denchclaw 3.0.7 → 3.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (172) hide show
  1. package/apps/web/.next/standalone/apps/web/.next/BUILD_ID +1 -1
  2. package/apps/web/.next/standalone/apps/web/.next/app-build-manifest.json +183 -183
  3. package/apps/web/.next/standalone/apps/web/.next/app-path-routes-manifest.json +51 -51
  4. package/apps/web/.next/standalone/apps/web/.next/build-manifest.json +2 -2
  5. package/apps/web/.next/standalone/apps/web/.next/cache/config.json +3 -3
  6. package/apps/web/.next/standalone/apps/web/.next/prerender-manifest.json +3 -3
  7. package/apps/web/.next/standalone/apps/web/.next/required-server-files.json +1 -1
  8. package/apps/web/.next/standalone/apps/web/.next/routes-manifest.json +1 -1
  9. package/apps/web/.next/standalone/apps/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  10. package/apps/web/.next/standalone/apps/web/.next/server/app/api/apps/cron/route_client-reference-manifest.js +1 -1
  11. package/apps/web/.next/standalone/apps/web/.next/server/app/api/apps/proxy/route_client-reference-manifest.js +1 -1
  12. package/apps/web/.next/standalone/apps/web/.next/server/app/api/apps/route_client-reference-manifest.js +1 -1
  13. package/apps/web/.next/standalone/apps/web/.next/server/app/api/apps/serve/[...path]/route_client-reference-manifest.js +1 -1
  14. package/apps/web/.next/standalone/apps/web/.next/server/app/api/apps/store/route_client-reference-manifest.js +1 -1
  15. package/apps/web/.next/standalone/apps/web/.next/server/app/api/apps/webhooks/[...path]/route_client-reference-manifest.js +1 -1
  16. package/apps/web/.next/standalone/apps/web/.next/server/app/api/chat/active/route_client-reference-manifest.js +1 -1
  17. package/apps/web/.next/standalone/apps/web/.next/server/app/api/chat/route.js +1 -1
  18. package/apps/web/.next/standalone/apps/web/.next/server/app/api/chat/route_client-reference-manifest.js +1 -1
  19. package/apps/web/.next/standalone/apps/web/.next/server/app/api/chat/runs/route_client-reference-manifest.js +1 -1
  20. package/apps/web/.next/standalone/apps/web/.next/server/app/api/chat/stop/route.js +1 -1
  21. package/apps/web/.next/standalone/apps/web/.next/server/app/api/chat/stop/route_client-reference-manifest.js +1 -1
  22. package/apps/web/.next/standalone/apps/web/.next/server/app/api/chat/stream/route_client-reference-manifest.js +1 -1
  23. package/apps/web/.next/standalone/apps/web/.next/server/app/api/chat/subagents/route_client-reference-manifest.js +1 -1
  24. package/apps/web/.next/standalone/apps/web/.next/server/app/api/composio/callback/route_client-reference-manifest.js +1 -1
  25. package/apps/web/.next/standalone/apps/web/.next/server/app/api/composio/connect/route_client-reference-manifest.js +1 -1
  26. package/apps/web/.next/standalone/apps/web/.next/server/app/api/composio/connections/route_client-reference-manifest.js +1 -1
  27. package/apps/web/.next/standalone/apps/web/.next/server/app/api/composio/disconnect/route_client-reference-manifest.js +1 -1
  28. package/apps/web/.next/standalone/apps/web/.next/server/app/api/composio/status/route_client-reference-manifest.js +1 -1
  29. package/apps/web/.next/standalone/apps/web/.next/server/app/api/composio/toolkits/route_client-reference-manifest.js +1 -1
  30. package/apps/web/.next/standalone/apps/web/.next/server/app/api/crm/calendar/[id]/route_client-reference-manifest.js +1 -1
  31. package/apps/web/.next/standalone/apps/web/.next/server/app/api/crm/calendar/route_client-reference-manifest.js +1 -1
  32. package/apps/web/.next/standalone/apps/web/.next/server/app/api/crm/companies/[id]/route_client-reference-manifest.js +1 -1
  33. package/apps/web/.next/standalone/apps/web/.next/server/app/api/crm/enrich/[type]/[id]/route_client-reference-manifest.js +1 -1
  34. package/apps/web/.next/standalone/apps/web/.next/server/app/api/crm/inbox/[threadId]/route_client-reference-manifest.js +1 -1
  35. package/apps/web/.next/standalone/apps/web/.next/server/app/api/crm/inbox/route_client-reference-manifest.js +1 -1
  36. package/apps/web/.next/standalone/apps/web/.next/server/app/api/crm/people/[id]/activity/route_client-reference-manifest.js +1 -1
  37. package/apps/web/.next/standalone/apps/web/.next/server/app/api/crm/people/[id]/route_client-reference-manifest.js +1 -1
  38. package/apps/web/.next/standalone/apps/web/.next/server/app/api/crm/people/route_client-reference-manifest.js +1 -1
  39. package/apps/web/.next/standalone/apps/web/.next/server/app/api/crm/photos/proxy/route_client-reference-manifest.js +1 -1
  40. package/apps/web/.next/standalone/apps/web/.next/server/app/api/crm/photos/sync/route_client-reference-manifest.js +1 -1
  41. package/apps/web/.next/standalone/apps/web/.next/server/app/api/cron/heartbeat/route_client-reference-manifest.js +1 -1
  42. package/apps/web/.next/standalone/apps/web/.next/server/app/api/cron/jobs/[jobId]/runs/route_client-reference-manifest.js +1 -1
  43. package/apps/web/.next/standalone/apps/web/.next/server/app/api/cron/jobs/route_client-reference-manifest.js +1 -1
  44. package/apps/web/.next/standalone/apps/web/.next/server/app/api/cron/runs/[sessionId]/route_client-reference-manifest.js +1 -1
  45. package/apps/web/.next/standalone/apps/web/.next/server/app/api/cron/runs/search-transcript/route_client-reference-manifest.js +1 -1
  46. package/apps/web/.next/standalone/apps/web/.next/server/app/api/feedback/route.js +1 -1
  47. package/apps/web/.next/standalone/apps/web/.next/server/app/api/feedback/route_client-reference-manifest.js +1 -1
  48. package/apps/web/.next/standalone/apps/web/.next/server/app/api/gateway/channels/route_client-reference-manifest.js +1 -1
  49. package/apps/web/.next/standalone/apps/web/.next/server/app/api/gateway/chat/route_client-reference-manifest.js +1 -1
  50. package/apps/web/.next/standalone/apps/web/.next/server/app/api/gateway/chat/stream/route_client-reference-manifest.js +1 -1
  51. package/apps/web/.next/standalone/apps/web/.next/server/app/api/gateway/sessions/[id]/route_client-reference-manifest.js +1 -1
  52. package/apps/web/.next/standalone/apps/web/.next/server/app/api/gateway/sessions/route_client-reference-manifest.js +1 -1
  53. package/apps/web/.next/standalone/apps/web/.next/server/app/api/integrations/[id]/toggle/route_client-reference-manifest.js +1 -1
  54. package/apps/web/.next/standalone/apps/web/.next/server/app/api/integrations/repair/route_client-reference-manifest.js +1 -1
  55. package/apps/web/.next/standalone/apps/web/.next/server/app/api/integrations/route_client-reference-manifest.js +1 -1
  56. package/apps/web/.next/standalone/apps/web/.next/server/app/api/memories/route_client-reference-manifest.js +1 -1
  57. package/apps/web/.next/standalone/apps/web/.next/server/app/api/onboarding/connections/route.js +1 -1
  58. package/apps/web/.next/standalone/apps/web/.next/server/app/api/onboarding/connections/route_client-reference-manifest.js +1 -1
  59. package/apps/web/.next/standalone/apps/web/.next/server/app/api/onboarding/dench-cloud/route.js +1 -1
  60. package/apps/web/.next/standalone/apps/web/.next/server/app/api/onboarding/dench-cloud/route_client-reference-manifest.js +1 -1
  61. package/apps/web/.next/standalone/apps/web/.next/server/app/api/onboarding/identity/route.js +1 -1
  62. package/apps/web/.next/standalone/apps/web/.next/server/app/api/onboarding/identity/route_client-reference-manifest.js +1 -1
  63. package/apps/web/.next/standalone/apps/web/.next/server/app/api/onboarding/state/route.js +1 -1
  64. package/apps/web/.next/standalone/apps/web/.next/server/app/api/onboarding/state/route_client-reference-manifest.js +1 -1
  65. package/apps/web/.next/standalone/apps/web/.next/server/app/api/onboarding/sync/progress/route_client-reference-manifest.js +1 -1
  66. package/apps/web/.next/standalone/apps/web/.next/server/app/api/onboarding/sync/start/route.js +1 -1
  67. package/apps/web/.next/standalone/apps/web/.next/server/app/api/onboarding/sync/start/route_client-reference-manifest.js +1 -1
  68. package/apps/web/.next/standalone/apps/web/.next/server/app/api/profiles/route_client-reference-manifest.js +1 -1
  69. package/apps/web/.next/standalone/apps/web/.next/server/app/api/profiles/switch/route_client-reference-manifest.js +1 -1
  70. package/apps/web/.next/standalone/apps/web/.next/server/app/api/sessions/[sessionId]/route_client-reference-manifest.js +1 -1
  71. package/apps/web/.next/standalone/apps/web/.next/server/app/api/sessions/route_client-reference-manifest.js +1 -1
  72. package/apps/web/.next/standalone/apps/web/.next/server/app/api/settings/cloud/route_client-reference-manifest.js +1 -1
  73. package/apps/web/.next/standalone/apps/web/.next/server/app/api/settings/mcp/connect/callback/route_client-reference-manifest.js +1 -1
  74. package/apps/web/.next/standalone/apps/web/.next/server/app/api/settings/mcp/connect/start/route_client-reference-manifest.js +1 -1
  75. package/apps/web/.next/standalone/apps/web/.next/server/app/api/settings/mcp/connect/token/route_client-reference-manifest.js +1 -1
  76. package/apps/web/.next/standalone/apps/web/.next/server/app/api/settings/mcp/probe/route_client-reference-manifest.js +1 -1
  77. package/apps/web/.next/standalone/apps/web/.next/server/app/api/settings/mcp/route_client-reference-manifest.js +1 -1
  78. package/apps/web/.next/standalone/apps/web/.next/server/app/api/skills/[slug]/content/route_client-reference-manifest.js +1 -1
  79. package/apps/web/.next/standalone/apps/web/.next/server/app/api/skills/[slug]/route_client-reference-manifest.js +1 -1
  80. package/apps/web/.next/standalone/apps/web/.next/server/app/api/skills/browse/route_client-reference-manifest.js +1 -1
  81. package/apps/web/.next/standalone/apps/web/.next/server/app/api/skills/install/route_client-reference-manifest.js +1 -1
  82. package/apps/web/.next/standalone/apps/web/.next/server/app/api/skills/route_client-reference-manifest.js +1 -1
  83. package/apps/web/.next/standalone/apps/web/.next/server/app/api/sync/poll-tick/route_client-reference-manifest.js +1 -1
  84. package/apps/web/.next/standalone/apps/web/.next/server/app/api/sync/refresh/route_client-reference-manifest.js +1 -1
  85. package/apps/web/.next/standalone/apps/web/.next/server/app/api/sync/status/route_client-reference-manifest.js +1 -1
  86. package/apps/web/.next/standalone/apps/web/.next/server/app/api/terminal/port/route_client-reference-manifest.js +1 -1
  87. package/apps/web/.next/standalone/apps/web/.next/server/app/api/voice/speech/route_client-reference-manifest.js +1 -1
  88. package/apps/web/.next/standalone/apps/web/.next/server/app/api/voice/transcribe/route_client-reference-manifest.js +1 -1
  89. package/apps/web/.next/standalone/apps/web/.next/server/app/api/voice/voices/route_client-reference-manifest.js +1 -1
  90. package/apps/web/.next/standalone/apps/web/.next/server/app/api/web-sessions/[id]/messages/route_client-reference-manifest.js +1 -1
  91. package/apps/web/.next/standalone/apps/web/.next/server/app/api/web-sessions/[id]/route_client-reference-manifest.js +1 -1
  92. package/apps/web/.next/standalone/apps/web/.next/server/app/api/web-sessions/route.js +1 -1
  93. package/apps/web/.next/standalone/apps/web/.next/server/app/api/web-sessions/route_client-reference-manifest.js +1 -1
  94. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/assets/[...path]/route_client-reference-manifest.js +1 -1
  95. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/browse/route_client-reference-manifest.js +1 -1
  96. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/browse-file/route_client-reference-manifest.js +1 -1
  97. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/context/route_client-reference-manifest.js +1 -1
  98. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/copy/route_client-reference-manifest.js +1 -1
  99. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/db/introspect/route_client-reference-manifest.js +1 -1
  100. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/db/query/route_client-reference-manifest.js +1 -1
  101. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/delete/route.js +1 -1
  102. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/delete/route_client-reference-manifest.js +1 -1
  103. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/enrichment-status/route_client-reference-manifest.js +1 -1
  104. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/execute/route_client-reference-manifest.js +1 -1
  105. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/file/route_client-reference-manifest.js +1 -1
  106. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/init/route.js +1 -1
  107. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/init/route_client-reference-manifest.js +1 -1
  108. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/link-preview/route_client-reference-manifest.js +1 -1
  109. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/list/route_client-reference-manifest.js +1 -1
  110. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/mkdir/route_client-reference-manifest.js +1 -1
  111. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/move/route_client-reference-manifest.js +1 -1
  112. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/actions/route_client-reference-manifest.js +1 -1
  113. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/actions/runs/route_client-reference-manifest.js +1 -1
  114. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/display-field/route_client-reference-manifest.js +1 -1
  115. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/enrich/route_client-reference-manifest.js +1 -1
  116. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/entries/[id]/content/route_client-reference-manifest.js +1 -1
  117. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/entries/[id]/route_client-reference-manifest.js +1 -1
  118. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/entries/bulk-delete/route_client-reference-manifest.js +1 -1
  119. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/entries/options/route_client-reference-manifest.js +1 -1
  120. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/entries/route.js +1 -1
  121. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/entries/route_client-reference-manifest.js +1 -1
  122. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/fields/[fieldId]/enum-rename/route_client-reference-manifest.js +1 -1
  123. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/fields/[fieldId]/route_client-reference-manifest.js +1 -1
  124. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/fields/reorder/route_client-reference-manifest.js +1 -1
  125. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/fields/route_client-reference-manifest.js +1 -1
  126. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/icon/route_client-reference-manifest.js +1 -1
  127. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/route_client-reference-manifest.js +1 -1
  128. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/[name]/views/route_client-reference-manifest.js +1 -1
  129. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/objects/route_client-reference-manifest.js +1 -1
  130. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/open-file/route_client-reference-manifest.js +1 -1
  131. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/path-info/route_client-reference-manifest.js +1 -1
  132. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/query/route_client-reference-manifest.js +1 -1
  133. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/raw-file/route_client-reference-manifest.js +1 -1
  134. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/rename/route_client-reference-manifest.js +1 -1
  135. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/reports/execute/route.js +1 -1
  136. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/reports/execute/route_client-reference-manifest.js +1 -1
  137. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/search-index/route_client-reference-manifest.js +1 -1
  138. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/suggest-files/route_client-reference-manifest.js +1 -1
  139. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/switch/route.js +1 -1
  140. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/switch/route_client-reference-manifest.js +1 -1
  141. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/thumbnail/route_client-reference-manifest.js +1 -1
  142. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/tree/route_client-reference-manifest.js +1 -1
  143. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/upload/route.js +1 -1
  144. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/upload/route_client-reference-manifest.js +1 -1
  145. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/virtual-file/route_client-reference-manifest.js +1 -1
  146. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/watch/route_client-reference-manifest.js +1 -1
  147. package/apps/web/.next/standalone/apps/web/.next/server/app/api/workspace/write-binary/route_client-reference-manifest.js +1 -1
  148. package/apps/web/.next/standalone/apps/web/.next/server/app/onboarding/page_client-reference-manifest.js +1 -1
  149. package/apps/web/.next/standalone/apps/web/.next/server/app/page.js +1 -1
  150. package/apps/web/.next/standalone/apps/web/.next/server/app/page_client-reference-manifest.js +1 -1
  151. package/apps/web/.next/standalone/apps/web/.next/server/app/workspace/page_client-reference-manifest.js +1 -1
  152. package/apps/web/.next/standalone/apps/web/.next/server/app-paths-manifest.json +51 -51
  153. package/apps/web/.next/standalone/apps/web/.next/server/chunks/44877.js +1 -1
  154. package/apps/web/.next/standalone/apps/web/.next/server/chunks/6787.js +1 -1
  155. package/apps/web/.next/standalone/apps/web/.next/server/functions-config-manifest.json +12 -12
  156. package/apps/web/.next/standalone/apps/web/.next/server/pages/500.html +1 -1
  157. package/apps/web/.next/standalone/apps/web/.next/server/pages-manifest.json +1 -1
  158. package/apps/web/.next/standalone/apps/web/.next/server/server-reference-manifest.json +1 -1
  159. package/apps/web/.next/{static/chunks/app/layout-ee82511fd3b3535c.js → standalone/apps/web/.next/static/chunks/app/layout-1593fe8efa94d5d8.js} +1 -1
  160. package/apps/web/.next/{static/chunks/app/page-9807308c53842594.js → standalone/apps/web/.next/static/chunks/app/page-e98634d56d0b3903.js} +1 -1
  161. package/apps/web/.next/standalone/apps/web/server.js +1 -1
  162. package/apps/web/.next/standalone/extensions/posthog-analytics/lib/build-env.js +1 -1
  163. package/apps/web/.next/standalone/package.json +1 -1
  164. package/apps/web/.next/{standalone/apps/web/.next/static/chunks/app/layout-ee82511fd3b3535c.js → static/chunks/app/layout-1593fe8efa94d5d8.js} +1 -1
  165. package/apps/web/.next/{standalone/apps/web/.next/static/chunks/app/page-9807308c53842594.js → static/chunks/app/page-e98634d56d0b3903.js} +1 -1
  166. package/assets/seed/workspace.duckdb +0 -0
  167. package/extensions/posthog-analytics/lib/build-env.js +1 -1
  168. package/package.json +1 -1
  169. /package/apps/web/.next/standalone/apps/web/.next/static/{Kn0eGggG_93j-3RbQBLdh → tXOdT0964sqzfxZm_X_3S}/_buildManifest.js +0 -0
  170. /package/apps/web/.next/standalone/apps/web/.next/static/{Kn0eGggG_93j-3RbQBLdh → tXOdT0964sqzfxZm_X_3S}/_ssgManifest.js +0 -0
  171. /package/apps/web/.next/static/{Kn0eGggG_93j-3RbQBLdh → tXOdT0964sqzfxZm_X_3S}/_buildManifest.js +0 -0
  172. /package/apps/web/.next/static/{Kn0eGggG_93j-3RbQBLdh → tXOdT0964sqzfxZm_X_3S}/_ssgManifest.js +0 -0
@@ -215,7 +215,7 @@ see more here https://nextjs.org/docs/messages/app-static-to-dynamic-error`),"__
215
215
  ${p}px !important;
216
216
  ${q}px !important;
217
217
  }
218
- `),()=>{s.contains(r)&&s.removeChild(r)}},[b]),(0,d.jsx)(m,{isPresent:b,childRef:j,sizeRef:n,pop:h,children:!1===h?a:e.cloneElement(a,{ref:p})})}let o=({children:a,initial:b,isPresent:c,onExitComplete:f,custom:h,presenceAffectsLayout:j,mode:k,anchorX:l,anchorY:m,root:o})=>{let q=(0,g.M)(p),r=(0,e.useId)(),s=!0,t=(0,e.useMemo)(()=>(s=!1,{id:r,initial:b,isPresent:c,custom:h,onExitComplete:a=>{for(let b of(q.set(a,!0),q.values()))if(!b)return;f&&f()},register:a=>(q.set(a,!1),()=>q.delete(a))}),[c,q,f]);return j&&s&&(t={...t}),(0,e.useMemo)(()=>{q.forEach((a,b)=>q.set(b,!1))},[c]),e.useEffect(()=>{c||q.size||!f||f()},[c]),a=(0,d.jsx)(n,{pop:"popLayout"===k,isPresent:c,anchorX:l,anchorY:m,root:o,children:a}),(0,d.jsx)(i.t.Provider,{value:t,children:a})};function p(){return new Map}var q=c(15086);let r=a=>a.key||"";function s(a){let b=[];return e.Children.forEach(a,a=>{(0,e.isValidElement)(a)&&b.push(a)}),b}let t=({children:a,custom:b,initial:c=!0,onExitComplete:i,presenceAffectsLayout:j=!0,mode:k="sync",propagate:l=!1,anchorX:m="left",anchorY:n="top",root:p})=>{let[t,u]=(0,q.xQ)(l),v=(0,e.useMemo)(()=>s(a),[a]),w=l&&!t?[]:v.map(r),x=(0,e.useRef)(!0),y=(0,e.useRef)(v),z=(0,g.M)(()=>new Map),A=(0,e.useRef)(new Set),[B,C]=(0,e.useState)(v),[D,E]=(0,e.useState)(v);(0,h.E)(()=>{x.current=!1,y.current=v;for(let a=0;a<D.length;a++){let b=r(D[a]);w.includes(b)?(z.delete(b),A.current.delete(b)):!0!==z.get(b)&&z.set(b,!1)}},[D,w.length,w.join("-")]);let F=[];if(v!==B){let a=[...v];for(let b=0;b<D.length;b++){let c=D[b],d=r(c);w.includes(d)||(a.splice(b,0,c),F.push(c))}return"wait"===k&&F.length&&(a=F),E(s(a)),C(v),null}let{forceRender:G}=(0,e.useContext)(f.L);return(0,d.jsx)(d.Fragment,{children:D.map(a=>{let e=r(a),f=(!l||!!t)&&(v===D||w.includes(e));return(0,d.jsx)(o,{isPresent:f,initial:(!x.current||!!c)&&void 0,custom:b,presenceAffectsLayout:j,mode:k,root:p,onExitComplete:f?void 0:()=>{if(A.current.has(e)||(A.current.add(e),!z.has(e)))return;z.set(e,!0);let a=!0;z.forEach(b=>{b||(a=!1)}),a&&(G?.(),E(y.current),l&&u?.(),i&&i())},anchorX:m,anchorY:n,children:a},e)})})}},656159:(a,b)=>{"use strict";Object.defineProperty(b,Symbol.toStringTag,{value:"Module"}),b.isDeepKey=function(a){switch(typeof a){case"number":case"symbol":return!1;case"string":return a.includes(".")||a.includes("[")||a.includes("]")}}},658422:(a,b,c)=>{"use strict";Object.defineProperty(b,Symbol.toStringTag,{value:"Module"});let d=c(452171),e=c(266196),f=c(606461);b.cloneDeepWith=function(a,b){return d.cloneDeepWith(a,(c,g,h,i)=>{let j=b?.(c,g,h,i);if(void 0!==j)return j;if("object"==typeof a){if(e.getTag(a)===f.objectTag&&"function"!=typeof a.constructor){let b={};return i.set(a,b),d.copyProperties(b,a,h,i),b}switch(Object.prototype.toString.call(a)){case f.numberTag:case f.stringTag:case f.booleanTag:{let b=new a.constructor(a?.valueOf());return d.copyProperties(b,a),b}case f.argumentsTag:{let b={};return d.copyProperties(b,a),b.length=a.length,b[Symbol.iterator]=a[Symbol.iterator],b}default:return}}})}},658556:(a,b,c)=>{"use strict";function d(a,b){let c=String(a);if("string"!=typeof b)throw TypeError("Expected character");let d=0,e=c.indexOf(b);for(;-1!==e;)d++,e=c.indexOf(b,e+b.length);return d}c.d(b,{A:()=>aI});var e=c(972421),f=c(145214),g=c(423721),h=c(348445);let i="phrasing",j=["autolink","link","image","label"];function k(a){this.enter({type:"link",title:null,url:"",children:[]},a)}function l(a){this.config.enter.autolinkProtocol.call(this,a)}function m(a){this.config.exit.autolinkProtocol.call(this,a)}function n(a){this.config.exit.data.call(this,a);let b=this.stack[this.stack.length-1];(0,e.ok)("link"===b.type),b.url="http://"+this.sliceSerialize(a)}function o(a){this.config.exit.autolinkEmail.call(this,a)}function p(a){this.exit(a)}function q(a){!function(a,b,c){let d=(0,h.C)((c||{}).ignore||[]),e=function(a){let b=[];if(!Array.isArray(a))throw TypeError("Expected find and replace tuple or list of tuples");let c=!a[0]||Array.isArray(a[0])?a:[a],d=-1;for(;++d<c.length;){var e;let a=c[d];b.push(["string"==typeof(e=a[0])?RegExp(function(a){if("string"!=typeof a)throw TypeError("Expected a string");return a.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}(e),"g"):e,function(a){return"function"==typeof a?a:function(){return a}}(a[1])])}return b}(b),f=-1;for(;++f<e.length;)(0,g.VG)(a,"text",i);function i(a,b){let c,g=-1;for(;++g<b.length;){let a=b[g],e=c?c.children:void 0;if(d(a,e?e.indexOf(a):void 0,c))return;c=a}if(c)return function(a,b){let c=b[b.length-1],d=e[f][0],g=e[f][1],h=0,i=c.children.indexOf(a),j=!1,k=[];d.lastIndex=0;let l=d.exec(a.value);for(;l;){let c=l.index,e={index:l.index,input:l.input,stack:[...b,a]},f=g(...l,e);if("string"==typeof f&&(f=f.length>0?{type:"text",value:f}:void 0),!1===f?d.lastIndex=c+1:(h!==c&&k.push({type:"text",value:a.value.slice(h,c)}),Array.isArray(f)?k.push(...f):f&&k.push(f),h=c+l[0].length,j=!0),!d.global)break;l=d.exec(a.value)}return j?(h<a.value.length&&k.push({type:"text",value:a.value.slice(h)}),c.children.splice(i,1,...k)):k=[a],i+k.length}(a,b)}}(a,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,r],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,s]],{ignore:["link","linkReference"]})}function r(a,b,c,e,f){let g="";if(!t(f)||(/^w/i.test(b)&&(c=b+c,b="",g="http://"),!function(a){let b=a.split(".");return!(b.length<2||b[b.length-1]&&(/_/.test(b[b.length-1])||!/[a-zA-Z\d]/.test(b[b.length-1]))||b[b.length-2]&&(/_/.test(b[b.length-2])||!/[a-zA-Z\d]/.test(b[b.length-2])))}(c)))return!1;let h=function(a){let b=/[!"&'),.:;<>?\]}]+$/.exec(a);if(!b)return[a,void 0];a=a.slice(0,b.index);let c=b[0],e=c.indexOf(")"),f=d(a,"("),g=d(a,")");for(;-1!==e&&f>g;)a+=c.slice(0,e+1),e=(c=c.slice(e+1)).indexOf(")"),g++;return[a,c]}(c+e);if(!h[0])return!1;let i={type:"link",title:null,url:g+b+h[0],children:[{type:"text",value:b+h[0]}]};return h[1]?[i,{type:"text",value:h[1]}]:i}function s(a,b,c,d){return!(!t(d,!0)||/[-\d_]$/.test(c))&&{type:"link",title:null,url:"mailto:"+b+"@"+c,children:[{type:"text",value:b+"@"+c}]}}function t(a,b){let c=a.input.charCodeAt(a.index-1);return(0===a.index||(0,f.Ny)(c)||(0,f.es)(c))&&(!b||47!==c)}var u=c(732347);function v(){this.buffer()}function w(a){this.enter({type:"footnoteReference",identifier:"",label:""},a)}function x(){this.buffer()}function y(a){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},a)}function z(a){let b=this.resume(),c=this.stack[this.stack.length-1];(0,e.ok)("footnoteReference"===c.type),c.identifier=(0,u.B)(this.sliceSerialize(a)).toLowerCase(),c.label=b}function A(a){this.exit(a)}function B(a){let b=this.resume(),c=this.stack[this.stack.length-1];(0,e.ok)("footnoteDefinition"===c.type),c.identifier=(0,u.B)(this.sliceSerialize(a)).toLowerCase(),c.label=b}function C(a){this.exit(a)}function D(a,b,c,d){let e=c.createTracker(d),f=e.move("[^"),g=c.enter("footnoteReference"),h=c.enter("reference");return f+=e.move(c.safe(c.associationId(a),{after:"]",before:f})),h(),g(),f+=e.move("]")}function E(a,b,c){return 0===b?a:F(a,b,c)}function F(a,b,c){return(c?"":" ")+a}D.peek=function(){return"["};let G=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];function H(a){this.enter({type:"delete",children:[]},a)}function I(a){this.exit(a)}function J(a,b,c,d){let e=c.createTracker(d),f=c.enter("strikethrough"),g=e.move("~~");return g+=c.containerPhrasing(a,{...e.current(),before:g,after:"~"}),g+=e.move("~~"),f(),g}function K(a){return a.length}function L(a){let b="string"==typeof a?a.codePointAt(0):0;return 67===b||99===b?99:76===b||108===b?108:114*(82===b||114===b)}J.peek=function(){return"~"};var M=c(294401);c(320608);c(210164);function N(a,b,c){let d=a.value||"",e="`",f=-1;for(;RegExp("(^|[^`])"+e+"([^`]|$)").test(d);)e+="`";for(/[^ \r\n]/.test(d)&&(/^[ \r\n]/.test(d)&&/[ \r\n]$/.test(d)||/^`|`$/.test(d))&&(d=" "+d+" ");++f<c.unsafe.length;){let a,b=c.unsafe[f],e=c.compilePattern(b);if(b.atBreak)for(;a=e.exec(d);){let b=a.index;10===d.charCodeAt(b)&&13===d.charCodeAt(b-1)&&b--,d=d.slice(0,b)+" "+d.slice(a.index+1)}}return e+d+e}N.peek=function(){return"`"};(0,h.C)(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);let O={inlineCode:N,listItem:function(a,b,c,d){let e=function(a){let b=a.options.listItemIndent||"one";if("tab"!==b&&"one"!==b&&"mixed"!==b)throw Error("Cannot serialize items with `"+b+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return b}(c),f=c.bulletCurrent||function(a){let b=a.options.bullet||"*";if("*"!==b&&"+"!==b&&"-"!==b)throw Error("Cannot serialize items with `"+b+"` for `options.bullet`, expected `*`, `+`, or `-`");return b}(c);b&&"list"===b.type&&b.ordered&&(f=("number"==typeof b.start&&b.start>-1?b.start:1)+(!1===c.options.incrementListMarker?0:b.children.indexOf(a))+f);let g=f.length+1;("tab"===e||"mixed"===e&&(b&&"list"===b.type&&b.spread||a.spread))&&(g=4*Math.ceil(g/4));let h=c.createTracker(d);h.move(f+" ".repeat(g-f.length)),h.shift(g);let i=c.enter("listItem"),j=c.indentLines(c.containerFlow(a,h.current()),function(a,b,c){return b?(c?"":" ".repeat(g))+a:(c?f:f+" ".repeat(g-f.length))+a});return i(),j}};function P(a){let b=a._align;(0,e.ok)(b,"expected `_align` on table"),this.enter({type:"table",align:b.map(function(a){return"none"===a?null:a}),children:[]},a),this.data.inTable=!0}function Q(a){this.exit(a),this.data.inTable=void 0}function R(a){this.enter({type:"tableRow",children:[]},a)}function S(a){this.exit(a)}function T(a){this.enter({type:"tableCell",children:[]},a)}function U(a){let b=this.resume();this.data.inTable&&(b=b.replace(/\\([\\|])/g,V));let c=this.stack[this.stack.length-1];(0,e.ok)("inlineCode"===c.type),c.value=b,this.exit(a)}function V(a,b){return"|"===b?b:a}function W(a){let b=this.stack[this.stack.length-2];(0,e.ok)("listItem"===b.type),b.checked="taskListCheckValueChecked"===a.type}function X(a){let b=this.stack[this.stack.length-2];if(b&&"listItem"===b.type&&"boolean"==typeof b.checked){let a=this.stack[this.stack.length-1];(0,e.ok)("paragraph"===a.type);let c=a.children[0];if(c&&"text"===c.type){let d,e=b.children,f=-1;for(;++f<e.length;){let a=e[f];if("paragraph"===a.type){d=a;break}}d===a&&(c.value=c.value.slice(1),0===c.value.length?a.children.shift():a.position&&c.position&&"number"==typeof c.position.start.offset&&(c.position.start.column++,c.position.start.offset++,a.position.start=Object.assign({},c.position.start)))}}this.exit(a)}function Y(a,b,c,d){let e=a.children[0],f="boolean"==typeof a.checked&&e&&"paragraph"===e.type,g="["+(a.checked?"x":" ")+"] ",h=c.createTracker(d);f&&h.move(g);let i=O.listItem(a,b,c,{...d,...h.current()});return f&&(i=i.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,function(a){return a+g})),i}var Z=c(161693);let _={tokenize:function(a,b,c){let d=0;return function b(f){return(87===f||119===f)&&d<3?(d++,a.consume(f),b):46===f&&3===d?(a.consume(f),e):c(f)};function e(a){return null===a?c(a):b(a)}},partial:!0},aa={tokenize:function(a,b,c){let d,e,g;return h;function h(b){return 46===b||95===b?a.check(ac,j,i)(b):null===b||(0,f.Ee)(b)||(0,f.Ny)(b)||45!==b&&(0,f.es)(b)?j(b):(g=!0,a.consume(b),h)}function i(b){return 95===b?d=!0:(e=d,d=void 0),a.consume(b),h}function j(a){return e||d||!g?c(a):b(a)}},partial:!0},ab={tokenize:function(a,b){let c=0,d=0;return e;function e(h){return 40===h?(c++,a.consume(h),e):41===h&&d<c?g(h):33===h||34===h||38===h||39===h||41===h||42===h||44===h||46===h||58===h||59===h||60===h||63===h||93===h||95===h||126===h?a.check(ac,b,g)(h):null===h||(0,f.Ee)(h)||(0,f.Ny)(h)?b(h):(a.consume(h),e)}function g(b){return 41===b&&d++,a.consume(b),e}},partial:!0},ac={tokenize:function(a,b,c){return d;function d(h){return 33===h||34===h||39===h||41===h||42===h||44===h||46===h||58===h||59===h||63===h||95===h||126===h?(a.consume(h),d):38===h?(a.consume(h),g):93===h?(a.consume(h),e):60===h||null===h||(0,f.Ee)(h)||(0,f.Ny)(h)?b(h):c(h)}function e(a){return null===a||40===a||91===a||(0,f.Ee)(a)||(0,f.Ny)(a)?b(a):d(a)}function g(b){return(0,f.CW)(b)?function b(e){return 59===e?(a.consume(e),d):(0,f.CW)(e)?(a.consume(e),b):c(e)}(b):c(b)}},partial:!0},ad={tokenize:function(a,b,c){return function(b){return a.consume(b),d};function d(a){return(0,f.lV)(a)?c(a):b(a)}},partial:!0},ae={name:"wwwAutolink",tokenize:function(a,b,c){let d=this;return function(b){return 87!==b&&119!==b||!aj.call(d,d.previous)||an(d.events)?c(b):(a.enter("literalAutolink"),a.enter("literalAutolinkWww"),a.check(_,a.attempt(aa,a.attempt(ab,e),c),c)(b))};function e(c){return a.exit("literalAutolinkWww"),a.exit("literalAutolink"),b(c)}},previous:aj},af={name:"protocolAutolink",tokenize:function(a,b,c){let d=this,e="",g=!1;return function(b){return(72===b||104===b)&&ak.call(d,d.previous)&&!an(d.events)?(a.enter("literalAutolink"),a.enter("literalAutolinkHttp"),e+=String.fromCodePoint(b),a.consume(b),h):c(b)};function h(b){if((0,f.CW)(b)&&e.length<5)return e+=String.fromCodePoint(b),a.consume(b),h;if(58===b){let c=e.toLowerCase();if("http"===c||"https"===c)return a.consume(b),i}return c(b)}function i(b){return 47===b?(a.consume(b),g)?j:(g=!0,i):c(b)}function j(b){return null===b||(0,f.JQ)(b)||(0,f.Ee)(b)||(0,f.Ny)(b)||(0,f.es)(b)?c(b):a.attempt(aa,a.attempt(ab,k),c)(b)}function k(c){return a.exit("literalAutolinkHttp"),a.exit("literalAutolink"),b(c)}},previous:ak},ag={name:"emailAutolink",tokenize:function(a,b,c){let d,e,g=this;return function(b){return!am(b)||!al.call(g,g.previous)||an(g.events)?c(b):(a.enter("literalAutolink"),a.enter("literalAutolinkEmail"),function b(d){return am(d)?(a.consume(d),b):64===d?(a.consume(d),h):c(d)}(b))};function h(b){return 46===b?a.check(ad,j,i)(b):45===b||95===b||(0,f.lV)(b)?(e=!0,a.consume(b),h):j(b)}function i(b){return a.consume(b),d=!0,h}function j(h){return e&&d&&(0,f.CW)(g.previous)?(a.exit("literalAutolinkEmail"),a.exit("literalAutolink"),b(h)):c(h)}},previous:al},ah={},ai=48;for(;ai<123;)ah[ai]=ag,58==++ai?ai=65:91===ai&&(ai=97);function aj(a){return null===a||40===a||42===a||95===a||91===a||93===a||126===a||(0,f.Ee)(a)}function ak(a){return!(0,f.CW)(a)}function al(a){return!(47===a||am(a))}function am(a){return 43===a||45===a||46===a||95===a||(0,f.lV)(a)}function an(a){let b=a.length,c=!1;for(;b--;){let d=a[b][1];if(("labelLink"===d.type||"labelImage"===d.type)&&!d._balanced){c=!0;break}if(d._gfmAutolinkLiteralWalkedInto){c=!1;break}}return a.length>0&&!c&&(a[a.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),c}ah[43]=ag,ah[45]=ag,ah[46]=ag,ah[95]=ag,ah[72]=[ag,af],ah[104]=[ag,af],ah[87]=[ag,ae],ah[119]=[ag,ae];var ao=c(360478),ap=c(621405);let aq={tokenize:function(a,b,c){let d=this;return(0,ap.N)(a,function(a){let e=d.events[d.events.length-1];return e&&"gfmFootnoteDefinitionIndent"===e[1].type&&4===e[2].sliceSerialize(e[1],!0).length?b(a):c(a)},"gfmFootnoteDefinitionIndent",5)},partial:!0};function ar(a,b,c){let d,e=this,f=e.events.length,g=e.parser.gfmFootnotes||(e.parser.gfmFootnotes=[]);for(;f--;){let a=e.events[f][1];if("labelImage"===a.type){d=a;break}if("gfmFootnoteCall"===a.type||"labelLink"===a.type||"label"===a.type||"image"===a.type||"link"===a.type)break}return function(f){if(!d||!d._balanced)return c(f);let h=(0,u.B)(e.sliceSerialize({start:d.end,end:e.now()}));return 94===h.codePointAt(0)&&g.includes(h.slice(1))?(a.enter("gfmFootnoteCallLabelMarker"),a.consume(f),a.exit("gfmFootnoteCallLabelMarker"),b(f)):c(f)}}function as(a,b){let c=a.length;for(;c--;)if("labelImage"===a[c][1].type&&"enter"===a[c][0]){a[c][1];break}a[c+1][1].type="data",a[c+3][1].type="gfmFootnoteCallLabelMarker";let d={type:"gfmFootnoteCall",start:Object.assign({},a[c+3][1].start),end:Object.assign({},a[a.length-1][1].end)},e={type:"gfmFootnoteCallMarker",start:Object.assign({},a[c+3][1].end),end:Object.assign({},a[c+3][1].end)};e.end.column++,e.end.offset++,e.end._bufferIndex++;let f={type:"gfmFootnoteCallString",start:Object.assign({},e.end),end:Object.assign({},a[a.length-1][1].start)},g={type:"chunkString",contentType:"string",start:Object.assign({},f.start),end:Object.assign({},f.end)},h=[a[c+1],a[c+2],["enter",d,b],a[c+3],a[c+4],["enter",e,b],["exit",e,b],["enter",f,b],["enter",g,b],["exit",g,b],["exit",f,b],a[a.length-2],a[a.length-1],["exit",d,b]];return a.splice(c,a.length-c+1,...h),a}function at(a,b,c){let d,e=this,g=e.parser.gfmFootnotes||(e.parser.gfmFootnotes=[]),h=0;return function(b){return a.enter("gfmFootnoteCall"),a.enter("gfmFootnoteCallLabelMarker"),a.consume(b),a.exit("gfmFootnoteCallLabelMarker"),i};function i(b){return 94!==b?c(b):(a.enter("gfmFootnoteCallMarker"),a.consume(b),a.exit("gfmFootnoteCallMarker"),a.enter("gfmFootnoteCallString"),a.enter("chunkString").contentType="string",j)}function j(i){if(h>999||93===i&&!d||null===i||91===i||(0,f.Ee)(i))return c(i);if(93===i){a.exit("chunkString");let d=a.exit("gfmFootnoteCallString");return g.includes((0,u.B)(e.sliceSerialize(d)))?(a.enter("gfmFootnoteCallLabelMarker"),a.consume(i),a.exit("gfmFootnoteCallLabelMarker"),a.exit("gfmFootnoteCall"),b):c(i)}return(0,f.Ee)(i)||(d=!0),h++,a.consume(i),92===i?k:j}function k(b){return 91===b||92===b||93===b?(a.consume(b),h++,j):j(b)}}function au(a,b,c){let d,e,g=this,h=g.parser.gfmFootnotes||(g.parser.gfmFootnotes=[]),i=0;return function(b){return a.enter("gfmFootnoteDefinition")._container=!0,a.enter("gfmFootnoteDefinitionLabel"),a.enter("gfmFootnoteDefinitionLabelMarker"),a.consume(b),a.exit("gfmFootnoteDefinitionLabelMarker"),j};function j(b){return 94===b?(a.enter("gfmFootnoteDefinitionMarker"),a.consume(b),a.exit("gfmFootnoteDefinitionMarker"),a.enter("gfmFootnoteDefinitionLabelString"),a.enter("chunkString").contentType="string",k):c(b)}function k(b){if(i>999||93===b&&!e||null===b||91===b||(0,f.Ee)(b))return c(b);if(93===b){a.exit("chunkString");let c=a.exit("gfmFootnoteDefinitionLabelString");return d=(0,u.B)(g.sliceSerialize(c)),a.enter("gfmFootnoteDefinitionLabelMarker"),a.consume(b),a.exit("gfmFootnoteDefinitionLabelMarker"),a.exit("gfmFootnoteDefinitionLabel"),m}return(0,f.Ee)(b)||(e=!0),i++,a.consume(b),92===b?l:k}function l(b){return 91===b||92===b||93===b?(a.consume(b),i++,k):k(b)}function m(b){return 58===b?(a.enter("definitionMarker"),a.consume(b),a.exit("definitionMarker"),h.includes(d)||h.push(d),(0,ap.N)(a,n,"gfmFootnoteDefinitionWhitespace")):c(b)}function n(a){return b(a)}}function av(a,b,c){return a.check(ao.B,b,a.attempt(aq,b,c))}function aw(a){a.exit("gfmFootnoteDefinition")}var ax=c(962349),ay=c(598525);class az{constructor(){this.map=[]}add(a,b,c){!function(a,b,c,d){let e=0;if(0!==c||0!==d.length){for(;e<a.map.length;){if(a.map[e][0]===b){a.map[e][1]+=c,a.map[e][2].push(...d);return}e+=1}a.map.push([b,c,d])}}(this,a,b,c)}consume(a){if(this.map.sort(function(a,b){return a[0]-b[0]}),0===this.map.length)return;let b=this.map.length,c=[];for(;b>0;)b-=1,c.push(a.slice(this.map[b][0]+this.map[b][1]),this.map[b][2]),a.length=this.map[b][0];c.push(a.slice()),a.length=0;let d=c.pop();for(;d;){for(let b of d)a.push(b);d=c.pop()}this.map.length=0}}function aA(a,b,c){let d,e=this,g=0,h=0;return function(a){let b=e.events.length-1;for(;b>-1;){let a=e.events[b][1].type;if("lineEnding"===a||"linePrefix"===a)b--;else break}let d=b>-1?e.events[b][1].type:null,f="tableHead"===d||"tableRow"===d?t:i;return f===t&&e.parser.lazy[e.now().line]?c(a):f(a)};function i(b){var c;return a.enter("tableHead"),a.enter("tableRow"),124===(c=b)||(d=!0,h+=1),j(c)}function j(b){return null===b?c(b):(0,f.HP)(b)?h>1?(h=0,e.interrupt=!0,a.exit("tableRow"),a.enter("lineEnding"),a.consume(b),a.exit("lineEnding"),m):c(b):(0,f.On)(b)?(0,ap.N)(a,j,"whitespace")(b):(h+=1,d&&(d=!1,g+=1),124===b)?(a.enter("tableCellDivider"),a.consume(b),a.exit("tableCellDivider"),d=!0,j):(a.enter("data"),k(b))}function k(b){return null===b||124===b||(0,f.Ee)(b)?(a.exit("data"),j(b)):(a.consume(b),92===b?l:k)}function l(b){return 92===b||124===b?(a.consume(b),k):k(b)}function m(b){return(e.interrupt=!1,e.parser.lazy[e.now().line])?c(b):(a.enter("tableDelimiterRow"),d=!1,(0,f.On)(b))?(0,ap.N)(a,n,"linePrefix",e.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(b):n(b)}function n(b){return 45===b||58===b?p(b):124===b?(d=!0,a.enter("tableCellDivider"),a.consume(b),a.exit("tableCellDivider"),o):c(b)}function o(b){return(0,f.On)(b)?(0,ap.N)(a,p,"whitespace")(b):p(b)}function p(b){return 58===b?(h+=1,d=!0,a.enter("tableDelimiterMarker"),a.consume(b),a.exit("tableDelimiterMarker"),q):45===b?(h+=1,q(b)):null===b||(0,f.HP)(b)?s(b):c(b)}function q(b){return 45===b?(a.enter("tableDelimiterFiller"),function b(c){return 45===c?(a.consume(c),b):58===c?(d=!0,a.exit("tableDelimiterFiller"),a.enter("tableDelimiterMarker"),a.consume(c),a.exit("tableDelimiterMarker"),r):(a.exit("tableDelimiterFiller"),r(c))}(b)):c(b)}function r(b){return(0,f.On)(b)?(0,ap.N)(a,s,"whitespace")(b):s(b)}function s(e){if(124===e)return n(e);if(null===e||(0,f.HP)(e))return d&&g===h?(a.exit("tableDelimiterRow"),a.exit("tableHead"),b(e)):c(e);return c(e)}function t(b){return a.enter("tableRow"),u(b)}function u(c){return 124===c?(a.enter("tableCellDivider"),a.consume(c),a.exit("tableCellDivider"),u):null===c||(0,f.HP)(c)?(a.exit("tableRow"),b(c)):(0,f.On)(c)?(0,ap.N)(a,u,"whitespace")(c):(a.enter("data"),v(c))}function v(b){return null===b||124===b||(0,f.Ee)(b)?(a.exit("data"),u(b)):(a.consume(b),92===b?w:v)}function w(b){return 92===b||124===b?(a.consume(b),v):v(b)}}function aB(a,b){let c,d,e,f=-1,g=!0,h=0,i=[0,0,0,0],j=[0,0,0,0],k=!1,l=0,m=new az;for(;++f<a.length;){let n=a[f],o=n[1];"enter"===n[0]?"tableHead"===o.type?(k=!1,0!==l&&(aD(m,b,l,c,d),d=void 0,l=0),c={type:"table",start:Object.assign({},o.start),end:Object.assign({},o.end)},m.add(f,0,[["enter",c,b]])):"tableRow"===o.type||"tableDelimiterRow"===o.type?(g=!0,e=void 0,i=[0,0,0,0],j=[0,f+1,0,0],k&&(k=!1,d={type:"tableBody",start:Object.assign({},o.start),end:Object.assign({},o.end)},m.add(f,0,[["enter",d,b]])),h="tableDelimiterRow"===o.type?2:d?3:1):h&&("data"===o.type||"tableDelimiterMarker"===o.type||"tableDelimiterFiller"===o.type)?(g=!1,0===j[2]&&(0!==i[1]&&(j[0]=j[1],e=aC(m,b,i,h,void 0,e),i=[0,0,0,0]),j[2]=f)):"tableCellDivider"===o.type&&(g?g=!1:(0!==i[1]&&(j[0]=j[1],e=aC(m,b,i,h,void 0,e)),j=[(i=j)[1],f,0,0])):"tableHead"===o.type?(k=!0,l=f):"tableRow"===o.type||"tableDelimiterRow"===o.type?(l=f,0!==i[1]?(j[0]=j[1],e=aC(m,b,i,h,f,e)):0!==j[1]&&(e=aC(m,b,j,h,f,e)),h=0):h&&("data"===o.type||"tableDelimiterMarker"===o.type||"tableDelimiterFiller"===o.type)&&(j[3]=f)}for(0!==l&&aD(m,b,l,c,d),m.consume(b.events),f=-1;++f<b.events.length;){let a=b.events[f];"enter"===a[0]&&"table"===a[1].type&&(a[1]._align=function(a,b){let c=!1,d=[];for(;b<a.length;){let e=a[b];if(c){if("enter"===e[0])"tableContent"===e[1].type&&d.push("tableDelimiterMarker"===a[b+1][1].type?"left":"none");else if("tableContent"===e[1].type){if("tableDelimiterMarker"===a[b-1][1].type){let a=d.length-1;d[a]="left"===d[a]?"center":"right"}}else if("tableDelimiterRow"===e[1].type)break}else"enter"===e[0]&&"tableDelimiterRow"===e[1].type&&(c=!0);b+=1}return d}(b.events,f))}return a}function aC(a,b,c,d,e,f){0!==c[0]&&(f.end=Object.assign({},aE(b.events,c[0])),a.add(c[0],0,[["exit",f,b]]));let g=aE(b.events,c[1]);if(f={type:1===d?"tableHeader":2===d?"tableDelimiter":"tableData",start:Object.assign({},g),end:Object.assign({},g)},a.add(c[1],0,[["enter",f,b]]),0!==c[2]){let e=aE(b.events,c[2]),f=aE(b.events,c[3]),g={type:"tableContent",start:Object.assign({},e),end:Object.assign({},f)};if(a.add(c[2],0,[["enter",g,b]]),2!==d){let d=b.events[c[2]],e=b.events[c[3]];if(d[1].end=Object.assign({},e[1].end),d[1].type="chunkText",d[1].contentType="text",c[3]>c[2]+1){let b=c[2]+1,d=c[3]-c[2]-1;a.add(b,d,[])}}a.add(c[3]+1,0,[["exit",g,b]])}return void 0!==e&&(f.end=Object.assign({},aE(b.events,e)),a.add(e,0,[["exit",f,b]]),f=void 0),f}function aD(a,b,c,d,e){let f=[],g=aE(b.events,c);e&&(e.end=Object.assign({},g),f.push(["exit",e,b])),d.end=Object.assign({},g),f.push(["exit",d,b]),a.add(c+1,0,f)}function aE(a,b){let c=a[b],d="enter"===c[0]?"start":"end";return c[1][d]}let aF={name:"tasklistCheck",tokenize:function(a,b,c){let d=this;return function(b){return null===d.previous&&d._gfmTasklistFirstContentOfListItem?(a.enter("taskListCheck"),a.enter("taskListCheckMarker"),a.consume(b),a.exit("taskListCheckMarker"),e):c(b)};function e(b){return(0,f.Ee)(b)?(a.enter("taskListCheckValueUnchecked"),a.consume(b),a.exit("taskListCheckValueUnchecked"),g):88===b||120===b?(a.enter("taskListCheckValueChecked"),a.consume(b),a.exit("taskListCheckValueChecked"),g):c(b)}function g(b){return 93===b?(a.enter("taskListCheckMarker"),a.consume(b),a.exit("taskListCheckMarker"),a.exit("taskListCheck"),h):c(b)}function h(d){return(0,f.HP)(d)?b(d):(0,f.On)(d)?a.check({tokenize:aG},b,c)(d):c(d)}}};function aG(a,b,c){return(0,ap.N)(a,function(a){return null===a?c(a):b(a)},"whitespace")}let aH={};function aI(a){let b,c=a||aH,d=this.data(),e=d.micromarkExtensions||(d.micromarkExtensions=[]),f=d.fromMarkdownExtensions||(d.fromMarkdownExtensions=[]),g=d.toMarkdownExtensions||(d.toMarkdownExtensions=[]);e.push((0,Z.y)([{text:ah},{document:{91:{name:"gfmFootnoteDefinition",tokenize:au,continuation:{tokenize:av},exit:aw}},text:{91:{name:"gfmFootnoteCall",tokenize:at},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:ar,resolveTo:as}}},function(a){let b=(a||{}).singleTilde,c={name:"strikethrough",tokenize:function(a,c,d){let e=this.previous,f=this.events,g=0;return function(h){return 126===e&&"characterEscape"!==f[f.length-1][1].type?d(h):(a.enter("strikethroughSequenceTemporary"),function f(h){let i=(0,M.S)(e);if(126===h)return g>1?d(h):(a.consume(h),g++,f);if(g<2&&!b)return d(h);let j=a.exit("strikethroughSequenceTemporary"),k=(0,M.S)(h);return j._open=!k||2===k&&!!i,j._close=!i||2===i&&!!k,c(h)}(h))}},resolveAll:function(a,b){let c=-1;for(;++c<a.length;)if("enter"===a[c][0]&&"strikethroughSequenceTemporary"===a[c][1].type&&a[c][1]._close){let d=c;for(;d--;)if("exit"===a[d][0]&&"strikethroughSequenceTemporary"===a[d][1].type&&a[d][1]._open&&a[c][1].end.offset-a[c][1].start.offset==a[d][1].end.offset-a[d][1].start.offset){a[c][1].type="strikethroughSequence",a[d][1].type="strikethroughSequence";let e={type:"strikethrough",start:Object.assign({},a[d][1].start),end:Object.assign({},a[c][1].end)},f={type:"strikethroughText",start:Object.assign({},a[d][1].end),end:Object.assign({},a[c][1].start)},g=[["enter",e,b],["enter",a[d][1],b],["exit",a[d][1],b],["enter",f,b]],h=b.parser.constructs.insideSpan.null;h&&(0,ax.m)(g,g.length,0,(0,ay.W)(h,a.slice(d+1,c),b)),(0,ax.m)(g,g.length,0,[["exit",f,b],["enter",a[c][1],b],["exit",a[c][1],b],["exit",e,b]]),(0,ax.m)(a,d-1,c-d+3,g),c=d+g.length-2;break}}for(c=-1;++c<a.length;)"strikethroughSequenceTemporary"===a[c][1].type&&(a[c][1].type="data");return a}};return null==b&&(b=!0),{text:{126:c},insideSpan:{null:[c]},attentionMarkers:{null:[126]}}}(c),{flow:{null:{name:"table",tokenize:aA,resolveAll:aB}}},{text:{91:aF}}])),f.push([{transforms:[q],enter:{literalAutolink:k,literalAutolinkEmail:l,literalAutolinkHttp:l,literalAutolinkWww:l},exit:{literalAutolink:p,literalAutolinkEmail:o,literalAutolinkHttp:m,literalAutolinkWww:n}},{enter:{gfmFootnoteCallString:v,gfmFootnoteCall:w,gfmFootnoteDefinitionLabelString:x,gfmFootnoteDefinition:y},exit:{gfmFootnoteCallString:z,gfmFootnoteCall:A,gfmFootnoteDefinitionLabelString:B,gfmFootnoteDefinition:C}},{canContainEols:["delete"],enter:{strikethrough:H},exit:{strikethrough:I}},{enter:{table:P,tableData:T,tableHeader:T,tableRow:R},exit:{codeText:U,table:Q,tableData:S,tableHeader:S,tableRow:S}},{exit:{taskListCheckValueChecked:W,taskListCheckValueUnchecked:W,paragraph:X}}]),g.push({extensions:[{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:i,notInConstruct:j},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:i,notInConstruct:j},{character:":",before:"[ps]",after:"\\/",inConstruct:i,notInConstruct:j}]},(b=!1,c&&c.firstLineBlank&&(b=!0),{handlers:{footnoteDefinition:function(a,c,d,e){let f=d.createTracker(e),g=f.move("[^"),h=d.enter("footnoteDefinition"),i=d.enter("label");return g+=f.move(d.safe(d.associationId(a),{before:g,after:"]"})),i(),g+=f.move("]:"),a.children&&a.children.length>0&&(f.shift(4),g+=f.move((b?"\n":" ")+d.indentLines(d.containerFlow(a,f.current()),b?F:E))),h(),g},footnoteReference:D},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]}),{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:G}],handlers:{delete:J}},function(a){let b=a||{},c=b.tableCellPadding,d=b.tablePipeAlign,e=b.stringLength,f=c?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:"\n",inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:function(a,b,c){let d=O.inlineCode(a,b,c);return c.stack.includes("tableCell")&&(d=d.replace(/\|/g,"\\$&")),d},table:function(a,b,c,d){return h(function(a,b,c){let d=a.children,e=-1,f=[],g=b.enter("table");for(;++e<d.length;)f[e]=i(d[e],b,c);return g(),f}(a,c,d),a.align)},tableCell:g,tableRow:function(a,b,c,d){let e=h([i(a,c,d)]);return e.slice(0,e.indexOf("\n"))}}};function g(a,b,c,d){let e=c.enter("tableCell"),g=c.enter("phrasing"),h=c.containerPhrasing(a,{...d,before:f,after:f});return g(),e(),h}function h(a,b){return function(a,b){let c=b||{},d=(c.align||[]).concat(),e=c.stringLength||K,f=[],g=[],h=[],i=[],j=0,k=-1;for(;++k<a.length;){let b=[],d=[],f=-1;for(a[k].length>j&&(j=a[k].length);++f<a[k].length;){var l;let g=null==(l=a[k][f])?"":String(l);if(!1!==c.alignDelimiters){let a=e(g);d[f]=a,(void 0===i[f]||a>i[f])&&(i[f]=a)}b.push(g)}g[k]=b,h[k]=d}let m=-1;if("object"==typeof d&&"length"in d)for(;++m<j;)f[m]=L(d[m]);else{let a=L(d);for(;++m<j;)f[m]=a}m=-1;let n=[],o=[];for(;++m<j;){let a=f[m],b="",d="";99===a?(b=":",d=":"):108===a?b=":":114===a&&(d=":");let e=!1===c.alignDelimiters?1:Math.max(1,i[m]-b.length-d.length),g=b+"-".repeat(e)+d;!1!==c.alignDelimiters&&((e=b.length+e+d.length)>i[m]&&(i[m]=e),o[m]=e),n[m]=g}g.splice(1,0,n),h.splice(1,0,o),k=-1;let p=[];for(;++k<g.length;){let a=g[k],b=h[k];m=-1;let d=[];for(;++m<j;){let e=a[m]||"",g="",h="";if(!1!==c.alignDelimiters){let a=i[m]-(b[m]||0),c=f[m];114===c?g=" ".repeat(a):99===c?a%2?(g=" ".repeat(a/2+.5),h=" ".repeat(a/2-.5)):h=g=" ".repeat(a/2):h=" ".repeat(a)}!1===c.delimiterStart||m||d.push("|"),!1!==c.padding&&(!1!==c.alignDelimiters||""!==e)&&(!1!==c.delimiterStart||m)&&d.push(" "),!1!==c.alignDelimiters&&d.push(g),d.push(e),!1!==c.alignDelimiters&&d.push(h),!1!==c.padding&&d.push(" "),(!1!==c.delimiterEnd||m!==j-1)&&d.push("|")}p.push(!1===c.delimiterEnd?d.join("").replace(/ +$/,""):d.join(""))}return p.join("\n")}(a,{align:b,alignDelimiters:d,padding:c,stringLength:e})}function i(a,b,c){let d=a.children,e=-1,f=[],h=b.enter("tableRow");for(;++e<d.length;)f[e]=g(d[e],a,b,c);return h(),f}}(c),{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Y}}]})}},663033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},665466:(a,b,c)=>{"use strict";c.d(b,{E:()=>i,I:()=>j});var d=c(736927),e=c(115962),f=c(437503),g=c(930439),h=c(535798);function i({event:a,expanded:b,onToggle:c,onOpenPerson:e,onOpenCompany:g}){let i=a.start_at?new Date(a.start_at):null,k=a.end_at?new Date(a.end_at):null,l=i?k?`${o(i)} – ${o(k)}`:o(i):"",m=(a.attendees??[]).slice(0,5),p=(a.attendees?.length??0)-m.length;return(0,d.jsxs)("li",{className:"overflow-hidden",style:{background:b?"var(--color-surface-hover)":"transparent",transition:"background 120ms ease"},children:[(0,d.jsxs)("div",{role:"button",tabIndex:0,"aria-expanded":b,onClick:c,onKeyDown:a=>{a.target===a.currentTarget&&("Enter"===a.key||" "===a.key)&&(a.preventDefault(),c())},className:"group/event w-full flex items-center gap-3 px-3 py-2 text-left cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-accent)] transition-colors",onMouseEnter:a=>{b||(a.currentTarget.style.background="var(--color-surface-hover)")},onMouseLeave:a=>{b||(a.currentTarget.style.background="transparent")},children:[(0,d.jsx)("div",{className:"text-[12px] tabular-nums shrink-0 whitespace-nowrap",style:{color:"var(--color-text-muted)",width:"11rem"},children:l||(a.start_at?(0,h.wI)(a.start_at):"")}),(0,d.jsxs)("div",{className:"flex-1 min-w-0 flex items-center gap-2",children:[(0,d.jsx)("p",{className:"truncate text-[13.5px]",style:{color:"var(--color-text)",fontWeight:500},children:a.title?.trim()||"(no title)"}),a.meeting_type&&(0,d.jsx)("span",{className:"shrink-0 rounded-full px-1.5 py-0 text-[10px] uppercase tracking-[0.06em]",style:{background:"var(--color-surface-hover)",color:"var(--color-text-muted)",fontWeight:600},children:a.meeting_type})]}),(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[m.length>0&&(0,d.jsxs)("div",{className:"flex items-center -space-x-1.5",children:[m.slice(0,4).map(a=>(0,d.jsx)("button",{type:"button",onClick:b=>{b.stopPropagation(),e?.(a.id)},disabled:!e,title:a.name??a.email??void 0,className:"disabled:cursor-default rounded-full",style:{boxShadow:"0 0 0 2px var(--color-background)"},children:(0,d.jsx)(f.X,{src:a.avatar_url,name:a.name,seed:a.email??a.id,size:"sm"})},a.id)),p>0&&(0,d.jsxs)("span",{className:"ml-1 text-[11px] tabular-nums",style:{color:"var(--color-text-muted)"},children:["+",p]})]}),(0,d.jsx)(n,{expanded:b})]})]}),(0,d.jsx)("div",{className:"grid transition-[grid-template-rows] duration-[220ms] ease-out motion-reduce:transition-none",style:{gridTemplateRows:b?"1fr":"0fr"},children:(0,d.jsx)("div",{className:"overflow-hidden",children:b&&(0,d.jsx)(j,{eventId:a.id,fallbackEvent:a,onOpenPerson:e,onOpenCompany:g})})})]})}function j({eventId:a,fallbackEvent:b,onOpenPerson:c,onOpenCompany:f}){var g;let[h,i]=(0,e.useState)(null),[j,n]=(0,e.useState)(!0),[p,q]=(0,e.useState)(null),r=h?.event.start_at??b.start_at?new Date(h?.event.start_at??b.start_at):null,s=h?.event.end_at??b.end_at?new Date(h?.event.end_at??b.end_at):null,t=r?(g=r,new Intl.DateTimeFormat(void 0,{weekday:"long",month:"long",day:"numeric",year:"numeric"}).format(g)):null,u=r?s?`${o(r)} – ${o(s)}`:o(r):null,v=r&&s?function(a,b){let c=b.getTime()-a.getTime();if(c<=0)return"";let d=Math.round(c/6e4);if(d>=1440){let a=Math.round(d/1440);return`${a} day${1===a?"":"s"}`}let e=Math.floor(d/60),f=d%60;return 0===e?`${f} min`:0===f?`${e}h`:`${e}h ${f}m`}(r,s):null,w=h?.organizer??null,x=h?.attendees??b.attendees??[],y=h?.companies??[];return(0,d.jsxs)("div",{className:"border-t px-4 py-4",style:{borderColor:"var(--color-border)",background:"var(--color-background)"},children:[(t||u||v)&&(0,d.jsx)(k,{label:"When",children:(0,d.jsxs)("div",{className:"text-[13px]",style:{color:"var(--color-text)"},children:[t&&(0,d.jsx)("div",{className:"font-medium",children:t}),(u||v)&&(0,d.jsxs)("div",{className:"mt-0.5",style:{color:"var(--color-text-muted)"},children:[u,u&&v&&" \xb7 ",v]})]})}),w&&(0,d.jsx)(k,{label:"Organizer",children:(0,d.jsx)(l,{person:w,onOpenPerson:c})}),x.length>0&&(0,d.jsx)(k,{label:`Attendees \xb7 ${x.length}`,children:(0,d.jsx)("div",{className:"flex flex-col gap-1.5",children:x.map(a=>(0,d.jsx)(l,{person:a,onOpenPerson:c},a.id))})}),y.length>0&&(0,d.jsx)(k,{label:1===y.length?"Company":"Companies",children:(0,d.jsx)("div",{className:"flex flex-col gap-1.5",children:y.map(a=>(0,d.jsx)(m,{company:a,onOpenCompany:f},a.id))})}),j&&!h&&(0,d.jsx)("p",{className:"text-[12px]",style:{color:"var(--color-text-muted)"},children:"Loading meeting details…"}),p&&(0,d.jsxs)("p",{className:"text-[12px]",style:{color:"var(--color-text-muted)"},children:["Couldn’t load meeting details (",p,"). Showing what we have."]}),!j&&!p&&h&&0===x.length&&!w&&0===y.length&&(0,d.jsx)("p",{className:"text-[12px]",style:{color:"var(--color-text-muted)"},children:"No additional details for this meeting."})]})}function k({label:a,children:b}){return(0,d.jsxs)("div",{className:"mb-4 last:mb-0",children:[(0,d.jsx)("h4",{className:"mb-1.5 text-[10px] font-semibold uppercase tracking-[0.16em]",style:{color:"var(--color-text-muted)"},children:a}),b]})}function l({person:a,onOpenPerson:b}){let c=a.name?.trim()||a.email||"Unknown",e=a.name?.trim()&&a.email?a.email:null;return(0,d.jsxs)("button",{type:"button",onClick:()=>b?.(a.id),disabled:!b,className:"flex items-center gap-2.5 rounded-lg px-2 py-1.5 text-left transition-colors disabled:cursor-default",style:{color:"var(--color-text)"},onMouseEnter:a=>{b&&(a.currentTarget.style.background="var(--color-surface-hover)")},onMouseLeave:a=>{a.currentTarget.style.background="transparent"},children:[(0,d.jsx)(f.X,{src:a.avatar_url,name:c,seed:a.email??a.id,size:"sm"}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"truncate text-[13px] font-medium",style:{color:"var(--color-text)"},children:c}),e&&(0,d.jsx)("p",{className:"truncate text-[11px]",style:{color:"var(--color-text-muted)"},children:e})]})]})}function m({company:a,onOpenCompany:b}){let c=a.name?.trim()||a.domain||"Unknown company";return(0,d.jsxs)("button",{type:"button",onClick:()=>b?.(a.id),disabled:!b,className:"flex items-center gap-2.5 rounded-lg px-2 py-1.5 text-left transition-colors disabled:cursor-default",onMouseEnter:a=>{b&&(a.currentTarget.style.background="var(--color-surface-hover)")},onMouseLeave:a=>{a.currentTarget.style.background="transparent"},children:[(0,d.jsx)(g.g,{domain:a.domain,name:a.name,size:"sm"}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"truncate text-[13px] font-medium",style:{color:"var(--color-text)"},children:c}),a.domain&&a.name&&(0,d.jsx)("p",{className:"truncate text-[11px]",style:{color:"var(--color-text-muted)"},children:a.domain})]})]})}function n({expanded:a}){return(0,d.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,className:"motion-reduce:transition-none",style:{color:"var(--color-text-muted)",transform:a?"rotate(180deg)":"rotate(0deg)",transition:"transform 180ms ease"},children:(0,d.jsx)("path",{d:"m6 9 6 6 6-6"})})}function o(a){return new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit"}).format(a)}},669661:(a,b,c)=>{"use strict";c.d(b,{Lz:()=>bR,NZ:()=>br,zF:()=>bu});var d=c(381802),e=c(331480),f=c(731626);let g=function(a){for(var b=0;;b++)if(!(a=a.previousSibling))return b},h=function(a){let b=a.assignedSlot||a.parentNode;return b&&11==b.nodeType?b.host:b},i=null,j=function(a,b,c){let d=i||(i=document.createRange());return d.setEnd(a,null==c?a.nodeValue.length:c),d.setStart(a,b||0),d},k=function(){i=null},l=function(a,b,c,d){return c&&(n(a,b,c,d,-1)||n(a,b,c,d,1))},m=/^(img|br|input|textarea|hr)$/i;function n(a,b,c,d,e){for(var f;;){if(a==c&&b==d)return!0;if(b==(e<0?0:o(a))){let c=a.parentNode;if(!c||1!=c.nodeType||p(a)||m.test(a.nodeName)||"false"==a.contentEditable)return!1;b=g(a)+(e<0?0:1),a=c}else{if(1!=a.nodeType)return!1;let c=a.childNodes[b+(e<0?-1:0)];if(1==c.nodeType&&"false"==c.contentEditable)if(null==(f=c.pmViewDesc)||!f.ignoreForSelection)return!1;else b+=e;else a=c,b=e<0?o(a):0}}}function o(a){return 3==a.nodeType?a.nodeValue.length:a.childNodes.length}function p(a){let b;for(let c=a;c&&!(b=c.pmViewDesc);c=c.parentNode);return b&&b.node&&b.node.isBlock&&(b.dom==a||b.contentDOM==a)}let q=function(a){return a.focusNode&&l(a.focusNode,a.focusOffset,a.anchorNode,a.anchorOffset)};function r(a,b){let c=document.createEvent("Event");return c.initEvent("keydown",!0,!0),c.keyCode=a,c.key=c.code=b,c}let s="undefined"!=typeof navigator?navigator:null,t="undefined"!=typeof document?document:null,u=s&&s.userAgent||"",v=/Edge\/(\d+)/.exec(u),w=/MSIE \d/.exec(u),x=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(u),y=!!(w||x||v),z=w?document.documentMode:x?+x[1]:v?+v[1]:0,A=!y&&/gecko\/(\d+)/i.test(u);A&&(/Firefox\/(\d+)/.exec(u)||[0,0])[1];let B=!y&&/Chrome\/(\d+)/.exec(u),C=!!B,D=B?+B[1]:0,E=!y&&!!s&&/Apple Computer/.test(s.vendor),F=E&&(/Mobile\/\w+/.test(u)||!!s&&s.maxTouchPoints>2),G=F||!!s&&/Mac/.test(s.platform),H=!!s&&/Win/.test(s.platform),I=/Android \d/.test(u),J=!!t&&"webkitFontSmoothing"in t.documentElement.style,K=J?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function L(a,b){return"number"==typeof a?a:a[b]}function M(a,b,c){let d=a.someProp("scrollThreshold")||0,e=a.someProp("scrollMargin")||5,f=a.dom.ownerDocument;for(let g=c||a.dom;g;){if(1!=g.nodeType){g=h(g);continue}let a=g,c=a==f.body,i=c?function(a){let b=a.defaultView&&a.defaultView.visualViewport;return b?{left:0,right:b.width,top:0,bottom:b.height}:{left:0,right:a.documentElement.clientWidth,top:0,bottom:a.documentElement.clientHeight}}(f):function(a){let b=a.getBoundingClientRect(),c=b.width/a.offsetWidth||1,d=b.height/a.offsetHeight||1;return{left:b.left,right:b.left+a.clientWidth*c,top:b.top,bottom:b.top+a.clientHeight*d}}(a),j=0,k=0;if(b.top<i.top+L(d,"top")?k=-(i.top-b.top+L(e,"top")):b.bottom>i.bottom-L(d,"bottom")&&(k=b.bottom-b.top>i.bottom-i.top?b.top+L(e,"top")-i.top:b.bottom-i.bottom+L(e,"bottom")),b.left<i.left+L(d,"left")?j=-(i.left-b.left+L(e,"left")):b.right>i.right-L(d,"right")&&(j=b.right-i.right+L(e,"right")),j||k)if(c)f.defaultView.scrollBy(j,k);else{let c=a.scrollLeft,d=a.scrollTop;k&&(a.scrollTop+=k),j&&(a.scrollLeft+=j);let e=a.scrollLeft-c,f=a.scrollTop-d;b={left:b.left-e,top:b.top-f,right:b.right-e,bottom:b.bottom-f}}let l=c?"fixed":getComputedStyle(g).position;if(/^(fixed|sticky)$/.test(l))break;g="absolute"==l?g.offsetParent:h(g)}}function N(a){let b=[],c=a.ownerDocument;for(let d=a;d&&(b.push({dom:d,top:d.scrollTop,left:d.scrollLeft}),a!=c);d=h(d));return b}function O(a,b){for(let c=0;c<a.length;c++){let{dom:d,top:e,left:f}=a[c];d.scrollTop!=e+b&&(d.scrollTop=e+b),d.scrollLeft!=f&&(d.scrollLeft=f)}}let P=null;function Q(a,b){return a.left>=b.left-1&&a.left<=b.right+1&&a.top>=b.top-1&&a.top<=b.bottom+1}function R(a){return a.top<a.bottom||a.left<a.right}function S(a,b){let c=a.getClientRects();if(c.length){let a=c[b<0?0:c.length-1];if(R(a))return a}return Array.prototype.find.call(c,R)||a.getBoundingClientRect()}let T=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function U(a,b,c){let{node:d,offset:e,atom:f}=a.docView.domFromPos(b,c<0?-1:1),g=J||A;if(3==d.nodeType)if(g&&(T.test(d.nodeValue)||(c<0?!e:e==d.nodeValue.length))){let a=S(j(d,e,e),c);if(A&&e&&/\s/.test(d.nodeValue[e-1])&&e<d.nodeValue.length){let b=S(j(d,e-1,e-1),-1);if(b.top==a.top){let c=S(j(d,e,e+1),-1);if(c.top!=a.top)return V(c,c.left<b.left)}}return a}else{let a=e,b=e,f=c<0?1:-1;return c<0&&!e?(b++,f=-1):c>=0&&e==d.nodeValue.length?(a--,f=1):c<0?a--:b++,V(S(j(d,a,b),f),f<0)}if(!a.state.doc.resolve(b-(f||0)).parent.inlineContent){if(null==f&&e&&(c<0||e==o(d))){let a=d.childNodes[e-1];if(1==a.nodeType)return W(a.getBoundingClientRect(),!1)}if(null==f&&e<o(d)){let a=d.childNodes[e];if(1==a.nodeType)return W(a.getBoundingClientRect(),!0)}return W(d.getBoundingClientRect(),c>=0)}if(null==f&&e&&(c<0||e==o(d))){let a=d.childNodes[e-1],b=3==a.nodeType?j(a,o(a)-!g):1!=a.nodeType||"BR"==a.nodeName&&a.nextSibling?null:a;if(b)return V(S(b,1),!1)}if(null==f&&e<o(d)){let a=d.childNodes[e];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let b=a?3==a.nodeType?j(a,0,+!g):1==a.nodeType?a:null:null;if(b)return V(S(b,-1),!0)}return V(S(3==d.nodeType?j(d):d,-c),c>=0)}function V(a,b){if(0==a.width)return a;let c=b?a.left:a.right;return{top:a.top,bottom:a.bottom,left:c,right:c}}function W(a,b){if(0==a.height)return a;let c=b?a.top:a.bottom;return{top:c,bottom:c,left:a.left,right:a.right}}function X(a,b,c){let d=a.state,e=a.root.activeElement;d!=b&&a.updateState(b),e!=a.dom&&a.focus();try{return c()}finally{d!=b&&a.updateState(d),e!=a.dom&&e&&e.focus()}}let Y=/[\u0590-\u08ac]/,Z=null,_=null,aa=!1;class ab{constructor(a,b,c,d){this.parent=a,this.children=b,this.dom=c,this.contentDOM=d,this.dirty=0,c.pmViewDesc=this}matchesWidget(a){return!1}matchesMark(a){return!1}matchesNode(a,b,c){return!1}matchesHack(a){return!1}parseRule(){return null}stopEvent(a){return!1}get size(){let a=0;for(let b=0;b<this.children.length;b++)a+=this.children[b].size;return a}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let a=0;a<this.children.length;a++)this.children[a].destroy()}posBeforeChild(a){for(let b=0,c=this.posAtStart;;b++){let d=this.children[b];if(d==a)return c;c+=d.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(a,b,c){let d;if(this.contentDOM&&this.contentDOM.contains(1==a.nodeType?a:a.parentNode))if(c<0){let c,d;if(a==this.contentDOM)c=a.childNodes[b-1];else{for(;a.parentNode!=this.contentDOM;)a=a.parentNode;c=a.previousSibling}for(;c&&!((d=c.pmViewDesc)&&d.parent==this);)c=c.previousSibling;return c?this.posBeforeChild(d)+d.size:this.posAtStart}else{let c,d;if(a==this.contentDOM)c=a.childNodes[b];else{for(;a.parentNode!=this.contentDOM;)a=a.parentNode;c=a.nextSibling}for(;c&&!((d=c.pmViewDesc)&&d.parent==this);)c=c.nextSibling;return c?this.posBeforeChild(d):this.posAtEnd}if(a==this.dom&&this.contentDOM)d=b>g(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))d=2&a.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==b)for(let b=a;;b=b.parentNode){if(b==this.dom){d=!1;break}if(b.previousSibling)break}if(null==d&&b==a.childNodes.length)for(let b=a;;b=b.parentNode){if(b==this.dom){d=!0;break}if(b.nextSibling)break}}return(null==d?c>0:d)?this.posAtEnd:this.posAtStart}nearestDesc(a,b=!1){for(let c=!0,d=a;d;d=d.parentNode){let e=this.getDesc(d),f;if(e&&(!b||e.node))if(!c||!(f=e.nodeDOM)||(1==f.nodeType?f.contains(1==a.nodeType?a:a.parentNode):f==a))return e;else c=!1}}getDesc(a){let b=a.pmViewDesc;for(let a=b;a;a=a.parent)if(a==this)return b}posFromDOM(a,b,c){for(let d=a;d;d=d.parentNode){let e=this.getDesc(d);if(e)return e.localPosFromDOM(a,b,c)}return -1}descAt(a){for(let b=0,c=0;b<this.children.length;b++){let d=this.children[b],e=c+d.size;if(c==a&&e!=c){for(;!d.border&&d.children.length;)for(let a=0;a<d.children.length;a++){let b=d.children[a];if(b.size){d=b;break}}return d}if(a<e)return d.descAt(a-c-d.border);c=e}}domFromPos(a,b){if(!this.contentDOM)return{node:this.dom,offset:0,atom:a+1};let c=0,d=0;for(let b=0;c<this.children.length;c++){let e=this.children[c],f=b+e.size;if(f>a||e instanceof ai){d=a-b;break}b=f}if(d)return this.children[c].domFromPos(d-this.children[c].border,b);for(let a;c&&!(a=this.children[c-1]).size&&a instanceof ac&&a.side>=0;c--);if(b<=0){let a,d=!0;for(;(a=c?this.children[c-1]:null)&&a.dom.parentNode!=this.contentDOM;c--,d=!1);return a&&b&&d&&!a.border&&!a.domAtom?a.domFromPos(a.size,b):{node:this.contentDOM,offset:a?g(a.dom)+1:0}}{let a,d=!0;for(;(a=c<this.children.length?this.children[c]:null)&&a.dom.parentNode!=this.contentDOM;c++,d=!1);return a&&d&&!a.border&&!a.domAtom?a.domFromPos(0,b):{node:this.contentDOM,offset:a?g(a.dom):this.contentDOM.childNodes.length}}}parseRange(a,b,c=0){if(0==this.children.length)return{node:this.contentDOM,from:a,to:b,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let d=-1,e=-1;for(let f=c,h=0;;h++){let c=this.children[h],i=f+c.size;if(-1==d&&a<=i){let e=f+c.border;if(a>=e&&b<=i-c.border&&c.node&&c.contentDOM&&this.contentDOM.contains(c.contentDOM))return c.parseRange(a,b,e);a=f;for(let b=h;b>0;b--){let c=this.children[b-1];if(c.size&&c.dom.parentNode==this.contentDOM&&!c.emptyChildAt(1)){d=g(c.dom)+1;break}a-=c.size}-1==d&&(d=0)}if(d>-1&&(i>b||h==this.children.length-1)){b=i;for(let a=h+1;a<this.children.length;a++){let c=this.children[a];if(c.size&&c.dom.parentNode==this.contentDOM&&!c.emptyChildAt(-1)){e=g(c.dom);break}b+=c.size}-1==e&&(e=this.contentDOM.childNodes.length);break}f=i}return{node:this.contentDOM,from:a,to:b,fromOffset:d,toOffset:e}}emptyChildAt(a){if(this.border||!this.contentDOM||!this.children.length)return!1;let b=this.children[a<0?0:this.children.length-1];return 0==b.size||b.emptyChildAt(a)}domAfterPos(a){let{node:b,offset:c}=this.domFromPos(a,0);if(1!=b.nodeType||c==b.childNodes.length)throw RangeError("No node after pos "+a);return b.childNodes[c]}setSelection(a,b,c,d=!1){let e=Math.min(a,b),f=Math.max(a,b);for(let g=0,h=0;g<this.children.length;g++){let i=this.children[g],j=h+i.size;if(e>h&&f<j)return i.setSelection(a-h-i.border,b-h-i.border,c,d);h=j}let h=this.domFromPos(a,a?-1:1),i=b==a?h:this.domFromPos(b,b?-1:1),j=c.root.getSelection(),k=c.domSelectionRange(),m=!1;if((A||E)&&a==b){let{node:a,offset:b}=h;if(3==a.nodeType){if((m=!!(b&&"\n"==a.nodeValue[b-1]))&&b==a.nodeValue.length)for(let b=a,c;b;b=b.parentNode){if(c=b.nextSibling){"BR"==c.nodeName&&(h=i={node:c.parentNode,offset:g(c)+1});break}let a=b.pmViewDesc;if(a&&a.node&&a.node.isBlock)break}}else{let c=a.childNodes[b-1];m=c&&("BR"==c.nodeName||"false"==c.contentEditable)}}if(A&&k.focusNode&&k.focusNode!=i.node&&1==k.focusNode.nodeType){let a=k.focusNode.childNodes[k.focusOffset];a&&"false"==a.contentEditable&&(d=!0)}if(!(d||m&&E)&&l(h.node,h.offset,k.anchorNode,k.anchorOffset)&&l(i.node,i.offset,k.focusNode,k.focusOffset))return;let n=!1;if((j.extend||a==b)&&!(m&&A)){j.collapse(h.node,h.offset);try{a!=b&&j.extend(i.node,i.offset),n=!0}catch(a){}}if(!n){if(a>b){let a=h;h=i,i=a}let c=document.createRange();c.setEnd(i.node,i.offset),c.setStart(h.node,h.offset),j.removeAllRanges(),j.addRange(c)}}ignoreMutation(a){return!this.contentDOM&&"selection"!=a.type}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(a,b){for(let c=0,d=0;d<this.children.length;d++){let e=this.children[d],f=c+e.size;if(c==f?a<=f&&b>=c:a<f&&b>c){let d=c+e.border,g=f-e.border;if(a>=d&&b<=g){this.dirty=a==c||b==f?2:1,a==d&&b==g&&(e.contentLost||e.dom.parentNode!=this.contentDOM)?e.dirty=3:e.markDirty(a-d,b-d);return}e.dirty=e.dom!=e.contentDOM||e.dom.parentNode!=this.contentDOM||e.children.length?3:2}c=f}this.dirty=2}markParentsDirty(){let a=1;for(let b=this.parent;b;b=b.parent,a++){let c=1==a?2:1;b.dirty<c&&(b.dirty=c)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(a){return!1}}class ac extends ab{constructor(a,b,c,d){let e,f=b.type.toDOM;if("function"==typeof f&&(f=f(c,()=>e?e.parent?e.parent.posBeforeChild(e):void 0:d)),!b.type.spec.raw){if(1!=f.nodeType){let a=document.createElement("span");a.appendChild(f),f=a}f.contentEditable="false",f.classList.add("ProseMirror-widget")}super(a,[],f,null),this.widget=b,this.widget=b,e=this}matchesWidget(a){return 0==this.dirty&&a.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(a){let b=this.widget.spec.stopEvent;return!!b&&b(a)}ignoreMutation(a){return"selection"!=a.type||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class ad extends ab{constructor(a,b,c,d){super(a,[],b,null),this.textDOM=c,this.text=d}get size(){return this.text.length}localPosFromDOM(a,b){return a!=this.textDOM?this.posAtStart+(b?this.size:0):this.posAtStart+b}domFromPos(a){return{node:this.textDOM,offset:a}}ignoreMutation(a){return"characterData"===a.type&&a.target.nodeValue==a.oldValue}}class ae extends ab{constructor(a,b,c,d,e){super(a,[],c,d),this.mark=b,this.spec=e}static create(a,b,c,d){let f=d.nodeViews[b.type.name],g=f&&f(b,d,c);return g&&g.dom||(g=e.ZF.renderSpec(document,b.type.spec.toDOM(b,c),null,b.attrs)),new ae(a,b,g.dom,g.contentDOM||g.dom,g)}parseRule(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(a){return 3!=this.dirty&&this.mark.eq(a)}markDirty(a,b){if(super.markDirty(a,b),0!=this.dirty){let a=this.parent;for(;!a.node;)a=a.parent;a.dirty<this.dirty&&(a.dirty=this.dirty),this.dirty=0}}slice(a,b,c){let d=ae.create(this.parent,this.mark,!0,c),e=this.children,f=this.size;b<f&&(e=at(e,b,f,c)),a>0&&(e=at(e,0,a,c));for(let a=0;a<e.length;a++)e[a].parent=d;return d.children=e,d}ignoreMutation(a){return this.spec.ignoreMutation?this.spec.ignoreMutation(a):super.ignoreMutation(a)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class af extends ab{constructor(a,b,c,d,e,f,g,h,i){super(a,[],e,f),this.node=b,this.outerDeco=c,this.innerDeco=d,this.nodeDOM=g}static create(a,b,c,d,f,g){let h=f.nodeViews[b.type.name],i,j=h&&h(b,f,()=>i?i.parent?i.parent.posBeforeChild(i):void 0:g,c,d),k=j&&j.dom,l=j&&j.contentDOM;if(b.isText)if(k){if(3!=k.nodeType)throw RangeError("Text must be rendered as a DOM text node")}else k=document.createTextNode(b.text);else if(!k){let a=e.ZF.renderSpec(document,b.type.spec.toDOM(b),null,b.attrs);({dom:k,contentDOM:l}=a)}l||b.isText||"BR"==k.nodeName||(k.hasAttribute("contenteditable")||(k.contentEditable="false"),b.type.spec.draggable&&(k.draggable=!0));let m=k;return(k=ao(k,c,b),j)?i=new aj(a,b,c,d,k,l||null,m,j,f,g+1):b.isText?new ah(a,b,c,d,k,m,f):new af(a,b,c,d,k,l||null,m,f,g+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let a={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(a.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(let b=this.children.length-1;b>=0;b--){let c=this.children[b];if(this.dom.contains(c.dom.parentNode)){a.contentElement=c.dom.parentNode;break}}a.contentElement||(a.getContent=()=>e.FK.empty)}else a.contentElement=this.contentDOM;else a.getContent=()=>this.node.content;return a}matchesNode(a,b,c){return 0==this.dirty&&a.eq(this.node)&&ap(b,this.outerDeco)&&c.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return+!this.node.isLeaf}updateChildren(a,b){let c=this.node.inlineContent,d=b,f=a.composing?this.localCompositionInfo(a,b):null,g=f&&f.pos>-1?f:null,h=f&&f.pos<0,i=new ar(this,g&&g.node,a);(function(a,b,c,d){let e=b.locals(a),f=0;if(0==e.length){for(let c=0;c<a.childCount;c++){let g=a.child(c);d(g,e,b.forChild(f,g),c),f+=g.nodeSize}return}let g=0,h=[],i=null;for(let j=0;;){let k,l,m,n;for(;g<e.length&&e[g].to==f;){let a=e[g++];a.widget&&(k?(l||(l=[k])).push(a):k=a)}if(k)if(l){l.sort(as);for(let a=0;a<l.length;a++)c(l[a],j,!!i)}else c(k,j,!!i);if(i)n=-1,m=i,i=null;else if(j<a.childCount)n=j,m=a.child(j++);else break;for(let a=0;a<h.length;a++)h[a].to<=f&&h.splice(a--,1);for(;g<e.length&&e[g].from<=f&&e[g].to>f;)h.push(e[g++]);let o=f+m.nodeSize;if(m.isText){let a=o;g<e.length&&e[g].from<a&&(a=e[g].from);for(let b=0;b<h.length;b++)h[b].to<a&&(a=h[b].to);a<o&&(i=m.cut(a-f),m=m.cut(0,a-f),o=a,n=-1)}else for(;g<e.length&&e[g].to<o;)g++;let p=m.isInline&&!m.isLeaf?h.filter(a=>!a.inline):h.slice();d(m,p,b.forChild(f,m),n),f=o}})(this.node,this.innerDeco,(b,f,g)=>{b.spec.marks?i.syncToMarks(b.spec.marks,c,a,f):b.type.side>=0&&!g&&i.syncToMarks(f==this.node.childCount?e.CU.none:this.node.child(f).marks,c,a,f),i.placeWidget(b,a,d)},(b,e,g,j)=>{let k;i.syncToMarks(b.marks,c,a,j),i.findNodeMatch(b,e,g,j)||h&&a.state.selection.from>d&&a.state.selection.to<d+b.nodeSize&&(k=i.findIndexWithChild(f.node))>-1&&i.updateNodeAt(b,e,g,k,a)||i.updateNextNode(b,e,g,a,j,d)||i.addNode(b,e,g,a,d),d+=b.nodeSize}),i.syncToMarks([],c,a,0),this.node.isTextblock&&i.addTextblockHacks(),i.destroyRest(),(i.changed||2==this.dirty)&&(g&&this.protectLocalComposition(a,g),function a(b,c,d){let e=b.firstChild,f=!1;for(let g=0;g<c.length;g++){let h=c[g],i=h.dom;if(i.parentNode==b){for(;i!=e;)e=aq(e),f=!0;e=e.nextSibling}else f=!0,b.insertBefore(i,e);if(h instanceof ae){let c=e?e.previousSibling:b.lastChild;a(h.contentDOM,h.children,d),e=c?c.nextSibling:b.firstChild}}for(;e;)e=aq(e),f=!0;f&&d.trackWrites==b&&(d.trackWrites=null)}(this.contentDOM,this.children,a),F&&function(a){if("UL"==a.nodeName||"OL"==a.nodeName){let b=a.style.cssText;a.style.cssText=b+"; list-style: square !important",window.getComputedStyle(a).listStyle,a.style.cssText=b}}(this.dom))}localCompositionInfo(a,b){let{from:c,to:e}=a.state.selection;if(!(a.state.selection instanceof d.U3)||c<b||e>b+this.node.content.size)return null;let f=a.input.compositionNode;if(!f||!this.dom.contains(f.parentNode))return null;if(!this.node.inlineContent)return{node:f,pos:-1,text:""};{let a=f.nodeValue,d=function(a,b,c,d){for(let e=0,f=0;e<a.childCount&&f<=d;){let g=a.child(e++),h=f;if(f+=g.nodeSize,!g.isText)continue;let i=g.text;for(;e<a.childCount;){let b=a.child(e++);if(f+=b.nodeSize,!b.isText)break;i+=b.text}if(f>=c){if(f>=d&&i.slice(d-b.length-h,d-h)==b)return d-b.length;let a=h<d?i.lastIndexOf(b,d-h-1):-1;if(a>=0&&a+b.length+h>=c)return h+a;if(c==d&&i.length>=d+b.length-h&&i.slice(d-h,d-h+b.length)==b)return d}}return -1}(this.node.content,a,c-b,e-b);return d<0?null:{node:f,pos:d,text:a}}}protectLocalComposition(a,{node:b,pos:c,text:d}){if(this.getDesc(b))return;let e=b;for(;e.parentNode!=this.contentDOM;e=e.parentNode){for(;e.previousSibling;)e.parentNode.removeChild(e.previousSibling);for(;e.nextSibling;)e.parentNode.removeChild(e.nextSibling);e.pmViewDesc&&(e.pmViewDesc=void 0)}let f=new ad(this,e,b,d);a.input.compositionNodes.push(f),this.children=at(this.children,c,c+d.length,a,f)}update(a,b,c,d){return 3!=this.dirty&&!!a.sameMarkup(this.node)&&(this.updateInner(a,b,c,d),!0)}updateInner(a,b,c,d){this.updateOuterDeco(b),this.node=a,this.innerDeco=c,this.contentDOM&&this.updateChildren(d,this.posAtStart),this.dirty=0}updateOuterDeco(a){if(ap(a,this.outerDeco))return;let b=1!=this.nodeDOM.nodeType,c=this.dom;this.dom=an(this.dom,this.nodeDOM,am(this.outerDeco,this.node,b),am(a,this.node,b)),this.dom!=c&&(c.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=a}selectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function ag(a,b,c,d,e){ao(d,b,a);let f=new af(void 0,a,b,c,d,d,d,e,0);return f.contentDOM&&f.updateChildren(e,0),f}class ah extends af{constructor(a,b,c,d,e,f,g){super(a,b,c,d,e,null,f,g,0)}parseRule(){let a=this.nodeDOM.parentNode;for(;a&&a!=this.dom&&!a.pmIsDeco;)a=a.parentNode;return{skip:a||!0}}update(a,b,c,d){return 3!=this.dirty&&(0==this.dirty||!!this.inParent())&&!!a.sameMarkup(this.node)&&(this.updateOuterDeco(b),(0!=this.dirty||a.text!=this.node.text)&&a.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=a.text,d.trackWrites==this.nodeDOM&&(d.trackWrites=null)),this.node=a,this.dirty=0,!0)}inParent(){let a=this.parent.contentDOM;for(let b=this.nodeDOM;b;b=b.parentNode)if(b==a)return!0;return!1}domFromPos(a){return{node:this.nodeDOM,offset:a}}localPosFromDOM(a,b,c){return a==this.nodeDOM?this.posAtStart+Math.min(b,this.node.text.length):super.localPosFromDOM(a,b,c)}ignoreMutation(a){return"characterData"!=a.type&&"selection"!=a.type}slice(a,b,c){let d=this.node.cut(a,b),e=document.createTextNode(d.text);return new ah(this.parent,d,this.outerDeco,this.innerDeco,e,e,c)}markDirty(a,b){super.markDirty(a,b),this.dom!=this.nodeDOM&&(0==a||b==this.nodeDOM.nodeValue.length)&&(this.dirty=3)}get domAtom(){return!1}isText(a){return this.node.text==a}}class ai extends ab{parseRule(){return{ignore:!0}}matchesHack(a){return 0==this.dirty&&this.dom.nodeName==a}get domAtom(){return!0}get ignoreForCoords(){return"IMG"==this.dom.nodeName}}class aj extends af{constructor(a,b,c,d,e,f,g,h,i,j){super(a,b,c,d,e,f,g,i,j),this.spec=h}update(a,b,c,d){if(3==this.dirty)return!1;if(this.spec.update&&(this.node.type==a.type||this.spec.multiType)){let e=this.spec.update(a,b,c);return e&&this.updateInner(a,b,c,d),e}return(!!this.contentDOM||!!a.isLeaf)&&super.update(a,b,c,d)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(a,b,c,d){this.spec.setSelection?this.spec.setSelection(a,b,c.root):super.setSelection(a,b,c,d)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(a){return!!this.spec.stopEvent&&this.spec.stopEvent(a)}ignoreMutation(a){return this.spec.ignoreMutation?this.spec.ignoreMutation(a):super.ignoreMutation(a)}}let ak=function(a){a&&(this.nodeName=a)};ak.prototype=Object.create(null);let al=[new ak];function am(a,b,c){if(0==a.length)return al;let d=c?al[0]:new ak,e=[d];for(let f=0;f<a.length;f++){let g=a[f].type.attrs;if(g)for(let a in g.nodeName&&e.push(d=new ak(g.nodeName)),g){let f=g[a];null!=f&&(c&&1==e.length&&e.push(d=new ak(b.isInline?"span":"div")),"class"==a?d.class=(d.class?d.class+" ":"")+f:"style"==a?d.style=(d.style?d.style+";":"")+f:"nodeName"!=a&&(d[a]=f))}}return e}function an(a,b,c,d){if(c==al&&d==al)return b;let e=b;for(let b=0;b<d.length;b++){let f=d[b],g=c[b];if(b){let b;g&&g.nodeName==f.nodeName&&e!=a&&(b=e.parentNode)&&b.nodeName.toLowerCase()==f.nodeName||((b=document.createElement(f.nodeName)).pmIsDeco=!0,b.appendChild(e),g=al[0]),e=b}!function(a,b,c){for(let d in b)"class"==d||"style"==d||"nodeName"==d||d in c||a.removeAttribute(d);for(let d in c)"class"!=d&&"style"!=d&&"nodeName"!=d&&c[d]!=b[d]&&a.setAttribute(d,c[d]);if(b.class!=c.class){let d=b.class?b.class.split(" ").filter(Boolean):[],e=c.class?c.class.split(" ").filter(Boolean):[];for(let b=0;b<d.length;b++)-1==e.indexOf(d[b])&&a.classList.remove(d[b]);for(let b=0;b<e.length;b++)-1==d.indexOf(e[b])&&a.classList.add(e[b]);0==a.classList.length&&a.removeAttribute("class")}if(b.style!=c.style){if(b.style){let c=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,d;for(;d=c.exec(b.style);)a.style.removeProperty(d[1])}c.style&&(a.style.cssText+=c.style)}}(e,g||al[0],f)}return e}function ao(a,b,c){return an(a,a,al,am(b,c,1!=a.nodeType))}function ap(a,b){if(a.length!=b.length)return!1;for(let c=0;c<a.length;c++)if(!a[c].type.eq(b[c].type))return!1;return!0}function aq(a){let b=a.nextSibling;return a.parentNode.removeChild(a),b}class ar{constructor(a,b,c){this.lock=b,this.view=c,this.index=0,this.stack=[],this.changed=!1,this.top=a,this.preMatch=function(a,b){let c=b,d=c.children.length,e=a.childCount,f=new Map,g=[];a:for(;e>0;){let h;for(;;)if(d){let a=c.children[d-1];if(a instanceof ae)c=a,d=a.children.length;else{h=a,d--;break}}else if(c==b)break a;else d=c.parent.children.indexOf(c),c=c.parent;let i=h.node;if(i){if(i!=a.child(e-1))break;--e,f.set(h,e),g.push(h)}}return{index:e,matched:f,matches:g.reverse()}}(a.node.content,a)}destroyBetween(a,b){if(a!=b){for(let c=a;c<b;c++)this.top.children[c].destroy();this.top.children.splice(a,b-a),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(a,b,c,d){let e=0,f=this.stack.length>>1,g=Math.min(f,a.length);for(;e<g&&(e==f-1?this.top:this.stack[e+1<<1]).matchesMark(a[e])&&!1!==a[e].type.spec.spanning;)e++;for(;e<f;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),f--;for(;f<a.length;){this.stack.push(this.top,this.index+1);let e=-1,g=this.top.children.length;d<this.preMatch.index&&(g=Math.min(this.index+3,g));for(let b=this.index;b<g;b++){let c=this.top.children[b];if(c.matchesMark(a[f])&&!this.isLocked(c.dom)){e=b;break}}if(e>-1)e>this.index&&(this.changed=!0,this.destroyBetween(this.index,e)),this.top=this.top.children[this.index];else{let d=ae.create(this.top,a[f],b,c);this.top.children.splice(this.index,0,d),this.top=d,this.changed=!0}this.index=0,f++}}findNodeMatch(a,b,c,d){let e=-1,f;if(d>=this.preMatch.index&&(f=this.preMatch.matches[d-this.preMatch.index]).parent==this.top&&f.matchesNode(a,b,c))e=this.top.children.indexOf(f,this.index);else for(let d=this.index,f=Math.min(this.top.children.length,d+5);d<f;d++){let f=this.top.children[d];if(f.matchesNode(a,b,c)&&!this.preMatch.matched.has(f)){e=d;break}}return!(e<0)&&(this.destroyBetween(this.index,e),this.index++,!0)}updateNodeAt(a,b,c,d,e){let f=this.top.children[d];return 3==f.dirty&&f.dom==f.contentDOM&&(f.dirty=2),!!f.update(a,b,c,e)&&(this.destroyBetween(this.index,d),this.index++,!0)}findIndexWithChild(a){for(;;){let b=a.parentNode;if(!b)return -1;if(b==this.top.contentDOM){let b=a.pmViewDesc;if(b){for(let a=this.index;a<this.top.children.length;a++)if(this.top.children[a]==b)return a}return -1}a=b}}updateNextNode(a,b,c,d,e,f){for(let g=this.index;g<this.top.children.length;g++){let h=this.top.children[g];if(h instanceof af){let i=this.preMatch.matched.get(h);if(null!=i&&i!=e)return!1;let j=h.dom,k,l=this.isLocked(j)&&!(a.isText&&h.node&&h.node.isText&&h.nodeDOM.nodeValue==a.text&&3!=h.dirty&&ap(b,h.outerDeco));if(!l&&h.update(a,b,c,d))return this.destroyBetween(this.index,g),h.dom!=j&&(this.changed=!0),this.index++,!0;if(!l&&(k=this.recreateWrapper(h,a,b,c,d,f)))return this.destroyBetween(this.index,g),this.top.children[this.index]=k,k.contentDOM&&(k.dirty=2,k.updateChildren(d,f+1),k.dirty=0),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(a,b,c,d,e,f){if(a.dirty||b.isAtom||!a.children.length||!a.node.content.eq(b.content)||!ap(c,a.outerDeco)||!d.eq(a.innerDeco))return null;let g=af.create(this.top,b,c,d,e,f);if(g.contentDOM)for(let b of(g.children=a.children,a.children=[],g.children))b.parent=g;return a.destroy(),g}addNode(a,b,c,d,e){let f=af.create(this.top,a,b,c,d,e);f.contentDOM&&f.updateChildren(d,e+1),this.top.children.splice(this.index++,0,f),this.changed=!0}placeWidget(a,b,c){let d=this.index<this.top.children.length?this.top.children[this.index]:null;if(d&&d.matchesWidget(a)&&(a==d.widget||!d.widget.type.toDOM.parentNode))this.index++;else{let d=new ac(this.top,a,b,c);this.top.children.splice(this.index++,0,d),this.changed=!0}}addTextblockHacks(){let a=this.top.children[this.index-1],b=this.top;for(;a instanceof ae;)a=(b=a).children[b.children.length-1];(!a||!(a instanceof ah)||/\n$/.test(a.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(a.node.text))&&((E||C)&&a&&"false"==a.dom.contentEditable&&this.addHackNode("IMG",b),this.addHackNode("BR",this.top))}addHackNode(a,b){if(b==this.top&&this.index<b.children.length&&b.children[this.index].matchesHack(a))this.index++;else{let c=document.createElement(a);"IMG"==a&&(c.className="ProseMirror-separator",c.alt=""),"BR"==a&&(c.className="ProseMirror-trailingBreak");let d=new ai(this.top,[],c,null);b!=this.top?b.children.push(d):b.children.splice(this.index++,0,d),this.changed=!0}}isLocked(a){return this.lock&&(a==this.lock||1==a.nodeType&&a.contains(this.lock.parentNode))}}function as(a,b){return a.type.side-b.type.side}function at(a,b,c,d,e){let f=[];for(let g=0,h=0;g<a.length;g++){let i=a[g],j=h,k=h+=i.size;j>=c||k<=b?f.push(i):(j<b&&f.push(i.slice(0,b-j,d)),e&&(f.push(e),e=void 0),k>c&&f.push(i.slice(c-j,i.size,d)))}return f}function au(a,b=null){let c=a.domSelectionRange(),e=a.state.doc;if(!c.focusNode)return null;let f=a.docView.nearestDesc(c.focusNode),h=f&&0==f.size,i=a.docView.posFromDOM(c.focusNode,c.focusOffset,1);if(i<0)return null;let j=e.resolve(i),k,l;if(q(c)){for(k=i;f&&!f.node;)f=f.parent;let a=f.node;if(f&&a.isAtom&&d.nh.isSelectable(a)&&f.parent&&!(a.isInline&&function(a,b,c){for(let d=0==b,e=b==o(a);d||e;){if(a==c)return!0;let b=g(a);if(!(a=a.parentNode))return!1;d=d&&0==b,e=e&&b==o(a)}}(c.focusNode,c.focusOffset,f.dom))){let a=f.posBefore;l=new d.nh(i==a?j:e.resolve(a))}}else{if(c instanceof a.dom.ownerDocument.defaultView.Selection&&c.rangeCount>1){let b=i,d=i;for(let e=0;e<c.rangeCount;e++){let f=c.getRangeAt(e);b=Math.min(b,a.docView.posFromDOM(f.startContainer,f.startOffset,1)),d=Math.max(d,a.docView.posFromDOM(f.endContainer,f.endOffset,-1))}if(b<0)return null;[k,i]=d==a.state.selection.anchor?[d,b]:[b,d],j=e.resolve(i)}else k=a.docView.posFromDOM(c.anchorNode,c.anchorOffset,1);if(k<0)return null}let m=e.resolve(k);if(!l){let c="pointer"==b||a.state.selection.head<j.pos&&!h?1:-1;l=aD(a,m,j,c)}return l}function av(a){return a.editable?a.hasFocus():aF(a)&&document.activeElement&&document.activeElement.contains(a.dom)}function aw(a,b=!1){let c=a.state.selection;if(aB(a,c),av(a)){if(!b&&a.input.mouseDown&&a.input.mouseDown.allowDefault&&C){let b=a.domSelectionRange(),c=a.domObserver.currentSelection;if(b.anchorNode&&c.anchorNode&&l(b.anchorNode,b.anchorOffset,c.anchorNode,c.anchorOffset)){a.input.mouseDown.delayedSelectionSync=!0,a.domObserver.setCurSelection();return}}if(a.domObserver.disconnectSelection(),a.cursorWrapper)!function(a){let b=a.domSelection();if(!b)return;let c=a.cursorWrapper.dom,d="IMG"==c.nodeName;d?b.collapse(c.parentNode,g(c)+1):b.collapse(c,0),!d&&!a.state.selection.visible&&y&&z<=11&&(c.disabled=!0,c.disabled=!1)}(a);else{var e;let f,g,h,i,{anchor:j,head:k}=c,l,m;ax&&!(c instanceof d.U3)&&(c.$from.parent.inlineContent||(l=ay(a,c.from)),c.empty||c.$from.parent.inlineContent||(m=ay(a,c.to))),a.docView.setSelection(j,k,a,b),ax&&(l&&aA(l),m&&aA(m)),c.visible?a.dom.classList.remove("ProseMirror-hideselection"):(a.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&((f=(e=a).dom.ownerDocument).removeEventListener("selectionchange",e.input.hideSelectionGuard),h=(g=e.domSelectionRange()).anchorNode,i=g.anchorOffset,f.addEventListener("selectionchange",e.input.hideSelectionGuard=()=>{(g.anchorNode!=h||g.anchorOffset!=i)&&(f.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout(()=>{(!av(e)||e.state.selection.visible)&&e.dom.classList.remove("ProseMirror-hideselection")},20))})))}a.domObserver.setCurSelection(),a.domObserver.connectSelection()}}let ax=E||C&&D<63;function ay(a,b){let{node:c,offset:d}=a.docView.domFromPos(b,0),e=d<c.childNodes.length?c.childNodes[d]:null,f=d?c.childNodes[d-1]:null;if(E&&e&&"false"==e.contentEditable)return az(e);if((!e||"false"==e.contentEditable)&&(!f||"false"==f.contentEditable)){if(e)return az(e);else if(f)return az(f)}}function az(a){return a.contentEditable="true",E&&a.draggable&&(a.draggable=!1,a.wasDraggable=!0),a}function aA(a){a.contentEditable="false",a.wasDraggable&&(a.draggable=!0,a.wasDraggable=null)}function aB(a,b){if(b instanceof d.nh){let c=a.docView.descAt(b.from);c!=a.lastSelectedViewDesc&&(aC(a),c&&c.selectNode(),a.lastSelectedViewDesc=c)}else aC(a)}function aC(a){a.lastSelectedViewDesc&&(a.lastSelectedViewDesc.parent&&a.lastSelectedViewDesc.deselectNode(),a.lastSelectedViewDesc=void 0)}function aD(a,b,c,e){return a.someProp("createSelectionBetween",d=>d(a,b,c))||d.U3.between(b,c,e)}function aE(a){return(!a.editable||!!a.hasFocus())&&aF(a)}function aF(a){let b=a.domSelectionRange();if(!b.anchorNode)return!1;try{return a.dom.contains(3==b.anchorNode.nodeType?b.anchorNode.parentNode:b.anchorNode)&&(a.editable||a.dom.contains(3==b.focusNode.nodeType?b.focusNode.parentNode:b.focusNode))}catch(a){return!1}}function aG(a,b){let{$anchor:c,$head:e}=a.selection,f=b>0?c.max(e):c.min(e),g=f.parent.inlineContent?f.depth?a.doc.resolve(b>0?f.after():f.before()):null:f;return g&&d.LN.findFrom(g,b)}function aH(a,b){return a.dispatch(a.state.tr.setSelection(b).scrollIntoView()),!0}function aI(a,b,c){let e=a.state.selection;if(e instanceof d.U3){if(c.indexOf("s")>-1){let{$head:c}=e,f=c.textOffset?null:b<0?c.nodeBefore:c.nodeAfter;if(!f||f.isText||!f.isLeaf)return!1;let g=a.state.doc.resolve(c.pos+f.nodeSize*(b<0?-1:1));return aH(a,new d.U3(e.$anchor,g))}else if(!e.empty)return!1;else if(a.endOfTextblock(b>0?"forward":"backward")){let c=aG(a.state,b);return!!c&&c instanceof d.nh&&aH(a,c)}else if(!(G&&c.indexOf("m")>-1)){let c=e.$head,f=c.textOffset?null:b<0?c.nodeBefore:c.nodeAfter,g;if(!f||f.isText)return!1;let h=b<0?c.pos-f.nodeSize:c.pos;return!!(f.isAtom||(g=a.docView.descAt(h))&&!g.contentDOM)&&(d.nh.isSelectable(f)?aH(a,new d.nh(b<0?a.state.doc.resolve(c.pos-f.nodeSize):c)):!!J&&aH(a,new d.U3(a.state.doc.resolve(b<0?h:h+f.nodeSize))))}}else{if(e instanceof d.nh&&e.node.isInline)return aH(a,new d.U3(b>0?e.$to:e.$from));let c=aG(a.state,b);return!!c&&aH(a,c)}}function aJ(a){return 3==a.nodeType?a.nodeValue.length:a.childNodes.length}function aK(a,b){let c=a.pmViewDesc;return c&&0==c.size&&(b<0||a.nextSibling||"BR"!=a.nodeName)}function aL(a,b){return b<0?function(a){let b=a.domSelectionRange(),c=b.focusNode,d=b.focusOffset;if(!c)return;let e,f,h=!1;for(A&&1==c.nodeType&&d<aJ(c)&&aK(c.childNodes[d],-1)&&(h=!0);;)if(d>0)if(1!=c.nodeType)break;else{let a=c.childNodes[d-1];if(aK(a,-1))e=c,f=--d;else if(3==a.nodeType)d=(c=a).nodeValue.length;else break}else if(aM(c))break;else{let b=c.previousSibling;for(;b&&aK(b,-1);)e=c.parentNode,f=g(b),b=b.previousSibling;if(b)d=aJ(c=b);else{if((c=c.parentNode)==a.dom)break;d=0}}h?aN(a,c,d):e&&aN(a,e,f)}(a):function(a){let b,c,d=a.domSelectionRange(),e=d.focusNode,f=d.focusOffset;if(!e)return;let h=aJ(e);for(;;)if(f<h){if(1!=e.nodeType)break;if(aK(e.childNodes[f],1))b=e,c=++f;else break}else if(aM(e))break;else{let d=e.nextSibling;for(;d&&aK(d,1);)b=d.parentNode,c=g(d)+1,d=d.nextSibling;if(d)f=0,h=aJ(e=d);else{if((e=e.parentNode)==a.dom)break;f=h=0}}b&&aN(a,b,c)}(a)}function aM(a){let b=a.pmViewDesc;return b&&b.node&&b.node.isBlock}function aN(a,b,c){if(3!=b.nodeType){let a,d;(d=function(a,b){for(;a&&b==a.childNodes.length&&!p(a);)b=g(a)+1,a=a.parentNode;for(;a&&b<a.childNodes.length;){let c=a.childNodes[b];if(3==c.nodeType)return c;if(1==c.nodeType&&"false"==c.contentEditable)break;a=c,b=0}}(b,c))?(b=d,c=0):(a=function(a,b){for(;a&&!b&&!p(a);)b=g(a),a=a.parentNode;for(;a&&b;){let c=a.childNodes[b-1];if(3==c.nodeType)return c;if(1==c.nodeType&&"false"==c.contentEditable)break;b=(a=c).childNodes.length}}(b,c))&&(b=a,c=a.nodeValue.length)}let d=a.domSelection();if(!d)return;if(q(d)){let a=document.createRange();a.setEnd(b,c),a.setStart(b,c),d.removeAllRanges(),d.addRange(a)}else d.extend&&d.extend(b,c);a.domObserver.setCurSelection();let{state:e}=a;setTimeout(()=>{a.state==e&&aw(a)},50)}function aO(a,b){let c=a.state.doc.resolve(b);if(!(C||H)&&c.parent.inlineContent){let d=a.coordsAtPos(b);if(b>c.start()){let c=a.coordsAtPos(b-1),e=(c.top+c.bottom)/2;if(e>d.top&&e<d.bottom&&Math.abs(c.left-d.left)>1)return c.left<d.left?"ltr":"rtl"}if(b<c.end()){let c=a.coordsAtPos(b+1),e=(c.top+c.bottom)/2;if(e>d.top&&e<d.bottom&&Math.abs(c.left-d.left)>1)return c.left>d.left?"ltr":"rtl"}}return"rtl"==getComputedStyle(a.dom).direction?"rtl":"ltr"}function aP(a,b,c){let e=a.state.selection;if(e instanceof d.U3&&!e.empty||c.indexOf("s")>-1||G&&c.indexOf("m")>-1)return!1;let{$from:f,$to:g}=e;if(!f.parent.inlineContent||a.endOfTextblock(b<0?"up":"down")){let c=aG(a.state,b);if(c&&c instanceof d.nh)return aH(a,c)}if(!f.parent.inlineContent){let c=b<0?f:g,h=e instanceof d.i5?d.LN.near(c,b):d.LN.findFrom(c,b);return!!h&&aH(a,h)}return!1}function aQ(a,b){if(!(a.state.selection instanceof d.U3))return!0;let{$head:c,$anchor:e,empty:f}=a.state.selection;if(!c.sameParent(e))return!0;if(!f)return!1;if(a.endOfTextblock(b>0?"forward":"backward"))return!0;let g=!c.textOffset&&(b<0?c.nodeBefore:c.nodeAfter);if(g&&!g.isText){let d=a.state.tr;return b<0?d.delete(c.pos-g.nodeSize,c.pos):d.delete(c.pos,c.pos+g.nodeSize),a.dispatch(d),!0}return!1}function aR(a,b,c){a.domObserver.stop(),b.contentEditable=c,a.domObserver.start()}function aS(a,b){a.someProp("transformCopied",c=>{b=c(b,a)});let c=[],{content:d,openStart:f,openEnd:g}=b;for(;f>1&&g>1&&1==d.childCount&&1==d.firstChild.childCount;){f--,g--;let a=d.firstChild;c.push(a.type.name,a.attrs!=a.type.defaultAttrs?a.attrs:null),d=a.content}let h=a.someProp("clipboardSerializer")||e.ZF.fromSchema(a.state.schema),i=a$(),j=i.createElement("div");j.appendChild(h.serializeFragment(d,{document:i}));let k=j.firstChild,l,m=0;for(;k&&1==k.nodeType&&(l=aY[k.nodeName.toLowerCase()]);){for(let a=l.length-1;a>=0;a--){let b=i.createElement(l[a]);for(;j.firstChild;)b.appendChild(j.firstChild);j.appendChild(b),m++}k=j.firstChild}return k&&1==k.nodeType&&k.setAttribute("data-pm-slice",`${f} ${g}${m?` -${m}`:""} ${JSON.stringify(c)}`),{dom:j,text:a.someProp("clipboardTextSerializer",c=>c(b,a))||b.content.textBetween(0,b.content.size,"\n\n"),slice:b}}function aT(a,b,c,d,f){let g,h,i=f.parent.type.spec.code;if(!c&&!b)return null;let j=!!b&&(d||i||!c);if(j){if(a.someProp("transformPastedText",c=>{b=c(b,i||d,a)}),i)return h=new e.Ji(e.FK.from(a.state.schema.text(b.replace(/\r\n?/g,"\n"))),0,0),a.someProp("transformPasted",b=>{h=b(h,a,!0)}),h;let c=a.someProp("clipboardTextParser",c=>c(b,f,d,a));if(c)h=c;else{let c=f.marks(),{schema:d}=a.state,h=e.ZF.fromSchema(d);g=document.createElement("div"),b.split(/(?:\r\n?|\n)+/).forEach(a=>{let b=g.appendChild(document.createElement("p"));a&&b.appendChild(h.serializeNode(d.text(a,c)))})}}else a.someProp("transformPastedHTML",b=>{c=b(c,a)}),g=function(a){var b;let c,d=/^(\s*<meta [^>]*>)*/.exec(a);d&&(a=a.slice(d[0].length));let e=a$().createElement("div"),f=/<([a-z][^>\s]+)/i.exec(a),g;if((g=f&&aY[f[1].toLowerCase()])&&(a=g.map(a=>"<"+a+">").join("")+a+g.map(a=>"</"+a+">").reverse().join("")),e.innerHTML=(b=a,(c=window.trustedTypes)?(a_||(a_=c.defaultPolicy||c.createPolicy("ProseMirrorClipboard",{createHTML:a=>a})),a_.createHTML(b)):b),g)for(let a=0;a<g.length;a++)e=e.querySelector(g[a])||e;return e}(c),J&&function(a){let b=a.querySelectorAll(C?"span:not([class]):not([style])":"span.Apple-converted-space");for(let c=0;c<b.length;c++){let d=b[c];1==d.childNodes.length&&"\xa0"==d.textContent&&d.parentNode&&d.parentNode.replaceChild(a.ownerDocument.createTextNode(" "),d)}}(g);let k=g&&g.querySelector("[data-pm-slice]"),l=k&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(k.getAttribute("data-pm-slice")||"");if(l&&l[3])for(let a=+l[3];a>0;a--){let a=g.firstChild;for(;a&&1!=a.nodeType;)a=a.nextSibling;if(!a)break;g=a}if(h||(h=(a.someProp("clipboardParser")||a.someProp("domParser")||e.S4.fromSchema(a.state.schema)).parseSlice(g,{preserveWhitespace:!!(j||l),context:f,ruleFromNode:a=>"BR"!=a.nodeName||a.nextSibling||!a.parentNode||aU.test(a.parentNode.nodeName)?null:{ignore:!0}})),l)h=function(a,b){if(!a.size)return a;let c=a.content.firstChild.type.schema,d;try{d=JSON.parse(b)}catch(b){return a}let{content:f,openStart:g,openEnd:h}=a;for(let a=d.length-2;a>=0;a-=2){let b=c.nodes[d[a]];if(!b||b.hasRequiredAttrs())break;f=e.FK.from(b.create(d[a+1],f)),g++,h++}return new e.Ji(f,g,h)}(aX(h,+l[1],+l[2]),l[4]);else if((h=e.Ji.maxOpen(function(a,b){if(a.childCount<2)return a;for(let c=b.depth;c>=0;c--){let d=b.node(c).contentMatchAt(b.index(c)),f,g=[];if(a.forEach(a=>{if(!g)return;let b=d.findWrapping(a.type),c;if(!b)return g=null;if(c=g.length&&f.length&&function a(b,c,d,f,g){if(g<b.length&&g<c.length&&b[g]==c[g]){let h=a(b,c,d,f.lastChild,g+1);if(h)return f.copy(f.content.replaceChild(f.childCount-1,h));if(f.contentMatchAt(f.childCount).matchType(g==b.length-1?d.type:b[g+1]))return f.copy(f.content.append(e.FK.from(aV(d,b,g+1))))}}(b,f,a,g[g.length-1],0))g[g.length-1]=c;else{g.length&&(g[g.length-1]=function a(b,c){if(0==c)return b;let d=b.content.replaceChild(b.childCount-1,a(b.lastChild,c-1)),f=b.contentMatchAt(b.childCount).fillBefore(e.FK.empty,!0);return b.copy(d.append(f))}(g[g.length-1],f.length));let c=aV(a,b);g.push(c),d=d.matchType(c.type),f=b}}),g)return e.FK.from(g)}return a}(h.content,f),!0)).openStart||h.openEnd){let a=0,b=0;for(let b=h.content.firstChild;a<h.openStart&&!b.type.spec.isolating;a++,b=b.firstChild);for(let a=h.content.lastChild;b<h.openEnd&&!a.type.spec.isolating;b++,a=a.lastChild);h=aX(h,a,b)}return a.someProp("transformPasted",b=>{h=b(h,a,j)}),h}let aU=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function aV(a,b,c=0){for(let d=b.length-1;d>=c;d--)a=b[d].create(null,e.FK.from(a));return a}function aW(a,b,c,d,f,g){let h=b<0?a.firstChild:a.lastChild,i=h.content;return a.childCount>1&&(g=0),f<d-1&&(i=aW(i,b,c,d,f+1,g)),f>=c&&(i=b<0?h.contentMatchAt(0).fillBefore(i,g<=f).append(i):i.append(h.contentMatchAt(h.childCount).fillBefore(e.FK.empty,!0))),a.replaceChild(b<0?0:a.childCount-1,h.copy(i))}function aX(a,b,c){return b<a.openStart&&(a=new e.Ji(aW(a.content,-1,b,a.openStart,0,a.openEnd),b,a.openEnd)),c<a.openEnd&&(a=new e.Ji(aW(a.content,1,c,a.openEnd,0,0),a.openStart,c)),a}let aY={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]},aZ=null;function a$(){return aZ||(aZ=document.implementation.createHTMLDocument("title"))}let a_=null,a0={},a1={},a2={touchstart:!0,touchmove:!0};class a3{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function a4(a,b){a.input.lastSelectionOrigin=b,a.input.lastSelectionTime=Date.now()}function a5(a){a.someProp("handleDOMEvents",b=>{for(let c in b)a.input.eventHandlers[c]||a.dom.addEventListener(c,a.input.eventHandlers[c]=b=>a6(a,b))})}function a6(a,b){return a.someProp("handleDOMEvents",c=>{let d=c[b.type];return!!d&&(d(a,b)||b.defaultPrevented)})}function a7(a){return{left:a.clientX,top:a.clientY}}function a8(a,b,c,d,e){if(-1==d)return!1;let f=a.state.doc.resolve(d);for(let d=f.depth+1;d>0;d--)if(a.someProp(b,b=>d>f.depth?b(a,c,f.nodeAfter,f.before(d),e,!0):b(a,c,f.node(d),f.before(d),e,!1)))return!0;return!1}function a9(a,b,c){if(a.focused||a.focus(),a.state.selection.eq(b))return;let d=a.state.tr.setSelection(b);"pointer"==c&&d.setMeta("pointer",!0),a.dispatch(d)}a1.keydown=(a,b)=>{if((a.input.shiftKey=16==b.keyCode||b.shiftKey,!bc(a,b))&&(a.input.lastKeyCode=b.keyCode,a.input.lastKeyCodeTime=Date.now(),!I||!C||13!=b.keyCode))if(229!=b.keyCode&&a.domObserver.forceFlush(),!F||13!=b.keyCode||b.ctrlKey||b.altKey||b.metaKey)a.someProp("handleKeyDown",c=>c(a,b))||function(a,b){let c,d=b.keyCode,e=(c="",b.ctrlKey&&(c+="c"),b.metaKey&&(c+="m"),b.altKey&&(c+="a"),b.shiftKey&&(c+="s"),c);if(8==d||G&&72==d&&"c"==e)return aQ(a,-1)||aL(a,-1);if(46==d&&!b.shiftKey||G&&68==d&&"c"==e)return aQ(a,1)||aL(a,1);if(13==d||27==d)return!0;if(37==d||G&&66==d&&"c"==e){let b=37==d?"ltr"==aO(a,a.state.selection.from)?-1:1:-1;return aI(a,b,e)||aL(a,b)}if(39==d||G&&70==d&&"c"==e){let b=39==d?"ltr"==aO(a,a.state.selection.from)?1:-1:1;return aI(a,b,e)||aL(a,b)}else if(38==d||G&&80==d&&"c"==e)return aP(a,-1,e)||aL(a,-1);else if(40==d||G&&78==d&&"c"==e)return function(a){if(!E||a.state.selection.$head.parentOffset>0)return!1;let{focusNode:b,focusOffset:c}=a.domSelectionRange();if(b&&1==b.nodeType&&0==c&&b.firstChild&&"false"==b.firstChild.contentEditable){let c=b.firstChild;aR(a,c,"true"),setTimeout(()=>aR(a,c,"false"),20)}return!1}(a)||aP(a,1,e)||aL(a,1);else if(e==(G?"m":"c")&&(66==d||73==d||89==d||90==d))return!0;return!1}(a,b)?b.preventDefault():a4(a,"key");else{let b=Date.now();a.input.lastIOSEnter=b,a.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{a.input.lastIOSEnter==b&&(a.someProp("handleKeyDown",b=>b(a,r(13,"Enter"))),a.input.lastIOSEnter=0)},200)}},a1.keyup=(a,b)=>{16==b.keyCode&&(a.input.shiftKey=!1)},a1.keypress=(a,b)=>{if(bc(a,b)||!b.charCode||b.ctrlKey&&!b.altKey||G&&b.metaKey)return;if(a.someProp("handleKeyPress",c=>c(a,b)))return void b.preventDefault();let c=a.state.selection;if(!(c instanceof d.U3)||!c.$from.sameParent(c.$to)){let d=String.fromCharCode(b.charCode),e=()=>a.state.tr.insertText(d).scrollIntoView();/[\r\n]/.test(d)||a.someProp("handleTextInput",b=>b(a,c.$from.pos,c.$to.pos,d,e))||a.dispatch(e()),b.preventDefault()}};let ba=G?"metaKey":"ctrlKey";a0.mousedown=(a,b)=>{a.input.shiftKey=b.shiftKey;let c=bg(a),e=Date.now(),f="singleClick";e-a.input.lastClick.time<500&&function(a,b){let c=b.x-a.clientX,d=b.y-a.clientY;return c*c+d*d<100}(b,a.input.lastClick)&&!b[ba]&&a.input.lastClick.button==b.button&&("singleClick"==a.input.lastClick.type?f="doubleClick":"doubleClick"==a.input.lastClick.type&&(f="tripleClick")),a.input.lastClick={time:e,x:b.clientX,y:b.clientY,type:f,button:b.button};let g=a.posAtCoords(a7(b));g&&("singleClick"==f?(a.input.mouseDown&&a.input.mouseDown.done(),a.input.mouseDown=new bb(a,g,b,!!c)):("doubleClick"==f?function(a,b,c,d){return a8(a,"handleDoubleClickOn",b,c,d)||a.someProp("handleDoubleClick",c=>c(a,b,d))}:function(a,b,c,e){return a8(a,"handleTripleClickOn",b,c,e)||a.someProp("handleTripleClick",c=>c(a,b,e))||function(a,b,c){if(0!=c.button)return!1;let e=a.state.doc;if(-1==b)return!!e.inlineContent&&(a9(a,d.U3.create(e,0,e.content.size),"pointer"),!0);let f=e.resolve(b);for(let b=f.depth+1;b>0;b--){let c=b>f.depth?f.nodeAfter:f.node(b),g=f.before(b);if(c.inlineContent)a9(a,d.U3.create(e,g+1,g+1+c.content.size),"pointer");else{if(!d.nh.isSelectable(c))continue;a9(a,d.nh.create(e,g),"pointer")}return!0}}(a,c,e)})(a,g.pos,g.inside,b)?b.preventDefault():a4(a,"pointer"))};class bb{constructor(a,b,c,e){let f,g;if(this.view=a,this.pos=b,this.event=c,this.flushed=e,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=a.state.doc,this.selectNode=!!c[ba],this.allowDefault=c.shiftKey,b.inside>-1)f=a.state.doc.nodeAt(b.inside),g=b.inside;else{let c=a.state.doc.resolve(b.pos);f=c.parent,g=c.depth?c.before():0}let h=e?null:c.target,i=h?a.docView.nearestDesc(h,!0):null;this.target=i&&1==i.nodeDOM.nodeType?i.nodeDOM:null;let{selection:j}=a.state;(0==c.button&&f.type.spec.draggable&&!1!==f.type.spec.selectable||j instanceof d.nh&&j.from<=g&&j.to>g)&&(this.mightDrag={node:f,pos:g,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&A&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),a.root.addEventListener("mouseup",this.up=this.up.bind(this)),a.root.addEventListener("mousemove",this.move=this.move.bind(this)),a4(a,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>aw(this.view)),this.view.input.mouseDown=null}up(a){if(this.done(),!this.view.dom.contains(a.target))return;let b=this.pos;if(this.view.state.doc!=this.startDoc&&(b=this.view.posAtCoords(a7(a))),this.updateAllowDefault(a),this.allowDefault||!b)a4(this.view,"pointer");else{var c,e,f,g;(c=this.view,e=b.pos,f=b.inside,g=this.selectNode,a8(c,"handleClickOn",e,f,a)||c.someProp("handleClick",b=>b(c,e,a))||(g?function(a,b){if(-1==b)return!1;let c=a.state.selection,e,f;c instanceof d.nh&&(e=c.node);let g=a.state.doc.resolve(b);for(let a=g.depth+1;a>0;a--){let b=a>g.depth?g.nodeAfter:g.node(a);if(d.nh.isSelectable(b)){f=e&&c.$from.depth>0&&a>=c.$from.depth&&g.before(c.$from.depth+1)==c.$from.pos?g.before(c.$from.depth):g.before(a);break}}return null!=f&&(a9(a,d.nh.create(a.state.doc,f),"pointer"),!0)}(c,f):function(a,b){if(-1==b)return!1;let c=a.state.doc.resolve(b),e=c.nodeAfter;return!!(e&&e.isAtom&&d.nh.isSelectable(e))&&(a9(a,new d.nh(c),"pointer"),!0)}(c,f)))?a.preventDefault():0==a.button&&(this.flushed||E&&this.mightDrag&&!this.mightDrag.node.isAtom||C&&!this.view.state.selection.visible&&2>=Math.min(Math.abs(b.pos-this.view.state.selection.from),Math.abs(b.pos-this.view.state.selection.to)))?(a9(this.view,d.LN.near(this.view.state.doc.resolve(b.pos)),"pointer"),a.preventDefault()):a4(this.view,"pointer")}}move(a){this.updateAllowDefault(a),a4(this.view,"pointer"),0==a.buttons&&this.done()}updateAllowDefault(a){!this.allowDefault&&(Math.abs(this.event.x-a.clientX)>4||Math.abs(this.event.y-a.clientY)>4)&&(this.allowDefault=!0)}}function bc(a,b){return!!a.composing||!!(E&&500>Math.abs(b.timeStamp-a.input.compositionEndedAt))&&(a.input.compositionEndedAt=-2e8,!0)}a0.touchstart=a=>{a.input.lastTouch=Date.now(),bg(a),a4(a,"pointer")},a0.touchmove=a=>{a.input.lastTouch=Date.now(),a4(a,"pointer")},a0.contextmenu=a=>bg(a);let bd=I?5e3:-1;function be(a,b){clearTimeout(a.input.composingTimeout),b>-1&&(a.input.composingTimeout=setTimeout(()=>bg(a),b))}function bf(a){let b;for(a.composing&&(a.input.composing=!1,a.input.compositionEndedAt=((b=document.createEvent("Event")).initEvent("event",!0,!0),b.timeStamp));a.input.compositionNodes.length>0;)a.input.compositionNodes.pop().markParentsDirty()}function bg(a,b=!1){if(!I||!(a.domObserver.flushingSoon>=0)){if(a.domObserver.forceFlush(),bf(a),b||a.docView&&a.docView.dirty){let c=au(a),d=a.state.selection;return c&&!c.eq(d)?a.dispatch(a.state.tr.setSelection(c)):(a.markCursor||b)&&!d.$from.node(d.$from.sharedDepth(d.to)).inlineContent?a.dispatch(a.state.tr.deleteSelection()):a.updateState(a.state),!0}return!1}}a1.compositionstart=a1.compositionupdate=a=>{if(!a.composing){a.domObserver.flush();let{state:b}=a,c=b.selection.$to;if(b.selection instanceof d.U3&&(b.storedMarks||!c.textOffset&&c.parentOffset&&c.nodeBefore.marks.some(a=>!1===a.type.spec.inclusive)||C&&H&&function(a){let{focusNode:b,focusOffset:c}=a.domSelectionRange();if(!b||1!=b.nodeType||c>=b.childNodes.length)return!1;let d=b.childNodes[c];return 1==d.nodeType&&"false"==d.contentEditable}(a)))a.markCursor=a.state.storedMarks||c.marks(),bg(a,!0),a.markCursor=null;else if(bg(a,!b.selection.empty),A&&b.selection.empty&&c.parentOffset&&!c.textOffset&&c.nodeBefore.marks.length){let b=a.domSelectionRange();for(let c=b.focusNode,d=b.focusOffset;c&&1==c.nodeType&&0!=d;){let b=d<0?c.lastChild:c.childNodes[d-1];if(!b)break;if(3==b.nodeType){let c=a.domSelection();c&&c.collapse(b,b.nodeValue.length);break}c=b,d=-1}}a.input.composing=!0}be(a,bd)},a1.compositionend=(a,b)=>{a.composing&&(a.input.composing=!1,a.input.compositionEndedAt=b.timeStamp,a.input.compositionPendingChanges=a.domObserver.pendingRecords().length?a.input.compositionID:0,a.input.compositionNode=null,a.input.badSafariComposition?a.domObserver.forceFlush():a.input.compositionPendingChanges&&Promise.resolve().then(()=>a.domObserver.flush()),a.input.compositionID++,be(a,20))};let bh=y&&z<15||F&&K<604;function bi(a,b,c,d,f){let g=aT(a,b,c,d,a.state.selection.$from);if(a.someProp("handlePaste",b=>b(a,f,g||e.Ji.empty)))return!0;if(!g)return!1;let h=0==g.openStart&&0==g.openEnd&&1==g.content.childCount?g.content.firstChild:null,i=h?a.state.tr.replaceSelectionWith(h,d):a.state.tr.replaceSelection(g);return a.dispatch(i.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function bj(a){let b=a.getData("text/plain")||a.getData("Text");if(b)return b;let c=a.getData("text/uri-list");return c?c.replace(/\r?\n/g," "):""}a0.copy=a1.cut=(a,b)=>{let c=a.state.selection,d="cut"==b.type;if(c.empty)return;let e=bh?null:b.clipboardData,{dom:f,text:g}=aS(a,c.content());e?(b.preventDefault(),e.clearData(),e.setData("text/html",f.innerHTML),e.setData("text/plain",g)):function(a,b){if(!a.dom.parentNode)return;let c=a.dom.parentNode.appendChild(document.createElement("div"));c.appendChild(b),c.style.cssText="position: fixed; left: -10000px; top: 10px";let d=getSelection(),e=document.createRange();e.selectNodeContents(b),a.dom.blur(),d.removeAllRanges(),d.addRange(e),setTimeout(()=>{c.parentNode&&c.parentNode.removeChild(c),a.focus()},50)}(a,f),d&&a.dispatch(a.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},a1.paste=(a,b)=>{if(a.composing&&!I)return;let c=bh?null:b.clipboardData,d=a.input.shiftKey&&45!=a.input.lastKeyCode;c&&bi(a,bj(c),c.getData("text/html"),d,b)?b.preventDefault():function(a,b){if(!a.dom.parentNode)return;let c=a.input.shiftKey||a.state.selection.$from.parent.type.spec.code,d=a.dom.parentNode.appendChild(document.createElement(c?"textarea":"div"));c||(d.contentEditable="true"),d.style.cssText="position: fixed; left: -10000px; top: 10px",d.focus();let e=a.input.shiftKey&&45!=a.input.lastKeyCode;setTimeout(()=>{a.focus(),d.parentNode&&d.parentNode.removeChild(d),c?bi(a,d.value,null,e,b):bi(a,d.textContent,d.innerHTML,e,b)},50)}(a,b)};class bk{constructor(a,b,c){this.slice=a,this.move=b,this.node=c}}let bl=G?"altKey":"ctrlKey";function bm(a,b){let c=a.someProp("dragCopies",a=>!a(b));return null!=c?c:!b[bl]}for(let a in a0.dragstart=(a,b)=>{let c,e=a.input.mouseDown;if(e&&e.done(),!b.dataTransfer)return;let f=a.state.selection,g=f.empty?null:a.posAtCoords(a7(b));if(g&&g.pos>=f.from&&g.pos<=(f instanceof d.nh?f.to-1:f.to));else if(e&&e.mightDrag)c=d.nh.create(a.state.doc,e.mightDrag.pos);else if(b.target&&1==b.target.nodeType){let e=a.docView.nearestDesc(b.target,!0);e&&e.node.type.spec.draggable&&e!=a.docView&&(c=d.nh.create(a.state.doc,e.posBefore))}let h=(c||a.state.selection).content(),{dom:i,text:j,slice:k}=aS(a,h);b.dataTransfer.files.length&&C&&!(D>120)||b.dataTransfer.clearData(),b.dataTransfer.setData(bh?"Text":"text/html",i.innerHTML),b.dataTransfer.effectAllowed="copyMove",bh||b.dataTransfer.setData("text/plain",j),a.dragging=new bk(k,bm(a,b),c)},a0.dragend=a=>{let b=a.dragging;window.setTimeout(()=>{a.dragging==b&&(a.dragging=null)},50)},a1.dragover=a1.dragenter=(a,b)=>b.preventDefault(),a1.drop=(a,b)=>{try{!function(a,b,c){if(!b.dataTransfer)return;let g=a.posAtCoords(a7(b));if(!g)return;let h=a.state.doc.resolve(g.pos),i=c&&c.slice;i?a.someProp("transformPasted",b=>{i=b(i,a,!1)}):i=aT(a,bj(b.dataTransfer),bh?null:b.dataTransfer.getData("text/html"),!1,h);let j=!!(c&&bm(a,b));if(a.someProp("handleDrop",c=>c(a,b,i||e.Ji.empty,j)))return b.preventDefault();if(!i)return;b.preventDefault();let k=i?(0,f.Um)(a.state.doc,h.pos,i):h.pos;null==k&&(k=h.pos);let l=a.state.tr;if(j){let{node:a}=c;a?a.replace(l):l.deleteSelection()}let m=l.mapping.map(k),n=0==i.openStart&&0==i.openEnd&&1==i.content.childCount,o=l.doc;if(n?l.replaceRangeWith(m,m,i.content.firstChild):l.replaceRange(m,m,i),l.doc.eq(o))return;let p=l.doc.resolve(m);if(n&&d.nh.isSelectable(i.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(i.content.firstChild))l.setSelection(new d.nh(p));else{let b=l.mapping.map(k);l.mapping.maps[l.mapping.maps.length-1].forEach((a,c,d,e)=>b=e),l.setSelection(aD(a,p,l.doc.resolve(b)))}a.focus(),a.dispatch(l.setMeta("uiEvent","drop"))}(a,b,a.dragging)}finally{a.dragging=null}},a0.focus=a=>{a.input.lastFocus=Date.now(),a.focused||(a.domObserver.stop(),a.dom.classList.add("ProseMirror-focused"),a.domObserver.start(),a.focused=!0,setTimeout(()=>{a.docView&&a.hasFocus()&&!a.domObserver.currentSelection.eq(a.domSelectionRange())&&aw(a)},20))},a0.blur=(a,b)=>{a.focused&&(a.domObserver.stop(),a.dom.classList.remove("ProseMirror-focused"),a.domObserver.start(),b.relatedTarget&&a.dom.contains(b.relatedTarget)&&a.domObserver.currentSelection.clear(),a.focused=!1)},a0.beforeinput=(a,b)=>{if(C&&I&&"deleteContentBackward"==b.inputType){a.domObserver.flushSoon();let{domChangeCount:b}=a.input;setTimeout(()=>{if(a.input.domChangeCount!=b||(a.dom.blur(),a.focus(),a.someProp("handleKeyDown",b=>b(a,r(8,"Backspace")))))return;let{$cursor:c}=a.state.selection;c&&c.pos>0&&a.dispatch(a.state.tr.delete(c.pos-1,c.pos).scrollIntoView())},50)}},a1)a0[a]=a1[a];function bn(a,b){if(a==b)return!0;for(let c in a)if(a[c]!==b[c])return!1;for(let c in b)if(!(c in a))return!1;return!0}class bo{constructor(a,b){this.toDOM=a,this.spec=b||bt,this.side=this.spec.side||0}map(a,b,c,d){let{pos:e,deleted:f}=a.mapResult(b.from+d,this.side<0?-1:1);return f?null:new br(e-c,e-c,this)}valid(){return!0}eq(a){return this==a||a instanceof bo&&(this.spec.key&&this.spec.key==a.spec.key||this.toDOM==a.toDOM&&bn(this.spec,a.spec))}destroy(a){this.spec.destroy&&this.spec.destroy(a)}}class bp{constructor(a,b){this.attrs=a,this.spec=b||bt}map(a,b,c,d){let e=a.map(b.from+d,this.spec.inclusiveStart?-1:1)-c,f=a.map(b.to+d,this.spec.inclusiveEnd?1:-1)-c;return e>=f?null:new br(e,f,this)}valid(a,b){return b.from<b.to}eq(a){return this==a||a instanceof bp&&bn(this.attrs,a.attrs)&&bn(this.spec,a.spec)}static is(a){return a.type instanceof bp}destroy(){}}class bq{constructor(a,b){this.attrs=a,this.spec=b||bt}map(a,b,c,d){let e=a.mapResult(b.from+d,1);if(e.deleted)return null;let f=a.mapResult(b.to+d,-1);return f.deleted||f.pos<=e.pos?null:new br(e.pos-c,f.pos-c,this)}valid(a,b){let{index:c,offset:d}=a.content.findIndex(b.from),e;return d==b.from&&!(e=a.child(c)).isText&&d+e.nodeSize==b.to}eq(a){return this==a||a instanceof bq&&bn(this.attrs,a.attrs)&&bn(this.spec,a.spec)}destroy(){}}class br{constructor(a,b,c){this.from=a,this.to=b,this.type=c}copy(a,b){return new br(a,b,this.type)}eq(a,b=0){return this.type.eq(a.type)&&this.from+b==a.from&&this.to+b==a.to}map(a,b,c){return this.type.map(a,this,b,c)}static widget(a,b,c){return new br(a,a,new bo(b,c))}static inline(a,b,c,d){return new br(a,b,new bp(c,d))}static node(a,b,c,d){return new br(a,b,new bq(c,d))}get spec(){return this.type.spec}get inline(){return this.type instanceof bp}get widget(){return this.type instanceof bo}}let bs=[],bt={};class bu{constructor(a,b){this.local=a.length?a:bs,this.children=b.length?b:bs}static create(a,b){return b.length?bA(b,a,0,bt):bv}find(a,b,c){let d=[];return this.findInner(null==a?0:a,null==b?1e9:b,d,0,c),d}findInner(a,b,c,d,e){for(let f=0;f<this.local.length;f++){let g=this.local[f];g.from<=b&&g.to>=a&&(!e||e(g.spec))&&c.push(g.copy(g.from+d,g.to+d))}for(let f=0;f<this.children.length;f+=3)if(this.children[f]<b&&this.children[f+1]>a){let g=this.children[f]+1;this.children[f+2].findInner(a-g,b-g,c,d+g,e)}}map(a,b,c){return this==bv||0==a.maps.length?this:this.mapInner(a,b,0,0,c||bt)}mapInner(a,b,c,d,e){let f;for(let g=0;g<this.local.length;g++){let h=this.local[g].map(a,c,d);h&&h.type.valid(b,h)?(f||(f=[])).push(h):e.onRemove&&e.onRemove(this.local[g].spec)}return this.children.length?function(a,b,c,d,e,f,g){let h=a.slice();for(let a=0,b=f;a<c.maps.length;a++){let d=0;c.maps[a].forEach((a,c,e,f)=>{let g=f-e-(c-a);for(let e=0;e<h.length;e+=3){let f=h[e+1];if(f<0||a>f+b-d)continue;let i=h[e]+b-d;c>=i?h[e+1]=a<=i?-2:-1:a>=b&&g&&(h[e]+=g,h[e+1]+=g)}d+=g}),b=c.maps[a].map(b,-1)}let i=!1;for(let b=0;b<h.length;b+=3)if(h[b+1]<0){if(-2==h[b+1]){i=!0,h[b+1]=-1;continue}let j=c.map(a[b]+f),k=j-e;if(k<0||k>=d.content.size){i=!0;continue}let l=c.map(a[b+1]+f,-1)-e,{index:m,offset:n}=d.content.findIndex(k),o=d.maybeChild(m);if(o&&n==k&&n+o.nodeSize==l){let d=h[b+2].mapInner(c,o,j+1,a[b]+f+1,g);d!=bv?(h[b]=k,h[b+1]=l,h[b+2]=d):(h[b+1]=-2,i=!0)}else i=!0}if(i){let i=bA(function(a,b,c,d,e,f,g){for(let h=0;h<a.length;h+=3)-1==a[h+1]&&function a(b,f){for(let a=0;a<b.local.length;a++){let h=b.local[a].map(d,e,f);h?c.push(h):g.onRemove&&g.onRemove(b.local[a].spec)}for(let c=0;c<b.children.length;c+=3)a(b.children[c+2],b.children[c]+f+1)}(a[h+2],b[h]+f+1);return c}(h,a,b,c,e,f,g),d,0,g);b=i.local;for(let a=0;a<h.length;a+=3)h[a+1]<0&&(h.splice(a,3),a-=3);for(let a=0,b=0;a<i.children.length;a+=3){let c=i.children[a];for(;b<h.length&&h[b]<c;)b+=3;h.splice(b,0,i.children[a],i.children[a+1],i.children[a+2])}}return new bu(b.sort(bB),h)}(this.children,f||[],a,b,c,d,e):f?new bu(f.sort(bB),bs):bv}add(a,b){return b.length?this==bv?bu.create(a,b):this.addInner(a,b,0):this}addInner(a,b,c){let d,e=0;a.forEach((a,f)=>{let g=f+c,h;if(h=by(b,a,g)){for(d||(d=this.children.slice());e<d.length&&d[e]<f;)e+=3;d[e]==f?d[e+2]=d[e+2].addInner(a,h,g+1):d.splice(e,0,f,f+a.nodeSize,bA(h,a,g+1,bt)),e+=3}});let f=bx(e?bz(b):b,-c);for(let b=0;b<f.length;b++)f[b].type.valid(a,f[b])||f.splice(b--,1);return new bu(f.length?this.local.concat(f).sort(bB):this.local,d||this.children)}remove(a){return 0==a.length||this==bv?this:this.removeInner(a,0)}removeInner(a,b){let c=this.children,d=this.local;for(let d=0;d<c.length;d+=3){let e,f=c[d]+b,g=c[d+1]+b;for(let b=0,c;b<a.length;b++)(c=a[b])&&c.from>f&&c.to<g&&(a[b]=null,(e||(e=[])).push(c));if(!e)continue;c==this.children&&(c=this.children.slice());let h=c[d+2].removeInner(e,f+1);h!=bv?c[d+2]=h:(c.splice(d,3),d-=3)}if(d.length){for(let c=0,e;c<a.length;c++)if(e=a[c])for(let a=0;a<d.length;a++)d[a].eq(e,b)&&(d==this.local&&(d=this.local.slice()),d.splice(a--,1))}return c==this.children&&d==this.local?this:d.length||c.length?new bu(d,c):bv}forChild(a,b){let c,d;if(this==bv)return this;if(b.isLeaf)return bu.empty;for(let b=0;b<this.children.length;b+=3)if(this.children[b]>=a){this.children[b]==a&&(c=this.children[b+2]);break}let e=a+1,f=e+b.content.size;for(let a=0;a<this.local.length;a++){let b=this.local[a];if(b.from<f&&b.to>e&&b.type instanceof bp){let a=Math.max(e,b.from)-e,c=Math.min(f,b.to)-e;a<c&&(d||(d=[])).push(b.copy(a,c))}}if(d){let a=new bu(d.sort(bB),bs);return c?new bw([a,c]):a}return c||bv}eq(a){if(this==a)return!0;if(!(a instanceof bu)||this.local.length!=a.local.length||this.children.length!=a.children.length)return!1;for(let b=0;b<this.local.length;b++)if(!this.local[b].eq(a.local[b]))return!1;for(let b=0;b<this.children.length;b+=3)if(this.children[b]!=a.children[b]||this.children[b+1]!=a.children[b+1]||!this.children[b+2].eq(a.children[b+2]))return!1;return!0}locals(a){return bC(this.localsInner(a))}localsInner(a){if(this==bv)return bs;if(a.inlineContent||!this.local.some(bp.is))return this.local;let b=[];for(let a=0;a<this.local.length;a++)this.local[a].type instanceof bp||b.push(this.local[a]);return b}forEachSet(a){a(this)}}bu.empty=new bu([],[]),bu.removeOverlap=bC;let bv=bu.empty;class bw{constructor(a){this.members=a}map(a,b){let c=this.members.map(c=>c.map(a,b,bt));return bw.from(c)}forChild(a,b){if(b.isLeaf)return bu.empty;let c=[];for(let d=0;d<this.members.length;d++){let e=this.members[d].forChild(a,b);e!=bv&&(e instanceof bw?c=c.concat(e.members):c.push(e))}return bw.from(c)}eq(a){if(!(a instanceof bw)||a.members.length!=this.members.length)return!1;for(let b=0;b<this.members.length;b++)if(!this.members[b].eq(a.members[b]))return!1;return!0}locals(a){let b,c=!0;for(let d=0;d<this.members.length;d++){let e=this.members[d].localsInner(a);if(e.length)if(b){c&&(b=b.slice(),c=!1);for(let a=0;a<e.length;a++)b.push(e[a])}else b=e}return b?bC(c?b:b.sort(bB)):bs}static from(a){switch(a.length){case 0:return bv;case 1:return a[0];default:return new bw(a.every(a=>a instanceof bu)?a:a.reduce((a,b)=>a.concat(b instanceof bu?b:b.members),[]))}}forEachSet(a){for(let b=0;b<this.members.length;b++)this.members[b].forEachSet(a)}}function bx(a,b){if(!b||!a.length)return a;let c=[];for(let d=0;d<a.length;d++){let e=a[d];c.push(new br(e.from+b,e.to+b,e.type))}return c}function by(a,b,c){if(b.isLeaf)return null;let d=c+b.nodeSize,e=null;for(let b=0,f;b<a.length;b++)(f=a[b])&&f.from>c&&f.to<d&&((e||(e=[])).push(f),a[b]=null);return e}function bz(a){let b=[];for(let c=0;c<a.length;c++)null!=a[c]&&b.push(a[c]);return b}function bA(a,b,c,d){let e=[],f=!1;b.forEach((b,g)=>{let h=by(a,b,g+c);if(h){f=!0;let a=bA(h,b,c+g+1,d);a!=bv&&e.push(g,g+b.nodeSize,a)}});let g=bx(f?bz(a):a,-c).sort(bB);for(let a=0;a<g.length;a++)g[a].type.valid(b,g[a])||(d.onRemove&&d.onRemove(g[a].spec),g.splice(a--,1));return g.length||e.length?new bu(g,e):bv}function bB(a,b){return a.from-b.from||a.to-b.to}function bC(a){let b=a;for(let c=0;c<b.length-1;c++){let d=b[c];if(d.from!=d.to)for(let e=c+1;e<b.length;e++){let f=b[e];if(f.from==d.from){f.to!=d.to&&(b==a&&(b=a.slice()),b[e]=f.copy(f.from,d.to),bD(b,e+1,f.copy(d.to,f.to)));continue}f.from<d.to&&(b==a&&(b=a.slice()),b[c]=d.copy(d.from,f.from),bD(b,e,d.copy(f.from,d.to)));break}}return b}function bD(a,b,c){for(;b<a.length&&bB(c,a[b])>0;)b++;a.splice(b,0,c)}function bE(a){let b=[];return a.someProp("decorations",c=>{let d=c(a.state);d&&d!=bv&&b.push(d)}),a.cursorWrapper&&b.push(bu.create(a.state.doc,[a.cursorWrapper.deco])),bw.from(b)}let bF={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},bG=y&&z<=11;class bH{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(a){this.anchorNode=a.anchorNode,this.anchorOffset=a.anchorOffset,this.focusNode=a.focusNode,this.focusOffset=a.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(a){return a.anchorNode==this.anchorNode&&a.anchorOffset==this.anchorOffset&&a.focusNode==this.focusNode&&a.focusOffset==this.focusOffset}}class bI{constructor(a,b){this.view=a,this.handleDOMChange=b,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new bH,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(b=>{for(let a=0;a<b.length;a++)this.queue.push(b[a]);y&&z<=11&&b.some(a=>"childList"==a.type&&a.removedNodes.length||"characterData"==a.type&&a.oldValue.length>a.target.nodeValue.length)?this.flushSoon():E&&a.composing&&b.some(a=>"childList"==a.type&&"TR"==a.target.nodeName)?(a.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),bG&&(this.onCharData=a=>{this.queue.push({target:a.target,type:"characterData",oldValue:a.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,bF)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let a=this.observer.takeRecords();if(a.length){for(let b=0;b<a.length;b++)this.queue.push(a[b]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(aE(this.view)){if(this.suppressingSelectionUpdates)return aw(this.view);if(y&&z<=11&&!this.view.state.selection.empty){let a=this.view.domSelectionRange();if(a.focusNode&&l(a.focusNode,a.focusOffset,a.anchorNode,a.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(a){if(!a.focusNode)return!0;let b=new Set,c;for(let c=a.focusNode;c;c=h(c))b.add(c);for(let d=a.anchorNode;d;d=h(d))if(b.has(d)){c=d;break}let d=c&&this.view.docView.nearestDesc(c);if(d&&d.ignoreMutation({type:"selection",target:3==c.nodeType?c.parentNode:c}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let a of this.observer.takeRecords())this.queue.push(a);return this.queue}flush(){var a;let{view:b}=this;if(!b.docView||this.flushingSoon>-1)return;let c=this.pendingRecords();c.length&&(this.queue=[]);let e=b.domSelectionRange(),f=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(e)&&aE(b)&&!this.ignoreSelectionChange(e),g=-1,h=-1,i=!1,j=[];if(b.editable)for(let a=0;a<c.length;a++){let b=this.registerMutation(c[a],j);b&&(g=g<0?b.from:Math.min(b.from,g),h=h<0?b.to:Math.max(b.to,h),b.typeOver&&(i=!0))}if(j.some(a=>"BR"==a.nodeName)&&(8==b.input.lastKeyCode||46==b.input.lastKeyCode)){for(let a of j)if("BR"==a.nodeName&&a.parentNode){let b=a.nextSibling;b&&1==b.nodeType&&"false"==b.contentEditable&&a.parentNode.removeChild(a)}}else if(A&&j.length){let a=j.filter(a=>"BR"==a.nodeName);if(2==a.length){let[b,c]=a;b.parentNode&&b.parentNode.parentNode==c.parentNode?c.remove():b.remove()}else{let{focusNode:c}=this.currentSelection;for(let d of a){let a=d.parentNode;a&&"LI"==a.nodeName&&(!c||function(a,b){for(let c=b.parentNode;c&&c!=a.dom;c=c.parentNode){let b=a.docView.nearestDesc(c,!0);if(b&&b.node.isBlock)return c}return null}(b,c)!=a)&&d.remove()}}}let k=null;g<0&&f&&b.input.lastFocus>Date.now()-200&&Math.max(b.input.lastTouch,b.input.lastClick.time)<Date.now()-300&&q(e)&&(k=au(b))&&k.eq(d.LN.near(b.state.doc.resolve(0),1))?(b.input.lastFocus=0,aw(b),this.currentSelection.set(e),b.scrollToSelection()):(g>-1||f)&&(g>-1&&(b.docView.markDirty(g,h),a=b,!bJ.has(a)&&(bJ.set(a,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(a.dom).whiteSpace))&&(a.requiresGeckoHackNode=A,bK||(console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),bK=!0))),b.input.badSafariComposition&&(b.input.badSafariComposition=!1,function(a,b){var c;let{focusNode:d,focusOffset:e}=a.domSelectionRange();for(let f of b)if((null==(c=f.parentNode)?void 0:c.nodeName)=="TR"){let b=f.nextSibling;for(;b&&"TD"!=b.nodeName&&"TH"!=b.nodeName;)b=b.nextSibling;if(b){let c=b;for(;;){let a=c.firstChild;if(!a||1!=a.nodeType||"false"==a.contentEditable||/^(BR|IMG)$/.test(a.nodeName))break;c=a}c.insertBefore(f,c.firstChild),d==f&&a.domSelection().collapse(f,e)}else f.parentNode.removeChild(f)}}(b,j)),this.handleDOMChange(g,h,i,j),b.docView&&b.docView.dirty?b.updateState(b.state):this.currentSelection.eq(e)||aw(b),this.currentSelection.set(e))}registerMutation(a,b){if(b.indexOf(a.target)>-1)return null;let c=this.view.docView.nearestDesc(a.target);if("attributes"==a.type&&(c==this.view.docView||"contenteditable"==a.attributeName||"style"==a.attributeName&&!a.oldValue&&!a.target.getAttribute("style"))||!c||c.ignoreMutation(a))return null;if("childList"==a.type){for(let c=0;c<a.addedNodes.length;c++){let d=a.addedNodes[c];b.push(d),3==d.nodeType&&(this.lastChangedTextNode=d)}if(c.contentDOM&&c.contentDOM!=c.dom&&!c.contentDOM.contains(a.target))return{from:c.posBefore,to:c.posAfter};let d=a.previousSibling,e=a.nextSibling;if(y&&z<=11&&a.addedNodes.length)for(let b=0;b<a.addedNodes.length;b++){let{previousSibling:c,nextSibling:f}=a.addedNodes[b];(!c||0>Array.prototype.indexOf.call(a.addedNodes,c))&&(d=c),(!f||0>Array.prototype.indexOf.call(a.addedNodes,f))&&(e=f)}let f=d&&d.parentNode==a.target?g(d)+1:0,h=c.localPosFromDOM(a.target,f,-1),i=e&&e.parentNode==a.target?g(e):a.target.childNodes.length;return{from:h,to:c.localPosFromDOM(a.target,i,1)}}return"attributes"==a.type?{from:c.posAtStart-c.border,to:c.posAtEnd+c.border}:(this.lastChangedTextNode=a.target,{from:c.posAtStart,to:c.posAtEnd,typeOver:a.target.nodeValue==a.oldValue})}}let bJ=new WeakMap,bK=!1;function bL(a,b){let c=b.startContainer,d=b.startOffset,e=b.endContainer,f=b.endOffset,g=a.domAtPos(a.state.selection.anchor);return l(g.node,g.offset,e,f)&&([c,d,e,f]=[e,f,c,d]),{anchorNode:c,anchorOffset:d,focusNode:e,focusOffset:f}}function bM(a){let b=a.pmViewDesc;if(b)return b.parseRule();if("BR"==a.nodeName&&a.parentNode){if(E&&/^(ul|ol)$/i.test(a.parentNode.nodeName)){let a=document.createElement("div");return a.appendChild(document.createElement("li")),{skip:a}}else if(a.parentNode.lastChild==a||E&&/^(tr|table)$/i.test(a.parentNode.nodeName))return{ignore:!0}}else if("IMG"==a.nodeName&&a.getAttribute("mark-placeholder"))return{ignore:!0};return null}let bN=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function bO(a,b,c){return Math.max(c.anchor,c.head)>b.content.size?null:aD(a,b.resolve(c.anchor),b.resolve(c.head))}function bP(a,b,c){let d=a.depth,e=b?a.end():a.pos;for(;d>0&&(b||a.indexAfter(d)==a.node(d).childCount);)d--,e++,b=!1;if(c){let b=a.node(d).maybeChild(a.indexAfter(d));for(;b&&!b.isLeaf;)b=b.firstChild,e++}return e}function bQ(a){if(2!=a.length)return!1;let b=a.charCodeAt(0),c=a.charCodeAt(1);return b>=56320&&b<=57343&&c>=55296&&c<=56319}class bR{constructor(a,b){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new a3,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=b,this.state=b.state,this.directPlugins=b.plugins||[],this.directPlugins.forEach(bW),this.dispatch=this.dispatch.bind(this),this.dom=a&&a.mount||document.createElement("div"),a&&(a.appendChild?a.appendChild(this.dom):"function"==typeof a?a(this.dom):a.mount&&(this.mounted=!0)),this.editable=bU(this),bT(this),this.nodeViews=bV(this),this.docView=ag(this.state.doc,bS(this),bE(this),this.dom,this),this.domObserver=new bI(this,(a,b,c,f)=>(function(a,b,c,f,g){let h,i,j,k=a.input.compositionPendingChanges||(a.composing?a.input.compositionID:0);if(a.input.compositionPendingChanges=0,b<0){let b=a.input.lastSelectionTime>Date.now()-50?a.input.lastSelectionOrigin:null,c=au(a,b);if(c&&!a.state.selection.eq(c)){if(C&&I&&13===a.input.lastKeyCode&&Date.now()-100<a.input.lastKeyCodeTime&&a.someProp("handleKeyDown",b=>b(a,r(13,"Enter"))))return;let d=a.state.tr.setSelection(c);"pointer"==b?d.setMeta("pointer",!0):"key"==b&&d.scrollIntoView(),k&&d.setMeta("composition",k),a.dispatch(d)}return}let l=a.state.doc.resolve(b),m=l.sharedDepth(c);b=l.before(m+1),c=a.state.doc.resolve(c).after(m+1);let n=a.state.selection,o=function(a,b,c){let d,{node:f,fromOffset:g,toOffset:h,from:i,to:j}=a.docView.parseRange(b,c),k=a.domSelectionRange(),l=k.anchorNode;if(l&&a.dom.contains(1==l.nodeType?l:l.parentNode)&&(d=[{node:l,offset:k.anchorOffset}],q(k)||d.push({node:k.focusNode,offset:k.focusOffset})),C&&8===a.input.lastKeyCode)for(let a=h;a>g;a--){let b=f.childNodes[a-1],c=b.pmViewDesc;if("BR"==b.nodeName&&!c){h=a;break}if(!c||c.size)break}let m=a.state.doc,n=a.someProp("domParser")||e.S4.fromSchema(a.state.schema),o=m.resolve(i),p=null,r=n.parse(f,{topNode:o.parent,topMatch:o.parent.contentMatchAt(o.index()),topOpen:!0,from:g,to:h,preserveWhitespace:"pre"!=o.parent.type.whitespace||"full",findPositions:d,ruleFromNode:bM,context:o});if(d&&null!=d[0].pos){let a=d[0].pos,b=d[1]&&d[1].pos;null==b&&(b=a),p={anchor:a+i,head:b+i}}return{doc:r,sel:p,from:i,to:j}}(a,b,c),p=a.state.doc,s=p.slice(o.from,o.to);8===a.input.lastKeyCode&&Date.now()-100<a.input.lastKeyCodeTime?(h=a.state.selection.to,i="end"):(h=a.state.selection.from,i="start"),a.input.lastKeyCode=null;let t=function(a,b,c,d,e){let f=a.findDiffStart(b,c);if(null==f)return null;let{a:g,b:h}=a.findDiffEnd(b,c+a.size,c+b.size);if("end"==e){let a=Math.max(0,f-Math.min(g,h));d-=g+a-f}if(g<f&&a.size<b.size){let a=d<=f&&d>=g?f-d:0;(f-=a)&&f<b.size&&bQ(b.textBetween(f-1,f+1))&&(f+=a?1:-1),h=f+(h-g),g=f}else if(h<f){let b=d<=f&&d>=h?f-d:0;(f-=b)&&f<a.size&&bQ(a.textBetween(f-1,f+1))&&(f+=b?1:-1),g=f+(g-h),h=f}return{start:f,endA:g,endB:h}}(s.content,o.doc.content,o.from,h,i);if(t&&a.input.domChangeCount++,(F&&a.input.lastIOSEnter>Date.now()-225||I)&&g.some(a=>1==a.nodeType&&!bN.test(a.nodeName))&&(!t||t.endA>=t.endB)&&a.someProp("handleKeyDown",b=>b(a,r(13,"Enter")))){a.input.lastIOSEnter=0;return}if(!t)if(f&&n instanceof d.U3&&!n.empty&&n.$head.sameParent(n.$anchor)&&!a.composing&&!(o.sel&&o.sel.anchor!=o.sel.head))t={start:n.from,endA:n.to,endB:n.to};else{if(o.sel){let b=bO(a,a.state.doc,o.sel);if(b&&!b.eq(a.state.selection)){let c=a.state.tr.setSelection(b);k&&c.setMeta("composition",k),a.dispatch(c)}}return}a.state.selection.from<a.state.selection.to&&t.start==t.endB&&a.state.selection instanceof d.U3&&(t.start>a.state.selection.from&&t.start<=a.state.selection.from+2&&a.state.selection.from>=o.from?t.start=a.state.selection.from:t.endA<a.state.selection.to&&t.endA>=a.state.selection.to-2&&a.state.selection.to<=o.to&&(t.endB+=a.state.selection.to-t.endA,t.endA=a.state.selection.to)),y&&z<=11&&t.endB==t.start+1&&t.endA==t.start&&t.start>o.from&&" \xa0"==o.doc.textBetween(t.start-o.from-1,t.start-o.from+1)&&(t.start--,t.endA--,t.endB--);let u=o.doc.resolveNoCache(t.start-o.from),v=o.doc.resolveNoCache(t.endB-o.from),w=p.resolve(t.start),x=u.sameParent(v)&&u.parent.inlineContent&&w.end()>=t.endA;if((F&&a.input.lastIOSEnter>Date.now()-225&&(!x||g.some(a=>"DIV"==a.nodeName||"P"==a.nodeName))||!x&&u.pos<o.doc.content.size&&(!u.sameParent(v)||!u.parent.inlineContent)&&u.pos<v.pos&&!/\S/.test(o.doc.textBetween(u.pos,v.pos,"","")))&&a.someProp("handleKeyDown",b=>b(a,r(13,"Enter")))){a.input.lastIOSEnter=0;return}if(a.state.selection.anchor>t.start&&function(a,b,c,d,e){if(c-b<=e.pos-d.pos||bP(d,!0,!1)<e.pos)return!1;let f=a.resolve(b);if(!d.parent.isTextblock){let a=f.nodeAfter;return null!=a&&c==b+a.nodeSize}if(f.parentOffset<f.parent.content.size||!f.parent.isTextblock)return!1;let g=a.resolve(bP(f,!0,!0));return!(!g.parent.isTextblock||g.pos>c||bP(g,!0,!1)<c)&&d.parent.content.cut(d.parentOffset).eq(g.parent.content)}(p,t.start,t.endA,u,v)&&a.someProp("handleKeyDown",b=>b(a,r(8,"Backspace")))){I&&C&&a.domObserver.suppressSelectionUpdates();return}C&&t.endB==t.start&&(a.input.lastChromeDelete=Date.now()),I&&!x&&u.start()!=v.start()&&0==v.parentOffset&&u.depth==v.depth&&o.sel&&o.sel.anchor==o.sel.head&&o.sel.head==t.endA&&(t.endB-=2,v=o.doc.resolveNoCache(t.endB-o.from),setTimeout(()=>{a.someProp("handleKeyDown",function(b){return b(a,r(13,"Enter"))})},20));let A=t.start,B=t.endA,D=b=>{let c=b||a.state.tr.replace(A,B,o.doc.slice(t.start-o.from,t.endB-o.from));if(o.sel){let b=bO(a,c.doc,o.sel);b&&!(C&&a.composing&&b.empty&&(t.start!=t.endB||a.input.lastChromeDelete<Date.now()-100)&&(b.head==A||b.head==c.mapping.map(B)-1)||y&&b.empty&&b.head==A)&&c.setSelection(b)}return k&&c.setMeta("composition",k),c.scrollIntoView()};if(x)if(u.pos==v.pos){y&&z<=11&&0==u.parentOffset&&(a.domObserver.suppressSelectionUpdates(),setTimeout(()=>aw(a),20));let b=D(a.state.tr.delete(A,B)),c=p.resolve(t.start).marksAcross(p.resolve(t.endA));c&&b.ensureMarks(c),a.dispatch(b)}else if(t.endA==t.endB&&(j=function(a,b){let c=a.firstChild.marks,d=b.firstChild.marks,f=c,g=d,h,i,j;for(let a=0;a<d.length;a++)f=d[a].removeFromSet(f);for(let a=0;a<c.length;a++)g=c[a].removeFromSet(g);if(1==f.length&&0==g.length)i=f[0],h="add",j=a=>a.mark(i.addToSet(a.marks));else{if(0!=f.length||1!=g.length)return null;i=g[0],h="remove",j=a=>a.mark(i.removeFromSet(a.marks))}let k=[];for(let a=0;a<b.childCount;a++)k.push(j(b.child(a)));if(e.FK.from(k).eq(a))return{mark:i,type:h}}(u.parent.content.cut(u.parentOffset,v.parentOffset),w.parent.content.cut(w.parentOffset,t.endA-w.start())))){let b=D(a.state.tr);"add"==j.type?b.addMark(A,B,j.mark):b.removeMark(A,B,j.mark),a.dispatch(b)}else if(u.parent.child(u.index()).isText&&u.index()==v.index()-!v.textOffset){let b=u.parent.textBetween(u.parentOffset,v.parentOffset),c=()=>D(a.state.tr.insertText(b,A,B));a.someProp("handleTextInput",d=>d(a,A,B,b,c))||a.dispatch(c())}else a.dispatch(D());else a.dispatch(D())})(this,a,b,c,f)),this.domObserver.start(),function(a){for(let b in a0){let c=a0[b];a.dom.addEventListener(b,a.input.eventHandlers[b]=b=>{!function(a,b){if(!b.bubbles)return!0;if(b.defaultPrevented)return!1;for(let c=b.target;c!=a.dom;c=c.parentNode)if(!c||11==c.nodeType||c.pmViewDesc&&c.pmViewDesc.stopEvent(b))return!1;return!0}(a,b)||a6(a,b)||!a.editable&&b.type in a1||c(a,b)},a2[b]?{passive:!0}:void 0)}E&&a.dom.addEventListener("input",()=>null),a5(a)}(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let a=this._props;for(let b in this._props={},a)this._props[b]=a[b];this._props.state=this.state}return this._props}update(a){a.handleDOMEvents!=this._props.handleDOMEvents&&a5(this);let b=this._props;this._props=a,a.plugins&&(a.plugins.forEach(bW),this.directPlugins=a.plugins),this.updateStateInner(a.state,b)}setProps(a){let b={};for(let a in this._props)b[a]=this._props[a];for(let c in b.state=this.state,a)b[c]=a[c];this.update(b)}updateState(a){this.updateStateInner(a,this._props)}updateStateInner(a,b){var c,d,e;let f=this.state,h=!1,i=!1;a.storedMarks&&this.composing&&(bf(this),i=!0),this.state=a;let j=f.plugins!=a.plugins||this._props.plugins!=b.plugins;if(j||this._props.plugins!=b.plugins||this._props.nodeViews!=b.nodeViews){let a=bV(this);(function(a,b){let c=0,d=0;for(let d in a){if(a[d]!=b[d])return!0;c++}for(let a in b)d++;return c!=d})(a,this.nodeViews)&&(this.nodeViews=a,h=!0)}(j||b.handleDOMEvents!=this._props.handleDOMEvents)&&a5(this),this.editable=bU(this),bT(this);let k=bE(this),m=bS(this),n=f.plugins==a.plugins||f.doc.eq(a.doc)?a.scrollToSelection>f.scrollToSelection?"to selection":"preserve":"reset",q=h||!this.docView.matchesNode(a.doc,m,k);(q||!a.selection.eq(f.selection))&&(i=!0);let r="preserve"==n&&i&&null==this.dom.style.overflowAnchor&&function(a){let b,c,d=a.dom.getBoundingClientRect(),e=Math.max(0,d.top);for(let f=(d.left+d.right)/2,g=e+1;g<Math.min(innerHeight,d.bottom);g+=5){let d=a.root.elementFromPoint(f,g);if(!d||d==a.dom||!a.dom.contains(d))continue;let h=d.getBoundingClientRect();if(h.top>=e-20){b=d,c=h.top;break}}return{refDOM:b,refTop:c,stack:N(a.dom)}}(this);if(i){let b,c,i;this.domObserver.stop();let j=q&&(y||C)&&!this.composing&&!f.selection.empty&&!a.selection.empty&&(d=f.selection,e=a.selection,i=Math.min(d.$anchor.sharedDepth(d.head),e.$anchor.sharedDepth(e.head)),d.$anchor.start(i)!=e.$anchor.start(i));if(q){let b=C?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=function(a){let b=a.domSelectionRange();if(!b.focusNode)return null;let c=function(a,b){for(;;){if(3==a.nodeType&&b)return a;if(1==a.nodeType&&b>0){if("false"==a.contentEditable)return null;b=o(a=a.childNodes[b-1])}else{if(!a.parentNode||p(a))return null;b=g(a),a=a.parentNode}}}(b.focusNode,b.focusOffset),d=function(a,b){for(;;){if(3==a.nodeType&&b<a.nodeValue.length)return a;if(1==a.nodeType&&b<a.childNodes.length){if("false"==a.contentEditable)return null;a=a.childNodes[b],b=0}else{if(!a.parentNode||p(a))return null;b=g(a)+1,a=a.parentNode}}}(b.focusNode,b.focusOffset);if(c&&d&&c!=d){let b=d.pmViewDesc,e=a.domObserver.lastChangedTextNode;if(c==e||d==e)return e;if(!b||!b.isText(d.nodeValue))return d;if(a.input.compositionNode==d){let a=c.pmViewDesc;if(!(!a||!a.isText(c.nodeValue)))return d}}return c||d}(this)),(h||!this.docView.update(a.doc,m,k,this))&&(this.docView.updateOuterDeco(m),this.docView.destroy(),this.docView=ag(a.doc,m,k,this.dom,this)),!b||this.trackWrites&&this.dom.contains(this.trackWrites)||(j=!0)}j||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&(b=this.docView.domFromPos(this.state.selection.anchor,0),c=this.domSelectionRange(),l(b.node,b.offset,c.anchorNode,c.anchorOffset)))?aw(this,j):(aB(this,a.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(f),(null==(c=this.dragging)?void 0:c.node)&&!f.doc.eq(a.doc)&&this.updateDraggedNode(this.dragging,f),"reset"==n?this.dom.scrollTop=0:"to selection"==n?this.scrollToSelection():r&&function({refDOM:a,refTop:b,stack:c}){let d=a?a.getBoundingClientRect().top:0;O(c,0==d?0:d-b)}(r)}scrollToSelection(){let a=this.domSelectionRange().focusNode;if(a&&this.dom.contains(1==a.nodeType?a:a.parentNode))if(this.someProp("handleScrollToSelection",a=>a(this)));else if(this.state.selection instanceof d.nh){let b=this.docView.domAfterPos(this.state.selection.from);1==b.nodeType&&M(this,b.getBoundingClientRect(),a)}else M(this,this.coordsAtPos(this.state.selection.head,1),a)}destroyPluginViews(){let a;for(;a=this.pluginViews.pop();)a.destroy&&a.destroy()}updatePluginViews(a){if(a&&a.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(let b=0;b<this.pluginViews.length;b++){let c=this.pluginViews[b];c.update&&c.update(this,a)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let a=0;a<this.directPlugins.length;a++){let b=this.directPlugins[a];b.spec.view&&this.pluginViews.push(b.spec.view(this))}for(let a=0;a<this.state.plugins.length;a++){let b=this.state.plugins[a];b.spec.view&&this.pluginViews.push(b.spec.view(this))}}}updateDraggedNode(a,b){let c=a.node,e=-1;if(this.state.doc.nodeAt(c.from)==c.node)e=c.from;else{let a=c.from+(this.state.doc.content.size-b.doc.content.size);(a>0&&this.state.doc.nodeAt(a))==c.node&&(e=a)}this.dragging=new bk(a.slice,a.move,e<0?void 0:d.nh.create(this.state.doc,e))}someProp(a,b){let c=this._props&&this._props[a],d;if(null!=c&&(d=b?b(c):c))return d;for(let c=0;c<this.directPlugins.length;c++){let e=this.directPlugins[c].props[a];if(null!=e&&(d=b?b(e):e))return d}let e=this.state.plugins;if(e)for(let c=0;c<e.length;c++){let f=e[c].props[a];if(null!=f&&(d=b?b(f):f))return d}}hasFocus(){if(y){let a=this.root.activeElement;if(a==this.dom)return!0;if(!a||!this.dom.contains(a))return!1;for(;a&&this.dom!=a&&this.dom.contains(a);){if("false"==a.contentEditable)return!1;a=a.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&function(a){if(a.setActive)return a.setActive();if(P)return a.focus(P);let b=N(a);a.focus(null==P?{get preventScroll(){return P={preventScroll:!0},!0}}:void 0),P||(P=!1,O(b,0))}(this.dom),aw(this),this.domObserver.start()}get root(){let a=this._root;if(null==a){for(let a=this.dom.parentNode;a;a=a.parentNode)if(9==a.nodeType||11==a.nodeType&&a.host)return a.getSelection||(Object.getPrototypeOf(a).getSelection=()=>a.ownerDocument.getSelection()),this._root=a}return a||document}updateRoot(){this._root=null}posAtCoords(a){return function(a,b){var c;let d,e,f=a.dom.ownerDocument,g,i=0,k=function(a,b,c){if(a.caretPositionFromPoint)try{let d=a.caretPositionFromPoint(b,c);if(d)return{node:d.offsetNode,offset:Math.min(o(d.offsetNode),d.offset)}}catch(a){}if(a.caretRangeFromPoint){let d=a.caretRangeFromPoint(b,c);if(d)return{node:d.startContainer,offset:Math.min(o(d.startContainer),d.startOffset)}}}(f,b.left,b.top);k&&({node:g,offset:i}=k);let l=(a.root.elementFromPoint?a.root:f).elementFromPoint(b.left,b.top);if(!l||!a.dom.contains(1!=l.nodeType?l.parentNode:l)){let c=a.dom.getBoundingClientRect();if(!Q(b,c)||!(l=function a(b,c,d){let e=b.childNodes.length;if(e&&d.top<d.bottom)for(let f=Math.max(0,Math.min(e-1,Math.floor(e*(c.top-d.top)/(d.bottom-d.top))-2)),g=f;;){let d=b.childNodes[g];if(1==d.nodeType){let b=d.getClientRects();for(let e=0;e<b.length;e++){let f=b[e];if(Q(c,f))return a(d,c,f)}}if((g=(g+1)%e)==f)break}return b}(a.dom,b,c)))return null}if(E)for(let a=l;g&&a;a=h(a))a.draggable&&(g=void 0);if(l=(d=(c=l).parentNode)&&/^li$/i.test(d.nodeName)&&b.left<c.getBoundingClientRect().left?d:c,g){let c;if(A&&1==g.nodeType&&(i=Math.min(i,g.childNodes.length))<g.childNodes.length){let a=g.childNodes[i],c;"IMG"==a.nodeName&&(c=a.getBoundingClientRect()).right<=b.left&&c.bottom>b.top&&i++}J&&i&&1==g.nodeType&&1==(c=g.childNodes[i-1]).nodeType&&"false"==c.contentEditable&&c.getBoundingClientRect().top>=b.top&&i--,g==a.dom&&i==g.childNodes.length-1&&1==g.lastChild.nodeType&&b.top>g.lastChild.getBoundingClientRect().bottom?e=a.state.doc.content.size:(0==i||1!=g.nodeType||"BR"!=g.childNodes[i-1].nodeName)&&(e=function(a,b,c,d){let e=-1;for(let c=b,f=!1;c!=a.dom;){let b=a.docView.nearestDesc(c,!0),g;if(!b)return null;if(1==b.dom.nodeType&&(b.node.isBlock&&b.parent||!b.contentDOM)&&((g=b.dom.getBoundingClientRect()).width||g.height)&&(b.node.isBlock&&b.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(b.dom.nodeName)&&(!f&&g.left>d.left||g.top>d.top?e=b.posBefore:(!f&&g.right<d.left||g.bottom<d.top)&&(e=b.posAfter),f=!0),!b.contentDOM&&e<0&&!b.node.isText))return(b.node.isBlock?d.top<(g.top+g.bottom)/2:d.left<(g.left+g.right)/2)?b.posBefore:b.posAfter;c=b.dom.parentNode}return e>-1?e:a.docView.posFromDOM(b,c,-1)}(a,g,i,b))}null==e&&(e=function(a,b,c){let{node:d,offset:e}=function a(b,c){let d,e,f,g=2e8,h,i=0,k=c.top,l=c.top;for(let a=b.firstChild,m=0;a;a=a.nextSibling,m++){let b;if(1==a.nodeType)b=a.getClientRects();else{if(3!=a.nodeType)continue;b=j(a).getClientRects()}for(let j=0;j<b.length;j++){let n=b[j];if(n.top<=k&&n.bottom>=l){k=Math.max(n.bottom,k),l=Math.min(n.top,l);let b=n.left>c.left?n.left-c.left:n.right<c.left?c.left-n.right:0;if(b<g){f=a,g=b,h=b&&3==f.nodeType?{left:n.right<c.left?n.right:n.left,top:c.top}:c,1==a.nodeType&&b&&(i=m+ +(c.left>=(n.left+n.right)/2));continue}}else n.top>c.top&&!d&&n.left<=c.left&&n.right>=c.left&&(d=a,e={left:Math.max(n.left,Math.min(n.right,c.left)),top:n.top});!f&&(c.left>=n.right&&c.top>=n.top||c.left>=n.left&&c.top>=n.bottom)&&(i=m+1)}}return(!f&&d&&(f=d,h=e,g=0),f&&3==f.nodeType)?function(a,b){let c=a.nodeValue.length,d=document.createRange(),e;for(let f=0;f<c;f++){d.setEnd(a,f+1),d.setStart(a,f);let c=S(d,1);if(c.top!=c.bottom&&Q(b,c)){e={node:a,offset:f+ +(b.left>=(c.left+c.right)/2)};break}}return d.detach(),e||{node:a,offset:0}}(f,h):!f||g&&1==f.nodeType?{node:b,offset:i}:a(f,h)}(b,c),f=-1;if(1==d.nodeType&&!d.firstChild){let a=d.getBoundingClientRect();f=a.left!=a.right&&c.left>(a.left+a.right)/2?1:-1}return a.docView.posFromDOM(d,e,f)}(a,l,b));let m=a.docView.nearestDesc(l,!0);return{pos:e,inside:m?m.posAtStart-m.border:-1}}(this,a)}coordsAtPos(a,b=1){return U(this,a,b)}domAtPos(a,b=0){return this.docView.domFromPos(a,b)}nodeDOM(a){let b=this.docView.descAt(a);return b?b.nodeDOM:null}posAtDOM(a,b,c=-1){let d=this.docView.posFromDOM(a,b,c);if(null==d)throw RangeError("DOM position not inside the editor");return d}endOfTextblock(a,b){return function(a,b,c){let d,e;return Z==b&&_==c?aa:(Z=b,_=c,aa="up"==c||"down"==c?(d=b.selection,e="up"==c?d.$from:d.$to,X(a,b,()=>{let{node:b}=a.docView.domFromPos(e.pos,"up"==c?-1:1);for(;;){let c=a.docView.nearestDesc(b,!0);if(!c)break;if(c.node.isBlock){b=c.contentDOM||c.dom;break}b=c.dom.parentNode}let d=U(a,e.pos,1);for(let a=b.firstChild;a;a=a.nextSibling){let b;if(1==a.nodeType)b=a.getClientRects();else{if(3!=a.nodeType)continue;b=j(a,0,a.nodeValue.length).getClientRects()}for(let a=0;a<b.length;a++){let e=b[a];if(e.bottom>e.top+1&&("up"==c?d.top-e.top>(e.bottom-d.top)*2:e.bottom-d.bottom>(d.bottom-e.top)*2))return!1}}return!0})):function(a,b,c){let{$head:d}=b.selection;if(!d.parent.isTextblock)return!1;let e=d.parentOffset,f=e==d.parent.content.size,g=a.domSelection();return g?Y.test(d.parent.textContent)&&g.modify?X(a,b,()=>{let{focusNode:b,focusOffset:e,anchorNode:f,anchorOffset:h}=a.domSelectionRange(),i=g.caretBidiLevel;g.modify("move",c,"character");let j=d.depth?a.docView.domAfterPos(d.before()):a.dom,{focusNode:k,focusOffset:l}=a.domSelectionRange(),m=k&&!j.contains(1==k.nodeType?k:k.parentNode)||b==k&&e==l;try{g.collapse(f,h),b&&(b!=f||e!=h)&&g.extend&&g.extend(b,e)}catch(a){}return null!=i&&(g.caretBidiLevel=i),m}):"left"==c||"backward"==c?!e:f:d.pos==d.start()||d.pos==d.end()}(a,b,c))}(this,b||this.state,a)}pasteHTML(a,b){return bi(this,"",a,!1,b||new ClipboardEvent("paste"))}pasteText(a,b){return bi(this,a,null,!0,b||new ClipboardEvent("paste"))}serializeForClipboard(a){return aS(this,a)}destroy(){if(this.docView){for(let a in this.domObserver.stop(),this.input.eventHandlers)this.dom.removeEventListener(a,this.input.eventHandlers[a]);clearTimeout(this.input.composingTimeout),clearTimeout(this.input.lastIOSEnterFallbackTimeout),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],bE(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,k()}}get isDestroyed(){return null==this.docView}dispatchEvent(a){!a6(this,a)&&a0[a.type]&&(this.editable||!(a.type in a1))&&a0[a.type](this,a)}domSelectionRange(){let a=this.domSelection();return a?E&&11===this.root.nodeType&&function(a){let b=a.activeElement;for(;b&&b.shadowRoot;)b=b.shadowRoot.activeElement;return b}(this.dom.ownerDocument)==this.dom&&function(a,b){let c;if(b.getComposedRanges){let c=b.getComposedRanges(a.root)[0];if(c)return bL(a,c)}function d(a){a.preventDefault(),a.stopImmediatePropagation(),c=a.getTargetRanges()[0]}return a.dom.addEventListener("beforeinput",d,!0),document.execCommand("indent"),a.dom.removeEventListener("beforeinput",d,!0),c?bL(a,c):null}(this,a)||a:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function bS(a){let b=Object.create(null);return b.class="ProseMirror",b.contenteditable=String(a.editable),a.someProp("attributes",c=>{if("function"==typeof c&&(c=c(a.state)),c)for(let a in c)"class"==a?b.class+=" "+c[a]:"style"==a?b.style=(b.style?b.style+";":"")+c[a]:b[a]||"contenteditable"==a||"nodeName"==a||(b[a]=String(c[a]))}),b.translate||(b.translate="no"),[br.node(0,a.state.doc.content.size,b)]}function bT(a){if(a.markCursor){let b=document.createElement("img");b.className="ProseMirror-separator",b.setAttribute("mark-placeholder","true"),b.setAttribute("alt",""),a.cursorWrapper={dom:b,deco:br.widget(a.state.selection.from,b,{raw:!0,marks:a.markCursor})}}else a.cursorWrapper=null}function bU(a){return!a.someProp("editable",b=>!1===b(a.state))}function bV(a){let b=Object.create(null);function c(a){for(let c in a)Object.prototype.hasOwnProperty.call(b,c)||(b[c]=a[c])}return a.someProp("nodeViews",c),a.someProp("markViews",c),b}function bW(a){if(a.spec.state||a.spec.filterTransaction||a.spec.appendTransaction)throw RangeError("Plugins passed directly to the view must not have a state component")}bR.prototype.dispatch=function(a){let b=this._props.dispatchTransaction;b?b.call(this,a):this.updateState(this.state.apply(a))}},670016:(a,b,c)=>{"use strict";Object.defineProperty(b,Symbol.toStringTag,{value:"Module"});let d=c(789253);b.property=function(a){return function(b){return d.get(b,a)}}},673977:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});var d=c(356103).Or},676029:(a,b,c)=>{"use strict";c.d(b,{q:()=>Y});var d=c(115962);function e(a){return Array.isArray?Array.isArray(a):"[object Array]"===l(a)}let f=1/0;function g(a){return"string"==typeof a}function h(a){return"number"==typeof a}function i(a){return"object"==typeof a}function j(a){return null!=a}function k(a){return!a.trim().length}function l(a){return null==a?void 0===a?"[object Undefined]":"[object Null]":Object.prototype.toString.call(a)}let m=Object.prototype.hasOwnProperty;class n{constructor(a){this._keys=[],this._keyMap={};let b=0;a.forEach(a=>{let c=o(a);this._keys.push(c),this._keyMap[c.id]=c,b+=c.weight}),this._keys.forEach(a=>{a.weight/=b})}get(a){return this._keyMap[a]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function o(a){let b=null,c=null,d=null,f=1,h=null;if(g(a)||e(a))d=a,b=p(a),c=q(a);else{if(!m.call(a,"name"))throw Error("Missing name property in key");let e=a.name;if(d=e,m.call(a,"weight")&&(f=a.weight)<=0)throw Error(`Property 'weight' in key '${e}' must be a positive integer`);b=p(e),c=q(e),h=a.getFn}return{path:b,id:c,weight:f,src:d,getFn:h}}function p(a){return e(a)?a:a.split(".")}function q(a){return e(a)?a.join("."):a}var r={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(a,b)=>a.score===b.score?a.idx<b.idx?-1:1:a.score<b.score?-1:1,includeMatches:!1,findAllMatches:!1,minMatchCharLength:1,location:0,threshold:.6,distance:100,useExtendedSearch:!1,getFn:function(a,b){let c=[],d=!1,k=(a,b,m)=>{if(j(a))if(b[m]){var n,o;let p=a[b[m]];if(!j(p))return;if(m===b.length-1&&(g(p)||h(p)||!0===(n=p)||!1===n||i(o=n)&&null!==o&&"[object Boolean]"==l(n)))c.push(null==p?"":function(a){if("string"==typeof a)return a;let b=a+"";return"0"==b&&1/a==-f?"-0":b}(p));else if(e(p)){d=!0;for(let a=0,c=p.length;a<c;a+=1)k(p[a],b,m+1)}else b.length&&k(p,b,m+1)}else c.push(a)};return k(a,g(b)?b.split("."):b,0),d?c:c[0]},ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1};let s=/[^ ]+/g;class t{constructor({getFn:a=r.getFn,fieldNormWeight:b=r.fieldNormWeight}={}){this.norm=function(a=1,b=3){let c=new Map,d=Math.pow(10,b);return{get(b){let e=b.match(s).length;if(c.has(e))return c.get(e);let f=parseFloat(Math.round(1/Math.pow(e,.5*a)*d)/d);return c.set(e,f),f},clear(){c.clear()}}}(b,3),this.getFn=a,this.isCreated=!1,this.setIndexRecords()}setSources(a=[]){this.docs=a}setIndexRecords(a=[]){this.records=a}setKeys(a=[]){this.keys=a,this._keysMap={},a.forEach((a,b)=>{this._keysMap[a.id]=b})}create(){!this.isCreated&&this.docs.length&&(this.isCreated=!0,g(this.docs[0])?this.docs.forEach((a,b)=>{this._addString(a,b)}):this.docs.forEach((a,b)=>{this._addObject(a,b)}),this.norm.clear())}add(a){let b=this.size();g(a)?this._addString(a,b):this._addObject(a,b)}removeAt(a){this.records.splice(a,1);for(let b=a,c=this.size();b<c;b+=1)this.records[b].i-=1}getValueForItemAtKeyId(a,b){return a[this._keysMap[b]]}size(){return this.records.length}_addString(a,b){if(!j(a)||k(a))return;let c={v:a,i:b,n:this.norm.get(a)};this.records.push(c)}_addObject(a,b){let c={i:b,$:{}};this.keys.forEach((b,d)=>{let f=b.getFn?b.getFn(a):this.getFn(a,b.path);if(j(f)){if(e(f)){let a=[],b=[{nestedArrIndex:-1,value:f}];for(;b.length;){let{nestedArrIndex:c,value:d}=b.pop();if(j(d))if(g(d)&&!k(d)){let b={v:d,i:c,n:this.norm.get(d)};a.push(b)}else e(d)&&d.forEach((a,c)=>{b.push({nestedArrIndex:c,value:a})})}c.$[d]=a}else if(g(f)&&!k(f)){let a={v:f,n:this.norm.get(f)};c.$[d]=a}}}),this.records.push(c)}toJSON(){return{keys:this.keys,records:this.records}}}function u(a,b,{getFn:c=r.getFn,fieldNormWeight:d=r.fieldNormWeight}={}){let e=new t({getFn:c,fieldNormWeight:d});return e.setKeys(a.map(o)),e.setSources(b),e.create(),e}function v(a,{errors:b=0,currentLocation:c=0,expectedLocation:d=0,distance:e=r.distance,ignoreLocation:f=r.ignoreLocation}={}){let g=b/a.length;if(f)return g;let h=Math.abs(d-c);return e?g+h/e:h?1:g}let w=String.prototype.normalize?a=>a.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,""):a=>a;class x{constructor(a,{location:b=r.location,threshold:c=r.threshold,distance:d=r.distance,includeMatches:e=r.includeMatches,findAllMatches:f=r.findAllMatches,minMatchCharLength:g=r.minMatchCharLength,isCaseSensitive:h=r.isCaseSensitive,ignoreDiacritics:i=r.ignoreDiacritics,ignoreLocation:j=r.ignoreLocation}={}){if(this.options={location:b,threshold:c,distance:d,includeMatches:e,findAllMatches:f,minMatchCharLength:g,isCaseSensitive:h,ignoreDiacritics:i,ignoreLocation:j},a=h?a:a.toLowerCase(),a=i?w(a):a,this.pattern=a,this.chunks=[],!this.pattern.length)return;let k=(a,b)=>{this.chunks.push({pattern:a,alphabet:function(a){let b={};for(let c=0,d=a.length;c<d;c+=1){let e=a.charAt(c);b[e]=(b[e]||0)|1<<d-c-1}return b}(a),startIndex:b})},l=this.pattern.length;if(l>32){let a=0,b=l%32,c=l-b;for(;a<c;)k(this.pattern.substr(a,32),a),a+=32;if(b){let a=l-32;k(this.pattern.substr(a),a)}}else k(this.pattern,0)}searchIn(a){let{isCaseSensitive:b,ignoreDiacritics:c,includeMatches:d}=this.options;if(a=b?a:a.toLowerCase(),a=c?w(a):a,this.pattern===a){let b={isMatch:!0,score:0};return d&&(b.indices=[[0,a.length-1]]),b}let{location:e,distance:f,threshold:g,findAllMatches:h,minMatchCharLength:i,ignoreLocation:j}=this.options,k=[],l=0,m=!1;this.chunks.forEach(({pattern:b,alphabet:c,startIndex:n})=>{let{isMatch:o,score:p,indices:q}=function(a,b,c,{location:d=r.location,distance:e=r.distance,threshold:f=r.threshold,findAllMatches:g=r.findAllMatches,minMatchCharLength:h=r.minMatchCharLength,includeMatches:i=r.includeMatches,ignoreLocation:j=r.ignoreLocation}={}){let k;if(b.length>32)throw Error("Pattern length exceeds max of 32.");let l=b.length,m=a.length,n=Math.max(0,Math.min(d,m)),o=f,p=n,q=h>1||i,s=q?Array(m):[];for(;(k=a.indexOf(b,p))>-1;)if(o=Math.min(v(b,{currentLocation:k,expectedLocation:n,distance:e,ignoreLocation:j}),o),p=k+l,q){let a=0;for(;a<l;)s[k+a]=1,a+=1}p=-1;let t=[],u=1,w=l+m,x=1<<l-1;for(let d=0;d<l;d+=1){let f=0,h=w;for(;f<h;)v(b,{errors:d,currentLocation:n+h,expectedLocation:n,distance:e,ignoreLocation:j})<=o?f=h:w=h,h=Math.floor((w-f)/2+f);w=h;let i=Math.max(1,n-h+1),k=g?m:Math.min(n+h,m)+l,r=Array(k+2);r[k+1]=(1<<d)-1;for(let f=k;f>=i;f-=1){let g=f-1,h=c[a.charAt(g)];if(q&&(s[g]=+!!h),r[f]=(r[f+1]<<1|1)&h,d&&(r[f]|=(t[f+1]|t[f])<<1|1|t[f+1]),r[f]&x&&(u=v(b,{errors:d,currentLocation:g,expectedLocation:n,distance:e,ignoreLocation:j}))<=o){if(o=u,(p=g)<=n)break;i=Math.max(1,2*n-p)}}if(v(b,{errors:d+1,currentLocation:n,expectedLocation:n,distance:e,ignoreLocation:j})>o)break;t=r}let y={isMatch:p>=0,score:Math.max(.001,u)};if(q){let a=function(a=[],b=r.minMatchCharLength){let c=[],d=-1,e=-1,f=0;for(let g=a.length;f<g;f+=1){let g=a[f];g&&-1===d?d=f:g||-1===d||((e=f-1)-d+1>=b&&c.push([d,e]),d=-1)}return a[f-1]&&f-d>=b&&c.push([d,f-1]),c}(s,h);a.length?i&&(y.indices=a):y.isMatch=!1}return y}(a,b,c,{location:e+n,distance:f,threshold:g,findAllMatches:h,minMatchCharLength:i,includeMatches:d,ignoreLocation:j});o&&(m=!0),l+=p,o&&q&&(k=[...k,...q])});let n={isMatch:m,score:m?l/this.chunks.length:1};return m&&d&&(n.indices=k),n}}class y{constructor(a){this.pattern=a}static isMultiMatch(a){return z(a,this.multiRegex)}static isSingleMatch(a){return z(a,this.singleRegex)}search(){}}function z(a,b){let c=a.match(b);return c?c[1]:null}class A extends y{constructor(a){super(a)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(a){let b=a===this.pattern;return{isMatch:b,score:+!b,indices:[0,this.pattern.length-1]}}}class B extends y{constructor(a){super(a)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(a){let b=-1===a.indexOf(this.pattern);return{isMatch:b,score:+!b,indices:[0,a.length-1]}}}class C extends y{constructor(a){super(a)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(a){let b=a.startsWith(this.pattern);return{isMatch:b,score:+!b,indices:[0,this.pattern.length-1]}}}class D extends y{constructor(a){super(a)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(a){let b=!a.startsWith(this.pattern);return{isMatch:b,score:+!b,indices:[0,a.length-1]}}}class E extends y{constructor(a){super(a)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(a){let b=a.endsWith(this.pattern);return{isMatch:b,score:+!b,indices:[a.length-this.pattern.length,a.length-1]}}}class F extends y{constructor(a){super(a)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(a){let b=!a.endsWith(this.pattern);return{isMatch:b,score:+!b,indices:[0,a.length-1]}}}class G extends y{constructor(a,{location:b=r.location,threshold:c=r.threshold,distance:d=r.distance,includeMatches:e=r.includeMatches,findAllMatches:f=r.findAllMatches,minMatchCharLength:g=r.minMatchCharLength,isCaseSensitive:h=r.isCaseSensitive,ignoreDiacritics:i=r.ignoreDiacritics,ignoreLocation:j=r.ignoreLocation}={}){super(a),this._bitapSearch=new x(a,{location:b,threshold:c,distance:d,includeMatches:e,findAllMatches:f,minMatchCharLength:g,isCaseSensitive:h,ignoreDiacritics:i,ignoreLocation:j})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(a){return this._bitapSearch.searchIn(a)}}class H extends y{constructor(a){super(a)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(a){let b,c=0,d=[],e=this.pattern.length;for(;(b=a.indexOf(this.pattern,c))>-1;)c=b+e,d.push([b,c-1]);let f=!!d.length;return{isMatch:f,score:+!f,indices:d}}}let I=[A,H,C,D,F,E,B,G],J=I.length,K=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,L=new Set([G.type,H.type]);class M{constructor(a,{isCaseSensitive:b=r.isCaseSensitive,ignoreDiacritics:c=r.ignoreDiacritics,includeMatches:d=r.includeMatches,minMatchCharLength:e=r.minMatchCharLength,ignoreLocation:f=r.ignoreLocation,findAllMatches:g=r.findAllMatches,location:h=r.location,threshold:i=r.threshold,distance:j=r.distance}={}){this.query=null,this.options={isCaseSensitive:b,ignoreDiacritics:c,includeMatches:d,minMatchCharLength:e,findAllMatches:g,ignoreLocation:f,location:h,threshold:i,distance:j},a=b?a:a.toLowerCase(),a=c?w(a):a,this.pattern=a,this.query=function(a,b={}){return a.split("|").map(a=>{let c=a.trim().split(K).filter(a=>a&&!!a.trim()),d=[];for(let a=0,e=c.length;a<e;a+=1){let e=c[a],f=!1,g=-1;for(;!f&&++g<J;){let a=I[g],c=a.isMultiMatch(e);c&&(d.push(new a(c,b)),f=!0)}if(!f)for(g=-1;++g<J;){let a=I[g],c=a.isSingleMatch(e);if(c){d.push(new a(c,b));break}}}return d})}(this.pattern,this.options)}static condition(a,b){return b.useExtendedSearch}searchIn(a){let b=this.query;if(!b)return{isMatch:!1,score:1};let{includeMatches:c,isCaseSensitive:d,ignoreDiacritics:e}=this.options;a=d?a:a.toLowerCase(),a=e?w(a):a;let f=0,g=[],h=0;for(let d=0,e=b.length;d<e;d+=1){let e=b[d];g.length=0,f=0;for(let b=0,d=e.length;b<d;b+=1){let d=e[b],{isMatch:i,indices:j,score:k}=d.search(a);if(i){if(f+=1,h+=k,c){let a=d.constructor.type;L.has(a)?g=[...g,...j]:g.push(j)}}else{h=0,f=0,g.length=0;break}}if(f){let a={isMatch:!0,score:h/f};return c&&(a.indices=g),a}}return{isMatch:!1,score:1}}}let N=[];function O(a,b){for(let c=0,d=N.length;c<d;c+=1){let d=N[c];if(d.condition(a,b))return new d(a,b)}return new x(a,b)}let P={AND:"$and",OR:"$or"},Q={PATH:"$path",PATTERN:"$val"},R=a=>!!(a[P.AND]||a[P.OR]),S=a=>({[P.AND]:Object.keys(a).map(b=>({[b]:a[b]}))});function T(a,b,{auto:c=!0}={}){let d=a=>{let f=Object.keys(a),h=!!a[Q.PATH];if(!h&&f.length>1&&!R(a))return d(S(a));if(!e(a)&&i(a)&&!R(a)){let d=h?a[Q.PATH]:f[0],e=h?a[Q.PATTERN]:a[d];if(!g(e))throw Error(`Invalid value for key ${d}`);let i={keyId:q(d),pattern:e};return c&&(i.searcher=O(e,b)),i}let j={children:[],operator:f[0]};return f.forEach(b=>{let c=a[b];e(c)&&c.forEach(a=>{j.children.push(d(a))})}),j};return R(a)||(a=S(a)),d(a)}function U(a,b){let c=a.matches;b.matches=[],j(c)&&c.forEach(a=>{if(!j(a.indices)||!a.indices.length)return;let{indices:c,value:d}=a,e={indices:c,value:d};a.key&&(e.key=a.key.src),a.idx>-1&&(e.refIndex=a.idx),b.matches.push(e)})}function V(a,b){b.score=a.score}class W{constructor(a,b={},c){this.options={...r,...b},this.options.useExtendedSearch,this._keyStore=new n(this.options.keys),this.setCollection(a,c)}setCollection(a,b){if(this._docs=a,b&&!(b instanceof t))throw Error("Incorrect 'index' type");this._myIndex=b||u(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(a){j(a)&&(this._docs.push(a),this._myIndex.add(a))}remove(a=()=>!1){let b=[];for(let c=0,d=this._docs.length;c<d;c+=1){let e=this._docs[c];a(e,c)&&(this.removeAt(c),c-=1,d-=1,b.push(e))}return b}removeAt(a){this._docs.splice(a,1),this._myIndex.removeAt(a)}getIndex(){return this._myIndex}search(a,{limit:b=-1}={}){let{includeMatches:c,includeScore:d,shouldSort:e,sortFn:f,ignoreFieldNorm:i}=this.options,j=g(a)?g(this._docs[0])?this._searchStringList(a):this._searchObjectList(a):this._searchLogical(a);return!function(a,{ignoreFieldNorm:b=r.ignoreFieldNorm}){a.forEach(a=>{let c=1;a.matches.forEach(({key:a,norm:d,score:e})=>{let f=a?a.weight:null;c*=Math.pow(0===e&&f?Number.EPSILON:e,(f||1)*(b?1:d))}),a.score=c})}(j,{ignoreFieldNorm:i}),e&&j.sort(f),h(b)&&b>-1&&(j=j.slice(0,b)),function(a,b,{includeMatches:c=r.includeMatches,includeScore:d=r.includeScore}={}){let e=[];return c&&e.push(U),d&&e.push(V),a.map(a=>{let{idx:c}=a,d={item:b[c],refIndex:c};return e.length&&e.forEach(b=>{b(a,d)}),d})}(j,this._docs,{includeMatches:c,includeScore:d})}_searchStringList(a){let b=O(a,this.options),{records:c}=this._myIndex,d=[];return c.forEach(({v:a,i:c,n:e})=>{if(!j(a))return;let{isMatch:f,score:g,indices:h}=b.searchIn(a);f&&d.push({item:a,idx:c,matches:[{score:g,value:a,norm:e,indices:h}]})}),d}_searchLogical(a){let b=T(a,this.options),c=(a,b,d)=>{if(!a.children){let{keyId:c,searcher:e}=a,f=this._findMatches({key:this._keyStore.get(c),value:this._myIndex.getValueForItemAtKeyId(b,c),searcher:e});return f&&f.length?[{idx:d,item:b,matches:f}]:[]}let e=[];for(let f=0,g=a.children.length;f<g;f+=1){let g=c(a.children[f],b,d);if(g.length)e.push(...g);else if(a.operator===P.AND)return[]}return e},d=this._myIndex.records,e={},f=[];return d.forEach(({$:a,i:d})=>{if(j(a)){let g=c(b,a,d);g.length&&(e[d]||(e[d]={idx:d,item:a,matches:[]},f.push(e[d])),g.forEach(({matches:a})=>{e[d].matches.push(...a)}))}}),f}_searchObjectList(a){let b=O(a,this.options),{keys:c,records:d}=this._myIndex,e=[];return d.forEach(({$:a,i:d})=>{if(!j(a))return;let f=[];c.forEach((c,d)=>{f.push(...this._findMatches({key:c,value:a[d],searcher:b}))}),f.length&&e.push({idx:d,item:a,matches:f})}),e}_findMatches({key:a,value:b,searcher:c}){if(!j(b))return[];let d=[];if(e(b))b.forEach(({v:b,i:e,n:f})=>{if(!j(b))return;let{isMatch:g,score:h,indices:i}=c.searchIn(b);g&&d.push({score:h,key:a,value:b,idx:e,norm:f,indices:i})});else{let{v:e,n:f}=b,{isMatch:g,score:h,indices:i}=c.searchIn(e);g&&d.push({score:h,key:a,value:e,norm:f,indices:i})}return d}}W.version="7.1.0",W.createIndex=u,W.parseIndex=function(a,{getFn:b=r.getFn,fieldNormWeight:c=r.fieldNormWeight}={}){let{keys:d,records:e}=a,f=new t({getFn:b,fieldNormWeight:c});return f.setKeys(d),f.setIndexRecords(e),f},W.config=r,W.parseQuery=T,function(...a){N.push(...a)}(M);let X={keys:[{name:"label",weight:3},{name:"sublabel",weight:1},{name:"objectName",weight:1.5},{name:"fieldValues",weight:2}],threshold:.4,distance:200,includeScore:!0,shouldSort:!0,minMatchCharLength:1};function Y(a){let[b,c]=(0,d.useState)([]),[e,f]=(0,d.useState)(!0),g=(0,d.useRef)(!0);(0,d.useCallback)(async()=>{try{let a=await fetch("/api/workspace/search-index"),b=await a.json();g.current&&(c(b.items??[]),f(!1))}catch{g.current&&f(!1)}},[]);let h=(0,d.useMemo)(()=>0===b.length?null:new W(b.map(a=>({...a,fieldValues:a.fields?Object.values(a.fields).join(" "):void 0})),X),[b]),i=(0,d.useCallback)((a,c=20)=>a.trim()?h?h.search(a,{limit:c}).map(a=>a.item):[]:[...b].toSorted((a,b)=>{let c={object:0,file:1,entry:2};return(c[a.kind]??9)-(c[b.kind]??9)}).slice(0,c),[h,b]),j=(0,d.useRef)(i);return j.current=i,{items:b,loading:e,search:(0,d.useCallback)((a,b)=>j.current(a,b),[])}}},681560:(a,b,c)=>{"use strict";c.d(b,{I:()=>n});var d=c(736927),e=c(115962),f=c(681713),g=c(612563),h=c(379924),i=c(18886),j=c(130526);function k(a){return null==a?"":"string"==typeof a?a:"number"==typeof a||"boolean"==typeof a||"bigint"==typeof a?String(a):"object"==typeof a?JSON.stringify(a):""}function l({entry:a,fields:b,titleField:c,coverField:l,onEntryClick:m}){let n=k(a.entry_id??a.id),o=function(a,b,c){if(c){let b=k(a[c]);if(b)return b}let d=b.find(a=>"text"===a.type&&/name|title/i.test(a.name))??b.find(a=>"text"===a.type);return d?k(a[d.name]):k(a.id)}(a,b,c),p=(0,j.I)(a,b),q=(0,e.useMemo)(()=>b.filter(a=>a.name!==c&&a.name!==l).slice(0,4),[b,c,l]),r=b.find(a=>"enum"===a.type&&a.enum_values?.length),s=r?k(a[r.name]):null,t=r&&s?function(a,b){if(!a||!b.enum_values)return null;let c=b.enum_values.indexOf(a);return{text:a,color:c>=0&&b.enum_colors?.[c]?b.enum_colors[c]:"#94a3b8"}}(s,r):null;return(0,d.jsxs)("button",{type:"button",onClick:()=>m?.(n),className:"text-left rounded-xl border p-4 hover:shadow-md transition-all cursor-pointer w-full group",style:{borderColor:"var(--color-border)",background:"var(--color-surface)"},children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-2 mb-2",children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-start gap-2",children:[p?.faviconUrl&&(0,d.jsx)(i.A,{src:p.faviconUrl,className:"w-4 h-4 rounded-[4px] shrink-0 mt-0.5"}),(0,d.jsx)("h4",{className:"text-[13px] font-semibold leading-tight line-clamp-2 group-hover:underline",style:{color:"var(--color-text)"},children:o||"Untitled"})]}),t&&(0,d.jsx)("span",{className:"text-[10px] px-2 py-0.5 rounded-full flex-shrink-0 whitespace-nowrap",style:{backgroundColor:t.color,color:"#fff"},children:t.text})]}),(0,d.jsx)("div",{className:"flex flex-col gap-1.5",children:q.map(b=>{let c=a[b.name];if(null==c||""===k(c))return null;let e="tags"===b.type?(0,h.k)(c):[];return(0,d.jsxs)("div",{className:"flex items-baseline gap-2",children:[(0,d.jsx)("span",{className:"text-[10px] flex-shrink-0 min-w-[60px]",style:{color:"var(--color-text-muted)"},children:b.name}),(0,d.jsx)("div",{className:"text-[12px] whitespace-pre-line line-clamp-2",style:{color:"var(--color-text)"},children:"tags"===b.type?(0,d.jsxs)("span",{className:"flex items-center gap-0.5 flex-wrap",children:[e.slice(0,3).map(a=>{let b=(0,g.KJ)(a),c="link"===b.kind&&b.href,e="url"===b.linkType&&!!b.faviconUrl;return c?(0,d.jsxs)("a",{href:b.href,target:"url"===b.linkType||"file"===b.linkType?"_blank":void 0,rel:"url"===b.linkType||"file"===b.linkType?"noopener noreferrer":void 0,onClick:a=>a.stopPropagation(),className:"inline-flex items-center gap-1 px-1.5 py-0 rounded text-[11px] font-medium hover:underline underline-offset-2 max-w-[220px]",style:{background:"rgba(148, 163, 184, 0.12)",color:"var(--color-accent)"},children:[e&&(0,d.jsx)(i.A,{src:b.faviconUrl,className:"w-3 h-3 rounded-[2px] shrink-0"}),(0,d.jsx)("span",{className:"min-w-0 truncate",children:b.text})]},a):(0,d.jsx)("span",{className:"inline-flex items-center px-1.5 py-0 rounded text-[11px] font-medium",style:{background:"rgba(148, 163, 184, 0.12)",color:"var(--color-text-muted)"},children:a},a)}),e.length>3&&(0,d.jsxs)("span",{className:"text-[10px]",style:{color:"var(--color-text-muted)"},children:["+",e.length-3]})]}):(0,d.jsx)(f.E,{value:c,fieldType:b.type,mode:"table",showUrlFavicon:!0})})]},b.id)})}),null!=a.created_at&&(0,d.jsx)("div",{className:"mt-3 text-[10px]",style:{color:"var(--color-text-muted)",opacity:.6},children:k(a.created_at).slice(0,10)})]})}function m(){return(0,d.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 gap-2",children:[(0,d.jsxs)("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",style:{color:"var(--color-text-muted)",opacity:.4},children:[(0,d.jsx)("rect",{width:"7",height:"7",x:"3",y:"3",rx:"1"}),(0,d.jsx)("rect",{width:"7",height:"7",x:"14",y:"3",rx:"1"}),(0,d.jsx)("rect",{width:"7",height:"7",x:"3",y:"14",rx:"1"}),(0,d.jsx)("rect",{width:"7",height:"7",x:"14",y:"14",rx:"1"})]}),(0,d.jsx)("span",{className:"text-sm",style:{color:"var(--color-text-muted)"},children:"No entries to display in gallery view."})]})}function n({objectName:a,fields:b,entries:c,titleField:e,coverField:f,members:g,relationLabels:h,onEntryClick:i}){return 0===c.length?(0,d.jsx)(m,{}):(0,d.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3",children:c.map(a=>(0,d.jsx)(l,{entry:a,fields:b,titleField:e,coverField:f,onEntryClick:i},k(a.entry_id??a.id)))})}},681713:(a,b,c)=>{"use strict";c.d(b,{E:()=>m});var d=c(736927),e=c(115962),f=c(612563),g=c(18886),h=c(545182),i=c(888973);function j(){return(0,d.jsx)("span",{style:{color:"var(--color-text-muted)",opacity:.5},children:"--"})}function k({mediaType:a,url:b,label:c}){return"image"===a?(0,d.jsx)("div",{className:"mt-2 rounded-lg overflow-hidden border",style:{borderColor:"var(--color-border)"},children:(0,d.jsx)("img",{src:b,alt:c,className:"max-h-64 w-auto"})}):"video"===a?(0,d.jsx)("video",{src:b,controls:!0,className:"mt-2 w-full max-h-72 rounded-lg border",style:{borderColor:"var(--color-border)",background:"#000"}}):"audio"===a?(0,d.jsx)("audio",{src:b,controls:!0,className:"mt-2 w-full"}):(0,d.jsx)("iframe",{src:`${b}#toolbar=0&navpanes=0&scrollbar=1`,title:c,className:"mt-2 w-full h-72 rounded-lg border",style:{borderColor:"var(--color-border)",background:"white"}})}function l({text:a,fieldType:b,showUrlFavicon:c=!1,linkInteractionMode:e="inline",isTableMode:j=!1}){let k=a.trim();if(!k)return(0,d.jsx)(d.Fragment,{children:a});let l=b&&"text"!==b&&"richtext"!==b?b:void 0,m=(0,f.KJ)(k,l);if("link"===m.kind&&m.href){if(!l&&"file"===m.linkType&&k.includes(" "))return(0,d.jsx)(d.Fragment,{children:m.text});let a="url"===m.linkType||"file"===m.linkType,b=c&&"url"===m.linkType&&!!m.faviconUrl;if("button"===e){let c=(0,d.jsxs)("span",{className:"inline-flex min-w-0 max-w-full items-center gap-1.5 align-middle",style:{color:"var(--color-accent)"},children:[b&&(0,d.jsx)(g.A,{src:m.faviconUrl}),(0,d.jsx)("span",{className:j?"min-w-0 truncate":"min-w-0 break-all",children:m.text}),(0,d.jsx)(h.x,{href:m.href,openInNewTab:a,className:"inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-sm hover:bg-black/5"})]});return"url"===m.linkType?(0,d.jsx)(i.k,{href:m.href,children:c}):c}return(0,d.jsx)(i.U,{href:m.href,text:m.text,linkType:m.linkType??"url",faviconUrl:m.faviconUrl,showFavicon:b})}return"number"===m.kind||"currency"===m.kind?(0,d.jsx)("span",{className:"tabular-nums",children:m.text}):(0,d.jsx)(d.Fragment,{children:m.text})}function m({value:a,fieldType:b,mode:c="table",className:m,showUrlFavicon:n=!1,linkInteractionMode:o="inline"}){let p=(0,f.KJ)(a,b),q="table"===c;if("empty"===p.kind)return(0,d.jsx)(j,{});let r=p.text.replace(/\\r\\n/g,"\n").replace(/\\n/g,"\n").replace(/\\r/g,"\n");if(r.includes("\n")){let a=r.split("\n"),c=m??(q?"block max-w-[300px] line-clamp-3":"break-words");return(0,d.jsx)("span",{className:c,children:a.map((a,c)=>(0,d.jsxs)(e.Fragment,{children:[c>0&&(0,d.jsx)("br",{}),(0,d.jsx)(l,{text:a,fieldType:b,showUrlFavicon:n,linkInteractionMode:o,isTableMode:q})]},c))})}let s=m??(q?"truncate block max-w-[300px]":"break-words");if("link"===p.kind&&p.href){let a="url"===p.linkType||"file"===p.linkType,b=!q&&!!p.embedUrl&&!!p.mediaType,c=n&&"url"===p.linkType&&!!p.faviconUrl;if("button"===o){let e=(0,d.jsxs)("div",{className:q?"block max-w-[300px]":"w-full",children:[(0,d.jsxs)("span",{className:"flex w-full min-w-0 items-center gap-1.5",style:{color:"var(--color-accent)"},children:[c&&(0,d.jsx)(g.A,{src:p.faviconUrl}),(0,d.jsx)("span",{className:q?"min-w-0 truncate":"min-w-0 break-all",children:p.text}),(0,d.jsx)(h.x,{href:p.href,openInNewTab:a})]}),b&&(0,d.jsx)(k,{mediaType:p.mediaType,url:p.embedUrl,label:p.text})]});return"url"===p.linkType?(0,d.jsx)(i.k,{href:p.href,children:e}):e}return(0,d.jsxs)("div",{className:q?"block max-w-[300px]":"w-full",children:[(0,d.jsx)(i.U,{href:p.href,text:p.text,linkType:p.linkType??"url",faviconUrl:p.faviconUrl,showFavicon:c,layout:"block",className:q?"truncate":""}),b&&(0,d.jsx)(k,{mediaType:p.mediaType,url:p.embedUrl,label:p.text})]})}return"number"===p.kind||"currency"===p.kind?(0,d.jsx)("span",{className:`tabular-nums ${s}`,children:p.text}):(0,d.jsx)("span",{className:s,children:r})}},685233:(a,b,c)=>{"use strict";c.d(b,{X:()=>a6,S:()=>a7});var d=c(736927),e=c(115962),f=c(213505),g=c(492081),h=c(755726),i=c(922123),j=c(478105),k=c(363269),l=c(515016),m=c(558287),n=c(631608),o=c(846069),p=c(744277),q=c(68200),r=c(316780),s=c(398367),t=c(405287),u=c(587464),v=c(173961),w=c(760687),x=c(840512);let y=e.createContext(void 0),z=e.createContext(void 0),A=e.createContext(void 0),B=e.createContext("");function C(){let a=e.useContext(y);if(!a)throw Error((0,x.A)(22));return a}function D(){let a=e.useContext(z);if(!a)throw Error((0,x.A)(23));return a}function E(){let a=e.useContext(A);if(!a)throw Error((0,x.A)(24));return a}var F=c(569869);let G=(a,b)=>Object.is(a,b);function H(a,b,c){return null==a||null==b?Object.is(a,b):c(a,b)}function I(a,b,c){return a&&0!==a.length?a.findIndex(a=>void 0!==a&&H(a,b,c)):-1}function J(a){if(null==a)return"";if("string"==typeof a)return a;try{return JSON.stringify(a)}catch{return String(a)}}function K(a){return null!=a&&a.length>0&&"object"==typeof a[0]&&null!=a[0]&&"items"in a[0]}function L(a,b){if(b&&null!=a)return b(a)??"";if(a&&"object"==typeof a){if("label"in a&&null!=a.label)return String(a.label);if("value"in a)return String(a.value)}return J(a)}function M(a,b){return b&&null!=a?b(a)??"":a&&"object"==typeof a&&"value"in a&&"label"in a?J(a.value):J(a)}let N={id:(0,F.M)(a=>a.id),query:(0,F.M)(a=>a.query),items:(0,F.M)(a=>a.items),selectedValue:(0,F.M)(a=>a.selectedValue),hasSelectionChips:(0,F.M)(a=>{let b=a.selectedValue;return Array.isArray(b)&&b.length>0}),hasSelectedValue:(0,F.M)(a=>{let{selectedValue:b,selectionMode:c}=a;return null!=b&&(!("multiple"===c&&Array.isArray(b))||b.length>0)}),hasNullItemLabel:(0,F.M)((a,b)=>!!b&&function(a){if(!Array.isArray(a))return null!=a&&!("null"in a);if(K(a)){for(let b of a)for(let a of b.items)if(a&&null==a.value&&null!=a.label)return!0;return!1}for(let b of a)if(b&&null==b.value&&null!=b.label)return!0;return!1}(a.items)),open:(0,F.M)(a=>a.open),mounted:(0,F.M)(a=>a.mounted),forceMounted:(0,F.M)(a=>a.forceMounted),inline:(0,F.M)(a=>a.inline),activeIndex:(0,F.M)(a=>a.activeIndex),selectedIndex:(0,F.M)(a=>a.selectedIndex),isActive:(0,F.M)((a,b)=>a.activeIndex===b),isSelected:(0,F.M)((a,b)=>{let c=a.isItemEqualToValue,d=a.selectedValue;return Array.isArray(d)?d.some(a=>H(b,a,c)):H(b,d,c)}),transitionStatus:(0,F.M)(a=>a.transitionStatus),popupProps:(0,F.M)(a=>a.popupProps),inputProps:(0,F.M)(a=>a.inputProps),triggerProps:(0,F.M)(a=>a.triggerProps),getItemProps:(0,F.M)(a=>a.getItemProps),positionerElement:(0,F.M)(a=>a.positionerElement),listElement:(0,F.M)(a=>a.listElement),triggerElement:(0,F.M)(a=>a.triggerElement),inputElement:(0,F.M)(a=>a.inputElement),popupSide:(0,F.M)(a=>a.popupSide),openMethod:(0,F.M)(a=>a.openMethod),inputInsidePopup:(0,F.M)(a=>a.inputInsidePopup),selectionMode:(0,F.M)(a=>a.selectionMode),listRef:(0,F.M)(a=>a.listRef),labelsRef:(0,F.M)(a=>a.labelsRef),popupRef:(0,F.M)(a=>a.popupRef),emptyRef:(0,F.M)(a=>a.emptyRef),inputRef:(0,F.M)(a=>a.inputRef),keyboardActiveRef:(0,F.M)(a=>a.keyboardActiveRef),chipsContainerRef:(0,F.M)(a=>a.chipsContainerRef),clearRef:(0,F.M)(a=>a.clearRef),valuesRef:(0,F.M)(a=>a.valuesRef),allValuesRef:(0,F.M)(a=>a.allValuesRef),name:(0,F.M)(a=>a.name),disabled:(0,F.M)(a=>a.disabled),readOnly:(0,F.M)(a=>a.readOnly),required:(0,F.M)(a=>a.required),grid:(0,F.M)(a=>a.grid),isGrouped:(0,F.M)(a=>a.isGrouped),virtualized:(0,F.M)(a=>a.virtualized),onOpenChangeComplete:(0,F.M)(a=>a.onOpenChangeComplete),openOnInputClick:(0,F.M)(a=>a.openOnInputClick),itemToStringLabel:(0,F.M)(a=>a.itemToStringLabel),isItemEqualToValue:(0,F.M)(a=>a.isItemEqualToValue),modal:(0,F.M)(a=>a.modal),autoHighlight:(0,F.M)(a=>a.autoHighlight),submitOnItemClick:(0,F.M)(a=>a.submitOnItemClick)};var O=c(230652),P=c(577225);let Q=function(a){return a.disabled="data-disabled",a.valid="data-valid",a.invalid="data-invalid",a.touched="data-touched",a.dirty="data-dirty",a.filled="data-filled",a.focused="data-focused",a}({}),R=e.createContext({invalid:void 0,name:void 0,validityData:{state:{badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},errors:[],error:"",value:"",initialValue:null},setValidityData:P.tE,disabled:void 0,touched:!1,setTouched:P.tE,dirty:!1,setDirty:P.tE,filled:!1,setFilled:P.tE,focused:!1,setFocused:P.tE,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:{disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},markedDirtyRef:{current:!1},validation:{getValidationProps:(a=P.t0)=>a,getInputValidationProps:(a=P.t0)=>a,inputRef:{current:null},commit:async()=>{}}});function S(a=!0){let b=e.useContext(R);if(b.setValidityData===P.tE&&!a)throw Error((0,x.A)(28));return b}var T=c(249855);let U=e.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:P.tE,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function V(){return e.useContext(U)}var W=c(725427),X=c(840507);let Y=e.createContext({controlId:void 0,registerControlId:P.tE,labelId:void 0,setLabelId:P.tE,messageIds:[],setMessageIds:P.tE,getDescriptionProps:a=>a});function Z(){return e.useContext(Y)}let _=new Map;var aa=c(735328),ab=c(192083);function ac(a,b){let c=e.useRef(a),d=(0,i.K)(b);(0,g.g)(()=>{c.current!==a&&d(c.current)},[a,d]),(0,g.g)(()=>{c.current=a},[a])}let ad=Symbol("none"),ae={value:ad,index:-1};function af(a){let b,c,x,{id:C,onOpenChangeComplete:D,defaultSelectedValue:E=null,selectedValue:F,onSelectedValueChange:J,defaultInputValue:Q,inputValue:R,selectionMode:U="none",onItemHighlighted:Y,name:af,disabled:ag=!1,readOnly:ah=!1,required:ai=!1,inputRef:aj,grid:ak=!1,items:al,filteredItems:am,filter:an,openOnInputClick:ao=!0,autoHighlight:ap=!1,keepHighlight:aq=!1,highlightItemOnHover:ar=!0,loopFocus:as=!0,itemToStringLabel:at,itemToStringValue:au,isItemEqualToValue:av=G,virtualized:aw=!1,inline:ax=!1,fillInputOnItemPress:ay=!0,modal:az=!1,limit:aA=-1,autoComplete:aB="list",formAutoComplete:aC,locale:aD,submitOnItemClick:aE=!1}=a,{clearErrors:aF}=V(),{setDirty:aG,validityData:aH,shouldValidateOnChange:aI,setFilled:aJ,name:aK,disabled:aL,setTouched:aM,setFocused:aN,validationMode:aO,validation:aP}=S(),aQ=function(a={}){let{id:b,implicit:c=!1,controlRef:d}=a,{controlId:f,registerControlId:h}=Z(),j=(0,X.e)(b),k=c?f:void 0,m=(0,l.j)(()=>Symbol("labelable-control")),n=e.useRef(!1),o=e.useRef(null!=b),p=(0,i.K)(()=>{n.current&&h!==P.tE&&(n.current=!1,h(m.current,void 0))});return(0,g.g)(()=>{let a;if(h!==P.tE){if(c){let c=d?.current;a=(0,W.vq)(c)&&null!=c.closest("label")?b??null:k??j}else if(null!=b)o.current=!0,a=b;else{if(!o.current)return void p();a=j}if(void 0===a)return void p();n.current=!0,h(m.current,a)}},[b,d,k,h,c,j,m,p]),e.useEffect(()=>p,[p]),f??j}({id:C}),aR=function(a={}){let b={usage:"search",sensitivity:"base",ignorePunctuation:!0,...a},c=`${function a(b){return Array.isArray(b)?b.map(b=>a(b)).join(","):null==b?"":String(b)}(a.locale)}|${JSON.stringify(b)}`,d=_.get(c);if(d)return d;let e=new Intl.Collator(a.locale,b),f={contains(a,b,c){if(!b)return!0;let d=L(a,c);for(let a=0;a<=d.length-b.length;a+=1)if(0===e.compare(d.slice(a,a+b.length),b))return!0;return!1},startsWith(a,b,c){if(!b)return!0;let d=L(a,c);return 0===e.compare(d.slice(0,b.length),b)},endsWith(a,b,c){if(!b)return!0;let d=L(a,c),f=b.length;return d.length>=f&&0===e.compare(d.slice(d.length-f),b)}};return _.set(c,f),f}({locale:aD}),[aS,aT]=e.useState(!1),[aU,aV]=e.useState(null),aW=e.useRef([]),aX=e.useRef([]),aY=e.useRef(null),aZ=e.useRef(null),a$=e.useRef(null),a_=e.useRef(!0),a0=e.useRef(!1),a1=e.useRef(null),a2=e.useRef(null),a3=e.useRef(null),a4=e.useRef(ae),a5=e.useRef(null),a6=e.useRef([]),a7=e.useRef([]),a8=aL||ag,a9=aK??af,ba="multiple"===U,bb="single"===U,bc=void 0!==R||void 0!==Q,bd=void 0!==al,be=void 0!==am;b="always"===ap?"always":!!ap&&"input-change";let[bf,bg]=(0,f.q)({controlled:F,default:ba?E??P.Ml:E,name:"Combobox",state:"selectedValue"}),bh=e.useMemo(()=>null===an?()=>!0:void 0!==an?an:bb&&!aS?(a,b)=>{if(null==a)return!1;if(!b)return!0;let c=L(a,at),d=null!=bf?L(bf,at):"";return!!(d&&aR.contains(d,b))&&d.length===b.length||aR.contains(c,b)}:(a,b)=>{if(null==a)return!1;let c=L(a,at);return aR.contains(c,b)},[an,bb,bf,aS,aR,at]),bi=(0,l.j)(()=>bc?Q??"":bb?L(bf,at):"").current,[bj,bk]=(0,f.q)({controlled:R,default:bi,name:"Combobox",state:"inputValue"}),[bl,bm]=(0,f.q)({controlled:a.open,default:a.defaultOpen,name:"Combobox",state:"open"}),bn=K(al),bo=aU??(""===bj?"":String(bj).trim()),bp=bb?L(bf,at):"",bq=bb&&!aS&&""!==bo&&""!==bp&&bp.length===bo.length&&aR.contains(bp,bo),br=bq?"":bo,bs=bd&&be&&bq,bt=e.useMemo(()=>al?bn?al.flatMap(a=>a.items):al:P.Ml,[al,bn]),bu=e.useMemo(()=>{if(am&&!bs)return am;if(!al)return P.Ml;if(bn){let a=[],b=0;for(let c of al){if(aA>-1&&b>=aA)break;let d=""===br?c.items:c.items.filter(a=>bh(a,br,at));if(0===d.length)continue;let e=aA>-1?aA-b:1/0,f=d.slice(0,e);if(f.length>0){let d={...c,items:f};a.push(d),b+=f.length}}return a}if(""===br)return aA>-1?bt.slice(0,aA):bt;let a=[];for(let b of bt){if(aA>-1&&a.length>=aA)break;bh(b,br,at)&&a.push(b)}return a},[am,bs,al,bn,br,aA,bh,at,bt]),bv=e.useMemo(()=>bn?bu.flatMap(a=>a.items):bu,[bu,bn]),bw=(0,l.j)(()=>new m.i({id:aQ,selectedValue:bf,open:bl,filter:bh,query:bo,items:al,selectionMode:U,listRef:aW,labelsRef:aX,popupRef:aY,emptyRef:a$,inputRef:aZ,keyboardActiveRef:a_,chipsContainerRef:a1,clearRef:a2,valuesRef:a6,allValuesRef:a7,selectionEventRef:a3,name:a9,disabled:a8,readOnly:ah,required:ai,grid:ak,isGrouped:bn,virtualized:aw,openOnInputClick:ao,itemToStringLabel:at,isItemEqualToValue:av,modal:az,autoHighlight:b,submitOnItemClick:aE,hasInputValue:bc,mounted:!1,forceMounted:!1,transitionStatus:"idle",inline:ax,activeIndex:null,selectedIndex:null,popupProps:{},inputProps:{},triggerProps:{},positionerElement:null,listElement:null,triggerElement:null,inputElement:null,popupSide:null,openMethod:null,inputInsidePopup:!0,onOpenChangeComplete:D||P.tE,setOpen:P.tE,setInputValue:P.tE,setSelectedValue:P.tE,setIndices:P.tE,onItemHighlighted:P.tE,handleSelection:P.tE,getItemProps:()=>P.t0,forceMount:P.tE,requestSubmit:P.tE})).current,bx="none"===U?bj:bf,by=e.useMemo(()=>"none"===U?bx:Array.isArray(bf)?bf.map(a=>M(a,au)):M(bf,au),[bx,au,U,bf]),bz=(0,i.K)(Y),bA=(0,i.K)(D),bB=(0,n.P)(bw,N.activeIndex),bC=(0,n.P)(bw,N.selectedIndex),bD=(0,n.P)(bw,N.positionerElement),bE=(0,n.P)(bw,N.listElement),bF=(0,n.P)(bw,N.triggerElement),bG=(0,n.P)(bw,N.inputElement),bH=(0,n.P)(bw,N.inline),bI=(0,n.P)(bw,N.inputInsidePopup),bJ=(0,o.u)(bF),{mounted:bK,setMounted:bL,transitionStatus:bM}=(0,aa.$)(bl),{openMethod:bN,triggerProps:bO,reset:bP}=(0,ab.G)(bl);!function(a){let{enabled:b=!0,value:c,id:d,name:e,controlRef:f,commit:h}=a,{formRef:j}=V(),{invalid:k,markedDirtyRef:l,validityData:m,setValidityData:n}=S(),o=(0,i.K)(a.getValue);(0,g.g)(()=>{if(!b)return;let a=c;void 0===a&&(a=o()),null===m.initialValue&&null!==a&&n(b=>({...b,initialValue:a}))},[b,n,c,m.initialValue,o]),(0,g.g)(()=>{b&&d&&j.current.fields.set(d,{getValue:o,name:e,controlRef:f,validityData:{...m,state:{...m.state,valid:!k&&m.state.valid}},validate(a=!0){let b=c;void 0===b&&(b=o()),l.current=!0,a?T.flushSync(()=>h(b)):h(b)}})},[h,f,b,j,o,d,k,l,e,m,c]),(0,g.g)(()=>{let a=j.current.fields;return()=>{d&&a.delete(d)}},[j,d])}({id:aQ,name:a9,commit:aP.commit,value:bx,controlRef:bI?bJ:aZ,getValue:()=>by});let bQ=(0,i.K)(()=>{al?aX.current=bv.map(a=>L(a,at)):bw.set("forceMounted",!0)}),bR=e.useRef(bf);(0,g.g)(()=>{bf!==bR.current&&bQ()},[bQ,bf]);let bS=(0,i.K)(a=>{bw.update(a);let b=a.type||"none";if(void 0!==a.activeIndex)if(null===a.activeIndex)a4.current!==ae&&(a4.current=ae,bz(void 0,(0,v.M)(b,void 0,{index:-1})));else{let c=a6.current[a.activeIndex];a4.current={value:c,index:a.activeIndex},bz(c,(0,v.M)(b,void 0,{index:a.activeIndex}))}}),bT=(0,i.K)((c,d)=>{if(a0.current=d.reason===w.qs,a.onInputValueChange?.(c,d),!d.isCanceled){if(d.reason===w.pf){let a=d.event,e=a.inputType;if("compositionend"===a.type||null!=e&&""!==e&&"insertReplacementText"!==e){let a=""!==c.trim();a&&aT(!0),a5.current={hasQuery:a},a&&b&&null==bw.state.activeIndex&&bw.set("activeIndex",0)}}bk(c)}}),bU=(0,i.K)((b,c)=>{if(bl!==b&&("escape-key"===c.reason&&bd&&0===bv.length&&!bw.state.emptyRef.current&&c.allowPropagation(),a.onOpenChange?.(b,c),!c.isCanceled&&(!b&&aS&&(bb?(bH||aV(bo),""===bo&&aT(!1)):ba&&(bH||bI?bS({activeIndex:null}):aV(bo),bT("",(0,v.d)(w.qs,c.event)))),bm(b),!b&&bI&&(c.reason===w.Xn||c.reason===w.Np))&&(aM(!0),aN(!1),"onBlur"===aO))){let a="none"===U?bj:bf;aP.commit(a)}}),bV=(0,i.K)((a,b)=>{J?.(a,b),!b.isCanceled&&(bg(a),("none"===U&&aY.current&&ay||bb&&!bw.state.inputInsidePopup)&&bT(L(a,at),(0,v.d)(b.reason,b.event)),bb&&null!=a&&b.reason!==w.pf&&aS&&!bH&&aV(bo))}),bW=(0,i.K)((a,b)=>{let c=b;if(void 0===c){if(null===bB)return;c=a6.current[bB]}let d=(0,u.EW)(a),e=a3.current??a;a3.current=null;let f=(0,v.d)(w.Bo,e),g=d?.closest("a")?.getAttribute("href");if(g){g.startsWith("#")&&bU(!1,f);return}if(ba){var h,i,j,k;let a=Array.isArray(bf)?bf:[];if(bV((h=c,i=bw.state.isItemEqualToValue,a&&0!==a.length&&a.some(a=>void 0!==a&&H(h,a,i)))?(j=c,k=bw.state.isItemEqualToValue,a.filter(a=>!H(j,a,k))):[...a,c],f),!(aZ.current&&""!==aZ.current.value.trim()))return;bw.state.inputInsidePopup?bT("",(0,v.d)(w.qs,f.event)):bU(!1,f)}else bV(c,f),bU(!1,f)}),bX=(0,i.K)(()=>{if(!bw.state.submitOnItemClick)return;let a=bw.state.inputElement?.form;a&&"function"==typeof a.requestSubmit&&a.requestSubmit()}),bY=(0,i.K)(()=>{if(bL(!1),bA?.(!1),aT(!1),bP(),aV(null),"none"===U?bS({activeIndex:null,selectedIndex:null}):bS({activeIndex:null}),ba&&aZ.current&&""!==aZ.current.value&&!a0.current&&bT("",(0,v.d)(w.qs)),bb)if(bw.state.inputInsidePopup)aZ.current&&""!==aZ.current.value&&bT("",(0,v.d)(w.qs));else{let a=L(bf,at);if(aZ.current&&aZ.current.value!==a){let b=""===a?w.qs:w.dv;bT(a,(0,v.d)(b))}}}),bZ=e.useMemo(()=>bH&&bD?{current:bD.closest('[role="dialog"]')}:aY,[bH,bD]);(0,O.v)({enabled:!a.actionsRef,open:bl,ref:bZ,onComplete(){bl||bY()}}),e.useImperativeHandle(a.actionsRef,()=>({unmount:bY}),[bY]),(0,g.g)(function(){if(bl||"none"===U)return;let a=al?bt:a7.current;if(ba){let b=Array.isArray(bf)?bf:[],c=I(a,b[b.length-1],av);bS({selectedIndex:-1===c?null:c})}else{let b=I(a,bf,av);bS({selectedIndex:-1===b?null:b})}},[bl,bf,al,U,bt,ba,av,bS]),(0,g.g)(()=>{al&&(a6.current=bv,aW.current.length=bv.length)},[al,bv]),(0,g.g)(()=>{let a=a5.current;if(a&&(a.hasQuery?b&&bw.set("activeIndex",0):"always"===b&&bw.set("activeIndex",0),a5.current=null),!bl&&!bH)return;let c=bd||be?bv:a6.current,d=bw.state.activeIndex;if(null==d)return"always"===b&&c.length>0?void bw.set("activeIndex",0):void(a4.current!==ae&&(a4.current=ae,bw.state.onItemHighlighted(void 0,(0,v.M)(w.dv,void 0,{index:-1}))));if(d>=c.length){a4.current!==ae&&(a4.current=ae,bw.state.onItemHighlighted(void 0,(0,v.M)(w.dv,void 0,{index:-1}))),bw.set("activeIndex",null);return}let e=c[d],f=a4.current.value,g=f!==ad&&H(e,f,bw.state.isItemEqualToValue);a4.current.index===d&&g||(a4.current={value:e,index:d},bw.state.onItemHighlighted(e,(0,v.M)(w.dv,void 0,{index:d})))},[bB,b,be,bd,bv,bH,bl,bw]),(0,g.g)(()=>{if("none"===U)return void aJ(""!==String(bj));aJ(ba?Array.isArray(bf)&&bf.length>0:null!=bf)},[aJ,U,bj,bf,ba]),e.useEffect(()=>{bd&&b&&0===bv.length&&bS({activeIndex:null})},[bd,b,bv.length,bS]),ac(bo,()=>{bl&&""!==bo&&bo!==String(bi)&&aT(!0)}),ac(bf,()=>{if("none"!==U&&(aF(a9),aG(bf!==aH.initialValue),aI()?aP.commit(bf):aP.commit(bf,!0),bb&&!bc&&!bI)){let a=L(bf,at);bj!==a&&bT(a,(0,v.d)(w.dv))}}),ac(bj,()=>{"none"===U&&(aF(a9),aG(bj!==aH.initialValue),aI()?aP.commit(bj):aP.commit(bj,!0))}),ac(al,()=>{if(!bb||bc||bI||aS)return;let a=L(bf,at);bj!==a&&bT(a,(0,v.d)(w.dv))});let b$=(0,p.P)({open:!!bH||bl,onOpenChange:bU,elements:{reference:bI?bF:bG,floating:bD}});bH||(c=ak?"grid":"listbox",x=bl?"true":"false");let b_=e.useMemo(()=>{let a=bG?.tagName==="INPUT",b=a||bl,d=a?{autoComplete:"off",spellCheck:"false",autoCorrect:"off",autoCapitalize:"none"}:{};return b&&(d.role="combobox",d["aria-expanded"]=x,d["aria-haspopup"]=c,d["aria-controls"]=bl?bE?.id:void 0,d["aria-autocomplete"]=aB),{reference:d,floating:{role:"presentation"}}},[bG,bl,x,c,bE?.id,aB]),b0=(0,q.k)(b$,{enabled:!ah&&!a8&&ao,event:"mousedown-only",toggle:!1,touchOpenDelay:50*!bI,reason:w._J}),b1=(0,r.s)(b$,{enabled:!ah&&!a8&&!bH,outsidePressEvent:{mouse:"sloppy",touch:"intentional"},bubbles:!!bH||void 0,outsidePress(a){let b=(0,u.EW)(a);return!(0,u.gR)(bF,b)&&!(0,u.gR)(a2.current,b)&&!(0,u.gR)(a1.current,b)}}),b2=(0,s.C)(b$,{enabled:!ah&&!a8,id:aQ,listRef:aW,activeIndex:bB,selectedIndex:bC,virtual:!0,loopFocus:as,allowEscape:as&&!b,focusItemOnOpen:!aS&&("none"!==U||!!b)&&"auto",focusItemOnHover:ar,resetOnPointerLeave:!aq,cols:ak?2:1,orientation:ak?"horizontal":void 0,disabledIndices:P.Ml,onNavigate(a,b){(b||bl)&&"ending"!==bM&&(b?bS({activeIndex:a,type:a_.current?"keyboard":"pointer"}):bS({activeIndex:a}))}}),{getReferenceProps:b3,getFloatingProps:b4,getItemProps:b5}=(0,t.b)([b_,b0,b1,b2]);(0,h.j)(()=>{bw.update({inline:ax,popupProps:b4(),inputProps:b3(),triggerProps:bO,getItemProps:b5,setOpen:bU,setInputValue:bT,setSelectedValue:bV,setIndices:bS,onItemHighlighted:bz,handleSelection:bW,forceMount:bQ,requestSubmit:bX})}),(0,g.g)(()=>{bw.update({id:aQ,selectedValue:bf,open:bl,mounted:bK,transitionStatus:bM,items:al,inline:ax,popupProps:b4(),inputProps:b3(),triggerProps:bO,openMethod:bN,getItemProps:b5,selectionMode:U,name:a9,disabled:a8,readOnly:ah,required:ai,grid:ak,isGrouped:bn,virtualized:aw,onOpenChangeComplete:bA,openOnInputClick:ao,itemToStringLabel:at,modal:az,autoHighlight:b,isItemEqualToValue:av,submitOnItemClick:aE,hasInputValue:bc,requestSubmit:bX})},[bw,aQ,bf,bl,bK,bM,al,b4,b3,b5,bN,bO,U,a9,a8,ah,ai,aP,ak,bn,aw,bA,ao,at,az,av,aE,bc,ax,bX,b]);let b6=(0,j.a)(aj,aP.inputRef),b7=e.useMemo(()=>({query:bo,hasItems:bd,filteredItems:bu,flatFilteredItems:bv}),[bo,bd,bu,bv]),b8=e.useMemo(()=>Array.isArray(bx)?"":M(bx,au),[bx,au]),b9=ba&&Array.isArray(bf)&&bf.length>0,ca=ba||"none"===U?void 0:a9,cb=e.useMemo(()=>ba&&Array.isArray(bf)&&a9?bf.map(a=>{let b=M(a,au);return(0,d.jsx)("input",{type:"hidden",name:a9,value:b},b)}):null,[ba,bf,a9,au]),cc=(0,d.jsxs)(e.Fragment,{children:[a.children,(0,d.jsx)("input",{...aP.getInputValidationProps({onFocus(){if(bI)return void bF?.focus();(aZ.current||bF)?.focus()},onChange(a){if(a.nativeEvent.defaultPrevented)return;let b=a.target.value,c=(0,v.d)(w.dv,a.nativeEvent);function d(){if(ba)return;if("none"===U){aG(b!==aH.initialValue),bT(b,c),aI()&&aP.commit(b);return}let a=a6.current.find(a=>M(a,au).toLowerCase()===b.toLowerCase());null!=a&&(aG(a!==aH.initialValue),bV?.(a,c),aI()&&aP.commit(a))}al?d():(bQ(),queueMicrotask(d))}}),id:aQ&&null==ca?`${aQ}-hidden-input`:void 0,name:ca,autoComplete:aC,disabled:a8,required:ai&&!b9,readOnly:ah,value:b8,ref:b6,style:ca?k.a:k.Q,tabIndex:-1,"aria-hidden":!0}),cb]});return(0,d.jsx)(y.Provider,{value:bw,children:(0,d.jsx)(z.Provider,{value:b$,children:(0,d.jsx)(A.Provider,{value:b7,children:(0,d.jsx)(B.Provider,{value:bj,children:cc})})})})}var ag=c(504745),ah=c(577979),ai=c(654277);let aj={...ai.jL,valid:a=>null===a?null:a?{[Q.valid]:""}:{[Q.invalid]:""},popupSide:a=>a?{"data-popup-side":a}:null,listEmpty:a=>a?{"data-list-empty":""}:null},ak=e.createContext(void 0);var al=c(20960);let am=e.createContext(void 0);function an(a){let b=e.useContext(am);if(void 0===b&&!a)throw Error((0,x.A)(21));return b}var ao=c(729406);let ap=e.forwardRef(function(a,b){let{render:c,className:d,disabled:f=!1,id:g,...h}=a,{state:j,disabled:k,setTouched:l,setFocused:m,validationMode:o,validation:p}=S(),{labelId:q}=Z(),r=e.useContext(ak),s=!!an(!0),t=C(),{filteredItems:u}=E(),x=e.useContext(B),y=(0,ao.j)(),z=(0,n.P)(t,N.required),A=(0,n.P)(t,N.disabled),D=(0,n.P)(t,N.readOnly),F=(0,n.P)(t,N.name),G=(0,n.P)(t,N.selectionMode),H=(0,n.P)(t,N.autoHighlight),I=(0,n.P)(t,N.inputProps),J=(0,n.P)(t,N.triggerProps),K=(0,n.P)(t,N.open),L=(0,n.P)(t,N.mounted),M=(0,n.P)(t,N.selectedValue),O=(0,n.P)(t,N.popupSide),P=(0,n.P)(t,N.positionerElement),Q=(0,n.P)(t,N.id),R=(0,n.P)(t,N.inline),T=!!H,U=k||A||f,V=0===u.length,W=s||R,Y=(0,X.e)(g??(W?void 0:Q)),[_,aa]=e.useState(null),ab=e.useRef(!1),ac=e.useRef(null),ad=e.useRef(!1),ae=(0,i.K)(a=>{let b=s||t.state.inline;b&&!t.state.hasInputValue&&t.state.setInputValue("",(0,v.d)(w.dv)),t.update({inputElement:a,inputInsidePopup:b})}),af={...j,open:K,disabled:U,readOnly:D,popupSide:L&&P?O:null,listEmpty:V};return(0,ah.o)("input",a,{state:af,ref:[b,t.state.inputRef,ae],props:[I,J,{type:"text",value:a.value??_??x,"aria-readonly":D||void 0,"aria-required":z||void 0,"aria-labelledby":q,disabled:U,readOnly:D,required:"none"===G?z:void 0,..."none"===G&&F&&{name:F},id:Y,onFocus(){if(m(!0),!R||!ad.current)return;ad.current=!1;let a=ac.current;null!=a&&Object.hasOwn(t.state.valuesRef.current,a)&&t.state.setIndices({activeIndex:a})},onBlur(){l(!0),m(!1);let a=t.state.activeIndex;if(R&&null!==a&&"always"!==H&&(ac.current=a,ad.current=!0,t.state.setIndices({activeIndex:null})),"onBlur"===o){let a="none"===G?x:M;p.commit(a)}},onCompositionStart(a){ag.m0||(ab.current=!0,aa(a.currentTarget.value))},onCompositionEnd(a){ab.current=!1;let b=a.currentTarget.value;aa(null),t.state.setInputValue(b,(0,v.d)(w.pf,a.nativeEvent))},onChange(a){let b=a.nativeEvent.inputType,c=ab.current||!(!b||"insertReplacementText"===b);if(ab.current){let b=a.currentTarget.value;aa(b),""!==b||t.state.openOnInputClick||t.state.inputInsidePopup||t.state.setOpen(!1,(0,v.d)(w.qs,a.nativeEvent));let d=b.trim();!D&&!U&&d&&c&&(t.state.setOpen(!0,(0,v.d)(w.pf,a.nativeEvent)),T||t.state.setIndices({activeIndex:null,selectedIndex:null,type:t.state.keyboardActiveRef.current?"keyboard":"pointer"})),K&&null!==t.state.activeIndex&&!(T&&""!==d)&&t.state.setIndices({activeIndex:null,selectedIndex:null,type:t.state.keyboardActiveRef.current?"keyboard":"pointer"});return}t.state.setInputValue(a.currentTarget.value,(0,v.d)(w.pf,a.nativeEvent));let d=""===a.currentTarget.value,e=(0,v.d)(w.qs,a.nativeEvent);d&&!t.state.inputInsidePopup&&("single"===G&&t.state.setSelectedValue(null,e),t.state.openOnInputClick||t.state.setOpen(!1,e));let f=a.currentTarget.value.trim();!D&&!U&&f&&c&&(t.state.setOpen(!0,(0,v.d)(w.pf,a.nativeEvent)),T||t.state.setIndices({activeIndex:null,selectedIndex:null,type:t.state.keyboardActiveRef.current?"keyboard":"pointer"})),K&&null!==t.state.activeIndex&&!T&&t.state.setIndices({activeIndex:null,selectedIndex:null,type:t.state.keyboardActiveRef.current?"keyboard":"pointer"})},onKeyDown(a){if(U||D||a.ctrlKey||a.shiftKey||a.altKey||a.metaKey)return;t.state.keyboardActiveRef.current=!0;let b=a.currentTarget,c=b.scrollWidth-b.clientWidth,d="rtl"===y;if("Home"===a.key){(0,al.jo)(a);let c=ag.gm&&d?b.value.length:0;b.setSelectionRange(c,c),b.scrollLeft=0;return}if("End"===a.key){(0,al.jo)(a);let e=ag.gm&&d?0:b.value.length;b.setSelectionRange(e,e),b.scrollLeft=d?-c:c;return}if(!L&&"Escape"===a.key){let b="multiple"===G&&Array.isArray(M)?0===M.length:null===M,c=(0,v.d)(w.jv,a.nativeEvent);t.state.setInputValue("",c),t.state.setSelectedValue("multiple"===G?[]:null,c),b||t.state.inline||c.isPropagationAllowed||a.stopPropagation();return}if(r&&"Backspace"===a.key&&""===b.value&&void 0===r.highlightedChipIndex&&Array.isArray(M)&&M.length>0){let b=M.slice(0,-1);t.state.setIndices({activeIndex:null,selectedIndex:null,type:t.state.keyboardActiveRef.current?"keyboard":"pointer"}),t.state.setSelectedValue(b,(0,v.d)(w.dv,a.nativeEvent));return}let e=r?.highlightedChipIndex!==void 0,f=function(a){let b;if(!r)return;let{highlightedChipIndex:c}=r;if(void 0!==c){if("ArrowLeft"===a.key)a.preventDefault(),b=c>0?c-1:void 0;else if("ArrowRight"===a.key)a.preventDefault(),b=c<M.length-1?c+1:void 0;else if("Backspace"===a.key||"Delete"===a.key){a.preventDefault();let d=c>=M.length-1?M.length-2:c;b=d>=0?d:void 0,t.state.setIndices({activeIndex:null,selectedIndex:null,type:"keyboard"})}return b}return"ArrowLeft"===a.key&&(a.currentTarget.selectionStart??0)===0&&M.length>0?(a.preventDefault(),b=Math.max(M.length-1,0)):"Backspace"===a.key&&""===a.currentTarget.value&&M.length>0&&(t.state.setIndices({activeIndex:null,selectedIndex:null,type:"keyboard"}),a.preventDefault()),b}(a);if(r?.setHighlightedChipIndex(f),void 0!==f?r?.chipsRef.current[f]?.focus():e&&t.state.inputRef.current?.focus(),229!==a.which&&"Enter"===a.key&&K){let b=t.state.activeIndex,c=a.nativeEvent;if(null===b)return void t.state.setOpen(!1,(0,v.d)(w.dv,c));(0,al.jo)(a);let d=t.state.listRef.current[b];d&&(t.state.selectionEventRef.current=c,d.click(),t.state.selectionEventRef.current=null)}},onPointerMove(){t.state.keyboardActiveRef.current=!1},onPointerDown(){t.state.keyboardActiveRef.current=!1}},p?p.getValidationProps(h):h],stateAttributesMapping:aj})});var aq=c(402831);let ar=e.createContext(void 0),as=e.forwardRef(function(a,b){let{keepMounted:c=!1,...e}=a,f=C(),g=(0,n.P)(f,N.mounted),h=(0,n.P)(f,N.forceMounted);return g||c||h?(0,d.jsx)(ar.Provider,{value:c,children:(0,d.jsx)(aq.XF,{ref:b,...e})}):null});var at=c(640023),au=c(568069),av=c(275819),aw=c(293863),ax=c(994152),ay=c(929035);let az=e.forwardRef(function(a,b){let{render:c,className:f,anchor:h,positionMethod:j="absolute",side:k="bottom",align:l="center",sideOffset:m=0,alignOffset:o=0,collisionBoundary:p="clipping-ancestors",collisionPadding:q=5,arrowPadding:r=5,sticky:s=!1,disableAnchorTracking:t=!1,collisionAvoidance:u=aw.uD,...v}=a,w=C(),{filteredItems:y}=E(),z=D(),A=function(){let a=e.useContext(ar);if(void 0===a)throw Error((0,x.A)(20));return a}(),B=(0,n.P)(w,N.modal),F=(0,n.P)(w,N.open),G=(0,n.P)(w,N.mounted),H=(0,n.P)(w,N.openMethod),I=(0,n.P)(w,N.triggerElement),J=(0,n.P)(w,N.inputElement),K=(0,n.P)(w,N.inputInsidePopup),L=(0,n.P)(w,N.transitionStatus),M=0===y.length,O=h??(K?I:J),P=(0,av.s)({anchor:O,floatingRootContext:z,positionMethod:j,mounted:G,side:k,sideOffset:m,align:l,alignOffset:o,arrowPadding:r,collisionBoundary:p,collisionPadding:q,sticky:s,disableAnchorTracking:t,keepMounted:A,collisionAvoidance:u,lazyFlip:!0});(0,au.K)(F&&B&&"touch"!==H,I);let Q=e.useMemo(()=>{let a={...P.positionerStyles};return F||(a.pointerEvents="none"),{role:"presentation",hidden:!G,style:a}},[F,G,P.positionerStyles]),R={open:F,side:P.side,align:P.align,anchorHidden:P.anchorHidden,empty:M};(0,g.g)(()=>{w.set("popupSide",P.side)},[w,P.side]);let S=e.useMemo(()=>({side:P.side,align:P.align,arrowRef:P.arrowRef,arrowUncentered:P.arrowUncentered,arrowStyles:P.arrowStyles,anchorHidden:P.anchorHidden,isPositioned:P.isPositioned}),[P.side,P.align,P.arrowRef,P.arrowUncentered,P.arrowStyles,P.anchorHidden,P.isPositioned]),T=(0,i.K)(a=>{w.set("positionerElement",a)}),U=(0,ah.o)("div",a,{state:R,ref:[b,T],props:[Q,(0,ax.d)(L),v],stateAttributesMapping:ai.GW});return(0,d.jsxs)(am.Provider,{value:S,children:[G&&B&&(0,d.jsx)(ay.W,{inert:(0,at.Y)(!F),cutout:J??I}),U]})});var aA=c(474228),aB=c(238978);let aC={...ai.GW,...aB.G},aD=e.forwardRef(function(a,b){let c,{render:e,className:f,initialFocus:g,finalFocus:h,...i}=a,j=C(),k=an(),l=D(),{filteredItems:m}=E(),o=(0,n.P)(j,N.mounted),p=(0,n.P)(j,N.open),q=(0,n.P)(j,N.openMethod),r=(0,n.P)(j,N.transitionStatus),s=(0,n.P)(j,N.inputInsidePopup),t=(0,n.P)(j,N.inputElement),v=0===m.length;(0,O.v)({open:p,ref:j.state.popupRef,onComplete(){p&&j.state.onOpenChangeComplete(!0)}});let w={open:p,side:k.side,align:k.align,anchorHidden:k.anchorHidden,transitionStatus:r,empty:v},x=(0,ah.o)("div",a,{state:w,ref:[b,j.state.popupRef],props:[{role:s?"dialog":"presentation",tabIndex:-1,onFocus(a){let b=(0,u.EW)(a.nativeEvent);"touch"!==q&&((0,u.gR)(j.state.listElement,b)||b===a.currentTarget)&&j.state.inputRef.current?.focus()}},(0,ax.d)(r),i],stateAttributesMapping:aC}),y=!!s&&(a=>"touch"===a?j.state.popupRef.current:t);return c=null!=h?h:!!s&&void 0,(0,d.jsx)(aA.s,{context:l,disabled:!o,modal:!s,openInteractionType:q,initialFocus:void 0===g?y:g,returnFocus:c,children:x})}),aE=e.createContext(null);function aF(a){let{children:b}=a,{filteredItems:c}=E(),f=e.useContext(aE),g=f?f.items:c;return g?(0,d.jsx)(e.Fragment,{children:g.map(b)}):null}var aG=c(987038);let aH=e.forwardRef(function(a,b){var c;let{render:f,className:g,children:h,...j}=a,k=C(),l=D(),m=!!an(!0),{filteredItems:o}=E(),p=(0,n.P)(k,N.items),q=(0,n.P)(k,N.labelsRef),r=(0,n.P)(k,N.listRef),s=(0,n.P)(k,N.selectionMode),t=(0,n.P)(k,N.grid),u=(0,n.P)(k,N.popupProps),v=(0,n.P)(k,N.disabled),w=(0,n.P)(k,N.readOnly),x=(0,n.P)(k,N.virtualized),y=0===o.length,z=(0,i.K)(a=>{k.set("positionerElement",a)}),A=(0,i.K)(a=>{k.set("listElement",a)}),B=e.useMemo(()=>"function"==typeof h?c||(c=(0,d.jsx)(aF,{children:h})):h,[h]),F=l.useState("floatingId"),G=(0,ah.o)("div",a,{state:{empty:y},ref:[b,A,m?null:z],props:[u,{children:B,tabIndex:-1,id:F,role:t?"grid":"listbox","aria-multiselectable":"multiple"===s?"true":void 0,onKeyDown(a){if(!v&&!w&&"Enter"===a.key){let b=k.state.activeIndex;if(null==b)return;(0,al.jo)(a);let c=a.nativeEvent,d=k.state.listRef.current[b];d&&(k.state.selectionEventRef.current=c,d.click(),k.state.selectionEventRef.current=null)}},onKeyDownCapture(){k.state.keyboardActiveRef.current=!0},onPointerMoveCapture(){k.state.keyboardActiveRef.current=!1}},j]});return x?G:(0,d.jsx)(aG.u,{elementsRef:r,labelsRef:p?void 0:q,children:G})});var aI=c(360412);let aJ=e.createContext(void 0);var aK=c(642228);let aL=e.createContext(!1),aM=e.memo(e.forwardRef(function(a,b){let{render:c,className:f,value:h=null,index:i,disabled:j=!1,nativeButton:k=!1,...l}=a,m=e.useRef(!1),o=e.useRef(null),p=(0,aI.q)({index:i,textRef:o,indexGuessBehavior:aI.G.GuessFromOrder}),q=C(),r=e.useContext(aL),{flatFilteredItems:s,hasItems:t}=E(),u=(0,n.P)(q,N.open),v=(0,n.P)(q,N.selectionMode),w=(0,n.P)(q,N.readOnly),x=(0,n.P)(q,N.virtualized),y=(0,n.P)(q,N.isItemEqualToValue),z="none"!==v,A=i??(x?I(s,h,y):p.index),B=-1!==p.index,D=(0,n.P)(q,N.id),F=(0,n.P)(q,N.isActive,A),G=(0,n.P)(q,N.isSelected,h),J=(0,n.P)(q,N.getItemProps),K=e.useRef(null),L=null!=D&&B?`${D}-${A}`:void 0,M=G&&z;(0,g.g)(()=>{if(!(B&&(x||null!=i)))return;let a=q.state.listRef.current;return a[A]=K.current,()=>{delete a[A]}},[B,x,A,i,q]),(0,g.g)(()=>{if(!B||t)return;let a=q.state.valuesRef.current;return a[A]=h,"none"!==v&&q.state.allValuesRef.current.push(h),()=>{delete a[A]}},[B,t,A,h,q,v]),(0,g.g)(()=>{if(!u){m.current=!1;return}if(!B||t)return;let a=q.state.selectedValue;H(h,Array.isArray(a)?a[a.length-1]:a,y)&&q.set("selectedIndex",A)},[B,t,u,q,A,h,y]);let O=J({active:F,selected:M});O.id=void 0,O.onFocus=void 0;let{getButtonProps:P,buttonRef:Q}=(0,aK.s)({disabled:j,focusableWhenDisabled:!0,native:k});function R(a){function b(){q.state.handleSelection(a,h)}q.state.submitOnItemClick?(T.flushSync(b),q.state.requestSubmit()):b()}let S=(0,ah.o)("div",a,{ref:[Q,b,p.ref,K],state:{disabled:j,selected:M,highlighted:F},props:[O,{id:L,role:r?"gridcell":"option","aria-selected":z?M:void 0,tabIndex:void 0,onPointerDownCapture(a){m.current=!0,a.preventDefault()},onClick(a){j||w||R(a.nativeEvent)},onMouseUp(a){let b=m.current;m.current=!1,j||w||0!==a.button||b||!F||R(a.nativeEvent)}},l,P]}),U=e.useMemo(()=>({selected:M,textRef:o}),[M,o]);return(0,d.jsx)(aJ.Provider,{value:U,children:S})}));var aN=c(165046);let aO=function(a){let{multiple:b=!1,defaultValue:c,value:e,onValueChange:f,autoComplete:g,...h}=a;return(0,d.jsx)(af,{...h,selectionMode:b?"multiple":"single",selectedValue:e,defaultSelectedValue:c,onSelectedValueChange:f,formAutoComplete:g})},aP=e.forwardRef(({className:a,...b},c)=>(0,d.jsx)(ap,{ref:c,"data-slot":"combobox-input",className:(0,aN.cn)("w-full rounded-xl py-2 text-sm outline-none transition-colors",a),...b}));function aQ({className:a,side:b="bottom",sideOffset:c=8,align:e="start",alignOffset:f=0,anchor:g,...h}){return(0,d.jsx)(as,{children:(0,d.jsx)(az,{side:b,sideOffset:c,align:e,alignOffset:f,anchor:g,className:"isolate z-[10000]",children:(0,d.jsx)(aD,{"data-slot":"combobox-content",className:(0,aN.cn)("bg-neutral-100/[0.67] dark:bg-neutral-900/[0.67] border border-white dark:border-white/10 backdrop-blur-md text-[var(--color-text)] max-h-[var(--available-height)] w-[calc(var(--anchor-width)+48px)] overflow-hidden rounded-3xl p-1 shadow-[0_0_25px_0_rgba(0,0,0,0.16)] outline-none","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",a),...h})})})}function aR({className:a,...b}){return(0,d.jsx)(aH,{"data-slot":"combobox-list",className:(0,aN.cn)("max-h-[300px] overflow-y-auto overscroll-contain thin-scrollbar",a),...b})}function aS({className:a,children:b,...c}){return(0,d.jsx)(aM,{"data-slot":"combobox-item",className:(0,aN.cn)("bg-transparent data-highlighted:bg-neutral-400/15 text-sm transition-all relative flex w-full cursor-pointer items-center gap-2.5 rounded-2xl px-3 py-2 outline-none select-none","data-disabled:pointer-events-none data-disabled:opacity-50",a),...c,children:b})}aP.displayName="ComboboxInput";var aT=c(941809),aU=c(896703),aV=c(490654),aW=c(75567);function aX(a){return(0,aW.k5)({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M7.875 2.292a.114.114 0 0 0-.032.018A7.239 7.239 0 0 0 4.75 8.25a7.248 7.248 0 0 0 3.654 6.297c.57.327.982.955.941 1.682v.002l-.317 6.058a.75.75 0 1 1-1.498-.078l.317-6.062v-.004c.006-.09-.047-.215-.188-.296A8.749 8.749 0 0 1 3.25 8.25a8.738 8.738 0 0 1 3.732-7.169 1.547 1.547 0 0 1 1.709-.064c.484.292.809.835.809 1.46v4.714a.25.25 0 0 0 .119.213l2.25 1.385c.08.05.182.05.262 0l2.25-1.385a.25.25 0 0 0 .119-.213V2.478c0-.626.325-1.169.81-1.461a1.547 1.547 0 0 1 1.708.064 8.741 8.741 0 0 1 3.732 7.17 8.747 8.747 0 0 1-4.41 7.598c-.14.081-.193.206-.188.296v.004l.318 6.062a.75.75 0 1 1-1.498.078l-.317-6.058v-.002c-.041-.727.37-1.355.94-1.682A7.247 7.247 0 0 0 19.25 8.25a7.239 7.239 0 0 0-3.093-5.94.114.114 0 0 0-.032-.018l-.01-.001c-.003 0-.014 0-.031.01-.036.022-.084.079-.084.177V7.19c0 .608-.315 1.172-.833 1.49l-2.25 1.385a1.75 1.75 0 0 1-1.834 0l-2.25-1.384A1.752 1.752 0 0 1 8 7.192V2.477c0-.098-.048-.155-.084-.176a.068.068 0 0 0-.031-.011l-.01.001Z"},child:[]}]})(a)}function aY(a){return(0,aW.k5)({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M2.5 7C2.5 9.48528 4.51472 11.5 7 11.5C9.48528 11.5 11.5 9.48528 11.5 7C11.5 4.51472 9.48528 2.5 7 2.5C4.51472 2.5 2.5 4.51472 2.5 7ZM2.5 17C2.5 19.4853 4.51472 21.5 7 21.5C9.48528 21.5 11.5 19.4853 11.5 17C11.5 14.5147 9.48528 12.5 7 12.5C4.51472 12.5 2.5 14.5147 2.5 17ZM12.5 17C12.5 19.4853 14.5147 21.5 17 21.5C19.4853 21.5 21.5 19.4853 21.5 17C21.5 14.5147 19.4853 12.5 17 12.5C14.5147 12.5 12.5 14.5147 12.5 17ZM9.5 7C9.5 8.38071 8.38071 9.5 7 9.5C5.61929 9.5 4.5 8.38071 4.5 7C4.5 5.61929 5.61929 4.5 7 4.5C8.38071 4.5 9.5 5.61929 9.5 7ZM9.5 17C9.5 18.3807 8.38071 19.5 7 19.5C5.61929 19.5 4.5 18.3807 4.5 17C4.5 15.6193 5.61929 14.5 7 14.5C8.38071 14.5 9.5 15.6193 9.5 17ZM19.5 17C19.5 18.3807 18.3807 19.5 17 19.5C15.6193 19.5 14.5 18.3807 14.5 17C14.5 15.6193 15.6193 14.5 17 14.5C18.3807 14.5 19.5 15.6193 19.5 17ZM17.5252 11.155L17.8026 10.5186C18.297 9.38398 19.1876 8.48059 20.2988 7.98638L21.1534 7.60631C21.6155 7.4008 21.6155 6.7284 21.1534 6.52289L20.3467 6.16406C19.2068 5.65713 18.3002 4.72031 17.8143 3.54712L17.5295 2.85945C17.3309 2.38018 16.669 2.38018 16.4705 2.85945L16.1856 3.54712C15.6997 4.72031 14.7932 5.65713 13.6534 6.16406L12.8466 6.52289C12.3845 6.7284 12.3845 7.4008 12.8466 7.60631L13.7011 7.98638C14.8124 8.48059 15.7029 9.38398 16.1974 10.5186L16.4748 11.155C16.6778 11.6209 17.3222 11.6209 17.5252 11.155Z"},child:[]}]})(a)}var aZ=c(826948),a$=c(57137),a_=c(489619),a0=c(86839),a1=c(981188);function a2(a){let b=a.path??a.id,c=b.split("/").pop()??a.label;return{name:"object"===a.kind?(0,a0.PV)(a.label):c,path:b,type:a.nodeType??("object"===a.kind?"folder":"file")}}function a3(){let{resolvedTheme:a,setTheme:b}=(0,aZ.D)(),[c,f]=(0,e.useState)(!1);if(!c)return(0,d.jsx)("div",{className:"w-[26px] h-[26px]"});let g="dark"===a;return(0,d.jsx)("button",{type:"button",onClick:()=>b(g?"light":"dark"),className:"p-1.5 rounded-lg transition-colors",style:{color:"var(--color-text-muted)"},onMouseEnter:a=>{a.currentTarget.style.background="var(--color-surface-hover)"},onMouseLeave:a=>{a.currentTarget.style.background="transparent"},title:g?"Switch to light mode":"Switch to dark mode",children:g?(0,d.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("circle",{cx:"12",cy:"12",r:"4"}),(0,d.jsx)("path",{d:"M12 2v2"}),(0,d.jsx)("path",{d:"M12 20v2"}),(0,d.jsx)("path",{d:"m4.93 4.93 1.41 1.41"}),(0,d.jsx)("path",{d:"m17.66 17.66 1.41 1.41"}),(0,d.jsx)("path",{d:"M2 12h2"}),(0,d.jsx)("path",{d:"M20 12h2"}),(0,d.jsx)("path",{d:"m6.34 17.66-1.41 1.41"}),(0,d.jsx)("path",{d:"m19.07 4.93-1.41 1.41"})]}):(0,d.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,d.jsx)("path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"})})})}function a4(){return(0,d.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("circle",{cx:"11",cy:"11",r:"8"}),(0,d.jsx)("path",{d:"m21 21-4.3-4.3"})]})}function a5({type:a}){switch(a){case"folder":return(0,d.jsx)(aT.A,{size:16,style:{flexShrink:0,color:"#60a5fa"}});case"document":default:return(0,d.jsx)(aU.A,{size:16,style:{flexShrink:0,opacity:.7}});case"database":return(0,d.jsx)(aV.A,{size:16,style:{flexShrink:0}})}}function a6({onSelect:a,searchFn:b}){let[c,f]=(0,e.useState)([]),[g,h]=(0,e.useState)(!1),[i,j]=(0,e.useState)(""),k=(0,e.useRef)(!1),l=(0,e.useRef)(null),m=(0,e.useRef)(null),n=(0,e.useCallback)(a=>{if(k.current){k.current=!1;return}if(j(a),!a.trim()){f([]),h(!1);return}b?(f(b(a.trim(),20).map(a2)),h(!0)):(l.current&&clearTimeout(l.current),l.current=setTimeout(async()=>{try{let b=await fetch(`/api/workspace/suggest-files?q=${encodeURIComponent(a.trim())}`),c=await b.json();f(c.items??[]),h(!0)}catch{f([])}},150))},[b]);return(0,d.jsxs)(aO,{value:null,open:g,onOpenChange:a=>{a||h(!1)},onValueChange:b=>{b&&(k.current=!0,a(b),h(!1),j(""),f([]))},onInputValueChange:n,filter:null,itemToStringLabel:()=>"",children:[(0,d.jsxs)("div",{ref:m,className:"relative",children:[(0,d.jsx)("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 pointer-events-none z-10",style:{color:"var(--color-text-muted)"},children:(0,d.jsx)(a4,{})}),(0,d.jsx)(aP,{placeholder:"Search",className:"w-full pl-9 pr-10 py-1.5 rounded-xl text-sm outline-none transition-colors",style:{background:"var(--color-surface-hover)",color:"var(--color-text)"}})]}),(0,d.jsxs)(aQ,{anchor:m,children:[(0,d.jsx)(aR,{children:c.map(a=>(0,d.jsxs)(aS,{value:a,children:[(0,d.jsx)("span",{className:"flex-shrink-0",style:{color:"var(--color-text-muted)",opacity:.55},children:(0,d.jsx)(a5,{type:a.type})}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("div",{className:"truncate font-medium",children:a.name}),(0,d.jsx)("div",{className:"truncate text-xs",style:{color:"var(--color-text-muted)"},children:a.path.split("/").slice(0,-1).join("/")})]})]},a.path))}),i.trim()&&0===c.length&&(0,d.jsx)("div",{className:"py-3 text-center text-sm",style:{color:"var(--color-text-muted)"},children:"No files found"})]})]})}function a7({orgName:a,onFileSearchSelect:b,mobile:c,onClose:f,showHidden:g,onToggleHidden:h,width:i,onCollapse:j,compact:k=!1,onToggleCompact:l,activeWorkspace:m,onWorkspaceChanged:n,onNavigate:o,activeCrmTarget:p=null,customCrmObjects:q,activeCrmObjectName:r=null,onNavigateToCrmObject:s,chatsPanel:t,onNewChatSession:u}){let v=c?"280px":i??260,[w,x]=(0,e.useState)(!1),[y,z]=(0,e.useState)("home"),A=[{id:"crm-people",label:"People",target:"people",icon:(0,d.jsxs)("svg",{className:"h-4 w-4 shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,d.jsx)("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),(0,d.jsx)("circle",{cx:"9",cy:"7",r:"4"}),(0,d.jsx)("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),(0,d.jsx)("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]})},{id:"crm-companies",label:"Companies",target:"companies",icon:(0,d.jsxs)("svg",{className:"h-4 w-4 shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,d.jsx)("path",{d:"M3 21h18"}),(0,d.jsx)("path",{d:"M5 21V7l8-4v18"}),(0,d.jsx)("path",{d:"M19 21V11l-6-4"}),(0,d.jsx)("path",{d:"M9 9h0"}),(0,d.jsx)("path",{d:"M9 13h0"}),(0,d.jsx)("path",{d:"M9 17h0"})]})},{id:"crm-inbox",label:"Inbox",target:"inbox",icon:(0,d.jsxs)("svg",{className:"h-4 w-4 shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,d.jsx)("polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12"}),(0,d.jsx)("path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11Z"})]})},{id:"crm-calendar",label:"Calendar",target:"calendar",icon:(0,d.jsxs)("svg",{className:"h-4 w-4 shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,d.jsx)("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),(0,d.jsx)("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),(0,d.jsx)("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),(0,d.jsx)("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]})}],B=[{id:"cloud",label:"Cloud",icon:(0,d.jsx)("svg",{className:"h-4 w-4 shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:(0,d.jsx)("path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z"})})},{id:"integrations",label:"Integrations",icon:(0,d.jsx)(aY,{className:"h-4 w-4 shrink-0","aria-hidden":!0})},{id:"skills",label:"Skills",icon:(0,d.jsx)(aX,{className:"h-4 w-4 shrink-0","aria-hidden":!0})},{id:"cron",label:"Cron",icon:(0,d.jsxs)("svg",{className:"h-4 w-4 shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,d.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,d.jsx)("polyline",{points:"12 6 12 12 16 14"})]})}],C=(0,d.jsxs)("aside",{className:"flex flex-col h-screen shrink-0 border-r",style:{width:"number"==typeof v?`${v}px`:v,minWidth:"number"==typeof v?`${v}px`:v,background:"var(--color-bg)",borderColor:"var(--color-border)"},children:[l&&(0,d.jsx)("div",{className:"flex items-center justify-center h-[44px] shrink-0",children:(0,d.jsx)("button",{type:"button",onClick:l,className:"w-9 h-9 rounded-lg flex items-center justify-center transition-colors",style:{color:"var(--color-text-muted)"},onMouseEnter:a=>{a.currentTarget.style.background="var(--color-surface-hover)"},onMouseLeave:a=>{a.currentTarget.style.background="transparent"},title:"Expand sidebar",children:(0,d.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}),(0,d.jsx)("path",{d:"M15 3v18"})]})})}),(0,d.jsx)("div",{className:"flex items-center justify-center pb-0.5 shrink-0",children:(0,d.jsx)(a$.N,{activeWorkspaceHint:m??null,onWorkspaceSwitch:()=>{n?.()},onWorkspaceDelete:()=>{n?.()},onCreateWorkspace:()=>{x(!0)},trigger:({onClick:b,activeWorkspace:c,switching:e})=>(0,d.jsx)("button",{type:"button",onClick:b,disabled:e,className:"w-7 h-7 mx-auto rounded-lg overflow-hidden flex items-center justify-center transition-opacity hover:opacity-90",title:`${a||"Workspace"}${c?` — ${c}`:""}`,children:(0,d.jsx)("img",{src:"/dench-workspace-icon.png",alt:"",className:"w-7 h-7 object-cover",draggable:!1})})})}),o&&(0,d.jsxs)("div",{className:"flex flex-col items-center gap-0.5 pt-1 pb-1",children:[A.map(a=>{let b=p===a.target;return(0,d.jsx)("button",{type:"button",onClick:()=>o(a.id),className:"w-9 h-9 rounded-lg flex items-center justify-center transition-colors",style:{color:"var(--color-text)",background:b?"var(--color-surface-hover)":"transparent"},onMouseEnter:a=>{b||(a.currentTarget.style.background="var(--color-surface-hover)")},onMouseLeave:a=>{b||(a.currentTarget.style.background="transparent")},title:a.label,"aria-label":a.label,children:a.icon},a.id)}),q&&q.length>0&&s&&q.map(a=>{let b=r===a.name,c=(0,a0.PV)(a.name);return(0,d.jsx)("button",{type:"button",onClick:()=>s(a.name),className:"w-9 h-9 rounded-lg flex items-center justify-center transition-colors",style:{color:"var(--color-text)",background:b?"var(--color-surface-hover)":"transparent"},onMouseEnter:a=>{b||(a.currentTarget.style.background="var(--color-surface-hover)")},onMouseLeave:a=>{b||(a.currentTarget.style.background="transparent")},title:c,"aria-label":c,children:(0,d.jsx)(a1.P,{name:a.icon,size:16})},`crm-object-${a.name}`)})]}),(0,d.jsx)("div",{className:"flex-1 min-h-0"}),o&&(0,d.jsx)("div",{className:"flex flex-col items-center gap-0.5 py-1",children:B.map(a=>(0,d.jsx)("button",{type:"button",onClick:()=>o(a.id),className:"w-9 h-9 rounded-lg flex items-center justify-center transition-colors",style:{color:"var(--color-text)"},onMouseEnter:a=>{a.currentTarget.style.background="var(--color-surface-hover)"},onMouseLeave:a=>{a.currentTarget.style.background="transparent"},title:a.label,"aria-label":a.label,children:a.icon},a.id))}),(0,d.jsxs)("div",{className:"flex flex-col items-center py-1.5 gap-0.5",children:[h&&(0,d.jsx)("button",{type:"button",onClick:h,className:"w-9 h-9 rounded-lg flex items-center justify-center transition-colors",style:{color:g?"var(--color-text)":"var(--color-text-muted)"},onMouseEnter:a=>{a.currentTarget.style.background="var(--color-surface-hover)"},onMouseLeave:a=>{a.currentTarget.style.background="transparent"},title:g?"Hide dotfiles":"Show dotfiles",children:(0,d.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:g?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"}),(0,d.jsx)("circle",{cx:"12",cy:"12",r:"3"})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49"}),(0,d.jsx)("path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242"}),(0,d.jsx)("path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143"}),(0,d.jsx)("path",{d:"m2 2 20 20"})]})})}),(0,d.jsx)(a3,{})]})]}),D=(0,d.jsxs)("aside",{className:`flex flex-col h-screen shrink-0 ${c?"drawer-left":"border-r"}`,style:{width:"number"==typeof v?`${v}px`:v,minWidth:"number"==typeof v?`${v}px`:v,background:"var(--color-bg)",borderColor:"var(--color-border)"},children:[(0,d.jsxs)("div",{className:"flex items-center gap-1 px-2 h-[44px] shrink-0",children:[(0,d.jsx)("div",{className:"flex-1 min-w-0",children:(0,d.jsx)(a$.N,{activeWorkspaceHint:m??null,onWorkspaceSwitch:()=>{n?.()},onWorkspaceDelete:()=>{n?.()},onCreateWorkspace:()=>{x(!0)},trigger:({onClick:b,activeWorkspace:c,switching:e})=>(0,d.jsxs)("button",{type:"button",onClick:b,disabled:e,className:"text-[13px] flex items-center gap-1.5 truncate w-full transition-colors rounded-lg px-2 py-1.5",style:{color:"var(--color-text)"},onMouseEnter:a=>{a.currentTarget.style.background="var(--color-surface-hover)"},onMouseLeave:a=>{a.currentTarget.style.background="transparent"},title:"Switch workspace",children:[(0,d.jsx)("span",{className:"truncate font-semibold",children:a||"Workspace"}),c&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"shrink-0 opacity-40",children:"/"}),(0,d.jsx)("span",{className:"truncate text-[12px]",style:{color:"var(--color-text-muted)"},children:c})]}),(0,d.jsx)("span",{className:"flex-1"}),(0,d.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"shrink-0",style:{color:"var(--color-text-muted)"},children:(0,d.jsx)("path",{d:"m6 9 6 6 6-6"})})]})})}),(l||j)&&(0,d.jsx)("button",{type:"button",onClick:l??j,className:"p-1.5 rounded-lg shrink-0 transition-colors",style:{color:"var(--color-text-muted)"},onMouseEnter:a=>{a.currentTarget.style.background="var(--color-surface-hover)"},onMouseLeave:a=>{a.currentTarget.style.background="transparent"},title:l?"Collapse to icons":"Hide sidebar (⌘B)",children:(0,d.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}),(0,d.jsx)("path",{d:"M9 3v18"})]})})]}),t&&(0,d.jsxs)("div",{className:"px-2 pt-1 pb-1 flex items-center gap-1",children:[[{id:"home",label:"Home"},{id:"chats",label:"Chats"}].map(a=>{let b=y===a.id;return(0,d.jsx)("button",{type:"button",onClick:()=>z(a.id),className:"flex-1 px-2 py-1 rounded-md text-[12px] font-medium transition-colors cursor-pointer",style:{color:b?"var(--color-text)":"var(--color-text-muted)",background:b?"var(--color-surface-hover)":"transparent"},onMouseEnter:a=>{b||(a.currentTarget.style.background="var(--color-surface-hover)")},onMouseLeave:a=>{b||(a.currentTarget.style.background="transparent")},children:a.label},a.id)}),"chats"===y&&u&&(0,d.jsx)("button",{type:"button",onClick:u,className:"p-1 rounded-md transition-colors cursor-pointer shrink-0",style:{color:"var(--color-text-muted)"},onMouseEnter:a=>{a.currentTarget.style.background="var(--color-surface-hover)"},onMouseLeave:a=>{a.currentTarget.style.background="transparent"},title:"New chat","aria-label":"New chat",children:(0,d.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,d.jsx)("path",{d:"M5 12h14"}),(0,d.jsx)("path",{d:"M12 5v14"})]})})]}),"chats"===y&&t?(0,d.jsx)("div",{className:"flex-1 min-h-0 flex flex-col relative",children:t}):(0,d.jsxs)(d.Fragment,{children:[o&&(0,d.jsxs)("div",{className:"px-2 pt-1 pb-1",children:[(0,d.jsx)("div",{className:"px-2 pt-2 pb-1 text-[9px] lowercase",style:{color:"var(--color-text-muted)",letterSpacing:"0.05em"},children:"workspace"}),(0,d.jsxs)("div",{className:"space-y-0.5",children:[A.map(a=>{let b=p===a.target;return(0,d.jsxs)("button",{type:"button",onClick:()=>o(a.id),className:"w-full flex items-center gap-2.5 px-2 py-1.5 rounded-lg text-[13px] transition-colors",style:{color:"var(--color-text)",background:b?"var(--color-surface-hover)":"transparent"},onMouseEnter:a=>{b||(a.currentTarget.style.background="var(--color-surface-hover)")},onMouseLeave:a=>{b||(a.currentTarget.style.background="transparent")},children:[(0,d.jsx)("span",{className:"shrink-0",style:{color:"var(--color-text-muted)"},children:a.icon}),a.label]},a.id)}),q&&q.length>0&&s&&q.map(a=>{let b=r===a.name,c=(0,a0.PV)(a.name);return(0,d.jsxs)("button",{type:"button",onClick:()=>s(a.name),className:"w-full flex items-center gap-2.5 px-2 py-1.5 rounded-lg text-[13px] transition-colors",style:{color:"var(--color-text)",background:b?"var(--color-surface-hover)":"transparent"},onMouseEnter:a=>{b||(a.currentTarget.style.background="var(--color-surface-hover)")},onMouseLeave:a=>{b||(a.currentTarget.style.background="transparent")},title:c,children:[(0,d.jsx)("span",{className:"shrink-0",style:{color:"var(--color-text-muted)"},children:(0,d.jsx)(a1.P,{name:a.icon,size:16})}),c]},`crm-object-${a.name}`)})]})]}),(0,d.jsx)("div",{className:"flex-1 min-h-0"}),o&&(0,d.jsx)("div",{className:"px-2 py-1 space-y-0.5",children:B.map(a=>(0,d.jsxs)("button",{type:"button",onClick:()=>o(a.id),className:"w-full flex items-center gap-2.5 px-2 py-1.5 rounded-lg text-[13px] transition-colors",style:{color:"var(--color-text)"},onMouseEnter:a=>{a.currentTarget.style.background="var(--color-surface-hover)"},onMouseLeave:a=>{a.currentTarget.style.background="transparent"},children:[(0,d.jsx)("span",{className:"shrink-0",style:{color:"var(--color-text-muted)"},children:a.icon}),a.label]},a.id))})]}),(0,d.jsxs)("div",{className:"px-2 py-1.5 flex items-center justify-between",children:[(0,d.jsxs)("a",{href:"https://dench.com",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 px-2 py-1 rounded-lg text-[11px]",style:{color:"var(--color-text-muted)"},children:["dench.com"," v3.0.7"]}),(0,d.jsxs)("div",{className:"flex items-center gap-0.5",children:[h&&(0,d.jsx)("button",{type:"button",onClick:h,className:"p-1.5 rounded-lg transition-colors",style:{color:g?"var(--color-text)":"var(--color-text-muted)"},title:g?"Hide dotfiles":"Show dotfiles",children:(0,d.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:g?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"}),(0,d.jsx)("circle",{cx:"12",cy:"12",r:"3"})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49"}),(0,d.jsx)("path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242"}),(0,d.jsx)("path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143"}),(0,d.jsx)("path",{d:"m2 2 20 20"})]})})}),(0,d.jsx)(a3,{})]})]})]});return c?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"drawer-backdrop",onClick:()=>void f?.(),children:(0,d.jsx)("div",{onClick:a=>a.stopPropagation(),className:"fixed inset-y-0 left-0 z-50",children:D})}),(0,d.jsx)(a_.s,{isOpen:w,onClose:()=>x(!1),onCreated:()=>{n?.()}})]}):(0,d.jsxs)(d.Fragment,{children:[!c&&k?C:D,(0,d.jsx)(a_.s,{isOpen:w,onClose:()=>x(!1),onCreated:()=>{n?.()}})]})}},685343:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});var d=c(95253)._0},686937:a=>{"use strict";var b=Object.prototype.hasOwnProperty,c=Object.prototype.toString,d=Object.defineProperty,e=Object.getOwnPropertyDescriptor,f=function(a){return"function"==typeof Array.isArray?Array.isArray(a):"[object Array]"===c.call(a)},g=function(a){if(!a||"[object Object]"!==c.call(a))return!1;var d,e=b.call(a,"constructor"),f=a.constructor&&a.constructor.prototype&&b.call(a.constructor.prototype,"isPrototypeOf");if(a.constructor&&!e&&!f)return!1;for(d in a);return void 0===d||b.call(a,d)},h=function(a,b){d&&"__proto__"===b.name?d(a,b.name,{enumerable:!0,configurable:!0,value:b.newValue,writable:!0}):a[b.name]=b.newValue},i=function(a,c){if("__proto__"===c){if(!b.call(a,c))return;else if(e)return e(a,c).value}return a[c]};a.exports=function a(){var b,c,d,e,j,k,l=arguments[0],m=1,n=arguments.length,o=!1;for("boolean"==typeof l&&(o=l,l=arguments[1]||{},m=2),(null==l||"object"!=typeof l&&"function"!=typeof l)&&(l={});m<n;++m)if(b=arguments[m],null!=b)for(c in b)d=i(l,c),l!==(e=i(b,c))&&(o&&e&&(g(e)||(j=f(e)))?(j?(j=!1,k=d&&f(d)?d:[]):k=d&&g(d)?d:{},h(l,{name:c,newValue:a(o,k,e)})):void 0!==e&&h(l,{name:c,newValue:e}));return l}},688094:(a,b,c)=>{"use strict";c.d(b,{y:()=>E});var d=c(736927),e=c(115962),f=c(327648),g=c(327770),h=c(673977),i=c(405545),j=c(720511),k=c(381802),l=c(86839);let m=new k.hs("chatFileMention"),n=j.bP.create({name:"chatFileMention",group:"inline",inline:!0,atom:!0,selectable:!0,draggable:!0,addAttributes:()=>({label:{default:""},path:{default:""},mentionType:{default:"file"},objectName:{default:""},defaultView:{default:""}}),parseHTML:()=>[{tag:"span[data-chat-file-mention]"}],renderHTML({HTMLAttributes:a}){let b=a.label||"file",c=a.mentionType||"file",d=a.defaultView||"",e={bg:"rgba(120, 113, 108, 0.1)",fg:"inherit"},f="object"===c?(0,l.PV)(b):b;return["span",(0,j.KV)({"data-chat-file-mention":"","data-mention-type":c,...d?{"data-default-view":d}:{},class:"chat-file-mention",style:`--mention-bg: ${e.bg}; --mention-fg: ${e.fg};`,title:a.path||""},a),f]}});var o=c(249855),p=c(941809),q=c(478425);let r=(0,q.A)("outline","photo","Photo",[["path",{d:"M15 8h.01",key:"svg-0"}],["path",{d:"M3 6a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3v-12",key:"svg-1"}],["path",{d:"M3 16l5 -5c.928 -.893 2.072 -.893 3 0l5 5",key:"svg-2"}],["path",{d:"M14 14l1 -1c.928 -.893 2.072 -.893 3 0l3 3",key:"svg-3"}]]),s=(0,q.A)("outline","video","Video",[["path",{d:"M15 10l4.553 -2.276a1 1 0 0 1 1.447 .894v6.764a1 1 0 0 1 -1.447 .894l-4.553 -2.276v-4",key:"svg-0"}],["path",{d:"M3 8a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2l0 -8",key:"svg-1"}]]),t=(0,q.A)("outline","music","Music",[["path",{d:"M3 17a3 3 0 1 0 6 0a3 3 0 0 0 -6 0",key:"svg-0"}],["path",{d:"M13 17a3 3 0 1 0 6 0a3 3 0 0 0 -6 0",key:"svg-1"}],["path",{d:"M9 17v-13h10v13",key:"svg-2"}],["path",{d:"M9 8h10",key:"svg-3"}]]);var u=c(896703);let v=(0,q.A)("outline","code","Code",[["path",{d:"M7 8l-4 4l4 4",key:"svg-0"}],["path",{d:"M17 8l4 4l-4 4",key:"svg-1"}],["path",{d:"M14 4l-4 16",key:"svg-2"}]]);var w=c(490654);let x=(0,q.A)("filled","layout-kanban-filled","LayoutKanbanFilled",[["path",{d:"M10 3a1 1 0 0 1 0 2h-6a1 1 0 1 1 0 -2z",key:"svg-0"}],["path",{d:"M20 3a1 1 0 0 1 0 2h-6a1 1 0 0 1 0 -2z",key:"svg-1"}],["path",{d:"M8 7a3 3 0 0 1 3 3v8a3 3 0 0 1 -3 3h-2a3 3 0 0 1 -3 -3v-8a3 3 0 0 1 3 -3z",key:"svg-2"}],["path",{d:"M18 7a3 3 0 0 1 3 3v2a3 3 0 0 1 -3 3h-2a3 3 0 0 1 -3 -3v-2a3 3 0 0 1 3 -3z",key:"svg-3"}]]);var y=c(118475);let z=(0,q.A)("filled","user-filled","UserFilled",[["path",{d:"M12 2a5 5 0 1 1 -5 5l.005 -.217a5 5 0 0 1 4.995 -4.783z",key:"svg-0"}],["path",{d:"M14 14a5 5 0 0 1 5 5v1a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-1a5 5 0 0 1 5 -5h4z",key:"svg-1"}]]);function A({category:a,defaultView:b}){let c={flexShrink:0};switch(a){case"folder":return(0,d.jsx)(p.A,{size:18,style:{...c,color:"#60a5fa"}});case"image":return(0,d.jsx)(r,{size:18,style:{...c,color:"#10b981"}});case"video":return(0,d.jsx)(s,{size:18,style:{...c,color:"#8b5cf6"}});case"audio":return(0,d.jsx)(t,{size:18,style:{...c,color:"#f59e0b"}});case"pdf":return(0,d.jsx)(u.A,{size:18,style:{...c,color:"#ef4444"}});case"code":return(0,d.jsx)(v,{size:18,style:{...c,color:"#3b82f6"}});case"database":return(0,d.jsx)(w.A,{size:18,style:c});case"object":return"kanban"===b?(0,d.jsx)(x,{size:18,style:{...c,color:"#8b7cf6"}}):(0,d.jsx)(y.A,{size:18,style:{...c,color:"#42a97a"}});case"entry":return(0,d.jsx)(z,{size:18,style:{...c,color:"#22c55e"}});default:return(0,d.jsx)(u.A,{size:18,style:{...c,opacity:.7}})}}let B=(0,e.forwardRef)(({items:a,command:b,loading:c},f)=>{let[g,h]=(0,e.useState)(0),i=(0,e.useRef)(null);(0,e.useEffect)(()=>{h(0)},[a]),(0,e.useEffect)(()=>{let a=i.current?.children[g];a?.scrollIntoView({block:"nearest"})},[g]);let j=(0,e.useCallback)(c=>{let d=a[c];d&&b(d)},[a,b]);(0,e.useImperativeHandle)(f,()=>({onKeyDown:({event:b})=>"ArrowUp"===b.key?(h(b=>(b+a.length-1)%a.length),!0):"ArrowDown"===b.key?(h(b=>(b+1)%a.length),!0):("Enter"===b.key||"Tab"===b.key)&&(j(g),!0)}));let k="bg-neutral-100/[0.67] dark:bg-neutral-900/[0.67] border border-white dark:border-white/10 backdrop-blur-md shadow-[0_0_25px_0_rgba(0,0,0,0.16)]";return c?(0,d.jsx)("div",{className:`rounded-3xl p-3 ${k}`,style:{minWidth:280,maxWidth:400},children:(0,d.jsx)("span",{className:"text-xs animate-pulse",style:{color:"var(--color-text-muted)"},children:"Searching..."})}):0===a.length?(0,d.jsx)("div",{className:`rounded-3xl p-3 text-center ${k}`,style:{minWidth:280,maxWidth:400},children:(0,d.jsx)("span",{className:"text-xs",style:{color:"var(--color-text-muted)"},children:"No results found"})}):(0,d.jsx)("div",{ref:i,className:`rounded-3xl p-1 overflow-y-auto thin-scrollbar ${k}`,style:{minWidth:280,maxWidth:400,maxHeight:300},children:a.map((a,b)=>{let c=function(a,b){if("folder"===b)return"folder";if("database"===b)return"database";if("object"===b)return"object";if("entry"===b)return"entry";let c=a.split(".").pop()?.toLowerCase()??"";return["jpg","jpeg","png","gif","webp","svg","bmp","ico","tiff","heic"].includes(c)?"image":["mp4","webm","mov","avi","mkv","flv"].includes(c)?"video":["mp3","wav","ogg","aac","flac","m4a"].includes(c)?"audio":"pdf"===c?"pdf":["js","ts","tsx","jsx","py","rb","go","rs","java","cpp","c","h","css","html","json","yaml","yml","toml","sh","bash","sql","swift","kt"].includes(c)?"code":"document"===b?"document":"other"}(a.name,a.type),e=a.icon&&/\p{Emoji_Presentation}/u.test(a.icon),f="object"===a.type||"entry"===a.type,i="object"===a.type?(0,l.PV)(a.name):a.name,k="entry"===a.type&&a.objectName?(0,l.A3)(a.objectName):f?"kanban"===a.defaultView?"Board":"Table":a.path.replace(/^\/Users\/[^/]+/,"~").replace(/^\/home\/[^/]+/,"~").replace(/^[A-Z]:\\Users\\[^\\]+/,"~");return(0,d.jsxs)("button",{type:"button",className:`w-full flex items-center gap-2.5 px-2.5 py-1.5 text-left transition-all rounded-2xl select-none ${b===g?"bg-neutral-400/15":""}`,style:{color:"var(--color-text)"},onClick:()=>j(b),onMouseEnter:()=>h(b),children:[(0,d.jsx)("span",{className:"flex-shrink-0 flex items-center",style:{opacity:.55},children:e?(0,d.jsx)("span",{className:"text-[15px] leading-none",children:a.icon}):(0,d.jsx)(A,{category:c,defaultView:a.defaultView})}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("div",{className:"text-sm font-medium truncate",children:i}),(0,d.jsx)("div",{className:"text-xs truncate",style:{color:"var(--color-text-muted)"},title:f?k:a.path,children:k})]})]},a.path)})})});function C({items:a,command:b,clientRect:c,componentRef:f,loading:g}){let h=(0,e.useRef)(null);return(0,o.createPortal)((0,d.jsx)("div",{ref:h,children:(0,d.jsx)(B,{ref:f,items:a,command:b,loading:g})}),document.body)}function D(a){if(!a)return{text:"",mentionedFiles:[]};let b=[],c=[];return a.state.doc.forEach(a=>{if("paragraph"===a.type.name||"hardBreak"===a.type.name){let d="";a.descendants(a=>{if("chatFileMention"===a.type.name){let c=a.attrs.label,e=a.attrs.path,f=a.attrs.mentionType,g=a.attrs.objectName;return b.push({name:c,path:e}),"object"===f?d+=`[object: ${c}]`:"entry"===f?d+=`[entry: ${g?`${g}/`:""}${c}]`:d+=`[file: ${e}]`,!1}return a.isText&&a.text&&(d+=a.text),"hardBreak"===a.type.name&&(d+="\n"),!0}),c.push(d)}}),{text:c.join("\n").trim(),mentionedFiles:b}}B.displayName="FileMentionList";let E=(0,e.forwardRef)(function({onSubmit:a,onChange:b,onNativeFileDrop:k,placeholder:l,disabled:o,compact:p,searchFn:q},r){let s=(0,e.useRef)(a);s.current=a;let t=(0,e.useRef)(k);t.current=k;let u=(0,e.useRef)(q??null);u.current=q??null;let v=(0,e.useRef)(null),w=(0,f.hG)({immediatelyRender:!1,extensions:[g.A.configure({heading:!1,codeBlock:!1,blockquote:!1,horizontalRule:!1,bulletList:!1,orderedList:!1,listItem:!1}),h.A.configure({placeholder:l??"Ask anything...",showOnlyWhenEditable:!1}),n,j.YY.create({name:"chatFileMentionSuggestion",addProseMirrorPlugins(){return[(0,i.Ay)({editor:this.editor,char:"@",pluginKey:m,startOfLine:!1,allowSpaces:!0,command:({editor:a,range:b,props:c})=>{let d="object"===c.type?"object":"entry"===c.type?"entry":"folder"===c.type?"folder":"file";a.chain().focus().deleteRange(b).insertContent([{type:"chatFileMention",attrs:{label:c.name,path:c.path,mentionType:d,objectName:c.objectName??"",defaultView:c.defaultView??""}},{type:"text",text:" "}]).run()},items:({query:a})=>[],render:()=>{let a=null,b=null,e={current:null},f="",g=[],h=!1,i=null,j=null,k=null;function l(){b&&j&&b.render((0,d.jsx)(C,{items:g,command:j,clientRect:k,componentRef:e,loading:h}))}function m(a){let b=a.path??a.id,c=b.split("/").pop()??a.label;return{name:"object"===a.kind||"entry"===a.kind?a.label:c,path:b,type:"entry"===a.kind?"entry":"object"===a.kind?"object":a.nodeType??"file",icon:a.icon,objectName:a.objectName,entryId:a.entryId,defaultView:a.defaultView}}function n(a){let b=u?.current;return!!b&&(g=b(a,20).map(m),h=!1,l(),!0)}async function o(a){if(!n(a)){h=!0,l();try{let b=a.startsWith("/")||a.startsWith("~/")||a.startsWith("../")||a.startsWith("./")||a.includes("/")?`path=${encodeURIComponent(a)}`:a?`q=${encodeURIComponent(a)}`:"",c=`/api/workspace/suggest-files${b?`?${b}`:""}`,d=await fetch(c);g=(await d.json()).items??[]}catch{g=[]}h=!1,l()}}function p(a){n(a)||(i&&clearTimeout(i),i=setTimeout(()=>{o(a)},120))}return{onStart:d=>{a=document.createElement("div"),document.body.appendChild(a),j=d.command,k=d.clientRect??null,f=d.query,c.e(70684).then(c.t.bind(c,570684,19)).then(({createRoot:c})=>{b=c(a),p(f)})},onUpdate:a=>{j=a.command,k=a.clientRect??null,p(f=a.query)},onKeyDown:c=>{if("Escape"===c.event.key)return b?.unmount(),a?.remove(),a=null,b=null,!0;let d=e.current?.onKeyDown(c)??!1;return d&&c.event.stopImmediatePropagation(),d},onExit:()=>{i&&clearTimeout(i),b?.unmount(),a?.remove(),a=null,b=null}}}})]}})],editorProps:{attributes:{class:`chat-editor-content ${p?"chat-editor-compact":""}`,style:"color: var(--color-text);"},handleKeyDown:(a,b)=>{if("Enter"===b.key&&!b.shiftKey&&!b.isComposing){let b=m.getState(a.state);return!b?.active}return!1},handleDOMEvents:{paste:(a,b)=>{let c=b.clipboardData;if(!c)return!1;let d=[];if(c.items){for(let a of Array.from(c.items))if("file"===a.kind){let b=a.getAsFile();b&&d.push(b)}}if(d.length>0){b.preventDefault();let a=new DataTransfer;for(let b of d)a.items.add(b);return t.current?.(a.files),!0}return!1},dragover:(a,b)=>!!(b.dataTransfer?.types.includes("application/x-file-mention")||b.dataTransfer?.types.includes("Files"))&&(b.preventDefault(),b.dataTransfer.dropEffect="copy",!0),drop:(a,b)=>{let c=()=>{let a=b.target instanceof HTMLElement?b.target.closest("[data-chat-drop-target]"):null;a?.removeAttribute("data-drag-hover")},d=b.dataTransfer?.getData("application/x-file-mention");if(d){b.preventDefault(),b.stopPropagation(),c();try{let{name:a,path:b}=JSON.parse(d);a&&b&&v.current?.chain().focus().insertContent([{type:"chatFileMention",attrs:{label:a,path:b}},{type:"text",text:" "}]).run()}catch{}return!0}let e=b.dataTransfer?.files;return!!e&&e.length>0&&(b.preventDefault(),b.stopPropagation(),c(),t.current?.(e),!0)}}},onUpdate:({editor:a})=>{b?.(a.isEmpty)}});return(0,e.useEffect)(()=>{v.current=w??null},[w]),(0,e.useEffect)(()=>{if(!w)return;let a=a=>{if("Enter"===a.key&&!a.shiftKey&&!a.isComposing){let b=m.getState(w.state);if(b?.active)return;a.preventDefault();let{text:c,mentionedFiles:d}=D(w),e=w.getHTML();s.current(c,d,e),(c.trim()||d.length>0)&&w.commands.clearContent(!0),requestAnimationFrame(()=>w.commands.focus())}},b=w.view.dom;return b.addEventListener("keydown",a),()=>b.removeEventListener("keydown",a)},[w]),(0,e.useEffect)(()=>{w&&w.setEditable(!o)},[w,o]),(0,e.useImperativeHandle)(r,()=>({insertFileMention:(a,b)=>{w?.chain().focus().insertContent([{type:"chatFileMention",attrs:{label:a,path:b}},{type:"text",text:" "}]).run()},clear:()=>{w?.commands.clearContent(!0)},focus:()=>{w?.commands.focus()},isEmpty:()=>w?.isEmpty??!0,submit:()=>{if(!w)return;let{text:a,mentionedFiles:b}=D(w);if(a.trim()||b.length>0){let c=w.getHTML();s.current(a,b,c),w.commands.clearContent(!0),requestAnimationFrame(()=>w.commands.focus())}},setText:a=>{w?.commands.setContent(a),w?.commands.focus("end")},appendText:a=>{if(!w)return;let b=a.trim();if(!b)return;let{text:c}=D(w),d=c.trim().length>0?" ":"";w.chain().focus("end").insertContent(`${d}${b}`).run()}})),(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(f.$Z,{editor:w}),(0,d.jsx)("style",{children:`
218
+ `),()=>{s.contains(r)&&s.removeChild(r)}},[b]),(0,d.jsx)(m,{isPresent:b,childRef:j,sizeRef:n,pop:h,children:!1===h?a:e.cloneElement(a,{ref:p})})}let o=({children:a,initial:b,isPresent:c,onExitComplete:f,custom:h,presenceAffectsLayout:j,mode:k,anchorX:l,anchorY:m,root:o})=>{let q=(0,g.M)(p),r=(0,e.useId)(),s=!0,t=(0,e.useMemo)(()=>(s=!1,{id:r,initial:b,isPresent:c,custom:h,onExitComplete:a=>{for(let b of(q.set(a,!0),q.values()))if(!b)return;f&&f()},register:a=>(q.set(a,!1),()=>q.delete(a))}),[c,q,f]);return j&&s&&(t={...t}),(0,e.useMemo)(()=>{q.forEach((a,b)=>q.set(b,!1))},[c]),e.useEffect(()=>{c||q.size||!f||f()},[c]),a=(0,d.jsx)(n,{pop:"popLayout"===k,isPresent:c,anchorX:l,anchorY:m,root:o,children:a}),(0,d.jsx)(i.t.Provider,{value:t,children:a})};function p(){return new Map}var q=c(15086);let r=a=>a.key||"";function s(a){let b=[];return e.Children.forEach(a,a=>{(0,e.isValidElement)(a)&&b.push(a)}),b}let t=({children:a,custom:b,initial:c=!0,onExitComplete:i,presenceAffectsLayout:j=!0,mode:k="sync",propagate:l=!1,anchorX:m="left",anchorY:n="top",root:p})=>{let[t,u]=(0,q.xQ)(l),v=(0,e.useMemo)(()=>s(a),[a]),w=l&&!t?[]:v.map(r),x=(0,e.useRef)(!0),y=(0,e.useRef)(v),z=(0,g.M)(()=>new Map),A=(0,e.useRef)(new Set),[B,C]=(0,e.useState)(v),[D,E]=(0,e.useState)(v);(0,h.E)(()=>{x.current=!1,y.current=v;for(let a=0;a<D.length;a++){let b=r(D[a]);w.includes(b)?(z.delete(b),A.current.delete(b)):!0!==z.get(b)&&z.set(b,!1)}},[D,w.length,w.join("-")]);let F=[];if(v!==B){let a=[...v];for(let b=0;b<D.length;b++){let c=D[b],d=r(c);w.includes(d)||(a.splice(b,0,c),F.push(c))}return"wait"===k&&F.length&&(a=F),E(s(a)),C(v),null}let{forceRender:G}=(0,e.useContext)(f.L);return(0,d.jsx)(d.Fragment,{children:D.map(a=>{let e=r(a),f=(!l||!!t)&&(v===D||w.includes(e));return(0,d.jsx)(o,{isPresent:f,initial:(!x.current||!!c)&&void 0,custom:b,presenceAffectsLayout:j,mode:k,root:p,onExitComplete:f?void 0:()=>{if(A.current.has(e)||(A.current.add(e),!z.has(e)))return;z.set(e,!0);let a=!0;z.forEach(b=>{b||(a=!1)}),a&&(G?.(),E(y.current),l&&u?.(),i&&i())},anchorX:m,anchorY:n,children:a},e)})})}},656159:(a,b)=>{"use strict";Object.defineProperty(b,Symbol.toStringTag,{value:"Module"}),b.isDeepKey=function(a){switch(typeof a){case"number":case"symbol":return!1;case"string":return a.includes(".")||a.includes("[")||a.includes("]")}}},658422:(a,b,c)=>{"use strict";Object.defineProperty(b,Symbol.toStringTag,{value:"Module"});let d=c(452171),e=c(266196),f=c(606461);b.cloneDeepWith=function(a,b){return d.cloneDeepWith(a,(c,g,h,i)=>{let j=b?.(c,g,h,i);if(void 0!==j)return j;if("object"==typeof a){if(e.getTag(a)===f.objectTag&&"function"!=typeof a.constructor){let b={};return i.set(a,b),d.copyProperties(b,a,h,i),b}switch(Object.prototype.toString.call(a)){case f.numberTag:case f.stringTag:case f.booleanTag:{let b=new a.constructor(a?.valueOf());return d.copyProperties(b,a),b}case f.argumentsTag:{let b={};return d.copyProperties(b,a),b.length=a.length,b[Symbol.iterator]=a[Symbol.iterator],b}default:return}}})}},658556:(a,b,c)=>{"use strict";function d(a,b){let c=String(a);if("string"!=typeof b)throw TypeError("Expected character");let d=0,e=c.indexOf(b);for(;-1!==e;)d++,e=c.indexOf(b,e+b.length);return d}c.d(b,{A:()=>aI});var e=c(972421),f=c(145214),g=c(423721),h=c(348445);let i="phrasing",j=["autolink","link","image","label"];function k(a){this.enter({type:"link",title:null,url:"",children:[]},a)}function l(a){this.config.enter.autolinkProtocol.call(this,a)}function m(a){this.config.exit.autolinkProtocol.call(this,a)}function n(a){this.config.exit.data.call(this,a);let b=this.stack[this.stack.length-1];(0,e.ok)("link"===b.type),b.url="http://"+this.sliceSerialize(a)}function o(a){this.config.exit.autolinkEmail.call(this,a)}function p(a){this.exit(a)}function q(a){!function(a,b,c){let d=(0,h.C)((c||{}).ignore||[]),e=function(a){let b=[];if(!Array.isArray(a))throw TypeError("Expected find and replace tuple or list of tuples");let c=!a[0]||Array.isArray(a[0])?a:[a],d=-1;for(;++d<c.length;){var e;let a=c[d];b.push(["string"==typeof(e=a[0])?RegExp(function(a){if("string"!=typeof a)throw TypeError("Expected a string");return a.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}(e),"g"):e,function(a){return"function"==typeof a?a:function(){return a}}(a[1])])}return b}(b),f=-1;for(;++f<e.length;)(0,g.VG)(a,"text",i);function i(a,b){let c,g=-1;for(;++g<b.length;){let a=b[g],e=c?c.children:void 0;if(d(a,e?e.indexOf(a):void 0,c))return;c=a}if(c)return function(a,b){let c=b[b.length-1],d=e[f][0],g=e[f][1],h=0,i=c.children.indexOf(a),j=!1,k=[];d.lastIndex=0;let l=d.exec(a.value);for(;l;){let c=l.index,e={index:l.index,input:l.input,stack:[...b,a]},f=g(...l,e);if("string"==typeof f&&(f=f.length>0?{type:"text",value:f}:void 0),!1===f?d.lastIndex=c+1:(h!==c&&k.push({type:"text",value:a.value.slice(h,c)}),Array.isArray(f)?k.push(...f):f&&k.push(f),h=c+l[0].length,j=!0),!d.global)break;l=d.exec(a.value)}return j?(h<a.value.length&&k.push({type:"text",value:a.value.slice(h)}),c.children.splice(i,1,...k)):k=[a],i+k.length}(a,b)}}(a,[[/(https?:\/\/|www(?=\.))([-.\w]+)([^ \t\r\n]*)/gi,r],[/(?<=^|\s|\p{P}|\p{S})([-.\w+]+)@([-\w]+(?:\.[-\w]+)+)/gu,s]],{ignore:["link","linkReference"]})}function r(a,b,c,e,f){let g="";if(!t(f)||(/^w/i.test(b)&&(c=b+c,b="",g="http://"),!function(a){let b=a.split(".");return!(b.length<2||b[b.length-1]&&(/_/.test(b[b.length-1])||!/[a-zA-Z\d]/.test(b[b.length-1]))||b[b.length-2]&&(/_/.test(b[b.length-2])||!/[a-zA-Z\d]/.test(b[b.length-2])))}(c)))return!1;let h=function(a){let b=/[!"&'),.:;<>?\]}]+$/.exec(a);if(!b)return[a,void 0];a=a.slice(0,b.index);let c=b[0],e=c.indexOf(")"),f=d(a,"("),g=d(a,")");for(;-1!==e&&f>g;)a+=c.slice(0,e+1),e=(c=c.slice(e+1)).indexOf(")"),g++;return[a,c]}(c+e);if(!h[0])return!1;let i={type:"link",title:null,url:g+b+h[0],children:[{type:"text",value:b+h[0]}]};return h[1]?[i,{type:"text",value:h[1]}]:i}function s(a,b,c,d){return!(!t(d,!0)||/[-\d_]$/.test(c))&&{type:"link",title:null,url:"mailto:"+b+"@"+c,children:[{type:"text",value:b+"@"+c}]}}function t(a,b){let c=a.input.charCodeAt(a.index-1);return(0===a.index||(0,f.Ny)(c)||(0,f.es)(c))&&(!b||47!==c)}var u=c(732347);function v(){this.buffer()}function w(a){this.enter({type:"footnoteReference",identifier:"",label:""},a)}function x(){this.buffer()}function y(a){this.enter({type:"footnoteDefinition",identifier:"",label:"",children:[]},a)}function z(a){let b=this.resume(),c=this.stack[this.stack.length-1];(0,e.ok)("footnoteReference"===c.type),c.identifier=(0,u.B)(this.sliceSerialize(a)).toLowerCase(),c.label=b}function A(a){this.exit(a)}function B(a){let b=this.resume(),c=this.stack[this.stack.length-1];(0,e.ok)("footnoteDefinition"===c.type),c.identifier=(0,u.B)(this.sliceSerialize(a)).toLowerCase(),c.label=b}function C(a){this.exit(a)}function D(a,b,c,d){let e=c.createTracker(d),f=e.move("[^"),g=c.enter("footnoteReference"),h=c.enter("reference");return f+=e.move(c.safe(c.associationId(a),{after:"]",before:f})),h(),g(),f+=e.move("]")}function E(a,b,c){return 0===b?a:F(a,b,c)}function F(a,b,c){return(c?"":" ")+a}D.peek=function(){return"["};let G=["autolink","destinationLiteral","destinationRaw","reference","titleQuote","titleApostrophe"];function H(a){this.enter({type:"delete",children:[]},a)}function I(a){this.exit(a)}function J(a,b,c,d){let e=c.createTracker(d),f=c.enter("strikethrough"),g=e.move("~~");return g+=c.containerPhrasing(a,{...e.current(),before:g,after:"~"}),g+=e.move("~~"),f(),g}function K(a){return a.length}function L(a){let b="string"==typeof a?a.codePointAt(0):0;return 67===b||99===b?99:76===b||108===b?108:114*(82===b||114===b)}J.peek=function(){return"~"};var M=c(294401);c(320608);c(210164);function N(a,b,c){let d=a.value||"",e="`",f=-1;for(;RegExp("(^|[^`])"+e+"([^`]|$)").test(d);)e+="`";for(/[^ \r\n]/.test(d)&&(/^[ \r\n]/.test(d)&&/[ \r\n]$/.test(d)||/^`|`$/.test(d))&&(d=" "+d+" ");++f<c.unsafe.length;){let a,b=c.unsafe[f],e=c.compilePattern(b);if(b.atBreak)for(;a=e.exec(d);){let b=a.index;10===d.charCodeAt(b)&&13===d.charCodeAt(b-1)&&b--,d=d.slice(0,b)+" "+d.slice(a.index+1)}}return e+d+e}N.peek=function(){return"`"};(0,h.C)(["break","delete","emphasis","footnote","footnoteReference","image","imageReference","inlineCode","inlineMath","link","linkReference","mdxJsxTextElement","mdxTextExpression","strong","text","textDirective"]);let O={inlineCode:N,listItem:function(a,b,c,d){let e=function(a){let b=a.options.listItemIndent||"one";if("tab"!==b&&"one"!==b&&"mixed"!==b)throw Error("Cannot serialize items with `"+b+"` for `options.listItemIndent`, expected `tab`, `one`, or `mixed`");return b}(c),f=c.bulletCurrent||function(a){let b=a.options.bullet||"*";if("*"!==b&&"+"!==b&&"-"!==b)throw Error("Cannot serialize items with `"+b+"` for `options.bullet`, expected `*`, `+`, or `-`");return b}(c);b&&"list"===b.type&&b.ordered&&(f=("number"==typeof b.start&&b.start>-1?b.start:1)+(!1===c.options.incrementListMarker?0:b.children.indexOf(a))+f);let g=f.length+1;("tab"===e||"mixed"===e&&(b&&"list"===b.type&&b.spread||a.spread))&&(g=4*Math.ceil(g/4));let h=c.createTracker(d);h.move(f+" ".repeat(g-f.length)),h.shift(g);let i=c.enter("listItem"),j=c.indentLines(c.containerFlow(a,h.current()),function(a,b,c){return b?(c?"":" ".repeat(g))+a:(c?f:f+" ".repeat(g-f.length))+a});return i(),j}};function P(a){let b=a._align;(0,e.ok)(b,"expected `_align` on table"),this.enter({type:"table",align:b.map(function(a){return"none"===a?null:a}),children:[]},a),this.data.inTable=!0}function Q(a){this.exit(a),this.data.inTable=void 0}function R(a){this.enter({type:"tableRow",children:[]},a)}function S(a){this.exit(a)}function T(a){this.enter({type:"tableCell",children:[]},a)}function U(a){let b=this.resume();this.data.inTable&&(b=b.replace(/\\([\\|])/g,V));let c=this.stack[this.stack.length-1];(0,e.ok)("inlineCode"===c.type),c.value=b,this.exit(a)}function V(a,b){return"|"===b?b:a}function W(a){let b=this.stack[this.stack.length-2];(0,e.ok)("listItem"===b.type),b.checked="taskListCheckValueChecked"===a.type}function X(a){let b=this.stack[this.stack.length-2];if(b&&"listItem"===b.type&&"boolean"==typeof b.checked){let a=this.stack[this.stack.length-1];(0,e.ok)("paragraph"===a.type);let c=a.children[0];if(c&&"text"===c.type){let d,e=b.children,f=-1;for(;++f<e.length;){let a=e[f];if("paragraph"===a.type){d=a;break}}d===a&&(c.value=c.value.slice(1),0===c.value.length?a.children.shift():a.position&&c.position&&"number"==typeof c.position.start.offset&&(c.position.start.column++,c.position.start.offset++,a.position.start=Object.assign({},c.position.start)))}}this.exit(a)}function Y(a,b,c,d){let e=a.children[0],f="boolean"==typeof a.checked&&e&&"paragraph"===e.type,g="["+(a.checked?"x":" ")+"] ",h=c.createTracker(d);f&&h.move(g);let i=O.listItem(a,b,c,{...d,...h.current()});return f&&(i=i.replace(/^(?:[*+-]|\d+\.)([\r\n]| {1,3})/,function(a){return a+g})),i}var Z=c(161693);let _={tokenize:function(a,b,c){let d=0;return function b(f){return(87===f||119===f)&&d<3?(d++,a.consume(f),b):46===f&&3===d?(a.consume(f),e):c(f)};function e(a){return null===a?c(a):b(a)}},partial:!0},aa={tokenize:function(a,b,c){let d,e,g;return h;function h(b){return 46===b||95===b?a.check(ac,j,i)(b):null===b||(0,f.Ee)(b)||(0,f.Ny)(b)||45!==b&&(0,f.es)(b)?j(b):(g=!0,a.consume(b),h)}function i(b){return 95===b?d=!0:(e=d,d=void 0),a.consume(b),h}function j(a){return e||d||!g?c(a):b(a)}},partial:!0},ab={tokenize:function(a,b){let c=0,d=0;return e;function e(h){return 40===h?(c++,a.consume(h),e):41===h&&d<c?g(h):33===h||34===h||38===h||39===h||41===h||42===h||44===h||46===h||58===h||59===h||60===h||63===h||93===h||95===h||126===h?a.check(ac,b,g)(h):null===h||(0,f.Ee)(h)||(0,f.Ny)(h)?b(h):(a.consume(h),e)}function g(b){return 41===b&&d++,a.consume(b),e}},partial:!0},ac={tokenize:function(a,b,c){return d;function d(h){return 33===h||34===h||39===h||41===h||42===h||44===h||46===h||58===h||59===h||63===h||95===h||126===h?(a.consume(h),d):38===h?(a.consume(h),g):93===h?(a.consume(h),e):60===h||null===h||(0,f.Ee)(h)||(0,f.Ny)(h)?b(h):c(h)}function e(a){return null===a||40===a||91===a||(0,f.Ee)(a)||(0,f.Ny)(a)?b(a):d(a)}function g(b){return(0,f.CW)(b)?function b(e){return 59===e?(a.consume(e),d):(0,f.CW)(e)?(a.consume(e),b):c(e)}(b):c(b)}},partial:!0},ad={tokenize:function(a,b,c){return function(b){return a.consume(b),d};function d(a){return(0,f.lV)(a)?c(a):b(a)}},partial:!0},ae={name:"wwwAutolink",tokenize:function(a,b,c){let d=this;return function(b){return 87!==b&&119!==b||!aj.call(d,d.previous)||an(d.events)?c(b):(a.enter("literalAutolink"),a.enter("literalAutolinkWww"),a.check(_,a.attempt(aa,a.attempt(ab,e),c),c)(b))};function e(c){return a.exit("literalAutolinkWww"),a.exit("literalAutolink"),b(c)}},previous:aj},af={name:"protocolAutolink",tokenize:function(a,b,c){let d=this,e="",g=!1;return function(b){return(72===b||104===b)&&ak.call(d,d.previous)&&!an(d.events)?(a.enter("literalAutolink"),a.enter("literalAutolinkHttp"),e+=String.fromCodePoint(b),a.consume(b),h):c(b)};function h(b){if((0,f.CW)(b)&&e.length<5)return e+=String.fromCodePoint(b),a.consume(b),h;if(58===b){let c=e.toLowerCase();if("http"===c||"https"===c)return a.consume(b),i}return c(b)}function i(b){return 47===b?(a.consume(b),g)?j:(g=!0,i):c(b)}function j(b){return null===b||(0,f.JQ)(b)||(0,f.Ee)(b)||(0,f.Ny)(b)||(0,f.es)(b)?c(b):a.attempt(aa,a.attempt(ab,k),c)(b)}function k(c){return a.exit("literalAutolinkHttp"),a.exit("literalAutolink"),b(c)}},previous:ak},ag={name:"emailAutolink",tokenize:function(a,b,c){let d,e,g=this;return function(b){return!am(b)||!al.call(g,g.previous)||an(g.events)?c(b):(a.enter("literalAutolink"),a.enter("literalAutolinkEmail"),function b(d){return am(d)?(a.consume(d),b):64===d?(a.consume(d),h):c(d)}(b))};function h(b){return 46===b?a.check(ad,j,i)(b):45===b||95===b||(0,f.lV)(b)?(e=!0,a.consume(b),h):j(b)}function i(b){return a.consume(b),d=!0,h}function j(h){return e&&d&&(0,f.CW)(g.previous)?(a.exit("literalAutolinkEmail"),a.exit("literalAutolink"),b(h)):c(h)}},previous:al},ah={},ai=48;for(;ai<123;)ah[ai]=ag,58==++ai?ai=65:91===ai&&(ai=97);function aj(a){return null===a||40===a||42===a||95===a||91===a||93===a||126===a||(0,f.Ee)(a)}function ak(a){return!(0,f.CW)(a)}function al(a){return!(47===a||am(a))}function am(a){return 43===a||45===a||46===a||95===a||(0,f.lV)(a)}function an(a){let b=a.length,c=!1;for(;b--;){let d=a[b][1];if(("labelLink"===d.type||"labelImage"===d.type)&&!d._balanced){c=!0;break}if(d._gfmAutolinkLiteralWalkedInto){c=!1;break}}return a.length>0&&!c&&(a[a.length-1][1]._gfmAutolinkLiteralWalkedInto=!0),c}ah[43]=ag,ah[45]=ag,ah[46]=ag,ah[95]=ag,ah[72]=[ag,af],ah[104]=[ag,af],ah[87]=[ag,ae],ah[119]=[ag,ae];var ao=c(360478),ap=c(621405);let aq={tokenize:function(a,b,c){let d=this;return(0,ap.N)(a,function(a){let e=d.events[d.events.length-1];return e&&"gfmFootnoteDefinitionIndent"===e[1].type&&4===e[2].sliceSerialize(e[1],!0).length?b(a):c(a)},"gfmFootnoteDefinitionIndent",5)},partial:!0};function ar(a,b,c){let d,e=this,f=e.events.length,g=e.parser.gfmFootnotes||(e.parser.gfmFootnotes=[]);for(;f--;){let a=e.events[f][1];if("labelImage"===a.type){d=a;break}if("gfmFootnoteCall"===a.type||"labelLink"===a.type||"label"===a.type||"image"===a.type||"link"===a.type)break}return function(f){if(!d||!d._balanced)return c(f);let h=(0,u.B)(e.sliceSerialize({start:d.end,end:e.now()}));return 94===h.codePointAt(0)&&g.includes(h.slice(1))?(a.enter("gfmFootnoteCallLabelMarker"),a.consume(f),a.exit("gfmFootnoteCallLabelMarker"),b(f)):c(f)}}function as(a,b){let c=a.length;for(;c--;)if("labelImage"===a[c][1].type&&"enter"===a[c][0]){a[c][1];break}a[c+1][1].type="data",a[c+3][1].type="gfmFootnoteCallLabelMarker";let d={type:"gfmFootnoteCall",start:Object.assign({},a[c+3][1].start),end:Object.assign({},a[a.length-1][1].end)},e={type:"gfmFootnoteCallMarker",start:Object.assign({},a[c+3][1].end),end:Object.assign({},a[c+3][1].end)};e.end.column++,e.end.offset++,e.end._bufferIndex++;let f={type:"gfmFootnoteCallString",start:Object.assign({},e.end),end:Object.assign({},a[a.length-1][1].start)},g={type:"chunkString",contentType:"string",start:Object.assign({},f.start),end:Object.assign({},f.end)},h=[a[c+1],a[c+2],["enter",d,b],a[c+3],a[c+4],["enter",e,b],["exit",e,b],["enter",f,b],["enter",g,b],["exit",g,b],["exit",f,b],a[a.length-2],a[a.length-1],["exit",d,b]];return a.splice(c,a.length-c+1,...h),a}function at(a,b,c){let d,e=this,g=e.parser.gfmFootnotes||(e.parser.gfmFootnotes=[]),h=0;return function(b){return a.enter("gfmFootnoteCall"),a.enter("gfmFootnoteCallLabelMarker"),a.consume(b),a.exit("gfmFootnoteCallLabelMarker"),i};function i(b){return 94!==b?c(b):(a.enter("gfmFootnoteCallMarker"),a.consume(b),a.exit("gfmFootnoteCallMarker"),a.enter("gfmFootnoteCallString"),a.enter("chunkString").contentType="string",j)}function j(i){if(h>999||93===i&&!d||null===i||91===i||(0,f.Ee)(i))return c(i);if(93===i){a.exit("chunkString");let d=a.exit("gfmFootnoteCallString");return g.includes((0,u.B)(e.sliceSerialize(d)))?(a.enter("gfmFootnoteCallLabelMarker"),a.consume(i),a.exit("gfmFootnoteCallLabelMarker"),a.exit("gfmFootnoteCall"),b):c(i)}return(0,f.Ee)(i)||(d=!0),h++,a.consume(i),92===i?k:j}function k(b){return 91===b||92===b||93===b?(a.consume(b),h++,j):j(b)}}function au(a,b,c){let d,e,g=this,h=g.parser.gfmFootnotes||(g.parser.gfmFootnotes=[]),i=0;return function(b){return a.enter("gfmFootnoteDefinition")._container=!0,a.enter("gfmFootnoteDefinitionLabel"),a.enter("gfmFootnoteDefinitionLabelMarker"),a.consume(b),a.exit("gfmFootnoteDefinitionLabelMarker"),j};function j(b){return 94===b?(a.enter("gfmFootnoteDefinitionMarker"),a.consume(b),a.exit("gfmFootnoteDefinitionMarker"),a.enter("gfmFootnoteDefinitionLabelString"),a.enter("chunkString").contentType="string",k):c(b)}function k(b){if(i>999||93===b&&!e||null===b||91===b||(0,f.Ee)(b))return c(b);if(93===b){a.exit("chunkString");let c=a.exit("gfmFootnoteDefinitionLabelString");return d=(0,u.B)(g.sliceSerialize(c)),a.enter("gfmFootnoteDefinitionLabelMarker"),a.consume(b),a.exit("gfmFootnoteDefinitionLabelMarker"),a.exit("gfmFootnoteDefinitionLabel"),m}return(0,f.Ee)(b)||(e=!0),i++,a.consume(b),92===b?l:k}function l(b){return 91===b||92===b||93===b?(a.consume(b),i++,k):k(b)}function m(b){return 58===b?(a.enter("definitionMarker"),a.consume(b),a.exit("definitionMarker"),h.includes(d)||h.push(d),(0,ap.N)(a,n,"gfmFootnoteDefinitionWhitespace")):c(b)}function n(a){return b(a)}}function av(a,b,c){return a.check(ao.B,b,a.attempt(aq,b,c))}function aw(a){a.exit("gfmFootnoteDefinition")}var ax=c(962349),ay=c(598525);class az{constructor(){this.map=[]}add(a,b,c){!function(a,b,c,d){let e=0;if(0!==c||0!==d.length){for(;e<a.map.length;){if(a.map[e][0]===b){a.map[e][1]+=c,a.map[e][2].push(...d);return}e+=1}a.map.push([b,c,d])}}(this,a,b,c)}consume(a){if(this.map.sort(function(a,b){return a[0]-b[0]}),0===this.map.length)return;let b=this.map.length,c=[];for(;b>0;)b-=1,c.push(a.slice(this.map[b][0]+this.map[b][1]),this.map[b][2]),a.length=this.map[b][0];c.push(a.slice()),a.length=0;let d=c.pop();for(;d;){for(let b of d)a.push(b);d=c.pop()}this.map.length=0}}function aA(a,b,c){let d,e=this,g=0,h=0;return function(a){let b=e.events.length-1;for(;b>-1;){let a=e.events[b][1].type;if("lineEnding"===a||"linePrefix"===a)b--;else break}let d=b>-1?e.events[b][1].type:null,f="tableHead"===d||"tableRow"===d?t:i;return f===t&&e.parser.lazy[e.now().line]?c(a):f(a)};function i(b){var c;return a.enter("tableHead"),a.enter("tableRow"),124===(c=b)||(d=!0,h+=1),j(c)}function j(b){return null===b?c(b):(0,f.HP)(b)?h>1?(h=0,e.interrupt=!0,a.exit("tableRow"),a.enter("lineEnding"),a.consume(b),a.exit("lineEnding"),m):c(b):(0,f.On)(b)?(0,ap.N)(a,j,"whitespace")(b):(h+=1,d&&(d=!1,g+=1),124===b)?(a.enter("tableCellDivider"),a.consume(b),a.exit("tableCellDivider"),d=!0,j):(a.enter("data"),k(b))}function k(b){return null===b||124===b||(0,f.Ee)(b)?(a.exit("data"),j(b)):(a.consume(b),92===b?l:k)}function l(b){return 92===b||124===b?(a.consume(b),k):k(b)}function m(b){return(e.interrupt=!1,e.parser.lazy[e.now().line])?c(b):(a.enter("tableDelimiterRow"),d=!1,(0,f.On)(b))?(0,ap.N)(a,n,"linePrefix",e.parser.constructs.disable.null.includes("codeIndented")?void 0:4)(b):n(b)}function n(b){return 45===b||58===b?p(b):124===b?(d=!0,a.enter("tableCellDivider"),a.consume(b),a.exit("tableCellDivider"),o):c(b)}function o(b){return(0,f.On)(b)?(0,ap.N)(a,p,"whitespace")(b):p(b)}function p(b){return 58===b?(h+=1,d=!0,a.enter("tableDelimiterMarker"),a.consume(b),a.exit("tableDelimiterMarker"),q):45===b?(h+=1,q(b)):null===b||(0,f.HP)(b)?s(b):c(b)}function q(b){return 45===b?(a.enter("tableDelimiterFiller"),function b(c){return 45===c?(a.consume(c),b):58===c?(d=!0,a.exit("tableDelimiterFiller"),a.enter("tableDelimiterMarker"),a.consume(c),a.exit("tableDelimiterMarker"),r):(a.exit("tableDelimiterFiller"),r(c))}(b)):c(b)}function r(b){return(0,f.On)(b)?(0,ap.N)(a,s,"whitespace")(b):s(b)}function s(e){if(124===e)return n(e);if(null===e||(0,f.HP)(e))return d&&g===h?(a.exit("tableDelimiterRow"),a.exit("tableHead"),b(e)):c(e);return c(e)}function t(b){return a.enter("tableRow"),u(b)}function u(c){return 124===c?(a.enter("tableCellDivider"),a.consume(c),a.exit("tableCellDivider"),u):null===c||(0,f.HP)(c)?(a.exit("tableRow"),b(c)):(0,f.On)(c)?(0,ap.N)(a,u,"whitespace")(c):(a.enter("data"),v(c))}function v(b){return null===b||124===b||(0,f.Ee)(b)?(a.exit("data"),u(b)):(a.consume(b),92===b?w:v)}function w(b){return 92===b||124===b?(a.consume(b),v):v(b)}}function aB(a,b){let c,d,e,f=-1,g=!0,h=0,i=[0,0,0,0],j=[0,0,0,0],k=!1,l=0,m=new az;for(;++f<a.length;){let n=a[f],o=n[1];"enter"===n[0]?"tableHead"===o.type?(k=!1,0!==l&&(aD(m,b,l,c,d),d=void 0,l=0),c={type:"table",start:Object.assign({},o.start),end:Object.assign({},o.end)},m.add(f,0,[["enter",c,b]])):"tableRow"===o.type||"tableDelimiterRow"===o.type?(g=!0,e=void 0,i=[0,0,0,0],j=[0,f+1,0,0],k&&(k=!1,d={type:"tableBody",start:Object.assign({},o.start),end:Object.assign({},o.end)},m.add(f,0,[["enter",d,b]])),h="tableDelimiterRow"===o.type?2:d?3:1):h&&("data"===o.type||"tableDelimiterMarker"===o.type||"tableDelimiterFiller"===o.type)?(g=!1,0===j[2]&&(0!==i[1]&&(j[0]=j[1],e=aC(m,b,i,h,void 0,e),i=[0,0,0,0]),j[2]=f)):"tableCellDivider"===o.type&&(g?g=!1:(0!==i[1]&&(j[0]=j[1],e=aC(m,b,i,h,void 0,e)),j=[(i=j)[1],f,0,0])):"tableHead"===o.type?(k=!0,l=f):"tableRow"===o.type||"tableDelimiterRow"===o.type?(l=f,0!==i[1]?(j[0]=j[1],e=aC(m,b,i,h,f,e)):0!==j[1]&&(e=aC(m,b,j,h,f,e)),h=0):h&&("data"===o.type||"tableDelimiterMarker"===o.type||"tableDelimiterFiller"===o.type)&&(j[3]=f)}for(0!==l&&aD(m,b,l,c,d),m.consume(b.events),f=-1;++f<b.events.length;){let a=b.events[f];"enter"===a[0]&&"table"===a[1].type&&(a[1]._align=function(a,b){let c=!1,d=[];for(;b<a.length;){let e=a[b];if(c){if("enter"===e[0])"tableContent"===e[1].type&&d.push("tableDelimiterMarker"===a[b+1][1].type?"left":"none");else if("tableContent"===e[1].type){if("tableDelimiterMarker"===a[b-1][1].type){let a=d.length-1;d[a]="left"===d[a]?"center":"right"}}else if("tableDelimiterRow"===e[1].type)break}else"enter"===e[0]&&"tableDelimiterRow"===e[1].type&&(c=!0);b+=1}return d}(b.events,f))}return a}function aC(a,b,c,d,e,f){0!==c[0]&&(f.end=Object.assign({},aE(b.events,c[0])),a.add(c[0],0,[["exit",f,b]]));let g=aE(b.events,c[1]);if(f={type:1===d?"tableHeader":2===d?"tableDelimiter":"tableData",start:Object.assign({},g),end:Object.assign({},g)},a.add(c[1],0,[["enter",f,b]]),0!==c[2]){let e=aE(b.events,c[2]),f=aE(b.events,c[3]),g={type:"tableContent",start:Object.assign({},e),end:Object.assign({},f)};if(a.add(c[2],0,[["enter",g,b]]),2!==d){let d=b.events[c[2]],e=b.events[c[3]];if(d[1].end=Object.assign({},e[1].end),d[1].type="chunkText",d[1].contentType="text",c[3]>c[2]+1){let b=c[2]+1,d=c[3]-c[2]-1;a.add(b,d,[])}}a.add(c[3]+1,0,[["exit",g,b]])}return void 0!==e&&(f.end=Object.assign({},aE(b.events,e)),a.add(e,0,[["exit",f,b]]),f=void 0),f}function aD(a,b,c,d,e){let f=[],g=aE(b.events,c);e&&(e.end=Object.assign({},g),f.push(["exit",e,b])),d.end=Object.assign({},g),f.push(["exit",d,b]),a.add(c+1,0,f)}function aE(a,b){let c=a[b],d="enter"===c[0]?"start":"end";return c[1][d]}let aF={name:"tasklistCheck",tokenize:function(a,b,c){let d=this;return function(b){return null===d.previous&&d._gfmTasklistFirstContentOfListItem?(a.enter("taskListCheck"),a.enter("taskListCheckMarker"),a.consume(b),a.exit("taskListCheckMarker"),e):c(b)};function e(b){return(0,f.Ee)(b)?(a.enter("taskListCheckValueUnchecked"),a.consume(b),a.exit("taskListCheckValueUnchecked"),g):88===b||120===b?(a.enter("taskListCheckValueChecked"),a.consume(b),a.exit("taskListCheckValueChecked"),g):c(b)}function g(b){return 93===b?(a.enter("taskListCheckMarker"),a.consume(b),a.exit("taskListCheckMarker"),a.exit("taskListCheck"),h):c(b)}function h(d){return(0,f.HP)(d)?b(d):(0,f.On)(d)?a.check({tokenize:aG},b,c)(d):c(d)}}};function aG(a,b,c){return(0,ap.N)(a,function(a){return null===a?c(a):b(a)},"whitespace")}let aH={};function aI(a){let b,c=a||aH,d=this.data(),e=d.micromarkExtensions||(d.micromarkExtensions=[]),f=d.fromMarkdownExtensions||(d.fromMarkdownExtensions=[]),g=d.toMarkdownExtensions||(d.toMarkdownExtensions=[]);e.push((0,Z.y)([{text:ah},{document:{91:{name:"gfmFootnoteDefinition",tokenize:au,continuation:{tokenize:av},exit:aw}},text:{91:{name:"gfmFootnoteCall",tokenize:at},93:{name:"gfmPotentialFootnoteCall",add:"after",tokenize:ar,resolveTo:as}}},function(a){let b=(a||{}).singleTilde,c={name:"strikethrough",tokenize:function(a,c,d){let e=this.previous,f=this.events,g=0;return function(h){return 126===e&&"characterEscape"!==f[f.length-1][1].type?d(h):(a.enter("strikethroughSequenceTemporary"),function f(h){let i=(0,M.S)(e);if(126===h)return g>1?d(h):(a.consume(h),g++,f);if(g<2&&!b)return d(h);let j=a.exit("strikethroughSequenceTemporary"),k=(0,M.S)(h);return j._open=!k||2===k&&!!i,j._close=!i||2===i&&!!k,c(h)}(h))}},resolveAll:function(a,b){let c=-1;for(;++c<a.length;)if("enter"===a[c][0]&&"strikethroughSequenceTemporary"===a[c][1].type&&a[c][1]._close){let d=c;for(;d--;)if("exit"===a[d][0]&&"strikethroughSequenceTemporary"===a[d][1].type&&a[d][1]._open&&a[c][1].end.offset-a[c][1].start.offset==a[d][1].end.offset-a[d][1].start.offset){a[c][1].type="strikethroughSequence",a[d][1].type="strikethroughSequence";let e={type:"strikethrough",start:Object.assign({},a[d][1].start),end:Object.assign({},a[c][1].end)},f={type:"strikethroughText",start:Object.assign({},a[d][1].end),end:Object.assign({},a[c][1].start)},g=[["enter",e,b],["enter",a[d][1],b],["exit",a[d][1],b],["enter",f,b]],h=b.parser.constructs.insideSpan.null;h&&(0,ax.m)(g,g.length,0,(0,ay.W)(h,a.slice(d+1,c),b)),(0,ax.m)(g,g.length,0,[["exit",f,b],["enter",a[c][1],b],["exit",a[c][1],b],["exit",e,b]]),(0,ax.m)(a,d-1,c-d+3,g),c=d+g.length-2;break}}for(c=-1;++c<a.length;)"strikethroughSequenceTemporary"===a[c][1].type&&(a[c][1].type="data");return a}};return null==b&&(b=!0),{text:{126:c},insideSpan:{null:[c]},attentionMarkers:{null:[126]}}}(c),{flow:{null:{name:"table",tokenize:aA,resolveAll:aB}}},{text:{91:aF}}])),f.push([{transforms:[q],enter:{literalAutolink:k,literalAutolinkEmail:l,literalAutolinkHttp:l,literalAutolinkWww:l},exit:{literalAutolink:p,literalAutolinkEmail:o,literalAutolinkHttp:m,literalAutolinkWww:n}},{enter:{gfmFootnoteCallString:v,gfmFootnoteCall:w,gfmFootnoteDefinitionLabelString:x,gfmFootnoteDefinition:y},exit:{gfmFootnoteCallString:z,gfmFootnoteCall:A,gfmFootnoteDefinitionLabelString:B,gfmFootnoteDefinition:C}},{canContainEols:["delete"],enter:{strikethrough:H},exit:{strikethrough:I}},{enter:{table:P,tableData:T,tableHeader:T,tableRow:R},exit:{codeText:U,table:Q,tableData:S,tableHeader:S,tableRow:S}},{exit:{taskListCheckValueChecked:W,taskListCheckValueUnchecked:W,paragraph:X}}]),g.push({extensions:[{unsafe:[{character:"@",before:"[+\\-.\\w]",after:"[\\-.\\w]",inConstruct:i,notInConstruct:j},{character:".",before:"[Ww]",after:"[\\-.\\w]",inConstruct:i,notInConstruct:j},{character:":",before:"[ps]",after:"\\/",inConstruct:i,notInConstruct:j}]},(b=!1,c&&c.firstLineBlank&&(b=!0),{handlers:{footnoteDefinition:function(a,c,d,e){let f=d.createTracker(e),g=f.move("[^"),h=d.enter("footnoteDefinition"),i=d.enter("label");return g+=f.move(d.safe(d.associationId(a),{before:g,after:"]"})),i(),g+=f.move("]:"),a.children&&a.children.length>0&&(f.shift(4),g+=f.move((b?"\n":" ")+d.indentLines(d.containerFlow(a,f.current()),b?F:E))),h(),g},footnoteReference:D},unsafe:[{character:"[",inConstruct:["label","phrasing","reference"]}]}),{unsafe:[{character:"~",inConstruct:"phrasing",notInConstruct:G}],handlers:{delete:J}},function(a){let b=a||{},c=b.tableCellPadding,d=b.tablePipeAlign,e=b.stringLength,f=c?" ":"|";return{unsafe:[{character:"\r",inConstruct:"tableCell"},{character:"\n",inConstruct:"tableCell"},{atBreak:!0,character:"|",after:"[ :-]"},{character:"|",inConstruct:"tableCell"},{atBreak:!0,character:":",after:"-"},{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{inlineCode:function(a,b,c){let d=O.inlineCode(a,b,c);return c.stack.includes("tableCell")&&(d=d.replace(/\|/g,"\\$&")),d},table:function(a,b,c,d){return h(function(a,b,c){let d=a.children,e=-1,f=[],g=b.enter("table");for(;++e<d.length;)f[e]=i(d[e],b,c);return g(),f}(a,c,d),a.align)},tableCell:g,tableRow:function(a,b,c,d){let e=h([i(a,c,d)]);return e.slice(0,e.indexOf("\n"))}}};function g(a,b,c,d){let e=c.enter("tableCell"),g=c.enter("phrasing"),h=c.containerPhrasing(a,{...d,before:f,after:f});return g(),e(),h}function h(a,b){return function(a,b){let c=b||{},d=(c.align||[]).concat(),e=c.stringLength||K,f=[],g=[],h=[],i=[],j=0,k=-1;for(;++k<a.length;){let b=[],d=[],f=-1;for(a[k].length>j&&(j=a[k].length);++f<a[k].length;){var l;let g=null==(l=a[k][f])?"":String(l);if(!1!==c.alignDelimiters){let a=e(g);d[f]=a,(void 0===i[f]||a>i[f])&&(i[f]=a)}b.push(g)}g[k]=b,h[k]=d}let m=-1;if("object"==typeof d&&"length"in d)for(;++m<j;)f[m]=L(d[m]);else{let a=L(d);for(;++m<j;)f[m]=a}m=-1;let n=[],o=[];for(;++m<j;){let a=f[m],b="",d="";99===a?(b=":",d=":"):108===a?b=":":114===a&&(d=":");let e=!1===c.alignDelimiters?1:Math.max(1,i[m]-b.length-d.length),g=b+"-".repeat(e)+d;!1!==c.alignDelimiters&&((e=b.length+e+d.length)>i[m]&&(i[m]=e),o[m]=e),n[m]=g}g.splice(1,0,n),h.splice(1,0,o),k=-1;let p=[];for(;++k<g.length;){let a=g[k],b=h[k];m=-1;let d=[];for(;++m<j;){let e=a[m]||"",g="",h="";if(!1!==c.alignDelimiters){let a=i[m]-(b[m]||0),c=f[m];114===c?g=" ".repeat(a):99===c?a%2?(g=" ".repeat(a/2+.5),h=" ".repeat(a/2-.5)):h=g=" ".repeat(a/2):h=" ".repeat(a)}!1===c.delimiterStart||m||d.push("|"),!1!==c.padding&&(!1!==c.alignDelimiters||""!==e)&&(!1!==c.delimiterStart||m)&&d.push(" "),!1!==c.alignDelimiters&&d.push(g),d.push(e),!1!==c.alignDelimiters&&d.push(h),!1!==c.padding&&d.push(" "),(!1!==c.delimiterEnd||m!==j-1)&&d.push("|")}p.push(!1===c.delimiterEnd?d.join("").replace(/ +$/,""):d.join(""))}return p.join("\n")}(a,{align:b,alignDelimiters:d,padding:c,stringLength:e})}function i(a,b,c){let d=a.children,e=-1,f=[],h=b.enter("tableRow");for(;++e<d.length;)f[e]=g(d[e],a,b,c);return h(),f}}(c),{unsafe:[{atBreak:!0,character:"-",after:"[:|-]"}],handlers:{listItem:Y}}]})}},663033:a=>{"use strict";a.exports=require("next/dist/server/app-render/work-unit-async-storage.external.js")},665466:(a,b,c)=>{"use strict";c.d(b,{E:()=>i,I:()=>j});var d=c(736927),e=c(115962),f=c(437503),g=c(930439),h=c(535798);function i({event:a,expanded:b,onToggle:c,onOpenPerson:e,onOpenCompany:g}){let i=a.start_at?new Date(a.start_at):null,k=a.end_at?new Date(a.end_at):null,l=i?k?`${o(i)} – ${o(k)}`:o(i):"",m=(a.attendees??[]).slice(0,5),p=(a.attendees?.length??0)-m.length;return(0,d.jsxs)("li",{className:"overflow-hidden",style:{background:b?"var(--color-surface-hover)":"transparent",transition:"background 120ms ease"},children:[(0,d.jsxs)("div",{role:"button",tabIndex:0,"aria-expanded":b,onClick:c,onKeyDown:a=>{a.target===a.currentTarget&&("Enter"===a.key||" "===a.key)&&(a.preventDefault(),c())},className:"group/event w-full flex items-center gap-3 px-3 py-2 text-left cursor-pointer focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-accent)] transition-colors",onMouseEnter:a=>{b||(a.currentTarget.style.background="var(--color-surface-hover)")},onMouseLeave:a=>{b||(a.currentTarget.style.background="transparent")},children:[(0,d.jsx)("div",{className:"text-[12px] tabular-nums shrink-0 whitespace-nowrap",style:{color:"var(--color-text-muted)",width:"11rem"},children:l||(a.start_at?(0,h.wI)(a.start_at):"")}),(0,d.jsxs)("div",{className:"flex-1 min-w-0 flex items-center gap-2",children:[(0,d.jsx)("p",{className:"truncate text-[13.5px]",style:{color:"var(--color-text)",fontWeight:500},children:a.title?.trim()||"(no title)"}),a.meeting_type&&(0,d.jsx)("span",{className:"shrink-0 rounded-full px-1.5 py-0 text-[10px] uppercase tracking-[0.06em]",style:{background:"var(--color-surface-hover)",color:"var(--color-text-muted)",fontWeight:600},children:a.meeting_type})]}),(0,d.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[m.length>0&&(0,d.jsxs)("div",{className:"flex items-center -space-x-1.5",children:[m.slice(0,4).map(a=>(0,d.jsx)("button",{type:"button",onClick:b=>{b.stopPropagation(),e?.(a.id)},disabled:!e,title:a.name??a.email??void 0,className:"disabled:cursor-default rounded-full",style:{boxShadow:"0 0 0 2px var(--color-background)"},children:(0,d.jsx)(f.X,{src:a.avatar_url,name:a.name,seed:a.email??a.id,size:"sm"})},a.id)),p>0&&(0,d.jsxs)("span",{className:"ml-1 text-[11px] tabular-nums",style:{color:"var(--color-text-muted)"},children:["+",p]})]}),(0,d.jsx)(n,{expanded:b})]})]}),(0,d.jsx)("div",{className:"grid transition-[grid-template-rows] duration-[220ms] ease-out motion-reduce:transition-none",style:{gridTemplateRows:b?"1fr":"0fr"},children:(0,d.jsx)("div",{className:"overflow-hidden",children:b&&(0,d.jsx)(j,{eventId:a.id,fallbackEvent:a,onOpenPerson:e,onOpenCompany:g})})})]})}function j({eventId:a,fallbackEvent:b,onOpenPerson:c,onOpenCompany:f}){var g;let[h,i]=(0,e.useState)(null),[j,n]=(0,e.useState)(!0),[p,q]=(0,e.useState)(null),r=h?.event.start_at??b.start_at?new Date(h?.event.start_at??b.start_at):null,s=h?.event.end_at??b.end_at?new Date(h?.event.end_at??b.end_at):null,t=r?(g=r,new Intl.DateTimeFormat(void 0,{weekday:"long",month:"long",day:"numeric",year:"numeric"}).format(g)):null,u=r?s?`${o(r)} – ${o(s)}`:o(r):null,v=r&&s?function(a,b){let c=b.getTime()-a.getTime();if(c<=0)return"";let d=Math.round(c/6e4);if(d>=1440){let a=Math.round(d/1440);return`${a} day${1===a?"":"s"}`}let e=Math.floor(d/60),f=d%60;return 0===e?`${f} min`:0===f?`${e}h`:`${e}h ${f}m`}(r,s):null,w=h?.organizer??null,x=h?.attendees??b.attendees??[],y=h?.companies??[];return(0,d.jsxs)("div",{className:"border-t px-4 py-4",style:{borderColor:"var(--color-border)",background:"var(--color-background)"},children:[(t||u||v)&&(0,d.jsx)(k,{label:"When",children:(0,d.jsxs)("div",{className:"text-[13px]",style:{color:"var(--color-text)"},children:[t&&(0,d.jsx)("div",{className:"font-medium",children:t}),(u||v)&&(0,d.jsxs)("div",{className:"mt-0.5",style:{color:"var(--color-text-muted)"},children:[u,u&&v&&" \xb7 ",v]})]})}),w&&(0,d.jsx)(k,{label:"Organizer",children:(0,d.jsx)(l,{person:w,onOpenPerson:c})}),x.length>0&&(0,d.jsx)(k,{label:`Attendees \xb7 ${x.length}`,children:(0,d.jsx)("div",{className:"flex flex-col gap-1.5",children:x.map(a=>(0,d.jsx)(l,{person:a,onOpenPerson:c},a.id))})}),y.length>0&&(0,d.jsx)(k,{label:1===y.length?"Company":"Companies",children:(0,d.jsx)("div",{className:"flex flex-col gap-1.5",children:y.map(a=>(0,d.jsx)(m,{company:a,onOpenCompany:f},a.id))})}),j&&!h&&(0,d.jsx)("p",{className:"text-[12px]",style:{color:"var(--color-text-muted)"},children:"Loading meeting details…"}),p&&(0,d.jsxs)("p",{className:"text-[12px]",style:{color:"var(--color-text-muted)"},children:["Couldn’t load meeting details (",p,"). Showing what we have."]}),!j&&!p&&h&&0===x.length&&!w&&0===y.length&&(0,d.jsx)("p",{className:"text-[12px]",style:{color:"var(--color-text-muted)"},children:"No additional details for this meeting."})]})}function k({label:a,children:b}){return(0,d.jsxs)("div",{className:"mb-4 last:mb-0",children:[(0,d.jsx)("h4",{className:"mb-1.5 text-[10px] font-semibold uppercase tracking-[0.16em]",style:{color:"var(--color-text-muted)"},children:a}),b]})}function l({person:a,onOpenPerson:b}){let c=a.name?.trim()||a.email||"Unknown",e=a.name?.trim()&&a.email?a.email:null;return(0,d.jsxs)("button",{type:"button",onClick:()=>b?.(a.id),disabled:!b,className:"flex items-center gap-2.5 rounded-lg px-2 py-1.5 text-left transition-colors disabled:cursor-default",style:{color:"var(--color-text)"},onMouseEnter:a=>{b&&(a.currentTarget.style.background="var(--color-surface-hover)")},onMouseLeave:a=>{a.currentTarget.style.background="transparent"},children:[(0,d.jsx)(f.X,{src:a.avatar_url,name:c,seed:a.email??a.id,size:"sm"}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"truncate text-[13px] font-medium",style:{color:"var(--color-text)"},children:c}),e&&(0,d.jsx)("p",{className:"truncate text-[11px]",style:{color:"var(--color-text-muted)"},children:e})]})]})}function m({company:a,onOpenCompany:b}){let c=a.name?.trim()||a.domain||"Unknown company";return(0,d.jsxs)("button",{type:"button",onClick:()=>b?.(a.id),disabled:!b,className:"flex items-center gap-2.5 rounded-lg px-2 py-1.5 text-left transition-colors disabled:cursor-default",onMouseEnter:a=>{b&&(a.currentTarget.style.background="var(--color-surface-hover)")},onMouseLeave:a=>{a.currentTarget.style.background="transparent"},children:[(0,d.jsx)(g.g,{domain:a.domain,name:a.name,size:"sm"}),(0,d.jsxs)("div",{className:"min-w-0",children:[(0,d.jsx)("p",{className:"truncate text-[13px] font-medium",style:{color:"var(--color-text)"},children:c}),a.domain&&a.name&&(0,d.jsx)("p",{className:"truncate text-[11px]",style:{color:"var(--color-text-muted)"},children:a.domain})]})]})}function n({expanded:a}){return(0,d.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,className:"motion-reduce:transition-none",style:{color:"var(--color-text-muted)",transform:a?"rotate(180deg)":"rotate(0deg)",transition:"transform 180ms ease"},children:(0,d.jsx)("path",{d:"m6 9 6 6 6-6"})})}function o(a){return new Intl.DateTimeFormat(void 0,{hour:"numeric",minute:"2-digit"}).format(a)}},669661:(a,b,c)=>{"use strict";c.d(b,{Lz:()=>bR,NZ:()=>br,zF:()=>bu});var d=c(381802),e=c(331480),f=c(731626);let g=function(a){for(var b=0;;b++)if(!(a=a.previousSibling))return b},h=function(a){let b=a.assignedSlot||a.parentNode;return b&&11==b.nodeType?b.host:b},i=null,j=function(a,b,c){let d=i||(i=document.createRange());return d.setEnd(a,null==c?a.nodeValue.length:c),d.setStart(a,b||0),d},k=function(){i=null},l=function(a,b,c,d){return c&&(n(a,b,c,d,-1)||n(a,b,c,d,1))},m=/^(img|br|input|textarea|hr)$/i;function n(a,b,c,d,e){for(var f;;){if(a==c&&b==d)return!0;if(b==(e<0?0:o(a))){let c=a.parentNode;if(!c||1!=c.nodeType||p(a)||m.test(a.nodeName)||"false"==a.contentEditable)return!1;b=g(a)+(e<0?0:1),a=c}else{if(1!=a.nodeType)return!1;let c=a.childNodes[b+(e<0?-1:0)];if(1==c.nodeType&&"false"==c.contentEditable)if(null==(f=c.pmViewDesc)||!f.ignoreForSelection)return!1;else b+=e;else a=c,b=e<0?o(a):0}}}function o(a){return 3==a.nodeType?a.nodeValue.length:a.childNodes.length}function p(a){let b;for(let c=a;c&&!(b=c.pmViewDesc);c=c.parentNode);return b&&b.node&&b.node.isBlock&&(b.dom==a||b.contentDOM==a)}let q=function(a){return a.focusNode&&l(a.focusNode,a.focusOffset,a.anchorNode,a.anchorOffset)};function r(a,b){let c=document.createEvent("Event");return c.initEvent("keydown",!0,!0),c.keyCode=a,c.key=c.code=b,c}let s="undefined"!=typeof navigator?navigator:null,t="undefined"!=typeof document?document:null,u=s&&s.userAgent||"",v=/Edge\/(\d+)/.exec(u),w=/MSIE \d/.exec(u),x=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(u),y=!!(w||x||v),z=w?document.documentMode:x?+x[1]:v?+v[1]:0,A=!y&&/gecko\/(\d+)/i.test(u);A&&(/Firefox\/(\d+)/.exec(u)||[0,0])[1];let B=!y&&/Chrome\/(\d+)/.exec(u),C=!!B,D=B?+B[1]:0,E=!y&&!!s&&/Apple Computer/.test(s.vendor),F=E&&(/Mobile\/\w+/.test(u)||!!s&&s.maxTouchPoints>2),G=F||!!s&&/Mac/.test(s.platform),H=!!s&&/Win/.test(s.platform),I=/Android \d/.test(u),J=!!t&&"webkitFontSmoothing"in t.documentElement.style,K=J?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function L(a,b){return"number"==typeof a?a:a[b]}function M(a,b,c){let d=a.someProp("scrollThreshold")||0,e=a.someProp("scrollMargin")||5,f=a.dom.ownerDocument;for(let g=c||a.dom;g;){if(1!=g.nodeType){g=h(g);continue}let a=g,c=a==f.body,i=c?function(a){let b=a.defaultView&&a.defaultView.visualViewport;return b?{left:0,right:b.width,top:0,bottom:b.height}:{left:0,right:a.documentElement.clientWidth,top:0,bottom:a.documentElement.clientHeight}}(f):function(a){let b=a.getBoundingClientRect(),c=b.width/a.offsetWidth||1,d=b.height/a.offsetHeight||1;return{left:b.left,right:b.left+a.clientWidth*c,top:b.top,bottom:b.top+a.clientHeight*d}}(a),j=0,k=0;if(b.top<i.top+L(d,"top")?k=-(i.top-b.top+L(e,"top")):b.bottom>i.bottom-L(d,"bottom")&&(k=b.bottom-b.top>i.bottom-i.top?b.top+L(e,"top")-i.top:b.bottom-i.bottom+L(e,"bottom")),b.left<i.left+L(d,"left")?j=-(i.left-b.left+L(e,"left")):b.right>i.right-L(d,"right")&&(j=b.right-i.right+L(e,"right")),j||k)if(c)f.defaultView.scrollBy(j,k);else{let c=a.scrollLeft,d=a.scrollTop;k&&(a.scrollTop+=k),j&&(a.scrollLeft+=j);let e=a.scrollLeft-c,f=a.scrollTop-d;b={left:b.left-e,top:b.top-f,right:b.right-e,bottom:b.bottom-f}}let l=c?"fixed":getComputedStyle(g).position;if(/^(fixed|sticky)$/.test(l))break;g="absolute"==l?g.offsetParent:h(g)}}function N(a){let b=[],c=a.ownerDocument;for(let d=a;d&&(b.push({dom:d,top:d.scrollTop,left:d.scrollLeft}),a!=c);d=h(d));return b}function O(a,b){for(let c=0;c<a.length;c++){let{dom:d,top:e,left:f}=a[c];d.scrollTop!=e+b&&(d.scrollTop=e+b),d.scrollLeft!=f&&(d.scrollLeft=f)}}let P=null;function Q(a,b){return a.left>=b.left-1&&a.left<=b.right+1&&a.top>=b.top-1&&a.top<=b.bottom+1}function R(a){return a.top<a.bottom||a.left<a.right}function S(a,b){let c=a.getClientRects();if(c.length){let a=c[b<0?0:c.length-1];if(R(a))return a}return Array.prototype.find.call(c,R)||a.getBoundingClientRect()}let T=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function U(a,b,c){let{node:d,offset:e,atom:f}=a.docView.domFromPos(b,c<0?-1:1),g=J||A;if(3==d.nodeType)if(g&&(T.test(d.nodeValue)||(c<0?!e:e==d.nodeValue.length))){let a=S(j(d,e,e),c);if(A&&e&&/\s/.test(d.nodeValue[e-1])&&e<d.nodeValue.length){let b=S(j(d,e-1,e-1),-1);if(b.top==a.top){let c=S(j(d,e,e+1),-1);if(c.top!=a.top)return V(c,c.left<b.left)}}return a}else{let a=e,b=e,f=c<0?1:-1;return c<0&&!e?(b++,f=-1):c>=0&&e==d.nodeValue.length?(a--,f=1):c<0?a--:b++,V(S(j(d,a,b),f),f<0)}if(!a.state.doc.resolve(b-(f||0)).parent.inlineContent){if(null==f&&e&&(c<0||e==o(d))){let a=d.childNodes[e-1];if(1==a.nodeType)return W(a.getBoundingClientRect(),!1)}if(null==f&&e<o(d)){let a=d.childNodes[e];if(1==a.nodeType)return W(a.getBoundingClientRect(),!0)}return W(d.getBoundingClientRect(),c>=0)}if(null==f&&e&&(c<0||e==o(d))){let a=d.childNodes[e-1],b=3==a.nodeType?j(a,o(a)-!g):1!=a.nodeType||"BR"==a.nodeName&&a.nextSibling?null:a;if(b)return V(S(b,1),!1)}if(null==f&&e<o(d)){let a=d.childNodes[e];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let b=a?3==a.nodeType?j(a,0,+!g):1==a.nodeType?a:null:null;if(b)return V(S(b,-1),!0)}return V(S(3==d.nodeType?j(d):d,-c),c>=0)}function V(a,b){if(0==a.width)return a;let c=b?a.left:a.right;return{top:a.top,bottom:a.bottom,left:c,right:c}}function W(a,b){if(0==a.height)return a;let c=b?a.top:a.bottom;return{top:c,bottom:c,left:a.left,right:a.right}}function X(a,b,c){let d=a.state,e=a.root.activeElement;d!=b&&a.updateState(b),e!=a.dom&&a.focus();try{return c()}finally{d!=b&&a.updateState(d),e!=a.dom&&e&&e.focus()}}let Y=/[\u0590-\u08ac]/,Z=null,_=null,aa=!1;class ab{constructor(a,b,c,d){this.parent=a,this.children=b,this.dom=c,this.contentDOM=d,this.dirty=0,c.pmViewDesc=this}matchesWidget(a){return!1}matchesMark(a){return!1}matchesNode(a,b,c){return!1}matchesHack(a){return!1}parseRule(){return null}stopEvent(a){return!1}get size(){let a=0;for(let b=0;b<this.children.length;b++)a+=this.children[b].size;return a}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let a=0;a<this.children.length;a++)this.children[a].destroy()}posBeforeChild(a){for(let b=0,c=this.posAtStart;;b++){let d=this.children[b];if(d==a)return c;c+=d.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(a,b,c){let d;if(this.contentDOM&&this.contentDOM.contains(1==a.nodeType?a:a.parentNode))if(c<0){let c,d;if(a==this.contentDOM)c=a.childNodes[b-1];else{for(;a.parentNode!=this.contentDOM;)a=a.parentNode;c=a.previousSibling}for(;c&&!((d=c.pmViewDesc)&&d.parent==this);)c=c.previousSibling;return c?this.posBeforeChild(d)+d.size:this.posAtStart}else{let c,d;if(a==this.contentDOM)c=a.childNodes[b];else{for(;a.parentNode!=this.contentDOM;)a=a.parentNode;c=a.nextSibling}for(;c&&!((d=c.pmViewDesc)&&d.parent==this);)c=c.nextSibling;return c?this.posBeforeChild(d):this.posAtEnd}if(a==this.dom&&this.contentDOM)d=b>g(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))d=2&a.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==b)for(let b=a;;b=b.parentNode){if(b==this.dom){d=!1;break}if(b.previousSibling)break}if(null==d&&b==a.childNodes.length)for(let b=a;;b=b.parentNode){if(b==this.dom){d=!0;break}if(b.nextSibling)break}}return(null==d?c>0:d)?this.posAtEnd:this.posAtStart}nearestDesc(a,b=!1){for(let c=!0,d=a;d;d=d.parentNode){let e=this.getDesc(d),f;if(e&&(!b||e.node))if(!c||!(f=e.nodeDOM)||(1==f.nodeType?f.contains(1==a.nodeType?a:a.parentNode):f==a))return e;else c=!1}}getDesc(a){let b=a.pmViewDesc;for(let a=b;a;a=a.parent)if(a==this)return b}posFromDOM(a,b,c){for(let d=a;d;d=d.parentNode){let e=this.getDesc(d);if(e)return e.localPosFromDOM(a,b,c)}return -1}descAt(a){for(let b=0,c=0;b<this.children.length;b++){let d=this.children[b],e=c+d.size;if(c==a&&e!=c){for(;!d.border&&d.children.length;)for(let a=0;a<d.children.length;a++){let b=d.children[a];if(b.size){d=b;break}}return d}if(a<e)return d.descAt(a-c-d.border);c=e}}domFromPos(a,b){if(!this.contentDOM)return{node:this.dom,offset:0,atom:a+1};let c=0,d=0;for(let b=0;c<this.children.length;c++){let e=this.children[c],f=b+e.size;if(f>a||e instanceof ai){d=a-b;break}b=f}if(d)return this.children[c].domFromPos(d-this.children[c].border,b);for(let a;c&&!(a=this.children[c-1]).size&&a instanceof ac&&a.side>=0;c--);if(b<=0){let a,d=!0;for(;(a=c?this.children[c-1]:null)&&a.dom.parentNode!=this.contentDOM;c--,d=!1);return a&&b&&d&&!a.border&&!a.domAtom?a.domFromPos(a.size,b):{node:this.contentDOM,offset:a?g(a.dom)+1:0}}{let a,d=!0;for(;(a=c<this.children.length?this.children[c]:null)&&a.dom.parentNode!=this.contentDOM;c++,d=!1);return a&&d&&!a.border&&!a.domAtom?a.domFromPos(0,b):{node:this.contentDOM,offset:a?g(a.dom):this.contentDOM.childNodes.length}}}parseRange(a,b,c=0){if(0==this.children.length)return{node:this.contentDOM,from:a,to:b,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let d=-1,e=-1;for(let f=c,h=0;;h++){let c=this.children[h],i=f+c.size;if(-1==d&&a<=i){let e=f+c.border;if(a>=e&&b<=i-c.border&&c.node&&c.contentDOM&&this.contentDOM.contains(c.contentDOM))return c.parseRange(a,b,e);a=f;for(let b=h;b>0;b--){let c=this.children[b-1];if(c.size&&c.dom.parentNode==this.contentDOM&&!c.emptyChildAt(1)){d=g(c.dom)+1;break}a-=c.size}-1==d&&(d=0)}if(d>-1&&(i>b||h==this.children.length-1)){b=i;for(let a=h+1;a<this.children.length;a++){let c=this.children[a];if(c.size&&c.dom.parentNode==this.contentDOM&&!c.emptyChildAt(-1)){e=g(c.dom);break}b+=c.size}-1==e&&(e=this.contentDOM.childNodes.length);break}f=i}return{node:this.contentDOM,from:a,to:b,fromOffset:d,toOffset:e}}emptyChildAt(a){if(this.border||!this.contentDOM||!this.children.length)return!1;let b=this.children[a<0?0:this.children.length-1];return 0==b.size||b.emptyChildAt(a)}domAfterPos(a){let{node:b,offset:c}=this.domFromPos(a,0);if(1!=b.nodeType||c==b.childNodes.length)throw RangeError("No node after pos "+a);return b.childNodes[c]}setSelection(a,b,c,d=!1){let e=Math.min(a,b),f=Math.max(a,b);for(let g=0,h=0;g<this.children.length;g++){let i=this.children[g],j=h+i.size;if(e>h&&f<j)return i.setSelection(a-h-i.border,b-h-i.border,c,d);h=j}let h=this.domFromPos(a,a?-1:1),i=b==a?h:this.domFromPos(b,b?-1:1),j=c.root.getSelection(),k=c.domSelectionRange(),m=!1;if((A||E)&&a==b){let{node:a,offset:b}=h;if(3==a.nodeType){if((m=!!(b&&"\n"==a.nodeValue[b-1]))&&b==a.nodeValue.length)for(let b=a,c;b;b=b.parentNode){if(c=b.nextSibling){"BR"==c.nodeName&&(h=i={node:c.parentNode,offset:g(c)+1});break}let a=b.pmViewDesc;if(a&&a.node&&a.node.isBlock)break}}else{let c=a.childNodes[b-1];m=c&&("BR"==c.nodeName||"false"==c.contentEditable)}}if(A&&k.focusNode&&k.focusNode!=i.node&&1==k.focusNode.nodeType){let a=k.focusNode.childNodes[k.focusOffset];a&&"false"==a.contentEditable&&(d=!0)}if(!(d||m&&E)&&l(h.node,h.offset,k.anchorNode,k.anchorOffset)&&l(i.node,i.offset,k.focusNode,k.focusOffset))return;let n=!1;if((j.extend||a==b)&&!(m&&A)){j.collapse(h.node,h.offset);try{a!=b&&j.extend(i.node,i.offset),n=!0}catch(a){}}if(!n){if(a>b){let a=h;h=i,i=a}let c=document.createRange();c.setEnd(i.node,i.offset),c.setStart(h.node,h.offset),j.removeAllRanges(),j.addRange(c)}}ignoreMutation(a){return!this.contentDOM&&"selection"!=a.type}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(a,b){for(let c=0,d=0;d<this.children.length;d++){let e=this.children[d],f=c+e.size;if(c==f?a<=f&&b>=c:a<f&&b>c){let d=c+e.border,g=f-e.border;if(a>=d&&b<=g){this.dirty=a==c||b==f?2:1,a==d&&b==g&&(e.contentLost||e.dom.parentNode!=this.contentDOM)?e.dirty=3:e.markDirty(a-d,b-d);return}e.dirty=e.dom!=e.contentDOM||e.dom.parentNode!=this.contentDOM||e.children.length?3:2}c=f}this.dirty=2}markParentsDirty(){let a=1;for(let b=this.parent;b;b=b.parent,a++){let c=1==a?2:1;b.dirty<c&&(b.dirty=c)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(a){return!1}}class ac extends ab{constructor(a,b,c,d){let e,f=b.type.toDOM;if("function"==typeof f&&(f=f(c,()=>e?e.parent?e.parent.posBeforeChild(e):void 0:d)),!b.type.spec.raw){if(1!=f.nodeType){let a=document.createElement("span");a.appendChild(f),f=a}f.contentEditable="false",f.classList.add("ProseMirror-widget")}super(a,[],f,null),this.widget=b,this.widget=b,e=this}matchesWidget(a){return 0==this.dirty&&a.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(a){let b=this.widget.spec.stopEvent;return!!b&&b(a)}ignoreMutation(a){return"selection"!=a.type||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class ad extends ab{constructor(a,b,c,d){super(a,[],b,null),this.textDOM=c,this.text=d}get size(){return this.text.length}localPosFromDOM(a,b){return a!=this.textDOM?this.posAtStart+(b?this.size:0):this.posAtStart+b}domFromPos(a){return{node:this.textDOM,offset:a}}ignoreMutation(a){return"characterData"===a.type&&a.target.nodeValue==a.oldValue}}class ae extends ab{constructor(a,b,c,d,e){super(a,[],c,d),this.mark=b,this.spec=e}static create(a,b,c,d){let f=d.nodeViews[b.type.name],g=f&&f(b,d,c);return g&&g.dom||(g=e.ZF.renderSpec(document,b.type.spec.toDOM(b,c),null,b.attrs)),new ae(a,b,g.dom,g.contentDOM||g.dom,g)}parseRule(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(a){return 3!=this.dirty&&this.mark.eq(a)}markDirty(a,b){if(super.markDirty(a,b),0!=this.dirty){let a=this.parent;for(;!a.node;)a=a.parent;a.dirty<this.dirty&&(a.dirty=this.dirty),this.dirty=0}}slice(a,b,c){let d=ae.create(this.parent,this.mark,!0,c),e=this.children,f=this.size;b<f&&(e=at(e,b,f,c)),a>0&&(e=at(e,0,a,c));for(let a=0;a<e.length;a++)e[a].parent=d;return d.children=e,d}ignoreMutation(a){return this.spec.ignoreMutation?this.spec.ignoreMutation(a):super.ignoreMutation(a)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class af extends ab{constructor(a,b,c,d,e,f,g,h,i){super(a,[],e,f),this.node=b,this.outerDeco=c,this.innerDeco=d,this.nodeDOM=g}static create(a,b,c,d,f,g){let h=f.nodeViews[b.type.name],i,j=h&&h(b,f,()=>i?i.parent?i.parent.posBeforeChild(i):void 0:g,c,d),k=j&&j.dom,l=j&&j.contentDOM;if(b.isText)if(k){if(3!=k.nodeType)throw RangeError("Text must be rendered as a DOM text node")}else k=document.createTextNode(b.text);else if(!k){let a=e.ZF.renderSpec(document,b.type.spec.toDOM(b),null,b.attrs);({dom:k,contentDOM:l}=a)}l||b.isText||"BR"==k.nodeName||(k.hasAttribute("contenteditable")||(k.contentEditable="false"),b.type.spec.draggable&&(k.draggable=!0));let m=k;return(k=ao(k,c,b),j)?i=new aj(a,b,c,d,k,l||null,m,j,f,g+1):b.isText?new ah(a,b,c,d,k,m,f):new af(a,b,c,d,k,l||null,m,f,g+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let a={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(a.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(let b=this.children.length-1;b>=0;b--){let c=this.children[b];if(this.dom.contains(c.dom.parentNode)){a.contentElement=c.dom.parentNode;break}}a.contentElement||(a.getContent=()=>e.FK.empty)}else a.contentElement=this.contentDOM;else a.getContent=()=>this.node.content;return a}matchesNode(a,b,c){return 0==this.dirty&&a.eq(this.node)&&ap(b,this.outerDeco)&&c.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return+!this.node.isLeaf}updateChildren(a,b){let c=this.node.inlineContent,d=b,f=a.composing?this.localCompositionInfo(a,b):null,g=f&&f.pos>-1?f:null,h=f&&f.pos<0,i=new ar(this,g&&g.node,a);(function(a,b,c,d){let e=b.locals(a),f=0;if(0==e.length){for(let c=0;c<a.childCount;c++){let g=a.child(c);d(g,e,b.forChild(f,g),c),f+=g.nodeSize}return}let g=0,h=[],i=null;for(let j=0;;){let k,l,m,n;for(;g<e.length&&e[g].to==f;){let a=e[g++];a.widget&&(k?(l||(l=[k])).push(a):k=a)}if(k)if(l){l.sort(as);for(let a=0;a<l.length;a++)c(l[a],j,!!i)}else c(k,j,!!i);if(i)n=-1,m=i,i=null;else if(j<a.childCount)n=j,m=a.child(j++);else break;for(let a=0;a<h.length;a++)h[a].to<=f&&h.splice(a--,1);for(;g<e.length&&e[g].from<=f&&e[g].to>f;)h.push(e[g++]);let o=f+m.nodeSize;if(m.isText){let a=o;g<e.length&&e[g].from<a&&(a=e[g].from);for(let b=0;b<h.length;b++)h[b].to<a&&(a=h[b].to);a<o&&(i=m.cut(a-f),m=m.cut(0,a-f),o=a,n=-1)}else for(;g<e.length&&e[g].to<o;)g++;let p=m.isInline&&!m.isLeaf?h.filter(a=>!a.inline):h.slice();d(m,p,b.forChild(f,m),n),f=o}})(this.node,this.innerDeco,(b,f,g)=>{b.spec.marks?i.syncToMarks(b.spec.marks,c,a,f):b.type.side>=0&&!g&&i.syncToMarks(f==this.node.childCount?e.CU.none:this.node.child(f).marks,c,a,f),i.placeWidget(b,a,d)},(b,e,g,j)=>{let k;i.syncToMarks(b.marks,c,a,j),i.findNodeMatch(b,e,g,j)||h&&a.state.selection.from>d&&a.state.selection.to<d+b.nodeSize&&(k=i.findIndexWithChild(f.node))>-1&&i.updateNodeAt(b,e,g,k,a)||i.updateNextNode(b,e,g,a,j,d)||i.addNode(b,e,g,a,d),d+=b.nodeSize}),i.syncToMarks([],c,a,0),this.node.isTextblock&&i.addTextblockHacks(),i.destroyRest(),(i.changed||2==this.dirty)&&(g&&this.protectLocalComposition(a,g),function a(b,c,d){let e=b.firstChild,f=!1;for(let g=0;g<c.length;g++){let h=c[g],i=h.dom;if(i.parentNode==b){for(;i!=e;)e=aq(e),f=!0;e=e.nextSibling}else f=!0,b.insertBefore(i,e);if(h instanceof ae){let c=e?e.previousSibling:b.lastChild;a(h.contentDOM,h.children,d),e=c?c.nextSibling:b.firstChild}}for(;e;)e=aq(e),f=!0;f&&d.trackWrites==b&&(d.trackWrites=null)}(this.contentDOM,this.children,a),F&&function(a){if("UL"==a.nodeName||"OL"==a.nodeName){let b=a.style.cssText;a.style.cssText=b+"; list-style: square !important",window.getComputedStyle(a).listStyle,a.style.cssText=b}}(this.dom))}localCompositionInfo(a,b){let{from:c,to:e}=a.state.selection;if(!(a.state.selection instanceof d.U3)||c<b||e>b+this.node.content.size)return null;let f=a.input.compositionNode;if(!f||!this.dom.contains(f.parentNode))return null;if(!this.node.inlineContent)return{node:f,pos:-1,text:""};{let a=f.nodeValue,d=function(a,b,c,d){for(let e=0,f=0;e<a.childCount&&f<=d;){let g=a.child(e++),h=f;if(f+=g.nodeSize,!g.isText)continue;let i=g.text;for(;e<a.childCount;){let b=a.child(e++);if(f+=b.nodeSize,!b.isText)break;i+=b.text}if(f>=c){if(f>=d&&i.slice(d-b.length-h,d-h)==b)return d-b.length;let a=h<d?i.lastIndexOf(b,d-h-1):-1;if(a>=0&&a+b.length+h>=c)return h+a;if(c==d&&i.length>=d+b.length-h&&i.slice(d-h,d-h+b.length)==b)return d}}return -1}(this.node.content,a,c-b,e-b);return d<0?null:{node:f,pos:d,text:a}}}protectLocalComposition(a,{node:b,pos:c,text:d}){if(this.getDesc(b))return;let e=b;for(;e.parentNode!=this.contentDOM;e=e.parentNode){for(;e.previousSibling;)e.parentNode.removeChild(e.previousSibling);for(;e.nextSibling;)e.parentNode.removeChild(e.nextSibling);e.pmViewDesc&&(e.pmViewDesc=void 0)}let f=new ad(this,e,b,d);a.input.compositionNodes.push(f),this.children=at(this.children,c,c+d.length,a,f)}update(a,b,c,d){return 3!=this.dirty&&!!a.sameMarkup(this.node)&&(this.updateInner(a,b,c,d),!0)}updateInner(a,b,c,d){this.updateOuterDeco(b),this.node=a,this.innerDeco=c,this.contentDOM&&this.updateChildren(d,this.posAtStart),this.dirty=0}updateOuterDeco(a){if(ap(a,this.outerDeco))return;let b=1!=this.nodeDOM.nodeType,c=this.dom;this.dom=an(this.dom,this.nodeDOM,am(this.outerDeco,this.node,b),am(a,this.node,b)),this.dom!=c&&(c.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=a}selectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function ag(a,b,c,d,e){ao(d,b,a);let f=new af(void 0,a,b,c,d,d,d,e,0);return f.contentDOM&&f.updateChildren(e,0),f}class ah extends af{constructor(a,b,c,d,e,f,g){super(a,b,c,d,e,null,f,g,0)}parseRule(){let a=this.nodeDOM.parentNode;for(;a&&a!=this.dom&&!a.pmIsDeco;)a=a.parentNode;return{skip:a||!0}}update(a,b,c,d){return 3!=this.dirty&&(0==this.dirty||!!this.inParent())&&!!a.sameMarkup(this.node)&&(this.updateOuterDeco(b),(0!=this.dirty||a.text!=this.node.text)&&a.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=a.text,d.trackWrites==this.nodeDOM&&(d.trackWrites=null)),this.node=a,this.dirty=0,!0)}inParent(){let a=this.parent.contentDOM;for(let b=this.nodeDOM;b;b=b.parentNode)if(b==a)return!0;return!1}domFromPos(a){return{node:this.nodeDOM,offset:a}}localPosFromDOM(a,b,c){return a==this.nodeDOM?this.posAtStart+Math.min(b,this.node.text.length):super.localPosFromDOM(a,b,c)}ignoreMutation(a){return"characterData"!=a.type&&"selection"!=a.type}slice(a,b,c){let d=this.node.cut(a,b),e=document.createTextNode(d.text);return new ah(this.parent,d,this.outerDeco,this.innerDeco,e,e,c)}markDirty(a,b){super.markDirty(a,b),this.dom!=this.nodeDOM&&(0==a||b==this.nodeDOM.nodeValue.length)&&(this.dirty=3)}get domAtom(){return!1}isText(a){return this.node.text==a}}class ai extends ab{parseRule(){return{ignore:!0}}matchesHack(a){return 0==this.dirty&&this.dom.nodeName==a}get domAtom(){return!0}get ignoreForCoords(){return"IMG"==this.dom.nodeName}}class aj extends af{constructor(a,b,c,d,e,f,g,h,i,j){super(a,b,c,d,e,f,g,i,j),this.spec=h}update(a,b,c,d){if(3==this.dirty)return!1;if(this.spec.update&&(this.node.type==a.type||this.spec.multiType)){let e=this.spec.update(a,b,c);return e&&this.updateInner(a,b,c,d),e}return(!!this.contentDOM||!!a.isLeaf)&&super.update(a,b,c,d)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(a,b,c,d){this.spec.setSelection?this.spec.setSelection(a,b,c.root):super.setSelection(a,b,c,d)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(a){return!!this.spec.stopEvent&&this.spec.stopEvent(a)}ignoreMutation(a){return this.spec.ignoreMutation?this.spec.ignoreMutation(a):super.ignoreMutation(a)}}let ak=function(a){a&&(this.nodeName=a)};ak.prototype=Object.create(null);let al=[new ak];function am(a,b,c){if(0==a.length)return al;let d=c?al[0]:new ak,e=[d];for(let f=0;f<a.length;f++){let g=a[f].type.attrs;if(g)for(let a in g.nodeName&&e.push(d=new ak(g.nodeName)),g){let f=g[a];null!=f&&(c&&1==e.length&&e.push(d=new ak(b.isInline?"span":"div")),"class"==a?d.class=(d.class?d.class+" ":"")+f:"style"==a?d.style=(d.style?d.style+";":"")+f:"nodeName"!=a&&(d[a]=f))}}return e}function an(a,b,c,d){if(c==al&&d==al)return b;let e=b;for(let b=0;b<d.length;b++){let f=d[b],g=c[b];if(b){let b;g&&g.nodeName==f.nodeName&&e!=a&&(b=e.parentNode)&&b.nodeName.toLowerCase()==f.nodeName||((b=document.createElement(f.nodeName)).pmIsDeco=!0,b.appendChild(e),g=al[0]),e=b}!function(a,b,c){for(let d in b)"class"==d||"style"==d||"nodeName"==d||d in c||a.removeAttribute(d);for(let d in c)"class"!=d&&"style"!=d&&"nodeName"!=d&&c[d]!=b[d]&&a.setAttribute(d,c[d]);if(b.class!=c.class){let d=b.class?b.class.split(" ").filter(Boolean):[],e=c.class?c.class.split(" ").filter(Boolean):[];for(let b=0;b<d.length;b++)-1==e.indexOf(d[b])&&a.classList.remove(d[b]);for(let b=0;b<e.length;b++)-1==d.indexOf(e[b])&&a.classList.add(e[b]);0==a.classList.length&&a.removeAttribute("class")}if(b.style!=c.style){if(b.style){let c=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,d;for(;d=c.exec(b.style);)a.style.removeProperty(d[1])}c.style&&(a.style.cssText+=c.style)}}(e,g||al[0],f)}return e}function ao(a,b,c){return an(a,a,al,am(b,c,1!=a.nodeType))}function ap(a,b){if(a.length!=b.length)return!1;for(let c=0;c<a.length;c++)if(!a[c].type.eq(b[c].type))return!1;return!0}function aq(a){let b=a.nextSibling;return a.parentNode.removeChild(a),b}class ar{constructor(a,b,c){this.lock=b,this.view=c,this.index=0,this.stack=[],this.changed=!1,this.top=a,this.preMatch=function(a,b){let c=b,d=c.children.length,e=a.childCount,f=new Map,g=[];a:for(;e>0;){let h;for(;;)if(d){let a=c.children[d-1];if(a instanceof ae)c=a,d=a.children.length;else{h=a,d--;break}}else if(c==b)break a;else d=c.parent.children.indexOf(c),c=c.parent;let i=h.node;if(i){if(i!=a.child(e-1))break;--e,f.set(h,e),g.push(h)}}return{index:e,matched:f,matches:g.reverse()}}(a.node.content,a)}destroyBetween(a,b){if(a!=b){for(let c=a;c<b;c++)this.top.children[c].destroy();this.top.children.splice(a,b-a),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(a,b,c,d){let e=0,f=this.stack.length>>1,g=Math.min(f,a.length);for(;e<g&&(e==f-1?this.top:this.stack[e+1<<1]).matchesMark(a[e])&&!1!==a[e].type.spec.spanning;)e++;for(;e<f;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),f--;for(;f<a.length;){this.stack.push(this.top,this.index+1);let e=-1,g=this.top.children.length;d<this.preMatch.index&&(g=Math.min(this.index+3,g));for(let b=this.index;b<g;b++){let c=this.top.children[b];if(c.matchesMark(a[f])&&!this.isLocked(c.dom)){e=b;break}}if(e>-1)e>this.index&&(this.changed=!0,this.destroyBetween(this.index,e)),this.top=this.top.children[this.index];else{let d=ae.create(this.top,a[f],b,c);this.top.children.splice(this.index,0,d),this.top=d,this.changed=!0}this.index=0,f++}}findNodeMatch(a,b,c,d){let e=-1,f;if(d>=this.preMatch.index&&(f=this.preMatch.matches[d-this.preMatch.index]).parent==this.top&&f.matchesNode(a,b,c))e=this.top.children.indexOf(f,this.index);else for(let d=this.index,f=Math.min(this.top.children.length,d+5);d<f;d++){let f=this.top.children[d];if(f.matchesNode(a,b,c)&&!this.preMatch.matched.has(f)){e=d;break}}return!(e<0)&&(this.destroyBetween(this.index,e),this.index++,!0)}updateNodeAt(a,b,c,d,e){let f=this.top.children[d];return 3==f.dirty&&f.dom==f.contentDOM&&(f.dirty=2),!!f.update(a,b,c,e)&&(this.destroyBetween(this.index,d),this.index++,!0)}findIndexWithChild(a){for(;;){let b=a.parentNode;if(!b)return -1;if(b==this.top.contentDOM){let b=a.pmViewDesc;if(b){for(let a=this.index;a<this.top.children.length;a++)if(this.top.children[a]==b)return a}return -1}a=b}}updateNextNode(a,b,c,d,e,f){for(let g=this.index;g<this.top.children.length;g++){let h=this.top.children[g];if(h instanceof af){let i=this.preMatch.matched.get(h);if(null!=i&&i!=e)return!1;let j=h.dom,k,l=this.isLocked(j)&&!(a.isText&&h.node&&h.node.isText&&h.nodeDOM.nodeValue==a.text&&3!=h.dirty&&ap(b,h.outerDeco));if(!l&&h.update(a,b,c,d))return this.destroyBetween(this.index,g),h.dom!=j&&(this.changed=!0),this.index++,!0;if(!l&&(k=this.recreateWrapper(h,a,b,c,d,f)))return this.destroyBetween(this.index,g),this.top.children[this.index]=k,k.contentDOM&&(k.dirty=2,k.updateChildren(d,f+1),k.dirty=0),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(a,b,c,d,e,f){if(a.dirty||b.isAtom||!a.children.length||!a.node.content.eq(b.content)||!ap(c,a.outerDeco)||!d.eq(a.innerDeco))return null;let g=af.create(this.top,b,c,d,e,f);if(g.contentDOM)for(let b of(g.children=a.children,a.children=[],g.children))b.parent=g;return a.destroy(),g}addNode(a,b,c,d,e){let f=af.create(this.top,a,b,c,d,e);f.contentDOM&&f.updateChildren(d,e+1),this.top.children.splice(this.index++,0,f),this.changed=!0}placeWidget(a,b,c){let d=this.index<this.top.children.length?this.top.children[this.index]:null;if(d&&d.matchesWidget(a)&&(a==d.widget||!d.widget.type.toDOM.parentNode))this.index++;else{let d=new ac(this.top,a,b,c);this.top.children.splice(this.index++,0,d),this.changed=!0}}addTextblockHacks(){let a=this.top.children[this.index-1],b=this.top;for(;a instanceof ae;)a=(b=a).children[b.children.length-1];(!a||!(a instanceof ah)||/\n$/.test(a.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(a.node.text))&&((E||C)&&a&&"false"==a.dom.contentEditable&&this.addHackNode("IMG",b),this.addHackNode("BR",this.top))}addHackNode(a,b){if(b==this.top&&this.index<b.children.length&&b.children[this.index].matchesHack(a))this.index++;else{let c=document.createElement(a);"IMG"==a&&(c.className="ProseMirror-separator",c.alt=""),"BR"==a&&(c.className="ProseMirror-trailingBreak");let d=new ai(this.top,[],c,null);b!=this.top?b.children.push(d):b.children.splice(this.index++,0,d),this.changed=!0}}isLocked(a){return this.lock&&(a==this.lock||1==a.nodeType&&a.contains(this.lock.parentNode))}}function as(a,b){return a.type.side-b.type.side}function at(a,b,c,d,e){let f=[];for(let g=0,h=0;g<a.length;g++){let i=a[g],j=h,k=h+=i.size;j>=c||k<=b?f.push(i):(j<b&&f.push(i.slice(0,b-j,d)),e&&(f.push(e),e=void 0),k>c&&f.push(i.slice(c-j,i.size,d)))}return f}function au(a,b=null){let c=a.domSelectionRange(),e=a.state.doc;if(!c.focusNode)return null;let f=a.docView.nearestDesc(c.focusNode),h=f&&0==f.size,i=a.docView.posFromDOM(c.focusNode,c.focusOffset,1);if(i<0)return null;let j=e.resolve(i),k,l;if(q(c)){for(k=i;f&&!f.node;)f=f.parent;let a=f.node;if(f&&a.isAtom&&d.nh.isSelectable(a)&&f.parent&&!(a.isInline&&function(a,b,c){for(let d=0==b,e=b==o(a);d||e;){if(a==c)return!0;let b=g(a);if(!(a=a.parentNode))return!1;d=d&&0==b,e=e&&b==o(a)}}(c.focusNode,c.focusOffset,f.dom))){let a=f.posBefore;l=new d.nh(i==a?j:e.resolve(a))}}else{if(c instanceof a.dom.ownerDocument.defaultView.Selection&&c.rangeCount>1){let b=i,d=i;for(let e=0;e<c.rangeCount;e++){let f=c.getRangeAt(e);b=Math.min(b,a.docView.posFromDOM(f.startContainer,f.startOffset,1)),d=Math.max(d,a.docView.posFromDOM(f.endContainer,f.endOffset,-1))}if(b<0)return null;[k,i]=d==a.state.selection.anchor?[d,b]:[b,d],j=e.resolve(i)}else k=a.docView.posFromDOM(c.anchorNode,c.anchorOffset,1);if(k<0)return null}let m=e.resolve(k);if(!l){let c="pointer"==b||a.state.selection.head<j.pos&&!h?1:-1;l=aD(a,m,j,c)}return l}function av(a){return a.editable?a.hasFocus():aF(a)&&document.activeElement&&document.activeElement.contains(a.dom)}function aw(a,b=!1){let c=a.state.selection;if(aB(a,c),av(a)){if(!b&&a.input.mouseDown&&a.input.mouseDown.allowDefault&&C){let b=a.domSelectionRange(),c=a.domObserver.currentSelection;if(b.anchorNode&&c.anchorNode&&l(b.anchorNode,b.anchorOffset,c.anchorNode,c.anchorOffset)){a.input.mouseDown.delayedSelectionSync=!0,a.domObserver.setCurSelection();return}}if(a.domObserver.disconnectSelection(),a.cursorWrapper)!function(a){let b=a.domSelection();if(!b)return;let c=a.cursorWrapper.dom,d="IMG"==c.nodeName;d?b.collapse(c.parentNode,g(c)+1):b.collapse(c,0),!d&&!a.state.selection.visible&&y&&z<=11&&(c.disabled=!0,c.disabled=!1)}(a);else{var e;let f,g,h,i,{anchor:j,head:k}=c,l,m;ax&&!(c instanceof d.U3)&&(c.$from.parent.inlineContent||(l=ay(a,c.from)),c.empty||c.$from.parent.inlineContent||(m=ay(a,c.to))),a.docView.setSelection(j,k,a,b),ax&&(l&&aA(l),m&&aA(m)),c.visible?a.dom.classList.remove("ProseMirror-hideselection"):(a.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&((f=(e=a).dom.ownerDocument).removeEventListener("selectionchange",e.input.hideSelectionGuard),h=(g=e.domSelectionRange()).anchorNode,i=g.anchorOffset,f.addEventListener("selectionchange",e.input.hideSelectionGuard=()=>{(g.anchorNode!=h||g.anchorOffset!=i)&&(f.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout(()=>{(!av(e)||e.state.selection.visible)&&e.dom.classList.remove("ProseMirror-hideselection")},20))})))}a.domObserver.setCurSelection(),a.domObserver.connectSelection()}}let ax=E||C&&D<63;function ay(a,b){let{node:c,offset:d}=a.docView.domFromPos(b,0),e=d<c.childNodes.length?c.childNodes[d]:null,f=d?c.childNodes[d-1]:null;if(E&&e&&"false"==e.contentEditable)return az(e);if((!e||"false"==e.contentEditable)&&(!f||"false"==f.contentEditable)){if(e)return az(e);else if(f)return az(f)}}function az(a){return a.contentEditable="true",E&&a.draggable&&(a.draggable=!1,a.wasDraggable=!0),a}function aA(a){a.contentEditable="false",a.wasDraggable&&(a.draggable=!0,a.wasDraggable=null)}function aB(a,b){if(b instanceof d.nh){let c=a.docView.descAt(b.from);c!=a.lastSelectedViewDesc&&(aC(a),c&&c.selectNode(),a.lastSelectedViewDesc=c)}else aC(a)}function aC(a){a.lastSelectedViewDesc&&(a.lastSelectedViewDesc.parent&&a.lastSelectedViewDesc.deselectNode(),a.lastSelectedViewDesc=void 0)}function aD(a,b,c,e){return a.someProp("createSelectionBetween",d=>d(a,b,c))||d.U3.between(b,c,e)}function aE(a){return(!a.editable||!!a.hasFocus())&&aF(a)}function aF(a){let b=a.domSelectionRange();if(!b.anchorNode)return!1;try{return a.dom.contains(3==b.anchorNode.nodeType?b.anchorNode.parentNode:b.anchorNode)&&(a.editable||a.dom.contains(3==b.focusNode.nodeType?b.focusNode.parentNode:b.focusNode))}catch(a){return!1}}function aG(a,b){let{$anchor:c,$head:e}=a.selection,f=b>0?c.max(e):c.min(e),g=f.parent.inlineContent?f.depth?a.doc.resolve(b>0?f.after():f.before()):null:f;return g&&d.LN.findFrom(g,b)}function aH(a,b){return a.dispatch(a.state.tr.setSelection(b).scrollIntoView()),!0}function aI(a,b,c){let e=a.state.selection;if(e instanceof d.U3){if(c.indexOf("s")>-1){let{$head:c}=e,f=c.textOffset?null:b<0?c.nodeBefore:c.nodeAfter;if(!f||f.isText||!f.isLeaf)return!1;let g=a.state.doc.resolve(c.pos+f.nodeSize*(b<0?-1:1));return aH(a,new d.U3(e.$anchor,g))}else if(!e.empty)return!1;else if(a.endOfTextblock(b>0?"forward":"backward")){let c=aG(a.state,b);return!!c&&c instanceof d.nh&&aH(a,c)}else if(!(G&&c.indexOf("m")>-1)){let c=e.$head,f=c.textOffset?null:b<0?c.nodeBefore:c.nodeAfter,g;if(!f||f.isText)return!1;let h=b<0?c.pos-f.nodeSize:c.pos;return!!(f.isAtom||(g=a.docView.descAt(h))&&!g.contentDOM)&&(d.nh.isSelectable(f)?aH(a,new d.nh(b<0?a.state.doc.resolve(c.pos-f.nodeSize):c)):!!J&&aH(a,new d.U3(a.state.doc.resolve(b<0?h:h+f.nodeSize))))}}else{if(e instanceof d.nh&&e.node.isInline)return aH(a,new d.U3(b>0?e.$to:e.$from));let c=aG(a.state,b);return!!c&&aH(a,c)}}function aJ(a){return 3==a.nodeType?a.nodeValue.length:a.childNodes.length}function aK(a,b){let c=a.pmViewDesc;return c&&0==c.size&&(b<0||a.nextSibling||"BR"!=a.nodeName)}function aL(a,b){return b<0?function(a){let b=a.domSelectionRange(),c=b.focusNode,d=b.focusOffset;if(!c)return;let e,f,h=!1;for(A&&1==c.nodeType&&d<aJ(c)&&aK(c.childNodes[d],-1)&&(h=!0);;)if(d>0)if(1!=c.nodeType)break;else{let a=c.childNodes[d-1];if(aK(a,-1))e=c,f=--d;else if(3==a.nodeType)d=(c=a).nodeValue.length;else break}else if(aM(c))break;else{let b=c.previousSibling;for(;b&&aK(b,-1);)e=c.parentNode,f=g(b),b=b.previousSibling;if(b)d=aJ(c=b);else{if((c=c.parentNode)==a.dom)break;d=0}}h?aN(a,c,d):e&&aN(a,e,f)}(a):function(a){let b,c,d=a.domSelectionRange(),e=d.focusNode,f=d.focusOffset;if(!e)return;let h=aJ(e);for(;;)if(f<h){if(1!=e.nodeType)break;if(aK(e.childNodes[f],1))b=e,c=++f;else break}else if(aM(e))break;else{let d=e.nextSibling;for(;d&&aK(d,1);)b=d.parentNode,c=g(d)+1,d=d.nextSibling;if(d)f=0,h=aJ(e=d);else{if((e=e.parentNode)==a.dom)break;f=h=0}}b&&aN(a,b,c)}(a)}function aM(a){let b=a.pmViewDesc;return b&&b.node&&b.node.isBlock}function aN(a,b,c){if(3!=b.nodeType){let a,d;(d=function(a,b){for(;a&&b==a.childNodes.length&&!p(a);)b=g(a)+1,a=a.parentNode;for(;a&&b<a.childNodes.length;){let c=a.childNodes[b];if(3==c.nodeType)return c;if(1==c.nodeType&&"false"==c.contentEditable)break;a=c,b=0}}(b,c))?(b=d,c=0):(a=function(a,b){for(;a&&!b&&!p(a);)b=g(a),a=a.parentNode;for(;a&&b;){let c=a.childNodes[b-1];if(3==c.nodeType)return c;if(1==c.nodeType&&"false"==c.contentEditable)break;b=(a=c).childNodes.length}}(b,c))&&(b=a,c=a.nodeValue.length)}let d=a.domSelection();if(!d)return;if(q(d)){let a=document.createRange();a.setEnd(b,c),a.setStart(b,c),d.removeAllRanges(),d.addRange(a)}else d.extend&&d.extend(b,c);a.domObserver.setCurSelection();let{state:e}=a;setTimeout(()=>{a.state==e&&aw(a)},50)}function aO(a,b){let c=a.state.doc.resolve(b);if(!(C||H)&&c.parent.inlineContent){let d=a.coordsAtPos(b);if(b>c.start()){let c=a.coordsAtPos(b-1),e=(c.top+c.bottom)/2;if(e>d.top&&e<d.bottom&&Math.abs(c.left-d.left)>1)return c.left<d.left?"ltr":"rtl"}if(b<c.end()){let c=a.coordsAtPos(b+1),e=(c.top+c.bottom)/2;if(e>d.top&&e<d.bottom&&Math.abs(c.left-d.left)>1)return c.left>d.left?"ltr":"rtl"}}return"rtl"==getComputedStyle(a.dom).direction?"rtl":"ltr"}function aP(a,b,c){let e=a.state.selection;if(e instanceof d.U3&&!e.empty||c.indexOf("s")>-1||G&&c.indexOf("m")>-1)return!1;let{$from:f,$to:g}=e;if(!f.parent.inlineContent||a.endOfTextblock(b<0?"up":"down")){let c=aG(a.state,b);if(c&&c instanceof d.nh)return aH(a,c)}if(!f.parent.inlineContent){let c=b<0?f:g,h=e instanceof d.i5?d.LN.near(c,b):d.LN.findFrom(c,b);return!!h&&aH(a,h)}return!1}function aQ(a,b){if(!(a.state.selection instanceof d.U3))return!0;let{$head:c,$anchor:e,empty:f}=a.state.selection;if(!c.sameParent(e))return!0;if(!f)return!1;if(a.endOfTextblock(b>0?"forward":"backward"))return!0;let g=!c.textOffset&&(b<0?c.nodeBefore:c.nodeAfter);if(g&&!g.isText){let d=a.state.tr;return b<0?d.delete(c.pos-g.nodeSize,c.pos):d.delete(c.pos,c.pos+g.nodeSize),a.dispatch(d),!0}return!1}function aR(a,b,c){a.domObserver.stop(),b.contentEditable=c,a.domObserver.start()}function aS(a,b){a.someProp("transformCopied",c=>{b=c(b,a)});let c=[],{content:d,openStart:f,openEnd:g}=b;for(;f>1&&g>1&&1==d.childCount&&1==d.firstChild.childCount;){f--,g--;let a=d.firstChild;c.push(a.type.name,a.attrs!=a.type.defaultAttrs?a.attrs:null),d=a.content}let h=a.someProp("clipboardSerializer")||e.ZF.fromSchema(a.state.schema),i=a$(),j=i.createElement("div");j.appendChild(h.serializeFragment(d,{document:i}));let k=j.firstChild,l,m=0;for(;k&&1==k.nodeType&&(l=aY[k.nodeName.toLowerCase()]);){for(let a=l.length-1;a>=0;a--){let b=i.createElement(l[a]);for(;j.firstChild;)b.appendChild(j.firstChild);j.appendChild(b),m++}k=j.firstChild}return k&&1==k.nodeType&&k.setAttribute("data-pm-slice",`${f} ${g}${m?` -${m}`:""} ${JSON.stringify(c)}`),{dom:j,text:a.someProp("clipboardTextSerializer",c=>c(b,a))||b.content.textBetween(0,b.content.size,"\n\n"),slice:b}}function aT(a,b,c,d,f){let g,h,i=f.parent.type.spec.code;if(!c&&!b)return null;let j=!!b&&(d||i||!c);if(j){if(a.someProp("transformPastedText",c=>{b=c(b,i||d,a)}),i)return h=new e.Ji(e.FK.from(a.state.schema.text(b.replace(/\r\n?/g,"\n"))),0,0),a.someProp("transformPasted",b=>{h=b(h,a,!0)}),h;let c=a.someProp("clipboardTextParser",c=>c(b,f,d,a));if(c)h=c;else{let c=f.marks(),{schema:d}=a.state,h=e.ZF.fromSchema(d);g=document.createElement("div"),b.split(/(?:\r\n?|\n)+/).forEach(a=>{let b=g.appendChild(document.createElement("p"));a&&b.appendChild(h.serializeNode(d.text(a,c)))})}}else a.someProp("transformPastedHTML",b=>{c=b(c,a)}),g=function(a){var b;let c,d=/^(\s*<meta [^>]*>)*/.exec(a);d&&(a=a.slice(d[0].length));let e=a$().createElement("div"),f=/<([a-z][^>\s]+)/i.exec(a),g;if((g=f&&aY[f[1].toLowerCase()])&&(a=g.map(a=>"<"+a+">").join("")+a+g.map(a=>"</"+a+">").reverse().join("")),e.innerHTML=(b=a,(c=window.trustedTypes)?(a_||(a_=c.defaultPolicy||c.createPolicy("ProseMirrorClipboard",{createHTML:a=>a})),a_.createHTML(b)):b),g)for(let a=0;a<g.length;a++)e=e.querySelector(g[a])||e;return e}(c),J&&function(a){let b=a.querySelectorAll(C?"span:not([class]):not([style])":"span.Apple-converted-space");for(let c=0;c<b.length;c++){let d=b[c];1==d.childNodes.length&&"\xa0"==d.textContent&&d.parentNode&&d.parentNode.replaceChild(a.ownerDocument.createTextNode(" "),d)}}(g);let k=g&&g.querySelector("[data-pm-slice]"),l=k&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(k.getAttribute("data-pm-slice")||"");if(l&&l[3])for(let a=+l[3];a>0;a--){let a=g.firstChild;for(;a&&1!=a.nodeType;)a=a.nextSibling;if(!a)break;g=a}if(h||(h=(a.someProp("clipboardParser")||a.someProp("domParser")||e.S4.fromSchema(a.state.schema)).parseSlice(g,{preserveWhitespace:!!(j||l),context:f,ruleFromNode:a=>"BR"!=a.nodeName||a.nextSibling||!a.parentNode||aU.test(a.parentNode.nodeName)?null:{ignore:!0}})),l)h=function(a,b){if(!a.size)return a;let c=a.content.firstChild.type.schema,d;try{d=JSON.parse(b)}catch(b){return a}let{content:f,openStart:g,openEnd:h}=a;for(let a=d.length-2;a>=0;a-=2){let b=c.nodes[d[a]];if(!b||b.hasRequiredAttrs())break;f=e.FK.from(b.create(d[a+1],f)),g++,h++}return new e.Ji(f,g,h)}(aX(h,+l[1],+l[2]),l[4]);else if((h=e.Ji.maxOpen(function(a,b){if(a.childCount<2)return a;for(let c=b.depth;c>=0;c--){let d=b.node(c).contentMatchAt(b.index(c)),f,g=[];if(a.forEach(a=>{if(!g)return;let b=d.findWrapping(a.type),c;if(!b)return g=null;if(c=g.length&&f.length&&function a(b,c,d,f,g){if(g<b.length&&g<c.length&&b[g]==c[g]){let h=a(b,c,d,f.lastChild,g+1);if(h)return f.copy(f.content.replaceChild(f.childCount-1,h));if(f.contentMatchAt(f.childCount).matchType(g==b.length-1?d.type:b[g+1]))return f.copy(f.content.append(e.FK.from(aV(d,b,g+1))))}}(b,f,a,g[g.length-1],0))g[g.length-1]=c;else{g.length&&(g[g.length-1]=function a(b,c){if(0==c)return b;let d=b.content.replaceChild(b.childCount-1,a(b.lastChild,c-1)),f=b.contentMatchAt(b.childCount).fillBefore(e.FK.empty,!0);return b.copy(d.append(f))}(g[g.length-1],f.length));let c=aV(a,b);g.push(c),d=d.matchType(c.type),f=b}}),g)return e.FK.from(g)}return a}(h.content,f),!0)).openStart||h.openEnd){let a=0,b=0;for(let b=h.content.firstChild;a<h.openStart&&!b.type.spec.isolating;a++,b=b.firstChild);for(let a=h.content.lastChild;b<h.openEnd&&!a.type.spec.isolating;b++,a=a.lastChild);h=aX(h,a,b)}return a.someProp("transformPasted",b=>{h=b(h,a,j)}),h}let aU=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function aV(a,b,c=0){for(let d=b.length-1;d>=c;d--)a=b[d].create(null,e.FK.from(a));return a}function aW(a,b,c,d,f,g){let h=b<0?a.firstChild:a.lastChild,i=h.content;return a.childCount>1&&(g=0),f<d-1&&(i=aW(i,b,c,d,f+1,g)),f>=c&&(i=b<0?h.contentMatchAt(0).fillBefore(i,g<=f).append(i):i.append(h.contentMatchAt(h.childCount).fillBefore(e.FK.empty,!0))),a.replaceChild(b<0?0:a.childCount-1,h.copy(i))}function aX(a,b,c){return b<a.openStart&&(a=new e.Ji(aW(a.content,-1,b,a.openStart,0,a.openEnd),b,a.openEnd)),c<a.openEnd&&(a=new e.Ji(aW(a.content,1,c,a.openEnd,0,0),a.openStart,c)),a}let aY={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]},aZ=null;function a$(){return aZ||(aZ=document.implementation.createHTMLDocument("title"))}let a_=null,a0={},a1={},a2={touchstart:!0,touchmove:!0};class a3{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function a4(a,b){a.input.lastSelectionOrigin=b,a.input.lastSelectionTime=Date.now()}function a5(a){a.someProp("handleDOMEvents",b=>{for(let c in b)a.input.eventHandlers[c]||a.dom.addEventListener(c,a.input.eventHandlers[c]=b=>a6(a,b))})}function a6(a,b){return a.someProp("handleDOMEvents",c=>{let d=c[b.type];return!!d&&(d(a,b)||b.defaultPrevented)})}function a7(a){return{left:a.clientX,top:a.clientY}}function a8(a,b,c,d,e){if(-1==d)return!1;let f=a.state.doc.resolve(d);for(let d=f.depth+1;d>0;d--)if(a.someProp(b,b=>d>f.depth?b(a,c,f.nodeAfter,f.before(d),e,!0):b(a,c,f.node(d),f.before(d),e,!1)))return!0;return!1}function a9(a,b,c){if(a.focused||a.focus(),a.state.selection.eq(b))return;let d=a.state.tr.setSelection(b);"pointer"==c&&d.setMeta("pointer",!0),a.dispatch(d)}a1.keydown=(a,b)=>{if((a.input.shiftKey=16==b.keyCode||b.shiftKey,!bc(a,b))&&(a.input.lastKeyCode=b.keyCode,a.input.lastKeyCodeTime=Date.now(),!I||!C||13!=b.keyCode))if(229!=b.keyCode&&a.domObserver.forceFlush(),!F||13!=b.keyCode||b.ctrlKey||b.altKey||b.metaKey)a.someProp("handleKeyDown",c=>c(a,b))||function(a,b){let c,d=b.keyCode,e=(c="",b.ctrlKey&&(c+="c"),b.metaKey&&(c+="m"),b.altKey&&(c+="a"),b.shiftKey&&(c+="s"),c);if(8==d||G&&72==d&&"c"==e)return aQ(a,-1)||aL(a,-1);if(46==d&&!b.shiftKey||G&&68==d&&"c"==e)return aQ(a,1)||aL(a,1);if(13==d||27==d)return!0;if(37==d||G&&66==d&&"c"==e){let b=37==d?"ltr"==aO(a,a.state.selection.from)?-1:1:-1;return aI(a,b,e)||aL(a,b)}if(39==d||G&&70==d&&"c"==e){let b=39==d?"ltr"==aO(a,a.state.selection.from)?1:-1:1;return aI(a,b,e)||aL(a,b)}else if(38==d||G&&80==d&&"c"==e)return aP(a,-1,e)||aL(a,-1);else if(40==d||G&&78==d&&"c"==e)return function(a){if(!E||a.state.selection.$head.parentOffset>0)return!1;let{focusNode:b,focusOffset:c}=a.domSelectionRange();if(b&&1==b.nodeType&&0==c&&b.firstChild&&"false"==b.firstChild.contentEditable){let c=b.firstChild;aR(a,c,"true"),setTimeout(()=>aR(a,c,"false"),20)}return!1}(a)||aP(a,1,e)||aL(a,1);else if(e==(G?"m":"c")&&(66==d||73==d||89==d||90==d))return!0;return!1}(a,b)?b.preventDefault():a4(a,"key");else{let b=Date.now();a.input.lastIOSEnter=b,a.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{a.input.lastIOSEnter==b&&(a.someProp("handleKeyDown",b=>b(a,r(13,"Enter"))),a.input.lastIOSEnter=0)},200)}},a1.keyup=(a,b)=>{16==b.keyCode&&(a.input.shiftKey=!1)},a1.keypress=(a,b)=>{if(bc(a,b)||!b.charCode||b.ctrlKey&&!b.altKey||G&&b.metaKey)return;if(a.someProp("handleKeyPress",c=>c(a,b)))return void b.preventDefault();let c=a.state.selection;if(!(c instanceof d.U3)||!c.$from.sameParent(c.$to)){let d=String.fromCharCode(b.charCode),e=()=>a.state.tr.insertText(d).scrollIntoView();/[\r\n]/.test(d)||a.someProp("handleTextInput",b=>b(a,c.$from.pos,c.$to.pos,d,e))||a.dispatch(e()),b.preventDefault()}};let ba=G?"metaKey":"ctrlKey";a0.mousedown=(a,b)=>{a.input.shiftKey=b.shiftKey;let c=bg(a),e=Date.now(),f="singleClick";e-a.input.lastClick.time<500&&function(a,b){let c=b.x-a.clientX,d=b.y-a.clientY;return c*c+d*d<100}(b,a.input.lastClick)&&!b[ba]&&a.input.lastClick.button==b.button&&("singleClick"==a.input.lastClick.type?f="doubleClick":"doubleClick"==a.input.lastClick.type&&(f="tripleClick")),a.input.lastClick={time:e,x:b.clientX,y:b.clientY,type:f,button:b.button};let g=a.posAtCoords(a7(b));g&&("singleClick"==f?(a.input.mouseDown&&a.input.mouseDown.done(),a.input.mouseDown=new bb(a,g,b,!!c)):("doubleClick"==f?function(a,b,c,d){return a8(a,"handleDoubleClickOn",b,c,d)||a.someProp("handleDoubleClick",c=>c(a,b,d))}:function(a,b,c,e){return a8(a,"handleTripleClickOn",b,c,e)||a.someProp("handleTripleClick",c=>c(a,b,e))||function(a,b,c){if(0!=c.button)return!1;let e=a.state.doc;if(-1==b)return!!e.inlineContent&&(a9(a,d.U3.create(e,0,e.content.size),"pointer"),!0);let f=e.resolve(b);for(let b=f.depth+1;b>0;b--){let c=b>f.depth?f.nodeAfter:f.node(b),g=f.before(b);if(c.inlineContent)a9(a,d.U3.create(e,g+1,g+1+c.content.size),"pointer");else{if(!d.nh.isSelectable(c))continue;a9(a,d.nh.create(e,g),"pointer")}return!0}}(a,c,e)})(a,g.pos,g.inside,b)?b.preventDefault():a4(a,"pointer"))};class bb{constructor(a,b,c,e){let f,g;if(this.view=a,this.pos=b,this.event=c,this.flushed=e,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=a.state.doc,this.selectNode=!!c[ba],this.allowDefault=c.shiftKey,b.inside>-1)f=a.state.doc.nodeAt(b.inside),g=b.inside;else{let c=a.state.doc.resolve(b.pos);f=c.parent,g=c.depth?c.before():0}let h=e?null:c.target,i=h?a.docView.nearestDesc(h,!0):null;this.target=i&&1==i.nodeDOM.nodeType?i.nodeDOM:null;let{selection:j}=a.state;(0==c.button&&f.type.spec.draggable&&!1!==f.type.spec.selectable||j instanceof d.nh&&j.from<=g&&j.to>g)&&(this.mightDrag={node:f,pos:g,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&A&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),a.root.addEventListener("mouseup",this.up=this.up.bind(this)),a.root.addEventListener("mousemove",this.move=this.move.bind(this)),a4(a,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>aw(this.view)),this.view.input.mouseDown=null}up(a){if(this.done(),!this.view.dom.contains(a.target))return;let b=this.pos;if(this.view.state.doc!=this.startDoc&&(b=this.view.posAtCoords(a7(a))),this.updateAllowDefault(a),this.allowDefault||!b)a4(this.view,"pointer");else{var c,e,f,g;(c=this.view,e=b.pos,f=b.inside,g=this.selectNode,a8(c,"handleClickOn",e,f,a)||c.someProp("handleClick",b=>b(c,e,a))||(g?function(a,b){if(-1==b)return!1;let c=a.state.selection,e,f;c instanceof d.nh&&(e=c.node);let g=a.state.doc.resolve(b);for(let a=g.depth+1;a>0;a--){let b=a>g.depth?g.nodeAfter:g.node(a);if(d.nh.isSelectable(b)){f=e&&c.$from.depth>0&&a>=c.$from.depth&&g.before(c.$from.depth+1)==c.$from.pos?g.before(c.$from.depth):g.before(a);break}}return null!=f&&(a9(a,d.nh.create(a.state.doc,f),"pointer"),!0)}(c,f):function(a,b){if(-1==b)return!1;let c=a.state.doc.resolve(b),e=c.nodeAfter;return!!(e&&e.isAtom&&d.nh.isSelectable(e))&&(a9(a,new d.nh(c),"pointer"),!0)}(c,f)))?a.preventDefault():0==a.button&&(this.flushed||E&&this.mightDrag&&!this.mightDrag.node.isAtom||C&&!this.view.state.selection.visible&&2>=Math.min(Math.abs(b.pos-this.view.state.selection.from),Math.abs(b.pos-this.view.state.selection.to)))?(a9(this.view,d.LN.near(this.view.state.doc.resolve(b.pos)),"pointer"),a.preventDefault()):a4(this.view,"pointer")}}move(a){this.updateAllowDefault(a),a4(this.view,"pointer"),0==a.buttons&&this.done()}updateAllowDefault(a){!this.allowDefault&&(Math.abs(this.event.x-a.clientX)>4||Math.abs(this.event.y-a.clientY)>4)&&(this.allowDefault=!0)}}function bc(a,b){return!!a.composing||!!(E&&500>Math.abs(b.timeStamp-a.input.compositionEndedAt))&&(a.input.compositionEndedAt=-2e8,!0)}a0.touchstart=a=>{a.input.lastTouch=Date.now(),bg(a),a4(a,"pointer")},a0.touchmove=a=>{a.input.lastTouch=Date.now(),a4(a,"pointer")},a0.contextmenu=a=>bg(a);let bd=I?5e3:-1;function be(a,b){clearTimeout(a.input.composingTimeout),b>-1&&(a.input.composingTimeout=setTimeout(()=>bg(a),b))}function bf(a){let b;for(a.composing&&(a.input.composing=!1,a.input.compositionEndedAt=((b=document.createEvent("Event")).initEvent("event",!0,!0),b.timeStamp));a.input.compositionNodes.length>0;)a.input.compositionNodes.pop().markParentsDirty()}function bg(a,b=!1){if(!I||!(a.domObserver.flushingSoon>=0)){if(a.domObserver.forceFlush(),bf(a),b||a.docView&&a.docView.dirty){let c=au(a),d=a.state.selection;return c&&!c.eq(d)?a.dispatch(a.state.tr.setSelection(c)):(a.markCursor||b)&&!d.$from.node(d.$from.sharedDepth(d.to)).inlineContent?a.dispatch(a.state.tr.deleteSelection()):a.updateState(a.state),!0}return!1}}a1.compositionstart=a1.compositionupdate=a=>{if(!a.composing){a.domObserver.flush();let{state:b}=a,c=b.selection.$to;if(b.selection instanceof d.U3&&(b.storedMarks||!c.textOffset&&c.parentOffset&&c.nodeBefore.marks.some(a=>!1===a.type.spec.inclusive)||C&&H&&function(a){let{focusNode:b,focusOffset:c}=a.domSelectionRange();if(!b||1!=b.nodeType||c>=b.childNodes.length)return!1;let d=b.childNodes[c];return 1==d.nodeType&&"false"==d.contentEditable}(a)))a.markCursor=a.state.storedMarks||c.marks(),bg(a,!0),a.markCursor=null;else if(bg(a,!b.selection.empty),A&&b.selection.empty&&c.parentOffset&&!c.textOffset&&c.nodeBefore.marks.length){let b=a.domSelectionRange();for(let c=b.focusNode,d=b.focusOffset;c&&1==c.nodeType&&0!=d;){let b=d<0?c.lastChild:c.childNodes[d-1];if(!b)break;if(3==b.nodeType){let c=a.domSelection();c&&c.collapse(b,b.nodeValue.length);break}c=b,d=-1}}a.input.composing=!0}be(a,bd)},a1.compositionend=(a,b)=>{a.composing&&(a.input.composing=!1,a.input.compositionEndedAt=b.timeStamp,a.input.compositionPendingChanges=a.domObserver.pendingRecords().length?a.input.compositionID:0,a.input.compositionNode=null,a.input.badSafariComposition?a.domObserver.forceFlush():a.input.compositionPendingChanges&&Promise.resolve().then(()=>a.domObserver.flush()),a.input.compositionID++,be(a,20))};let bh=y&&z<15||F&&K<604;function bi(a,b,c,d,f){let g=aT(a,b,c,d,a.state.selection.$from);if(a.someProp("handlePaste",b=>b(a,f,g||e.Ji.empty)))return!0;if(!g)return!1;let h=0==g.openStart&&0==g.openEnd&&1==g.content.childCount?g.content.firstChild:null,i=h?a.state.tr.replaceSelectionWith(h,d):a.state.tr.replaceSelection(g);return a.dispatch(i.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function bj(a){let b=a.getData("text/plain")||a.getData("Text");if(b)return b;let c=a.getData("text/uri-list");return c?c.replace(/\r?\n/g," "):""}a0.copy=a1.cut=(a,b)=>{let c=a.state.selection,d="cut"==b.type;if(c.empty)return;let e=bh?null:b.clipboardData,{dom:f,text:g}=aS(a,c.content());e?(b.preventDefault(),e.clearData(),e.setData("text/html",f.innerHTML),e.setData("text/plain",g)):function(a,b){if(!a.dom.parentNode)return;let c=a.dom.parentNode.appendChild(document.createElement("div"));c.appendChild(b),c.style.cssText="position: fixed; left: -10000px; top: 10px";let d=getSelection(),e=document.createRange();e.selectNodeContents(b),a.dom.blur(),d.removeAllRanges(),d.addRange(e),setTimeout(()=>{c.parentNode&&c.parentNode.removeChild(c),a.focus()},50)}(a,f),d&&a.dispatch(a.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},a1.paste=(a,b)=>{if(a.composing&&!I)return;let c=bh?null:b.clipboardData,d=a.input.shiftKey&&45!=a.input.lastKeyCode;c&&bi(a,bj(c),c.getData("text/html"),d,b)?b.preventDefault():function(a,b){if(!a.dom.parentNode)return;let c=a.input.shiftKey||a.state.selection.$from.parent.type.spec.code,d=a.dom.parentNode.appendChild(document.createElement(c?"textarea":"div"));c||(d.contentEditable="true"),d.style.cssText="position: fixed; left: -10000px; top: 10px",d.focus();let e=a.input.shiftKey&&45!=a.input.lastKeyCode;setTimeout(()=>{a.focus(),d.parentNode&&d.parentNode.removeChild(d),c?bi(a,d.value,null,e,b):bi(a,d.textContent,d.innerHTML,e,b)},50)}(a,b)};class bk{constructor(a,b,c){this.slice=a,this.move=b,this.node=c}}let bl=G?"altKey":"ctrlKey";function bm(a,b){let c=a.someProp("dragCopies",a=>!a(b));return null!=c?c:!b[bl]}for(let a in a0.dragstart=(a,b)=>{let c,e=a.input.mouseDown;if(e&&e.done(),!b.dataTransfer)return;let f=a.state.selection,g=f.empty?null:a.posAtCoords(a7(b));if(g&&g.pos>=f.from&&g.pos<=(f instanceof d.nh?f.to-1:f.to));else if(e&&e.mightDrag)c=d.nh.create(a.state.doc,e.mightDrag.pos);else if(b.target&&1==b.target.nodeType){let e=a.docView.nearestDesc(b.target,!0);e&&e.node.type.spec.draggable&&e!=a.docView&&(c=d.nh.create(a.state.doc,e.posBefore))}let h=(c||a.state.selection).content(),{dom:i,text:j,slice:k}=aS(a,h);b.dataTransfer.files.length&&C&&!(D>120)||b.dataTransfer.clearData(),b.dataTransfer.setData(bh?"Text":"text/html",i.innerHTML),b.dataTransfer.effectAllowed="copyMove",bh||b.dataTransfer.setData("text/plain",j),a.dragging=new bk(k,bm(a,b),c)},a0.dragend=a=>{let b=a.dragging;window.setTimeout(()=>{a.dragging==b&&(a.dragging=null)},50)},a1.dragover=a1.dragenter=(a,b)=>b.preventDefault(),a1.drop=(a,b)=>{try{!function(a,b,c){if(!b.dataTransfer)return;let g=a.posAtCoords(a7(b));if(!g)return;let h=a.state.doc.resolve(g.pos),i=c&&c.slice;i?a.someProp("transformPasted",b=>{i=b(i,a,!1)}):i=aT(a,bj(b.dataTransfer),bh?null:b.dataTransfer.getData("text/html"),!1,h);let j=!!(c&&bm(a,b));if(a.someProp("handleDrop",c=>c(a,b,i||e.Ji.empty,j)))return b.preventDefault();if(!i)return;b.preventDefault();let k=i?(0,f.Um)(a.state.doc,h.pos,i):h.pos;null==k&&(k=h.pos);let l=a.state.tr;if(j){let{node:a}=c;a?a.replace(l):l.deleteSelection()}let m=l.mapping.map(k),n=0==i.openStart&&0==i.openEnd&&1==i.content.childCount,o=l.doc;if(n?l.replaceRangeWith(m,m,i.content.firstChild):l.replaceRange(m,m,i),l.doc.eq(o))return;let p=l.doc.resolve(m);if(n&&d.nh.isSelectable(i.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(i.content.firstChild))l.setSelection(new d.nh(p));else{let b=l.mapping.map(k);l.mapping.maps[l.mapping.maps.length-1].forEach((a,c,d,e)=>b=e),l.setSelection(aD(a,p,l.doc.resolve(b)))}a.focus(),a.dispatch(l.setMeta("uiEvent","drop"))}(a,b,a.dragging)}finally{a.dragging=null}},a0.focus=a=>{a.input.lastFocus=Date.now(),a.focused||(a.domObserver.stop(),a.dom.classList.add("ProseMirror-focused"),a.domObserver.start(),a.focused=!0,setTimeout(()=>{a.docView&&a.hasFocus()&&!a.domObserver.currentSelection.eq(a.domSelectionRange())&&aw(a)},20))},a0.blur=(a,b)=>{a.focused&&(a.domObserver.stop(),a.dom.classList.remove("ProseMirror-focused"),a.domObserver.start(),b.relatedTarget&&a.dom.contains(b.relatedTarget)&&a.domObserver.currentSelection.clear(),a.focused=!1)},a0.beforeinput=(a,b)=>{if(C&&I&&"deleteContentBackward"==b.inputType){a.domObserver.flushSoon();let{domChangeCount:b}=a.input;setTimeout(()=>{if(a.input.domChangeCount!=b||(a.dom.blur(),a.focus(),a.someProp("handleKeyDown",b=>b(a,r(8,"Backspace")))))return;let{$cursor:c}=a.state.selection;c&&c.pos>0&&a.dispatch(a.state.tr.delete(c.pos-1,c.pos).scrollIntoView())},50)}},a1)a0[a]=a1[a];function bn(a,b){if(a==b)return!0;for(let c in a)if(a[c]!==b[c])return!1;for(let c in b)if(!(c in a))return!1;return!0}class bo{constructor(a,b){this.toDOM=a,this.spec=b||bt,this.side=this.spec.side||0}map(a,b,c,d){let{pos:e,deleted:f}=a.mapResult(b.from+d,this.side<0?-1:1);return f?null:new br(e-c,e-c,this)}valid(){return!0}eq(a){return this==a||a instanceof bo&&(this.spec.key&&this.spec.key==a.spec.key||this.toDOM==a.toDOM&&bn(this.spec,a.spec))}destroy(a){this.spec.destroy&&this.spec.destroy(a)}}class bp{constructor(a,b){this.attrs=a,this.spec=b||bt}map(a,b,c,d){let e=a.map(b.from+d,this.spec.inclusiveStart?-1:1)-c,f=a.map(b.to+d,this.spec.inclusiveEnd?1:-1)-c;return e>=f?null:new br(e,f,this)}valid(a,b){return b.from<b.to}eq(a){return this==a||a instanceof bp&&bn(this.attrs,a.attrs)&&bn(this.spec,a.spec)}static is(a){return a.type instanceof bp}destroy(){}}class bq{constructor(a,b){this.attrs=a,this.spec=b||bt}map(a,b,c,d){let e=a.mapResult(b.from+d,1);if(e.deleted)return null;let f=a.mapResult(b.to+d,-1);return f.deleted||f.pos<=e.pos?null:new br(e.pos-c,f.pos-c,this)}valid(a,b){let{index:c,offset:d}=a.content.findIndex(b.from),e;return d==b.from&&!(e=a.child(c)).isText&&d+e.nodeSize==b.to}eq(a){return this==a||a instanceof bq&&bn(this.attrs,a.attrs)&&bn(this.spec,a.spec)}destroy(){}}class br{constructor(a,b,c){this.from=a,this.to=b,this.type=c}copy(a,b){return new br(a,b,this.type)}eq(a,b=0){return this.type.eq(a.type)&&this.from+b==a.from&&this.to+b==a.to}map(a,b,c){return this.type.map(a,this,b,c)}static widget(a,b,c){return new br(a,a,new bo(b,c))}static inline(a,b,c,d){return new br(a,b,new bp(c,d))}static node(a,b,c,d){return new br(a,b,new bq(c,d))}get spec(){return this.type.spec}get inline(){return this.type instanceof bp}get widget(){return this.type instanceof bo}}let bs=[],bt={};class bu{constructor(a,b){this.local=a.length?a:bs,this.children=b.length?b:bs}static create(a,b){return b.length?bA(b,a,0,bt):bv}find(a,b,c){let d=[];return this.findInner(null==a?0:a,null==b?1e9:b,d,0,c),d}findInner(a,b,c,d,e){for(let f=0;f<this.local.length;f++){let g=this.local[f];g.from<=b&&g.to>=a&&(!e||e(g.spec))&&c.push(g.copy(g.from+d,g.to+d))}for(let f=0;f<this.children.length;f+=3)if(this.children[f]<b&&this.children[f+1]>a){let g=this.children[f]+1;this.children[f+2].findInner(a-g,b-g,c,d+g,e)}}map(a,b,c){return this==bv||0==a.maps.length?this:this.mapInner(a,b,0,0,c||bt)}mapInner(a,b,c,d,e){let f;for(let g=0;g<this.local.length;g++){let h=this.local[g].map(a,c,d);h&&h.type.valid(b,h)?(f||(f=[])).push(h):e.onRemove&&e.onRemove(this.local[g].spec)}return this.children.length?function(a,b,c,d,e,f,g){let h=a.slice();for(let a=0,b=f;a<c.maps.length;a++){let d=0;c.maps[a].forEach((a,c,e,f)=>{let g=f-e-(c-a);for(let e=0;e<h.length;e+=3){let f=h[e+1];if(f<0||a>f+b-d)continue;let i=h[e]+b-d;c>=i?h[e+1]=a<=i?-2:-1:a>=b&&g&&(h[e]+=g,h[e+1]+=g)}d+=g}),b=c.maps[a].map(b,-1)}let i=!1;for(let b=0;b<h.length;b+=3)if(h[b+1]<0){if(-2==h[b+1]){i=!0,h[b+1]=-1;continue}let j=c.map(a[b]+f),k=j-e;if(k<0||k>=d.content.size){i=!0;continue}let l=c.map(a[b+1]+f,-1)-e,{index:m,offset:n}=d.content.findIndex(k),o=d.maybeChild(m);if(o&&n==k&&n+o.nodeSize==l){let d=h[b+2].mapInner(c,o,j+1,a[b]+f+1,g);d!=bv?(h[b]=k,h[b+1]=l,h[b+2]=d):(h[b+1]=-2,i=!0)}else i=!0}if(i){let i=bA(function(a,b,c,d,e,f,g){for(let h=0;h<a.length;h+=3)-1==a[h+1]&&function a(b,f){for(let a=0;a<b.local.length;a++){let h=b.local[a].map(d,e,f);h?c.push(h):g.onRemove&&g.onRemove(b.local[a].spec)}for(let c=0;c<b.children.length;c+=3)a(b.children[c+2],b.children[c]+f+1)}(a[h+2],b[h]+f+1);return c}(h,a,b,c,e,f,g),d,0,g);b=i.local;for(let a=0;a<h.length;a+=3)h[a+1]<0&&(h.splice(a,3),a-=3);for(let a=0,b=0;a<i.children.length;a+=3){let c=i.children[a];for(;b<h.length&&h[b]<c;)b+=3;h.splice(b,0,i.children[a],i.children[a+1],i.children[a+2])}}return new bu(b.sort(bB),h)}(this.children,f||[],a,b,c,d,e):f?new bu(f.sort(bB),bs):bv}add(a,b){return b.length?this==bv?bu.create(a,b):this.addInner(a,b,0):this}addInner(a,b,c){let d,e=0;a.forEach((a,f)=>{let g=f+c,h;if(h=by(b,a,g)){for(d||(d=this.children.slice());e<d.length&&d[e]<f;)e+=3;d[e]==f?d[e+2]=d[e+2].addInner(a,h,g+1):d.splice(e,0,f,f+a.nodeSize,bA(h,a,g+1,bt)),e+=3}});let f=bx(e?bz(b):b,-c);for(let b=0;b<f.length;b++)f[b].type.valid(a,f[b])||f.splice(b--,1);return new bu(f.length?this.local.concat(f).sort(bB):this.local,d||this.children)}remove(a){return 0==a.length||this==bv?this:this.removeInner(a,0)}removeInner(a,b){let c=this.children,d=this.local;for(let d=0;d<c.length;d+=3){let e,f=c[d]+b,g=c[d+1]+b;for(let b=0,c;b<a.length;b++)(c=a[b])&&c.from>f&&c.to<g&&(a[b]=null,(e||(e=[])).push(c));if(!e)continue;c==this.children&&(c=this.children.slice());let h=c[d+2].removeInner(e,f+1);h!=bv?c[d+2]=h:(c.splice(d,3),d-=3)}if(d.length){for(let c=0,e;c<a.length;c++)if(e=a[c])for(let a=0;a<d.length;a++)d[a].eq(e,b)&&(d==this.local&&(d=this.local.slice()),d.splice(a--,1))}return c==this.children&&d==this.local?this:d.length||c.length?new bu(d,c):bv}forChild(a,b){let c,d;if(this==bv)return this;if(b.isLeaf)return bu.empty;for(let b=0;b<this.children.length;b+=3)if(this.children[b]>=a){this.children[b]==a&&(c=this.children[b+2]);break}let e=a+1,f=e+b.content.size;for(let a=0;a<this.local.length;a++){let b=this.local[a];if(b.from<f&&b.to>e&&b.type instanceof bp){let a=Math.max(e,b.from)-e,c=Math.min(f,b.to)-e;a<c&&(d||(d=[])).push(b.copy(a,c))}}if(d){let a=new bu(d.sort(bB),bs);return c?new bw([a,c]):a}return c||bv}eq(a){if(this==a)return!0;if(!(a instanceof bu)||this.local.length!=a.local.length||this.children.length!=a.children.length)return!1;for(let b=0;b<this.local.length;b++)if(!this.local[b].eq(a.local[b]))return!1;for(let b=0;b<this.children.length;b+=3)if(this.children[b]!=a.children[b]||this.children[b+1]!=a.children[b+1]||!this.children[b+2].eq(a.children[b+2]))return!1;return!0}locals(a){return bC(this.localsInner(a))}localsInner(a){if(this==bv)return bs;if(a.inlineContent||!this.local.some(bp.is))return this.local;let b=[];for(let a=0;a<this.local.length;a++)this.local[a].type instanceof bp||b.push(this.local[a]);return b}forEachSet(a){a(this)}}bu.empty=new bu([],[]),bu.removeOverlap=bC;let bv=bu.empty;class bw{constructor(a){this.members=a}map(a,b){let c=this.members.map(c=>c.map(a,b,bt));return bw.from(c)}forChild(a,b){if(b.isLeaf)return bu.empty;let c=[];for(let d=0;d<this.members.length;d++){let e=this.members[d].forChild(a,b);e!=bv&&(e instanceof bw?c=c.concat(e.members):c.push(e))}return bw.from(c)}eq(a){if(!(a instanceof bw)||a.members.length!=this.members.length)return!1;for(let b=0;b<this.members.length;b++)if(!this.members[b].eq(a.members[b]))return!1;return!0}locals(a){let b,c=!0;for(let d=0;d<this.members.length;d++){let e=this.members[d].localsInner(a);if(e.length)if(b){c&&(b=b.slice(),c=!1);for(let a=0;a<e.length;a++)b.push(e[a])}else b=e}return b?bC(c?b:b.sort(bB)):bs}static from(a){switch(a.length){case 0:return bv;case 1:return a[0];default:return new bw(a.every(a=>a instanceof bu)?a:a.reduce((a,b)=>a.concat(b instanceof bu?b:b.members),[]))}}forEachSet(a){for(let b=0;b<this.members.length;b++)this.members[b].forEachSet(a)}}function bx(a,b){if(!b||!a.length)return a;let c=[];for(let d=0;d<a.length;d++){let e=a[d];c.push(new br(e.from+b,e.to+b,e.type))}return c}function by(a,b,c){if(b.isLeaf)return null;let d=c+b.nodeSize,e=null;for(let b=0,f;b<a.length;b++)(f=a[b])&&f.from>c&&f.to<d&&((e||(e=[])).push(f),a[b]=null);return e}function bz(a){let b=[];for(let c=0;c<a.length;c++)null!=a[c]&&b.push(a[c]);return b}function bA(a,b,c,d){let e=[],f=!1;b.forEach((b,g)=>{let h=by(a,b,g+c);if(h){f=!0;let a=bA(h,b,c+g+1,d);a!=bv&&e.push(g,g+b.nodeSize,a)}});let g=bx(f?bz(a):a,-c).sort(bB);for(let a=0;a<g.length;a++)g[a].type.valid(b,g[a])||(d.onRemove&&d.onRemove(g[a].spec),g.splice(a--,1));return g.length||e.length?new bu(g,e):bv}function bB(a,b){return a.from-b.from||a.to-b.to}function bC(a){let b=a;for(let c=0;c<b.length-1;c++){let d=b[c];if(d.from!=d.to)for(let e=c+1;e<b.length;e++){let f=b[e];if(f.from==d.from){f.to!=d.to&&(b==a&&(b=a.slice()),b[e]=f.copy(f.from,d.to),bD(b,e+1,f.copy(d.to,f.to)));continue}f.from<d.to&&(b==a&&(b=a.slice()),b[c]=d.copy(d.from,f.from),bD(b,e,d.copy(f.from,d.to)));break}}return b}function bD(a,b,c){for(;b<a.length&&bB(c,a[b])>0;)b++;a.splice(b,0,c)}function bE(a){let b=[];return a.someProp("decorations",c=>{let d=c(a.state);d&&d!=bv&&b.push(d)}),a.cursorWrapper&&b.push(bu.create(a.state.doc,[a.cursorWrapper.deco])),bw.from(b)}let bF={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},bG=y&&z<=11;class bH{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(a){this.anchorNode=a.anchorNode,this.anchorOffset=a.anchorOffset,this.focusNode=a.focusNode,this.focusOffset=a.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(a){return a.anchorNode==this.anchorNode&&a.anchorOffset==this.anchorOffset&&a.focusNode==this.focusNode&&a.focusOffset==this.focusOffset}}class bI{constructor(a,b){this.view=a,this.handleDOMChange=b,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new bH,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(b=>{for(let a=0;a<b.length;a++)this.queue.push(b[a]);y&&z<=11&&b.some(a=>"childList"==a.type&&a.removedNodes.length||"characterData"==a.type&&a.oldValue.length>a.target.nodeValue.length)?this.flushSoon():E&&a.composing&&b.some(a=>"childList"==a.type&&"TR"==a.target.nodeName)?(a.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),bG&&(this.onCharData=a=>{this.queue.push({target:a.target,type:"characterData",oldValue:a.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,bF)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let a=this.observer.takeRecords();if(a.length){for(let b=0;b<a.length;b++)this.queue.push(a[b]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(aE(this.view)){if(this.suppressingSelectionUpdates)return aw(this.view);if(y&&z<=11&&!this.view.state.selection.empty){let a=this.view.domSelectionRange();if(a.focusNode&&l(a.focusNode,a.focusOffset,a.anchorNode,a.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(a){if(!a.focusNode)return!0;let b=new Set,c;for(let c=a.focusNode;c;c=h(c))b.add(c);for(let d=a.anchorNode;d;d=h(d))if(b.has(d)){c=d;break}let d=c&&this.view.docView.nearestDesc(c);if(d&&d.ignoreMutation({type:"selection",target:3==c.nodeType?c.parentNode:c}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let a of this.observer.takeRecords())this.queue.push(a);return this.queue}flush(){var a;let{view:b}=this;if(!b.docView||this.flushingSoon>-1)return;let c=this.pendingRecords();c.length&&(this.queue=[]);let e=b.domSelectionRange(),f=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(e)&&aE(b)&&!this.ignoreSelectionChange(e),g=-1,h=-1,i=!1,j=[];if(b.editable)for(let a=0;a<c.length;a++){let b=this.registerMutation(c[a],j);b&&(g=g<0?b.from:Math.min(b.from,g),h=h<0?b.to:Math.max(b.to,h),b.typeOver&&(i=!0))}if(j.some(a=>"BR"==a.nodeName)&&(8==b.input.lastKeyCode||46==b.input.lastKeyCode)){for(let a of j)if("BR"==a.nodeName&&a.parentNode){let b=a.nextSibling;b&&1==b.nodeType&&"false"==b.contentEditable&&a.parentNode.removeChild(a)}}else if(A&&j.length){let a=j.filter(a=>"BR"==a.nodeName);if(2==a.length){let[b,c]=a;b.parentNode&&b.parentNode.parentNode==c.parentNode?c.remove():b.remove()}else{let{focusNode:c}=this.currentSelection;for(let d of a){let a=d.parentNode;a&&"LI"==a.nodeName&&(!c||function(a,b){for(let c=b.parentNode;c&&c!=a.dom;c=c.parentNode){let b=a.docView.nearestDesc(c,!0);if(b&&b.node.isBlock)return c}return null}(b,c)!=a)&&d.remove()}}}let k=null;g<0&&f&&b.input.lastFocus>Date.now()-200&&Math.max(b.input.lastTouch,b.input.lastClick.time)<Date.now()-300&&q(e)&&(k=au(b))&&k.eq(d.LN.near(b.state.doc.resolve(0),1))?(b.input.lastFocus=0,aw(b),this.currentSelection.set(e),b.scrollToSelection()):(g>-1||f)&&(g>-1&&(b.docView.markDirty(g,h),a=b,!bJ.has(a)&&(bJ.set(a,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(a.dom).whiteSpace))&&(a.requiresGeckoHackNode=A,bK||(console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),bK=!0))),b.input.badSafariComposition&&(b.input.badSafariComposition=!1,function(a,b){var c;let{focusNode:d,focusOffset:e}=a.domSelectionRange();for(let f of b)if((null==(c=f.parentNode)?void 0:c.nodeName)=="TR"){let b=f.nextSibling;for(;b&&"TD"!=b.nodeName&&"TH"!=b.nodeName;)b=b.nextSibling;if(b){let c=b;for(;;){let a=c.firstChild;if(!a||1!=a.nodeType||"false"==a.contentEditable||/^(BR|IMG)$/.test(a.nodeName))break;c=a}c.insertBefore(f,c.firstChild),d==f&&a.domSelection().collapse(f,e)}else f.parentNode.removeChild(f)}}(b,j)),this.handleDOMChange(g,h,i,j),b.docView&&b.docView.dirty?b.updateState(b.state):this.currentSelection.eq(e)||aw(b),this.currentSelection.set(e))}registerMutation(a,b){if(b.indexOf(a.target)>-1)return null;let c=this.view.docView.nearestDesc(a.target);if("attributes"==a.type&&(c==this.view.docView||"contenteditable"==a.attributeName||"style"==a.attributeName&&!a.oldValue&&!a.target.getAttribute("style"))||!c||c.ignoreMutation(a))return null;if("childList"==a.type){for(let c=0;c<a.addedNodes.length;c++){let d=a.addedNodes[c];b.push(d),3==d.nodeType&&(this.lastChangedTextNode=d)}if(c.contentDOM&&c.contentDOM!=c.dom&&!c.contentDOM.contains(a.target))return{from:c.posBefore,to:c.posAfter};let d=a.previousSibling,e=a.nextSibling;if(y&&z<=11&&a.addedNodes.length)for(let b=0;b<a.addedNodes.length;b++){let{previousSibling:c,nextSibling:f}=a.addedNodes[b];(!c||0>Array.prototype.indexOf.call(a.addedNodes,c))&&(d=c),(!f||0>Array.prototype.indexOf.call(a.addedNodes,f))&&(e=f)}let f=d&&d.parentNode==a.target?g(d)+1:0,h=c.localPosFromDOM(a.target,f,-1),i=e&&e.parentNode==a.target?g(e):a.target.childNodes.length;return{from:h,to:c.localPosFromDOM(a.target,i,1)}}return"attributes"==a.type?{from:c.posAtStart-c.border,to:c.posAtEnd+c.border}:(this.lastChangedTextNode=a.target,{from:c.posAtStart,to:c.posAtEnd,typeOver:a.target.nodeValue==a.oldValue})}}let bJ=new WeakMap,bK=!1;function bL(a,b){let c=b.startContainer,d=b.startOffset,e=b.endContainer,f=b.endOffset,g=a.domAtPos(a.state.selection.anchor);return l(g.node,g.offset,e,f)&&([c,d,e,f]=[e,f,c,d]),{anchorNode:c,anchorOffset:d,focusNode:e,focusOffset:f}}function bM(a){let b=a.pmViewDesc;if(b)return b.parseRule();if("BR"==a.nodeName&&a.parentNode){if(E&&/^(ul|ol)$/i.test(a.parentNode.nodeName)){let a=document.createElement("div");return a.appendChild(document.createElement("li")),{skip:a}}else if(a.parentNode.lastChild==a||E&&/^(tr|table)$/i.test(a.parentNode.nodeName))return{ignore:!0}}else if("IMG"==a.nodeName&&a.getAttribute("mark-placeholder"))return{ignore:!0};return null}let bN=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function bO(a,b,c){return Math.max(c.anchor,c.head)>b.content.size?null:aD(a,b.resolve(c.anchor),b.resolve(c.head))}function bP(a,b,c){let d=a.depth,e=b?a.end():a.pos;for(;d>0&&(b||a.indexAfter(d)==a.node(d).childCount);)d--,e++,b=!1;if(c){let b=a.node(d).maybeChild(a.indexAfter(d));for(;b&&!b.isLeaf;)b=b.firstChild,e++}return e}function bQ(a){if(2!=a.length)return!1;let b=a.charCodeAt(0),c=a.charCodeAt(1);return b>=56320&&b<=57343&&c>=55296&&c<=56319}class bR{constructor(a,b){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new a3,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=b,this.state=b.state,this.directPlugins=b.plugins||[],this.directPlugins.forEach(bW),this.dispatch=this.dispatch.bind(this),this.dom=a&&a.mount||document.createElement("div"),a&&(a.appendChild?a.appendChild(this.dom):"function"==typeof a?a(this.dom):a.mount&&(this.mounted=!0)),this.editable=bU(this),bT(this),this.nodeViews=bV(this),this.docView=ag(this.state.doc,bS(this),bE(this),this.dom,this),this.domObserver=new bI(this,(a,b,c,f)=>(function(a,b,c,f,g){let h,i,j,k=a.input.compositionPendingChanges||(a.composing?a.input.compositionID:0);if(a.input.compositionPendingChanges=0,b<0){let b=a.input.lastSelectionTime>Date.now()-50?a.input.lastSelectionOrigin:null,c=au(a,b);if(c&&!a.state.selection.eq(c)){if(C&&I&&13===a.input.lastKeyCode&&Date.now()-100<a.input.lastKeyCodeTime&&a.someProp("handleKeyDown",b=>b(a,r(13,"Enter"))))return;let d=a.state.tr.setSelection(c);"pointer"==b?d.setMeta("pointer",!0):"key"==b&&d.scrollIntoView(),k&&d.setMeta("composition",k),a.dispatch(d)}return}let l=a.state.doc.resolve(b),m=l.sharedDepth(c);b=l.before(m+1),c=a.state.doc.resolve(c).after(m+1);let n=a.state.selection,o=function(a,b,c){let d,{node:f,fromOffset:g,toOffset:h,from:i,to:j}=a.docView.parseRange(b,c),k=a.domSelectionRange(),l=k.anchorNode;if(l&&a.dom.contains(1==l.nodeType?l:l.parentNode)&&(d=[{node:l,offset:k.anchorOffset}],q(k)||d.push({node:k.focusNode,offset:k.focusOffset})),C&&8===a.input.lastKeyCode)for(let a=h;a>g;a--){let b=f.childNodes[a-1],c=b.pmViewDesc;if("BR"==b.nodeName&&!c){h=a;break}if(!c||c.size)break}let m=a.state.doc,n=a.someProp("domParser")||e.S4.fromSchema(a.state.schema),o=m.resolve(i),p=null,r=n.parse(f,{topNode:o.parent,topMatch:o.parent.contentMatchAt(o.index()),topOpen:!0,from:g,to:h,preserveWhitespace:"pre"!=o.parent.type.whitespace||"full",findPositions:d,ruleFromNode:bM,context:o});if(d&&null!=d[0].pos){let a=d[0].pos,b=d[1]&&d[1].pos;null==b&&(b=a),p={anchor:a+i,head:b+i}}return{doc:r,sel:p,from:i,to:j}}(a,b,c),p=a.state.doc,s=p.slice(o.from,o.to);8===a.input.lastKeyCode&&Date.now()-100<a.input.lastKeyCodeTime?(h=a.state.selection.to,i="end"):(h=a.state.selection.from,i="start"),a.input.lastKeyCode=null;let t=function(a,b,c,d,e){let f=a.findDiffStart(b,c);if(null==f)return null;let{a:g,b:h}=a.findDiffEnd(b,c+a.size,c+b.size);if("end"==e){let a=Math.max(0,f-Math.min(g,h));d-=g+a-f}if(g<f&&a.size<b.size){let a=d<=f&&d>=g?f-d:0;(f-=a)&&f<b.size&&bQ(b.textBetween(f-1,f+1))&&(f+=a?1:-1),h=f+(h-g),g=f}else if(h<f){let b=d<=f&&d>=h?f-d:0;(f-=b)&&f<a.size&&bQ(a.textBetween(f-1,f+1))&&(f+=b?1:-1),g=f+(g-h),h=f}return{start:f,endA:g,endB:h}}(s.content,o.doc.content,o.from,h,i);if(t&&a.input.domChangeCount++,(F&&a.input.lastIOSEnter>Date.now()-225||I)&&g.some(a=>1==a.nodeType&&!bN.test(a.nodeName))&&(!t||t.endA>=t.endB)&&a.someProp("handleKeyDown",b=>b(a,r(13,"Enter")))){a.input.lastIOSEnter=0;return}if(!t)if(f&&n instanceof d.U3&&!n.empty&&n.$head.sameParent(n.$anchor)&&!a.composing&&!(o.sel&&o.sel.anchor!=o.sel.head))t={start:n.from,endA:n.to,endB:n.to};else{if(o.sel){let b=bO(a,a.state.doc,o.sel);if(b&&!b.eq(a.state.selection)){let c=a.state.tr.setSelection(b);k&&c.setMeta("composition",k),a.dispatch(c)}}return}a.state.selection.from<a.state.selection.to&&t.start==t.endB&&a.state.selection instanceof d.U3&&(t.start>a.state.selection.from&&t.start<=a.state.selection.from+2&&a.state.selection.from>=o.from?t.start=a.state.selection.from:t.endA<a.state.selection.to&&t.endA>=a.state.selection.to-2&&a.state.selection.to<=o.to&&(t.endB+=a.state.selection.to-t.endA,t.endA=a.state.selection.to)),y&&z<=11&&t.endB==t.start+1&&t.endA==t.start&&t.start>o.from&&" \xa0"==o.doc.textBetween(t.start-o.from-1,t.start-o.from+1)&&(t.start--,t.endA--,t.endB--);let u=o.doc.resolveNoCache(t.start-o.from),v=o.doc.resolveNoCache(t.endB-o.from),w=p.resolve(t.start),x=u.sameParent(v)&&u.parent.inlineContent&&w.end()>=t.endA;if((F&&a.input.lastIOSEnter>Date.now()-225&&(!x||g.some(a=>"DIV"==a.nodeName||"P"==a.nodeName))||!x&&u.pos<o.doc.content.size&&(!u.sameParent(v)||!u.parent.inlineContent)&&u.pos<v.pos&&!/\S/.test(o.doc.textBetween(u.pos,v.pos,"","")))&&a.someProp("handleKeyDown",b=>b(a,r(13,"Enter")))){a.input.lastIOSEnter=0;return}if(a.state.selection.anchor>t.start&&function(a,b,c,d,e){if(c-b<=e.pos-d.pos||bP(d,!0,!1)<e.pos)return!1;let f=a.resolve(b);if(!d.parent.isTextblock){let a=f.nodeAfter;return null!=a&&c==b+a.nodeSize}if(f.parentOffset<f.parent.content.size||!f.parent.isTextblock)return!1;let g=a.resolve(bP(f,!0,!0));return!(!g.parent.isTextblock||g.pos>c||bP(g,!0,!1)<c)&&d.parent.content.cut(d.parentOffset).eq(g.parent.content)}(p,t.start,t.endA,u,v)&&a.someProp("handleKeyDown",b=>b(a,r(8,"Backspace")))){I&&C&&a.domObserver.suppressSelectionUpdates();return}C&&t.endB==t.start&&(a.input.lastChromeDelete=Date.now()),I&&!x&&u.start()!=v.start()&&0==v.parentOffset&&u.depth==v.depth&&o.sel&&o.sel.anchor==o.sel.head&&o.sel.head==t.endA&&(t.endB-=2,v=o.doc.resolveNoCache(t.endB-o.from),setTimeout(()=>{a.someProp("handleKeyDown",function(b){return b(a,r(13,"Enter"))})},20));let A=t.start,B=t.endA,D=b=>{let c=b||a.state.tr.replace(A,B,o.doc.slice(t.start-o.from,t.endB-o.from));if(o.sel){let b=bO(a,c.doc,o.sel);b&&!(C&&a.composing&&b.empty&&(t.start!=t.endB||a.input.lastChromeDelete<Date.now()-100)&&(b.head==A||b.head==c.mapping.map(B)-1)||y&&b.empty&&b.head==A)&&c.setSelection(b)}return k&&c.setMeta("composition",k),c.scrollIntoView()};if(x)if(u.pos==v.pos){y&&z<=11&&0==u.parentOffset&&(a.domObserver.suppressSelectionUpdates(),setTimeout(()=>aw(a),20));let b=D(a.state.tr.delete(A,B)),c=p.resolve(t.start).marksAcross(p.resolve(t.endA));c&&b.ensureMarks(c),a.dispatch(b)}else if(t.endA==t.endB&&(j=function(a,b){let c=a.firstChild.marks,d=b.firstChild.marks,f=c,g=d,h,i,j;for(let a=0;a<d.length;a++)f=d[a].removeFromSet(f);for(let a=0;a<c.length;a++)g=c[a].removeFromSet(g);if(1==f.length&&0==g.length)i=f[0],h="add",j=a=>a.mark(i.addToSet(a.marks));else{if(0!=f.length||1!=g.length)return null;i=g[0],h="remove",j=a=>a.mark(i.removeFromSet(a.marks))}let k=[];for(let a=0;a<b.childCount;a++)k.push(j(b.child(a)));if(e.FK.from(k).eq(a))return{mark:i,type:h}}(u.parent.content.cut(u.parentOffset,v.parentOffset),w.parent.content.cut(w.parentOffset,t.endA-w.start())))){let b=D(a.state.tr);"add"==j.type?b.addMark(A,B,j.mark):b.removeMark(A,B,j.mark),a.dispatch(b)}else if(u.parent.child(u.index()).isText&&u.index()==v.index()-!v.textOffset){let b=u.parent.textBetween(u.parentOffset,v.parentOffset),c=()=>D(a.state.tr.insertText(b,A,B));a.someProp("handleTextInput",d=>d(a,A,B,b,c))||a.dispatch(c())}else a.dispatch(D());else a.dispatch(D())})(this,a,b,c,f)),this.domObserver.start(),function(a){for(let b in a0){let c=a0[b];a.dom.addEventListener(b,a.input.eventHandlers[b]=b=>{!function(a,b){if(!b.bubbles)return!0;if(b.defaultPrevented)return!1;for(let c=b.target;c!=a.dom;c=c.parentNode)if(!c||11==c.nodeType||c.pmViewDesc&&c.pmViewDesc.stopEvent(b))return!1;return!0}(a,b)||a6(a,b)||!a.editable&&b.type in a1||c(a,b)},a2[b]?{passive:!0}:void 0)}E&&a.dom.addEventListener("input",()=>null),a5(a)}(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let a=this._props;for(let b in this._props={},a)this._props[b]=a[b];this._props.state=this.state}return this._props}update(a){a.handleDOMEvents!=this._props.handleDOMEvents&&a5(this);let b=this._props;this._props=a,a.plugins&&(a.plugins.forEach(bW),this.directPlugins=a.plugins),this.updateStateInner(a.state,b)}setProps(a){let b={};for(let a in this._props)b[a]=this._props[a];for(let c in b.state=this.state,a)b[c]=a[c];this.update(b)}updateState(a){this.updateStateInner(a,this._props)}updateStateInner(a,b){var c,d,e;let f=this.state,h=!1,i=!1;a.storedMarks&&this.composing&&(bf(this),i=!0),this.state=a;let j=f.plugins!=a.plugins||this._props.plugins!=b.plugins;if(j||this._props.plugins!=b.plugins||this._props.nodeViews!=b.nodeViews){let a=bV(this);(function(a,b){let c=0,d=0;for(let d in a){if(a[d]!=b[d])return!0;c++}for(let a in b)d++;return c!=d})(a,this.nodeViews)&&(this.nodeViews=a,h=!0)}(j||b.handleDOMEvents!=this._props.handleDOMEvents)&&a5(this),this.editable=bU(this),bT(this);let k=bE(this),m=bS(this),n=f.plugins==a.plugins||f.doc.eq(a.doc)?a.scrollToSelection>f.scrollToSelection?"to selection":"preserve":"reset",q=h||!this.docView.matchesNode(a.doc,m,k);(q||!a.selection.eq(f.selection))&&(i=!0);let r="preserve"==n&&i&&null==this.dom.style.overflowAnchor&&function(a){let b,c,d=a.dom.getBoundingClientRect(),e=Math.max(0,d.top);for(let f=(d.left+d.right)/2,g=e+1;g<Math.min(innerHeight,d.bottom);g+=5){let d=a.root.elementFromPoint(f,g);if(!d||d==a.dom||!a.dom.contains(d))continue;let h=d.getBoundingClientRect();if(h.top>=e-20){b=d,c=h.top;break}}return{refDOM:b,refTop:c,stack:N(a.dom)}}(this);if(i){let b,c,i;this.domObserver.stop();let j=q&&(y||C)&&!this.composing&&!f.selection.empty&&!a.selection.empty&&(d=f.selection,e=a.selection,i=Math.min(d.$anchor.sharedDepth(d.head),e.$anchor.sharedDepth(e.head)),d.$anchor.start(i)!=e.$anchor.start(i));if(q){let b=C?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=function(a){let b=a.domSelectionRange();if(!b.focusNode)return null;let c=function(a,b){for(;;){if(3==a.nodeType&&b)return a;if(1==a.nodeType&&b>0){if("false"==a.contentEditable)return null;b=o(a=a.childNodes[b-1])}else{if(!a.parentNode||p(a))return null;b=g(a),a=a.parentNode}}}(b.focusNode,b.focusOffset),d=function(a,b){for(;;){if(3==a.nodeType&&b<a.nodeValue.length)return a;if(1==a.nodeType&&b<a.childNodes.length){if("false"==a.contentEditable)return null;a=a.childNodes[b],b=0}else{if(!a.parentNode||p(a))return null;b=g(a)+1,a=a.parentNode}}}(b.focusNode,b.focusOffset);if(c&&d&&c!=d){let b=d.pmViewDesc,e=a.domObserver.lastChangedTextNode;if(c==e||d==e)return e;if(!b||!b.isText(d.nodeValue))return d;if(a.input.compositionNode==d){let a=c.pmViewDesc;if(!(!a||!a.isText(c.nodeValue)))return d}}return c||d}(this)),(h||!this.docView.update(a.doc,m,k,this))&&(this.docView.updateOuterDeco(m),this.docView.destroy(),this.docView=ag(a.doc,m,k,this.dom,this)),!b||this.trackWrites&&this.dom.contains(this.trackWrites)||(j=!0)}j||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&(b=this.docView.domFromPos(this.state.selection.anchor,0),c=this.domSelectionRange(),l(b.node,b.offset,c.anchorNode,c.anchorOffset)))?aw(this,j):(aB(this,a.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(f),(null==(c=this.dragging)?void 0:c.node)&&!f.doc.eq(a.doc)&&this.updateDraggedNode(this.dragging,f),"reset"==n?this.dom.scrollTop=0:"to selection"==n?this.scrollToSelection():r&&function({refDOM:a,refTop:b,stack:c}){let d=a?a.getBoundingClientRect().top:0;O(c,0==d?0:d-b)}(r)}scrollToSelection(){let a=this.domSelectionRange().focusNode;if(a&&this.dom.contains(1==a.nodeType?a:a.parentNode))if(this.someProp("handleScrollToSelection",a=>a(this)));else if(this.state.selection instanceof d.nh){let b=this.docView.domAfterPos(this.state.selection.from);1==b.nodeType&&M(this,b.getBoundingClientRect(),a)}else M(this,this.coordsAtPos(this.state.selection.head,1),a)}destroyPluginViews(){let a;for(;a=this.pluginViews.pop();)a.destroy&&a.destroy()}updatePluginViews(a){if(a&&a.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(let b=0;b<this.pluginViews.length;b++){let c=this.pluginViews[b];c.update&&c.update(this,a)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let a=0;a<this.directPlugins.length;a++){let b=this.directPlugins[a];b.spec.view&&this.pluginViews.push(b.spec.view(this))}for(let a=0;a<this.state.plugins.length;a++){let b=this.state.plugins[a];b.spec.view&&this.pluginViews.push(b.spec.view(this))}}}updateDraggedNode(a,b){let c=a.node,e=-1;if(this.state.doc.nodeAt(c.from)==c.node)e=c.from;else{let a=c.from+(this.state.doc.content.size-b.doc.content.size);(a>0&&this.state.doc.nodeAt(a))==c.node&&(e=a)}this.dragging=new bk(a.slice,a.move,e<0?void 0:d.nh.create(this.state.doc,e))}someProp(a,b){let c=this._props&&this._props[a],d;if(null!=c&&(d=b?b(c):c))return d;for(let c=0;c<this.directPlugins.length;c++){let e=this.directPlugins[c].props[a];if(null!=e&&(d=b?b(e):e))return d}let e=this.state.plugins;if(e)for(let c=0;c<e.length;c++){let f=e[c].props[a];if(null!=f&&(d=b?b(f):f))return d}}hasFocus(){if(y){let a=this.root.activeElement;if(a==this.dom)return!0;if(!a||!this.dom.contains(a))return!1;for(;a&&this.dom!=a&&this.dom.contains(a);){if("false"==a.contentEditable)return!1;a=a.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&function(a){if(a.setActive)return a.setActive();if(P)return a.focus(P);let b=N(a);a.focus(null==P?{get preventScroll(){return P={preventScroll:!0},!0}}:void 0),P||(P=!1,O(b,0))}(this.dom),aw(this),this.domObserver.start()}get root(){let a=this._root;if(null==a){for(let a=this.dom.parentNode;a;a=a.parentNode)if(9==a.nodeType||11==a.nodeType&&a.host)return a.getSelection||(Object.getPrototypeOf(a).getSelection=()=>a.ownerDocument.getSelection()),this._root=a}return a||document}updateRoot(){this._root=null}posAtCoords(a){return function(a,b){var c;let d,e,f=a.dom.ownerDocument,g,i=0,k=function(a,b,c){if(a.caretPositionFromPoint)try{let d=a.caretPositionFromPoint(b,c);if(d)return{node:d.offsetNode,offset:Math.min(o(d.offsetNode),d.offset)}}catch(a){}if(a.caretRangeFromPoint){let d=a.caretRangeFromPoint(b,c);if(d)return{node:d.startContainer,offset:Math.min(o(d.startContainer),d.startOffset)}}}(f,b.left,b.top);k&&({node:g,offset:i}=k);let l=(a.root.elementFromPoint?a.root:f).elementFromPoint(b.left,b.top);if(!l||!a.dom.contains(1!=l.nodeType?l.parentNode:l)){let c=a.dom.getBoundingClientRect();if(!Q(b,c)||!(l=function a(b,c,d){let e=b.childNodes.length;if(e&&d.top<d.bottom)for(let f=Math.max(0,Math.min(e-1,Math.floor(e*(c.top-d.top)/(d.bottom-d.top))-2)),g=f;;){let d=b.childNodes[g];if(1==d.nodeType){let b=d.getClientRects();for(let e=0;e<b.length;e++){let f=b[e];if(Q(c,f))return a(d,c,f)}}if((g=(g+1)%e)==f)break}return b}(a.dom,b,c)))return null}if(E)for(let a=l;g&&a;a=h(a))a.draggable&&(g=void 0);if(l=(d=(c=l).parentNode)&&/^li$/i.test(d.nodeName)&&b.left<c.getBoundingClientRect().left?d:c,g){let c;if(A&&1==g.nodeType&&(i=Math.min(i,g.childNodes.length))<g.childNodes.length){let a=g.childNodes[i],c;"IMG"==a.nodeName&&(c=a.getBoundingClientRect()).right<=b.left&&c.bottom>b.top&&i++}J&&i&&1==g.nodeType&&1==(c=g.childNodes[i-1]).nodeType&&"false"==c.contentEditable&&c.getBoundingClientRect().top>=b.top&&i--,g==a.dom&&i==g.childNodes.length-1&&1==g.lastChild.nodeType&&b.top>g.lastChild.getBoundingClientRect().bottom?e=a.state.doc.content.size:(0==i||1!=g.nodeType||"BR"!=g.childNodes[i-1].nodeName)&&(e=function(a,b,c,d){let e=-1;for(let c=b,f=!1;c!=a.dom;){let b=a.docView.nearestDesc(c,!0),g;if(!b)return null;if(1==b.dom.nodeType&&(b.node.isBlock&&b.parent||!b.contentDOM)&&((g=b.dom.getBoundingClientRect()).width||g.height)&&(b.node.isBlock&&b.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(b.dom.nodeName)&&(!f&&g.left>d.left||g.top>d.top?e=b.posBefore:(!f&&g.right<d.left||g.bottom<d.top)&&(e=b.posAfter),f=!0),!b.contentDOM&&e<0&&!b.node.isText))return(b.node.isBlock?d.top<(g.top+g.bottom)/2:d.left<(g.left+g.right)/2)?b.posBefore:b.posAfter;c=b.dom.parentNode}return e>-1?e:a.docView.posFromDOM(b,c,-1)}(a,g,i,b))}null==e&&(e=function(a,b,c){let{node:d,offset:e}=function a(b,c){let d,e,f,g=2e8,h,i=0,k=c.top,l=c.top;for(let a=b.firstChild,m=0;a;a=a.nextSibling,m++){let b;if(1==a.nodeType)b=a.getClientRects();else{if(3!=a.nodeType)continue;b=j(a).getClientRects()}for(let j=0;j<b.length;j++){let n=b[j];if(n.top<=k&&n.bottom>=l){k=Math.max(n.bottom,k),l=Math.min(n.top,l);let b=n.left>c.left?n.left-c.left:n.right<c.left?c.left-n.right:0;if(b<g){f=a,g=b,h=b&&3==f.nodeType?{left:n.right<c.left?n.right:n.left,top:c.top}:c,1==a.nodeType&&b&&(i=m+ +(c.left>=(n.left+n.right)/2));continue}}else n.top>c.top&&!d&&n.left<=c.left&&n.right>=c.left&&(d=a,e={left:Math.max(n.left,Math.min(n.right,c.left)),top:n.top});!f&&(c.left>=n.right&&c.top>=n.top||c.left>=n.left&&c.top>=n.bottom)&&(i=m+1)}}return(!f&&d&&(f=d,h=e,g=0),f&&3==f.nodeType)?function(a,b){let c=a.nodeValue.length,d=document.createRange(),e;for(let f=0;f<c;f++){d.setEnd(a,f+1),d.setStart(a,f);let c=S(d,1);if(c.top!=c.bottom&&Q(b,c)){e={node:a,offset:f+ +(b.left>=(c.left+c.right)/2)};break}}return d.detach(),e||{node:a,offset:0}}(f,h):!f||g&&1==f.nodeType?{node:b,offset:i}:a(f,h)}(b,c),f=-1;if(1==d.nodeType&&!d.firstChild){let a=d.getBoundingClientRect();f=a.left!=a.right&&c.left>(a.left+a.right)/2?1:-1}return a.docView.posFromDOM(d,e,f)}(a,l,b));let m=a.docView.nearestDesc(l,!0);return{pos:e,inside:m?m.posAtStart-m.border:-1}}(this,a)}coordsAtPos(a,b=1){return U(this,a,b)}domAtPos(a,b=0){return this.docView.domFromPos(a,b)}nodeDOM(a){let b=this.docView.descAt(a);return b?b.nodeDOM:null}posAtDOM(a,b,c=-1){let d=this.docView.posFromDOM(a,b,c);if(null==d)throw RangeError("DOM position not inside the editor");return d}endOfTextblock(a,b){return function(a,b,c){let d,e;return Z==b&&_==c?aa:(Z=b,_=c,aa="up"==c||"down"==c?(d=b.selection,e="up"==c?d.$from:d.$to,X(a,b,()=>{let{node:b}=a.docView.domFromPos(e.pos,"up"==c?-1:1);for(;;){let c=a.docView.nearestDesc(b,!0);if(!c)break;if(c.node.isBlock){b=c.contentDOM||c.dom;break}b=c.dom.parentNode}let d=U(a,e.pos,1);for(let a=b.firstChild;a;a=a.nextSibling){let b;if(1==a.nodeType)b=a.getClientRects();else{if(3!=a.nodeType)continue;b=j(a,0,a.nodeValue.length).getClientRects()}for(let a=0;a<b.length;a++){let e=b[a];if(e.bottom>e.top+1&&("up"==c?d.top-e.top>(e.bottom-d.top)*2:e.bottom-d.bottom>(d.bottom-e.top)*2))return!1}}return!0})):function(a,b,c){let{$head:d}=b.selection;if(!d.parent.isTextblock)return!1;let e=d.parentOffset,f=e==d.parent.content.size,g=a.domSelection();return g?Y.test(d.parent.textContent)&&g.modify?X(a,b,()=>{let{focusNode:b,focusOffset:e,anchorNode:f,anchorOffset:h}=a.domSelectionRange(),i=g.caretBidiLevel;g.modify("move",c,"character");let j=d.depth?a.docView.domAfterPos(d.before()):a.dom,{focusNode:k,focusOffset:l}=a.domSelectionRange(),m=k&&!j.contains(1==k.nodeType?k:k.parentNode)||b==k&&e==l;try{g.collapse(f,h),b&&(b!=f||e!=h)&&g.extend&&g.extend(b,e)}catch(a){}return null!=i&&(g.caretBidiLevel=i),m}):"left"==c||"backward"==c?!e:f:d.pos==d.start()||d.pos==d.end()}(a,b,c))}(this,b||this.state,a)}pasteHTML(a,b){return bi(this,"",a,!1,b||new ClipboardEvent("paste"))}pasteText(a,b){return bi(this,a,null,!0,b||new ClipboardEvent("paste"))}serializeForClipboard(a){return aS(this,a)}destroy(){if(this.docView){for(let a in this.domObserver.stop(),this.input.eventHandlers)this.dom.removeEventListener(a,this.input.eventHandlers[a]);clearTimeout(this.input.composingTimeout),clearTimeout(this.input.lastIOSEnterFallbackTimeout),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],bE(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,k()}}get isDestroyed(){return null==this.docView}dispatchEvent(a){!a6(this,a)&&a0[a.type]&&(this.editable||!(a.type in a1))&&a0[a.type](this,a)}domSelectionRange(){let a=this.domSelection();return a?E&&11===this.root.nodeType&&function(a){let b=a.activeElement;for(;b&&b.shadowRoot;)b=b.shadowRoot.activeElement;return b}(this.dom.ownerDocument)==this.dom&&function(a,b){let c;if(b.getComposedRanges){let c=b.getComposedRanges(a.root)[0];if(c)return bL(a,c)}function d(a){a.preventDefault(),a.stopImmediatePropagation(),c=a.getTargetRanges()[0]}return a.dom.addEventListener("beforeinput",d,!0),document.execCommand("indent"),a.dom.removeEventListener("beforeinput",d,!0),c?bL(a,c):null}(this,a)||a:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function bS(a){let b=Object.create(null);return b.class="ProseMirror",b.contenteditable=String(a.editable),a.someProp("attributes",c=>{if("function"==typeof c&&(c=c(a.state)),c)for(let a in c)"class"==a?b.class+=" "+c[a]:"style"==a?b.style=(b.style?b.style+";":"")+c[a]:b[a]||"contenteditable"==a||"nodeName"==a||(b[a]=String(c[a]))}),b.translate||(b.translate="no"),[br.node(0,a.state.doc.content.size,b)]}function bT(a){if(a.markCursor){let b=document.createElement("img");b.className="ProseMirror-separator",b.setAttribute("mark-placeholder","true"),b.setAttribute("alt",""),a.cursorWrapper={dom:b,deco:br.widget(a.state.selection.from,b,{raw:!0,marks:a.markCursor})}}else a.cursorWrapper=null}function bU(a){return!a.someProp("editable",b=>!1===b(a.state))}function bV(a){let b=Object.create(null);function c(a){for(let c in a)Object.prototype.hasOwnProperty.call(b,c)||(b[c]=a[c])}return a.someProp("nodeViews",c),a.someProp("markViews",c),b}function bW(a){if(a.spec.state||a.spec.filterTransaction||a.spec.appendTransaction)throw RangeError("Plugins passed directly to the view must not have a state component")}bR.prototype.dispatch=function(a){let b=this._props.dispatchTransaction;b?b.call(this,a):this.updateState(this.state.apply(a))}},670016:(a,b,c)=>{"use strict";Object.defineProperty(b,Symbol.toStringTag,{value:"Module"});let d=c(789253);b.property=function(a){return function(b){return d.get(b,a)}}},673977:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});var d=c(356103).Or},676029:(a,b,c)=>{"use strict";c.d(b,{q:()=>Y});var d=c(115962);function e(a){return Array.isArray?Array.isArray(a):"[object Array]"===l(a)}let f=1/0;function g(a){return"string"==typeof a}function h(a){return"number"==typeof a}function i(a){return"object"==typeof a}function j(a){return null!=a}function k(a){return!a.trim().length}function l(a){return null==a?void 0===a?"[object Undefined]":"[object Null]":Object.prototype.toString.call(a)}let m=Object.prototype.hasOwnProperty;class n{constructor(a){this._keys=[],this._keyMap={};let b=0;a.forEach(a=>{let c=o(a);this._keys.push(c),this._keyMap[c.id]=c,b+=c.weight}),this._keys.forEach(a=>{a.weight/=b})}get(a){return this._keyMap[a]}keys(){return this._keys}toJSON(){return JSON.stringify(this._keys)}}function o(a){let b=null,c=null,d=null,f=1,h=null;if(g(a)||e(a))d=a,b=p(a),c=q(a);else{if(!m.call(a,"name"))throw Error("Missing name property in key");let e=a.name;if(d=e,m.call(a,"weight")&&(f=a.weight)<=0)throw Error(`Property 'weight' in key '${e}' must be a positive integer`);b=p(e),c=q(e),h=a.getFn}return{path:b,id:c,weight:f,src:d,getFn:h}}function p(a){return e(a)?a:a.split(".")}function q(a){return e(a)?a.join("."):a}var r={isCaseSensitive:!1,ignoreDiacritics:!1,includeScore:!1,keys:[],shouldSort:!0,sortFn:(a,b)=>a.score===b.score?a.idx<b.idx?-1:1:a.score<b.score?-1:1,includeMatches:!1,findAllMatches:!1,minMatchCharLength:1,location:0,threshold:.6,distance:100,useExtendedSearch:!1,getFn:function(a,b){let c=[],d=!1,k=(a,b,m)=>{if(j(a))if(b[m]){var n,o;let p=a[b[m]];if(!j(p))return;if(m===b.length-1&&(g(p)||h(p)||!0===(n=p)||!1===n||i(o=n)&&null!==o&&"[object Boolean]"==l(n)))c.push(null==p?"":function(a){if("string"==typeof a)return a;let b=a+"";return"0"==b&&1/a==-f?"-0":b}(p));else if(e(p)){d=!0;for(let a=0,c=p.length;a<c;a+=1)k(p[a],b,m+1)}else b.length&&k(p,b,m+1)}else c.push(a)};return k(a,g(b)?b.split("."):b,0),d?c:c[0]},ignoreLocation:!1,ignoreFieldNorm:!1,fieldNormWeight:1};let s=/[^ ]+/g;class t{constructor({getFn:a=r.getFn,fieldNormWeight:b=r.fieldNormWeight}={}){this.norm=function(a=1,b=3){let c=new Map,d=Math.pow(10,b);return{get(b){let e=b.match(s).length;if(c.has(e))return c.get(e);let f=parseFloat(Math.round(1/Math.pow(e,.5*a)*d)/d);return c.set(e,f),f},clear(){c.clear()}}}(b,3),this.getFn=a,this.isCreated=!1,this.setIndexRecords()}setSources(a=[]){this.docs=a}setIndexRecords(a=[]){this.records=a}setKeys(a=[]){this.keys=a,this._keysMap={},a.forEach((a,b)=>{this._keysMap[a.id]=b})}create(){!this.isCreated&&this.docs.length&&(this.isCreated=!0,g(this.docs[0])?this.docs.forEach((a,b)=>{this._addString(a,b)}):this.docs.forEach((a,b)=>{this._addObject(a,b)}),this.norm.clear())}add(a){let b=this.size();g(a)?this._addString(a,b):this._addObject(a,b)}removeAt(a){this.records.splice(a,1);for(let b=a,c=this.size();b<c;b+=1)this.records[b].i-=1}getValueForItemAtKeyId(a,b){return a[this._keysMap[b]]}size(){return this.records.length}_addString(a,b){if(!j(a)||k(a))return;let c={v:a,i:b,n:this.norm.get(a)};this.records.push(c)}_addObject(a,b){let c={i:b,$:{}};this.keys.forEach((b,d)=>{let f=b.getFn?b.getFn(a):this.getFn(a,b.path);if(j(f)){if(e(f)){let a=[],b=[{nestedArrIndex:-1,value:f}];for(;b.length;){let{nestedArrIndex:c,value:d}=b.pop();if(j(d))if(g(d)&&!k(d)){let b={v:d,i:c,n:this.norm.get(d)};a.push(b)}else e(d)&&d.forEach((a,c)=>{b.push({nestedArrIndex:c,value:a})})}c.$[d]=a}else if(g(f)&&!k(f)){let a={v:f,n:this.norm.get(f)};c.$[d]=a}}}),this.records.push(c)}toJSON(){return{keys:this.keys,records:this.records}}}function u(a,b,{getFn:c=r.getFn,fieldNormWeight:d=r.fieldNormWeight}={}){let e=new t({getFn:c,fieldNormWeight:d});return e.setKeys(a.map(o)),e.setSources(b),e.create(),e}function v(a,{errors:b=0,currentLocation:c=0,expectedLocation:d=0,distance:e=r.distance,ignoreLocation:f=r.ignoreLocation}={}){let g=b/a.length;if(f)return g;let h=Math.abs(d-c);return e?g+h/e:h?1:g}let w=String.prototype.normalize?a=>a.normalize("NFD").replace(/[\u0300-\u036F\u0483-\u0489\u0591-\u05BD\u05BF\u05C1\u05C2\u05C4\u05C5\u05C7\u0610-\u061A\u064B-\u065F\u0670\u06D6-\u06DC\u06DF-\u06E4\u06E7\u06E8\u06EA-\u06ED\u0711\u0730-\u074A\u07A6-\u07B0\u07EB-\u07F3\u07FD\u0816-\u0819\u081B-\u0823\u0825-\u0827\u0829-\u082D\u0859-\u085B\u08D3-\u08E1\u08E3-\u0903\u093A-\u093C\u093E-\u094F\u0951-\u0957\u0962\u0963\u0981-\u0983\u09BC\u09BE-\u09C4\u09C7\u09C8\u09CB-\u09CD\u09D7\u09E2\u09E3\u09FE\u0A01-\u0A03\u0A3C\u0A3E-\u0A42\u0A47\u0A48\u0A4B-\u0A4D\u0A51\u0A70\u0A71\u0A75\u0A81-\u0A83\u0ABC\u0ABE-\u0AC5\u0AC7-\u0AC9\u0ACB-\u0ACD\u0AE2\u0AE3\u0AFA-\u0AFF\u0B01-\u0B03\u0B3C\u0B3E-\u0B44\u0B47\u0B48\u0B4B-\u0B4D\u0B56\u0B57\u0B62\u0B63\u0B82\u0BBE-\u0BC2\u0BC6-\u0BC8\u0BCA-\u0BCD\u0BD7\u0C00-\u0C04\u0C3E-\u0C44\u0C46-\u0C48\u0C4A-\u0C4D\u0C55\u0C56\u0C62\u0C63\u0C81-\u0C83\u0CBC\u0CBE-\u0CC4\u0CC6-\u0CC8\u0CCA-\u0CCD\u0CD5\u0CD6\u0CE2\u0CE3\u0D00-\u0D03\u0D3B\u0D3C\u0D3E-\u0D44\u0D46-\u0D48\u0D4A-\u0D4D\u0D57\u0D62\u0D63\u0D82\u0D83\u0DCA\u0DCF-\u0DD4\u0DD6\u0DD8-\u0DDF\u0DF2\u0DF3\u0E31\u0E34-\u0E3A\u0E47-\u0E4E\u0EB1\u0EB4-\u0EB9\u0EBB\u0EBC\u0EC8-\u0ECD\u0F18\u0F19\u0F35\u0F37\u0F39\u0F3E\u0F3F\u0F71-\u0F84\u0F86\u0F87\u0F8D-\u0F97\u0F99-\u0FBC\u0FC6\u102B-\u103E\u1056-\u1059\u105E-\u1060\u1062-\u1064\u1067-\u106D\u1071-\u1074\u1082-\u108D\u108F\u109A-\u109D\u135D-\u135F\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17B4-\u17D3\u17DD\u180B-\u180D\u1885\u1886\u18A9\u1920-\u192B\u1930-\u193B\u1A17-\u1A1B\u1A55-\u1A5E\u1A60-\u1A7C\u1A7F\u1AB0-\u1ABE\u1B00-\u1B04\u1B34-\u1B44\u1B6B-\u1B73\u1B80-\u1B82\u1BA1-\u1BAD\u1BE6-\u1BF3\u1C24-\u1C37\u1CD0-\u1CD2\u1CD4-\u1CE8\u1CED\u1CF2-\u1CF4\u1CF7-\u1CF9\u1DC0-\u1DF9\u1DFB-\u1DFF\u20D0-\u20F0\u2CEF-\u2CF1\u2D7F\u2DE0-\u2DFF\u302A-\u302F\u3099\u309A\uA66F-\uA672\uA674-\uA67D\uA69E\uA69F\uA6F0\uA6F1\uA802\uA806\uA80B\uA823-\uA827\uA880\uA881\uA8B4-\uA8C5\uA8E0-\uA8F1\uA8FF\uA926-\uA92D\uA947-\uA953\uA980-\uA983\uA9B3-\uA9C0\uA9E5\uAA29-\uAA36\uAA43\uAA4C\uAA4D\uAA7B-\uAA7D\uAAB0\uAAB2-\uAAB4\uAAB7\uAAB8\uAABE\uAABF\uAAC1\uAAEB-\uAAEF\uAAF5\uAAF6\uABE3-\uABEA\uABEC\uABED\uFB1E\uFE00-\uFE0F\uFE20-\uFE2F]/g,""):a=>a;class x{constructor(a,{location:b=r.location,threshold:c=r.threshold,distance:d=r.distance,includeMatches:e=r.includeMatches,findAllMatches:f=r.findAllMatches,minMatchCharLength:g=r.minMatchCharLength,isCaseSensitive:h=r.isCaseSensitive,ignoreDiacritics:i=r.ignoreDiacritics,ignoreLocation:j=r.ignoreLocation}={}){if(this.options={location:b,threshold:c,distance:d,includeMatches:e,findAllMatches:f,minMatchCharLength:g,isCaseSensitive:h,ignoreDiacritics:i,ignoreLocation:j},a=h?a:a.toLowerCase(),a=i?w(a):a,this.pattern=a,this.chunks=[],!this.pattern.length)return;let k=(a,b)=>{this.chunks.push({pattern:a,alphabet:function(a){let b={};for(let c=0,d=a.length;c<d;c+=1){let e=a.charAt(c);b[e]=(b[e]||0)|1<<d-c-1}return b}(a),startIndex:b})},l=this.pattern.length;if(l>32){let a=0,b=l%32,c=l-b;for(;a<c;)k(this.pattern.substr(a,32),a),a+=32;if(b){let a=l-32;k(this.pattern.substr(a),a)}}else k(this.pattern,0)}searchIn(a){let{isCaseSensitive:b,ignoreDiacritics:c,includeMatches:d}=this.options;if(a=b?a:a.toLowerCase(),a=c?w(a):a,this.pattern===a){let b={isMatch:!0,score:0};return d&&(b.indices=[[0,a.length-1]]),b}let{location:e,distance:f,threshold:g,findAllMatches:h,minMatchCharLength:i,ignoreLocation:j}=this.options,k=[],l=0,m=!1;this.chunks.forEach(({pattern:b,alphabet:c,startIndex:n})=>{let{isMatch:o,score:p,indices:q}=function(a,b,c,{location:d=r.location,distance:e=r.distance,threshold:f=r.threshold,findAllMatches:g=r.findAllMatches,minMatchCharLength:h=r.minMatchCharLength,includeMatches:i=r.includeMatches,ignoreLocation:j=r.ignoreLocation}={}){let k;if(b.length>32)throw Error("Pattern length exceeds max of 32.");let l=b.length,m=a.length,n=Math.max(0,Math.min(d,m)),o=f,p=n,q=h>1||i,s=q?Array(m):[];for(;(k=a.indexOf(b,p))>-1;)if(o=Math.min(v(b,{currentLocation:k,expectedLocation:n,distance:e,ignoreLocation:j}),o),p=k+l,q){let a=0;for(;a<l;)s[k+a]=1,a+=1}p=-1;let t=[],u=1,w=l+m,x=1<<l-1;for(let d=0;d<l;d+=1){let f=0,h=w;for(;f<h;)v(b,{errors:d,currentLocation:n+h,expectedLocation:n,distance:e,ignoreLocation:j})<=o?f=h:w=h,h=Math.floor((w-f)/2+f);w=h;let i=Math.max(1,n-h+1),k=g?m:Math.min(n+h,m)+l,r=Array(k+2);r[k+1]=(1<<d)-1;for(let f=k;f>=i;f-=1){let g=f-1,h=c[a.charAt(g)];if(q&&(s[g]=+!!h),r[f]=(r[f+1]<<1|1)&h,d&&(r[f]|=(t[f+1]|t[f])<<1|1|t[f+1]),r[f]&x&&(u=v(b,{errors:d,currentLocation:g,expectedLocation:n,distance:e,ignoreLocation:j}))<=o){if(o=u,(p=g)<=n)break;i=Math.max(1,2*n-p)}}if(v(b,{errors:d+1,currentLocation:n,expectedLocation:n,distance:e,ignoreLocation:j})>o)break;t=r}let y={isMatch:p>=0,score:Math.max(.001,u)};if(q){let a=function(a=[],b=r.minMatchCharLength){let c=[],d=-1,e=-1,f=0;for(let g=a.length;f<g;f+=1){let g=a[f];g&&-1===d?d=f:g||-1===d||((e=f-1)-d+1>=b&&c.push([d,e]),d=-1)}return a[f-1]&&f-d>=b&&c.push([d,f-1]),c}(s,h);a.length?i&&(y.indices=a):y.isMatch=!1}return y}(a,b,c,{location:e+n,distance:f,threshold:g,findAllMatches:h,minMatchCharLength:i,includeMatches:d,ignoreLocation:j});o&&(m=!0),l+=p,o&&q&&(k=[...k,...q])});let n={isMatch:m,score:m?l/this.chunks.length:1};return m&&d&&(n.indices=k),n}}class y{constructor(a){this.pattern=a}static isMultiMatch(a){return z(a,this.multiRegex)}static isSingleMatch(a){return z(a,this.singleRegex)}search(){}}function z(a,b){let c=a.match(b);return c?c[1]:null}class A extends y{constructor(a){super(a)}static get type(){return"exact"}static get multiRegex(){return/^="(.*)"$/}static get singleRegex(){return/^=(.*)$/}search(a){let b=a===this.pattern;return{isMatch:b,score:+!b,indices:[0,this.pattern.length-1]}}}class B extends y{constructor(a){super(a)}static get type(){return"inverse-exact"}static get multiRegex(){return/^!"(.*)"$/}static get singleRegex(){return/^!(.*)$/}search(a){let b=-1===a.indexOf(this.pattern);return{isMatch:b,score:+!b,indices:[0,a.length-1]}}}class C extends y{constructor(a){super(a)}static get type(){return"prefix-exact"}static get multiRegex(){return/^\^"(.*)"$/}static get singleRegex(){return/^\^(.*)$/}search(a){let b=a.startsWith(this.pattern);return{isMatch:b,score:+!b,indices:[0,this.pattern.length-1]}}}class D extends y{constructor(a){super(a)}static get type(){return"inverse-prefix-exact"}static get multiRegex(){return/^!\^"(.*)"$/}static get singleRegex(){return/^!\^(.*)$/}search(a){let b=!a.startsWith(this.pattern);return{isMatch:b,score:+!b,indices:[0,a.length-1]}}}class E extends y{constructor(a){super(a)}static get type(){return"suffix-exact"}static get multiRegex(){return/^"(.*)"\$$/}static get singleRegex(){return/^(.*)\$$/}search(a){let b=a.endsWith(this.pattern);return{isMatch:b,score:+!b,indices:[a.length-this.pattern.length,a.length-1]}}}class F extends y{constructor(a){super(a)}static get type(){return"inverse-suffix-exact"}static get multiRegex(){return/^!"(.*)"\$$/}static get singleRegex(){return/^!(.*)\$$/}search(a){let b=!a.endsWith(this.pattern);return{isMatch:b,score:+!b,indices:[0,a.length-1]}}}class G extends y{constructor(a,{location:b=r.location,threshold:c=r.threshold,distance:d=r.distance,includeMatches:e=r.includeMatches,findAllMatches:f=r.findAllMatches,minMatchCharLength:g=r.minMatchCharLength,isCaseSensitive:h=r.isCaseSensitive,ignoreDiacritics:i=r.ignoreDiacritics,ignoreLocation:j=r.ignoreLocation}={}){super(a),this._bitapSearch=new x(a,{location:b,threshold:c,distance:d,includeMatches:e,findAllMatches:f,minMatchCharLength:g,isCaseSensitive:h,ignoreDiacritics:i,ignoreLocation:j})}static get type(){return"fuzzy"}static get multiRegex(){return/^"(.*)"$/}static get singleRegex(){return/^(.*)$/}search(a){return this._bitapSearch.searchIn(a)}}class H extends y{constructor(a){super(a)}static get type(){return"include"}static get multiRegex(){return/^'"(.*)"$/}static get singleRegex(){return/^'(.*)$/}search(a){let b,c=0,d=[],e=this.pattern.length;for(;(b=a.indexOf(this.pattern,c))>-1;)c=b+e,d.push([b,c-1]);let f=!!d.length;return{isMatch:f,score:+!f,indices:d}}}let I=[A,H,C,D,F,E,B,G],J=I.length,K=/ +(?=(?:[^\"]*\"[^\"]*\")*[^\"]*$)/,L=new Set([G.type,H.type]);class M{constructor(a,{isCaseSensitive:b=r.isCaseSensitive,ignoreDiacritics:c=r.ignoreDiacritics,includeMatches:d=r.includeMatches,minMatchCharLength:e=r.minMatchCharLength,ignoreLocation:f=r.ignoreLocation,findAllMatches:g=r.findAllMatches,location:h=r.location,threshold:i=r.threshold,distance:j=r.distance}={}){this.query=null,this.options={isCaseSensitive:b,ignoreDiacritics:c,includeMatches:d,minMatchCharLength:e,findAllMatches:g,ignoreLocation:f,location:h,threshold:i,distance:j},a=b?a:a.toLowerCase(),a=c?w(a):a,this.pattern=a,this.query=function(a,b={}){return a.split("|").map(a=>{let c=a.trim().split(K).filter(a=>a&&!!a.trim()),d=[];for(let a=0,e=c.length;a<e;a+=1){let e=c[a],f=!1,g=-1;for(;!f&&++g<J;){let a=I[g],c=a.isMultiMatch(e);c&&(d.push(new a(c,b)),f=!0)}if(!f)for(g=-1;++g<J;){let a=I[g],c=a.isSingleMatch(e);if(c){d.push(new a(c,b));break}}}return d})}(this.pattern,this.options)}static condition(a,b){return b.useExtendedSearch}searchIn(a){let b=this.query;if(!b)return{isMatch:!1,score:1};let{includeMatches:c,isCaseSensitive:d,ignoreDiacritics:e}=this.options;a=d?a:a.toLowerCase(),a=e?w(a):a;let f=0,g=[],h=0;for(let d=0,e=b.length;d<e;d+=1){let e=b[d];g.length=0,f=0;for(let b=0,d=e.length;b<d;b+=1){let d=e[b],{isMatch:i,indices:j,score:k}=d.search(a);if(i){if(f+=1,h+=k,c){let a=d.constructor.type;L.has(a)?g=[...g,...j]:g.push(j)}}else{h=0,f=0,g.length=0;break}}if(f){let a={isMatch:!0,score:h/f};return c&&(a.indices=g),a}}return{isMatch:!1,score:1}}}let N=[];function O(a,b){for(let c=0,d=N.length;c<d;c+=1){let d=N[c];if(d.condition(a,b))return new d(a,b)}return new x(a,b)}let P={AND:"$and",OR:"$or"},Q={PATH:"$path",PATTERN:"$val"},R=a=>!!(a[P.AND]||a[P.OR]),S=a=>({[P.AND]:Object.keys(a).map(b=>({[b]:a[b]}))});function T(a,b,{auto:c=!0}={}){let d=a=>{let f=Object.keys(a),h=!!a[Q.PATH];if(!h&&f.length>1&&!R(a))return d(S(a));if(!e(a)&&i(a)&&!R(a)){let d=h?a[Q.PATH]:f[0],e=h?a[Q.PATTERN]:a[d];if(!g(e))throw Error(`Invalid value for key ${d}`);let i={keyId:q(d),pattern:e};return c&&(i.searcher=O(e,b)),i}let j={children:[],operator:f[0]};return f.forEach(b=>{let c=a[b];e(c)&&c.forEach(a=>{j.children.push(d(a))})}),j};return R(a)||(a=S(a)),d(a)}function U(a,b){let c=a.matches;b.matches=[],j(c)&&c.forEach(a=>{if(!j(a.indices)||!a.indices.length)return;let{indices:c,value:d}=a,e={indices:c,value:d};a.key&&(e.key=a.key.src),a.idx>-1&&(e.refIndex=a.idx),b.matches.push(e)})}function V(a,b){b.score=a.score}class W{constructor(a,b={},c){this.options={...r,...b},this.options.useExtendedSearch,this._keyStore=new n(this.options.keys),this.setCollection(a,c)}setCollection(a,b){if(this._docs=a,b&&!(b instanceof t))throw Error("Incorrect 'index' type");this._myIndex=b||u(this.options.keys,this._docs,{getFn:this.options.getFn,fieldNormWeight:this.options.fieldNormWeight})}add(a){j(a)&&(this._docs.push(a),this._myIndex.add(a))}remove(a=()=>!1){let b=[];for(let c=0,d=this._docs.length;c<d;c+=1){let e=this._docs[c];a(e,c)&&(this.removeAt(c),c-=1,d-=1,b.push(e))}return b}removeAt(a){this._docs.splice(a,1),this._myIndex.removeAt(a)}getIndex(){return this._myIndex}search(a,{limit:b=-1}={}){let{includeMatches:c,includeScore:d,shouldSort:e,sortFn:f,ignoreFieldNorm:i}=this.options,j=g(a)?g(this._docs[0])?this._searchStringList(a):this._searchObjectList(a):this._searchLogical(a);return!function(a,{ignoreFieldNorm:b=r.ignoreFieldNorm}){a.forEach(a=>{let c=1;a.matches.forEach(({key:a,norm:d,score:e})=>{let f=a?a.weight:null;c*=Math.pow(0===e&&f?Number.EPSILON:e,(f||1)*(b?1:d))}),a.score=c})}(j,{ignoreFieldNorm:i}),e&&j.sort(f),h(b)&&b>-1&&(j=j.slice(0,b)),function(a,b,{includeMatches:c=r.includeMatches,includeScore:d=r.includeScore}={}){let e=[];return c&&e.push(U),d&&e.push(V),a.map(a=>{let{idx:c}=a,d={item:b[c],refIndex:c};return e.length&&e.forEach(b=>{b(a,d)}),d})}(j,this._docs,{includeMatches:c,includeScore:d})}_searchStringList(a){let b=O(a,this.options),{records:c}=this._myIndex,d=[];return c.forEach(({v:a,i:c,n:e})=>{if(!j(a))return;let{isMatch:f,score:g,indices:h}=b.searchIn(a);f&&d.push({item:a,idx:c,matches:[{score:g,value:a,norm:e,indices:h}]})}),d}_searchLogical(a){let b=T(a,this.options),c=(a,b,d)=>{if(!a.children){let{keyId:c,searcher:e}=a,f=this._findMatches({key:this._keyStore.get(c),value:this._myIndex.getValueForItemAtKeyId(b,c),searcher:e});return f&&f.length?[{idx:d,item:b,matches:f}]:[]}let e=[];for(let f=0,g=a.children.length;f<g;f+=1){let g=c(a.children[f],b,d);if(g.length)e.push(...g);else if(a.operator===P.AND)return[]}return e},d=this._myIndex.records,e={},f=[];return d.forEach(({$:a,i:d})=>{if(j(a)){let g=c(b,a,d);g.length&&(e[d]||(e[d]={idx:d,item:a,matches:[]},f.push(e[d])),g.forEach(({matches:a})=>{e[d].matches.push(...a)}))}}),f}_searchObjectList(a){let b=O(a,this.options),{keys:c,records:d}=this._myIndex,e=[];return d.forEach(({$:a,i:d})=>{if(!j(a))return;let f=[];c.forEach((c,d)=>{f.push(...this._findMatches({key:c,value:a[d],searcher:b}))}),f.length&&e.push({idx:d,item:a,matches:f})}),e}_findMatches({key:a,value:b,searcher:c}){if(!j(b))return[];let d=[];if(e(b))b.forEach(({v:b,i:e,n:f})=>{if(!j(b))return;let{isMatch:g,score:h,indices:i}=c.searchIn(b);g&&d.push({score:h,key:a,value:b,idx:e,norm:f,indices:i})});else{let{v:e,n:f}=b,{isMatch:g,score:h,indices:i}=c.searchIn(e);g&&d.push({score:h,key:a,value:e,norm:f,indices:i})}return d}}W.version="7.1.0",W.createIndex=u,W.parseIndex=function(a,{getFn:b=r.getFn,fieldNormWeight:c=r.fieldNormWeight}={}){let{keys:d,records:e}=a,f=new t({getFn:b,fieldNormWeight:c});return f.setKeys(d),f.setIndexRecords(e),f},W.config=r,W.parseQuery=T,function(...a){N.push(...a)}(M);let X={keys:[{name:"label",weight:3},{name:"sublabel",weight:1},{name:"objectName",weight:1.5},{name:"fieldValues",weight:2}],threshold:.4,distance:200,includeScore:!0,shouldSort:!0,minMatchCharLength:1};function Y(a){let[b,c]=(0,d.useState)([]),[e,f]=(0,d.useState)(!0),g=(0,d.useRef)(!0);(0,d.useCallback)(async()=>{try{let a=await fetch("/api/workspace/search-index"),b=await a.json();g.current&&(c(b.items??[]),f(!1))}catch{g.current&&f(!1)}},[]);let h=(0,d.useMemo)(()=>0===b.length?null:new W(b.map(a=>({...a,fieldValues:a.fields?Object.values(a.fields).join(" "):void 0})),X),[b]),i=(0,d.useCallback)((a,c=20)=>a.trim()?h?h.search(a,{limit:c}).map(a=>a.item):[]:[...b].toSorted((a,b)=>{let c={object:0,file:1,entry:2};return(c[a.kind]??9)-(c[b.kind]??9)}).slice(0,c),[h,b]),j=(0,d.useRef)(i);return j.current=i,{items:b,loading:e,search:(0,d.useCallback)((a,b)=>j.current(a,b),[])}}},681560:(a,b,c)=>{"use strict";c.d(b,{I:()=>n});var d=c(736927),e=c(115962),f=c(681713),g=c(612563),h=c(379924),i=c(18886),j=c(130526);function k(a){return null==a?"":"string"==typeof a?a:"number"==typeof a||"boolean"==typeof a||"bigint"==typeof a?String(a):"object"==typeof a?JSON.stringify(a):""}function l({entry:a,fields:b,titleField:c,coverField:l,onEntryClick:m}){let n=k(a.entry_id??a.id),o=function(a,b,c){if(c){let b=k(a[c]);if(b)return b}let d=b.find(a=>"text"===a.type&&/name|title/i.test(a.name))??b.find(a=>"text"===a.type);return d?k(a[d.name]):k(a.id)}(a,b,c),p=(0,j.I)(a,b),q=(0,e.useMemo)(()=>b.filter(a=>a.name!==c&&a.name!==l).slice(0,4),[b,c,l]),r=b.find(a=>"enum"===a.type&&a.enum_values?.length),s=r?k(a[r.name]):null,t=r&&s?function(a,b){if(!a||!b.enum_values)return null;let c=b.enum_values.indexOf(a);return{text:a,color:c>=0&&b.enum_colors?.[c]?b.enum_colors[c]:"#94a3b8"}}(s,r):null;return(0,d.jsxs)("button",{type:"button",onClick:()=>m?.(n),className:"text-left rounded-xl border p-4 hover:shadow-md transition-all cursor-pointer w-full group",style:{borderColor:"var(--color-border)",background:"var(--color-surface)"},children:[(0,d.jsxs)("div",{className:"flex items-start justify-between gap-2 mb-2",children:[(0,d.jsxs)("div",{className:"flex min-w-0 items-start gap-2",children:[p?.faviconUrl&&(0,d.jsx)(i.A,{src:p.faviconUrl,className:"w-4 h-4 rounded-[4px] shrink-0 mt-0.5"}),(0,d.jsx)("h4",{className:"text-[13px] font-semibold leading-tight line-clamp-2 group-hover:underline",style:{color:"var(--color-text)"},children:o||"Untitled"})]}),t&&(0,d.jsx)("span",{className:"text-[10px] px-2 py-0.5 rounded-full flex-shrink-0 whitespace-nowrap",style:{backgroundColor:t.color,color:"#fff"},children:t.text})]}),(0,d.jsx)("div",{className:"flex flex-col gap-1.5",children:q.map(b=>{let c=a[b.name];if(null==c||""===k(c))return null;let e="tags"===b.type?(0,h.k)(c):[];return(0,d.jsxs)("div",{className:"flex items-baseline gap-2",children:[(0,d.jsx)("span",{className:"text-[10px] flex-shrink-0 min-w-[60px]",style:{color:"var(--color-text-muted)"},children:b.name}),(0,d.jsx)("div",{className:"text-[12px] whitespace-pre-line line-clamp-2",style:{color:"var(--color-text)"},children:"tags"===b.type?(0,d.jsxs)("span",{className:"flex items-center gap-0.5 flex-wrap",children:[e.slice(0,3).map(a=>{let b=(0,g.KJ)(a),c="link"===b.kind&&b.href,e="url"===b.linkType&&!!b.faviconUrl;return c?(0,d.jsxs)("a",{href:b.href,target:"url"===b.linkType||"file"===b.linkType?"_blank":void 0,rel:"url"===b.linkType||"file"===b.linkType?"noopener noreferrer":void 0,onClick:a=>a.stopPropagation(),className:"inline-flex items-center gap-1 px-1.5 py-0 rounded text-[11px] font-medium hover:underline underline-offset-2 max-w-[220px]",style:{background:"rgba(148, 163, 184, 0.12)",color:"var(--color-accent)"},children:[e&&(0,d.jsx)(i.A,{src:b.faviconUrl,className:"w-3 h-3 rounded-[2px] shrink-0"}),(0,d.jsx)("span",{className:"min-w-0 truncate",children:b.text})]},a):(0,d.jsx)("span",{className:"inline-flex items-center px-1.5 py-0 rounded text-[11px] font-medium",style:{background:"rgba(148, 163, 184, 0.12)",color:"var(--color-text-muted)"},children:a},a)}),e.length>3&&(0,d.jsxs)("span",{className:"text-[10px]",style:{color:"var(--color-text-muted)"},children:["+",e.length-3]})]}):(0,d.jsx)(f.E,{value:c,fieldType:b.type,mode:"table",showUrlFavicon:!0})})]},b.id)})}),null!=a.created_at&&(0,d.jsx)("div",{className:"mt-3 text-[10px]",style:{color:"var(--color-text-muted)",opacity:.6},children:k(a.created_at).slice(0,10)})]})}function m(){return(0,d.jsxs)("div",{className:"flex flex-col items-center justify-center py-16 gap-2",children:[(0,d.jsxs)("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",style:{color:"var(--color-text-muted)",opacity:.4},children:[(0,d.jsx)("rect",{width:"7",height:"7",x:"3",y:"3",rx:"1"}),(0,d.jsx)("rect",{width:"7",height:"7",x:"14",y:"3",rx:"1"}),(0,d.jsx)("rect",{width:"7",height:"7",x:"3",y:"14",rx:"1"}),(0,d.jsx)("rect",{width:"7",height:"7",x:"14",y:"14",rx:"1"})]}),(0,d.jsx)("span",{className:"text-sm",style:{color:"var(--color-text-muted)"},children:"No entries to display in gallery view."})]})}function n({objectName:a,fields:b,entries:c,titleField:e,coverField:f,members:g,relationLabels:h,onEntryClick:i}){return 0===c.length?(0,d.jsx)(m,{}):(0,d.jsx)("div",{className:"grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-3",children:c.map(a=>(0,d.jsx)(l,{entry:a,fields:b,titleField:e,coverField:f,onEntryClick:i},k(a.entry_id??a.id)))})}},681713:(a,b,c)=>{"use strict";c.d(b,{E:()=>m});var d=c(736927),e=c(115962),f=c(612563),g=c(18886),h=c(545182),i=c(888973);function j(){return(0,d.jsx)("span",{style:{color:"var(--color-text-muted)",opacity:.5},children:"--"})}function k({mediaType:a,url:b,label:c}){return"image"===a?(0,d.jsx)("div",{className:"mt-2 rounded-lg overflow-hidden border",style:{borderColor:"var(--color-border)"},children:(0,d.jsx)("img",{src:b,alt:c,className:"max-h-64 w-auto"})}):"video"===a?(0,d.jsx)("video",{src:b,controls:!0,className:"mt-2 w-full max-h-72 rounded-lg border",style:{borderColor:"var(--color-border)",background:"#000"}}):"audio"===a?(0,d.jsx)("audio",{src:b,controls:!0,className:"mt-2 w-full"}):(0,d.jsx)("iframe",{src:`${b}#toolbar=0&navpanes=0&scrollbar=1`,title:c,className:"mt-2 w-full h-72 rounded-lg border",style:{borderColor:"var(--color-border)",background:"white"}})}function l({text:a,fieldType:b,showUrlFavicon:c=!1,linkInteractionMode:e="inline",isTableMode:j=!1}){let k=a.trim();if(!k)return(0,d.jsx)(d.Fragment,{children:a});let l=b&&"text"!==b&&"richtext"!==b?b:void 0,m=(0,f.KJ)(k,l);if("link"===m.kind&&m.href){if(!l&&"file"===m.linkType&&k.includes(" "))return(0,d.jsx)(d.Fragment,{children:m.text});let a="url"===m.linkType||"file"===m.linkType,b=c&&"url"===m.linkType&&!!m.faviconUrl;if("button"===e){let c=(0,d.jsxs)("span",{className:"inline-flex min-w-0 max-w-full items-center gap-1.5 align-middle",style:{color:"var(--color-accent)"},children:[b&&(0,d.jsx)(g.A,{src:m.faviconUrl}),(0,d.jsx)("span",{className:j?"min-w-0 truncate":"min-w-0 break-all",children:m.text}),(0,d.jsx)(h.x,{href:m.href,openInNewTab:a,className:"inline-flex h-4 w-4 shrink-0 items-center justify-center rounded-sm hover:bg-black/5"})]});return"url"===m.linkType?(0,d.jsx)(i.k,{href:m.href,children:c}):c}return(0,d.jsx)(i.U,{href:m.href,text:m.text,linkType:m.linkType??"url",faviconUrl:m.faviconUrl,showFavicon:b})}return"number"===m.kind||"currency"===m.kind?(0,d.jsx)("span",{className:"tabular-nums",children:m.text}):(0,d.jsx)(d.Fragment,{children:m.text})}function m({value:a,fieldType:b,mode:c="table",className:m,showUrlFavicon:n=!1,linkInteractionMode:o="inline"}){let p=(0,f.KJ)(a,b),q="table"===c;if("empty"===p.kind)return(0,d.jsx)(j,{});let r=p.text.replace(/\\r\\n/g,"\n").replace(/\\n/g,"\n").replace(/\\r/g,"\n");if(r.includes("\n")){let a=r.split("\n"),c=m??(q?"block max-w-[300px] line-clamp-3":"break-words");return(0,d.jsx)("span",{className:c,children:a.map((a,c)=>(0,d.jsxs)(e.Fragment,{children:[c>0&&(0,d.jsx)("br",{}),(0,d.jsx)(l,{text:a,fieldType:b,showUrlFavicon:n,linkInteractionMode:o,isTableMode:q})]},c))})}let s=m??(q?"truncate block max-w-[300px]":"break-words");if("link"===p.kind&&p.href){let a="url"===p.linkType||"file"===p.linkType,b=!q&&!!p.embedUrl&&!!p.mediaType,c=n&&"url"===p.linkType&&!!p.faviconUrl;if("button"===o){let e=(0,d.jsxs)("div",{className:q?"block max-w-[300px]":"w-full",children:[(0,d.jsxs)("span",{className:"flex w-full min-w-0 items-center gap-1.5",style:{color:"var(--color-accent)"},children:[c&&(0,d.jsx)(g.A,{src:p.faviconUrl}),(0,d.jsx)("span",{className:q?"min-w-0 truncate":"min-w-0 break-all",children:p.text}),(0,d.jsx)(h.x,{href:p.href,openInNewTab:a})]}),b&&(0,d.jsx)(k,{mediaType:p.mediaType,url:p.embedUrl,label:p.text})]});return"url"===p.linkType?(0,d.jsx)(i.k,{href:p.href,children:e}):e}return(0,d.jsxs)("div",{className:q?"block max-w-[300px]":"w-full",children:[(0,d.jsx)(i.U,{href:p.href,text:p.text,linkType:p.linkType??"url",faviconUrl:p.faviconUrl,showFavicon:c,layout:"block",className:q?"truncate":""}),b&&(0,d.jsx)(k,{mediaType:p.mediaType,url:p.embedUrl,label:p.text})]})}return"number"===p.kind||"currency"===p.kind?(0,d.jsx)("span",{className:`tabular-nums ${s}`,children:p.text}):(0,d.jsx)("span",{className:s,children:r})}},685233:(a,b,c)=>{"use strict";c.d(b,{X:()=>a6,S:()=>a7});var d=c(736927),e=c(115962),f=c(213505),g=c(492081),h=c(755726),i=c(922123),j=c(478105),k=c(363269),l=c(515016),m=c(558287),n=c(631608),o=c(846069),p=c(744277),q=c(68200),r=c(316780),s=c(398367),t=c(405287),u=c(587464),v=c(173961),w=c(760687),x=c(840512);let y=e.createContext(void 0),z=e.createContext(void 0),A=e.createContext(void 0),B=e.createContext("");function C(){let a=e.useContext(y);if(!a)throw Error((0,x.A)(22));return a}function D(){let a=e.useContext(z);if(!a)throw Error((0,x.A)(23));return a}function E(){let a=e.useContext(A);if(!a)throw Error((0,x.A)(24));return a}var F=c(569869);let G=(a,b)=>Object.is(a,b);function H(a,b,c){return null==a||null==b?Object.is(a,b):c(a,b)}function I(a,b,c){return a&&0!==a.length?a.findIndex(a=>void 0!==a&&H(a,b,c)):-1}function J(a){if(null==a)return"";if("string"==typeof a)return a;try{return JSON.stringify(a)}catch{return String(a)}}function K(a){return null!=a&&a.length>0&&"object"==typeof a[0]&&null!=a[0]&&"items"in a[0]}function L(a,b){if(b&&null!=a)return b(a)??"";if(a&&"object"==typeof a){if("label"in a&&null!=a.label)return String(a.label);if("value"in a)return String(a.value)}return J(a)}function M(a,b){return b&&null!=a?b(a)??"":a&&"object"==typeof a&&"value"in a&&"label"in a?J(a.value):J(a)}let N={id:(0,F.M)(a=>a.id),query:(0,F.M)(a=>a.query),items:(0,F.M)(a=>a.items),selectedValue:(0,F.M)(a=>a.selectedValue),hasSelectionChips:(0,F.M)(a=>{let b=a.selectedValue;return Array.isArray(b)&&b.length>0}),hasSelectedValue:(0,F.M)(a=>{let{selectedValue:b,selectionMode:c}=a;return null!=b&&(!("multiple"===c&&Array.isArray(b))||b.length>0)}),hasNullItemLabel:(0,F.M)((a,b)=>!!b&&function(a){if(!Array.isArray(a))return null!=a&&!("null"in a);if(K(a)){for(let b of a)for(let a of b.items)if(a&&null==a.value&&null!=a.label)return!0;return!1}for(let b of a)if(b&&null==b.value&&null!=b.label)return!0;return!1}(a.items)),open:(0,F.M)(a=>a.open),mounted:(0,F.M)(a=>a.mounted),forceMounted:(0,F.M)(a=>a.forceMounted),inline:(0,F.M)(a=>a.inline),activeIndex:(0,F.M)(a=>a.activeIndex),selectedIndex:(0,F.M)(a=>a.selectedIndex),isActive:(0,F.M)((a,b)=>a.activeIndex===b),isSelected:(0,F.M)((a,b)=>{let c=a.isItemEqualToValue,d=a.selectedValue;return Array.isArray(d)?d.some(a=>H(b,a,c)):H(b,d,c)}),transitionStatus:(0,F.M)(a=>a.transitionStatus),popupProps:(0,F.M)(a=>a.popupProps),inputProps:(0,F.M)(a=>a.inputProps),triggerProps:(0,F.M)(a=>a.triggerProps),getItemProps:(0,F.M)(a=>a.getItemProps),positionerElement:(0,F.M)(a=>a.positionerElement),listElement:(0,F.M)(a=>a.listElement),triggerElement:(0,F.M)(a=>a.triggerElement),inputElement:(0,F.M)(a=>a.inputElement),popupSide:(0,F.M)(a=>a.popupSide),openMethod:(0,F.M)(a=>a.openMethod),inputInsidePopup:(0,F.M)(a=>a.inputInsidePopup),selectionMode:(0,F.M)(a=>a.selectionMode),listRef:(0,F.M)(a=>a.listRef),labelsRef:(0,F.M)(a=>a.labelsRef),popupRef:(0,F.M)(a=>a.popupRef),emptyRef:(0,F.M)(a=>a.emptyRef),inputRef:(0,F.M)(a=>a.inputRef),keyboardActiveRef:(0,F.M)(a=>a.keyboardActiveRef),chipsContainerRef:(0,F.M)(a=>a.chipsContainerRef),clearRef:(0,F.M)(a=>a.clearRef),valuesRef:(0,F.M)(a=>a.valuesRef),allValuesRef:(0,F.M)(a=>a.allValuesRef),name:(0,F.M)(a=>a.name),disabled:(0,F.M)(a=>a.disabled),readOnly:(0,F.M)(a=>a.readOnly),required:(0,F.M)(a=>a.required),grid:(0,F.M)(a=>a.grid),isGrouped:(0,F.M)(a=>a.isGrouped),virtualized:(0,F.M)(a=>a.virtualized),onOpenChangeComplete:(0,F.M)(a=>a.onOpenChangeComplete),openOnInputClick:(0,F.M)(a=>a.openOnInputClick),itemToStringLabel:(0,F.M)(a=>a.itemToStringLabel),isItemEqualToValue:(0,F.M)(a=>a.isItemEqualToValue),modal:(0,F.M)(a=>a.modal),autoHighlight:(0,F.M)(a=>a.autoHighlight),submitOnItemClick:(0,F.M)(a=>a.submitOnItemClick)};var O=c(230652),P=c(577225);let Q=function(a){return a.disabled="data-disabled",a.valid="data-valid",a.invalid="data-invalid",a.touched="data-touched",a.dirty="data-dirty",a.filled="data-filled",a.focused="data-focused",a}({}),R=e.createContext({invalid:void 0,name:void 0,validityData:{state:{badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:null,valueMissing:!1},errors:[],error:"",value:"",initialValue:null},setValidityData:P.tE,disabled:void 0,touched:!1,setTouched:P.tE,dirty:!1,setDirty:P.tE,filled:!1,setFilled:P.tE,focused:!1,setFocused:P.tE,validate:()=>null,validationMode:"onSubmit",validationDebounceTime:0,shouldValidateOnChange:()=>!1,state:{disabled:!1,valid:null,touched:!1,dirty:!1,filled:!1,focused:!1},markedDirtyRef:{current:!1},validation:{getValidationProps:(a=P.t0)=>a,getInputValidationProps:(a=P.t0)=>a,inputRef:{current:null},commit:async()=>{}}});function S(a=!0){let b=e.useContext(R);if(b.setValidityData===P.tE&&!a)throw Error((0,x.A)(28));return b}var T=c(249855);let U=e.createContext({formRef:{current:{fields:new Map}},errors:{},clearErrors:P.tE,validationMode:"onSubmit",submitAttemptedRef:{current:!1}});function V(){return e.useContext(U)}var W=c(725427),X=c(840507);let Y=e.createContext({controlId:void 0,registerControlId:P.tE,labelId:void 0,setLabelId:P.tE,messageIds:[],setMessageIds:P.tE,getDescriptionProps:a=>a});function Z(){return e.useContext(Y)}let _=new Map;var aa=c(735328),ab=c(192083);function ac(a,b){let c=e.useRef(a),d=(0,i.K)(b);(0,g.g)(()=>{c.current!==a&&d(c.current)},[a,d]),(0,g.g)(()=>{c.current=a},[a])}let ad=Symbol("none"),ae={value:ad,index:-1};function af(a){let b,c,x,{id:C,onOpenChangeComplete:D,defaultSelectedValue:E=null,selectedValue:F,onSelectedValueChange:J,defaultInputValue:Q,inputValue:R,selectionMode:U="none",onItemHighlighted:Y,name:af,disabled:ag=!1,readOnly:ah=!1,required:ai=!1,inputRef:aj,grid:ak=!1,items:al,filteredItems:am,filter:an,openOnInputClick:ao=!0,autoHighlight:ap=!1,keepHighlight:aq=!1,highlightItemOnHover:ar=!0,loopFocus:as=!0,itemToStringLabel:at,itemToStringValue:au,isItemEqualToValue:av=G,virtualized:aw=!1,inline:ax=!1,fillInputOnItemPress:ay=!0,modal:az=!1,limit:aA=-1,autoComplete:aB="list",formAutoComplete:aC,locale:aD,submitOnItemClick:aE=!1}=a,{clearErrors:aF}=V(),{setDirty:aG,validityData:aH,shouldValidateOnChange:aI,setFilled:aJ,name:aK,disabled:aL,setTouched:aM,setFocused:aN,validationMode:aO,validation:aP}=S(),aQ=function(a={}){let{id:b,implicit:c=!1,controlRef:d}=a,{controlId:f,registerControlId:h}=Z(),j=(0,X.e)(b),k=c?f:void 0,m=(0,l.j)(()=>Symbol("labelable-control")),n=e.useRef(!1),o=e.useRef(null!=b),p=(0,i.K)(()=>{n.current&&h!==P.tE&&(n.current=!1,h(m.current,void 0))});return(0,g.g)(()=>{let a;if(h!==P.tE){if(c){let c=d?.current;a=(0,W.vq)(c)&&null!=c.closest("label")?b??null:k??j}else if(null!=b)o.current=!0,a=b;else{if(!o.current)return void p();a=j}if(void 0===a)return void p();n.current=!0,h(m.current,a)}},[b,d,k,h,c,j,m,p]),e.useEffect(()=>p,[p]),f??j}({id:C}),aR=function(a={}){let b={usage:"search",sensitivity:"base",ignorePunctuation:!0,...a},c=`${function a(b){return Array.isArray(b)?b.map(b=>a(b)).join(","):null==b?"":String(b)}(a.locale)}|${JSON.stringify(b)}`,d=_.get(c);if(d)return d;let e=new Intl.Collator(a.locale,b),f={contains(a,b,c){if(!b)return!0;let d=L(a,c);for(let a=0;a<=d.length-b.length;a+=1)if(0===e.compare(d.slice(a,a+b.length),b))return!0;return!1},startsWith(a,b,c){if(!b)return!0;let d=L(a,c);return 0===e.compare(d.slice(0,b.length),b)},endsWith(a,b,c){if(!b)return!0;let d=L(a,c),f=b.length;return d.length>=f&&0===e.compare(d.slice(d.length-f),b)}};return _.set(c,f),f}({locale:aD}),[aS,aT]=e.useState(!1),[aU,aV]=e.useState(null),aW=e.useRef([]),aX=e.useRef([]),aY=e.useRef(null),aZ=e.useRef(null),a$=e.useRef(null),a_=e.useRef(!0),a0=e.useRef(!1),a1=e.useRef(null),a2=e.useRef(null),a3=e.useRef(null),a4=e.useRef(ae),a5=e.useRef(null),a6=e.useRef([]),a7=e.useRef([]),a8=aL||ag,a9=aK??af,ba="multiple"===U,bb="single"===U,bc=void 0!==R||void 0!==Q,bd=void 0!==al,be=void 0!==am;b="always"===ap?"always":!!ap&&"input-change";let[bf,bg]=(0,f.q)({controlled:F,default:ba?E??P.Ml:E,name:"Combobox",state:"selectedValue"}),bh=e.useMemo(()=>null===an?()=>!0:void 0!==an?an:bb&&!aS?(a,b)=>{if(null==a)return!1;if(!b)return!0;let c=L(a,at),d=null!=bf?L(bf,at):"";return!!(d&&aR.contains(d,b))&&d.length===b.length||aR.contains(c,b)}:(a,b)=>{if(null==a)return!1;let c=L(a,at);return aR.contains(c,b)},[an,bb,bf,aS,aR,at]),bi=(0,l.j)(()=>bc?Q??"":bb?L(bf,at):"").current,[bj,bk]=(0,f.q)({controlled:R,default:bi,name:"Combobox",state:"inputValue"}),[bl,bm]=(0,f.q)({controlled:a.open,default:a.defaultOpen,name:"Combobox",state:"open"}),bn=K(al),bo=aU??(""===bj?"":String(bj).trim()),bp=bb?L(bf,at):"",bq=bb&&!aS&&""!==bo&&""!==bp&&bp.length===bo.length&&aR.contains(bp,bo),br=bq?"":bo,bs=bd&&be&&bq,bt=e.useMemo(()=>al?bn?al.flatMap(a=>a.items):al:P.Ml,[al,bn]),bu=e.useMemo(()=>{if(am&&!bs)return am;if(!al)return P.Ml;if(bn){let a=[],b=0;for(let c of al){if(aA>-1&&b>=aA)break;let d=""===br?c.items:c.items.filter(a=>bh(a,br,at));if(0===d.length)continue;let e=aA>-1?aA-b:1/0,f=d.slice(0,e);if(f.length>0){let d={...c,items:f};a.push(d),b+=f.length}}return a}if(""===br)return aA>-1?bt.slice(0,aA):bt;let a=[];for(let b of bt){if(aA>-1&&a.length>=aA)break;bh(b,br,at)&&a.push(b)}return a},[am,bs,al,bn,br,aA,bh,at,bt]),bv=e.useMemo(()=>bn?bu.flatMap(a=>a.items):bu,[bu,bn]),bw=(0,l.j)(()=>new m.i({id:aQ,selectedValue:bf,open:bl,filter:bh,query:bo,items:al,selectionMode:U,listRef:aW,labelsRef:aX,popupRef:aY,emptyRef:a$,inputRef:aZ,keyboardActiveRef:a_,chipsContainerRef:a1,clearRef:a2,valuesRef:a6,allValuesRef:a7,selectionEventRef:a3,name:a9,disabled:a8,readOnly:ah,required:ai,grid:ak,isGrouped:bn,virtualized:aw,openOnInputClick:ao,itemToStringLabel:at,isItemEqualToValue:av,modal:az,autoHighlight:b,submitOnItemClick:aE,hasInputValue:bc,mounted:!1,forceMounted:!1,transitionStatus:"idle",inline:ax,activeIndex:null,selectedIndex:null,popupProps:{},inputProps:{},triggerProps:{},positionerElement:null,listElement:null,triggerElement:null,inputElement:null,popupSide:null,openMethod:null,inputInsidePopup:!0,onOpenChangeComplete:D||P.tE,setOpen:P.tE,setInputValue:P.tE,setSelectedValue:P.tE,setIndices:P.tE,onItemHighlighted:P.tE,handleSelection:P.tE,getItemProps:()=>P.t0,forceMount:P.tE,requestSubmit:P.tE})).current,bx="none"===U?bj:bf,by=e.useMemo(()=>"none"===U?bx:Array.isArray(bf)?bf.map(a=>M(a,au)):M(bf,au),[bx,au,U,bf]),bz=(0,i.K)(Y),bA=(0,i.K)(D),bB=(0,n.P)(bw,N.activeIndex),bC=(0,n.P)(bw,N.selectedIndex),bD=(0,n.P)(bw,N.positionerElement),bE=(0,n.P)(bw,N.listElement),bF=(0,n.P)(bw,N.triggerElement),bG=(0,n.P)(bw,N.inputElement),bH=(0,n.P)(bw,N.inline),bI=(0,n.P)(bw,N.inputInsidePopup),bJ=(0,o.u)(bF),{mounted:bK,setMounted:bL,transitionStatus:bM}=(0,aa.$)(bl),{openMethod:bN,triggerProps:bO,reset:bP}=(0,ab.G)(bl);!function(a){let{enabled:b=!0,value:c,id:d,name:e,controlRef:f,commit:h}=a,{formRef:j}=V(),{invalid:k,markedDirtyRef:l,validityData:m,setValidityData:n}=S(),o=(0,i.K)(a.getValue);(0,g.g)(()=>{if(!b)return;let a=c;void 0===a&&(a=o()),null===m.initialValue&&null!==a&&n(b=>({...b,initialValue:a}))},[b,n,c,m.initialValue,o]),(0,g.g)(()=>{b&&d&&j.current.fields.set(d,{getValue:o,name:e,controlRef:f,validityData:{...m,state:{...m.state,valid:!k&&m.state.valid}},validate(a=!0){let b=c;void 0===b&&(b=o()),l.current=!0,a?T.flushSync(()=>h(b)):h(b)}})},[h,f,b,j,o,d,k,l,e,m,c]),(0,g.g)(()=>{let a=j.current.fields;return()=>{d&&a.delete(d)}},[j,d])}({id:aQ,name:a9,commit:aP.commit,value:bx,controlRef:bI?bJ:aZ,getValue:()=>by});let bQ=(0,i.K)(()=>{al?aX.current=bv.map(a=>L(a,at)):bw.set("forceMounted",!0)}),bR=e.useRef(bf);(0,g.g)(()=>{bf!==bR.current&&bQ()},[bQ,bf]);let bS=(0,i.K)(a=>{bw.update(a);let b=a.type||"none";if(void 0!==a.activeIndex)if(null===a.activeIndex)a4.current!==ae&&(a4.current=ae,bz(void 0,(0,v.M)(b,void 0,{index:-1})));else{let c=a6.current[a.activeIndex];a4.current={value:c,index:a.activeIndex},bz(c,(0,v.M)(b,void 0,{index:a.activeIndex}))}}),bT=(0,i.K)((c,d)=>{if(a0.current=d.reason===w.qs,a.onInputValueChange?.(c,d),!d.isCanceled){if(d.reason===w.pf){let a=d.event,e=a.inputType;if("compositionend"===a.type||null!=e&&""!==e&&"insertReplacementText"!==e){let a=""!==c.trim();a&&aT(!0),a5.current={hasQuery:a},a&&b&&null==bw.state.activeIndex&&bw.set("activeIndex",0)}}bk(c)}}),bU=(0,i.K)((b,c)=>{if(bl!==b&&("escape-key"===c.reason&&bd&&0===bv.length&&!bw.state.emptyRef.current&&c.allowPropagation(),a.onOpenChange?.(b,c),!c.isCanceled&&(!b&&aS&&(bb?(bH||aV(bo),""===bo&&aT(!1)):ba&&(bH||bI?bS({activeIndex:null}):aV(bo),bT("",(0,v.d)(w.qs,c.event)))),bm(b),!b&&bI&&(c.reason===w.Xn||c.reason===w.Np))&&(aM(!0),aN(!1),"onBlur"===aO))){let a="none"===U?bj:bf;aP.commit(a)}}),bV=(0,i.K)((a,b)=>{J?.(a,b),!b.isCanceled&&(bg(a),("none"===U&&aY.current&&ay||bb&&!bw.state.inputInsidePopup)&&bT(L(a,at),(0,v.d)(b.reason,b.event)),bb&&null!=a&&b.reason!==w.pf&&aS&&!bH&&aV(bo))}),bW=(0,i.K)((a,b)=>{let c=b;if(void 0===c){if(null===bB)return;c=a6.current[bB]}let d=(0,u.EW)(a),e=a3.current??a;a3.current=null;let f=(0,v.d)(w.Bo,e),g=d?.closest("a")?.getAttribute("href");if(g){g.startsWith("#")&&bU(!1,f);return}if(ba){var h,i,j,k;let a=Array.isArray(bf)?bf:[];if(bV((h=c,i=bw.state.isItemEqualToValue,a&&0!==a.length&&a.some(a=>void 0!==a&&H(h,a,i)))?(j=c,k=bw.state.isItemEqualToValue,a.filter(a=>!H(j,a,k))):[...a,c],f),!(aZ.current&&""!==aZ.current.value.trim()))return;bw.state.inputInsidePopup?bT("",(0,v.d)(w.qs,f.event)):bU(!1,f)}else bV(c,f),bU(!1,f)}),bX=(0,i.K)(()=>{if(!bw.state.submitOnItemClick)return;let a=bw.state.inputElement?.form;a&&"function"==typeof a.requestSubmit&&a.requestSubmit()}),bY=(0,i.K)(()=>{if(bL(!1),bA?.(!1),aT(!1),bP(),aV(null),"none"===U?bS({activeIndex:null,selectedIndex:null}):bS({activeIndex:null}),ba&&aZ.current&&""!==aZ.current.value&&!a0.current&&bT("",(0,v.d)(w.qs)),bb)if(bw.state.inputInsidePopup)aZ.current&&""!==aZ.current.value&&bT("",(0,v.d)(w.qs));else{let a=L(bf,at);if(aZ.current&&aZ.current.value!==a){let b=""===a?w.qs:w.dv;bT(a,(0,v.d)(b))}}}),bZ=e.useMemo(()=>bH&&bD?{current:bD.closest('[role="dialog"]')}:aY,[bH,bD]);(0,O.v)({enabled:!a.actionsRef,open:bl,ref:bZ,onComplete(){bl||bY()}}),e.useImperativeHandle(a.actionsRef,()=>({unmount:bY}),[bY]),(0,g.g)(function(){if(bl||"none"===U)return;let a=al?bt:a7.current;if(ba){let b=Array.isArray(bf)?bf:[],c=I(a,b[b.length-1],av);bS({selectedIndex:-1===c?null:c})}else{let b=I(a,bf,av);bS({selectedIndex:-1===b?null:b})}},[bl,bf,al,U,bt,ba,av,bS]),(0,g.g)(()=>{al&&(a6.current=bv,aW.current.length=bv.length)},[al,bv]),(0,g.g)(()=>{let a=a5.current;if(a&&(a.hasQuery?b&&bw.set("activeIndex",0):"always"===b&&bw.set("activeIndex",0),a5.current=null),!bl&&!bH)return;let c=bd||be?bv:a6.current,d=bw.state.activeIndex;if(null==d)return"always"===b&&c.length>0?void bw.set("activeIndex",0):void(a4.current!==ae&&(a4.current=ae,bw.state.onItemHighlighted(void 0,(0,v.M)(w.dv,void 0,{index:-1}))));if(d>=c.length){a4.current!==ae&&(a4.current=ae,bw.state.onItemHighlighted(void 0,(0,v.M)(w.dv,void 0,{index:-1}))),bw.set("activeIndex",null);return}let e=c[d],f=a4.current.value,g=f!==ad&&H(e,f,bw.state.isItemEqualToValue);a4.current.index===d&&g||(a4.current={value:e,index:d},bw.state.onItemHighlighted(e,(0,v.M)(w.dv,void 0,{index:d})))},[bB,b,be,bd,bv,bH,bl,bw]),(0,g.g)(()=>{if("none"===U)return void aJ(""!==String(bj));aJ(ba?Array.isArray(bf)&&bf.length>0:null!=bf)},[aJ,U,bj,bf,ba]),e.useEffect(()=>{bd&&b&&0===bv.length&&bS({activeIndex:null})},[bd,b,bv.length,bS]),ac(bo,()=>{bl&&""!==bo&&bo!==String(bi)&&aT(!0)}),ac(bf,()=>{if("none"!==U&&(aF(a9),aG(bf!==aH.initialValue),aI()?aP.commit(bf):aP.commit(bf,!0),bb&&!bc&&!bI)){let a=L(bf,at);bj!==a&&bT(a,(0,v.d)(w.dv))}}),ac(bj,()=>{"none"===U&&(aF(a9),aG(bj!==aH.initialValue),aI()?aP.commit(bj):aP.commit(bj,!0))}),ac(al,()=>{if(!bb||bc||bI||aS)return;let a=L(bf,at);bj!==a&&bT(a,(0,v.d)(w.dv))});let b$=(0,p.P)({open:!!bH||bl,onOpenChange:bU,elements:{reference:bI?bF:bG,floating:bD}});bH||(c=ak?"grid":"listbox",x=bl?"true":"false");let b_=e.useMemo(()=>{let a=bG?.tagName==="INPUT",b=a||bl,d=a?{autoComplete:"off",spellCheck:"false",autoCorrect:"off",autoCapitalize:"none"}:{};return b&&(d.role="combobox",d["aria-expanded"]=x,d["aria-haspopup"]=c,d["aria-controls"]=bl?bE?.id:void 0,d["aria-autocomplete"]=aB),{reference:d,floating:{role:"presentation"}}},[bG,bl,x,c,bE?.id,aB]),b0=(0,q.k)(b$,{enabled:!ah&&!a8&&ao,event:"mousedown-only",toggle:!1,touchOpenDelay:50*!bI,reason:w._J}),b1=(0,r.s)(b$,{enabled:!ah&&!a8&&!bH,outsidePressEvent:{mouse:"sloppy",touch:"intentional"},bubbles:!!bH||void 0,outsidePress(a){let b=(0,u.EW)(a);return!(0,u.gR)(bF,b)&&!(0,u.gR)(a2.current,b)&&!(0,u.gR)(a1.current,b)}}),b2=(0,s.C)(b$,{enabled:!ah&&!a8,id:aQ,listRef:aW,activeIndex:bB,selectedIndex:bC,virtual:!0,loopFocus:as,allowEscape:as&&!b,focusItemOnOpen:!aS&&("none"!==U||!!b)&&"auto",focusItemOnHover:ar,resetOnPointerLeave:!aq,cols:ak?2:1,orientation:ak?"horizontal":void 0,disabledIndices:P.Ml,onNavigate(a,b){(b||bl)&&"ending"!==bM&&(b?bS({activeIndex:a,type:a_.current?"keyboard":"pointer"}):bS({activeIndex:a}))}}),{getReferenceProps:b3,getFloatingProps:b4,getItemProps:b5}=(0,t.b)([b_,b0,b1,b2]);(0,h.j)(()=>{bw.update({inline:ax,popupProps:b4(),inputProps:b3(),triggerProps:bO,getItemProps:b5,setOpen:bU,setInputValue:bT,setSelectedValue:bV,setIndices:bS,onItemHighlighted:bz,handleSelection:bW,forceMount:bQ,requestSubmit:bX})}),(0,g.g)(()=>{bw.update({id:aQ,selectedValue:bf,open:bl,mounted:bK,transitionStatus:bM,items:al,inline:ax,popupProps:b4(),inputProps:b3(),triggerProps:bO,openMethod:bN,getItemProps:b5,selectionMode:U,name:a9,disabled:a8,readOnly:ah,required:ai,grid:ak,isGrouped:bn,virtualized:aw,onOpenChangeComplete:bA,openOnInputClick:ao,itemToStringLabel:at,modal:az,autoHighlight:b,isItemEqualToValue:av,submitOnItemClick:aE,hasInputValue:bc,requestSubmit:bX})},[bw,aQ,bf,bl,bK,bM,al,b4,b3,b5,bN,bO,U,a9,a8,ah,ai,aP,ak,bn,aw,bA,ao,at,az,av,aE,bc,ax,bX,b]);let b6=(0,j.a)(aj,aP.inputRef),b7=e.useMemo(()=>({query:bo,hasItems:bd,filteredItems:bu,flatFilteredItems:bv}),[bo,bd,bu,bv]),b8=e.useMemo(()=>Array.isArray(bx)?"":M(bx,au),[bx,au]),b9=ba&&Array.isArray(bf)&&bf.length>0,ca=ba||"none"===U?void 0:a9,cb=e.useMemo(()=>ba&&Array.isArray(bf)&&a9?bf.map(a=>{let b=M(a,au);return(0,d.jsx)("input",{type:"hidden",name:a9,value:b},b)}):null,[ba,bf,a9,au]),cc=(0,d.jsxs)(e.Fragment,{children:[a.children,(0,d.jsx)("input",{...aP.getInputValidationProps({onFocus(){if(bI)return void bF?.focus();(aZ.current||bF)?.focus()},onChange(a){if(a.nativeEvent.defaultPrevented)return;let b=a.target.value,c=(0,v.d)(w.dv,a.nativeEvent);function d(){if(ba)return;if("none"===U){aG(b!==aH.initialValue),bT(b,c),aI()&&aP.commit(b);return}let a=a6.current.find(a=>M(a,au).toLowerCase()===b.toLowerCase());null!=a&&(aG(a!==aH.initialValue),bV?.(a,c),aI()&&aP.commit(a))}al?d():(bQ(),queueMicrotask(d))}}),id:aQ&&null==ca?`${aQ}-hidden-input`:void 0,name:ca,autoComplete:aC,disabled:a8,required:ai&&!b9,readOnly:ah,value:b8,ref:b6,style:ca?k.a:k.Q,tabIndex:-1,"aria-hidden":!0}),cb]});return(0,d.jsx)(y.Provider,{value:bw,children:(0,d.jsx)(z.Provider,{value:b$,children:(0,d.jsx)(A.Provider,{value:b7,children:(0,d.jsx)(B.Provider,{value:bj,children:cc})})})})}var ag=c(504745),ah=c(577979),ai=c(654277);let aj={...ai.jL,valid:a=>null===a?null:a?{[Q.valid]:""}:{[Q.invalid]:""},popupSide:a=>a?{"data-popup-side":a}:null,listEmpty:a=>a?{"data-list-empty":""}:null},ak=e.createContext(void 0);var al=c(20960);let am=e.createContext(void 0);function an(a){let b=e.useContext(am);if(void 0===b&&!a)throw Error((0,x.A)(21));return b}var ao=c(729406);let ap=e.forwardRef(function(a,b){let{render:c,className:d,disabled:f=!1,id:g,...h}=a,{state:j,disabled:k,setTouched:l,setFocused:m,validationMode:o,validation:p}=S(),{labelId:q}=Z(),r=e.useContext(ak),s=!!an(!0),t=C(),{filteredItems:u}=E(),x=e.useContext(B),y=(0,ao.j)(),z=(0,n.P)(t,N.required),A=(0,n.P)(t,N.disabled),D=(0,n.P)(t,N.readOnly),F=(0,n.P)(t,N.name),G=(0,n.P)(t,N.selectionMode),H=(0,n.P)(t,N.autoHighlight),I=(0,n.P)(t,N.inputProps),J=(0,n.P)(t,N.triggerProps),K=(0,n.P)(t,N.open),L=(0,n.P)(t,N.mounted),M=(0,n.P)(t,N.selectedValue),O=(0,n.P)(t,N.popupSide),P=(0,n.P)(t,N.positionerElement),Q=(0,n.P)(t,N.id),R=(0,n.P)(t,N.inline),T=!!H,U=k||A||f,V=0===u.length,W=s||R,Y=(0,X.e)(g??(W?void 0:Q)),[_,aa]=e.useState(null),ab=e.useRef(!1),ac=e.useRef(null),ad=e.useRef(!1),ae=(0,i.K)(a=>{let b=s||t.state.inline;b&&!t.state.hasInputValue&&t.state.setInputValue("",(0,v.d)(w.dv)),t.update({inputElement:a,inputInsidePopup:b})}),af={...j,open:K,disabled:U,readOnly:D,popupSide:L&&P?O:null,listEmpty:V};return(0,ah.o)("input",a,{state:af,ref:[b,t.state.inputRef,ae],props:[I,J,{type:"text",value:a.value??_??x,"aria-readonly":D||void 0,"aria-required":z||void 0,"aria-labelledby":q,disabled:U,readOnly:D,required:"none"===G?z:void 0,..."none"===G&&F&&{name:F},id:Y,onFocus(){if(m(!0),!R||!ad.current)return;ad.current=!1;let a=ac.current;null!=a&&Object.hasOwn(t.state.valuesRef.current,a)&&t.state.setIndices({activeIndex:a})},onBlur(){l(!0),m(!1);let a=t.state.activeIndex;if(R&&null!==a&&"always"!==H&&(ac.current=a,ad.current=!0,t.state.setIndices({activeIndex:null})),"onBlur"===o){let a="none"===G?x:M;p.commit(a)}},onCompositionStart(a){ag.m0||(ab.current=!0,aa(a.currentTarget.value))},onCompositionEnd(a){ab.current=!1;let b=a.currentTarget.value;aa(null),t.state.setInputValue(b,(0,v.d)(w.pf,a.nativeEvent))},onChange(a){let b=a.nativeEvent.inputType,c=ab.current||!(!b||"insertReplacementText"===b);if(ab.current){let b=a.currentTarget.value;aa(b),""!==b||t.state.openOnInputClick||t.state.inputInsidePopup||t.state.setOpen(!1,(0,v.d)(w.qs,a.nativeEvent));let d=b.trim();!D&&!U&&d&&c&&(t.state.setOpen(!0,(0,v.d)(w.pf,a.nativeEvent)),T||t.state.setIndices({activeIndex:null,selectedIndex:null,type:t.state.keyboardActiveRef.current?"keyboard":"pointer"})),K&&null!==t.state.activeIndex&&!(T&&""!==d)&&t.state.setIndices({activeIndex:null,selectedIndex:null,type:t.state.keyboardActiveRef.current?"keyboard":"pointer"});return}t.state.setInputValue(a.currentTarget.value,(0,v.d)(w.pf,a.nativeEvent));let d=""===a.currentTarget.value,e=(0,v.d)(w.qs,a.nativeEvent);d&&!t.state.inputInsidePopup&&("single"===G&&t.state.setSelectedValue(null,e),t.state.openOnInputClick||t.state.setOpen(!1,e));let f=a.currentTarget.value.trim();!D&&!U&&f&&c&&(t.state.setOpen(!0,(0,v.d)(w.pf,a.nativeEvent)),T||t.state.setIndices({activeIndex:null,selectedIndex:null,type:t.state.keyboardActiveRef.current?"keyboard":"pointer"})),K&&null!==t.state.activeIndex&&!T&&t.state.setIndices({activeIndex:null,selectedIndex:null,type:t.state.keyboardActiveRef.current?"keyboard":"pointer"})},onKeyDown(a){if(U||D||a.ctrlKey||a.shiftKey||a.altKey||a.metaKey)return;t.state.keyboardActiveRef.current=!0;let b=a.currentTarget,c=b.scrollWidth-b.clientWidth,d="rtl"===y;if("Home"===a.key){(0,al.jo)(a);let c=ag.gm&&d?b.value.length:0;b.setSelectionRange(c,c),b.scrollLeft=0;return}if("End"===a.key){(0,al.jo)(a);let e=ag.gm&&d?0:b.value.length;b.setSelectionRange(e,e),b.scrollLeft=d?-c:c;return}if(!L&&"Escape"===a.key){let b="multiple"===G&&Array.isArray(M)?0===M.length:null===M,c=(0,v.d)(w.jv,a.nativeEvent);t.state.setInputValue("",c),t.state.setSelectedValue("multiple"===G?[]:null,c),b||t.state.inline||c.isPropagationAllowed||a.stopPropagation();return}if(r&&"Backspace"===a.key&&""===b.value&&void 0===r.highlightedChipIndex&&Array.isArray(M)&&M.length>0){let b=M.slice(0,-1);t.state.setIndices({activeIndex:null,selectedIndex:null,type:t.state.keyboardActiveRef.current?"keyboard":"pointer"}),t.state.setSelectedValue(b,(0,v.d)(w.dv,a.nativeEvent));return}let e=r?.highlightedChipIndex!==void 0,f=function(a){let b;if(!r)return;let{highlightedChipIndex:c}=r;if(void 0!==c){if("ArrowLeft"===a.key)a.preventDefault(),b=c>0?c-1:void 0;else if("ArrowRight"===a.key)a.preventDefault(),b=c<M.length-1?c+1:void 0;else if("Backspace"===a.key||"Delete"===a.key){a.preventDefault();let d=c>=M.length-1?M.length-2:c;b=d>=0?d:void 0,t.state.setIndices({activeIndex:null,selectedIndex:null,type:"keyboard"})}return b}return"ArrowLeft"===a.key&&(a.currentTarget.selectionStart??0)===0&&M.length>0?(a.preventDefault(),b=Math.max(M.length-1,0)):"Backspace"===a.key&&""===a.currentTarget.value&&M.length>0&&(t.state.setIndices({activeIndex:null,selectedIndex:null,type:"keyboard"}),a.preventDefault()),b}(a);if(r?.setHighlightedChipIndex(f),void 0!==f?r?.chipsRef.current[f]?.focus():e&&t.state.inputRef.current?.focus(),229!==a.which&&"Enter"===a.key&&K){let b=t.state.activeIndex,c=a.nativeEvent;if(null===b)return void t.state.setOpen(!1,(0,v.d)(w.dv,c));(0,al.jo)(a);let d=t.state.listRef.current[b];d&&(t.state.selectionEventRef.current=c,d.click(),t.state.selectionEventRef.current=null)}},onPointerMove(){t.state.keyboardActiveRef.current=!1},onPointerDown(){t.state.keyboardActiveRef.current=!1}},p?p.getValidationProps(h):h],stateAttributesMapping:aj})});var aq=c(402831);let ar=e.createContext(void 0),as=e.forwardRef(function(a,b){let{keepMounted:c=!1,...e}=a,f=C(),g=(0,n.P)(f,N.mounted),h=(0,n.P)(f,N.forceMounted);return g||c||h?(0,d.jsx)(ar.Provider,{value:c,children:(0,d.jsx)(aq.XF,{ref:b,...e})}):null});var at=c(640023),au=c(568069),av=c(275819),aw=c(293863),ax=c(994152),ay=c(929035);let az=e.forwardRef(function(a,b){let{render:c,className:f,anchor:h,positionMethod:j="absolute",side:k="bottom",align:l="center",sideOffset:m=0,alignOffset:o=0,collisionBoundary:p="clipping-ancestors",collisionPadding:q=5,arrowPadding:r=5,sticky:s=!1,disableAnchorTracking:t=!1,collisionAvoidance:u=aw.uD,...v}=a,w=C(),{filteredItems:y}=E(),z=D(),A=function(){let a=e.useContext(ar);if(void 0===a)throw Error((0,x.A)(20));return a}(),B=(0,n.P)(w,N.modal),F=(0,n.P)(w,N.open),G=(0,n.P)(w,N.mounted),H=(0,n.P)(w,N.openMethod),I=(0,n.P)(w,N.triggerElement),J=(0,n.P)(w,N.inputElement),K=(0,n.P)(w,N.inputInsidePopup),L=(0,n.P)(w,N.transitionStatus),M=0===y.length,O=h??(K?I:J),P=(0,av.s)({anchor:O,floatingRootContext:z,positionMethod:j,mounted:G,side:k,sideOffset:m,align:l,alignOffset:o,arrowPadding:r,collisionBoundary:p,collisionPadding:q,sticky:s,disableAnchorTracking:t,keepMounted:A,collisionAvoidance:u,lazyFlip:!0});(0,au.K)(F&&B&&"touch"!==H,I);let Q=e.useMemo(()=>{let a={...P.positionerStyles};return F||(a.pointerEvents="none"),{role:"presentation",hidden:!G,style:a}},[F,G,P.positionerStyles]),R={open:F,side:P.side,align:P.align,anchorHidden:P.anchorHidden,empty:M};(0,g.g)(()=>{w.set("popupSide",P.side)},[w,P.side]);let S=e.useMemo(()=>({side:P.side,align:P.align,arrowRef:P.arrowRef,arrowUncentered:P.arrowUncentered,arrowStyles:P.arrowStyles,anchorHidden:P.anchorHidden,isPositioned:P.isPositioned}),[P.side,P.align,P.arrowRef,P.arrowUncentered,P.arrowStyles,P.anchorHidden,P.isPositioned]),T=(0,i.K)(a=>{w.set("positionerElement",a)}),U=(0,ah.o)("div",a,{state:R,ref:[b,T],props:[Q,(0,ax.d)(L),v],stateAttributesMapping:ai.GW});return(0,d.jsxs)(am.Provider,{value:S,children:[G&&B&&(0,d.jsx)(ay.W,{inert:(0,at.Y)(!F),cutout:J??I}),U]})});var aA=c(474228),aB=c(238978);let aC={...ai.GW,...aB.G},aD=e.forwardRef(function(a,b){let c,{render:e,className:f,initialFocus:g,finalFocus:h,...i}=a,j=C(),k=an(),l=D(),{filteredItems:m}=E(),o=(0,n.P)(j,N.mounted),p=(0,n.P)(j,N.open),q=(0,n.P)(j,N.openMethod),r=(0,n.P)(j,N.transitionStatus),s=(0,n.P)(j,N.inputInsidePopup),t=(0,n.P)(j,N.inputElement),v=0===m.length;(0,O.v)({open:p,ref:j.state.popupRef,onComplete(){p&&j.state.onOpenChangeComplete(!0)}});let w={open:p,side:k.side,align:k.align,anchorHidden:k.anchorHidden,transitionStatus:r,empty:v},x=(0,ah.o)("div",a,{state:w,ref:[b,j.state.popupRef],props:[{role:s?"dialog":"presentation",tabIndex:-1,onFocus(a){let b=(0,u.EW)(a.nativeEvent);"touch"!==q&&((0,u.gR)(j.state.listElement,b)||b===a.currentTarget)&&j.state.inputRef.current?.focus()}},(0,ax.d)(r),i],stateAttributesMapping:aC}),y=!!s&&(a=>"touch"===a?j.state.popupRef.current:t);return c=null!=h?h:!!s&&void 0,(0,d.jsx)(aA.s,{context:l,disabled:!o,modal:!s,openInteractionType:q,initialFocus:void 0===g?y:g,returnFocus:c,children:x})}),aE=e.createContext(null);function aF(a){let{children:b}=a,{filteredItems:c}=E(),f=e.useContext(aE),g=f?f.items:c;return g?(0,d.jsx)(e.Fragment,{children:g.map(b)}):null}var aG=c(987038);let aH=e.forwardRef(function(a,b){var c;let{render:f,className:g,children:h,...j}=a,k=C(),l=D(),m=!!an(!0),{filteredItems:o}=E(),p=(0,n.P)(k,N.items),q=(0,n.P)(k,N.labelsRef),r=(0,n.P)(k,N.listRef),s=(0,n.P)(k,N.selectionMode),t=(0,n.P)(k,N.grid),u=(0,n.P)(k,N.popupProps),v=(0,n.P)(k,N.disabled),w=(0,n.P)(k,N.readOnly),x=(0,n.P)(k,N.virtualized),y=0===o.length,z=(0,i.K)(a=>{k.set("positionerElement",a)}),A=(0,i.K)(a=>{k.set("listElement",a)}),B=e.useMemo(()=>"function"==typeof h?c||(c=(0,d.jsx)(aF,{children:h})):h,[h]),F=l.useState("floatingId"),G=(0,ah.o)("div",a,{state:{empty:y},ref:[b,A,m?null:z],props:[u,{children:B,tabIndex:-1,id:F,role:t?"grid":"listbox","aria-multiselectable":"multiple"===s?"true":void 0,onKeyDown(a){if(!v&&!w&&"Enter"===a.key){let b=k.state.activeIndex;if(null==b)return;(0,al.jo)(a);let c=a.nativeEvent,d=k.state.listRef.current[b];d&&(k.state.selectionEventRef.current=c,d.click(),k.state.selectionEventRef.current=null)}},onKeyDownCapture(){k.state.keyboardActiveRef.current=!0},onPointerMoveCapture(){k.state.keyboardActiveRef.current=!1}},j]});return x?G:(0,d.jsx)(aG.u,{elementsRef:r,labelsRef:p?void 0:q,children:G})});var aI=c(360412);let aJ=e.createContext(void 0);var aK=c(642228);let aL=e.createContext(!1),aM=e.memo(e.forwardRef(function(a,b){let{render:c,className:f,value:h=null,index:i,disabled:j=!1,nativeButton:k=!1,...l}=a,m=e.useRef(!1),o=e.useRef(null),p=(0,aI.q)({index:i,textRef:o,indexGuessBehavior:aI.G.GuessFromOrder}),q=C(),r=e.useContext(aL),{flatFilteredItems:s,hasItems:t}=E(),u=(0,n.P)(q,N.open),v=(0,n.P)(q,N.selectionMode),w=(0,n.P)(q,N.readOnly),x=(0,n.P)(q,N.virtualized),y=(0,n.P)(q,N.isItemEqualToValue),z="none"!==v,A=i??(x?I(s,h,y):p.index),B=-1!==p.index,D=(0,n.P)(q,N.id),F=(0,n.P)(q,N.isActive,A),G=(0,n.P)(q,N.isSelected,h),J=(0,n.P)(q,N.getItemProps),K=e.useRef(null),L=null!=D&&B?`${D}-${A}`:void 0,M=G&&z;(0,g.g)(()=>{if(!(B&&(x||null!=i)))return;let a=q.state.listRef.current;return a[A]=K.current,()=>{delete a[A]}},[B,x,A,i,q]),(0,g.g)(()=>{if(!B||t)return;let a=q.state.valuesRef.current;return a[A]=h,"none"!==v&&q.state.allValuesRef.current.push(h),()=>{delete a[A]}},[B,t,A,h,q,v]),(0,g.g)(()=>{if(!u){m.current=!1;return}if(!B||t)return;let a=q.state.selectedValue;H(h,Array.isArray(a)?a[a.length-1]:a,y)&&q.set("selectedIndex",A)},[B,t,u,q,A,h,y]);let O=J({active:F,selected:M});O.id=void 0,O.onFocus=void 0;let{getButtonProps:P,buttonRef:Q}=(0,aK.s)({disabled:j,focusableWhenDisabled:!0,native:k});function R(a){function b(){q.state.handleSelection(a,h)}q.state.submitOnItemClick?(T.flushSync(b),q.state.requestSubmit()):b()}let S=(0,ah.o)("div",a,{ref:[Q,b,p.ref,K],state:{disabled:j,selected:M,highlighted:F},props:[O,{id:L,role:r?"gridcell":"option","aria-selected":z?M:void 0,tabIndex:void 0,onPointerDownCapture(a){m.current=!0,a.preventDefault()},onClick(a){j||w||R(a.nativeEvent)},onMouseUp(a){let b=m.current;m.current=!1,j||w||0!==a.button||b||!F||R(a.nativeEvent)}},l,P]}),U=e.useMemo(()=>({selected:M,textRef:o}),[M,o]);return(0,d.jsx)(aJ.Provider,{value:U,children:S})}));var aN=c(165046);let aO=function(a){let{multiple:b=!1,defaultValue:c,value:e,onValueChange:f,autoComplete:g,...h}=a;return(0,d.jsx)(af,{...h,selectionMode:b?"multiple":"single",selectedValue:e,defaultSelectedValue:c,onSelectedValueChange:f,formAutoComplete:g})},aP=e.forwardRef(({className:a,...b},c)=>(0,d.jsx)(ap,{ref:c,"data-slot":"combobox-input",className:(0,aN.cn)("w-full rounded-xl py-2 text-sm outline-none transition-colors",a),...b}));function aQ({className:a,side:b="bottom",sideOffset:c=8,align:e="start",alignOffset:f=0,anchor:g,...h}){return(0,d.jsx)(as,{children:(0,d.jsx)(az,{side:b,sideOffset:c,align:e,alignOffset:f,anchor:g,className:"isolate z-[10000]",children:(0,d.jsx)(aD,{"data-slot":"combobox-content",className:(0,aN.cn)("bg-neutral-100/[0.67] dark:bg-neutral-900/[0.67] border border-white dark:border-white/10 backdrop-blur-md text-[var(--color-text)] max-h-[var(--available-height)] w-[calc(var(--anchor-width)+48px)] overflow-hidden rounded-3xl p-1 shadow-[0_0_25px_0_rgba(0,0,0,0.16)] outline-none","data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",a),...h})})})}function aR({className:a,...b}){return(0,d.jsx)(aH,{"data-slot":"combobox-list",className:(0,aN.cn)("max-h-[300px] overflow-y-auto overscroll-contain thin-scrollbar",a),...b})}function aS({className:a,children:b,...c}){return(0,d.jsx)(aM,{"data-slot":"combobox-item",className:(0,aN.cn)("bg-transparent data-highlighted:bg-neutral-400/15 text-sm transition-all relative flex w-full cursor-pointer items-center gap-2.5 rounded-2xl px-3 py-2 outline-none select-none","data-disabled:pointer-events-none data-disabled:opacity-50",a),...c,children:b})}aP.displayName="ComboboxInput";var aT=c(941809),aU=c(896703),aV=c(490654),aW=c(75567);function aX(a){return(0,aW.k5)({tag:"svg",attr:{viewBox:"0 0 24 24"},child:[{tag:"path",attr:{d:"M7.875 2.292a.114.114 0 0 0-.032.018A7.239 7.239 0 0 0 4.75 8.25a7.248 7.248 0 0 0 3.654 6.297c.57.327.982.955.941 1.682v.002l-.317 6.058a.75.75 0 1 1-1.498-.078l.317-6.062v-.004c.006-.09-.047-.215-.188-.296A8.749 8.749 0 0 1 3.25 8.25a8.738 8.738 0 0 1 3.732-7.169 1.547 1.547 0 0 1 1.709-.064c.484.292.809.835.809 1.46v4.714a.25.25 0 0 0 .119.213l2.25 1.385c.08.05.182.05.262 0l2.25-1.385a.25.25 0 0 0 .119-.213V2.478c0-.626.325-1.169.81-1.461a1.547 1.547 0 0 1 1.708.064 8.741 8.741 0 0 1 3.732 7.17 8.747 8.747 0 0 1-4.41 7.598c-.14.081-.193.206-.188.296v.004l.318 6.062a.75.75 0 1 1-1.498.078l-.317-6.058v-.002c-.041-.727.37-1.355.94-1.682A7.247 7.247 0 0 0 19.25 8.25a7.239 7.239 0 0 0-3.093-5.94.114.114 0 0 0-.032-.018l-.01-.001c-.003 0-.014 0-.031.01-.036.022-.084.079-.084.177V7.19c0 .608-.315 1.172-.833 1.49l-2.25 1.385a1.75 1.75 0 0 1-1.834 0l-2.25-1.384A1.752 1.752 0 0 1 8 7.192V2.477c0-.098-.048-.155-.084-.176a.068.068 0 0 0-.031-.011l-.01.001Z"},child:[]}]})(a)}function aY(a){return(0,aW.k5)({tag:"svg",attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M2.5 7C2.5 9.48528 4.51472 11.5 7 11.5C9.48528 11.5 11.5 9.48528 11.5 7C11.5 4.51472 9.48528 2.5 7 2.5C4.51472 2.5 2.5 4.51472 2.5 7ZM2.5 17C2.5 19.4853 4.51472 21.5 7 21.5C9.48528 21.5 11.5 19.4853 11.5 17C11.5 14.5147 9.48528 12.5 7 12.5C4.51472 12.5 2.5 14.5147 2.5 17ZM12.5 17C12.5 19.4853 14.5147 21.5 17 21.5C19.4853 21.5 21.5 19.4853 21.5 17C21.5 14.5147 19.4853 12.5 17 12.5C14.5147 12.5 12.5 14.5147 12.5 17ZM9.5 7C9.5 8.38071 8.38071 9.5 7 9.5C5.61929 9.5 4.5 8.38071 4.5 7C4.5 5.61929 5.61929 4.5 7 4.5C8.38071 4.5 9.5 5.61929 9.5 7ZM9.5 17C9.5 18.3807 8.38071 19.5 7 19.5C5.61929 19.5 4.5 18.3807 4.5 17C4.5 15.6193 5.61929 14.5 7 14.5C8.38071 14.5 9.5 15.6193 9.5 17ZM19.5 17C19.5 18.3807 18.3807 19.5 17 19.5C15.6193 19.5 14.5 18.3807 14.5 17C14.5 15.6193 15.6193 14.5 17 14.5C18.3807 14.5 19.5 15.6193 19.5 17ZM17.5252 11.155L17.8026 10.5186C18.297 9.38398 19.1876 8.48059 20.2988 7.98638L21.1534 7.60631C21.6155 7.4008 21.6155 6.7284 21.1534 6.52289L20.3467 6.16406C19.2068 5.65713 18.3002 4.72031 17.8143 3.54712L17.5295 2.85945C17.3309 2.38018 16.669 2.38018 16.4705 2.85945L16.1856 3.54712C15.6997 4.72031 14.7932 5.65713 13.6534 6.16406L12.8466 6.52289C12.3845 6.7284 12.3845 7.4008 12.8466 7.60631L13.7011 7.98638C14.8124 8.48059 15.7029 9.38398 16.1974 10.5186L16.4748 11.155C16.6778 11.6209 17.3222 11.6209 17.5252 11.155Z"},child:[]}]})(a)}var aZ=c(826948),a$=c(57137),a_=c(489619),a0=c(86839),a1=c(981188);function a2(a){let b=a.path??a.id,c=b.split("/").pop()??a.label;return{name:"object"===a.kind?(0,a0.PV)(a.label):c,path:b,type:a.nodeType??("object"===a.kind?"folder":"file")}}function a3(){let{resolvedTheme:a,setTheme:b}=(0,aZ.D)(),[c,f]=(0,e.useState)(!1);if(!c)return(0,d.jsx)("div",{className:"w-[26px] h-[26px]"});let g="dark"===a;return(0,d.jsx)("button",{type:"button",onClick:()=>b(g?"light":"dark"),className:"p-1.5 rounded-lg transition-colors",style:{color:"var(--color-text-muted)"},onMouseEnter:a=>{a.currentTarget.style.background="var(--color-surface-hover)"},onMouseLeave:a=>{a.currentTarget.style.background="transparent"},title:g?"Switch to light mode":"Switch to dark mode",children:g?(0,d.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("circle",{cx:"12",cy:"12",r:"4"}),(0,d.jsx)("path",{d:"M12 2v2"}),(0,d.jsx)("path",{d:"M12 20v2"}),(0,d.jsx)("path",{d:"m4.93 4.93 1.41 1.41"}),(0,d.jsx)("path",{d:"m17.66 17.66 1.41 1.41"}),(0,d.jsx)("path",{d:"M2 12h2"}),(0,d.jsx)("path",{d:"M20 12h2"}),(0,d.jsx)("path",{d:"m6.34 17.66-1.41 1.41"}),(0,d.jsx)("path",{d:"m19.07 4.93-1.41 1.41"})]}):(0,d.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,d.jsx)("path",{d:"M12 3a6 6 0 0 0 9 9 9 9 0 1 1-9-9Z"})})})}function a4(){return(0,d.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("circle",{cx:"11",cy:"11",r:"8"}),(0,d.jsx)("path",{d:"m21 21-4.3-4.3"})]})}function a5({type:a}){switch(a){case"folder":return(0,d.jsx)(aT.A,{size:16,style:{flexShrink:0,color:"#60a5fa"}});case"document":default:return(0,d.jsx)(aU.A,{size:16,style:{flexShrink:0,opacity:.7}});case"database":return(0,d.jsx)(aV.A,{size:16,style:{flexShrink:0}})}}function a6({onSelect:a,searchFn:b}){let[c,f]=(0,e.useState)([]),[g,h]=(0,e.useState)(!1),[i,j]=(0,e.useState)(""),k=(0,e.useRef)(!1),l=(0,e.useRef)(null),m=(0,e.useRef)(null),n=(0,e.useCallback)(a=>{if(k.current){k.current=!1;return}if(j(a),!a.trim()){f([]),h(!1);return}b?(f(b(a.trim(),20).map(a2)),h(!0)):(l.current&&clearTimeout(l.current),l.current=setTimeout(async()=>{try{let b=await fetch(`/api/workspace/suggest-files?q=${encodeURIComponent(a.trim())}`),c=await b.json();f(c.items??[]),h(!0)}catch{f([])}},150))},[b]);return(0,d.jsxs)(aO,{value:null,open:g,onOpenChange:a=>{a||h(!1)},onValueChange:b=>{b&&(k.current=!0,a(b),h(!1),j(""),f([]))},onInputValueChange:n,filter:null,itemToStringLabel:()=>"",children:[(0,d.jsxs)("div",{ref:m,className:"relative",children:[(0,d.jsx)("span",{className:"absolute left-3 top-1/2 -translate-y-1/2 pointer-events-none z-10",style:{color:"var(--color-text-muted)"},children:(0,d.jsx)(a4,{})}),(0,d.jsx)(aP,{placeholder:"Search",className:"w-full pl-9 pr-10 py-1.5 rounded-xl text-sm outline-none transition-colors",style:{background:"var(--color-surface-hover)",color:"var(--color-text)"}})]}),(0,d.jsxs)(aQ,{anchor:m,children:[(0,d.jsx)(aR,{children:c.map(a=>(0,d.jsxs)(aS,{value:a,children:[(0,d.jsx)("span",{className:"flex-shrink-0",style:{color:"var(--color-text-muted)",opacity:.55},children:(0,d.jsx)(a5,{type:a.type})}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("div",{className:"truncate font-medium",children:a.name}),(0,d.jsx)("div",{className:"truncate text-xs",style:{color:"var(--color-text-muted)"},children:a.path.split("/").slice(0,-1).join("/")})]})]},a.path))}),i.trim()&&0===c.length&&(0,d.jsx)("div",{className:"py-3 text-center text-sm",style:{color:"var(--color-text-muted)"},children:"No files found"})]})]})}function a7({orgName:a,onFileSearchSelect:b,mobile:c,onClose:f,showHidden:g,onToggleHidden:h,width:i,onCollapse:j,compact:k=!1,onToggleCompact:l,activeWorkspace:m,onWorkspaceChanged:n,onNavigate:o,activeCrmTarget:p=null,customCrmObjects:q,activeCrmObjectName:r=null,onNavigateToCrmObject:s,chatsPanel:t,onNewChatSession:u}){let v=c?"280px":i??260,[w,x]=(0,e.useState)(!1),[y,z]=(0,e.useState)("home"),A=[{id:"crm-people",label:"People",target:"people",icon:(0,d.jsxs)("svg",{className:"h-4 w-4 shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,d.jsx)("path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2"}),(0,d.jsx)("circle",{cx:"9",cy:"7",r:"4"}),(0,d.jsx)("path",{d:"M22 21v-2a4 4 0 0 0-3-3.87"}),(0,d.jsx)("path",{d:"M16 3.13a4 4 0 0 1 0 7.75"})]})},{id:"crm-companies",label:"Companies",target:"companies",icon:(0,d.jsxs)("svg",{className:"h-4 w-4 shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,d.jsx)("path",{d:"M3 21h18"}),(0,d.jsx)("path",{d:"M5 21V7l8-4v18"}),(0,d.jsx)("path",{d:"M19 21V11l-6-4"}),(0,d.jsx)("path",{d:"M9 9h0"}),(0,d.jsx)("path",{d:"M9 13h0"}),(0,d.jsx)("path",{d:"M9 17h0"})]})},{id:"crm-inbox",label:"Inbox",target:"inbox",icon:(0,d.jsxs)("svg",{className:"h-4 w-4 shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,d.jsx)("polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12"}),(0,d.jsx)("path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11Z"})]})},{id:"crm-calendar",label:"Calendar",target:"calendar",icon:(0,d.jsxs)("svg",{className:"h-4 w-4 shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,d.jsx)("rect",{x:"3",y:"4",width:"18",height:"18",rx:"2",ry:"2"}),(0,d.jsx)("line",{x1:"16",y1:"2",x2:"16",y2:"6"}),(0,d.jsx)("line",{x1:"8",y1:"2",x2:"8",y2:"6"}),(0,d.jsx)("line",{x1:"3",y1:"10",x2:"21",y2:"10"})]})}],B=[{id:"cloud",label:"Cloud",icon:(0,d.jsx)("svg",{className:"h-4 w-4 shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:(0,d.jsx)("path",{d:"M17.5 19H9a7 7 0 1 1 6.71-9h1.79a4.5 4.5 0 1 1 0 9Z"})})},{id:"integrations",label:"Integrations",icon:(0,d.jsx)(aY,{className:"h-4 w-4 shrink-0","aria-hidden":!0})},{id:"skills",label:"Skills",icon:(0,d.jsx)(aX,{className:"h-4 w-4 shrink-0","aria-hidden":!0})},{id:"cron",label:"Cron",icon:(0,d.jsxs)("svg",{className:"h-4 w-4 shrink-0",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,d.jsx)("circle",{cx:"12",cy:"12",r:"10"}),(0,d.jsx)("polyline",{points:"12 6 12 12 16 14"})]})}],C=(0,d.jsxs)("aside",{className:"flex flex-col h-screen shrink-0 border-r",style:{width:"number"==typeof v?`${v}px`:v,minWidth:"number"==typeof v?`${v}px`:v,background:"var(--color-bg)",borderColor:"var(--color-border)"},children:[l&&(0,d.jsx)("div",{className:"flex items-center justify-center h-[44px] shrink-0",children:(0,d.jsx)("button",{type:"button",onClick:l,className:"w-9 h-9 rounded-lg flex items-center justify-center transition-colors",style:{color:"var(--color-text-muted)"},onMouseEnter:a=>{a.currentTarget.style.background="var(--color-surface-hover)"},onMouseLeave:a=>{a.currentTarget.style.background="transparent"},title:"Expand sidebar",children:(0,d.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}),(0,d.jsx)("path",{d:"M15 3v18"})]})})}),(0,d.jsx)("div",{className:"flex items-center justify-center pb-0.5 shrink-0",children:(0,d.jsx)(a$.N,{activeWorkspaceHint:m??null,onWorkspaceSwitch:()=>{n?.()},onWorkspaceDelete:()=>{n?.()},onCreateWorkspace:()=>{x(!0)},trigger:({onClick:b,activeWorkspace:c,switching:e})=>(0,d.jsx)("button",{type:"button",onClick:b,disabled:e,className:"w-7 h-7 mx-auto rounded-lg overflow-hidden flex items-center justify-center transition-opacity hover:opacity-90",title:`${a||"Workspace"}${c?` — ${c}`:""}`,children:(0,d.jsx)("img",{src:"/dench-workspace-icon.png",alt:"",className:"w-7 h-7 object-cover",draggable:!1})})})}),o&&(0,d.jsxs)("div",{className:"flex flex-col items-center gap-0.5 pt-1 pb-1",children:[A.map(a=>{let b=p===a.target;return(0,d.jsx)("button",{type:"button",onClick:()=>o(a.id),className:"w-9 h-9 rounded-lg flex items-center justify-center transition-colors",style:{color:"var(--color-text)",background:b?"var(--color-surface-hover)":"transparent"},onMouseEnter:a=>{b||(a.currentTarget.style.background="var(--color-surface-hover)")},onMouseLeave:a=>{b||(a.currentTarget.style.background="transparent")},title:a.label,"aria-label":a.label,children:a.icon},a.id)}),q&&q.length>0&&s&&q.map(a=>{let b=r===a.name,c=(0,a0.PV)(a.name);return(0,d.jsx)("button",{type:"button",onClick:()=>s(a.name),className:"w-9 h-9 rounded-lg flex items-center justify-center transition-colors",style:{color:"var(--color-text)",background:b?"var(--color-surface-hover)":"transparent"},onMouseEnter:a=>{b||(a.currentTarget.style.background="var(--color-surface-hover)")},onMouseLeave:a=>{b||(a.currentTarget.style.background="transparent")},title:c,"aria-label":c,children:(0,d.jsx)(a1.P,{name:a.icon,size:16})},`crm-object-${a.name}`)})]}),(0,d.jsx)("div",{className:"flex-1 min-h-0"}),o&&(0,d.jsx)("div",{className:"flex flex-col items-center gap-0.5 py-1",children:B.map(a=>(0,d.jsx)("button",{type:"button",onClick:()=>o(a.id),className:"w-9 h-9 rounded-lg flex items-center justify-center transition-colors",style:{color:"var(--color-text)"},onMouseEnter:a=>{a.currentTarget.style.background="var(--color-surface-hover)"},onMouseLeave:a=>{a.currentTarget.style.background="transparent"},title:a.label,"aria-label":a.label,children:a.icon},a.id))}),(0,d.jsxs)("div",{className:"flex flex-col items-center py-1.5 gap-0.5",children:[h&&(0,d.jsx)("button",{type:"button",onClick:h,className:"w-9 h-9 rounded-lg flex items-center justify-center transition-colors",style:{color:g?"var(--color-text)":"var(--color-text-muted)"},onMouseEnter:a=>{a.currentTarget.style.background="var(--color-surface-hover)"},onMouseLeave:a=>{a.currentTarget.style.background="transparent"},title:g?"Hide dotfiles":"Show dotfiles",children:(0,d.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:g?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"}),(0,d.jsx)("circle",{cx:"12",cy:"12",r:"3"})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49"}),(0,d.jsx)("path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242"}),(0,d.jsx)("path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143"}),(0,d.jsx)("path",{d:"m2 2 20 20"})]})})}),(0,d.jsx)(a3,{})]})]}),D=(0,d.jsxs)("aside",{className:`flex flex-col h-screen shrink-0 ${c?"drawer-left":"border-r"}`,style:{width:"number"==typeof v?`${v}px`:v,minWidth:"number"==typeof v?`${v}px`:v,background:"var(--color-bg)",borderColor:"var(--color-border)"},children:[(0,d.jsxs)("div",{className:"flex items-center gap-1 px-2 h-[44px] shrink-0",children:[(0,d.jsx)("div",{className:"flex-1 min-w-0",children:(0,d.jsx)(a$.N,{activeWorkspaceHint:m??null,onWorkspaceSwitch:()=>{n?.()},onWorkspaceDelete:()=>{n?.()},onCreateWorkspace:()=>{x(!0)},trigger:({onClick:b,activeWorkspace:c,switching:e})=>(0,d.jsxs)("button",{type:"button",onClick:b,disabled:e,className:"text-[13px] flex items-center gap-1.5 truncate w-full transition-colors rounded-lg px-2 py-1.5",style:{color:"var(--color-text)"},onMouseEnter:a=>{a.currentTarget.style.background="var(--color-surface-hover)"},onMouseLeave:a=>{a.currentTarget.style.background="transparent"},title:"Switch workspace",children:[(0,d.jsx)("span",{className:"truncate font-semibold",children:a||"Workspace"}),c&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("span",{className:"shrink-0 opacity-40",children:"/"}),(0,d.jsx)("span",{className:"truncate text-[12px]",style:{color:"var(--color-text-muted)"},children:c})]}),(0,d.jsx)("span",{className:"flex-1"}),(0,d.jsx)("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"shrink-0",style:{color:"var(--color-text-muted)"},children:(0,d.jsx)("path",{d:"m6 9 6 6 6-6"})})]})})}),(l||j)&&(0,d.jsx)("button",{type:"button",onClick:l??j,className:"p-1.5 rounded-lg shrink-0 transition-colors",style:{color:"var(--color-text-muted)"},onMouseEnter:a=>{a.currentTarget.style.background="var(--color-surface-hover)"},onMouseLeave:a=>{a.currentTarget.style.background="transparent"},title:l?"Collapse to icons":"Hide sidebar (⌘B)",children:(0,d.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,d.jsx)("rect",{width:"18",height:"18",x:"3",y:"3",rx:"2"}),(0,d.jsx)("path",{d:"M9 3v18"})]})})]}),t&&(0,d.jsxs)("div",{className:"px-2 pt-1 pb-1 flex items-center gap-1",children:[[{id:"home",label:"Home"},{id:"chats",label:"Chats"}].map(a=>{let b=y===a.id;return(0,d.jsx)("button",{type:"button",onClick:()=>z(a.id),className:"flex-1 px-2 py-1 rounded-md text-[12px] font-medium transition-colors cursor-pointer",style:{color:b?"var(--color-text)":"var(--color-text-muted)",background:b?"var(--color-surface-hover)":"transparent"},onMouseEnter:a=>{b||(a.currentTarget.style.background="var(--color-surface-hover)")},onMouseLeave:a=>{b||(a.currentTarget.style.background="transparent")},children:a.label},a.id)}),"chats"===y&&u&&(0,d.jsx)("button",{type:"button",onClick:u,className:"p-1 rounded-md transition-colors cursor-pointer shrink-0",style:{color:"var(--color-text-muted)"},onMouseEnter:a=>{a.currentTarget.style.background="var(--color-surface-hover)"},onMouseLeave:a=>{a.currentTarget.style.background="transparent"},title:"New chat","aria-label":"New chat",children:(0,d.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0,children:[(0,d.jsx)("path",{d:"M5 12h14"}),(0,d.jsx)("path",{d:"M12 5v14"})]})})]}),"chats"===y&&t?(0,d.jsx)("div",{className:"flex-1 min-h-0 flex flex-col relative",children:t}):(0,d.jsxs)(d.Fragment,{children:[o&&(0,d.jsxs)("div",{className:"px-2 pt-1 pb-1",children:[(0,d.jsx)("div",{className:"px-2 pt-2 pb-1 text-[9px] lowercase",style:{color:"var(--color-text-muted)",letterSpacing:"0.05em"},children:"workspace"}),(0,d.jsxs)("div",{className:"space-y-0.5",children:[A.map(a=>{let b=p===a.target;return(0,d.jsxs)("button",{type:"button",onClick:()=>o(a.id),className:"w-full flex items-center gap-2.5 px-2 py-1.5 rounded-lg text-[13px] transition-colors",style:{color:"var(--color-text)",background:b?"var(--color-surface-hover)":"transparent"},onMouseEnter:a=>{b||(a.currentTarget.style.background="var(--color-surface-hover)")},onMouseLeave:a=>{b||(a.currentTarget.style.background="transparent")},children:[(0,d.jsx)("span",{className:"shrink-0",style:{color:"var(--color-text-muted)"},children:a.icon}),a.label]},a.id)}),q&&q.length>0&&s&&q.map(a=>{let b=r===a.name,c=(0,a0.PV)(a.name);return(0,d.jsxs)("button",{type:"button",onClick:()=>s(a.name),className:"w-full flex items-center gap-2.5 px-2 py-1.5 rounded-lg text-[13px] transition-colors",style:{color:"var(--color-text)",background:b?"var(--color-surface-hover)":"transparent"},onMouseEnter:a=>{b||(a.currentTarget.style.background="var(--color-surface-hover)")},onMouseLeave:a=>{b||(a.currentTarget.style.background="transparent")},title:c,children:[(0,d.jsx)("span",{className:"shrink-0",style:{color:"var(--color-text-muted)"},children:(0,d.jsx)(a1.P,{name:a.icon,size:16})}),c]},`crm-object-${a.name}`)})]})]}),(0,d.jsx)("div",{className:"flex-1 min-h-0"}),o&&(0,d.jsx)("div",{className:"px-2 py-1 space-y-0.5",children:B.map(a=>(0,d.jsxs)("button",{type:"button",onClick:()=>o(a.id),className:"w-full flex items-center gap-2.5 px-2 py-1.5 rounded-lg text-[13px] transition-colors",style:{color:"var(--color-text)"},onMouseEnter:a=>{a.currentTarget.style.background="var(--color-surface-hover)"},onMouseLeave:a=>{a.currentTarget.style.background="transparent"},children:[(0,d.jsx)("span",{className:"shrink-0",style:{color:"var(--color-text-muted)"},children:a.icon}),a.label]},a.id))})]}),(0,d.jsxs)("div",{className:"px-2 py-1.5 flex items-center justify-between",children:[(0,d.jsxs)("a",{href:"https://dench.com",target:"_blank",rel:"noopener noreferrer",className:"flex items-center gap-2 px-2 py-1 rounded-lg text-[11px]",style:{color:"var(--color-text-muted)"},children:["dench.com"," v3.0.8"]}),(0,d.jsxs)("div",{className:"flex items-center gap-0.5",children:[h&&(0,d.jsx)("button",{type:"button",onClick:h,className:"p-1.5 rounded-lg transition-colors",style:{color:g?"var(--color-text)":"var(--color-text-muted)"},title:g?"Hide dotfiles":"Show dotfiles",children:(0,d.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:g?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("path",{d:"M2.062 12.348a1 1 0 0 1 0-.696 10.75 10.75 0 0 1 19.876 0 1 1 0 0 1 0 .696 10.75 10.75 0 0 1-19.876 0"}),(0,d.jsx)("circle",{cx:"12",cy:"12",r:"3"})]}):(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("path",{d:"M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49"}),(0,d.jsx)("path",{d:"M14.084 14.158a3 3 0 0 1-4.242-4.242"}),(0,d.jsx)("path",{d:"M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143"}),(0,d.jsx)("path",{d:"m2 2 20 20"})]})})}),(0,d.jsx)(a3,{})]})]})]});return c?(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)("div",{className:"drawer-backdrop",onClick:()=>void f?.(),children:(0,d.jsx)("div",{onClick:a=>a.stopPropagation(),className:"fixed inset-y-0 left-0 z-50",children:D})}),(0,d.jsx)(a_.s,{isOpen:w,onClose:()=>x(!1),onCreated:()=>{n?.()}})]}):(0,d.jsxs)(d.Fragment,{children:[!c&&k?C:D,(0,d.jsx)(a_.s,{isOpen:w,onClose:()=>x(!1),onCreated:()=>{n?.()}})]})}},685343:(a,b,c)=>{"use strict";c.d(b,{A:()=>d});var d=c(95253)._0},686937:a=>{"use strict";var b=Object.prototype.hasOwnProperty,c=Object.prototype.toString,d=Object.defineProperty,e=Object.getOwnPropertyDescriptor,f=function(a){return"function"==typeof Array.isArray?Array.isArray(a):"[object Array]"===c.call(a)},g=function(a){if(!a||"[object Object]"!==c.call(a))return!1;var d,e=b.call(a,"constructor"),f=a.constructor&&a.constructor.prototype&&b.call(a.constructor.prototype,"isPrototypeOf");if(a.constructor&&!e&&!f)return!1;for(d in a);return void 0===d||b.call(a,d)},h=function(a,b){d&&"__proto__"===b.name?d(a,b.name,{enumerable:!0,configurable:!0,value:b.newValue,writable:!0}):a[b.name]=b.newValue},i=function(a,c){if("__proto__"===c){if(!b.call(a,c))return;else if(e)return e(a,c).value}return a[c]};a.exports=function a(){var b,c,d,e,j,k,l=arguments[0],m=1,n=arguments.length,o=!1;for("boolean"==typeof l&&(o=l,l=arguments[1]||{},m=2),(null==l||"object"!=typeof l&&"function"!=typeof l)&&(l={});m<n;++m)if(b=arguments[m],null!=b)for(c in b)d=i(l,c),l!==(e=i(b,c))&&(o&&e&&(g(e)||(j=f(e)))?(j?(j=!1,k=d&&f(d)?d:[]):k=d&&g(d)?d:{},h(l,{name:c,newValue:a(o,k,e)})):void 0!==e&&h(l,{name:c,newValue:e}));return l}},688094:(a,b,c)=>{"use strict";c.d(b,{y:()=>E});var d=c(736927),e=c(115962),f=c(327648),g=c(327770),h=c(673977),i=c(405545),j=c(720511),k=c(381802),l=c(86839);let m=new k.hs("chatFileMention"),n=j.bP.create({name:"chatFileMention",group:"inline",inline:!0,atom:!0,selectable:!0,draggable:!0,addAttributes:()=>({label:{default:""},path:{default:""},mentionType:{default:"file"},objectName:{default:""},defaultView:{default:""}}),parseHTML:()=>[{tag:"span[data-chat-file-mention]"}],renderHTML({HTMLAttributes:a}){let b=a.label||"file",c=a.mentionType||"file",d=a.defaultView||"",e={bg:"rgba(120, 113, 108, 0.1)",fg:"inherit"},f="object"===c?(0,l.PV)(b):b;return["span",(0,j.KV)({"data-chat-file-mention":"","data-mention-type":c,...d?{"data-default-view":d}:{},class:"chat-file-mention",style:`--mention-bg: ${e.bg}; --mention-fg: ${e.fg};`,title:a.path||""},a),f]}});var o=c(249855),p=c(941809),q=c(478425);let r=(0,q.A)("outline","photo","Photo",[["path",{d:"M15 8h.01",key:"svg-0"}],["path",{d:"M3 6a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v12a3 3 0 0 1 -3 3h-12a3 3 0 0 1 -3 -3v-12",key:"svg-1"}],["path",{d:"M3 16l5 -5c.928 -.893 2.072 -.893 3 0l5 5",key:"svg-2"}],["path",{d:"M14 14l1 -1c.928 -.893 2.072 -.893 3 0l3 3",key:"svg-3"}]]),s=(0,q.A)("outline","video","Video",[["path",{d:"M15 10l4.553 -2.276a1 1 0 0 1 1.447 .894v6.764a1 1 0 0 1 -1.447 .894l-4.553 -2.276v-4",key:"svg-0"}],["path",{d:"M3 8a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2l0 -8",key:"svg-1"}]]),t=(0,q.A)("outline","music","Music",[["path",{d:"M3 17a3 3 0 1 0 6 0a3 3 0 0 0 -6 0",key:"svg-0"}],["path",{d:"M13 17a3 3 0 1 0 6 0a3 3 0 0 0 -6 0",key:"svg-1"}],["path",{d:"M9 17v-13h10v13",key:"svg-2"}],["path",{d:"M9 8h10",key:"svg-3"}]]);var u=c(896703);let v=(0,q.A)("outline","code","Code",[["path",{d:"M7 8l-4 4l4 4",key:"svg-0"}],["path",{d:"M17 8l4 4l-4 4",key:"svg-1"}],["path",{d:"M14 4l-4 16",key:"svg-2"}]]);var w=c(490654);let x=(0,q.A)("filled","layout-kanban-filled","LayoutKanbanFilled",[["path",{d:"M10 3a1 1 0 0 1 0 2h-6a1 1 0 1 1 0 -2z",key:"svg-0"}],["path",{d:"M20 3a1 1 0 0 1 0 2h-6a1 1 0 0 1 0 -2z",key:"svg-1"}],["path",{d:"M8 7a3 3 0 0 1 3 3v8a3 3 0 0 1 -3 3h-2a3 3 0 0 1 -3 -3v-8a3 3 0 0 1 3 -3z",key:"svg-2"}],["path",{d:"M18 7a3 3 0 0 1 3 3v2a3 3 0 0 1 -3 3h-2a3 3 0 0 1 -3 -3v-2a3 3 0 0 1 3 -3z",key:"svg-3"}]]);var y=c(118475);let z=(0,q.A)("filled","user-filled","UserFilled",[["path",{d:"M12 2a5 5 0 1 1 -5 5l.005 -.217a5 5 0 0 1 4.995 -4.783z",key:"svg-0"}],["path",{d:"M14 14a5 5 0 0 1 5 5v1a2 2 0 0 1 -2 2h-10a2 2 0 0 1 -2 -2v-1a5 5 0 0 1 5 -5h4z",key:"svg-1"}]]);function A({category:a,defaultView:b}){let c={flexShrink:0};switch(a){case"folder":return(0,d.jsx)(p.A,{size:18,style:{...c,color:"#60a5fa"}});case"image":return(0,d.jsx)(r,{size:18,style:{...c,color:"#10b981"}});case"video":return(0,d.jsx)(s,{size:18,style:{...c,color:"#8b5cf6"}});case"audio":return(0,d.jsx)(t,{size:18,style:{...c,color:"#f59e0b"}});case"pdf":return(0,d.jsx)(u.A,{size:18,style:{...c,color:"#ef4444"}});case"code":return(0,d.jsx)(v,{size:18,style:{...c,color:"#3b82f6"}});case"database":return(0,d.jsx)(w.A,{size:18,style:c});case"object":return"kanban"===b?(0,d.jsx)(x,{size:18,style:{...c,color:"#8b7cf6"}}):(0,d.jsx)(y.A,{size:18,style:{...c,color:"#42a97a"}});case"entry":return(0,d.jsx)(z,{size:18,style:{...c,color:"#22c55e"}});default:return(0,d.jsx)(u.A,{size:18,style:{...c,opacity:.7}})}}let B=(0,e.forwardRef)(({items:a,command:b,loading:c},f)=>{let[g,h]=(0,e.useState)(0),i=(0,e.useRef)(null);(0,e.useEffect)(()=>{h(0)},[a]),(0,e.useEffect)(()=>{let a=i.current?.children[g];a?.scrollIntoView({block:"nearest"})},[g]);let j=(0,e.useCallback)(c=>{let d=a[c];d&&b(d)},[a,b]);(0,e.useImperativeHandle)(f,()=>({onKeyDown:({event:b})=>"ArrowUp"===b.key?(h(b=>(b+a.length-1)%a.length),!0):"ArrowDown"===b.key?(h(b=>(b+1)%a.length),!0):("Enter"===b.key||"Tab"===b.key)&&(j(g),!0)}));let k="bg-neutral-100/[0.67] dark:bg-neutral-900/[0.67] border border-white dark:border-white/10 backdrop-blur-md shadow-[0_0_25px_0_rgba(0,0,0,0.16)]";return c?(0,d.jsx)("div",{className:`rounded-3xl p-3 ${k}`,style:{minWidth:280,maxWidth:400},children:(0,d.jsx)("span",{className:"text-xs animate-pulse",style:{color:"var(--color-text-muted)"},children:"Searching..."})}):0===a.length?(0,d.jsx)("div",{className:`rounded-3xl p-3 text-center ${k}`,style:{minWidth:280,maxWidth:400},children:(0,d.jsx)("span",{className:"text-xs",style:{color:"var(--color-text-muted)"},children:"No results found"})}):(0,d.jsx)("div",{ref:i,className:`rounded-3xl p-1 overflow-y-auto thin-scrollbar ${k}`,style:{minWidth:280,maxWidth:400,maxHeight:300},children:a.map((a,b)=>{let c=function(a,b){if("folder"===b)return"folder";if("database"===b)return"database";if("object"===b)return"object";if("entry"===b)return"entry";let c=a.split(".").pop()?.toLowerCase()??"";return["jpg","jpeg","png","gif","webp","svg","bmp","ico","tiff","heic"].includes(c)?"image":["mp4","webm","mov","avi","mkv","flv"].includes(c)?"video":["mp3","wav","ogg","aac","flac","m4a"].includes(c)?"audio":"pdf"===c?"pdf":["js","ts","tsx","jsx","py","rb","go","rs","java","cpp","c","h","css","html","json","yaml","yml","toml","sh","bash","sql","swift","kt"].includes(c)?"code":"document"===b?"document":"other"}(a.name,a.type),e=a.icon&&/\p{Emoji_Presentation}/u.test(a.icon),f="object"===a.type||"entry"===a.type,i="object"===a.type?(0,l.PV)(a.name):a.name,k="entry"===a.type&&a.objectName?(0,l.A3)(a.objectName):f?"kanban"===a.defaultView?"Board":"Table":a.path.replace(/^\/Users\/[^/]+/,"~").replace(/^\/home\/[^/]+/,"~").replace(/^[A-Z]:\\Users\\[^\\]+/,"~");return(0,d.jsxs)("button",{type:"button",className:`w-full flex items-center gap-2.5 px-2.5 py-1.5 text-left transition-all rounded-2xl select-none ${b===g?"bg-neutral-400/15":""}`,style:{color:"var(--color-text)"},onClick:()=>j(b),onMouseEnter:()=>h(b),children:[(0,d.jsx)("span",{className:"flex-shrink-0 flex items-center",style:{opacity:.55},children:e?(0,d.jsx)("span",{className:"text-[15px] leading-none",children:a.icon}):(0,d.jsx)(A,{category:c,defaultView:a.defaultView})}),(0,d.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,d.jsx)("div",{className:"text-sm font-medium truncate",children:i}),(0,d.jsx)("div",{className:"text-xs truncate",style:{color:"var(--color-text-muted)"},title:f?k:a.path,children:k})]})]},a.path)})})});function C({items:a,command:b,clientRect:c,componentRef:f,loading:g}){let h=(0,e.useRef)(null);return(0,o.createPortal)((0,d.jsx)("div",{ref:h,children:(0,d.jsx)(B,{ref:f,items:a,command:b,loading:g})}),document.body)}function D(a){if(!a)return{text:"",mentionedFiles:[]};let b=[],c=[];return a.state.doc.forEach(a=>{if("paragraph"===a.type.name||"hardBreak"===a.type.name){let d="";a.descendants(a=>{if("chatFileMention"===a.type.name){let c=a.attrs.label,e=a.attrs.path,f=a.attrs.mentionType,g=a.attrs.objectName;return b.push({name:c,path:e}),"object"===f?d+=`[object: ${c}]`:"entry"===f?d+=`[entry: ${g?`${g}/`:""}${c}]`:d+=`[file: ${e}]`,!1}return a.isText&&a.text&&(d+=a.text),"hardBreak"===a.type.name&&(d+="\n"),!0}),c.push(d)}}),{text:c.join("\n").trim(),mentionedFiles:b}}B.displayName="FileMentionList";let E=(0,e.forwardRef)(function({onSubmit:a,onChange:b,onNativeFileDrop:k,placeholder:l,disabled:o,compact:p,searchFn:q},r){let s=(0,e.useRef)(a);s.current=a;let t=(0,e.useRef)(k);t.current=k;let u=(0,e.useRef)(q??null);u.current=q??null;let v=(0,e.useRef)(null),w=(0,f.hG)({immediatelyRender:!1,extensions:[g.A.configure({heading:!1,codeBlock:!1,blockquote:!1,horizontalRule:!1,bulletList:!1,orderedList:!1,listItem:!1}),h.A.configure({placeholder:l??"Ask anything...",showOnlyWhenEditable:!1}),n,j.YY.create({name:"chatFileMentionSuggestion",addProseMirrorPlugins(){return[(0,i.Ay)({editor:this.editor,char:"@",pluginKey:m,startOfLine:!1,allowSpaces:!0,command:({editor:a,range:b,props:c})=>{let d="object"===c.type?"object":"entry"===c.type?"entry":"folder"===c.type?"folder":"file";a.chain().focus().deleteRange(b).insertContent([{type:"chatFileMention",attrs:{label:c.name,path:c.path,mentionType:d,objectName:c.objectName??"",defaultView:c.defaultView??""}},{type:"text",text:" "}]).run()},items:({query:a})=>[],render:()=>{let a=null,b=null,e={current:null},f="",g=[],h=!1,i=null,j=null,k=null;function l(){b&&j&&b.render((0,d.jsx)(C,{items:g,command:j,clientRect:k,componentRef:e,loading:h}))}function m(a){let b=a.path??a.id,c=b.split("/").pop()??a.label;return{name:"object"===a.kind||"entry"===a.kind?a.label:c,path:b,type:"entry"===a.kind?"entry":"object"===a.kind?"object":a.nodeType??"file",icon:a.icon,objectName:a.objectName,entryId:a.entryId,defaultView:a.defaultView}}function n(a){let b=u?.current;return!!b&&(g=b(a,20).map(m),h=!1,l(),!0)}async function o(a){if(!n(a)){h=!0,l();try{let b=a.startsWith("/")||a.startsWith("~/")||a.startsWith("../")||a.startsWith("./")||a.includes("/")?`path=${encodeURIComponent(a)}`:a?`q=${encodeURIComponent(a)}`:"",c=`/api/workspace/suggest-files${b?`?${b}`:""}`,d=await fetch(c);g=(await d.json()).items??[]}catch{g=[]}h=!1,l()}}function p(a){n(a)||(i&&clearTimeout(i),i=setTimeout(()=>{o(a)},120))}return{onStart:d=>{a=document.createElement("div"),document.body.appendChild(a),j=d.command,k=d.clientRect??null,f=d.query,c.e(70684).then(c.t.bind(c,570684,19)).then(({createRoot:c})=>{b=c(a),p(f)})},onUpdate:a=>{j=a.command,k=a.clientRect??null,p(f=a.query)},onKeyDown:c=>{if("Escape"===c.event.key)return b?.unmount(),a?.remove(),a=null,b=null,!0;let d=e.current?.onKeyDown(c)??!1;return d&&c.event.stopImmediatePropagation(),d},onExit:()=>{i&&clearTimeout(i),b?.unmount(),a?.remove(),a=null,b=null}}}})]}})],editorProps:{attributes:{class:`chat-editor-content ${p?"chat-editor-compact":""}`,style:"color: var(--color-text);"},handleKeyDown:(a,b)=>{if("Enter"===b.key&&!b.shiftKey&&!b.isComposing){let b=m.getState(a.state);return!b?.active}return!1},handleDOMEvents:{paste:(a,b)=>{let c=b.clipboardData;if(!c)return!1;let d=[];if(c.items){for(let a of Array.from(c.items))if("file"===a.kind){let b=a.getAsFile();b&&d.push(b)}}if(d.length>0){b.preventDefault();let a=new DataTransfer;for(let b of d)a.items.add(b);return t.current?.(a.files),!0}return!1},dragover:(a,b)=>!!(b.dataTransfer?.types.includes("application/x-file-mention")||b.dataTransfer?.types.includes("Files"))&&(b.preventDefault(),b.dataTransfer.dropEffect="copy",!0),drop:(a,b)=>{let c=()=>{let a=b.target instanceof HTMLElement?b.target.closest("[data-chat-drop-target]"):null;a?.removeAttribute("data-drag-hover")},d=b.dataTransfer?.getData("application/x-file-mention");if(d){b.preventDefault(),b.stopPropagation(),c();try{let{name:a,path:b}=JSON.parse(d);a&&b&&v.current?.chain().focus().insertContent([{type:"chatFileMention",attrs:{label:a,path:b}},{type:"text",text:" "}]).run()}catch{}return!0}let e=b.dataTransfer?.files;return!!e&&e.length>0&&(b.preventDefault(),b.stopPropagation(),c(),t.current?.(e),!0)}}},onUpdate:({editor:a})=>{b?.(a.isEmpty)}});return(0,e.useEffect)(()=>{v.current=w??null},[w]),(0,e.useEffect)(()=>{if(!w)return;let a=a=>{if("Enter"===a.key&&!a.shiftKey&&!a.isComposing){let b=m.getState(w.state);if(b?.active)return;a.preventDefault();let{text:c,mentionedFiles:d}=D(w),e=w.getHTML();s.current(c,d,e),(c.trim()||d.length>0)&&w.commands.clearContent(!0),requestAnimationFrame(()=>w.commands.focus())}},b=w.view.dom;return b.addEventListener("keydown",a),()=>b.removeEventListener("keydown",a)},[w]),(0,e.useEffect)(()=>{w&&w.setEditable(!o)},[w,o]),(0,e.useImperativeHandle)(r,()=>({insertFileMention:(a,b)=>{w?.chain().focus().insertContent([{type:"chatFileMention",attrs:{label:a,path:b}},{type:"text",text:" "}]).run()},clear:()=>{w?.commands.clearContent(!0)},focus:()=>{w?.commands.focus()},isEmpty:()=>w?.isEmpty??!0,submit:()=>{if(!w)return;let{text:a,mentionedFiles:b}=D(w);if(a.trim()||b.length>0){let c=w.getHTML();s.current(a,b,c),w.commands.clearContent(!0),requestAnimationFrame(()=>w.commands.focus())}},setText:a=>{w?.commands.setContent(a),w?.commands.focus("end")},appendText:a=>{if(!w)return;let b=a.trim();if(!b)return;let{text:c}=D(w),d=c.trim().length>0?" ":"";w.chain().focus("end").insertContent(`${d}${b}`).run()}})),(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(f.$Z,{editor:w}),(0,d.jsx)("style",{children:`
219
219
  .chat-editor-content {
220
220
  outline: none;
221
221
  min-height: ${p?"16px":"28px"};