@profoundlogic/coderflow-server 0.5.5 → 0.5.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/coder-server.js +1 -1
- package/dist/config.js +1 -1
- package/dist/lib/agent-keepalive.js +1 -1
- package/dist/lib/agent-models.js +1 -1
- package/dist/lib/api-keys.js +1 -1
- package/dist/lib/apiKeys.js +1 -1
- package/dist/lib/app-server-ports.js +1 -1
- package/dist/lib/auto-judge.js +1 -1
- package/dist/lib/automation-service.js +1 -1
- package/dist/lib/basic-auth.js +1 -1
- package/dist/lib/bindings.js +1 -1
- package/dist/lib/build-history.js +1 -1
- package/dist/lib/build-output-service.js +1 -1
- package/dist/lib/build-scheduler.js +1 -1
- package/dist/lib/build-service.js +1 -1
- package/dist/lib/ca-certificates.js +1 -1
- package/dist/lib/claude-oauth-refresh.js +1 -1
- package/dist/lib/cli/build.js +1 -1
- package/dist/lib/cli/cleanup-users.js +1 -1
- package/dist/lib/cli/config-command.js +1 -1
- package/dist/lib/cli/config.js +1 -1
- package/dist/lib/cli/create-user.js +1 -1
- package/dist/lib/cli/grant-admin.js +1 -1
- package/dist/lib/cli/init.js +1 -1
- package/dist/lib/cli/jira.js +1 -1
- package/dist/lib/cli/license.js +1 -1
- package/dist/lib/cli/list-roles.js +1 -1
- package/dist/lib/cli/list-users.js +1 -1
- package/dist/lib/cli/server-manager.js +1 -1
- package/dist/lib/cli/set-password.js +1 -1
- package/dist/lib/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/migration-to-scoped-rbac.js +1 -1
- package/dist/lib/model-fetcher.js +1 -1
- package/dist/lib/notifications.js +1 -1
- package/dist/lib/objective-context.js +1 -1
- package/dist/lib/oidc-auth.js +1 -1
- package/dist/lib/oidc-device-flow.js +1 -1
- package/dist/lib/passwordTokens.js +1 -1
- package/dist/lib/permission-resolver.js +1 -1
- package/dist/lib/pin-cascade.js +1 -1
- package/dist/lib/provider-accounts.js +1 -1
- package/dist/lib/provider-oauth.js +1 -1
- package/dist/lib/provider-profile.js +1 -1
- package/dist/lib/provider-token-refresh.js +1 -1
- package/dist/lib/rbac-user-state.js +1 -1
- package/dist/lib/request-url.js +1 -1
- package/dist/lib/rewind.js +1 -1
- package/dist/lib/role-definitions.js +1 -1
- package/dist/lib/roles.js +1 -1
- package/dist/lib/secrets.js +1 -1
- package/dist/lib/setup-repo-git-auth.js +1 -1
- package/dist/lib/state-capture.js +1 -1
- package/dist/lib/static-files.js +1 -1
- package/dist/lib/task-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/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/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/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/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/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/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/pr-dialog.js +1 -1
- package/dist/web-ui/public/roles.js +1 -1
- package/dist/web-ui/public/server-health.js +1 -1
- package/dist/web-ui/public/settings.js +1 -1
- package/dist/web-ui/public/setup-password.js +1 -1
- package/dist/web-ui/public/skills.js +1 -1
- package/dist/web-ui/public/sse-client.js +1 -1
- package/dist/web-ui/public/sse-shared-worker.js +1 -1
- package/dist/web-ui/public/task.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
|
-
import{initTheme,mountThemeToggle}from'./theme.js';const OIDC_ERRORS={'oidc_init_failed':'Failed\x20to\x20connect\x20to\x20the\x20identity\x20provider.\x20Please\x20try\x20again.','oidc_not_configured':'Single\x20sign-on\x20is\x20not\x20configured.\x20Please\x20use\x20local\x20login.','oidc_error':'Authentication\x20was\x20cancelled\x20or\x20failed.','oidc_invalid_callback':'Invalid\x20authentication\x20response.\x20Please\x20try\x20again.','oidc_no_email':'Your\x20identity\x20provider\x20did\x20not\x20provide\x20an\x20email\x20address.\x20Please\x20contact\x20your\x20administrator.','oidc_user_not_found':'Your\x20account\x20is\x20not\x20authorized\x20to\x20access\x20this\x20application.\x20Please\x20contact\x20your\x20administrator.','oidc_invalid_state':'Authentication\x20session\x20expired.\x20Please\x20try\x20again.','oidc_session_expired':'Authentication\x20session\x20expired.\x20Please\x20try\x20again.','oidc_callback_failed':'Authentication\x20failed.\x20Please\x20try\x20again.','session_failed':'Failed\x20to\x20create\x20session.\x20Please\x20try\x20again.'};async function loadOidcConfig(){try{const
|
|
1
|
+
import{initTheme,mountThemeToggle}from'./theme.js';const OIDC_ERRORS={'oidc_init_failed':'Failed\x20to\x20connect\x20to\x20the\x20identity\x20provider.\x20Please\x20try\x20again.','oidc_not_configured':'Single\x20sign-on\x20is\x20not\x20configured.\x20Please\x20use\x20local\x20login.','oidc_error':'Authentication\x20was\x20cancelled\x20or\x20failed.','oidc_invalid_callback':'Invalid\x20authentication\x20response.\x20Please\x20try\x20again.','oidc_no_email':'Your\x20identity\x20provider\x20did\x20not\x20provide\x20an\x20email\x20address.\x20Please\x20contact\x20your\x20administrator.','oidc_user_not_found':'Your\x20account\x20is\x20not\x20authorized\x20to\x20access\x20this\x20application.\x20Please\x20contact\x20your\x20administrator.','oidc_invalid_state':'Authentication\x20session\x20expired.\x20Please\x20try\x20again.','oidc_session_expired':'Authentication\x20session\x20expired.\x20Please\x20try\x20again.','oidc_callback_failed':'Authentication\x20failed.\x20Please\x20try\x20again.','session_failed':'Failed\x20to\x20create\x20session.\x20Please\x20try\x20again.'};async function loadOidcConfig(){try{const _0x172031=await fetch('/auth/oidc/config');if(_0x172031['ok'])return await _0x172031['json']();}catch(_0x593371){console['error']('Failed\x20to\x20load\x20OIDC\x20configuration:',_0x593371);}return{'enabled':![]};}function initializeSsoUi(_0x24ea66){const _0x485e68=document['getElementById']('sso-section'),_0x507198=document['getElementById']('sso-divider'),_0xa1943e=document['getElementById']('sso-button-text'),_0x3a680c=document['getElementById']('sso-button'),_0x369108=document['querySelector']('.local-auth-section');_0x24ea66['enabled']&&(_0x485e68['classList']['add']('visible'),_0xa1943e['textContent']=_0x24ea66['display_name']||'Sign\x20in\x20with\x20SSO',_0x3a680c['addEventListener']('click',()=>{window['location']['href']='/auth/oidc/login';}),!_0x24ea66['allow_local_auth']&&(_0x369108['classList']['add']('hidden'),_0x507198['style']['display']='none'));}function checkOidcErrors(){const _0x4d4826=new URLSearchParams(window['location']['search']),_0x4a47f0=_0x4d4826['get']('error'),_0x26e795=_0x4d4826['get']('message');if(_0x4a47f0){const _0x5cc63c=document['getElementById']('login-error'),_0x5a4169=_0x26e795||OIDC_ERRORS[_0x4a47f0]||'Authentication\x20error:\x20'+_0x4a47f0;_0x5cc63c['textContent']=_0x5a4169,_0x5cc63c['classList']['add']('visible'),window['history']['replaceState']({},document['title'],window['location']['pathname']);}}async function handleLogin(_0x3ec97a){_0x3ec97a['preventDefault']();const _0x516407=_0x3ec97a['target'],_0x4e539d=_0x516407['username']['value']['trim'](),_0x2cd7b8=_0x516407['password']['value'],_0x5a550d=_0x516407['querySelector']('button[type=\x22submit\x22]'),_0x3df54d=document['getElementById']('login-error');_0x3df54d['classList']['remove']('visible'),_0x3df54d['textContent']='',_0x5a550d['disabled']=!![],_0x5a550d['textContent']='Signing\x20in...';try{const _0x321f65=await fetch('/auth/login',{'method':'POST','headers':{'Content-Type':'application/json'},'body':JSON['stringify']({'username':_0x4e539d,'password':_0x2cd7b8})}),_0x1bb55c=await _0x321f65['json']();if(!_0x321f65['ok'])throw new Error(_0x1bb55c['message']||'Login\x20failed');window['location']['href']='index.html';}catch(_0xc67bbe){_0x3df54d['textContent']=_0xc67bbe['message']||'An\x20error\x20occurred\x20during\x20login',_0x3df54d['classList']['add']('visible'),_0x5a550d['disabled']=![],_0x5a550d['textContent']='Sign\x20In',_0x516407['password']['value']='',_0x516407['password']['focus']();}}document['addEventListener']('DOMContentLoaded',async()=>{initTheme(),mountThemeToggle(),checkOidcErrors();const _0x36f2a4=await loadOidcConfig();initializeSsoUi(_0x36f2a4);const _0x32aca9=document['getElementById']('login-form');_0x32aca9&&_0x32aca9['addEventListener']('submit',handleLogin);});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const ATTACHMENT_SCHEME='attachment:',INTERNAL_DRAG_MIME='application/x-profound-editor-image',LINK_DIALOG_STYLE_ID='markdown-editor-link-dialog-styles',ICONS={'bold':'<svg\x20viewBox=\x220\x200\x2024\x2024\x22\x20width=\x2216\x22\x20height=\x2216\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20fill=\x22none\x22\x20stroke-linecap=\x22round\x22\x20stroke-linejoin=\x22round\x22><path\x20d=\x22M6\x204h8a4\x204\x200\x200\x201\x204\x204\x204\x204\x200\x200\x201-4\x204H6z\x22></path><path\x20d=\x22M6\x2012h9a4\x204\x200\x200\x201\x204\x204\x204\x204\x200\x200\x201-4\x204H6z\x22></path></svg>','italic':'<svg\x20viewBox=\x220\x200\x2024\x2024\x22\x20width=\x2216\x22\x20height=\x2216\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20fill=\x22none\x22\x20stroke-linecap=\x22round\x22\x20stroke-linejoin=\x22round\x22><line\x20x1=\x2219\x22\x20y1=\x224\x22\x20x2=\x2210\x22\x20y2=\x224\x22></line><line\x20x1=\x2214\x22\x20y1=\x2220\x22\x20x2=\x225\x22\x20y2=\x2220\x22></line><line\x20x1=\x2215\x22\x20y1=\x224\x22\x20x2=\x229\x22\x20y2=\x2220\x22></line></svg>','strike':'<svg\x20viewBox=\x220\x200\x2024\x2024\x22\x20width=\x2216\x22\x20height=\x2216\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20fill=\x22none\x22\x20stroke-linecap=\x22round\x22\x20stroke-linejoin=\x22round\x22><line\x20x1=\x225\x22\x20y1=\x2212\x22\x20x2=\x2219\x22\x20y2=\x2212\x22></line><path\x20d=\x22M16\x206a4\x204\x200\x200\x200-4-4c-2.48\x200-4\x201.79-4\x204\x200\x201.25.5\x202.5\x201.5\x203\x22></path><path\x20d=\x22M9\x2018c0\x201.79\x201.79\x203\x204\x203\x202.48\x200\x204-1.79\x204-4\x200-1.25-.5-2.5-1.5-3\x22></path></svg>','link':'<svg\x20viewBox=\x220\x200\x2024\x2024\x22\x20width=\x2216\x22\x20height=\x2216\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20fill=\x22none\x22\x20stroke-linecap=\x22round\x22\x20stroke-linejoin=\x22round\x22><path\x20d=\x22M10\x2013a5\x205\x200\x200\x200\x207.54.54l3-3a5\x205\x200\x200\x200-7.07-7.07l-1.72\x201.71\x22></path><path\x20d=\x22M14\x2011a5\x205\x200\x200\x200-7.54-.54l-3\x203a5\x205\x200\x200\x200\x207.07\x207.07l1.71-1.71\x22></path></svg>','code':'<svg\x20viewBox=\x220\x200\x2024\x2024\x22\x20width=\x2216\x22\x20height=\x2216\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20fill=\x22none\x22\x20stroke-linecap=\x22round\x22\x20stroke-linejoin=\x22round\x22><polyline\x20points=\x2216\x2018\x2022\x2012\x2016\x206\x22></polyline><polyline\x20points=\x228\x206\x202\x2012\x208\x2018\x22></polyline></svg>','listBullet':'<svg\x20viewBox=\x220\x200\x2024\x2024\x22\x20width=\x2216\x22\x20height=\x2216\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20fill=\x22none\x22\x20stroke-linecap=\x22round\x22\x20stroke-linejoin=\x22round\x22><line\x20x1=\x228\x22\x20y1=\x226\x22\x20x2=\x2221\x22\x20y2=\x226\x22></line><line\x20x1=\x228\x22\x20y1=\x2212\x22\x20x2=\x2221\x22\x20y2=\x2212\x22></line><line\x20x1=\x228\x22\x20y1=\x2218\x22\x20x2=\x2221\x22\x20y2=\x2218\x22></line><line\x20x1=\x223\x22\x20y1=\x226\x22\x20x2=\x223.01\x22\x20y2=\x226\x22></line><line\x20x1=\x223\x22\x20y1=\x2212\x22\x20x2=\x223.01\x22\x20y2=\x2212\x22></line><line\x20x1=\x223\x22\x20y1=\x2218\x22\x20x2=\x223.01\x22\x20y2=\x2218\x22></line></svg>','listOrdered':'<svg\x20viewBox=\x220\x200\x2024\x2024\x22\x20width=\x2216\x22\x20height=\x2216\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20fill=\x22none\x22\x20stroke-linecap=\x22round\x22\x20stroke-linejoin=\x22round\x22><line\x20x1=\x2210\x22\x20y1=\x226\x22\x20x2=\x2221\x22\x20y2=\x226\x22></line><line\x20x1=\x2210\x22\x20y1=\x2212\x22\x20x2=\x2221\x22\x20y2=\x2212\x22></line><line\x20x1=\x2210\x22\x20y1=\x2218\x22\x20x2=\x2221\x22\x20y2=\x2218\x22></line><path\x20d=\x22M4\x206h1v4\x22></path><path\x20d=\x22M4\x2010h2\x22></path><path\x20d=\x22M6\x2018H4c0-1\x202-2\x202-3s-1-1.5-2-1\x22></path></svg>','blockquote':'<svg\x20viewBox=\x220\x200\x2024\x2024\x22\x20width=\x2216\x22\x20height=\x2216\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20fill=\x22none\x22\x20stroke-linecap=\x22round\x22\x20stroke-linejoin=\x22round\x22><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></svg>','codeBlock':'<svg\x20viewBox=\x220\x200\x2024\x2024\x22\x20width=\x2216\x22\x20height=\x2216\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20fill=\x22none\x22\x20stroke-linecap=\x22round\x22\x20stroke-linejoin=\x22round\x22><rect\x20x=\x223\x22\x20y=\x223\x22\x20width=\x2218\x22\x20height=\x2218\x22\x20rx=\x222\x22\x20ry=\x222\x22></rect><polyline\x20points=\x229\x208\x205\x2012\x209\x2016\x22></polyline><polyline\x20points=\x2215\x208\x2019\x2012\x2015\x2016\x22></polyline></svg>','header':'<svg\x20viewBox=\x220\x200\x2024\x2024\x22\x20width=\x2216\x22\x20height=\x2216\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20fill=\x22none\x22\x20stroke-linecap=\x22round\x22\x20stroke-linejoin=\x22round\x22><path\x20d=\x22M4\x2012h8\x22></path><path\x20d=\x22M4\x2018V6\x22></path><path\x20d=\x22M12\x2018V6\x22></path><path\x20d=\x22M17\x2012l3-2v8\x22></path></svg>','color':'<svg\x20viewBox=\x220\x200\x2024\x2024\x22\x20width=\x2216\x22\x20height=\x2216\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20fill=\x22none\x22\x20stroke-linecap=\x22round\x22\x20stroke-linejoin=\x22round\x22><path\x20d=\x22M4\x2020h16\x22></path><path\x20d=\x22M6\x2016l6-14\x206\x2014\x22></path><path\x20d=\x22M8\x2012h8\x22></path></svg>'},LINK_DIALOG_STYLES='\x0a.markdown-editor-link-modal\x20{\x0a\x20\x20position:\x20fixed;\x0a\x20\x20inset:\x200;\x0a\x20\x20display:\x20flex;\x0a\x20\x20align-items:\x20center;\x0a\x20\x20justify-content:\x20center;\x0a\x20\x20z-index:\x2010020;\x0a}\x0a\x0a.markdown-editor-link-modal[hidden]\x20{\x0a\x20\x20display:\x20none\x20!important;\x0a}\x0a\x0a.markdown-editor-link-backdrop\x20{\x0a\x20\x20position:\x20absolute;\x0a\x20\x20inset:\x200;\x0a\x20\x20background:\x20rgba(15,\x2023,\x2042,\x200.45);\x0a}\x0a\x0a.markdown-editor-link-dialog\x20{\x0a\x20\x20position:\x20relative;\x0a\x20\x20width:\x20min(460px,\x20calc(100vw\x20-\x2024px));\x0a\x20\x20background:\x20var(--color-surface,\x20var(--feedback-surface,\x20#ffffff));\x0a\x20\x20color:\x20var(--color-text,\x20var(--feedback-text,\x20#111827));\x0a\x20\x20border:\x201px\x20solid\x20var(--color-border,\x20var(--feedback-border,\x20#d1d5db));\x0a\x20\x20border-radius:\x20var(--radius-medium,\x2010px);\x0a\x20\x20box-shadow:\x200\x2018px\x2042px\x20rgba(15,\x2023,\x2042,\x200.25);\x0a\x20\x20padding:\x2014px;\x0a\x20\x20display:\x20flex;\x0a\x20\x20flex-direction:\x20column;\x0a\x20\x20gap:\x2012px;\x0a}\x0a\x0a.markdown-editor-link-header\x20{\x0a\x20\x20display:\x20flex;\x0a\x20\x20align-items:\x20center;\x0a\x20\x20justify-content:\x20space-between;\x0a\x20\x20gap:\x208px;\x0a}\x0a\x0a.markdown-editor-link-title\x20{\x0a\x20\x20margin:\x200;\x0a\x20\x20font-size:\x2016px;\x0a\x20\x20font-weight:\x20600;\x0a}\x0a\x0a.markdown-editor-link-close\x20{\x0a\x20\x20width:\x2028px;\x0a\x20\x20height:\x2028px;\x0a\x20\x20border:\x20none;\x0a\x20\x20border-radius:\x20var(--radius-small,\x208px);\x0a\x20\x20background:\x20transparent;\x0a\x20\x20color:\x20var(--color-text-muted,\x20var(--feedback-text-muted,\x20#6b7280));\x0a\x20\x20font-size:\x2020px;\x0a\x20\x20line-height:\x201;\x0a\x20\x20cursor:\x20pointer;\x0a}\x0a\x0a.markdown-editor-link-close:hover\x20{\x0a\x20\x20background:\x20var(--color-surface-muted,\x20var(--feedback-surface-muted,\x20#f3f4f6));\x0a\x20\x20color:\x20var(--color-text,\x20var(--feedback-text,\x20#111827));\x0a}\x0a\x0a.markdown-editor-link-form\x20{\x0a\x20\x20display:\x20flex;\x0a\x20\x20flex-direction:\x20column;\x0a\x20\x20gap:\x2010px;\x0a}\x0a\x0a.markdown-editor-link-field-grid\x20{\x0a\x20\x20display:\x20grid;\x0a\x20\x20gap:\x2010px;\x0a}\x0a\x0a.markdown-editor-link-label\x20{\x0a\x20\x20display:\x20flex;\x0a\x20\x20flex-direction:\x20column;\x0a\x20\x20gap:\x206px;\x0a\x20\x20font-size:\x2012px;\x0a\x20\x20font-weight:\x20600;\x0a\x20\x20color:\x20var(--color-text-muted,\x20var(--feedback-text-muted,\x20#4b5563));\x0a}\x0a\x0a.markdown-editor-link-input\x20{\x0a\x20\x20width:\x20100%;\x0a\x20\x20padding:\x209px\x2010px;\x0a\x20\x20border:\x201px\x20solid\x20var(--color-border,\x20var(--feedback-border,\x20#d1d5db));\x0a\x20\x20border-radius:\x20var(--radius-small,\x208px);\x0a\x20\x20background:\x20var(--color-surface,\x20var(--feedback-surface,\x20#ffffff));\x0a\x20\x20color:\x20var(--color-text,\x20var(--feedback-text,\x20#111827));\x0a\x20\x20font-size:\x2014px;\x0a}\x0a\x0a.markdown-editor-link-input:focus\x20{\x0a\x20\x20outline:\x20none;\x0a\x20\x20border-color:\x20var(--color-primary,\x20#3f72ff);\x0a\x20\x20box-shadow:\x200\x200\x200\x203px\x20rgba(63,\x20114,\x20255,\x200.2);\x0a}\x0a\x0a.markdown-editor-link-actions\x20{\x0a\x20\x20display:\x20flex;\x0a\x20\x20justify-content:\x20flex-end;\x0a\x20\x20gap:\x208px;\x0a}\x0a\x0a.markdown-editor-link-btn\x20{\x0a\x20\x20border:\x201px\x20solid\x20transparent;\x0a\x20\x20border-radius:\x20var(--radius-small,\x208px);\x0a\x20\x20padding:\x207px\x2012px;\x0a\x20\x20font-size:\x2013px;\x0a\x20\x20font-weight:\x20600;\x0a\x20\x20cursor:\x20pointer;\x0a}\x0a\x0a.markdown-editor-link-btn-secondary\x20{\x0a\x20\x20background:\x20var(--color-surface-muted,\x20var(--feedback-surface-muted,\x20#f3f4f6));\x0a\x20\x20color:\x20var(--color-text,\x20var(--feedback-text,\x20#111827));\x0a\x20\x20border-color:\x20var(--color-border,\x20var(--feedback-border,\x20#d1d5db));\x0a}\x0a\x0a.markdown-editor-link-btn-secondary:hover\x20{\x0a\x20\x20background:\x20var(--color-bg-secondary,\x20var(--feedback-surface-hover,\x20#e5e7eb));\x0a}\x0a\x0a.markdown-editor-link-btn-danger\x20{\x0a\x20\x20background:\x20transparent;\x0a\x20\x20color:\x20var(--color-danger,\x20#dc2626);\x0a\x20\x20border-color:\x20rgba(220,\x2038,\x2038,\x200.35);\x0a}\x0a\x0a.markdown-editor-link-btn-danger:hover\x20{\x0a\x20\x20background:\x20rgba(220,\x2038,\x2038,\x200.08);\x0a}\x0a\x0a.markdown-editor-link-btn-primary\x20{\x0a\x20\x20background:\x20var(--color-primary,\x20#3f72ff);\x0a\x20\x20color:\x20#ffffff;\x0a}\x0a\x0a.markdown-editor-link-btn-primary:hover\x20{\x0a\x20\x20background:\x20var(--color-accent,\x20#2563eb);\x0a}\x0a\x0a[data-theme=\x22dark\x22]\x20.markdown-editor-link-backdrop\x20{\x0a\x20\x20background:\x20rgba(2,\x206,\x2023,\x200.65);\x0a}\x0a\x0a[data-theme=\x22dark\x22]\x20.markdown-editor-link-dialog\x20{\x0a\x20\x20box-shadow:\x200\x2018px\x2042px\x20rgba(0,\x200,\x200,\x200.5);\x0a}\x0a\x0a@media\x20(max-width:\x20480px)\x20{\x0a\x20\x20.markdown-editor-link-dialog\x20{\x0a\x20\x20\x20\x20width:\x20calc(100vw\x20-\x2016px);\x0a\x20\x20\x20\x20padding:\x2012px;\x0a\x20\x20}\x0a\x0a\x20\x20.markdown-editor-link-actions\x20{\x0a\x20\x20\x20\x20flex-wrap:\x20wrap;\x0a\x20\x20}\x0a\x0a\x20\x20.markdown-editor-link-btn\x20{\x0a\x20\x20\x20\x20flex:\x201\x201\x20calc(50%\x20-\x206px);\x0a\x20\x20\x20\x20text-align:\x20center;\x0a\x20\x20}\x0a}\x0a';export class MarkdownEditor{constructor(_0x9f4123,_0x27ed93={}){this['element']=_0x9f4123,this['options']={'placeholder':_0x27ed93['placeholder']||'Start\x20typing...','editable':_0x27ed93['editable']!==![],'onChange':_0x27ed93['onChange']||null,'minHeight':_0x27ed93['minHeight']||'100px','toolbar':_0x27ed93['toolbar']||![],'onAddAttachments':_0x27ed93['onAddAttachments']||null,'resolveAttachmentUrl':_0x27ed93['resolveAttachmentUrl']||null,'isAttachmentNameTaken':_0x27ed93['isAttachmentNameTaken']||null,'fetchUsers':_0x27ed93['fetchUsers']||null},this['mentionState']={'active':![],'query':'','startOffset':0x0,'startNode':null,'users':[],'filteredUsers':[],'selectedIndex':0x0},this['mentionDropdown']=null,this['usersCache']=null,this['linkDialog']=null,this['linkDialogContext']=null;const _0x27209a=window['TurndownService'];this['turndownService']=new _0x27209a({'headingStyle':'atx','codeBlockStyle':'fenced','emDelimiter':'_','bulletListMarker':'-'}),this['attachmentObjectUrls']=new Map(),this['registerTurndownRules'](),this['init']();}['registerTurndownRules'](){this['turndownService']['addRule']('profoundAttachmentImage',{'filter':_0x3eb554=>{return _0x3eb554&&_0x3eb554['nodeName']==='IMG'&&_0x3eb554['getAttribute']&&_0x3eb554['getAttribute']('data-attachment-name');},'replacement':(_0x5a416b,_0x51dbae)=>{const _0xf1ee15=_0x51dbae['getAttribute']('data-attachment-name')||'',_0x130ac0=_0x51dbae['getAttribute']('alt')||'',_0x49a280=_0xf1ee15['trim'](),_0x4d0894=this['escapeAltText'](_0x130ac0||_0x49a280),_0x57afbe=encodeURIComponent(_0x49a280);return'';}}),this['turndownService']['addRule']('profoundMention',{'filter':_0x7f4a62=>{return _0x7f4a62&&_0x7f4a62['nodeName']==='SPAN'&&_0x7f4a62['getAttribute']&&_0x7f4a62['getAttribute']('data-mention-user-id');},'replacement':(_0x16d670,_0x4acfb8)=>{const _0x15204e=_0x4acfb8['getAttribute']('data-mention-user-id')||'',_0x42d145=_0x4acfb8['textContent']||'',_0x48d504=_0x42d145['startsWith']('@')?_0x42d145['slice'](0x1):_0x42d145;return'['+_0x48d504+'](mention:'+_0x15204e+')';}}),this['turndownService']['addRule']('profoundColoredText',{'filter':_0x12019a=>{if(!_0x12019a)return![];if(_0x12019a['nodeName']==='FONT'&&_0x12019a['getAttribute']&&_0x12019a['getAttribute']('color'))return!![];if(_0x12019a['nodeName']==='SPAN'&&_0x12019a['style']&&_0x12019a['style']['color']){if(_0x12019a['getAttribute']&&_0x12019a['getAttribute']('data-mention-user-id'))return![];return!![];}return![];},'replacement':(_0x496a1e,_0x5d87b)=>{if(!_0x496a1e['trim']())return _0x496a1e;let _0x42a01c='';if(_0x5d87b['nodeName']==='FONT')_0x42a01c=_0x5d87b['getAttribute']('color')||'';else _0x5d87b['style']&&_0x5d87b['style']['color']&&(_0x42a01c=this['rgbToHex'](_0x5d87b['style']['color']));if(!_0x42a01c)return _0x496a1e;return'{color:'+_0x42a01c+'}'+_0x496a1e+'{/color}';}});}['rgbToHex'](_0x5607da){if(!_0x5607da)return'';if(_0x5607da['startsWith']('#'))return _0x5607da;const _0x56cf7d=_0x5607da['match'](/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i);if(!_0x56cf7d)return _0x5607da;const _0x11136e=parseInt(_0x56cf7d[0x1],0xa),_0x578264=parseInt(_0x56cf7d[0x2],0xa),_0x2ca26d=parseInt(_0x56cf7d[0x3],0xa);return'#'+[_0x11136e,_0x578264,_0x2ca26d]['map'](_0x3b735d=>_0x3b735d['toString'](0x10)['padStart'](0x2,'0'))['join']('')['toUpperCase']();}['escapeAltText'](_0x12d6ca){return String(_0x12d6ca||'')['replace'](/\]/g,'\x5c]');}['init'](){this['editor']=document['createElement']('div'),this['editor']['className']='markdown-editor',this['editor']['contentEditable']=this['options']['editable'],this['editor']['setAttribute']('role','textbox'),this['editor']['setAttribute']('aria-multiline','true'),this['editor']['style']['minHeight']=this['options']['minHeight'];this['options']['placeholder']&&this['editor']['setAttribute']('data-placeholder',this['options']['placeholder']);this['options']['toolbar']?(this['container']=document['createElement']('div'),this['container']['className']='markdown-editor-wrapper',this['container']['style']['display']='flex',this['container']['style']['flexDirection']='column',this['createToolbar'](),this['container']['appendChild'](this['toolbar']),this['container']['appendChild'](this['editor']),this['element']['parentNode']['insertBefore'](this['container'],this['element'])):this['element']['parentNode']['insertBefore'](this['editor'],this['element']);this['element']['style']['display']='none',this['isMac']=navigator['platform']['toUpperCase']()['indexOf']('MAC')>=0x0,this['linkHintText']=this['isMac']?'⌘+click\x20to\x20follow':'Ctrl+click\x20to\x20follow';this['options']['editable']&&this['bindEvents']();const _0x5a1524=this['element']['textContent']||this['element']['value']||'';_0x5a1524['trim']()&&this['setMarkdown'](_0x5a1524);}['createToolbar'](){this['toolbar']=document['createElement']('div'),this['toolbar']['className']='markdown-editor-toolbar',this['toolbarButtons']={};const _0x2e55cd=[{'id':'header','icon':ICONS['header'],'title':'Heading','action':'header','isDropdown':!![]},{'separator':!![]},{'id':'bold','icon':ICONS['bold'],'title':'Bold\x20(Ctrl+B)','action':'bold','command':'bold'},{'id':'italic','icon':ICONS['italic'],'title':'Italic\x20(Ctrl+I)','action':'italic','command':'italic'},{'id':'strike','icon':ICONS['strike'],'title':'Strikethrough','action':'strikeThrough','command':'strikeThrough'},{'id':'color','icon':ICONS['color'],'title':'Text\x20Color','action':'color','isDropdown':!![]},{'separator':!![]},{'id':'link','icon':ICONS['link'],'title':'Link\x20(Ctrl+K)','action':'link','tagName':'A'},{'id':'code','icon':ICONS['code'],'title':'Inline\x20Code','action':'code','tagName':'CODE'},{'id':'codeBlock','icon':ICONS['codeBlock'],'title':'Code\x20Block','action':'codeBlock','tagName':'PRE'},{'separator':!![]},{'id':'list-bullet','icon':ICONS['listBullet'],'title':'Bullet\x20List','action':'insertUnorderedList','command':'insertUnorderedList'},{'id':'list-ordered','icon':ICONS['listOrdered'],'title':'Numbered\x20List','action':'insertOrderedList','command':'insertOrderedList'}];_0x2e55cd['forEach'](_0x431469=>{if(_0x431469['separator']){const _0x4e7983=document['createElement']('div');_0x4e7983['className']='markdown-toolbar-separator',_0x4e7983['style']['width']='1px',_0x4e7983['style']['height']='16px',_0x4e7983['style']['background']='var(--color-border)',_0x4e7983['style']['margin']='0\x206px',_0x4e7983['style']['alignSelf']='center',this['toolbar']['appendChild'](_0x4e7983);}else{if(_0x431469['isDropdown']){const _0x2179e5=document['createElement']('div');_0x2179e5['className']='markdown-toolbar-dropdown',_0x2179e5['style']['position']='relative';const _0x305cb9=document['createElement']('button');_0x305cb9['type']='button',_0x305cb9['className']='markdown-editor-toolbar-btn\x20markdown-toolbar-dropdown-btn',_0x305cb9['tabIndex']=-0x1,_0x305cb9['innerHTML']=_0x431469['icon']+'<svg\x20class=\x22dropdown-arrow\x22\x20viewBox=\x220\x200\x2024\x2024\x22\x20width=\x2210\x22\x20height=\x2210\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20fill=\x22none\x22><polyline\x20points=\x226\x209\x2012\x2015\x2018\x209\x22></polyline></svg>',_0x305cb9['title']=_0x431469['title'],_0x305cb9['dataset']['action']=_0x431469['action'];const _0x2d06d8=document['createElement']('div');_0x2d06d8['className']='markdown-toolbar-dropdown-menu',_0x2d06d8['style']['display']='none';if(_0x431469['action']==='header')this['createHeaderDropdown'](_0x2d06d8);else _0x431469['action']==='color'&&this['createColorDropdown'](_0x2d06d8);_0x305cb9['addEventListener']('click',_0x2a0c5f=>{_0x2a0c5f['preventDefault'](),_0x2a0c5f['stopPropagation'](),this['toggleDropdown'](_0x2d06d8,_0x305cb9);}),_0x2179e5['appendChild'](_0x305cb9),_0x2179e5['appendChild'](_0x2d06d8),this['toolbar']['appendChild'](_0x2179e5),this['toolbarButtons'][_0x431469['id']]={'button':_0x305cb9,'dropdown':_0x2d06d8,'command':_0x431469['command'],'tagName':_0x431469['tagName']};}else{const _0x1bc7c6=document['createElement']('button');_0x1bc7c6['type']='button',_0x1bc7c6['className']='markdown-editor-toolbar-btn',_0x1bc7c6['tabIndex']=-0x1,_0x1bc7c6['innerHTML']=_0x431469['icon'],_0x1bc7c6['title']=_0x431469['title'],_0x1bc7c6['dataset']['action']=_0x431469['action'],_0x1bc7c6['addEventListener']('click',_0x2690a6=>{_0x2690a6['preventDefault'](),this['handleToolbarAction'](_0x431469['action']);}),this['toolbar']['appendChild'](_0x1bc7c6),this['toolbarButtons'][_0x431469['id']]={'button':_0x1bc7c6,'command':_0x431469['command'],'tagName':_0x431469['tagName']};}}}),document['addEventListener']('click',_0x57a0ed=>{!this['toolbar']['contains'](_0x57a0ed['target'])&&this['closeAllDropdowns']();});}['createHeaderDropdown'](_0x564149){const _0x3c4142=[{'level':0x1,'label':'Heading\x201','tag':'H1'},{'level':0x2,'label':'Heading\x202','tag':'H2'},{'level':0x3,'label':'Heading\x203','tag':'H3'},{'level':0x4,'label':'Heading\x204','tag':'H4'},{'level':0x0,'label':'Normal\x20Text','tag':'P'}];_0x3c4142['forEach'](_0xfa940d=>{const _0x21b071=document['createElement']('button');_0x21b071['type']='button',_0x21b071['className']='markdown-dropdown-item',_0x21b071['tabIndex']=-0x1,_0x21b071['innerHTML']='<span\x20style=\x22font-size:\x20'+(_0xfa940d['level']===0x0?'14px':0x14-_0xfa940d['level']*0x2+'px')+';\x20font-weight:\x20'+(_0xfa940d['level']===0x0?'normal':'bold')+'\x22>'+_0xfa940d['label']+'</span>',_0x21b071['addEventListener']('click',_0x766372=>{_0x766372['preventDefault'](),_0x766372['stopPropagation'](),this['applyHeader'](_0xfa940d['level']),this['closeAllDropdowns']();}),_0x564149['appendChild'](_0x21b071);});}['createColorDropdown'](_0x515d2d){const _0x4d5ba2=[{'value':'#000000','label':'Black'},{'value':'#374151','label':'Gray'},{'value':'#DC2626','label':'Red'},{'value':'#EA580C','label':'Orange'},{'value':'#CA8A04','label':'Yellow'},{'value':'#16A34A','label':'Green'},{'value':'#2563EB','label':'Blue'},{'value':'#7C3AED','label':'Purple'},{'value':'#DB2777','label':'Pink'}],_0x29789c=document['createElement']('div');_0x29789c['className']='markdown-color-grid',_0x29789c['style']['display']='grid',_0x29789c['style']['gridTemplateColumns']='repeat(3,\x201fr)',_0x29789c['style']['gap']='4px',_0x29789c['style']['padding']='8px',_0x4d5ba2['forEach'](_0x327b72=>{const _0x43583c=document['createElement']('button');_0x43583c['type']='button',_0x43583c['className']='markdown-color-btn',_0x43583c['tabIndex']=-0x1,_0x43583c['style']['width']='24px',_0x43583c['style']['height']='24px',_0x43583c['style']['backgroundColor']=_0x327b72['value'],_0x43583c['style']['border']='1px\x20solid\x20var(--color-border)',_0x43583c['style']['borderRadius']='4px',_0x43583c['style']['cursor']='pointer',_0x43583c['title']=_0x327b72['label'],_0x43583c['addEventListener']('click',_0x2c33c6=>{_0x2c33c6['preventDefault'](),_0x2c33c6['stopPropagation'](),this['applyColor'](_0x327b72['value']),this['closeAllDropdowns']();}),_0x29789c['appendChild'](_0x43583c);}),_0x515d2d['appendChild'](_0x29789c);const _0xb9c466=document['createElement']('button');_0xb9c466['type']='button',_0xb9c466['className']='markdown-dropdown-item',_0xb9c466['innerHTML']='<span>Remove\x20Color</span>',_0xb9c466['style']['borderTop']='1px\x20solid\x20var(--color-border)',_0xb9c466['style']['marginTop']='4px',_0xb9c466['style']['paddingTop']='8px',_0xb9c466['addEventListener']('click',_0x53c754=>{_0x53c754['preventDefault'](),_0x53c754['stopPropagation'](),this['removeColor'](),this['closeAllDropdowns']();}),_0x515d2d['appendChild'](_0xb9c466);}['toggleDropdown'](_0x4dcf65,_0x596053){const _0x5a9cc2=_0x4dcf65['style']['display']!=='none';this['toolbar']&&this['closeAllDropdowns'](),!_0x5a9cc2&&(_0x4dcf65['style']['display']='block',_0x596053['classList']['add']('active'));}['closeAllDropdowns'](){const _0x35afcd=this['toolbar']['querySelectorAll']('.markdown-toolbar-dropdown-menu');_0x35afcd['forEach'](_0x5bd8c8=>_0x5bd8c8['style']['display']='none');const _0x4961f0=this['toolbar']['querySelectorAll']('.markdown-toolbar-dropdown-btn');_0x4961f0['forEach'](_0x48bb47=>_0x48bb47['classList']['remove']('active'));}['applyHeader'](_0xe8661b){this['editor']['focus']();const _0xafea58=window['getSelection']();if(!_0xafea58||_0xafea58['rangeCount']===0x0)return;const _0x5312d9=_0xafea58['getRangeAt'](0x0);let _0x2d80b1=_0x5312d9['startContainer'];while(_0x2d80b1&&_0x2d80b1!==this['editor']){if(_0x2d80b1['nodeType']===Node['ELEMENT_NODE']){const _0x3182cd=window['getComputedStyle'](_0x2d80b1)['display'];if(_0x3182cd==='block'||['P','H1','H2','H3','H4','H5','H6','DIV']['includes'](_0x2d80b1['tagName']))break;}_0x2d80b1=_0x2d80b1['parentNode'];}_0xe8661b===0x0?document['execCommand']('formatBlock',![],'p'):document['execCommand']('formatBlock',![],'h'+_0xe8661b),this['editor']['dispatchEvent'](new Event('input'));}['applyColor'](_0xe7f9be){this['editor']['focus'](),document['execCommand']('foreColor',![],_0xe7f9be),this['editor']['dispatchEvent'](new Event('input'));}['removeColor'](){this['editor']['focus'](),document['execCommand']('removeFormat',![],null),this['editor']['dispatchEvent'](new Event('input'));}['handleToolbarAction'](_0x382687){this['editor']['focus']();switch(_0x382687){case'bold':case'italic':case'strikeThrough':case'insertUnorderedList':case'insertOrderedList':document['execCommand'](_0x382687,![],null);break;case'link':this['openLinkDialog']();return;case'code':this['toggleInlineCode']();break;case'codeBlock':this['insertCodeBlock']();break;}this['updateToolbarState'](),this['editor']['dispatchEvent'](new Event('input'));}['ensureLinkDialog'](){if(this['linkDialog'])return;this['ensureLinkDialogStyles']();const _0xb3abe9=document['createElement']('div');_0xb3abe9['className']='markdown-editor-link-modal',_0xb3abe9['hidden']=!![],_0xb3abe9['innerHTML']='\x0a\x20\x20\x20\x20\x20\x20<div\x20class=\x22markdown-editor-link-backdrop\x22></div>\x0a\x20\x20\x20\x20\x20\x20<div\x20class=\x22markdown-editor-link-dialog\x22\x20role=\x22dialog\x22\x20aria-modal=\x22true\x22\x20aria-label=\x22Edit\x20link\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22markdown-editor-link-header\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<h3\x20class=\x22markdown-editor-link-title\x22>Insert\x20Link</h3>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<button\x20type=\x22button\x22\x20class=\x22markdown-editor-link-close\x22\x20aria-label=\x22Close\x22>×</button>\x0a\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20<form\x20class=\x22markdown-editor-link-form\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22markdown-editor-link-field-grid\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<label\x20class=\x22markdown-editor-link-label\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20URL\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<input\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20class=\x22markdown-editor-link-input\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20data-link-field=\x22url\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20type=\x22text\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20placeholder=\x22https://example.com\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20autocomplete=\x22off\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20spellcheck=\x22false\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20>\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=\x22markdown-editor-link-label\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Display\x20text\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<input\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20class=\x22markdown-editor-link-input\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20data-link-field=\x22text\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20type=\x22text\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20placeholder=\x22Text\x20shown\x20to\x20readers\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20autocomplete=\x22off\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20spellcheck=\x22false\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20>\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=\x22markdown-editor-link-actions\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<button\x20type=\x22button\x22\x20class=\x22markdown-editor-link-btn\x20markdown-editor-link-btn-secondary\x22\x20data-action=\x22cancel\x22>Cancel</button>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<button\x20type=\x22button\x22\x20class=\x22markdown-editor-link-btn\x20markdown-editor-link-btn-danger\x22\x20data-action=\x22remove\x22\x20hidden>Remove\x20Link</button>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<button\x20type=\x22submit\x22\x20class=\x22markdown-editor-link-btn\x20markdown-editor-link-btn-primary\x22>Insert\x20Link</button>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20</form>\x0a\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20',document['body']['appendChild'](_0xb3abe9),this['linkDialog']=_0xb3abe9,this['linkDialogElements']={'backdrop':_0xb3abe9['querySelector']('.markdown-editor-link-backdrop'),'title':_0xb3abe9['querySelector']('.markdown-editor-link-title'),'close':_0xb3abe9['querySelector']('.markdown-editor-link-close'),'form':_0xb3abe9['querySelector']('.markdown-editor-link-form'),'urlInput':_0xb3abe9['querySelector']('[data-link-field=\x22url\x22]'),'textInput':_0xb3abe9['querySelector']('[data-link-field=\x22text\x22]'),'remove':_0xb3abe9['querySelector']('[data-action=\x22remove\x22]'),'cancel':_0xb3abe9['querySelector']('[data-action=\x22cancel\x22]'),'submit':_0xb3abe9['querySelector']('.markdown-editor-link-btn-primary')},this['linkDialogElements']['backdrop']['addEventListener']('click',()=>{this['closeLinkDialog']({'restoreSelection':!![]});}),this['linkDialogElements']['close']['addEventListener']('click',()=>{this['closeLinkDialog']({'restoreSelection':!![]});}),this['linkDialogElements']['cancel']['addEventListener']('click',()=>{this['closeLinkDialog']({'restoreSelection':!![]});}),this['linkDialogElements']['remove']['addEventListener']('click',()=>{this['applyLinkDialogResult']({'remove':!![]});}),this['linkDialogElements']['form']['addEventListener']('submit',_0x3b0c3f=>{_0x3b0c3f['preventDefault'](),this['applyLinkDialogResult']();}),this['linkDialog']['addEventListener']('keydown',_0x562a13=>{_0x562a13['key']==='Escape'&&(_0x562a13['preventDefault'](),this['closeLinkDialog']({'restoreSelection':!![]}));});}['openLinkDialog'](){const _0x562593=window['getSelection']();if(!_0x562593||_0x562593['rangeCount']===0x0)return;const _0x3fe848=_0x562593['getRangeAt'](0x0),_0x548c26=this['editor']['contains'](_0x3fe848['commonAncestorContainer'])||this['editor']===_0x3fe848['commonAncestorContainer'];if(!_0x548c26)return;this['toolbar']&&this['closeAllDropdowns']();this['ensureLinkDialog']();const _0x210f00=_0x3fe848['cloneRange'](),_0x4f17f0=this['findLinkAtRange'](_0x210f00),_0x40780f=_0x4f17f0?_0x4f17f0['getAttribute']('href')||'':'',_0x4822c5=_0x4f17f0?_0x4f17f0['textContent']||'':_0x210f00['toString']();this['linkDialogContext']={'range':_0x210f00,'existingLink':_0x4f17f0,'selectedText':_0x4822c5},this['linkDialogElements']['title']['textContent']=_0x4f17f0?'Edit\x20Link':'Insert\x20Link',this['linkDialogElements']['submit']['textContent']=_0x4f17f0?'Save\x20Link':'Insert\x20Link',this['linkDialogElements']['remove']['hidden']=!_0x4f17f0,this['linkDialogElements']['urlInput']['value']=_0x40780f,this['linkDialogElements']['textInput']['value']=_0x4822c5,this['linkDialog']['hidden']=![],this['linkDialogElements']['urlInput']['focus'](),this['linkDialogElements']['urlInput']['select']();}['closeLinkDialog']({restoreSelection:restoreSelection=![]}={}){if(!this['linkDialog'])return;const _0x55d72c=this['linkDialogContext'];this['linkDialog']['hidden']=!![],restoreSelection&&_0x55d72c?.['range']&&(this['editor']['focus'](),this['restoreRange'](_0x55d72c['range'])),this['linkDialogContext']=null;}['applyLinkDialogResult']({remove:remove=![]}={}){if(!this['linkDialog']||!this['linkDialogContext'])return;const _0x253c5f=this['linkDialogContext'],_0x3839b1=(this['linkDialogElements']['urlInput']['value']||'')['trim'](),_0x38a990=this['linkDialogElements']['textInput']['value']||'',_0x1635ae=_0x38a990['trim']();if(!remove&&!_0x3839b1){this['linkDialogElements']['urlInput']['focus']();return;}this['closeLinkDialog'](),this['editor']['focus'](),this['restoreRange'](_0x253c5f['range']);if(remove)_0x253c5f['existingLink']&&_0x253c5f['existingLink']['parentNode']?this['unwrapLinkElement'](_0x253c5f['existingLink']):document['execCommand']('unlink',![],null);else{if(_0x253c5f['existingLink']&&_0x253c5f['existingLink']['parentNode'])_0x253c5f['existingLink']['setAttribute']('href',_0x3839b1),_0x253c5f['existingLink']['textContent']=_0x1635ae||_0x3839b1;else{const _0x1d3815=window['getSelection']();if(!_0x1d3815||_0x1d3815['rangeCount']===0x0)return;const _0x1252c3=_0x1d3815['getRangeAt'](0x0),_0x4da38e=(_0x253c5f['selectedText']||'')['trim'](),_0x1e2496=_0x1635ae||_0x4da38e||_0x3839b1;_0x1252c3['deleteContents']();const _0x58dab4=document['createElement']('a');_0x58dab4['href']=_0x3839b1,_0x58dab4['textContent']=_0x1e2496,_0x1252c3['insertNode'](_0x58dab4),_0x1252c3['setStartAfter'](_0x58dab4),_0x1252c3['collapse'](!![]),_0x1d3815['removeAllRanges'](),_0x1d3815['addRange'](_0x1252c3);}}this['addLinkHints'](),this['updateToolbarState'](),this['editor']['dispatchEvent'](new Event('input'));}['ensureLinkDialogStyles'](){if(document['getElementById'](LINK_DIALOG_STYLE_ID))return;const _0x4e13ea=document['createElement']('style');_0x4e13ea['id']=LINK_DIALOG_STYLE_ID,_0x4e13ea['textContent']=LINK_DIALOG_STYLES,document['head']['appendChild'](_0x4e13ea);}['restoreRange'](_0x504baf){const _0x468c42=window['getSelection']();if(!_0x468c42)return;try{_0x468c42['removeAllRanges'](),_0x468c42['addRange'](_0x504baf);return;}catch(_0xf772bc){}const _0x55ec79=document['createRange']();_0x55ec79['selectNodeContents'](this['editor']),_0x55ec79['collapse'](![]),_0x468c42['removeAllRanges'](),_0x468c42['addRange'](_0x55ec79);}['findLinkAtRange'](_0x1f9049){if(!_0x1f9049)return null;const _0x2551aa=this['findParentLink'](_0x1f9049['startContainer']);if(_0x1f9049['collapsed'])return _0x2551aa;const _0x287472=this['findParentLink'](_0x1f9049['endContainer']);if(_0x2551aa&&_0x2551aa===_0x287472)return _0x2551aa;if(_0x2551aa&&_0x2551aa['contains'](_0x1f9049['endContainer']))return _0x2551aa;if(_0x287472&&_0x287472['contains'](_0x1f9049['startContainer']))return _0x287472;return null;}['findParentLink'](_0x344107){let _0x24a8a6=_0x344107;while(_0x24a8a6&&_0x24a8a6!==this['editor']){if(_0x24a8a6['nodeType']===Node['ELEMENT_NODE']&&_0x24a8a6['tagName']==='A'){const _0x2460b9=_0x24a8a6['getAttribute']('href')||'';if(_0x2460b9['startsWith']('mention:'))return null;return _0x24a8a6;}_0x24a8a6=_0x24a8a6['parentNode'];}return null;}['unwrapLinkElement'](_0x234482){const _0x60aa3e=_0x234482['parentNode'];if(!_0x60aa3e)return;while(_0x234482['firstChild']){_0x60aa3e['insertBefore'](_0x234482['firstChild'],_0x234482);}_0x60aa3e['removeChild'](_0x234482);}['isSelectionInTag'](_0x56d715){const _0x37fe1c=window['getSelection']();if(!_0x37fe1c||_0x37fe1c['rangeCount']===0x0)return![];let _0x3a43d2=_0x37fe1c['anchorNode'];while(_0x3a43d2&&_0x3a43d2!==this['editor']){if(_0x3a43d2['nodeType']===Node['ELEMENT_NODE']&&_0x3a43d2['tagName']===_0x56d715)return!![];_0x3a43d2=_0x3a43d2['parentNode'];}return![];}['updateToolbarState'](){if(!this['toolbarButtons'])return;for(const [_0x53a18d,_0xdf4dd2]of Object['entries'](this['toolbarButtons'])){let _0x1d9ee8=![];if(_0xdf4dd2['command'])try{_0x1d9ee8=document['queryCommandState'](_0xdf4dd2['command']);}catch(_0x122639){_0x1d9ee8=![];}else _0xdf4dd2['tagName']&&(_0x1d9ee8=this['isSelectionInTag'](_0xdf4dd2['tagName']));_0xdf4dd2['button']['classList']['toggle']('active',_0x1d9ee8);}}['bindEvents'](){this['editor']['addEventListener']('keydown',_0x1c1928=>this['handleKeydown'](_0x1c1928)),this['editor']['addEventListener']('input',_0x2e5ecb=>{this['handleMentionInput'](_0x2e5ecb),this['handleAutoFormat'](_0x2e5ecb);}),this['editor']['addEventListener']('input',()=>{const _0x228430=this['editor']['textContent']['trim']()!==''||this['editor']['innerHTML']['includes']('<br')||this['editor']['innerHTML']['includes']('<div')||this['editor']['innerHTML']['includes']('<img');!_0x228430&&(this['editor']['innerHTML']='');this['updatePlaceholder']();const _0xedd811=this['getMarkdown']();this['element']['tagName']==='TEXTAREA'||this['element']['tagName']==='INPUT'?this['element']['value']=_0xedd811:this['element']['textContent']=_0xedd811,this['options']['onChange']&&this['options']['onChange'](_0xedd811);}),this['editor']['addEventListener']('paste',_0x509926=>this['handlePaste'](_0x509926)),this['editor']['addEventListener']('dragover',_0x4050f2=>this['handleDragOver'](_0x4050f2)),this['editor']['addEventListener']('drop',_0x1c00e5=>this['handleDrop'](_0x1c00e5)),this['editor']['addEventListener']('dragstart',_0x4a3d1a=>this['handleDragStart'](_0x4a3d1a)),this['options']['toolbar']&&(this['selectionChangeHandler']=()=>{(this['editor']['contains'](document['activeElement'])||this['editor']===document['activeElement'])&&this['updateToolbarState']();},document['addEventListener']('selectionchange',this['selectionChangeHandler']),this['editor']['addEventListener']('keyup',()=>this['updateToolbarState']()),this['editor']['addEventListener']('mouseup',()=>this['updateToolbarState']()),this['editor']['addEventListener']('focus',()=>this['updateToolbarState']())),this['linkClickHandler']=_0x2b218a=>this['handleLinkClick'](_0x2b218a),this['editor']['addEventListener']('click',this['linkClickHandler']),this['linkMouseEnterHandler']=_0x202aaa=>this['handleLinkMouseEnter'](_0x202aaa),this['linkMouseLeaveHandler']=_0x1b1359=>this['handleLinkMouseLeave'](_0x1b1359),this['editor']['addEventListener']('mouseover',this['linkMouseEnterHandler']),this['editor']['addEventListener']('mouseout',this['linkMouseLeaveHandler']),this['updatePlaceholder']();}['handleAutoFormat'](_0x188263){if(_0x188263['inputType']==='deleteContentBackward')return;const _0xd38659=window['getSelection']();if(!_0xd38659||_0xd38659['rangeCount']===0x0)return;const _0x465ec0=_0xd38659['getRangeAt'](0x0),_0x22fdb4=_0x465ec0['startContainer'];if(_0x22fdb4['nodeType']!==Node['TEXT_NODE'])return;if(this['isSelectionInTag']('CODE')||this['isSelectionInTag']('PRE'))return;const _0x8b8519=_0x22fdb4['textContent'],_0x2071f8=_0x465ec0['startOffset'],_0x101ef5=_0x8b8519['slice'](0x0,_0x2071f8);if(_0x101ef5['endsWith']('```')){_0x465ec0['setStart'](_0x22fdb4,_0x2071f8-0x3),_0x465ec0['setEnd'](_0x22fdb4,_0x2071f8),_0x465ec0['deleteContents'](),this['insertCodeBlock']();return;}const _0x3dc70d=/`([^`]+)`$/,_0x3471d4=_0x101ef5['match'](_0x3dc70d);if(_0x3471d4){const _0x5eaa03=_0x3471d4[0x1];if(_0x5eaa03){const _0x3faf94=_0x3471d4['index'],_0x1de92a=_0x3faf94+_0x5eaa03['length']+0x2;_0x465ec0['setStart'](_0x22fdb4,_0x3faf94),_0x465ec0['setEnd'](_0x22fdb4,_0x2071f8),_0x465ec0['deleteContents']();const _0x187e60=document['createElement']('code');_0x187e60['textContent']=_0x5eaa03,_0x465ec0['insertNode'](_0x187e60),_0x465ec0['setStartAfter'](_0x187e60),_0x465ec0['setEndAfter'](_0x187e60);const _0x10335b=document['createTextNode']('');_0x465ec0['insertNode'](_0x10335b),_0x465ec0['setStartAfter'](_0x10335b),_0x465ec0['setEndAfter'](_0x10335b),_0xd38659['removeAllRanges'](),_0xd38659['addRange'](_0x465ec0);return;}}const _0x2c639a=_0x101ef5['match'](/^[-*][\s\u00A0]$/);if(_0x2c639a&&this['isAtStartOfBlock'](_0x22fdb4)){if(this['isSelectionInTag']('UL')||this['isSelectionInTag']('OL'))return;_0x465ec0['setStart'](_0x22fdb4,Math['max'](_0x2071f8-0x2,0x0)),_0x465ec0['setEnd'](_0x22fdb4,_0x2071f8),_0x465ec0['deleteContents']();const _0x4d38a3=this['ensureListInsertionAnchor'](_0x22fdb4);document['execCommand']('insertUnorderedList',![],null);_0x4d38a3&&_0x4d38a3['parentNode']&&_0x4d38a3['parentNode']['removeChild'](_0x4d38a3);this['updateToolbarState']();return;}const _0x11811b=_0x101ef5['match'](/^1\.[\s\u00A0]$/);if(_0x11811b&&this['isAtStartOfBlock'](_0x22fdb4)){if(this['isSelectionInTag']('UL')||this['isSelectionInTag']('OL'))return;_0x465ec0['setStart'](_0x22fdb4,Math['max'](_0x2071f8-0x3,0x0)),_0x465ec0['setEnd'](_0x22fdb4,_0x2071f8),_0x465ec0['deleteContents']();const _0x45363e=this['ensureListInsertionAnchor'](_0x22fdb4);document['execCommand']('insertOrderedList',![],null);_0x45363e&&_0x45363e['parentNode']&&_0x45363e['parentNode']['removeChild'](_0x45363e);this['updateToolbarState']();return;}}['isAtStartOfBlock'](_0x2416f9){let _0xeeb6ce=_0x2416f9;while(_0xeeb6ce&&_0xeeb6ce!==this['editor']){const _0x4c423f=_0xeeb6ce['parentNode'];if(!_0x4c423f)break;const _0x49b87e=_0x4c423f['tagName'];if(_0x49b87e==='DIV'||_0x49b87e==='P'||_0x49b87e==='LI'||_0x4c423f===this['editor']){let _0x35e01a=_0x4c423f['firstChild'];while(_0x35e01a&&(_0x35e01a['nodeType']===Node['TEXT_NODE']&&_0x35e01a['textContent']===''||_0x35e01a['nodeType']===Node['ELEMENT_NODE']&&_0x35e01a['tagName']==='BR')){_0x35e01a=_0x35e01a['nextSibling'];}return _0x35e01a===_0x2416f9||_0x35e01a===_0xeeb6ce;}_0xeeb6ce=_0x4c423f;}if(_0xeeb6ce===this['editor']||_0x2416f9['parentNode']===this['editor']){let _0x3e9ab1=this['editor']['firstChild'];while(_0x3e9ab1&&(_0x3e9ab1['nodeType']===Node['TEXT_NODE']&&_0x3e9ab1['textContent']===''||_0x3e9ab1['nodeType']===Node['ELEMENT_NODE']&&_0x3e9ab1['tagName']==='BR')){_0x3e9ab1=_0x3e9ab1['nextSibling'];}return _0x3e9ab1===_0x2416f9;}return![];}['getClosestBlockElement'](_0x1f409e){let _0x127d69=_0x1f409e;while(_0x127d69&&_0x127d69!==this['editor']){const _0x317ad7=_0x127d69['parentNode'];if(!_0x317ad7)break;const _0x58fb3c=_0x317ad7['tagName'];if(_0x58fb3c==='DIV'||_0x58fb3c==='P'||_0x58fb3c==='LI'||_0x317ad7===this['editor'])return _0x317ad7;_0x127d69=_0x317ad7;}return this['editor'];}['ensureListInsertionAnchor'](_0x5d8899){const _0x585f91=window['getSelection']();if(!_0x585f91||_0x585f91['rangeCount']===0x0)return null;const _0x42e5ef=this['getClosestBlockElement'](_0x5d8899);if(!_0x42e5ef||_0x42e5ef===this['editor'])return null;const _0x3ddd57=_0x42e5ef['textContent']['replace'](/\u200B/g,'');if(_0x3ddd57!=='')return null;const _0x504689=document['createTextNode']('');_0x42e5ef['appendChild'](_0x504689);const _0xc94d59=document['createRange']();return _0xc94d59['setStart'](_0x504689,0x1),_0xc94d59['setEnd'](_0x504689,0x1),_0x585f91['removeAllRanges'](),_0x585f91['addRange'](_0xc94d59),_0x504689;}['getContainingListItem'](){const _0x2ee489=window['getSelection']();if(!_0x2ee489||_0x2ee489['rangeCount']===0x0)return null;let _0x5c66da=_0x2ee489['anchorNode'];while(_0x5c66da&&_0x5c66da!==this['editor']){if(_0x5c66da['nodeType']===Node['ELEMENT_NODE']&&_0x5c66da['tagName']==='LI')return _0x5c66da;_0x5c66da=_0x5c66da['parentNode'];}return null;}['isEmptyListItem'](_0x3c1050){if(!_0x3c1050)return![];const _0x47f721=_0x3c1050['textContent']['replace'](/\u200B/g,'')['trim']();if(_0x47f721!=='')return![];const _0x10b709=_0x3c1050['querySelector']('img');if(_0x10b709)return![];const _0x48e8f5=_0x3c1050['querySelector']('ul,\x20ol');if(_0x48e8f5)return![];return!![];}['isCursorAtStartOfListItem'](_0x5ea4fb){if(!_0x5ea4fb)return![];const _0x2a5176=window['getSelection']();if(!_0x2a5176||_0x2a5176['rangeCount']===0x0||!_0x2a5176['isCollapsed'])return![];const _0x3acaf0=_0x2a5176['getRangeAt'](0x0),_0x1c2515=_0x3acaf0['startContainer'];if(_0x1c2515!==_0x5ea4fb&&!_0x5ea4fb['contains'](_0x1c2515))return![];const _0x4df2c8=_0x3acaf0['cloneRange']();_0x4df2c8['setStart'](_0x5ea4fb,0x0),_0x4df2c8['setEnd'](_0x1c2515,_0x3acaf0['startOffset']);const _0xfb486a=_0x4df2c8['toString']()['replace'](/\u200B/g,'')['replace'](/\u00A0/g,'\x20');return _0xfb486a['trim']()==='';}['indentListItem'](_0x21eb50){const _0xb90887=_0x21eb50['previousElementSibling'];if(!_0xb90887||_0xb90887['tagName']!=='LI')return;const _0x568b66=_0x21eb50['parentNode'],_0x2ace14=_0x568b66['tagName'];let _0xe7fe39=_0xb90887['querySelector'](':scope\x20>\x20ul,\x20:scope\x20>\x20ol');!_0xe7fe39&&(_0xe7fe39=document['createElement'](_0x2ace14),_0xb90887['appendChild'](_0xe7fe39)),_0xe7fe39['appendChild'](_0x21eb50),this['placeCursorInListItem'](_0x21eb50);}['outdentListItem'](_0xc81b79){const _0x3e8642=_0xc81b79['parentNode'];if(!_0x3e8642||_0x3e8642['tagName']!=='UL'&&_0x3e8642['tagName']!=='OL')return;const _0x28b53b=_0x3e8642['parentNode'];if(_0x28b53b&&_0x28b53b['tagName']==='LI'){const _0x5ca9d3=_0x28b53b['parentNode'];_0x5ca9d3['insertBefore'](_0xc81b79,_0x28b53b['nextSibling']),_0x3e8642['children']['length']===0x0&&_0x3e8642['remove'](),this['placeCursorInListItem'](_0xc81b79);}else return;}['exitListOnEmptyBullet'](_0x27cfe2){const _0x15bd73=_0x27cfe2['parentNode'];if(!_0x15bd73)return;const _0xd6c5a1=_0x15bd73['parentNode'];if(_0xd6c5a1&&_0xd6c5a1['tagName']==='LI'){this['outdentListItem'](_0x27cfe2);return;}const _0x165a92=_0x15bd73['parentNode'],_0xbad395=document['createElement']('p');_0xbad395['innerHTML']='<br>',_0x165a92['insertBefore'](_0xbad395,_0x15bd73['nextSibling']),_0x27cfe2['remove']();_0x15bd73['children']['length']===0x0&&_0x15bd73['remove']();const _0xd7141d=window['getSelection'](),_0x532ffc=document['createRange']();_0x532ffc['setStart'](_0xbad395,0x0),_0x532ffc['collapse'](!![]),_0xd7141d['removeAllRanges'](),_0xd7141d['addRange'](_0x532ffc);}['placeCursorInListItem'](_0x4d0441){const _0x2aebcc=window['getSelection'](),_0xde65b1=document['createRange'](),_0x33a0b3=document['createTreeWalker'](_0x4d0441,NodeFilter['SHOW_TEXT'],null,![]),_0x2f9cf1=_0x33a0b3['nextNode']();_0x2f9cf1?_0xde65b1['setStart'](_0x2f9cf1,0x0):_0xde65b1['setStart'](_0x4d0441,0x0),_0xde65b1['collapse'](!![]),_0x2aebcc['removeAllRanges'](),_0x2aebcc['addRange'](_0xde65b1);}['handleLinkClick'](_0x275a39){const _0x112e30=this['isMac']?_0x275a39['metaKey']:_0x275a39['ctrlKey'];if(!_0x112e30)return;let _0x463591=_0x275a39['target'];while(_0x463591&&_0x463591!==this['editor']){if(_0x463591['tagName']==='A'){_0x275a39['preventDefault'](),_0x275a39['stopPropagation']();const _0x5a25d4=_0x463591['getAttribute']('href');if(!_0x5a25d4)return;if(_0x5a25d4['startsWith']('mention:'))return;const _0x378aa8=/^https?:\/\//i['test'](_0x5a25d4);_0x378aa8?window['open'](_0x5a25d4,'_blank','noopener,noreferrer'):window['location']['href']=_0x5a25d4;return;}_0x463591=_0x463591['parentNode'];}}['handleLinkMouseEnter'](_0x22c019){const _0x1c4135=_0x22c019['target'];if(_0x1c4135['tagName']!=='A')return;const _0x5a6a1d=_0x1c4135['getAttribute']('href')||'';if(_0x5a6a1d['startsWith']('mention:'))return;this['linkTooltipTimeout']&&clearTimeout(this['linkTooltipTimeout']),this['linkTooltipTimeout']=setTimeout(()=>{this['showLinkTooltip'](_0x1c4135);},0x12c);}['handleLinkMouseLeave'](_0x2147b5){const _0x192b6e=_0x2147b5['target'];if(_0x192b6e['tagName']!=='A')return;this['linkTooltipTimeout']&&(clearTimeout(this['linkTooltipTimeout']),this['linkTooltipTimeout']=null),this['hideLinkTooltip']();}['showLinkTooltip'](_0x1ac7a4){!this['linkTooltip']&&(this['linkTooltip']=document['createElement']('div'),this['linkTooltip']['className']='markdown-editor-link-tooltip',document['body']['appendChild'](this['linkTooltip']));this['linkTooltip']['textContent']=this['linkHintText']||'Ctrl+click\x20to\x20follow';const _0x2270a0=_0x1ac7a4['getBoundingClientRect'](),_0x4151c3=this['linkTooltip']['getBoundingClientRect']();let _0x21df3b=_0x2270a0['bottom']+0x4,_0x50bfec=_0x2270a0['left']+_0x2270a0['width']/0x2;_0x21df3b+0x1e>window['innerHeight']&&(_0x21df3b=_0x2270a0['top']-0x1e);const _0x469256=0x78;if(_0x50bfec-_0x469256/0x2<0xa)_0x50bfec=_0x469256/0x2+0xa;else _0x50bfec+_0x469256/0x2>window['innerWidth']-0xa&&(_0x50bfec=window['innerWidth']-_0x469256/0x2-0xa);this['linkTooltip']['style']['top']=_0x21df3b+'px',this['linkTooltip']['style']['left']=_0x50bfec+'px',this['linkTooltip']['style']['transform']='translateX(-50%)',this['linkTooltip']['classList']['add']('visible');}['hideLinkTooltip'](){this['linkTooltip']&&this['linkTooltip']['classList']['remove']('visible');}['handleKeydown'](_0x21349d){if(this['mentionState']['active']){if(_0x21349d['key']==='ArrowDown'){_0x21349d['preventDefault'](),this['mentionNavigate'](0x1);return;}if(_0x21349d['key']==='ArrowUp'){_0x21349d['preventDefault'](),this['mentionNavigate'](-0x1);return;}if(_0x21349d['key']==='Enter'||_0x21349d['key']==='Tab'){if(this['mentionState']['filteredUsers']['length']>0x0){_0x21349d['preventDefault'](),this['insertMention'](this['mentionState']['filteredUsers'][this['mentionState']['selectedIndex']]);return;}}if(_0x21349d['key']==='Escape'){_0x21349d['preventDefault'](),this['closeMentionDropdown']();return;}}if(_0x21349d['key']==='Tab'&&(this['isSelectionInTag']('UL')||this['isSelectionInTag']('OL'))){const _0x15cf91=this['getContainingListItem']();if(_0x15cf91&&this['isCursorAtStartOfListItem'](_0x15cf91)){_0x21349d['preventDefault']();_0x21349d['shiftKey']?this['outdentListItem'](_0x15cf91):this['indentListItem'](_0x15cf91);this['editor']['dispatchEvent'](new Event('input',{'bubbles':!![]}));return;}}if(_0x21349d['key']==='Enter'&&!_0x21349d['shiftKey']&&(this['isSelectionInTag']('UL')||this['isSelectionInTag']('OL'))){const _0x53128b=this['getContainingListItem']();if(_0x53128b&&this['isEmptyListItem'](_0x53128b)){_0x21349d['preventDefault'](),this['exitListOnEmptyBullet'](_0x53128b),this['editor']['dispatchEvent'](new Event('input',{'bubbles':!![]}));return;}}if(_0x21349d['key']==='Enter'&&!_0x21349d['shiftKey']&&this['isSelectionInTag']('PRE')){_0x21349d['preventDefault']();const _0x2d11c0=window['getSelection']();if(_0x2d11c0['rangeCount']>0x0){const _0x584ea8=_0x2d11c0['getRangeAt'](0x0);_0x584ea8['deleteContents']();const _0x1d46cd=document['createTextNode']('\x0a');_0x584ea8['insertNode'](_0x1d46cd),_0x584ea8['setStartAfter'](_0x1d46cd),_0x584ea8['setEndAfter'](_0x1d46cd),_0x2d11c0['removeAllRanges'](),_0x2d11c0['addRange'](_0x584ea8),this['handleInput']();}return;}(_0x21349d['ctrlKey']||_0x21349d['metaKey'])&&_0x21349d['key']==='b'&&(_0x21349d['preventDefault'](),document['execCommand']('bold',![],null));(_0x21349d['ctrlKey']||_0x21349d['metaKey'])&&_0x21349d['key']==='i'&&(_0x21349d['preventDefault'](),document['execCommand']('italic',![],null));if((_0x21349d['ctrlKey']||_0x21349d['metaKey'])&&_0x21349d['key']==='k'){_0x21349d['preventDefault'](),this['openLinkDialog']();return;}}['handlePaste'](_0x21341c){const _0x506118=_0x21341c['clipboardData'];if(_0x506118&&this['options']['onAddAttachments']){const _0x58185b=this['extractImageFilesFromClipboard'](_0x506118);if(_0x58185b['length']>0x0){_0x21341c['preventDefault'](),this['addAndInsertImages'](_0x58185b);return;}}_0x21341c['preventDefault']();const _0x3fbe44=_0x21341c['clipboardData']['getData']('text/html');if(_0x3fbe44&&_0x3fbe44['trim']()){const _0x3cd16a=this['convertPastedHtmlToMarkdown'](_0x3fbe44);if(_0x3cd16a&&_0x3cd16a['trim']()){this['insertMarkdownAsRichText'](_0x3cd16a);return;}}const _0x5db9eb=_0x21341c['clipboardData']['getData']('text/plain');document['execCommand']('insertText',![],_0x5db9eb);}['convertPastedHtmlToMarkdown'](_0xdf163a){const _0x198d94=document['createElement']('div');_0x198d94['innerHTML']=_0xdf163a;const _0x4aa2cb=_0x198d94['querySelectorAll']('style,\x20script,\x20meta,\x20link,\x20head,\x20title');_0x4aa2cb['forEach'](_0x4646ed=>_0x4646ed['remove']());const _0x37595d=_0x198d94['querySelectorAll']('*');_0x37595d['forEach'](_0x73c488=>{const _0x4bd5f0=Array['from'](_0x73c488['attributes']);_0x4bd5f0['forEach'](_0x513184=>{_0x513184['name']['startsWith']('data-')&&_0x513184['name']!=='data-attachment-name'&&_0x513184['name']!=='data-mention-user-id'&&_0x73c488['removeAttribute'](_0x513184['name']);});}),_0x198d94['querySelectorAll']('font[color]')['forEach'](_0x58c219=>{_0x58c219['replaceWith'](..._0x58c219['childNodes']);}),_0x198d94['querySelectorAll']('span')['forEach'](_0x1861ea=>{_0x1861ea['style']['color']&&_0x1861ea['style']['removeProperty']('color'),!_0x1861ea['getAttribute']('style')&&!_0x1861ea['getAttribute']('data-mention-user-id')&&!_0x1861ea['getAttribute']('data-attachment-name')&&_0x1861ea['replaceWith'](..._0x1861ea['childNodes']);});try{return this['turndownService']['turndown'](_0x198d94['innerHTML']);}catch(_0x1d1943){return console['warn']('Failed\x20to\x20convert\x20HTML\x20to\x20markdown:',_0x1d1943),null;}}['insertMarkdownAsRichText'](_0x328e07){const _0x57905b=window['marked'];if(!_0x57905b){document['execCommand']('insertText',![],_0x328e07);return;}try{const _0x11b607=this['preprocessColorSyntax'](_0x328e07),_0x1c7a40=_0x57905b['parse'](_0x11b607),_0x376ef4=document['createElement']('div');_0x376ef4['innerHTML']=_0x1c7a40,this['processHtmlForEditor'](_0x376ef4),document['execCommand']('insertHTML',![],_0x376ef4['innerHTML']);}catch(_0x14844e){console['warn']('Failed\x20to\x20convert\x20markdown\x20to\x20HTML:',_0x14844e),document['execCommand']('insertText',![],_0x328e07);}}['processHtmlForEditor'](_0x1646a6){const _0x2d118b=_0x1646a6['querySelectorAll']('pre');_0x2d118b['forEach'](_0x39f8d8=>{const _0x6dd161=_0x39f8d8['querySelector']('code');if(_0x6dd161){const _0x4fb700=Array['from'](_0x6dd161['classList'])['find'](_0x1aa9ce=>_0x1aa9ce['startsWith']('language-')),_0x142689=_0x4fb700?_0x4fb700['replace']('language-',''):'',_0x1d7e13=document['createElement']('pre');_0x142689&&_0x1d7e13['setAttribute']('data-language',_0x142689),_0x1d7e13['textContent']=_0x6dd161['textContent'],_0x39f8d8['replaceWith'](_0x1d7e13);}});const _0x1c5ca4=_0x1646a6['querySelectorAll']('a');_0x1c5ca4['forEach'](_0x170950=>{_0x170950['setAttribute']('target','_blank'),_0x170950['setAttribute']('rel','noopener\x20noreferrer');});}['handleDragStart'](_0x3130e7){const _0x40202d=_0x3130e7['target'];if(!_0x40202d||_0x40202d['tagName']!=='IMG')return;if(!_0x3130e7['dataTransfer'])return;const _0x2094b8=_0x40202d['getAttribute']('data-attachment-name')||'';try{_0x3130e7['dataTransfer']['setData'](INTERNAL_DRAG_MIME,_0x2094b8||'1');}catch{}_0x3130e7['dataTransfer']['effectAllowed']='move';}['handleDragOver'](_0x599c1d){if(!this['isExternalFileTransfer'](_0x599c1d['dataTransfer']))return;_0x599c1d['preventDefault'](),_0x599c1d['dataTransfer']['dropEffect']='copy';}['handleDrop'](_0x12a657){if(!this['isExternalFileTransfer'](_0x12a657['dataTransfer']))return;const _0x19a7b5=_0x12a657['dataTransfer'],_0x4f2026=Array['from'](_0x19a7b5['files']||[])['filter'](_0x130446=>_0x130446&&typeof _0x130446['type']==='string'),_0x16405a=_0x4f2026['filter'](_0x478cce=>_0x478cce['type']['startsWith']('image/'));if(_0x16405a['length']===0x0)return;_0x12a657['preventDefault'](),_0x12a657['stopPropagation'](),this['cleanupParentDragState'](),this['moveSelectionToDropPoint'](_0x12a657),this['addAndInsertImages'](_0x16405a);}['cleanupParentDragState'](){let _0x4c65b1=this['editor']['parentElement'];while(_0x4c65b1){_0x4c65b1['classList']&&_0x4c65b1['classList']['contains']('drag-over')&&_0x4c65b1['classList']['remove']('drag-over'),_0x4c65b1=_0x4c65b1['parentElement'];}}['isExternalFileTransfer'](_0x5d633a){if(!_0x5d633a)return![];const _0x5e45d0=Array['from'](_0x5d633a['types']||[]);if(!_0x5e45d0['includes']('Files'))return![];if(_0x5e45d0['includes'](INTERNAL_DRAG_MIME))return![];if(_0x5d633a['files']&&_0x5d633a['files']['length']>0x0)return!![];if(_0x5d633a['items']&&Array['from'](_0x5d633a['items'])['some'](_0x3154fa=>_0x3154fa['kind']==='file'))return!![];return![];}['moveSelectionToDropPoint'](_0x4f392c){const _0x16b83d=_0x4f392c['clientX'],_0x2ef1b3=_0x4f392c['clientY'];let _0x32462a=null;if(document['caretRangeFromPoint'])_0x32462a=document['caretRangeFromPoint'](_0x16b83d,_0x2ef1b3);else{if(document['caretPositionFromPoint']){const _0x5c89a0=document['caretPositionFromPoint'](_0x16b83d,_0x2ef1b3);_0x5c89a0&&(_0x32462a=document['createRange'](),_0x32462a['setStart'](_0x5c89a0['offsetNode'],_0x5c89a0['offset']),_0x32462a['collapse'](!![]));}}if(_0x32462a){const _0x4160e0=window['getSelection']();_0x4160e0['removeAllRanges'](),_0x4160e0['addRange'](_0x32462a);}}['extractImageFilesFromClipboard'](_0x48c74b){const _0x1eed62=Array['from'](_0x48c74b['items']||[]),_0x523710=[];for(const _0x10ded3 of _0x1eed62){if(_0x10ded3['kind']==='file'&&_0x10ded3['type']&&_0x10ded3['type']['startsWith']('image/')){const _0x141371=_0x10ded3['getAsFile']();if(_0x141371)_0x523710['push'](_0x141371);}}return _0x523710;}['addAndInsertImages'](_0x359432){const _0x29add6=_0x359432['map'](_0x11f2ee=>this['prepareAttachmentFile'](_0x11f2ee))['filter'](Boolean);if(_0x29add6['length']===0x0)return;const _0x4b6ed0=_0x29add6['map'](_0x15e701=>_0x15e701['file']);try{this['options']['onAddAttachments'](_0x4b6ed0);}catch(_0x2743e9){console['error']('Failed\x20to\x20add\x20attachments:',_0x2743e9);}for(const {name:_0x506bc8,objectUrl:_0xe8c73d}of _0x29add6){this['insertAttachmentImage'](_0x506bc8,_0xe8c73d);}this['editor']['dispatchEvent'](new Event('input',{'bubbles':!![]}));}['prepareAttachmentFile'](_0x3f1c39){const _0x44c683=this['sanitizeFilename'](_0x3f1c39['name']||this['defaultImageName'](_0x3f1c39['type']));if(!_0x44c683)return null;const _0xa2b761=this['getUniqueAttachmentName'](_0x44c683),_0x24daa0=_0xa2b761===_0x3f1c39['name']?_0x3f1c39:new File([_0x3f1c39],_0xa2b761,{'type':_0x3f1c39['type'],'lastModified':_0x3f1c39['lastModified']}),_0x59efff=URL['createObjectURL'](_0x24daa0);return this['attachmentObjectUrls']['set'](_0xa2b761,_0x59efff),{'name':_0xa2b761,'file':_0x24daa0,'objectUrl':_0x59efff};}['getUniqueAttachmentName'](_0x3179d5){const _0x220775=_0x5f3b59=>{if(this['attachmentObjectUrls']['has'](_0x5f3b59))return!![];if(this['options']['isAttachmentNameTaken'])try{return Boolean(this['options']['isAttachmentNameTaken'](_0x5f3b59));}catch{return![];}return![];};if(!_0x220775(_0x3179d5))return _0x3179d5;const {stem:_0x466af6,ext:_0x311355}=this['splitFilename'](_0x3179d5);for(let _0x96c8a2=0x2;_0x96c8a2<0x3e8;_0x96c8a2++){const _0x7ca768=_0x466af6+'-'+_0x96c8a2+_0x311355;if(!_0x220775(_0x7ca768))return _0x7ca768;}return _0x466af6+'-'+Date['now']()+_0x311355;}['splitFilename'](_0x3f7b02){const _0x43d7c2=_0x3f7b02['lastIndexOf']('.');if(_0x43d7c2<=0x0||_0x43d7c2===_0x3f7b02['length']-0x1)return{'stem':_0x3f7b02,'ext':''};return{'stem':_0x3f7b02['slice'](0x0,_0x43d7c2),'ext':_0x3f7b02['slice'](_0x43d7c2)};}['sanitizeFilename'](_0x592b78){const _0x4f823f=String(_0x592b78||'')['split']('/')['pop']()['split']('\x5c')['pop']();return _0x4f823f['replace'](/[\u0000-\u001F\u007F]/g,'')['trim']();}['defaultImageName'](_0x54fe05){const _0x13b429=this['extensionForMime'](_0x54fe05);return'pasted-image-'+Date['now']()+_0x13b429;}['extensionForMime'](_0x169921){switch(_0x169921){case'image/png':return'.png';case'image/jpeg':return'.jpg';case'image/gif':return'.gif';case'image/webp':return'.webp';case'image/svg+xml':return'.svg';default:return'.png';}}['insertAttachmentImage'](_0x157193,_0x352904){const _0x49cc87=document['createElement']('img');_0x49cc87['src']=_0x352904,_0x49cc87['alt']=_0x157193,_0x49cc87['setAttribute']('data-attachment-name',_0x157193),_0x49cc87['draggable']=!![];const _0x5a50b5=window['getSelection']();let _0xb581b1=![];if(_0x5a50b5&&_0x5a50b5['rangeCount']>0x0){const _0x26e536=_0x5a50b5['getRangeAt'](0x0);_0xb581b1=this['editor']['contains'](_0x26e536['commonAncestorContainer'])||this['editor']===_0x26e536['commonAncestorContainer'];}if(!_0xb581b1){this['editor']['appendChild'](_0x49cc87);const _0x3b5003=document['createRange']();_0x3b5003['setStartAfter'](_0x49cc87),_0x3b5003['collapse'](!![]),_0x5a50b5['removeAllRanges'](),_0x5a50b5['addRange'](_0x3b5003);return;}const _0x5d4c25=_0x5a50b5['getRangeAt'](0x0);_0x5d4c25['deleteContents'](),_0x5d4c25['insertNode'](_0x49cc87),_0x5d4c25['setStartAfter'](_0x49cc87),_0x5d4c25['collapse'](!![]),_0x5a50b5['removeAllRanges'](),_0x5a50b5['addRange'](_0x5d4c25);}['toggleInlineCode'](){const _0x1af98a=window['getSelection']();if(_0x1af98a['rangeCount']===0x0)return;const _0x1164c2=_0x1af98a['getRangeAt'](0x0),_0x8b5f13=_0x1164c2['toString']();if(_0x8b5f13){const _0x2ddcc0=document['createElement']('code');_0x2ddcc0['textContent']=_0x8b5f13,_0x1164c2['deleteContents'](),_0x1164c2['insertNode'](_0x2ddcc0),_0x1164c2['setStartAfter'](_0x2ddcc0),_0x1164c2['setEndAfter'](_0x2ddcc0),_0x1af98a['removeAllRanges'](),_0x1af98a['addRange'](_0x1164c2);}}['insertCodeBlock'](){const _0x34cd92=window['getSelection']();if(_0x34cd92['rangeCount']===0x0)return;const _0x5d785d=_0x34cd92['getRangeAt'](0x0),_0x499bdb=_0x5d785d['toString'](),_0x22cdf2=document['createElement']('pre'),_0x7058e9=document['createElement']('code');_0x7058e9['textContent']=_0x499bdb||'\x0a',_0x22cdf2['appendChild'](_0x7058e9),_0x5d785d['deleteContents'](),_0x5d785d['insertNode'](_0x22cdf2);const _0x282761=document['createElement']('p');_0x282761['innerHTML']='<br>',_0x22cdf2['parentNode']['insertBefore'](_0x282761,_0x22cdf2['nextSibling']);const _0x55ad2e=document['createRange']();!_0x499bdb?(_0x55ad2e['setStart'](_0x7058e9['firstChild'],0x0),_0x55ad2e['setEnd'](_0x7058e9['firstChild'],0x0)):(_0x55ad2e['selectNodeContents'](_0x7058e9),_0x55ad2e['collapse'](![])),_0x34cd92['removeAllRanges'](),_0x34cd92['addRange'](_0x55ad2e);}['updatePlaceholder'](){const _0x226224=this['editor']['textContent']['trim']()!==''||this['editor']['innerHTML']['includes']('<br')||this['editor']['innerHTML']['includes']('<div')||this['editor']['innerHTML']['includes']('<img');_0x226224?this['editor']['classList']['remove']('empty'):this['editor']['classList']['add']('empty');}['setMarkdown'](_0x3f76dc){if(!_0x3f76dc||!_0x3f76dc['trim']()){this['editor']['innerHTML']='',this['updatePlaceholder']();this['element']['tagName']==='TEXTAREA'||this['element']['tagName']==='INPUT'?this['element']['value']='':this['element']['textContent']='';return;}const _0x321d6b=this['preprocessColorSyntax'](_0x3f76dc),_0x48ddbc=window['marked']['parse'](_0x321d6b);this['editor']['innerHTML']=_0x48ddbc,this['rewriteAttachmentImages'](),this['rewriteMentionLinks'](),this['addLinkHints'](),this['updatePlaceholder'](),this['element']['tagName']==='TEXTAREA'||this['element']['tagName']==='INPUT'?this['element']['value']=_0x3f76dc:this['element']['textContent']=_0x3f76dc;}['rewriteAttachmentImages'](){const _0x21f9f0=this['editor']['querySelectorAll']('img');_0x21f9f0['forEach'](_0x525d81=>{const _0x578355=_0x525d81['getAttribute']('data-attachment-name'),_0x98c117=_0x525d81['getAttribute']('src')||'',_0x28b15f=this['parseAttachmentReference'](_0x98c117)||this['parseTaskAttachmentUrl'](_0x98c117),_0x4919a5=_0x578355||(_0x28b15f?_0x28b15f['name']:null);if(!_0x4919a5)return;_0x525d81['setAttribute']('data-attachment-name',_0x4919a5);const _0x1e371b=this['attachmentObjectUrls']['get'](_0x4919a5)||(this['options']['resolveAttachmentUrl']?this['options']['resolveAttachmentUrl'](_0x4919a5):null);_0x1e371b&&(_0x525d81['src']=_0x1e371b);});}['rewriteMentionLinks'](){const _0x1fad6d=this['editor']['querySelectorAll']('a[href^=\x22mention:\x22]');_0x1fad6d['forEach'](_0x3eac7a=>{const _0x3aba6a=_0x3eac7a['getAttribute']('href')||'',_0x439db6=_0x3aba6a['replace']('mention:',''),_0x572d80=_0x3eac7a['textContent']||'',_0x4d8fbf=document['createElement']('span');_0x4d8fbf['className']='mention',_0x4d8fbf['setAttribute']('data-mention-user-id',_0x439db6),_0x4d8fbf['setAttribute']('contenteditable','false'),_0x4d8fbf['textContent']='@'+_0x572d80;const _0x145f5b=_0x3eac7a['previousSibling'];_0x145f5b&&_0x145f5b['nodeType']===Node['TEXT_NODE']&&_0x145f5b['textContent']['endsWith']('@')&&(_0x145f5b['textContent']=_0x145f5b['textContent']['slice'](0x0,-0x1)),_0x3eac7a['parentNode']['replaceChild'](_0x4d8fbf,_0x3eac7a);});}['addLinkHints'](){if(!this['options']['editable'])return;const _0x44ae12=this['editor']['querySelectorAll']('a');_0x44ae12['forEach'](_0x2b96e2=>{const _0x3f67a8=_0x2b96e2['getAttribute']('href')||'';if(_0x3f67a8['startsWith']('mention:'))return;const _0x32362a=_0x2b96e2['textContent']||_0x3f67a8,_0x16ef25=_0x32362a+'\x20('+(this['linkHintText']||'Ctrl+click\x20to\x20follow')+')';_0x2b96e2['setAttribute']('aria-label',_0x16ef25);});}['preprocessColorSyntax'](_0x2c3e78){if(!_0x2c3e78)return _0x2c3e78;const _0x43c9cb=_0x127a1c=>{return String(_0x127a1c)['replace'](/\{color:(#[0-9A-Fa-f]{3,6})\}([\s\S]*?)\{\/color\}/g,(_0x542265,_0x852044,_0x420ea6)=>{const _0x36b025=_0x43c9cb(_0x420ea6);return'<span\x20style=\x22color:\x20'+_0x852044+'\x22>'+_0x36b025+'</span>';});};return _0x43c9cb(_0x2c3e78);}['parseAttachmentReference'](_0x556db6){if(!_0x556db6||typeof _0x556db6!=='string')return null;if(!_0x556db6['startsWith'](ATTACHMENT_SCHEME)&&!_0x556db6['startsWith'](ATTACHMENT_SCHEME+'//'))return null;const _0x1273de=_0x556db6['replace'](ATTACHMENT_SCHEME+'//','')['replace'](ATTACHMENT_SCHEME,'');if(!_0x1273de)return null;try{return{'name':decodeURIComponent(_0x1273de)};}catch{return{'name':_0x1273de};}}['parseTaskAttachmentUrl'](_0x3e2671){if(!_0x3e2671||typeof _0x3e2671!=='string')return null;const _0x33c2a7=_0x3e2671['match'](/\/tasks\/[^/]+\/attachments\/([^?#]+)/);if(!_0x33c2a7)return null;const _0x1f542a=_0x33c2a7[0x1];try{return{'name':decodeURIComponent(_0x1f542a)};}catch{return{'name':_0x1f542a};}}['updateAttachmentFile'](_0x20213b,_0x10d3e7){const _0x528a54=this['attachmentObjectUrls']['get'](_0x20213b);if(_0x528a54)try{URL['revokeObjectURL'](_0x528a54);}catch{}const _0x518265=URL['createObjectURL'](_0x10d3e7);this['attachmentObjectUrls']['set'](_0x20213b,_0x518265);const _0x1c3809=this['editor']['querySelector']('img[data-attachment-name=\x22'+CSS['escape'](_0x20213b)+'\x22]');return _0x1c3809&&(_0x1c3809['src']=_0x518265),_0x518265;}['getMarkdown'](){const _0x20a79f=this['editor']['innerHTML'];if(!_0x20a79f||_0x20a79f['trim']()===''||_0x20a79f==='<br>')return'';return this['turndownService']['turndown'](_0x20a79f)['replace'](/\u200B/g,'');}['getValue'](){return this['getMarkdown']();}['setValue'](_0x4a449d){this['setMarkdown'](_0x4a449d);}['focus'](){this['editor']['focus']();}['clear'](){this['editor']['innerHTML']='',this['updatePlaceholder']();}['setEditable'](_0x140a5a){this['editor']['contentEditable']=_0x140a5a,this['options']['editable']=_0x140a5a;}['handleMentionInput'](_0x44191c){if(!this['options']['fetchUsers'])return;const _0x3e9a4b=window['getSelection']();if(!_0x3e9a4b||_0x3e9a4b['rangeCount']===0x0){this['closeMentionDropdown']();return;}const _0x456d88=_0x3e9a4b['getRangeAt'](0x0),_0x427dcd=_0x456d88['startContainer'];if(_0x427dcd['nodeType']!==Node['TEXT_NODE']){this['closeMentionDropdown']();return;}const _0xb9508d=_0x427dcd['textContent']||'',_0x224766=_0x456d88['startOffset'],_0x5424f4=_0xb9508d['slice'](0x0,_0x224766),_0x1bb2a1=_0x5424f4['lastIndexOf']('@');if(_0x1bb2a1===-0x1){this['closeMentionDropdown']();return;}const _0x44f855=_0x1bb2a1>0x0?_0x5424f4[_0x1bb2a1-0x1]:'\x20';if(!/\s/['test'](_0x44f855)&&_0x1bb2a1!==0x0){this['closeMentionDropdown']();return;}const _0x112ec4=_0x5424f4['slice'](_0x1bb2a1+0x1);if(/[\s\n]/['test'](_0x112ec4)){this['closeMentionDropdown']();return;}this['mentionState']['active']=!![],this['mentionState']['query']=_0x112ec4['toLowerCase'](),this['mentionState']['startOffset']=_0x1bb2a1,this['mentionState']['startNode']=_0x427dcd,this['showMentionDropdown']();}async['showMentionDropdown'](){if(!this['usersCache'])try{const _0xd57e57=await this['options']['fetchUsers']();this['usersCache']=_0xd57e57['users']||_0xd57e57||[];}catch(_0x3542f8){console['error']('Failed\x20to\x20fetch\x20users\x20for\x20@mention:',_0x3542f8),this['closeMentionDropdown']();return;}this['mentionState']['users']=this['usersCache'];const _0x4e7669=this['mentionState']['query'];this['mentionState']['filteredUsers']=this['mentionState']['users']['filter'](_0x30011e=>{const _0x1fc7ba=(_0x30011e['name']||'')['toLowerCase'](),_0x270a79=(_0x30011e['username']||'')['toLowerCase']();return _0x1fc7ba['includes'](_0x4e7669)||_0x270a79['includes'](_0x4e7669);})['slice'](0x0,0x8),this['mentionState']['selectedIndex']=0x0;if(this['mentionState']['filteredUsers']['length']===0x0){this['closeMentionDropdown']();return;}this['renderMentionDropdown'](),this['positionMentionDropdown']();}['renderMentionDropdown'](){!this['mentionDropdown']&&(this['mentionDropdown']=document['createElement']('div'),this['mentionDropdown']['className']='mention-dropdown',document['body']['appendChild'](this['mentionDropdown']),this['mentionClickOutsideHandler']=_0x32b8ca=>{!this['mentionDropdown']['contains'](_0x32b8ca['target'])&&!this['editor']['contains'](_0x32b8ca['target'])&&this['closeMentionDropdown']();},document['addEventListener']('click',this['mentionClickOutsideHandler']),this['mentionScrollHandler']=()=>{this['mentionState']['active']&&this['positionMentionDropdown']();},window['addEventListener']('scroll',this['mentionScrollHandler'],!![]));const _0x105ffa=this['mentionState']['filteredUsers'];this['mentionDropdown']['innerHTML']=_0x105ffa['map']((_0x4918b2,_0x474f0a)=>{const _0x574fac=_0x474f0a===this['mentionState']['selectedIndex'],_0xf85eca=_0x4918b2['name']||_0x4918b2['username']||'Unknown',_0x51057a=_0x4918b2['username']||'',_0x42eb8d=this['getInitials'](_0xf85eca),_0x3dc7f4=this['getAvatarColorIndex'](_0x51057a||_0x4918b2['id']||_0xf85eca);return'\x0a\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22mention-option\x20'+(_0x574fac?'mention-option-selected':'')+'\x22\x20data-index=\x22'+_0x474f0a+'\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span\x20class=\x22mention-avatar\x20avatar-color-'+_0x3dc7f4+'\x22>'+this['escapeHtmlForMention'](_0x42eb8d)+'</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span\x20class=\x22mention-option-name\x22>'+this['escapeHtmlForMention'](_0xf85eca)+'</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'+(_0x51057a?'<span\x20class=\x22mention-option-username\x22>@'+this['escapeHtmlForMention'](_0x51057a)+'</span>':'')+'\x0a\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20';})['join'](''),this['mentionDropdown']['querySelectorAll']('.mention-option')['forEach'](_0x5912e8=>{_0x5912e8['addEventListener']('mousedown',_0xefe572=>{_0xefe572['preventDefault']();const _0x509567=parseInt(_0x5912e8['dataset']['index'],0xa);this['insertMention'](this['mentionState']['filteredUsers'][_0x509567]);}),_0x5912e8['addEventListener']('mouseenter',()=>{const _0x3a65de=parseInt(_0x5912e8['dataset']['index'],0xa);this['mentionState']['selectedIndex']=_0x3a65de,this['updateMentionSelection']();});}),this['mentionDropdown']['style']['display']='block';}['positionMentionDropdown'](){if(!this['mentionDropdown'])return;const _0x343843=window['getSelection']();if(!_0x343843||_0x343843['rangeCount']===0x0)return;const _0x46974a=_0x343843['getRangeAt'](0x0),_0xcadfb3=_0x46974a['getBoundingClientRect'](),_0x2f572c=0x104,_0x4faaab=Math['min'](0xf0,this['mentionState']['filteredUsers']['length']*0x24+0x8),_0x4c4720=window['innerWidth'],_0x408fd3=window['innerHeight'],_0x378316=_0x408fd3-_0xcadfb3['bottom'],_0xe5dfac=_0xcadfb3['top'],_0x463ee7=_0x378316<_0x4faaab+0xa&&_0xe5dfac>_0x378316;let _0x3158d3,_0x439c35;_0x463ee7?_0x3158d3=_0xcadfb3['top']+window['scrollY']-_0x4faaab-0x4:_0x3158d3=_0xcadfb3['bottom']+window['scrollY']+0x4,_0x439c35=_0xcadfb3['left']+window['scrollX'],_0x439c35+_0x2f572c>_0x4c4720-0xa&&(_0x439c35=_0x4c4720-_0x2f572c-0xa),_0x439c35<0xa&&(_0x439c35=0xa),this['mentionDropdown']['style']['position']='absolute',this['mentionDropdown']['style']['top']=_0x3158d3+'px',this['mentionDropdown']['style']['left']=_0x439c35+'px';}['mentionNavigate'](_0x57964b){const _0x1e8959=this['mentionState']['filteredUsers']['length'];if(_0x1e8959===0x0)return;this['mentionState']['selectedIndex']=(this['mentionState']['selectedIndex']+_0x57964b+_0x1e8959)%_0x1e8959,this['updateMentionSelection']();}['updateMentionSelection'](){if(!this['mentionDropdown'])return;const _0x4b7a66=this['mentionDropdown']['querySelectorAll']('.mention-option');_0x4b7a66['forEach']((_0x479d11,_0x1ff691)=>{_0x1ff691===this['mentionState']['selectedIndex']?(_0x479d11['classList']['add']('mention-option-selected'),_0x479d11['scrollIntoView']({'block':'nearest'})):_0x479d11['classList']['remove']('mention-option-selected');});}['insertMention'](_0x1f6be0){if(!_0x1f6be0)return;const _0x423416=window['getSelection']();if(!_0x423416||_0x423416['rangeCount']===0x0)return;const _0x2d2439=_0x423416['getRangeAt'](0x0),_0xeaa275=this['mentionState']['startNode'];if(!_0xeaa275||_0xeaa275['nodeType']!==Node['TEXT_NODE']){this['closeMentionDropdown']();return;}const _0x48457e=_0xeaa275['textContent']||'',_0x45d8cb=this['mentionState']['startOffset'],_0x44172b=_0x2d2439['startOffset'],_0xfbaa3c=_0x48457e['slice'](0x0,_0x45d8cb),_0x5d1c57=_0x48457e['slice'](_0x44172b),_0x3fea2b=document['createElement']('span');_0x3fea2b['className']='mention',_0x3fea2b['setAttribute']('data-mention-user-id',_0x1f6be0['id']),_0x3fea2b['setAttribute']('contenteditable','false'),_0x3fea2b['textContent']='@'+(_0x1f6be0['name']||_0x1f6be0['username']);const _0x3021aa=document['createTextNode'](_0xfbaa3c),_0x27b203=document['createTextNode']('\x20'+_0x5d1c57),_0x26827d=_0xeaa275['parentNode'];_0x26827d['insertBefore'](_0x3021aa,_0xeaa275),_0x26827d['insertBefore'](_0x3fea2b,_0xeaa275),_0x26827d['insertBefore'](_0x27b203,_0xeaa275),_0x26827d['removeChild'](_0xeaa275);const _0x1986a1=document['createRange']();_0x1986a1['setStart'](_0x27b203,0x1),_0x1986a1['collapse'](!![]),_0x423416['removeAllRanges'](),_0x423416['addRange'](_0x1986a1),this['closeMentionDropdown'](),this['editor']['dispatchEvent'](new Event('input',{'bubbles':!![]}));}['closeMentionDropdown'](){this['mentionState']['active']=![],this['mentionState']['query']='',this['mentionState']['filteredUsers']=[],this['mentionState']['selectedIndex']=0x0,this['mentionDropdown']&&(this['mentionDropdown']['style']['display']='none');}['escapeHtmlForMention'](_0x29fd4d){const _0x56b9f7=document['createElement']('div');return _0x56b9f7['textContent']=_0x29fd4d,_0x56b9f7['innerHTML'];}['getInitials'](_0xa72cf4){if(!_0xa72cf4)return'?';const _0xaf3b8e=_0xa72cf4['trim']()['split'](/\s+/);if(_0xaf3b8e['length']>=0x2)return(_0xaf3b8e[0x0][0x0]+_0xaf3b8e[_0xaf3b8e['length']-0x1][0x0])['toUpperCase']();return _0xa72cf4['substring'](0x0,0x2)['toUpperCase']();}['getAvatarColorIndex'](_0x40f7ff){if(!_0x40f7ff)return 0x6;let _0x532da6=0x0;for(let _0x41fcd7=0x0;_0x41fcd7<_0x40f7ff['length'];_0x41fcd7++){_0x532da6=_0x40f7ff['charCodeAt'](_0x41fcd7)+((_0x532da6<<0x5)-_0x532da6);}return Math['abs'](_0x532da6)%0xa;}['destroy'](){this['selectionChangeHandler']&&document['removeEventListener']('selectionchange',this['selectionChangeHandler']);this['linkClickHandler']&&this['editor']['removeEventListener']('click',this['linkClickHandler']);this['linkMouseEnterHandler']&&this['editor']['removeEventListener']('mouseover',this['linkMouseEnterHandler']);this['linkMouseLeaveHandler']&&this['editor']['removeEventListener']('mouseout',this['linkMouseLeaveHandler']);this['linkTooltipTimeout']&&clearTimeout(this['linkTooltipTimeout']);this['linkTooltip']&&(this['linkTooltip']['remove'](),this['linkTooltip']=null);this['linkDialog']&&(this['linkDialog']['remove'](),this['linkDialog']=null,this['linkDialogContext']=null,this['linkDialogElements']=null);this['mentionDropdown']&&(this['mentionDropdown']['remove'](),this['mentionDropdown']=null);this['mentionClickOutsideHandler']&&document['removeEventListener']('click',this['mentionClickOutsideHandler']);this['mentionScrollHandler']&&window['removeEventListener']('scroll',this['mentionScrollHandler'],!![]);for(const _0x2296d5 of this['attachmentObjectUrls']['values']()){try{URL['revokeObjectURL'](_0x2296d5);}catch{}}this['attachmentObjectUrls']['clear'](),this['container']?this['container']['remove']():this['editor']['remove'](),this['element']['style']['display']='';}}typeof window!=='undefined'&&(window['MarkdownEditor']=MarkdownEditor);
|
|
1
|
+
const ATTACHMENT_SCHEME='attachment:',INTERNAL_DRAG_MIME='application/x-profound-editor-image',LINK_DIALOG_STYLE_ID='markdown-editor-link-dialog-styles',ICONS={'bold':'<svg\x20viewBox=\x220\x200\x2024\x2024\x22\x20width=\x2216\x22\x20height=\x2216\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20fill=\x22none\x22\x20stroke-linecap=\x22round\x22\x20stroke-linejoin=\x22round\x22><path\x20d=\x22M6\x204h8a4\x204\x200\x200\x201\x204\x204\x204\x204\x200\x200\x201-4\x204H6z\x22></path><path\x20d=\x22M6\x2012h9a4\x204\x200\x200\x201\x204\x204\x204\x204\x200\x200\x201-4\x204H6z\x22></path></svg>','italic':'<svg\x20viewBox=\x220\x200\x2024\x2024\x22\x20width=\x2216\x22\x20height=\x2216\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20fill=\x22none\x22\x20stroke-linecap=\x22round\x22\x20stroke-linejoin=\x22round\x22><line\x20x1=\x2219\x22\x20y1=\x224\x22\x20x2=\x2210\x22\x20y2=\x224\x22></line><line\x20x1=\x2214\x22\x20y1=\x2220\x22\x20x2=\x225\x22\x20y2=\x2220\x22></line><line\x20x1=\x2215\x22\x20y1=\x224\x22\x20x2=\x229\x22\x20y2=\x2220\x22></line></svg>','strike':'<svg\x20viewBox=\x220\x200\x2024\x2024\x22\x20width=\x2216\x22\x20height=\x2216\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20fill=\x22none\x22\x20stroke-linecap=\x22round\x22\x20stroke-linejoin=\x22round\x22><line\x20x1=\x225\x22\x20y1=\x2212\x22\x20x2=\x2219\x22\x20y2=\x2212\x22></line><path\x20d=\x22M16\x206a4\x204\x200\x200\x200-4-4c-2.48\x200-4\x201.79-4\x204\x200\x201.25.5\x202.5\x201.5\x203\x22></path><path\x20d=\x22M9\x2018c0\x201.79\x201.79\x203\x204\x203\x202.48\x200\x204-1.79\x204-4\x200-1.25-.5-2.5-1.5-3\x22></path></svg>','link':'<svg\x20viewBox=\x220\x200\x2024\x2024\x22\x20width=\x2216\x22\x20height=\x2216\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20fill=\x22none\x22\x20stroke-linecap=\x22round\x22\x20stroke-linejoin=\x22round\x22><path\x20d=\x22M10\x2013a5\x205\x200\x200\x200\x207.54.54l3-3a5\x205\x200\x200\x200-7.07-7.07l-1.72\x201.71\x22></path><path\x20d=\x22M14\x2011a5\x205\x200\x200\x200-7.54-.54l-3\x203a5\x205\x200\x200\x200\x207.07\x207.07l1.71-1.71\x22></path></svg>','code':'<svg\x20viewBox=\x220\x200\x2024\x2024\x22\x20width=\x2216\x22\x20height=\x2216\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20fill=\x22none\x22\x20stroke-linecap=\x22round\x22\x20stroke-linejoin=\x22round\x22><polyline\x20points=\x2216\x2018\x2022\x2012\x2016\x206\x22></polyline><polyline\x20points=\x228\x206\x202\x2012\x208\x2018\x22></polyline></svg>','listBullet':'<svg\x20viewBox=\x220\x200\x2024\x2024\x22\x20width=\x2216\x22\x20height=\x2216\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20fill=\x22none\x22\x20stroke-linecap=\x22round\x22\x20stroke-linejoin=\x22round\x22><line\x20x1=\x228\x22\x20y1=\x226\x22\x20x2=\x2221\x22\x20y2=\x226\x22></line><line\x20x1=\x228\x22\x20y1=\x2212\x22\x20x2=\x2221\x22\x20y2=\x2212\x22></line><line\x20x1=\x228\x22\x20y1=\x2218\x22\x20x2=\x2221\x22\x20y2=\x2218\x22></line><line\x20x1=\x223\x22\x20y1=\x226\x22\x20x2=\x223.01\x22\x20y2=\x226\x22></line><line\x20x1=\x223\x22\x20y1=\x2212\x22\x20x2=\x223.01\x22\x20y2=\x2212\x22></line><line\x20x1=\x223\x22\x20y1=\x2218\x22\x20x2=\x223.01\x22\x20y2=\x2218\x22></line></svg>','listOrdered':'<svg\x20viewBox=\x220\x200\x2024\x2024\x22\x20width=\x2216\x22\x20height=\x2216\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20fill=\x22none\x22\x20stroke-linecap=\x22round\x22\x20stroke-linejoin=\x22round\x22><line\x20x1=\x2210\x22\x20y1=\x226\x22\x20x2=\x2221\x22\x20y2=\x226\x22></line><line\x20x1=\x2210\x22\x20y1=\x2212\x22\x20x2=\x2221\x22\x20y2=\x2212\x22></line><line\x20x1=\x2210\x22\x20y1=\x2218\x22\x20x2=\x2221\x22\x20y2=\x2218\x22></line><path\x20d=\x22M4\x206h1v4\x22></path><path\x20d=\x22M4\x2010h2\x22></path><path\x20d=\x22M6\x2018H4c0-1\x202-2\x202-3s-1-1.5-2-1\x22></path></svg>','blockquote':'<svg\x20viewBox=\x220\x200\x2024\x2024\x22\x20width=\x2216\x22\x20height=\x2216\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20fill=\x22none\x22\x20stroke-linecap=\x22round\x22\x20stroke-linejoin=\x22round\x22><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></svg>','codeBlock':'<svg\x20viewBox=\x220\x200\x2024\x2024\x22\x20width=\x2216\x22\x20height=\x2216\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20fill=\x22none\x22\x20stroke-linecap=\x22round\x22\x20stroke-linejoin=\x22round\x22><rect\x20x=\x223\x22\x20y=\x223\x22\x20width=\x2218\x22\x20height=\x2218\x22\x20rx=\x222\x22\x20ry=\x222\x22></rect><polyline\x20points=\x229\x208\x205\x2012\x209\x2016\x22></polyline><polyline\x20points=\x2215\x208\x2019\x2012\x2015\x2016\x22></polyline></svg>','header':'<svg\x20viewBox=\x220\x200\x2024\x2024\x22\x20width=\x2216\x22\x20height=\x2216\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20fill=\x22none\x22\x20stroke-linecap=\x22round\x22\x20stroke-linejoin=\x22round\x22><path\x20d=\x22M4\x2012h8\x22></path><path\x20d=\x22M4\x2018V6\x22></path><path\x20d=\x22M12\x2018V6\x22></path><path\x20d=\x22M17\x2012l3-2v8\x22></path></svg>','color':'<svg\x20viewBox=\x220\x200\x2024\x2024\x22\x20width=\x2216\x22\x20height=\x2216\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20fill=\x22none\x22\x20stroke-linecap=\x22round\x22\x20stroke-linejoin=\x22round\x22><path\x20d=\x22M4\x2020h16\x22></path><path\x20d=\x22M6\x2016l6-14\x206\x2014\x22></path><path\x20d=\x22M8\x2012h8\x22></path></svg>'},LINK_DIALOG_STYLES='\x0a.markdown-editor-link-modal\x20{\x0a\x20\x20position:\x20fixed;\x0a\x20\x20inset:\x200;\x0a\x20\x20display:\x20flex;\x0a\x20\x20align-items:\x20center;\x0a\x20\x20justify-content:\x20center;\x0a\x20\x20z-index:\x2010020;\x0a}\x0a\x0a.markdown-editor-link-modal[hidden]\x20{\x0a\x20\x20display:\x20none\x20!important;\x0a}\x0a\x0a.markdown-editor-link-backdrop\x20{\x0a\x20\x20position:\x20absolute;\x0a\x20\x20inset:\x200;\x0a\x20\x20background:\x20rgba(15,\x2023,\x2042,\x200.45);\x0a}\x0a\x0a.markdown-editor-link-dialog\x20{\x0a\x20\x20position:\x20relative;\x0a\x20\x20width:\x20min(460px,\x20calc(100vw\x20-\x2024px));\x0a\x20\x20background:\x20var(--color-surface,\x20var(--feedback-surface,\x20#ffffff));\x0a\x20\x20color:\x20var(--color-text,\x20var(--feedback-text,\x20#111827));\x0a\x20\x20border:\x201px\x20solid\x20var(--color-border,\x20var(--feedback-border,\x20#d1d5db));\x0a\x20\x20border-radius:\x20var(--radius-medium,\x2010px);\x0a\x20\x20box-shadow:\x200\x2018px\x2042px\x20rgba(15,\x2023,\x2042,\x200.25);\x0a\x20\x20padding:\x2014px;\x0a\x20\x20display:\x20flex;\x0a\x20\x20flex-direction:\x20column;\x0a\x20\x20gap:\x2012px;\x0a}\x0a\x0a.markdown-editor-link-header\x20{\x0a\x20\x20display:\x20flex;\x0a\x20\x20align-items:\x20center;\x0a\x20\x20justify-content:\x20space-between;\x0a\x20\x20gap:\x208px;\x0a}\x0a\x0a.markdown-editor-link-title\x20{\x0a\x20\x20margin:\x200;\x0a\x20\x20font-size:\x2016px;\x0a\x20\x20font-weight:\x20600;\x0a}\x0a\x0a.markdown-editor-link-close\x20{\x0a\x20\x20width:\x2028px;\x0a\x20\x20height:\x2028px;\x0a\x20\x20border:\x20none;\x0a\x20\x20border-radius:\x20var(--radius-small,\x208px);\x0a\x20\x20background:\x20transparent;\x0a\x20\x20color:\x20var(--color-text-muted,\x20var(--feedback-text-muted,\x20#6b7280));\x0a\x20\x20font-size:\x2020px;\x0a\x20\x20line-height:\x201;\x0a\x20\x20cursor:\x20pointer;\x0a}\x0a\x0a.markdown-editor-link-close:hover\x20{\x0a\x20\x20background:\x20var(--color-surface-muted,\x20var(--feedback-surface-muted,\x20#f3f4f6));\x0a\x20\x20color:\x20var(--color-text,\x20var(--feedback-text,\x20#111827));\x0a}\x0a\x0a.markdown-editor-link-form\x20{\x0a\x20\x20display:\x20flex;\x0a\x20\x20flex-direction:\x20column;\x0a\x20\x20gap:\x2010px;\x0a}\x0a\x0a.markdown-editor-link-field-grid\x20{\x0a\x20\x20display:\x20grid;\x0a\x20\x20gap:\x2010px;\x0a}\x0a\x0a.markdown-editor-link-label\x20{\x0a\x20\x20display:\x20flex;\x0a\x20\x20flex-direction:\x20column;\x0a\x20\x20gap:\x206px;\x0a\x20\x20font-size:\x2012px;\x0a\x20\x20font-weight:\x20600;\x0a\x20\x20color:\x20var(--color-text-muted,\x20var(--feedback-text-muted,\x20#4b5563));\x0a}\x0a\x0a.markdown-editor-link-input\x20{\x0a\x20\x20width:\x20100%;\x0a\x20\x20padding:\x209px\x2010px;\x0a\x20\x20border:\x201px\x20solid\x20var(--color-border,\x20var(--feedback-border,\x20#d1d5db));\x0a\x20\x20border-radius:\x20var(--radius-small,\x208px);\x0a\x20\x20background:\x20var(--color-surface,\x20var(--feedback-surface,\x20#ffffff));\x0a\x20\x20color:\x20var(--color-text,\x20var(--feedback-text,\x20#111827));\x0a\x20\x20font-size:\x2014px;\x0a}\x0a\x0a.markdown-editor-link-input:focus\x20{\x0a\x20\x20outline:\x20none;\x0a\x20\x20border-color:\x20var(--color-primary,\x20#3f72ff);\x0a\x20\x20box-shadow:\x200\x200\x200\x203px\x20rgba(63,\x20114,\x20255,\x200.2);\x0a}\x0a\x0a.markdown-editor-link-actions\x20{\x0a\x20\x20display:\x20flex;\x0a\x20\x20justify-content:\x20flex-end;\x0a\x20\x20gap:\x208px;\x0a}\x0a\x0a.markdown-editor-link-btn\x20{\x0a\x20\x20border:\x201px\x20solid\x20transparent;\x0a\x20\x20border-radius:\x20var(--radius-small,\x208px);\x0a\x20\x20padding:\x207px\x2012px;\x0a\x20\x20font-size:\x2013px;\x0a\x20\x20font-weight:\x20600;\x0a\x20\x20cursor:\x20pointer;\x0a}\x0a\x0a.markdown-editor-link-btn-secondary\x20{\x0a\x20\x20background:\x20var(--color-surface-muted,\x20var(--feedback-surface-muted,\x20#f3f4f6));\x0a\x20\x20color:\x20var(--color-text,\x20var(--feedback-text,\x20#111827));\x0a\x20\x20border-color:\x20var(--color-border,\x20var(--feedback-border,\x20#d1d5db));\x0a}\x0a\x0a.markdown-editor-link-btn-secondary:hover\x20{\x0a\x20\x20background:\x20var(--color-bg-secondary,\x20var(--feedback-surface-hover,\x20#e5e7eb));\x0a}\x0a\x0a.markdown-editor-link-btn-danger\x20{\x0a\x20\x20background:\x20transparent;\x0a\x20\x20color:\x20var(--color-danger,\x20#dc2626);\x0a\x20\x20border-color:\x20rgba(220,\x2038,\x2038,\x200.35);\x0a}\x0a\x0a.markdown-editor-link-btn-danger:hover\x20{\x0a\x20\x20background:\x20rgba(220,\x2038,\x2038,\x200.08);\x0a}\x0a\x0a.markdown-editor-link-btn-primary\x20{\x0a\x20\x20background:\x20var(--color-primary,\x20#3f72ff);\x0a\x20\x20color:\x20#ffffff;\x0a}\x0a\x0a.markdown-editor-link-btn-primary:hover\x20{\x0a\x20\x20background:\x20var(--color-accent,\x20#2563eb);\x0a}\x0a\x0a[data-theme=\x22dark\x22]\x20.markdown-editor-link-backdrop\x20{\x0a\x20\x20background:\x20rgba(2,\x206,\x2023,\x200.65);\x0a}\x0a\x0a[data-theme=\x22dark\x22]\x20.markdown-editor-link-dialog\x20{\x0a\x20\x20box-shadow:\x200\x2018px\x2042px\x20rgba(0,\x200,\x200,\x200.5);\x0a}\x0a\x0a@media\x20(max-width:\x20480px)\x20{\x0a\x20\x20.markdown-editor-link-dialog\x20{\x0a\x20\x20\x20\x20width:\x20calc(100vw\x20-\x2016px);\x0a\x20\x20\x20\x20padding:\x2012px;\x0a\x20\x20}\x0a\x0a\x20\x20.markdown-editor-link-actions\x20{\x0a\x20\x20\x20\x20flex-wrap:\x20wrap;\x0a\x20\x20}\x0a\x0a\x20\x20.markdown-editor-link-btn\x20{\x0a\x20\x20\x20\x20flex:\x201\x201\x20calc(50%\x20-\x206px);\x0a\x20\x20\x20\x20text-align:\x20center;\x0a\x20\x20}\x0a}\x0a';export class MarkdownEditor{constructor(_0x32846f,_0x5ce235={}){this['element']=_0x32846f,this['options']={'placeholder':_0x5ce235['placeholder']||'Start\x20typing...','editable':_0x5ce235['editable']!==![],'onChange':_0x5ce235['onChange']||null,'minHeight':_0x5ce235['minHeight']||'100px','toolbar':_0x5ce235['toolbar']||![],'onAddAttachments':_0x5ce235['onAddAttachments']||null,'resolveAttachmentUrl':_0x5ce235['resolveAttachmentUrl']||null,'isAttachmentNameTaken':_0x5ce235['isAttachmentNameTaken']||null,'fetchUsers':_0x5ce235['fetchUsers']||null},this['mentionState']={'active':![],'query':'','startOffset':0x0,'startNode':null,'users':[],'filteredUsers':[],'selectedIndex':0x0},this['mentionDropdown']=null,this['usersCache']=null,this['linkDialog']=null,this['linkDialogContext']=null;const _0x507d09=window['TurndownService'];this['turndownService']=new _0x507d09({'headingStyle':'atx','codeBlockStyle':'fenced','emDelimiter':'_','bulletListMarker':'-'}),this['attachmentObjectUrls']=new Map(),this['registerTurndownRules'](),this['init']();}['registerTurndownRules'](){this['turndownService']['addRule']('profoundAttachmentImage',{'filter':_0x26df17=>{return _0x26df17&&_0x26df17['nodeName']==='IMG'&&_0x26df17['getAttribute']&&_0x26df17['getAttribute']('data-attachment-name');},'replacement':(_0x30eb61,_0x3af532)=>{const _0x228300=_0x3af532['getAttribute']('data-attachment-name')||'',_0x589d9b=_0x3af532['getAttribute']('alt')||'',_0x5a254d=_0x228300['trim'](),_0x1cabff=this['escapeAltText'](_0x589d9b||_0x5a254d),_0x363aa4=encodeURIComponent(_0x5a254d);return'';}}),this['turndownService']['addRule']('profoundMention',{'filter':_0x4bade9=>{return _0x4bade9&&_0x4bade9['nodeName']==='SPAN'&&_0x4bade9['getAttribute']&&_0x4bade9['getAttribute']('data-mention-user-id');},'replacement':(_0x4b396d,_0x508c76)=>{const _0x4062a3=_0x508c76['getAttribute']('data-mention-user-id')||'',_0x55a68f=_0x508c76['textContent']||'',_0x2d9ed1=_0x55a68f['startsWith']('@')?_0x55a68f['slice'](0x1):_0x55a68f;return'['+_0x2d9ed1+'](mention:'+_0x4062a3+')';}}),this['turndownService']['addRule']('profoundColoredText',{'filter':_0x1c11a6=>{if(!_0x1c11a6)return![];if(_0x1c11a6['nodeName']==='FONT'&&_0x1c11a6['getAttribute']&&_0x1c11a6['getAttribute']('color'))return!![];if(_0x1c11a6['nodeName']==='SPAN'&&_0x1c11a6['style']&&_0x1c11a6['style']['color']){if(_0x1c11a6['getAttribute']&&_0x1c11a6['getAttribute']('data-mention-user-id'))return![];return!![];}return![];},'replacement':(_0x2320db,_0x241460)=>{if(!_0x2320db['trim']())return _0x2320db;let _0x8f21b5='';if(_0x241460['nodeName']==='FONT')_0x8f21b5=_0x241460['getAttribute']('color')||'';else _0x241460['style']&&_0x241460['style']['color']&&(_0x8f21b5=this['rgbToHex'](_0x241460['style']['color']));if(!_0x8f21b5)return _0x2320db;return'{color:'+_0x8f21b5+'}'+_0x2320db+'{/color}';}});}['rgbToHex'](_0x1153a1){if(!_0x1153a1)return'';if(_0x1153a1['startsWith']('#'))return _0x1153a1;const _0x2cd51e=_0x1153a1['match'](/^rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)$/i);if(!_0x2cd51e)return _0x1153a1;const _0x574a6c=parseInt(_0x2cd51e[0x1],0xa),_0x1f1e0f=parseInt(_0x2cd51e[0x2],0xa),_0x26f3a8=parseInt(_0x2cd51e[0x3],0xa);return'#'+[_0x574a6c,_0x1f1e0f,_0x26f3a8]['map'](_0x8ade4d=>_0x8ade4d['toString'](0x10)['padStart'](0x2,'0'))['join']('')['toUpperCase']();}['escapeAltText'](_0x558f01){return String(_0x558f01||'')['replace'](/\]/g,'\x5c]');}['init'](){this['editor']=document['createElement']('div'),this['editor']['className']='markdown-editor',this['editor']['contentEditable']=this['options']['editable'],this['editor']['setAttribute']('role','textbox'),this['editor']['setAttribute']('aria-multiline','true'),this['editor']['style']['minHeight']=this['options']['minHeight'];this['options']['placeholder']&&this['editor']['setAttribute']('data-placeholder',this['options']['placeholder']);this['options']['toolbar']?(this['container']=document['createElement']('div'),this['container']['className']='markdown-editor-wrapper',this['container']['style']['display']='flex',this['container']['style']['flexDirection']='column',this['createToolbar'](),this['container']['appendChild'](this['toolbar']),this['container']['appendChild'](this['editor']),this['element']['parentNode']['insertBefore'](this['container'],this['element'])):this['element']['parentNode']['insertBefore'](this['editor'],this['element']);this['element']['style']['display']='none',this['isMac']=navigator['platform']['toUpperCase']()['indexOf']('MAC')>=0x0,this['linkHintText']=this['isMac']?'⌘+click\x20to\x20follow':'Ctrl+click\x20to\x20follow';this['options']['editable']&&this['bindEvents']();const _0x538f58=this['element']['textContent']||this['element']['value']||'';_0x538f58['trim']()&&this['setMarkdown'](_0x538f58);}['createToolbar'](){this['toolbar']=document['createElement']('div'),this['toolbar']['className']='markdown-editor-toolbar',this['toolbarButtons']={};const _0x426614=[{'id':'header','icon':ICONS['header'],'title':'Heading','action':'header','isDropdown':!![]},{'separator':!![]},{'id':'bold','icon':ICONS['bold'],'title':'Bold\x20(Ctrl+B)','action':'bold','command':'bold'},{'id':'italic','icon':ICONS['italic'],'title':'Italic\x20(Ctrl+I)','action':'italic','command':'italic'},{'id':'strike','icon':ICONS['strike'],'title':'Strikethrough','action':'strikeThrough','command':'strikeThrough'},{'id':'color','icon':ICONS['color'],'title':'Text\x20Color','action':'color','isDropdown':!![]},{'separator':!![]},{'id':'link','icon':ICONS['link'],'title':'Link\x20(Ctrl+K)','action':'link','tagName':'A'},{'id':'code','icon':ICONS['code'],'title':'Inline\x20Code','action':'code','tagName':'CODE'},{'id':'codeBlock','icon':ICONS['codeBlock'],'title':'Code\x20Block','action':'codeBlock','tagName':'PRE'},{'separator':!![]},{'id':'list-bullet','icon':ICONS['listBullet'],'title':'Bullet\x20List','action':'insertUnorderedList','command':'insertUnorderedList'},{'id':'list-ordered','icon':ICONS['listOrdered'],'title':'Numbered\x20List','action':'insertOrderedList','command':'insertOrderedList'}];_0x426614['forEach'](_0x418dd1=>{if(_0x418dd1['separator']){const _0x4c4b02=document['createElement']('div');_0x4c4b02['className']='markdown-toolbar-separator',_0x4c4b02['style']['width']='1px',_0x4c4b02['style']['height']='16px',_0x4c4b02['style']['background']='var(--color-border)',_0x4c4b02['style']['margin']='0\x206px',_0x4c4b02['style']['alignSelf']='center',this['toolbar']['appendChild'](_0x4c4b02);}else{if(_0x418dd1['isDropdown']){const _0x5543da=document['createElement']('div');_0x5543da['className']='markdown-toolbar-dropdown',_0x5543da['style']['position']='relative';const _0x1e62ac=document['createElement']('button');_0x1e62ac['type']='button',_0x1e62ac['className']='markdown-editor-toolbar-btn\x20markdown-toolbar-dropdown-btn',_0x1e62ac['tabIndex']=-0x1,_0x1e62ac['innerHTML']=_0x418dd1['icon']+'<svg\x20class=\x22dropdown-arrow\x22\x20viewBox=\x220\x200\x2024\x2024\x22\x20width=\x2210\x22\x20height=\x2210\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20fill=\x22none\x22><polyline\x20points=\x226\x209\x2012\x2015\x2018\x209\x22></polyline></svg>',_0x1e62ac['title']=_0x418dd1['title'],_0x1e62ac['dataset']['action']=_0x418dd1['action'];const _0x3c1b89=document['createElement']('div');_0x3c1b89['className']='markdown-toolbar-dropdown-menu',_0x3c1b89['style']['display']='none';if(_0x418dd1['action']==='header')this['createHeaderDropdown'](_0x3c1b89);else _0x418dd1['action']==='color'&&this['createColorDropdown'](_0x3c1b89);_0x1e62ac['addEventListener']('click',_0x29f04f=>{_0x29f04f['preventDefault'](),_0x29f04f['stopPropagation'](),this['toggleDropdown'](_0x3c1b89,_0x1e62ac);}),_0x5543da['appendChild'](_0x1e62ac),_0x5543da['appendChild'](_0x3c1b89),this['toolbar']['appendChild'](_0x5543da),this['toolbarButtons'][_0x418dd1['id']]={'button':_0x1e62ac,'dropdown':_0x3c1b89,'command':_0x418dd1['command'],'tagName':_0x418dd1['tagName']};}else{const _0x2ce767=document['createElement']('button');_0x2ce767['type']='button',_0x2ce767['className']='markdown-editor-toolbar-btn',_0x2ce767['tabIndex']=-0x1,_0x2ce767['innerHTML']=_0x418dd1['icon'],_0x2ce767['title']=_0x418dd1['title'],_0x2ce767['dataset']['action']=_0x418dd1['action'],_0x2ce767['addEventListener']('click',_0x575755=>{_0x575755['preventDefault'](),this['handleToolbarAction'](_0x418dd1['action']);}),this['toolbar']['appendChild'](_0x2ce767),this['toolbarButtons'][_0x418dd1['id']]={'button':_0x2ce767,'command':_0x418dd1['command'],'tagName':_0x418dd1['tagName']};}}}),document['addEventListener']('click',_0x4c2e1a=>{!this['toolbar']['contains'](_0x4c2e1a['target'])&&this['closeAllDropdowns']();});}['createHeaderDropdown'](_0x4f6bfa){const _0x1f46a1=[{'level':0x1,'label':'Heading\x201','tag':'H1'},{'level':0x2,'label':'Heading\x202','tag':'H2'},{'level':0x3,'label':'Heading\x203','tag':'H3'},{'level':0x4,'label':'Heading\x204','tag':'H4'},{'level':0x0,'label':'Normal\x20Text','tag':'P'}];_0x1f46a1['forEach'](_0x37ef14=>{const _0x5609d1=document['createElement']('button');_0x5609d1['type']='button',_0x5609d1['className']='markdown-dropdown-item',_0x5609d1['tabIndex']=-0x1,_0x5609d1['innerHTML']='<span\x20style=\x22font-size:\x20'+(_0x37ef14['level']===0x0?'14px':0x14-_0x37ef14['level']*0x2+'px')+';\x20font-weight:\x20'+(_0x37ef14['level']===0x0?'normal':'bold')+'\x22>'+_0x37ef14['label']+'</span>',_0x5609d1['addEventListener']('click',_0x4e0eab=>{_0x4e0eab['preventDefault'](),_0x4e0eab['stopPropagation'](),this['applyHeader'](_0x37ef14['level']),this['closeAllDropdowns']();}),_0x4f6bfa['appendChild'](_0x5609d1);});}['createColorDropdown'](_0x366d38){const _0x270a0c=[{'value':'#000000','label':'Black'},{'value':'#374151','label':'Gray'},{'value':'#DC2626','label':'Red'},{'value':'#EA580C','label':'Orange'},{'value':'#CA8A04','label':'Yellow'},{'value':'#16A34A','label':'Green'},{'value':'#2563EB','label':'Blue'},{'value':'#7C3AED','label':'Purple'},{'value':'#DB2777','label':'Pink'}],_0x99e016=document['createElement']('div');_0x99e016['className']='markdown-color-grid',_0x99e016['style']['display']='grid',_0x99e016['style']['gridTemplateColumns']='repeat(3,\x201fr)',_0x99e016['style']['gap']='4px',_0x99e016['style']['padding']='8px',_0x270a0c['forEach'](_0x3841a6=>{const _0x1d52e2=document['createElement']('button');_0x1d52e2['type']='button',_0x1d52e2['className']='markdown-color-btn',_0x1d52e2['tabIndex']=-0x1,_0x1d52e2['style']['width']='24px',_0x1d52e2['style']['height']='24px',_0x1d52e2['style']['backgroundColor']=_0x3841a6['value'],_0x1d52e2['style']['border']='1px\x20solid\x20var(--color-border)',_0x1d52e2['style']['borderRadius']='4px',_0x1d52e2['style']['cursor']='pointer',_0x1d52e2['title']=_0x3841a6['label'],_0x1d52e2['addEventListener']('click',_0x21ca77=>{_0x21ca77['preventDefault'](),_0x21ca77['stopPropagation'](),this['applyColor'](_0x3841a6['value']),this['closeAllDropdowns']();}),_0x99e016['appendChild'](_0x1d52e2);}),_0x366d38['appendChild'](_0x99e016);const _0x480408=document['createElement']('button');_0x480408['type']='button',_0x480408['className']='markdown-dropdown-item',_0x480408['innerHTML']='<span>Remove\x20Color</span>',_0x480408['style']['borderTop']='1px\x20solid\x20var(--color-border)',_0x480408['style']['marginTop']='4px',_0x480408['style']['paddingTop']='8px',_0x480408['addEventListener']('click',_0x1ef876=>{_0x1ef876['preventDefault'](),_0x1ef876['stopPropagation'](),this['removeColor'](),this['closeAllDropdowns']();}),_0x366d38['appendChild'](_0x480408);}['toggleDropdown'](_0x53123a,_0x3d9821){const _0x5920a4=_0x53123a['style']['display']!=='none';this['toolbar']&&this['closeAllDropdowns'](),!_0x5920a4&&(_0x53123a['style']['display']='block',_0x3d9821['classList']['add']('active'));}['closeAllDropdowns'](){const _0x21c4fe=this['toolbar']['querySelectorAll']('.markdown-toolbar-dropdown-menu');_0x21c4fe['forEach'](_0x241c73=>_0x241c73['style']['display']='none');const _0x34fd3d=this['toolbar']['querySelectorAll']('.markdown-toolbar-dropdown-btn');_0x34fd3d['forEach'](_0x1b0db5=>_0x1b0db5['classList']['remove']('active'));}['applyHeader'](_0x16a0d6){this['editor']['focus']();const _0x2e0b9a=window['getSelection']();if(!_0x2e0b9a||_0x2e0b9a['rangeCount']===0x0)return;const _0x6bfbc4=_0x2e0b9a['getRangeAt'](0x0);let _0x1774ab=_0x6bfbc4['startContainer'];while(_0x1774ab&&_0x1774ab!==this['editor']){if(_0x1774ab['nodeType']===Node['ELEMENT_NODE']){const _0x5ac44b=window['getComputedStyle'](_0x1774ab)['display'];if(_0x5ac44b==='block'||['P','H1','H2','H3','H4','H5','H6','DIV']['includes'](_0x1774ab['tagName']))break;}_0x1774ab=_0x1774ab['parentNode'];}_0x16a0d6===0x0?document['execCommand']('formatBlock',![],'p'):document['execCommand']('formatBlock',![],'h'+_0x16a0d6),this['editor']['dispatchEvent'](new Event('input'));}['applyColor'](_0x3c6ff1){this['editor']['focus'](),document['execCommand']('foreColor',![],_0x3c6ff1),this['editor']['dispatchEvent'](new Event('input'));}['removeColor'](){this['editor']['focus'](),document['execCommand']('removeFormat',![],null),this['editor']['dispatchEvent'](new Event('input'));}['handleToolbarAction'](_0x4af33a){this['editor']['focus']();switch(_0x4af33a){case'bold':case'italic':case'strikeThrough':case'insertUnorderedList':case'insertOrderedList':document['execCommand'](_0x4af33a,![],null);break;case'link':this['openLinkDialog']();return;case'code':this['toggleInlineCode']();break;case'codeBlock':this['insertCodeBlock']();break;}this['updateToolbarState'](),this['editor']['dispatchEvent'](new Event('input'));}['ensureLinkDialog'](){if(this['linkDialog'])return;this['ensureLinkDialogStyles']();const _0x475d77=document['createElement']('div');_0x475d77['className']='markdown-editor-link-modal',_0x475d77['hidden']=!![],_0x475d77['innerHTML']='\x0a\x20\x20\x20\x20\x20\x20<div\x20class=\x22markdown-editor-link-backdrop\x22></div>\x0a\x20\x20\x20\x20\x20\x20<div\x20class=\x22markdown-editor-link-dialog\x22\x20role=\x22dialog\x22\x20aria-modal=\x22true\x22\x20aria-label=\x22Edit\x20link\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22markdown-editor-link-header\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<h3\x20class=\x22markdown-editor-link-title\x22>Insert\x20Link</h3>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<button\x20type=\x22button\x22\x20class=\x22markdown-editor-link-close\x22\x20aria-label=\x22Close\x22>×</button>\x0a\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20<form\x20class=\x22markdown-editor-link-form\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22markdown-editor-link-field-grid\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<label\x20class=\x22markdown-editor-link-label\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20URL\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<input\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20class=\x22markdown-editor-link-input\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20data-link-field=\x22url\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20type=\x22text\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20placeholder=\x22https://example.com\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20autocomplete=\x22off\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20spellcheck=\x22false\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20>\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=\x22markdown-editor-link-label\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20Display\x20text\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<input\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20class=\x22markdown-editor-link-input\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20data-link-field=\x22text\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20type=\x22text\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20placeholder=\x22Text\x20shown\x20to\x20readers\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20autocomplete=\x22off\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20spellcheck=\x22false\x22\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20>\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=\x22markdown-editor-link-actions\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<button\x20type=\x22button\x22\x20class=\x22markdown-editor-link-btn\x20markdown-editor-link-btn-secondary\x22\x20data-action=\x22cancel\x22>Cancel</button>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<button\x20type=\x22button\x22\x20class=\x22markdown-editor-link-btn\x20markdown-editor-link-btn-danger\x22\x20data-action=\x22remove\x22\x20hidden>Remove\x20Link</button>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<button\x20type=\x22submit\x22\x20class=\x22markdown-editor-link-btn\x20markdown-editor-link-btn-primary\x22>Insert\x20Link</button>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20\x20\x20</form>\x0a\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20',document['body']['appendChild'](_0x475d77),this['linkDialog']=_0x475d77,this['linkDialogElements']={'backdrop':_0x475d77['querySelector']('.markdown-editor-link-backdrop'),'title':_0x475d77['querySelector']('.markdown-editor-link-title'),'close':_0x475d77['querySelector']('.markdown-editor-link-close'),'form':_0x475d77['querySelector']('.markdown-editor-link-form'),'urlInput':_0x475d77['querySelector']('[data-link-field=\x22url\x22]'),'textInput':_0x475d77['querySelector']('[data-link-field=\x22text\x22]'),'remove':_0x475d77['querySelector']('[data-action=\x22remove\x22]'),'cancel':_0x475d77['querySelector']('[data-action=\x22cancel\x22]'),'submit':_0x475d77['querySelector']('.markdown-editor-link-btn-primary')},this['linkDialogElements']['backdrop']['addEventListener']('click',()=>{this['closeLinkDialog']({'restoreSelection':!![]});}),this['linkDialogElements']['close']['addEventListener']('click',()=>{this['closeLinkDialog']({'restoreSelection':!![]});}),this['linkDialogElements']['cancel']['addEventListener']('click',()=>{this['closeLinkDialog']({'restoreSelection':!![]});}),this['linkDialogElements']['remove']['addEventListener']('click',()=>{this['applyLinkDialogResult']({'remove':!![]});}),this['linkDialogElements']['form']['addEventListener']('submit',_0x114182=>{_0x114182['preventDefault'](),this['applyLinkDialogResult']();}),this['linkDialog']['addEventListener']('keydown',_0xbb8d9e=>{_0xbb8d9e['key']==='Escape'&&(_0xbb8d9e['preventDefault'](),this['closeLinkDialog']({'restoreSelection':!![]}));});}['openLinkDialog'](){const _0x17603f=window['getSelection']();if(!_0x17603f||_0x17603f['rangeCount']===0x0)return;const _0x5ba5d2=_0x17603f['getRangeAt'](0x0),_0x4f7d6d=this['editor']['contains'](_0x5ba5d2['commonAncestorContainer'])||this['editor']===_0x5ba5d2['commonAncestorContainer'];if(!_0x4f7d6d)return;this['toolbar']&&this['closeAllDropdowns']();this['ensureLinkDialog']();const _0x1a900d=_0x5ba5d2['cloneRange'](),_0x4a5b80=this['findLinkAtRange'](_0x1a900d),_0x5bf35f=_0x4a5b80?_0x4a5b80['getAttribute']('href')||'':'',_0x202002=_0x4a5b80?_0x4a5b80['textContent']||'':_0x1a900d['toString']();this['linkDialogContext']={'range':_0x1a900d,'existingLink':_0x4a5b80,'selectedText':_0x202002},this['linkDialogElements']['title']['textContent']=_0x4a5b80?'Edit\x20Link':'Insert\x20Link',this['linkDialogElements']['submit']['textContent']=_0x4a5b80?'Save\x20Link':'Insert\x20Link',this['linkDialogElements']['remove']['hidden']=!_0x4a5b80,this['linkDialogElements']['urlInput']['value']=_0x5bf35f,this['linkDialogElements']['textInput']['value']=_0x202002,this['linkDialog']['hidden']=![],this['linkDialogElements']['urlInput']['focus'](),this['linkDialogElements']['urlInput']['select']();}['closeLinkDialog']({restoreSelection:restoreSelection=![]}={}){if(!this['linkDialog'])return;const _0x364a88=this['linkDialogContext'];this['linkDialog']['hidden']=!![],restoreSelection&&_0x364a88?.['range']&&(this['editor']['focus'](),this['restoreRange'](_0x364a88['range'])),this['linkDialogContext']=null;}['applyLinkDialogResult']({remove:remove=![]}={}){if(!this['linkDialog']||!this['linkDialogContext'])return;const _0x2f211a=this['linkDialogContext'],_0x35adf5=(this['linkDialogElements']['urlInput']['value']||'')['trim'](),_0x3b3b04=this['linkDialogElements']['textInput']['value']||'',_0x370f0c=_0x3b3b04['trim']();if(!remove&&!_0x35adf5){this['linkDialogElements']['urlInput']['focus']();return;}this['closeLinkDialog'](),this['editor']['focus'](),this['restoreRange'](_0x2f211a['range']);if(remove)_0x2f211a['existingLink']&&_0x2f211a['existingLink']['parentNode']?this['unwrapLinkElement'](_0x2f211a['existingLink']):document['execCommand']('unlink',![],null);else{if(_0x2f211a['existingLink']&&_0x2f211a['existingLink']['parentNode'])_0x2f211a['existingLink']['setAttribute']('href',_0x35adf5),_0x2f211a['existingLink']['textContent']=_0x370f0c||_0x35adf5;else{const _0xe72831=window['getSelection']();if(!_0xe72831||_0xe72831['rangeCount']===0x0)return;const _0x25d120=_0xe72831['getRangeAt'](0x0),_0x9f29c2=(_0x2f211a['selectedText']||'')['trim'](),_0x2cc677=_0x370f0c||_0x9f29c2||_0x35adf5;_0x25d120['deleteContents']();const _0x302fbb=document['createElement']('a');_0x302fbb['href']=_0x35adf5,_0x302fbb['textContent']=_0x2cc677,_0x25d120['insertNode'](_0x302fbb),_0x25d120['setStartAfter'](_0x302fbb),_0x25d120['collapse'](!![]),_0xe72831['removeAllRanges'](),_0xe72831['addRange'](_0x25d120);}}this['addLinkHints'](),this['updateToolbarState'](),this['editor']['dispatchEvent'](new Event('input'));}['ensureLinkDialogStyles'](){if(document['getElementById'](LINK_DIALOG_STYLE_ID))return;const _0x5c8eba=document['createElement']('style');_0x5c8eba['id']=LINK_DIALOG_STYLE_ID,_0x5c8eba['textContent']=LINK_DIALOG_STYLES,document['head']['appendChild'](_0x5c8eba);}['restoreRange'](_0x3294fb){const _0x455195=window['getSelection']();if(!_0x455195)return;try{_0x455195['removeAllRanges'](),_0x455195['addRange'](_0x3294fb);return;}catch(_0x27a93c){}const _0x1cbe72=document['createRange']();_0x1cbe72['selectNodeContents'](this['editor']),_0x1cbe72['collapse'](![]),_0x455195['removeAllRanges'](),_0x455195['addRange'](_0x1cbe72);}['findLinkAtRange'](_0x11f27f){if(!_0x11f27f)return null;const _0x284c77=this['findParentLink'](_0x11f27f['startContainer']);if(_0x11f27f['collapsed'])return _0x284c77;const _0x282633=this['findParentLink'](_0x11f27f['endContainer']);if(_0x284c77&&_0x284c77===_0x282633)return _0x284c77;if(_0x284c77&&_0x284c77['contains'](_0x11f27f['endContainer']))return _0x284c77;if(_0x282633&&_0x282633['contains'](_0x11f27f['startContainer']))return _0x282633;return null;}['findParentLink'](_0x3c8025){let _0x133029=_0x3c8025;while(_0x133029&&_0x133029!==this['editor']){if(_0x133029['nodeType']===Node['ELEMENT_NODE']&&_0x133029['tagName']==='A'){const _0x298782=_0x133029['getAttribute']('href')||'';if(_0x298782['startsWith']('mention:'))return null;return _0x133029;}_0x133029=_0x133029['parentNode'];}return null;}['unwrapLinkElement'](_0x2f3d3b){const _0x243e01=_0x2f3d3b['parentNode'];if(!_0x243e01)return;while(_0x2f3d3b['firstChild']){_0x243e01['insertBefore'](_0x2f3d3b['firstChild'],_0x2f3d3b);}_0x243e01['removeChild'](_0x2f3d3b);}['isSelectionInTag'](_0xf3a597){const _0x5b4486=window['getSelection']();if(!_0x5b4486||_0x5b4486['rangeCount']===0x0)return![];let _0x550328=_0x5b4486['anchorNode'];while(_0x550328&&_0x550328!==this['editor']){if(_0x550328['nodeType']===Node['ELEMENT_NODE']&&_0x550328['tagName']===_0xf3a597)return!![];_0x550328=_0x550328['parentNode'];}return![];}['updateToolbarState'](){if(!this['toolbarButtons'])return;for(const [_0x4a9eb7,_0x46e779]of Object['entries'](this['toolbarButtons'])){let _0x54ed23=![];if(_0x46e779['command'])try{_0x54ed23=document['queryCommandState'](_0x46e779['command']);}catch(_0x402458){_0x54ed23=![];}else _0x46e779['tagName']&&(_0x54ed23=this['isSelectionInTag'](_0x46e779['tagName']));_0x46e779['button']['classList']['toggle']('active',_0x54ed23);}}['bindEvents'](){this['editor']['addEventListener']('keydown',_0xdac6e2=>this['handleKeydown'](_0xdac6e2)),this['editor']['addEventListener']('input',_0x2f5541=>{this['handleMentionInput'](_0x2f5541),this['handleAutoFormat'](_0x2f5541);}),this['editor']['addEventListener']('input',()=>{const _0x4782f1=this['editor']['textContent']['trim']()!==''||this['editor']['innerHTML']['includes']('<br')||this['editor']['innerHTML']['includes']('<div')||this['editor']['innerHTML']['includes']('<img');!_0x4782f1&&(this['editor']['innerHTML']='');this['updatePlaceholder']();const _0x41cb4e=this['getMarkdown']();this['element']['tagName']==='TEXTAREA'||this['element']['tagName']==='INPUT'?this['element']['value']=_0x41cb4e:this['element']['textContent']=_0x41cb4e,this['options']['onChange']&&this['options']['onChange'](_0x41cb4e);}),this['editor']['addEventListener']('paste',_0x23871b=>this['handlePaste'](_0x23871b)),this['editor']['addEventListener']('dragover',_0x1c7bd1=>this['handleDragOver'](_0x1c7bd1)),this['editor']['addEventListener']('drop',_0x1a3e42=>this['handleDrop'](_0x1a3e42)),this['editor']['addEventListener']('dragstart',_0x1b5775=>this['handleDragStart'](_0x1b5775)),this['options']['toolbar']&&(this['selectionChangeHandler']=()=>{(this['editor']['contains'](document['activeElement'])||this['editor']===document['activeElement'])&&this['updateToolbarState']();},document['addEventListener']('selectionchange',this['selectionChangeHandler']),this['editor']['addEventListener']('keyup',()=>this['updateToolbarState']()),this['editor']['addEventListener']('mouseup',()=>this['updateToolbarState']()),this['editor']['addEventListener']('focus',()=>this['updateToolbarState']())),this['linkClickHandler']=_0x11ded4=>this['handleLinkClick'](_0x11ded4),this['editor']['addEventListener']('click',this['linkClickHandler']),this['linkMouseEnterHandler']=_0x140754=>this['handleLinkMouseEnter'](_0x140754),this['linkMouseLeaveHandler']=_0x3fa060=>this['handleLinkMouseLeave'](_0x3fa060),this['editor']['addEventListener']('mouseover',this['linkMouseEnterHandler']),this['editor']['addEventListener']('mouseout',this['linkMouseLeaveHandler']),this['updatePlaceholder']();}['handleAutoFormat'](_0x5915c7){if(_0x5915c7['inputType']==='deleteContentBackward')return;const _0x5876a9=window['getSelection']();if(!_0x5876a9||_0x5876a9['rangeCount']===0x0)return;const _0xa4ffc9=_0x5876a9['getRangeAt'](0x0),_0x599cdc=_0xa4ffc9['startContainer'];if(_0x599cdc['nodeType']!==Node['TEXT_NODE'])return;if(this['isSelectionInTag']('CODE')||this['isSelectionInTag']('PRE'))return;const _0x5c172a=_0x599cdc['textContent'],_0x5e514f=_0xa4ffc9['startOffset'],_0x2a7b47=_0x5c172a['slice'](0x0,_0x5e514f);if(_0x2a7b47['endsWith']('```')){_0xa4ffc9['setStart'](_0x599cdc,_0x5e514f-0x3),_0xa4ffc9['setEnd'](_0x599cdc,_0x5e514f),_0xa4ffc9['deleteContents'](),this['insertCodeBlock']();return;}const _0x58638b=/`([^`]+)`$/,_0x452a4c=_0x2a7b47['match'](_0x58638b);if(_0x452a4c){const _0x16db8e=_0x452a4c[0x1];if(_0x16db8e){const _0x5d1735=_0x452a4c['index'],_0x4afc24=_0x5d1735+_0x16db8e['length']+0x2;_0xa4ffc9['setStart'](_0x599cdc,_0x5d1735),_0xa4ffc9['setEnd'](_0x599cdc,_0x5e514f),_0xa4ffc9['deleteContents']();const _0x185961=document['createElement']('code');_0x185961['textContent']=_0x16db8e,_0xa4ffc9['insertNode'](_0x185961),_0xa4ffc9['setStartAfter'](_0x185961),_0xa4ffc9['setEndAfter'](_0x185961);const _0x3ee459=document['createTextNode']('');_0xa4ffc9['insertNode'](_0x3ee459),_0xa4ffc9['setStartAfter'](_0x3ee459),_0xa4ffc9['setEndAfter'](_0x3ee459),_0x5876a9['removeAllRanges'](),_0x5876a9['addRange'](_0xa4ffc9);return;}}const _0x32e1bc=_0x2a7b47['match'](/^[-*][\s\u00A0]$/);if(_0x32e1bc&&this['isAtStartOfBlock'](_0x599cdc)){if(this['isSelectionInTag']('UL')||this['isSelectionInTag']('OL'))return;_0xa4ffc9['setStart'](_0x599cdc,Math['max'](_0x5e514f-0x2,0x0)),_0xa4ffc9['setEnd'](_0x599cdc,_0x5e514f),_0xa4ffc9['deleteContents']();const _0x8ef7c1=this['ensureListInsertionAnchor'](_0x599cdc);document['execCommand']('insertUnorderedList',![],null);_0x8ef7c1&&_0x8ef7c1['parentNode']&&_0x8ef7c1['parentNode']['removeChild'](_0x8ef7c1);this['updateToolbarState']();return;}const _0x5244d8=_0x2a7b47['match'](/^1\.[\s\u00A0]$/);if(_0x5244d8&&this['isAtStartOfBlock'](_0x599cdc)){if(this['isSelectionInTag']('UL')||this['isSelectionInTag']('OL'))return;_0xa4ffc9['setStart'](_0x599cdc,Math['max'](_0x5e514f-0x3,0x0)),_0xa4ffc9['setEnd'](_0x599cdc,_0x5e514f),_0xa4ffc9['deleteContents']();const _0x354831=this['ensureListInsertionAnchor'](_0x599cdc);document['execCommand']('insertOrderedList',![],null);_0x354831&&_0x354831['parentNode']&&_0x354831['parentNode']['removeChild'](_0x354831);this['updateToolbarState']();return;}}['isAtStartOfBlock'](_0x24a500){let _0x520211=_0x24a500;while(_0x520211&&_0x520211!==this['editor']){const _0x15aae2=_0x520211['parentNode'];if(!_0x15aae2)break;const _0x5318db=_0x15aae2['tagName'];if(_0x5318db==='DIV'||_0x5318db==='P'||_0x5318db==='LI'||_0x15aae2===this['editor']){let _0x1cb244=_0x15aae2['firstChild'];while(_0x1cb244&&(_0x1cb244['nodeType']===Node['TEXT_NODE']&&_0x1cb244['textContent']===''||_0x1cb244['nodeType']===Node['ELEMENT_NODE']&&_0x1cb244['tagName']==='BR')){_0x1cb244=_0x1cb244['nextSibling'];}return _0x1cb244===_0x24a500||_0x1cb244===_0x520211;}_0x520211=_0x15aae2;}if(_0x520211===this['editor']||_0x24a500['parentNode']===this['editor']){let _0x203ce5=this['editor']['firstChild'];while(_0x203ce5&&(_0x203ce5['nodeType']===Node['TEXT_NODE']&&_0x203ce5['textContent']===''||_0x203ce5['nodeType']===Node['ELEMENT_NODE']&&_0x203ce5['tagName']==='BR')){_0x203ce5=_0x203ce5['nextSibling'];}return _0x203ce5===_0x24a500;}return![];}['getClosestBlockElement'](_0x466530){let _0x4e3337=_0x466530;while(_0x4e3337&&_0x4e3337!==this['editor']){const _0x3400ac=_0x4e3337['parentNode'];if(!_0x3400ac)break;const _0x4934ca=_0x3400ac['tagName'];if(_0x4934ca==='DIV'||_0x4934ca==='P'||_0x4934ca==='LI'||_0x3400ac===this['editor'])return _0x3400ac;_0x4e3337=_0x3400ac;}return this['editor'];}['ensureListInsertionAnchor'](_0x151983){const _0x1ae9ae=window['getSelection']();if(!_0x1ae9ae||_0x1ae9ae['rangeCount']===0x0)return null;const _0x6c0c7c=this['getClosestBlockElement'](_0x151983);if(!_0x6c0c7c||_0x6c0c7c===this['editor'])return null;const _0x1906b3=_0x6c0c7c['textContent']['replace'](/\u200B/g,'');if(_0x1906b3!=='')return null;const _0x2de86a=document['createTextNode']('');_0x6c0c7c['appendChild'](_0x2de86a);const _0x4e89ff=document['createRange']();return _0x4e89ff['setStart'](_0x2de86a,0x1),_0x4e89ff['setEnd'](_0x2de86a,0x1),_0x1ae9ae['removeAllRanges'](),_0x1ae9ae['addRange'](_0x4e89ff),_0x2de86a;}['getContainingListItem'](){const _0x2a3dbd=window['getSelection']();if(!_0x2a3dbd||_0x2a3dbd['rangeCount']===0x0)return null;let _0x104c58=_0x2a3dbd['anchorNode'];while(_0x104c58&&_0x104c58!==this['editor']){if(_0x104c58['nodeType']===Node['ELEMENT_NODE']&&_0x104c58['tagName']==='LI')return _0x104c58;_0x104c58=_0x104c58['parentNode'];}return null;}['isEmptyListItem'](_0x1bf89e){if(!_0x1bf89e)return![];const _0x209f79=_0x1bf89e['textContent']['replace'](/\u200B/g,'')['trim']();if(_0x209f79!=='')return![];const _0x5657fb=_0x1bf89e['querySelector']('img');if(_0x5657fb)return![];const _0x4917b0=_0x1bf89e['querySelector']('ul,\x20ol');if(_0x4917b0)return![];return!![];}['isCursorAtStartOfListItem'](_0x3d4865){if(!_0x3d4865)return![];const _0x236165=window['getSelection']();if(!_0x236165||_0x236165['rangeCount']===0x0||!_0x236165['isCollapsed'])return![];const _0x3a7f00=_0x236165['getRangeAt'](0x0),_0x21ae36=_0x3a7f00['startContainer'];if(_0x21ae36!==_0x3d4865&&!_0x3d4865['contains'](_0x21ae36))return![];const _0x515322=_0x3a7f00['cloneRange']();_0x515322['setStart'](_0x3d4865,0x0),_0x515322['setEnd'](_0x21ae36,_0x3a7f00['startOffset']);const _0x2ad657=_0x515322['toString']()['replace'](/\u200B/g,'')['replace'](/\u00A0/g,'\x20');return _0x2ad657['trim']()==='';}['indentListItem'](_0x1f32a2){const _0x1ea09d=_0x1f32a2['previousElementSibling'];if(!_0x1ea09d||_0x1ea09d['tagName']!=='LI')return;const _0x54d0c5=_0x1f32a2['parentNode'],_0x5cb5bf=_0x54d0c5['tagName'];let _0x38a3d9=_0x1ea09d['querySelector'](':scope\x20>\x20ul,\x20:scope\x20>\x20ol');!_0x38a3d9&&(_0x38a3d9=document['createElement'](_0x5cb5bf),_0x1ea09d['appendChild'](_0x38a3d9)),_0x38a3d9['appendChild'](_0x1f32a2),this['placeCursorInListItem'](_0x1f32a2);}['outdentListItem'](_0x2d4f18){const _0x822af4=_0x2d4f18['parentNode'];if(!_0x822af4||_0x822af4['tagName']!=='UL'&&_0x822af4['tagName']!=='OL')return;const _0x422de5=_0x822af4['parentNode'];if(_0x422de5&&_0x422de5['tagName']==='LI'){const _0x2013fa=_0x422de5['parentNode'];_0x2013fa['insertBefore'](_0x2d4f18,_0x422de5['nextSibling']),_0x822af4['children']['length']===0x0&&_0x822af4['remove'](),this['placeCursorInListItem'](_0x2d4f18);}else return;}['exitListOnEmptyBullet'](_0x1bea31){const _0x43a6e6=_0x1bea31['parentNode'];if(!_0x43a6e6)return;const _0x297d17=_0x43a6e6['parentNode'];if(_0x297d17&&_0x297d17['tagName']==='LI'){this['outdentListItem'](_0x1bea31);return;}const _0x55ce9e=_0x43a6e6['parentNode'],_0x44c211=document['createElement']('p');_0x44c211['innerHTML']='<br>',_0x55ce9e['insertBefore'](_0x44c211,_0x43a6e6['nextSibling']),_0x1bea31['remove']();_0x43a6e6['children']['length']===0x0&&_0x43a6e6['remove']();const _0x1df3be=window['getSelection'](),_0xc8ef57=document['createRange']();_0xc8ef57['setStart'](_0x44c211,0x0),_0xc8ef57['collapse'](!![]),_0x1df3be['removeAllRanges'](),_0x1df3be['addRange'](_0xc8ef57);}['placeCursorInListItem'](_0x5a4c8c){const _0x4a6333=window['getSelection'](),_0x3fd497=document['createRange'](),_0xea9dc8=document['createTreeWalker'](_0x5a4c8c,NodeFilter['SHOW_TEXT'],null,![]),_0x3eeeac=_0xea9dc8['nextNode']();_0x3eeeac?_0x3fd497['setStart'](_0x3eeeac,0x0):_0x3fd497['setStart'](_0x5a4c8c,0x0),_0x3fd497['collapse'](!![]),_0x4a6333['removeAllRanges'](),_0x4a6333['addRange'](_0x3fd497);}['handleLinkClick'](_0x505043){const _0x9424e6=this['isMac']?_0x505043['metaKey']:_0x505043['ctrlKey'];if(!_0x9424e6)return;let _0x1b27b7=_0x505043['target'];while(_0x1b27b7&&_0x1b27b7!==this['editor']){if(_0x1b27b7['tagName']==='A'){_0x505043['preventDefault'](),_0x505043['stopPropagation']();const _0x4c4683=_0x1b27b7['getAttribute']('href');if(!_0x4c4683)return;if(_0x4c4683['startsWith']('mention:'))return;const _0x278f58=/^https?:\/\//i['test'](_0x4c4683);_0x278f58?window['open'](_0x4c4683,'_blank','noopener,noreferrer'):window['location']['href']=_0x4c4683;return;}_0x1b27b7=_0x1b27b7['parentNode'];}}['handleLinkMouseEnter'](_0x2c58da){const _0x236528=_0x2c58da['target'];if(_0x236528['tagName']!=='A')return;const _0x360bfc=_0x236528['getAttribute']('href')||'';if(_0x360bfc['startsWith']('mention:'))return;this['linkTooltipTimeout']&&clearTimeout(this['linkTooltipTimeout']),this['linkTooltipTimeout']=setTimeout(()=>{this['showLinkTooltip'](_0x236528);},0x12c);}['handleLinkMouseLeave'](_0x1b7530){const _0x2b28c4=_0x1b7530['target'];if(_0x2b28c4['tagName']!=='A')return;this['linkTooltipTimeout']&&(clearTimeout(this['linkTooltipTimeout']),this['linkTooltipTimeout']=null),this['hideLinkTooltip']();}['showLinkTooltip'](_0x238d07){!this['linkTooltip']&&(this['linkTooltip']=document['createElement']('div'),this['linkTooltip']['className']='markdown-editor-link-tooltip',document['body']['appendChild'](this['linkTooltip']));this['linkTooltip']['textContent']=this['linkHintText']||'Ctrl+click\x20to\x20follow';const _0x495501=_0x238d07['getBoundingClientRect'](),_0x2fc608=this['linkTooltip']['getBoundingClientRect']();let _0x926dce=_0x495501['bottom']+0x4,_0x5070a1=_0x495501['left']+_0x495501['width']/0x2;_0x926dce+0x1e>window['innerHeight']&&(_0x926dce=_0x495501['top']-0x1e);const _0x2fd280=0x78;if(_0x5070a1-_0x2fd280/0x2<0xa)_0x5070a1=_0x2fd280/0x2+0xa;else _0x5070a1+_0x2fd280/0x2>window['innerWidth']-0xa&&(_0x5070a1=window['innerWidth']-_0x2fd280/0x2-0xa);this['linkTooltip']['style']['top']=_0x926dce+'px',this['linkTooltip']['style']['left']=_0x5070a1+'px',this['linkTooltip']['style']['transform']='translateX(-50%)',this['linkTooltip']['classList']['add']('visible');}['hideLinkTooltip'](){this['linkTooltip']&&this['linkTooltip']['classList']['remove']('visible');}['handleKeydown'](_0x5468f7){if(this['mentionState']['active']){if(_0x5468f7['key']==='ArrowDown'){_0x5468f7['preventDefault'](),this['mentionNavigate'](0x1);return;}if(_0x5468f7['key']==='ArrowUp'){_0x5468f7['preventDefault'](),this['mentionNavigate'](-0x1);return;}if(_0x5468f7['key']==='Enter'||_0x5468f7['key']==='Tab'){if(this['mentionState']['filteredUsers']['length']>0x0){_0x5468f7['preventDefault'](),this['insertMention'](this['mentionState']['filteredUsers'][this['mentionState']['selectedIndex']]);return;}}if(_0x5468f7['key']==='Escape'){_0x5468f7['preventDefault'](),this['closeMentionDropdown']();return;}}if(_0x5468f7['key']==='Tab'&&(this['isSelectionInTag']('UL')||this['isSelectionInTag']('OL'))){const _0x5e72bd=this['getContainingListItem']();if(_0x5e72bd&&this['isCursorAtStartOfListItem'](_0x5e72bd)){_0x5468f7['preventDefault']();_0x5468f7['shiftKey']?this['outdentListItem'](_0x5e72bd):this['indentListItem'](_0x5e72bd);this['editor']['dispatchEvent'](new Event('input',{'bubbles':!![]}));return;}}if(_0x5468f7['key']==='Enter'&&!_0x5468f7['shiftKey']&&(this['isSelectionInTag']('UL')||this['isSelectionInTag']('OL'))){const _0x4665d3=this['getContainingListItem']();if(_0x4665d3&&this['isEmptyListItem'](_0x4665d3)){_0x5468f7['preventDefault'](),this['exitListOnEmptyBullet'](_0x4665d3),this['editor']['dispatchEvent'](new Event('input',{'bubbles':!![]}));return;}}if(_0x5468f7['key']==='Enter'&&!_0x5468f7['shiftKey']&&this['isSelectionInTag']('PRE')){_0x5468f7['preventDefault']();const _0x515247=window['getSelection']();if(_0x515247['rangeCount']>0x0){const _0x41739d=_0x515247['getRangeAt'](0x0);_0x41739d['deleteContents']();const _0x136c29=document['createTextNode']('\x0a');_0x41739d['insertNode'](_0x136c29),_0x41739d['setStartAfter'](_0x136c29),_0x41739d['setEndAfter'](_0x136c29),_0x515247['removeAllRanges'](),_0x515247['addRange'](_0x41739d),this['handleInput']();}return;}(_0x5468f7['ctrlKey']||_0x5468f7['metaKey'])&&_0x5468f7['key']==='b'&&(_0x5468f7['preventDefault'](),document['execCommand']('bold',![],null));(_0x5468f7['ctrlKey']||_0x5468f7['metaKey'])&&_0x5468f7['key']==='i'&&(_0x5468f7['preventDefault'](),document['execCommand']('italic',![],null));if((_0x5468f7['ctrlKey']||_0x5468f7['metaKey'])&&_0x5468f7['key']==='k'){_0x5468f7['preventDefault'](),this['openLinkDialog']();return;}}['handlePaste'](_0x107f96){const _0x45e82b=_0x107f96['clipboardData'];if(_0x45e82b&&this['options']['onAddAttachments']){const _0x4ee871=this['extractImageFilesFromClipboard'](_0x45e82b);if(_0x4ee871['length']>0x0){_0x107f96['preventDefault'](),this['addAndInsertImages'](_0x4ee871);return;}}_0x107f96['preventDefault']();const _0x537d65=_0x107f96['clipboardData']['getData']('text/html');if(_0x537d65&&_0x537d65['trim']()){const _0x36b42d=this['convertPastedHtmlToMarkdown'](_0x537d65);if(_0x36b42d&&_0x36b42d['trim']()){this['insertMarkdownAsRichText'](_0x36b42d);return;}}const _0x4ce674=_0x107f96['clipboardData']['getData']('text/plain');document['execCommand']('insertText',![],_0x4ce674);}['convertPastedHtmlToMarkdown'](_0x1377a6){const _0xa41c1e=document['createElement']('div');_0xa41c1e['innerHTML']=_0x1377a6;const _0x41a8b3=_0xa41c1e['querySelectorAll']('style,\x20script,\x20meta,\x20link,\x20head,\x20title');_0x41a8b3['forEach'](_0x4054f8=>_0x4054f8['remove']());const _0x3bebf0=_0xa41c1e['querySelectorAll']('*');_0x3bebf0['forEach'](_0x24233b=>{const _0x1292ab=Array['from'](_0x24233b['attributes']);_0x1292ab['forEach'](_0x3a91be=>{_0x3a91be['name']['startsWith']('data-')&&_0x3a91be['name']!=='data-attachment-name'&&_0x3a91be['name']!=='data-mention-user-id'&&_0x24233b['removeAttribute'](_0x3a91be['name']);});}),_0xa41c1e['querySelectorAll']('font[color]')['forEach'](_0x1aa318=>{_0x1aa318['replaceWith'](..._0x1aa318['childNodes']);}),_0xa41c1e['querySelectorAll']('span')['forEach'](_0x48ceca=>{_0x48ceca['style']['color']&&_0x48ceca['style']['removeProperty']('color'),!_0x48ceca['getAttribute']('style')&&!_0x48ceca['getAttribute']('data-mention-user-id')&&!_0x48ceca['getAttribute']('data-attachment-name')&&_0x48ceca['replaceWith'](..._0x48ceca['childNodes']);});try{return this['turndownService']['turndown'](_0xa41c1e['innerHTML']);}catch(_0x5b22ca){return console['warn']('Failed\x20to\x20convert\x20HTML\x20to\x20markdown:',_0x5b22ca),null;}}['insertMarkdownAsRichText'](_0x3e979d){const _0x1b7a9e=window['marked'];if(!_0x1b7a9e){document['execCommand']('insertText',![],_0x3e979d);return;}try{const _0x3927d0=this['preprocessColorSyntax'](_0x3e979d),_0x121c43=_0x1b7a9e['parse'](_0x3927d0),_0x123858=document['createElement']('div');_0x123858['innerHTML']=_0x121c43,this['processHtmlForEditor'](_0x123858),document['execCommand']('insertHTML',![],_0x123858['innerHTML']);}catch(_0x2acd44){console['warn']('Failed\x20to\x20convert\x20markdown\x20to\x20HTML:',_0x2acd44),document['execCommand']('insertText',![],_0x3e979d);}}['processHtmlForEditor'](_0x2da2c2){const _0x86ee33=_0x2da2c2['querySelectorAll']('pre');_0x86ee33['forEach'](_0x5bef75=>{const _0x1ad759=_0x5bef75['querySelector']('code');if(_0x1ad759){const _0x454cc1=Array['from'](_0x1ad759['classList'])['find'](_0x44407b=>_0x44407b['startsWith']('language-')),_0x4c545f=_0x454cc1?_0x454cc1['replace']('language-',''):'',_0x1c8b1f=document['createElement']('pre');_0x4c545f&&_0x1c8b1f['setAttribute']('data-language',_0x4c545f),_0x1c8b1f['textContent']=_0x1ad759['textContent'],_0x5bef75['replaceWith'](_0x1c8b1f);}});const _0x3fd472=_0x2da2c2['querySelectorAll']('a');_0x3fd472['forEach'](_0x99284a=>{_0x99284a['setAttribute']('target','_blank'),_0x99284a['setAttribute']('rel','noopener\x20noreferrer');});}['handleDragStart'](_0x205f0f){const _0x401408=_0x205f0f['target'];if(!_0x401408||_0x401408['tagName']!=='IMG')return;if(!_0x205f0f['dataTransfer'])return;const _0x2698df=_0x401408['getAttribute']('data-attachment-name')||'';try{_0x205f0f['dataTransfer']['setData'](INTERNAL_DRAG_MIME,_0x2698df||'1');}catch{}_0x205f0f['dataTransfer']['effectAllowed']='move';}['handleDragOver'](_0xfbf55){if(!this['isExternalFileTransfer'](_0xfbf55['dataTransfer']))return;_0xfbf55['preventDefault'](),_0xfbf55['dataTransfer']['dropEffect']='copy';}['handleDrop'](_0x1be61f){if(!this['isExternalFileTransfer'](_0x1be61f['dataTransfer']))return;const _0x30668a=_0x1be61f['dataTransfer'],_0x43378c=Array['from'](_0x30668a['files']||[])['filter'](_0x731a64=>_0x731a64&&typeof _0x731a64['type']==='string'),_0x5e5733=_0x43378c['filter'](_0x40a46a=>_0x40a46a['type']['startsWith']('image/'));if(_0x5e5733['length']===0x0)return;_0x1be61f['preventDefault'](),_0x1be61f['stopPropagation'](),this['cleanupParentDragState'](),this['moveSelectionToDropPoint'](_0x1be61f),this['addAndInsertImages'](_0x5e5733);}['cleanupParentDragState'](){let _0xe9d177=this['editor']['parentElement'];while(_0xe9d177){_0xe9d177['classList']&&_0xe9d177['classList']['contains']('drag-over')&&_0xe9d177['classList']['remove']('drag-over'),_0xe9d177=_0xe9d177['parentElement'];}}['isExternalFileTransfer'](_0x4d3824){if(!_0x4d3824)return![];const _0x5be5fc=Array['from'](_0x4d3824['types']||[]);if(!_0x5be5fc['includes']('Files'))return![];if(_0x5be5fc['includes'](INTERNAL_DRAG_MIME))return![];if(_0x4d3824['files']&&_0x4d3824['files']['length']>0x0)return!![];if(_0x4d3824['items']&&Array['from'](_0x4d3824['items'])['some'](_0x1657fb=>_0x1657fb['kind']==='file'))return!![];return![];}['moveSelectionToDropPoint'](_0x5e7137){const _0x3931b3=_0x5e7137['clientX'],_0x2864b5=_0x5e7137['clientY'];let _0x3ecb72=null;if(document['caretRangeFromPoint'])_0x3ecb72=document['caretRangeFromPoint'](_0x3931b3,_0x2864b5);else{if(document['caretPositionFromPoint']){const _0xfc80a7=document['caretPositionFromPoint'](_0x3931b3,_0x2864b5);_0xfc80a7&&(_0x3ecb72=document['createRange'](),_0x3ecb72['setStart'](_0xfc80a7['offsetNode'],_0xfc80a7['offset']),_0x3ecb72['collapse'](!![]));}}if(_0x3ecb72){const _0x1aaf6b=window['getSelection']();_0x1aaf6b['removeAllRanges'](),_0x1aaf6b['addRange'](_0x3ecb72);}}['extractImageFilesFromClipboard'](_0x1b189f){const _0x335c69=Array['from'](_0x1b189f['items']||[]),_0x45742f=[];for(const _0x24badc of _0x335c69){if(_0x24badc['kind']==='file'&&_0x24badc['type']&&_0x24badc['type']['startsWith']('image/')){const _0x47bb75=_0x24badc['getAsFile']();if(_0x47bb75)_0x45742f['push'](_0x47bb75);}}return _0x45742f;}['addAndInsertImages'](_0x511284){const _0x164563=_0x511284['map'](_0x2a14e7=>this['prepareAttachmentFile'](_0x2a14e7))['filter'](Boolean);if(_0x164563['length']===0x0)return;const _0x4ae277=_0x164563['map'](_0x123c1d=>_0x123c1d['file']);try{this['options']['onAddAttachments'](_0x4ae277);}catch(_0x4aa7bd){console['error']('Failed\x20to\x20add\x20attachments:',_0x4aa7bd);}for(const {name:_0x2b7a5c,objectUrl:_0x365c29}of _0x164563){this['insertAttachmentImage'](_0x2b7a5c,_0x365c29);}this['editor']['dispatchEvent'](new Event('input',{'bubbles':!![]}));}['prepareAttachmentFile'](_0x4eb6ef){const _0x93684d=this['sanitizeFilename'](_0x4eb6ef['name']||this['defaultImageName'](_0x4eb6ef['type']));if(!_0x93684d)return null;const _0x22fb1e=this['getUniqueAttachmentName'](_0x93684d),_0x3db75e=_0x22fb1e===_0x4eb6ef['name']?_0x4eb6ef:new File([_0x4eb6ef],_0x22fb1e,{'type':_0x4eb6ef['type'],'lastModified':_0x4eb6ef['lastModified']}),_0x1f7f0a=URL['createObjectURL'](_0x3db75e);return this['attachmentObjectUrls']['set'](_0x22fb1e,_0x1f7f0a),{'name':_0x22fb1e,'file':_0x3db75e,'objectUrl':_0x1f7f0a};}['getUniqueAttachmentName'](_0x8fae3c){const _0x240454=_0x58bf5d=>{if(this['attachmentObjectUrls']['has'](_0x58bf5d))return!![];if(this['options']['isAttachmentNameTaken'])try{return Boolean(this['options']['isAttachmentNameTaken'](_0x58bf5d));}catch{return![];}return![];};if(!_0x240454(_0x8fae3c))return _0x8fae3c;const {stem:_0x3caaa0,ext:_0x13a86f}=this['splitFilename'](_0x8fae3c);for(let _0x5b1702=0x2;_0x5b1702<0x3e8;_0x5b1702++){const _0x3c5256=_0x3caaa0+'-'+_0x5b1702+_0x13a86f;if(!_0x240454(_0x3c5256))return _0x3c5256;}return _0x3caaa0+'-'+Date['now']()+_0x13a86f;}['splitFilename'](_0x28dfa1){const _0x59887c=_0x28dfa1['lastIndexOf']('.');if(_0x59887c<=0x0||_0x59887c===_0x28dfa1['length']-0x1)return{'stem':_0x28dfa1,'ext':''};return{'stem':_0x28dfa1['slice'](0x0,_0x59887c),'ext':_0x28dfa1['slice'](_0x59887c)};}['sanitizeFilename'](_0x10d2f0){const _0x39ea1a=String(_0x10d2f0||'')['split']('/')['pop']()['split']('\x5c')['pop']();return _0x39ea1a['replace'](/[\u0000-\u001F\u007F]/g,'')['trim']();}['defaultImageName'](_0x11f6b2){const _0x14a372=this['extensionForMime'](_0x11f6b2);return'pasted-image-'+Date['now']()+_0x14a372;}['extensionForMime'](_0x398394){switch(_0x398394){case'image/png':return'.png';case'image/jpeg':return'.jpg';case'image/gif':return'.gif';case'image/webp':return'.webp';case'image/svg+xml':return'.svg';default:return'.png';}}['insertAttachmentImage'](_0x2e2536,_0x5e3cf3){const _0x57a3ce=document['createElement']('img');_0x57a3ce['src']=_0x5e3cf3,_0x57a3ce['alt']=_0x2e2536,_0x57a3ce['setAttribute']('data-attachment-name',_0x2e2536),_0x57a3ce['draggable']=!![];const _0x3902c3=window['getSelection']();let _0x5f2850=![];if(_0x3902c3&&_0x3902c3['rangeCount']>0x0){const _0x1082c5=_0x3902c3['getRangeAt'](0x0);_0x5f2850=this['editor']['contains'](_0x1082c5['commonAncestorContainer'])||this['editor']===_0x1082c5['commonAncestorContainer'];}if(!_0x5f2850){this['editor']['appendChild'](_0x57a3ce);const _0x18877b=document['createRange']();_0x18877b['setStartAfter'](_0x57a3ce),_0x18877b['collapse'](!![]),_0x3902c3['removeAllRanges'](),_0x3902c3['addRange'](_0x18877b);return;}const _0x4cfb61=_0x3902c3['getRangeAt'](0x0);_0x4cfb61['deleteContents'](),_0x4cfb61['insertNode'](_0x57a3ce),_0x4cfb61['setStartAfter'](_0x57a3ce),_0x4cfb61['collapse'](!![]),_0x3902c3['removeAllRanges'](),_0x3902c3['addRange'](_0x4cfb61);}['toggleInlineCode'](){const _0x1bee63=window['getSelection']();if(_0x1bee63['rangeCount']===0x0)return;const _0x475f15=_0x1bee63['getRangeAt'](0x0),_0x5a95d1=_0x475f15['toString']();if(_0x5a95d1){const _0x12a89f=document['createElement']('code');_0x12a89f['textContent']=_0x5a95d1,_0x475f15['deleteContents'](),_0x475f15['insertNode'](_0x12a89f),_0x475f15['setStartAfter'](_0x12a89f),_0x475f15['setEndAfter'](_0x12a89f),_0x1bee63['removeAllRanges'](),_0x1bee63['addRange'](_0x475f15);}}['insertCodeBlock'](){const _0x32961e=window['getSelection']();if(_0x32961e['rangeCount']===0x0)return;const _0x57b00b=_0x32961e['getRangeAt'](0x0),_0x2186c1=_0x57b00b['toString'](),_0x24bbe3=document['createElement']('pre'),_0x31c504=document['createElement']('code');_0x31c504['textContent']=_0x2186c1||'\x0a',_0x24bbe3['appendChild'](_0x31c504),_0x57b00b['deleteContents'](),_0x57b00b['insertNode'](_0x24bbe3);const _0x164066=document['createElement']('p');_0x164066['innerHTML']='<br>',_0x24bbe3['parentNode']['insertBefore'](_0x164066,_0x24bbe3['nextSibling']);const _0xdd44af=document['createRange']();!_0x2186c1?(_0xdd44af['setStart'](_0x31c504['firstChild'],0x0),_0xdd44af['setEnd'](_0x31c504['firstChild'],0x0)):(_0xdd44af['selectNodeContents'](_0x31c504),_0xdd44af['collapse'](![])),_0x32961e['removeAllRanges'](),_0x32961e['addRange'](_0xdd44af);}['updatePlaceholder'](){const _0x445447=this['editor']['textContent']['trim']()!==''||this['editor']['innerHTML']['includes']('<br')||this['editor']['innerHTML']['includes']('<div')||this['editor']['innerHTML']['includes']('<img');_0x445447?this['editor']['classList']['remove']('empty'):this['editor']['classList']['add']('empty');}['setMarkdown'](_0x32361f){if(!_0x32361f||!_0x32361f['trim']()){this['editor']['innerHTML']='',this['updatePlaceholder']();this['element']['tagName']==='TEXTAREA'||this['element']['tagName']==='INPUT'?this['element']['value']='':this['element']['textContent']='';return;}const _0x28c8e2=this['preprocessColorSyntax'](_0x32361f),_0x28e1ba=window['marked']['parse'](_0x28c8e2);this['editor']['innerHTML']=_0x28e1ba,this['rewriteAttachmentImages'](),this['rewriteMentionLinks'](),this['addLinkHints'](),this['updatePlaceholder'](),this['element']['tagName']==='TEXTAREA'||this['element']['tagName']==='INPUT'?this['element']['value']=_0x32361f:this['element']['textContent']=_0x32361f;}['rewriteAttachmentImages'](){const _0x1e2f59=this['editor']['querySelectorAll']('img');_0x1e2f59['forEach'](_0x3f65b1=>{const _0x538101=_0x3f65b1['getAttribute']('data-attachment-name'),_0x378899=_0x3f65b1['getAttribute']('src')||'',_0x476094=this['parseAttachmentReference'](_0x378899)||this['parseTaskAttachmentUrl'](_0x378899),_0x1fe9bb=_0x538101||(_0x476094?_0x476094['name']:null);if(!_0x1fe9bb)return;_0x3f65b1['setAttribute']('data-attachment-name',_0x1fe9bb);const _0x197158=this['attachmentObjectUrls']['get'](_0x1fe9bb)||(this['options']['resolveAttachmentUrl']?this['options']['resolveAttachmentUrl'](_0x1fe9bb):null);_0x197158&&(_0x3f65b1['src']=_0x197158);});}['rewriteMentionLinks'](){const _0x4d9bbb=this['editor']['querySelectorAll']('a[href^=\x22mention:\x22]');_0x4d9bbb['forEach'](_0xa12f00=>{const _0x5124ff=_0xa12f00['getAttribute']('href')||'',_0x13e13a=_0x5124ff['replace']('mention:',''),_0x40b6ad=_0xa12f00['textContent']||'',_0x832d2b=document['createElement']('span');_0x832d2b['className']='mention',_0x832d2b['setAttribute']('data-mention-user-id',_0x13e13a),_0x832d2b['setAttribute']('contenteditable','false'),_0x832d2b['textContent']='@'+_0x40b6ad;const _0x51723d=_0xa12f00['previousSibling'];_0x51723d&&_0x51723d['nodeType']===Node['TEXT_NODE']&&_0x51723d['textContent']['endsWith']('@')&&(_0x51723d['textContent']=_0x51723d['textContent']['slice'](0x0,-0x1)),_0xa12f00['parentNode']['replaceChild'](_0x832d2b,_0xa12f00);});}['addLinkHints'](){if(!this['options']['editable'])return;const _0x470897=this['editor']['querySelectorAll']('a');_0x470897['forEach'](_0x2dc3cf=>{const _0x24b9c=_0x2dc3cf['getAttribute']('href')||'';if(_0x24b9c['startsWith']('mention:'))return;const _0x3005e5=_0x2dc3cf['textContent']||_0x24b9c,_0x2b9b64=_0x3005e5+'\x20('+(this['linkHintText']||'Ctrl+click\x20to\x20follow')+')';_0x2dc3cf['setAttribute']('aria-label',_0x2b9b64);});}['preprocessColorSyntax'](_0x5e81e0){if(!_0x5e81e0)return _0x5e81e0;const _0x5155c1=_0x1239f2=>{return String(_0x1239f2)['replace'](/\{color:(#[0-9A-Fa-f]{3,6})\}([\s\S]*?)\{\/color\}/g,(_0x2bf3ff,_0x183744,_0x527021)=>{const _0xd8a499=_0x5155c1(_0x527021);return'<span\x20style=\x22color:\x20'+_0x183744+'\x22>'+_0xd8a499+'</span>';});};return _0x5155c1(_0x5e81e0);}['parseAttachmentReference'](_0x36c716){if(!_0x36c716||typeof _0x36c716!=='string')return null;if(!_0x36c716['startsWith'](ATTACHMENT_SCHEME)&&!_0x36c716['startsWith'](ATTACHMENT_SCHEME+'//'))return null;const _0x4ecb6e=_0x36c716['replace'](ATTACHMENT_SCHEME+'//','')['replace'](ATTACHMENT_SCHEME,'');if(!_0x4ecb6e)return null;try{return{'name':decodeURIComponent(_0x4ecb6e)};}catch{return{'name':_0x4ecb6e};}}['parseTaskAttachmentUrl'](_0x1d8599){if(!_0x1d8599||typeof _0x1d8599!=='string')return null;const _0x5c4b6d=_0x1d8599['match'](/\/tasks\/[^/]+\/attachments\/([^?#]+)/);if(!_0x5c4b6d)return null;const _0xc649a3=_0x5c4b6d[0x1];try{return{'name':decodeURIComponent(_0xc649a3)};}catch{return{'name':_0xc649a3};}}['updateAttachmentFile'](_0xd1bb76,_0x2f26d8){const _0x3938be=this['attachmentObjectUrls']['get'](_0xd1bb76);if(_0x3938be)try{URL['revokeObjectURL'](_0x3938be);}catch{}const _0x200287=URL['createObjectURL'](_0x2f26d8);this['attachmentObjectUrls']['set'](_0xd1bb76,_0x200287);const _0xf1c636=this['editor']['querySelector']('img[data-attachment-name=\x22'+CSS['escape'](_0xd1bb76)+'\x22]');return _0xf1c636&&(_0xf1c636['src']=_0x200287),_0x200287;}['getMarkdown'](){const _0x4a3f88=this['editor']['innerHTML'];if(!_0x4a3f88||_0x4a3f88['trim']()===''||_0x4a3f88==='<br>')return'';return this['turndownService']['turndown'](_0x4a3f88)['replace'](/\u200B/g,'');}['getValue'](){return this['getMarkdown']();}['setValue'](_0x5161a2){this['setMarkdown'](_0x5161a2);}['focus'](){this['editor']['focus']();}['clear'](){this['editor']['innerHTML']='',this['updatePlaceholder']();}['setEditable'](_0x409e62){this['editor']['contentEditable']=_0x409e62,this['options']['editable']=_0x409e62;}['handleMentionInput'](_0x54153d){if(!this['options']['fetchUsers'])return;const _0x10c4e1=window['getSelection']();if(!_0x10c4e1||_0x10c4e1['rangeCount']===0x0){this['closeMentionDropdown']();return;}const _0x13400c=_0x10c4e1['getRangeAt'](0x0),_0x69b313=_0x13400c['startContainer'];if(_0x69b313['nodeType']!==Node['TEXT_NODE']){this['closeMentionDropdown']();return;}const _0x12185c=_0x69b313['textContent']||'',_0x6dcd76=_0x13400c['startOffset'],_0x36a002=_0x12185c['slice'](0x0,_0x6dcd76),_0x571499=_0x36a002['lastIndexOf']('@');if(_0x571499===-0x1){this['closeMentionDropdown']();return;}const _0x1bfebe=_0x571499>0x0?_0x36a002[_0x571499-0x1]:'\x20';if(!/\s/['test'](_0x1bfebe)&&_0x571499!==0x0){this['closeMentionDropdown']();return;}const _0x3cce2f=_0x36a002['slice'](_0x571499+0x1);if(/[\s\n]/['test'](_0x3cce2f)){this['closeMentionDropdown']();return;}this['mentionState']['active']=!![],this['mentionState']['query']=_0x3cce2f['toLowerCase'](),this['mentionState']['startOffset']=_0x571499,this['mentionState']['startNode']=_0x69b313,this['showMentionDropdown']();}async['showMentionDropdown'](){if(!this['usersCache'])try{const _0x262586=await this['options']['fetchUsers']();this['usersCache']=_0x262586['users']||_0x262586||[];}catch(_0x48ddbc){console['error']('Failed\x20to\x20fetch\x20users\x20for\x20@mention:',_0x48ddbc),this['closeMentionDropdown']();return;}this['mentionState']['users']=this['usersCache'];const _0x40a173=this['mentionState']['query'];this['mentionState']['filteredUsers']=this['mentionState']['users']['filter'](_0x3772fa=>{const _0x563158=(_0x3772fa['name']||'')['toLowerCase'](),_0x5b96cb=(_0x3772fa['username']||'')['toLowerCase']();return _0x563158['includes'](_0x40a173)||_0x5b96cb['includes'](_0x40a173);})['slice'](0x0,0x8),this['mentionState']['selectedIndex']=0x0;if(this['mentionState']['filteredUsers']['length']===0x0){this['closeMentionDropdown']();return;}this['renderMentionDropdown'](),this['positionMentionDropdown']();}['renderMentionDropdown'](){!this['mentionDropdown']&&(this['mentionDropdown']=document['createElement']('div'),this['mentionDropdown']['className']='mention-dropdown',document['body']['appendChild'](this['mentionDropdown']),this['mentionClickOutsideHandler']=_0x522e2c=>{!this['mentionDropdown']['contains'](_0x522e2c['target'])&&!this['editor']['contains'](_0x522e2c['target'])&&this['closeMentionDropdown']();},document['addEventListener']('click',this['mentionClickOutsideHandler']),this['mentionScrollHandler']=()=>{this['mentionState']['active']&&this['positionMentionDropdown']();},window['addEventListener']('scroll',this['mentionScrollHandler'],!![]));const _0x1c08c7=this['mentionState']['filteredUsers'];this['mentionDropdown']['innerHTML']=_0x1c08c7['map']((_0x891a7,_0xc405d3)=>{const _0x6a659d=_0xc405d3===this['mentionState']['selectedIndex'],_0x4244ce=_0x891a7['name']||_0x891a7['username']||'Unknown',_0x3ce00e=_0x891a7['username']||'',_0x28e30a=this['getInitials'](_0x4244ce),_0x38f3d0=this['getAvatarColorIndex'](_0x3ce00e||_0x891a7['id']||_0x4244ce);return'\x0a\x20\x20\x20\x20\x20\x20\x20\x20<div\x20class=\x22mention-option\x20'+(_0x6a659d?'mention-option-selected':'')+'\x22\x20data-index=\x22'+_0xc405d3+'\x22>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span\x20class=\x22mention-avatar\x20avatar-color-'+_0x38f3d0+'\x22>'+this['escapeHtmlForMention'](_0x28e30a)+'</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20<span\x20class=\x22mention-option-name\x22>'+this['escapeHtmlForMention'](_0x4244ce)+'</span>\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'+(_0x3ce00e?'<span\x20class=\x22mention-option-username\x22>@'+this['escapeHtmlForMention'](_0x3ce00e)+'</span>':'')+'\x0a\x20\x20\x20\x20\x20\x20\x20\x20</div>\x0a\x20\x20\x20\x20\x20\x20';})['join'](''),this['mentionDropdown']['querySelectorAll']('.mention-option')['forEach'](_0x29f1cf=>{_0x29f1cf['addEventListener']('mousedown',_0x24da9c=>{_0x24da9c['preventDefault']();const _0x59ff24=parseInt(_0x29f1cf['dataset']['index'],0xa);this['insertMention'](this['mentionState']['filteredUsers'][_0x59ff24]);}),_0x29f1cf['addEventListener']('mouseenter',()=>{const _0x52726d=parseInt(_0x29f1cf['dataset']['index'],0xa);this['mentionState']['selectedIndex']=_0x52726d,this['updateMentionSelection']();});}),this['mentionDropdown']['style']['display']='block';}['positionMentionDropdown'](){if(!this['mentionDropdown'])return;const _0x4dbb39=window['getSelection']();if(!_0x4dbb39||_0x4dbb39['rangeCount']===0x0)return;const _0xa09240=_0x4dbb39['getRangeAt'](0x0),_0x3cd29e=_0xa09240['getBoundingClientRect'](),_0x2817d5=0x104,_0x47cbc0=Math['min'](0xf0,this['mentionState']['filteredUsers']['length']*0x24+0x8),_0x2a247d=window['innerWidth'],_0x1b984a=window['innerHeight'],_0x220597=_0x1b984a-_0x3cd29e['bottom'],_0x222c32=_0x3cd29e['top'],_0x2307e6=_0x220597<_0x47cbc0+0xa&&_0x222c32>_0x220597;let _0x51c6ff,_0x14a3dd;_0x2307e6?_0x51c6ff=_0x3cd29e['top']+window['scrollY']-_0x47cbc0-0x4:_0x51c6ff=_0x3cd29e['bottom']+window['scrollY']+0x4,_0x14a3dd=_0x3cd29e['left']+window['scrollX'],_0x14a3dd+_0x2817d5>_0x2a247d-0xa&&(_0x14a3dd=_0x2a247d-_0x2817d5-0xa),_0x14a3dd<0xa&&(_0x14a3dd=0xa),this['mentionDropdown']['style']['position']='absolute',this['mentionDropdown']['style']['top']=_0x51c6ff+'px',this['mentionDropdown']['style']['left']=_0x14a3dd+'px';}['mentionNavigate'](_0x4c8f82){const _0x293eb0=this['mentionState']['filteredUsers']['length'];if(_0x293eb0===0x0)return;this['mentionState']['selectedIndex']=(this['mentionState']['selectedIndex']+_0x4c8f82+_0x293eb0)%_0x293eb0,this['updateMentionSelection']();}['updateMentionSelection'](){if(!this['mentionDropdown'])return;const _0x5b7d31=this['mentionDropdown']['querySelectorAll']('.mention-option');_0x5b7d31['forEach']((_0x28098c,_0x3f905a)=>{_0x3f905a===this['mentionState']['selectedIndex']?(_0x28098c['classList']['add']('mention-option-selected'),_0x28098c['scrollIntoView']({'block':'nearest'})):_0x28098c['classList']['remove']('mention-option-selected');});}['insertMention'](_0x44c9dd){if(!_0x44c9dd)return;const _0xd12b96=window['getSelection']();if(!_0xd12b96||_0xd12b96['rangeCount']===0x0)return;const _0x293d98=_0xd12b96['getRangeAt'](0x0),_0x7d2c7d=this['mentionState']['startNode'];if(!_0x7d2c7d||_0x7d2c7d['nodeType']!==Node['TEXT_NODE']){this['closeMentionDropdown']();return;}const _0x18c501=_0x7d2c7d['textContent']||'',_0x50277a=this['mentionState']['startOffset'],_0x5e5bac=_0x293d98['startOffset'],_0x42ca4f=_0x18c501['slice'](0x0,_0x50277a),_0xec2a62=_0x18c501['slice'](_0x5e5bac),_0x4d01e4=document['createElement']('span');_0x4d01e4['className']='mention',_0x4d01e4['setAttribute']('data-mention-user-id',_0x44c9dd['id']),_0x4d01e4['setAttribute']('contenteditable','false'),_0x4d01e4['textContent']='@'+(_0x44c9dd['name']||_0x44c9dd['username']);const _0x1ef2ba=document['createTextNode'](_0x42ca4f),_0x2511c4=document['createTextNode']('\x20'+_0xec2a62),_0x300648=_0x7d2c7d['parentNode'];_0x300648['insertBefore'](_0x1ef2ba,_0x7d2c7d),_0x300648['insertBefore'](_0x4d01e4,_0x7d2c7d),_0x300648['insertBefore'](_0x2511c4,_0x7d2c7d),_0x300648['removeChild'](_0x7d2c7d);const _0x360c4a=document['createRange']();_0x360c4a['setStart'](_0x2511c4,0x1),_0x360c4a['collapse'](!![]),_0xd12b96['removeAllRanges'](),_0xd12b96['addRange'](_0x360c4a),this['closeMentionDropdown'](),this['editor']['dispatchEvent'](new Event('input',{'bubbles':!![]}));}['closeMentionDropdown'](){this['mentionState']['active']=![],this['mentionState']['query']='',this['mentionState']['filteredUsers']=[],this['mentionState']['selectedIndex']=0x0,this['mentionDropdown']&&(this['mentionDropdown']['style']['display']='none');}['escapeHtmlForMention'](_0x446520){const _0x52d91f=document['createElement']('div');return _0x52d91f['textContent']=_0x446520,_0x52d91f['innerHTML'];}['getInitials'](_0x3ea85c){if(!_0x3ea85c)return'?';const _0x5161ab=_0x3ea85c['trim']()['split'](/\s+/);if(_0x5161ab['length']>=0x2)return(_0x5161ab[0x0][0x0]+_0x5161ab[_0x5161ab['length']-0x1][0x0])['toUpperCase']();return _0x3ea85c['substring'](0x0,0x2)['toUpperCase']();}['getAvatarColorIndex'](_0x5a80a1){if(!_0x5a80a1)return 0x6;let _0x5cb0c2=0x0;for(let _0x24b1bd=0x0;_0x24b1bd<_0x5a80a1['length'];_0x24b1bd++){_0x5cb0c2=_0x5a80a1['charCodeAt'](_0x24b1bd)+((_0x5cb0c2<<0x5)-_0x5cb0c2);}return Math['abs'](_0x5cb0c2)%0xa;}['destroy'](){this['selectionChangeHandler']&&document['removeEventListener']('selectionchange',this['selectionChangeHandler']);this['linkClickHandler']&&this['editor']['removeEventListener']('click',this['linkClickHandler']);this['linkMouseEnterHandler']&&this['editor']['removeEventListener']('mouseover',this['linkMouseEnterHandler']);this['linkMouseLeaveHandler']&&this['editor']['removeEventListener']('mouseout',this['linkMouseLeaveHandler']);this['linkTooltipTimeout']&&clearTimeout(this['linkTooltipTimeout']);this['linkTooltip']&&(this['linkTooltip']['remove'](),this['linkTooltip']=null);this['linkDialog']&&(this['linkDialog']['remove'](),this['linkDialog']=null,this['linkDialogContext']=null,this['linkDialogElements']=null);this['mentionDropdown']&&(this['mentionDropdown']['remove'](),this['mentionDropdown']=null);this['mentionClickOutsideHandler']&&document['removeEventListener']('click',this['mentionClickOutsideHandler']);this['mentionScrollHandler']&&window['removeEventListener']('scroll',this['mentionScrollHandler'],!![]);for(const _0x1367c2 of this['attachmentObjectUrls']['values']()){try{URL['revokeObjectURL'](_0x1367c2);}catch{}}this['attachmentObjectUrls']['clear'](),this['container']?this['container']['remove']():this['editor']['remove'](),this['element']['style']['display']='';}}typeof window!=='undefined'&&(window['MarkdownEditor']=MarkdownEditor);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
let monacoLoadPromise=null;async function ensureMonacoLoaded(){if(typeof monaco!=='undefined')return;if(monacoLoadPromise)return monacoLoadPromise;const _0xb4784a=document['querySelector']('script[src*=\x22monaco-editor\x22][src*=\x22loader.min.js\x22]');if(_0xb4784a)return monacoLoadPromise=new Promise((_0x229c3a,_0x53a910)=>{const _0x399b9f=setInterval(()=>{typeof monaco!=='undefined'&&(clearInterval(_0x399b9f),_0x229c3a());},0x32);setTimeout(()=>{clearInterval(_0x399b9f),_0x53a910(new Error('Monaco\x20loading\x20timeout'));},0x2710);}),monacoLoadPromise;return monacoLoadPromise=new Promise((_0x60ec55,_0x3d76dc)=>{const _0x4b2cdc=document['createElement']('script');_0x4b2cdc['src']='https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.45.0/min/vs/loader.min.js',_0x4b2cdc['onload']=()=>{require['config']({'paths':{'vs':'https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.45.0/min/vs'}}),require(['vs/editor/editor.main'],()=>{_0x60ec55();});},_0x4b2cdc['onerror']=()=>_0x3d76dc(new Error('Failed\x20to\x20load\x20Monaco\x20Editor')),document['head']['appendChild'](_0x4b2cdc);}),monacoLoadPromise;}function getMonacoTheme(){const _0x33eaf9=document['documentElement']['getAttribute']('data-theme')==='dark';return _0x33eaf9?'vs-dark':'vs';}function isMarkdownFile(_0x28a0a1){if(!_0x28a0a1)return![];const _0x3727f2=_0x28a0a1['split']('.')['pop']()['toLowerCase']();return _0x3727f2==='md'||_0x3727f2==='markdown';}function createMarkdownFileEditor(_0x9165d5){const {container:_0x1fad71,content:content='',readOnly:readOnly=![],height:height='400px',onChange:onChange=null,placeholder:placeholder='Enter\x20markdown\x20content...',enableModeToggle:enableModeToggle=!![],initialMode:initialMode='visual'}=_0x9165d5;_0x1fad71['innerHTML']='';let _0x123be2='visual',_0x6ec4e3=content,_0x7e41f=null,_0x443e00=null,_0x432aa9=![],_0xe176a4=initialMode==='source';const _0x5672dc=document['createElement']('div');_0x5672dc['className']='markdown-file-editor-wrapper',_0x5672dc['style']['height']=height,_0x5672dc['style']['display']='flex',_0x5672dc['style']['flexDirection']='column',_0x5672dc['style']['border']='1px\x20solid\x20var(--color-border)',_0x5672dc['style']['borderRadius']='var(--radius-small)',_0x5672dc['style']['overflow']='hidden';let _0x268f86=null,_0x555e78=null,_0x31c541=null;!readOnly&&enableModeToggle&&(_0x268f86=document['createElement']('div'),_0x268f86['className']='markdown-editor-mode-toggle',_0x268f86['style']['display']='flex',_0x268f86['style']['alignItems']='center',_0x268f86['style']['padding']='4px\x208px',_0x268f86['style']['borderBottom']='1px\x20solid\x20var(--color-border)',_0x268f86['style']['background']='var(--color-surface-secondary)',_0x268f86['style']['gap']='4px',_0x268f86['style']['flexShrink']='0',_0x555e78=document['createElement']('button'),_0x555e78['type']='button',_0x555e78['className']='markdown-mode-btn',_0x555e78['innerHTML']='<svg\x20viewBox=\x220\x200\x2024\x2024\x22\x20width=\x2214\x22\x20height=\x2214\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20fill=\x22none\x22><path\x20d=\x22M1\x2012s4-8\x2011-8\x2011\x208\x2011\x208-4\x208-11\x208-11-8-11-8z\x22></path><circle\x20cx=\x2212\x22\x20cy=\x2212\x22\x20r=\x223\x22></circle></svg>\x20Visual',_0x555e78['title']='Visual\x20editing\x20mode\x20(WYSIWYG)',_0x31c541=document['createElement']('button'),_0x31c541['type']='button',_0x31c541['className']='markdown-mode-btn',_0x31c541['innerHTML']='<svg\x20viewBox=\x220\x200\x2024\x2024\x22\x20width=\x2214\x22\x20height=\x2214\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20fill=\x22none\x22><polyline\x20points=\x2216\x2018\x2022\x2012\x2016\x206\x22></polyline><polyline\x20points=\x228\x206\x202\x2012\x208\x2018\x22></polyline></svg>\x20Source',_0x31c541['title']='Source\x20editing\x20mode\x20(Monaco\x20Editor)',_0x268f86['appendChild'](_0x555e78),_0x268f86['appendChild'](_0x31c541),_0x5672dc['appendChild'](_0x268f86));const _0x3716cc=document['createElement']('div');_0x3716cc['className']='markdown-visual-container',_0x3716cc['style']['flex']='1',_0x3716cc['style']['display']='flex',_0x3716cc['style']['flexDirection']='column',_0x3716cc['style']['overflow']='hidden',_0x3716cc['style']['minHeight']='0';const _0x308ccc=document['createElement']('textarea');_0x308ccc['style']['display']='none',_0x308ccc['value']=content,_0x3716cc['appendChild'](_0x308ccc),_0x5672dc['appendChild'](_0x3716cc);const _0x4e5847=document['createElement']('div');_0x4e5847['className']='markdown-source-container',_0x4e5847['style']['flex']='1',_0x4e5847['style']['display']='none',_0x4e5847['style']['overflow']='hidden',_0x4e5847['style']['minHeight']='0',_0x5672dc['appendChild'](_0x4e5847),_0x1fad71['appendChild'](_0x5672dc),_0x7e41f=new window['MarkdownEditor'](_0x308ccc,{'placeholder':placeholder,'editable':!readOnly,'minHeight':'100%','toolbar':!readOnly,'onChange':_0x36336e=>{_0x6ec4e3=_0x36336e,onChange&&onChange(_0x36336e);}});_0x7e41f['container']&&(_0x7e41f['container']['style']['flex']='1',_0x7e41f['container']['style']['display']='flex',_0x7e41f['container']['style']['flexDirection']='column',_0x7e41f['container']['style']['overflow']='hidden');_0x7e41f['editor']&&(_0x7e41f['editor']['style']['flex']='1',_0x7e41f['editor']['style']['overflow']='auto',_0x7e41f['editor']['style']['minHeight']='0',_0x7e41f['editor']['style']['border']='none',_0x7e41f['editor']['style']['borderRadius']='0',_0x7e41f['editor']['style']['padding']='16px',_0x7e41f['editor']['style']['fontSize']='14px',_0x7e41f['editor']['style']['lineHeight']='1.6');_0x7e41f['toolbar']&&(_0x7e41f['toolbar']['style']['borderRadius']='0',_0x7e41f['toolbar']['style']['flexShrink']='0');content&&_0x7e41f['setMarkdown'](content);function _0x36bac4(){if(!_0x555e78||!_0x31c541)return;_0x123be2==='visual'?(_0x555e78['classList']['add']('active'),_0x31c541['classList']['remove']('active')):(_0x555e78['classList']['remove']('active'),_0x31c541['classList']['add']('active'));}async function _0x23077b(){if(_0x432aa9)return;try{await ensureMonacoLoaded(),_0x443e00=monaco['editor']['create'](_0x4e5847,{'value':_0x6ec4e3,'language':'markdown','theme':getMonacoTheme(),'readOnly':readOnly,'minimap':{'enabled':![]},'automaticLayout':!![],'wordWrap':'on','lineNumbers':'on','scrollBeyondLastLine':![],'fontSize':0xe,'lineHeight':0x16,'padding':{'top':0x10,'bottom':0x10},'renderWhitespace':'selection','tabSize':0x2,'insertSpaces':!![]}),_0x443e00['onDidChangeModelContent'](()=>{_0x6ec4e3=_0x443e00['getValue'](),onChange&&onChange(_0x6ec4e3);}),_0x432aa9=!![];}catch(_0x523b62){console['error']('Failed\x20to\x20initialize\x20Monaco\x20editor:',_0x523b62);throw _0x523b62;}}async function _0x3de32e(_0x1c2351){if(_0x1c2351===_0x123be2)return;if(_0x123be2==='visual')_0x6ec4e3=_0x7e41f['getMarkdown']();else _0x443e00&&(_0x6ec4e3=_0x443e00['getValue']());_0x123be2=_0x1c2351;if(_0x1c2351==='visual')_0x4e5847['style']['display']='none',_0x3716cc['style']['display']='flex',_0x7e41f['setMarkdown'](_0x6ec4e3),_0x7e41f['focus']();else{_0x3716cc['style']['display']='none',_0x4e5847['style']['display']='block';if(!_0x432aa9)try{await _0x23077b();}catch(_0x237e06){console['error']('Failed\x20to\x20switch\x20to\x20source\x20mode:',_0x237e06),_0x123be2='visual',_0x4e5847['style']['display']='none',_0x3716cc['style']['display']='flex',_0x36bac4();return;}_0x443e00&&(_0x443e00['setValue'](_0x6ec4e3),_0x443e00['focus'](),_0x443e00['layout']());}_0x36bac4();}_0x555e78&&_0x31c541&&(_0x555e78['addEventListener']('click',_0x415fbc=>{_0x415fbc['preventDefault'](),_0x3de32e('visual');}),_0x31c541['addEventListener']('click',_0x51713c=>{_0x51713c['preventDefault'](),_0x3de32e('source');}),_0x36bac4());_0xe176a4&&setTimeout(()=>_0x3de32e('source'),0x0);const _0x3ef114={'getValue':()=>{if(_0x123be2==='visual')return _0x7e41f['getMarkdown']();else{if(_0x443e00)return _0x443e00['getValue']();}return _0x6ec4e3;},'setValue':_0x5aa28a=>{_0x6ec4e3=_0x5aa28a||'';if(_0x123be2==='visual')_0x7e41f['setMarkdown'](_0x6ec4e3);else _0x443e00&&_0x443e00['setValue'](_0x6ec4e3);},'focus':()=>{if(_0x123be2==='visual')_0x7e41f['focus']();else _0x443e00&&_0x443e00['focus']();},'setEditable':_0xb3bd34=>{_0x7e41f['setEditable'](_0xb3bd34),_0x443e00&&_0x443e00['updateOptions']({'readOnly':!_0xb3bd34});},'destroy':()=>{_0x7e41f['destroy'](),_0x443e00&&(_0x443e00['dispose'](),_0x443e00=null),_0x1fad71['innerHTML']='';},'getMode':()=>_0x123be2,'setMode':_0x2be90e=>_0x3de32e(_0x2be90e),'toggleMode':()=>_0x3de32e(_0x123be2==='visual'?'source':'visual'),'_visualEditor':_0x7e41f,'_getSourceEditor':()=>_0x443e00,'_container':_0x1fad71,'_isMarkdownFileEditor':!![],'_hasModeToggle':enableModeToggle};return _0x3ef114;}const markdownFileEditors=new Map();function getOrCreateMarkdownFileEditor(_0xd193f,_0x59db75,_0x58b0f0=![],_0x1dd237='400px',_0x396cbc=null,_0x3a8add={}){const _0x2fbd3d=document['getElementById'](_0xd193f);if(!_0x2fbd3d)return console['error']('Container\x20not\x20found:\x20'+_0xd193f),null;const _0x349445=markdownFileEditors['get'](_0xd193f);if(_0x349445){try{_0x349445['destroy']();}catch(_0x226182){console['warn']('Failed\x20to\x20destroy\x20existing\x20markdown\x20editor:',_0x226182);}markdownFileEditors['delete'](_0xd193f);}const _0x28f9a4=createMarkdownFileEditor({'container':_0x2fbd3d,'content':_0x59db75,'readOnly':_0x58b0f0,'height':_0x1dd237,'onChange':_0x396cbc,..._0x3a8add});return markdownFileEditors['set'](_0xd193f,_0x28f9a4),_0x28f9a4;}function getMarkdownFileEditorValue(_0x2c4090){const _0x352bc1=markdownFileEditors['get'](_0x2c4090);if(!_0x352bc1)return null;return _0x352bc1['getValue']();}function setMarkdownFileEditorValue(_0x3ee1fb,_0x37ff17){const _0x250c6b=markdownFileEditors['get'](_0x3ee1fb);_0x250c6b&&_0x250c6b['setValue'](_0x37ff17||'');}function disposeMarkdownFileEditor(_0x527e20){const _0x3ac5ca=markdownFileEditors['get'](_0x527e20);if(_0x3ac5ca){try{_0x3ac5ca['destroy']();}catch(_0x37f933){console['warn']('Failed\x20to\x20dispose\x20markdown\x20editor:',_0x37f933);}markdownFileEditors['delete'](_0x527e20);}}function hasMarkdownFileEditor(_0x58ecd6){return markdownFileEditors['has'](_0x58ecd6);}function getMarkdownFileEditorMode(_0x1fc566){const _0x21af70=markdownFileEditors['get'](_0x1fc566);if(!_0x21af70||!_0x21af70['getMode'])return null;return _0x21af70['getMode']();}function setMarkdownFileEditorMode(_0x233e2f,_0x44d34e){const _0x45ae85=markdownFileEditors['get'](_0x233e2f);_0x45ae85&&_0x45ae85['setMode']&&_0x45ae85['setMode'](_0x44d34e);}typeof window!=='undefined'&&(window['MarkdownFileEditor']={'isMarkdownFile':isMarkdownFile,'create':createMarkdownFileEditor,'getOrCreate':getOrCreateMarkdownFileEditor,'getValue':getMarkdownFileEditorValue,'setValue':setMarkdownFileEditorValue,'dispose':disposeMarkdownFileEditor,'has':hasMarkdownFileEditor,'getMode':getMarkdownFileEditorMode,'setMode':setMarkdownFileEditorMode,'editors':markdownFileEditors,'ensureMonacoLoaded':ensureMonacoLoaded});
|
|
1
|
+
let monacoLoadPromise=null;async function ensureMonacoLoaded(){if(typeof monaco!=='undefined')return;if(monacoLoadPromise)return monacoLoadPromise;const _0x15e585=document['querySelector']('script[src*=\x22monaco-editor\x22][src*=\x22loader.min.js\x22]');if(_0x15e585)return monacoLoadPromise=new Promise((_0x4bc296,_0x33b887)=>{const _0x1ce845=setInterval(()=>{typeof monaco!=='undefined'&&(clearInterval(_0x1ce845),_0x4bc296());},0x32);setTimeout(()=>{clearInterval(_0x1ce845),_0x33b887(new Error('Monaco\x20loading\x20timeout'));},0x2710);}),monacoLoadPromise;return monacoLoadPromise=new Promise((_0x5d5267,_0x30fd7c)=>{const _0x288d0a=document['createElement']('script');_0x288d0a['src']='https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.45.0/min/vs/loader.min.js',_0x288d0a['onload']=()=>{require['config']({'paths':{'vs':'https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.45.0/min/vs'}}),require(['vs/editor/editor.main'],()=>{_0x5d5267();});},_0x288d0a['onerror']=()=>_0x30fd7c(new Error('Failed\x20to\x20load\x20Monaco\x20Editor')),document['head']['appendChild'](_0x288d0a);}),monacoLoadPromise;}function getMonacoTheme(){const _0x3b60a9=document['documentElement']['getAttribute']('data-theme')==='dark';return _0x3b60a9?'vs-dark':'vs';}function isMarkdownFile(_0xd8a1d1){if(!_0xd8a1d1)return![];const _0x49cc36=_0xd8a1d1['split']('.')['pop']()['toLowerCase']();return _0x49cc36==='md'||_0x49cc36==='markdown';}function createMarkdownFileEditor(_0x320bc3){const {container:_0x3b8f39,content:content='',readOnly:readOnly=![],height:height='400px',onChange:onChange=null,placeholder:placeholder='Enter\x20markdown\x20content...',enableModeToggle:enableModeToggle=!![],initialMode:initialMode='visual'}=_0x320bc3;_0x3b8f39['innerHTML']='';let _0x59a080='visual',_0x210507=content,_0x1c8929=null,_0x4d2f01=null,_0x218b7f=![],_0xabac5b=initialMode==='source';const _0x5455ec=document['createElement']('div');_0x5455ec['className']='markdown-file-editor-wrapper',_0x5455ec['style']['height']=height,_0x5455ec['style']['display']='flex',_0x5455ec['style']['flexDirection']='column',_0x5455ec['style']['border']='1px\x20solid\x20var(--color-border)',_0x5455ec['style']['borderRadius']='var(--radius-small)',_0x5455ec['style']['overflow']='hidden';let _0x5652f0=null,_0x16a8c4=null,_0x4dea36=null;!readOnly&&enableModeToggle&&(_0x5652f0=document['createElement']('div'),_0x5652f0['className']='markdown-editor-mode-toggle',_0x5652f0['style']['display']='flex',_0x5652f0['style']['alignItems']='center',_0x5652f0['style']['padding']='4px\x208px',_0x5652f0['style']['borderBottom']='1px\x20solid\x20var(--color-border)',_0x5652f0['style']['background']='var(--color-surface-secondary)',_0x5652f0['style']['gap']='4px',_0x5652f0['style']['flexShrink']='0',_0x16a8c4=document['createElement']('button'),_0x16a8c4['type']='button',_0x16a8c4['className']='markdown-mode-btn',_0x16a8c4['innerHTML']='<svg\x20viewBox=\x220\x200\x2024\x2024\x22\x20width=\x2214\x22\x20height=\x2214\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20fill=\x22none\x22><path\x20d=\x22M1\x2012s4-8\x2011-8\x2011\x208\x2011\x208-4\x208-11\x208-11-8-11-8z\x22></path><circle\x20cx=\x2212\x22\x20cy=\x2212\x22\x20r=\x223\x22></circle></svg>\x20Visual',_0x16a8c4['title']='Visual\x20editing\x20mode\x20(WYSIWYG)',_0x4dea36=document['createElement']('button'),_0x4dea36['type']='button',_0x4dea36['className']='markdown-mode-btn',_0x4dea36['innerHTML']='<svg\x20viewBox=\x220\x200\x2024\x2024\x22\x20width=\x2214\x22\x20height=\x2214\x22\x20stroke=\x22currentColor\x22\x20stroke-width=\x222\x22\x20fill=\x22none\x22><polyline\x20points=\x2216\x2018\x2022\x2012\x2016\x206\x22></polyline><polyline\x20points=\x228\x206\x202\x2012\x208\x2018\x22></polyline></svg>\x20Source',_0x4dea36['title']='Source\x20editing\x20mode\x20(Monaco\x20Editor)',_0x5652f0['appendChild'](_0x16a8c4),_0x5652f0['appendChild'](_0x4dea36),_0x5455ec['appendChild'](_0x5652f0));const _0x386ddd=document['createElement']('div');_0x386ddd['className']='markdown-visual-container',_0x386ddd['style']['flex']='1',_0x386ddd['style']['display']='flex',_0x386ddd['style']['flexDirection']='column',_0x386ddd['style']['overflow']='hidden',_0x386ddd['style']['minHeight']='0';const _0x4211ea=document['createElement']('textarea');_0x4211ea['style']['display']='none',_0x4211ea['value']=content,_0x386ddd['appendChild'](_0x4211ea),_0x5455ec['appendChild'](_0x386ddd);const _0xe440f2=document['createElement']('div');_0xe440f2['className']='markdown-source-container',_0xe440f2['style']['flex']='1',_0xe440f2['style']['display']='none',_0xe440f2['style']['overflow']='hidden',_0xe440f2['style']['minHeight']='0',_0x5455ec['appendChild'](_0xe440f2),_0x3b8f39['appendChild'](_0x5455ec),_0x1c8929=new window['MarkdownEditor'](_0x4211ea,{'placeholder':placeholder,'editable':!readOnly,'minHeight':'100%','toolbar':!readOnly,'onChange':_0x17f0db=>{_0x210507=_0x17f0db,onChange&&onChange(_0x17f0db);}});_0x1c8929['container']&&(_0x1c8929['container']['style']['flex']='1',_0x1c8929['container']['style']['display']='flex',_0x1c8929['container']['style']['flexDirection']='column',_0x1c8929['container']['style']['overflow']='hidden');_0x1c8929['editor']&&(_0x1c8929['editor']['style']['flex']='1',_0x1c8929['editor']['style']['overflow']='auto',_0x1c8929['editor']['style']['minHeight']='0',_0x1c8929['editor']['style']['border']='none',_0x1c8929['editor']['style']['borderRadius']='0',_0x1c8929['editor']['style']['padding']='16px',_0x1c8929['editor']['style']['fontSize']='14px',_0x1c8929['editor']['style']['lineHeight']='1.6');_0x1c8929['toolbar']&&(_0x1c8929['toolbar']['style']['borderRadius']='0',_0x1c8929['toolbar']['style']['flexShrink']='0');content&&_0x1c8929['setMarkdown'](content);function _0x3a1fe1(){if(!_0x16a8c4||!_0x4dea36)return;_0x59a080==='visual'?(_0x16a8c4['classList']['add']('active'),_0x4dea36['classList']['remove']('active')):(_0x16a8c4['classList']['remove']('active'),_0x4dea36['classList']['add']('active'));}async function _0x2c2df2(){if(_0x218b7f)return;try{await ensureMonacoLoaded(),_0x4d2f01=monaco['editor']['create'](_0xe440f2,{'value':_0x210507,'language':'markdown','theme':getMonacoTheme(),'readOnly':readOnly,'minimap':{'enabled':![]},'automaticLayout':!![],'wordWrap':'on','lineNumbers':'on','scrollBeyondLastLine':![],'fontSize':0xe,'lineHeight':0x16,'padding':{'top':0x10,'bottom':0x10},'renderWhitespace':'selection','tabSize':0x2,'insertSpaces':!![]}),_0x4d2f01['onDidChangeModelContent'](()=>{_0x210507=_0x4d2f01['getValue'](),onChange&&onChange(_0x210507);}),_0x218b7f=!![];}catch(_0x4a3647){console['error']('Failed\x20to\x20initialize\x20Monaco\x20editor:',_0x4a3647);throw _0x4a3647;}}async function _0x2e44ab(_0x3394b8){if(_0x3394b8===_0x59a080)return;if(_0x59a080==='visual')_0x210507=_0x1c8929['getMarkdown']();else _0x4d2f01&&(_0x210507=_0x4d2f01['getValue']());_0x59a080=_0x3394b8;if(_0x3394b8==='visual')_0xe440f2['style']['display']='none',_0x386ddd['style']['display']='flex',_0x1c8929['setMarkdown'](_0x210507),_0x1c8929['focus']();else{_0x386ddd['style']['display']='none',_0xe440f2['style']['display']='block';if(!_0x218b7f)try{await _0x2c2df2();}catch(_0x30238f){console['error']('Failed\x20to\x20switch\x20to\x20source\x20mode:',_0x30238f),_0x59a080='visual',_0xe440f2['style']['display']='none',_0x386ddd['style']['display']='flex',_0x3a1fe1();return;}_0x4d2f01&&(_0x4d2f01['setValue'](_0x210507),_0x4d2f01['focus'](),_0x4d2f01['layout']());}_0x3a1fe1();}_0x16a8c4&&_0x4dea36&&(_0x16a8c4['addEventListener']('click',_0xcd9f8f=>{_0xcd9f8f['preventDefault'](),_0x2e44ab('visual');}),_0x4dea36['addEventListener']('click',_0x1f49a6=>{_0x1f49a6['preventDefault'](),_0x2e44ab('source');}),_0x3a1fe1());_0xabac5b&&setTimeout(()=>_0x2e44ab('source'),0x0);const _0x380562={'getValue':()=>{if(_0x59a080==='visual')return _0x1c8929['getMarkdown']();else{if(_0x4d2f01)return _0x4d2f01['getValue']();}return _0x210507;},'setValue':_0x38e547=>{_0x210507=_0x38e547||'';if(_0x59a080==='visual')_0x1c8929['setMarkdown'](_0x210507);else _0x4d2f01&&_0x4d2f01['setValue'](_0x210507);},'focus':()=>{if(_0x59a080==='visual')_0x1c8929['focus']();else _0x4d2f01&&_0x4d2f01['focus']();},'setEditable':_0x55f83d=>{_0x1c8929['setEditable'](_0x55f83d),_0x4d2f01&&_0x4d2f01['updateOptions']({'readOnly':!_0x55f83d});},'destroy':()=>{_0x1c8929['destroy'](),_0x4d2f01&&(_0x4d2f01['dispose'](),_0x4d2f01=null),_0x3b8f39['innerHTML']='';},'getMode':()=>_0x59a080,'setMode':_0x5ddc21=>_0x2e44ab(_0x5ddc21),'toggleMode':()=>_0x2e44ab(_0x59a080==='visual'?'source':'visual'),'_visualEditor':_0x1c8929,'_getSourceEditor':()=>_0x4d2f01,'_container':_0x3b8f39,'_isMarkdownFileEditor':!![],'_hasModeToggle':enableModeToggle};return _0x380562;}const markdownFileEditors=new Map();function getOrCreateMarkdownFileEditor(_0x14c6d6,_0x3250dd,_0x3c24bf=![],_0x2199cf='400px',_0x5c9203=null,_0xb0777={}){const _0x41b57a=document['getElementById'](_0x14c6d6);if(!_0x41b57a)return console['error']('Container\x20not\x20found:\x20'+_0x14c6d6),null;const _0x5a323b=markdownFileEditors['get'](_0x14c6d6);if(_0x5a323b){try{_0x5a323b['destroy']();}catch(_0x177e22){console['warn']('Failed\x20to\x20destroy\x20existing\x20markdown\x20editor:',_0x177e22);}markdownFileEditors['delete'](_0x14c6d6);}const _0x3f2b0a=createMarkdownFileEditor({'container':_0x41b57a,'content':_0x3250dd,'readOnly':_0x3c24bf,'height':_0x2199cf,'onChange':_0x5c9203,..._0xb0777});return markdownFileEditors['set'](_0x14c6d6,_0x3f2b0a),_0x3f2b0a;}function getMarkdownFileEditorValue(_0x4724b5){const _0x4a64a9=markdownFileEditors['get'](_0x4724b5);if(!_0x4a64a9)return null;return _0x4a64a9['getValue']();}function setMarkdownFileEditorValue(_0x4ce7e0,_0x153074){const _0x4a6f9d=markdownFileEditors['get'](_0x4ce7e0);_0x4a6f9d&&_0x4a6f9d['setValue'](_0x153074||'');}function disposeMarkdownFileEditor(_0x4ab9ed){const _0x212440=markdownFileEditors['get'](_0x4ab9ed);if(_0x212440){try{_0x212440['destroy']();}catch(_0x1e74e5){console['warn']('Failed\x20to\x20dispose\x20markdown\x20editor:',_0x1e74e5);}markdownFileEditors['delete'](_0x4ab9ed);}}function hasMarkdownFileEditor(_0x50a144){return markdownFileEditors['has'](_0x50a144);}function getMarkdownFileEditorMode(_0x4ab262){const _0x3b2c5d=markdownFileEditors['get'](_0x4ab262);if(!_0x3b2c5d||!_0x3b2c5d['getMode'])return null;return _0x3b2c5d['getMode']();}function setMarkdownFileEditorMode(_0x13b600,_0x29cf1b){const _0x2a7d98=markdownFileEditors['get'](_0x13b600);_0x2a7d98&&_0x2a7d98['setMode']&&_0x2a7d98['setMode'](_0x29cf1b);}typeof window!=='undefined'&&(window['MarkdownFileEditor']={'isMarkdownFile':isMarkdownFile,'create':createMarkdownFileEditor,'getOrCreate':getOrCreateMarkdownFileEditor,'getValue':getMarkdownFileEditorValue,'setValue':setMarkdownFileEditorValue,'dispose':disposeMarkdownFileEditor,'has':hasMarkdownFileEditor,'getMode':getMarkdownFileEditorMode,'setMode':setMarkdownFileEditorMode,'editors':markdownFileEditors,'ensureMonacoLoaded':ensureMonacoLoaded});
|