From c22b3abc4d01a45d1cc43bce2dd0676b32ebcaba Mon Sep 17 00:00:00 2001 From: Luke Vella Date: Mon, 19 Jun 2023 17:17:00 +0100 Subject: [PATCH] =?UTF-8?q?=E2=AC=86=EF=B8=8F=20v3.0.0=20(#704)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .eslintrc.json | 9 +- apps/docs/images/self-hosting/spacetime.html | 227 + .../spacetime_files/codemirror.css | 340 ++ .../spacetime_files/codemirror.js | 1 + .../self-hosting/spacetime_files/d3.v3.min.js | 5 + .../self-hosting/spacetime_files/explain.js | 118 + .../self-hosting/spacetime_files/github.png | Bin 0 -> 1714 bytes .../self-hosting/spacetime_files/index.css | 224 + .../self-hosting/spacetime_files/index.js | 151 + .../spacetime_files/javascript-mode.js | 1 + .../self-hosting/spacetime_files/mytheme.css | 37 + .../self-hosting/spacetime_files/spacetime | 1 + .../spacetime_files/topojson.v1.min.js | 2 + .../self-hosting/spacetime_files/vue.min.js | 6 + apps/landing/.gitignore | 8 + apps/landing/declarations/environment.d.ts | 99 + apps/landing/declarations/i18next.d.ts | 15 + apps/landing/i18n.config.js | 6 + apps/landing/i18next-scanner.config.js | 29 + apps/landing/next-env.d.ts | 5 + apps/landing/next-i18next.config.js | 12 + apps/landing/next.config.js | 76 + apps/landing/package.json | 69 + apps/landing/playwright.config.ts | 34 + apps/landing/postcss.config.js | 3 + .../landing/public/android-chrome-192x192.png | Bin 0 -> 2045 bytes .../landing/public/android-chrome-512x512.png | Bin 0 -> 5831 bytes .../public/apple-touch-icon-114x114.png | Bin 0 -> 1220 bytes .../public/apple-touch-icon-120x120.png | Bin 0 -> 1326 bytes .../public/apple-touch-icon-144x144.png | Bin 0 -> 1605 bytes .../public/apple-touch-icon-152x152.png | Bin 0 -> 1675 bytes .../public/apple-touch-icon-167x167.png | Bin 0 -> 1786 bytes .../public/apple-touch-icon-180x180.png | Bin 0 -> 1865 bytes .../landing/public/apple-touch-icon-57x57.png | Bin 0 -> 710 bytes .../landing/public/apple-touch-icon-60x60.png | Bin 0 -> 751 bytes .../landing/public/apple-touch-icon-72x72.png | Bin 0 -> 885 bytes .../landing/public/apple-touch-icon-76x76.png | Bin 0 -> 959 bytes apps/landing/public/bimi-logo.svg | 9 + apps/landing/public/digitalocean.svg | 71 + apps/landing/public/favicon-128x128.png | Bin 0 -> 1499 bytes apps/landing/public/favicon-16x16.png | Bin 0 -> 388 bytes apps/landing/public/favicon-196x196.png | Bin 0 -> 2233 bytes apps/landing/public/favicon-32x32.png | Bin 0 -> 566 bytes apps/landing/public/favicon-96x96.png | Bin 0 -> 1188 bytes apps/landing/public/favicon.ico | Bin 0 -> 4286 bytes apps/landing/public/favicon.svg | 5 + apps/landing/public/if-need-be.svg | 3 + apps/landing/public/locales/ca/app.json | 174 + apps/landing/public/locales/cs/app.json | 192 + apps/landing/public/locales/da/app.json | 190 + apps/landing/public/locales/de/app.json | 192 + apps/landing/public/locales/en/app.json | 54 + apps/landing/public/locales/es/app.json | 170 + apps/landing/public/locales/fa/app.json | 142 + apps/landing/public/locales/fi/app.json | 192 + apps/landing/public/locales/fr/app.json | 192 + apps/landing/public/locales/hr/app.json | 190 + apps/landing/public/locales/hu/app.json | 192 + apps/landing/public/locales/it/app.json | 189 + apps/landing/public/locales/ko/app.json | 190 + apps/landing/public/locales/nl/app.json | 192 + apps/landing/public/locales/pl/app.json | 140 + apps/landing/public/locales/pt-BR/app.json | 192 + apps/landing/public/locales/pt/app.json | 173 + apps/landing/public/locales/ru/app.json | 183 + apps/landing/public/locales/sk/app.json | 192 + apps/landing/public/locales/sv/app.json | 190 + apps/landing/public/locales/tr/app.json | 90 + apps/landing/public/locales/vi/app.json | 179 + apps/landing/public/locales/zh/app.json | 190 + apps/landing/public/logo-color.svg | 3 + apps/landing/public/logo.png | Bin 0 -> 2288 bytes apps/{web => landing}/public/logo.svg | 2 +- apps/landing/public/mstile-144x144.png | Bin 0 -> 1605 bytes apps/landing/public/mstile-150x150.png | Bin 0 -> 1632 bytes apps/landing/public/mstile-310x150.png | Bin 0 -> 1355 bytes apps/landing/public/mstile-310x310.png | Bin 0 -> 3274 bytes apps/landing/public/mstile-70x70.png | Bin 0 -> 892 bytes apps/landing/public/no.svg | 3 + apps/landing/public/og-image-1200.png | Bin 0 -> 60465 bytes .../public/powered-by-vercel.svg | 0 apps/landing/public/robots.txt | 2 + apps/landing/public/screenshot.png | Bin 0 -> 376800 bytes apps/{web => landing}/public/sentry.svg | 0 .../public/static/images/animations.gif | Bin 0 -> 1375784 bytes .../public/static/images/device-data.png | Bin 0 -> 57096 bytes apps/landing/public/static/images/google.png | Bin 0 -> 30353 bytes .../public/static/images/grouped-times.png | Bin 0 -> 719301 bytes apps/landing/public/static/images/hero.png | Bin 0 -> 343113 bytes .../introducing-rallly-3-0/navigation.png | Bin 0 -> 68098 bytes .../introducing-rallly-3-0/poll-status.png | Bin 0 -> 12524 bytes .../introducing-rallly-3-0/polls-page.png | Bin 0 -> 105131 bytes .../updated-scoring.png | Bin 0 -> 20284 bytes .../finalize-poll-demo.gif | Bin 0 -> 1498331 bytes .../introducing-rallly-pro/finalize-poll.gif | Bin 0 -> 912367 bytes .../introducing-rallly-pro/pro-splash.svg | 4 + .../rallly-pro-splash.png | Bin 0 -> 83582 bytes .../public/static/images/luke-vella.jpg | Bin 0 -> 167635 bytes .../public/static/images/mobile-demo.gif | Bin 0 -> 1840798 bytes .../public/static/images/share-demo.gif | Bin 0 -> 482631 bytes .../landing/public/static/images/shortcut.gif | Bin 0 -> 2187407 bytes .../availability-grid.svg | 486 +++ .../images/the-future-of-rallly/funnel.svg | 9 + .../images/the-future-of-rallly/poll.svg | 28 + .../images/the-future-of-rallly/rsvp.svg | 36 + .../public/static/images/timeslots-demo.gif | Bin 0 -> 1244903 bytes .../public/static/images/touchable-area.png | Bin 0 -> 21004 bytes .../public/static/images/twitter-card.png | Bin 0 -> 9073 bytes .../public/vercel-logotype-dark.svg | 0 apps/landing/public/yes.svg | 3 + apps/landing/sentry.client.config.ts | 17 + apps/landing/sentry.edge.config.ts | 17 + apps/landing/sentry.server.config.ts | 17 + .../src/components/blog/date-formatter.tsx | 11 + .../blog/markdown-styles.module.css | 30 + .../landing/src/components/blog/post-body.tsx | 16 + .../src/components/blog/post-header.tsx | 21 + .../src/components/blog/post-preview.tsx | 36 + apps/landing/src/components/blog/posts.tsx | 29 + apps/landing/src/components/error-page.tsx | 49 + apps/{web => landing}/src/components/home.tsx | 0 .../src/components/home/ban-ads.svg | 0 .../src/components/home/bonus.tsx | 12 +- .../landing/src/components/home/color-hash.ts | 55 + .../src/components/home/features.tsx | 31 +- apps/landing/src/components/home/hero.tsx | 239 ++ .../src/components/home/scribble-arrow.svg | 0 .../src/components/layouts/blog-layout.tsx | 48 + .../src/components/layouts/page-layout.tsx | 150 + .../components/layouts/page-layout/footer.tsx | 133 +- apps/landing/src/components/trans.tsx | 8 + apps/landing/src/lib/api.ts | 47 + apps/landing/src/lib/markdownToHtml.ts | 7 + apps/landing/src/pages/404.tsx | 29 + apps/landing/src/pages/_app.tsx | 84 + apps/landing/src/pages/_document.tsx | 107 + apps/landing/src/pages/_error.tsx | 38 + apps/landing/src/pages/blog.tsx | 57 + apps/landing/src/pages/blog/[slug].tsx | 114 + .../src/pages/cookie-policy.tsx | 16 +- apps/landing/src/pages/index.tsx | 8 + .../src/pages/privacy-policy.tsx | 17 +- .../src/pages/terms-of-use.tsx | 31 +- .../src/posts/introducing-rallly-pro.md | 43 + apps/landing/src/posts/mobile-ui-update.md | 45 + .../src/posts/new-version-announcment.md | 83 + apps/landing/src/posts/rallly-3-0.md | 39 + .../landing/src/posts/the-future-of-rallly.md | 43 + apps/landing/src/style.css | 219 + apps/landing/src/types.ts | 33 + apps/landing/src/utils/page-translations.ts | 11 + apps/landing/tailwind.config.js | 8 + apps/landing/tsconfig.json | 24 + apps/web/declarations/environment.d.ts | 4 + apps/web/next.config.js | 20 +- apps/web/package.json | 20 +- apps/web/playwright.config.ts | 4 + apps/web/public/locales/en/app.json | 156 +- apps/web/public/logo-color.svg | 13 +- apps/web/public/logo-mark.svg | 3 + apps/web/public/og-image-1200.png | Bin 49525 -> 60465 bytes apps/web/public/site.webmanifest | 1 - apps/web/public/static/logo.svg | 3 + apps/web/src/components/admin-control.tsx | 74 - apps/web/src/components/auth/auth-layout.tsx | 15 +- apps/web/src/components/auth/login-form.tsx | 45 +- apps/web/src/components/auth/login-modal.tsx | 147 +- apps/web/src/components/badge.tsx | 2 +- apps/web/src/components/button.tsx | 43 +- apps/web/src/components/card.tsx | 22 + apps/web/src/components/compact-button.tsx | 31 +- apps/web/src/components/confirm-prompt.tsx | 24 - apps/web/src/components/container.tsx | 12 + apps/web/src/components/cookie-consent.tsx | 2 +- apps/web/src/components/create-poll.tsx | 94 +- apps/web/src/components/crisp-chat.tsx | 46 - apps/web/src/components/data-table.tsx | 79 + apps/web/src/components/date-card.tsx | 8 +- apps/web/src/components/date-icon.tsx | 43 + apps/web/src/components/dates-table.tsx | 137 + .../src/components/discussion/discussion.tsx | 215 +- apps/web/src/components/dropdown.tsx | 113 - apps/web/src/components/empty-state.tsx | 20 - apps/web/src/components/error-page.tsx | 26 +- apps/web/src/components/event-card.tsx | 146 + apps/web/src/components/feedback.tsx | 37 +- .../components/forms/poll-details-form.tsx | 100 +- .../month-calendar/month-calendar.tsx | 161 +- .../month-calendar/time-picker.tsx | 5 +- .../poll-options-form/poll-options-form.tsx | 236 +- .../forms/poll-options-form/week-calendar.tsx | 9 +- .../components/forms/user-details-form.tsx | 74 +- .../src/components/headless-date-picker.tsx | 5 +- apps/web/src/components/home/hero.tsx | 89 - apps/web/src/components/home/how-it-works.tsx | 36 - apps/web/src/components/home/poll-demo.tsx | 99 - apps/web/src/components/invite-dialog.tsx | 101 + .../src/components/layouts/admin-layout.tsx | 29 + .../src/components/layouts/auth-layout.tsx | 4 +- .../components/layouts/new-poll-layout.tsx | 14 + .../src/components/layouts/page-layout.tsx | 99 - .../src/components/layouts/poll-layout.tsx | 302 ++ .../src/components/layouts/profile-layout.tsx | 71 + .../components/layouts/standard-layout.tsx | 189 +- .../layouts/standard-layout/home-link.tsx | 11 - .../standard-layout/mobile-navigation.tsx | 149 - .../layouts/standard-layout/top-bar.tsx | 37 + .../layouts/standard-layout/user-dropdown.tsx | 107 - apps/web/src/components/logo.tsx | 2 +- apps/web/src/components/maintenance.tsx | 3 - apps/web/src/components/modal/modal.tsx | 18 +- apps/web/src/components/modal/use-modal.tsx | 2 +- .../src/components/new-participant-modal.tsx | 17 +- apps/web/src/components/open-beta-modal.tsx | 4 +- apps/web/src/components/page-dialog.tsx | 46 + .../src/components/participant-avatar-bar.tsx | 63 + .../src/components/participant-dropdown.tsx | 291 +- .../src/components/participants-provider.tsx | 17 +- apps/web/src/components/poll-context.tsx | 92 +- apps/web/src/components/poll-status.tsx | 66 + apps/web/src/components/poll.tsx | 114 +- apps/web/src/components/poll/desktop-poll.tsx | 108 +- .../desktop-poll/participant-row-form.tsx | 16 +- .../poll/desktop-poll/participant-row.tsx | 32 +- .../poll/desktop-poll/poll-header.tsx | 44 +- .../src/components/poll/language-selector.tsx | 42 +- .../components/poll/legacy-poll-notice.tsx | 58 - apps/web/src/components/poll/manage-poll.tsx | 301 +- .../poll/manage-poll/delete-poll-dialog.tsx | 66 + .../poll/manage-poll/delete-poll-form.tsx | 89 - .../poll/manage-poll/finalize-poll-dialog.tsx | 273 ++ .../manage-poll/notify-participants-form.tsx | 210 + .../poll/manage-poll/use-csv-exporter.ts | 9 +- apps/web/src/components/poll/mobile-poll.tsx | 78 +- .../poll/mobile-poll/date-option.tsx | 7 +- .../poll/mobile-poll/grouped-options.tsx | 3 +- .../poll/mobile-poll/poll-option.tsx | 16 +- .../poll/mobile-poll/poll-options.tsx | 7 +- .../poll/mobile-poll/time-slot-option.tsx | 2 +- apps/web/src/components/poll/mutations.ts | 11 +- .../components/poll/notifications-toggle.tsx | 107 +- .../components/poll/participant-avatar.tsx | 78 + .../components/poll/poll-context-provider.tsx | 25 + .../src/components/poll/poll-subheader.tsx | 54 +- .../web/src/components/poll/score-summary.tsx | 43 +- .../src/components/poll/truncated-linkify.tsx | 6 +- .../poll/use-delete-participant-modal.ts | 33 - apps/web/src/components/poll/user-avatar.tsx | 47 +- apps/web/src/components/poll/vote-icon.tsx | 14 +- .../web/src/components/poll/vote-selector.tsx | 2 +- apps/web/src/components/preferences.tsx | 90 - apps/web/src/components/profile.tsx | 129 - .../src/components/profile/user-details.tsx | 109 - .../components/settings/change-email-form.tsx | 56 + .../settings/date-time-preferences.tsx | 169 + .../settings/language-preference.tsx | 60 + .../components/settings/profile-settings.tsx | 96 + .../components/settings/settings-section.tsx | 17 + apps/web/src/components/sharing.tsx | 81 - apps/web/src/components/skeleton.tsx | 14 + apps/web/src/components/steps/steps.tsx | 6 +- apps/web/src/components/table.tsx | 99 + apps/web/src/components/text-input.tsx | 4 +- apps/web/src/components/text-summary.tsx | 39 + .../web/src/components/time-format-picker.tsx | 61 + .../time-zone-picker/time-zone-select.tsx | 130 + apps/web/src/components/tooltip.tsx | 142 +- .../src/components/user-avatar/gradients.ts | 34 + apps/web/src/components/user-dropdown.tsx | 139 + apps/web/src/components/user-provider.tsx | 31 +- apps/web/src/components/user.tsx | 67 + .../components/vote-summary-progress-bar.tsx | 72 + apps/web/src/contexts/current-event.ts | 108 + apps/web/src/contexts/permissions.ts | 47 + apps/web/src/contexts/poll.tsx | 22 + apps/web/src/contexts/preferences.tsx | 45 + apps/web/src/contexts/role.tsx | 6 + apps/web/src/contexts/time-preferences.tsx | 104 + apps/web/src/middleware.ts | 22 +- apps/web/src/pages/404.tsx | 4 +- apps/web/src/pages/_app.tsx | 16 +- apps/web/src/pages/_document.tsx | 4 +- apps/web/src/pages/admin/[urlId].tsx | 182 +- .../src/pages/auth/disable-notifications.tsx | 4 +- apps/web/src/pages/auth/login.tsx | 6 +- apps/web/src/pages/demo.tsx | 35 - apps/web/src/pages/home.tsx | 20 - apps/web/src/pages/invite/[urlId].tsx | 133 + apps/web/src/pages/login.tsx | 9 +- apps/web/src/pages/logout.tsx | 2 +- apps/web/src/pages/new.tsx | 95 +- apps/web/src/pages/p/[urlId].tsx | 120 +- apps/web/src/pages/poll/[urlId].tsx | 75 + .../src/pages/poll/[urlId]/edit-details.tsx | 87 + .../src/pages/poll/[urlId]/edit-options.tsx | 163 + apps/web/src/pages/poll/[urlId]/finalize.tsx | 187 + apps/web/src/pages/polls.tsx | 190 + apps/web/src/pages/profile.tsx | 19 - apps/web/src/pages/register.tsx | 2 +- apps/web/src/pages/settings/billing.tsx | 60 + apps/web/src/pages/settings/preferences.tsx | 51 + apps/web/src/pages/settings/profile.tsx | 70 + apps/web/src/style.css | 68 +- apps/web/src/types.ts | 8 + apps/web/src/utils/color-hash.ts | 55 + apps/web/src/utils/date-time-utils.ts | 21 +- apps/web/src/utils/dayjs.tsx | 192 +- apps/web/src/utils/trpc/hooks.ts | 4 +- apps/web/src/utils/with-page-translations.ts | 19 +- apps/web/tailwind.config.js | 7 - apps/web/tests/authentication.spec.ts | 26 +- apps/web/tests/create-delete-poll.spec.ts | 73 +- apps/web/tests/edit-options-page.ts | 9 + apps/web/tests/edit-options.spec.ts | 34 +- apps/web/tests/i18n.spec.ts | 4 +- apps/web/tests/invite-page.ts | 20 + apps/web/tests/mobile-test.spec.ts | 2 +- apps/web/tests/mocks.ts | 130 + apps/web/tests/new-poll-page.ts | 50 + apps/web/tests/poll-page.ts | 89 + apps/web/tests/vote-and-comment.spec.ts | 68 +- crowdin.yml | 3 +- package.json | 3 +- packages/backend/next/session.ts | 18 - packages/backend/next/trpc/client.ts | 2 + packages/backend/next/utils.ts | 6 +- packages/backend/package.json | 4 +- packages/backend/session.ts | 12 +- packages/backend/trpc/context.ts | 2 +- packages/backend/trpc/routers/auth.ts | 11 + packages/backend/trpc/routers/index.ts | 2 + packages/backend/trpc/routers/polls.ts | 579 ++- .../backend/trpc/routers/polls/comments.ts | 4 +- .../backend/trpc/routers/polls/options.ts | 45 + .../trpc/routers/polls/participants.ts | 10 +- .../backend/trpc/routers/user-preferences.ts | 74 + packages/backend/trpc/routers/user.ts | 5 +- packages/backend/trpc/routers/whoami.ts | 14 +- packages/backend/trpc/trpc.ts | 29 +- packages/backend/utils/date.ts | 33 + .../20230614141138_v3/migration.sql | 39 + .../20230615111329_events/migration.sql | 8 + .../migration.sql | 8 + packages/database/prisma/schema.prisma | 64 +- packages/database/prisma/seed.ts | 3 +- packages/emails/src/send-email.tsx | 3 + packages/emails/src/templates.ts | 1 + .../src/templates/components/email-layout.tsx | 8 +- .../components/styled-components.tsx | 6 +- .../emails/src/templates/finalized-host.tsx | 38 + .../src/templates/finalized-participant.tsx | 53 + .../new-participant-confirmation.tsx | 8 +- packages/emails/src/templates/new-poll.tsx | 65 +- packages/icons/package.json | 3 +- packages/icons/src/index.ts | 4 +- packages/tailwind-config/package.json | 3 + packages/tailwind-config/tailwind.config.js | 56 +- packages/tsconfig/base.json | 1 + packages/tsconfig/package.json | 3 +- packages/tsconfig/react-library.json | 5 +- packages/ui/accordion.tsx | 60 + packages/ui/alert.tsx | 66 + packages/ui/button.tsx | 86 + packages/ui/card.tsx | 92 + packages/ui/checkbox.tsx | 30 + packages/ui/command.tsx | 155 + packages/ui/dialog.tsx | 132 + packages/ui/dropdown-menu.tsx | 215 + packages/ui/form.tsx | 177 + packages/ui/index.ts | 1 + packages/ui/input.tsx | 24 + packages/ui/label.tsx | 26 + packages/ui/lib/utils.ts | 6 + packages/ui/package.json | 28 + .../components => packages/ui}/popover.tsx | 11 +- packages/ui/radio-group.tsx | 44 + packages/ui/select.tsx | 119 + packages/ui/switch.tsx | 33 + packages/ui/table.tsx | 114 + packages/ui/textarea.tsx | 23 + packages/ui/tooltip.tsx | 32 + packages/ui/tsconfig.json | 11 + packages/ui/types.ts | 0 turbo.json | 94 +- yarn.lock | 3744 +++++++++++------ 385 files changed, 19912 insertions(+), 5250 deletions(-) create mode 100644 apps/docs/images/self-hosting/spacetime.html create mode 100644 apps/docs/images/self-hosting/spacetime_files/codemirror.css create mode 100644 apps/docs/images/self-hosting/spacetime_files/codemirror.js create mode 100644 apps/docs/images/self-hosting/spacetime_files/d3.v3.min.js create mode 100644 apps/docs/images/self-hosting/spacetime_files/explain.js create mode 100644 apps/docs/images/self-hosting/spacetime_files/github.png create mode 100644 apps/docs/images/self-hosting/spacetime_files/index.css create mode 100644 apps/docs/images/self-hosting/spacetime_files/index.js create mode 100644 apps/docs/images/self-hosting/spacetime_files/javascript-mode.js create mode 100644 apps/docs/images/self-hosting/spacetime_files/mytheme.css create mode 100644 apps/docs/images/self-hosting/spacetime_files/spacetime create mode 100644 apps/docs/images/self-hosting/spacetime_files/topojson.v1.min.js create mode 100644 apps/docs/images/self-hosting/spacetime_files/vue.min.js create mode 100644 apps/landing/.gitignore create mode 100644 apps/landing/declarations/environment.d.ts create mode 100644 apps/landing/declarations/i18next.d.ts create mode 100644 apps/landing/i18n.config.js create mode 100644 apps/landing/i18next-scanner.config.js create mode 100644 apps/landing/next-env.d.ts create mode 100644 apps/landing/next-i18next.config.js create mode 100644 apps/landing/next.config.js create mode 100644 apps/landing/package.json create mode 100644 apps/landing/playwright.config.ts create mode 100644 apps/landing/postcss.config.js create mode 100644 apps/landing/public/android-chrome-192x192.png create mode 100644 apps/landing/public/android-chrome-512x512.png create mode 100644 apps/landing/public/apple-touch-icon-114x114.png create mode 100644 apps/landing/public/apple-touch-icon-120x120.png create mode 100644 apps/landing/public/apple-touch-icon-144x144.png create mode 100644 apps/landing/public/apple-touch-icon-152x152.png create mode 100644 apps/landing/public/apple-touch-icon-167x167.png create mode 100644 apps/landing/public/apple-touch-icon-180x180.png create mode 100644 apps/landing/public/apple-touch-icon-57x57.png create mode 100644 apps/landing/public/apple-touch-icon-60x60.png create mode 100644 apps/landing/public/apple-touch-icon-72x72.png create mode 100644 apps/landing/public/apple-touch-icon-76x76.png create mode 100644 apps/landing/public/bimi-logo.svg create mode 100644 apps/landing/public/digitalocean.svg create mode 100644 apps/landing/public/favicon-128x128.png create mode 100644 apps/landing/public/favicon-16x16.png create mode 100644 apps/landing/public/favicon-196x196.png create mode 100644 apps/landing/public/favicon-32x32.png create mode 100644 apps/landing/public/favicon-96x96.png create mode 100644 apps/landing/public/favicon.ico create mode 100644 apps/landing/public/favicon.svg create mode 100644 apps/landing/public/if-need-be.svg create mode 100644 apps/landing/public/locales/ca/app.json create mode 100644 apps/landing/public/locales/cs/app.json create mode 100644 apps/landing/public/locales/da/app.json create mode 100644 apps/landing/public/locales/de/app.json create mode 100644 apps/landing/public/locales/en/app.json create mode 100644 apps/landing/public/locales/es/app.json create mode 100644 apps/landing/public/locales/fa/app.json create mode 100644 apps/landing/public/locales/fi/app.json create mode 100644 apps/landing/public/locales/fr/app.json create mode 100644 apps/landing/public/locales/hr/app.json create mode 100644 apps/landing/public/locales/hu/app.json create mode 100644 apps/landing/public/locales/it/app.json create mode 100644 apps/landing/public/locales/ko/app.json create mode 100644 apps/landing/public/locales/nl/app.json create mode 100644 apps/landing/public/locales/pl/app.json create mode 100644 apps/landing/public/locales/pt-BR/app.json create mode 100644 apps/landing/public/locales/pt/app.json create mode 100644 apps/landing/public/locales/ru/app.json create mode 100644 apps/landing/public/locales/sk/app.json create mode 100644 apps/landing/public/locales/sv/app.json create mode 100644 apps/landing/public/locales/tr/app.json create mode 100644 apps/landing/public/locales/vi/app.json create mode 100644 apps/landing/public/locales/zh/app.json create mode 100644 apps/landing/public/logo-color.svg create mode 100644 apps/landing/public/logo.png rename apps/{web => landing}/public/logo.svg (94%) create mode 100644 apps/landing/public/mstile-144x144.png create mode 100644 apps/landing/public/mstile-150x150.png create mode 100644 apps/landing/public/mstile-310x150.png create mode 100644 apps/landing/public/mstile-310x310.png create mode 100644 apps/landing/public/mstile-70x70.png create mode 100644 apps/landing/public/no.svg create mode 100644 apps/landing/public/og-image-1200.png rename apps/{web => landing}/public/powered-by-vercel.svg (100%) create mode 100644 apps/landing/public/robots.txt create mode 100644 apps/landing/public/screenshot.png rename apps/{web => landing}/public/sentry.svg (100%) create mode 100644 apps/landing/public/static/images/animations.gif create mode 100644 apps/landing/public/static/images/device-data.png create mode 100644 apps/landing/public/static/images/google.png create mode 100644 apps/landing/public/static/images/grouped-times.png create mode 100644 apps/landing/public/static/images/hero.png create mode 100644 apps/landing/public/static/images/introducing-rallly-3-0/navigation.png create mode 100644 apps/landing/public/static/images/introducing-rallly-3-0/poll-status.png create mode 100644 apps/landing/public/static/images/introducing-rallly-3-0/polls-page.png create mode 100644 apps/landing/public/static/images/introducing-rallly-3-0/updated-scoring.png create mode 100644 apps/landing/public/static/images/introducing-rallly-pro/finalize-poll-demo.gif create mode 100644 apps/landing/public/static/images/introducing-rallly-pro/finalize-poll.gif create mode 100644 apps/landing/public/static/images/introducing-rallly-pro/pro-splash.svg create mode 100644 apps/landing/public/static/images/introducing-rallly-pro/rallly-pro-splash.png create mode 100644 apps/landing/public/static/images/luke-vella.jpg create mode 100644 apps/landing/public/static/images/mobile-demo.gif create mode 100644 apps/landing/public/static/images/share-demo.gif create mode 100644 apps/landing/public/static/images/shortcut.gif create mode 100644 apps/landing/public/static/images/the-future-of-rallly/availability-grid.svg create mode 100644 apps/landing/public/static/images/the-future-of-rallly/funnel.svg create mode 100644 apps/landing/public/static/images/the-future-of-rallly/poll.svg create mode 100644 apps/landing/public/static/images/the-future-of-rallly/rsvp.svg create mode 100644 apps/landing/public/static/images/timeslots-demo.gif create mode 100644 apps/landing/public/static/images/touchable-area.png create mode 100644 apps/landing/public/static/images/twitter-card.png rename apps/{web => landing}/public/vercel-logotype-dark.svg (100%) create mode 100644 apps/landing/public/yes.svg create mode 100644 apps/landing/sentry.client.config.ts create mode 100644 apps/landing/sentry.edge.config.ts create mode 100644 apps/landing/sentry.server.config.ts create mode 100644 apps/landing/src/components/blog/date-formatter.tsx create mode 100644 apps/landing/src/components/blog/markdown-styles.module.css create mode 100644 apps/landing/src/components/blog/post-body.tsx create mode 100644 apps/landing/src/components/blog/post-header.tsx create mode 100644 apps/landing/src/components/blog/post-preview.tsx create mode 100644 apps/landing/src/components/blog/posts.tsx create mode 100644 apps/landing/src/components/error-page.tsx rename apps/{web => landing}/src/components/home.tsx (100%) rename apps/{web => landing}/src/components/home/ban-ads.svg (100%) rename apps/{web => landing}/src/components/home/bonus.tsx (86%) create mode 100644 apps/landing/src/components/home/color-hash.ts rename apps/{web => landing}/src/components/home/features.tsx (58%) create mode 100644 apps/landing/src/components/home/hero.tsx rename apps/{web => landing}/src/components/home/scribble-arrow.svg (100%) create mode 100644 apps/landing/src/components/layouts/blog-layout.tsx create mode 100644 apps/landing/src/components/layouts/page-layout.tsx rename apps/{web => landing}/src/components/layouts/page-layout/footer.tsx (61%) create mode 100644 apps/landing/src/components/trans.tsx create mode 100644 apps/landing/src/lib/api.ts create mode 100644 apps/landing/src/lib/markdownToHtml.ts create mode 100644 apps/landing/src/pages/404.tsx create mode 100644 apps/landing/src/pages/_app.tsx create mode 100644 apps/landing/src/pages/_document.tsx create mode 100644 apps/landing/src/pages/_error.tsx create mode 100644 apps/landing/src/pages/blog.tsx create mode 100644 apps/landing/src/pages/blog/[slug].tsx rename apps/{web => landing}/src/pages/cookie-policy.tsx (85%) create mode 100644 apps/landing/src/pages/index.tsx rename apps/{web => landing}/src/pages/privacy-policy.tsx (93%) rename apps/{web => landing}/src/pages/terms-of-use.tsx (75%) create mode 100644 apps/landing/src/posts/introducing-rallly-pro.md create mode 100644 apps/landing/src/posts/mobile-ui-update.md create mode 100644 apps/landing/src/posts/new-version-announcment.md create mode 100644 apps/landing/src/posts/rallly-3-0.md create mode 100644 apps/landing/src/posts/the-future-of-rallly.md create mode 100644 apps/landing/src/style.css create mode 100644 apps/landing/src/types.ts create mode 100644 apps/landing/src/utils/page-translations.ts create mode 100644 apps/landing/tailwind.config.js create mode 100644 apps/landing/tsconfig.json create mode 100644 apps/web/public/logo-mark.svg delete mode 100644 apps/web/public/site.webmanifest create mode 100644 apps/web/public/static/logo.svg delete mode 100644 apps/web/src/components/admin-control.tsx create mode 100644 apps/web/src/components/card.tsx delete mode 100644 apps/web/src/components/confirm-prompt.tsx create mode 100644 apps/web/src/components/container.tsx delete mode 100644 apps/web/src/components/crisp-chat.tsx create mode 100644 apps/web/src/components/data-table.tsx create mode 100644 apps/web/src/components/date-icon.tsx create mode 100644 apps/web/src/components/dates-table.tsx delete mode 100644 apps/web/src/components/dropdown.tsx delete mode 100644 apps/web/src/components/empty-state.tsx create mode 100644 apps/web/src/components/event-card.tsx delete mode 100644 apps/web/src/components/home/hero.tsx delete mode 100644 apps/web/src/components/home/how-it-works.tsx delete mode 100644 apps/web/src/components/home/poll-demo.tsx create mode 100644 apps/web/src/components/invite-dialog.tsx create mode 100644 apps/web/src/components/layouts/admin-layout.tsx create mode 100644 apps/web/src/components/layouts/new-poll-layout.tsx delete mode 100644 apps/web/src/components/layouts/page-layout.tsx create mode 100644 apps/web/src/components/layouts/poll-layout.tsx create mode 100644 apps/web/src/components/layouts/profile-layout.tsx delete mode 100644 apps/web/src/components/layouts/standard-layout/home-link.tsx delete mode 100644 apps/web/src/components/layouts/standard-layout/mobile-navigation.tsx create mode 100644 apps/web/src/components/layouts/standard-layout/top-bar.tsx delete mode 100644 apps/web/src/components/layouts/standard-layout/user-dropdown.tsx create mode 100644 apps/web/src/components/page-dialog.tsx create mode 100644 apps/web/src/components/participant-avatar-bar.tsx create mode 100644 apps/web/src/components/poll-status.tsx delete mode 100644 apps/web/src/components/poll/legacy-poll-notice.tsx create mode 100644 apps/web/src/components/poll/manage-poll/delete-poll-dialog.tsx delete mode 100644 apps/web/src/components/poll/manage-poll/delete-poll-form.tsx create mode 100644 apps/web/src/components/poll/manage-poll/finalize-poll-dialog.tsx create mode 100644 apps/web/src/components/poll/manage-poll/notify-participants-form.tsx create mode 100644 apps/web/src/components/poll/participant-avatar.tsx create mode 100644 apps/web/src/components/poll/poll-context-provider.tsx delete mode 100644 apps/web/src/components/poll/use-delete-participant-modal.ts delete mode 100644 apps/web/src/components/preferences.tsx delete mode 100644 apps/web/src/components/profile.tsx delete mode 100644 apps/web/src/components/profile/user-details.tsx create mode 100644 apps/web/src/components/settings/change-email-form.tsx create mode 100644 apps/web/src/components/settings/date-time-preferences.tsx create mode 100644 apps/web/src/components/settings/language-preference.tsx create mode 100644 apps/web/src/components/settings/profile-settings.tsx create mode 100644 apps/web/src/components/settings/settings-section.tsx delete mode 100644 apps/web/src/components/sharing.tsx create mode 100644 apps/web/src/components/skeleton.tsx create mode 100644 apps/web/src/components/table.tsx create mode 100644 apps/web/src/components/text-summary.tsx create mode 100644 apps/web/src/components/time-format-picker.tsx create mode 100644 apps/web/src/components/time-zone-picker/time-zone-select.tsx create mode 100644 apps/web/src/components/user-avatar/gradients.ts create mode 100644 apps/web/src/components/user-dropdown.tsx create mode 100644 apps/web/src/components/user.tsx create mode 100644 apps/web/src/components/vote-summary-progress-bar.tsx create mode 100644 apps/web/src/contexts/current-event.ts create mode 100644 apps/web/src/contexts/permissions.ts create mode 100644 apps/web/src/contexts/poll.tsx create mode 100644 apps/web/src/contexts/preferences.tsx create mode 100644 apps/web/src/contexts/role.tsx create mode 100644 apps/web/src/contexts/time-preferences.tsx delete mode 100644 apps/web/src/pages/demo.tsx delete mode 100644 apps/web/src/pages/home.tsx create mode 100644 apps/web/src/pages/invite/[urlId].tsx create mode 100644 apps/web/src/pages/poll/[urlId].tsx create mode 100644 apps/web/src/pages/poll/[urlId]/edit-details.tsx create mode 100644 apps/web/src/pages/poll/[urlId]/edit-options.tsx create mode 100644 apps/web/src/pages/poll/[urlId]/finalize.tsx create mode 100644 apps/web/src/pages/polls.tsx delete mode 100644 apps/web/src/pages/profile.tsx create mode 100644 apps/web/src/pages/settings/billing.tsx create mode 100644 apps/web/src/pages/settings/preferences.tsx create mode 100644 apps/web/src/pages/settings/profile.tsx create mode 100644 apps/web/src/utils/color-hash.ts create mode 100644 apps/web/tests/edit-options-page.ts create mode 100644 apps/web/tests/invite-page.ts create mode 100644 apps/web/tests/mocks.ts create mode 100644 apps/web/tests/new-poll-page.ts create mode 100644 apps/web/tests/poll-page.ts create mode 100644 packages/backend/trpc/routers/polls/options.ts create mode 100644 packages/backend/trpc/routers/user-preferences.ts create mode 100644 packages/backend/utils/date.ts create mode 100644 packages/database/prisma/migrations/20230614141138_v3/migration.sql create mode 100644 packages/database/prisma/migrations/20230615111329_events/migration.sql create mode 100644 packages/database/prisma/migrations/20230615163229_remove_selected_option_id/migration.sql create mode 100644 packages/emails/src/templates/finalized-host.tsx create mode 100644 packages/emails/src/templates/finalized-participant.tsx create mode 100644 packages/ui/accordion.tsx create mode 100644 packages/ui/alert.tsx create mode 100644 packages/ui/button.tsx create mode 100644 packages/ui/card.tsx create mode 100644 packages/ui/checkbox.tsx create mode 100644 packages/ui/command.tsx create mode 100644 packages/ui/dialog.tsx create mode 100644 packages/ui/dropdown-menu.tsx create mode 100644 packages/ui/form.tsx create mode 100644 packages/ui/index.ts create mode 100644 packages/ui/input.tsx create mode 100644 packages/ui/label.tsx create mode 100644 packages/ui/lib/utils.ts create mode 100644 packages/ui/package.json rename {apps/web/src/components => packages/ui}/popover.tsx (72%) create mode 100644 packages/ui/radio-group.tsx create mode 100644 packages/ui/select.tsx create mode 100644 packages/ui/switch.tsx create mode 100644 packages/ui/table.tsx create mode 100644 packages/ui/textarea.tsx create mode 100644 packages/ui/tooltip.tsx create mode 100644 packages/ui/tsconfig.json create mode 100644 packages/ui/types.ts diff --git a/.eslintrc.json b/.eslintrc.json index 4d7af7256..20647c2ab 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -7,7 +7,10 @@ "files": ["**/*.ts", "**/*.tsx"], "parser": "@typescript-eslint/parser", "plugins": ["@typescript-eslint"], - "extends": ["plugin:@typescript-eslint/recommended"] + "extends": ["plugin:@typescript-eslint/recommended"], + "rules": { + "@typescript-eslint/no-unused-vars": "error" + } } ], "rules": { @@ -16,7 +19,7 @@ "import/first": "error", "import/newline-after-import": "error", "import/no-duplicates": "error", - "@typescript-eslint/no-unused-vars": "error", - "no-console": ["error", { "allow": ["warn", "error", "info"] }] + "no-console": ["error", { "allow": ["warn", "error", "info"] }], + "no-unused-vars": "error" } } diff --git a/apps/docs/images/self-hosting/spacetime.html b/apps/docs/images/self-hosting/spacetime.html new file mode 100644 index 000000000..504c34e7a --- /dev/null +++ b/apps/docs/images/self-hosting/spacetime.html @@ -0,0 +1,227 @@ + + + + + spacetime + + + + + + + + + github + github + +
+ Yeah, +
+
+ the world's pretty big. +
+
+ Asia/KashgarAsia/JerusalemAmerica/PhoenixEurope/BerlinAfrica/GaboroneAsia/SeoulAfrica/Dar_es_SalaamAmerica/Port-au-PrinceAmerica/MontrealAmerica/PanamaAsia/Ho_Chi_MinhAmerica/BoiseAsia/BaghdadAfrica/El_AaiunEurope/ZagrebAmerica/MeridaAfrica/NouakchottAmerica/SantiagoAfrica/BissauAmerica/Los_AngelesAmerica/SitkaAsia/JakartaAsia/HarbinAmerica/BelizeAmerica/VancouverAsia/TbilisiAsia/YerevanEurope/TallinnAsia/MagadanAustralia/PerthAmerica/North_Dakota/New_SalemEurope/VilniusAsia/BakuAsia/TehranEurope/LisbonAmerica/AraguainaAmerica/Coral_HarbourAsia/NovokuznetskAsia/ThimphuAustralia/DarwinAmerica/Argentina/CatamarcaAfrica/FreetownAtlantic/South_GeorgiaAfrica/AccraAsia/SakhalinAustralia/AdelaideAmerica/North_Dakota/BeulahAustralia/EuclaAmerica/JamaicaEurope/TiraneAsia/VladivostokAmerica/ScoresbysundAmerica/MonctonAfrica/BujumburaAmerica/Glace_BayAtlantic/StanleyAfrica/Porto-NovoAmerica/Argentina/Rio_GallegosAmerica/Indiana/IndianapolisAsia/AshgabatAmerica/DetroitAmerica/MenomineeAsia/NovosibirskAfrica/LagosAmerica/GodthabAmerica/YakutatEurope/VolgogradAsia/RangoonAsia/QatarIndian/AntananarivoAsia/KhandygaAmerica/North_Dakota/CenterArctic/LongyearbyenAustralia/HobartPacific/GalapagosAsia/OralAsia/TaipeiAmerica/Argentina/SaltaAustralia/Broken_HillAmerica/Dawson_CreekAfrica/MbabaneAfrica/CairoAmerica/Cambridge_BayAsia/AqtauAsia/HovduninhabitedAsia/UlaanbaatarAfrica/NairobiAmerica/Argentina/TucumanAmerica/Kentucky/LouisvilleAustralia/MelbourneAmerica/HalifaxAmerica/OjinagaAmerica/NomeAsia/JayapuraAsia/Ust-NeraAsia/YakutskAsia/IrkutskAmerica/TegucigalpaEurope/ZaporozhyeAmerica/FortalezaAmerica/YellowknifePacific/FijiEurope/BratislavaAmerica/IqaluitAmerica/ResoluteAfrica/BrazzavilleAfrica/LibrevilleAmerica/New_YorkAsia/SamarkandAfrica/JohannesburgAmerica/BahiaEurope/ZurichAmerica/ParamariboEurope/SamaraAsia/PyongyangEurope/LjubljanaPacific/Port_MoresbyAmerica/ManausAfrica/KampalaAmerica/Rio_BrancoAfrica/BamakoAmerica/Argentina/MendozaAsia/YekaterinburgAmerica/Goose_BayAfrica/ConakryAmerica/Argentina/JujuyAfrica/AsmaraAmerica/ChihuahuaEurope/WarsawAsia/KarachiEurope/IstanbulAfrica/BanguiAmerica/LimaAsia/AdenAmerica/Port_of_SpainAmerica/TijuanaAsia/NicosiaEurope/SimferopolEurope/BudapestAmerica/Santo_DomingoEurope/KaliningradEurope/LondonPacific/GuadalcanalAsia/ShanghaiAfrica/WindhoekAsia/DhakaEurope/MariehamnAmerica/La_PazAmerica/RecifeEurope/AthensAmerica/Mexico_CityAmerica/ChicagoAsia/AmmanAmerica/Indiana/WinamacAtlantic/ReykjavikAfrica/MogadishuAfrica/MalaboAfrica/NdjamenaAsia/ChoibalsanAsia/RiyadhAfrica/BlantyreAustralia/SydneyAsia/DushanbeEurope/BelgradeEurope/LuxembourgEurope/PodgoricaAsia/BruneiAmerica/AsuncionEurope/PragueAmerica/AtikokanAmerica/PangnirtungAfrica/DakarAmerica/EdmontonAmerica/Argentina/Buenos_AiresAsia/KuwaitAsia/BishkekEurope/MoscowAustralia/BrisbaneAsia/QyzylordaAsia/AqtobeAmerica/EirunepeAmerica/TorontoPacific/HonoluluAmerica/MontevideoAmerica/Blanc-SablonAsia/TashkentAmerica/ManaguaAfrica/NiameyAmerica/Argentina/La_RiojaAfrica/BanjulAsia/Phnom_PenhAmerica/CrestonPacific/EfateEurope/BrusselsAmerica/El_SalvadorAfrica/OuagadougouIndian/KerguelenAtlantic/CanaryAsia/VientianeEurope/BucharestAfrica/LusakaAsia/KathmanduAfrica/HarareAsia/BangkokAmerica/DenverAfrica/LomeEurope/KievEurope/ViennaEurope/RomeAsia/ManilaAmerica/Argentina/CordobaAsia/TokyoAfrica/KigaliEurope/ChisinauAmerica/WinnipegAmerica/NassauEurope/DublinAsia/KuchingAmerica/Argentina/UshuaiaAsia/ColomboAsia/KrasnoyarskAmerica/St_JohnsAfrica/LuandaAmerica/GuyanaEurope/ParisAfrica/AbidjanAmerica/ReginaAmerica/ThuleAmerica/Campo_GrandeAfrica/TunisAmerica/Rankin_InletEurope/CopenhagenAsia/DubaiAmerica/WhitehorseAmerica/Indiana/VincennesAmerica/SantaremAfrica/DjiboutiAmerica/Argentina/San_LuisAfrica/CasablancaAsia/HebronAmerica/MaceioAfrica/KhartoumAfrica/DoualaAsia/Kuala_LumpurAfrica/KinshasaEurope/RigaAmerica/Sao_PauloAfrica/TripoliEurope/MadridAmerica/DanmarkshavnEurope/SkopjeAmerica/Porto_VelhoAfrica/MaseruEurope/SofiaAsia/DiliAmerica/Argentina/San_JuanAsia/AlmatyEurope/SarajevoAmerica/Boa_VistaAfrica/Addis_AbabaAsia/PontianakAfrica/LubumbashiEurope/HelsinkiAfrica/MonroviaAsia/MuscatEurope/OsloAmerica/CayenneAsia/KolkataAmerica/CuiabaAfrica/MaputoAsia/AnadyrAsia/KabulAmerica/Santa_IsabelAsia/DamascusAmerica/JuneauPacific/NoumeaAsia/KamchatkaAmerica/AnchorageAmerica/MatamorosAsia/OmskAfrica/AlgiersAmerica/GuayaquilPacific/AucklandEurope/AmsterdamAmerica/MonterreyAfrica/JubaEurope/StockholmAmerica/Costa_RicaAmerica/CaracasAsia/Hong_KongEurope/UzhgorodAsia/MakassarEurope/MinskAmerica/HavanaAmerica/CancunAmerica/HermosilloAmerica/BelemAsia/ChongqingAsia/BeirutAmerica/GuatemalaAsia/UrumqiAmerica/MazatlanAmerica/Puerto_RicoAmerica/Bogota
+
+ but this library is very small ✨ +
+
+ Europe/London: +
June 15th
+ 3:53pm +
+ â–¼ +
6am
noon
6pm
10pm
jan
feb
mar
apr
may
jun
jul
aug
sept
oct
nov
dec
 
ï¹£ hour +
ï¹£ minute +
ï¹£ day +
ï¹£ month +
ï¹£ week +
ï¹£ year +
+ + +
+ spacetime date-utility +
+ +
+ 💥 - local model of remote TZ +
+
+ 💥 - DST, leap-year, hemisphere! +
+
+ 💥 - + moment-like💙 API +
+
+ 💥 - quarter, season, and week-orientation +
+
+ +
+ 40 + kb +
+
that's more like it
+
+
+
+
+ npm install spacetime +
or
+ <script src='https://unpkg.com/spacetime'></script> +
+
+ 👹 spacetime does some ugly things. +
+
+ it can sometimes get confused. 🌌 +
+
+ but by making realistic compromises, spacetime considerably under-weighs most date libraries.
+
+ It lets you have a mostly-great time, without thinking about awful things. +
+
+
+
+ +
+ now go crazy:
+
+
+ +
how the?
+ it is currently 1686840780810 everywhere (even in Australia). +
[Fake-Paris]
+ time +
= + Epoch time
+ (1686840780810) +
ï¹£ + your computer's offset
+ (-60 mins) +
+ + current offset
Europe/Paris
+ (with DST) +
+ that's not too bad. +

+ but hold up - +

+ to change the date, you have to shift to your computer's offset, make the calendar-based change, then shift it back to Paris time, + in some kind of distopian web programming: +
+ this is error-prone!

+ one challenge is that different DST rules may apply on your computer, compared to Paris-time.
- you may miss a DST-shift while pretending to be in Paris, but lying about it.
+ another possibility is making a very specific time locally, that doesn't exist in Paris-time. +
spacetime 🎉 + (mostly) addresses these problems in post-processing the date after every transformation, + to ensure the funny-business is a minimum.

+ if it's 9:37pm, and you move forward 6 months, it should still be 9:37pm.
+ - even the day of the month should remain stable too, when possible +

+ There is admittedly, some guesswork involved. +
+ but what a pleasure, to let this little library do that for you + 🌈

+ not for every use-case, fine for most. - +
API:
main:
+ goto() +
+ clone() +
+ timezone() +
+ format() +
+ startOf() +
+ endOf() +
+ add() +
+ subtract() +
+ next() +
+ last() +
+ isAfter() +
+ isBefore() +
+ isEqual() +
+ isSame() +
+ diff() +
getters/setters
+ millisecond() +
+ second() +
+ minute() +
+ hour() +
+ date() +
+ month() +
+ year() +
+ dayOfYear() +
+ time() +
+ week() +
+ quarter() +
+ season() +
+ hourFloat() +
+ day() +
+ ampm() +
+ dayTime() +
+ monthName() +
utils:
+ set() +
+ d() +
+ isValid() +
+ log() +
+ progress() +
+ leapYear() +
+ inDST() +
+ hasDST() +
+ offset() +
+ isAsleep() +
+ + +

+

+

+
+ Apache-2.0 - by SmallWins +
+ + + + + + + + + + + \ No newline at end of file diff --git a/apps/docs/images/self-hosting/spacetime_files/codemirror.css b/apps/docs/images/self-hosting/spacetime_files/codemirror.css new file mode 100644 index 000000000..b962b3837 --- /dev/null +++ b/apps/docs/images/self-hosting/spacetime_files/codemirror.css @@ -0,0 +1,340 @@ +/* BASICS */ + +.CodeMirror { + /* Set height, width, borders, and global font properties here */ + font-family: monospace; + height: 300px; + color: black; +} + +/* PADDING */ + +.CodeMirror-lines { + padding: 4px 0; /* Vertical padding around content */ +} +.CodeMirror pre { + padding: 0 4px; /* Horizontal padding of content */ +} + +.CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler { + background-color: white; /* The little square between H and V scrollbars */ +} + +/* GUTTER */ + +.CodeMirror-gutters { + border-right: 1px solid #ddd; + background-color: #f7f7f7; + white-space: nowrap; +} +.CodeMirror-linenumbers {} +.CodeMirror-linenumber { + padding: 0 3px 0 5px; + min-width: 20px; + text-align: right; + color: #999; + white-space: nowrap; +} + +.CodeMirror-guttermarker { color: black; } +.CodeMirror-guttermarker-subtle { color: #999; } + +/* CURSOR */ + +.CodeMirror-cursor { + border-left: 1px solid black; + border-right: none; + width: 0; +} +/* Shown when moving in bi-directional text */ +.CodeMirror div.CodeMirror-secondarycursor { + border-left: 1px solid silver; +} +.cm-fat-cursor .CodeMirror-cursor { + width: auto; + border: 0 !important; + background: #7e7; +} +.cm-fat-cursor div.CodeMirror-cursors { + z-index: 1; +} + +.cm-animate-fat-cursor { + width: auto; + border: 0; + -webkit-animation: blink 1.06s steps(1) infinite; + -moz-animation: blink 1.06s steps(1) infinite; + animation: blink 1.06s steps(1) infinite; + background-color: #7e7; +} +@-moz-keyframes blink { + 0% {} + 50% { background-color: transparent; } + 100% {} +} +@-webkit-keyframes blink { + 0% {} + 50% { background-color: transparent; } + 100% {} +} +@keyframes blink { + 0% {} + 50% { background-color: transparent; } + 100% {} +} + +/* Can style cursor different in overwrite (non-insert) mode */ +.CodeMirror-overwrite .CodeMirror-cursor {} + +.cm-tab { display: inline-block; text-decoration: inherit; } + +.CodeMirror-rulers { + position: absolute; + left: 0; right: 0; top: -50px; bottom: -20px; + overflow: hidden; +} +.CodeMirror-ruler { + border-left: 1px solid #ccc; + top: 0; bottom: 0; + position: absolute; +} + +/* DEFAULT THEME */ + +.cm-s-default .cm-header {color: blue;} +.cm-s-default .cm-quote {color: #090;} +.cm-negative {color: #d44;} +.cm-positive {color: #292;} +.cm-header, .cm-strong {font-weight: bold;} +.cm-em {font-style: italic;} +.cm-link {text-decoration: underline;} +.cm-strikethrough {text-decoration: line-through;} + +.cm-s-default .cm-keyword {color: #708;} +.cm-s-default .cm-atom {color: #219;} +.cm-s-default .cm-number {color: #164;} +.cm-s-default .cm-def {color: #00f;} +.cm-s-default .cm-variable, +.cm-s-default .cm-punctuation, +.cm-s-default .cm-property, +.cm-s-default .cm-operator {} +.cm-s-default .cm-variable-2 {color: #05a;} +.cm-s-default .cm-variable-3 {color: #085;} +.cm-s-default .cm-comment {color: #a50;} +.cm-s-default .cm-string {color: #a11;} +.cm-s-default .cm-string-2 {color: #f50;} +.cm-s-default .cm-meta {color: #555;} +.cm-s-default .cm-qualifier {color: #555;} +.cm-s-default .cm-builtin {color: #30a;} +.cm-s-default .cm-bracket {color: #997;} +.cm-s-default .cm-tag {color: #170;} +.cm-s-default .cm-attribute {color: #00c;} +.cm-s-default .cm-hr {color: #999;} +.cm-s-default .cm-link {color: #00c;} + +.cm-s-default .cm-error {color: #f00;} +.cm-invalidchar {color: #f00;} + +.CodeMirror-composing { border-bottom: 2px solid; } + +/* Default styles for common addons */ + +div.CodeMirror span.CodeMirror-matchingbracket {color: #0f0;} +div.CodeMirror span.CodeMirror-nonmatchingbracket {color: #f22;} +.CodeMirror-matchingtag { background: rgba(255, 150, 0, .3); } +.CodeMirror-activeline-background {background: #e8f2ff;} + +/* STOP */ + +/* The rest of this file contains styles related to the mechanics of + the editor. You probably shouldn't touch them. */ + +.CodeMirror { + position: relative; + overflow: hidden; + background: white; +} + +.CodeMirror-scroll { + overflow: scroll !important; /* Things will break if this is overridden */ + /* 30px is the magic margin used to hide the element's real scrollbars */ + /* See overflow: hidden in .CodeMirror */ + margin-bottom: -30px; margin-right: -30px; + padding-bottom: 30px; + height: 100%; + outline: none; /* Prevent dragging from highlighting the element */ + position: relative; +} +.CodeMirror-sizer { + position: relative; + border-right: 30px solid transparent; +} + +/* The fake, visible scrollbars. Used to force redraw during scrolling + before actual scrolling happens, thus preventing shaking and + flickering artifacts. */ +.CodeMirror-vscrollbar, .CodeMirror-hscrollbar, .CodeMirror-scrollbar-filler, .CodeMirror-gutter-filler { + position: absolute; + z-index: 6; + display: none; +} +.CodeMirror-vscrollbar { + right: 0; top: 0; + overflow-x: hidden; + overflow-y: scroll; +} +.CodeMirror-hscrollbar { + bottom: 0; left: 0; + overflow-y: hidden; + overflow-x: scroll; +} +.CodeMirror-scrollbar-filler { + right: 0; bottom: 0; +} +.CodeMirror-gutter-filler { + left: 0; bottom: 0; +} + +.CodeMirror-gutters { + position: absolute; left: 0; top: 0; + min-height: 100%; + z-index: 3; +} +.CodeMirror-gutter { + white-space: normal; + height: 100%; + display: inline-block; + vertical-align: top; + margin-bottom: -30px; +} +.CodeMirror-gutter-wrapper { + position: absolute; + z-index: 4; + background: none !important; + border: none !important; +} +.CodeMirror-gutter-background { + position: absolute; + top: 0; bottom: 0; + z-index: 4; +} +.CodeMirror-gutter-elt { + position: absolute; + cursor: default; + z-index: 4; +} +.CodeMirror-gutter-wrapper ::selection { background-color: transparent } +.CodeMirror-gutter-wrapper ::-moz-selection { background-color: transparent } + +.CodeMirror-lines { + cursor: text; + min-height: 1px; /* prevents collapsing before first draw */ +} +.CodeMirror pre { + /* Reset some styles that the rest of the page might have set */ + -moz-border-radius: 0; -webkit-border-radius: 0; border-radius: 0; + border-width: 0; + background: transparent; + font-family: inherit; + font-size: inherit; + margin: 0; + white-space: pre; + word-wrap: normal; + line-height: inherit; + color: inherit; + z-index: 2; + position: relative; + overflow: visible; + -webkit-tap-highlight-color: transparent; + -webkit-font-variant-ligatures: contextual; + font-variant-ligatures: contextual; +} +.CodeMirror-wrap pre { + word-wrap: break-word; + white-space: pre-wrap; + word-break: normal; +} + +.CodeMirror-linebackground { + position: absolute; + left: 0; right: 0; top: 0; bottom: 0; + z-index: 0; +} + +.CodeMirror-linewidget { + position: relative; + z-index: 2; + overflow: auto; +} + +.CodeMirror-widget {} + +.CodeMirror-rtl pre { direction: rtl; } + +.CodeMirror-code { + outline: none; +} + +/* Force content-box sizing for the elements where we expect it */ +.CodeMirror-scroll, +.CodeMirror-sizer, +.CodeMirror-gutter, +.CodeMirror-gutters, +.CodeMirror-linenumber { + -moz-box-sizing: content-box; + box-sizing: content-box; +} + +.CodeMirror-measure { + position: absolute; + width: 100%; + height: 0; + overflow: hidden; + visibility: hidden; +} + +.CodeMirror-cursor { + position: absolute; + pointer-events: none; +} +.CodeMirror-measure pre { position: static; } + +div.CodeMirror-cursors { + visibility: hidden; + position: relative; + z-index: 3; +} +div.CodeMirror-dragcursors { + visibility: visible; +} + +.CodeMirror-focused div.CodeMirror-cursors { + visibility: visible; +} + +.CodeMirror-selected { background: #d9d9d9; } +.CodeMirror-focused .CodeMirror-selected { background: #d7d4f0; } +.CodeMirror-crosshair { cursor: crosshair; } +.CodeMirror-line::selection, .CodeMirror-line > span::selection, .CodeMirror-line > span > span::selection { background: #d7d4f0; } +.CodeMirror-line::-moz-selection, .CodeMirror-line > span::-moz-selection, .CodeMirror-line > span > span::-moz-selection { background: #d7d4f0; } + +.cm-searching { + background: #ffa; + background: rgba(255, 255, 0, .4); +} + +/* Used to force a border model for a node */ +.cm-force-border { padding-right: .1px; } + +@media print { + /* Hide the cursor when printing */ + .CodeMirror div.CodeMirror-cursors { + visibility: hidden; + } +} + +/* See issue #2901 */ +.cm-tab-wrap-hack:after { content: ''; } + +/* Help users use markselection to safely style text background */ +span.CodeMirror-selectedtext { background: none; } diff --git a/apps/docs/images/self-hosting/spacetime_files/codemirror.js b/apps/docs/images/self-hosting/spacetime_files/codemirror.js new file mode 100644 index 000000000..cf6121f8f --- /dev/null +++ b/apps/docs/images/self-hosting/spacetime_files/codemirror.js @@ -0,0 +1 @@ +(function(global,factory){typeof exports==="object"&&typeof module!=="undefined"?module.exports=factory():typeof define==="function"&&define.amd?define(factory):global.CodeMirror=factory()})(this,(function(){"use strict";var userAgent=navigator.userAgent;var platform=navigator.platform;var gecko=/gecko\/\d/i.test(userAgent);var ie_upto10=/MSIE \d/.test(userAgent);var ie_11up=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(userAgent);var edge=/Edge\/(\d+)/.exec(userAgent);var ie=ie_upto10||ie_11up||edge;var ie_version=ie&&(ie_upto10?document.documentMode||6:+(edge||ie_11up)[1]);var webkit=!edge&&/WebKit\//.test(userAgent);var qtwebkit=webkit&&/Qt\/\d+\.\d+/.test(userAgent);var chrome=!edge&&/Chrome\//.test(userAgent);var presto=/Opera\//.test(userAgent);var safari=/Apple Computer/.test(navigator.vendor);var mac_geMountainLion=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(userAgent);var phantom=/PhantomJS/.test(userAgent);var ios=!edge&&/AppleWebKit/.test(userAgent)&&/Mobile\/\w+/.test(userAgent);var android=/Android/.test(userAgent);var mobile=ios||android||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(userAgent);var mac=ios||/Mac/.test(platform);var chromeOS=/\bCrOS\b/.test(userAgent);var windows=/win/i.test(platform);var presto_version=presto&&userAgent.match(/Version\/(\d*\.\d*)/);if(presto_version){presto_version=Number(presto_version[1])}if(presto_version&&presto_version>=15){presto=false;webkit=true}var flipCtrlCmd=mac&&(qtwebkit||presto&&(presto_version==null||presto_version<12.11));var captureRightClick=gecko||ie&&ie_version>=9;function classTest(cls){return new RegExp("(^|\\s)"+cls+"(?:$|\\s)\\s*")}var rmClass=function(node,cls){var current=node.className;var match=classTest(cls).exec(current);if(match){var after=current.slice(match.index+match[0].length);node.className=current.slice(0,match.index)+(after?match[1]+after:"")}};function removeChildren(e){for(var count=e.childNodes.length;count>0;--count){e.removeChild(e.firstChild)}return e}function removeChildrenAndAdd(parent,e){return removeChildren(parent).appendChild(e)}function elt(tag,content,className,style){var e=document.createElement(tag);if(className){e.className=className}if(style){e.style.cssText=style}if(typeof content=="string"){e.appendChild(document.createTextNode(content))}else if(content){for(var i=0;i=end){return n+(end-i)}n+=nextTab-i;n+=tabSize-n%tabSize;i=nextTab+1}}var Delayed=function(){this.id=null};Delayed.prototype.set=function(ms,f){clearTimeout(this.id);this.id=setTimeout(f,ms)};function indexOf(array,elt){for(var i=0;i=goal){return pos+Math.min(skipped,goal-col)}col+=nextTab-pos;col+=tabSize-col%tabSize;pos=nextTab+1;if(col>=goal){return pos}}}var spaceStrs=[""];function spaceStr(n){while(spaceStrs.length<=n){spaceStrs.push(lst(spaceStrs)+" ")}return spaceStrs[n]}function lst(arr){return arr[arr.length-1]}function map(array,f){var out=[];for(var i=0;i"€"&&(ch.toUpperCase()!=ch.toLowerCase()||nonASCIISingleCaseWordChar.test(ch))}function isWordChar(ch,helper){if(!helper){return isWordCharBasic(ch)}if(helper.source.indexOf("\\w")>-1&&isWordCharBasic(ch)){return true}return helper.test(ch)}function isEmpty(obj){for(var n in obj){if(obj.hasOwnProperty(n)&&obj[n]){return false}}return true}var extendingChars=/[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;function isExtendingChar(ch){return ch.charCodeAt(0)>=768&&extendingChars.test(ch)}function skipExtendingChars(str,pos,dir){while((dir<0?pos>0:pos=doc.size){throw new Error("There is no line "+(n+doc.first)+" in the document.")}var chunk=doc;while(!chunk.lines){for(var i=0;;++i){var child=chunk.children[i],sz=child.chunkSize();if(n=doc.first&&llast){return Pos(last,getLine(doc,last).text.length)}return clipToLen(pos,getLine(doc,pos.line).text.length)}function clipToLen(pos,linelen){var ch=pos.ch;if(ch==null||ch>linelen){return Pos(pos.line,linelen)}else if(ch<0){return Pos(pos.line,0)}else{return pos}}function clipPosArray(doc,array){var out=[];for(var i=0;i=startCh:span.to>startCh);(nw||(nw=[])).push(new MarkedSpan(marker,span.from,endsAfter?null:span.to))}}}return nw}function markedSpansAfter(old,endCh,isInsert){var nw;if(old){for(var i=0;i=endCh:span.to>endCh);if(endsAfter||span.from==endCh&&marker.type=="bookmark"&&(!isInsert||span.marker.insertLeft)){var startsBefore=span.from==null||(marker.inclusiveLeft?span.from<=endCh:span.from0&&first){for(var i$2=0;i$20){continue}var newParts=[j,1],dfrom=cmp(p.from,m.from),dto=cmp(p.to,m.to);if(dfrom<0||!mk.inclusiveLeft&&!dfrom){newParts.push({from:p.from,to:m.from})}if(dto>0||!mk.inclusiveRight&&!dto){newParts.push({from:m.to,to:p.to})}parts.splice.apply(parts,newParts);j+=newParts.length-3}}return parts}function detachMarkedSpans(line){var spans=line.markedSpans;if(!spans){return}for(var i=0;i=0&&toCmp<=0||fromCmp<=0&&toCmp>=0){continue}if(fromCmp<=0&&(sp.marker.inclusiveRight&&marker.inclusiveLeft?cmp(found.to,from)>=0:cmp(found.to,from)>0)||fromCmp>=0&&(sp.marker.inclusiveRight&&marker.inclusiveLeft?cmp(found.from,to)<=0:cmp(found.from,to)<0)){return true}}}}function visualLine(line){var merged;while(merged=collapsedSpanAtStart(line)){line=merged.find(-1,true).line}return line}function visualLineEnd(line){var merged;while(merged=collapsedSpanAtEnd(line)){line=merged.find(1,true).line}return line}function visualLineContinued(line){var merged,lines;while(merged=collapsedSpanAtEnd(line)){line=merged.find(1,true).line;(lines||(lines=[])).push(line)}return lines}function visualLineNo(doc,lineN){var line=getLine(doc,lineN),vis=visualLine(line);if(line==vis){return lineN}return lineNo(vis)}function visualLineEndNo(doc,lineN){if(lineN>doc.lastLine()){return lineN}var line=getLine(doc,lineN),merged;if(!lineIsHidden(doc,line)){return lineN}while(merged=collapsedSpanAtEnd(line)){line=merged.find(1,true).line}return lineNo(line)+1}function lineIsHidden(doc,line){var sps=sawCollapsedSpans&&line.markedSpans;if(sps){for(var sp=void 0,i=0;id.maxLineLength){d.maxLineLength=len;d.maxLine=line}}))}function iterateBidiSections(order,from,to,f){if(!order){return f(from,to,"ltr")}var found=false;for(var i=0;ifrom||from==to&&part.to==from){f(Math.max(part.from,from),Math.min(part.to,to),part.level==1?"rtl":"ltr");found=true}}if(!found){f(from,to,"ltr")}}var bidiOther=null;function getBidiPartAt(order,ch,sticky){var found;bidiOther=null;for(var i=0;ich){return i}if(cur.to==ch){if(cur.from!=cur.to&&sticky=="before"){found=i}else{bidiOther=i}}if(cur.from==ch){if(cur.from!=cur.to&&sticky!="before"){found=i}else{bidiOther=i}}}return found!=null?found:bidiOther}var bidiOrdering=function(){var lowTypes="bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN";var arabicTypes="nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";function charType(code){if(code<=247){return lowTypes.charAt(code)}else if(1424<=code&&code<=1524){return"R"}else if(1536<=code&&code<=1785){return arabicTypes.charAt(code-1536)}else if(1774<=code&&code<=2220){return"r"}else if(8192<=code&&code<=8203){return"w"}else if(code==8204){return"b"}else{return"L"}}var bidiRE=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;var isNeutral=/[stwN]/,isStrong=/[LRr]/,countsAsLeft=/[Lb1n]/,countsAsNum=/[1n]/;function BidiSpan(level,from,to){this.level=level;this.from=from;this.to=to}return function(str,direction){var outerType=direction=="ltr"?"L":"R";if(str.length==0||direction=="ltr"&&!bidiRE.test(str)){return false}var len=str.length,types=[];for(var i=0;iline.text.length?null:target}function moveLogically(line,start,dir){var ch=moveCharLogically(line,start.ch,dir);return ch==null?null:new Pos(start.line,ch,dir<0?"after":"before")}function endOfLine(visually,cm,lineObj,lineNo,dir){if(visually){var order=getOrder(lineObj,cm.doc.direction);if(order){var part=dir<0?lst(order):order[0];var moveInStorageOrder=dir<0==(part.level==1);var sticky=moveInStorageOrder?"after":"before";var ch;if(part.level>0){var prep=prepareMeasureForLine(cm,lineObj);ch=dir<0?lineObj.text.length-1:0;var targetTop=measureCharPrepared(cm,prep,ch).top;ch=findFirst((function(ch){return measureCharPrepared(cm,prep,ch).top==targetTop}),dir<0==(part.level==1)?part.from:part.to-1,ch);if(sticky=="before"){ch=moveCharLogically(lineObj,ch,1,true)}}else{ch=dir<0?part.to:part.from}return new Pos(lineNo,ch,sticky)}}return new Pos(lineNo,dir<0?lineObj.text.length:0,dir<0?"before":"after")}function moveVisually(cm,line,start,dir){var bidi=getOrder(line,cm.doc.direction);if(!bidi){return moveLogically(line,start,dir)}if(start.ch>=line.text.length){start.ch=line.text.length;start.sticky="before"}else if(start.ch<=0){start.ch=0;start.sticky="after"}var partPos=getBidiPartAt(bidi,start.ch,start.sticky),part=bidi[partPos];if(cm.doc.direction=="ltr"&&part.level%2==0&&(dir>0?part.to>start.ch:part.from=part.from&&ch>=wrappedLineExtent.begin:ch<=part.to&&ch<=wrappedLineExtent.end)){var sticky=moveInStorageOrder?"before":"after";return new Pos(start.line,ch,sticky)}}var searchInVisualLine=function(partPos,dir,wrappedLineExtent){var getRes=function(ch,moveInStorageOrder){return moveInStorageOrder?new Pos(start.line,mv(ch,1),"before"):new Pos(start.line,ch,"after")};for(;partPos>=0&&partPos0==(part.level!=1);var ch=moveInStorageOrder?wrappedLineExtent.begin:mv(wrappedLineExtent.end,-1);if(part.from<=ch&&ch0?wrappedLineExtent.end:mv(wrappedLineExtent.begin,-1);if(nextCh!=null&&!(dir>0&&nextCh==line.text.length)){res=searchInVisualLine(dir>0?0:bidi.length-1,dir,getWrappedLineExtent(nextCh));if(res){return res}}return null}var noHandlers=[];var on=function(emitter,type,f){if(emitter.addEventListener){emitter.addEventListener(type,f,false)}else if(emitter.attachEvent){emitter.attachEvent("on"+type,f)}else{var map$$1=emitter._handlers||(emitter._handlers={});map$$1[type]=(map$$1[type]||noHandlers).concat(f)}};function getHandlers(emitter,type){return emitter._handlers&&emitter._handlers[type]||noHandlers}function off(emitter,type,f){if(emitter.removeEventListener){emitter.removeEventListener(type,f,false)}else if(emitter.detachEvent){emitter.detachEvent("on"+type,f)}else{var map$$1=emitter._handlers,arr=map$$1&&map$$1[type];if(arr){var index=indexOf(arr,f);if(index>-1){map$$1[type]=arr.slice(0,index).concat(arr.slice(index+1))}}}}function signal(emitter,type){var handlers=getHandlers(emitter,type);if(!handlers.length){return}var args=Array.prototype.slice.call(arguments,2);for(var i=0;i0}function eventMixin(ctor){ctor.prototype.on=function(type,f){on(this,type,f)};ctor.prototype.off=function(type,f){off(this,type,f)}}function e_preventDefault(e){if(e.preventDefault){e.preventDefault()}else{e.returnValue=false}}function e_stopPropagation(e){if(e.stopPropagation){e.stopPropagation()}else{e.cancelBubble=true}}function e_defaultPrevented(e){return e.defaultPrevented!=null?e.defaultPrevented:e.returnValue==false}function e_stop(e){e_preventDefault(e);e_stopPropagation(e)}function e_target(e){return e.target||e.srcElement}function e_button(e){var b=e.which;if(b==null){if(e.button&1){b=1}else if(e.button&2){b=3}else if(e.button&4){b=2}}if(mac&&e.ctrlKey&&b==1){b=3}return b}var dragAndDrop=function(){if(ie&&ie_version<9){return false}var div=elt("div");return"draggable"in div||"dragDrop"in div}();var zwspSupported;function zeroWidthElement(measure){if(zwspSupported==null){var test=elt("span","​");removeChildrenAndAdd(measure,elt("span",[test,document.createTextNode("x")]));if(measure.firstChild.offsetHeight!=0){zwspSupported=test.offsetWidth<=1&&test.offsetHeight>2&&!(ie&&ie_version<8)}}var node=zwspSupported?elt("span","​"):elt("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");node.setAttribute("cm-text","");return node}var badBidiRects;function hasBadBidiRects(measure){if(badBidiRects!=null){return badBidiRects}var txt=removeChildrenAndAdd(measure,document.createTextNode("AØ®A"));var r0=range(txt,0,1).getBoundingClientRect();var r1=range(txt,1,2).getBoundingClientRect();removeChildren(measure);if(!r0||r0.left==r0.right){return false}return badBidiRects=r1.right-r0.right<3}var splitLinesAuto="\n\nb".split(/\n/).length!=3?function(string){var pos=0,result=[],l=string.length;while(pos<=l){var nl=string.indexOf("\n",pos);if(nl==-1){nl=string.length}var line=string.slice(pos,string.charAt(nl-1)=="\r"?nl-1:nl);var rt=line.indexOf("\r");if(rt!=-1){result.push(line.slice(0,rt));pos+=rt+1}else{result.push(line);pos=nl+1}}return result}:function(string){return string.split(/\r\n?|\n/)};var hasSelection=window.getSelection?function(te){try{return te.selectionStart!=te.selectionEnd}catch(e){return false}}:function(te){var range$$1;try{range$$1=te.ownerDocument.selection.createRange()}catch(e){}if(!range$$1||range$$1.parentElement()!=te){return false}return range$$1.compareEndPoints("StartToEnd",range$$1)!=0};var hasCopyEvent=function(){var e=elt("div");if("oncopy"in e){return true}e.setAttribute("oncopy","return;");return typeof e.oncopy=="function"}();var badZoomedRects=null;function hasBadZoomedRects(measure){if(badZoomedRects!=null){return badZoomedRects}var node=removeChildrenAndAdd(measure,elt("span","x"));var normal=node.getBoundingClientRect();var fromRange=range(node,0,1).getBoundingClientRect();return badZoomedRects=Math.abs(normal.left-fromRange.left)>1}var modes={};var mimeModes={};function defineMode(name,mode){if(arguments.length>2){mode.dependencies=Array.prototype.slice.call(arguments,2)}modes[name]=mode}function defineMIME(mime,spec){mimeModes[mime]=spec}function resolveMode(spec){if(typeof spec=="string"&&mimeModes.hasOwnProperty(spec)){spec=mimeModes[spec]}else if(spec&&typeof spec.name=="string"&&mimeModes.hasOwnProperty(spec.name)){var found=mimeModes[spec.name];if(typeof found=="string"){found={name:found}}spec=createObj(found,spec);spec.name=found.name}else if(typeof spec=="string"&&/^[\w\-]+\/[\w\-]+\+xml$/.test(spec)){return resolveMode("application/xml")}else if(typeof spec=="string"&&/^[\w\-]+\/[\w\-]+\+json$/.test(spec)){return resolveMode("application/json")}if(typeof spec=="string"){return{name:spec}}else{return spec||{name:"null"}}}function getMode(options,spec){spec=resolveMode(spec);var mfactory=modes[spec.name];if(!mfactory){return getMode(options,"text/plain")}var modeObj=mfactory(options,spec);if(modeExtensions.hasOwnProperty(spec.name)){var exts=modeExtensions[spec.name];for(var prop in exts){if(!exts.hasOwnProperty(prop)){continue}if(modeObj.hasOwnProperty(prop)){modeObj["_"+prop]=modeObj[prop]}modeObj[prop]=exts[prop]}}modeObj.name=spec.name;if(spec.helperType){modeObj.helperType=spec.helperType}if(spec.modeProps){for(var prop$1 in spec.modeProps){modeObj[prop$1]=spec.modeProps[prop$1]}}return modeObj}var modeExtensions={};function extendMode(mode,properties){var exts=modeExtensions.hasOwnProperty(mode)?modeExtensions[mode]:modeExtensions[mode]={};copyObj(properties,exts)}function copyState(mode,state){if(state===true){return state}if(mode.copyState){return mode.copyState(state)}var nstate={};for(var n in state){var val=state[n];if(val instanceof Array){val=val.concat([])}nstate[n]=val}return nstate}function innerMode(mode,state){var info;while(mode.innerMode){info=mode.innerMode(state);if(!info||info.mode==mode){break}state=info.state;mode=info.mode}return info||{mode:mode,state:state}}function startState(mode,a1,a2){return mode.startState?mode.startState(a1,a2):true}var StringStream=function(string,tabSize){this.pos=this.start=0;this.string=string;this.tabSize=tabSize||8;this.lastColumnPos=this.lastColumnValue=0;this.lineStart=0};StringStream.prototype.eol=function(){return this.pos>=this.string.length};StringStream.prototype.sol=function(){return this.pos==this.lineStart};StringStream.prototype.peek=function(){return this.string.charAt(this.pos)||undefined};StringStream.prototype.next=function(){if(this.posstart};StringStream.prototype.eatSpace=function(){var this$1=this;var start=this.pos;while(/[\s\u00a0]/.test(this.string.charAt(this.pos))){++this$1.pos}return this.pos>start};StringStream.prototype.skipToEnd=function(){this.pos=this.string.length};StringStream.prototype.skipTo=function(ch){var found=this.string.indexOf(ch,this.pos);if(found>-1){this.pos=found;return true}};StringStream.prototype.backUp=function(n){this.pos-=n};StringStream.prototype.column=function(){if(this.lastColumnPos0){return null}if(match&&consume!==false){this.pos+=match[0].length}return match}};StringStream.prototype.current=function(){return this.string.slice(this.start,this.pos)};StringStream.prototype.hideFirstChars=function(n,inner){this.lineStart+=n;try{return inner()}finally{this.lineStart-=n}};function highlightLine(cm,line,state,forceToEnd){var st=[cm.state.modeGen],lineClasses={};runMode(cm,line.text,cm.doc.mode,state,(function(end,style){return st.push(end,style)}),lineClasses,forceToEnd);var loop=function(o){var overlay=cm.state.overlays[o],i=1,at=0;runMode(cm,line.text,overlay.mode,true,(function(end,style){var start=i;while(atend){st.splice(i,1,end,st[i+1],i_end)}i+=2;at=Math.min(end,i_end)}if(!style){return}if(overlay.opaque){st.splice(start,i-start,end,"overlay "+style);i=start+2}else{for(;startcm.options.maxHighlightLength?copyState(cm.doc.mode,state):state);line.stateAfter=state;line.styles=result.styles;if(result.classes){line.styleClasses=result.classes}else if(line.styleClasses){line.styleClasses=null}if(updateFrontier===cm.doc.frontier){cm.doc.frontier++}}return line.styles}function getStateBefore(cm,n,precise){var doc=cm.doc,display=cm.display;if(!doc.mode.startState){return true}var pos=findStartLine(cm,n,precise),state=pos>doc.first&&getLine(doc,pos-1).stateAfter;if(!state){state=startState(doc.mode)}else{state=copyState(doc.mode,state)}doc.iter(pos,n,(function(line){processLine(cm,line.text,state);var save=pos==n-1||pos%5==0||pos>=display.viewFrom&&posstream.start){return style}}throw new Error("Mode "+mode.name+" failed to advance stream.")}function takeToken(cm,pos,precise,asArray){var getObj=function(copy){return{start:stream.start,end:stream.pos,string:stream.current(),type:style||null,state:copy?copyState(doc.mode,state):state}};var doc=cm.doc,mode=doc.mode,style;pos=clipPos(doc,pos);var line=getLine(doc,pos.line),state=getStateBefore(cm,pos.line,precise);var stream=new StringStream(line.text,cm.options.tabSize),tokens;if(asArray){tokens=[]}while((asArray||stream.poscm.options.maxHighlightLength){flattenSpans=false;if(forceToEnd){processLine(cm,text,state,stream.pos)}stream.pos=text.length;style=null}else{style=extractLineClasses(readToken(mode,stream,state,inner),lineClasses)}if(inner){var mName=inner[0].name;if(mName){style="m-"+(style?mName+" "+style:mName)}}if(!flattenSpans||curStyle!=style){while(curStartlim;--search){if(search<=doc.first){return doc.first}var line=getLine(doc,search-1);if(line.stateAfter&&(!precise||search<=doc.frontier)){return search}var indented=countColumn(line.text,null,cm.options.tabSize);if(minline==null||minindent>indented){minline=search-1;minindent=indented}}return minline}var Line=function(text,markedSpans,estimateHeight){this.text=text;attachMarkedSpans(this,markedSpans);this.height=estimateHeight?estimateHeight(this):1};Line.prototype.lineNo=function(){return lineNo(this)};eventMixin(Line);function updateLine(line,text,markedSpans,estimateHeight){line.text=text;if(line.stateAfter){line.stateAfter=null}if(line.styles){line.styles=null}if(line.order!=null){line.order=null}detachMarkedSpans(line);attachMarkedSpans(line,markedSpans);var estHeight=estimateHeight?estimateHeight(line):1;if(estHeight!=line.height){updateLineHeight(line,estHeight)}}function cleanUpLine(line){line.parent=null;detachMarkedSpans(line)}var styleToClassCache={};var styleToClassCacheWithMode={};function interpretTokenStyle(style,options){if(!style||/^\s*$/.test(style)){return null}var cache=options.addModeClass?styleToClassCacheWithMode:styleToClassCache;return cache[style]||(cache[style]=style.replace(/\S+/g,"cm-$&"))}function buildLineContent(cm,lineView){var content=eltP("span",null,null,webkit?"padding-right: .1px":null);var builder={pre:eltP("pre",[content],"CodeMirror-line"),content:content,col:0,pos:0,cm:cm,trailingSpace:false,splitSpaces:(ie||webkit)&&cm.getOption("lineWrapping")};lineView.measure={};for(var i=0;i<=(lineView.rest?lineView.rest.length:0);i++){var line=i?lineView.rest[i-1]:lineView.line,order=void 0;builder.pos=0;builder.addToken=buildToken;if(hasBadBidiRects(cm.display.measure)&&(order=getOrder(line,cm.doc.direction))){builder.addToken=buildTokenBadBidi(builder.addToken,order)}builder.map=[];var allowFrontierUpdate=lineView!=cm.display.externalMeasured&&lineNo(line);insertLineContent(line,builder,getLineStyles(cm,line,allowFrontierUpdate));if(line.styleClasses){if(line.styleClasses.bgClass){builder.bgClass=joinClasses(line.styleClasses.bgClass,builder.bgClass||"")}if(line.styleClasses.textClass){builder.textClass=joinClasses(line.styleClasses.textClass,builder.textClass||"")}}if(builder.map.length==0){builder.map.push(0,0,builder.content.appendChild(zeroWidthElement(cm.display.measure)))}if(i==0){lineView.measure.map=builder.map;lineView.measure.cache={}}else{(lineView.measure.maps||(lineView.measure.maps=[])).push(builder.map);(lineView.measure.caches||(lineView.measure.caches=[])).push({})}}if(webkit){var last=builder.content.lastChild;if(/\bcm-tab\b/.test(last.className)||last.querySelector&&last.querySelector(".cm-tab")){builder.content.className="cm-tab-wrap-hack"}}signal(cm,"renderLine",cm,lineView.line,builder.pre);if(builder.pre.className){builder.textClass=joinClasses(builder.pre.className,builder.textClass||"")}return builder}function defaultSpecialCharPlaceholder(ch){var token=elt("span","•","cm-invalidchar");token.title="\\u"+ch.charCodeAt(0).toString(16);token.setAttribute("aria-label",token.title);return token}function buildToken(builder,text,style,startStyle,endStyle,title,css){if(!text){return}var displayText=builder.splitSpaces?splitSpaces(text,builder.trailingSpace):text;var special=builder.cm.state.specialChars,mustWrap=false;var content;if(!special.test(text)){builder.col+=text.length;content=document.createTextNode(displayText);builder.map.push(builder.pos,builder.pos+text.length,content);if(ie&&ie_version<9){mustWrap=true}builder.pos+=text.length}else{content=document.createDocumentFragment();var pos=0;while(true){special.lastIndex=pos;var m=special.exec(text);var skipped=m?m.index-pos:text.length-pos;if(skipped){var txt=document.createTextNode(displayText.slice(pos,pos+skipped));if(ie&&ie_version<9){content.appendChild(elt("span",[txt]))}else{content.appendChild(txt)}builder.map.push(builder.pos,builder.pos+skipped,txt);builder.col+=skipped;builder.pos+=skipped}if(!m){break}pos+=skipped+1;var txt$1=void 0;if(m[0]=="\t"){var tabSize=builder.cm.options.tabSize,tabWidth=tabSize-builder.col%tabSize;txt$1=content.appendChild(elt("span",spaceStr(tabWidth),"cm-tab"));txt$1.setAttribute("role","presentation");txt$1.setAttribute("cm-text","\t");builder.col+=tabWidth}else if(m[0]=="\r"||m[0]=="\n"){txt$1=content.appendChild(elt("span",m[0]=="\r"?"â":"â¤","cm-invalidchar"));txt$1.setAttribute("cm-text",m[0]);builder.col+=1}else{txt$1=builder.cm.options.specialCharPlaceholder(m[0]);txt$1.setAttribute("cm-text",m[0]);if(ie&&ie_version<9){content.appendChild(elt("span",[txt$1]))}else{content.appendChild(txt$1)}builder.col+=1}builder.map.push(builder.pos,builder.pos+1,txt$1);builder.pos++}}builder.trailingSpace=displayText.charCodeAt(text.length-1)==32;if(style||startStyle||endStyle||mustWrap||css){var fullStyle=style||"";if(startStyle){fullStyle+=startStyle}if(endStyle){fullStyle+=endStyle}var token=elt("span",[content],fullStyle,css);if(title){token.title=title}return builder.content.appendChild(token)}builder.content.appendChild(content)}function splitSpaces(text,trailingBefore){if(text.length>1&&!/ /.test(text)){return text}var spaceBefore=trailingBefore,result="";for(var i=0;istart&&part.from<=start){break}}if(part.to>=end){return inner(builder,text,style,startStyle,endStyle,title,css)}inner(builder,text.slice(0,part.to-start),style,startStyle,null,title,css);startStyle=null;text=text.slice(part.to-start);start=part.to}}}function buildCollapsedSpan(builder,size,marker,ignoreWidget){var widget=!ignoreWidget&&marker.widgetNode;if(widget){builder.map.push(builder.pos,builder.pos+size,widget)}if(!ignoreWidget&&builder.cm.display.input.needsContentAttribute){if(!widget){widget=builder.content.appendChild(document.createElement("span"))}widget.setAttribute("cm-marker",marker.id)}if(widget){builder.cm.display.input.setUneditable(widget);builder.content.appendChild(widget)}builder.pos+=size;builder.trailingSpace=false}function insertLineContent(line,builder,styles){var spans=line.markedSpans,allText=line.text,at=0;if(!spans){for(var i$1=1;i$1pos||m.collapsed&&sp.to==pos&&sp.from==pos)){if(sp.to!=null&&sp.to!=pos&&nextChange>sp.to){nextChange=sp.to;spanEndStyle=""}if(m.className){spanStyle+=" "+m.className}if(m.css){css=(css?css+";":"")+m.css}if(m.startStyle&&sp.from==pos){spanStartStyle+=" "+m.startStyle}if(m.endStyle&&sp.to==nextChange){(endStyles||(endStyles=[])).push(m.endStyle,sp.to)}if(m.title&&!title){title=m.title}if(m.collapsed&&(!collapsed||compareCollapsedMarkers(collapsed.marker,m)<0)){collapsed=sp}}else if(sp.from>pos&&nextChange>sp.from){nextChange=sp.from}}if(endStyles){for(var j$1=0;j$1=len){break}var upto=Math.min(len,nextChange);while(true){if(text){var end=pos+text.length;if(!collapsed){var tokenText=end>upto?text.slice(0,upto-pos):text;builder.addToken(builder,tokenText,style?style+spanStyle:spanStyle,spanStartStyle,pos+tokenText.length==nextChange?spanEndStyle:"",title,css)}if(end>=upto){text=text.slice(upto-pos);pos=upto;break}pos=end;spanStartStyle=""}text=allText.slice(at,at=styles[i++]);style=interpretTokenStyle(styles[i++],builder.cm.options)}}}function LineView(doc,line,lineN){this.line=line;this.rest=visualLineContinued(line);this.size=this.rest?lineNo(lst(this.rest))-lineN+1:1;this.node=this.text=null;this.hidden=lineIsHidden(doc,line)}function buildViewArray(cm,from,to){var array=[],nextPos;for(var pos=from;pos2){heights.push((cur.bottom+next.top)/2-rect.top)}}}heights.push(rect.bottom-rect.top)}}function mapFromLineView(lineView,line,lineN){if(lineView.line==line){return{map:lineView.measure.map,cache:lineView.measure.cache}}for(var i=0;ilineN){return{map:lineView.measure.maps[i$1],cache:lineView.measure.caches[i$1],before:true}}}}function updateExternalMeasurement(cm,line){line=visualLine(line);var lineN=lineNo(line);var view=cm.display.externalMeasured=new LineView(cm.doc,line,lineN);view.lineN=lineN;var built=view.built=buildLineContent(cm,view);view.text=built.pre;removeChildrenAndAdd(cm.display.lineMeasure,built.pre);return view}function measureChar(cm,line,ch,bias){return measureCharPrepared(cm,prepareMeasureForLine(cm,line),ch,bias)}function findViewForLine(cm,lineN){if(lineN>=cm.display.viewFrom&&lineN=ext.lineN&&lineNch){end=mEnd-mStart;start=end-1;if(ch>=mEnd){collapse="right"}}if(start!=null){node=map$$1[i+2];if(mStart==mEnd&&bias==(node.insertLeft?"left":"right")){collapse=bias}if(bias=="left"&&start==0){while(i&&map$$1[i-2]==map$$1[i-3]&&map$$1[i-1].insertLeft){node=map$$1[(i-=3)+2];collapse="left"}}if(bias=="right"&&start==mEnd-mStart){while(i=0;i$1--){if((rect=rects[i$1]).left!=rect.right){break}}}return rect}function measureCharInner(cm,prepared,ch,bias){var place=nodeAndOffsetInLineMap(prepared.map,ch,bias);var node=place.node,start=place.start,end=place.end,collapse=place.collapse;var rect;if(node.nodeType==3){for(var i$1=0;i$1<4;i$1++){while(start&&isExtendingChar(prepared.line.text.charAt(place.coverStart+start))){--start}while(place.coverStart+end0){collapse=bias="right"}var rects;if(cm.options.lineWrapping&&(rects=node.getClientRects()).length>1){rect=rects[bias=="right"?rects.length-1:0]}else{rect=node.getBoundingClientRect()}}if(ie&&ie_version<9&&!start&&(!rect||!rect.left&&!rect.right)){var rSpan=node.parentNode.getClientRects()[0];if(rSpan){rect={left:rSpan.left,right:rSpan.left+charWidth(cm.display),top:rSpan.top,bottom:rSpan.bottom}}else{rect=nullRect}}var rtop=rect.top-prepared.rect.top,rbot=rect.bottom-prepared.rect.top;var mid=(rtop+rbot)/2;var heights=prepared.view.measure.heights;var i=0;for(;i=lineObj.text.length){ch=lineObj.text.length;sticky="before"}else if(ch<=0){ch=0;sticky="after"}if(!order){return get(sticky=="before"?ch-1:ch,sticky=="before")}function getBidi(ch,partPos,invert){var part=order[partPos],right=part.level%2!=0;return get(invert?ch-1:ch,right!=invert)}var partPos=getBidiPartAt(order,ch,sticky);var other=bidiOther;var val=getBidi(ch,partPos,sticky=="before");if(other!=null){val.other=getBidi(ch,other,sticky!="before")}return val}function estimateCoords(cm,pos){var left=0;pos=clipPos(cm.doc,pos);if(!cm.options.lineWrapping){left=charWidth(cm.display)*pos.ch}var lineObj=getLine(cm.doc,pos.line);var top=heightAtLine(lineObj)+paddingTop(cm.display);return{left:left,right:left,top:top,bottom:top+lineObj.height}}function PosWithInfo(line,ch,sticky,outside,xRel){var pos=Pos(line,ch,sticky);pos.xRel=xRel;if(outside){pos.outside=true}return pos}function coordsChar(cm,x,y){var doc=cm.doc;y+=cm.display.viewOffset;if(y<0){return PosWithInfo(doc.first,0,null,true,-1)}var lineN=lineAtHeight(doc,y),last=doc.first+doc.size-1;if(lineN>last){return PosWithInfo(doc.first+doc.size-1,getLine(doc,last).text.length,null,true,1)}if(x<0){x=0}var lineObj=getLine(doc,lineN);for(;;){var found=coordsCharInner(cm,lineObj,lineN,x,y);var merged=collapsedSpanAtEnd(lineObj);var mergedPos=merged&&merged.find(0,true);if(merged&&(found.ch>mergedPos.from.ch||found.ch==mergedPos.from.ch&&found.xRel>0)){lineN=lineNo(lineObj=mergedPos.to.line)}else{return found}}}function wrappedLineExtent(cm,lineObj,preparedMeasure,y){var measure=function(ch){return intoCoordSystem(cm,lineObj,measureCharPrepared(cm,preparedMeasure,ch),"line")};var end=lineObj.text.length;var begin=findFirst((function(ch){return measure(ch-1).bottom<=y}),end,0);end=findFirst((function(ch){return measure(ch).top>y}),begin,end);return{begin:begin,end:end}}function wrappedLineExtentChar(cm,lineObj,preparedMeasure,target){var targetTop=intoCoordSystem(cm,lineObj,measureCharPrepared(cm,preparedMeasure,target),"line").top;return wrappedLineExtent(cm,lineObj,preparedMeasure,targetTop)}function coordsCharInner(cm,lineObj,lineNo$$1,x,y){y-=heightAtLine(lineObj);var begin=0,end=lineObj.text.length;var preparedMeasure=prepareMeasureForLine(cm,lineObj);var pos;var order=getOrder(lineObj,cm.doc.direction);if(order){if(cm.options.lineWrapping){var assign;assign=wrappedLineExtent(cm,lineObj,preparedMeasure,y),begin=assign.begin,end=assign.end,assign}pos=new Pos(lineNo$$1,begin);var beginLeft=cursorCoords(cm,pos,"line",lineObj,preparedMeasure).left;var dir=beginLeftMath.abs(prevDiff)){if(diff<0==prevDiff<0){throw new Error("Broke out of infinite loop in coordsCharInner")}pos=prevPos}}else{var ch=findFirst((function(ch){var box=intoCoordSystem(cm,lineObj,measureCharPrepared(cm,preparedMeasure,ch),"line");if(box.top>y){end=Math.min(ch,end);return true}else if(box.bottom<=y){return false}else if(box.left>x){return true}else if(box.rightcoords.right?1:0;return pos}var measureText;function textHeight(display){if(display.cachedTextHeight!=null){return display.cachedTextHeight}if(measureText==null){measureText=elt("pre");for(var i=0;i<49;++i){measureText.appendChild(document.createTextNode("x"));measureText.appendChild(elt("br"))}measureText.appendChild(document.createTextNode("x"))}removeChildrenAndAdd(display.measure,measureText);var height=measureText.offsetHeight/50;if(height>3){display.cachedTextHeight=height}removeChildren(display.measure);return height||1}function charWidth(display){if(display.cachedCharWidth!=null){return display.cachedCharWidth}var anchor=elt("span","xxxxxxxxxx");var pre=elt("pre",[anchor]);removeChildrenAndAdd(display.measure,pre);var rect=anchor.getBoundingClientRect(),width=(rect.right-rect.left)/10;if(width>2){display.cachedCharWidth=width}return width||10}function getDimensions(cm){var d=cm.display,left={},width={};var gutterLeft=d.gutters.clientLeft;for(var n=d.gutters.firstChild,i=0;n;n=n.nextSibling,++i){left[cm.options.gutters[i]]=n.offsetLeft+n.clientLeft+gutterLeft;width[cm.options.gutters[i]]=n.clientWidth}return{fixedPos:compensateForHScroll(d),gutterTotalWidth:d.gutters.offsetWidth,gutterLeft:left,gutterWidth:width,wrapperWidth:d.wrapper.clientWidth}}function compensateForHScroll(display){return display.scroller.getBoundingClientRect().left-display.sizer.getBoundingClientRect().left}function estimateHeight(cm){var th=textHeight(cm.display),wrapping=cm.options.lineWrapping;var perLine=wrapping&&Math.max(5,cm.display.scroller.clientWidth/charWidth(cm.display)-3);return function(line){if(lineIsHidden(cm.doc,line)){return 0}var widgetsHeight=0;if(line.widgets){for(var i=0;i=cm.display.viewTo){return null}n-=cm.display.viewFrom;if(n<0){return null}var view=cm.display.view;for(var i=0;i=cm.display.viewTo||range$$1.to().line3){add(left,leftPos.top,null,leftPos.bottom);left=leftSide;if(leftPos.bottomend.bottom||rightPos.bottom==end.bottom&&rightPos.right>end.right){end=rightPos}if(left0){display.blinker=setInterval((function(){return display.cursorDiv.style.visibility=(on=!on)?"":"hidden"}),cm.options.cursorBlinkRate)}else if(cm.options.cursorBlinkRate<0){display.cursorDiv.style.visibility="hidden"}}function ensureFocus(cm){if(!cm.state.focused){cm.display.input.focus();onFocus(cm)}}function delayBlurEvent(cm){cm.state.delayingBlurEvent=true;setTimeout((function(){if(cm.state.delayingBlurEvent){cm.state.delayingBlurEvent=false;onBlur(cm)}}),100)}function onFocus(cm,e){if(cm.state.delayingBlurEvent){cm.state.delayingBlurEvent=false}if(cm.options.readOnly=="nocursor"){return}if(!cm.state.focused){signal(cm,"focus",cm,e);cm.state.focused=true;addClass(cm.display.wrapper,"CodeMirror-focused");if(!cm.curOp&&cm.display.selForContextMenu!=cm.doc.sel){cm.display.input.reset();if(webkit){setTimeout((function(){return cm.display.input.reset(true)}),20)}}cm.display.input.receivedFocus()}restartBlink(cm)}function onBlur(cm,e){if(cm.state.delayingBlurEvent){return}if(cm.state.focused){signal(cm,"blur",cm,e);cm.state.focused=false;rmClass(cm.display.wrapper,"CodeMirror-focused")}clearInterval(cm.display.blinker);setTimeout((function(){if(!cm.state.focused){cm.display.shift=false}}),150)}function alignHorizontally(cm){var display=cm.display,view=display.view;if(!display.alignWidgets&&(!display.gutters.firstChild||!cm.options.fixedGutter)){return}var comp=compensateForHScroll(display)-display.scroller.scrollLeft+cm.doc.scrollLeft;var gutterW=display.gutters.offsetWidth,left=comp+"px";for(var i=0;i.001||diff<-.001){updateLineHeight(cur.line,height);updateWidgetHeight(cur.line);if(cur.rest){for(var j=0;j=to){from=lineAtHeight(doc,heightAtLine(getLine(doc,ensureTo))-display.wrapper.clientHeight);to=ensureTo}}return{from:from,to:Math.max(to,from+1)}}function setScrollTop(cm,val){if(Math.abs(cm.doc.scrollTop-val)<2){return}cm.doc.scrollTop=val;if(!gecko){updateDisplaySimple(cm,{top:val})}if(cm.display.scroller.scrollTop!=val){cm.display.scroller.scrollTop=val}cm.display.scrollbars.setScrollTop(val);if(gecko){updateDisplaySimple(cm)}startWorker(cm,100)}function setScrollLeft(cm,val,isScroller){if(isScroller?val==cm.doc.scrollLeft:Math.abs(cm.doc.scrollLeft-val)<2){return}val=Math.min(val,cm.display.scroller.scrollWidth-cm.display.scroller.clientWidth);cm.doc.scrollLeft=val;alignHorizontally(cm);if(cm.display.scroller.scrollLeft!=val){cm.display.scroller.scrollLeft=val}cm.display.scrollbars.setScrollLeft(val)}var wheelSamples=0;var wheelPixelsPerUnit=null;if(ie){wheelPixelsPerUnit=-.53}else if(gecko){wheelPixelsPerUnit=15}else if(chrome){wheelPixelsPerUnit=-.7}else if(safari){wheelPixelsPerUnit=-1/3}function wheelEventDelta(e){var dx=e.wheelDeltaX,dy=e.wheelDeltaY;if(dx==null&&e.detail&&e.axis==e.HORIZONTAL_AXIS){dx=e.detail}if(dy==null&&e.detail&&e.axis==e.VERTICAL_AXIS){dy=e.detail}else if(dy==null){dy=e.wheelDelta}return{x:dx,y:dy}}function wheelEventPixels(e){var delta=wheelEventDelta(e);delta.x*=wheelPixelsPerUnit;delta.y*=wheelPixelsPerUnit;return delta}function onScrollWheel(cm,e){var delta=wheelEventDelta(e),dx=delta.x,dy=delta.y;var display=cm.display,scroll=display.scroller;var canScrollX=scroll.scrollWidth>scroll.clientWidth;var canScrollY=scroll.scrollHeight>scroll.clientHeight;if(!(dx&&canScrollX||dy&&canScrollY)){return}if(dy&&mac&&webkit){outer:for(var cur=e.target,view=display.view;cur!=scroll;cur=cur.parentNode){for(var i=0;imeasure.clientWidth+1;var needsV=measure.scrollHeight>measure.clientHeight+1;var sWidth=measure.nativeBarWidth;if(needsV){this.vert.style.display="block";this.vert.style.bottom=needsH?sWidth+"px":"0";var totalHeight=measure.viewHeight-(needsH?sWidth:0);this.vert.firstChild.style.height=Math.max(0,measure.scrollHeight-measure.clientHeight+totalHeight)+"px"}else{this.vert.style.display="";this.vert.firstChild.style.height="0"}if(needsH){this.horiz.style.display="block";this.horiz.style.right=needsV?sWidth+"px":"0";this.horiz.style.left=measure.barLeft+"px";var totalWidth=measure.viewWidth-measure.barLeft-(needsV?sWidth:0);this.horiz.firstChild.style.width=Math.max(0,measure.scrollWidth-measure.clientWidth+totalWidth)+"px"}else{this.horiz.style.display="";this.horiz.firstChild.style.width="0"}if(!this.checkedZeroWidth&&measure.clientHeight>0){if(sWidth==0){this.zeroWidthHack()}this.checkedZeroWidth=true}return{right:needsV?sWidth:0,bottom:needsH?sWidth:0}};NativeScrollbars.prototype.setScrollLeft=function(pos){if(this.horiz.scrollLeft!=pos){this.horiz.scrollLeft=pos}if(this.disableHoriz){this.enableZeroWidthBar(this.horiz,this.disableHoriz)}};NativeScrollbars.prototype.setScrollTop=function(pos){if(this.vert.scrollTop!=pos){this.vert.scrollTop=pos}if(this.disableVert){this.enableZeroWidthBar(this.vert,this.disableVert)}};NativeScrollbars.prototype.zeroWidthHack=function(){var w=mac&&!mac_geMountainLion?"12px":"18px";this.horiz.style.height=this.vert.style.width=w;this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none";this.disableHoriz=new Delayed;this.disableVert=new Delayed};NativeScrollbars.prototype.enableZeroWidthBar=function(bar,delay){bar.style.pointerEvents="auto";function maybeDisable(){var box=bar.getBoundingClientRect();var elt$$1=document.elementFromPoint(box.left+1,box.bottom-1);if(elt$$1!=bar){bar.style.pointerEvents="none"}else{delay.set(1e3,maybeDisable)}}delay.set(1e3,maybeDisable)};NativeScrollbars.prototype.clear=function(){var parent=this.horiz.parentNode;parent.removeChild(this.horiz);parent.removeChild(this.vert)};var NullScrollbars=function(){};NullScrollbars.prototype.update=function(){return{bottom:0,right:0}};NullScrollbars.prototype.setScrollLeft=function(){};NullScrollbars.prototype.setScrollTop=function(){};NullScrollbars.prototype.clear=function(){};function updateScrollbars(cm,measure){if(!measure){measure=measureForScrollbars(cm)}var startWidth=cm.display.barWidth,startHeight=cm.display.barHeight;updateScrollbarsInner(cm,measure);for(var i=0;i<4&&startWidth!=cm.display.barWidth||startHeight!=cm.display.barHeight;i++){if(startWidth!=cm.display.barWidth&&cm.options.lineWrapping){updateHeightsInViewport(cm)}updateScrollbarsInner(cm,measureForScrollbars(cm));startWidth=cm.display.barWidth;startHeight=cm.display.barHeight}}function updateScrollbarsInner(cm,measure){var d=cm.display;var sizes=d.scrollbars.update(measure);d.sizer.style.paddingRight=(d.barWidth=sizes.right)+"px";d.sizer.style.paddingBottom=(d.barHeight=sizes.bottom)+"px";d.heightForcer.style.borderBottom=sizes.bottom+"px solid transparent";if(sizes.right&&sizes.bottom){d.scrollbarFiller.style.display="block";d.scrollbarFiller.style.height=sizes.bottom+"px";d.scrollbarFiller.style.width=sizes.right+"px"}else{d.scrollbarFiller.style.display=""}if(sizes.bottom&&cm.options.coverGutterNextToScrollbar&&cm.options.fixedGutter){d.gutterFiller.style.display="block";d.gutterFiller.style.height=sizes.bottom+"px";d.gutterFiller.style.width=measure.gutterWidth+"px"}else{d.gutterFiller.style.display=""}}var scrollbarModel={native:NativeScrollbars,null:NullScrollbars};function initScrollbars(cm){if(cm.display.scrollbars){cm.display.scrollbars.clear();if(cm.display.scrollbars.addClass){rmClass(cm.display.wrapper,cm.display.scrollbars.addClass)}}cm.display.scrollbars=new scrollbarModel[cm.options.scrollbarStyle]((function(node){cm.display.wrapper.insertBefore(node,cm.display.scrollbarFiller);on(node,"mousedown",(function(){if(cm.state.focused){setTimeout((function(){return cm.display.input.focus()}),0)}}));node.setAttribute("cm-not-content","true")}),(function(pos,axis){if(axis=="horizontal"){setScrollLeft(cm,pos)}else{setScrollTop(cm,pos)}}),cm);if(cm.display.scrollbars.addClass){addClass(cm.display.wrapper,cm.display.scrollbars.addClass)}}function maybeScrollWindow(cm,rect){if(signalDOMEvent(cm,"scrollCursorIntoView")){return}var display=cm.display,box=display.sizer.getBoundingClientRect(),doScroll=null;if(rect.top+box.top<0){doScroll=true}else if(rect.bottom+box.top>(window.innerHeight||document.documentElement.clientHeight)){doScroll=false}if(doScroll!=null&&!phantom){var scrollNode=elt("div","​",null,"position: absolute;\n top: "+(rect.top-display.viewOffset-paddingTop(cm.display))+"px;\n height: "+(rect.bottom-rect.top+scrollGap(cm)+display.barHeight)+"px;\n left: "+rect.left+"px; width: "+Math.max(2,rect.right-rect.left)+"px;");cm.display.lineSpace.appendChild(scrollNode);scrollNode.scrollIntoView(doScroll);cm.display.lineSpace.removeChild(scrollNode)}}function scrollPosIntoView(cm,pos,end,margin){if(margin==null){margin=0}var rect;for(var limit=0;limit<5;limit++){var changed=false;var coords=cursorCoords(cm,pos);var endCoords=!end||end==pos?coords:cursorCoords(cm,end);rect={left:Math.min(coords.left,endCoords.left),top:Math.min(coords.top,endCoords.top)-margin,right:Math.max(coords.left,endCoords.left),bottom:Math.max(coords.bottom,endCoords.bottom)+margin};var scrollPos=calculateScrollPos(cm,rect);var startTop=cm.doc.scrollTop,startLeft=cm.doc.scrollLeft;if(scrollPos.scrollTop!=null){setScrollTop(cm,scrollPos.scrollTop);if(Math.abs(cm.doc.scrollTop-startTop)>1){changed=true}}if(scrollPos.scrollLeft!=null){setScrollLeft(cm,scrollPos.scrollLeft);if(Math.abs(cm.doc.scrollLeft-startLeft)>1){changed=true}}if(!changed){break}}return rect}function scrollIntoView(cm,rect){var scrollPos=calculateScrollPos(cm,rect);if(scrollPos.scrollTop!=null){setScrollTop(cm,scrollPos.scrollTop)}if(scrollPos.scrollLeft!=null){setScrollLeft(cm,scrollPos.scrollLeft)}}function calculateScrollPos(cm,rect){var display=cm.display,snapMargin=textHeight(cm.display);if(rect.top<0){rect.top=0}var screentop=cm.curOp&&cm.curOp.scrollTop!=null?cm.curOp.scrollTop:display.scroller.scrollTop;var screen=displayHeight(cm),result={};if(rect.bottom-rect.top>screen){rect.bottom=rect.top+screen}var docBottom=cm.doc.height+paddingVert(display);var atTop=rect.topdocBottom-snapMargin;if(rect.topscreentop+screen){var newTop=Math.min(rect.top,(atBottom?docBottom:rect.bottom)-screen);if(newTop!=screentop){result.scrollTop=newTop}}var screenleft=cm.curOp&&cm.curOp.scrollLeft!=null?cm.curOp.scrollLeft:display.scroller.scrollLeft;var screenw=displayWidth(cm)-(cm.options.fixedGutter?display.gutters.offsetWidth:0);var tooWide=rect.right-rect.left>screenw;if(tooWide){rect.right=rect.left+screenw}if(rect.left<10){result.scrollLeft=0}else if(rect.leftscreenw+screenleft-3){result.scrollLeft=rect.right+(tooWide?0:10)-screenw}return result}function addToScrollPos(cm,left,top){if(left!=null||top!=null){resolveScrollToPos(cm)}if(left!=null){cm.curOp.scrollLeft=(cm.curOp.scrollLeft==null?cm.doc.scrollLeft:cm.curOp.scrollLeft)+left}if(top!=null){cm.curOp.scrollTop=(cm.curOp.scrollTop==null?cm.doc.scrollTop:cm.curOp.scrollTop)+top}}function ensureCursorVisible(cm){resolveScrollToPos(cm);var cur=cm.getCursor(),from=cur,to=cur;if(!cm.options.lineWrapping){from=cur.ch?Pos(cur.line,cur.ch-1):cur;to=Pos(cur.line,cur.ch+1)}cm.curOp.scrollToPos={from:from,to:to,margin:cm.options.cursorScrollMargin}}function resolveScrollToPos(cm){var range$$1=cm.curOp.scrollToPos;if(range$$1){cm.curOp.scrollToPos=null;var from=estimateCoords(cm,range$$1.from),to=estimateCoords(cm,range$$1.to);var sPos=calculateScrollPos(cm,{left:Math.min(from.left,to.left),top:Math.min(from.top,to.top)-range$$1.margin,right:Math.max(from.right,to.right),bottom:Math.max(from.bottom,to.bottom)+range$$1.margin});cm.scrollTo(sPos.scrollLeft,sPos.scrollTop)}}var nextOpId=0;function startOperation(cm){cm.curOp={cm:cm,viewChanged:false,startHeight:cm.doc.height,forceUpdate:false,updateInput:null,typing:false,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:false,updateMaxLine:false,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:false,id:++nextOpId};pushOperation(cm.curOp)}function endOperation(cm){var op=cm.curOp;finishOperation(op,(function(group){for(var i=0;i=display.viewTo)||display.maxLineChanged&&cm.options.lineWrapping;op.update=op.mustUpdate&&new DisplayUpdate(cm,op.mustUpdate&&{top:op.scrollTop,ensure:op.scrollToPos},op.forceUpdate)}function endOperation_W1(op){op.updatedDisplay=op.mustUpdate&&updateDisplayIfNeeded(op.cm,op.update)}function endOperation_R2(op){var cm=op.cm,display=cm.display;if(op.updatedDisplay){updateHeightsInViewport(cm)}op.barMeasure=measureForScrollbars(cm);if(display.maxLineChanged&&!cm.options.lineWrapping){op.adjustWidthTo=measureChar(cm,display.maxLine,display.maxLine.text.length).left+3;cm.display.sizerWidth=op.adjustWidthTo;op.barMeasure.scrollWidth=Math.max(display.scroller.clientWidth,display.sizer.offsetLeft+op.adjustWidthTo+scrollGap(cm)+cm.display.barWidth);op.maxScrollLeft=Math.max(0,display.sizer.offsetLeft+op.adjustWidthTo-displayWidth(cm))}if(op.updatedDisplay||op.selectionChanged){op.preparedSelection=display.input.prepareSelection(op.focus)}}function endOperation_W2(op){var cm=op.cm;if(op.adjustWidthTo!=null){cm.display.sizer.style.minWidth=op.adjustWidthTo+"px";if(op.maxScrollLeft