ghost 5.94.0 → 5.94.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/tryghost-adapter-cache-memory-ttl-5.94.2.tgz +0 -0
- package/components/{tryghost-adapter-cache-redis-5.94.0.tgz → tryghost-adapter-cache-redis-5.94.2.tgz} +0 -0
- package/components/{tryghost-adapter-manager-5.94.0.tgz → tryghost-adapter-manager-5.94.2.tgz} +0 -0
- package/components/tryghost-announcement-bar-settings-5.94.2.tgz +0 -0
- package/components/{tryghost-api-framework-5.94.0.tgz → tryghost-api-framework-5.94.2.tgz} +0 -0
- package/components/{tryghost-api-version-compatibility-service-5.94.0.tgz → tryghost-api-version-compatibility-service-5.94.2.tgz} +0 -0
- package/components/tryghost-audience-feedback-5.94.2.tgz +0 -0
- package/components/tryghost-bookshelf-repository-5.94.2.tgz +0 -0
- package/components/{tryghost-bootstrap-socket-5.94.0.tgz → tryghost-bootstrap-socket-5.94.2.tgz} +0 -0
- package/components/tryghost-collections-5.94.2.tgz +0 -0
- package/components/tryghost-constants-5.94.2.tgz +0 -0
- package/components/{tryghost-custom-theme-settings-service-5.94.0.tgz → tryghost-custom-theme-settings-service-5.94.2.tgz} +0 -0
- package/components/{tryghost-data-generator-5.94.0.tgz → tryghost-data-generator-5.94.2.tgz} +0 -0
- package/components/tryghost-domain-events-5.94.2.tgz +0 -0
- package/components/{tryghost-donations-5.94.0.tgz → tryghost-donations-5.94.2.tgz} +0 -0
- package/components/tryghost-dynamic-routing-events-5.94.2.tgz +0 -0
- package/components/tryghost-email-addresses-5.94.2.tgz +0 -0
- package/components/tryghost-email-analytics-provider-mailgun-5.94.2.tgz +0 -0
- package/components/tryghost-email-analytics-service-5.94.2.tgz +0 -0
- package/components/{tryghost-email-content-generator-5.94.0.tgz → tryghost-email-content-generator-5.94.2.tgz} +0 -0
- package/components/{tryghost-email-events-5.94.0.tgz → tryghost-email-events-5.94.2.tgz} +0 -0
- package/components/{tryghost-email-service-5.94.0.tgz → tryghost-email-service-5.94.2.tgz} +0 -0
- package/components/tryghost-email-suppression-list-5.94.2.tgz +0 -0
- package/components/tryghost-express-dynamic-redirects-5.94.2.tgz +0 -0
- package/components/tryghost-external-media-inliner-5.94.2.tgz +0 -0
- package/components/tryghost-extract-api-key-5.94.2.tgz +0 -0
- package/components/tryghost-ghost-5.94.2.tgz +0 -0
- package/components/{tryghost-html-to-plaintext-5.94.0.tgz → tryghost-html-to-plaintext-5.94.2.tgz} +0 -0
- package/components/tryghost-i18n-5.94.2.tgz +0 -0
- package/components/tryghost-importer-handler-content-files-5.94.2.tgz +0 -0
- package/components/tryghost-importer-revue-5.94.2.tgz +0 -0
- package/components/tryghost-in-memory-repository-5.94.2.tgz +0 -0
- package/components/{tryghost-job-manager-5.94.0.tgz → tryghost-job-manager-5.94.2.tgz} +0 -0
- package/components/tryghost-link-redirects-5.94.2.tgz +0 -0
- package/components/tryghost-link-replacer-5.94.2.tgz +0 -0
- package/components/{tryghost-link-tracking-5.94.0.tgz → tryghost-link-tracking-5.94.2.tgz} +0 -0
- package/components/{tryghost-magic-link-5.94.0.tgz → tryghost-magic-link-5.94.2.tgz} +0 -0
- package/components/{tryghost-mail-events-5.94.0.tgz → tryghost-mail-events-5.94.2.tgz} +0 -0
- package/components/tryghost-mailgun-client-5.94.2.tgz +0 -0
- package/components/{tryghost-member-attribution-5.94.0.tgz → tryghost-member-attribution-5.94.2.tgz} +0 -0
- package/components/{tryghost-member-events-5.94.0.tgz → tryghost-member-events-5.94.2.tgz} +0 -0
- package/components/tryghost-members-api-5.94.2.tgz +0 -0
- package/components/{tryghost-members-csv-5.94.0.tgz → tryghost-members-csv-5.94.2.tgz} +0 -0
- package/components/tryghost-members-events-service-5.94.2.tgz +0 -0
- package/components/{tryghost-members-importer-5.94.0.tgz → tryghost-members-importer-5.94.2.tgz} +0 -0
- package/components/tryghost-members-offers-5.94.2.tgz +0 -0
- package/components/tryghost-members-payments-5.94.2.tgz +0 -0
- package/components/tryghost-members-ssr-5.94.2.tgz +0 -0
- package/components/tryghost-members-stripe-service-5.94.2.tgz +0 -0
- package/components/{tryghost-mentions-email-report-5.94.0.tgz → tryghost-mentions-email-report-5.94.2.tgz} +0 -0
- package/components/{tryghost-milestones-5.94.0.tgz → tryghost-milestones-5.94.2.tgz} +0 -0
- package/components/tryghost-minifier-5.94.2.tgz +0 -0
- package/components/tryghost-model-to-domain-event-interceptor-5.94.2.tgz +0 -0
- package/components/{tryghost-mw-api-version-mismatch-5.94.0.tgz → tryghost-mw-api-version-mismatch-5.94.2.tgz} +0 -0
- package/components/tryghost-mw-cache-control-5.94.2.tgz +0 -0
- package/components/tryghost-mw-error-handler-5.94.2.tgz +0 -0
- package/components/tryghost-mw-session-from-token-5.94.2.tgz +0 -0
- package/components/tryghost-mw-update-user-last-seen-5.94.2.tgz +0 -0
- package/components/tryghost-mw-version-match-5.94.2.tgz +0 -0
- package/components/tryghost-mw-vhost-5.94.2.tgz +0 -0
- package/components/tryghost-nql-filter-expansions-5.94.2.tgz +0 -0
- package/components/tryghost-oembed-service-5.94.2.tgz +0 -0
- package/components/{tryghost-package-json-5.94.0.tgz → tryghost-package-json-5.94.2.tgz} +0 -0
- package/components/tryghost-post-events-5.94.2.tgz +0 -0
- package/components/tryghost-post-revisions-5.94.2.tgz +0 -0
- package/components/tryghost-posts-service-5.94.2.tgz +0 -0
- package/components/tryghost-recommendations-5.94.2.tgz +0 -0
- package/components/tryghost-referrers-5.94.2.tgz +0 -0
- package/components/{tryghost-security-5.94.0.tgz → tryghost-security-5.94.2.tgz} +0 -0
- package/components/tryghost-session-service-5.94.2.tgz +0 -0
- package/components/tryghost-settings-path-manager-5.94.2.tgz +0 -0
- package/components/tryghost-slack-notifications-5.94.2.tgz +0 -0
- package/components/{tryghost-staff-service-5.94.0.tgz → tryghost-staff-service-5.94.2.tgz} +0 -0
- package/components/tryghost-stats-service-5.94.2.tgz +0 -0
- package/components/{tryghost-tiers-5.94.0.tgz → tryghost-tiers-5.94.2.tgz} +0 -0
- package/components/{tryghost-update-check-service-5.94.0.tgz → tryghost-update-check-service-5.94.2.tgz} +0 -0
- package/components/{tryghost-verification-trigger-5.94.0.tgz → tryghost-verification-trigger-5.94.2.tgz} +0 -0
- package/components/tryghost-version-notifications-data-service-5.94.2.tgz +0 -0
- package/components/{tryghost-webmentions-5.94.0.tgz → tryghost-webmentions-5.94.2.tgz} +0 -0
- package/core/built/admin/assets/admin-x-activitypub/admin-x-activitypub.js +2 -2
- package/core/built/admin/assets/admin-x-activitypub/{index-51277f76.mjs → index-d646c7a1.mjs} +6618 -4913
- package/core/built/admin/assets/admin-x-activitypub/modals-a8aeb643.mjs +342 -0
- package/core/built/admin/assets/admin-x-demo/admin-x-demo.js +2 -2
- package/core/built/admin/assets/admin-x-demo/{index-bfbb9783.mjs → index-140752db.mjs} +1667 -1657
- package/core/built/admin/assets/admin-x-demo/{modals-334b160e.mjs → modals-3979b40c.mjs} +2 -2
- package/core/built/admin/assets/admin-x-settings/{CodeEditorView-6bb10ebd.mjs → CodeEditorView-9ca04b2a.mjs} +2 -2
- package/core/built/admin/assets/admin-x-settings/admin-x-settings.js +2 -2
- package/core/built/admin/assets/admin-x-settings/{index-a57eb33d.mjs → index-5fba7766.mjs} +1907 -1893
- package/core/built/admin/assets/admin-x-settings/{index-52f09138.mjs → index-6c87f26e.mjs} +2 -2
- package/core/built/admin/assets/admin-x-settings/{modals-07c66c7d.mjs → modals-80acb66f.mjs} +2107 -2101
- package/core/built/admin/assets/{chunk.524.b9da8e9c62fc112baf2b.js → chunk.524.cd82d3016052a43d2b44.js} +5 -5
- package/core/built/admin/assets/{chunk.582.27ddbcbd7a6e7a439db8.js → chunk.582.ea2e209b67019b57bff7.js} +6 -6
- package/core/built/admin/assets/{chunk.785.78610bd253a9e2419ec9.js → chunk.602.a3d38ba0a516decd78ce.js} +6089 -6078
- package/core/built/admin/assets/codemirror/{codemirror-91774021e5e17ea08db5cd2ed9f3e664.js → codemirror-730d06e33ae9af4745ddd6a1af2a66bd.js} +809 -810
- package/core/built/admin/assets/{ghost-535088daf62c8cbea78a012bb6bbafc6.js → ghost-27a2284f57455ac2e06f1553344f5ba7.js} +248 -194
- package/core/built/admin/assets/{ghost-d1c51d3a2d840dda5aa7b4ffe6057756.css → ghost-81adcc22c7836b40b08a662812319e01.css} +1 -1
- package/core/built/admin/assets/{ghost-dark-98b3a7e593292a7cb410609e17727a3c.css → ghost-dark-88c10b0aa259d4b666d6a98174c6f5bd.css} +1 -1
- package/core/built/admin/assets/koenig-lexical/koenig-lexical.js +3 -3
- package/core/built/admin/assets/koenig-lexical/koenig-lexical.umd.js +3 -3
- package/core/built/admin/assets/{vendor-649dc64bfd9ecc1bd7361b53680dfdc2.js → vendor-b83f61eee071be0ef00075df9ff7782d.js} +15 -15
- package/core/built/admin/index.html +6 -6
- package/core/server/api/endpoints/utils/serializers/output/mappers/index.js +1 -0
- package/core/server/api/endpoints/utils/serializers/output/mappers/oembed.js +5 -0
- package/core/server/api/endpoints/utils/serializers/output/oembed.js +7 -0
- package/core/server/data/importer/import-manager.js +2 -2
- package/core/server/data/importer/importers/data/PostsImporter.js +2 -2
- package/core/server/data/migrations/versions/4.46/2022-04-13-12-58-fill-uuid-for-newsletters.js +2 -2
- package/core/server/data/migrations/versions/4.46/2022-04-13-13-00-add-default-newsletter.js +2 -2
- package/core/server/models/email.js +2 -2
- package/core/server/models/member.js +3 -3
- package/core/server/models/newsletter.js +2 -2
- package/core/server/models/post.js +2 -2
- package/core/server/models/settings.js +1 -2
- package/core/server/services/email-analytics/lib/queries.js +2 -2
- package/core/server/services/members-events/index.js +20 -2
- package/core/server/web/parent/middleware/request-id.js +2 -2
- package/core/shared/labs.js +2 -1
- package/core/shared/settings-cache/public.js +2 -1
- package/package.json +157 -155
- package/yarn.lock +363 -185
- package/components/tryghost-adapter-cache-memory-ttl-5.94.0.tgz +0 -0
- package/components/tryghost-announcement-bar-settings-5.94.0.tgz +0 -0
- package/components/tryghost-audience-feedback-5.94.0.tgz +0 -0
- package/components/tryghost-bookshelf-repository-5.94.0.tgz +0 -0
- package/components/tryghost-collections-5.94.0.tgz +0 -0
- package/components/tryghost-constants-5.94.0.tgz +0 -0
- package/components/tryghost-domain-events-5.94.0.tgz +0 -0
- package/components/tryghost-dynamic-routing-events-5.94.0.tgz +0 -0
- package/components/tryghost-email-addresses-5.94.0.tgz +0 -0
- package/components/tryghost-email-analytics-provider-mailgun-5.94.0.tgz +0 -0
- package/components/tryghost-email-analytics-service-5.94.0.tgz +0 -0
- package/components/tryghost-email-suppression-list-5.94.0.tgz +0 -0
- package/components/tryghost-express-dynamic-redirects-5.94.0.tgz +0 -0
- package/components/tryghost-external-media-inliner-5.94.0.tgz +0 -0
- package/components/tryghost-extract-api-key-5.94.0.tgz +0 -0
- package/components/tryghost-ghost-5.94.0.tgz +0 -0
- package/components/tryghost-i18n-5.94.0.tgz +0 -0
- package/components/tryghost-importer-handler-content-files-5.94.0.tgz +0 -0
- package/components/tryghost-importer-revue-5.94.0.tgz +0 -0
- package/components/tryghost-in-memory-repository-5.94.0.tgz +0 -0
- package/components/tryghost-link-redirects-5.94.0.tgz +0 -0
- package/components/tryghost-link-replacer-5.94.0.tgz +0 -0
- package/components/tryghost-mailgun-client-5.94.0.tgz +0 -0
- package/components/tryghost-members-api-5.94.0.tgz +0 -0
- package/components/tryghost-members-events-service-5.94.0.tgz +0 -0
- package/components/tryghost-members-offers-5.94.0.tgz +0 -0
- package/components/tryghost-members-payments-5.94.0.tgz +0 -0
- package/components/tryghost-members-ssr-5.94.0.tgz +0 -0
- package/components/tryghost-members-stripe-service-5.94.0.tgz +0 -0
- package/components/tryghost-minifier-5.94.0.tgz +0 -0
- package/components/tryghost-model-to-domain-event-interceptor-5.94.0.tgz +0 -0
- package/components/tryghost-mw-cache-control-5.94.0.tgz +0 -0
- package/components/tryghost-mw-error-handler-5.94.0.tgz +0 -0
- package/components/tryghost-mw-session-from-token-5.94.0.tgz +0 -0
- package/components/tryghost-mw-update-user-last-seen-5.94.0.tgz +0 -0
- package/components/tryghost-mw-version-match-5.94.0.tgz +0 -0
- package/components/tryghost-mw-vhost-5.94.0.tgz +0 -0
- package/components/tryghost-nql-filter-expansions-5.94.0.tgz +0 -0
- package/components/tryghost-oembed-service-5.94.0.tgz +0 -0
- package/components/tryghost-post-events-5.94.0.tgz +0 -0
- package/components/tryghost-post-revisions-5.94.0.tgz +0 -0
- package/components/tryghost-posts-service-5.94.0.tgz +0 -0
- package/components/tryghost-recommendations-5.94.0.tgz +0 -0
- package/components/tryghost-referrers-5.94.0.tgz +0 -0
- package/components/tryghost-session-service-5.94.0.tgz +0 -0
- package/components/tryghost-settings-path-manager-5.94.0.tgz +0 -0
- package/components/tryghost-slack-notifications-5.94.0.tgz +0 -0
- package/components/tryghost-stats-service-5.94.0.tgz +0 -0
- package/components/tryghost-version-notifications-data-service-5.94.0.tgz +0 -0
- package/core/built/admin/assets/admin-x-activitypub/modals-c85985ad.mjs +0 -815
- /package/core/built/admin/assets/{chunk.785.78610bd253a9e2419ec9.js.LICENSE.txt → chunk.602.a3d38ba0a516decd78ce.js.LICENSE.txt} +0 -0
|
@@ -28,27 +28,27 @@ a+=l-o,a+=r-a%r,o=l+1}}g?H=function(e){e.selectionStart=0,e.selectionEnd=e.value
|
|
|
28
28
|
var R=function(){this.id=null}
|
|
29
29
|
function B(e,t){for(var r=0;r<e.length;++r)if(e[r]==t)return r
|
|
30
30
|
return-1}R.prototype.set=function(e,t){clearTimeout(this.id),this.id=setTimeout(t,e)}
|
|
31
|
-
var j=
|
|
32
|
-
function
|
|
31
|
+
var j={toString:function(){return"CodeMirror.Pass"}},V={scroll:!1},K={origin:"*mouse"},G={origin:"+move"}
|
|
32
|
+
function U(e,t,r){for(var n=0,i=0;;){var o=e.indexOf("\t",n);-1==o&&(o=e.length)
|
|
33
33
|
var a=o-n
|
|
34
34
|
if(o==e.length||i+a>=t)return n+Math.min(a,t-i)
|
|
35
|
-
if(i+=o-n,n=o+1,(i+=r-i%r)>=t)return n}}var
|
|
36
|
-
function
|
|
37
|
-
return
|
|
38
|
-
return r}function
|
|
39
|
-
return Object.create?r=Object.create(e):(
|
|
40
|
-
function
|
|
41
|
-
return!0}var
|
|
42
|
-
function
|
|
43
|
-
return t}function
|
|
35
|
+
if(i+=o-n,n=o+1,(i+=r-i%r)>=t)return n}}var q=[""]
|
|
36
|
+
function _(e){for(;q.length<=e;)q.push($(q)+" ")
|
|
37
|
+
return q[e]}function $(e){return e[e.length-1]}function X(e,t){for(var r=[],n=0;n<e.length;n++)r[n]=t(e[n],n)
|
|
38
|
+
return r}function Y(){}function Z(e,t){var r
|
|
39
|
+
return Object.create?r=Object.create(e):(Y.prototype=e,r=new Y),t&&E(t,r),r}var Q=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/
|
|
40
|
+
function J(e){return/\w/.test(e)||e>""&&(e.toUpperCase()!=e.toLowerCase()||Q.test(e))}function ee(e,t){return t?!!(t.source.indexOf("\\w")>-1&&J(e))||t.test(e):J(e)}function te(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1
|
|
41
|
+
return!0}var re=/[\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]/
|
|
42
|
+
function ne(e){return e.charCodeAt(0)>=768&&re.test(e)}function ie(e,t,r){for(;(r<0?t>0:t<e.length)&&ne(e.charAt(t));)t+=r
|
|
43
|
+
return t}function oe(e,t,r){for(var n=t>r?-1:1;;){if(t==r)return t
|
|
44
44
|
var i=(t+r)/2,o=n<0?Math.ceil(i):Math.floor(i)
|
|
45
45
|
if(o==t)return e(o)?t:r
|
|
46
|
-
e(o)?r=o:t=o+n}}var
|
|
47
|
-
function
|
|
48
|
-
|
|
46
|
+
e(o)?r=o:t=o+n}}var ae=null
|
|
47
|
+
function le(e,t,r){var n
|
|
48
|
+
ae=null
|
|
49
49
|
for(var i=0;i<e.length;++i){var o=e[i]
|
|
50
50
|
if(o.from<t&&o.to>t)return i
|
|
51
|
-
o.to==t&&(o.from!=o.to&&"before"==r?n=i:
|
|
51
|
+
o.to==t&&(o.from!=o.to&&"before"==r?n=i:ae=i),o.from==t&&(o.from!=o.to&&"before"!=r?n=i:ae=i)}return null!=n?n:ae}var se=function(){var e=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,t=/[stwN]/,r=/[LRr]/,n=/[Lb1n]/,i=/[1n]/
|
|
52
52
|
function o(e,t,r){this.level=e,this.from=t,this.to=r}return function(a,l){var s="ltr"==l?"L":"R"
|
|
53
53
|
if(0==a.length||"ltr"==l&&!e.test(a))return!1
|
|
54
54
|
for(var u,c=a.length,d=[],f=0;f<c;++f)d.push((u=a.charCodeAt(f))<=247?"bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN".charAt(u):1424<=u&&u<=1524?"R":1536<=u&&u<=1785?"nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111".charAt(u-1536):1774<=u&&u<=2220?"r":8192<=u&&u<=8203?"w":8204==u?"b":"L")
|
|
@@ -67,178 +67,178 @@ for(++E;E<c&&n.test(d[E]);++E);I.push(new o(0,F,E))}else{var R=E,B=I.length
|
|
|
67
67
|
for(++E;E<c&&"L"!=d[E];++E);for(var j=R;j<E;)if(i.test(d[j])){R<j&&I.splice(B,0,new o(1,R,j))
|
|
68
68
|
var V=j
|
|
69
69
|
for(++j;j<E&&i.test(d[j]);++j);I.splice(B,0,new o(2,V,j)),R=j}else++j
|
|
70
|
-
R<E&&I.splice(B,0,new o(1,R,E))}return"ltr"==l&&(1==I[0].level&&(H=a.match(/^\s+/))&&(I[0].from=H[0].length,I.unshift(new o(0,0,H[0].length))),1
|
|
71
|
-
function
|
|
72
|
-
return null==r&&(r=e.order=
|
|
70
|
+
R<E&&I.splice(B,0,new o(1,R,E))}return"ltr"==l&&(1==I[0].level&&(H=a.match(/^\s+/))&&(I[0].from=H[0].length,I.unshift(new o(0,0,H[0].length))),1==$(I).level&&(H=a.match(/\s+$/))&&($(I).to-=H[0].length,I.push(new o(0,c-H[0].length,c)))),"rtl"==l?I.reverse():I}}()
|
|
71
|
+
function ue(e,t){var r=e.order
|
|
72
|
+
return null==r&&(r=e.order=se(e.text,t)),r}var ce=[],de=function(e,t,r){if(e.addEventListener)e.addEventListener(t,r,!1)
|
|
73
73
|
else if(e.attachEvent)e.attachEvent("on"+t,r)
|
|
74
74
|
else{var n=e._handlers||(e._handlers={})
|
|
75
|
-
n[t]=(n[t]||
|
|
76
|
-
function
|
|
75
|
+
n[t]=(n[t]||ce).concat(r)}}
|
|
76
|
+
function fe(e,t){return e._handlers&&e._handlers[t]||ce}function he(e,t,r){if(e.removeEventListener)e.removeEventListener(t,r,!1)
|
|
77
77
|
else if(e.detachEvent)e.detachEvent("on"+t,r)
|
|
78
78
|
else{var n=e._handlers,i=n&&n[t]
|
|
79
79
|
if(i){var o=B(i,r)
|
|
80
|
-
o>-1&&(n[t]=i.slice(0,o).concat(i.slice(o+1)))}}}function
|
|
81
|
-
if(r.length)for(var n=Array.prototype.slice.call(arguments,2),i=0;i<r.length;++i)r[i].apply(null,n)}function
|
|
82
|
-
if(t)for(var r=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),n=0;n<t.length;++n)-1==B(r,t[n])&&r.push(t[n])}function
|
|
83
|
-
return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),y&&e.ctrlKey&&1==t&&(t=3),t}var Te,Me
|
|
80
|
+
o>-1&&(n[t]=i.slice(0,o).concat(i.slice(o+1)))}}}function pe(e,t){var r=fe(e,t)
|
|
81
|
+
if(r.length)for(var n=Array.prototype.slice.call(arguments,2),i=0;i<r.length;++i)r[i].apply(null,n)}function ge(e,t,r){return"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),pe(e,r||t.type,e,t),xe(t)||t.codemirrorIgnore}function me(e){var t=e._handlers&&e._handlers.cursorActivity
|
|
82
|
+
if(t)for(var r=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),n=0;n<t.length;++n)-1==B(r,t[n])&&r.push(t[n])}function ve(e,t){return fe(e,t).length>0}function ye(e){e.prototype.on=function(e,t){de(this,e,t)},e.prototype.off=function(e,t){he(this,e,t)}}function be(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function we(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function xe(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function ke(e){be(e),we(e)}function Ce(e){return e.target||e.srcElement}function Se(e){var t=e.which
|
|
83
|
+
return null==t&&(1&e.button?t=1:2&e.button?t=3:4&e.button&&(t=2)),y&&e.ctrlKey&&1==t&&(t=3),t}var Le,Te,Me=function(){if(a&&l<9)return!1
|
|
84
84
|
var e=A("div")
|
|
85
85
|
return"draggable"in e||"dragDrop"in e}()
|
|
86
|
-
function
|
|
87
|
-
N(e,A("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(
|
|
88
|
-
return r.setAttribute("cm-text",""),r}function
|
|
86
|
+
function Ne(e){if(null==Le){var t=A("span","")
|
|
87
|
+
N(e,A("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(Le=t.offsetWidth<=1&&t.offsetHeight>2&&!(a&&l<8))}var r=Le?A("span",""):A("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px")
|
|
88
|
+
return r.setAttribute("cm-text",""),r}function Ae(e){if(null!=Te)return Te
|
|
89
89
|
var t=N(e,document.createTextNode("AخA")),r=L(t,0,1).getBoundingClientRect(),n=L(t,1,2).getBoundingClientRect()
|
|
90
|
-
return M(e),!(!r||r.left==r.right)&&(
|
|
91
|
-
var o=e.slice(t,"\r"==e.charAt(i-1)?i-1:i),a=o.indexOf("\r");-1!=a?(r.push(o.slice(0,a)),t+=a+1):(r.push(o),t=i+1)}return r}:function(e){return e.split(/\r\n?|\n/)},
|
|
92
|
-
try{t=e.ownerDocument.selection.createRange()}catch(e){}return!(!t||t.parentElement()!=e)&&0!=t.compareEndPoints("StartToEnd",t)},
|
|
93
|
-
function
|
|
94
|
-
else if(e&&"string"==typeof e.name&&
|
|
95
|
-
"string"==typeof t&&(t={name:t}),(e=
|
|
96
|
-
if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return
|
|
97
|
-
var r=
|
|
98
|
-
if(!r)return
|
|
90
|
+
return M(e),!(!r||r.left==r.right)&&(Te=n.right-r.right<3)}var Oe,We=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,r=[],n=e.length;t<=n;){var i=e.indexOf("\n",t);-1==i&&(i=e.length)
|
|
91
|
+
var o=e.slice(t,"\r"==e.charAt(i-1)?i-1:i),a=o.indexOf("\r");-1!=a?(r.push(o.slice(0,a)),t+=a+1):(r.push(o),t=i+1)}return r}:function(e){return e.split(/\r\n?|\n/)},De=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(e){return!1}}:function(e){var t
|
|
92
|
+
try{t=e.ownerDocument.selection.createRange()}catch(e){}return!(!t||t.parentElement()!=e)&&0!=t.compareEndPoints("StartToEnd",t)},ze="oncopy"in(Oe=A("div"))||(Oe.setAttribute("oncopy","return;"),"function"==typeof Oe.oncopy),Pe=null,He={},Ie={}
|
|
93
|
+
function Ee(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),He[e]=t}function Fe(e){if("string"==typeof e&&Ie.hasOwnProperty(e))e=Ie[e]
|
|
94
|
+
else if(e&&"string"==typeof e.name&&Ie.hasOwnProperty(e.name)){var t=Ie[e.name]
|
|
95
|
+
"string"==typeof t&&(t={name:t}),(e=Z(t,e)).name=t.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Fe("application/xml")
|
|
96
|
+
if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Fe("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function Re(e,t){t=Fe(t)
|
|
97
|
+
var r=He[t.name]
|
|
98
|
+
if(!r)return Re(e,"text/plain")
|
|
99
99
|
var n=r(e,t)
|
|
100
|
-
if(
|
|
100
|
+
if(Be.hasOwnProperty(t.name)){var i=Be[t.name]
|
|
101
101
|
for(var o in i)i.hasOwnProperty(o)&&(n.hasOwnProperty(o)&&(n["_"+o]=n[o]),n[o]=i[o])}if(n.name=t.name,t.helperType&&(n.helperType=t.helperType),t.modeProps)for(var a in t.modeProps)n[a]=t.modeProps[a]
|
|
102
|
-
return n}var
|
|
103
|
-
function
|
|
102
|
+
return n}var Be={}
|
|
103
|
+
function je(e,t){E(t,Be.hasOwnProperty(e)?Be[e]:Be[e]={})}function Ve(e,t){if(!0===t)return t
|
|
104
104
|
if(e.copyState)return e.copyState(t)
|
|
105
105
|
var r={}
|
|
106
106
|
for(var n in t){var i=t[n]
|
|
107
|
-
i instanceof Array&&(i=i.concat([])),r[n]=i}return r}function
|
|
108
|
-
return r||{mode:e,state:t}}function
|
|
109
|
-
function
|
|
107
|
+
i instanceof Array&&(i=i.concat([])),r[n]=i}return r}function Ke(e,t){for(var r;e.innerMode&&(r=e.innerMode(t))&&r.mode!=e;)t=r.state,e=r.mode
|
|
108
|
+
return r||{mode:e,state:t}}function Ge(e,t,r){return!e.startState||e.startState(t,r)}var Ue=function(e,t,r){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=r}
|
|
109
|
+
function qe(e,t){if((t-=e.first)<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.")
|
|
110
110
|
for(var r=e;!r.lines;)for(var n=0;;++n){var i=r.children[n],o=i.chunkSize()
|
|
111
111
|
if(t<o){r=i
|
|
112
|
-
break}t-=o}return r.lines[t]}function
|
|
112
|
+
break}t-=o}return r.lines[t]}function _e(e,t,r){var n=[],i=t.line
|
|
113
113
|
return e.iter(t.line,r.line+1,(function(e){var o=e.text
|
|
114
|
-
i==r.line&&(o=o.slice(0,r.ch)),i==t.line&&(o=o.slice(t.ch)),n.push(o),++i})),n}function
|
|
115
|
-
return e.iter(t,r,(function(e){n.push(e.text)})),n}function
|
|
116
|
-
if(r)for(var n=e;n;n=n.parent)n.height+=r}function
|
|
114
|
+
i==r.line&&(o=o.slice(0,r.ch)),i==t.line&&(o=o.slice(t.ch)),n.push(o),++i})),n}function $e(e,t,r){var n=[]
|
|
115
|
+
return e.iter(t,r,(function(e){n.push(e.text)})),n}function Xe(e,t){var r=t-e.height
|
|
116
|
+
if(r)for(var n=e;n;n=n.parent)n.height+=r}function Ye(e){if(null==e.parent)return null
|
|
117
117
|
for(var t=e.parent,r=B(t.lines,e),n=t.parent;n;t=n,n=n.parent)for(var i=0;n.children[i]!=t;++i)r+=n.children[i].chunkSize()
|
|
118
|
-
return r+t.first}function
|
|
118
|
+
return r+t.first}function Ze(e,t){var r=e.first
|
|
119
119
|
e:do{for(var n=0;n<e.children.length;++n){var i=e.children[n],o=i.height
|
|
120
120
|
if(t<o){e=i
|
|
121
121
|
continue e}t-=o,r+=i.chunkSize()}return r}while(!e.lines)
|
|
122
122
|
for(var a=0;a<e.lines.length;++a){var l=e.lines[a].height
|
|
123
123
|
if(t<l)break
|
|
124
|
-
t-=l}return r+a}function
|
|
125
|
-
this.line=e,this.ch=t,this.sticky=r}function
|
|
124
|
+
t-=l}return r+a}function Qe(e,t){return t>=e.first&&t<e.first+e.size}function Je(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function et(e,t,r){if(void 0===r&&(r=null),!(this instanceof et))return new et(e,t,r)
|
|
125
|
+
this.line=e,this.ch=t,this.sticky=r}function tt(e,t){return e.line-t.line||e.ch-t.ch}function rt(e,t){return e.sticky==t.sticky&&0==tt(e,t)}function nt(e){return et(e.line,e.ch)}function it(e,t){return tt(e,t)<0?t:e}function ot(e,t){return tt(e,t)<0?e:t}function at(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function lt(e,t){if(t.line<e.first)return et(e.first,0)
|
|
126
126
|
var r=e.first+e.size-1
|
|
127
|
-
return t.line>r?
|
|
128
|
-
return null==r||r>t?
|
|
129
|
-
return r}
|
|
130
|
-
if("string"==typeof e?t==e:t&&(e.test?e.test(t):e(t)))return++this.pos,t},
|
|
131
|
-
return this.pos>e},
|
|
132
|
-
if(t>-1)return this.pos=t,!0},
|
|
127
|
+
return t.line>r?et(r,qe(e,r).text.length):function(e,t){var r=e.ch
|
|
128
|
+
return null==r||r>t?et(e.line,t):r<0?et(e.line,0):e}(t,qe(e,t.line).text.length)}function st(e,t){for(var r=[],n=0;n<t.length;n++)r[n]=lt(e,t[n])
|
|
129
|
+
return r}Ue.prototype.eol=function(){return this.pos>=this.string.length},Ue.prototype.sol=function(){return this.pos==this.lineStart},Ue.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ue.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Ue.prototype.eat=function(e){var t=this.string.charAt(this.pos)
|
|
130
|
+
if("string"==typeof e?t==e:t&&(e.test?e.test(t):e(t)))return++this.pos,t},Ue.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Ue.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos
|
|
131
|
+
return this.pos>e},Ue.prototype.skipToEnd=function(){this.pos=this.string.length},Ue.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos)
|
|
132
|
+
if(t>-1)return this.pos=t,!0},Ue.prototype.backUp=function(e){this.pos-=e},Ue.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=F(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?F(this.string,this.lineStart,this.tabSize):0)},Ue.prototype.indentation=function(){return F(this.string,null,this.tabSize)-(this.lineStart?F(this.string,this.lineStart,this.tabSize):0)},Ue.prototype.match=function(e,t,r){if("string"!=typeof e){var n=this.string.slice(this.pos).match(e)
|
|
133
133
|
return n&&n.index>0?null:(n&&!1!==t&&(this.pos+=n[0].length),n)}var i=function(e){return r?e.toLowerCase():e}
|
|
134
|
-
if(i(this.string.substr(this.pos,e.length))==i(e))return!1!==t&&(this.pos+=e.length),!0},
|
|
135
|
-
try{return t()}finally{this.lineStart-=e}},
|
|
136
|
-
return t&&t.lookAhead(e)},
|
|
134
|
+
if(i(this.string.substr(this.pos,e.length))==i(e))return!1!==t&&(this.pos+=e.length),!0},Ue.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ue.prototype.hideFirstChars=function(e,t){this.lineStart+=e
|
|
135
|
+
try{return t()}finally{this.lineStart-=e}},Ue.prototype.lookAhead=function(e){var t=this.lineOracle
|
|
136
|
+
return t&&t.lookAhead(e)},Ue.prototype.baseToken=function(){var e=this.lineOracle
|
|
137
137
|
return e&&e.baseToken(this.pos)}
|
|
138
|
-
var
|
|
139
|
-
function
|
|
140
|
-
|
|
138
|
+
var ut=function(e,t){this.state=e,this.lookAhead=t},ct=function(e,t,r,n){this.state=t,this.doc=e,this.line=r,this.maxLookAhead=n||0,this.baseTokens=null,this.baseTokenPos=1}
|
|
139
|
+
function dt(e,t,r,n){var i=[e.state.modeGen],o={}
|
|
140
|
+
wt(e,t.text,e.doc.mode,r,(function(e,t){return i.push(e,t)}),o,n)
|
|
141
141
|
for(var a=r.state,l=function(n){r.baseTokens=i
|
|
142
142
|
var l=e.state.overlays[n],s=1,u=0
|
|
143
|
-
r.state=!0,
|
|
143
|
+
r.state=!0,wt(e,t.text,l.mode,r,(function(e,t){for(var r=s;u<e;){var n=i[s]
|
|
144
144
|
n>e&&i.splice(s,1,e,i[s+1],n),s+=2,u=Math.min(e,n)}if(t)if(l.opaque)i.splice(r,s-r,e,"overlay "+t),s=r+2
|
|
145
145
|
else for(;r<s;r+=2){var o=i[r+1]
|
|
146
146
|
i[r+1]=(o?o+" ":"")+"overlay "+t}}),o),r.state=a,r.baseTokens=null,r.baseTokenPos=1},s=0;s<e.state.overlays.length;++s)l(s)
|
|
147
|
-
return{styles:i,classes:o.bgClass||o.textClass?o:null}}function
|
|
148
|
-
i&&(n.state=i),t.stateAfter=n.save(!i),t.styles=o.styles,o.classes?t.styleClasses=o.classes:t.styleClasses&&(t.styleClasses=null),r===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function
|
|
149
|
-
if(!n.mode.startState)return new
|
|
147
|
+
return{styles:i,classes:o.bgClass||o.textClass?o:null}}function ft(e,t,r){if(!t.styles||t.styles[0]!=e.state.modeGen){var n=ht(e,Ye(t)),i=t.text.length>e.options.maxHighlightLength&&Ve(e.doc.mode,n.state),o=dt(e,t,n)
|
|
148
|
+
i&&(n.state=i),t.stateAfter=n.save(!i),t.styles=o.styles,o.classes?t.styleClasses=o.classes:t.styleClasses&&(t.styleClasses=null),r===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function ht(e,t,r){var n=e.doc,i=e.display
|
|
149
|
+
if(!n.mode.startState)return new ct(n,!0,t)
|
|
150
150
|
var o=function(e,t,r){for(var n,i,o=e.doc,a=r?-1:t-(e.doc.mode.innerMode?1e3:100),l=t;l>a;--l){if(l<=o.first)return o.first
|
|
151
|
-
var s=
|
|
152
|
-
if(u&&(!r||l+(u instanceof
|
|
153
|
-
var c=F(s.text,null,e.options.tabSize);(null==i||n>c)&&(i=l-1,n=c)}return i}(e,t,r),a=o>n.first&&
|
|
154
|
-
return n.iter(o,t,(function(r){
|
|
151
|
+
var s=qe(o,l-1),u=s.stateAfter
|
|
152
|
+
if(u&&(!r||l+(u instanceof ut?u.lookAhead:0)<=o.modeFrontier))return l
|
|
153
|
+
var c=F(s.text,null,e.options.tabSize);(null==i||n>c)&&(i=l-1,n=c)}return i}(e,t,r),a=o>n.first&&qe(n,o-1).stateAfter,l=a?ct.fromSaved(n,a,o):new ct(n,Ge(n.mode),o)
|
|
154
|
+
return n.iter(o,t,(function(r){pt(e,r.text,l)
|
|
155
155
|
var n=l.line
|
|
156
|
-
r.stateAfter=n==t-1||n%5==0||n>=i.viewFrom&&n<i.viewTo?l.save():null,l.nextLine()})),r&&(n.modeFrontier=l.line),l}function
|
|
157
|
-
for(o.start=o.pos=n||0,""==t&&
|
|
158
|
-
if(e.innerMode){var r=
|
|
159
|
-
return r.mode.blankLine?r.mode.blankLine(r.state):void 0}}function
|
|
156
|
+
r.stateAfter=n==t-1||n%5==0||n>=i.viewFrom&&n<i.viewTo?l.save():null,l.nextLine()})),r&&(n.modeFrontier=l.line),l}function pt(e,t,r,n){var i=e.doc.mode,o=new Ue(t,e.options.tabSize,r)
|
|
157
|
+
for(o.start=o.pos=n||0,""==t&>(i,r.state);!o.eol();)mt(i,o,r.state),o.start=o.pos}function gt(e,t){if(e.blankLine)return e.blankLine(t)
|
|
158
|
+
if(e.innerMode){var r=Ke(e,t)
|
|
159
|
+
return r.mode.blankLine?r.mode.blankLine(r.state):void 0}}function mt(e,t,r,n){for(var i=0;i<10;i++){n&&(n[0]=Ke(e,r).mode)
|
|
160
160
|
var o=e.token(t,r)
|
|
161
|
-
if(t.pos>t.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}
|
|
162
|
-
return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},
|
|
161
|
+
if(t.pos>t.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}ct.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e)
|
|
162
|
+
return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},ct.prototype.baseToken=function(e){if(!this.baseTokens)return null
|
|
163
163
|
for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2
|
|
164
164
|
var t=this.baseTokens[this.baseTokenPos+1]
|
|
165
|
-
return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},
|
|
166
|
-
return this.maxLookAhead>0?new
|
|
167
|
-
var
|
|
168
|
-
function
|
|
169
|
-
for(n&&(o=[]);(n||c.pos<t.ch)&&!c.eol();)c.start=c.pos,i=
|
|
170
|
-
return n?o:new
|
|
165
|
+
return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},ct.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},ct.fromSaved=function(e,t,r){return t instanceof ut?new ct(e,Ve(e.mode,t.state),r,t.lookAhead):new ct(e,Ve(e.mode,t),r)},ct.prototype.save=function(e){var t=!1!==e?Ve(this.doc.mode,this.state):this.state
|
|
166
|
+
return this.maxLookAhead>0?new ut(t,this.maxLookAhead):t}
|
|
167
|
+
var vt=function(e,t,r){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=r}
|
|
168
|
+
function yt(e,t,r,n){var i,o,a=e.doc,l=a.mode,s=qe(a,(t=lt(a,t)).line),u=ht(e,t.line,r),c=new Ue(s.text,e.options.tabSize,u)
|
|
169
|
+
for(n&&(o=[]);(n||c.pos<t.ch)&&!c.eol();)c.start=c.pos,i=mt(l,c,u.state),n&&o.push(new vt(c,i,Ve(a.mode,u.state)))
|
|
170
|
+
return n?o:new vt(c,i,u.state)}function bt(e,t){if(e)for(;;){var r=e.match(/(?:^|\s+)line-(background-)?(\S+)/)
|
|
171
171
|
if(!r)break
|
|
172
172
|
e=e.slice(0,r.index)+e.slice(r.index+r[0].length)
|
|
173
173
|
var n=r[1]?"bgClass":"textClass"
|
|
174
|
-
null==t[n]?t[n]=r[2]:new RegExp("(?:^|s)"+r[2]+"(?:$|s)").test(t[n])||(t[n]+=" "+r[2])}return e}function
|
|
174
|
+
null==t[n]?t[n]=r[2]:new RegExp("(?:^|s)"+r[2]+"(?:$|s)").test(t[n])||(t[n]+=" "+r[2])}return e}function wt(e,t,r,n,i,o,a){var l=r.flattenSpans
|
|
175
175
|
null==l&&(l=e.options.flattenSpans)
|
|
176
|
-
var s,u=0,c=null,d=new
|
|
177
|
-
for(""==t&&
|
|
176
|
+
var s,u=0,c=null,d=new Ue(t,e.options.tabSize,n),f=e.options.addModeClass&&[null]
|
|
177
|
+
for(""==t&&bt(gt(r,n.state),o);!d.eol();){if(d.pos>e.options.maxHighlightLength?(l=!1,a&&pt(e,t,n,d.pos),d.pos=t.length,s=null):s=bt(mt(r,d,n.state,f),o),f){var h=f[0].name
|
|
178
178
|
h&&(s="m-"+(s?h+" "+s:h))}if(!l||c!=s){for(;u<d.start;)i(u=Math.min(d.start,u+5e3),c)
|
|
179
179
|
c=s}d.start=d.pos}for(;u<d.pos;){var p=Math.min(d.pos,u+5e3)
|
|
180
|
-
i(p,c),u=p}}var
|
|
181
|
-
function
|
|
182
|
-
if(n.marker==t)return n}}function
|
|
183
|
-
return r}function
|
|
184
|
-
var r=
|
|
180
|
+
i(p,c),u=p}}var xt=!1,kt=!1
|
|
181
|
+
function Ct(e,t,r){this.marker=e,this.from=t,this.to=r}function St(e,t){if(e)for(var r=0;r<e.length;++r){var n=e[r]
|
|
182
|
+
if(n.marker==t)return n}}function Lt(e,t){for(var r,n=0;n<e.length;++n)e[n]!=t&&(r||(r=[])).push(e[n])
|
|
183
|
+
return r}function Tt(e,t){if(t.full)return null
|
|
184
|
+
var r=Qe(e,t.from.line)&&qe(e,t.from.line).markedSpans,n=Qe(e,t.to.line)&&qe(e,t.to.line).markedSpans
|
|
185
185
|
if(!r&&!n)return null
|
|
186
|
-
var i=t.from.ch,o=t.to.ch,a=0==
|
|
186
|
+
var i=t.from.ch,o=t.to.ch,a=0==tt(t.from,t.to),l=function(e,t,r){var n
|
|
187
187
|
if(e)for(var i=0;i<e.length;++i){var o=e[i],a=o.marker
|
|
188
|
-
if(null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t)||o.from==t&&"bookmark"==a.type&&(!r||!o.marker.insertLeft)){var l=null==o.to||(a.inclusiveRight?o.to>=t:o.to>t);(n||(n=[])).push(new
|
|
188
|
+
if(null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t)||o.from==t&&"bookmark"==a.type&&(!r||!o.marker.insertLeft)){var l=null==o.to||(a.inclusiveRight?o.to>=t:o.to>t);(n||(n=[])).push(new Ct(a,o.from,l?null:o.to))}}return n}(r,i,a),s=function(e,t,r){var n
|
|
189
189
|
if(e)for(var i=0;i<e.length;++i){var o=e[i],a=o.marker
|
|
190
|
-
if(null==o.to||(a.inclusiveRight?o.to>=t:o.to>t)||o.from==t&&"bookmark"==a.type&&(!r||o.marker.insertLeft)){var l=null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t);(n||(n=[])).push(new
|
|
190
|
+
if(null==o.to||(a.inclusiveRight?o.to>=t:o.to>t)||o.from==t&&"bookmark"==a.type&&(!r||o.marker.insertLeft)){var l=null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t);(n||(n=[])).push(new Ct(a,l?null:o.from-t,null==o.to?null:o.to-t))}}return n}(n,o,a),u=1==t.text.length,c=$(t.text).length+(u?i:0)
|
|
191
191
|
if(l)for(var d=0;d<l.length;++d){var f=l[d]
|
|
192
|
-
if(null==f.to){var h=
|
|
192
|
+
if(null==f.to){var h=St(s,f.marker)
|
|
193
193
|
h?u&&(f.to=null==h.to?null:h.to+c):f.to=i}}if(s)for(var p=0;p<s.length;++p){var g=s[p]
|
|
194
|
-
null!=g.to&&(g.to+=c),null==g.from?
|
|
194
|
+
null!=g.to&&(g.to+=c),null==g.from?St(l,g.marker)||(g.from=c,u&&(l||(l=[])).push(g)):(g.from+=c,u&&(l||(l=[])).push(g))}l&&(l=Mt(l)),s&&s!=l&&(s=Mt(s))
|
|
195
195
|
var m=[l]
|
|
196
196
|
if(!u){var v,y=t.text.length-2
|
|
197
|
-
if(y>0&&l)for(var b=0;b<l.length;++b)null==l[b].to&&(v||(v=[])).push(new
|
|
197
|
+
if(y>0&&l)for(var b=0;b<l.length;++b)null==l[b].to&&(v||(v=[])).push(new Ct(l[b].marker,null,null))
|
|
198
198
|
for(var w=0;w<y;++w)m.push(v)
|
|
199
|
-
m.push(s)}return m}function
|
|
200
|
-
null!=r.from&&r.from==r.to&&!1!==r.marker.clearWhenEmpty&&e.splice(t--,1)}return e.length?e:null}function
|
|
199
|
+
m.push(s)}return m}function Mt(e){for(var t=0;t<e.length;++t){var r=e[t]
|
|
200
|
+
null!=r.from&&r.from==r.to&&!1!==r.marker.clearWhenEmpty&&e.splice(t--,1)}return e.length?e:null}function Nt(e){var t=e.markedSpans
|
|
201
201
|
if(t){for(var r=0;r<t.length;++r)t[r].marker.detachLine(e)
|
|
202
|
-
e.markedSpans=null}}function
|
|
203
|
-
e.markedSpans=t}}function
|
|
202
|
+
e.markedSpans=null}}function At(e,t){if(t){for(var r=0;r<t.length;++r)t[r].marker.attachLine(e)
|
|
203
|
+
e.markedSpans=t}}function Ot(e){return e.inclusiveLeft?-1:0}function Wt(e){return e.inclusiveRight?1:0}function Dt(e,t){var r=e.lines.length-t.lines.length
|
|
204
204
|
if(0!=r)return r
|
|
205
|
-
var n=e.find(),i=t.find(),o=
|
|
206
|
-
return o?-o:
|
|
207
|
-
if(n)for(var i=void 0,o=0;o<n.length;++o)(i=n[o]).marker.collapsed&&null==(t?i.from:i.to)&&(!r||
|
|
208
|
-
return r}function
|
|
205
|
+
var n=e.find(),i=t.find(),o=tt(n.from,i.from)||Ot(e)-Ot(t)
|
|
206
|
+
return o?-o:tt(n.to,i.to)||Wt(e)-Wt(t)||t.id-e.id}function zt(e,t){var r,n=kt&&e.markedSpans
|
|
207
|
+
if(n)for(var i=void 0,o=0;o<n.length;++o)(i=n[o]).marker.collapsed&&null==(t?i.from:i.to)&&(!r||Dt(r,i.marker)<0)&&(r=i.marker)
|
|
208
|
+
return r}function Pt(e){return zt(e,!0)}function Ht(e){return zt(e,!1)}function It(e,t){var r,n=kt&&e.markedSpans
|
|
209
209
|
if(n)for(var i=0;i<n.length;++i){var o=n[i]
|
|
210
|
-
o.marker.collapsed&&(null==o.from||o.from<t)&&(null==o.to||o.to>t)&&(!r||
|
|
210
|
+
o.marker.collapsed&&(null==o.from||o.from<t)&&(null==o.to||o.to>t)&&(!r||Dt(r,o.marker)<0)&&(r=o.marker)}return r}function Et(e,t,r,n,i){var o=qe(e,t),a=kt&&o.markedSpans
|
|
211
211
|
if(a)for(var l=0;l<a.length;++l){var s=a[l]
|
|
212
|
-
if(s.marker.collapsed){var u=s.marker.find(0),c=
|
|
213
|
-
if(!(c>=0&&d<=0||c<=0&&d>=0)&&(c<=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?
|
|
214
|
-
return e}function
|
|
215
|
-
return r==n?t:
|
|
216
|
-
var r,n=
|
|
217
|
-
if(!
|
|
218
|
-
for(;r=
|
|
219
|
-
return
|
|
212
|
+
if(s.marker.collapsed){var u=s.marker.find(0),c=tt(u.from,r)||Ot(s.marker)-Ot(i),d=tt(u.to,n)||Wt(s.marker)-Wt(i)
|
|
213
|
+
if(!(c>=0&&d<=0||c<=0&&d>=0)&&(c<=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?tt(u.to,r)>=0:tt(u.to,r)>0)||c>=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?tt(u.from,n)<=0:tt(u.from,n)<0)))return!0}}}function Ft(e){for(var t;t=Pt(e);)e=t.find(-1,!0).line
|
|
214
|
+
return e}function Rt(e,t){var r=qe(e,t),n=Ft(r)
|
|
215
|
+
return r==n?t:Ye(n)}function Bt(e,t){if(t>e.lastLine())return t
|
|
216
|
+
var r,n=qe(e,t)
|
|
217
|
+
if(!jt(e,n))return t
|
|
218
|
+
for(;r=Ht(n);)n=r.find(1,!0).line
|
|
219
|
+
return Ye(n)+1}function jt(e,t){var r=kt&&t.markedSpans
|
|
220
220
|
if(r)for(var n=void 0,i=0;i<r.length;++i)if((n=r[i]).marker.collapsed){if(null==n.from)return!0
|
|
221
|
-
if(!n.marker.widgetNode&&0==n.from&&n.marker.inclusiveLeft&&
|
|
222
|
-
return
|
|
223
|
-
for(var i=void 0,o=0;o<t.markedSpans.length;++o)if((i=t.markedSpans[o]).marker.collapsed&&!i.marker.widgetNode&&i.from==r.to&&(null==i.to||i.to!=r.from)&&(i.marker.inclusiveLeft||r.marker.inclusiveRight)&&
|
|
221
|
+
if(!n.marker.widgetNode&&0==n.from&&n.marker.inclusiveLeft&&Vt(e,t,n))return!0}}function Vt(e,t,r){if(null==r.to){var n=r.marker.find(1,!0)
|
|
222
|
+
return Vt(e,n.line,St(n.line.markedSpans,r.marker))}if(r.marker.inclusiveRight&&r.to==t.text.length)return!0
|
|
223
|
+
for(var i=void 0,o=0;o<t.markedSpans.length;++o)if((i=t.markedSpans[o]).marker.collapsed&&!i.marker.widgetNode&&i.from==r.to&&(null==i.to||i.to!=r.from)&&(i.marker.inclusiveLeft||r.marker.inclusiveRight)&&Vt(e,t,i))return!0}function Kt(e){for(var t=0,r=(e=Ft(e)).parent,n=0;n<r.lines.length;++n){var i=r.lines[n]
|
|
224
224
|
if(i==e)break
|
|
225
225
|
t+=i.height}for(var o=r.parent;o;o=(r=o).parent)for(var a=0;a<o.children.length;++a){var l=o.children[a]
|
|
226
226
|
if(l==r)break
|
|
227
|
-
t+=l.height}return t}function
|
|
228
|
-
for(var t,r=e.text.length,n=e;t=
|
|
229
|
-
n=i.from.line,r+=i.from.ch-i.to.ch}for(n=e;t=
|
|
230
|
-
r-=n.text.length-o.from.ch,r+=(n=o.to.line).text.length-o.to.ch}return r}function
|
|
231
|
-
t.maxLine=
|
|
232
|
-
r>t.maxLineLength&&(t.maxLineLength=r,t.maxLine=e)}))}var
|
|
233
|
-
function
|
|
234
|
-
var
|
|
235
|
-
function
|
|
236
|
-
var r=t.addModeClass?
|
|
237
|
-
return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function
|
|
227
|
+
t+=l.height}return t}function Gt(e){if(0==e.height)return 0
|
|
228
|
+
for(var t,r=e.text.length,n=e;t=Pt(n);){var i=t.find(0,!0)
|
|
229
|
+
n=i.from.line,r+=i.from.ch-i.to.ch}for(n=e;t=Ht(n);){var o=t.find(0,!0)
|
|
230
|
+
r-=n.text.length-o.from.ch,r+=(n=o.to.line).text.length-o.to.ch}return r}function Ut(e){var t=e.display,r=e.doc
|
|
231
|
+
t.maxLine=qe(r,r.first),t.maxLineLength=Gt(t.maxLine),t.maxLineChanged=!0,r.iter((function(e){var r=Gt(e)
|
|
232
|
+
r>t.maxLineLength&&(t.maxLineLength=r,t.maxLine=e)}))}var qt=function(e,t,r){this.text=e,At(this,t),this.height=r?r(this):1}
|
|
233
|
+
function _t(e){e.parent=null,Nt(e)}qt.prototype.lineNo=function(){return Ye(this)},ye(qt)
|
|
234
|
+
var $t={},Xt={}
|
|
235
|
+
function Yt(e,t){if(!e||/^\s*$/.test(e))return null
|
|
236
|
+
var r=t.addModeClass?Xt:$t
|
|
237
|
+
return r[e]||(r[e]=e.replace(/\S+/g,"cm-$&"))}function Zt(e,t){var r=O("span",null,null,s?"padding-right: .1px":null),n={pre:O("pre",[r],"CodeMirror-line"),content:r,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")}
|
|
238
238
|
t.measure={}
|
|
239
239
|
for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o=i?t.rest[i-1]:t.line,a=void 0
|
|
240
|
-
n.pos=0,n.addToken=
|
|
241
|
-
return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function
|
|
240
|
+
n.pos=0,n.addToken=Jt,Ae(e.display.measure)&&(a=ue(o,e.doc.direction))&&(n.addToken=er(n.addToken,a)),n.map=[],rr(o,n,ft(e,o,t!=e.display.externalMeasured&&Ye(o))),o.styleClasses&&(o.styleClasses.bgClass&&(n.bgClass=P(o.styleClasses.bgClass,n.bgClass||"")),o.styleClasses.textClass&&(n.textClass=P(o.styleClasses.textClass,n.textClass||""))),0==n.map.length&&n.map.push(0,0,n.content.appendChild(Ne(e.display.measure))),0==i?(t.measure.map=n.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(n.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(s){var l=n.content.lastChild;(/\bcm-tab\b/.test(l.className)||l.querySelector&&l.querySelector(".cm-tab"))&&(n.content.className="cm-tab-wrap-hack")}return pe(e,"renderLine",e,t.line,n.pre),n.pre.className&&(n.textClass=P(n.pre.className,n.textClass||"")),n}function Qt(e){var t=A("span","•","cm-invalidchar")
|
|
241
|
+
return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Jt(e,t,r,n,i,o,s){if(t){var u,c=e.splitSpaces?function(e,t){if(e.length>1&&!/ /.test(e))return e
|
|
242
242
|
for(var r=t,n="",i=0;i<e.length;i++){var o=e.charAt(i)
|
|
243
243
|
" "!=o||!r||i!=e.length-1&&32!=e.charCodeAt(i+1)||(o=" "),n+=o,r=" "==o}return n}(t,e.trailingSpace):t,d=e.cm.state.specialChars,f=!1
|
|
244
244
|
if(d.test(t)){u=document.createDocumentFragment()
|
|
@@ -248,299 +248,299 @@ if(g){var m=document.createTextNode(c.slice(h,h+g))
|
|
|
248
248
|
a&&l<9?u.appendChild(A("span",[m])):u.appendChild(m),e.map.push(e.pos,e.pos+g,m),e.col+=g,e.pos+=g}if(!p)break
|
|
249
249
|
h+=g+1
|
|
250
250
|
var v=void 0
|
|
251
|
-
if("\t"==p[0]){var y=e.cm.options.tabSize,b=y-e.col%y;(v=u.appendChild(A("span"
|
|
251
|
+
if("\t"==p[0]){var y=e.cm.options.tabSize,b=y-e.col%y;(v=u.appendChild(A("span",_(b),"cm-tab"))).setAttribute("role","presentation"),v.setAttribute("cm-text","\t"),e.col+=b}else"\r"==p[0]||"\n"==p[0]?((v=u.appendChild(A("span","\r"==p[0]?"␍":"","cm-invalidchar"))).setAttribute("cm-text",p[0]),e.col+=1):((v=e.cm.options.specialCharPlaceholder(p[0])).setAttribute("cm-text",p[0]),a&&l<9?u.appendChild(A("span",[v])):u.appendChild(v),e.col+=1)
|
|
252
252
|
e.map.push(e.pos,e.pos+1,v),e.pos++}}else e.col+=t.length,u=document.createTextNode(c),e.map.push(e.pos,e.pos+t.length,u),a&&l<9&&(f=!0),e.pos+=t.length
|
|
253
253
|
if(e.trailingSpace=32==c.charCodeAt(t.length-1),r||n||i||f||o){var w=r||""
|
|
254
254
|
n&&(w+=n),i&&(w+=i)
|
|
255
255
|
var x=A("span",[u],w,o)
|
|
256
256
|
if(s)for(var k in s)s.hasOwnProperty(k)&&"style"!=k&&"class"!=k&&x.setAttribute(k,s[k])
|
|
257
|
-
return e.content.appendChild(x)}e.content.appendChild(u)}}function
|
|
257
|
+
return e.content.appendChild(x)}e.content.appendChild(u)}}function er(e,t){return function(r,n,i,o,a,l,s){i=i?i+" cm-force-border":"cm-force-border"
|
|
258
258
|
for(var u=r.pos,c=u+n.length;;){for(var d=void 0,f=0;f<t.length&&!((d=t[f]).to>u&&d.from<=u);f++);if(d.to>=c)return e(r,n,i,o,a,l,s)
|
|
259
|
-
e(r,n.slice(0,d.to-u),i,o,null,l,s),o=null,n=n.slice(d.to-u),u=d.to}}}function
|
|
260
|
-
i&&e.map.push(e.pos,e.pos+t,i),!n&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",r.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function
|
|
259
|
+
e(r,n.slice(0,d.to-u),i,o,null,l,s),o=null,n=n.slice(d.to-u),u=d.to}}}function tr(e,t,r,n){var i=!n&&r.widgetNode
|
|
260
|
+
i&&e.map.push(e.pos,e.pos+t,i),!n&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",r.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function rr(e,t,r){var n=e.markedSpans,i=e.text,o=0
|
|
261
261
|
if(n)for(var a,l,s,u,c,d,f,h=i.length,p=0,g=1,m="",v=0;;){if(v==p){s=u=c=l="",f=null,d=null,v=1/0
|
|
262
262
|
for(var y=[],b=void 0,w=0;w<n.length;++w){var x=n[w],k=x.marker
|
|
263
263
|
if("bookmark"==k.type&&x.from==p&&k.widgetNode)y.push(k)
|
|
264
264
|
else if(x.from<=p&&(null==x.to||x.to>p||k.collapsed&&x.to==p&&x.from==p)){if(null!=x.to&&x.to!=p&&v>x.to&&(v=x.to,u=""),k.className&&(s+=" "+k.className),k.css&&(l=(l?l+";":"")+k.css),k.startStyle&&x.from==p&&(c+=" "+k.startStyle),k.endStyle&&x.to==v&&(b||(b=[])).push(k.endStyle,x.to),k.title&&((f||(f={})).title=k.title),k.attributes)for(var C in k.attributes)(f||(f={}))[C]=k.attributes[C]
|
|
265
|
-
k.collapsed&&(!d||
|
|
266
|
-
if(!d||d.from==p)for(var L=0;L<y.length;++L)
|
|
267
|
-
if(d&&(d.from||0)==p){if(
|
|
265
|
+
k.collapsed&&(!d||Dt(d.marker,k)<0)&&(d=x)}else x.from>p&&v>x.from&&(v=x.from)}if(b)for(var S=0;S<b.length;S+=2)b[S+1]==v&&(u+=" "+b[S])
|
|
266
|
+
if(!d||d.from==p)for(var L=0;L<y.length;++L)tr(t,0,y[L])
|
|
267
|
+
if(d&&(d.from||0)==p){if(tr(t,(null==d.to?h+1:d.to)-p,d.marker,null==d.from),null==d.to)return
|
|
268
268
|
d.to==p&&(d=!1)}}if(p>=h)break
|
|
269
269
|
for(var T=Math.min(h,v);;){if(m){var M=p+m.length
|
|
270
270
|
if(!d){var N=M>T?m.slice(0,T-p):m
|
|
271
271
|
t.addToken(t,N,a?a+s:s,c,p+N.length==v?u:"",l,f)}if(M>=T){m=m.slice(T-p),p=T
|
|
272
|
-
break}p=M,c=""}m=i.slice(o,o=r[g++]),a=
|
|
273
|
-
return r}(t),this.size=this.rest?
|
|
274
|
-
n=o+a.size,i.push(a)}return i}var
|
|
275
|
-
function
|
|
272
|
+
break}p=M,c=""}m=i.slice(o,o=r[g++]),a=Yt(r[g++],t.cm.options)}}else for(var A=1;A<r.length;A+=2)t.addToken(t,i.slice(o,o=r[A]),Yt(r[A+1],t.cm.options))}function nr(e,t,r){this.line=t,this.rest=function(e){for(var t,r;t=Ht(e);)e=t.find(1,!0).line,(r||(r=[])).push(e)
|
|
273
|
+
return r}(t),this.size=this.rest?Ye($(this.rest))-r+1:1,this.node=this.text=null,this.hidden=jt(e,t)}function ir(e,t,r){for(var n,i=[],o=t;o<r;o=n){var a=new nr(e.doc,qe(e.doc,o),o)
|
|
274
|
+
n=o+a.size,i.push(a)}return i}var or=null,ar=null
|
|
275
|
+
function lr(e,t){var r=fe(e,t)
|
|
276
276
|
if(r.length){var n,i=Array.prototype.slice.call(arguments,2)
|
|
277
|
-
|
|
278
|
-
for(var o=function(e){n.push((function(){return r[e].apply(null,i)}))},a=0;a<r.length;++a)o(a)}}function
|
|
279
|
-
|
|
280
|
-
for(var t=0;t<e.length;++t)e[t]()}function
|
|
281
|
-
"text"==o?
|
|
282
|
-
return r&&r.line==t.line?(e.display.externalMeasured=null,t.measure=r.measure,r.built):
|
|
283
|
-
t.text==t.node&&(t.node=n.pre),t.text.parentNode.replaceChild(n.pre,t.text),t.text=n.pre,n.bgClass!=t.bgClass||n.textClass!=t.textClass?(t.bgClass=n.bgClass,t.textClass=n.textClass,
|
|
277
|
+
or?n=or.delayedCallbacks:ar?n=ar:(n=ar=[],setTimeout(sr,0))
|
|
278
|
+
for(var o=function(e){n.push((function(){return r[e].apply(null,i)}))},a=0;a<r.length;++a)o(a)}}function sr(){var e=ar
|
|
279
|
+
ar=null
|
|
280
|
+
for(var t=0;t<e.length;++t)e[t]()}function ur(e,t,r,n){for(var i=0;i<t.changes.length;i++){var o=t.changes[i]
|
|
281
|
+
"text"==o?fr(e,t):"gutter"==o?pr(e,t,r,n):"class"==o?hr(e,t):"widget"==o&&gr(e,t,n)}t.changes=null}function cr(e){return e.node==e.text&&(e.node=A("div",null,null,"position: relative"),e.text.parentNode&&e.text.parentNode.replaceChild(e.node,e.text),e.node.appendChild(e.text),a&&l<8&&(e.node.style.zIndex=2)),e.node}function dr(e,t){var r=e.display.externalMeasured
|
|
282
|
+
return r&&r.line==t.line?(e.display.externalMeasured=null,t.measure=r.measure,r.built):Zt(e,t)}function fr(e,t){var r=t.text.className,n=dr(e,t)
|
|
283
|
+
t.text==t.node&&(t.node=n.pre),t.text.parentNode.replaceChild(n.pre,t.text),t.text=n.pre,n.bgClass!=t.bgClass||n.textClass!=t.textClass?(t.bgClass=n.bgClass,t.textClass=n.textClass,hr(e,t)):r&&(t.text.className=r)}function hr(e,t){!function(e,t){var r=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass
|
|
284
284
|
if(r&&(r+=" CodeMirror-linebackground"),t.background)r?t.background.className=r:(t.background.parentNode.removeChild(t.background),t.background=null)
|
|
285
|
-
else if(r){var n=
|
|
286
|
-
t.background=n.insertBefore(A("div",null,r),n.firstChild),e.display.input.setUneditable(t.background)}}(e,t),t.line.wrapClass?
|
|
285
|
+
else if(r){var n=cr(t)
|
|
286
|
+
t.background=n.insertBefore(A("div",null,r),n.firstChild),e.display.input.setUneditable(t.background)}}(e,t),t.line.wrapClass?cr(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="")
|
|
287
287
|
var r=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass
|
|
288
|
-
t.text.className=r||""}function
|
|
288
|
+
t.text.className=r||""}function pr(e,t,r,n){if(t.gutter&&(t.node.removeChild(t.gutter),t.gutter=null),t.gutterBackground&&(t.node.removeChild(t.gutterBackground),t.gutterBackground=null),t.line.gutterClass){var i=cr(t)
|
|
289
289
|
t.gutterBackground=A("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px; width: "+n.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),i.insertBefore(t.gutterBackground,t.text)}var o=t.line.gutterMarkers
|
|
290
|
-
if(e.options.lineNumbers||o){var a=
|
|
291
|
-
if(e.display.input.setUneditable(l),a.insertBefore(l,t.text),t.line.gutterClass&&(l.className+=" "+t.line.gutterClass),!e.options.lineNumbers||o&&o["CodeMirror-linenumbers"]||(t.lineNumber=l.appendChild(A("div",
|
|
292
|
-
c&&l.appendChild(A("div",[c],"CodeMirror-gutter-elt","left: "+n.gutterLeft[u]+"px; width: "+n.gutterWidth[u]+"px"))}}}function
|
|
290
|
+
if(e.options.lineNumbers||o){var a=cr(t),l=t.gutter=A("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?n.fixedPos:-n.gutterTotalWidth)+"px")
|
|
291
|
+
if(e.display.input.setUneditable(l),a.insertBefore(l,t.text),t.line.gutterClass&&(l.className+=" "+t.line.gutterClass),!e.options.lineNumbers||o&&o["CodeMirror-linenumbers"]||(t.lineNumber=l.appendChild(A("div",Je(e.options,r),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+n.gutterLeft["CodeMirror-linenumbers"]+"px; width: "+e.display.lineNumInnerWidth+"px"))),o)for(var s=0;s<e.display.gutterSpecs.length;++s){var u=e.display.gutterSpecs[s].className,c=o.hasOwnProperty(u)&&o[u]
|
|
292
|
+
c&&l.appendChild(A("div",[c],"CodeMirror-gutter-elt","left: "+n.gutterLeft[u]+"px; width: "+n.gutterWidth[u]+"px"))}}}function gr(e,t,r){t.alignable&&(t.alignable=null)
|
|
293
293
|
for(var n=t.node.firstChild,i=void 0;n;n=i)i=n.nextSibling,"CodeMirror-linewidget"==n.className&&t.node.removeChild(n)
|
|
294
|
-
|
|
295
|
-
return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),
|
|
296
|
-
s.handleMouseEvents||u.setAttribute("cm-ignore-events","true"),
|
|
294
|
+
vr(e,t,r)}function mr(e,t,r,n){var i=dr(e,t)
|
|
295
|
+
return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),hr(e,t),pr(e,t,r,n),vr(e,t,n),t.node}function vr(e,t,r){if(yr(e,t.line,t,r,!0),t.rest)for(var n=0;n<t.rest.length;n++)yr(e,t.rest[n],t,r,!1)}function yr(e,t,r,n,i){if(t.widgets)for(var o=cr(r),a=0,l=t.widgets;a<l.length;++a){var s=l[a],u=A("div",[s.node],"CodeMirror-linewidget")
|
|
296
|
+
s.handleMouseEvents||u.setAttribute("cm-ignore-events","true"),br(s,u,r,n),e.display.input.setUneditable(u),i&&s.above?o.insertBefore(u,r.gutter||r.text):o.appendChild(u),lr(s,"redraw")}}function br(e,t,r,n){if(e.noHScroll){(r.alignable||(r.alignable=[])).push(t)
|
|
297
297
|
var i=n.wrapperWidth
|
|
298
|
-
t.style.left=n.fixedPos+"px",e.coverGutter||(i-=n.gutterTotalWidth,t.style.paddingLeft=n.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-n.gutterTotalWidth+"px"))}function
|
|
298
|
+
t.style.left=n.fixedPos+"px",e.coverGutter||(i-=n.gutterTotalWidth,t.style.paddingLeft=n.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-n.gutterTotalWidth+"px"))}function wr(e){if(null!=e.height)return e.height
|
|
299
299
|
var t=e.doc.cm
|
|
300
300
|
if(!t)return 0
|
|
301
301
|
if(!W(document.body,e.node)){var r="position: relative;"
|
|
302
|
-
e.coverGutter&&(r+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(r+="width: "+t.display.wrapper.clientWidth+"px;"),N(t.display.measure,A("div",[e.node],null,r))}return e.height=e.node.parentNode.offsetHeight}function
|
|
302
|
+
e.coverGutter&&(r+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(r+="width: "+t.display.wrapper.clientWidth+"px;"),N(t.display.measure,A("div",[e.node],null,r))}return e.height=e.node.parentNode.offsetHeight}function xr(e,t){for(var r=Ce(t);r!=e.wrapper;r=r.parentNode)if(!r||1==r.nodeType&&"true"==r.getAttribute("cm-ignore-events")||r.parentNode==e.sizer&&r!=e.mover)return!0}function kr(e){return e.lineSpace.offsetTop}function Cr(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function Sr(e){if(e.cachedPaddingH)return e.cachedPaddingH
|
|
303
303
|
var t=N(e.measure,A("pre","x")),r=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,n={left:parseInt(r.paddingLeft),right:parseInt(r.paddingRight)}
|
|
304
|
-
return isNaN(n.left)||isNaN(n.right)||(e.cachedPaddingH=n),n}function
|
|
304
|
+
return isNaN(n.left)||isNaN(n.right)||(e.cachedPaddingH=n),n}function Lr(e){return 30-e.display.nativeBarWidth}function Tr(e){return e.display.scroller.clientWidth-Lr(e)-e.display.barWidth}function Mr(e){return e.display.scroller.clientHeight-Lr(e)-e.display.barHeight}function Nr(e,t,r){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache}
|
|
305
305
|
for(var n=0;n<e.rest.length;n++)if(e.rest[n]==t)return{map:e.measure.maps[n],cache:e.measure.caches[n]}
|
|
306
|
-
for(var i=0;i<e.rest.length;i++)if(
|
|
306
|
+
for(var i=0;i<e.rest.length;i++)if(Ye(e.rest[i])>r)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Ar(e,t,r,n){return Dr(e,Wr(e,t),r,n)}function Or(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[cn(e,t)]
|
|
307
307
|
var r=e.display.externalMeasured
|
|
308
|
-
return r&&t>=r.lineN&&t<r.lineN+r.size?r:void 0}function
|
|
309
|
-
n&&!n.text?n=null:n&&n.changes&&(
|
|
308
|
+
return r&&t>=r.lineN&&t<r.lineN+r.size?r:void 0}function Wr(e,t){var r=Ye(t),n=Or(e,r)
|
|
309
|
+
n&&!n.text?n=null:n&&n.changes&&(ur(e,n,r,on(e)),e.curOp.forceUpdate=!0),n||(n=function(e,t){var r=Ye(t=Ft(t)),n=e.display.externalMeasured=new nr(e.doc,t,r)
|
|
310
310
|
n.lineN=r
|
|
311
|
-
var i=n.built=
|
|
311
|
+
var i=n.built=Zt(e,n)
|
|
312
312
|
return n.text=i.pre,N(e.display.lineMeasure,i.pre),n}(e,t))
|
|
313
|
-
var i=
|
|
314
|
-
return{line:t,view:n,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function
|
|
313
|
+
var i=Nr(n,t,r)
|
|
314
|
+
return{line:t,view:n,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function Dr(e,t,r,n,i){t.before&&(r=-1)
|
|
315
315
|
var o,s=r+(n||"")
|
|
316
|
-
return t.cache.hasOwnProperty(s)?o=t.cache[s]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(function(e,t,r){var n=e.options.lineWrapping,i=n&&
|
|
316
|
+
return t.cache.hasOwnProperty(s)?o=t.cache[s]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(function(e,t,r){var n=e.options.lineWrapping,i=n&&Tr(e)
|
|
317
317
|
if(!t.measure.heights||n&&t.measure.width!=i){var o=t.measure.heights=[]
|
|
318
318
|
if(n){t.measure.width=i
|
|
319
319
|
for(var a=t.text.firstChild.getClientRects(),l=0;l<a.length-1;l++){var s=a[l],u=a[l+1]
|
|
320
|
-
Math.abs(s.bottom-u.bottom)>2&&o.push((s.bottom+u.top)/2-r.top)}}o.push(r.bottom-r.top)}}(e,t.view,t.rect),t.hasHeights=!0),o=function(e,t,r,n){var i,o=
|
|
321
|
-
if(3==s.nodeType){for(var f=0;f<4;f++){for(;u&&
|
|
322
|
-
for(;o.coverStart+c<o.coverEnd&&
|
|
323
|
-
if((i=a&&l<9&&0==u&&c==o.coverEnd-o.coverStart?s.parentNode.getBoundingClientRect():
|
|
324
|
-
c=u,u-=1,d="right"}a&&l<11&&(i=function(e,t){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!function(e){if(null!=
|
|
320
|
+
Math.abs(s.bottom-u.bottom)>2&&o.push((s.bottom+u.top)/2-r.top)}}o.push(r.bottom-r.top)}}(e,t.view,t.rect),t.hasHeights=!0),o=function(e,t,r,n){var i,o=Hr(t.map,r,n),s=o.node,u=o.start,c=o.end,d=o.collapse
|
|
321
|
+
if(3==s.nodeType){for(var f=0;f<4;f++){for(;u&&ne(t.line.text.charAt(o.coverStart+u));)--u
|
|
322
|
+
for(;o.coverStart+c<o.coverEnd&&ne(t.line.text.charAt(o.coverStart+c));)++c
|
|
323
|
+
if((i=a&&l<9&&0==u&&c==o.coverEnd-o.coverStart?s.parentNode.getBoundingClientRect():Ir(L(s,u,c).getClientRects(),n)).left||i.right||0==u)break
|
|
324
|
+
c=u,u-=1,d="right"}a&&l<11&&(i=function(e,t){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!function(e){if(null!=Pe)return Pe
|
|
325
325
|
var t=N(e,A("span","x")),r=t.getBoundingClientRect(),n=L(t,0,1).getBoundingClientRect()
|
|
326
|
-
return
|
|
326
|
+
return Pe=Math.abs(r.left-n.left)>1}(e))return t
|
|
327
327
|
var r=screen.logicalXDPI/screen.deviceXDPI,n=screen.logicalYDPI/screen.deviceYDPI
|
|
328
328
|
return{left:t.left*r,right:t.right*r,top:t.top*n,bottom:t.bottom*n}}(e.display.measure,i))}else{var h
|
|
329
329
|
u>0&&(d=n="right"),i=e.options.lineWrapping&&(h=s.getClientRects()).length>1?h["right"==n?h.length-1:0]:s.getBoundingClientRect()}if(a&&l<9&&!u&&(!i||!i.left&&!i.right)){var p=s.parentNode.getClientRects()[0]
|
|
330
|
-
i=p?{left:p.left,right:p.left+
|
|
331
|
-
return i.left||i.right||(k.bogus=!0),e.options.singleCursorHeightPerLine||(k.rtop=g,k.rbottom=m),k}(e,t,r,n),o.bogus||(t.cache[s]=o)),{left:o.left,right:o.right,top:i?o.rtop:o.top,bottom:i?o.rbottom:o.bottom}}var Pr
|
|
332
|
-
function
|
|
330
|
+
i=p?{left:p.left,right:p.left+nn(e.display),top:p.top,bottom:p.bottom}:Pr}for(var g=i.top-t.rect.top,m=i.bottom-t.rect.top,v=(g+m)/2,y=t.view.measure.heights,b=0;b<y.length-1&&!(v<y[b]);b++);var w=b?y[b-1]:0,x=y[b],k={left:("right"==d?i.right:i.left)-t.rect.left,right:("left"==d?i.left:i.right)-t.rect.left,top:w,bottom:x}
|
|
331
|
+
return i.left||i.right||(k.bogus=!0),e.options.singleCursorHeightPerLine||(k.rtop=g,k.rbottom=m),k}(e,t,r,n),o.bogus||(t.cache[s]=o)),{left:o.left,right:o.right,top:i?o.rtop:o.top,bottom:i?o.rbottom:o.bottom}}var zr,Pr={left:0,right:0,top:0,bottom:0}
|
|
332
|
+
function Hr(e,t,r){for(var n,i,o,a,l,s,u=0;u<e.length;u+=3)if(l=e[u],s=e[u+1],t<l?(i=0,o=1,a="left"):t<s?o=1+(i=t-l):(u==e.length-3||t==s&&e[u+3]>t)&&(i=(o=s-l)-1,t>=s&&(a="right")),null!=i){if(n=e[u+2],l==s&&r==(n.insertLeft?"left":"right")&&(a=r),"left"==r&&0==i)for(;u&&e[u-2]==e[u-3]&&e[u-1].insertLeft;)n=e[2+(u-=3)],a="left"
|
|
333
333
|
if("right"==r&&i==s-l)for(;u<e.length-3&&e[u+3]==e[u+4]&&!e[u+5].insertLeft;)n=e[(u+=3)+2],a="right"
|
|
334
|
-
break}return{node:n,start:i,end:o,collapse:a,coverStart:l,coverEnd:s}}function
|
|
335
|
-
if("left"==t)for(var n=0;n<e.length&&(r=e[n]).left==r.right;n++);else for(var i=e.length-1;i>=0&&(r=e[i]).left==r.right;i--);return r}function
|
|
336
|
-
for(var t=0;t<e.display.view.length;t++)
|
|
337
|
-
if(e.widgets)for(var r=0;r<e.widgets.length;++r)e.widgets[r].above&&(t+=
|
|
338
|
-
return t}function
|
|
334
|
+
break}return{node:n,start:i,end:o,collapse:a,coverStart:l,coverEnd:s}}function Ir(e,t){var r=Pr
|
|
335
|
+
if("left"==t)for(var n=0;n<e.length&&(r=e[n]).left==r.right;n++);else for(var i=e.length-1;i>=0&&(r=e[i]).left==r.right;i--);return r}function Er(e){if(e.measure&&(e.measure.cache={},e.measure.heights=null,e.rest))for(var t=0;t<e.rest.length;t++)e.measure.caches[t]={}}function Fr(e){e.display.externalMeasure=null,M(e.display.lineMeasure)
|
|
336
|
+
for(var t=0;t<e.display.view.length;t++)Er(e.display.view[t])}function Rr(e){Fr(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function Br(){return c&&m?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function jr(){return c&&m?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function Vr(e){var t=0
|
|
337
|
+
if(e.widgets)for(var r=0;r<e.widgets.length;++r)e.widgets[r].above&&(t+=wr(e.widgets[r]))
|
|
338
|
+
return t}function Kr(e,t,r,n,i){if(!i){var o=Vr(t)
|
|
339
339
|
r.top+=o,r.bottom+=o}if("line"==n)return r
|
|
340
340
|
n||(n="local")
|
|
341
|
-
var a=
|
|
342
|
-
if("local"==n?a+=
|
|
343
|
-
a+=l.top+("window"==n?0:
|
|
344
|
-
var s=l.left+("window"==n?0:
|
|
345
|
-
r.left+=s,r.right+=s}return r.top+=a,r.bottom+=a,r}function
|
|
341
|
+
var a=Kt(t)
|
|
342
|
+
if("local"==n?a+=kr(e.display):a-=e.display.viewOffset,"page"==n||"window"==n){var l=e.display.lineSpace.getBoundingClientRect()
|
|
343
|
+
a+=l.top+("window"==n?0:jr())
|
|
344
|
+
var s=l.left+("window"==n?0:Br())
|
|
345
|
+
r.left+=s,r.right+=s}return r.top+=a,r.bottom+=a,r}function Gr(e,t,r){if("div"==r)return t
|
|
346
346
|
var n=t.left,i=t.top
|
|
347
|
-
if("page"==r)n-=
|
|
347
|
+
if("page"==r)n-=Br(),i-=jr()
|
|
348
348
|
else if("local"==r||!r){var o=e.display.sizer.getBoundingClientRect()
|
|
349
349
|
n+=o.left,i+=o.top}var a=e.display.lineSpace.getBoundingClientRect()
|
|
350
|
-
return{left:n-a.left,top:i-a.top}}function
|
|
351
|
-
return a?l.left=l.right:l.right=l.left,
|
|
352
|
-
var l=
|
|
350
|
+
return{left:n-a.left,top:i-a.top}}function Ur(e,t,r,n,i){return n||(n=qe(e.doc,t.line)),Kr(e,n,Ar(e,n,t.ch,i),r)}function qr(e,t,r,n,i,o){function a(t,a){var l=Dr(e,i,t,a?"right":"left",o)
|
|
351
|
+
return a?l.left=l.right:l.right=l.left,Kr(e,n,l,r)}n=n||qe(e.doc,t.line),i||(i=Wr(e,n))
|
|
352
|
+
var l=ue(n,e.doc.direction),s=t.ch,u=t.sticky
|
|
353
353
|
if(s>=n.text.length?(s=n.text.length,u="before"):s<=0&&(s=0,u="after"),!l)return a("before"==u?s-1:s,"before"==u)
|
|
354
|
-
function c(e,t,r){return a(r?e-1:e,1==l[t].level!=r)}var d=
|
|
355
|
-
return null!=f&&(h.other=c(s,f,"before"!=u)),h}function
|
|
356
|
-
t=
|
|
357
|
-
var n=
|
|
358
|
-
return{left:r,right:r,top:i,bottom:i+n.height}}function
|
|
359
|
-
return o.xRel=i,n&&(o.outside=!0),o}function
|
|
360
|
-
if((r+=e.display.viewOffset)<0)return
|
|
361
|
-
var i=
|
|
362
|
-
if(i>o)return
|
|
354
|
+
function c(e,t,r){return a(r?e-1:e,1==l[t].level!=r)}var d=le(l,s,u),f=ae,h=c(s,d,"before"==u)
|
|
355
|
+
return null!=f&&(h.other=c(s,f,"before"!=u)),h}function _r(e,t){var r=0
|
|
356
|
+
t=lt(e.doc,t),e.options.lineWrapping||(r=nn(e.display)*t.ch)
|
|
357
|
+
var n=qe(e.doc,t.line),i=Kt(n)+kr(e.display)
|
|
358
|
+
return{left:r,right:r,top:i,bottom:i+n.height}}function $r(e,t,r,n,i){var o=et(e,t,r)
|
|
359
|
+
return o.xRel=i,n&&(o.outside=!0),o}function Xr(e,t,r){var n=e.doc
|
|
360
|
+
if((r+=e.display.viewOffset)<0)return $r(n.first,0,null,!0,-1)
|
|
361
|
+
var i=Ze(n,r),o=n.first+n.size-1
|
|
362
|
+
if(i>o)return $r(n.first+n.size-1,qe(n,o).text.length,null,!0,1)
|
|
363
363
|
t<0&&(t=0)
|
|
364
|
-
for(var a=
|
|
364
|
+
for(var a=qe(n,i);;){var l=Jr(e,a,i,t,r),s=It(a,l.ch+(l.xRel>0?1:0))
|
|
365
365
|
if(!s)return l
|
|
366
366
|
var u=s.find(1)
|
|
367
367
|
if(u.line==i)return u
|
|
368
|
-
a=
|
|
369
|
-
var i=t.text.length,o=
|
|
370
|
-
return{begin:o,end:i=
|
|
371
|
-
var o=
|
|
372
|
-
if(c){var d=(e.options.lineWrapping?
|
|
373
|
-
l=(u=1!=d.level)?d.from:d.to-1,s=u?d.to:d.from-1}var f,h,p=null,g=null,m=
|
|
374
|
-
return r.top+=a,r.bottom+=a,!!
|
|
368
|
+
a=qe(n,i=u.line)}}function Yr(e,t,r,n){n-=Vr(t)
|
|
369
|
+
var i=t.text.length,o=oe((function(t){return Dr(e,r,t-1).bottom<=n}),i,0)
|
|
370
|
+
return{begin:o,end:i=oe((function(t){return Dr(e,r,t).top>n}),o,i)}}function Zr(e,t,r,n){return r||(r=Wr(e,t)),Yr(e,t,r,Kr(e,t,Dr(e,r,n),"line").top)}function Qr(e,t,r,n){return!(e.bottom<=r)&&(e.top>r||(n?e.left:e.right)>t)}function Jr(e,t,r,n,i){i-=Kt(t)
|
|
371
|
+
var o=Wr(e,t),a=Vr(t),l=0,s=t.text.length,u=!0,c=ue(t,e.doc.direction)
|
|
372
|
+
if(c){var d=(e.options.lineWrapping?tn:en)(e,t,r,o,c,n,i)
|
|
373
|
+
l=(u=1!=d.level)?d.from:d.to-1,s=u?d.to:d.from-1}var f,h,p=null,g=null,m=oe((function(t){var r=Dr(e,o,t)
|
|
374
|
+
return r.top+=a,r.bottom+=a,!!Qr(r,n,i,!1)&&(r.top<=i&&r.left<=n&&(p=t,g=r),!0)}),l,s),v=!1
|
|
375
375
|
if(g){var y=n-g.left<g.right-n,b=y==u
|
|
376
|
-
m=p+(b?0:1),h=b?"after":"before",f=y?g.left:g.right}else{u||m!=s&&m!=l||m++,h=0==m?"after":m==t.text.length?"before":
|
|
377
|
-
var w=
|
|
378
|
-
f=w.left,v=i<w.top||i>=w.bottom}return
|
|
379
|
-
return
|
|
380
|
-
if(l>0){var u=1!=s.level,c=
|
|
381
|
-
|
|
376
|
+
m=p+(b?0:1),h=b?"after":"before",f=y?g.left:g.right}else{u||m!=s&&m!=l||m++,h=0==m?"after":m==t.text.length?"before":Dr(e,o,m-(u?1:0)).bottom+a<=i==u?"after":"before"
|
|
377
|
+
var w=qr(e,et(r,m,h),"line",t,o)
|
|
378
|
+
f=w.left,v=i<w.top||i>=w.bottom}return $r(r,m=ie(t.text,m,1),h,v,n-f)}function en(e,t,r,n,i,o,a){var l=oe((function(l){var s=i[l],u=1!=s.level
|
|
379
|
+
return Qr(qr(e,et(r,u?s.to:s.from,u?"before":"after"),"line",t,n),o,a,!0)}),0,i.length-1),s=i[l]
|
|
380
|
+
if(l>0){var u=1!=s.level,c=qr(e,et(r,u?s.from:s.to,u?"after":"before"),"line",t,n)
|
|
381
|
+
Qr(c,o,a,!0)&&c.top>a&&(s=i[l-1])}return s}function tn(e,t,r,n,i,o,a){var l=Yr(e,t,n,a),s=l.begin,u=l.end;/\s/.test(t.text.charAt(u-1))&&u--
|
|
382
382
|
for(var c=null,d=null,f=0;f<i.length;f++){var h=i[f]
|
|
383
|
-
if(!(h.from>=u||h.to<=s)){var p=
|
|
384
|
-
if(null==
|
|
385
|
-
for(var t=0;t<49;++t)
|
|
386
|
-
|
|
387
|
-
var r=
|
|
388
|
-
return r>3&&(e.cachedTextHeight=r),M(e.measure),r||1}function
|
|
383
|
+
if(!(h.from>=u||h.to<=s)){var p=Dr(e,n,1!=h.level?Math.min(u,h.to)-1:Math.max(s,h.from)).right,g=p<o?o-p+1e9:p-o;(!c||d>g)&&(c=h,d=g)}}return c||(c=i[i.length-1]),c.from<s&&(c={from:s,to:c.to,level:c.level}),c.to>u&&(c={from:c.from,to:u,level:c.level}),c}function rn(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight
|
|
384
|
+
if(null==zr){zr=A("pre")
|
|
385
|
+
for(var t=0;t<49;++t)zr.appendChild(document.createTextNode("x")),zr.appendChild(A("br"))
|
|
386
|
+
zr.appendChild(document.createTextNode("x"))}N(e.measure,zr)
|
|
387
|
+
var r=zr.offsetHeight/50
|
|
388
|
+
return r>3&&(e.cachedTextHeight=r),M(e.measure),r||1}function nn(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth
|
|
389
389
|
var t=A("span","xxxxxxxxxx"),r=A("pre",[t])
|
|
390
390
|
N(e.measure,r)
|
|
391
391
|
var n=t.getBoundingClientRect(),i=(n.right-n.left)/10
|
|
392
|
-
return i>2&&(e.cachedCharWidth=i),i||10}function
|
|
393
|
-
r[l]=o.offsetLeft+o.clientLeft+i,n[l]=o.clientWidth}return{fixedPos:
|
|
394
|
-
return function(i){if(
|
|
392
|
+
return i>2&&(e.cachedCharWidth=i),i||10}function on(e){for(var t=e.display,r={},n={},i=t.gutters.clientLeft,o=t.gutters.firstChild,a=0;o;o=o.nextSibling,++a){var l=e.display.gutterSpecs[a].className
|
|
393
|
+
r[l]=o.offsetLeft+o.clientLeft+i,n[l]=o.clientWidth}return{fixedPos:an(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:r,gutterWidth:n,wrapperWidth:t.wrapper.clientWidth}}function an(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function ln(e){var t=rn(e.display),r=e.options.lineWrapping,n=r&&Math.max(5,e.display.scroller.clientWidth/nn(e.display)-3)
|
|
394
|
+
return function(i){if(jt(e.doc,i))return 0
|
|
395
395
|
var o=0
|
|
396
396
|
if(i.widgets)for(var a=0;a<i.widgets.length;a++)i.widgets[a].height&&(o+=i.widgets[a].height)
|
|
397
|
-
return r?o+(Math.ceil(i.text.length/n)||1)*t:o+t}}function
|
|
397
|
+
return r?o+(Math.ceil(i.text.length/n)||1)*t:o+t}}function sn(e){var t=e.doc,r=ln(e)
|
|
398
398
|
t.iter((function(e){var t=r(e)
|
|
399
|
-
t!=e.height&&
|
|
400
|
-
if(!r&&"true"==
|
|
399
|
+
t!=e.height&&Xe(e,t)}))}function un(e,t,r,n){var i=e.display
|
|
400
|
+
if(!r&&"true"==Ce(t).getAttribute("cm-not-content"))return null
|
|
401
401
|
var o,a,l=i.lineSpace.getBoundingClientRect()
|
|
402
|
-
try{o=t.clientX-l.left,a=t.clientY-l.top}catch(t){return null}var s,u=
|
|
403
|
-
if(n&&1==u.xRel&&(s=
|
|
404
|
-
u=
|
|
402
|
+
try{o=t.clientX-l.left,a=t.clientY-l.top}catch(t){return null}var s,u=Xr(e,o,a)
|
|
403
|
+
if(n&&1==u.xRel&&(s=qe(e.doc,u.line).text).length==u.ch){var c=F(s,s.length,e.options.tabSize)-s.length
|
|
404
|
+
u=et(u.line,Math.max(0,Math.round((o-Sr(e.display).left)/nn(e.display))-c))}return u}function cn(e,t){if(t>=e.display.viewTo)return null
|
|
405
405
|
if((t-=e.display.viewFrom)<0)return null
|
|
406
|
-
for(var r=e.display.view,n=0;n<r.length;n++)if((t-=r[n].size)<0)return n}function
|
|
406
|
+
for(var r=e.display.view,n=0;n<r.length;n++)if((t-=r[n].size)<0)return n}function dn(e,t,r,n){null==t&&(t=e.doc.first),null==r&&(r=e.doc.first+e.doc.size),n||(n=0)
|
|
407
407
|
var i=e.display
|
|
408
|
-
if(n&&r<i.viewTo&&(null==i.updateLineNumbers||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)
|
|
409
|
-
else if(r<=i.viewFrom)
|
|
410
|
-
else if(t<=i.viewFrom&&r>=i.viewTo)
|
|
411
|
-
else if(t<=i.viewFrom){var o=
|
|
412
|
-
o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=n):
|
|
413
|
-
a?(i.view=i.view.slice(0,a.index),i.viewTo=a.lineN):
|
|
414
|
-
l&&s?(i.view=i.view.slice(0,l.index).concat(
|
|
415
|
-
u&&(r<u.lineN?u.lineN+=n:t<u.lineN+u.size&&(i.externalMeasured=null))}function
|
|
408
|
+
if(n&&r<i.viewTo&&(null==i.updateLineNumbers||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)kt&&Rt(e.doc,t)<i.viewTo&&hn(e)
|
|
409
|
+
else if(r<=i.viewFrom)kt&&Bt(e.doc,r+n)>i.viewFrom?hn(e):(i.viewFrom+=n,i.viewTo+=n)
|
|
410
|
+
else if(t<=i.viewFrom&&r>=i.viewTo)hn(e)
|
|
411
|
+
else if(t<=i.viewFrom){var o=pn(e,r,r+n,1)
|
|
412
|
+
o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=n):hn(e)}else if(r>=i.viewTo){var a=pn(e,t,t,-1)
|
|
413
|
+
a?(i.view=i.view.slice(0,a.index),i.viewTo=a.lineN):hn(e)}else{var l=pn(e,t,t,-1),s=pn(e,r,r+n,1)
|
|
414
|
+
l&&s?(i.view=i.view.slice(0,l.index).concat(ir(e,l.lineN,s.lineN)).concat(i.view.slice(s.index)),i.viewTo+=n):hn(e)}var u=i.externalMeasured
|
|
415
|
+
u&&(r<u.lineN?u.lineN+=n:t<u.lineN+u.size&&(i.externalMeasured=null))}function fn(e,t,r){e.curOp.viewChanged=!0
|
|
416
416
|
var n=e.display,i=e.display.externalMeasured
|
|
417
|
-
if(i&&t>=i.lineN&&t<i.lineN+i.size&&(n.externalMeasured=null),!(t<n.viewFrom||t>=n.viewTo)){var o=n.view[
|
|
418
|
-
if(null!=o.node){var a=o.changes||(o.changes=[]);-1==B(a,r)&&a.push(r)}}}function
|
|
419
|
-
if(!
|
|
417
|
+
if(i&&t>=i.lineN&&t<i.lineN+i.size&&(n.externalMeasured=null),!(t<n.viewFrom||t>=n.viewTo)){var o=n.view[cn(e,t)]
|
|
418
|
+
if(null!=o.node){var a=o.changes||(o.changes=[]);-1==B(a,r)&&a.push(r)}}}function hn(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function pn(e,t,r,n){var i,o=cn(e,t),a=e.display.view
|
|
419
|
+
if(!kt||r==e.doc.first+e.doc.size)return{index:o,lineN:r}
|
|
420
420
|
for(var l=e.display.viewFrom,s=0;s<o;s++)l+=a[s].size
|
|
421
421
|
if(l!=t){if(n>0){if(o==a.length-1)return null
|
|
422
422
|
i=l+a[o].size-t,o++}else i=l-t
|
|
423
|
-
t+=i,r+=i}for(;
|
|
424
|
-
r+=n*a[o-(n<0?1:0)].size,o+=n}return{index:o,lineN:r}}function
|
|
425
|
-
i.hidden||i.node&&!i.changes||++r}return r}function
|
|
423
|
+
t+=i,r+=i}for(;Rt(e.doc,r)!=r;){if(o==(n<0?0:a.length-1))return null
|
|
424
|
+
r+=n*a[o-(n<0?1:0)].size,o+=n}return{index:o,lineN:r}}function gn(e){for(var t=e.display.view,r=0,n=0;n<t.length;n++){var i=t[n]
|
|
425
|
+
i.hidden||i.node&&!i.changes||++r}return r}function mn(e){e.display.input.showSelection(e.display.input.prepareSelection())}function vn(e,t){void 0===t&&(t=!0)
|
|
426
426
|
for(var r=e.doc,n={},i=n.cursors=document.createDocumentFragment(),o=n.selection=document.createDocumentFragment(),a=0;a<r.sel.ranges.length;a++)if(t||a!=r.sel.primIndex){var l=r.sel.ranges[a]
|
|
427
|
-
if(!(l.from().line>=e.display.viewTo||l.to().line<e.display.viewFrom)){var s=l.empty();(s||e.options.showCursorWhenSelecting)&&
|
|
427
|
+
if(!(l.from().line>=e.display.viewTo||l.to().line<e.display.viewFrom)){var s=l.empty();(s||e.options.showCursorWhenSelecting)&&yn(e,l.head,i),s||wn(e,l,o)}}return n}function yn(e,t,r){var n=qr(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=r.appendChild(A("div"," ","CodeMirror-cursor"))
|
|
428
428
|
if(i.style.left=n.left+"px",i.style.top=n.top+"px",i.style.height=Math.max(0,n.bottom-n.top)*e.options.cursorHeight+"px",n.other){var o=r.appendChild(A("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"))
|
|
429
|
-
o.style.display="",o.style.left=n.other.left+"px",o.style.top=n.other.top+"px",o.style.height=.85*(n.other.bottom-n.other.top)+"px"}}function
|
|
430
|
-
function c(e,t,r,n){t<0&&(t=0),t=Math.round(t),n=Math.round(n),o.appendChild(A("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px;\n top: "+t+"px; width: "+(null==r?s-e:r)+"px;\n height: "+(n-t)+"px"))}function d(t,r,n){var o,a,d=
|
|
431
|
-
function h(r,n){return
|
|
432
|
-
return h("after"==n?i.begin:i.end-(/\s/.test(d.text.charAt(i.end-1))?2:1),o)[o]}var g=
|
|
429
|
+
o.style.display="",o.style.left=n.other.left+"px",o.style.top=n.other.top+"px",o.style.height=.85*(n.other.bottom-n.other.top)+"px"}}function bn(e,t){return e.top-t.top||e.left-t.left}function wn(e,t,r){var n=e.display,i=e.doc,o=document.createDocumentFragment(),a=Sr(e.display),l=a.left,s=Math.max(n.sizerWidth,Tr(e)-n.sizer.offsetLeft)-a.right,u="ltr"==i.direction
|
|
430
|
+
function c(e,t,r,n){t<0&&(t=0),t=Math.round(t),n=Math.round(n),o.appendChild(A("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px;\n top: "+t+"px; width: "+(null==r?s-e:r)+"px;\n height: "+(n-t)+"px"))}function d(t,r,n){var o,a,d=qe(i,t),f=d.text.length
|
|
431
|
+
function h(r,n){return Ur(e,et(t,r),"div",d,n)}function p(t,r,n){var i=Zr(e,d,null,t),o="ltr"==r==("after"==n)?"left":"right"
|
|
432
|
+
return h("after"==n?i.begin:i.end-(/\s/.test(d.text.charAt(i.end-1))?2:1),o)[o]}var g=ue(d,i.direction)
|
|
433
433
|
return function(e,t,r,n){if(!e)return n(t,r,"ltr",0)
|
|
434
434
|
for(var i=!1,o=0;o<e.length;++o){var a=e[o];(a.from<r&&a.to>t||t==r&&a.to==t)&&(n(Math.max(a.from,t),Math.min(a.to,r),1==a.level?"rtl":"ltr",o),i=!0)}i||n(t,r,"ltr")}(g,r||0,null==n?f:n,(function(e,t,i,d){var m="ltr"==i,v=h(e,m?"left":"right"),y=h(t-1,m?"right":"left"),b=null==r&&0==e,w=null==n&&t==f,x=0==d,k=!g||d==g.length-1
|
|
435
435
|
if(y.top-v.top<=3){var C=(u?w:b)&&k,S=(u?b:w)&&x?l:(m?v:y).left,L=C?s:(m?y:v).right
|
|
436
436
|
c(S,v.top,L-S,v.bottom)}else{var T,M,N,A
|
|
437
|
-
m?(T=u&&b&&x?l:v.left,M=u?s:p(e,i,"before"),N=u?l:p(t,i,"after"),A=u&&w&&k?s:y.right):(T=u?p(e,i,"before"):l,M=!u&&b&&x?s:v.right,N=!u&&w&&k?l:y.left,A=u?p(t,i,"after"):s),c(T,v.top,M-T,v.bottom),v.bottom<y.top&&c(l,v.bottom,null,y.top),c(N,y.top,A-N,y.bottom)}(!o||
|
|
437
|
+
m?(T=u&&b&&x?l:v.left,M=u?s:p(e,i,"before"),N=u?l:p(t,i,"after"),A=u&&w&&k?s:y.right):(T=u?p(e,i,"before"):l,M=!u&&b&&x?s:v.right,N=!u&&w&&k?l:y.left,A=u?p(t,i,"after"):s),c(T,v.top,M-T,v.bottom),v.bottom<y.top&&c(l,v.bottom,null,y.top),c(N,y.top,A-N,y.bottom)}(!o||bn(v,o)<0)&&(o=v),bn(y,o)<0&&(o=y),(!a||bn(v,a)<0)&&(a=v),bn(y,a)<0&&(a=y)})),{start:o,end:a}}var f=t.from(),h=t.to()
|
|
438
438
|
if(f.line==h.line)d(f.line,f.ch,h.ch)
|
|
439
|
-
else{var p=
|
|
440
|
-
m&&(v.top<y.top-2?(c(v.right,v.top,null,v.bottom),c(l,y.top,y.left,y.bottom)):c(v.right,v.top,y.left-v.right,v.bottom)),v.bottom<y.top&&c(l,v.bottom,null,y.top)}r.appendChild(o)}function
|
|
439
|
+
else{var p=qe(i,f.line),g=qe(i,h.line),m=Ft(p)==Ft(g),v=d(f.line,f.ch,m?p.text.length+1:null).end,y=d(h.line,m?0:null,h.ch).start
|
|
440
|
+
m&&(v.top<y.top-2?(c(v.right,v.top,null,v.bottom),c(l,y.top,y.left,y.bottom)):c(v.right,v.top,y.left-v.right,v.bottom)),v.bottom<y.top&&c(l,v.bottom,null,y.top)}r.appendChild(o)}function xn(e){if(e.state.focused){var t=e.display
|
|
441
441
|
clearInterval(t.blinker)
|
|
442
442
|
var r=!0
|
|
443
|
-
t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval((function(){return t.cursorDiv.style.visibility=(r=!r)?"":"hidden"}),e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function
|
|
443
|
+
t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval((function(){return t.cursorDiv.style.visibility=(r=!r)?"":"hidden"}),e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function kn(e){e.state.focused||(e.display.input.focus(),Sn(e))}function Cn(e){e.state.delayingBlurEvent=!0,setTimeout((function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Ln(e))}),100)}function Sn(e,t){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(pe(e,"focus",e,t),e.state.focused=!0,z(e.display.wrapper,"CodeMirror-focused"),e.curOp||e.display.selForContextMenu==e.doc.sel||(e.display.input.reset(),s&&setTimeout((function(){return e.display.input.reset(!0)}),20)),e.display.input.receivedFocus()),xn(e))}function Ln(e,t){e.state.delayingBlurEvent||(e.state.focused&&(pe(e,"blur",e,t),e.state.focused=!1,T(e.display.wrapper,"CodeMirror-focused")),clearInterval(e.display.blinker),setTimeout((function(){e.state.focused||(e.display.shift=!1)}),150))}function Tn(e){for(var t=e.display,r=t.lineDiv.offsetTop,n=0;n<t.view.length;n++){var i=t.view[n],o=e.options.lineWrapping,s=void 0,u=0
|
|
444
444
|
if(!i.hidden){if(a&&l<8){var c=i.node.offsetTop+i.node.offsetHeight
|
|
445
445
|
s=c-r,r=c}else{var d=i.node.getBoundingClientRect()
|
|
446
446
|
s=d.bottom-d.top,!o&&i.text.firstChild&&(u=i.text.firstChild.getBoundingClientRect().right-d.left-1)}var f=i.line.height-s
|
|
447
|
-
if((f>.005||f<-.005)&&(
|
|
448
|
-
if(u>e.display.sizerWidth){var p=Math.ceil(u/
|
|
449
|
-
p>e.display.maxLineLength&&(e.display.maxLineLength=p,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}}function
|
|
450
|
-
n&&(r.height=n.offsetHeight)}}function
|
|
451
|
-
n=Math.floor(n-
|
|
452
|
-
var i=r&&null!=r.bottom?r.bottom:n+e.wrapper.clientHeight,o=
|
|
447
|
+
if((f>.005||f<-.005)&&(Xe(i.line,s),Mn(i.line),i.rest))for(var h=0;h<i.rest.length;h++)Mn(i.rest[h])
|
|
448
|
+
if(u>e.display.sizerWidth){var p=Math.ceil(u/nn(e.display))
|
|
449
|
+
p>e.display.maxLineLength&&(e.display.maxLineLength=p,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}}function Mn(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var r=e.widgets[t],n=r.node.parentNode
|
|
450
|
+
n&&(r.height=n.offsetHeight)}}function Nn(e,t,r){var n=r&&null!=r.top?Math.max(0,r.top):e.scroller.scrollTop
|
|
451
|
+
n=Math.floor(n-kr(e))
|
|
452
|
+
var i=r&&null!=r.bottom?r.bottom:n+e.wrapper.clientHeight,o=Ze(t,n),a=Ze(t,i)
|
|
453
453
|
if(r&&r.ensure){var l=r.ensure.from.line,s=r.ensure.to.line
|
|
454
|
-
l<o?(o=l,a=
|
|
454
|
+
l<o?(o=l,a=Ze(t,Kt(qe(t,l))+e.wrapper.clientHeight)):Math.min(s,t.lastLine())>=a&&(o=Ze(t,Kt(qe(t,s))-e.wrapper.clientHeight),a=s)}return{from:o,to:Math.max(a,o+1)}}function An(e,t){var r=e.display,n=rn(e.display)
|
|
455
455
|
t.top<0&&(t.top=0)
|
|
456
|
-
var i=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:r.scroller.scrollTop,o=
|
|
456
|
+
var i=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:r.scroller.scrollTop,o=Mr(e),a={}
|
|
457
457
|
t.bottom-t.top>o&&(t.bottom=t.top+o)
|
|
458
|
-
var l=e.doc.height+
|
|
458
|
+
var l=e.doc.height+Cr(r),s=t.top<n,u=t.bottom>l-n
|
|
459
459
|
if(t.top<i)a.scrollTop=s?0:t.top
|
|
460
460
|
else if(t.bottom>i+o){var c=Math.min(t.top,(u?l:t.bottom)-o)
|
|
461
|
-
c!=i&&(a.scrollTop=c)}var d=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:r.scroller.scrollLeft,f=
|
|
462
|
-
return h&&(t.right=t.left+f),t.left<10?a.scrollLeft=0:t.left<d?a.scrollLeft=Math.max(0,t.left-(h?0:10)):t.right>f+d-3&&(a.scrollLeft=t.right+(h?0:10)-f),a}function
|
|
461
|
+
c!=i&&(a.scrollTop=c)}var d=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:r.scroller.scrollLeft,f=Tr(e)-(e.options.fixedGutter?r.gutters.offsetWidth:0),h=t.right-t.left>f
|
|
462
|
+
return h&&(t.right=t.left+f),t.left<10?a.scrollLeft=0:t.left<d?a.scrollLeft=Math.max(0,t.left-(h?0:10)):t.right>f+d-3&&(a.scrollLeft=t.right+(h?0:10)-f),a}function On(e,t){null!=t&&(zn(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+t)}function Wn(e){zn(e)
|
|
463
463
|
var t=e.getCursor()
|
|
464
|
-
e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function
|
|
465
|
-
t&&(e.curOp.scrollToPos=null,
|
|
466
|
-
|
|
467
|
-
return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?r:0,docHeight:n,scrollHeight:n+
|
|
464
|
+
e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Dn(e,t,r){null==t&&null==r||zn(e),null!=t&&(e.curOp.scrollLeft=t),null!=r&&(e.curOp.scrollTop=r)}function zn(e){var t=e.curOp.scrollToPos
|
|
465
|
+
t&&(e.curOp.scrollToPos=null,Pn(e,_r(e,t.from),_r(e,t.to),t.margin))}function Pn(e,t,r,n){var i=An(e,{left:Math.min(t.left,r.left),top:Math.min(t.top,r.top)-n,right:Math.max(t.right,r.right),bottom:Math.max(t.bottom,r.bottom)+n})
|
|
466
|
+
Dn(e,i.scrollLeft,i.scrollTop)}function Hn(e,t){Math.abs(e.doc.scrollTop-t)<2||(r||si(e,{top:t}),In(e,t,!0),r&&si(e),ni(e,100))}function In(e,t,r){t=Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t),(e.display.scroller.scrollTop!=t||r)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function En(e,t,r,n){t=Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth),(r?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!n||(e.doc.scrollLeft=t,di(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function Fn(e){var t=e.display,r=t.gutters.offsetWidth,n=Math.round(e.doc.height+Cr(e.display))
|
|
467
|
+
return{clientHeight:t.scroller.clientHeight,viewHeight:t.wrapper.clientHeight,scrollWidth:t.scroller.scrollWidth,clientWidth:t.scroller.clientWidth,viewWidth:t.wrapper.clientWidth,barLeft:e.options.fixedGutter?r:0,docHeight:n,scrollHeight:n+Lr(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:r}}var Rn=function(e,t,r){this.cm=r
|
|
468
468
|
var n=this.vert=A("div",[A("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=A("div",[A("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar")
|
|
469
|
-
n.tabIndex=i.tabIndex=-1,e(n),e(i),
|
|
470
|
-
|
|
469
|
+
n.tabIndex=i.tabIndex=-1,e(n),e(i),de(n,"scroll",(function(){n.clientHeight&&t(n.scrollTop,"vertical")})),de(i,"scroll",(function(){i.clientWidth&&t(i.scrollLeft,"horizontal")})),this.checkedZeroWidth=!1,a&&l<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")}
|
|
470
|
+
Rn.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,r=e.scrollHeight>e.clientHeight+1,n=e.nativeBarWidth
|
|
471
471
|
if(r){this.vert.style.display="block",this.vert.style.bottom=t?n+"px":"0"
|
|
472
472
|
var i=e.viewHeight-(t?n:0)
|
|
473
473
|
this.vert.firstChild.style.height=Math.max(0,e.scrollHeight-e.clientHeight+i)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0"
|
|
474
474
|
if(t){this.horiz.style.display="block",this.horiz.style.right=r?n+"px":"0",this.horiz.style.left=e.barLeft+"px"
|
|
475
475
|
var o=e.viewWidth-e.barLeft-(r?n:0)
|
|
476
476
|
this.horiz.firstChild.style.width=Math.max(0,e.scrollWidth-e.clientWidth+o)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0"
|
|
477
|
-
return!this.checkedZeroWidth&&e.clientHeight>0&&(0==n&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:r?n:0,bottom:t?n:0}},
|
|
478
|
-
this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new R,this.disableVert=new R},
|
|
477
|
+
return!this.checkedZeroWidth&&e.clientHeight>0&&(0==n&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:r?n:0,bottom:t?n:0}},Rn.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Rn.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Rn.prototype.zeroWidthHack=function(){var e=y&&!h?"12px":"18px"
|
|
478
|
+
this.horiz.style.height=this.vert.style.width=e,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new R,this.disableVert=new R},Rn.prototype.enableZeroWidthBar=function(e,t,r){e.style.pointerEvents="auto",t.set(1e3,(function n(){var i=e.getBoundingClientRect();("vert"==r?document.elementFromPoint(i.right-1,(i.top+i.bottom)/2):document.elementFromPoint((i.right+i.left)/2,i.bottom-1))!=e?e.style.pointerEvents="none":t.set(1e3,n)}))},Rn.prototype.clear=function(){var e=this.horiz.parentNode
|
|
479
479
|
e.removeChild(this.horiz),e.removeChild(this.vert)}
|
|
480
|
-
var
|
|
481
|
-
function
|
|
480
|
+
var Bn=function(){}
|
|
481
|
+
function jn(e,t){t||(t=Fn(e))
|
|
482
482
|
var r=e.display.barWidth,n=e.display.barHeight
|
|
483
|
-
|
|
484
|
-
for(var i=0;i<4&&r!=e.display.barWidth||n!=e.display.barHeight;i++)r!=e.display.barWidth&&e.options.lineWrapping&&
|
|
485
|
-
r.sizer.style.paddingRight=(r.barWidth=n.right)+"px",r.sizer.style.paddingBottom=(r.barHeight=n.bottom)+"px",r.heightForcer.style.borderBottom=n.bottom+"px solid transparent",n.right&&n.bottom?(r.scrollbarFiller.style.display="block",r.scrollbarFiller.style.height=n.bottom+"px",r.scrollbarFiller.style.width=n.right+"px"):r.scrollbarFiller.style.display="",n.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(r.gutterFiller.style.display="block",r.gutterFiller.style.height=n.bottom+"px",r.gutterFiller.style.width=t.gutterWidth+"px"):r.gutterFiller.style.display=""}
|
|
486
|
-
var
|
|
487
|
-
function
|
|
488
|
-
function
|
|
489
|
-
e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++
|
|
483
|
+
Vn(e,t)
|
|
484
|
+
for(var i=0;i<4&&r!=e.display.barWidth||n!=e.display.barHeight;i++)r!=e.display.barWidth&&e.options.lineWrapping&&Tn(e),Vn(e,Fn(e)),r=e.display.barWidth,n=e.display.barHeight}function Vn(e,t){var r=e.display,n=r.scrollbars.update(t)
|
|
485
|
+
r.sizer.style.paddingRight=(r.barWidth=n.right)+"px",r.sizer.style.paddingBottom=(r.barHeight=n.bottom)+"px",r.heightForcer.style.borderBottom=n.bottom+"px solid transparent",n.right&&n.bottom?(r.scrollbarFiller.style.display="block",r.scrollbarFiller.style.height=n.bottom+"px",r.scrollbarFiller.style.width=n.right+"px"):r.scrollbarFiller.style.display="",n.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(r.gutterFiller.style.display="block",r.gutterFiller.style.height=n.bottom+"px",r.gutterFiller.style.width=t.gutterWidth+"px"):r.gutterFiller.style.display=""}Bn.prototype.update=function(){return{bottom:0,right:0}},Bn.prototype.setScrollLeft=function(){},Bn.prototype.setScrollTop=function(){},Bn.prototype.clear=function(){}
|
|
486
|
+
var Kn={native:Rn,null:Bn}
|
|
487
|
+
function Gn(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&T(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Kn[e.options.scrollbarStyle]((function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),de(t,"mousedown",(function(){e.state.focused&&setTimeout((function(){return e.display.input.focus()}),0)})),t.setAttribute("cm-not-content","true")}),(function(t,r){"horizontal"==r?En(e,t):Hn(e,t)}),e),e.display.scrollbars.addClass&&z(e.display.wrapper,e.display.scrollbars.addClass)}var Un=0
|
|
488
|
+
function qn(e){var t
|
|
489
|
+
e.curOp={cm:e,viewChanged:!1,startHeight:e.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++Un},t=e.curOp,or?or.ops.push(t):t.ownsGroup=or={ops:[t],delayedCallbacks:[]}}function _n(e){var t=e.curOp
|
|
490
490
|
t&&function(e){var t=e.ownsGroup
|
|
491
491
|
if(t)try{!function(e){var t=e.delayedCallbacks,r=0
|
|
492
492
|
do{for(;r<t.length;r++)t[r].call(null)
|
|
493
493
|
for(var n=0;n<e.ops.length;n++){var i=e.ops[n]
|
|
494
|
-
if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(r<t.length)}(t)}finally{
|
|
495
|
-
!function(e){for(var t=e.ops,r=0;r<t.length;r++)
|
|
496
|
-
for(var n=0;n<t.length;n++)
|
|
497
|
-
for(var i=0;i<t.length;i++)
|
|
498
|
-
for(var o=0;o<t.length;o++)
|
|
499
|
-
for(var a=0;a<t.length;a++)
|
|
494
|
+
if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(r<t.length)}(t)}finally{or=null,function(e){for(var t=0;t<e.ops.length;t++)e.ops[t].cm.curOp=null
|
|
495
|
+
!function(e){for(var t=e.ops,r=0;r<t.length;r++)$n(t[r])
|
|
496
|
+
for(var n=0;n<t.length;n++)Xn(t[n])
|
|
497
|
+
for(var i=0;i<t.length;i++)Yn(t[i])
|
|
498
|
+
for(var o=0;o<t.length;o++)Zn(t[o])
|
|
499
|
+
for(var a=0;a<t.length;a++)Qn(t[a])}(e)}(t)}}(t)}function $n(e){var t=e.cm,r=t.display
|
|
500
500
|
!function(e){var t=e.display
|
|
501
|
-
!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=
|
|
502
|
-
e.updatedDisplay&&
|
|
503
|
-
null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&
|
|
501
|
+
!t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=Lr(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Lr(e)+"px",t.scrollbarsClipped=!0)}(t),e.updateMaxLine&&Ut(t),e.mustUpdate=e.viewChanged||e.forceUpdate||null!=e.scrollTop||e.scrollToPos&&(e.scrollToPos.from.line<r.viewFrom||e.scrollToPos.to.line>=r.viewTo)||r.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new oi(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Xn(e){e.updatedDisplay=e.mustUpdate&&ai(e.cm,e.update)}function Yn(e){var t=e.cm,r=t.display
|
|
502
|
+
e.updatedDisplay&&Tn(t),e.barMeasure=Fn(t),r.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Ar(t,r.maxLine,r.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(r.scroller.clientWidth,r.sizer.offsetLeft+e.adjustWidthTo+Lr(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,r.sizer.offsetLeft+e.adjustWidthTo-Tr(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=r.input.prepareSelection())}function Zn(e){var t=e.cm
|
|
503
|
+
null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&En(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1)
|
|
504
504
|
var r=e.focus&&e.focus==D()
|
|
505
|
-
e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,r),(e.updatedDisplay||e.startHeight!=t.doc.height)&&
|
|
506
|
-
if(e.updatedDisplay&&
|
|
507
|
-
null==n&&(n=0),e.options.lineWrapping||t!=r||(r="before"==(t=t.ch?
|
|
508
|
-
for(var o=0;o<5;o++){var a=!1,l=
|
|
509
|
-
if(null!=u.scrollTop&&(
|
|
510
|
-
!function(e,t){if(!
|
|
511
|
-
if(t.top+n.top<0?i=!0:t.bottom+n.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i&&!p){var o=A("div","",null,"position: absolute;\n top: "+(t.top-r.viewOffset-
|
|
505
|
+
e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,r),(e.updatedDisplay||e.startHeight!=t.doc.height)&&jn(t,e.barMeasure),e.updatedDisplay&&ci(t,e.barMeasure),e.selectionChanged&&xn(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),r&&kn(e.cm)}function Qn(e){var t=e.cm,r=t.display,n=t.doc
|
|
506
|
+
if(e.updatedDisplay&&li(t,e.update),null==r.wheelStartX||null==e.scrollTop&&null==e.scrollLeft&&!e.scrollToPos||(r.wheelStartX=r.wheelStartY=null),null!=e.scrollTop&&In(t,e.scrollTop,e.forceScroll),null!=e.scrollLeft&&En(t,e.scrollLeft,!0,!0),e.scrollToPos){var i=function(e,t,r,n){var i
|
|
507
|
+
null==n&&(n=0),e.options.lineWrapping||t!=r||(r="before"==(t=t.ch?et(t.line,"before"==t.sticky?t.ch-1:t.ch,"after"):t).sticky?et(t.line,t.ch+1,"before"):t)
|
|
508
|
+
for(var o=0;o<5;o++){var a=!1,l=qr(e,t),s=r&&r!=t?qr(e,r):l,u=An(e,i={left:Math.min(l.left,s.left),top:Math.min(l.top,s.top)-n,right:Math.max(l.left,s.left),bottom:Math.max(l.bottom,s.bottom)+n}),c=e.doc.scrollTop,d=e.doc.scrollLeft
|
|
509
|
+
if(null!=u.scrollTop&&(Hn(e,u.scrollTop),Math.abs(e.doc.scrollTop-c)>1&&(a=!0)),null!=u.scrollLeft&&(En(e,u.scrollLeft),Math.abs(e.doc.scrollLeft-d)>1&&(a=!0)),!a)break}return i}(t,lt(n,e.scrollToPos.from),lt(n,e.scrollToPos.to),e.scrollToPos.margin)
|
|
510
|
+
!function(e,t){if(!ge(e,"scrollCursorIntoView")){var r=e.display,n=r.sizer.getBoundingClientRect(),i=null
|
|
511
|
+
if(t.top+n.top<0?i=!0:t.bottom+n.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i&&!p){var o=A("div","",null,"position: absolute;\n top: "+(t.top-r.viewOffset-kr(e.display))+"px;\n height: "+(t.bottom-t.top+Lr(e)+r.barHeight)+"px;\n left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;")
|
|
512
512
|
e.display.lineSpace.appendChild(o),o.scrollIntoView(i),e.display.lineSpace.removeChild(o)}}}(t,i)}var o=e.maybeHiddenMarkers,a=e.maybeUnhiddenMarkers
|
|
513
|
-
if(o)for(var l=0;l<o.length;++l)o[l].lines.length||
|
|
514
|
-
if(a)for(var s=0;s<a.length;++s)a[s].lines.length&&
|
|
515
|
-
r.wrapper.offsetHeight&&(n.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&
|
|
516
|
-
|
|
517
|
-
try{return t()}finally{
|
|
518
|
-
|
|
519
|
-
try{return t.apply(e,arguments)}finally{
|
|
520
|
-
|
|
521
|
-
try{return e.apply(this,arguments)}finally{
|
|
513
|
+
if(o)for(var l=0;l<o.length;++l)o[l].lines.length||pe(o[l],"hide")
|
|
514
|
+
if(a)for(var s=0;s<a.length;++s)a[s].lines.length&&pe(a[s],"unhide")
|
|
515
|
+
r.wrapper.offsetHeight&&(n.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&pe(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Jn(e,t){if(e.curOp)return t()
|
|
516
|
+
qn(e)
|
|
517
|
+
try{return t()}finally{_n(e)}}function ei(e,t){return function(){if(e.curOp)return t.apply(e,arguments)
|
|
518
|
+
qn(e)
|
|
519
|
+
try{return t.apply(e,arguments)}finally{_n(e)}}}function ti(e){return function(){if(this.curOp)return e.apply(this,arguments)
|
|
520
|
+
qn(this)
|
|
521
|
+
try{return e.apply(this,arguments)}finally{_n(this)}}}function ri(e){return function(){var t=this.cm
|
|
522
522
|
if(!t||t.curOp)return e.apply(this,arguments)
|
|
523
|
-
|
|
524
|
-
try{return e.apply(this,arguments)}finally{
|
|
525
|
-
if(!(t.highlightFrontier>=e.display.viewTo)){var r=+new Date+e.options.workTime,n=
|
|
526
|
-
t.iter(n.line,Math.min(t.first+t.size,e.display.viewTo+500),(function(o){if(n.line>=e.display.viewFrom){var a=o.styles,l=o.text.length>e.options.maxHighlightLength?
|
|
523
|
+
qn(t)
|
|
524
|
+
try{return e.apply(this,arguments)}finally{_n(t)}}}function ni(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,I(ii,e))}function ii(e){var t=e.doc
|
|
525
|
+
if(!(t.highlightFrontier>=e.display.viewTo)){var r=+new Date+e.options.workTime,n=ht(e,t.highlightFrontier),i=[]
|
|
526
|
+
t.iter(n.line,Math.min(t.first+t.size,e.display.viewTo+500),(function(o){if(n.line>=e.display.viewFrom){var a=o.styles,l=o.text.length>e.options.maxHighlightLength?Ve(t.mode,n.state):null,s=dt(e,o,n,!0)
|
|
527
527
|
l&&(n.state=l),o.styles=s.styles
|
|
528
528
|
var u=o.styleClasses,c=s.classes
|
|
529
529
|
c?o.styleClasses=c:u&&(o.styleClasses=null)
|
|
530
530
|
for(var d=!a||a.length!=o.styles.length||u!=c&&(!u||!c||u.bgClass!=c.bgClass||u.textClass!=c.textClass),f=0;!d&&f<a.length;++f)d=a[f]!=o.styles[f]
|
|
531
|
-
d&&i.push(n.line),o.stateAfter=n.save(),n.nextLine()}else o.text.length<=e.options.maxHighlightLength&&
|
|
532
|
-
if(+new Date>r)return
|
|
533
|
-
this.viewport=t,this.visible=
|
|
534
|
-
function
|
|
535
|
-
if(t.editorIsHidden)return
|
|
536
|
-
if(!t.force&&t.visible.from>=r.viewFrom&&t.visible.to<=r.viewTo&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo)&&r.renderedView==r.view&&0==
|
|
537
|
-
|
|
531
|
+
d&&i.push(n.line),o.stateAfter=n.save(),n.nextLine()}else o.text.length<=e.options.maxHighlightLength&&pt(e,o.text,n),o.stateAfter=n.line%5==0?n.save():null,n.nextLine()
|
|
532
|
+
if(+new Date>r)return ni(e,e.options.workDelay),!0})),t.highlightFrontier=n.line,t.modeFrontier=Math.max(t.modeFrontier,n.line),i.length&&Jn(e,(function(){for(var t=0;t<i.length;t++)fn(e,i[t],"text")}))}}var oi=function(e,t,r){var n=e.display
|
|
533
|
+
this.viewport=t,this.visible=Nn(n,e.doc,t),this.editorIsHidden=!n.wrapper.offsetWidth,this.wrapperHeight=n.wrapper.clientHeight,this.wrapperWidth=n.wrapper.clientWidth,this.oldDisplayWidth=Tr(e),this.force=r,this.dims=on(e),this.events=[]}
|
|
534
|
+
function ai(e,t){var r=e.display,n=e.doc
|
|
535
|
+
if(t.editorIsHidden)return hn(e),!1
|
|
536
|
+
if(!t.force&&t.visible.from>=r.viewFrom&&t.visible.to<=r.viewTo&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo)&&r.renderedView==r.view&&0==gn(e))return!1
|
|
537
|
+
fi(e)&&(hn(e),t.dims=on(e))
|
|
538
538
|
var i=n.first+n.size,o=Math.max(t.visible.from-e.options.viewportMargin,n.first),a=Math.min(i,t.visible.to+e.options.viewportMargin)
|
|
539
|
-
r.viewFrom<o&&o-r.viewFrom<20&&(o=Math.max(n.first,r.viewFrom)),r.viewTo>a&&r.viewTo-a<20&&(a=Math.min(i,r.viewTo)),
|
|
539
|
+
r.viewFrom<o&&o-r.viewFrom<20&&(o=Math.max(n.first,r.viewFrom)),r.viewTo>a&&r.viewTo-a<20&&(a=Math.min(i,r.viewTo)),kt&&(o=Rt(e.doc,o),a=Bt(e.doc,a))
|
|
540
540
|
var l=o!=r.viewFrom||a!=r.viewTo||r.lastWrapHeight!=t.wrapperHeight||r.lastWrapWidth!=t.wrapperWidth
|
|
541
541
|
!function(e,t,r){var n=e.display
|
|
542
|
-
0==n.view.length||t>=n.viewTo||r<=n.viewFrom?(n.view=
|
|
543
|
-
var u=
|
|
542
|
+
0==n.view.length||t>=n.viewTo||r<=n.viewFrom?(n.view=ir(e,t,r),n.viewFrom=t):(n.viewFrom>t?n.view=ir(e,t,n.viewFrom).concat(n.view):n.viewFrom<t&&(n.view=n.view.slice(cn(e,t))),n.viewFrom=t,n.viewTo<r?n.view=n.view.concat(ir(e,n.viewTo,r)):n.viewTo>r&&(n.view=n.view.slice(0,cn(e,r)))),n.viewTo=r}(e,o,a),r.viewOffset=Kt(qe(e.doc,r.viewFrom)),e.display.mover.style.top=r.viewOffset+"px"
|
|
543
|
+
var u=gn(e)
|
|
544
544
|
if(!l&&0==u&&!t.force&&r.renderedView==r.view&&(null==r.updateLineNumbers||r.updateLineNumbers>=r.viewTo))return!1
|
|
545
545
|
var c=function(e){if(e.hasFocus())return null
|
|
546
546
|
var t=D()
|
|
@@ -553,272 +553,272 @@ function l(t){var r=t.nextSibling
|
|
|
553
553
|
return s&&y&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),r}for(var u=n.view,c=n.viewFrom,d=0;d<u.length;d++){var f=u[d]
|
|
554
554
|
if(f.hidden);else if(f.node&&f.node.parentNode==o){for(;a!=f.node;)a=l(a)
|
|
555
555
|
var h=i&&null!=t&&t<=c&&f.lineNumber
|
|
556
|
-
f.changes&&(B(f.changes,"gutter")>-1&&(h=!1),
|
|
556
|
+
f.changes&&(B(f.changes,"gutter")>-1&&(h=!1),ur(e,f,c,r)),h&&(M(f.lineNumber),f.lineNumber.appendChild(document.createTextNode(Je(e.options,c)))),a=f.node.nextSibling}else{var p=mr(e,f,c,r)
|
|
557
557
|
o.insertBefore(p,a)}c+=f.size}for(;a;)a=l(a)}(e,r.updateLineNumbers,t.dims),u>4&&(r.lineDiv.style.display=""),r.renderedView=r.view,function(e){if(e&&e.activeElt&&e.activeElt!=D()&&(e.activeElt.focus(),e.anchorNode&&W(document.body,e.anchorNode)&&W(document.body,e.focusNode))){var t=window.getSelection(),r=document.createRange()
|
|
558
|
-
r.setEnd(e.anchorNode,e.anchorOffset),r.collapse(!1),t.removeAllRanges(),t.addRange(r),t.extend(e.focusNode,e.focusOffset)}}(c),M(r.cursorDiv),M(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,l&&(r.lastWrapHeight=t.wrapperHeight,r.lastWrapWidth=t.wrapperWidth,
|
|
559
|
-
var i=
|
|
560
|
-
|
|
561
|
-
if(
|
|
562
|
-
var n=
|
|
563
|
-
|
|
564
|
-
e.sizer.style.marginLeft=t+"px"}function
|
|
565
|
-
if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var n=
|
|
558
|
+
r.setEnd(e.anchorNode,e.anchorOffset),r.collapse(!1),t.removeAllRanges(),t.addRange(r),t.extend(e.focusNode,e.focusOffset)}}(c),M(r.cursorDiv),M(r.selectionDiv),r.gutters.style.height=r.sizer.style.minHeight=0,l&&(r.lastWrapHeight=t.wrapperHeight,r.lastWrapWidth=t.wrapperWidth,ni(e,400)),r.updateLineNumbers=null,!0}function li(e,t){for(var r=t.viewport,n=!0;(n&&e.options.lineWrapping&&t.oldDisplayWidth!=Tr(e)||(r&&null!=r.top&&(r={top:Math.min(e.doc.height+Cr(e.display)-Mr(e),r.top)}),t.visible=Nn(e.display,e.doc,r),!(t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)))&&ai(e,t);n=!1){Tn(e)
|
|
559
|
+
var i=Fn(e)
|
|
560
|
+
mn(e),jn(e,i),ci(e,i),t.force=!1}t.signal(e,"update",e),e.display.viewFrom==e.display.reportedViewFrom&&e.display.viewTo==e.display.reportedViewTo||(t.signal(e,"viewportChange",e,e.display.viewFrom,e.display.viewTo),e.display.reportedViewFrom=e.display.viewFrom,e.display.reportedViewTo=e.display.viewTo)}function si(e,t){var r=new oi(e,t)
|
|
561
|
+
if(ai(e,r)){Tn(e),li(e,r)
|
|
562
|
+
var n=Fn(e)
|
|
563
|
+
mn(e),jn(e,n),ci(e,n),r.finish()}}function ui(e){var t=e.gutters.offsetWidth
|
|
564
|
+
e.sizer.style.marginLeft=t+"px"}function ci(e,t){e.display.sizer.style.minHeight=t.docHeight+"px",e.display.heightForcer.style.top=t.docHeight+"px",e.display.gutters.style.height=t.docHeight+e.display.barHeight+Lr(e)+"px"}function di(e){var t=e.display,r=t.view
|
|
565
|
+
if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var n=an(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=n+"px",a=0;a<r.length;a++)if(!r[a].hidden){e.options.fixedGutter&&(r[a].gutter&&(r[a].gutter.style.left=o),r[a].gutterBackground&&(r[a].gutterBackground.style.left=o))
|
|
566
566
|
var l=r[a].alignable
|
|
567
|
-
if(l)for(var s=0;s<l.length;s++)l[s].style.left=o}e.options.fixedGutter&&(t.gutters.style.left=n+i+"px")}}function
|
|
568
|
-
var t=e.doc,r=
|
|
567
|
+
if(l)for(var s=0;s<l.length;s++)l[s].style.left=o}e.options.fixedGutter&&(t.gutters.style.left=n+i+"px")}}function fi(e){if(!e.options.lineNumbers)return!1
|
|
568
|
+
var t=e.doc,r=Je(e.options,t.first+t.size-1),n=e.display
|
|
569
569
|
if(r.length!=n.lineNumChars){var i=n.measure.appendChild(A("div",[A("div",r)],"CodeMirror-linenumber CodeMirror-gutter-elt")),o=i.firstChild.offsetWidth,a=i.offsetWidth-o
|
|
570
|
-
return n.lineGutter.style.width="",n.lineNumInnerWidth=Math.max(o,n.lineGutter.offsetWidth-a)+1,n.lineNumWidth=n.lineNumInnerWidth+a,n.lineNumChars=n.lineNumInnerWidth?r.length:-1,n.lineGutter.style.width=n.lineNumWidth+"px",
|
|
570
|
+
return n.lineGutter.style.width="",n.lineNumInnerWidth=Math.max(o,n.lineGutter.offsetWidth-a)+1,n.lineNumWidth=n.lineNumInnerWidth+a,n.lineNumChars=n.lineNumInnerWidth?r.length:-1,n.lineGutter.style.width=n.lineNumWidth+"px",ui(e.display),!0}return!1}function hi(e,t){for(var r=[],n=!1,i=0;i<e.length;i++){var o=e[i],a=null
|
|
571
571
|
if("string"!=typeof o&&(a=o.style,o=o.className),"CodeMirror-linenumbers"==o){if(!t)continue
|
|
572
|
-
n=!0}r.push({className:o,style:a})}return t&&!n&&r.push({className:"CodeMirror-linenumbers",style:null}),r}function
|
|
572
|
+
n=!0}r.push({className:o,style:a})}return t&&!n&&r.push({className:"CodeMirror-linenumbers",style:null}),r}function pi(e){var t=e.gutters,r=e.gutterSpecs
|
|
573
573
|
M(t),e.lineGutter=null
|
|
574
574
|
for(var n=0;n<r.length;++n){var i=r[n],o=i.className,a=i.style,l=t.appendChild(A("div",null,"CodeMirror-gutter "+o))
|
|
575
|
-
a&&(l.style.cssText=a),"CodeMirror-linenumbers"==o&&(e.lineGutter=l,l.style.width=(e.lineNumWidth||1)+"px")}t.style.display=r.length?"":"none",
|
|
575
|
+
a&&(l.style.cssText=a),"CodeMirror-linenumbers"==o&&(e.lineGutter=l,l.style.width=(e.lineNumWidth||1)+"px")}t.style.display=r.length?"":"none",ui(e)}function gi(e){pi(e.display),dn(e),di(e)}function mi(e,t,n,i){var o=this
|
|
576
576
|
this.input=n,o.scrollbarFiller=A("div",null,"CodeMirror-scrollbar-filler"),o.scrollbarFiller.setAttribute("cm-not-content","true"),o.gutterFiller=A("div",null,"CodeMirror-gutter-filler"),o.gutterFiller.setAttribute("cm-not-content","true"),o.lineDiv=O("div",null,"CodeMirror-code"),o.selectionDiv=A("div",null,null,"position: relative; z-index: 1"),o.cursorDiv=A("div",null,"CodeMirror-cursors"),o.measure=A("div",null,"CodeMirror-measure"),o.lineMeasure=A("div",null,"CodeMirror-measure"),o.lineSpace=O("div",[o.measure,o.lineMeasure,o.selectionDiv,o.cursorDiv,o.lineDiv],null,"position: relative; outline: none")
|
|
577
577
|
var u=O("div",[o.lineSpace],"CodeMirror-lines")
|
|
578
|
-
o.mover=A("div",[u],null,"position: relative"),o.sizer=A("div",[o.mover],"CodeMirror-sizer"),o.sizerWidth=null,o.heightForcer=A("div",null,null,"position: absolute; height:
|
|
579
|
-
var
|
|
580
|
-
function
|
|
581
|
-
return null==t&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),null==r&&e.detail&&e.axis==e.VERTICAL_AXIS?r=e.detail:null==r&&(r=e.wheelDelta),{x:t,y:r}}function
|
|
582
|
-
return t.x*=
|
|
578
|
+
o.mover=A("div",[u],null,"position: relative"),o.sizer=A("div",[o.mover],"CodeMirror-sizer"),o.sizerWidth=null,o.heightForcer=A("div",null,null,"position: absolute; height: 30px; width: 1px;"),o.gutters=A("div",null,"CodeMirror-gutters"),o.lineGutter=null,o.scroller=A("div",[o.sizer,o.heightForcer,o.gutters],"CodeMirror-scroll"),o.scroller.setAttribute("tabIndex","-1"),o.wrapper=A("div",[o.scrollbarFiller,o.gutterFiller,o.scroller],"CodeMirror"),a&&l<8&&(o.gutters.style.zIndex=-1,o.scroller.style.paddingRight=0),s||r&&v||(o.scroller.draggable=!0),e&&(e.appendChild?e.appendChild(o.wrapper):e(o.wrapper)),o.viewFrom=o.viewTo=t.first,o.reportedViewFrom=o.reportedViewTo=t.first,o.view=[],o.renderedView=null,o.externalMeasured=null,o.viewOffset=0,o.lastWrapHeight=o.lastWrapWidth=0,o.updateLineNumbers=null,o.nativeBarWidth=o.barHeight=o.barWidth=0,o.scrollbarsClipped=!1,o.lineNumWidth=o.lineNumInnerWidth=o.lineNumChars=null,o.alignWidgets=!1,o.cachedCharWidth=o.cachedTextHeight=o.cachedPaddingH=null,o.maxLine=null,o.maxLineLength=0,o.maxLineChanged=!1,o.wheelDX=o.wheelDY=o.wheelStartX=o.wheelStartY=null,o.shift=!1,o.selForContextMenu=null,o.activeTouch=null,o.gutterSpecs=hi(i.gutters,i.lineNumbers),pi(o),n.init(o)}oi.prototype.signal=function(e,t){ve(e,t)&&this.events.push(arguments)},oi.prototype.finish=function(){for(var e=0;e<this.events.length;e++)pe.apply(null,this.events[e])}
|
|
579
|
+
var vi=0,yi=null
|
|
580
|
+
function bi(e){var t=e.wheelDeltaX,r=e.wheelDeltaY
|
|
581
|
+
return null==t&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),null==r&&e.detail&&e.axis==e.VERTICAL_AXIS?r=e.detail:null==r&&(r=e.wheelDelta),{x:t,y:r}}function wi(e){var t=bi(e)
|
|
582
|
+
return t.x*=yi,t.y*=yi,t}function xi(e,t){var n=bi(t),i=n.x,o=n.y,a=e.display,l=a.scroller,u=l.scrollWidth>l.clientWidth,c=l.scrollHeight>l.clientHeight
|
|
583
583
|
if(i&&u||o&&c){if(o&&y&&s)e:for(var f=t.target,h=a.view;f!=l;f=f.parentNode)for(var p=0;p<h.length;p++)if(h[p].node==f){e.display.currentWheelTarget=f
|
|
584
|
-
break e}if(i&&!r&&!d&&null!=
|
|
585
|
-
if(o&&null!=
|
|
586
|
-
g<0?m=Math.max(0,m+g-50):v=Math.min(e.doc.height,v+g+50),
|
|
587
|
-
a.wheelStartX=a.wheelStartY=null,r&&(
|
|
588
|
-
var
|
|
589
|
-
|
|
584
|
+
break e}if(i&&!r&&!d&&null!=yi)return o&&c&&Hn(e,Math.max(0,l.scrollTop+o*yi)),En(e,Math.max(0,l.scrollLeft+i*yi)),(!o||o&&c)&&be(t),void(a.wheelStartX=null)
|
|
585
|
+
if(o&&null!=yi){var g=o*yi,m=e.doc.scrollTop,v=m+a.wrapper.clientHeight
|
|
586
|
+
g<0?m=Math.max(0,m+g-50):v=Math.min(e.doc.height,v+g+50),si(e,{top:m,bottom:v})}vi<20&&(null==a.wheelStartX?(a.wheelStartX=l.scrollLeft,a.wheelStartY=l.scrollTop,a.wheelDX=i,a.wheelDY=o,setTimeout((function(){if(null!=a.wheelStartX){var e=l.scrollLeft-a.wheelStartX,t=l.scrollTop-a.wheelStartY,r=t&&a.wheelDY&&t/a.wheelDY||e&&a.wheelDX&&e/a.wheelDX
|
|
587
|
+
a.wheelStartX=a.wheelStartY=null,r&&(yi=(yi*vi+r)/(vi+1),++vi)}}),200)):(a.wheelDX+=i,a.wheelDY+=o))}}a?yi=-.53:r?yi=15:c?yi=-.7:f&&(yi=-1/3)
|
|
588
|
+
var ki=function(e,t){this.ranges=e,this.primIndex=t}
|
|
589
|
+
ki.prototype.primary=function(){return this.ranges[this.primIndex]},ki.prototype.equals=function(e){if(e==this)return!0
|
|
590
590
|
if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1
|
|
591
591
|
for(var t=0;t<this.ranges.length;t++){var r=this.ranges[t],n=e.ranges[t]
|
|
592
|
-
if(!
|
|
593
|
-
return new
|
|
594
|
-
return!1},
|
|
592
|
+
if(!rt(r.anchor,n.anchor)||!rt(r.head,n.head))return!1}return!0},ki.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new Ci(nt(this.ranges[t].anchor),nt(this.ranges[t].head))
|
|
593
|
+
return new ki(e,this.primIndex)},ki.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0
|
|
594
|
+
return!1},ki.prototype.contains=function(e,t){t||(t=e)
|
|
595
595
|
for(var r=0;r<this.ranges.length;r++){var n=this.ranges[r]
|
|
596
|
-
if(
|
|
597
|
-
var
|
|
598
|
-
function
|
|
599
|
-
t.sort((function(e,t){return
|
|
600
|
-
for(var o=1;o<t.length;o++){var a=t[o],l=t[o-1],s=
|
|
601
|
-
if(n&&!a.empty()?s>0:s>=0){var u=
|
|
602
|
-
o<=r&&--r,t.splice(--o,2,new
|
|
603
|
-
if(
|
|
596
|
+
if(tt(t,n.from())>=0&&tt(e,n.to())<=0)return r}return-1}
|
|
597
|
+
var Ci=function(e,t){this.anchor=e,this.head=t}
|
|
598
|
+
function Si(e,t,r){var n=e&&e.options.selectionsMayTouch,i=t[r]
|
|
599
|
+
t.sort((function(e,t){return tt(e.from(),t.from())})),r=B(t,i)
|
|
600
|
+
for(var o=1;o<t.length;o++){var a=t[o],l=t[o-1],s=tt(l.to(),a.from())
|
|
601
|
+
if(n&&!a.empty()?s>0:s>=0){var u=ot(l.from(),a.from()),c=it(l.to(),a.to()),d=l.empty()?a.from()==a.head:l.from()==l.head
|
|
602
|
+
o<=r&&--r,t.splice(--o,2,new Ci(d?c:u,d?u:c))}}return new ki(t,r)}function Li(e,t){return new ki([new Ci(e,t||e)],0)}function Ti(e){return e.text?et(e.from.line+e.text.length-1,$(e.text).length+(1==e.text.length?e.from.ch:0)):e.to}function Mi(e,t){if(tt(e,t.from)<0)return e
|
|
603
|
+
if(tt(e,t.to)<=0)return Ti(t)
|
|
604
604
|
var r=e.line+t.text.length-(t.to.line-t.from.line)-1,n=e.ch
|
|
605
|
-
return e.line==t.to.line&&(n+=
|
|
606
|
-
r.push(new
|
|
605
|
+
return e.line==t.to.line&&(n+=Ti(t).ch-t.to.ch),et(r,n)}function Ni(e,t){for(var r=[],n=0;n<e.sel.ranges.length;n++){var i=e.sel.ranges[n]
|
|
606
|
+
r.push(new Ci(Mi(i.anchor,t),Mi(i.head,t)))}return Si(e.cm,r,e.sel.primIndex)}function Ai(e,t,r){return e.line==t.line?et(r.line,e.ch-t.ch+r.ch):et(r.line+(e.line-t.line),e.ch)}function Oi(e){e.doc.mode=Re(e.options,e.doc.modeOption),Wi(e)}function Wi(e){e.doc.iter((function(e){e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null)})),e.doc.modeFrontier=e.doc.highlightFrontier=e.doc.first,ni(e,100),e.state.modeGen++,e.curOp&&dn(e)}function Di(e,t){return 0==t.from.ch&&0==t.to.ch&&""==$(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function zi(e,t,r,n){function i(e){return r?r[e]:null}function o(e,r,i){!function(e,t,r,n){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),null!=e.order&&(e.order=null),Nt(e),At(e,r)
|
|
607
607
|
var i=n?n(e):1
|
|
608
|
-
i!=e.height&&
|
|
609
|
-
return r}var l=t.from,s=t.to,u=t.text,c=
|
|
608
|
+
i!=e.height&&Xe(e,i)}(e,r,i,n),lr(e,"change",e,t)}function a(e,t){for(var r=[],o=e;o<t;++o)r.push(new qt(u[o],i(o),n))
|
|
609
|
+
return r}var l=t.from,s=t.to,u=t.text,c=qe(e,l.line),d=qe(e,s.line),f=$(u),h=i(u.length-1),p=s.line-l.line
|
|
610
610
|
if(t.full)e.insert(0,a(0,u.length)),e.remove(u.length,e.size-u.length)
|
|
611
|
-
else if(
|
|
611
|
+
else if(Di(e,t)){var g=a(0,u.length-1)
|
|
612
612
|
o(d,d.text,h),p&&e.remove(l.line,p),g.length&&e.insert(l.line,g)}else if(c==d)if(1==u.length)o(c,c.text.slice(0,l.ch)+f+c.text.slice(s.ch),h)
|
|
613
613
|
else{var m=a(1,u.length-1)
|
|
614
|
-
m.push(new
|
|
614
|
+
m.push(new qt(f+c.text.slice(s.ch),h,n)),o(c,c.text.slice(0,l.ch)+u[0],i(0)),e.insert(l.line+1,m)}else if(1==u.length)o(c,c.text.slice(0,l.ch)+u[0]+d.text.slice(s.ch),i(0)),e.remove(l.line+1,p)
|
|
615
615
|
else{o(c,c.text.slice(0,l.ch)+u[0],i(0)),o(d,f+d.text.slice(s.ch),h)
|
|
616
616
|
var v=a(1,u.length-1)
|
|
617
|
-
p>1&&e.remove(l.line+1,p-1),e.insert(l.line+1,v)}
|
|
617
|
+
p>1&&e.remove(l.line+1,p-1),e.insert(l.line+1,v)}lr(e,"change",e,t)}function Pi(e,t,r){!function e(n,i,o){if(n.linked)for(var a=0;a<n.linked.length;++a){var l=n.linked[a]
|
|
618
618
|
if(l.doc!=i){var s=o&&l.sharedHist
|
|
619
|
-
r&&!s||(t(l.doc,s),e(l.doc,n,s))}}}(e,null,!0)}function
|
|
620
|
-
e.doc=t,t.cm=e,
|
|
621
|
-
return
|
|
619
|
+
r&&!s||(t(l.doc,s),e(l.doc,n,s))}}}(e,null,!0)}function Hi(e,t){if(t.cm)throw new Error("This document is already in use.")
|
|
620
|
+
e.doc=t,t.cm=e,sn(e),Oi(e),Ii(e),e.options.lineWrapping||Ut(e),e.options.mode=t.modeOption,dn(e)}function Ii(e){("rtl"==e.doc.direction?z:T)(e.display.lineDiv,"CodeMirror-rtl")}function Ei(e){this.done=[],this.undone=[],this.undoDepth=1/0,this.lastModTime=this.lastSelTime=0,this.lastOp=this.lastSelOp=null,this.lastOrigin=this.lastSelOrigin=null,this.generation=this.maxGeneration=e||1}function Fi(e,t){var r={from:nt(t.from),to:Ti(t),text:_e(e,t.from,t.to)}
|
|
621
|
+
return Vi(e,r,t.from.line,t.to.line+1),Pi(e,(function(e){return Vi(e,r,t.from.line,t.to.line+1)}),!0),r}function Ri(e){for(;e.length&&$(e).ranges;)e.pop()}function Bi(e,t,r,n){var i=e.history
|
|
622
622
|
i.undone.length=0
|
|
623
623
|
var o,a,l=+new Date
|
|
624
|
-
if((i.lastOp==n||i.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&i.lastModTime>l-(e.cm?e.cm.options.historyEventDelay:500)||"*"==t.origin.charAt(0)))&&(o=function(e,t){return t?(
|
|
625
|
-
else{var s
|
|
626
|
-
for(s&&s.ranges||
|
|
627
|
-
r&&r.ranges&&r.equals(e)||t.push(e)}function
|
|
628
|
-
e.iter(Math.max(e.first,r),Math.min(e.first+e.size,n),(function(r){r.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=r.markedSpans),++o}))}function
|
|
624
|
+
if((i.lastOp==n||i.lastOrigin==t.origin&&t.origin&&("+"==t.origin.charAt(0)&&i.lastModTime>l-(e.cm?e.cm.options.historyEventDelay:500)||"*"==t.origin.charAt(0)))&&(o=function(e,t){return t?(Ri(e.done),$(e.done)):e.done.length&&!$(e.done).ranges?$(e.done):e.done.length>1&&!e.done[e.done.length-2].ranges?(e.done.pop(),$(e.done)):void 0}(i,i.lastOp==n)))a=$(o.changes),0==tt(t.from,t.to)&&0==tt(t.from,a.to)?a.to=Ti(t):o.changes.push(Fi(e,t))
|
|
625
|
+
else{var s=$(i.done)
|
|
626
|
+
for(s&&s.ranges||ji(e.sel,i.done),o={changes:[Fi(e,t)],generation:i.generation},i.done.push(o);i.done.length>i.undoDepth;)i.done.shift(),i.done[0].ranges||i.done.shift()}i.done.push(r),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=l,i.lastOp=i.lastSelOp=n,i.lastOrigin=i.lastSelOrigin=t.origin,a||pe(e,"historyAdded")}function ji(e,t){var r=$(t)
|
|
627
|
+
r&&r.ranges&&r.equals(e)||t.push(e)}function Vi(e,t,r,n){var i=t["spans_"+e.id],o=0
|
|
628
|
+
e.iter(Math.max(e.first,r),Math.min(e.first+e.size,n),(function(r){r.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=r.markedSpans),++o}))}function Ki(e){if(!e)return null
|
|
629
629
|
for(var t,r=0;r<e.length;++r)e[r].marker.explicitlyCleared?t||(t=e.slice(0,r)):t&&t.push(e[r])
|
|
630
|
-
return t?t.length?t:null:e}function
|
|
630
|
+
return t?t.length?t:null:e}function Gi(e,t){var r=function(e,t){var r=t["spans_"+e.id]
|
|
631
631
|
if(!r)return null
|
|
632
|
-
for(var n=[],i=0;i<t.text.length;++i)n.push(
|
|
633
|
-
return n}(e,t),n=
|
|
632
|
+
for(var n=[],i=0;i<t.text.length;++i)n.push(Ki(r[i]))
|
|
633
|
+
return n}(e,t),n=Tt(e,t)
|
|
634
634
|
if(!r)return n
|
|
635
635
|
if(!n)return r
|
|
636
636
|
for(var i=0;i<r.length;++i){var o=r[i],a=n[i]
|
|
637
637
|
if(o&&a)e:for(var l=0;l<a.length;++l){for(var s=a[l],u=0;u<o.length;++u)if(o[u].marker==s.marker)continue e
|
|
638
|
-
o.push(s)}else a&&(r[i]=a)}return r}function
|
|
639
|
-
if(o.ranges)n.push(r?
|
|
638
|
+
o.push(s)}else a&&(r[i]=a)}return r}function Ui(e,t,r){for(var n=[],i=0;i<e.length;++i){var o=e[i]
|
|
639
|
+
if(o.ranges)n.push(r?ki.prototype.deepCopy.call(o):o)
|
|
640
640
|
else{var a=o.changes,l=[]
|
|
641
641
|
n.push({changes:l})
|
|
642
642
|
for(var s=0;s<a.length;++s){var u=a[s],c=void 0
|
|
643
|
-
if(l.push({from:u.from,to:u.to,text:u.text}),t)for(var d in u)(c=d.match(/^spans_(\d+)$/))&&B(t,Number(c[1]))>-1&&(
|
|
644
|
-
if(r){var o=
|
|
645
|
-
o!=
|
|
646
|
-
|
|
647
|
-
i[t]=r,
|
|
648
|
-
i&&i.ranges?(n[n.length-1]=t,
|
|
643
|
+
if(l.push({from:u.from,to:u.to,text:u.text}),t)for(var d in u)(c=d.match(/^spans_(\d+)$/))&&B(t,Number(c[1]))>-1&&($(l)[d]=u[d],delete u[d])}}}return n}function qi(e,t,r,n){if(n){var i=e.anchor
|
|
644
|
+
if(r){var o=tt(t,i)<0
|
|
645
|
+
o!=tt(r,i)<0?(i=t,t=r):o!=tt(t,r)<0&&(t=r)}return new Ci(i,t)}return new Ci(r||t,t)}function _i(e,t,r,n,i){null==i&&(i=e.cm&&(e.cm.display.shift||e.extend)),Qi(e,new ki([qi(e.sel.primary(),t,r,i)],0),n)}function $i(e,t,r){for(var n=[],i=e.cm&&(e.cm.display.shift||e.extend),o=0;o<e.sel.ranges.length;o++)n[o]=qi(e.sel.ranges[o],t[o],null,i)
|
|
646
|
+
Qi(e,Si(e.cm,n,e.sel.primIndex),r)}function Xi(e,t,r,n){var i=e.sel.ranges.slice(0)
|
|
647
|
+
i[t]=r,Qi(e,Si(e.cm,i,e.sel.primIndex),n)}function Yi(e,t,r,n){Qi(e,Li(t,r),n)}function Zi(e,t,r){var n=e.history.done,i=$(n)
|
|
648
|
+
i&&i.ranges?(n[n.length-1]=t,Ji(e,t,r)):Qi(e,t,r)}function Qi(e,t,r){Ji(e,t,r),function(e,t,r,n){var i=e.history,o=n&&n.origin
|
|
649
649
|
r==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||function(e,t,r,n){var i=t.charAt(0)
|
|
650
|
-
return"*"==i||"+"==i&&r.ranges.length==n.ranges.length&&r.somethingSelected()==n.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}(e,o
|
|
651
|
-
for(var r=0;r<t.length;r++)this.ranges[r]=new
|
|
652
|
-
return
|
|
653
|
-
var n=r&&r.bias||(
|
|
654
|
-
|
|
650
|
+
return"*"==i||"+"==i&&r.ranges.length==n.ranges.length&&r.somethingSelected()==n.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}(e,o,$(i.done),t))?i.done[i.done.length-1]=t:ji(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=r,n&&!1!==n.clearRedo&&Ri(i.undone)}(e,e.sel,e.cm?e.cm.curOp.id:NaN,r)}function Ji(e,t,r){(ve(e,"beforeSelectionChange")||e.cm&&ve(e.cm,"beforeSelectionChange"))&&(t=function(e,t,r){var n={ranges:t.ranges,update:function(t){this.ranges=[]
|
|
651
|
+
for(var r=0;r<t.length;r++)this.ranges[r]=new Ci(lt(e,t[r].anchor),lt(e,t[r].head))},origin:r&&r.origin}
|
|
652
|
+
return pe(e,"beforeSelectionChange",e,n),e.cm&&pe(e.cm,"beforeSelectionChange",e.cm,n),n.ranges!=t.ranges?Si(e.cm,n.ranges,n.ranges.length-1):t}(e,t,r))
|
|
653
|
+
var n=r&&r.bias||(tt(t.primary().head,e.sel.primary().head)<0?-1:1)
|
|
654
|
+
eo(e,ro(e,t,n,!0)),r&&!1===r.scroll||!e.cm||Wn(e.cm)}function eo(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,me(e.cm)),lr(e,"cursorActivity",e))}function to(e){eo(e,ro(e,e.sel,null,!1))}function ro(e,t,r,n){for(var i,o=0;o<t.ranges.length;o++){var a=t.ranges[o],l=t.ranges.length==e.sel.ranges.length&&e.sel.ranges[o],s=io(e,a.anchor,l&&l.anchor,r,n),u=io(e,a.head,l&&l.head,r,n);(i||s!=a.anchor||u!=a.head)&&(i||(i=t.ranges.slice(0,o)),i[o]=new Ci(s,u))}return i?Si(e.cm,i,t.primIndex):t}function no(e,t,r,n,i){var o=qe(e,t.line)
|
|
655
655
|
if(o.markedSpans)for(var a=0;a<o.markedSpans.length;++a){var l=o.markedSpans[a],s=l.marker,u="selectLeft"in s?!s.selectLeft:s.inclusiveLeft,c="selectRight"in s?!s.selectRight:s.inclusiveRight
|
|
656
|
-
if((null==l.from||(u?l.from<=t.ch:l.from<t.ch))&&(null==l.to||(c?l.to>=t.ch:l.to>t.ch))){if(i&&(
|
|
656
|
+
if((null==l.from||(u?l.from<=t.ch:l.from<t.ch))&&(null==l.to||(c?l.to>=t.ch:l.to>t.ch))){if(i&&(pe(s,"beforeCursorEnter"),s.explicitlyCleared)){if(o.markedSpans){--a
|
|
657
657
|
continue}break}if(!s.atomic)continue
|
|
658
658
|
if(r){var d=s.find(n<0?1:-1),f=void 0
|
|
659
|
-
if((n<0?c:u)&&(d=
|
|
660
|
-
return(n<0?u:c)&&(h=
|
|
661
|
-
return
|
|
662
|
-
return r&&(n.update=function(t,r,i,o){t&&(n.from=
|
|
663
|
-
if(e.cm.state.suppressEdits)return}if(!(
|
|
659
|
+
if((n<0?c:u)&&(d=oo(e,d,-n,d&&d.line==t.line?o:null)),d&&d.line==t.line&&(f=tt(d,r))&&(n<0?f<0:f>0))return no(e,d,t,n,i)}var h=s.find(n<0?-1:1)
|
|
660
|
+
return(n<0?u:c)&&(h=oo(e,h,n,h.line==t.line?o:null)),h?no(e,h,t,n,i):null}}return t}function io(e,t,r,n,i){var o=n||1
|
|
661
|
+
return no(e,t,r,o,i)||!i&&no(e,t,r,o,!0)||no(e,t,r,-o,i)||!i&&no(e,t,r,-o,!0)||(e.cantEdit=!0,et(e.first,0))}function oo(e,t,r,n){return r<0&&0==t.ch?t.line>e.first?lt(e,et(t.line-1)):null:r>0&&t.ch==(n||qe(e,t.line)).text.length?t.line<e.first+e.size-1?et(t.line+1,0):null:new et(t.line,t.ch+r)}function ao(e){e.setSelection(et(e.firstLine(),0),et(e.lastLine()),V)}function lo(e,t,r){var n={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return n.canceled=!0}}
|
|
662
|
+
return r&&(n.update=function(t,r,i,o){t&&(n.from=lt(e,t)),r&&(n.to=lt(e,r)),i&&(n.text=i),void 0!==o&&(n.origin=o)}),pe(e,"beforeChange",e,n),e.cm&&pe(e.cm,"beforeChange",e.cm,n),n.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:n.from,to:n.to,text:n.text,origin:n.origin}}function so(e,t,r){if(e.cm){if(!e.cm.curOp)return ei(e.cm,so)(e,t,r)
|
|
663
|
+
if(e.cm.state.suppressEdits)return}if(!(ve(e,"beforeChange")||e.cm&&ve(e.cm,"beforeChange"))||(t=lo(e,t,!0))){var n=xt&&!r&&function(e,t,r){var n=null
|
|
664
664
|
if(e.iter(t.line,r.line+1,(function(e){if(e.markedSpans)for(var t=0;t<e.markedSpans.length;++t){var r=e.markedSpans[t].marker
|
|
665
665
|
!r.readOnly||n&&-1!=B(n,r)||(n||(n=[])).push(r)}})),!n)return null
|
|
666
666
|
for(var i=[{from:t,to:r}],o=0;o<n.length;++o)for(var a=n[o],l=a.find(0),s=0;s<i.length;++s){var u=i[s]
|
|
667
|
-
if(!(
|
|
668
|
-
if(n)for(var i=n.length-1;i>=0;--i)
|
|
669
|
-
else
|
|
670
|
-
|
|
667
|
+
if(!(tt(u.to,l.from)<0||tt(u.from,l.to)>0)){var c=[s,1],d=tt(u.from,l.from),f=tt(u.to,l.to);(d<0||!a.inclusiveLeft&&!d)&&c.push({from:u.from,to:l.from}),(f>0||!a.inclusiveRight&&!f)&&c.push({from:l.to,to:u.to}),i.splice.apply(i,c),s+=c.length-3}}return i}(e,t.from,t.to)
|
|
668
|
+
if(n)for(var i=n.length-1;i>=0;--i)uo(e,{from:n[i].from,to:n[i].to,text:i?[""]:t.text,origin:t.origin})
|
|
669
|
+
else uo(e,t)}}function uo(e,t){if(1!=t.text.length||""!=t.text[0]||0!=tt(t.from,t.to)){var r=Ni(e,t)
|
|
670
|
+
Bi(e,t,r,e.cm?e.cm.curOp.id:NaN),ho(e,t,r,Tt(e,t))
|
|
671
671
|
var n=[]
|
|
672
|
-
|
|
672
|
+
Pi(e,(function(e,r){r||-1!=B(n,e.history)||(vo(e.history,t),n.push(e.history)),ho(e,t,null,Tt(e,t))}))}}function co(e,t,r){var n=e.cm&&e.cm.state.suppressEdits
|
|
673
673
|
if(!n||r){for(var i,o=e.history,a=e.sel,l="undo"==t?o.done:o.undone,s="undo"==t?o.undone:o.done,u=0;u<l.length&&(i=l[u],r?!i.ranges||i.equals(e.sel):i.ranges);u++);if(u!=l.length){for(o.lastOrigin=o.lastSelOrigin=null;;){if(!(i=l.pop()).ranges){if(n)return void l.push(i)
|
|
674
|
-
break}if(
|
|
674
|
+
break}if(ji(i,s),r&&!i.equals(e.sel))return void Qi(e,i,{clearRedo:!1})
|
|
675
675
|
a=i}var c=[]
|
|
676
|
-
|
|
677
|
-
for(var d=
|
|
678
|
-
if(n.origin=t,d&&!
|
|
679
|
-
c.push(
|
|
680
|
-
var o=r?
|
|
681
|
-
|
|
676
|
+
ji(a,s),s.push({changes:c,generation:o.generation}),o.generation=i.generation||++o.maxGeneration
|
|
677
|
+
for(var d=ve(e,"beforeChange")||e.cm&&ve(e.cm,"beforeChange"),f=function(r){var n=i.changes[r]
|
|
678
|
+
if(n.origin=t,d&&!lo(e,n,!1))return l.length=0,{}
|
|
679
|
+
c.push(Fi(e,n))
|
|
680
|
+
var o=r?Ni(e,n):$(l)
|
|
681
|
+
ho(e,n,o,Gi(e,n)),!r&&e.cm&&e.cm.scrollIntoView({from:n.from,to:Ti(n)})
|
|
682
682
|
var a=[]
|
|
683
|
-
|
|
684
|
-
if(p)return p.v}}}}function
|
|
685
|
-
for(var r=e.cm.display,n=r.viewFrom;n<r.viewTo;n++)
|
|
686
|
-
if(t.to.line<e.first)
|
|
683
|
+
Pi(e,(function(e,t){t||-1!=B(a,e.history)||(vo(e.history,n),a.push(e.history)),ho(e,n,null,Gi(e,n))}))},h=i.changes.length-1;h>=0;--h){var p=f(h)
|
|
684
|
+
if(p)return p.v}}}}function fo(e,t){if(0!=t&&(e.first+=t,e.sel=new ki(X(e.sel.ranges,(function(e){return new Ci(et(e.anchor.line+t,e.anchor.ch),et(e.head.line+t,e.head.ch))})),e.sel.primIndex),e.cm)){dn(e.cm,e.first,e.first-t,t)
|
|
685
|
+
for(var r=e.cm.display,n=r.viewFrom;n<r.viewTo;n++)fn(e.cm,n,"gutter")}}function ho(e,t,r,n){if(e.cm&&!e.cm.curOp)return ei(e.cm,ho)(e,t,r,n)
|
|
686
|
+
if(t.to.line<e.first)fo(e,t.text.length-1-(t.to.line-t.from.line))
|
|
687
687
|
else if(!(t.from.line>e.lastLine())){if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line)
|
|
688
|
-
|
|
689
|
-
t.to.line>o&&(t={from:t.from,to:
|
|
690
|
-
e.options.lineWrapping||(s=
|
|
691
|
-
t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,l=!1)})),l&&(e.curOp.updateMaxLine=!0)),function(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontier<t-10)){for(var r=e.first,n=t-1;n>r;n--){var i=
|
|
692
|
-
if(i&&(!(i instanceof
|
|
693
|
-
break}}e.highlightFrontier=Math.min(e.highlightFrontier,r)}}(n,o.line),
|
|
688
|
+
fo(e,i),t={from:et(e.first,0),to:et(t.to.line+i,t.to.ch),text:[$(t.text)],origin:t.origin}}var o=e.lastLine()
|
|
689
|
+
t.to.line>o&&(t={from:t.from,to:et(o,qe(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=_e(e,t.from,t.to),r||(r=Ni(e,t)),e.cm?function(e,t,r){var n=e.doc,i=e.display,o=t.from,a=t.to,l=!1,s=o.line
|
|
690
|
+
e.options.lineWrapping||(s=Ye(Ft(qe(n,o.line))),n.iter(s,a.line+1,(function(e){if(e==i.maxLine)return l=!0,!0}))),n.sel.contains(t.from,t.to)>-1&&me(e),zi(n,t,r,ln(e)),e.options.lineWrapping||(n.iter(s,o.line+t.text.length,(function(e){var t=Gt(e)
|
|
691
|
+
t>i.maxLineLength&&(i.maxLine=e,i.maxLineLength=t,i.maxLineChanged=!0,l=!1)})),l&&(e.curOp.updateMaxLine=!0)),function(e,t){if(e.modeFrontier=Math.min(e.modeFrontier,t),!(e.highlightFrontier<t-10)){for(var r=e.first,n=t-1;n>r;n--){var i=qe(e,n).stateAfter
|
|
692
|
+
if(i&&(!(i instanceof ut)||n+i.lookAhead<t)){r=n+1
|
|
693
|
+
break}}e.highlightFrontier=Math.min(e.highlightFrontier,r)}}(n,o.line),ni(e,400)
|
|
694
694
|
var u=t.text.length-(a.line-o.line)-1
|
|
695
|
-
t.full?
|
|
696
|
-
var c=
|
|
695
|
+
t.full?dn(e):o.line!=a.line||1!=t.text.length||Di(e.doc,t)?dn(e,o.line,a.line+1,u):fn(e,o.line,"text")
|
|
696
|
+
var c=ve(e,"changes"),d=ve(e,"change")
|
|
697
697
|
if(d||c){var f={from:o,to:a,text:t.text,removed:t.removed,origin:t.origin}
|
|
698
|
-
d&&
|
|
699
|
-
n||(n=r),
|
|
698
|
+
d&&lr(e,"change",e,f),c&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(f)}e.display.selForContextMenu=null}(e.cm,t,n):zi(e,t,n),Ji(e,r,V)}}function po(e,t,r,n,i){var o
|
|
699
|
+
n||(n=r),tt(n,r)<0&&(r=(o=[n,r])[0],n=o[1]),"string"==typeof t&&(t=e.splitLines(t)),so(e,{from:r,to:n,text:t,origin:i})}function go(e,t,r,n){r<e.line?e.line+=n:t<e.line&&(e.line=t,e.ch=0)}function mo(e,t,r,n){for(var i=0;i<e.length;++i){var o=e[i],a=!0
|
|
700
700
|
if(o.ranges){o.copied||((o=e[i]=o.deepCopy()).copied=!0)
|
|
701
|
-
for(var l=0;l<o.ranges.length;l++)
|
|
702
|
-
if(r<u.from.line)u.from=
|
|
701
|
+
for(var l=0;l<o.ranges.length;l++)go(o.ranges[l].anchor,t,r,n),go(o.ranges[l].head,t,r,n)}else{for(var s=0;s<o.changes.length;++s){var u=o.changes[s]
|
|
702
|
+
if(r<u.from.line)u.from=et(u.from.line+n,u.from.ch),u.to=et(u.to.line+n,u.to.ch)
|
|
703
703
|
else if(t<=u.to.line){a=!1
|
|
704
|
-
break}}a||(e.splice(0,i+1),i=0)}}}function
|
|
705
|
-
|
|
706
|
-
return"number"==typeof t?o=
|
|
704
|
+
break}}a||(e.splice(0,i+1),i=0)}}}function vo(e,t){var r=t.from.line,n=t.to.line,i=t.text.length-(n-r)-1
|
|
705
|
+
mo(e.done,r,n,i),mo(e.undone,r,n,i)}function yo(e,t,r,n){var i=t,o=t
|
|
706
|
+
return"number"==typeof t?o=qe(e,at(e,t)):i=Ye(t),null==i?null:(n(o,i)&&e.cm&&fn(e.cm,i,r),o)}function bo(e){this.lines=e,this.parent=null
|
|
707
707
|
for(var t=0,r=0;r<e.length;++r)e[r].parent=this,t+=e[r].height
|
|
708
|
-
this.height=t}function
|
|
708
|
+
this.height=t}function wo(e){this.children=e
|
|
709
709
|
for(var t=0,r=0,n=0;n<e.length;++n){var i=e[n]
|
|
710
|
-
t+=i.chunkSize(),r+=i.height,i.parent=this}this.size=t,this.height=r,this.parent=null}
|
|
711
|
-
this.height-=i.height
|
|
712
|
-
for(var n=0;n<t.length;++n)t[n].parent=this},iterN:function(e,t,r){for(var n=e+t;e<n;++e)if(r(this.lines[e]))return!0}},
|
|
710
|
+
t+=i.chunkSize(),r+=i.height,i.parent=this}this.size=t,this.height=r,this.parent=null}Ci.prototype.from=function(){return ot(this.anchor,this.head)},Ci.prototype.to=function(){return it(this.anchor,this.head)},Ci.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},bo.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var r=e,n=e+t;r<n;++r){var i=this.lines[r]
|
|
711
|
+
this.height-=i.height,_t(i),lr(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,r){this.height+=r,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e))
|
|
712
|
+
for(var n=0;n<t.length;++n)t[n].parent=this},iterN:function(e,t,r){for(var n=e+t;e<n;++e)if(r(this.lines[e]))return!0}},wo.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){var r=this
|
|
713
713
|
this.size-=t
|
|
714
714
|
for(var n=0;n<this.children.length;++n){var i=r.children[n],o=i.chunkSize()
|
|
715
715
|
if(e<o){var a=Math.min(t,o-e),l=i.height
|
|
716
716
|
if(i.removeInner(e,a),r.height-=l-i.height,o==a&&(r.children.splice(n--,1),i.parent=null),0==(t-=a))break
|
|
717
|
-
e=0}else e-=o}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof
|
|
718
|
-
this.collapse(s),this.children=[new
|
|
717
|
+
e=0}else e-=o}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof bo))){var s=[]
|
|
718
|
+
this.collapse(s),this.children=[new bo(s)],this.children[0].parent=this}},collapse:function(e){for(var t=0;t<this.children.length;++t)this.children[t].collapse(e)},insertInner:function(e,t,r){var n=this
|
|
719
719
|
this.size+=t.length,this.height+=r
|
|
720
720
|
for(var i=0;i<this.children.length;++i){var o=n.children[i],a=o.chunkSize()
|
|
721
|
-
if(e<=a){if(o.insertInner(e,t,r),o.lines&&o.lines.length>50){for(var l=o.lines.length%25+25,s=l;s<o.lines.length;){var u=new
|
|
721
|
+
if(e<=a){if(o.insertInner(e,t,r),o.lines&&o.lines.length>50){for(var l=o.lines.length%25+25,s=l;s<o.lines.length;){var u=new bo(o.lines.slice(s,s+=25))
|
|
722
722
|
o.height-=u.height,n.children.splice(++i,0,u),u.parent=n}o.lines=o.lines.slice(0,l),n.maybeSpill()}break}e-=a}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this
|
|
723
|
-
do{var t=new
|
|
723
|
+
do{var t=new wo(e.children.splice(e.children.length-5,5))
|
|
724
724
|
if(e.parent){e.size-=t.size,e.height-=t.height
|
|
725
725
|
var r=B(e.parent.children,e)
|
|
726
|
-
e.parent.children.splice(r+1,0,t)}else{var n=new
|
|
726
|
+
e.parent.children.splice(r+1,0,t)}else{var n=new wo(e.children)
|
|
727
727
|
n.parent=e,e.children=[n,t],e=n}t.parent=e.parent}while(e.children.length>10)
|
|
728
728
|
e.parent.maybeSpill()}},iterN:function(e,t,r){for(var n=0;n<this.children.length;++n){var i=this.children[n],o=i.chunkSize()
|
|
729
729
|
if(e<o){var a=Math.min(t,o-e)
|
|
730
730
|
if(i.iterN(e,a,r))return!0
|
|
731
731
|
if(0==(t-=a))break
|
|
732
732
|
e=0}else e-=o}}}
|
|
733
|
-
var
|
|
733
|
+
var xo=function(e,t,r){if(r)for(var n in r)r.hasOwnProperty(n)&&(this[n]=r[n])
|
|
734
734
|
this.doc=e,this.node=t}
|
|
735
|
-
function
|
|
735
|
+
function ko(e,t,r){Kt(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&On(e,r)}xo.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,r=this.line,n=Ye(r)
|
|
736
736
|
if(null!=n&&t){for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1)
|
|
737
737
|
t.length||(r.widgets=null)
|
|
738
|
-
var o=
|
|
739
|
-
|
|
738
|
+
var o=wr(this)
|
|
739
|
+
Xe(r,Math.max(0,r.height-o)),e&&(Jn(e,(function(){ko(e,r,-o),fn(e,n,"widget")})),lr(e,"lineWidgetCleared",e,this,n))}},xo.prototype.changed=function(){var e=this,t=this.height,r=this.doc.cm,n=this.line
|
|
740
740
|
this.height=null
|
|
741
|
-
var i=
|
|
742
|
-
i&&(
|
|
743
|
-
var
|
|
744
|
-
function
|
|
745
|
-
var o=[
|
|
746
|
-
return
|
|
741
|
+
var i=wr(this)-t
|
|
742
|
+
i&&(jt(this.doc,n)||Xe(n,n.height+i),r&&Jn(r,(function(){r.curOp.forceUpdate=!0,ko(r,n,i),lr(r,"lineWidgetChanged",r,e,Ye(n))})))},ye(xo)
|
|
743
|
+
var Co=0,So=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++Co}
|
|
744
|
+
function Lo(e,t,r,n,i){if(n&&n.shared)return function(e,t,r,n,i){(n=E(n)).shared=!1
|
|
745
|
+
var o=[Lo(e,t,r,n,i)],a=o[0],l=n.widgetNode
|
|
746
|
+
return Pi(e,(function(e){l&&(n.widgetNode=l.cloneNode(!0)),o.push(Lo(e,lt(e,t),lt(e,r),n,i))
|
|
747
747
|
for(var s=0;s<e.linked.length;++s)if(e.linked[s].isParent)return
|
|
748
|
-
a
|
|
749
|
-
if(e.cm&&!e.cm.curOp)return
|
|
750
|
-
var o=new
|
|
748
|
+
a=$(o)})),new To(o,a)}(e,t,r,n,i)
|
|
749
|
+
if(e.cm&&!e.cm.curOp)return ei(e.cm,Lo)(e,t,r,n,i)
|
|
750
|
+
var o=new So(e,i),a=tt(t,r)
|
|
751
751
|
if(n&&E(n,o,!1),a>0||0==a&&!1!==o.clearWhenEmpty)return o
|
|
752
|
-
if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=O("span",[o.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),n.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(
|
|
753
|
-
|
|
752
|
+
if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=O("span",[o.replacedWith],"CodeMirror-widget"),n.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),n.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(Et(e,t.line,t,r,o)||t.line!=r.line&&Et(e,r.line,t,r,o))throw new Error("Inserting collapsed marker partially overlapping an existing one")
|
|
753
|
+
kt=!0}o.addToHistory&&Bi(e,{from:t,to:r,origin:"markText"},e.sel,NaN)
|
|
754
754
|
var l,s=t.line,u=e.cm
|
|
755
|
-
if(e.iter(s,r.line+1,(function(e){u&&o.collapsed&&!u.options.lineWrapping&&
|
|
756
|
-
else if(o.className||o.startStyle||o.endStyle||o.css||o.attributes||o.title)for(var c=t.line;c<=r.line;c++)
|
|
757
|
-
o.atomic&&
|
|
755
|
+
if(e.iter(s,r.line+1,(function(e){u&&o.collapsed&&!u.options.lineWrapping&&Ft(e)==u.display.maxLine&&(l=!0),o.collapsed&&s!=t.line&&Xe(e,0),function(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}(e,new Ct(o,s==t.line?t.ch:null,s==r.line?r.ch:null)),++s})),o.collapsed&&e.iter(t.line,r.line+1,(function(t){jt(e,t)&&Xe(t,0)})),o.clearOnEnter&&de(o,"beforeCursorEnter",(function(){return o.clear()})),o.readOnly&&(xt=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++Co,o.atomic=!0),u){if(l&&(u.curOp.updateMaxLine=!0),o.collapsed)dn(u,t.line,r.line+1)
|
|
756
|
+
else if(o.className||o.startStyle||o.endStyle||o.css||o.attributes||o.title)for(var c=t.line;c<=r.line;c++)fn(u,c,"text")
|
|
757
|
+
o.atomic&&to(u.doc),lr(u,"markerAdded",u,o)}return o}So.prototype.clear=function(){var e=this
|
|
758
758
|
if(!this.explicitlyCleared){var t=this.doc.cm,r=t&&!t.curOp
|
|
759
|
-
if(r&&
|
|
760
|
-
n&&
|
|
761
|
-
t&&!e.collapsed?
|
|
762
|
-
d>t.display.maxLineLength&&(t.display.maxLine=c,t.display.maxLineLength=d,t.display.maxLineChanged=!0)}null!=i&&t&&this.collapsed&&
|
|
759
|
+
if(r&&qn(t),ve(this,"clear")){var n=this.find()
|
|
760
|
+
n&&lr(this,"clear",n.from,n.to)}for(var i=null,o=null,a=0;a<this.lines.length;++a){var l=e.lines[a],s=St(l.markedSpans,e)
|
|
761
|
+
t&&!e.collapsed?fn(t,Ye(l),"text"):t&&(null!=s.to&&(o=Ye(l)),null!=s.from&&(i=Ye(l))),l.markedSpans=Lt(l.markedSpans,s),null==s.from&&e.collapsed&&!jt(e.doc,l)&&t&&Xe(l,rn(t.display))}if(t&&this.collapsed&&!t.options.lineWrapping)for(var u=0;u<this.lines.length;++u){var c=Ft(e.lines[u]),d=Gt(c)
|
|
762
|
+
d>t.display.maxLineLength&&(t.display.maxLine=c,t.display.maxLineLength=d,t.display.maxLineChanged=!0)}null!=i&&t&&this.collapsed&&dn(t,i,o+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,t&&to(t.doc)),t&&lr(t,"markerCleared",t,this,i,o),r&&_n(t),this.parent&&this.parent.clear()}},So.prototype.find=function(e,t){var r,n
|
|
763
763
|
null==e&&"bookmark"==this.type&&(e=1)
|
|
764
|
-
for(var i=0;i<this.lines.length;++i){var o=this.lines[i],a=
|
|
765
|
-
if(null!=a.from&&(r=
|
|
766
|
-
if(null!=a.to&&(n=
|
|
767
|
-
t&&n&&
|
|
768
|
-
if(a&&(
|
|
764
|
+
for(var i=0;i<this.lines.length;++i){var o=this.lines[i],a=St(o.markedSpans,this)
|
|
765
|
+
if(null!=a.from&&(r=et(t?o:Ye(o),a.from),-1==e))return r
|
|
766
|
+
if(null!=a.to&&(n=et(t?o:Ye(o),a.to),1==e))return n}return r&&{from:r,to:n}},So.prototype.changed=function(){var e=this,t=this.find(-1,!0),r=this,n=this.doc.cm
|
|
767
|
+
t&&n&&Jn(n,(function(){var i=t.line,o=Ye(t.line),a=Or(n,o)
|
|
768
|
+
if(a&&(Er(a),n.curOp.selectionChanged=n.curOp.forceUpdate=!0),n.curOp.updateMaxLine=!0,!jt(r.doc,i)&&null!=r.height){var l=r.height
|
|
769
769
|
r.height=null
|
|
770
|
-
var s=
|
|
771
|
-
s&&
|
|
772
|
-
t.maybeHiddenMarkers&&-1!=B(t.maybeHiddenMarkers,this)||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},
|
|
773
|
-
var
|
|
770
|
+
var s=wr(r)-l
|
|
771
|
+
s&&Xe(i,i.height+s)}lr(n,"markerChanged",n,e)}))},So.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp
|
|
772
|
+
t.maybeHiddenMarkers&&-1!=B(t.maybeHiddenMarkers,this)||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},So.prototype.detachLine=function(e){if(this.lines.splice(B(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},ye(So)
|
|
773
|
+
var To=function(e,t){this.markers=e,this.primary=t
|
|
774
774
|
for(var r=0;r<e.length;++r)e[r].parent=this}
|
|
775
|
-
function
|
|
776
|
-
|
|
777
|
-
for(var i=0;i<r.markers.length;i++){var o=r.markers[i];-1==B(n,o.doc)&&(o.parent=null,r.markers.splice(i--,1))}},r=0;r<e.length;r++)t(r)}
|
|
775
|
+
function Mo(e){return e.findMarks(et(e.first,0),e.clipPos(et(e.lastLine())),(function(e){return e.parent}))}function No(e){for(var t=function(t){var r=e[t],n=[r.primary.doc]
|
|
776
|
+
Pi(r.primary.doc,(function(e){return n.push(e)}))
|
|
777
|
+
for(var i=0;i<r.markers.length;i++){var o=r.markers[i];-1==B(n,o.doc)&&(o.parent=null,r.markers.splice(i--,1))}},r=0;r<e.length;r++)t(r)}To.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0
|
|
778
778
|
for(var e=0;e<this.markers.length;++e)this.markers[e].clear()
|
|
779
|
-
|
|
780
|
-
var
|
|
781
|
-
null==r&&(r=0),
|
|
782
|
-
var o=
|
|
783
|
-
this.sel=
|
|
784
|
-
|
|
785
|
-
this.insertInner(e-this.first,t,r)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t
|
|
786
|
-
return!1===e?t:t.join(e||this.lineSeparator())},setValue:
|
|
787
|
-
|
|
779
|
+
lr(this,"clear")}},To.prototype.find=function(e,t){return this.primary.find(e,t)},ye(To)
|
|
780
|
+
var Ao=0,Oo=function(e,t,r,n,i){if(!(this instanceof Oo))return new Oo(e,t,r,n,i)
|
|
781
|
+
null==r&&(r=0),wo.call(this,[new bo([new qt("",null)])]),this.first=r,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=r
|
|
782
|
+
var o=et(r,0)
|
|
783
|
+
this.sel=Li(o),this.history=new Ei(null),this.id=++Ao,this.modeOption=t,this.lineSep=n,this.direction="rtl"==i?"rtl":"ltr",this.extend=!1,"string"==typeof e&&(e=this.splitLines(e)),zi(this,{from:o,to:o,text:e}),Qi(this,Li(o),V)}
|
|
784
|
+
Oo.prototype=Z(wo.prototype,{constructor:Oo,iter:function(e,t,r){r?this.iterN(e-this.first,t-e,r):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var r=0,n=0;n<t.length;++n)r+=t[n].height
|
|
785
|
+
this.insertInner(e-this.first,t,r)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=$e(this,this.first,this.first+this.size)
|
|
786
|
+
return!1===e?t:t.join(e||this.lineSeparator())},setValue:ri((function(e){var t=et(this.first,0),r=this.first+this.size-1
|
|
787
|
+
so(this,{from:t,to:et(r,qe(this,r).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&Dn(this.cm,0,0),Qi(this,Li(t),V)})),replaceRange:function(e,t,r,n){po(this,e,t=lt(this,t),r=r?lt(this,r):t,n)},getRange:function(e,t,r){var n=_e(this,lt(this,e),lt(this,t))
|
|
788
788
|
return!1===r?n:n.join(r||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e)
|
|
789
|
-
return t&&t.text},getLineHandle:function(e){if(
|
|
790
|
-
return null==e||"head"==e?t.head:"anchor"==e?t.anchor:"end"==e||"to"==e||!1===e?t.to():t.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:
|
|
791
|
-
null==t&&(t=Math.min(e.length-1,this.sel.primIndex)),
|
|
792
|
-
n.push(new
|
|
793
|
-
t=t?t.concat(i):i}return!1===e?t:t.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],r=this.sel.ranges,n=0;n<r.length;n++){var i
|
|
789
|
+
return t&&t.text},getLineHandle:function(e){if(Qe(this,e))return qe(this,e)},getLineNumber:function(e){return Ye(e)},getLineHandleVisualStart:function(e){return"number"==typeof e&&(e=qe(this,e)),Ft(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return lt(this,e)},getCursor:function(e){var t=this.sel.primary()
|
|
790
|
+
return null==e||"head"==e?t.head:"anchor"==e?t.anchor:"end"==e||"to"==e||!1===e?t.to():t.from()},listSelections:function(){return this.sel.ranges},somethingSelected:function(){return this.sel.somethingSelected()},setCursor:ri((function(e,t,r){Yi(this,lt(this,"number"==typeof e?et(e,t||0):e),null,r)})),setSelection:ri((function(e,t,r){Yi(this,lt(this,e),lt(this,t||e),r)})),extendSelection:ri((function(e,t,r){_i(this,lt(this,e),t&<(this,t),r)})),extendSelections:ri((function(e,t){$i(this,st(this,e),t)})),extendSelectionsBy:ri((function(e,t){$i(this,st(this,X(this.sel.ranges,e)),t)})),setSelections:ri((function(e,t,r){if(e.length){for(var n=[],i=0;i<e.length;i++)n[i]=new Ci(lt(this,e[i].anchor),lt(this,e[i].head))
|
|
791
|
+
null==t&&(t=Math.min(e.length-1,this.sel.primIndex)),Qi(this,Si(this.cm,n,t),r)}})),addSelection:ri((function(e,t,r){var n=this.sel.ranges.slice(0)
|
|
792
|
+
n.push(new Ci(lt(this,e),lt(this,t||e))),Qi(this,Si(this.cm,n,n.length-1),r)})),getSelection:function(e){for(var t,r=this.sel.ranges,n=0;n<r.length;n++){var i=_e(this,r[n].from(),r[n].to())
|
|
793
|
+
t=t?t.concat(i):i}return!1===e?t:t.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],r=this.sel.ranges,n=0;n<r.length;n++){var i=_e(this,r[n].from(),r[n].to())
|
|
794
794
|
!1!==e&&(i=i.join(e||this.lineSeparator())),t[n]=i}return t},replaceSelection:function(e,t,r){for(var n=[],i=0;i<this.sel.ranges.length;i++)n[i]=e
|
|
795
|
-
this.replaceSelections(n,t,r||"+input")},replaceSelections:
|
|
796
|
-
n[o]={from:a.from(),to:a.to(),text:this.splitLines(e[o]),origin:r}}for(var l=t&&"end"!=t&&function(e,t,r){for(var n=[],i=
|
|
797
|
-
if(i=l.to,o=u,"around"==r){var c=e.sel.ranges[a],d=
|
|
798
|
-
n[a]=new
|
|
799
|
-
l?
|
|
795
|
+
this.replaceSelections(n,t,r||"+input")},replaceSelections:ri((function(e,t,r){for(var n=[],i=this.sel,o=0;o<i.ranges.length;o++){var a=i.ranges[o]
|
|
796
|
+
n[o]={from:a.from(),to:a.to(),text:this.splitLines(e[o]),origin:r}}for(var l=t&&"end"!=t&&function(e,t,r){for(var n=[],i=et(e.first,0),o=i,a=0;a<t.length;a++){var l=t[a],s=Ai(l.from,i,o),u=Ai(Ti(l),i,o)
|
|
797
|
+
if(i=l.to,o=u,"around"==r){var c=e.sel.ranges[a],d=tt(c.head,c.anchor)<0
|
|
798
|
+
n[a]=new Ci(d?u:s,d?s:u)}else n[a]=new Ci(s,s)}return new ki(n,e.sel.primIndex)}(this,n,t),s=n.length-1;s>=0;s--)so(this,n[s])
|
|
799
|
+
l?Zi(this,l):this.cm&&Wn(this.cm)})),undo:ri((function(){co(this,"undo")})),redo:ri((function(){co(this,"redo")})),undoSelection:ri((function(){co(this,"undo",!0)})),redoSelection:ri((function(){co(this,"redo",!0)})),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,r=0,n=0;n<e.done.length;n++)e.done[n].ranges||++t
|
|
800
800
|
for(var i=0;i<e.undone.length;i++)e.undone[i].ranges||++r
|
|
801
|
-
return{undo:t,redo:r}},clearHistory:function(){this.history=new
|
|
802
|
-
t.done=
|
|
803
|
-
return n[t]=r,!r&&
|
|
804
|
-
this.iter((function(r){r.gutterMarkers&&r.gutterMarkers[e]&&
|
|
805
|
-
if("number"==typeof e){if(!
|
|
806
|
-
if(t=e,!(e=
|
|
807
|
-
return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:
|
|
801
|
+
return{undo:t,redo:r}},clearHistory:function(){this.history=new Ei(this.history.maxGeneration)},markClean:function(){this.cleanGeneration=this.changeGeneration(!0)},changeGeneration:function(e){return e&&(this.history.lastOp=this.history.lastSelOp=this.history.lastOrigin=null),this.history.generation},isClean:function(e){return this.history.generation==(e||this.cleanGeneration)},getHistory:function(){return{done:Ui(this.history.done),undone:Ui(this.history.undone)}},setHistory:function(e){var t=this.history=new Ei(this.history.maxGeneration)
|
|
802
|
+
t.done=Ui(e.done.slice(0),null,!0),t.undone=Ui(e.undone.slice(0),null,!0)},setGutterMarker:ri((function(e,t,r){return yo(this,e,"gutter",(function(e){var n=e.gutterMarkers||(e.gutterMarkers={})
|
|
803
|
+
return n[t]=r,!r&&te(n)&&(e.gutterMarkers=null),!0}))})),clearGutter:ri((function(e){var t=this
|
|
804
|
+
this.iter((function(r){r.gutterMarkers&&r.gutterMarkers[e]&&yo(t,r,"gutter",(function(){return r.gutterMarkers[e]=null,te(r.gutterMarkers)&&(r.gutterMarkers=null),!0}))}))})),lineInfo:function(e){var t
|
|
805
|
+
if("number"==typeof e){if(!Qe(this,e))return null
|
|
806
|
+
if(t=e,!(e=qe(this,e)))return null}else if(null==(t=Ye(e)))return null
|
|
807
|
+
return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:ri((function(e,t,r){return yo(this,e,"gutter"==t?"gutter":"class",(function(e){var n="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass"
|
|
808
808
|
if(e[n]){if(S(r).test(e[n]))return!1
|
|
809
809
|
e[n]+=" "+r}else e[n]=r
|
|
810
|
-
return!0}))})),removeLineClass:
|
|
810
|
+
return!0}))})),removeLineClass:ri((function(e,t,r){return yo(this,e,"gutter"==t?"gutter":"class",(function(e){var n="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass",i=e[n]
|
|
811
811
|
if(!i)return!1
|
|
812
812
|
if(null==r)e[n]=null
|
|
813
813
|
else{var o=i.match(S(r))
|
|
814
814
|
if(!o)return!1
|
|
815
815
|
var a=o.index+o[0].length
|
|
816
|
-
e[n]=i.slice(0,o.index)+(o.index&&a!=i.length?" ":"")+i.slice(a)||null}return!0}))})),addLineWidget:
|
|
817
|
-
return o&&i.noHScroll&&(o.display.alignWidgets=!0),
|
|
818
|
-
if(null==i.insertAt?r.push(i):r.splice(Math.min(r.length-1,Math.max(0,i.insertAt)),0,i),i.line=t,o&&!
|
|
819
|
-
|
|
820
|
-
return
|
|
821
|
-
if(r)for(var n=0;n<r.length;++n){var i=r[n];(null==i.from||i.from<=e.ch)&&(null==i.to||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,r){e=
|
|
816
|
+
e[n]=i.slice(0,o.index)+(o.index&&a!=i.length?" ":"")+i.slice(a)||null}return!0}))})),addLineWidget:ri((function(e,t,r){return function(e,t,r,n){var i=new xo(e,r,n),o=e.cm
|
|
817
|
+
return o&&i.noHScroll&&(o.display.alignWidgets=!0),yo(e,t,"widget",(function(t){var r=t.widgets||(t.widgets=[])
|
|
818
|
+
if(null==i.insertAt?r.push(i):r.splice(Math.min(r.length-1,Math.max(0,i.insertAt)),0,i),i.line=t,o&&!jt(e,t)){var n=Kt(t)<e.scrollTop
|
|
819
|
+
Xe(t,t.height+wr(i)),n&&On(o,i.height),o.curOp.forceUpdate=!0}return!0})),o&&lr(o,"lineWidgetAdded",o,i,"number"==typeof t?t:Ye(t)),i}(this,e,t,r)})),removeLineWidget:function(e){e.clear()},markText:function(e,t,r){return Lo(this,lt(this,e),lt(this,t),r,r&&r.type||"range")},setBookmark:function(e,t){var r={replacedWith:t&&(null==t.nodeType?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents}
|
|
820
|
+
return Lo(this,e=lt(this,e),e,r,"bookmark")},findMarksAt:function(e){var t=[],r=qe(this,(e=lt(this,e)).line).markedSpans
|
|
821
|
+
if(r)for(var n=0;n<r.length;++n){var i=r[n];(null==i.from||i.from<=e.ch)&&(null==i.to||i.to>=e.ch)&&t.push(i.marker.parent||i.marker)}return t},findMarks:function(e,t,r){e=lt(this,e),t=lt(this,t)
|
|
822
822
|
var n=[],i=e.line
|
|
823
823
|
return this.iter(e.line,t.line+1,(function(o){var a=o.markedSpans
|
|
824
824
|
if(a)for(var l=0;l<a.length;l++){var s=a[l]
|
|
@@ -827,392 +827,392 @@ return this.iter((function(t){var r=t.markedSpans
|
|
|
827
827
|
if(r)for(var n=0;n<r.length;++n)null!=r[n].from&&e.push(r[n].marker)})),e},posFromIndex:function(e){var t,r=this.first,n=this.lineSeparator().length
|
|
828
828
|
return this.iter((function(i){var o=i.text.length+n
|
|
829
829
|
if(o>e)return t=e,!0
|
|
830
|
-
e-=o,++r})),
|
|
830
|
+
e-=o,++r})),lt(this,et(r,t))},indexFromPos:function(e){var t=(e=lt(this,e)).ch
|
|
831
831
|
if(e.line<this.first||e.ch<0)return 0
|
|
832
832
|
var r=this.lineSeparator().length
|
|
833
|
-
return this.iter(this.first,e.line,(function(e){t+=e.text.length+r})),t},copy:function(e){var t=new
|
|
833
|
+
return this.iter(this.first,e.line,(function(e){t+=e.text.length+r})),t},copy:function(e){var t=new Oo($e(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction)
|
|
834
834
|
return t.scrollTop=this.scrollTop,t.scrollLeft=this.scrollLeft,t.sel=this.sel,t.extend=!1,e&&(t.history.undoDepth=this.history.undoDepth,t.setHistory(this.getHistory())),t},linkedDoc:function(e){e||(e={})
|
|
835
835
|
var t=this.first,r=this.first+this.size
|
|
836
836
|
null!=e.from&&e.from>t&&(t=e.from),null!=e.to&&e.to<r&&(r=e.to)
|
|
837
|
-
var n=new
|
|
837
|
+
var n=new Oo($e(this,t,r),e.mode||this.modeOption,t,this.lineSep,this.direction)
|
|
838
838
|
return e.sharedHist&&(n.history=this.history),(this.linked||(this.linked=[])).push({doc:n,sharedHist:e.sharedHist}),n.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],function(e,t){for(var r=0;r<t.length;r++){var n=t[r],i=n.find(),o=e.clipPos(i.from),a=e.clipPos(i.to)
|
|
839
|
-
if(
|
|
840
|
-
n.markers.push(l),l.parent=n}}}(n,
|
|
841
|
-
if(e instanceof
|
|
839
|
+
if(tt(o,a)){var l=Lo(e,o,a,n.primary,n.primary.type)
|
|
840
|
+
n.markers.push(l),l.parent=n}}}(n,Mo(this)),n},unlinkDoc:function(e){var t=this
|
|
841
|
+
if(e instanceof Sa&&(e=e.doc),this.linked)for(var r=0;r<this.linked.length;++r)if(t.linked[r].doc==e){t.linked.splice(r,1),e.unlinkDoc(t),No(Mo(t))
|
|
842
842
|
break}if(e.history==this.history){var n=[e.id]
|
|
843
|
-
|
|
844
|
-
"rtl"!=e&&(e="ltr"),e!=this.direction&&(this.direction=e,this.iter((function(e){return e.order=null})),this.cm&&
|
|
845
|
-
var
|
|
846
|
-
function
|
|
847
|
-
if(
|
|
848
|
-
var r=
|
|
843
|
+
Pi(e,(function(e){return n.push(e.id)}),!0),e.history=new Ei(null),e.history.done=Ui(this.history.done,n),e.history.undone=Ui(this.history.undone,n)}},iterLinkedDocs:function(e){Pi(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):We(e)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:ri((function(e){var t
|
|
844
|
+
"rtl"!=e&&(e="ltr"),e!=this.direction&&(this.direction=e,this.iter((function(e){return e.order=null})),this.cm&&Jn(t=this.cm,(function(){Ii(t),dn(t)})))}))}),Oo.prototype.eachLine=Oo.prototype.iter
|
|
845
|
+
var Wo=0
|
|
846
|
+
function Do(e){var t=this
|
|
847
|
+
if(zo(t),!ge(t,e)&&!xr(t.display,e)){be(e),a&&(Wo=+new Date)
|
|
848
|
+
var r=un(t,e,!0),n=e.dataTransfer.files
|
|
849
849
|
if(r&&!t.isReadOnly())if(n&&n.length&&window.FileReader&&window.File)for(var i=n.length,o=Array(i),l=0,s=function(e,n){if(!t.options.allowDropFileTypes||-1!=B(t.options.allowDropFileTypes,e.type)){var a=new FileReader
|
|
850
|
-
a.onload=
|
|
851
|
-
if(/[\x00-\x08\x0e-\x1f]{2}/.test(e)&&(e=""),o[n]=e,++l==i){var s={from:r=
|
|
852
|
-
|
|
850
|
+
a.onload=ei(t,(function(){var e=a.result
|
|
851
|
+
if(/[\x00-\x08\x0e-\x1f]{2}/.test(e)&&(e=""),o[n]=e,++l==i){var s={from:r=lt(t.doc,r),to:r,text:t.doc.splitLines(o.join(t.doc.lineSeparator())),origin:"paste"}
|
|
852
|
+
so(t.doc,s),Zi(t.doc,Li(r,Ti(s)))}})),a.readAsText(e)}},u=0;u<i;++u)s(n[u],u)
|
|
853
853
|
else{if(t.state.draggingText&&t.doc.sel.contains(r)>-1)return t.state.draggingText(e),void setTimeout((function(){return t.display.input.focus()}),20)
|
|
854
854
|
try{var c=e.dataTransfer.getData("Text")
|
|
855
855
|
if(c){var d
|
|
856
|
-
if(t.state.draggingText&&!t.state.draggingText.copy&&(d=t.listSelections()),
|
|
857
|
-
t.replaceSelection(c,"around","paste"),t.display.input.focus()}}catch(e){}}}}function
|
|
858
|
-
i&&r.push(i)}r.length&&r[0].operation((function(){for(var t=0;t<r.length;t++)e(r[t])}))}}var
|
|
859
|
-
function
|
|
860
|
-
t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var
|
|
861
|
-
for(var
|
|
862
|
-
for(var
|
|
863
|
-
var
|
|
864
|
-
function
|
|
856
|
+
if(t.state.draggingText&&!t.state.draggingText.copy&&(d=t.listSelections()),Ji(t.doc,Li(r,r)),d)for(var f=0;f<d.length;++f)po(t.doc,"",d[f].anchor,d[f].head,"drag")
|
|
857
|
+
t.replaceSelection(c,"around","paste"),t.display.input.focus()}}catch(e){}}}}function zo(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function Po(e){if(document.getElementsByClassName){for(var t=document.getElementsByClassName("CodeMirror"),r=[],n=0;n<t.length;n++){var i=t[n].CodeMirror
|
|
858
|
+
i&&r.push(i)}r.length&&r[0].operation((function(){for(var t=0;t<r.length;t++)e(r[t])}))}}var Ho=!1
|
|
859
|
+
function Io(e){var t=e.display
|
|
860
|
+
t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Eo={3:"Pause",8:"Backspace",9:"Tab",13:"Enter",16:"Shift",17:"Ctrl",18:"Alt",19:"Pause",20:"CapsLock",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"PrintScrn",45:"Insert",46:"Delete",59:";",61:"=",91:"Mod",92:"Mod",93:"Mod",106:"*",107:"=",109:"-",110:".",111:"/",145:"ScrollLock",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",63232:"Up",63233:"Down",63234:"Left",63235:"Right",63272:"Delete",63273:"Home",63275:"End",63276:"PageUp",63277:"PageDown",63302:"Insert"},Fo=0;Fo<10;Fo++)Eo[Fo+48]=Eo[Fo+96]=String(Fo)
|
|
861
|
+
for(var Ro=65;Ro<=90;Ro++)Eo[Ro]=String.fromCharCode(Ro)
|
|
862
|
+
for(var Bo=1;Bo<=12;Bo++)Eo[Bo+111]=Eo[Bo+63235]="F"+Bo
|
|
863
|
+
var jo={}
|
|
864
|
+
function Vo(e){var t,r,n,i,o=e.split(/-(?!$)/)
|
|
865
865
|
e=o[o.length-1]
|
|
866
866
|
for(var a=0;a<o.length-1;a++){var l=o[a]
|
|
867
867
|
if(/^(cmd|meta|m)$/i.test(l))i=!0
|
|
868
868
|
else if(/^a(lt)?$/i.test(l))t=!0
|
|
869
869
|
else if(/^(c|ctrl|control)$/i.test(l))r=!0
|
|
870
870
|
else{if(!/^s(hift)?$/i.test(l))throw new Error("Unrecognized modifier name: "+l)
|
|
871
|
-
n=!0}}return t&&(e="Alt-"+e),r&&(e="Ctrl-"+e),i&&(e="Cmd-"+e),n&&(e="Shift-"+e),e}function
|
|
871
|
+
n=!0}}return t&&(e="Alt-"+e),r&&(e="Ctrl-"+e),i&&(e="Cmd-"+e),n&&(e="Shift-"+e),e}function Ko(e){var t={}
|
|
872
872
|
for(var r in e)if(e.hasOwnProperty(r)){var n=e[r]
|
|
873
873
|
if(/^(name|fallthrough|(de|at)tach)$/.test(r))continue
|
|
874
874
|
if("..."==n){delete e[r]
|
|
875
|
-
continue}for(var i=
|
|
875
|
+
continue}for(var i=X(r.split(" "),Vo),o=0;o<i.length;o++){var a=void 0,l=void 0
|
|
876
876
|
o==i.length-1?(l=i.join(" "),a=n):(l=i.slice(0,o+1).join(" "),a="...")
|
|
877
877
|
var s=t[l]
|
|
878
878
|
if(s){if(s!=a)throw new Error("Inconsistent bindings for "+l)}else t[l]=a}delete e[r]}for(var u in t)e[u]=t[u]
|
|
879
|
-
return e}function
|
|
879
|
+
return e}function Go(e,t,r,n){var i=(t=$o(t)).call?t.call(e,n):t[e]
|
|
880
880
|
if(!1===i)return"nothing"
|
|
881
881
|
if("..."===i)return"multi"
|
|
882
882
|
if(null!=i&&r(i))return"handled"
|
|
883
|
-
if(t.fallthrough){if("[object Array]"!=Object.prototype.toString.call(t.fallthrough))return
|
|
884
|
-
for(var o=0;o<t.fallthrough.length;o++){var a=
|
|
885
|
-
if(a)return a}}}function
|
|
886
|
-
return"Ctrl"==t||"Alt"==t||"Shift"==t||"Mod"==t}function
|
|
887
|
-
return t.altKey&&"Alt"!=n&&(e="Alt-"+e),(k?t.metaKey:t.ctrlKey)&&"Ctrl"!=n&&(e="Ctrl-"+e),(k?t.ctrlKey:t.metaKey)&&"Cmd"!=n&&(e="Cmd-"+e),!r&&t.shiftKey&&"Shift"!=n&&(e="Shift-"+e),e}function
|
|
888
|
-
var r=
|
|
889
|
-
return null!=r&&!e.altGraphKey&&(3==e.keyCode&&e.code&&(r=e.code),
|
|
890
|
-
if(
|
|
891
|
-
break}}n.push(o)}
|
|
892
|
-
|
|
893
|
-
return n<0||n>e.text.length?null:n}function
|
|
894
|
-
return null==n?null:new
|
|
895
|
-
if(o){var a,l=i<0
|
|
896
|
-
if(l.level>0||"rtl"==t.doc.direction){var u=
|
|
883
|
+
if(t.fallthrough){if("[object Array]"!=Object.prototype.toString.call(t.fallthrough))return Go(e,t.fallthrough,r,n)
|
|
884
|
+
for(var o=0;o<t.fallthrough.length;o++){var a=Go(e,t.fallthrough[o],r,n)
|
|
885
|
+
if(a)return a}}}function Uo(e){var t="string"==typeof e?e:Eo[e.keyCode]
|
|
886
|
+
return"Ctrl"==t||"Alt"==t||"Shift"==t||"Mod"==t}function qo(e,t,r){var n=e
|
|
887
|
+
return t.altKey&&"Alt"!=n&&(e="Alt-"+e),(k?t.metaKey:t.ctrlKey)&&"Ctrl"!=n&&(e="Ctrl-"+e),(k?t.ctrlKey:t.metaKey)&&"Cmd"!=n&&(e="Cmd-"+e),!r&&t.shiftKey&&"Shift"!=n&&(e="Shift-"+e),e}function _o(e,t){if(d&&34==e.keyCode&&e.char)return!1
|
|
888
|
+
var r=Eo[e.keyCode]
|
|
889
|
+
return null!=r&&!e.altGraphKey&&(3==e.keyCode&&e.code&&(r=e.code),qo(r,e,t))}function $o(e){return"string"==typeof e?jo[e]:e}function Xo(e,t){for(var r=e.doc.sel.ranges,n=[],i=0;i<r.length;i++){for(var o=t(r[i]);n.length&&tt(o.from,$(n).to)<=0;){var a=n.pop()
|
|
890
|
+
if(tt(a.from,o.from)<0){o.from=a.from
|
|
891
|
+
break}}n.push(o)}Jn(e,(function(){for(var t=n.length-1;t>=0;t--)po(e.doc,"",n[t].from,n[t].to,"+delete")
|
|
892
|
+
Wn(e)}))}function Yo(e,t,r){var n=ie(e.text,t+r,r)
|
|
893
|
+
return n<0||n>e.text.length?null:n}function Zo(e,t,r){var n=Yo(e,t.ch,r)
|
|
894
|
+
return null==n?null:new et(t.line,n,r<0?"after":"before")}function Qo(e,t,r,n,i){if(e){var o=ue(r,t.doc.direction)
|
|
895
|
+
if(o){var a,l=i<0?$(o):o[0],s=i<0==(1==l.level)?"after":"before"
|
|
896
|
+
if(l.level>0||"rtl"==t.doc.direction){var u=Wr(t,r)
|
|
897
897
|
a=i<0?r.text.length-1:0
|
|
898
|
-
var c=
|
|
899
|
-
a=
|
|
900
|
-
return new
|
|
901
|
-
var
|
|
902
|
-
return t.head.ch==r&&t.head.line<e.lastLine()?{from:t.head,to:
|
|
903
|
-
return{from:e.coordsChar({left:0,top:r},"div"),to:t.from()}}))},delWrappedLineRight:function(e){return
|
|
904
|
-
return{from:t.from(),to:n}}))},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(
|
|
898
|
+
var c=Dr(t,u,a).top
|
|
899
|
+
a=oe((function(e){return Dr(t,u,e).top==c}),i<0==(1==l.level)?l.from:l.to-1,a),"before"==s&&(a=Yo(r,a,1))}else a=i<0?l.to:l.from
|
|
900
|
+
return new et(n,a,s)}}return new et(n,i<0?r.text.length:0,i<0?"before":"after")}jo.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},jo.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},jo.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},jo.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},jo.default=y?jo.macDefault:jo.pcDefault
|
|
901
|
+
var Jo={selectAll:ao,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),V)},killLine:function(e){return Xo(e,(function(t){if(t.empty()){var r=qe(e.doc,t.head.line).text.length
|
|
902
|
+
return t.head.ch==r&&t.head.line<e.lastLine()?{from:t.head,to:et(t.head.line+1,0)}:{from:t.head,to:et(t.head.line,r)}}return{from:t.from(),to:t.to()}}))},deleteLine:function(e){return Xo(e,(function(t){return{from:et(t.from().line,0),to:lt(e.doc,et(t.to().line+1,0))}}))},delLineLeft:function(e){return Xo(e,(function(e){return{from:et(e.from().line,0),to:e.from()}}))},delWrappedLineLeft:function(e){return Xo(e,(function(t){var r=e.charCoords(t.head,"div").top+5
|
|
903
|
+
return{from:e.coordsChar({left:0,top:r},"div"),to:t.from()}}))},delWrappedLineRight:function(e){return Xo(e,(function(t){var r=e.charCoords(t.head,"div").top+5,n=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div")
|
|
904
|
+
return{from:t.from(),to:n}}))},undo:function(e){return e.undo()},redo:function(e){return e.redo()},undoSelection:function(e){return e.undoSelection()},redoSelection:function(e){return e.redoSelection()},goDocStart:function(e){return e.extendSelection(et(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(et(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy((function(t){return ea(e,t.head.line)}),{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy((function(t){return ta(e,t.head)}),{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy((function(t){return function(e,t){var r=qe(e.doc,t),n=function(e){for(var t;t=Ht(e);)e=t.find(1,!0).line
|
|
905
905
|
return e}(r)
|
|
906
|
-
return n!=r&&(t=
|
|
907
|
-
return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div")}),
|
|
908
|
-
return e.coordsChar({left:0,top:r},"div")}),
|
|
909
|
-
return n.ch<e.getLine(n.line).search(/\S/)?
|
|
910
|
-
t.push(
|
|
911
|
-
if(o)if(i.ch==o.length&&(i=new
|
|
912
|
-
else if(i.line>e.doc.first){var a=
|
|
913
|
-
a&&(i=new
|
|
906
|
+
return n!=r&&(t=Ye(n)),Qo(!0,e,r,t,-1)}(e,t.head.line)}),{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy((function(t){var r=e.cursorCoords(t.head,"div").top+5
|
|
907
|
+
return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:r},"div")}),G)},goLineLeft:function(e){return e.extendSelectionsBy((function(t){var r=e.cursorCoords(t.head,"div").top+5
|
|
908
|
+
return e.coordsChar({left:0,top:r},"div")}),G)},goLineLeftSmart:function(e){return e.extendSelectionsBy((function(t){var r=e.cursorCoords(t.head,"div").top+5,n=e.coordsChar({left:0,top:r},"div")
|
|
909
|
+
return n.ch<e.getLine(n.line).search(/\S/)?ta(e,t.head):n}),G)},goLineUp:function(e){return e.moveV(-1,"line")},goLineDown:function(e){return e.moveV(1,"line")},goPageUp:function(e){return e.moveV(-1,"page")},goPageDown:function(e){return e.moveV(1,"page")},goCharLeft:function(e){return e.moveH(-1,"char")},goCharRight:function(e){return e.moveH(1,"char")},goColumnLeft:function(e){return e.moveH(-1,"column")},goColumnRight:function(e){return e.moveH(1,"column")},goWordLeft:function(e){return e.moveH(-1,"word")},goGroupRight:function(e){return e.moveH(1,"group")},goGroupLeft:function(e){return e.moveH(-1,"group")},goWordRight:function(e){return e.moveH(1,"word")},delCharBefore:function(e){return e.deleteH(-1,"char")},delCharAfter:function(e){return e.deleteH(1,"char")},delWordBefore:function(e){return e.deleteH(-1,"word")},delWordAfter:function(e){return e.deleteH(1,"word")},delGroupBefore:function(e){return e.deleteH(-1,"group")},delGroupAfter:function(e){return e.deleteH(1,"group")},indentAuto:function(e){return e.indentSelection("smart")},indentMore:function(e){return e.indentSelection("add")},indentLess:function(e){return e.indentSelection("subtract")},insertTab:function(e){return e.replaceSelection("\t")},insertSoftTab:function(e){for(var t=[],r=e.listSelections(),n=e.options.tabSize,i=0;i<r.length;i++){var o=r[i].from(),a=F(e.getLine(o.line),o.ch,n)
|
|
910
|
+
t.push(_(n-a%n))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return Jn(e,(function(){for(var t=e.listSelections(),r=[],n=0;n<t.length;n++)if(t[n].empty()){var i=t[n].head,o=qe(e.doc,i.line).text
|
|
911
|
+
if(o)if(i.ch==o.length&&(i=new et(i.line,i.ch-1)),i.ch>0)i=new et(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),et(i.line,i.ch-2),i,"+transpose")
|
|
912
|
+
else if(i.line>e.doc.first){var a=qe(e.doc,i.line-1).text
|
|
913
|
+
a&&(i=new et(i.line,1),e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+a.charAt(a.length-1),et(i.line-1,a.length-1),i,"+transpose"))}r.push(new Ci(i,i))}e.setSelections(r)}))},newlineAndIndent:function(e){return Jn(e,(function(){for(var t=e.listSelections(),r=t.length-1;r>=0;r--)e.replaceRange(e.doc.lineSeparator(),t[r].anchor,t[r].head,"+input")
|
|
914
914
|
t=e.listSelections()
|
|
915
915
|
for(var n=0;n<t.length;n++)e.indentLine(t[n].from().line,null,!0)
|
|
916
|
-
|
|
917
|
-
function
|
|
918
|
-
return n!=r&&(t=
|
|
916
|
+
Wn(e)}))},openLine:function(e){return e.replaceSelection("\n","start")},toggleOverwrite:function(e){return e.toggleOverwrite()}}
|
|
917
|
+
function ea(e,t){var r=qe(e.doc,t),n=Ft(r)
|
|
918
|
+
return n!=r&&(t=Ye(n)),Qo(!0,e,n,t,1)}function ta(e,t){var r=ea(e,t.line),n=qe(e.doc,r.line),i=ue(n,e.doc.direction)
|
|
919
919
|
if(!i||0==i[0].level){var o=Math.max(0,n.text.search(/\S/)),a=t.line==r.line&&t.ch<=o&&t.ch
|
|
920
|
-
return
|
|
920
|
+
return et(r.line,a?0:o,r.sticky)}return r}function ra(e,t,r){if("string"==typeof t&&!(t=Jo[t]))return!1
|
|
921
921
|
e.display.input.ensurePolled()
|
|
922
922
|
var n=e.display.shift,i=!1
|
|
923
|
-
try{e.isReadOnly()&&(e.state.suppressEdits=!0),r&&(e.display.shift=!1),i=t(e)!=
|
|
924
|
-
function
|
|
925
|
-
if(i){if(
|
|
926
|
-
if(/\'$/.test(t)?e.state.keySeq=null:
|
|
927
|
-
if(i)return i}return e.options.extraKeys&&
|
|
928
|
-
return"multi"==i&&(e.state.keySeq=t),"handled"==i&&
|
|
929
|
-
return!!r&&(t.shiftKey&&!e.state.keySeq?
|
|
930
|
-
function
|
|
931
|
-
if(t.curOp.focus=D(),!
|
|
923
|
+
try{e.isReadOnly()&&(e.state.suppressEdits=!0),r&&(e.display.shift=!1),i=t(e)!=j}finally{e.display.shift=n,e.state.suppressEdits=!1}return i}var na=new R
|
|
924
|
+
function ia(e,t,r,n){var i=e.state.keySeq
|
|
925
|
+
if(i){if(Uo(t))return"handled"
|
|
926
|
+
if(/\'$/.test(t)?e.state.keySeq=null:na.set(50,(function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())})),oa(e,i+" "+t,r,n))return!0}return oa(e,t,r,n)}function oa(e,t,r,n){var i=function(e,t,r){for(var n=0;n<e.state.keyMaps.length;n++){var i=Go(t,e.state.keyMaps[n],r,e)
|
|
927
|
+
if(i)return i}return e.options.extraKeys&&Go(t,e.options.extraKeys,r,e)||Go(t,e.options.keyMap,r,e)}(e,t,n)
|
|
928
|
+
return"multi"==i&&(e.state.keySeq=t),"handled"==i&&lr(e,"keyHandled",e,t,r),"handled"!=i&&"multi"!=i||(be(r),xn(e)),!!i}function aa(e,t){var r=_o(t,!0)
|
|
929
|
+
return!!r&&(t.shiftKey&&!e.state.keySeq?ia(e,"Shift-"+r,t,(function(t){return ra(e,t,!0)}))||ia(e,r,t,(function(t){if("string"==typeof t?/^go[A-Z]/.test(t):t.motion)return ra(e,t)})):ia(e,r,t,(function(t){return ra(e,t)})))}var la=null
|
|
930
|
+
function sa(e){var t=this
|
|
931
|
+
if(t.curOp.focus=D(),!ge(t,e)){a&&l<11&&27==e.keyCode&&(e.returnValue=!1)
|
|
932
932
|
var r=e.keyCode
|
|
933
933
|
t.display.shift=16==r||e.shiftKey
|
|
934
|
-
var n=
|
|
935
|
-
d&&(
|
|
936
|
-
function r(e){18!=e.keyCode&&e.altKey||(T(t,"CodeMirror-crosshair"),
|
|
937
|
-
if(!(
|
|
938
|
-
if(d&&r==
|
|
939
|
-
if(!d||e.which&&!(e.which<10)||!
|
|
940
|
-
"\b"!=i&&(function(e,t,r){return
|
|
941
|
-
function
|
|
942
|
-
if(!(
|
|
943
|
-
else if(!
|
|
944
|
-
return
|
|
934
|
+
var n=aa(t,e)
|
|
935
|
+
d&&(la=n?r:null,n||88!=r||ze||!(y?e.metaKey:e.ctrlKey)||t.replaceSelection("",null,"cut")),18!=r||/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)||function(e){var t=e.display.lineDiv
|
|
936
|
+
function r(e){18!=e.keyCode&&e.altKey||(T(t,"CodeMirror-crosshair"),he(document,"keyup",r),he(document,"mouseover",r))}z(t,"CodeMirror-crosshair"),de(document,"keyup",r),de(document,"mouseover",r)}(t)}}function ua(e){16==e.keyCode&&(this.doc.sel.shift=!1),ge(this,e)}function ca(e){var t=this
|
|
937
|
+
if(!(xr(t.display,e)||ge(t,e)||e.ctrlKey&&!e.altKey||y&&e.metaKey)){var r=e.keyCode,n=e.charCode
|
|
938
|
+
if(d&&r==la)return la=null,void be(e)
|
|
939
|
+
if(!d||e.which&&!(e.which<10)||!aa(t,e)){var i=String.fromCharCode(null==n?r:n)
|
|
940
|
+
"\b"!=i&&(function(e,t,r){return ia(e,"'"+r+"'",t,(function(t){return ra(e,t,!0)}))}(t,e,i)||t.display.input.onKeyPress(e))}}}var da,fa,ha=function(e,t,r){this.time=e,this.pos=t,this.button=r}
|
|
941
|
+
function pa(e){var t=this,r=t.display
|
|
942
|
+
if(!(ge(t,e)||r.activeTouch&&r.input.supportsTouch()))if(r.input.ensurePolled(),r.shift=e.shiftKey,xr(r,e))s||(r.scroller.draggable=!1,setTimeout((function(){return r.scroller.draggable=!0}),100))
|
|
943
|
+
else if(!va(t,e)){var n=un(t,e),i=Se(e),o=n?function(e,t){var r=+new Date
|
|
944
|
+
return fa&&fa.compare(r,e,t)?(da=fa=null,"triple"):da&&da.compare(r,e,t)?(fa=new ha(r,e,t),da=null,"double"):(da=new ha(r,e,t),fa=null,"single")}(n,i):"single"
|
|
945
945
|
window.focus(),1==i&&t.state.selectingText&&t.state.selectingText(e),n&&function(e,t,r,n,i){var o="Click"
|
|
946
|
-
return"double"==n?o="Double"+o:"triple"==n&&(o="Triple"+o),
|
|
946
|
+
return"double"==n?o="Double"+o:"triple"==n&&(o="Triple"+o),ia(e,qo(o=(1==t?"Left":2==t?"Middle":"Right")+o,i),i,(function(t){if("string"==typeof t&&(t=Jo[t]),!t)return!1
|
|
947
947
|
var n=!1
|
|
948
|
-
try{e.isReadOnly()&&(e.state.suppressEdits=!0),n=t(e,r)!=
|
|
948
|
+
try{e.isReadOnly()&&(e.state.suppressEdits=!0),n=t(e,r)!=j}finally{e.state.suppressEdits=!1}return n}))}(t,i,n,o,e)||(1==i?n?function(e,t,r,n){a?setTimeout(I(kn,e),0):e.curOp.focus=D()
|
|
949
949
|
var i,o=function(e,t,r){var n=e.getOption("configureMouse"),i=n?n(e,t,r):{}
|
|
950
950
|
if(null==i.unit){var o=b?r.shiftKey&&r.metaKey:r.altKey
|
|
951
951
|
i.unit=o?"rectangle":"single"==t?"char":"double"==t?"word":"line"}return(null==i.extend||e.doc.extend)&&(i.extend=e.doc.extend||r.shiftKey),null==i.addNew&&(i.addNew=y?r.metaKey:r.ctrlKey),null==i.moveOnDrag&&(i.moveOnDrag=!(y?r.altKey:r.ctrlKey)),i}(e,r,n),u=e.doc.sel
|
|
952
|
-
e.options.dragDrop&&
|
|
953
|
-
s&&(i.scroller.draggable=!0),e.state.draggingText=u,u.copy=!n.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),
|
|
954
|
-
|
|
952
|
+
e.options.dragDrop&&Me&&!e.isReadOnly()&&"single"==r&&(i=u.contains(t))>-1&&(tt((i=u.ranges[i]).from(),t)<0||t.xRel>0)&&(tt(i.to(),t)>0||t.xRel<0)?function(e,t,r,n){var i=e.display,o=!1,u=ei(e,(function(t){s&&(i.scroller.draggable=!1),e.state.draggingText=!1,he(i.wrapper.ownerDocument,"mouseup",u),he(i.wrapper.ownerDocument,"mousemove",c),he(i.scroller,"dragstart",d),he(i.scroller,"drop",u),o||(be(t),n.addNew||_i(e.doc,r,null,null,n.extend),s||a&&9==l?setTimeout((function(){i.wrapper.ownerDocument.body.focus(),i.input.focus()}),20):i.input.focus())})),c=function(e){o=o||Math.abs(t.clientX-e.clientX)+Math.abs(t.clientY-e.clientY)>=10},d=function(){return o=!0}
|
|
953
|
+
s&&(i.scroller.draggable=!0),e.state.draggingText=u,u.copy=!n.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),de(i.wrapper.ownerDocument,"mouseup",u),de(i.wrapper.ownerDocument,"mousemove",c),de(i.scroller,"dragstart",d),de(i.scroller,"drop",u),Cn(e),setTimeout((function(){return i.input.focus()}),20)}(e,n,t,o):function(e,t,r,n){var i=e.display,o=e.doc
|
|
954
|
+
be(t)
|
|
955
955
|
var a,l,s=o.sel,u=s.ranges
|
|
956
|
-
if(n.addNew&&!n.extend?(l=o.sel.contains(r),a=l>-1?u[l]:new
|
|
957
|
-
else{var c=
|
|
958
|
-
a=n.extend?
|
|
956
|
+
if(n.addNew&&!n.extend?(l=o.sel.contains(r),a=l>-1?u[l]:new Ci(r,r)):(a=o.sel.primary(),l=o.sel.primIndex),"rectangle"==n.unit)n.addNew||(a=new Ci(r,r)),r=un(e,t,!0,!0),l=-1
|
|
957
|
+
else{var c=ga(e,r,n.unit)
|
|
958
|
+
a=n.extend?qi(a,c.anchor,c.head,n.extend):c}n.addNew?-1==l?(l=u.length,Qi(o,Si(e,u.concat([a]),l),{scroll:!1,origin:"*mouse"})):u.length>1&&u[l].empty()&&"char"==n.unit&&!n.extend?(Qi(o,Si(e,u.slice(0,l).concat(u.slice(l+1)),0),{scroll:!1,origin:"*mouse"}),s=o.sel):Xi(o,l,a,K):(l=0,Qi(o,new ki([a],0),K),s=o.sel)
|
|
959
959
|
var d=r
|
|
960
|
-
function f(t){if(0!=
|
|
961
|
-
h==p?i.push(new
|
|
962
|
-
|
|
960
|
+
function f(t){if(0!=tt(d,t))if(d=t,"rectangle"==n.unit){for(var i=[],u=e.options.tabSize,c=F(qe(o,r.line).text,r.ch,u),f=F(qe(o,t.line).text,t.ch,u),h=Math.min(c,f),p=Math.max(c,f),g=Math.min(r.line,t.line),m=Math.min(e.lastLine(),Math.max(r.line,t.line));g<=m;g++){var v=qe(o,g).text,y=U(v,h,u)
|
|
961
|
+
h==p?i.push(new Ci(et(g,y),et(g,y))):v.length>y&&i.push(new Ci(et(g,y),et(g,U(v,p,u))))}i.length||i.push(new Ci(r,r)),Qi(o,Si(e,s.ranges.slice(0,l).concat(i),l),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var b,w=a,x=ga(e,t,n.unit),k=w.anchor
|
|
962
|
+
tt(x.anchor,k)>0?(b=x.head,k=ot(w.from(),x.anchor)):(b=x.anchor,k=it(w.to(),x.head))
|
|
963
963
|
var C=s.ranges.slice(0)
|
|
964
|
-
C[l]=function(e,t){var r=t.anchor,n=t.head,i=
|
|
965
|
-
if(0==
|
|
966
|
-
var o=
|
|
964
|
+
C[l]=function(e,t){var r=t.anchor,n=t.head,i=qe(e.doc,r.line)
|
|
965
|
+
if(0==tt(r,n)&&r.sticky==n.sticky)return t
|
|
966
|
+
var o=ue(i)
|
|
967
967
|
if(!o)return t
|
|
968
|
-
var a=
|
|
968
|
+
var a=le(o,r.ch,r.sticky),l=o[a]
|
|
969
969
|
if(l.from!=r.ch&&l.to!=r.ch)return t
|
|
970
970
|
var s,u=a+(l.from==r.ch==(1!=l.level)?0:1)
|
|
971
971
|
if(0==u||u==o.length)return t
|
|
972
972
|
if(n.line!=r.line)s=(n.line-r.line)*("ltr"==e.doc.direction?1:-1)>0
|
|
973
|
-
else{var c=
|
|
973
|
+
else{var c=le(o,n.ch,n.sticky),d=c-a||(n.ch-r.ch)*(1==l.level?-1:1)
|
|
974
974
|
s=c==u-1||c==u?d<0:d>0}var f=o[u+(s?-1:0)],h=s==(1==f.level),p=h?f.from:f.to,g=h?"after":"before"
|
|
975
|
-
return r.ch==p&&r.sticky==g?t:new
|
|
976
|
-
function g(t){var r=++p,a=
|
|
977
|
-
if(a)if(0!=
|
|
978
|
-
var l=
|
|
979
|
-
s&&setTimeout(
|
|
980
|
-
e.state.selectingText=y,
|
|
975
|
+
return r.ch==p&&r.sticky==g?t:new Ci(new et(r.line,p,g),n)}(e,new Ci(lt(o,k),b)),Qi(o,Si(e,C,l),K)}}var h=i.wrapper.getBoundingClientRect(),p=0
|
|
976
|
+
function g(t){var r=++p,a=un(e,t,!0,"rectangle"==n.unit)
|
|
977
|
+
if(a)if(0!=tt(a,d)){e.curOp.focus=D(),f(a)
|
|
978
|
+
var l=Nn(i,o);(a.line>=l.to||a.line<l.from)&&setTimeout(ei(e,(function(){p==r&&g(t)})),150)}else{var s=t.clientY<h.top?-20:t.clientY>h.bottom?20:0
|
|
979
|
+
s&&setTimeout(ei(e,(function(){p==r&&(i.scroller.scrollTop+=s,g(t))})),50)}}function m(t){e.state.selectingText=!1,p=1/0,t&&(be(t),i.input.focus()),he(i.wrapper.ownerDocument,"mousemove",v),he(i.wrapper.ownerDocument,"mouseup",y),o.history.lastSelOrigin=null}var v=ei(e,(function(e){0!==e.buttons&&Se(e)?g(e):m(e)})),y=ei(e,m)
|
|
980
|
+
e.state.selectingText=y,de(i.wrapper.ownerDocument,"mousemove",v),de(i.wrapper.ownerDocument,"mouseup",y)}(e,n,t,o)}(t,n,o,e):Ce(e)==r.scroller&&be(e):2==i?(n&&_i(t.doc,n),setTimeout((function(){return r.input.focus()}),20)):3==i&&(C?t.display.input.onContextMenu(e):Cn(t)))}}function ga(e,t,r){if("char"==r)return new Ci(t,t)
|
|
981
981
|
if("word"==r)return e.findWordAt(t)
|
|
982
|
-
if("line"==r)return new
|
|
982
|
+
if("line"==r)return new Ci(et(t.line,0),lt(e.doc,et(t.line+1,0)))
|
|
983
983
|
var n=r(e,t)
|
|
984
|
-
return new
|
|
984
|
+
return new Ci(n.from,n.to)}function ma(e,t,r,n){var i,o
|
|
985
985
|
if(t.touches)i=t.touches[0].clientX,o=t.touches[0].clientY
|
|
986
986
|
else try{i=t.clientX,o=t.clientY}catch(t){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1
|
|
987
|
-
n&&
|
|
987
|
+
n&&be(t)
|
|
988
988
|
var a=e.display,l=a.lineDiv.getBoundingClientRect()
|
|
989
|
-
if(o>l.bottom||!
|
|
989
|
+
if(o>l.bottom||!ve(e,r))return xe(t)
|
|
990
990
|
o-=l.top-a.viewOffset
|
|
991
991
|
for(var s=0;s<e.display.gutterSpecs.length;++s){var u=a.gutters.childNodes[s]
|
|
992
|
-
if(u&&u.getBoundingClientRect().right>=i)return
|
|
993
|
-
var
|
|
994
|
-
function
|
|
995
|
-
i(e.display.scroller,"dragstart",n.start),i(e.display.scroller,"dragenter",n.enter),i(e.display.scroller,"dragover",n.over),i(e.display.scroller,"dragleave",n.leave),i(e.display.scroller,"drop",n.drop)}}function
|
|
996
|
-
if(!(this instanceof
|
|
997
|
-
this.options=t=t?E(t):{},E(
|
|
992
|
+
if(u&&u.getBoundingClientRect().right>=i)return pe(e,r,e,Ze(e.doc,o),e.display.gutterSpecs[s].className,t),xe(t)}}function va(e,t){return ma(e,t,"gutterClick",!0)}function ya(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),Rr(e)}ha.prototype.compare=function(e,t,r){return this.time+400>e&&0==tt(t,this.pos)&&r==this.button}
|
|
993
|
+
var ba={toString:function(){return"CodeMirror.Init"}},wa={},xa={}
|
|
994
|
+
function ka(e,t,r){if(!t!=!(r&&r!=ba)){var n=e.display.dragFunctions,i=t?de:he
|
|
995
|
+
i(e.display.scroller,"dragstart",n.start),i(e.display.scroller,"dragenter",n.enter),i(e.display.scroller,"dragover",n.over),i(e.display.scroller,"dragleave",n.leave),i(e.display.scroller,"drop",n.drop)}}function Ca(e){e.options.lineWrapping?(z(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(T(e.display.wrapper,"CodeMirror-wrap"),Ut(e)),sn(e),dn(e),Rr(e),setTimeout((function(){return jn(e)}),100)}function Sa(e,t){var r=this
|
|
996
|
+
if(!(this instanceof Sa))return new Sa(e,t)
|
|
997
|
+
this.options=t=t?E(t):{},E(wa,t,!1)
|
|
998
998
|
var n=t.value
|
|
999
|
-
"string"==typeof n?n=new
|
|
1000
|
-
var i=new
|
|
1001
|
-
for(var u in o.wrapper.CodeMirror=this,
|
|
1002
|
-
|
|
1003
|
-
if(r&&!
|
|
999
|
+
"string"==typeof n?n=new Oo(n,t.mode,null,t.lineSeparator,t.direction):t.mode&&(n.modeOption=t.mode),this.doc=n
|
|
1000
|
+
var i=new Sa.inputStyles[t.inputStyle](this),o=this.display=new mi(e,n,i,t)
|
|
1001
|
+
for(var u in o.wrapper.CodeMirror=this,ya(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Gn(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new R,keySeq:null,specialChars:null},t.autofocus&&!v&&o.input.focus(),a&&l<11&&setTimeout((function(){return r.display.input.reset(!0)}),20),function(e){var t=e.display
|
|
1002
|
+
de(t.scroller,"mousedown",ei(e,pa)),de(t.scroller,"dblclick",a&&l<11?ei(e,(function(t){if(!ge(e,t)){var r=un(e,t)
|
|
1003
|
+
if(r&&!va(e,t)&&!xr(e.display,t)){be(t)
|
|
1004
1004
|
var n=e.findWordAt(r)
|
|
1005
|
-
|
|
1005
|
+
_i(e.doc,n.anchor,n.head)}}})):function(t){return ge(e,t)||be(t)}),de(t.scroller,"contextmenu",(function(t){return function(e,t){xr(e.display,t)||function(e,t){return!!ve(e,"gutterContextMenu")&&ma(e,t,"gutterContextMenu",!1)}(e,t)||ge(e,t,"contextmenu")||C||e.display.input.onContextMenu(t)}(e,t)}))
|
|
1006
1006
|
var r,n={end:0}
|
|
1007
1007
|
function i(){t.activeTouch&&(r=setTimeout((function(){return t.activeTouch=null}),1e3),(n=t.activeTouch).end=+new Date)}function o(e,t){if(null==t.left)return!0
|
|
1008
1008
|
var r=t.left-e.left,n=t.top-e.top
|
|
1009
|
-
return r*r+n*n>400}
|
|
1009
|
+
return r*r+n*n>400}de(t.scroller,"touchstart",(function(i){if(!ge(e,i)&&!function(e){if(1!=e.touches.length)return!1
|
|
1010
1010
|
var t=e.touches[0]
|
|
1011
|
-
return t.radiusX<=1&&t.radiusY<=1}(i)&&!
|
|
1011
|
+
return t.radiusX<=1&&t.radiusY<=1}(i)&&!va(e,i)){t.input.ensurePolled(),clearTimeout(r)
|
|
1012
1012
|
var o=+new Date
|
|
1013
|
-
t.activeTouch={start:o,moved:!1,prev:o-n.end<=300?n:null},1==i.touches.length&&(t.activeTouch.left=i.touches[0].pageX,t.activeTouch.top=i.touches[0].pageY)}})),
|
|
1014
|
-
if(n&&!
|
|
1015
|
-
a=!n.prev||o(n,n.prev)?new
|
|
1013
|
+
t.activeTouch={start:o,moved:!1,prev:o-n.end<=300?n:null},1==i.touches.length&&(t.activeTouch.left=i.touches[0].pageX,t.activeTouch.top=i.touches[0].pageY)}})),de(t.scroller,"touchmove",(function(){t.activeTouch&&(t.activeTouch.moved=!0)})),de(t.scroller,"touchend",(function(r){var n=t.activeTouch
|
|
1014
|
+
if(n&&!xr(t,r)&&null!=n.left&&!n.moved&&new Date-n.start<300){var a,l=e.coordsChar(t.activeTouch,"page")
|
|
1015
|
+
a=!n.prev||o(n,n.prev)?new Ci(l,l):!n.prev.prev||o(n,n.prev.prev)?e.findWordAt(l):new Ci(et(l.line,0),lt(e.doc,et(l.line+1,0))),e.setSelection(a.anchor,a.head),e.focus(),be(r)}i()})),de(t.scroller,"touchcancel",i),de(t.scroller,"scroll",(function(){t.scroller.clientHeight&&(Hn(e,t.scroller.scrollTop),En(e,t.scroller.scrollLeft,!0),pe(e,"scroll",e))})),de(t.scroller,"mousewheel",(function(t){return xi(e,t)})),de(t.scroller,"DOMMouseScroll",(function(t){return xi(e,t)})),de(t.wrapper,"scroll",(function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0})),t.dragFunctions={enter:function(t){ge(e,t)||ke(t)},over:function(t){ge(e,t)||(function(e,t){var r=un(e,t)
|
|
1016
1016
|
if(r){var n=document.createDocumentFragment()
|
|
1017
|
-
|
|
1018
|
-
else if(!
|
|
1019
|
-
r.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",d&&(r.width=r.height=1,e.display.wrapper.appendChild(r),r._top=r.offsetTop),t.dataTransfer.setDragImage(r,0,0),d&&r.parentNode.removeChild(r)}}(e,t)},drop:
|
|
1017
|
+
yn(e,r,n),e.display.dragCursor||(e.display.dragCursor=A("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),N(e.display.dragCursor,n)}}(e,t),ke(t))},start:function(t){return function(e,t){if(a&&(!e.state.draggingText||+new Date-Wo<100))ke(t)
|
|
1018
|
+
else if(!ge(e,t)&&!xr(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!f)){var r=A("img",null,null,"position: fixed; left: 0; top: 0;")
|
|
1019
|
+
r.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",d&&(r.width=r.height=1,e.display.wrapper.appendChild(r),r._top=r.offsetTop),t.dataTransfer.setDragImage(r,0,0),d&&r.parentNode.removeChild(r)}}(e,t)},drop:ei(e,Do),leave:function(t){ge(e,t)||zo(e)}}
|
|
1020
1020
|
var s=t.input.getField()
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
for(var c=0;c<
|
|
1025
|
-
|
|
1026
|
-
var
|
|
1027
|
-
function
|
|
1028
|
-
null==r&&(r="add"),"smart"==r&&(o.mode.indent?i=
|
|
1029
|
-
var a=e.options.tabSize,l=
|
|
1021
|
+
de(s,"keyup",(function(t){return ua.call(e,t)})),de(s,"keydown",ei(e,sa)),de(s,"keypress",ei(e,ca)),de(s,"focus",(function(t){return Sn(e,t)})),de(s,"blur",(function(t){return Ln(e,t)}))}(this),function(){var e
|
|
1022
|
+
Ho||(de(window,"resize",(function(){null==e&&(e=setTimeout((function(){e=null,Po(Io)}),100))})),de(window,"blur",(function(){return Po(Ln)})),Ho=!0)}(),qn(this),this.curOp.forceUpdate=!0,Hi(this,n),t.autofocus&&!v||this.hasFocus()?setTimeout(I(Sn,this),20):Ln(this),xa)xa.hasOwnProperty(u)&&xa[u](r,t[u],ba)
|
|
1023
|
+
fi(this),t.finishInit&&t.finishInit(this)
|
|
1024
|
+
for(var c=0;c<La.length;++c)La[c](r)
|
|
1025
|
+
_n(this),s&&t.lineWrapping&&"optimizelegibility"==getComputedStyle(o.lineDiv).textRendering&&(o.lineDiv.style.textRendering="auto")}Sa.defaults=wa,Sa.optionHandlers=xa
|
|
1026
|
+
var La=[]
|
|
1027
|
+
function Ta(e,t,r,n){var i,o=e.doc
|
|
1028
|
+
null==r&&(r="add"),"smart"==r&&(o.mode.indent?i=ht(e,t).state:r="prev")
|
|
1029
|
+
var a=e.options.tabSize,l=qe(o,t),s=F(l.text,null,a)
|
|
1030
1030
|
l.stateAfter&&(l.stateAfter=null)
|
|
1031
1031
|
var u,c=l.text.match(/^\s*/)[0]
|
|
1032
|
-
if(n||/\S/.test(l.text)){if("smart"==r&&((u=o.mode.indent(i,l.text.slice(c.length),l.text))==
|
|
1032
|
+
if(n||/\S/.test(l.text)){if("smart"==r&&((u=o.mode.indent(i,l.text.slice(c.length),l.text))==j||u>150)){if(!n)return
|
|
1033
1033
|
r="prev"}}else u=0,r="not"
|
|
1034
|
-
"prev"==r?u=t>o.first?F(
|
|
1034
|
+
"prev"==r?u=t>o.first?F(qe(o,t-1).text,null,a):0:"add"==r?u=s+e.options.indentUnit:"subtract"==r?u=s-e.options.indentUnit:"number"==typeof r&&(u=s+r),u=Math.max(0,u)
|
|
1035
1035
|
var d="",f=0
|
|
1036
1036
|
if(e.options.indentWithTabs)for(var h=Math.floor(u/a);h;--h)f+=a,d+="\t"
|
|
1037
|
-
if(f<u&&(d
|
|
1037
|
+
if(f<u&&(d+=_(u-f)),d!=c)return po(o,d,et(t,0),et(t,c.length),"+input"),l.stateAfter=null,!0
|
|
1038
1038
|
for(var p=0;p<o.sel.ranges.length;p++){var g=o.sel.ranges[p]
|
|
1039
|
-
if(g.head.line==t&&g.head.ch<c.length){var m=
|
|
1040
|
-
|
|
1041
|
-
break}}}
|
|
1042
|
-
var
|
|
1043
|
-
function
|
|
1039
|
+
if(g.head.line==t&&g.head.ch<c.length){var m=et(t,c.length)
|
|
1040
|
+
Xi(o,p,new Ci(m,m))
|
|
1041
|
+
break}}}Sa.defineInitHook=function(e){return La.push(e)}
|
|
1042
|
+
var Ma=null
|
|
1043
|
+
function Na(e){Ma=e}function Aa(e,t,r,n,i){var o=e.doc
|
|
1044
1044
|
e.display.shift=!1,n||(n=o.sel)
|
|
1045
|
-
var a=+new Date-200,l="paste"==i||e.state.pasteIncoming>a,s=
|
|
1046
|
-
if(l&&n.ranges.length>1)if(
|
|
1047
|
-
for(var c=0;c<
|
|
1045
|
+
var a=+new Date-200,l="paste"==i||e.state.pasteIncoming>a,s=We(t),u=null
|
|
1046
|
+
if(l&&n.ranges.length>1)if(Ma&&Ma.text.join("\n")==t){if(n.ranges.length%Ma.text.length==0){u=[]
|
|
1047
|
+
for(var c=0;c<Ma.text.length;c++)u.push(o.splitLines(Ma.text[c]))}}else s.length==n.ranges.length&&e.options.pasteLinesPerSelection&&(u=X(s,(function(e){return[e]})))
|
|
1048
1048
|
for(var d=e.curOp.updateInput,f=n.ranges.length-1;f>=0;f--){var h=n.ranges[f],p=h.from(),g=h.to()
|
|
1049
|
-
h.empty()&&(r&&r>0?p=
|
|
1049
|
+
h.empty()&&(r&&r>0?p=et(p.line,p.ch-r):e.state.overwrite&&!l?g=et(g.line,Math.min(qe(o,g.line).text.length,g.ch+$(s).length)):l&&Ma&&Ma.lineWise&&Ma.text.join("\n")==t&&(p=g=et(p.line,0)))
|
|
1050
1050
|
var m={from:p,to:g,text:u?u[f%u.length]:s,origin:i||(l?"paste":e.state.cutIncoming>a?"cut":"+input")}
|
|
1051
|
-
|
|
1052
|
-
if(r)return e.preventDefault(),t.isReadOnly()||t.options.disableInput||
|
|
1051
|
+
so(e.doc,m),lr(e,"inputRead",e,m)}t&&!l&&Wa(e,t),Wn(e),e.curOp.updateInput<2&&(e.curOp.updateInput=d),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Oa(e,t){var r=e.clipboardData&&e.clipboardData.getData("Text")
|
|
1052
|
+
if(r)return e.preventDefault(),t.isReadOnly()||t.options.disableInput||Jn(t,(function(){return Aa(t,r,0,null,"paste")})),!0}function Wa(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var r=e.doc.sel,n=r.ranges.length-1;n>=0;n--){var i=r.ranges[n]
|
|
1053
1053
|
if(!(i.head.ch>100||n&&r.ranges[n-1].head.line==i.head.line)){var o=e.getModeAt(i.head),a=!1
|
|
1054
|
-
if(o.electricChars){for(var l=0;l<o.electricChars.length;l++)if(t.indexOf(o.electricChars.charAt(l))>-1){a=
|
|
1055
|
-
break}}else o.electricInput&&o.electricInput.test(
|
|
1056
|
-
a&&
|
|
1057
|
-
r.push(o),t.push(e.getRange(o.anchor,o.head))}return{text:t,ranges:r}}function
|
|
1058
|
-
return s?e.style.width="1000px":e.setAttribute("wrap","off"),g&&(e.style.border="1px solid black"),
|
|
1054
|
+
if(o.electricChars){for(var l=0;l<o.electricChars.length;l++)if(t.indexOf(o.electricChars.charAt(l))>-1){a=Ta(e,i.head.line,"smart")
|
|
1055
|
+
break}}else o.electricInput&&o.electricInput.test(qe(e.doc,i.head.line).text.slice(0,i.head.ch))&&(a=Ta(e,i.head.line,"smart"))
|
|
1056
|
+
a&&lr(e,"electricInput",e,i.head.line)}}}function Da(e){for(var t=[],r=[],n=0;n<e.doc.sel.ranges.length;n++){var i=e.doc.sel.ranges[n].head.line,o={anchor:et(i,0),head:et(i+1,0)}
|
|
1057
|
+
r.push(o),t.push(e.getRange(o.anchor,o.head))}return{text:t,ranges:r}}function za(e,t,r,n){e.setAttribute("autocorrect",r?"":"off"),e.setAttribute("autocapitalize",n?"":"off"),e.setAttribute("spellcheck",!!t)}function Pa(){var e=A("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=A("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;")
|
|
1058
|
+
return s?e.style.width="1000px":e.setAttribute("wrap","off"),g&&(e.style.border="1px solid black"),za(e),t}function Ha(e,t,r,n,i){var o=t,a=r,l=qe(e,t.line)
|
|
1059
1059
|
function s(n){var o,a
|
|
1060
|
-
if(o=i?function(e,t,r,n){var i=
|
|
1061
|
-
if(!i)return
|
|
1060
|
+
if(o=i?function(e,t,r,n){var i=ue(t,e.doc.direction)
|
|
1061
|
+
if(!i)return Zo(t,r,n)
|
|
1062
1062
|
r.ch>=t.text.length?(r.ch=t.text.length,r.sticky="before"):r.ch<=0&&(r.ch=0,r.sticky="after")
|
|
1063
|
-
var o=
|
|
1064
|
-
if("ltr"==e.doc.direction&&a.level%2==0&&(n>0?a.to>r.ch:a.from<r.ch))return
|
|
1065
|
-
var l,s=function(e,r){return
|
|
1063
|
+
var o=le(i,r.ch,r.sticky),a=i[o]
|
|
1064
|
+
if("ltr"==e.doc.direction&&a.level%2==0&&(n>0?a.to>r.ch:a.from<r.ch))return Zo(t,r,n)
|
|
1065
|
+
var l,s=function(e,r){return Yo(t,e instanceof et?e.ch:e,r)},u=function(r){return e.options.lineWrapping?(l=l||Wr(e,t),Zr(e,t,l,r)):{begin:0,end:t.text.length}},c=u("before"==r.sticky?s(r,-1):r.ch)
|
|
1066
1066
|
if("rtl"==e.doc.direction||1==a.level){var d=1==a.level==n<0,f=s(r,d?1:-1)
|
|
1067
1067
|
if(null!=f&&(d?f<=a.to&&f<=c.end:f>=a.from&&f>=c.begin)){var h=d?"before":"after"
|
|
1068
|
-
return new
|
|
1068
|
+
return new et(r.line,f,h)}}var p=function(e,t,n){for(var o=function(e,t){return t?new et(r.line,s(e,1),"before"):new et(r.line,e,"after")};e>=0&&e<i.length;e+=t){var a=i[e],l=t>0==(1!=a.level),u=l?n.begin:s(n.end,-1)
|
|
1069
1069
|
if(a.from<=u&&u<a.to)return o(u,l)
|
|
1070
1070
|
if(u=l?a.from:s(a.to,-1),n.begin<=u&&u<n.end)return o(u,l)}},g=p(o+n,n,c)
|
|
1071
1071
|
if(g)return g
|
|
1072
1072
|
var m=n>0?c.end:s(c.begin,-1)
|
|
1073
|
-
return null==m||n>0&&m==t.text.length||!(g=p(n>0?0:i.length-1,n,u(m)))?null:g}(e.cm,l,t,r):
|
|
1074
|
-
t=
|
|
1073
|
+
return null==m||n>0&&m==t.text.length||!(g=p(n>0?0:i.length-1,n,u(m)))?null:g}(e.cm,l,t,r):Zo(l,t,r),null==o){if(n||(a=t.line+r)<e.first||a>=e.first+e.size||(t=new et(a,t.ch,t.sticky),!(l=qe(e,a))))return!1
|
|
1074
|
+
t=Qo(i,e.cm,l,t.line,r)}else t=o
|
|
1075
1075
|
return!0}if("char"==n)s()
|
|
1076
1076
|
else if("column"==n)s(!0)
|
|
1077
|
-
else if("word"==n||"group"==n)for(var u=null,c="group"==n,d=e.cm&&e.cm.getHelper(t,"wordChars"),f=!0;!(r<0)||s(!f);f=!1){var h=l.text.charAt(t.ch)||"\n",p=
|
|
1077
|
+
else if("word"==n||"group"==n)for(var u=null,c="group"==n,d=e.cm&&e.cm.getHelper(t,"wordChars"),f=!0;!(r<0)||s(!f);f=!1){var h=l.text.charAt(t.ch)||"\n",p=ee(h,d)?"w":c&&"\n"==h?"n":!c||/\s/.test(h)?null:"p"
|
|
1078
1078
|
if(!c||f||p||(p="s"),u&&u!=p){r<0&&(r=1,s(),t.sticky="after")
|
|
1079
|
-
break}if(p&&(u=p),r>0&&!s(!f))break}var g=
|
|
1080
|
-
return
|
|
1081
|
-
if("page"==n){var s=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),u=Math.max(s-.5*
|
|
1079
|
+
break}if(p&&(u=p),r>0&&!s(!f))break}var g=io(e,t,o,a,!0)
|
|
1080
|
+
return rt(o,g)&&(g.hitSide=!0),g}function Ia(e,t,r,n){var i,o,a=e.doc,l=t.left
|
|
1081
|
+
if("page"==n){var s=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),u=Math.max(s-.5*rn(e.display),3)
|
|
1082
1082
|
i=(r>0?t.bottom:t.top)+r*u}else"line"==n&&(i=r>0?t.bottom+3:t.top-3)
|
|
1083
|
-
for(;(o=
|
|
1084
|
-
break}i+=5*r}return o}var
|
|
1085
|
-
function
|
|
1083
|
+
for(;(o=Xr(e,l,i)).outside;){if(r<0?i<=0:i>=a.height){o.hitSide=!0
|
|
1084
|
+
break}i+=5*r}return o}var Ea=function(e){this.cm=e,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new R,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null}
|
|
1085
|
+
function Fa(e,t){var r=Or(e,t.line)
|
|
1086
1086
|
if(!r||r.hidden)return null
|
|
1087
|
-
var n=
|
|
1088
|
-
o&&(a=
|
|
1089
|
-
var l=
|
|
1090
|
-
return l.offset="right"==l.collapse?l.end:l.start,l}function
|
|
1091
|
-
if(t==e.display.lineDiv){if(!(n=e.display.lineDiv.childNodes[r]))return
|
|
1087
|
+
var n=qe(e.doc,t.line),i=Nr(r,n,t.line),o=ue(n,e.doc.direction),a="left"
|
|
1088
|
+
o&&(a=le(o,t.ch)%2?"right":"left")
|
|
1089
|
+
var l=Hr(i.map,t.ch,a)
|
|
1090
|
+
return l.offset="right"==l.collapse?l.end:l.start,l}function Ra(e,t){return t&&(e.bad=!0),e}function Ba(e,t,r){var n
|
|
1091
|
+
if(t==e.display.lineDiv){if(!(n=e.display.lineDiv.childNodes[r]))return Ra(e.clipPos(et(e.display.viewTo-1)),!0)
|
|
1092
1092
|
t=null,r=0}else for(n=t;;n=n.parentNode){if(!n||n==e.display.lineDiv)return null
|
|
1093
1093
|
if(n.parentNode&&n.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var o=e.display.view[i]
|
|
1094
|
-
if(o.node==n)return
|
|
1095
|
-
if(!t||!W(n,t))return
|
|
1096
|
-
if(t==n&&(i=!0,t=n.childNodes[r],r=0,!t)){var o=e.rest
|
|
1097
|
-
return
|
|
1094
|
+
if(o.node==n)return ja(o,t,r)}}function ja(e,t,r){var n=e.text.firstChild,i=!1
|
|
1095
|
+
if(!t||!W(n,t))return Ra(et(Ye(e.line),0),!0)
|
|
1096
|
+
if(t==n&&(i=!0,t=n.childNodes[r],r=0,!t)){var o=e.rest?$(e.rest):e.line
|
|
1097
|
+
return Ra(et(Ye(o),o.text.length),i)}var a=3==t.nodeType?t:null,l=t
|
|
1098
1098
|
for(a||1!=t.childNodes.length||3!=t.firstChild.nodeType||(a=t.firstChild,r&&(r=a.nodeValue.length));l.parentNode!=n;)l=l.parentNode
|
|
1099
1099
|
var s=e.measure,u=s.maps
|
|
1100
1100
|
function c(t,r,n){for(var i=-1;i<(u?u.length:0);i++)for(var o=i<0?s.map:u[i],a=0;a<o.length;a+=3){var l=o[a+2]
|
|
1101
|
-
if(l==t||l==r){var c=
|
|
1102
|
-
return(n<0||l!=t)&&(d=o[a+(n?1:0)]),
|
|
1103
|
-
if(d)return
|
|
1104
|
-
for(var f=l.nextSibling,h=a?a.nodeValue.length-r:0;f;f=f.nextSibling){if(d=c(f,f.firstChild,0))return
|
|
1105
|
-
h+=f.textContent.length}for(var p=l.previousSibling,g=r;p;p=p.previousSibling){if(d=c(p,p.firstChild,-1))return
|
|
1106
|
-
g+=p.textContent.length}}
|
|
1107
|
-
function o(e){if(!
|
|
1101
|
+
if(l==t||l==r){var c=Ye(i<0?e.line:e.rest[i]),d=o[a]+n
|
|
1102
|
+
return(n<0||l!=t)&&(d=o[a+(n?1:0)]),et(c,d)}}}var d=c(a,l,r)
|
|
1103
|
+
if(d)return Ra(d,i)
|
|
1104
|
+
for(var f=l.nextSibling,h=a?a.nodeValue.length-r:0;f;f=f.nextSibling){if(d=c(f,f.firstChild,0))return Ra(et(d.line,d.ch-h),i)
|
|
1105
|
+
h+=f.textContent.length}for(var p=l.previousSibling,g=r;p;p=p.previousSibling){if(d=c(p,p.firstChild,-1))return Ra(et(d.line,d.ch+g),i)
|
|
1106
|
+
g+=p.textContent.length}}Ea.prototype.init=function(e){var t=this,r=this,n=r.cm,i=r.div=e.lineDiv
|
|
1107
|
+
function o(e){if(!ge(n,e)){if(n.somethingSelected())Na({lineWise:!1,text:n.getSelections()}),"cut"==e.type&&n.replaceSelection("",null,"cut")
|
|
1108
1108
|
else{if(!n.options.lineWiseCopyCut)return
|
|
1109
|
-
var t=
|
|
1110
|
-
|
|
1111
|
-
var o=
|
|
1112
|
-
if(e.clipboardData.setData("Text",o),e.clipboardData.getData("Text")==o)return void e.preventDefault()}var a=
|
|
1113
|
-
n.display.lineSpace.insertBefore(a,n.display.lineSpace.firstChild),l.value=
|
|
1109
|
+
var t=Da(n)
|
|
1110
|
+
Na({lineWise:!0,text:t.text}),"cut"==e.type&&n.operation((function(){n.setSelections(t.ranges,0,V),n.replaceSelection("",null,"cut")}))}if(e.clipboardData){e.clipboardData.clearData()
|
|
1111
|
+
var o=Ma.text.join("\n")
|
|
1112
|
+
if(e.clipboardData.setData("Text",o),e.clipboardData.getData("Text")==o)return void e.preventDefault()}var a=Pa(),l=a.firstChild
|
|
1113
|
+
n.display.lineSpace.insertBefore(a,n.display.lineSpace.firstChild),l.value=Ma.text.join("\n")
|
|
1114
1114
|
var s=document.activeElement
|
|
1115
|
-
H(l),setTimeout((function(){n.display.lineSpace.removeChild(a),s.focus(),s==i&&r.showPrimarySelection()}),50)}}
|
|
1116
|
-
return e.focus=this.cm.state.focused,e},
|
|
1115
|
+
H(l),setTimeout((function(){n.display.lineSpace.removeChild(a),s.focus(),s==i&&r.showPrimarySelection()}),50)}}za(i,n.options.spellcheck,n.options.autocorrect,n.options.autocapitalize),de(i,"paste",(function(e){ge(n,e)||Oa(e,n)||l<=11&&setTimeout(ei(n,(function(){return t.updateFromDOM()})),20)})),de(i,"compositionstart",(function(e){t.composing={data:e.data,done:!1}})),de(i,"compositionupdate",(function(e){t.composing||(t.composing={data:e.data,done:!1})})),de(i,"compositionend",(function(e){t.composing&&(e.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)})),de(i,"touchstart",(function(){return r.forceCompositionEnd()})),de(i,"input",(function(){t.composing||t.readFromDOMSoon()})),de(i,"copy",o),de(i,"cut",o)},Ea.prototype.prepareSelection=function(){var e=vn(this.cm,!1)
|
|
1116
|
+
return e.focus=this.cm.state.focused,e},Ea.prototype.showSelection=function(e,t){e&&this.cm.display.view.length&&((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},Ea.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Ea.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,n=t.doc.sel.primary(),i=n.from(),o=n.to()
|
|
1117
1117
|
if(t.display.viewTo==t.display.viewFrom||i.line>=t.display.viewTo||o.line<t.display.viewFrom)e.removeAllRanges()
|
|
1118
|
-
else{var a=
|
|
1119
|
-
if(!a||a.bad||!l||l.bad||0!=
|
|
1118
|
+
else{var a=Ba(t,e.anchorNode,e.anchorOffset),l=Ba(t,e.focusNode,e.focusOffset)
|
|
1119
|
+
if(!a||a.bad||!l||l.bad||0!=tt(ot(a,l),i)||0!=tt(it(a,l),o)){var s=t.display.view,u=i.line>=t.display.viewFrom&&Fa(t,i)||{node:s[0].measure.map[2],offset:0},c=o.line<t.display.viewTo&&Fa(t,o)
|
|
1120
1120
|
if(!c){var d=s[s.length-1].measure,f=d.maps?d.maps[d.maps.length-1]:d.map
|
|
1121
1121
|
c={node:f[f.length-1],offset:f[f.length-2]-f[f.length-3]}}if(u&&c){var h,p=e.rangeCount&&e.getRangeAt(0)
|
|
1122
|
-
try{h=L(u.node,u.offset,c.offset,c.node)}catch(e){}h&&(!r&&t.state.focused?(e.collapse(u.node,u.offset),h.collapsed||(e.removeAllRanges(),e.addRange(h))):(e.removeAllRanges(),e.addRange(h)),p&&null==e.anchorNode?e.addRange(p):r&&this.startGracePeriod()),this.rememberSelection()}else e.removeAllRanges()}}},
|
|
1123
|
-
clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout((function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation((function(){return e.cm.curOp.selectionChanged=!0}))}),20)},
|
|
1124
|
-
this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},
|
|
1122
|
+
try{h=L(u.node,u.offset,c.offset,c.node)}catch(e){}h&&(!r&&t.state.focused?(e.collapse(u.node,u.offset),h.collapsed||(e.removeAllRanges(),e.addRange(h))):(e.removeAllRanges(),e.addRange(h)),p&&null==e.anchorNode?e.addRange(p):r&&this.startGracePeriod()),this.rememberSelection()}else e.removeAllRanges()}}},Ea.prototype.startGracePeriod=function(){var e=this
|
|
1123
|
+
clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout((function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation((function(){return e.cm.curOp.selectionChanged=!0}))}),20)},Ea.prototype.showMultipleSelections=function(e){N(this.cm.display.cursorDiv,e.cursors),N(this.cm.display.selectionDiv,e.selection)},Ea.prototype.rememberSelection=function(){var e=this.getSelection()
|
|
1124
|
+
this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Ea.prototype.selectionInEditor=function(){var e=this.getSelection()
|
|
1125
1125
|
if(!e.rangeCount)return!1
|
|
1126
1126
|
var t=e.getRangeAt(0).commonAncestorContainer
|
|
1127
|
-
return W(this.div,t)},
|
|
1128
|
-
this.selectionInEditor()?this.pollSelection():
|
|
1129
|
-
return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},
|
|
1127
|
+
return W(this.div,t)},Ea.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()||this.showSelection(this.prepareSelection(),!0),this.div.focus())},Ea.prototype.blur=function(){this.div.blur()},Ea.prototype.getField=function(){return this.div},Ea.prototype.supportsTouch=function(){return!0},Ea.prototype.receivedFocus=function(){var e=this
|
|
1128
|
+
this.selectionInEditor()?this.pollSelection():Jn(this.cm,(function(){return e.cm.curOp.selectionChanged=!0})),this.polling.set(this.cm.options.pollInterval,(function t(){e.cm.state.focused&&(e.pollSelection(),e.polling.set(e.cm.options.pollInterval,t))}))},Ea.prototype.selectionChanged=function(){var e=this.getSelection()
|
|
1129
|
+
return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Ea.prototype.pollSelection=function(){if(null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var e=this.getSelection(),t=this.cm
|
|
1130
1130
|
if(m&&c&&this.cm.display.gutterSpecs.length&&function(e){for(var t=e;t;t=t.parentNode)if(/CodeMirror-gutter-wrapper/.test(t.className))return!0
|
|
1131
1131
|
return!1}(e.anchorNode))return this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),void this.focus()
|
|
1132
1132
|
if(!this.composing){this.rememberSelection()
|
|
1133
|
-
var r=
|
|
1134
|
-
r&&n&&
|
|
1133
|
+
var r=Ba(t,e.anchorNode,e.anchorOffset),n=Ba(t,e.focusNode,e.focusOffset)
|
|
1134
|
+
r&&n&&Jn(t,(function(){Qi(t.doc,Li(r,n),V),(r.bad||n.bad)&&(t.curOp.selectionChanged=!0)}))}}},Ea.prototype.pollContent=function(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null)
|
|
1135
1135
|
var e,t,r,n=this.cm,i=n.display,o=n.doc.sel.primary(),a=o.from(),l=o.to()
|
|
1136
|
-
if(0==a.ch&&a.line>n.firstLine()&&(a=
|
|
1137
|
-
a.line==i.viewFrom||0==(e=
|
|
1138
|
-
var s,u,c=
|
|
1139
|
-
if(c==i.view.length-1?(s=i.viewTo-1,u=i.lineDiv.lastChild):(s=
|
|
1136
|
+
if(0==a.ch&&a.line>n.firstLine()&&(a=et(a.line-1,qe(n.doc,a.line-1).length)),l.ch==qe(n.doc,l.line).text.length&&l.line<n.lastLine()&&(l=et(l.line+1,0)),a.line<i.viewFrom||l.line>i.viewTo-1)return!1
|
|
1137
|
+
a.line==i.viewFrom||0==(e=cn(n,a.line))?(t=Ye(i.view[0].line),r=i.view[0].node):(t=Ye(i.view[e].line),r=i.view[e-1].node.nextSibling)
|
|
1138
|
+
var s,u,c=cn(n,l.line)
|
|
1139
|
+
if(c==i.view.length-1?(s=i.viewTo-1,u=i.lineDiv.lastChild):(s=Ye(i.view[c+1].line)-1,u=i.view[c+1].node.previousSibling),!r)return!1
|
|
1140
1140
|
for(var d=n.doc.splitLines(function(e,t,r,n,i){var o="",a=!1,l=e.doc.lineSeparator(),s=!1
|
|
1141
1141
|
function u(){a&&(o+=l,s&&(o+=l),a=s=!1)}function c(e){e&&(u(),o+=e)}function d(t){if(1==t.nodeType){var r=t.getAttribute("cm-text")
|
|
1142
1142
|
if(r)return void c(r)
|
|
1143
1143
|
var o,f=t.getAttribute("cm-marker")
|
|
1144
|
-
if(f){var h=e.findMarks(
|
|
1145
|
-
return void(h.length&&(o=h[0].find(0))&&c(
|
|
1144
|
+
if(f){var h=e.findMarks(et(n,0),et(i+1,0),function(e){return function(t){return t.id==e}}(+f))
|
|
1145
|
+
return void(h.length&&(o=h[0].find(0))&&c(_e(e.doc,o.from,o.to).join(l)))}if("false"==t.getAttribute("contenteditable"))return
|
|
1146
1146
|
var p=/^(pre|div|p|li|table|br)$/i.test(t.nodeName)
|
|
1147
1147
|
if(!/^br$/i.test(t.nodeName)&&0==t.textContent.length)return
|
|
1148
1148
|
p&&u()
|
|
1149
1149
|
for(var g=0;g<t.childNodes.length;g++)d(t.childNodes[g]);/^(pre|p)$/i.test(t.nodeName)&&(s=!0),p&&(a=!0)}else 3==t.nodeType&&c(t.nodeValue.replace(/\u200b/g,"").replace(/\u00a0/g," "))}for(;d(t),t!=r;)t=t.nextSibling,s=!1
|
|
1150
|
-
return o}(n,r,u,t,s)),f
|
|
1150
|
+
return o}(n,r,u,t,s)),f=_e(n.doc,et(t,0),et(s,qe(n.doc,s).text.length));d.length>1&&f.length>1;)if($(d)==$(f))d.pop(),f.pop(),s--
|
|
1151
1151
|
else{if(d[0]!=f[0])break
|
|
1152
1152
|
d.shift(),f.shift(),t++}for(var h=0,p=0,g=d[0],m=f[0],v=Math.min(g.length,m.length);h<v&&g.charCodeAt(h)==m.charCodeAt(h);)++h
|
|
1153
|
-
for(var y
|
|
1153
|
+
for(var y=$(d),b=$(f),w=Math.min(y.length-(1==d.length?h:0),b.length-(1==f.length?h:0));p<w&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1);)++p
|
|
1154
1154
|
if(1==d.length&&1==f.length&&t==a.line)for(;h&&h>a.ch&&y.charCodeAt(y.length-p-1)==b.charCodeAt(b.length-p-1);)h--,p++
|
|
1155
1155
|
d[d.length-1]=y.slice(0,y.length-p).replace(/^\u200b+/,""),d[0]=d[0].slice(h).replace(/\u200b+$/,"")
|
|
1156
|
-
var x=
|
|
1157
|
-
return d.length>1||d[0]||
|
|
1156
|
+
var x=et(t,h),k=et(s,f.length?$(f).length-p:0)
|
|
1157
|
+
return d.length>1||d[0]||tt(x,k)?(po(n.doc,d,x,k,"+input"),!0):void 0},Ea.prototype.ensurePolled=function(){this.forceCompositionEnd()},Ea.prototype.reset=function(){this.forceCompositionEnd()},Ea.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Ea.prototype.readFromDOMSoon=function(){var e=this
|
|
1158
1158
|
null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout((function(){if(e.readDOMTimeout=null,e.composing){if(!e.composing.done)return
|
|
1159
|
-
e.composing=null}e.updateFromDOM()}),80))},
|
|
1160
|
-
!this.cm.isReadOnly()&&this.pollContent()||
|
|
1161
|
-
var
|
|
1162
|
-
|
|
1159
|
+
e.composing=null}e.updateFromDOM()}),80))},Ea.prototype.updateFromDOM=function(){var e=this
|
|
1160
|
+
!this.cm.isReadOnly()&&this.pollContent()||Jn(this.cm,(function(){return dn(e.cm)}))},Ea.prototype.setUneditable=function(e){e.contentEditable="false"},Ea.prototype.onKeyPress=function(e){0==e.charCode||this.composing||(e.preventDefault(),this.cm.isReadOnly()||ei(this.cm,Aa)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},Ea.prototype.readOnlyChanged=function(e){this.div.contentEditable=String("nocursor"!=e)},Ea.prototype.onContextMenu=function(){},Ea.prototype.resetPosition=function(){},Ea.prototype.needsContentAttribute=!0
|
|
1161
|
+
var Va=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new R,this.hasSelection=!1,this.composing=null}
|
|
1162
|
+
Va.prototype.init=function(e){var t=this,r=this,n=this.cm
|
|
1163
1163
|
this.createField(e)
|
|
1164
1164
|
var i=this.textarea
|
|
1165
|
-
function o(e){if(!
|
|
1165
|
+
function o(e){if(!ge(n,e)){if(n.somethingSelected())Na({lineWise:!1,text:n.getSelections()})
|
|
1166
1166
|
else{if(!n.options.lineWiseCopyCut)return
|
|
1167
|
-
var t=
|
|
1168
|
-
|
|
1167
|
+
var t=Da(n)
|
|
1168
|
+
Na({lineWise:!0,text:t.text}),"cut"==e.type?n.setSelections(t.ranges,null,V):(r.prevInput="",i.value=t.text.join("\n"),H(i))}"cut"==e.type&&(n.state.cutIncoming=+new Date)}}e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),g&&(i.style.width="0px"),de(i,"input",(function(){a&&l>=9&&t.hasSelection&&(t.hasSelection=null),r.poll()})),de(i,"paste",(function(e){ge(n,e)||Oa(e,n)||(n.state.pasteIncoming=+new Date,r.fastPoll())})),de(i,"cut",o),de(i,"copy",o),de(e.scroller,"paste",(function(t){if(!xr(e,t)&&!ge(n,t)){if(!i.dispatchEvent)return n.state.pasteIncoming=+new Date,void r.focus()
|
|
1169
1169
|
var o=new Event("paste")
|
|
1170
|
-
o.clipboardData=t.clipboardData,i.dispatchEvent(o)}})),
|
|
1171
|
-
r.composing&&r.composing.range.clear(),r.composing={start:e,range:n.markText(e,n.getCursor("to"),{className:"CodeMirror-composing"})}})),
|
|
1172
|
-
if(e.options.moveInputWithCursor){var i=
|
|
1173
|
-
n.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+a.top-o.top)),n.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+a.left-o.left))}return n},
|
|
1174
|
-
N(t.cursorDiv,e.cursors),N(t.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},
|
|
1170
|
+
o.clipboardData=t.clipboardData,i.dispatchEvent(o)}})),de(e.lineSpace,"selectstart",(function(t){xr(e,t)||be(t)})),de(i,"compositionstart",(function(){var e=n.getCursor("from")
|
|
1171
|
+
r.composing&&r.composing.range.clear(),r.composing={start:e,range:n.markText(e,n.getCursor("to"),{className:"CodeMirror-composing"})}})),de(i,"compositionend",(function(){r.composing&&(r.poll(),r.composing.range.clear(),r.composing=null)}))},Va.prototype.createField=function(e){this.wrapper=Pa(),this.textarea=this.wrapper.firstChild},Va.prototype.prepareSelection=function(){var e=this.cm,t=e.display,r=e.doc,n=vn(e)
|
|
1172
|
+
if(e.options.moveInputWithCursor){var i=qr(e,r.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),a=t.lineDiv.getBoundingClientRect()
|
|
1173
|
+
n.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+a.top-o.top)),n.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+a.left-o.left))}return n},Va.prototype.showSelection=function(e){var t=this.cm.display
|
|
1174
|
+
N(t.cursorDiv,e.cursors),N(t.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Va.prototype.reset=function(e){if(!this.contextMenuPending&&!this.composing){var t=this.cm
|
|
1175
1175
|
if(t.somethingSelected()){this.prevInput=""
|
|
1176
1176
|
var r=t.getSelection()
|
|
1177
|
-
this.textarea.value=r,t.state.focused&&H(this.textarea),a&&l>=9&&(this.hasSelection=r)}else e||(this.prevInput=this.textarea.value="",a&&l>=9&&(this.hasSelection=null))}},
|
|
1178
|
-
this.pollingFast||this.polling.set(this.cm.options.pollInterval,(function(){e.poll(),e.cm.state.focused&&e.slowPoll()}))},
|
|
1179
|
-
t.pollingFast=!0,t.polling.set(20,(function r(){t.poll()||e?(t.pollingFast=!1,t.slowPoll()):(e=!0,t.polling.set(60,r))}))},
|
|
1180
|
-
if(this.contextMenuPending||!t.state.focused||
|
|
1177
|
+
this.textarea.value=r,t.state.focused&&H(this.textarea),a&&l>=9&&(this.hasSelection=r)}else e||(this.prevInput=this.textarea.value="",a&&l>=9&&(this.hasSelection=null))}},Va.prototype.getField=function(){return this.textarea},Va.prototype.supportsTouch=function(){return!1},Va.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!v||D()!=this.textarea))try{this.textarea.focus()}catch(e){}},Va.prototype.blur=function(){this.textarea.blur()},Va.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Va.prototype.receivedFocus=function(){this.slowPoll()},Va.prototype.slowPoll=function(){var e=this
|
|
1178
|
+
this.pollingFast||this.polling.set(this.cm.options.pollInterval,(function(){e.poll(),e.cm.state.focused&&e.slowPoll()}))},Va.prototype.fastPoll=function(){var e=!1,t=this
|
|
1179
|
+
t.pollingFast=!0,t.polling.set(20,(function r(){t.poll()||e?(t.pollingFast=!1,t.slowPoll()):(e=!0,t.polling.set(60,r))}))},Va.prototype.poll=function(){var e=this,t=this.cm,r=this.textarea,n=this.prevInput
|
|
1180
|
+
if(this.contextMenuPending||!t.state.focused||De(r)&&!n&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1
|
|
1181
1181
|
var i=r.value
|
|
1182
1182
|
if(i==n&&!t.somethingSelected())return!1
|
|
1183
1183
|
if(a&&l>=9&&this.hasSelection===i||y&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1
|
|
1184
1184
|
if(t.doc.sel==t.display.selForContextMenu){var o=i.charCodeAt(0)
|
|
1185
1185
|
if(8203!=o||n||(n=""),8666==o)return this.reset(),this.cm.execCommand("undo")}for(var s=0,u=Math.min(n.length,i.length);s<u&&n.charCodeAt(s)==i.charCodeAt(s);)++s
|
|
1186
|
-
return
|
|
1186
|
+
return Jn(t,(function(){Aa(t,i.slice(s),n.length-s,null,e.composing?"*compose":null),i.length>1e3||i.indexOf("\n")>-1?r.value=e.prevInput="":e.prevInput=i,e.composing&&(e.composing.range.clear(),e.composing.range=t.markText(e.composing.start,t.getCursor("to"),{className:"CodeMirror-composing"}))})),!0},Va.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Va.prototype.onKeyPress=function(){a&&l>=9&&(this.hasSelection=null),this.fastPoll()},Va.prototype.onContextMenu=function(e){var t=this,r=t.cm,n=r.display,i=t.textarea
|
|
1187
1187
|
t.contextMenuPending&&t.contextMenuPending()
|
|
1188
|
-
var o=
|
|
1189
|
-
if(o&&!d){r.options.resetSelectionOnContextMenu&&-1==r.doc.sel.contains(o)&&
|
|
1188
|
+
var o=un(r,e),u=n.scroller.scrollTop
|
|
1189
|
+
if(o&&!d){r.options.resetSelectionOnContextMenu&&-1==r.doc.sel.contains(o)&&ei(r,Qi)(r.doc,Li(o),V)
|
|
1190
1190
|
var c,f=i.style.cssText,h=t.wrapper.style.cssText,p=t.wrapper.offsetParent.getBoundingClientRect()
|
|
1191
|
-
if(t.wrapper.style.cssText="position: static",i.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(e.clientY-p.top-5)+"px; left: "+(e.clientX-p.left-5)+"px;\n z-index: 1000; background: "+(a?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",s&&(c=window.scrollY),n.input.focus(),s&&window.scrollTo(null,c),n.input.reset(),r.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=v,n.selForContextMenu=r.doc.sel,clearTimeout(n.detectingSelectAll),a&&l>=9&&m(),C){
|
|
1192
|
-
var g=function(){
|
|
1193
|
-
|
|
1191
|
+
if(t.wrapper.style.cssText="position: static",i.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(e.clientY-p.top-5)+"px; left: "+(e.clientX-p.left-5)+"px;\n z-index: 1000; background: "+(a?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",s&&(c=window.scrollY),n.input.focus(),s&&window.scrollTo(null,c),n.input.reset(),r.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=v,n.selForContextMenu=r.doc.sel,clearTimeout(n.detectingSelectAll),a&&l>=9&&m(),C){ke(e)
|
|
1192
|
+
var g=function(){he(window,"mouseup",g),setTimeout(v,20)}
|
|
1193
|
+
de(window,"mouseup",g)}else setTimeout(v,50)}function m(){if(null!=i.selectionStart){var e=r.somethingSelected(),o=""+(e?i.value:"")
|
|
1194
1194
|
i.value="⇚",i.value=o,t.prevInput=e?"":"",i.selectionStart=1,i.selectionEnd=o.length,n.selForContextMenu=r.doc.sel}}function v(){if(t.contextMenuPending==v&&(t.contextMenuPending=!1,t.wrapper.style.cssText=h,i.style.cssText=f,a&&l<9&&n.scrollbars.setScrollTop(n.scroller.scrollTop=u),null!=i.selectionStart)){(!a||a&&l<9)&&m()
|
|
1195
|
-
var e=0,o=function(){n.selForContextMenu==r.doc.sel&&0==i.selectionStart&&i.selectionEnd>0&&""==t.prevInput?
|
|
1196
|
-
n.detectingSelectAll=setTimeout(o,200)}}},
|
|
1197
|
-
function r(r,n,i,o){e.defaults[r]=n,i&&(t[r]=o?function(e,t,r){r!=
|
|
1195
|
+
var e=0,o=function(){n.selForContextMenu==r.doc.sel&&0==i.selectionStart&&i.selectionEnd>0&&""==t.prevInput?ei(r,ao)(r):e++<10?n.detectingSelectAll=setTimeout(o,500):(n.selForContextMenu=null,n.input.reset())}
|
|
1196
|
+
n.detectingSelectAll=setTimeout(o,200)}}},Va.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled="nocursor"==e},Va.prototype.setUneditable=function(){},Va.prototype.needsContentAttribute=!1,function(e){var t=e.optionHandlers
|
|
1197
|
+
function r(r,n,i,o){e.defaults[r]=n,i&&(t[r]=o?function(e,t,r){r!=ba&&i(e,t,r)}:i)}e.defineOption=r,e.Init=ba,r("value","",(function(e,t){return e.setValue(t)}),!0),r("mode",null,(function(e,t){e.doc.modeOption=t,Oi(e)}),!0),r("indentUnit",2,Oi,!0),r("indentWithTabs",!1),r("smartIndent",!0),r("tabSize",4,(function(e){Wi(e),Rr(e),dn(e)}),!0),r("lineSeparator",null,(function(e,t){if(e.doc.lineSep=t,t){var r=[],n=e.doc.first
|
|
1198
1198
|
e.doc.iter((function(e){for(var i=0;;){var o=e.text.indexOf(t,i)
|
|
1199
1199
|
if(-1==o)break
|
|
1200
|
-
i=o+t.length,r.push(
|
|
1201
|
-
for(var i=r.length-1;i>=0;i--)
|
|
1202
|
-
i&&i.detach&&i.detach(e,n),n.attach&&n.attach(e,i||null)})),r("extraKeys",null),r("configureMouse",null),r("lineWrapping",!1,
|
|
1200
|
+
i=o+t.length,r.push(et(n,o))}n++}))
|
|
1201
|
+
for(var i=r.length-1;i>=0;i--)po(e.doc,t,r[i],et(r[i].line,r[i].ch+t.length))}})),r("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,(function(e,t,r){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g"),r!=ba&&e.refresh()})),r("specialCharPlaceholder",Qt,(function(e){return e.refresh()}),!0),r("electricChars",!0),r("inputStyle",v?"contenteditable":"textarea",(function(){throw new Error("inputStyle can not (yet) be changed in a running editor")}),!0),r("spellcheck",!1,(function(e,t){return e.getInputField().spellcheck=t}),!0),r("autocorrect",!1,(function(e,t){return e.getInputField().autocorrect=t}),!0),r("autocapitalize",!1,(function(e,t){return e.getInputField().autocapitalize=t}),!0),r("rtlMoveVisually",!w),r("wholeLineUpdateBefore",!0),r("theme","default",(function(e){ya(e),gi(e)}),!0),r("keyMap","default",(function(e,t,r){var n=$o(t),i=r!=ba&&$o(r)
|
|
1202
|
+
i&&i.detach&&i.detach(e,n),n.attach&&n.attach(e,i||null)})),r("extraKeys",null),r("configureMouse",null),r("lineWrapping",!1,Ca,!0),r("gutters",[],(function(e,t){e.display.gutterSpecs=hi(t,e.options.lineNumbers),gi(e)}),!0),r("fixedGutter",!0,(function(e,t){e.display.gutters.style.left=t?an(e.display)+"px":"0",e.refresh()}),!0),r("coverGutterNextToScrollbar",!1,(function(e){return jn(e)}),!0),r("scrollbarStyle","native",(function(e){Gn(e),jn(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)}),!0),r("lineNumbers",!1,(function(e,t){e.display.gutterSpecs=hi(e.options.gutters,t),gi(e)}),!0),r("firstLineNumber",1,gi,!0),r("lineNumberFormatter",(function(e){return e}),gi,!0),r("showCursorWhenSelecting",!1,mn,!0),r("resetSelectionOnContextMenu",!0),r("lineWiseCopyCut",!0),r("pasteLinesPerSelection",!0),r("selectionsMayTouch",!1),r("readOnly",!1,(function(e,t){"nocursor"==t&&(Ln(e),e.display.input.blur()),e.display.input.readOnlyChanged(t)})),r("disableInput",!1,(function(e,t){t||e.display.input.reset()}),!0),r("dragDrop",!0,ka),r("allowDropFileTypes",null),r("cursorBlinkRate",530),r("cursorScrollMargin",0),r("cursorHeight",1,mn,!0),r("singleCursorHeightPerLine",!0,mn,!0),r("workTime",100),r("workDelay",100),r("flattenSpans",!0,Wi,!0),r("addModeClass",!1,Wi,!0),r("pollInterval",100),r("undoDepth",200,(function(e,t){return e.doc.history.undoDepth=t})),r("historyEventDelay",1250),r("viewportMargin",10,(function(e){return e.refresh()}),!0),r("maxHighlightLength",1e4,Wi,!0),r("moveInputWithCursor",!0,(function(e,t){t||e.display.input.resetPosition()})),r("tabindex",null,(function(e,t){return e.display.input.getField().tabIndex=t||""})),r("autofocus",null),r("direction","ltr",(function(e,t){return e.doc.setDirection(t)}),!0),r("phrases",null)}(Sa),function(e){var t=e.optionHandlers,r=e.helpers={}
|
|
1203
1203
|
e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,r){var n=this.options,i=n[e]
|
|
1204
|
-
n[e]==r&&"mode"!=e||(n[e]=r,t.hasOwnProperty(e)&&
|
|
1204
|
+
n[e]==r&&"mode"!=e||(n[e]=r,t.hasOwnProperty(e)&&ei(this,t[e])(this,r,i),pe(this,"optionChange",this,e))},getOption:function(e){return this.options[e]},getDoc:function(){return this.doc},addKeyMap:function(e,t){this.state.keyMaps[t?"push":"unshift"]($o(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,r=0;r<t.length;++r)if(t[r]==e||t[r].name==e)return t.splice(r,1),!0},addOverlay:ti((function(t,r){var n=t.token?t:e.getMode(this.options,t)
|
|
1205
1205
|
if(n.startState)throw new Error("Overlays may not be stateful.")
|
|
1206
1206
|
!function(e,t,r){for(var n=0,i=r(t);n<e.length&&r(e[n])<=i;)n++
|
|
1207
|
-
e.splice(n,0,t)}(this.state.overlays,{mode:n,modeSpec:t,opaque:r&&r.opaque,priority:r&&r.priority||0},(function(e){return e.priority})),this.state.modeGen++,
|
|
1208
|
-
if(n==e||"string"==typeof e&&n.name==e)return t.splice(r,1),this.state.modeGen++,void
|
|
1209
|
-
if(o.empty())o.head.line>n&&(
|
|
1207
|
+
e.splice(n,0,t)}(this.state.overlays,{mode:n,modeSpec:t,opaque:r&&r.opaque,priority:r&&r.priority||0},(function(e){return e.priority})),this.state.modeGen++,dn(this)})),removeOverlay:ti((function(e){for(var t=this.state.overlays,r=0;r<t.length;++r){var n=t[r].modeSpec
|
|
1208
|
+
if(n==e||"string"==typeof e&&n.name==e)return t.splice(r,1),this.state.modeGen++,void dn(this)}})),indentLine:ti((function(e,t,r){"string"!=typeof t&&"number"!=typeof t&&(t=null==t?this.options.smartIndent?"smart":"prev":t?"add":"subtract"),Qe(this.doc,e)&&Ta(this,e,t,r)})),indentSelection:ti((function(e){for(var t=this,r=this.doc.sel.ranges,n=-1,i=0;i<r.length;i++){var o=r[i]
|
|
1209
|
+
if(o.empty())o.head.line>n&&(Ta(t,o.head.line,e,!0),n=o.head.line,i==t.doc.sel.primIndex&&Wn(t))
|
|
1210
1210
|
else{var a=o.from(),l=o.to(),s=Math.max(n,a.line)
|
|
1211
1211
|
n=Math.min(t.lastLine(),l.line-(l.ch?0:1))+1
|
|
1212
|
-
for(var u=s;u<n;++u)
|
|
1212
|
+
for(var u=s;u<n;++u)Ta(t,u,e)
|
|
1213
1213
|
var c=t.doc.sel.ranges
|
|
1214
|
-
0==a.ch&&r.length==c.length&&c[i].from().ch>0&&
|
|
1215
|
-
var t,r=
|
|
1214
|
+
0==a.ch&&r.length==c.length&&c[i].from().ch>0&&Xi(t.doc,i,new Ci(a,c[i].to()),V)}}})),getTokenAt:function(e,t){return yt(this,e,t)},getLineTokens:function(e,t){return yt(this,et(e),t,!0)},getTokenTypeAt:function(e){e=lt(this.doc,e)
|
|
1215
|
+
var t,r=ft(this,qe(this.doc,e.line)),n=0,i=(r.length-1)/2,o=e.ch
|
|
1216
1216
|
if(0==o)t=r[2]
|
|
1217
1217
|
else for(;;){var a=n+i>>1
|
|
1218
1218
|
if((a?r[2*a-1]:0)>=o)i=a
|
|
@@ -1227,47 +1227,47 @@ else if(o[t])for(var a=0;a<o[t].length;a++){var l=i[o[t][a]]
|
|
|
1227
1227
|
l&&n.push(l)}else o.helperType&&i[o.helperType]?n.push(i[o.helperType]):i[o.name]&&n.push(i[o.name])
|
|
1228
1228
|
for(var s=0;s<i._global.length;s++){var u=i._global[s]
|
|
1229
1229
|
u.pred(o,this)&&-1==B(n,u.val)&&n.push(u.val)}return n},getStateAfter:function(e,t){var r=this.doc
|
|
1230
|
-
return
|
|
1231
|
-
return
|
|
1230
|
+
return ht(this,(e=at(r,null==e?r.first+r.size-1:e))+1,t).state},cursorCoords:function(e,t){var r=this.doc.sel.primary()
|
|
1231
|
+
return qr(this,null==e?r.head:"object"==typeof e?lt(this.doc,e):e?r.from():r.to(),t||"page")},charCoords:function(e,t){return Ur(this,lt(this.doc,e),t||"page")},coordsChar:function(e,t){return Xr(this,(e=Gr(this,e,t||"page")).left,e.top)},lineAtHeight:function(e,t){return e=Gr(this,{top:e,left:0},t||"page").top,Ze(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t,r){var n,i=!1
|
|
1232
1232
|
if("number"==typeof e){var o=this.doc.first+this.doc.size-1
|
|
1233
|
-
e<this.doc.first?e=this.doc.first:e>o&&(e=o,i=!0),n=
|
|
1234
|
-
return
|
|
1233
|
+
e<this.doc.first?e=this.doc.first:e>o&&(e=o,i=!0),n=qe(this.doc,e)}else n=e
|
|
1234
|
+
return Kr(this,n,{top:0,left:0},t||"page",r||i).top+(i?this.doc.height-Kt(n):0)},defaultTextHeight:function(){return rn(this.display)},defaultCharWidth:function(){return nn(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,r,n,i){var o,a,l=this.display,s=(e=qr(this,lt(this.doc,e))).bottom,u=e.left
|
|
1235
1235
|
if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),l.sizer.appendChild(t),"over"==n)s=e.top
|
|
1236
|
-
else if("above"==n||"near"==n){var c=Math.max(l.wrapper.clientHeight,this.doc.height),d=Math.max(l.sizer.clientWidth,l.lineSpace.clientWidth);("above"==n||e.bottom+t.offsetHeight>c)&&e.top>t.offsetHeight?s=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=c&&(s=e.bottom),u+t.offsetWidth>d&&(u=d-t.offsetWidth)}t.style.top=s+"px",t.style.left=t.style.right="","right"==i?(u=l.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?u=0:"middle"==i&&(u=(l.sizer.clientWidth-t.offsetWidth)/2),t.style.left=u+"px"),r&&(null!=(a=
|
|
1236
|
+
else if("above"==n||"near"==n){var c=Math.max(l.wrapper.clientHeight,this.doc.height),d=Math.max(l.sizer.clientWidth,l.lineSpace.clientWidth);("above"==n||e.bottom+t.offsetHeight>c)&&e.top>t.offsetHeight?s=e.top-t.offsetHeight:e.bottom+t.offsetHeight<=c&&(s=e.bottom),u+t.offsetWidth>d&&(u=d-t.offsetWidth)}t.style.top=s+"px",t.style.left=t.style.right="","right"==i?(u=l.sizer.clientWidth-t.offsetWidth,t.style.right="0px"):("left"==i?u=0:"middle"==i&&(u=(l.sizer.clientWidth-t.offsetWidth)/2),t.style.left=u+"px"),r&&(null!=(a=An(o=this,{left:u,top:s,right:u+t.offsetWidth,bottom:s+t.offsetHeight})).scrollTop&&Hn(o,a.scrollTop),null!=a.scrollLeft&&En(o,a.scrollLeft))},triggerOnKeyDown:ti(sa),triggerOnKeyPress:ti(ca),triggerOnKeyUp:ua,triggerOnMouseDown:ti(pa),execCommand:function(e){if(Jo.hasOwnProperty(e))return Jo[e].call(null,this)},triggerElectric:ti((function(e){Wa(this,e)})),findPosH:function(e,t,r,n){var i=1
|
|
1237
1237
|
t<0&&(i=-1,t=-t)
|
|
1238
|
-
for(var o=
|
|
1239
|
-
this.extendSelectionsBy((function(n){return r.display.shift||r.doc.extend||n.empty()?
|
|
1240
|
-
r.somethingSelected()?n.replaceSelection("",null,"+delete"):
|
|
1238
|
+
for(var o=lt(this.doc,e),a=0;a<t&&!(o=Ha(this.doc,o,i,r,n)).hitSide;++a);return o},moveH:ti((function(e,t){var r=this
|
|
1239
|
+
this.extendSelectionsBy((function(n){return r.display.shift||r.doc.extend||n.empty()?Ha(r.doc,n.head,e,t,r.options.rtlMoveVisually):e<0?n.from():n.to()}),G)})),deleteH:ti((function(e,t){var r=this.doc.sel,n=this.doc
|
|
1240
|
+
r.somethingSelected()?n.replaceSelection("",null,"+delete"):Xo(this,(function(r){var i=Ha(n,r.head,e,t,!1)
|
|
1241
1241
|
return e<0?{from:i,to:r.head}:{from:r.head,to:i}}))})),findPosV:function(e,t,r,n){var i=1,o=n
|
|
1242
1242
|
t<0&&(i=-1,t=-t)
|
|
1243
|
-
for(var a=
|
|
1244
|
-
if(null==o?o=s.left:s.left=o,(a=
|
|
1243
|
+
for(var a=lt(this.doc,e),l=0;l<t;++l){var s=qr(this,a,"div")
|
|
1244
|
+
if(null==o?o=s.left:s.left=o,(a=Ia(this,s,i,r)).hitSide)break}return a},moveV:ti((function(e,t){var r=this,n=this.doc,i=[],o=!this.display.shift&&!n.extend&&n.sel.somethingSelected()
|
|
1245
1245
|
if(n.extendSelectionsBy((function(a){if(o)return e<0?a.from():a.to()
|
|
1246
|
-
var l=
|
|
1246
|
+
var l=qr(r,a.head,"div")
|
|
1247
1247
|
null!=a.goalColumn&&(l.left=a.goalColumn),i.push(l.left)
|
|
1248
|
-
var s=
|
|
1249
|
-
return"page"==t&&a==n.sel.primary()&&
|
|
1248
|
+
var s=Ia(r,l,e,t)
|
|
1249
|
+
return"page"==t&&a==n.sel.primary()&&On(r,Ur(r,s,"div").top-l.top),s}),G),i.length)for(var a=0;a<n.sel.ranges.length;a++)n.sel.ranges[a].goalColumn=i[a]})),findWordAt:function(e){var t=qe(this.doc,e.line).text,r=e.ch,n=e.ch
|
|
1250
1250
|
if(t){var i=this.getHelper(e,"wordChars")
|
|
1251
1251
|
"before"!=e.sticky&&n!=t.length||!r?++n:--r
|
|
1252
|
-
for(var o=t.charAt(r),a=
|
|
1253
|
-
for(;n<t.length&&a(t.charAt(n));)++n}return new
|
|
1254
|
-
return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-
|
|
1255
|
-
null!=e&&(this.display.wrapper.style.width=n(e)),null!=t&&(this.display.wrapper.style.height=n(t)),this.options.lineWrapping&&
|
|
1252
|
+
for(var o=t.charAt(r),a=ee(o,i)?function(e){return ee(e,i)}:/\s/.test(o)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!ee(e)};r>0&&a(t.charAt(r-1));)--r
|
|
1253
|
+
for(;n<t.length&&a(t.charAt(n));)++n}return new Ci(et(e.line,r),et(e.line,n))},toggleOverwrite:function(e){null!=e&&e==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?z(this.display.cursorDiv,"CodeMirror-overwrite"):T(this.display.cursorDiv,"CodeMirror-overwrite"),pe(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==D()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:ti((function(e,t){Dn(this,e,t)})),getScrollInfo:function(){var e=this.display.scroller
|
|
1254
|
+
return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-Lr(this)-this.display.barHeight,width:e.scrollWidth-Lr(this)-this.display.barWidth,clientHeight:Mr(this),clientWidth:Tr(this)}},scrollIntoView:ti((function(e,t){null==e?(e={from:this.doc.sel.primary().head,to:null},null==t&&(t=this.options.cursorScrollMargin)):"number"==typeof e?e={from:et(e,0),to:null}:null==e.from&&(e={from:e,to:null}),e.to||(e.to=e.from),e.margin=t||0,null!=e.from.line?function(e,t){zn(e),e.curOp.scrollToPos=t}(this,e):Pn(this,e.from,e.to,e.margin)})),setSize:ti((function(e,t){var r=this,n=function(e){return"number"==typeof e||/^\d+$/.test(String(e))?e+"px":e}
|
|
1255
|
+
null!=e&&(this.display.wrapper.style.width=n(e)),null!=t&&(this.display.wrapper.style.height=n(t)),this.options.lineWrapping&&Fr(this)
|
|
1256
1256
|
var i=this.display.viewFrom
|
|
1257
|
-
this.doc.iter(i,this.display.viewTo,(function(e){if(e.widgets)for(var t=0;t<e.widgets.length;t++)if(e.widgets[t].noHScroll){
|
|
1258
|
-
break}++i})),this.curOp.forceUpdate=!0,
|
|
1259
|
-
|
|
1260
|
-
return t.cm=null,this.state.selectingText&&this.state.selectingText(),
|
|
1261
|
-
return t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:e},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},
|
|
1262
|
-
var
|
|
1263
|
-
for(var
|
|
1264
|
-
return
|
|
1257
|
+
this.doc.iter(i,this.display.viewTo,(function(e){if(e.widgets)for(var t=0;t<e.widgets.length;t++)if(e.widgets[t].noHScroll){fn(r,i,"widget")
|
|
1258
|
+
break}++i})),this.curOp.forceUpdate=!0,pe(this,"refresh",this)})),operation:function(e){return Jn(this,e)},startOperation:function(){return qn(this)},endOperation:function(){return _n(this)},refresh:ti((function(){var e=this.display.cachedTextHeight
|
|
1259
|
+
dn(this),this.curOp.forceUpdate=!0,Rr(this),Dn(this,this.doc.scrollLeft,this.doc.scrollTop),ui(this.display),(null==e||Math.abs(e-rn(this.display))>.5)&&sn(this),pe(this,"refresh",this)})),swapDoc:ti((function(e){var t=this.doc
|
|
1260
|
+
return t.cm=null,this.state.selectingText&&this.state.selectingText(),Hi(this,e),Rr(this),this.display.input.reset(),Dn(this,e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,lr(this,"swapDoc",this,t),t})),phrase:function(e){var t=this.options.phrases
|
|
1261
|
+
return t&&Object.prototype.hasOwnProperty.call(t,e)?t[e]:e},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},ye(e),e.registerHelper=function(t,n,i){r.hasOwnProperty(t)||(r[t]=e[t]={_global:[]}),r[t][n]=i},e.registerGlobalHelper=function(t,n,i,o){e.registerHelper(t,n,o),r[t]._global.push({pred:i,val:o})}}(Sa)
|
|
1262
|
+
var Ka="iter insert remove copy getEditor constructor".split(" ")
|
|
1263
|
+
for(var Ga in Oo.prototype)Oo.prototype.hasOwnProperty(Ga)&&B(Ka,Ga)<0&&(Sa.prototype[Ga]=function(e){return function(){return e.apply(this.doc,arguments)}}(Oo.prototype[Ga]))
|
|
1264
|
+
return ye(Oo),Sa.inputStyles={textarea:Va,contenteditable:Ea},Sa.defineMode=function(e){Sa.defaults.mode||"null"==e||(Sa.defaults.mode=e),Ee.apply(this,arguments)},Sa.defineMIME=function(e,t){Ie[e]=t},Sa.defineMode("null",(function(){return{token:function(e){return e.skipToEnd()}}})),Sa.defineMIME("text/plain","null"),Sa.defineExtension=function(e,t){Sa.prototype[e]=t},Sa.defineDocExtension=function(e,t){Oo.prototype[e]=t},Sa.fromTextArea=function(e,t){if((t=t?E(t):{}).value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),null==t.autofocus){var r=D()
|
|
1265
1265
|
t.autofocus=r==e||null!=e.getAttribute("autofocus")&&r==document.body}function n(){e.value=l.getValue()}var i
|
|
1266
|
-
if(e.form&&(
|
|
1266
|
+
if(e.form&&(de(e.form,"submit",n),!t.leaveSubmitMethodAlone)){var o=e.form
|
|
1267
1267
|
i=o.submit
|
|
1268
|
-
try{var a=o.submit=function(){n(),o.submit=i,o.submit(),o.submit=a}}catch(e){}}t.finishInit=function(t){t.save=n,t.getTextArea=function(){return e},t.toTextArea=function(){t.toTextArea=isNaN,n(),e.parentNode.removeChild(t.getWrapperElement()),e.style.display="",e.form&&(
|
|
1269
|
-
var l=
|
|
1270
|
-
return l},function(e){e.off=
|
|
1268
|
+
try{var a=o.submit=function(){n(),o.submit=i,o.submit(),o.submit=a}}catch(e){}}t.finishInit=function(t){t.save=n,t.getTextArea=function(){return e},t.toTextArea=function(){t.toTextArea=isNaN,n(),e.parentNode.removeChild(t.getWrapperElement()),e.style.display="",e.form&&(he(e.form,"submit",n),"function"==typeof e.form.submit&&(e.form.submit=i))}},e.style.display="none"
|
|
1269
|
+
var l=Sa((function(t){return e.parentNode.insertBefore(t,e.nextSibling)}),t)
|
|
1270
|
+
return l},function(e){e.off=he,e.on=de,e.wheelEventPixels=wi,e.Doc=Oo,e.splitLines=We,e.countColumn=F,e.findColumn=U,e.isWordChar=J,e.Pass=j,e.signal=pe,e.Line=qt,e.changeEnd=Ti,e.scrollbarModel=Kn,e.Pos=et,e.cmpPos=tt,e.modes=He,e.mimeModes=Ie,e.resolveMode=Fe,e.getMode=Re,e.modeExtensions=Be,e.extendMode=je,e.copyState=Ve,e.startState=Ge,e.innerMode=Ke,e.commands=Jo,e.keyMap=jo,e.keyName=_o,e.isModifierKey=Uo,e.lookupKey=Go,e.normalizeKeyMap=Ko,e.StringStream=Ue,e.SharedTextMarker=To,e.TextMarker=So,e.LineWidget=xo,e.e_preventDefault=be,e.e_stopPropagation=we,e.e_stop=ke,e.addClass=z,e.contains=W,e.rmClass=T,e.keyNames=Eo}(Sa),Sa.version="5.48.2",Sa})),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}((function(e){"use strict"
|
|
1271
1271
|
function t(e){for(var t={},r=0;r<e.length;++r)t[e[r].toLowerCase()]=!0
|
|
1272
1272
|
return t}e.defineMode("css",(function(t,r){var n=r.inline
|
|
1273
1273
|
r.propertyKeywords||(r=e.resolveMode("text/css"))
|
|
@@ -1337,7 +1337,7 @@ if(/[\[\]{}\(\),;\:\.]/.test(n))return p(n)
|
|
|
1337
1337
|
if("="==n&&e.eat(">"))return p("=>","operator")
|
|
1338
1338
|
if("0"==n&&e.match(/^(?:x[\dA-Fa-f_]+|o[0-7_]+|b[01_]+)n?/))return p("number","number")
|
|
1339
1339
|
if(/\d/.test(n))return e.match(/^[\d_]*(?:n|(?:\.[\d_]*)?(?:[eE][+\-]?[\d_]+)?)?/),p("number","number")
|
|
1340
|
-
if("/"==n)return e.eat("*")?(t.tokenize=m,m(e,t)):e.eat("/")?(e.skipToEnd(),p("comment","comment"))
|
|
1340
|
+
if("/"==n)return e.eat("*")?(t.tokenize=m,m(e,t)):e.eat("/")?(e.skipToEnd(),p("comment","comment")):$e(e,t,1)?(function(e){for(var t,r=!1,n=!1;null!=(t=e.next());){if(!r){if("/"==t&&!n)return
|
|
1341
1341
|
"["==t?n=!0:n&&"]"==t&&(n=!1)}r=!r&&"\\"==t}}(e),e.match(/^\b(([gimyus])(?![gimyus]*\2))+\b/),p("regexp","string-2")):(e.eat("="),p("operator","operator",e.current()))
|
|
1342
1342
|
if("`"==n)return t.tokenize=v,v(e,t)
|
|
1343
1343
|
if("#"==n)return e.skipToEnd(),p("error","error")
|
|
@@ -1347,11 +1347,10 @@ var i=e.current()
|
|
|
1347
1347
|
if("."!=t.lastType){if(d.propertyIsEnumerable(i)){var o=d[i]
|
|
1348
1348
|
return p(o.type,o.style,i)}if("async"==i&&e.match(/^(\s|\/\*.*?\*\/)*[\[\(\w]/,!1))return p("async","keyword",i)}return p("variable","variable",i)}}function m(e,t){for(var r,n=!1;r=e.next();){if("/"==r&&n){t.tokenize=g
|
|
1349
1349
|
break}n="*"==r}return p("comment","comment")}function v(e,t){for(var r,n=!1;null!=(r=e.next());){if(!n&&("`"==r||"$"==r&&e.eat("{"))){t.tokenize=g
|
|
1350
|
-
break}n=!n&&"\\"==r}return p("quasi","string-2",e.current())}
|
|
1351
|
-
function b(e,t){t.fatArrowAt&&(t.fatArrowAt=null)
|
|
1350
|
+
break}n=!n&&"\\"==r}return p("quasi","string-2",e.current())}function y(e,t){t.fatArrowAt&&(t.fatArrowAt=null)
|
|
1352
1351
|
var r=e.string.indexOf("=>",e.start)
|
|
1353
1352
|
if(!(r<0)){if(u){var n=/:\s*(?:\w+(?:<[^>]*>|\[\])?|\{[^}]*\})\s*$/.exec(e.string.slice(e.start,r))
|
|
1354
|
-
n&&(r=n.index)}for(var i=0,o=!1,a=r-1;a>=0;--a){var l=e.string.charAt(a),s=
|
|
1353
|
+
n&&(r=n.index)}for(var i=0,o=!1,a=r-1;a>=0;--a){var l=e.string.charAt(a),s="([{}])".indexOf(l)
|
|
1355
1354
|
if(s>=0&&s<3){if(!i){++a
|
|
1356
1355
|
break}if(0==--i){"("==l&&(o=!0)
|
|
1357
1356
|
break}}else if(s>=3&&s<6)++i
|
|
@@ -1359,47 +1358,47 @@ else if(c.test(l))o=!0
|
|
|
1359
1358
|
else if(/["'\/`]/.test(l))for(;;--a){if(0==a)return
|
|
1360
1359
|
if(e.string.charAt(a-1)==l&&"\\"!=e.string.charAt(a-2)){a--
|
|
1361
1360
|
break}}else if(o&&!i){++a
|
|
1362
|
-
break}}o&&!i&&(t.fatArrowAt=a)}}var
|
|
1363
|
-
function
|
|
1364
|
-
for(var n=e.context;n;n=n.prev)for(r=n.vars;r;r=r.next)if(r.name==t)return!0}var
|
|
1365
|
-
function
|
|
1366
|
-
return!1}function
|
|
1367
|
-
if(
|
|
1368
|
-
if(null!=n)return void(t.context=n)}else if(!
|
|
1369
|
-
r.globalVars&&!
|
|
1370
|
-
return r?r==t.prev?t:new
|
|
1371
|
-
function
|
|
1361
|
+
break}}o&&!i&&(t.fatArrowAt=a)}}var b={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,"jsonld-keyword":!0}
|
|
1362
|
+
function w(e,t,r,n,i,o){this.indented=e,this.column=t,this.type=r,this.prev=i,this.info=o,null!=n&&(this.align=n)}function x(e,t){for(var r=e.localVars;r;r=r.next)if(r.name==t)return!0
|
|
1363
|
+
for(var n=e.context;n;n=n.prev)for(r=n.vars;r;r=r.next)if(r.name==t)return!0}var k={state:null,column:null,marked:null,cc:null}
|
|
1364
|
+
function C(){for(var e=arguments.length-1;e>=0;e--)k.cc.push(arguments[e])}function S(){return C.apply(null,arguments),!0}function L(e,t){for(var r=t;r;r=r.next)if(r.name==e)return!0
|
|
1365
|
+
return!1}function T(e){var t=k.state
|
|
1366
|
+
if(k.marked="def",t.context)if("var"==t.lexical.info&&t.context&&t.context.block){var n=M(e,t.context)
|
|
1367
|
+
if(null!=n)return void(t.context=n)}else if(!L(e,t.localVars))return void(t.localVars=new O(e,t.localVars))
|
|
1368
|
+
r.globalVars&&!L(e,t.globalVars)&&(t.globalVars=new O(e,t.globalVars))}function M(e,t){if(t){if(t.block){var r=M(e,t.prev)
|
|
1369
|
+
return r?r==t.prev?t:new A(r,t.vars,!0):null}return L(e,t.vars)?t:new A(t.prev,new O(e,t.vars),!1)}return null}function N(e){return"public"==e||"private"==e||"protected"==e||"abstract"==e||"readonly"==e}function A(e,t,r){this.prev=e,this.vars=t,this.block=r}function O(e,t){this.name=e,this.next=t}var W=new O("this",new O("arguments",null))
|
|
1370
|
+
function D(){k.state.context=new A(k.state.context,k.state.localVars,!1),k.state.localVars=W}function z(){k.state.context=new A(k.state.context,k.state.localVars,!0),k.state.localVars=null}function P(){k.state.localVars=k.state.context.vars,k.state.context=k.state.context.prev}function H(e,t){var r=function(){var r=k.state,n=r.indented
|
|
1372
1371
|
if("stat"==r.lexical.type)n=r.lexical.indented
|
|
1373
1372
|
else for(var i=r.lexical;i&&")"==i.type&&i.align;i=i.prev)n=i.indented
|
|
1374
|
-
r.lexical=new
|
|
1375
|
-
return r.lex=!0,r}function
|
|
1376
|
-
e.lexical.prev&&(")"==e.lexical.type&&(e.indented=e.lexical.indented),e.lexical=e.lexical.prev)}function
|
|
1377
|
-
if("("==e)return
|
|
1378
|
-
if("variable"==e)return
|
|
1379
|
-
return
|
|
1380
|
-
return"=>"==e?
|
|
1381
|
-
var r}function
|
|
1382
|
-
return"call"==a.info&&(a.pos=(a.pos||0)+1),
|
|
1383
|
-
return
|
|
1384
|
-
if("?"==t)return
|
|
1385
|
-
if(":"==e)return
|
|
1386
|
-
if("="==t)return
|
|
1387
|
-
var r=
|
|
1388
|
-
return
|
|
1389
|
-
return r.globalVars&&"object"==typeof r.globalVars&&(t.globalVars=r.globalVars),t},token:function(e,t){if(e.sol()&&(t.lexical.hasOwnProperty("align")||(t.lexical.align=!1),t.indented=e.indentation(),
|
|
1373
|
+
r.lexical=new w(n,k.stream.column(),e,null,r.lexical,t)}
|
|
1374
|
+
return r.lex=!0,r}function I(){var e=k.state
|
|
1375
|
+
e.lexical.prev&&(")"==e.lexical.type&&(e.indented=e.lexical.indented),e.lexical=e.lexical.prev)}function E(e){return function t(r){return r==e?S():";"==e||"}"==r||")"==r||"]"==r?C():S(t)}}function F(e,t){return"var"==e?S(H("vardef",t),be,E(";"),I):"keyword a"==e?S(H("form"),V,F,I):"keyword b"==e?S(H("form"),F,I):"keyword d"==e?k.stream.match(/^\s*$/,!1)?S():S(H("stat"),G,E(";"),I):"debugger"==e?S(E(";")):"{"==e?S(H("}"),z,ae,I,P):";"==e?S():"if"==e?("else"==k.state.lexical.info&&k.state.cc[k.state.cc.length-1]==I&&k.state.cc.pop()(),S(H("form"),V,F,I,Le)):"function"==e?S(Ae):"for"==e?S(H("form"),Te,F,I):"class"==e||u&&"interface"==t?(k.marked="keyword",S(H("form","class"==e?e:t),Pe,I)):"variable"==e?u&&"declare"==t?(k.marked="keyword",S(F)):u&&("module"==t||"enum"==t||"type"==t)&&k.stream.match(/^\s*\w/,!1)?(k.marked="keyword","enum"==t?S(qe):"type"==t?S(We,E("operator"),de,E(";")):S(H("form"),we,E("{"),H("}"),ae,I,I)):u&&"namespace"==t?(k.marked="keyword",S(H("form"),B,F,I)):u&&"abstract"==t?(k.marked="keyword",S(F)):S(H("stat"),J):"switch"==e?S(H("form"),V,E("{"),H("}","switch"),z,ae,I,I,P):"case"==e?S(B,E(":")):"default"==e?S(E(":")):"catch"==e?S(H("form"),D,R,F,I,P):"export"==e?S(H("stat"),Fe,I):"import"==e?S(H("stat"),Be,I):"async"==e?S(F):"@"==t?S(B,F):C(H("stat"),B,E(";"),I)}function R(e){if("("==e)return S(De,E(")"))}function B(e,t){return K(e,t,!1)}function j(e,t){return K(e,t,!0)}function V(e){return"("!=e?C():S(H(")"),B,E(")"),I)}function K(e,t,r){if(k.state.fatArrowAt==k.stream.start){var n=r?Y:X
|
|
1376
|
+
if("("==e)return S(D,H(")"),ie(De,")"),I,E("=>"),n,P)
|
|
1377
|
+
if("variable"==e)return C(D,we,E("=>"),n,P)}var i=r?q:U
|
|
1378
|
+
return b.hasOwnProperty(e)?S(i):"function"==e?S(Ae,i):"class"==e||u&&"interface"==t?(k.marked="keyword",S(H("form"),ze,I)):"keyword c"==e||"async"==e?S(r?j:B):"("==e?S(H(")"),G,E(")"),I,i):"operator"==e||"spread"==e?S(r?j:B):"["==e?S(H("]"),Ue,I,i):"{"==e?oe(te,"}",null,i):"quasi"==e?C(_,i):"new"==e?S(function(e){return function(t){return"."==t?S(e?Q:Z):"variable"==t&&u?S(me,e?q:U):C(e?j:B)}}(r)):"import"==e?S(B):S()}function G(e){return e.match(/[;\}\)\],]/)?C():C(B)}function U(e,t){return","==e?S(B):q(e,t,!1)}function q(e,t,r){var n=0==r?U:q,i=0==r?B:j
|
|
1379
|
+
return"=>"==e?S(D,r?Y:X,P):"operator"==e?/\+\+|--/.test(t)||u&&"!"==t?S(n):u&&"<"==t&&k.stream.match(/^([^>]|<.*?>)*>\s*\(/,!1)?S(H(">"),ie(de,">"),I,n):"?"==t?S(B,E(":"),i):S(i):"quasi"==e?C(_,n):";"!=e?"("==e?oe(j,")","call",n):"."==e?S(ee,n):"["==e?S(H("]"),G,E("]"),I,n):u&&"as"==t?(k.marked="keyword",S(de,n)):"regexp"==e?(k.state.lastType=k.marked="operator",k.stream.backUp(k.stream.pos-k.stream.start-1),S(i)):void 0:void 0}function _(e,t){return"quasi"!=e?C():"${"!=t.slice(t.length-2)?S(_):S(B,$)}function $(e){if("}"==e)return k.marked="string-2",k.state.tokenize=v,S(_)}function X(e){return y(k.stream,k.state),C("{"==e?F:B)}function Y(e){return y(k.stream,k.state),C("{"==e?F:j)}function Z(e,t){if("target"==t)return k.marked="keyword",S(U)}function Q(e,t){if("target"==t)return k.marked="keyword",S(q)}function J(e){return":"==e?S(I,F):C(U,E(";"),I)}function ee(e){if("variable"==e)return k.marked="property",S()}function te(e,t){return"async"==e?(k.marked="property",S(te)):"variable"==e||"keyword"==k.style?(k.marked="property","get"==t||"set"==t?S(re):(u&&k.state.fatArrowAt==k.stream.start&&(r=k.stream.match(/^\s*:\s*/,!1))&&(k.state.fatArrowAt=k.stream.pos+r[0].length),S(ne))):"number"==e||"string"==e?(k.marked=l?"property":k.style+" property",S(ne)):"jsonld-keyword"==e?S(ne):u&&N(t)?(k.marked="keyword",S(te)):"["==e?S(B,le,E("]"),ne):"spread"==e?S(j,ne):"*"==t?(k.marked="keyword",S(te)):":"==e?C(ne):void 0
|
|
1380
|
+
var r}function re(e){return"variable"!=e?C(ne):(k.marked="property",S(Ae))}function ne(e){return":"==e?S(j):"("==e?C(Ae):void 0}function ie(e,t,r){function n(i,o){if(r?r.indexOf(i)>-1:","==i){var a=k.state.lexical
|
|
1381
|
+
return"call"==a.info&&(a.pos=(a.pos||0)+1),S((function(r,n){return r==t||n==t?C():C(e)}),n)}return i==t||o==t?S():r&&r.indexOf(";")>-1?C(e):S(E(t))}return function(r,i){return r==t||i==t?S():C(e,n)}}function oe(e,t,r){for(var n=3;n<arguments.length;n++)k.cc.push(arguments[n])
|
|
1382
|
+
return S(H(t,r),ie(e,t),I)}function ae(e){return"}"==e?S():C(F,ae)}function le(e,t){if(u){if(":"==e)return S(de)
|
|
1383
|
+
if("?"==t)return S(le)}}function se(e,t){if(u&&(":"==e||"in"==t))return S(de)}function ue(e){if(u&&":"==e)return k.stream.match(/^\s*\w+\s+is\b/,!1)?S(B,ce,de):S(de)}function ce(e,t){if("is"==t)return k.marked="keyword",S()}function de(e,t){return"keyof"==t||"typeof"==t||"infer"==t?(k.marked="keyword",S("typeof"==t?j:de)):"variable"==e||"void"==t?(k.marked="type",S(ge)):"|"==t||"&"==t?S(de):"string"==e||"number"==e||"atom"==e?S(ge):"["==e?S(H("]"),ie(de,"]",","),I,ge):"{"==e?S(H("}"),ie(he,"}",",;"),I,ge):"("==e?S(ie(pe,")"),fe,ge):"<"==e?S(ie(de,">"),de):void 0}function fe(e){if("=>"==e)return S(de)}function he(e,t){return"variable"==e||"keyword"==k.style?(k.marked="property",S(he)):"?"==t||"number"==e||"string"==e?S(he):":"==e?S(de):"["==e?S(E("variable"),se,E("]"),he):"("==e?C(Oe,he):void 0}function pe(e,t){return"variable"==e&&k.stream.match(/^\s*[?:]/,!1)||"?"==t?S(pe):":"==e?S(de):"spread"==e?S(pe):C(de)}function ge(e,t){return"<"==t?S(H(">"),ie(de,">"),I,ge):"|"==t||"."==e||"&"==t?S(de):"["==e?S(de,E("]"),ge):"extends"==t||"implements"==t?(k.marked="keyword",S(de)):"?"==t?S(de,E(":"),de):void 0}function me(e,t){if("<"==t)return S(H(">"),ie(de,">"),I,ge)}function ve(){return C(de,ye)}function ye(e,t){if("="==t)return S(de)}function be(e,t){return"enum"==t?(k.marked="keyword",S(qe)):C(we,le,Ce,Se)}function we(e,t){return u&&N(t)?(k.marked="keyword",S(we)):"variable"==e?(T(t),S()):"spread"==e?S(we):"["==e?oe(ke,"]"):"{"==e?oe(xe,"}"):void 0}function xe(e,t){return"variable"!=e||k.stream.match(/^\s*:/,!1)?("variable"==e&&(k.marked="property"),"spread"==e?S(we):"}"==e?C():"["==e?S(B,E("]"),E(":"),xe):S(E(":"),we,Ce)):(T(t),S(Ce))}function ke(){return C(we,Ce)}function Ce(e,t){if("="==t)return S(j)}function Se(e){if(","==e)return S(be)}function Le(e,t){if("keyword b"==e&&"else"==t)return S(H("form","else"),F,I)}function Te(e,t){return"await"==t?S(Te):"("==e?S(H(")"),Me,I):void 0}function Me(e){return"var"==e?S(be,Ne):"variable"==e?S(Ne):C(Ne)}function Ne(e,t){return")"==e?S():";"==e?S(Ne):"in"==t||"of"==t?(k.marked="keyword",S(B,Ne)):C(B,Ne)}function Ae(e,t){return"*"==t?(k.marked="keyword",S(Ae)):"variable"==e?(T(t),S(Ae)):"("==e?S(D,H(")"),ie(De,")"),I,ue,F,P):u&&"<"==t?S(H(">"),ie(ve,">"),I,Ae):void 0}function Oe(e,t){return"*"==t?(k.marked="keyword",S(Oe)):"variable"==e?(T(t),S(Oe)):"("==e?S(D,H(")"),ie(De,")"),I,ue,P):u&&"<"==t?S(H(">"),ie(ve,">"),I,Oe):void 0}function We(e,t){return"keyword"==e||"variable"==e?(k.marked="type",S(We)):"<"==t?S(H(">"),ie(ve,">"),I):void 0}function De(e,t){return"@"==t&&S(B,De),"spread"==e?S(De):u&&N(t)?(k.marked="keyword",S(De)):u&&"this"==e?S(le,Ce):C(we,le,Ce)}function ze(e,t){return"variable"==e?Pe(e,t):He(e,t)}function Pe(e,t){if("variable"==e)return T(t),S(He)}function He(e,t){return"<"==t?S(H(">"),ie(ve,">"),I,He):"extends"==t||"implements"==t||u&&","==e?("implements"==t&&(k.marked="keyword"),S(u?de:B,He)):"{"==e?S(H("}"),Ie,I):void 0}function Ie(e,t){return"async"==e||"variable"==e&&("static"==t||"get"==t||"set"==t||u&&N(t))&&k.stream.match(/^\s+[\w$\xa1-\uffff]/,!1)?(k.marked="keyword",S(Ie)):"variable"==e||"keyword"==k.style?(k.marked="property",S(u?Ee:Ae,Ie)):"number"==e||"string"==e?S(u?Ee:Ae,Ie):"["==e?S(B,le,E("]"),u?Ee:Ae,Ie):"*"==t?(k.marked="keyword",S(Ie)):u&&"("==e?C(Oe,Ie):";"==e||","==e?S(Ie):"}"==e?S():"@"==t?S(B,Ie):void 0}function Ee(e,t){if("?"==t)return S(Ee)
|
|
1384
|
+
if(":"==e)return S(de,Ce)
|
|
1385
|
+
if("="==t)return S(j)
|
|
1386
|
+
var r=k.state.lexical.prev
|
|
1387
|
+
return C(r&&"interface"==r.info?Oe:Ae)}function Fe(e,t){return"*"==t?(k.marked="keyword",S(Ge,E(";"))):"default"==t?(k.marked="keyword",S(B,E(";"))):"{"==e?S(ie(Re,"}"),Ge,E(";")):C(F)}function Re(e,t){return"as"==t?(k.marked="keyword",S(E("variable"))):"variable"==e?C(j,Re):void 0}function Be(e){return"string"==e?S():"("==e?C(B):C(je,Ve,Ge)}function je(e,t){return"{"==e?oe(je,"}"):("variable"==e&&T(t),"*"==t&&(k.marked="keyword"),S(Ke))}function Ve(e){if(","==e)return S(je,Ve)}function Ke(e,t){if("as"==t)return k.marked="keyword",S(je)}function Ge(e,t){if("from"==t)return k.marked="keyword",S(B)}function Ue(e){return"]"==e?S():C(ie(j,"]"))}function qe(){return C(H("form"),we,E("{"),H("}"),ie(_e,"}"),I,I)}function _e(){return C(we,Ce)}function $e(e,t,r){return t.tokenize==g&&/^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\[{}\(,;:]|=>)$/.test(t.lastType)||"quasi"==t.lastType&&/\{\s*$/.test(e.string.slice(0,e.pos-(r||0)))}return P.lex=!0,I.lex=!0,{startState:function(e){var t={tokenize:g,lastType:"sof",cc:[],lexical:new w((e||0)-o,0,"block",!1),localVars:r.localVars,context:r.localVars&&new A(null,null,!1),indented:e||0}
|
|
1388
|
+
return r.globalVars&&"object"==typeof r.globalVars&&(t.globalVars=r.globalVars),t},token:function(e,t){if(e.sol()&&(t.lexical.hasOwnProperty("align")||(t.lexical.align=!1),t.indented=e.indentation(),y(e,t)),t.tokenize!=m&&e.eatSpace())return null
|
|
1390
1389
|
var r=t.tokenize(e,t)
|
|
1391
1390
|
return"comment"==n?r:(t.lastType="operator"!=n||"++"!=i&&"--"!=i?n:"incdec",function(e,t,r,n,i){var o=e.cc
|
|
1392
|
-
for(
|
|
1393
|
-
return
|
|
1391
|
+
for(k.state=e,k.stream=i,k.marked=null,k.cc=o,k.style=t,e.lexical.hasOwnProperty("align")||(e.lexical.align=!0);;)if((o.length?o.pop():s?B:F)(r,n)){for(;o.length&&o[o.length-1].lex;)o.pop()()
|
|
1392
|
+
return k.marked?k.marked:"variable"==r&&x(e,n)?"variable-2":t}}(t,r,n,i,e))},indent:function(t,n){if(t.tokenize==m)return e.Pass
|
|
1394
1393
|
if(t.tokenize!=g)return 0
|
|
1395
1394
|
var i,l=n&&n.charAt(0),s=t.lexical
|
|
1396
1395
|
if(!/^\s*else\b/.test(n))for(var u=t.cc.length-1;u>=0;--u){var c=t.cc[u]
|
|
1397
|
-
if(c==
|
|
1398
|
-
else if(c!=
|
|
1396
|
+
if(c==I)s=s.prev
|
|
1397
|
+
else if(c!=Le)break}for(;("stat"==s.type||"form"==s.type)&&("}"==l||(i=t.cc[t.cc.length-1])&&(i==U||i==q)&&!/^[,\.=+\-*:?[\(]/.test(n));)s=s.prev
|
|
1399
1398
|
a&&")"==s.type&&"stat"==s.prev.type&&(s=s.prev)
|
|
1400
1399
|
var d=s.type,h=l==d
|
|
1401
|
-
return"vardef"==d?s.indented+("operator"==t.lastType||","==t.lastType?s.info.length+1:0):"form"==d&&"{"==l?s.indented:"form"==d?s.indented+o:"stat"==d?s.indented+(function(e,t){return"operator"==e.lastType||","==e.lastType||f.test(t.charAt(0))||/[,.]/.test(t.charAt(0))}(t,n)?a||o:0):"switch"!=s.info||h||0==r.doubleIndentSwitch?s.align?s.column+(h?0:1):s.indented+(h?0:o):s.indented+(/^(?:case|default)\b/.test(n)?o:2*o)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:s?null:"/*",blockCommentEnd:s?null:"*/",blockCommentContinue:s?null:" * ",lineComment:s?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:s?"json":"javascript",jsonldMode:l,jsonMode:s,expressionAllowed
|
|
1402
|
-
t!=
|
|
1400
|
+
return"vardef"==d?s.indented+("operator"==t.lastType||","==t.lastType?s.info.length+1:0):"form"==d&&"{"==l?s.indented:"form"==d?s.indented+o:"stat"==d?s.indented+(function(e,t){return"operator"==e.lastType||","==e.lastType||f.test(t.charAt(0))||/[,.]/.test(t.charAt(0))}(t,n)?a||o:0):"switch"!=s.info||h||0==r.doubleIndentSwitch?s.align?s.column+(h?0:1):s.indented+(h?0:o):s.indented+(/^(?:case|default)\b/.test(n)?o:2*o)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:s?null:"/*",blockCommentEnd:s?null:"*/",blockCommentContinue:s?null:" * ",lineComment:s?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:s?"json":"javascript",jsonldMode:l,jsonMode:s,expressionAllowed:$e,skipExpression:function(e){var t=e.cc[e.cc.length-1]
|
|
1401
|
+
t!=B&&t!=j||e.cc.pop()}}})),e.registerHelper("wordChars","javascript",/[\w$]/),e.defineMIME("text/javascript","javascript"),e.defineMIME("text/ecmascript","javascript"),e.defineMIME("application/javascript","javascript"),e.defineMIME("application/x-javascript","javascript"),e.defineMIME("application/ecmascript","javascript"),e.defineMIME("application/json",{name:"javascript",json:!0}),e.defineMIME("application/x-json",{name:"javascript",json:!0}),e.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),e.defineMIME("text/typescript",{name:"javascript",typescript:!0}),e.defineMIME("application/typescript",{name:"javascript",typescript:!0})})),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}((function(e){"use strict"
|
|
1403
1402
|
var t={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},r={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,allowMissingTagName:!1,caseFold:!1}
|
|
1404
1403
|
e.defineMode("xml",(function(n,i){var o,a,l=n.indentUnit,s={},u=i.htmlMode?t:r
|
|
1405
1404
|
for(var c in u)s[c]=u[c]
|
|
@@ -1437,4 +1436,4 @@ if(!a||!a.hasOwnProperty(o[2]))break
|
|
|
1437
1436
|
i=i.prev}for(;i&&i.prev&&!i.startOfLine;)i=i.prev
|
|
1438
1437
|
return i?i.indent+l:t.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"\x3c!--",blockCommentEnd:"--\x3e",configuration:s.htmlMode?"html":"xml",helperType:s.htmlMode?"html":"xml",skipAttribute:function(e){e.state==L&&(e.state=C)}}})),e.defineMIME("text/xml","xml"),e.defineMIME("application/xml","xml"),e.mimeModes.hasOwnProperty("text/html")||e.defineMIME("text/html",{name:"xml",htmlMode:!0})}))
|
|
1439
1438
|
|
|
1440
|
-
//# sourceMappingURL=codemirror-
|
|
1439
|
+
//# sourceMappingURL=codemirror-0bb6ad9e5932e66cef2a680d7dc42fa4.map
|