ghost 5.33.8 → 5.34.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (165) hide show
  1. package/components/tryghost-adapter-cache-redis-5.34.1.tgz +0 -0
  2. package/components/tryghost-adapter-manager-5.34.1.tgz +0 -0
  3. package/components/{tryghost-api-framework-5.33.8.tgz → tryghost-api-framework-5.34.1.tgz} +0 -0
  4. package/components/tryghost-api-version-compatibility-service-5.34.1.tgz +0 -0
  5. package/components/tryghost-audience-feedback-5.34.1.tgz +0 -0
  6. package/components/tryghost-bootstrap-socket-5.34.1.tgz +0 -0
  7. package/components/tryghost-constants-5.34.1.tgz +0 -0
  8. package/components/{tryghost-custom-theme-settings-service-5.33.8.tgz → tryghost-custom-theme-settings-service-5.34.1.tgz} +0 -0
  9. package/components/tryghost-data-generator-5.34.1.tgz +0 -0
  10. package/components/tryghost-domain-events-5.34.1.tgz +0 -0
  11. package/components/tryghost-dynamic-routing-events-5.34.1.tgz +0 -0
  12. package/components/tryghost-email-analytics-provider-mailgun-5.34.1.tgz +0 -0
  13. package/components/tryghost-email-analytics-service-5.34.1.tgz +0 -0
  14. package/components/tryghost-email-content-generator-5.34.1.tgz +0 -0
  15. package/components/tryghost-email-events-5.34.1.tgz +0 -0
  16. package/components/tryghost-email-service-5.34.1.tgz +0 -0
  17. package/components/tryghost-email-suppression-list-5.34.1.tgz +0 -0
  18. package/components/{tryghost-express-dynamic-redirects-5.33.8.tgz → tryghost-express-dynamic-redirects-5.34.1.tgz} +0 -0
  19. package/components/tryghost-extract-api-key-5.34.1.tgz +0 -0
  20. package/components/tryghost-html-to-plaintext-5.34.1.tgz +0 -0
  21. package/components/tryghost-i18n-5.34.1.tgz +0 -0
  22. package/components/{tryghost-importer-revue-5.33.8.tgz → tryghost-importer-revue-5.34.1.tgz} +0 -0
  23. package/components/{tryghost-job-manager-5.33.8.tgz → tryghost-job-manager-5.34.1.tgz} +0 -0
  24. package/components/tryghost-link-redirects-5.34.1.tgz +0 -0
  25. package/components/tryghost-link-replacer-5.34.1.tgz +0 -0
  26. package/components/tryghost-link-tracking-5.34.1.tgz +0 -0
  27. package/components/{tryghost-magic-link-5.33.8.tgz → tryghost-magic-link-5.34.1.tgz} +0 -0
  28. package/components/tryghost-mailgun-client-5.34.1.tgz +0 -0
  29. package/components/{tryghost-member-attribution-5.33.8.tgz → tryghost-member-attribution-5.34.1.tgz} +0 -0
  30. package/components/tryghost-member-events-5.34.1.tgz +0 -0
  31. package/components/tryghost-members-api-5.34.1.tgz +0 -0
  32. package/components/tryghost-members-csv-5.34.1.tgz +0 -0
  33. package/components/{tryghost-members-events-service-5.33.8.tgz → tryghost-members-events-service-5.34.1.tgz} +0 -0
  34. package/components/{tryghost-members-importer-5.33.8.tgz → tryghost-members-importer-5.34.1.tgz} +0 -0
  35. package/components/tryghost-members-offers-5.34.1.tgz +0 -0
  36. package/components/tryghost-members-payments-5.34.1.tgz +0 -0
  37. package/components/tryghost-members-ssr-5.34.1.tgz +0 -0
  38. package/components/tryghost-members-stripe-service-5.34.1.tgz +0 -0
  39. package/components/tryghost-milestone-emails-5.34.1.tgz +0 -0
  40. package/components/tryghost-minifier-5.34.1.tgz +0 -0
  41. package/components/tryghost-mw-api-version-mismatch-5.34.1.tgz +0 -0
  42. package/components/{tryghost-mw-cache-control-5.33.8.tgz → tryghost-mw-cache-control-5.34.1.tgz} +0 -0
  43. package/components/{tryghost-mw-error-handler-5.33.8.tgz → tryghost-mw-error-handler-5.34.1.tgz} +0 -0
  44. package/components/tryghost-mw-session-from-token-5.34.1.tgz +0 -0
  45. package/components/tryghost-mw-update-user-last-seen-5.34.1.tgz +0 -0
  46. package/components/tryghost-mw-vhost-5.34.1.tgz +0 -0
  47. package/components/tryghost-oembed-service-5.34.1.tgz +0 -0
  48. package/components/{tryghost-package-json-5.33.8.tgz → tryghost-package-json-5.34.1.tgz} +0 -0
  49. package/components/tryghost-referrers-5.34.1.tgz +0 -0
  50. package/components/tryghost-security-5.34.1.tgz +0 -0
  51. package/components/tryghost-session-service-5.34.1.tgz +0 -0
  52. package/components/tryghost-settings-path-manager-5.34.1.tgz +0 -0
  53. package/components/tryghost-staff-service-5.34.1.tgz +0 -0
  54. package/components/tryghost-stats-service-5.34.1.tgz +0 -0
  55. package/components/tryghost-tags-public-5.34.1.tgz +0 -0
  56. package/components/tryghost-tiers-5.34.1.tgz +0 -0
  57. package/components/{tryghost-update-check-service-5.33.8.tgz → tryghost-update-check-service-5.34.1.tgz} +0 -0
  58. package/components/tryghost-verification-trigger-5.34.1.tgz +0 -0
  59. package/components/tryghost-version-notifications-data-service-5.34.1.tgz +0 -0
  60. package/components/tryghost-webmentions-5.34.1.tgz +0 -0
  61. package/core/boot.js +6 -1
  62. package/core/built/admin/assets/{chunk.143.caa7dbd727b76021c31b.js → chunk.143.07f5af56ff872bb0e9e4.js} +14 -14
  63. package/core/built/admin/assets/{chunk.178.9803e6194593a0ed6595.js → chunk.178.2e831ef9072743e38dd1.js} +4 -4
  64. package/core/built/admin/assets/{chunk.963.e47ead5abeca4cf69fed.js → chunk.616.181e1ad6c33f0bec7a65.js} +3519 -3512
  65. package/core/built/admin/assets/{chunk.963.e47ead5abeca4cf69fed.js.LICENSE.txt → chunk.616.181e1ad6c33f0bec7a65.js.LICENSE.txt} +0 -0
  66. package/core/built/admin/assets/{chunk.79.c3c2c05ea7ff7707fcad.js → chunk.79.ec143a398298020c87e6.js} +112 -112
  67. package/core/built/admin/assets/codemirror/{codemirror-a81c0653d8e57286b75c5a1792f80779.js → codemirror-6c43f4894cbd8db73d7f35cde836c58e.js} +810 -809
  68. package/core/built/admin/assets/{ghost-fb9fb8adbcaf1603ad4006dd2d49e401.css → ghost-558c1e319d6e025bfab2054bc0f7fe83.css} +1 -1
  69. package/core/built/admin/assets/{ghost-872d240189f9b5ff85f4f7cb2ac3ab4c.js → ghost-ad40d109653288e74a7cd922341fb33d.js} +114 -89
  70. package/core/built/admin/assets/{ghost-dark-ac0cb221eddc8652a0e7c263ed6513dc.css → ghost-dark-a15754df1f9070dc2525482ce22e2251.css} +1 -1
  71. package/core/built/admin/assets/simplemde/{simplemde-2885e4a40ed66fcae974595584efe50b.js → simplemde-28049a9bd7f432b0648747eb26958a33.js} +836 -836
  72. package/core/built/admin/assets/{vendor-0441964c34d58f2aacd5a04bbe240243.js → vendor-253d6527ca6353855164ef65f896f762.js} +1208 -1233
  73. package/core/built/admin/index.html +6 -6
  74. package/core/cli/generate-data.js +21 -3
  75. package/core/frontend/services/routing/router-manager.js +1 -1
  76. package/core/frontend/web/middleware/handle-image-sizes.js +6 -21
  77. package/core/server/adapters/cache/Redis.js +3 -0
  78. package/core/server/adapters/storage/LocalStorageBase.js +11 -1
  79. package/core/server/api/endpoints/images.js +47 -6
  80. package/core/server/api/endpoints/mentions.js +1 -1
  81. package/core/server/api/endpoints/tags-public.js +2 -1
  82. package/core/server/api/endpoints/utils/serializers/output/mappers/mentions.js +1 -1
  83. package/core/server/api/endpoints/utils/serializers/output/utils/clean.js +1 -0
  84. package/core/server/data/migrations/versions/5.34/2023-01-30-07-27-add-mentions-permission.js +10 -0
  85. package/core/server/data/migrations/versions/5.34/2023-02-08-03-08-add-mentions-notifications-column.js +7 -0
  86. package/core/server/data/migrations/versions/5.34/2023-02-08-22-32-add-mentions-delete-column.js +7 -0
  87. package/core/server/data/schema/fixtures/fixtures.json +9 -2
  88. package/core/server/data/schema/schema.js +3 -1
  89. package/core/server/lib/image/image-size.js +23 -5
  90. package/core/server/lib/lexical.js +36 -3
  91. package/core/server/models/member.js +3 -0
  92. package/core/server/models/mention.js +7 -1
  93. package/core/server/models/post.js +1 -1
  94. package/core/server/models/user.js +4 -1
  95. package/core/server/services/adapter-manager/index.js +7 -0
  96. package/core/server/services/email-analytics/wrapper.js +22 -13
  97. package/core/server/services/email-service/wrapper.js +1 -1
  98. package/core/server/services/mega/post-email-serializer.js +1 -1
  99. package/core/server/services/members/jobs/index.js +4 -2
  100. package/core/server/services/mentions/BookshelfMentionRepository.js +3 -2
  101. package/core/server/services/mentions/MentionController.js +78 -12
  102. package/core/server/services/mentions/service.js +43 -3
  103. package/core/server/services/milestone-emails/MilestoneQueries.js +58 -0
  104. package/core/server/services/milestone-emails/index.js +1 -0
  105. package/core/server/services/milestone-emails/service.js +58 -0
  106. package/core/server/services/tags-public/index.js +1 -0
  107. package/core/server/services/tags-public/service.js +31 -0
  108. package/core/server/web/api/endpoints/admin/routes.js +0 -1
  109. package/core/server/web/api/middleware/index.js +0 -1
  110. package/core/server/web/shared/middleware/api/spam-prevention.js +31 -1
  111. package/core/server/web/shared/middleware/brute.js +13 -0
  112. package/core/server/web/webmentions/routes.js +3 -0
  113. package/core/shared/config/defaults.json +17 -1
  114. package/core/shared/config/env/config.development.json +0 -3
  115. package/core/shared/config/env/config.testing-browser.json +6 -0
  116. package/core/shared/config/env/config.testing-mysql.json +7 -0
  117. package/core/shared/config/env/config.testing.json +6 -0
  118. package/core/shared/labs.js +3 -3
  119. package/package.json +121 -114
  120. package/yarn.lock +327 -242
  121. package/components/tryghost-adapter-manager-5.33.8.tgz +0 -0
  122. package/components/tryghost-api-version-compatibility-service-5.33.8.tgz +0 -0
  123. package/components/tryghost-audience-feedback-5.33.8.tgz +0 -0
  124. package/components/tryghost-bootstrap-socket-5.33.8.tgz +0 -0
  125. package/components/tryghost-constants-5.33.8.tgz +0 -0
  126. package/components/tryghost-data-generator-5.33.8.tgz +0 -0
  127. package/components/tryghost-domain-events-5.33.8.tgz +0 -0
  128. package/components/tryghost-dynamic-routing-events-5.33.8.tgz +0 -0
  129. package/components/tryghost-email-analytics-provider-mailgun-5.33.8.tgz +0 -0
  130. package/components/tryghost-email-analytics-service-5.33.8.tgz +0 -0
  131. package/components/tryghost-email-content-generator-5.33.8.tgz +0 -0
  132. package/components/tryghost-email-events-5.33.8.tgz +0 -0
  133. package/components/tryghost-email-service-5.33.8.tgz +0 -0
  134. package/components/tryghost-email-suppression-list-5.33.8.tgz +0 -0
  135. package/components/tryghost-extract-api-key-5.33.8.tgz +0 -0
  136. package/components/tryghost-html-to-plaintext-5.33.8.tgz +0 -0
  137. package/components/tryghost-i18n-5.33.8.tgz +0 -0
  138. package/components/tryghost-link-redirects-5.33.8.tgz +0 -0
  139. package/components/tryghost-link-replacer-5.33.8.tgz +0 -0
  140. package/components/tryghost-link-tracking-5.33.8.tgz +0 -0
  141. package/components/tryghost-mailgun-client-5.33.8.tgz +0 -0
  142. package/components/tryghost-member-events-5.33.8.tgz +0 -0
  143. package/components/tryghost-members-api-5.33.8.tgz +0 -0
  144. package/components/tryghost-members-csv-5.33.8.tgz +0 -0
  145. package/components/tryghost-members-offers-5.33.8.tgz +0 -0
  146. package/components/tryghost-members-payments-5.33.8.tgz +0 -0
  147. package/components/tryghost-members-ssr-5.33.8.tgz +0 -0
  148. package/components/tryghost-members-stripe-service-5.33.8.tgz +0 -0
  149. package/components/tryghost-minifier-5.33.8.tgz +0 -0
  150. package/components/tryghost-mw-api-version-mismatch-5.33.8.tgz +0 -0
  151. package/components/tryghost-mw-session-from-token-5.33.8.tgz +0 -0
  152. package/components/tryghost-mw-update-user-last-seen-5.33.8.tgz +0 -0
  153. package/components/tryghost-mw-vhost-5.33.8.tgz +0 -0
  154. package/components/tryghost-oembed-service-5.33.8.tgz +0 -0
  155. package/components/tryghost-referrers-5.33.8.tgz +0 -0
  156. package/components/tryghost-security-5.33.8.tgz +0 -0
  157. package/components/tryghost-session-service-5.33.8.tgz +0 -0
  158. package/components/tryghost-settings-path-manager-5.33.8.tgz +0 -0
  159. package/components/tryghost-staff-service-5.33.8.tgz +0 -0
  160. package/components/tryghost-stats-service-5.33.8.tgz +0 -0
  161. package/components/tryghost-tiers-5.33.8.tgz +0 -0
  162. package/components/tryghost-verification-trigger-5.33.8.tgz +0 -0
  163. package/components/tryghost-version-notifications-data-service-5.33.8.tgz +0 -0
  164. package/components/tryghost-webmentions-5.33.8.tgz +0 -0
  165. package/core/server/web/api/middleware/normalize-image.js +0 -42
@@ -260,22 +260,22 @@ else{var v=m[1],y=m[5],x=!(r.test(m[2])||m[2].indexOf(">")>=0),b=x?parseInt(m[3]
260
260
  l[s]="\n"+v+b+y,x&&i(o,u)}}o.replaceSelections(l)}})("object"==typeof n&&"object"==typeof t?e("../../lib/codemirror"):CodeMirror)},{"../../lib/codemirror":10}],8:[function(e,t,n){(function(e){"use strict"
261
261
  e.overlayMode=function(t,n,r){return{startState:function(){return{base:e.startState(t),overlay:e.startState(n),basePos:0,baseCur:null,overlayPos:0,overlayCur:null,streamSeen:null}},copyState:function(r){return{base:e.copyState(t,r.base),overlay:e.copyState(n,r.overlay),basePos:r.basePos,baseCur:null,overlayPos:r.overlayPos,overlayCur:null}},token:function(e,i){return(e!=i.streamSeen||Math.min(i.basePos,i.overlayPos)<e.start)&&(i.streamSeen=e,i.basePos=i.overlayPos=e.start),e.start==i.basePos&&(i.baseCur=t.token(e,i.base),i.basePos=e.pos),e.start==i.overlayPos&&(e.pos=e.start,i.overlayCur=n.token(e,i.overlay),i.overlayPos=e.pos),e.pos=Math.min(i.basePos,i.overlayPos),null==i.overlayCur?i.baseCur:null!=i.baseCur&&i.overlay.combineTokens||r&&null==i.overlay.combineTokens?i.baseCur+" "+i.overlayCur:i.overlayCur},indent:t.indent&&function(e,n,r){return t.indent(e.base,n,r)},electricChars:t.electricChars,innerMode:function(e){return{state:e.base,mode:t}},blankLine:function(e){var i,o
262
262
  return t.blankLine&&(i=t.blankLine(e.base)),n.blankLine&&(o=n.blankLine(e.overlay)),null==o?i:r&&null!=i?i+" "+o:o}}}})("object"==typeof n&&"object"==typeof t?e("../../lib/codemirror"):CodeMirror)},{"../../lib/codemirror":10}],9:[function(e,t,n){(function(e){"use strict"
263
- function t(e){e.state.markedSelection&&e.operation((function(){!function(e){if(!e.somethingSelected())return a(e)
264
- if(e.listSelections().length>1)return l(e)
265
- var t=e.getCursor("start"),n=e.getCursor("end"),r=e.state.markedSelection
266
- if(!r.length)return o(e,t,n)
267
- var s=r[0].find(),u=r[r.length-1].find()
268
- if(!s||!u||n.line-t.line<=8||i(t,u.to)>=0||i(n,s.from)<=0)return l(e)
269
- for(;i(t,s.from)>0;)r.shift().clear(),s=r[0].find()
270
- for(i(t,s.from)<0&&(s.to.line-t.line<8?(r.shift().clear(),o(e,t,s.to,0)):o(e,t,s.from,0));i(n,u.to)<0;)r.pop().clear(),u=r[r.length-1].find()
271
- i(n,u.to)>0&&(n.line-u.from.line<8?(r.pop().clear(),o(e,u.from,n)):o(e,u.to,n))}(e)}))}function n(e){e.state.markedSelection&&e.state.markedSelection.length&&e.operation((function(){a(e)}))}e.defineOption("styleSelectedText",!1,(function(r,i,o){var s=o&&o!=e.Init
272
- i&&!s?(r.state.markedSelection=[],r.state.markedSelectionStyle="string"==typeof i?i:"CodeMirror-selectedtext",l(r),r.on("cursorActivity",t),r.on("change",n)):!i&&s&&(r.off("cursorActivity",t),r.off("change",n),a(r),r.state.markedSelection=r.state.markedSelectionStyle=null)}))
273
- var r=e.Pos,i=e.cmpPos
274
- function o(e,t,n,o){if(0!=i(t,n))for(var a=e.state.markedSelection,l=e.state.markedSelectionStyle,s=t.line;;){var u=s==t.line?t:r(s,0),c=s+8,f=c>=n.line,d=f?n:r(c,0),h=e.markText(u,d,{className:l})
275
- if(null==o?a.push(h):a.splice(o++,0,h),f)break
276
- s=c}}function a(e){for(var t=e.state.markedSelection,n=0;n<t.length;++n)t[n].clear()
277
- t.length=0}function l(e){a(e)
278
- for(var t=e.listSelections(),n=0;n<t.length;n++)o(e,t[n].from(),t[n].to())}})("object"==typeof n&&"object"==typeof t?e("../../lib/codemirror"):CodeMirror)},{"../../lib/codemirror":10}],10:[function(e,t,n){!function(e,r){"object"==typeof n&&void 0!==t?t.exports=r():e.CodeMirror=r()}(this,(function(){"use strict"
263
+ function t(e){e.state.markedSelection&&e.operation((function(){!function(e){if(!e.somethingSelected())return l(e)
264
+ if(e.listSelections().length>1)return s(e)
265
+ var t=e.getCursor("start"),n=e.getCursor("end"),i=e.state.markedSelection
266
+ if(!i.length)return a(e,t,n)
267
+ var u=i[0].find(),c=i[i.length-1].find()
268
+ if(!u||!c||n.line-t.line<=r||o(t,c.to)>=0||o(n,u.from)<=0)return s(e)
269
+ for(;o(t,u.from)>0;)i.shift().clear(),u=i[0].find()
270
+ for(o(t,u.from)<0&&(u.to.line-t.line<r?(i.shift().clear(),a(e,t,u.to,0)):a(e,t,u.from,0));o(n,c.to)<0;)i.pop().clear(),c=i[i.length-1].find()
271
+ o(n,c.to)>0&&(n.line-c.from.line<r?(i.pop().clear(),a(e,c.from,n)):a(e,c.to,n))}(e)}))}function n(e){e.state.markedSelection&&e.state.markedSelection.length&&e.operation((function(){l(e)}))}e.defineOption("styleSelectedText",!1,(function(r,i,o){var a=o&&o!=e.Init
272
+ i&&!a?(r.state.markedSelection=[],r.state.markedSelectionStyle="string"==typeof i?i:"CodeMirror-selectedtext",s(r),r.on("cursorActivity",t),r.on("change",n)):!i&&a&&(r.off("cursorActivity",t),r.off("change",n),l(r),r.state.markedSelection=r.state.markedSelectionStyle=null)}))
273
+ var r=8,i=e.Pos,o=e.cmpPos
274
+ function a(e,t,n,a){if(0!=o(t,n))for(var l=e.state.markedSelection,s=e.state.markedSelectionStyle,u=t.line;;){var c=u==t.line?t:i(u,0),f=u+r,d=f>=n.line,h=d?n:i(f,0),p=e.markText(c,h,{className:s})
275
+ if(null==a?l.push(p):l.splice(a++,0,p),d)break
276
+ u=f}}function l(e){for(var t=e.state.markedSelection,n=0;n<t.length;++n)t[n].clear()
277
+ t.length=0}function s(e){l(e)
278
+ for(var t=e.listSelections(),n=0;n<t.length;n++)a(e,t[n].from(),t[n].to())}})("object"==typeof n&&"object"==typeof t?e("../../lib/codemirror"):CodeMirror)},{"../../lib/codemirror":10}],10:[function(e,t,n){!function(e,r){"object"==typeof n&&void 0!==t?t.exports=r():e.CodeMirror=r()}(this,(function(){"use strict"
279
279
  var e=navigator.userAgent,t=navigator.platform,n=/gecko\/\d/i.test(e),r=/MSIE \d/.test(e),i=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(e),o=/Edge\/(\d+)/.exec(e),a=r||i||o,l=a&&(r?document.documentMode||6:+(o||i)[1]),s=!o&&/WebKit\//.test(e),u=s&&/Qt\/\d+\.\d+/.test(e),c=!o&&/Chrome\//.test(e),f=/Opera\//.test(e),d=/Apple Computer/.test(navigator.vendor),h=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(e),p=/PhantomJS/.test(e),m=!o&&/AppleWebKit/.test(e)&&/Mobile\/\w+/.test(e),g=/Android/.test(e),v=m||g||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(e),y=m||/Mac/.test(t),x=/\bCrOS\b/.test(e),b=/win/i.test(t),w=f&&e.match(/Version\/(\d*\.\d*)/)
280
280
  w&&(w=Number(w[1])),w&&w>=15&&(f=!1,s=!0)
281
281
  var C=y&&(u||f&&(null==w||w<12.11)),k=n||a&&l>=9
@@ -305,27 +305,27 @@ a+=l-o,a+=n-a%n,o=l+1}}m?B=function(e){e.selectionStart=0,e.selectionEnd=e.value
305
305
  var R=function(){this.id=null}
306
306
  function z(e,t){for(var n=0;n<e.length;++n)if(e[n]==t)return n
307
307
  return-1}R.prototype.set=function(e,t){clearTimeout(this.id),this.id=setTimeout(t,e)}
308
- var j={toString:function(){return"CodeMirror.Pass"}},_={scroll:!1},U={origin:"*mouse"},q={origin:"+move"}
309
- function G(e,t,n){for(var r=0,i=0;;){var o=e.indexOf("\t",r);-1==o&&(o=e.length)
308
+ var j=30,_={toString:function(){return"CodeMirror.Pass"}},U={scroll:!1},q={origin:"*mouse"},G={origin:"+move"}
309
+ function V(e,t,n){for(var r=0,i=0;;){var o=e.indexOf("\t",r);-1==o&&(o=e.length)
310
310
  var a=o-r
311
311
  if(o==e.length||i+a>=t)return r+Math.min(a,t-i)
312
- if(i+=o-r,r=o+1,(i+=n-i%n)>=t)return r}}var V=[""]
313
- function $(e){for(;V.length<=e;)V.push(X(V)+" ")
314
- return V[e]}function X(e){return e[e.length-1]}function K(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r)
315
- return n}function Y(){}function Z(e,t){var n
316
- return Object.create?n=Object.create(e):(Y.prototype=e,n=new Y),t&&W(t,n),n}var Q=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/
317
- 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
318
- return!0}var ne=/[\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]/
319
- function re(e){return e.charCodeAt(0)>=768&&ne.test(e)}function ie(e,t,n){for(;(n<0?t>0:t<e.length)&&re(e.charAt(t));)t+=n
320
- return t}function oe(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t
312
+ if(i+=o-r,r=o+1,(i+=n-i%n)>=t)return r}}var $=[""]
313
+ function X(e){for(;$.length<=e;)$.push(K($)+" ")
314
+ return $[e]}function K(e){return e[e.length-1]}function Y(e,t){for(var n=[],r=0;r<e.length;r++)n[r]=t(e[r],r)
315
+ return n}function Z(){}function Q(e,t){var n
316
+ return Object.create?n=Object.create(e):(Z.prototype=e,n=new Z),t&&W(t,n),n}var J=/[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/
317
+ function ee(e){return/\w/.test(e)||e>"€"&&(e.toUpperCase()!=e.toLowerCase()||J.test(e))}function te(e,t){return t?!!(t.source.indexOf("\\w")>-1&&ee(e))||t.test(e):ee(e)}function ne(e){for(var t in e)if(e.hasOwnProperty(t)&&e[t])return!1
318
+ 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]/
319
+ function ie(e){return e.charCodeAt(0)>=768&&re.test(e)}function oe(e,t,n){for(;(n<0?t>0:t<e.length)&&ie(e.charAt(t));)t+=n
320
+ return t}function ae(e,t,n){for(var r=t>n?-1:1;;){if(t==n)return t
321
321
  var i=(t+n)/2,o=r<0?Math.ceil(i):Math.floor(i)
322
322
  if(o==t)return e(o)?t:n
323
- e(o)?n=o:t=o+r}}var ae=null
324
- function le(e,t,n){var r
325
- ae=null
323
+ e(o)?n=o:t=o+r}}var le=null
324
+ function se(e,t,n){var r
325
+ le=null
326
326
  for(var i=0;i<e.length;++i){var o=e[i]
327
327
  if(o.from<t&&o.to>t)return i
328
- o.to==t&&(o.from!=o.to&&"before"==n?r=i:ae=i),o.from==t&&(o.from!=o.to&&"before"!=n?r=i:ae=i)}return null!=r?r:ae}var se=function(){var e=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,t=/[stwN]/,n=/[LRr]/,r=/[Lb1n]/,i=/[1n]/
328
+ o.to==t&&(o.from!=o.to&&"before"==n?r=i:le=i),o.from==t&&(o.from!=o.to&&"before"!=n?r=i:le=i)}return null!=r?r:le}var ue=function(){var e=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,t=/[stwN]/,n=/[LRr]/,r=/[Lb1n]/,i=/[1n]/
329
329
  function o(e,t,n){this.level=e,this.from=t,this.to=n}return function(a,l){var s="ltr"==l?"L":"R"
330
330
  if(0==a.length||"ltr"==l&&!e.test(a))return!1
331
331
  for(var u,c=a.length,f=[],d=0;d<c;++d)f.push((u=a.charCodeAt(d))<=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")
@@ -344,178 +344,178 @@ for(++W;W<c&&r.test(f[W]);++W);H.push(new o(0,P,W))}else{var R=W,z=H.length
344
344
  for(++W;W<c&&"L"!=f[W];++W);for(var j=R;j<W;)if(i.test(f[j])){R<j&&H.splice(z,0,new o(1,R,j))
345
345
  var _=j
346
346
  for(++j;j<W&&i.test(f[j]);++j);H.splice(z,0,new o(2,_,j)),R=j}else++j
347
- R<W&&H.splice(z,0,new o(1,R,W))}return"ltr"==l&&(1==H[0].level&&(B=a.match(/^\s+/))&&(H[0].from=B[0].length,H.unshift(new o(0,0,B[0].length))),1==X(H).level&&(B=a.match(/\s+$/))&&(X(H).to-=B[0].length,H.push(new o(0,c-B[0].length,c)))),"rtl"==l?H.reverse():H}}()
348
- function ue(e,t){var n=e.order
349
- return null==n&&(n=e.order=se(e.text,t)),n}var ce=[],fe=function(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1)
347
+ R<W&&H.splice(z,0,new o(1,R,W))}return"ltr"==l&&(1==H[0].level&&(B=a.match(/^\s+/))&&(H[0].from=B[0].length,H.unshift(new o(0,0,B[0].length))),1==K(H).level&&(B=a.match(/\s+$/))&&(K(H).to-=B[0].length,H.push(new o(0,c-B[0].length,c)))),"rtl"==l?H.reverse():H}}()
348
+ function ce(e,t){var n=e.order
349
+ return null==n&&(n=e.order=ue(e.text,t)),n}var fe=[],de=function(e,t,n){if(e.addEventListener)e.addEventListener(t,n,!1)
350
350
  else if(e.attachEvent)e.attachEvent("on"+t,n)
351
351
  else{var r=e._handlers||(e._handlers={})
352
- r[t]=(r[t]||ce).concat(n)}}
353
- function de(e,t){return e._handlers&&e._handlers[t]||ce}function he(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1)
352
+ r[t]=(r[t]||fe).concat(n)}}
353
+ function he(e,t){return e._handlers&&e._handlers[t]||fe}function pe(e,t,n){if(e.removeEventListener)e.removeEventListener(t,n,!1)
354
354
  else if(e.detachEvent)e.detachEvent("on"+t,n)
355
355
  else{var r=e._handlers,i=r&&r[t]
356
356
  if(i){var o=z(i,n)
357
- o>-1&&(r[t]=i.slice(0,o).concat(i.slice(o+1)))}}}function pe(e,t){var n=de(e,t)
358
- if(n.length)for(var r=Array.prototype.slice.call(arguments,2),i=0;i<n.length;++i)n[i].apply(null,r)}function me(e,t,n){return"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),pe(e,n||t.type,e,t),we(t)||t.codemirrorIgnore}function ge(e){var t=e._handlers&&e._handlers.cursorActivity
359
- if(t)for(var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)-1==z(n,t[r])&&n.push(t[r])}function ve(e,t){return de(e,t).length>0}function ye(e){e.prototype.on=function(e,t){fe(this,e,t)},e.prototype.off=function(e,t){he(this,e,t)}}function xe(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function be(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function we(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function Ce(e){xe(e),be(e)}function ke(e){return e.target||e.srcElement}function Se(e){var t=e.which
360
- 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
357
+ o>-1&&(r[t]=i.slice(0,o).concat(i.slice(o+1)))}}}function me(e,t){var n=he(e,t)
358
+ if(n.length)for(var r=Array.prototype.slice.call(arguments,2),i=0;i<n.length;++i)n[i].apply(null,r)}function ge(e,t,n){return"string"==typeof t&&(t={type:t,preventDefault:function(){this.defaultPrevented=!0}}),me(e,n||t.type,e,t),Ce(t)||t.codemirrorIgnore}function ve(e){var t=e._handlers&&e._handlers.cursorActivity
359
+ if(t)for(var n=e.curOp.cursorActivityHandlers||(e.curOp.cursorActivityHandlers=[]),r=0;r<t.length;++r)-1==z(n,t[r])&&n.push(t[r])}function ye(e,t){return he(e,t).length>0}function xe(e){e.prototype.on=function(e,t){de(this,e,t)},e.prototype.off=function(e,t){pe(this,e,t)}}function be(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function we(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function Ce(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function ke(e){be(e),we(e)}function Se(e){return e.target||e.srcElement}function Le(e){var t=e.which
360
+ 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,Ae=function(){if(a&&l<9)return!1
361
361
  var e=N("div")
362
362
  return"draggable"in e||"dragDrop"in e}()
363
- function Ae(e){if(null==Le){var t=N("span","​")
364
- A(e,N("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(Le=t.offsetWidth<=1&&t.offsetHeight>2&&!(a&&l<8))}var n=Le?N("span","​"):N("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px")
365
- return n.setAttribute("cm-text",""),n}function Ne(e){if(null!=Te)return Te
363
+ function Ne(e){if(null==Te){var t=N("span","​")
364
+ A(e,N("span",[t,document.createTextNode("x")])),0!=e.firstChild.offsetHeight&&(Te=t.offsetWidth<=1&&t.offsetHeight>2&&!(a&&l<8))}var n=Te?N("span","​"):N("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px")
365
+ return n.setAttribute("cm-text",""),n}function Ee(e){if(null!=Me)return Me
366
366
  var t=A(e,document.createTextNode("AخA")),n=L(t,0,1).getBoundingClientRect(),r=L(t,1,2).getBoundingClientRect()
367
- return M(e),!(!n||n.left==n.right)&&(Te=r.right-n.right<3)}var Ee,De=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,n=[],r=e.length;t<=r;){var i=e.indexOf("\n",t);-1==i&&(i=e.length)
368
- var o=e.slice(t,"\r"==e.charAt(i-1)?i-1:i),a=o.indexOf("\r");-1!=a?(n.push(o.slice(0,a)),t+=a+1):(n.push(o),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},Fe=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(e){return!1}}:function(e){var t
369
- try{t=e.ownerDocument.selection.createRange()}catch(e){}return!(!t||t.parentElement()!=e)&&0!=t.compareEndPoints("StartToEnd",t)},Oe="oncopy"in(Ee=N("div"))||(Ee.setAttribute("oncopy","return;"),"function"==typeof Ee.oncopy),Ie=null,Be={},He={}
370
- function We(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),Be[e]=t}function Pe(e){if("string"==typeof e&&He.hasOwnProperty(e))e=He[e]
371
- else if(e&&"string"==typeof e.name&&He.hasOwnProperty(e.name)){var t=He[e.name]
372
- "string"==typeof t&&(t={name:t}),(e=Z(t,e)).name=t.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Pe("application/xml")
373
- if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Pe("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function Re(e,t){t=Pe(t)
374
- var n=Be[t.name]
375
- if(!n)return Re(e,"text/plain")
367
+ return M(e),!(!n||n.left==n.right)&&(Me=r.right-n.right<3)}var De,Fe=3!="\n\nb".split(/\n/).length?function(e){for(var t=0,n=[],r=e.length;t<=r;){var i=e.indexOf("\n",t);-1==i&&(i=e.length)
368
+ var o=e.slice(t,"\r"==e.charAt(i-1)?i-1:i),a=o.indexOf("\r");-1!=a?(n.push(o.slice(0,a)),t+=a+1):(n.push(o),t=i+1)}return n}:function(e){return e.split(/\r\n?|\n/)},Oe=window.getSelection?function(e){try{return e.selectionStart!=e.selectionEnd}catch(e){return!1}}:function(e){var t
369
+ try{t=e.ownerDocument.selection.createRange()}catch(e){}return!(!t||t.parentElement()!=e)&&0!=t.compareEndPoints("StartToEnd",t)},Ie="oncopy"in(De=N("div"))||(De.setAttribute("oncopy","return;"),"function"==typeof De.oncopy),Be=null,He={},We={}
370
+ function Pe(e,t){arguments.length>2&&(t.dependencies=Array.prototype.slice.call(arguments,2)),He[e]=t}function Re(e){if("string"==typeof e&&We.hasOwnProperty(e))e=We[e]
371
+ else if(e&&"string"==typeof e.name&&We.hasOwnProperty(e.name)){var t=We[e.name]
372
+ "string"==typeof t&&(t={name:t}),(e=Q(t,e)).name=t.name}else{if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+xml$/.test(e))return Re("application/xml")
373
+ if("string"==typeof e&&/^[\w\-]+\/[\w\-]+\+json$/.test(e))return Re("application/json")}return"string"==typeof e?{name:e}:e||{name:"null"}}function ze(e,t){t=Re(t)
374
+ var n=He[t.name]
375
+ if(!n)return ze(e,"text/plain")
376
376
  var r=n(e,t)
377
- if(ze.hasOwnProperty(t.name)){var i=ze[t.name]
377
+ if(je.hasOwnProperty(t.name)){var i=je[t.name]
378
378
  for(var o in i)i.hasOwnProperty(o)&&(r.hasOwnProperty(o)&&(r["_"+o]=r[o]),r[o]=i[o])}if(r.name=t.name,t.helperType&&(r.helperType=t.helperType),t.modeProps)for(var a in t.modeProps)r[a]=t.modeProps[a]
379
- return r}var ze={}
380
- function je(e,t){W(t,ze.hasOwnProperty(e)?ze[e]:ze[e]={})}function _e(e,t){if(!0===t)return t
379
+ return r}var je={}
380
+ function _e(e,t){W(t,je.hasOwnProperty(e)?je[e]:je[e]={})}function Ue(e,t){if(!0===t)return t
381
381
  if(e.copyState)return e.copyState(t)
382
382
  var n={}
383
383
  for(var r in t){var i=t[r]
384
- i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function Ue(e,t){for(var n;e.innerMode&&(n=e.innerMode(t))&&n.mode!=e;)t=n.state,e=n.mode
385
- return n||{mode:e,state:t}}function qe(e,t,n){return!e.startState||e.startState(t,n)}var Ge=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n}
386
- function Ve(e,t){if((t-=e.first)<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.")
384
+ i instanceof Array&&(i=i.concat([])),n[r]=i}return n}function qe(e,t){for(var n;e.innerMode&&(n=e.innerMode(t))&&n.mode!=e;)t=n.state,e=n.mode
385
+ return n||{mode:e,state:t}}function Ge(e,t,n){return!e.startState||e.startState(t,n)}var Ve=function(e,t,n){this.pos=this.start=0,this.string=e,this.tabSize=t||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=n}
386
+ function $e(e,t){if((t-=e.first)<0||t>=e.size)throw new Error("There is no line "+(t+e.first)+" in the document.")
387
387
  for(var n=e;!n.lines;)for(var r=0;;++r){var i=n.children[r],o=i.chunkSize()
388
388
  if(t<o){n=i
389
- break}t-=o}return n.lines[t]}function $e(e,t,n){var r=[],i=t.line
389
+ break}t-=o}return n.lines[t]}function Xe(e,t,n){var r=[],i=t.line
390
390
  return e.iter(t.line,n.line+1,(function(e){var o=e.text
391
- i==n.line&&(o=o.slice(0,n.ch)),i==t.line&&(o=o.slice(t.ch)),r.push(o),++i})),r}function Xe(e,t,n){var r=[]
392
- return e.iter(t,n,(function(e){r.push(e.text)})),r}function Ke(e,t){var n=t-e.height
393
- if(n)for(var r=e;r;r=r.parent)r.height+=n}function Ye(e){if(null==e.parent)return null
391
+ i==n.line&&(o=o.slice(0,n.ch)),i==t.line&&(o=o.slice(t.ch)),r.push(o),++i})),r}function Ke(e,t,n){var r=[]
392
+ return e.iter(t,n,(function(e){r.push(e.text)})),r}function Ye(e,t){var n=t-e.height
393
+ if(n)for(var r=e;r;r=r.parent)r.height+=n}function Ze(e){if(null==e.parent)return null
394
394
  for(var t=e.parent,n=z(t.lines,e),r=t.parent;r;t=r,r=r.parent)for(var i=0;r.children[i]!=t;++i)n+=r.children[i].chunkSize()
395
- return n+t.first}function Ze(e,t){var n=e.first
395
+ return n+t.first}function Qe(e,t){var n=e.first
396
396
  e:do{for(var r=0;r<e.children.length;++r){var i=e.children[r],o=i.height
397
397
  if(t<o){e=i
398
398
  continue e}t-=o,n+=i.chunkSize()}return n}while(!e.lines)
399
399
  for(var a=0;a<e.lines.length;++a){var l=e.lines[a].height
400
400
  if(t<l)break
401
- t-=l}return n+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,n){if(void 0===n&&(n=null),!(this instanceof et))return new et(e,t,n)
402
- this.line=e,this.ch=t,this.sticky=n}function tt(e,t){return e.line-t.line||e.ch-t.ch}function nt(e,t){return e.sticky==t.sticky&&0==tt(e,t)}function rt(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)
401
+ t-=l}return n+a}function Je(e,t){return t>=e.first&&t<e.first+e.size}function et(e,t){return String(e.lineNumberFormatter(t+e.firstLineNumber))}function tt(e,t,n){if(void 0===n&&(n=null),!(this instanceof tt))return new tt(e,t,n)
402
+ this.line=e,this.ch=t,this.sticky=n}function nt(e,t){return e.line-t.line||e.ch-t.ch}function rt(e,t){return e.sticky==t.sticky&&0==nt(e,t)}function it(e){return tt(e.line,e.ch)}function ot(e,t){return nt(e,t)<0?t:e}function at(e,t){return nt(e,t)<0?e:t}function lt(e,t){return Math.max(e.first,Math.min(t,e.first+e.size-1))}function st(e,t){if(t.line<e.first)return tt(e.first,0)
403
403
  var n=e.first+e.size-1
404
- return t.line>n?et(n,Ve(e,n).text.length):function(e,t){var n=e.ch
405
- return null==n||n>t?et(e.line,t):n<0?et(e.line,0):e}(t,Ve(e,t.line).text.length)}function st(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=lt(e,t[r])
406
- return n}Ge.prototype.eol=function(){return this.pos>=this.string.length},Ge.prototype.sol=function(){return this.pos==this.lineStart},Ge.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ge.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Ge.prototype.eat=function(e){var t=this.string.charAt(this.pos)
407
- if("string"==typeof e?t==e:t&&(e.test?e.test(t):e(t)))return++this.pos,t},Ge.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Ge.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos
408
- return this.pos>e},Ge.prototype.skipToEnd=function(){this.pos=this.string.length},Ge.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos)
409
- if(t>-1)return this.pos=t,!0},Ge.prototype.backUp=function(e){this.pos-=e},Ge.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=P(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?P(this.string,this.lineStart,this.tabSize):0)},Ge.prototype.indentation=function(){return P(this.string,null,this.tabSize)-(this.lineStart?P(this.string,this.lineStart,this.tabSize):0)},Ge.prototype.match=function(e,t,n){if("string"!=typeof e){var r=this.string.slice(this.pos).match(e)
404
+ return t.line>n?tt(n,$e(e,n).text.length):function(e,t){var n=e.ch
405
+ return null==n||n>t?tt(e.line,t):n<0?tt(e.line,0):e}(t,$e(e,t.line).text.length)}function ut(e,t){for(var n=[],r=0;r<t.length;r++)n[r]=st(e,t[r])
406
+ return n}Ve.prototype.eol=function(){return this.pos>=this.string.length},Ve.prototype.sol=function(){return this.pos==this.lineStart},Ve.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},Ve.prototype.next=function(){if(this.pos<this.string.length)return this.string.charAt(this.pos++)},Ve.prototype.eat=function(e){var t=this.string.charAt(this.pos)
407
+ if("string"==typeof e?t==e:t&&(e.test?e.test(t):e(t)))return++this.pos,t},Ve.prototype.eatWhile=function(e){for(var t=this.pos;this.eat(e););return this.pos>t},Ve.prototype.eatSpace=function(){for(var e=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos
408
+ return this.pos>e},Ve.prototype.skipToEnd=function(){this.pos=this.string.length},Ve.prototype.skipTo=function(e){var t=this.string.indexOf(e,this.pos)
409
+ if(t>-1)return this.pos=t,!0},Ve.prototype.backUp=function(e){this.pos-=e},Ve.prototype.column=function(){return this.lastColumnPos<this.start&&(this.lastColumnValue=P(this.string,this.start,this.tabSize,this.lastColumnPos,this.lastColumnValue),this.lastColumnPos=this.start),this.lastColumnValue-(this.lineStart?P(this.string,this.lineStart,this.tabSize):0)},Ve.prototype.indentation=function(){return P(this.string,null,this.tabSize)-(this.lineStart?P(this.string,this.lineStart,this.tabSize):0)},Ve.prototype.match=function(e,t,n){if("string"!=typeof e){var r=this.string.slice(this.pos).match(e)
410
410
  return r&&r.index>0?null:(r&&!1!==t&&(this.pos+=r[0].length),r)}var i=function(e){return n?e.toLowerCase():e}
411
- if(i(this.string.substr(this.pos,e.length))==i(e))return!1!==t&&(this.pos+=e.length),!0},Ge.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ge.prototype.hideFirstChars=function(e,t){this.lineStart+=e
412
- try{return t()}finally{this.lineStart-=e}},Ge.prototype.lookAhead=function(e){var t=this.lineOracle
413
- return t&&t.lookAhead(e)},Ge.prototype.baseToken=function(){var e=this.lineOracle
411
+ if(i(this.string.substr(this.pos,e.length))==i(e))return!1!==t&&(this.pos+=e.length),!0},Ve.prototype.current=function(){return this.string.slice(this.start,this.pos)},Ve.prototype.hideFirstChars=function(e,t){this.lineStart+=e
412
+ try{return t()}finally{this.lineStart-=e}},Ve.prototype.lookAhead=function(e){var t=this.lineOracle
413
+ return t&&t.lookAhead(e)},Ve.prototype.baseToken=function(){var e=this.lineOracle
414
414
  return e&&e.baseToken(this.pos)}
415
- var ut=function(e,t){this.state=e,this.lookAhead=t},ct=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1}
416
- function ft(e,t,n,r){var i=[e.state.modeGen],o={}
417
- bt(e,t.text,e.doc.mode,n,(function(e,t){return i.push(e,t)}),o,r)
415
+ var ct=function(e,t){this.state=e,this.lookAhead=t},ft=function(e,t,n,r){this.state=t,this.doc=e,this.line=n,this.maxLookAhead=r||0,this.baseTokens=null,this.baseTokenPos=1}
416
+ function dt(e,t,n,r){var i=[e.state.modeGen],o={}
417
+ wt(e,t.text,e.doc.mode,n,(function(e,t){return i.push(e,t)}),o,r)
418
418
  for(var a=n.state,l=function(r){n.baseTokens=i
419
419
  var l=e.state.overlays[r],s=1,u=0
420
- n.state=!0,bt(e,t.text,l.mode,n,(function(e,t){for(var n=s;u<e;){var r=i[s]
420
+ n.state=!0,wt(e,t.text,l.mode,n,(function(e,t){for(var n=s;u<e;){var r=i[s]
421
421
  r>e&&i.splice(s,1,e,i[s+1],r),s+=2,u=Math.min(e,r)}if(t)if(l.opaque)i.splice(n,s-n,e,"overlay "+t),s=n+2
422
422
  else for(;n<s;n+=2){var o=i[n+1]
423
423
  i[n+1]=(o?o+" ":"")+"overlay "+t}}),o),n.state=a,n.baseTokens=null,n.baseTokenPos=1},s=0;s<e.state.overlays.length;++s)l(s)
424
- return{styles:i,classes:o.bgClass||o.textClass?o:null}}function dt(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=ht(e,Ye(t)),i=t.text.length>e.options.maxHighlightLength&&_e(e.doc.mode,r.state),o=ft(e,t,r)
425
- i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=o.styles,o.classes?t.styleClasses=o.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function ht(e,t,n){var r=e.doc,i=e.display
426
- if(!r.mode.startState)return new ct(r,!0,t)
424
+ return{styles:i,classes:o.bgClass||o.textClass?o:null}}function ht(e,t,n){if(!t.styles||t.styles[0]!=e.state.modeGen){var r=pt(e,Ze(t)),i=t.text.length>e.options.maxHighlightLength&&Ue(e.doc.mode,r.state),o=dt(e,t,r)
425
+ i&&(r.state=i),t.stateAfter=r.save(!i),t.styles=o.styles,o.classes?t.styleClasses=o.classes:t.styleClasses&&(t.styleClasses=null),n===e.doc.highlightFrontier&&(e.doc.modeFrontier=Math.max(e.doc.modeFrontier,++e.doc.highlightFrontier))}return t.styles}function pt(e,t,n){var r=e.doc,i=e.display
426
+ if(!r.mode.startState)return new ft(r,!0,t)
427
427
  var o=function(e,t,n){for(var r,i,o=e.doc,a=n?-1:t-(e.doc.mode.innerMode?1e3:100),l=t;l>a;--l){if(l<=o.first)return o.first
428
- var s=Ve(o,l-1),u=s.stateAfter
429
- if(u&&(!n||l+(u instanceof ut?u.lookAhead:0)<=o.modeFrontier))return l
430
- var c=P(s.text,null,e.options.tabSize);(null==i||r>c)&&(i=l-1,r=c)}return i}(e,t,n),a=o>r.first&&Ve(r,o-1).stateAfter,l=a?ct.fromSaved(r,a,o):new ct(r,qe(r.mode),o)
431
- return r.iter(o,t,(function(n){pt(e,n.text,l)
428
+ var s=$e(o,l-1),u=s.stateAfter
429
+ if(u&&(!n||l+(u instanceof ct?u.lookAhead:0)<=o.modeFrontier))return l
430
+ var c=P(s.text,null,e.options.tabSize);(null==i||r>c)&&(i=l-1,r=c)}return i}(e,t,n),a=o>r.first&&$e(r,o-1).stateAfter,l=a?ft.fromSaved(r,a,o):new ft(r,Ge(r.mode),o)
431
+ return r.iter(o,t,(function(n){mt(e,n.text,l)
432
432
  var r=l.line
433
- n.stateAfter=r==t-1||r%5==0||r>=i.viewFrom&&r<i.viewTo?l.save():null,l.nextLine()})),n&&(r.modeFrontier=l.line),l}function pt(e,t,n,r){var i=e.doc.mode,o=new Ge(t,e.options.tabSize,n)
434
- for(o.start=o.pos=r||0,""==t&&mt(i,n.state);!o.eol();)gt(i,o,n.state),o.start=o.pos}function mt(e,t){if(e.blankLine)return e.blankLine(t)
435
- if(e.innerMode){var n=Ue(e,t)
436
- return n.mode.blankLine?n.mode.blankLine(n.state):void 0}}function gt(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=Ue(e,n).mode)
433
+ n.stateAfter=r==t-1||r%5==0||r>=i.viewFrom&&r<i.viewTo?l.save():null,l.nextLine()})),n&&(r.modeFrontier=l.line),l}function mt(e,t,n,r){var i=e.doc.mode,o=new Ve(t,e.options.tabSize,n)
434
+ for(o.start=o.pos=r||0,""==t&&gt(i,n.state);!o.eol();)vt(i,o,n.state),o.start=o.pos}function gt(e,t){if(e.blankLine)return e.blankLine(t)
435
+ if(e.innerMode){var n=qe(e,t)
436
+ return n.mode.blankLine?n.mode.blankLine(n.state):void 0}}function vt(e,t,n,r){for(var i=0;i<10;i++){r&&(r[0]=qe(e,n).mode)
437
437
  var o=e.token(t,n)
438
- 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)
439
- return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},ct.prototype.baseToken=function(e){if(!this.baseTokens)return null
438
+ if(t.pos>t.start)return o}throw new Error("Mode "+e.name+" failed to advance stream.")}ft.prototype.lookAhead=function(e){var t=this.doc.getLine(this.line+e)
439
+ return null!=t&&e>this.maxLookAhead&&(this.maxLookAhead=e),t},ft.prototype.baseToken=function(e){if(!this.baseTokens)return null
440
440
  for(;this.baseTokens[this.baseTokenPos]<=e;)this.baseTokenPos+=2
441
441
  var t=this.baseTokens[this.baseTokenPos+1]
442
- 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,n){return t instanceof ut?new ct(e,_e(e.mode,t.state),n,t.lookAhead):new ct(e,_e(e.mode,t),n)},ct.prototype.save=function(e){var t=!1!==e?_e(this.doc.mode,this.state):this.state
443
- return this.maxLookAhead>0?new ut(t,this.maxLookAhead):t}
444
- var vt=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n}
445
- function yt(e,t,n,r){var i,o,a=e.doc,l=a.mode,s=Ve(a,(t=lt(a,t)).line),u=ht(e,t.line,n),c=new Ge(s.text,e.options.tabSize,u)
446
- for(r&&(o=[]);(r||c.pos<t.ch)&&!c.eol();)c.start=c.pos,i=gt(l,c,u.state),r&&o.push(new vt(c,i,_e(a.mode,u.state)))
447
- return r?o:new vt(c,i,u.state)}function xt(e,t){if(e)for(;;){var n=e.match(/(?:^|\s+)line-(background-)?(\S+)/)
442
+ return{type:t&&t.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-e}},ft.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},ft.fromSaved=function(e,t,n){return t instanceof ct?new ft(e,Ue(e.mode,t.state),n,t.lookAhead):new ft(e,Ue(e.mode,t),n)},ft.prototype.save=function(e){var t=!1!==e?Ue(this.doc.mode,this.state):this.state
443
+ return this.maxLookAhead>0?new ct(t,this.maxLookAhead):t}
444
+ var yt=function(e,t,n){this.start=e.start,this.end=e.pos,this.string=e.current(),this.type=t||null,this.state=n}
445
+ function xt(e,t,n,r){var i,o,a=e.doc,l=a.mode,s=$e(a,(t=st(a,t)).line),u=pt(e,t.line,n),c=new Ve(s.text,e.options.tabSize,u)
446
+ for(r&&(o=[]);(r||c.pos<t.ch)&&!c.eol();)c.start=c.pos,i=vt(l,c,u.state),r&&o.push(new yt(c,i,Ue(a.mode,u.state)))
447
+ return r?o:new yt(c,i,u.state)}function bt(e,t){if(e)for(;;){var n=e.match(/(?:^|\s+)line-(background-)?(\S+)/)
448
448
  if(!n)break
449
449
  e=e.slice(0,n.index)+e.slice(n.index+n[0].length)
450
450
  var r=n[1]?"bgClass":"textClass"
451
- null==t[r]?t[r]=n[2]:new RegExp("(?:^|s)"+n[2]+"(?:$|s)").test(t[r])||(t[r]+=" "+n[2])}return e}function bt(e,t,n,r,i,o,a){var l=n.flattenSpans
451
+ null==t[r]?t[r]=n[2]:new RegExp("(?:^|s)"+n[2]+"(?:$|s)").test(t[r])||(t[r]+=" "+n[2])}return e}function wt(e,t,n,r,i,o,a){var l=n.flattenSpans
452
452
  null==l&&(l=e.options.flattenSpans)
453
- var s,u=0,c=null,f=new Ge(t,e.options.tabSize,r),d=e.options.addModeClass&&[null]
454
- for(""==t&&xt(mt(n,r.state),o);!f.eol();){if(f.pos>e.options.maxHighlightLength?(l=!1,a&&pt(e,t,r,f.pos),f.pos=t.length,s=null):s=xt(gt(n,f,r.state,d),o),d){var h=d[0].name
453
+ var s,u=0,c=null,f=new Ve(t,e.options.tabSize,r),d=e.options.addModeClass&&[null]
454
+ for(""==t&&bt(gt(n,r.state),o);!f.eol();){if(f.pos>e.options.maxHighlightLength?(l=!1,a&&mt(e,t,r,f.pos),f.pos=t.length,s=null):s=bt(vt(n,f,r.state,d),o),d){var h=d[0].name
455
455
  h&&(s="m-"+(s?h+" "+s:h))}if(!l||c!=s){for(;u<f.start;)i(u=Math.min(f.start,u+5e3),c)
456
456
  c=s}f.start=f.pos}for(;u<f.pos;){var p=Math.min(f.pos,u+5e3)
457
- i(p,c),u=p}}var wt=!1,Ct=!1
458
- function kt(e,t,n){this.marker=e,this.from=t,this.to=n}function St(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n]
459
- if(r.marker==t)return r}}function Lt(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r])
460
- return n}function Tt(e,t){if(t.full)return null
461
- var n=Qe(e,t.from.line)&&Ve(e,t.from.line).markedSpans,r=Qe(e,t.to.line)&&Ve(e,t.to.line).markedSpans
457
+ i(p,c),u=p}}var Ct=!1,kt=!1
458
+ function St(e,t,n){this.marker=e,this.from=t,this.to=n}function Lt(e,t){if(e)for(var n=0;n<e.length;++n){var r=e[n]
459
+ if(r.marker==t)return r}}function Tt(e,t){for(var n,r=0;r<e.length;++r)e[r]!=t&&(n||(n=[])).push(e[r])
460
+ return n}function Mt(e,t){if(t.full)return null
461
+ var n=Je(e,t.from.line)&&$e(e,t.from.line).markedSpans,r=Je(e,t.to.line)&&$e(e,t.to.line).markedSpans
462
462
  if(!n&&!r)return null
463
- var i=t.from.ch,o=t.to.ch,a=0==tt(t.from,t.to),l=function(e,t,n){var r
463
+ var i=t.from.ch,o=t.to.ch,a=0==nt(t.from,t.to),l=function(e,t,n){var r
464
464
  if(e)for(var i=0;i<e.length;++i){var o=e[i],a=o.marker
465
- if(null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t)||o.from==t&&"bookmark"==a.type&&(!n||!o.marker.insertLeft)){var l=null==o.to||(a.inclusiveRight?o.to>=t:o.to>t);(r||(r=[])).push(new kt(a,o.from,l?null:o.to))}}return r}(n,i,a),s=function(e,t,n){var r
465
+ if(null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t)||o.from==t&&"bookmark"==a.type&&(!n||!o.marker.insertLeft)){var l=null==o.to||(a.inclusiveRight?o.to>=t:o.to>t);(r||(r=[])).push(new St(a,o.from,l?null:o.to))}}return r}(n,i,a),s=function(e,t,n){var r
466
466
  if(e)for(var i=0;i<e.length;++i){var o=e[i],a=o.marker
467
- if(null==o.to||(a.inclusiveRight?o.to>=t:o.to>t)||o.from==t&&"bookmark"==a.type&&(!n||o.marker.insertLeft)){var l=null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t);(r||(r=[])).push(new kt(a,l?null:o.from-t,null==o.to?null:o.to-t))}}return r}(r,o,a),u=1==t.text.length,c=X(t.text).length+(u?i:0)
467
+ if(null==o.to||(a.inclusiveRight?o.to>=t:o.to>t)||o.from==t&&"bookmark"==a.type&&(!n||o.marker.insertLeft)){var l=null==o.from||(a.inclusiveLeft?o.from<=t:o.from<t);(r||(r=[])).push(new St(a,l?null:o.from-t,null==o.to?null:o.to-t))}}return r}(r,o,a),u=1==t.text.length,c=K(t.text).length+(u?i:0)
468
468
  if(l)for(var f=0;f<l.length;++f){var d=l[f]
469
- if(null==d.to){var h=St(s,d.marker)
469
+ if(null==d.to){var h=Lt(s,d.marker)
470
470
  h?u&&(d.to=null==h.to?null:h.to+c):d.to=i}}if(s)for(var p=0;p<s.length;++p){var m=s[p]
471
- null!=m.to&&(m.to+=c),null==m.from?St(l,m.marker)||(m.from=c,u&&(l||(l=[])).push(m)):(m.from+=c,u&&(l||(l=[])).push(m))}l&&(l=Mt(l)),s&&s!=l&&(s=Mt(s))
471
+ null!=m.to&&(m.to+=c),null==m.from?Lt(l,m.marker)||(m.from=c,u&&(l||(l=[])).push(m)):(m.from+=c,u&&(l||(l=[])).push(m))}l&&(l=At(l)),s&&s!=l&&(s=At(s))
472
472
  var g=[l]
473
473
  if(!u){var v,y=t.text.length-2
474
- if(y>0&&l)for(var x=0;x<l.length;++x)null==l[x].to&&(v||(v=[])).push(new kt(l[x].marker,null,null))
474
+ if(y>0&&l)for(var x=0;x<l.length;++x)null==l[x].to&&(v||(v=[])).push(new St(l[x].marker,null,null))
475
475
  for(var b=0;b<y;++b)g.push(v)
476
- g.push(s)}return g}function Mt(e){for(var t=0;t<e.length;++t){var n=e[t]
477
- null!=n.from&&n.from==n.to&&!1!==n.marker.clearWhenEmpty&&e.splice(t--,1)}return e.length?e:null}function At(e){var t=e.markedSpans
476
+ g.push(s)}return g}function At(e){for(var t=0;t<e.length;++t){var n=e[t]
477
+ null!=n.from&&n.from==n.to&&!1!==n.marker.clearWhenEmpty&&e.splice(t--,1)}return e.length?e:null}function Nt(e){var t=e.markedSpans
478
478
  if(t){for(var n=0;n<t.length;++n)t[n].marker.detachLine(e)
479
- e.markedSpans=null}}function Nt(e,t){if(t){for(var n=0;n<t.length;++n)t[n].marker.attachLine(e)
480
- e.markedSpans=t}}function Et(e){return e.inclusiveLeft?-1:0}function Dt(e){return e.inclusiveRight?1:0}function Ft(e,t){var n=e.lines.length-t.lines.length
479
+ e.markedSpans=null}}function Et(e,t){if(t){for(var n=0;n<t.length;++n)t[n].marker.attachLine(e)
480
+ e.markedSpans=t}}function Dt(e){return e.inclusiveLeft?-1:0}function Ft(e){return e.inclusiveRight?1:0}function Ot(e,t){var n=e.lines.length-t.lines.length
481
481
  if(0!=n)return n
482
- var r=e.find(),i=t.find(),o=tt(r.from,i.from)||Et(e)-Et(t)
483
- return o?-o:tt(r.to,i.to)||Dt(e)-Dt(t)||t.id-e.id}function Ot(e,t){var n,r=Ct&&e.markedSpans
484
- if(r)for(var i=void 0,o=0;o<r.length;++o)(i=r[o]).marker.collapsed&&null==(t?i.from:i.to)&&(!n||Ft(n,i.marker)<0)&&(n=i.marker)
485
- return n}function It(e){return Ot(e,!0)}function Bt(e){return Ot(e,!1)}function Ht(e,t){var n,r=Ct&&e.markedSpans
482
+ var r=e.find(),i=t.find(),o=nt(r.from,i.from)||Dt(e)-Dt(t)
483
+ return o?-o:nt(r.to,i.to)||Ft(e)-Ft(t)||t.id-e.id}function It(e,t){var n,r=kt&&e.markedSpans
484
+ if(r)for(var i=void 0,o=0;o<r.length;++o)(i=r[o]).marker.collapsed&&null==(t?i.from:i.to)&&(!n||Ot(n,i.marker)<0)&&(n=i.marker)
485
+ return n}function Bt(e){return It(e,!0)}function Ht(e){return It(e,!1)}function Wt(e,t){var n,r=kt&&e.markedSpans
486
486
  if(r)for(var i=0;i<r.length;++i){var o=r[i]
487
- o.marker.collapsed&&(null==o.from||o.from<t)&&(null==o.to||o.to>t)&&(!n||Ft(n,o.marker)<0)&&(n=o.marker)}return n}function Wt(e,t,n,r,i){var o=Ve(e,t),a=Ct&&o.markedSpans
487
+ o.marker.collapsed&&(null==o.from||o.from<t)&&(null==o.to||o.to>t)&&(!n||Ot(n,o.marker)<0)&&(n=o.marker)}return n}function Pt(e,t,n,r,i){var o=$e(e,t),a=kt&&o.markedSpans
488
488
  if(a)for(var l=0;l<a.length;++l){var s=a[l]
489
- if(s.marker.collapsed){var u=s.marker.find(0),c=tt(u.from,n)||Et(s.marker)-Et(i),f=tt(u.to,r)||Dt(s.marker)-Dt(i)
490
- if(!(c>=0&&f<=0||c<=0&&f>=0)&&(c<=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?tt(u.to,n)>=0:tt(u.to,n)>0)||c>=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?tt(u.from,r)<=0:tt(u.from,r)<0)))return!0}}}function Pt(e){for(var t;t=It(e);)e=t.find(-1,!0).line
491
- return e}function Rt(e,t){var n=Ve(e,t),r=Pt(n)
492
- return n==r?t:Ye(r)}function zt(e,t){if(t>e.lastLine())return t
493
- var n,r=Ve(e,t)
494
- if(!jt(e,r))return t
495
- for(;n=Bt(r);)r=n.find(1,!0).line
496
- return Ye(r)+1}function jt(e,t){var n=Ct&&t.markedSpans
489
+ if(s.marker.collapsed){var u=s.marker.find(0),c=nt(u.from,n)||Dt(s.marker)-Dt(i),f=nt(u.to,r)||Ft(s.marker)-Ft(i)
490
+ if(!(c>=0&&f<=0||c<=0&&f>=0)&&(c<=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?nt(u.to,n)>=0:nt(u.to,n)>0)||c>=0&&(s.marker.inclusiveRight&&i.inclusiveLeft?nt(u.from,r)<=0:nt(u.from,r)<0)))return!0}}}function Rt(e){for(var t;t=Bt(e);)e=t.find(-1,!0).line
491
+ return e}function zt(e,t){var n=$e(e,t),r=Rt(n)
492
+ return n==r?t:Ze(r)}function jt(e,t){if(t>e.lastLine())return t
493
+ var n,r=$e(e,t)
494
+ if(!_t(e,r))return t
495
+ for(;n=Ht(r);)r=n.find(1,!0).line
496
+ return Ze(r)+1}function _t(e,t){var n=kt&&t.markedSpans
497
497
  if(n)for(var r=void 0,i=0;i<n.length;++i)if((r=n[i]).marker.collapsed){if(null==r.from)return!0
498
- if(!r.marker.widgetNode&&0==r.from&&r.marker.inclusiveLeft&&_t(e,t,r))return!0}}function _t(e,t,n){if(null==n.to){var r=n.marker.find(1,!0)
499
- return _t(e,r.line,St(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0
500
- for(var i=void 0,o=0;o<t.markedSpans.length;++o)if((i=t.markedSpans[o]).marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(null==i.to||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&_t(e,t,i))return!0}function Ut(e){for(var t=0,n=(e=Pt(e)).parent,r=0;r<n.lines.length;++r){var i=n.lines[r]
498
+ if(!r.marker.widgetNode&&0==r.from&&r.marker.inclusiveLeft&&Ut(e,t,r))return!0}}function Ut(e,t,n){if(null==n.to){var r=n.marker.find(1,!0)
499
+ return Ut(e,r.line,Lt(r.line.markedSpans,n.marker))}if(n.marker.inclusiveRight&&n.to==t.text.length)return!0
500
+ for(var i=void 0,o=0;o<t.markedSpans.length;++o)if((i=t.markedSpans[o]).marker.collapsed&&!i.marker.widgetNode&&i.from==n.to&&(null==i.to||i.to!=n.from)&&(i.marker.inclusiveLeft||n.marker.inclusiveRight)&&Ut(e,t,i))return!0}function qt(e){for(var t=0,n=(e=Rt(e)).parent,r=0;r<n.lines.length;++r){var i=n.lines[r]
501
501
  if(i==e)break
502
502
  t+=i.height}for(var o=n.parent;o;o=(n=o).parent)for(var a=0;a<o.children.length;++a){var l=o.children[a]
503
503
  if(l==n)break
504
- t+=l.height}return t}function qt(e){if(0==e.height)return 0
505
- for(var t,n=e.text.length,r=e;t=It(r);){var i=t.find(0,!0)
506
- r=i.from.line,n+=i.from.ch-i.to.ch}for(r=e;t=Bt(r);){var o=t.find(0,!0)
507
- n-=r.text.length-o.from.ch,n+=(r=o.to.line).text.length-o.to.ch}return n}function Gt(e){var t=e.display,n=e.doc
508
- t.maxLine=Ve(n,n.first),t.maxLineLength=qt(t.maxLine),t.maxLineChanged=!0,n.iter((function(e){var n=qt(e)
509
- n>t.maxLineLength&&(t.maxLineLength=n,t.maxLine=e)}))}var Vt=function(e,t,n){this.text=e,Nt(this,t),this.height=n?n(this):1}
510
- function $t(e){e.parent=null,At(e)}Vt.prototype.lineNo=function(){return Ye(this)},ye(Vt)
511
- var Xt={},Kt={}
512
- function Yt(e,t){if(!e||/^\s*$/.test(e))return null
513
- var n=t.addModeClass?Kt:Xt
514
- return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Zt(e,t){var n=E("span",null,null,s?"padding-right: .1px":null),r={pre:E("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")}
504
+ t+=l.height}return t}function Gt(e){if(0==e.height)return 0
505
+ for(var t,n=e.text.length,r=e;t=Bt(r);){var i=t.find(0,!0)
506
+ r=i.from.line,n+=i.from.ch-i.to.ch}for(r=e;t=Ht(r);){var o=t.find(0,!0)
507
+ n-=r.text.length-o.from.ch,n+=(r=o.to.line).text.length-o.to.ch}return n}function Vt(e){var t=e.display,n=e.doc
508
+ t.maxLine=$e(n,n.first),t.maxLineLength=Gt(t.maxLine),t.maxLineChanged=!0,n.iter((function(e){var n=Gt(e)
509
+ n>t.maxLineLength&&(t.maxLineLength=n,t.maxLine=e)}))}var $t=function(e,t,n){this.text=e,Et(this,t),this.height=n?n(this):1}
510
+ function Xt(e){e.parent=null,Nt(e)}$t.prototype.lineNo=function(){return Ze(this)},xe($t)
511
+ var Kt={},Yt={}
512
+ function Zt(e,t){if(!e||/^\s*$/.test(e))return null
513
+ var n=t.addModeClass?Yt:Kt
514
+ return n[e]||(n[e]=e.replace(/\S+/g,"cm-$&"))}function Qt(e,t){var n=E("span",null,null,s?"padding-right: .1px":null),r={pre:E("pre",[n],"CodeMirror-line"),content:n,col:0,pos:0,cm:e,trailingSpace:!1,splitSpaces:e.getOption("lineWrapping")}
515
515
  t.measure={}
516
516
  for(var i=0;i<=(t.rest?t.rest.length:0);i++){var o=i?t.rest[i-1]:t.line,a=void 0
517
- r.pos=0,r.addToken=Jt,Ne(e.display.measure)&&(a=ue(o,e.doc.direction))&&(r.addToken=en(r.addToken,a)),r.map=[],nn(o,r,dt(e,o,t!=e.display.externalMeasured&&Ye(o))),o.styleClasses&&(o.styleClasses.bgClass&&(r.bgClass=I(o.styleClasses.bgClass,r.bgClass||"")),o.styleClasses.textClass&&(r.textClass=I(o.styleClasses.textClass,r.textClass||""))),0==r.map.length&&r.map.push(0,0,r.content.appendChild(Ae(e.display.measure))),0==i?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(s){var l=r.content.lastChild;(/\bcm-tab\b/.test(l.className)||l.querySelector&&l.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return pe(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=I(r.pre.className,r.textClass||"")),r}function Qt(e){var t=N("span","•","cm-invalidchar")
518
- return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function Jt(e,t,n,r,i,o,s){if(t){var u,c=e.splitSpaces?function(e,t){if(e.length>1&&!/ /.test(e))return e
517
+ r.pos=0,r.addToken=en,Ee(e.display.measure)&&(a=ce(o,e.doc.direction))&&(r.addToken=tn(r.addToken,a)),r.map=[],rn(o,r,ht(e,o,t!=e.display.externalMeasured&&Ze(o))),o.styleClasses&&(o.styleClasses.bgClass&&(r.bgClass=I(o.styleClasses.bgClass,r.bgClass||"")),o.styleClasses.textClass&&(r.textClass=I(o.styleClasses.textClass,r.textClass||""))),0==r.map.length&&r.map.push(0,0,r.content.appendChild(Ne(e.display.measure))),0==i?(t.measure.map=r.map,t.measure.cache={}):((t.measure.maps||(t.measure.maps=[])).push(r.map),(t.measure.caches||(t.measure.caches=[])).push({}))}if(s){var l=r.content.lastChild;(/\bcm-tab\b/.test(l.className)||l.querySelector&&l.querySelector(".cm-tab"))&&(r.content.className="cm-tab-wrap-hack")}return me(e,"renderLine",e,t.line,r.pre),r.pre.className&&(r.textClass=I(r.pre.className,r.textClass||"")),r}function Jt(e){var t=N("span","•","cm-invalidchar")
518
+ return t.title="\\u"+e.charCodeAt(0).toString(16),t.setAttribute("aria-label",t.title),t}function en(e,t,n,r,i,o,s){if(t){var u,c=e.splitSpaces?function(e,t){if(e.length>1&&!/ /.test(e))return e
519
519
  for(var n=t,r="",i=0;i<e.length;i++){var o=e.charAt(i)
520
520
  " "!=o||!n||i!=e.length-1&&32!=e.charCodeAt(i+1)||(o=" "),r+=o,n=" "==o}return r}(t,e.trailingSpace):t,f=e.cm.state.specialChars,d=!1
521
521
  if(f.test(t)){u=document.createDocumentFragment()
@@ -525,299 +525,299 @@ if(m){var g=document.createTextNode(c.slice(h,h+m))
525
525
  a&&l<9?u.appendChild(N("span",[g])):u.appendChild(g),e.map.push(e.pos,e.pos+m,g),e.col+=m,e.pos+=m}if(!p)break
526
526
  h+=m+1
527
527
  var v=void 0
528
- if("\t"==p[0]){var y=e.cm.options.tabSize,x=y-e.col%y;(v=u.appendChild(N("span",$(x),"cm-tab"))).setAttribute("role","presentation"),v.setAttribute("cm-text","\t"),e.col+=x}else"\r"==p[0]||"\n"==p[0]?((v=u.appendChild(N("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(N("span",[v])):u.appendChild(v),e.col+=1)
528
+ if("\t"==p[0]){var y=e.cm.options.tabSize,x=y-e.col%y;(v=u.appendChild(N("span",X(x),"cm-tab"))).setAttribute("role","presentation"),v.setAttribute("cm-text","\t"),e.col+=x}else"\r"==p[0]||"\n"==p[0]?((v=u.appendChild(N("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(N("span",[v])):u.appendChild(v),e.col+=1)
529
529
  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&&(d=!0),e.pos+=t.length
530
530
  if(e.trailingSpace=32==c.charCodeAt(t.length-1),n||r||i||d||o){var b=n||""
531
531
  r&&(b+=r),i&&(b+=i)
532
532
  var w=N("span",[u],b,o)
533
533
  if(s)for(var C in s)s.hasOwnProperty(C)&&"style"!=C&&"class"!=C&&w.setAttribute(C,s[C])
534
- return e.content.appendChild(w)}e.content.appendChild(u)}}function en(e,t){return function(n,r,i,o,a,l,s){i=i?i+" cm-force-border":"cm-force-border"
534
+ return e.content.appendChild(w)}e.content.appendChild(u)}}function tn(e,t){return function(n,r,i,o,a,l,s){i=i?i+" cm-force-border":"cm-force-border"
535
535
  for(var u=n.pos,c=u+r.length;;){for(var f=void 0,d=0;d<t.length&&!((f=t[d]).to>u&&f.from<=u);d++);if(f.to>=c)return e(n,r,i,o,a,l,s)
536
- e(n,r.slice(0,f.to-u),i,o,null,l,s),o=null,r=r.slice(f.to-u),u=f.to}}}function tn(e,t,n,r){var i=!r&&n.widgetNode
537
- i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function nn(e,t,n){var r=e.markedSpans,i=e.text,o=0
536
+ e(n,r.slice(0,f.to-u),i,o,null,l,s),o=null,r=r.slice(f.to-u),u=f.to}}}function nn(e,t,n,r){var i=!r&&n.widgetNode
537
+ i&&e.map.push(e.pos,e.pos+t,i),!r&&e.cm.display.input.needsContentAttribute&&(i||(i=e.content.appendChild(document.createElement("span"))),i.setAttribute("cm-marker",n.id)),i&&(e.cm.display.input.setUneditable(i),e.content.appendChild(i)),e.pos+=t,e.trailingSpace=!1}function rn(e,t,n){var r=e.markedSpans,i=e.text,o=0
538
538
  if(r)for(var a,l,s,u,c,f,d,h=i.length,p=0,m=1,g="",v=0;;){if(v==p){s=u=c=l="",d=null,f=null,v=1/0
539
539
  for(var y=[],x=void 0,b=0;b<r.length;++b){var w=r[b],C=w.marker
540
540
  if("bookmark"==C.type&&w.from==p&&C.widgetNode)y.push(C)
541
541
  else if(w.from<=p&&(null==w.to||w.to>p||C.collapsed&&w.to==p&&w.from==p)){if(null!=w.to&&w.to!=p&&v>w.to&&(v=w.to,u=""),C.className&&(s+=" "+C.className),C.css&&(l=(l?l+";":"")+C.css),C.startStyle&&w.from==p&&(c+=" "+C.startStyle),C.endStyle&&w.to==v&&(x||(x=[])).push(C.endStyle,w.to),C.title&&((d||(d={})).title=C.title),C.attributes)for(var k in C.attributes)(d||(d={}))[k]=C.attributes[k]
542
- C.collapsed&&(!f||Ft(f.marker,C)<0)&&(f=w)}else w.from>p&&v>w.from&&(v=w.from)}if(x)for(var S=0;S<x.length;S+=2)x[S+1]==v&&(u+=" "+x[S])
543
- if(!f||f.from==p)for(var L=0;L<y.length;++L)tn(t,0,y[L])
544
- if(f&&(f.from||0)==p){if(tn(t,(null==f.to?h+1:f.to)-p,f.marker,null==f.from),null==f.to)return
542
+ C.collapsed&&(!f||Ot(f.marker,C)<0)&&(f=w)}else w.from>p&&v>w.from&&(v=w.from)}if(x)for(var S=0;S<x.length;S+=2)x[S+1]==v&&(u+=" "+x[S])
543
+ if(!f||f.from==p)for(var L=0;L<y.length;++L)nn(t,0,y[L])
544
+ if(f&&(f.from||0)==p){if(nn(t,(null==f.to?h+1:f.to)-p,f.marker,null==f.from),null==f.to)return
545
545
  f.to==p&&(f=!1)}}if(p>=h)break
546
546
  for(var T=Math.min(h,v);;){if(g){var M=p+g.length
547
547
  if(!f){var A=M>T?g.slice(0,T-p):g
548
548
  t.addToken(t,A,a?a+s:s,c,p+A.length==v?u:"",l,d)}if(M>=T){g=g.slice(T-p),p=T
549
- break}p=M,c=""}g=i.slice(o,o=n[m++]),a=Yt(n[m++],t.cm.options)}}else for(var N=1;N<n.length;N+=2)t.addToken(t,i.slice(o,o=n[N]),Yt(n[N+1],t.cm.options))}function rn(e,t,n){this.line=t,this.rest=function(e){for(var t,n;t=Bt(e);)e=t.find(1,!0).line,(n||(n=[])).push(e)
550
- return n}(t),this.size=this.rest?Ye(X(this.rest))-n+1:1,this.node=this.text=null,this.hidden=jt(e,t)}function on(e,t,n){for(var r,i=[],o=t;o<n;o=r){var a=new rn(e.doc,Ve(e.doc,o),o)
551
- r=o+a.size,i.push(a)}return i}var an=null,ln=null
552
- function sn(e,t){var n=de(e,t)
549
+ break}p=M,c=""}g=i.slice(o,o=n[m++]),a=Zt(n[m++],t.cm.options)}}else for(var N=1;N<n.length;N+=2)t.addToken(t,i.slice(o,o=n[N]),Zt(n[N+1],t.cm.options))}function on(e,t,n){this.line=t,this.rest=function(e){for(var t,n;t=Ht(e);)e=t.find(1,!0).line,(n||(n=[])).push(e)
550
+ return n}(t),this.size=this.rest?Ze(K(this.rest))-n+1:1,this.node=this.text=null,this.hidden=_t(e,t)}function an(e,t,n){for(var r,i=[],o=t;o<n;o=r){var a=new on(e.doc,$e(e.doc,o),o)
551
+ r=o+a.size,i.push(a)}return i}var ln=null,sn=null
552
+ function un(e,t){var n=he(e,t)
553
553
  if(n.length){var r,i=Array.prototype.slice.call(arguments,2)
554
- an?r=an.delayedCallbacks:ln?r=ln:(r=ln=[],setTimeout(un,0))
555
- for(var o=function(e){r.push((function(){return n[e].apply(null,i)}))},a=0;a<n.length;++a)o(a)}}function un(){var e=ln
556
- ln=null
557
- for(var t=0;t<e.length;++t)e[t]()}function cn(e,t,n,r){for(var i=0;i<t.changes.length;i++){var o=t.changes[i]
558
- "text"==o?hn(e,t):"gutter"==o?mn(e,t,n,r):"class"==o?pn(e,t):"widget"==o&&gn(e,t,r)}t.changes=null}function fn(e){return e.node==e.text&&(e.node=N("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 dn(e,t){var n=e.display.externalMeasured
559
- return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):Zt(e,t)}function hn(e,t){var n=t.text.className,r=dn(e,t)
560
- t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,pn(e,t)):n&&(t.text.className=n)}function pn(e,t){!function(e,t){var n=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass
554
+ ln?r=ln.delayedCallbacks:sn?r=sn:(r=sn=[],setTimeout(cn,0))
555
+ for(var o=function(e){r.push((function(){return n[e].apply(null,i)}))},a=0;a<n.length;++a)o(a)}}function cn(){var e=sn
556
+ sn=null
557
+ for(var t=0;t<e.length;++t)e[t]()}function fn(e,t,n,r){for(var i=0;i<t.changes.length;i++){var o=t.changes[i]
558
+ "text"==o?pn(e,t):"gutter"==o?gn(e,t,n,r):"class"==o?mn(e,t):"widget"==o&&vn(e,t,r)}t.changes=null}function dn(e){return e.node==e.text&&(e.node=N("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 hn(e,t){var n=e.display.externalMeasured
559
+ return n&&n.line==t.line?(e.display.externalMeasured=null,t.measure=n.measure,n.built):Qt(e,t)}function pn(e,t){var n=t.text.className,r=hn(e,t)
560
+ t.text==t.node&&(t.node=r.pre),t.text.parentNode.replaceChild(r.pre,t.text),t.text=r.pre,r.bgClass!=t.bgClass||r.textClass!=t.textClass?(t.bgClass=r.bgClass,t.textClass=r.textClass,mn(e,t)):n&&(t.text.className=n)}function mn(e,t){!function(e,t){var n=t.bgClass?t.bgClass+" "+(t.line.bgClass||""):t.line.bgClass
561
561
  if(n&&(n+=" CodeMirror-linebackground"),t.background)n?t.background.className=n:(t.background.parentNode.removeChild(t.background),t.background=null)
562
- else if(n){var r=fn(t)
563
- t.background=r.insertBefore(N("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}(e,t),t.line.wrapClass?fn(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="")
562
+ else if(n){var r=dn(t)
563
+ t.background=r.insertBefore(N("div",null,n),r.firstChild),e.display.input.setUneditable(t.background)}}(e,t),t.line.wrapClass?dn(t).className=t.line.wrapClass:t.node!=t.text&&(t.node.className="")
564
564
  var n=t.textClass?t.textClass+" "+(t.line.textClass||""):t.line.textClass
565
- t.text.className=n||""}function mn(e,t,n,r){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=fn(t)
565
+ t.text.className=n||""}function gn(e,t,n,r){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=dn(t)
566
566
  t.gutterBackground=N("div",null,"CodeMirror-gutter-background "+t.line.gutterClass,"left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px; width: "+r.gutterTotalWidth+"px"),e.display.input.setUneditable(t.gutterBackground),i.insertBefore(t.gutterBackground,t.text)}var o=t.line.gutterMarkers
567
- if(e.options.lineNumbers||o){var a=fn(t),l=t.gutter=N("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px")
568
- 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(N("div",Je(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.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]
569
- c&&l.appendChild(N("div",[c],"CodeMirror-gutter-elt","left: "+r.gutterLeft[u]+"px; width: "+r.gutterWidth[u]+"px"))}}}function gn(e,t,n){t.alignable&&(t.alignable=null)
567
+ if(e.options.lineNumbers||o){var a=dn(t),l=t.gutter=N("div",null,"CodeMirror-gutter-wrapper","left: "+(e.options.fixedGutter?r.fixedPos:-r.gutterTotalWidth)+"px")
568
+ 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(N("div",et(e.options,n),"CodeMirror-linenumber CodeMirror-gutter-elt","left: "+r.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]
569
+ c&&l.appendChild(N("div",[c],"CodeMirror-gutter-elt","left: "+r.gutterLeft[u]+"px; width: "+r.gutterWidth[u]+"px"))}}}function vn(e,t,n){t.alignable&&(t.alignable=null)
570
570
  for(var r=t.node.firstChild,i=void 0;r;r=i)i=r.nextSibling,"CodeMirror-linewidget"==r.className&&t.node.removeChild(r)
571
- yn(e,t,n)}function vn(e,t,n,r){var i=dn(e,t)
572
- return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),pn(e,t),mn(e,t,n,r),yn(e,t,r),t.node}function yn(e,t,n){if(xn(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)xn(e,t.rest[r],t,n,!1)}function xn(e,t,n,r,i){if(t.widgets)for(var o=fn(n),a=0,l=t.widgets;a<l.length;++a){var s=l[a],u=N("div",[s.node],"CodeMirror-linewidget")
573
- s.handleMouseEvents||u.setAttribute("cm-ignore-events","true"),bn(s,u,n,r),e.display.input.setUneditable(u),i&&s.above?o.insertBefore(u,n.gutter||n.text):o.appendChild(u),sn(s,"redraw")}}function bn(e,t,n,r){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t)
571
+ xn(e,t,n)}function yn(e,t,n,r){var i=hn(e,t)
572
+ return t.text=t.node=i.pre,i.bgClass&&(t.bgClass=i.bgClass),i.textClass&&(t.textClass=i.textClass),mn(e,t),gn(e,t,n,r),xn(e,t,r),t.node}function xn(e,t,n){if(bn(e,t.line,t,n,!0),t.rest)for(var r=0;r<t.rest.length;r++)bn(e,t.rest[r],t,n,!1)}function bn(e,t,n,r,i){if(t.widgets)for(var o=dn(n),a=0,l=t.widgets;a<l.length;++a){var s=l[a],u=N("div",[s.node],"CodeMirror-linewidget")
573
+ s.handleMouseEvents||u.setAttribute("cm-ignore-events","true"),wn(s,u,n,r),e.display.input.setUneditable(u),i&&s.above?o.insertBefore(u,n.gutter||n.text):o.appendChild(u),un(s,"redraw")}}function wn(e,t,n,r){if(e.noHScroll){(n.alignable||(n.alignable=[])).push(t)
574
574
  var i=r.wrapperWidth
575
- t.style.left=r.fixedPos+"px",e.coverGutter||(i-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function wn(e){if(null!=e.height)return e.height
575
+ t.style.left=r.fixedPos+"px",e.coverGutter||(i-=r.gutterTotalWidth,t.style.paddingLeft=r.gutterTotalWidth+"px"),t.style.width=i+"px"}e.coverGutter&&(t.style.zIndex=5,t.style.position="relative",e.noHScroll||(t.style.marginLeft=-r.gutterTotalWidth+"px"))}function Cn(e){if(null!=e.height)return e.height
576
576
  var t=e.doc.cm
577
577
  if(!t)return 0
578
578
  if(!D(document.body,e.node)){var n="position: relative;"
579
- e.coverGutter&&(n+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(n+="width: "+t.display.wrapper.clientWidth+"px;"),A(t.display.measure,N("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function Cn(e,t){for(var n=ke(t);n!=e.wrapper;n=n.parentNode)if(!n||1==n.nodeType&&"true"==n.getAttribute("cm-ignore-events")||n.parentNode==e.sizer&&n!=e.mover)return!0}function kn(e){return e.lineSpace.offsetTop}function Sn(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function Ln(e){if(e.cachedPaddingH)return e.cachedPaddingH
579
+ e.coverGutter&&(n+="margin-left: -"+t.display.gutters.offsetWidth+"px;"),e.noHScroll&&(n+="width: "+t.display.wrapper.clientWidth+"px;"),A(t.display.measure,N("div",[e.node],null,n))}return e.height=e.node.parentNode.offsetHeight}function kn(e,t){for(var n=Se(t);n!=e.wrapper;n=n.parentNode)if(!n||1==n.nodeType&&"true"==n.getAttribute("cm-ignore-events")||n.parentNode==e.sizer&&n!=e.mover)return!0}function Sn(e){return e.lineSpace.offsetTop}function Ln(e){return e.mover.offsetHeight-e.lineSpace.offsetHeight}function Tn(e){if(e.cachedPaddingH)return e.cachedPaddingH
580
580
  var t=A(e.measure,N("pre","x")),n=window.getComputedStyle?window.getComputedStyle(t):t.currentStyle,r={left:parseInt(n.paddingLeft),right:parseInt(n.paddingRight)}
581
- return isNaN(r.left)||isNaN(r.right)||(e.cachedPaddingH=r),r}function Tn(e){return 30-e.display.nativeBarWidth}function Mn(e){return e.display.scroller.clientWidth-Tn(e)-e.display.barWidth}function An(e){return e.display.scroller.clientHeight-Tn(e)-e.display.barHeight}function Nn(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache}
581
+ return isNaN(r.left)||isNaN(r.right)||(e.cachedPaddingH=r),r}function Mn(e){return j-e.display.nativeBarWidth}function An(e){return e.display.scroller.clientWidth-Mn(e)-e.display.barWidth}function Nn(e){return e.display.scroller.clientHeight-Mn(e)-e.display.barHeight}function En(e,t,n){if(e.line==t)return{map:e.measure.map,cache:e.measure.cache}
582
582
  for(var r=0;r<e.rest.length;r++)if(e.rest[r]==t)return{map:e.measure.maps[r],cache:e.measure.caches[r]}
583
- for(var i=0;i<e.rest.length;i++)if(Ye(e.rest[i])>n)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function En(e,t,n,r){return On(e,Fn(e,t),n,r)}function Dn(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[cr(e,t)]
583
+ for(var i=0;i<e.rest.length;i++)if(Ze(e.rest[i])>n)return{map:e.measure.maps[i],cache:e.measure.caches[i],before:!0}}function Dn(e,t,n,r){return In(e,On(e,t),n,r)}function Fn(e,t){if(t>=e.display.viewFrom&&t<e.display.viewTo)return e.display.view[fr(e,t)]
584
584
  var n=e.display.externalMeasured
585
- return n&&t>=n.lineN&&t<n.lineN+n.size?n:void 0}function Fn(e,t){var n=Ye(t),r=Dn(e,n)
586
- r&&!r.text?r=null:r&&r.changes&&(cn(e,r,n,or(e)),e.curOp.forceUpdate=!0),r||(r=function(e,t){var n=Ye(t=Pt(t)),r=e.display.externalMeasured=new rn(e.doc,t,n)
585
+ return n&&t>=n.lineN&&t<n.lineN+n.size?n:void 0}function On(e,t){var n=Ze(t),r=Fn(e,n)
586
+ r&&!r.text?r=null:r&&r.changes&&(fn(e,r,n,ar(e)),e.curOp.forceUpdate=!0),r||(r=function(e,t){var n=Ze(t=Rt(t)),r=e.display.externalMeasured=new on(e.doc,t,n)
587
587
  r.lineN=n
588
- var i=r.built=Zt(e,r)
588
+ var i=r.built=Qt(e,r)
589
589
  return r.text=i.pre,A(e.display.lineMeasure,i.pre),r}(e,t))
590
- var i=Nn(r,t,n)
591
- return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function On(e,t,n,r,i){t.before&&(n=-1)
590
+ var i=En(r,t,n)
591
+ return{line:t,view:r,rect:null,map:i.map,cache:i.cache,before:i.before,hasHeights:!1}}function In(e,t,n,r,i){t.before&&(n=-1)
592
592
  var o,s=n+(r||"")
593
- return t.cache.hasOwnProperty(s)?o=t.cache[s]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(function(e,t,n){var r=e.options.lineWrapping,i=r&&Mn(e)
593
+ return t.cache.hasOwnProperty(s)?o=t.cache[s]:(t.rect||(t.rect=t.view.text.getBoundingClientRect()),t.hasHeights||(function(e,t,n){var r=e.options.lineWrapping,i=r&&An(e)
594
594
  if(!t.measure.heights||r&&t.measure.width!=i){var o=t.measure.heights=[]
595
595
  if(r){t.measure.width=i
596
596
  for(var a=t.text.firstChild.getClientRects(),l=0;l<a.length-1;l++){var s=a[l],u=a[l+1]
597
- Math.abs(s.bottom-u.bottom)>2&&o.push((s.bottom+u.top)/2-n.top)}}o.push(n.bottom-n.top)}}(e,t.view,t.rect),t.hasHeights=!0),o=function(e,t,n,r){var i,o=Hn(t.map,n,r),s=o.node,u=o.start,c=o.end,f=o.collapse
598
- if(3==s.nodeType){for(var d=0;d<4;d++){for(;u&&re(t.line.text.charAt(o.coverStart+u));)--u
599
- for(;o.coverStart+c<o.coverEnd&&re(t.line.text.charAt(o.coverStart+c));)++c
600
- if((i=a&&l<9&&0==u&&c==o.coverEnd-o.coverStart?s.parentNode.getBoundingClientRect():Wn(L(s,u,c).getClientRects(),r)).left||i.right||0==u)break
601
- c=u,u-=1,f="right"}a&&l<11&&(i=function(e,t){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!function(e){if(null!=Ie)return Ie
597
+ Math.abs(s.bottom-u.bottom)>2&&o.push((s.bottom+u.top)/2-n.top)}}o.push(n.bottom-n.top)}}(e,t.view,t.rect),t.hasHeights=!0),o=function(e,t,n,r){var i,o=Wn(t.map,n,r),s=o.node,u=o.start,c=o.end,f=o.collapse
598
+ if(3==s.nodeType){for(var d=0;d<4;d++){for(;u&&ie(t.line.text.charAt(o.coverStart+u));)--u
599
+ for(;o.coverStart+c<o.coverEnd&&ie(t.line.text.charAt(o.coverStart+c));)++c
600
+ if((i=a&&l<9&&0==u&&c==o.coverEnd-o.coverStart?s.parentNode.getBoundingClientRect():Pn(L(s,u,c).getClientRects(),r)).left||i.right||0==u)break
601
+ c=u,u-=1,f="right"}a&&l<11&&(i=function(e,t){if(!window.screen||null==screen.logicalXDPI||screen.logicalXDPI==screen.deviceXDPI||!function(e){if(null!=Be)return Be
602
602
  var t=A(e,N("span","x")),n=t.getBoundingClientRect(),r=L(t,0,1).getBoundingClientRect()
603
- return Ie=Math.abs(n.left-r.left)>1}(e))return t
603
+ return Be=Math.abs(n.left-r.left)>1}(e))return t
604
604
  var n=screen.logicalXDPI/screen.deviceXDPI,r=screen.logicalYDPI/screen.deviceYDPI
605
605
  return{left:t.left*n,right:t.right*n,top:t.top*r,bottom:t.bottom*r}}(e.display.measure,i))}else{var h
606
606
  u>0&&(f=r="right"),i=e.options.lineWrapping&&(h=s.getClientRects()).length>1?h["right"==r?h.length-1:0]:s.getBoundingClientRect()}if(a&&l<9&&!u&&(!i||!i.left&&!i.right)){var p=s.parentNode.getClientRects()[0]
607
- i=p?{left:p.left,right:p.left+ir(e.display),top:p.top,bottom:p.bottom}:Bn}for(var m=i.top-t.rect.top,g=i.bottom-t.rect.top,v=(m+g)/2,y=t.view.measure.heights,x=0;x<y.length-1&&!(v<y[x]);x++);var b=x?y[x-1]:0,w=y[x],C={left:("right"==f?i.right:i.left)-t.rect.left,right:("left"==f?i.left:i.right)-t.rect.left,top:b,bottom:w}
608
- return i.left||i.right||(C.bogus=!0),e.options.singleCursorHeightPerLine||(C.rtop=m,C.rbottom=g),C}(e,t,n,r),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 In,Bn={left:0,right:0,top:0,bottom:0}
609
- function Hn(e,t,n){for(var r,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(r=e[u+2],l==s&&n==(r.insertLeft?"left":"right")&&(a=n),"left"==n&&0==i)for(;u&&e[u-2]==e[u-3]&&e[u-1].insertLeft;)r=e[2+(u-=3)],a="left"
607
+ i=p?{left:p.left,right:p.left+or(e.display),top:p.top,bottom:p.bottom}:Hn}for(var m=i.top-t.rect.top,g=i.bottom-t.rect.top,v=(m+g)/2,y=t.view.measure.heights,x=0;x<y.length-1&&!(v<y[x]);x++);var b=x?y[x-1]:0,w=y[x],C={left:("right"==f?i.right:i.left)-t.rect.left,right:("left"==f?i.left:i.right)-t.rect.left,top:b,bottom:w}
608
+ return i.left||i.right||(C.bogus=!0),e.options.singleCursorHeightPerLine||(C.rtop=m,C.rbottom=g),C}(e,t,n,r),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 Bn,Hn={left:0,right:0,top:0,bottom:0}
609
+ function Wn(e,t,n){for(var r,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(r=e[u+2],l==s&&n==(r.insertLeft?"left":"right")&&(a=n),"left"==n&&0==i)for(;u&&e[u-2]==e[u-3]&&e[u-1].insertLeft;)r=e[2+(u-=3)],a="left"
610
610
  if("right"==n&&i==s-l)for(;u<e.length-3&&e[u+3]==e[u+4]&&!e[u+5].insertLeft;)r=e[(u+=3)+2],a="right"
611
- break}return{node:r,start:i,end:o,collapse:a,coverStart:l,coverEnd:s}}function Wn(e,t){var n=Bn
612
- if("left"==t)for(var r=0;r<e.length&&(n=e[r]).left==n.right;r++);else for(var i=e.length-1;i>=0&&(n=e[i]).left==n.right;i--);return n}function Pn(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 Rn(e){e.display.externalMeasure=null,M(e.display.lineMeasure)
613
- for(var t=0;t<e.display.view.length;t++)Pn(e.display.view[t])}function zn(e){Rn(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function jn(){return c&&g?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function _n(){return c&&g?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function Un(e){var t=0
614
- if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=wn(e.widgets[n]))
615
- return t}function qn(e,t,n,r,i){if(!i){var o=Un(t)
611
+ break}return{node:r,start:i,end:o,collapse:a,coverStart:l,coverEnd:s}}function Pn(e,t){var n=Hn
612
+ if("left"==t)for(var r=0;r<e.length&&(n=e[r]).left==n.right;r++);else for(var i=e.length-1;i>=0&&(n=e[i]).left==n.right;i--);return n}function Rn(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 zn(e){e.display.externalMeasure=null,M(e.display.lineMeasure)
613
+ for(var t=0;t<e.display.view.length;t++)Rn(e.display.view[t])}function jn(e){zn(e),e.display.cachedCharWidth=e.display.cachedTextHeight=e.display.cachedPaddingH=null,e.options.lineWrapping||(e.display.maxLineChanged=!0),e.display.lineNumChars=null}function _n(){return c&&g?-(document.body.getBoundingClientRect().left-parseInt(getComputedStyle(document.body).marginLeft)):window.pageXOffset||(document.documentElement||document.body).scrollLeft}function Un(){return c&&g?-(document.body.getBoundingClientRect().top-parseInt(getComputedStyle(document.body).marginTop)):window.pageYOffset||(document.documentElement||document.body).scrollTop}function qn(e){var t=0
614
+ if(e.widgets)for(var n=0;n<e.widgets.length;++n)e.widgets[n].above&&(t+=Cn(e.widgets[n]))
615
+ return t}function Gn(e,t,n,r,i){if(!i){var o=qn(t)
616
616
  n.top+=o,n.bottom+=o}if("line"==r)return n
617
617
  r||(r="local")
618
- var a=Ut(t)
619
- if("local"==r?a+=kn(e.display):a-=e.display.viewOffset,"page"==r||"window"==r){var l=e.display.lineSpace.getBoundingClientRect()
620
- a+=l.top+("window"==r?0:_n())
621
- var s=l.left+("window"==r?0:jn())
622
- n.left+=s,n.right+=s}return n.top+=a,n.bottom+=a,n}function Gn(e,t,n){if("div"==n)return t
618
+ var a=qt(t)
619
+ if("local"==r?a+=Sn(e.display):a-=e.display.viewOffset,"page"==r||"window"==r){var l=e.display.lineSpace.getBoundingClientRect()
620
+ a+=l.top+("window"==r?0:Un())
621
+ var s=l.left+("window"==r?0:_n())
622
+ n.left+=s,n.right+=s}return n.top+=a,n.bottom+=a,n}function Vn(e,t,n){if("div"==n)return t
623
623
  var r=t.left,i=t.top
624
- if("page"==n)r-=jn(),i-=_n()
624
+ if("page"==n)r-=_n(),i-=Un()
625
625
  else if("local"==n||!n){var o=e.display.sizer.getBoundingClientRect()
626
626
  r+=o.left,i+=o.top}var a=e.display.lineSpace.getBoundingClientRect()
627
- return{left:r-a.left,top:i-a.top}}function Vn(e,t,n,r,i){return r||(r=Ve(e.doc,t.line)),qn(e,r,En(e,r,t.ch,i),n)}function $n(e,t,n,r,i,o){function a(t,a){var l=On(e,i,t,a?"right":"left",o)
628
- return a?l.left=l.right:l.right=l.left,qn(e,r,l,n)}r=r||Ve(e.doc,t.line),i||(i=Fn(e,r))
629
- var l=ue(r,e.doc.direction),s=t.ch,u=t.sticky
627
+ return{left:r-a.left,top:i-a.top}}function $n(e,t,n,r,i){return r||(r=$e(e.doc,t.line)),Gn(e,r,Dn(e,r,t.ch,i),n)}function Xn(e,t,n,r,i,o){function a(t,a){var l=In(e,i,t,a?"right":"left",o)
628
+ return a?l.left=l.right:l.right=l.left,Gn(e,r,l,n)}r=r||$e(e.doc,t.line),i||(i=On(e,r))
629
+ var l=ce(r,e.doc.direction),s=t.ch,u=t.sticky
630
630
  if(s>=r.text.length?(s=r.text.length,u="before"):s<=0&&(s=0,u="after"),!l)return a("before"==u?s-1:s,"before"==u)
631
- function c(e,t,n){return a(n?e-1:e,1==l[t].level!=n)}var f=le(l,s,u),d=ae,h=c(s,f,"before"==u)
632
- return null!=d&&(h.other=c(s,d,"before"!=u)),h}function Xn(e,t){var n=0
633
- t=lt(e.doc,t),e.options.lineWrapping||(n=ir(e.display)*t.ch)
634
- var r=Ve(e.doc,t.line),i=Ut(r)+kn(e.display)
635
- return{left:n,right:n,top:i,bottom:i+r.height}}function Kn(e,t,n,r,i){var o=et(e,t,n)
636
- return o.xRel=i,r&&(o.outside=!0),o}function Yn(e,t,n){var r=e.doc
637
- if((n+=e.display.viewOffset)<0)return Kn(r.first,0,null,!0,-1)
638
- var i=Ze(r,n),o=r.first+r.size-1
639
- if(i>o)return Kn(r.first+r.size-1,Ve(r,o).text.length,null,!0,1)
631
+ function c(e,t,n){return a(n?e-1:e,1==l[t].level!=n)}var f=se(l,s,u),d=le,h=c(s,f,"before"==u)
632
+ return null!=d&&(h.other=c(s,d,"before"!=u)),h}function Kn(e,t){var n=0
633
+ t=st(e.doc,t),e.options.lineWrapping||(n=or(e.display)*t.ch)
634
+ var r=$e(e.doc,t.line),i=qt(r)+Sn(e.display)
635
+ return{left:n,right:n,top:i,bottom:i+r.height}}function Yn(e,t,n,r,i){var o=tt(e,t,n)
636
+ return o.xRel=i,r&&(o.outside=!0),o}function Zn(e,t,n){var r=e.doc
637
+ if((n+=e.display.viewOffset)<0)return Yn(r.first,0,null,!0,-1)
638
+ var i=Qe(r,n),o=r.first+r.size-1
639
+ if(i>o)return Yn(r.first+r.size-1,$e(r,o).text.length,null,!0,1)
640
640
  t<0&&(t=0)
641
- for(var a=Ve(r,i);;){var l=er(e,a,i,t,n),s=Ht(a,l.ch+(l.xRel>0?1:0))
641
+ for(var a=$e(r,i);;){var l=tr(e,a,i,t,n),s=Wt(a,l.ch+(l.xRel>0?1:0))
642
642
  if(!s)return l
643
643
  var u=s.find(1)
644
644
  if(u.line==i)return u
645
- a=Ve(r,i=u.line)}}function Zn(e,t,n,r){r-=Un(t)
646
- var i=t.text.length,o=oe((function(t){return On(e,n,t-1).bottom<=r}),i,0)
647
- return{begin:o,end:i=oe((function(t){return On(e,n,t).top>r}),o,i)}}function Qn(e,t,n,r){return n||(n=Fn(e,t)),Zn(e,t,n,qn(e,t,On(e,n,r),"line").top)}function Jn(e,t,n,r){return!(e.bottom<=n)&&(e.top>n||(r?e.left:e.right)>t)}function er(e,t,n,r,i){i-=Ut(t)
648
- var o=Fn(e,t),a=Un(t),l=0,s=t.text.length,u=!0,c=ue(t,e.doc.direction)
649
- if(c){var f=(e.options.lineWrapping?nr:tr)(e,t,n,o,c,r,i)
650
- l=(u=1!=f.level)?f.from:f.to-1,s=u?f.to:f.from-1}var d,h,p=null,m=null,g=oe((function(t){var n=On(e,o,t)
651
- return n.top+=a,n.bottom+=a,!!Jn(n,r,i,!1)&&(n.top<=i&&n.left<=r&&(p=t,m=n),!0)}),l,s),v=!1
645
+ a=$e(r,i=u.line)}}function Qn(e,t,n,r){r-=qn(t)
646
+ var i=t.text.length,o=ae((function(t){return In(e,n,t-1).bottom<=r}),i,0)
647
+ return{begin:o,end:i=ae((function(t){return In(e,n,t).top>r}),o,i)}}function Jn(e,t,n,r){return n||(n=On(e,t)),Qn(e,t,n,Gn(e,t,In(e,n,r),"line").top)}function er(e,t,n,r){return!(e.bottom<=n)&&(e.top>n||(r?e.left:e.right)>t)}function tr(e,t,n,r,i){i-=qt(t)
648
+ var o=On(e,t),a=qn(t),l=0,s=t.text.length,u=!0,c=ce(t,e.doc.direction)
649
+ if(c){var f=(e.options.lineWrapping?rr:nr)(e,t,n,o,c,r,i)
650
+ l=(u=1!=f.level)?f.from:f.to-1,s=u?f.to:f.from-1}var d,h,p=null,m=null,g=ae((function(t){var n=In(e,o,t)
651
+ return n.top+=a,n.bottom+=a,!!er(n,r,i,!1)&&(n.top<=i&&n.left<=r&&(p=t,m=n),!0)}),l,s),v=!1
652
652
  if(m){var y=r-m.left<m.right-r,x=y==u
653
- g=p+(x?0:1),h=x?"after":"before",d=y?m.left:m.right}else{u||g!=s&&g!=l||g++,h=0==g?"after":g==t.text.length?"before":On(e,o,g-(u?1:0)).bottom+a<=i==u?"after":"before"
654
- var b=$n(e,et(n,g,h),"line",t,o)
655
- d=b.left,v=i<b.top||i>=b.bottom}return Kn(n,g=ie(t.text,g,1),h,v,r-d)}function tr(e,t,n,r,i,o,a){var l=oe((function(l){var s=i[l],u=1!=s.level
656
- return Jn($n(e,et(n,u?s.to:s.from,u?"before":"after"),"line",t,r),o,a,!0)}),0,i.length-1),s=i[l]
657
- if(l>0){var u=1!=s.level,c=$n(e,et(n,u?s.from:s.to,u?"after":"before"),"line",t,r)
658
- Jn(c,o,a,!0)&&c.top>a&&(s=i[l-1])}return s}function nr(e,t,n,r,i,o,a){var l=Zn(e,t,r,a),s=l.begin,u=l.end;/\s/.test(t.text.charAt(u-1))&&u--
653
+ g=p+(x?0:1),h=x?"after":"before",d=y?m.left:m.right}else{u||g!=s&&g!=l||g++,h=0==g?"after":g==t.text.length?"before":In(e,o,g-(u?1:0)).bottom+a<=i==u?"after":"before"
654
+ var b=Xn(e,tt(n,g,h),"line",t,o)
655
+ d=b.left,v=i<b.top||i>=b.bottom}return Yn(n,g=oe(t.text,g,1),h,v,r-d)}function nr(e,t,n,r,i,o,a){var l=ae((function(l){var s=i[l],u=1!=s.level
656
+ return er(Xn(e,tt(n,u?s.to:s.from,u?"before":"after"),"line",t,r),o,a,!0)}),0,i.length-1),s=i[l]
657
+ if(l>0){var u=1!=s.level,c=Xn(e,tt(n,u?s.from:s.to,u?"after":"before"),"line",t,r)
658
+ er(c,o,a,!0)&&c.top>a&&(s=i[l-1])}return s}function rr(e,t,n,r,i,o,a){var l=Qn(e,t,r,a),s=l.begin,u=l.end;/\s/.test(t.text.charAt(u-1))&&u--
659
659
  for(var c=null,f=null,d=0;d<i.length;d++){var h=i[d]
660
- if(!(h.from>=u||h.to<=s)){var p=On(e,r,1!=h.level?Math.min(u,h.to)-1:Math.max(s,h.from)).right,m=p<o?o-p+1e9:p-o;(!c||f>m)&&(c=h,f=m)}}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 rr(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight
661
- if(null==In){In=N("pre")
662
- for(var t=0;t<49;++t)In.appendChild(document.createTextNode("x")),In.appendChild(N("br"))
663
- In.appendChild(document.createTextNode("x"))}A(e.measure,In)
664
- var n=In.offsetHeight/50
665
- return n>3&&(e.cachedTextHeight=n),M(e.measure),n||1}function ir(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth
660
+ if(!(h.from>=u||h.to<=s)){var p=In(e,r,1!=h.level?Math.min(u,h.to)-1:Math.max(s,h.from)).right,m=p<o?o-p+1e9:p-o;(!c||f>m)&&(c=h,f=m)}}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 ir(e){if(null!=e.cachedTextHeight)return e.cachedTextHeight
661
+ if(null==Bn){Bn=N("pre")
662
+ for(var t=0;t<49;++t)Bn.appendChild(document.createTextNode("x")),Bn.appendChild(N("br"))
663
+ Bn.appendChild(document.createTextNode("x"))}A(e.measure,Bn)
664
+ var n=Bn.offsetHeight/50
665
+ return n>3&&(e.cachedTextHeight=n),M(e.measure),n||1}function or(e){if(null!=e.cachedCharWidth)return e.cachedCharWidth
666
666
  var t=N("span","xxxxxxxxxx"),n=N("pre",[t])
667
667
  A(e.measure,n)
668
668
  var r=t.getBoundingClientRect(),i=(r.right-r.left)/10
669
- return i>2&&(e.cachedCharWidth=i),i||10}function or(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,o=t.gutters.firstChild,a=0;o;o=o.nextSibling,++a){var l=e.display.gutterSpecs[a].className
670
- n[l]=o.offsetLeft+o.clientLeft+i,r[l]=o.clientWidth}return{fixedPos:ar(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function ar(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function lr(e){var t=rr(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/ir(e.display)-3)
671
- return function(i){if(jt(e.doc,i))return 0
669
+ return i>2&&(e.cachedCharWidth=i),i||10}function ar(e){for(var t=e.display,n={},r={},i=t.gutters.clientLeft,o=t.gutters.firstChild,a=0;o;o=o.nextSibling,++a){var l=e.display.gutterSpecs[a].className
670
+ n[l]=o.offsetLeft+o.clientLeft+i,r[l]=o.clientWidth}return{fixedPos:lr(t),gutterTotalWidth:t.gutters.offsetWidth,gutterLeft:n,gutterWidth:r,wrapperWidth:t.wrapper.clientWidth}}function lr(e){return e.scroller.getBoundingClientRect().left-e.sizer.getBoundingClientRect().left}function sr(e){var t=ir(e.display),n=e.options.lineWrapping,r=n&&Math.max(5,e.display.scroller.clientWidth/or(e.display)-3)
671
+ return function(i){if(_t(e.doc,i))return 0
672
672
  var o=0
673
673
  if(i.widgets)for(var a=0;a<i.widgets.length;a++)i.widgets[a].height&&(o+=i.widgets[a].height)
674
- return n?o+(Math.ceil(i.text.length/r)||1)*t:o+t}}function sr(e){var t=e.doc,n=lr(e)
674
+ return n?o+(Math.ceil(i.text.length/r)||1)*t:o+t}}function ur(e){var t=e.doc,n=sr(e)
675
675
  t.iter((function(e){var t=n(e)
676
- t!=e.height&&Ke(e,t)}))}function ur(e,t,n,r){var i=e.display
677
- if(!n&&"true"==ke(t).getAttribute("cm-not-content"))return null
676
+ t!=e.height&&Ye(e,t)}))}function cr(e,t,n,r){var i=e.display
677
+ if(!n&&"true"==Se(t).getAttribute("cm-not-content"))return null
678
678
  var o,a,l=i.lineSpace.getBoundingClientRect()
679
- try{o=t.clientX-l.left,a=t.clientY-l.top}catch(t){return null}var s,u=Yn(e,o,a)
680
- if(r&&1==u.xRel&&(s=Ve(e.doc,u.line).text).length==u.ch){var c=P(s,s.length,e.options.tabSize)-s.length
681
- u=et(u.line,Math.max(0,Math.round((o-Ln(e.display).left)/ir(e.display))-c))}return u}function cr(e,t){if(t>=e.display.viewTo)return null
679
+ try{o=t.clientX-l.left,a=t.clientY-l.top}catch(t){return null}var s,u=Zn(e,o,a)
680
+ if(r&&1==u.xRel&&(s=$e(e.doc,u.line).text).length==u.ch){var c=P(s,s.length,e.options.tabSize)-s.length
681
+ u=tt(u.line,Math.max(0,Math.round((o-Tn(e.display).left)/or(e.display))-c))}return u}function fr(e,t){if(t>=e.display.viewTo)return null
682
682
  if((t-=e.display.viewFrom)<0)return null
683
- for(var n=e.display.view,r=0;r<n.length;r++)if((t-=n[r].size)<0)return r}function fr(e,t,n,r){null==t&&(t=e.doc.first),null==n&&(n=e.doc.first+e.doc.size),r||(r=0)
683
+ for(var n=e.display.view,r=0;r<n.length;r++)if((t-=n[r].size)<0)return r}function dr(e,t,n,r){null==t&&(t=e.doc.first),null==n&&(n=e.doc.first+e.doc.size),r||(r=0)
684
684
  var i=e.display
685
- if(r&&n<i.viewTo&&(null==i.updateLineNumbers||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)Ct&&Rt(e.doc,t)<i.viewTo&&hr(e)
686
- else if(n<=i.viewFrom)Ct&&zt(e.doc,n+r)>i.viewFrom?hr(e):(i.viewFrom+=r,i.viewTo+=r)
687
- else if(t<=i.viewFrom&&n>=i.viewTo)hr(e)
688
- else if(t<=i.viewFrom){var o=pr(e,n,n+r,1)
689
- o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=r):hr(e)}else if(n>=i.viewTo){var a=pr(e,t,t,-1)
690
- a?(i.view=i.view.slice(0,a.index),i.viewTo=a.lineN):hr(e)}else{var l=pr(e,t,t,-1),s=pr(e,n,n+r,1)
691
- l&&s?(i.view=i.view.slice(0,l.index).concat(on(e,l.lineN,s.lineN)).concat(i.view.slice(s.index)),i.viewTo+=r):hr(e)}var u=i.externalMeasured
692
- u&&(n<u.lineN?u.lineN+=r:t<u.lineN+u.size&&(i.externalMeasured=null))}function dr(e,t,n){e.curOp.viewChanged=!0
685
+ if(r&&n<i.viewTo&&(null==i.updateLineNumbers||i.updateLineNumbers>t)&&(i.updateLineNumbers=t),e.curOp.viewChanged=!0,t>=i.viewTo)kt&&zt(e.doc,t)<i.viewTo&&pr(e)
686
+ else if(n<=i.viewFrom)kt&&jt(e.doc,n+r)>i.viewFrom?pr(e):(i.viewFrom+=r,i.viewTo+=r)
687
+ else if(t<=i.viewFrom&&n>=i.viewTo)pr(e)
688
+ else if(t<=i.viewFrom){var o=mr(e,n,n+r,1)
689
+ o?(i.view=i.view.slice(o.index),i.viewFrom=o.lineN,i.viewTo+=r):pr(e)}else if(n>=i.viewTo){var a=mr(e,t,t,-1)
690
+ a?(i.view=i.view.slice(0,a.index),i.viewTo=a.lineN):pr(e)}else{var l=mr(e,t,t,-1),s=mr(e,n,n+r,1)
691
+ l&&s?(i.view=i.view.slice(0,l.index).concat(an(e,l.lineN,s.lineN)).concat(i.view.slice(s.index)),i.viewTo+=r):pr(e)}var u=i.externalMeasured
692
+ u&&(n<u.lineN?u.lineN+=r:t<u.lineN+u.size&&(i.externalMeasured=null))}function hr(e,t,n){e.curOp.viewChanged=!0
693
693
  var r=e.display,i=e.display.externalMeasured
694
- if(i&&t>=i.lineN&&t<i.lineN+i.size&&(r.externalMeasured=null),!(t<r.viewFrom||t>=r.viewTo)){var o=r.view[cr(e,t)]
695
- if(null!=o.node){var a=o.changes||(o.changes=[]);-1==z(a,n)&&a.push(n)}}}function hr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function pr(e,t,n,r){var i,o=cr(e,t),a=e.display.view
696
- if(!Ct||n==e.doc.first+e.doc.size)return{index:o,lineN:n}
694
+ if(i&&t>=i.lineN&&t<i.lineN+i.size&&(r.externalMeasured=null),!(t<r.viewFrom||t>=r.viewTo)){var o=r.view[fr(e,t)]
695
+ if(null!=o.node){var a=o.changes||(o.changes=[]);-1==z(a,n)&&a.push(n)}}}function pr(e){e.display.viewFrom=e.display.viewTo=e.doc.first,e.display.view=[],e.display.viewOffset=0}function mr(e,t,n,r){var i,o=fr(e,t),a=e.display.view
696
+ if(!kt||n==e.doc.first+e.doc.size)return{index:o,lineN:n}
697
697
  for(var l=e.display.viewFrom,s=0;s<o;s++)l+=a[s].size
698
698
  if(l!=t){if(r>0){if(o==a.length-1)return null
699
699
  i=l+a[o].size-t,o++}else i=l-t
700
- t+=i,n+=i}for(;Rt(e.doc,n)!=n;){if(o==(r<0?0:a.length-1))return null
701
- n+=r*a[o-(r<0?1:0)].size,o+=r}return{index:o,lineN:n}}function mr(e){for(var t=e.display.view,n=0,r=0;r<t.length;r++){var i=t[r]
702
- i.hidden||i.node&&!i.changes||++n}return n}function gr(e){e.display.input.showSelection(e.display.input.prepareSelection())}function vr(e,t){void 0===t&&(t=!0)
700
+ t+=i,n+=i}for(;zt(e.doc,n)!=n;){if(o==(r<0?0:a.length-1))return null
701
+ n+=r*a[o-(r<0?1:0)].size,o+=r}return{index:o,lineN:n}}function gr(e){for(var t=e.display.view,n=0,r=0;r<t.length;r++){var i=t[r]
702
+ i.hidden||i.node&&!i.changes||++n}return n}function vr(e){e.display.input.showSelection(e.display.input.prepareSelection())}function yr(e,t){void 0===t&&(t=!0)
703
703
  for(var n=e.doc,r={},i=r.cursors=document.createDocumentFragment(),o=r.selection=document.createDocumentFragment(),a=0;a<n.sel.ranges.length;a++)if(t||a!=n.sel.primIndex){var l=n.sel.ranges[a]
704
- if(!(l.from().line>=e.display.viewTo||l.to().line<e.display.viewFrom)){var s=l.empty();(s||e.options.showCursorWhenSelecting)&&yr(e,l.head,i),s||br(e,l,o)}}return r}function yr(e,t,n){var r=$n(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=n.appendChild(N("div"," ","CodeMirror-cursor"))
704
+ if(!(l.from().line>=e.display.viewTo||l.to().line<e.display.viewFrom)){var s=l.empty();(s||e.options.showCursorWhenSelecting)&&xr(e,l.head,i),s||wr(e,l,o)}}return r}function xr(e,t,n){var r=Xn(e,t,"div",null,null,!e.options.singleCursorHeightPerLine),i=n.appendChild(N("div"," ","CodeMirror-cursor"))
705
705
  if(i.style.left=r.left+"px",i.style.top=r.top+"px",i.style.height=Math.max(0,r.bottom-r.top)*e.options.cursorHeight+"px",r.other){var o=n.appendChild(N("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"))
706
- o.style.display="",o.style.left=r.other.left+"px",o.style.top=r.other.top+"px",o.style.height=.85*(r.other.bottom-r.other.top)+"px"}}function xr(e,t){return e.top-t.top||e.left-t.left}function br(e,t,n){var r=e.display,i=e.doc,o=document.createDocumentFragment(),a=Ln(e.display),l=a.left,s=Math.max(r.sizerWidth,Mn(e)-r.sizer.offsetLeft)-a.right,u="ltr"==i.direction
707
- function c(e,t,n,r){t<0&&(t=0),t=Math.round(t),r=Math.round(r),o.appendChild(N("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px;\n top: "+t+"px; width: "+(null==n?s-e:n)+"px;\n height: "+(r-t)+"px"))}function f(t,n,r){var o,a,f=Ve(i,t),d=f.text.length
708
- function h(n,r){return Vn(e,et(t,n),"div",f,r)}function p(t,n,r){var i=Qn(e,f,null,t),o="ltr"==n==("after"==r)?"left":"right"
709
- return h("after"==r?i.begin:i.end-(/\s/.test(f.text.charAt(i.end-1))?2:1),o)[o]}var m=ue(f,i.direction)
706
+ o.style.display="",o.style.left=r.other.left+"px",o.style.top=r.other.top+"px",o.style.height=.85*(r.other.bottom-r.other.top)+"px"}}function br(e,t){return e.top-t.top||e.left-t.left}function wr(e,t,n){var r=e.display,i=e.doc,o=document.createDocumentFragment(),a=Tn(e.display),l=a.left,s=Math.max(r.sizerWidth,An(e)-r.sizer.offsetLeft)-a.right,u="ltr"==i.direction
707
+ function c(e,t,n,r){t<0&&(t=0),t=Math.round(t),r=Math.round(r),o.appendChild(N("div",null,"CodeMirror-selected","position: absolute; left: "+e+"px;\n top: "+t+"px; width: "+(null==n?s-e:n)+"px;\n height: "+(r-t)+"px"))}function f(t,n,r){var o,a,f=$e(i,t),d=f.text.length
708
+ function h(n,r){return $n(e,tt(t,n),"div",f,r)}function p(t,n,r){var i=Jn(e,f,null,t),o="ltr"==n==("after"==r)?"left":"right"
709
+ return h("after"==r?i.begin:i.end-(/\s/.test(f.text.charAt(i.end-1))?2:1),o)[o]}var m=ce(f,i.direction)
710
710
  return function(e,t,n,r){if(!e)return r(t,n,"ltr",0)
711
711
  for(var i=!1,o=0;o<e.length;++o){var a=e[o];(a.from<n&&a.to>t||t==n&&a.to==t)&&(r(Math.max(a.from,t),Math.min(a.to,n),1==a.level?"rtl":"ltr",o),i=!0)}i||r(t,n,"ltr")}(m,n||0,null==r?d:r,(function(e,t,i,f){var g="ltr"==i,v=h(e,g?"left":"right"),y=h(t-1,g?"right":"left"),x=null==n&&0==e,b=null==r&&t==d,w=0==f,C=!m||f==m.length-1
712
712
  if(y.top-v.top<=3){var k=(u?b:x)&&C,S=(u?x:b)&&w?l:(g?v:y).left,L=k?s:(g?y:v).right
713
713
  c(S,v.top,L-S,v.bottom)}else{var T,M,A,N
714
- g?(T=u&&x&&w?l:v.left,M=u?s:p(e,i,"before"),A=u?l:p(t,i,"after"),N=u&&b&&C?s:y.right):(T=u?p(e,i,"before"):l,M=!u&&x&&w?s:v.right,A=!u&&b&&C?l:y.left,N=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(A,y.top,N-A,y.bottom)}(!o||xr(v,o)<0)&&(o=v),xr(y,o)<0&&(o=y),(!a||xr(v,a)<0)&&(a=v),xr(y,a)<0&&(a=y)})),{start:o,end:a}}var d=t.from(),h=t.to()
714
+ g?(T=u&&x&&w?l:v.left,M=u?s:p(e,i,"before"),A=u?l:p(t,i,"after"),N=u&&b&&C?s:y.right):(T=u?p(e,i,"before"):l,M=!u&&x&&w?s:v.right,A=!u&&b&&C?l:y.left,N=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(A,y.top,N-A,y.bottom)}(!o||br(v,o)<0)&&(o=v),br(y,o)<0&&(o=y),(!a||br(v,a)<0)&&(a=v),br(y,a)<0&&(a=y)})),{start:o,end:a}}var d=t.from(),h=t.to()
715
715
  if(d.line==h.line)f(d.line,d.ch,h.ch)
716
- else{var p=Ve(i,d.line),m=Ve(i,h.line),g=Pt(p)==Pt(m),v=f(d.line,d.ch,g?p.text.length+1:null).end,y=f(h.line,g?0:null,h.ch).start
717
- g&&(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)}n.appendChild(o)}function wr(e){if(e.state.focused){var t=e.display
716
+ else{var p=$e(i,d.line),m=$e(i,h.line),g=Rt(p)==Rt(m),v=f(d.line,d.ch,g?p.text.length+1:null).end,y=f(h.line,g?0:null,h.ch).start
717
+ g&&(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)}n.appendChild(o)}function Cr(e){if(e.state.focused){var t=e.display
718
718
  clearInterval(t.blinker)
719
719
  var n=!0
720
- t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval((function(){return t.cursorDiv.style.visibility=(n=!n)?"":"hidden"}),e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function Cr(e){e.state.focused||(e.display.input.focus(),Sr(e))}function kr(e){e.state.delayingBlurEvent=!0,setTimeout((function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Lr(e))}),100)}function Sr(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,O(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()),wr(e))}function Lr(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 Tr(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var i=t.view[r],o=e.options.lineWrapping,s=void 0,u=0
720
+ t.cursorDiv.style.visibility="",e.options.cursorBlinkRate>0?t.blinker=setInterval((function(){return t.cursorDiv.style.visibility=(n=!n)?"":"hidden"}),e.options.cursorBlinkRate):e.options.cursorBlinkRate<0&&(t.cursorDiv.style.visibility="hidden")}}function kr(e){e.state.focused||(e.display.input.focus(),Lr(e))}function Sr(e){e.state.delayingBlurEvent=!0,setTimeout((function(){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1,Tr(e))}),100)}function Lr(e,t){e.state.delayingBlurEvent&&(e.state.delayingBlurEvent=!1),"nocursor"!=e.options.readOnly&&(e.state.focused||(me(e,"focus",e,t),e.state.focused=!0,O(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()),Cr(e))}function Tr(e,t){e.state.delayingBlurEvent||(e.state.focused&&(me(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 Mr(e){for(var t=e.display,n=t.lineDiv.offsetTop,r=0;r<t.view.length;r++){var i=t.view[r],o=e.options.lineWrapping,s=void 0,u=0
721
721
  if(!i.hidden){if(a&&l<8){var c=i.node.offsetTop+i.node.offsetHeight
722
722
  s=c-n,n=c}else{var f=i.node.getBoundingClientRect()
723
723
  s=f.bottom-f.top,!o&&i.text.firstChild&&(u=i.text.firstChild.getBoundingClientRect().right-f.left-1)}var d=i.line.height-s
724
- if((d>.005||d<-.005)&&(Ke(i.line,s),Mr(i.line),i.rest))for(var h=0;h<i.rest.length;h++)Mr(i.rest[h])
725
- if(u>e.display.sizerWidth){var p=Math.ceil(u/ir(e.display))
726
- p>e.display.maxLineLength&&(e.display.maxLineLength=p,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}}function Mr(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var n=e.widgets[t],r=n.node.parentNode
727
- r&&(n.height=r.offsetHeight)}}function Ar(e,t,n){var r=n&&null!=n.top?Math.max(0,n.top):e.scroller.scrollTop
728
- r=Math.floor(r-kn(e))
729
- var i=n&&null!=n.bottom?n.bottom:r+e.wrapper.clientHeight,o=Ze(t,r),a=Ze(t,i)
724
+ if((d>.005||d<-.005)&&(Ye(i.line,s),Ar(i.line),i.rest))for(var h=0;h<i.rest.length;h++)Ar(i.rest[h])
725
+ if(u>e.display.sizerWidth){var p=Math.ceil(u/or(e.display))
726
+ p>e.display.maxLineLength&&(e.display.maxLineLength=p,e.display.maxLine=i.line,e.display.maxLineChanged=!0)}}}}function Ar(e){if(e.widgets)for(var t=0;t<e.widgets.length;++t){var n=e.widgets[t],r=n.node.parentNode
727
+ r&&(n.height=r.offsetHeight)}}function Nr(e,t,n){var r=n&&null!=n.top?Math.max(0,n.top):e.scroller.scrollTop
728
+ r=Math.floor(r-Sn(e))
729
+ var i=n&&null!=n.bottom?n.bottom:r+e.wrapper.clientHeight,o=Qe(t,r),a=Qe(t,i)
730
730
  if(n&&n.ensure){var l=n.ensure.from.line,s=n.ensure.to.line
731
- l<o?(o=l,a=Ze(t,Ut(Ve(t,l))+e.wrapper.clientHeight)):Math.min(s,t.lastLine())>=a&&(o=Ze(t,Ut(Ve(t,s))-e.wrapper.clientHeight),a=s)}return{from:o,to:Math.max(a,o+1)}}function Nr(e,t){var n=e.display,r=rr(e.display)
731
+ l<o?(o=l,a=Qe(t,qt($e(t,l))+e.wrapper.clientHeight)):Math.min(s,t.lastLine())>=a&&(o=Qe(t,qt($e(t,s))-e.wrapper.clientHeight),a=s)}return{from:o,to:Math.max(a,o+1)}}function Er(e,t){var n=e.display,r=ir(e.display)
732
732
  t.top<0&&(t.top=0)
733
- var i=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:n.scroller.scrollTop,o=An(e),a={}
733
+ var i=e.curOp&&null!=e.curOp.scrollTop?e.curOp.scrollTop:n.scroller.scrollTop,o=Nn(e),a={}
734
734
  t.bottom-t.top>o&&(t.bottom=t.top+o)
735
- var l=e.doc.height+Sn(n),s=t.top<r,u=t.bottom>l-r
735
+ var l=e.doc.height+Ln(n),s=t.top<r,u=t.bottom>l-r
736
736
  if(t.top<i)a.scrollTop=s?0:t.top
737
737
  else if(t.bottom>i+o){var c=Math.min(t.top,(u?l:t.bottom)-o)
738
- c!=i&&(a.scrollTop=c)}var f=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:n.scroller.scrollLeft,d=Mn(e)-(e.options.fixedGutter?n.gutters.offsetWidth:0),h=t.right-t.left>d
739
- return h&&(t.right=t.left+d),t.left<10?a.scrollLeft=0:t.left<f?a.scrollLeft=Math.max(0,t.left-(h?0:10)):t.right>d+f-3&&(a.scrollLeft=t.right+(h?0:10)-d),a}function Er(e,t){null!=t&&(Or(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+t)}function Dr(e){Or(e)
738
+ c!=i&&(a.scrollTop=c)}var f=e.curOp&&null!=e.curOp.scrollLeft?e.curOp.scrollLeft:n.scroller.scrollLeft,d=An(e)-(e.options.fixedGutter?n.gutters.offsetWidth:0),h=t.right-t.left>d
739
+ return h&&(t.right=t.left+d),t.left<10?a.scrollLeft=0:t.left<f?a.scrollLeft=Math.max(0,t.left-(h?0:10)):t.right>d+f-3&&(a.scrollLeft=t.right+(h?0:10)-d),a}function Dr(e,t){null!=t&&(Ir(e),e.curOp.scrollTop=(null==e.curOp.scrollTop?e.doc.scrollTop:e.curOp.scrollTop)+t)}function Fr(e){Ir(e)
740
740
  var t=e.getCursor()
741
- e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Fr(e,t,n){null==t&&null==n||Or(e),null!=t&&(e.curOp.scrollLeft=t),null!=n&&(e.curOp.scrollTop=n)}function Or(e){var t=e.curOp.scrollToPos
742
- t&&(e.curOp.scrollToPos=null,Ir(e,Xn(e,t.from),Xn(e,t.to),t.margin))}function Ir(e,t,n,r){var i=Nr(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r})
743
- Fr(e,i.scrollLeft,i.scrollTop)}function Br(e,t){Math.abs(e.doc.scrollTop-t)<2||(n||si(e,{top:t}),Hr(e,t,!0),n&&si(e),ri(e,100))}function Hr(e,t,n){t=Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t),(e.display.scroller.scrollTop!=t||n)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function Wr(e,t,n,r){t=Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth),(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r||(e.doc.scrollLeft=t,fi(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function Pr(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+Sn(e.display))
744
- 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?n:0,docHeight:r,scrollHeight:r+Tn(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var Rr=function(e,t,n){this.cm=n
741
+ e.curOp.scrollToPos={from:t,to:t,margin:e.options.cursorScrollMargin}}function Or(e,t,n){null==t&&null==n||Ir(e),null!=t&&(e.curOp.scrollLeft=t),null!=n&&(e.curOp.scrollTop=n)}function Ir(e){var t=e.curOp.scrollToPos
742
+ t&&(e.curOp.scrollToPos=null,Br(e,Kn(e,t.from),Kn(e,t.to),t.margin))}function Br(e,t,n,r){var i=Er(e,{left:Math.min(t.left,n.left),top:Math.min(t.top,n.top)-r,right:Math.max(t.right,n.right),bottom:Math.max(t.bottom,n.bottom)+r})
743
+ Or(e,i.scrollLeft,i.scrollTop)}function Hr(e,t){Math.abs(e.doc.scrollTop-t)<2||(n||ui(e,{top:t}),Wr(e,t,!0),n&&ui(e),ii(e,100))}function Wr(e,t,n){t=Math.min(e.display.scroller.scrollHeight-e.display.scroller.clientHeight,t),(e.display.scroller.scrollTop!=t||n)&&(e.doc.scrollTop=t,e.display.scrollbars.setScrollTop(t),e.display.scroller.scrollTop!=t&&(e.display.scroller.scrollTop=t))}function Pr(e,t,n,r){t=Math.min(t,e.display.scroller.scrollWidth-e.display.scroller.clientWidth),(n?t==e.doc.scrollLeft:Math.abs(e.doc.scrollLeft-t)<2)&&!r||(e.doc.scrollLeft=t,di(e),e.display.scroller.scrollLeft!=t&&(e.display.scroller.scrollLeft=t),e.display.scrollbars.setScrollLeft(t))}function Rr(e){var t=e.display,n=t.gutters.offsetWidth,r=Math.round(e.doc.height+Ln(e.display))
744
+ 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?n:0,docHeight:r,scrollHeight:r+Mn(e)+t.barHeight,nativeBarWidth:t.nativeBarWidth,gutterWidth:n}}var zr=function(e,t,n){this.cm=n
745
745
  var r=this.vert=N("div",[N("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),i=this.horiz=N("div",[N("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar")
746
- r.tabIndex=i.tabIndex=-1,e(r),e(i),fe(r,"scroll",(function(){r.clientHeight&&t(r.scrollTop,"vertical")})),fe(i,"scroll",(function(){i.clientWidth&&t(i.scrollLeft,"horizontal")})),this.checkedZeroWidth=!1,a&&l<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")}
747
- Rr.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth
746
+ r.tabIndex=i.tabIndex=-1,e(r),e(i),de(r,"scroll",(function(){r.clientHeight&&t(r.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")}
747
+ zr.prototype.update=function(e){var t=e.scrollWidth>e.clientWidth+1,n=e.scrollHeight>e.clientHeight+1,r=e.nativeBarWidth
748
748
  if(n){this.vert.style.display="block",this.vert.style.bottom=t?r+"px":"0"
749
749
  var i=e.viewHeight-(t?r:0)
750
750
  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"
751
751
  if(t){this.horiz.style.display="block",this.horiz.style.right=n?r+"px":"0",this.horiz.style.left=e.barLeft+"px"
752
752
  var o=e.viewWidth-e.barLeft-(n?r:0)
753
753
  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"
754
- return!this.checkedZeroWidth&&e.clientHeight>0&&(0==r&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},Rr.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},Rr.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},Rr.prototype.zeroWidthHack=function(){var e=y&&!h?"12px":"18px"
755
- 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},Rr.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto",t.set(1e3,(function r(){var i=e.getBoundingClientRect();("vert"==n?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,r)}))},Rr.prototype.clear=function(){var e=this.horiz.parentNode
754
+ return!this.checkedZeroWidth&&e.clientHeight>0&&(0==r&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:n?r:0,bottom:t?r:0}},zr.prototype.setScrollLeft=function(e){this.horiz.scrollLeft!=e&&(this.horiz.scrollLeft=e),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},zr.prototype.setScrollTop=function(e){this.vert.scrollTop!=e&&(this.vert.scrollTop=e),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},zr.prototype.zeroWidthHack=function(){var e=y&&!h?"12px":"18px"
755
+ 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},zr.prototype.enableZeroWidthBar=function(e,t,n){e.style.pointerEvents="auto",t.set(1e3,(function r(){var i=e.getBoundingClientRect();("vert"==n?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,r)}))},zr.prototype.clear=function(){var e=this.horiz.parentNode
756
756
  e.removeChild(this.horiz),e.removeChild(this.vert)}
757
- var zr=function(){}
758
- function jr(e,t){t||(t=Pr(e))
757
+ var jr=function(){}
758
+ function _r(e,t){t||(t=Rr(e))
759
759
  var n=e.display.barWidth,r=e.display.barHeight
760
- _r(e,t)
761
- for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&Tr(e),_r(e,Pr(e)),n=e.display.barWidth,r=e.display.barHeight}function _r(e,t){var n=e.display,r=n.scrollbars.update(t)
762
- n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}zr.prototype.update=function(){return{bottom:0,right:0}},zr.prototype.setScrollLeft=function(){},zr.prototype.setScrollTop=function(){},zr.prototype.clear=function(){}
763
- var Ur={native:Rr,null:zr}
764
- function qr(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&T(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new Ur[e.options.scrollbarStyle]((function(t){e.display.wrapper.insertBefore(t,e.display.scrollbarFiller),fe(t,"mousedown",(function(){e.state.focused&&setTimeout((function(){return e.display.input.focus()}),0)})),t.setAttribute("cm-not-content","true")}),(function(t,n){"horizontal"==n?Wr(e,t):Br(e,t)}),e),e.display.scrollbars.addClass&&O(e.display.wrapper,e.display.scrollbars.addClass)}var Gr=0
765
- function Vr(e){var t
766
- 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:++Gr},t=e.curOp,an?an.ops.push(t):t.ownsGroup=an={ops:[t],delayedCallbacks:[]}}function $r(e){var t=e.curOp
760
+ Ur(e,t)
761
+ for(var i=0;i<4&&n!=e.display.barWidth||r!=e.display.barHeight;i++)n!=e.display.barWidth&&e.options.lineWrapping&&Mr(e),Ur(e,Rr(e)),n=e.display.barWidth,r=e.display.barHeight}function Ur(e,t){var n=e.display,r=n.scrollbars.update(t)
762
+ n.sizer.style.paddingRight=(n.barWidth=r.right)+"px",n.sizer.style.paddingBottom=(n.barHeight=r.bottom)+"px",n.heightForcer.style.borderBottom=r.bottom+"px solid transparent",r.right&&r.bottom?(n.scrollbarFiller.style.display="block",n.scrollbarFiller.style.height=r.bottom+"px",n.scrollbarFiller.style.width=r.right+"px"):n.scrollbarFiller.style.display="",r.bottom&&e.options.coverGutterNextToScrollbar&&e.options.fixedGutter?(n.gutterFiller.style.display="block",n.gutterFiller.style.height=r.bottom+"px",n.gutterFiller.style.width=t.gutterWidth+"px"):n.gutterFiller.style.display=""}jr.prototype.update=function(){return{bottom:0,right:0}},jr.prototype.setScrollLeft=function(){},jr.prototype.setScrollTop=function(){},jr.prototype.clear=function(){}
763
+ var qr={native:zr,null:jr}
764
+ function Gr(e){e.display.scrollbars&&(e.display.scrollbars.clear(),e.display.scrollbars.addClass&&T(e.display.wrapper,e.display.scrollbars.addClass)),e.display.scrollbars=new qr[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,n){"horizontal"==n?Pr(e,t):Hr(e,t)}),e),e.display.scrollbars.addClass&&O(e.display.wrapper,e.display.scrollbars.addClass)}var Vr=0
765
+ function $r(e){var t
766
+ 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:++Vr},t=e.curOp,ln?ln.ops.push(t):t.ownsGroup=ln={ops:[t],delayedCallbacks:[]}}function Xr(e){var t=e.curOp
767
767
  t&&function(e,t){var n=e.ownsGroup
768
768
  if(n)try{!function(e){var t=e.delayedCallbacks,n=0
769
769
  do{for(;n<t.length;n++)t[n].call(null)
770
770
  for(var r=0;r<e.ops.length;r++){var i=e.ops[r]
771
- if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(n<t.length)}(n)}finally{an=null,function(e){for(var t=0;t<e.ops.length;t++)e.ops[t].cm.curOp=null
772
- !function(e){for(var t=e.ops,n=0;n<t.length;n++)Xr(t[n])
773
- for(var r=0;r<t.length;r++)Kr(t[r])
774
- for(var i=0;i<t.length;i++)Yr(t[i])
775
- for(var o=0;o<t.length;o++)Zr(t[o])
776
- for(var a=0;a<t.length;a++)Qr(t[a])}(e)}(n)}}(t)}function Xr(e){var t=e.cm,n=t.display
771
+ if(i.cursorActivityHandlers)for(;i.cursorActivityCalled<i.cursorActivityHandlers.length;)i.cursorActivityHandlers[i.cursorActivityCalled++].call(null,i.cm)}}while(n<t.length)}(n)}finally{ln=null,function(e){for(var t=0;t<e.ops.length;t++)e.ops[t].cm.curOp=null
772
+ !function(e){for(var t=e.ops,n=0;n<t.length;n++)Kr(t[n])
773
+ for(var r=0;r<t.length;r++)Yr(t[r])
774
+ for(var i=0;i<t.length;i++)Zr(t[i])
775
+ for(var o=0;o<t.length;o++)Qr(t[o])
776
+ for(var a=0;a<t.length;a++)Jr(t[a])}(e)}(n)}}(t)}function Kr(e){var t=e.cm,n=t.display
777
777
  !function(e){var t=e.display
778
- !t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=Tn(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Tn(e)+"px",t.scrollbarsClipped=!0)}(t),e.updateMaxLine&&Gt(t),e.mustUpdate=e.viewChanged||e.forceUpdate||null!=e.scrollTop||e.scrollToPos&&(e.scrollToPos.from.line<n.viewFrom||e.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new oi(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Kr(e){e.updatedDisplay=e.mustUpdate&&ai(e.cm,e.update)}function Yr(e){var t=e.cm,n=t.display
779
- e.updatedDisplay&&Tr(t),e.barMeasure=Pr(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=En(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+Tn(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-Mn(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function Zr(e){var t=e.cm
780
- null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&Wr(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1)
778
+ !t.scrollbarsClipped&&t.scroller.offsetWidth&&(t.nativeBarWidth=t.scroller.offsetWidth-t.scroller.clientWidth,t.heightForcer.style.height=Mn(e)+"px",t.sizer.style.marginBottom=-t.nativeBarWidth+"px",t.sizer.style.borderRightWidth=Mn(e)+"px",t.scrollbarsClipped=!0)}(t),e.updateMaxLine&&Vt(t),e.mustUpdate=e.viewChanged||e.forceUpdate||null!=e.scrollTop||e.scrollToPos&&(e.scrollToPos.from.line<n.viewFrom||e.scrollToPos.to.line>=n.viewTo)||n.maxLineChanged&&t.options.lineWrapping,e.update=e.mustUpdate&&new ai(t,e.mustUpdate&&{top:e.scrollTop,ensure:e.scrollToPos},e.forceUpdate)}function Yr(e){e.updatedDisplay=e.mustUpdate&&li(e.cm,e.update)}function Zr(e){var t=e.cm,n=t.display
779
+ e.updatedDisplay&&Mr(t),e.barMeasure=Rr(t),n.maxLineChanged&&!t.options.lineWrapping&&(e.adjustWidthTo=Dn(t,n.maxLine,n.maxLine.text.length).left+3,t.display.sizerWidth=e.adjustWidthTo,e.barMeasure.scrollWidth=Math.max(n.scroller.clientWidth,n.sizer.offsetLeft+e.adjustWidthTo+Mn(t)+t.display.barWidth),e.maxScrollLeft=Math.max(0,n.sizer.offsetLeft+e.adjustWidthTo-An(t))),(e.updatedDisplay||e.selectionChanged)&&(e.preparedSelection=n.input.prepareSelection())}function Qr(e){var t=e.cm
780
+ null!=e.adjustWidthTo&&(t.display.sizer.style.minWidth=e.adjustWidthTo+"px",e.maxScrollLeft<t.doc.scrollLeft&&Pr(t,Math.min(t.display.scroller.scrollLeft,e.maxScrollLeft),!0),t.display.maxLineChanged=!1)
781
781
  var n=e.focus&&e.focus==F()
782
- e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&jr(t,e.barMeasure),e.updatedDisplay&&ci(t,e.barMeasure),e.selectionChanged&&wr(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&Cr(e.cm)}function Qr(e){var t=e.cm,n=t.display,r=t.doc
783
- if(e.updatedDisplay&&li(t,e.update),null==n.wheelStartX||null==e.scrollTop&&null==e.scrollLeft&&!e.scrollToPos||(n.wheelStartX=n.wheelStartY=null),null!=e.scrollTop&&Hr(t,e.scrollTop,e.forceScroll),null!=e.scrollLeft&&Wr(t,e.scrollLeft,!0,!0),e.scrollToPos){var i=function(e,t,n,r){var i
784
- null==r&&(r=0),e.options.lineWrapping||t!=n||(n="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)
785
- for(var o=0;o<5;o++){var a=!1,l=$n(e,t),s=n&&n!=t?$n(e,n):l,u=Nr(e,i={left:Math.min(l.left,s.left),top:Math.min(l.top,s.top)-r,right:Math.max(l.left,s.left),bottom:Math.max(l.bottom,s.bottom)+r}),c=e.doc.scrollTop,f=e.doc.scrollLeft
786
- if(null!=u.scrollTop&&(Br(e,u.scrollTop),Math.abs(e.doc.scrollTop-c)>1&&(a=!0)),null!=u.scrollLeft&&(Wr(e,u.scrollLeft),Math.abs(e.doc.scrollLeft-f)>1&&(a=!0)),!a)break}return i}(t,lt(r,e.scrollToPos.from),lt(r,e.scrollToPos.to),e.scrollToPos.margin)
787
- !function(e,t){if(!me(e,"scrollCursorIntoView")){var n=e.display,r=n.sizer.getBoundingClientRect(),i=null
788
- if(t.top+r.top<0?i=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i&&!p){var o=N("div","​",null,"position: absolute;\n top: "+(t.top-n.viewOffset-kn(e.display))+"px;\n height: "+(t.bottom-t.top+Tn(e)+n.barHeight)+"px;\n left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;")
782
+ e.preparedSelection&&t.display.input.showSelection(e.preparedSelection,n),(e.updatedDisplay||e.startHeight!=t.doc.height)&&_r(t,e.barMeasure),e.updatedDisplay&&fi(t,e.barMeasure),e.selectionChanged&&Cr(t),t.state.focused&&e.updateInput&&t.display.input.reset(e.typing),n&&kr(e.cm)}function Jr(e){var t=e.cm,n=t.display,r=t.doc
783
+ if(e.updatedDisplay&&si(t,e.update),null==n.wheelStartX||null==e.scrollTop&&null==e.scrollLeft&&!e.scrollToPos||(n.wheelStartX=n.wheelStartY=null),null!=e.scrollTop&&Wr(t,e.scrollTop,e.forceScroll),null!=e.scrollLeft&&Pr(t,e.scrollLeft,!0,!0),e.scrollToPos){var i=function(e,t,n,r){var i
784
+ null==r&&(r=0),e.options.lineWrapping||t!=n||(n="before"==(t=t.ch?tt(t.line,"before"==t.sticky?t.ch-1:t.ch,"after"):t).sticky?tt(t.line,t.ch+1,"before"):t)
785
+ for(var o=0;o<5;o++){var a=!1,l=Xn(e,t),s=n&&n!=t?Xn(e,n):l,u=Er(e,i={left:Math.min(l.left,s.left),top:Math.min(l.top,s.top)-r,right:Math.max(l.left,s.left),bottom:Math.max(l.bottom,s.bottom)+r}),c=e.doc.scrollTop,f=e.doc.scrollLeft
786
+ if(null!=u.scrollTop&&(Hr(e,u.scrollTop),Math.abs(e.doc.scrollTop-c)>1&&(a=!0)),null!=u.scrollLeft&&(Pr(e,u.scrollLeft),Math.abs(e.doc.scrollLeft-f)>1&&(a=!0)),!a)break}return i}(t,st(r,e.scrollToPos.from),st(r,e.scrollToPos.to),e.scrollToPos.margin)
787
+ !function(e,t){if(!ge(e,"scrollCursorIntoView")){var n=e.display,r=n.sizer.getBoundingClientRect(),i=null
788
+ if(t.top+r.top<0?i=!0:t.bottom+r.top>(window.innerHeight||document.documentElement.clientHeight)&&(i=!1),null!=i&&!p){var o=N("div","​",null,"position: absolute;\n top: "+(t.top-n.viewOffset-Sn(e.display))+"px;\n height: "+(t.bottom-t.top+Mn(e)+n.barHeight)+"px;\n left: "+t.left+"px; width: "+Math.max(2,t.right-t.left)+"px;")
789
789
  e.display.lineSpace.appendChild(o),o.scrollIntoView(i),e.display.lineSpace.removeChild(o)}}}(t,i)}var o=e.maybeHiddenMarkers,a=e.maybeUnhiddenMarkers
790
- if(o)for(var l=0;l<o.length;++l)o[l].lines.length||pe(o[l],"hide")
791
- if(a)for(var s=0;s<a.length;++s)a[s].lines.length&&pe(a[s],"unhide")
792
- n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&pe(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function Jr(e,t){if(e.curOp)return t()
793
- Vr(e)
794
- try{return t()}finally{$r(e)}}function ei(e,t){return function(){if(e.curOp)return t.apply(e,arguments)
795
- Vr(e)
796
- try{return t.apply(e,arguments)}finally{$r(e)}}}function ti(e){return function(){if(this.curOp)return e.apply(this,arguments)
797
- Vr(this)
798
- try{return e.apply(this,arguments)}finally{$r(this)}}}function ni(e){return function(){var t=this.cm
790
+ if(o)for(var l=0;l<o.length;++l)o[l].lines.length||me(o[l],"hide")
791
+ if(a)for(var s=0;s<a.length;++s)a[s].lines.length&&me(a[s],"unhide")
792
+ n.wrapper.offsetHeight&&(r.scrollTop=t.display.scroller.scrollTop),e.changeObjs&&me(t,"changes",t,e.changeObjs),e.update&&e.update.finish()}function ei(e,t){if(e.curOp)return t()
793
+ $r(e)
794
+ try{return t()}finally{Xr(e)}}function ti(e,t){return function(){if(e.curOp)return t.apply(e,arguments)
795
+ $r(e)
796
+ try{return t.apply(e,arguments)}finally{Xr(e)}}}function ni(e){return function(){if(this.curOp)return e.apply(this,arguments)
797
+ $r(this)
798
+ try{return e.apply(this,arguments)}finally{Xr(this)}}}function ri(e){return function(){var t=this.cm
799
799
  if(!t||t.curOp)return e.apply(this,arguments)
800
- Vr(t)
801
- try{return e.apply(this,arguments)}finally{$r(t)}}}function ri(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,H(ii,e))}function ii(e){var t=e.doc
802
- if(!(t.highlightFrontier>=e.display.viewTo)){var n=+new Date+e.options.workTime,r=ht(e,t.highlightFrontier),i=[]
803
- t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),(function(o){if(r.line>=e.display.viewFrom){var a=o.styles,l=o.text.length>e.options.maxHighlightLength?_e(t.mode,r.state):null,s=ft(e,o,r,!0)
800
+ $r(t)
801
+ try{return e.apply(this,arguments)}finally{Xr(t)}}}function ii(e,t){e.doc.highlightFrontier<e.display.viewTo&&e.state.highlight.set(t,H(oi,e))}function oi(e){var t=e.doc
802
+ if(!(t.highlightFrontier>=e.display.viewTo)){var n=+new Date+e.options.workTime,r=pt(e,t.highlightFrontier),i=[]
803
+ t.iter(r.line,Math.min(t.first+t.size,e.display.viewTo+500),(function(o){if(r.line>=e.display.viewFrom){var a=o.styles,l=o.text.length>e.options.maxHighlightLength?Ue(t.mode,r.state):null,s=dt(e,o,r,!0)
804
804
  l&&(r.state=l),o.styles=s.styles
805
805
  var u=o.styleClasses,c=s.classes
806
806
  c?o.styleClasses=c:u&&(o.styleClasses=null)
807
807
  for(var f=!a||a.length!=o.styles.length||u!=c&&(!u||!c||u.bgClass!=c.bgClass||u.textClass!=c.textClass),d=0;!f&&d<a.length;++d)f=a[d]!=o.styles[d]
808
- f&&i.push(r.line),o.stateAfter=r.save(),r.nextLine()}else o.text.length<=e.options.maxHighlightLength&&pt(e,o.text,r),o.stateAfter=r.line%5==0?r.save():null,r.nextLine()
809
- if(+new Date>n)return ri(e,e.options.workDelay),!0})),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&Jr(e,(function(){for(var t=0;t<i.length;t++)dr(e,i[t],"text")}))}}var oi=function(e,t,n){var r=e.display
810
- this.viewport=t,this.visible=Ar(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=Mn(e),this.force=n,this.dims=or(e),this.events=[]}
811
- function ai(e,t){var n=e.display,r=e.doc
812
- if(t.editorIsHidden)return hr(e),!1
813
- if(!t.force&&t.visible.from>=n.viewFrom&&t.visible.to<=n.viewTo&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&0==mr(e))return!1
814
- di(e)&&(hr(e),t.dims=or(e))
808
+ f&&i.push(r.line),o.stateAfter=r.save(),r.nextLine()}else o.text.length<=e.options.maxHighlightLength&&mt(e,o.text,r),o.stateAfter=r.line%5==0?r.save():null,r.nextLine()
809
+ if(+new Date>n)return ii(e,e.options.workDelay),!0})),t.highlightFrontier=r.line,t.modeFrontier=Math.max(t.modeFrontier,r.line),i.length&&ei(e,(function(){for(var t=0;t<i.length;t++)hr(e,i[t],"text")}))}}var ai=function(e,t,n){var r=e.display
810
+ this.viewport=t,this.visible=Nr(r,e.doc,t),this.editorIsHidden=!r.wrapper.offsetWidth,this.wrapperHeight=r.wrapper.clientHeight,this.wrapperWidth=r.wrapper.clientWidth,this.oldDisplayWidth=An(e),this.force=n,this.dims=ar(e),this.events=[]}
811
+ function li(e,t){var n=e.display,r=e.doc
812
+ if(t.editorIsHidden)return pr(e),!1
813
+ if(!t.force&&t.visible.from>=n.viewFrom&&t.visible.to<=n.viewTo&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo)&&n.renderedView==n.view&&0==gr(e))return!1
814
+ hi(e)&&(pr(e),t.dims=ar(e))
815
815
  var i=r.first+r.size,o=Math.max(t.visible.from-e.options.viewportMargin,r.first),a=Math.min(i,t.visible.to+e.options.viewportMargin)
816
- n.viewFrom<o&&o-n.viewFrom<20&&(o=Math.max(r.first,n.viewFrom)),n.viewTo>a&&n.viewTo-a<20&&(a=Math.min(i,n.viewTo)),Ct&&(o=Rt(e.doc,o),a=zt(e.doc,a))
816
+ n.viewFrom<o&&o-n.viewFrom<20&&(o=Math.max(r.first,n.viewFrom)),n.viewTo>a&&n.viewTo-a<20&&(a=Math.min(i,n.viewTo)),kt&&(o=zt(e.doc,o),a=jt(e.doc,a))
817
817
  var l=o!=n.viewFrom||a!=n.viewTo||n.lastWrapHeight!=t.wrapperHeight||n.lastWrapWidth!=t.wrapperWidth
818
818
  !function(e,t,n){var r=e.display
819
- 0==r.view.length||t>=r.viewTo||n<=r.viewFrom?(r.view=on(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=on(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(cr(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(on(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,cr(e,n)))),r.viewTo=n}(e,o,a),n.viewOffset=Ut(Ve(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px"
820
- var u=mr(e)
819
+ 0==r.view.length||t>=r.viewTo||n<=r.viewFrom?(r.view=an(e,t,n),r.viewFrom=t):(r.viewFrom>t?r.view=an(e,t,r.viewFrom).concat(r.view):r.viewFrom<t&&(r.view=r.view.slice(fr(e,t))),r.viewFrom=t,r.viewTo<n?r.view=r.view.concat(an(e,r.viewTo,n)):r.viewTo>n&&(r.view=r.view.slice(0,fr(e,n)))),r.viewTo=n}(e,o,a),n.viewOffset=qt($e(e.doc,n.viewFrom)),e.display.mover.style.top=n.viewOffset+"px"
820
+ var u=gr(e)
821
821
  if(!l&&0==u&&!t.force&&n.renderedView==n.view&&(null==n.updateLineNumbers||n.updateLineNumbers>=n.viewTo))return!1
822
822
  var c=function(e){if(e.hasFocus())return null
823
823
  var t=F()
@@ -830,272 +830,272 @@ function l(t){var n=t.nextSibling
830
830
  return s&&y&&e.display.currentWheelTarget==t?t.style.display="none":t.parentNode.removeChild(t),n}for(var u=r.view,c=r.viewFrom,f=0;f<u.length;f++){var d=u[f]
831
831
  if(d.hidden);else if(d.node&&d.node.parentNode==o){for(;a!=d.node;)a=l(a)
832
832
  var h=i&&null!=t&&t<=c&&d.lineNumber
833
- d.changes&&(z(d.changes,"gutter")>-1&&(h=!1),cn(e,d,c,n)),h&&(M(d.lineNumber),d.lineNumber.appendChild(document.createTextNode(Je(e.options,c)))),a=d.node.nextSibling}else{var p=vn(e,d,c,n)
833
+ d.changes&&(z(d.changes,"gutter")>-1&&(h=!1),fn(e,d,c,n)),h&&(M(d.lineNumber),d.lineNumber.appendChild(document.createTextNode(et(e.options,c)))),a=d.node.nextSibling}else{var p=yn(e,d,c,n)
834
834
  o.insertBefore(p,a)}c+=d.size}for(;a;)a=l(a)}(e,n.updateLineNumbers,t.dims),u>4&&(n.lineDiv.style.display=""),n.renderedView=n.view,function(e){if(e&&e.activeElt&&e.activeElt!=F()&&(e.activeElt.focus(),e.anchorNode&&D(document.body,e.anchorNode)&&D(document.body,e.focusNode))){var t=window.getSelection(),n=document.createRange()
835
- n.setEnd(e.anchorNode,e.anchorOffset),n.collapse(!1),t.removeAllRanges(),t.addRange(n),t.extend(e.focusNode,e.focusOffset)}}(c),M(n.cursorDiv),M(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,l&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,ri(e,400)),n.updateLineNumbers=null,!0}function li(e,t){for(var n=t.viewport,r=!0;(r&&e.options.lineWrapping&&t.oldDisplayWidth!=Mn(e)||(n&&null!=n.top&&(n={top:Math.min(e.doc.height+Sn(e.display)-An(e),n.top)}),t.visible=Ar(e.display,e.doc,n),!(t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)))&&ai(e,t);r=!1){Tr(e)
836
- var i=Pr(e)
837
- gr(e),jr(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 n=new oi(e,t)
838
- if(ai(e,n)){Tr(e),li(e,n)
839
- var r=Pr(e)
840
- gr(e),jr(e,r),ci(e,r),n.finish()}}function ui(e){var t=e.gutters.offsetWidth
841
- 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+Tn(e)+"px"}function fi(e){var t=e.display,n=t.view
842
- if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var r=ar(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=r+"px",a=0;a<n.length;a++)if(!n[a].hidden){e.options.fixedGutter&&(n[a].gutter&&(n[a].gutter.style.left=o),n[a].gutterBackground&&(n[a].gutterBackground.style.left=o))
835
+ n.setEnd(e.anchorNode,e.anchorOffset),n.collapse(!1),t.removeAllRanges(),t.addRange(n),t.extend(e.focusNode,e.focusOffset)}}(c),M(n.cursorDiv),M(n.selectionDiv),n.gutters.style.height=n.sizer.style.minHeight=0,l&&(n.lastWrapHeight=t.wrapperHeight,n.lastWrapWidth=t.wrapperWidth,ii(e,400)),n.updateLineNumbers=null,!0}function si(e,t){for(var n=t.viewport,r=!0;(r&&e.options.lineWrapping&&t.oldDisplayWidth!=An(e)||(n&&null!=n.top&&(n={top:Math.min(e.doc.height+Ln(e.display)-Nn(e),n.top)}),t.visible=Nr(e.display,e.doc,n),!(t.visible.from>=e.display.viewFrom&&t.visible.to<=e.display.viewTo)))&&li(e,t);r=!1){Mr(e)
836
+ var i=Rr(e)
837
+ vr(e),_r(e,i),fi(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 ui(e,t){var n=new ai(e,t)
838
+ if(li(e,n)){Mr(e),si(e,n)
839
+ var r=Rr(e)
840
+ vr(e),_r(e,r),fi(e,r),n.finish()}}function ci(e){var t=e.gutters.offsetWidth
841
+ e.sizer.style.marginLeft=t+"px"}function fi(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+Mn(e)+"px"}function di(e){var t=e.display,n=t.view
842
+ if(t.alignWidgets||t.gutters.firstChild&&e.options.fixedGutter){for(var r=lr(t)-t.scroller.scrollLeft+e.doc.scrollLeft,i=t.gutters.offsetWidth,o=r+"px",a=0;a<n.length;a++)if(!n[a].hidden){e.options.fixedGutter&&(n[a].gutter&&(n[a].gutter.style.left=o),n[a].gutterBackground&&(n[a].gutterBackground.style.left=o))
843
843
  var l=n[a].alignable
844
- if(l)for(var s=0;s<l.length;s++)l[s].style.left=o}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}}function di(e){if(!e.options.lineNumbers)return!1
845
- var t=e.doc,n=Je(e.options,t.first+t.size-1),r=e.display
844
+ if(l)for(var s=0;s<l.length;s++)l[s].style.left=o}e.options.fixedGutter&&(t.gutters.style.left=r+i+"px")}}function hi(e){if(!e.options.lineNumbers)return!1
845
+ var t=e.doc,n=et(e.options,t.first+t.size-1),r=e.display
846
846
  if(n.length!=r.lineNumChars){var i=r.measure.appendChild(N("div",[N("div",n)],"CodeMirror-linenumber CodeMirror-gutter-elt")),o=i.firstChild.offsetWidth,a=i.offsetWidth-o
847
- return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(o,r.lineGutter.offsetWidth-a)+1,r.lineNumWidth=r.lineNumInnerWidth+a,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",ui(e.display),!0}return!1}function hi(e,t){for(var n=[],r=!1,i=0;i<e.length;i++){var o=e[i],a=null
847
+ return r.lineGutter.style.width="",r.lineNumInnerWidth=Math.max(o,r.lineGutter.offsetWidth-a)+1,r.lineNumWidth=r.lineNumInnerWidth+a,r.lineNumChars=r.lineNumInnerWidth?n.length:-1,r.lineGutter.style.width=r.lineNumWidth+"px",ci(e.display),!0}return!1}function pi(e,t){for(var n=[],r=!1,i=0;i<e.length;i++){var o=e[i],a=null
848
848
  if("string"!=typeof o&&(a=o.style,o=o.className),"CodeMirror-linenumbers"==o){if(!t)continue
849
- r=!0}n.push({className:o,style:a})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function pi(e){var t=e.gutters,n=e.gutterSpecs
849
+ r=!0}n.push({className:o,style:a})}return t&&!r&&n.push({className:"CodeMirror-linenumbers",style:null}),n}function mi(e){var t=e.gutters,n=e.gutterSpecs
850
850
  M(t),e.lineGutter=null
851
851
  for(var r=0;r<n.length;++r){var i=n[r],o=i.className,a=i.style,l=t.appendChild(N("div",null,"CodeMirror-gutter "+o))
852
- a&&(l.style.cssText=a),"CodeMirror-linenumbers"==o&&(e.lineGutter=l,l.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",ui(e)}function mi(e){pi(e.display),fr(e),fi(e)}function gi(e,t,r,i){var o=this
852
+ a&&(l.style.cssText=a),"CodeMirror-linenumbers"==o&&(e.lineGutter=l,l.style.width=(e.lineNumWidth||1)+"px")}t.style.display=n.length?"":"none",ci(e)}function gi(e){mi(e.display),dr(e),di(e)}function vi(e,t,r,i){var o=this
853
853
  this.input=r,o.scrollbarFiller=N("div",null,"CodeMirror-scrollbar-filler"),o.scrollbarFiller.setAttribute("cm-not-content","true"),o.gutterFiller=N("div",null,"CodeMirror-gutter-filler"),o.gutterFiller.setAttribute("cm-not-content","true"),o.lineDiv=E("div",null,"CodeMirror-code"),o.selectionDiv=N("div",null,null,"position: relative; z-index: 1"),o.cursorDiv=N("div",null,"CodeMirror-cursors"),o.measure=N("div",null,"CodeMirror-measure"),o.lineMeasure=N("div",null,"CodeMirror-measure"),o.lineSpace=E("div",[o.measure,o.lineMeasure,o.selectionDiv,o.cursorDiv,o.lineDiv],null,"position: relative; outline: none")
854
854
  var u=E("div",[o.lineSpace],"CodeMirror-lines")
855
- o.mover=N("div",[u],null,"position: relative"),o.sizer=N("div",[o.mover],"CodeMirror-sizer"),o.sizerWidth=null,o.heightForcer=N("div",null,null,"position: absolute; height: 30px; width: 1px;"),o.gutters=N("div",null,"CodeMirror-gutters"),o.lineGutter=null,o.scroller=N("div",[o.sizer,o.heightForcer,o.gutters],"CodeMirror-scroll"),o.scroller.setAttribute("tabIndex","-1"),o.wrapper=N("div",[o.scrollbarFiller,o.gutterFiller,o.scroller],"CodeMirror"),a&&l<8&&(o.gutters.style.zIndex=-1,o.scroller.style.paddingRight=0),s||n&&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),r.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])}
856
- var vi=0,yi=null
857
- function xi(e){var t=e.wheelDeltaX,n=e.wheelDeltaY
858
- return null==t&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),null==n&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:null==n&&(n=e.wheelDelta),{x:t,y:n}}function bi(e){var t=xi(e)
859
- return t.x*=yi,t.y*=yi,t}function wi(e,t){var r=xi(t),i=r.x,o=r.y,a=e.display,l=a.scroller,u=l.scrollWidth>l.clientWidth,c=l.scrollHeight>l.clientHeight
855
+ o.mover=N("div",[u],null,"position: relative"),o.sizer=N("div",[o.mover],"CodeMirror-sizer"),o.sizerWidth=null,o.heightForcer=N("div",null,null,"position: absolute; height: "+j+"px; width: 1px;"),o.gutters=N("div",null,"CodeMirror-gutters"),o.lineGutter=null,o.scroller=N("div",[o.sizer,o.heightForcer,o.gutters],"CodeMirror-scroll"),o.scroller.setAttribute("tabIndex","-1"),o.wrapper=N("div",[o.scrollbarFiller,o.gutterFiller,o.scroller],"CodeMirror"),a&&l<8&&(o.gutters.style.zIndex=-1,o.scroller.style.paddingRight=0),s||n&&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=pi(i.gutters,i.lineNumbers),mi(o),r.init(o)}ai.prototype.signal=function(e,t){ye(e,t)&&this.events.push(arguments)},ai.prototype.finish=function(){for(var e=0;e<this.events.length;e++)me.apply(null,this.events[e])}
856
+ var yi=0,xi=null
857
+ function bi(e){var t=e.wheelDeltaX,n=e.wheelDeltaY
858
+ return null==t&&e.detail&&e.axis==e.HORIZONTAL_AXIS&&(t=e.detail),null==n&&e.detail&&e.axis==e.VERTICAL_AXIS?n=e.detail:null==n&&(n=e.wheelDelta),{x:t,y:n}}function wi(e){var t=bi(e)
859
+ return t.x*=xi,t.y*=xi,t}function Ci(e,t){var r=bi(t),i=r.x,o=r.y,a=e.display,l=a.scroller,u=l.scrollWidth>l.clientWidth,c=l.scrollHeight>l.clientHeight
860
860
  if(i&&u||o&&c){if(o&&y&&s)e:for(var d=t.target,h=a.view;d!=l;d=d.parentNode)for(var p=0;p<h.length;p++)if(h[p].node==d){e.display.currentWheelTarget=d
861
- break e}if(i&&!n&&!f&&null!=yi)return o&&c&&Br(e,Math.max(0,l.scrollTop+o*yi)),Wr(e,Math.max(0,l.scrollLeft+i*yi)),(!o||o&&c)&&xe(t),void(a.wheelStartX=null)
862
- if(o&&null!=yi){var m=o*yi,g=e.doc.scrollTop,v=g+a.wrapper.clientHeight
863
- m<0?g=Math.max(0,g+m-50):v=Math.min(e.doc.height,v+m+50),si(e,{top:g,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,n=t&&a.wheelDY&&t/a.wheelDY||e&&a.wheelDX&&e/a.wheelDX
864
- a.wheelStartX=a.wheelStartY=null,n&&(yi=(yi*vi+n)/(vi+1),++vi)}}),200)):(a.wheelDX+=i,a.wheelDY+=o))}}a?yi=-.53:n?yi=15:c?yi=-.7:d&&(yi=-1/3)
865
- var Ci=function(e,t){this.ranges=e,this.primIndex=t}
866
- Ci.prototype.primary=function(){return this.ranges[this.primIndex]},Ci.prototype.equals=function(e){if(e==this)return!0
861
+ break e}if(i&&!n&&!f&&null!=xi)return o&&c&&Hr(e,Math.max(0,l.scrollTop+o*xi)),Pr(e,Math.max(0,l.scrollLeft+i*xi)),(!o||o&&c)&&be(t),void(a.wheelStartX=null)
862
+ if(o&&null!=xi){var m=o*xi,g=e.doc.scrollTop,v=g+a.wrapper.clientHeight
863
+ m<0?g=Math.max(0,g+m-50):v=Math.min(e.doc.height,v+m+50),ui(e,{top:g,bottom:v})}yi<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,n=t&&a.wheelDY&&t/a.wheelDY||e&&a.wheelDX&&e/a.wheelDX
864
+ a.wheelStartX=a.wheelStartY=null,n&&(xi=(xi*yi+n)/(yi+1),++yi)}}),200)):(a.wheelDX+=i,a.wheelDY+=o))}}a?xi=-.53:n?xi=15:c?xi=-.7:d&&(xi=-1/3)
865
+ var ki=function(e,t){this.ranges=e,this.primIndex=t}
866
+ ki.prototype.primary=function(){return this.ranges[this.primIndex]},ki.prototype.equals=function(e){if(e==this)return!0
867
867
  if(e.primIndex!=this.primIndex||e.ranges.length!=this.ranges.length)return!1
868
868
  for(var t=0;t<this.ranges.length;t++){var n=this.ranges[t],r=e.ranges[t]
869
- if(!nt(n.anchor,r.anchor)||!nt(n.head,r.head))return!1}return!0},Ci.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new ki(rt(this.ranges[t].anchor),rt(this.ranges[t].head))
870
- return new Ci(e,this.primIndex)},Ci.prototype.somethingSelected=function(){for(var e=0;e<this.ranges.length;e++)if(!this.ranges[e].empty())return!0
871
- return!1},Ci.prototype.contains=function(e,t){t||(t=e)
869
+ if(!rt(n.anchor,r.anchor)||!rt(n.head,r.head))return!1}return!0},ki.prototype.deepCopy=function(){for(var e=[],t=0;t<this.ranges.length;t++)e[t]=new Si(it(this.ranges[t].anchor),it(this.ranges[t].head))
870
+ 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
871
+ return!1},ki.prototype.contains=function(e,t){t||(t=e)
872
872
  for(var n=0;n<this.ranges.length;n++){var r=this.ranges[n]
873
- if(tt(t,r.from())>=0&&tt(e,r.to())<=0)return n}return-1}
874
- var ki=function(e,t){this.anchor=e,this.head=t}
875
- function Si(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n]
876
- t.sort((function(e,t){return tt(e.from(),t.from())})),n=z(t,i)
877
- for(var o=1;o<t.length;o++){var a=t[o],l=t[o-1],s=tt(l.to(),a.from())
878
- if(r&&!a.empty()?s>0:s>=0){var u=ot(l.from(),a.from()),c=it(l.to(),a.to()),f=l.empty()?a.from()==a.head:l.from()==l.head
879
- o<=n&&--n,t.splice(--o,2,new ki(f?c:u,f?u:c))}}return new Ci(t,n)}function Li(e,t){return new Ci([new ki(e,t||e)],0)}function Ti(e){return e.text?et(e.from.line+e.text.length-1,X(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
880
- if(tt(e,t.to)<=0)return Ti(t)
873
+ if(nt(t,r.from())>=0&&nt(e,r.to())<=0)return n}return-1}
874
+ var Si=function(e,t){this.anchor=e,this.head=t}
875
+ function Li(e,t,n){var r=e&&e.options.selectionsMayTouch,i=t[n]
876
+ t.sort((function(e,t){return nt(e.from(),t.from())})),n=z(t,i)
877
+ for(var o=1;o<t.length;o++){var a=t[o],l=t[o-1],s=nt(l.to(),a.from())
878
+ if(r&&!a.empty()?s>0:s>=0){var u=at(l.from(),a.from()),c=ot(l.to(),a.to()),f=l.empty()?a.from()==a.head:l.from()==l.head
879
+ o<=n&&--n,t.splice(--o,2,new Si(f?c:u,f?u:c))}}return new ki(t,n)}function Ti(e,t){return new ki([new Si(e,t||e)],0)}function Mi(e){return e.text?tt(e.from.line+e.text.length-1,K(e.text).length+(1==e.text.length?e.from.ch:0)):e.to}function Ai(e,t){if(nt(e,t.from)<0)return e
880
+ if(nt(e,t.to)<=0)return Mi(t)
881
881
  var n=e.line+t.text.length-(t.to.line-t.from.line)-1,r=e.ch
882
- return e.line==t.to.line&&(r+=Ti(t).ch-t.to.ch),et(n,r)}function Ai(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r]
883
- n.push(new ki(Mi(i.anchor,t),Mi(i.head,t)))}return Si(e.cm,n,e.sel.primIndex)}function Ni(e,t,n){return e.line==t.line?et(n.line,e.ch-t.ch+n.ch):et(n.line+(e.line-t.line),e.ch)}function Ei(e){e.doc.mode=Re(e.options,e.doc.modeOption),Di(e)}function Di(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,ri(e,100),e.state.modeGen++,e.curOp&&fr(e)}function Fi(e,t){return 0==t.from.ch&&0==t.to.ch&&""==X(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Oi(e,t,n,r){function i(e){return n?n[e]:null}function o(e,n,i){!function(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),null!=e.order&&(e.order=null),At(e),Nt(e,n)
882
+ return e.line==t.to.line&&(r+=Mi(t).ch-t.to.ch),tt(n,r)}function Ni(e,t){for(var n=[],r=0;r<e.sel.ranges.length;r++){var i=e.sel.ranges[r]
883
+ n.push(new Si(Ai(i.anchor,t),Ai(i.head,t)))}return Li(e.cm,n,e.sel.primIndex)}function Ei(e,t,n){return e.line==t.line?tt(n.line,e.ch-t.ch+n.ch):tt(n.line+(e.line-t.line),e.ch)}function Di(e){e.doc.mode=ze(e.options,e.doc.modeOption),Fi(e)}function Fi(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,ii(e,100),e.state.modeGen++,e.curOp&&dr(e)}function Oi(e,t){return 0==t.from.ch&&0==t.to.ch&&""==K(t.text)&&(!e.cm||e.cm.options.wholeLineUpdateBefore)}function Ii(e,t,n,r){function i(e){return n?n[e]:null}function o(e,n,i){!function(e,t,n,r){e.text=t,e.stateAfter&&(e.stateAfter=null),e.styles&&(e.styles=null),null!=e.order&&(e.order=null),Nt(e),Et(e,n)
884
884
  var i=r?r(e):1
885
- i!=e.height&&Ke(e,i)}(e,n,i,r),sn(e,"change",e,t)}function a(e,t){for(var n=[],o=e;o<t;++o)n.push(new Vt(u[o],i(o),r))
886
- return n}var l=t.from,s=t.to,u=t.text,c=Ve(e,l.line),f=Ve(e,s.line),d=X(u),h=i(u.length-1),p=s.line-l.line
885
+ i!=e.height&&Ye(e,i)}(e,n,i,r),un(e,"change",e,t)}function a(e,t){for(var n=[],o=e;o<t;++o)n.push(new $t(u[o],i(o),r))
886
+ return n}var l=t.from,s=t.to,u=t.text,c=$e(e,l.line),f=$e(e,s.line),d=K(u),h=i(u.length-1),p=s.line-l.line
887
887
  if(t.full)e.insert(0,a(0,u.length)),e.remove(u.length,e.size-u.length)
888
- else if(Fi(e,t)){var m=a(0,u.length-1)
888
+ else if(Oi(e,t)){var m=a(0,u.length-1)
889
889
  o(f,f.text,h),p&&e.remove(l.line,p),m.length&&e.insert(l.line,m)}else if(c==f)if(1==u.length)o(c,c.text.slice(0,l.ch)+d+c.text.slice(s.ch),h)
890
890
  else{var g=a(1,u.length-1)
891
- g.push(new Vt(d+c.text.slice(s.ch),h,r)),o(c,c.text.slice(0,l.ch)+u[0],i(0)),e.insert(l.line+1,g)}else if(1==u.length)o(c,c.text.slice(0,l.ch)+u[0]+f.text.slice(s.ch),i(0)),e.remove(l.line+1,p)
891
+ g.push(new $t(d+c.text.slice(s.ch),h,r)),o(c,c.text.slice(0,l.ch)+u[0],i(0)),e.insert(l.line+1,g)}else if(1==u.length)o(c,c.text.slice(0,l.ch)+u[0]+f.text.slice(s.ch),i(0)),e.remove(l.line+1,p)
892
892
  else{o(c,c.text.slice(0,l.ch)+u[0],i(0)),o(f,d+f.text.slice(s.ch),h)
893
893
  var v=a(1,u.length-1)
894
- p>1&&e.remove(l.line+1,p-1),e.insert(l.line+1,v)}sn(e,"change",e,t)}function Ii(e,t,n){!function e(r,i,o){if(r.linked)for(var a=0;a<r.linked.length;++a){var l=r.linked[a]
894
+ p>1&&e.remove(l.line+1,p-1),e.insert(l.line+1,v)}un(e,"change",e,t)}function Bi(e,t,n){!function e(r,i,o){if(r.linked)for(var a=0;a<r.linked.length;++a){var l=r.linked[a]
895
895
  if(l.doc!=i){var s=o&&l.sharedHist
896
- n&&!s||(t(l.doc,s),e(l.doc,r,s))}}}(e,null,!0)}function Bi(e,t){if(t.cm)throw new Error("This document is already in use.")
897
- e.doc=t,t.cm=e,sr(e),Ei(e),Hi(e),e.options.lineWrapping||Gt(e),e.options.mode=t.modeOption,fr(e)}function Hi(e){("rtl"==e.doc.direction?O:T)(e.display.lineDiv,"CodeMirror-rtl")}function Wi(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 Pi(e,t){var n={from:rt(t.from),to:Ti(t),text:$e(e,t.from,t.to)}
898
- return _i(e,n,t.from.line,t.to.line+1),Ii(e,(function(e){return _i(e,n,t.from.line,t.to.line+1)}),!0),n}function Ri(e){for(;e.length&&X(e).ranges;)e.pop()}function zi(e,t,n,r){var i=e.history
896
+ n&&!s||(t(l.doc,s),e(l.doc,r,s))}}}(e,null,!0)}function Hi(e,t){if(t.cm)throw new Error("This document is already in use.")
897
+ e.doc=t,t.cm=e,ur(e),Di(e),Wi(e),e.options.lineWrapping||Vt(e),e.options.mode=t.modeOption,dr(e)}function Wi(e){("rtl"==e.doc.direction?O:T)(e.display.lineDiv,"CodeMirror-rtl")}function Pi(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 Ri(e,t){var n={from:it(t.from),to:Mi(t),text:Xe(e,t.from,t.to)}
898
+ return Ui(e,n,t.from.line,t.to.line+1),Bi(e,(function(e){return Ui(e,n,t.from.line,t.to.line+1)}),!0),n}function zi(e){for(;e.length&&K(e).ranges;)e.pop()}function ji(e,t,n,r){var i=e.history
899
899
  i.undone.length=0
900
900
  var o,a,l=+new Date
901
- if((i.lastOp==r||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),X(e.done)):e.done.length&&!X(e.done).ranges?X(e.done):e.done.length>1&&!e.done[e.done.length-2].ranges?(e.done.pop(),X(e.done)):void 0}(i,i.lastOp==r)))a=X(o.changes),0==tt(t.from,t.to)&&0==tt(t.from,a.to)?a.to=Ti(t):o.changes.push(Pi(e,t))
902
- else{var s=X(i.done)
903
- for(s&&s.ranges||ji(e.sel,i.done),o={changes:[Pi(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(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=l,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,a||pe(e,"historyAdded")}function ji(e,t){var n=X(t)
904
- n&&n.ranges&&n.equals(e)||t.push(e)}function _i(e,t,n,r){var i=t["spans_"+e.id],o=0
905
- e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),(function(n){n.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=n.markedSpans),++o}))}function Ui(e){if(!e)return null
901
+ if((i.lastOp==r||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?(zi(e.done),K(e.done)):e.done.length&&!K(e.done).ranges?K(e.done):e.done.length>1&&!e.done[e.done.length-2].ranges?(e.done.pop(),K(e.done)):void 0}(i,i.lastOp==r)))a=K(o.changes),0==nt(t.from,t.to)&&0==nt(t.from,a.to)?a.to=Mi(t):o.changes.push(Ri(e,t))
902
+ else{var s=K(i.done)
903
+ for(s&&s.ranges||_i(e.sel,i.done),o={changes:[Ri(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(n),i.generation=++i.maxGeneration,i.lastModTime=i.lastSelTime=l,i.lastOp=i.lastSelOp=r,i.lastOrigin=i.lastSelOrigin=t.origin,a||me(e,"historyAdded")}function _i(e,t){var n=K(t)
904
+ n&&n.ranges&&n.equals(e)||t.push(e)}function Ui(e,t,n,r){var i=t["spans_"+e.id],o=0
905
+ e.iter(Math.max(e.first,n),Math.min(e.first+e.size,r),(function(n){n.markedSpans&&((i||(i=t["spans_"+e.id]={}))[o]=n.markedSpans),++o}))}function qi(e){if(!e)return null
906
906
  for(var t,n=0;n<e.length;++n)e[n].marker.explicitlyCleared?t||(t=e.slice(0,n)):t&&t.push(e[n])
907
- return t?t.length?t:null:e}function qi(e,t){var n=function(e,t){var n=t["spans_"+e.id]
907
+ return t?t.length?t:null:e}function Gi(e,t){var n=function(e,t){var n=t["spans_"+e.id]
908
908
  if(!n)return null
909
- for(var r=[],i=0;i<t.text.length;++i)r.push(Ui(n[i]))
910
- return r}(e,t),r=Tt(e,t)
909
+ for(var r=[],i=0;i<t.text.length;++i)r.push(qi(n[i]))
910
+ return r}(e,t),r=Mt(e,t)
911
911
  if(!n)return r
912
912
  if(!r)return n
913
913
  for(var i=0;i<n.length;++i){var o=n[i],a=r[i]
914
914
  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
915
- o.push(s)}else a&&(n[i]=a)}return n}function Gi(e,t,n){for(var r=[],i=0;i<e.length;++i){var o=e[i]
916
- if(o.ranges)r.push(n?Ci.prototype.deepCopy.call(o):o)
915
+ o.push(s)}else a&&(n[i]=a)}return n}function Vi(e,t,n){for(var r=[],i=0;i<e.length;++i){var o=e[i]
916
+ if(o.ranges)r.push(n?ki.prototype.deepCopy.call(o):o)
917
917
  else{var a=o.changes,l=[]
918
918
  r.push({changes:l})
919
919
  for(var s=0;s<a.length;++s){var u=a[s],c=void 0
920
- if(l.push({from:u.from,to:u.to,text:u.text}),t)for(var f in u)(c=f.match(/^spans_(\d+)$/))&&z(t,Number(c[1]))>-1&&(X(l)[f]=u[f],delete u[f])}}}return r}function Vi(e,t,n,r){if(r){var i=e.anchor
921
- if(n){var o=tt(t,i)<0
922
- o!=tt(n,i)<0?(i=t,t=n):o!=tt(t,n)<0&&(t=n)}return new ki(i,t)}return new ki(n||t,t)}function $i(e,t,n,r,i){null==i&&(i=e.cm&&(e.cm.display.shift||e.extend)),Qi(e,new Ci([Vi(e.sel.primary(),t,n,i)],0),r)}function Xi(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),o=0;o<e.sel.ranges.length;o++)r[o]=Vi(e.sel.ranges[o],t[o],null,i)
923
- Qi(e,Si(e.cm,r,e.sel.primIndex),n)}function Ki(e,t,n,r){var i=e.sel.ranges.slice(0)
924
- i[t]=n,Qi(e,Si(e.cm,i,e.sel.primIndex),r)}function Yi(e,t,n,r){Qi(e,Li(t,n),r)}function Zi(e,t,n){var r=e.history.done,i=X(r)
925
- i&&i.ranges?(r[r.length-1]=t,Ji(e,t,n)):Qi(e,t,n)}function Qi(e,t,n){Ji(e,t,n),function(e,t,n,r){var i=e.history,o=r&&r.origin
920
+ if(l.push({from:u.from,to:u.to,text:u.text}),t)for(var f in u)(c=f.match(/^spans_(\d+)$/))&&z(t,Number(c[1]))>-1&&(K(l)[f]=u[f],delete u[f])}}}return r}function $i(e,t,n,r){if(r){var i=e.anchor
921
+ if(n){var o=nt(t,i)<0
922
+ o!=nt(n,i)<0?(i=t,t=n):o!=nt(t,n)<0&&(t=n)}return new Si(i,t)}return new Si(n||t,t)}function Xi(e,t,n,r,i){null==i&&(i=e.cm&&(e.cm.display.shift||e.extend)),Ji(e,new ki([$i(e.sel.primary(),t,n,i)],0),r)}function Ki(e,t,n){for(var r=[],i=e.cm&&(e.cm.display.shift||e.extend),o=0;o<e.sel.ranges.length;o++)r[o]=$i(e.sel.ranges[o],t[o],null,i)
923
+ Ji(e,Li(e.cm,r,e.sel.primIndex),n)}function Yi(e,t,n,r){var i=e.sel.ranges.slice(0)
924
+ i[t]=n,Ji(e,Li(e.cm,i,e.sel.primIndex),r)}function Zi(e,t,n,r){Ji(e,Ti(t,n),r)}function Qi(e,t,n){var r=e.history.done,i=K(r)
925
+ i&&i.ranges?(r[r.length-1]=t,eo(e,t,n)):Ji(e,t,n)}function Ji(e,t,n){eo(e,t,n),function(e,t,n,r){var i=e.history,o=r&&r.origin
926
926
  n==i.lastSelOp||o&&i.lastSelOrigin==o&&(i.lastModTime==i.lastSelTime&&i.lastOrigin==o||function(e,t,n,r){var i=t.charAt(0)
927
- return"*"==i||"+"==i&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}(e,o,X(i.done),t))?i.done[i.done.length-1]=t:ji(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=n,r&&!1!==r.clearRedo&&Ri(i.undone)}(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function Ji(e,t,n){(ve(e,"beforeSelectionChange")||e.cm&&ve(e.cm,"beforeSelectionChange"))&&(t=function(e,t,n){var r={ranges:t.ranges,update:function(t){this.ranges=[]
928
- for(var n=0;n<t.length;n++)this.ranges[n]=new ki(lt(e,t[n].anchor),lt(e,t[n].head))},origin:n&&n.origin}
929
- return pe(e,"beforeSelectionChange",e,r),e.cm&&pe(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?Si(e.cm,r.ranges,r.ranges.length-1):t}(e,t,n))
930
- var r=n&&n.bias||(tt(t.primary().head,e.sel.primary().head)<0?-1:1)
931
- eo(e,no(e,t,r,!0)),n&&!1===n.scroll||!e.cm||Dr(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,ge(e.cm)),sn(e,"cursorActivity",e))}function to(e){eo(e,no(e,e.sel,null,!1))}function no(e,t,n,r){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,n,r),u=io(e,a.head,l&&l.head,n,r);(i||s!=a.anchor||u!=a.head)&&(i||(i=t.ranges.slice(0,o)),i[o]=new ki(s,u))}return i?Si(e.cm,i,t.primIndex):t}function ro(e,t,n,r,i){var o=Ve(e,t.line)
927
+ return"*"==i||"+"==i&&n.ranges.length==r.ranges.length&&n.somethingSelected()==r.somethingSelected()&&new Date-e.history.lastSelTime<=(e.cm?e.cm.options.historyEventDelay:500)}(e,o,K(i.done),t))?i.done[i.done.length-1]=t:_i(t,i.done),i.lastSelTime=+new Date,i.lastSelOrigin=o,i.lastSelOp=n,r&&!1!==r.clearRedo&&zi(i.undone)}(e,e.sel,e.cm?e.cm.curOp.id:NaN,n)}function eo(e,t,n){(ye(e,"beforeSelectionChange")||e.cm&&ye(e.cm,"beforeSelectionChange"))&&(t=function(e,t,n){var r={ranges:t.ranges,update:function(t){this.ranges=[]
928
+ for(var n=0;n<t.length;n++)this.ranges[n]=new Si(st(e,t[n].anchor),st(e,t[n].head))},origin:n&&n.origin}
929
+ return me(e,"beforeSelectionChange",e,r),e.cm&&me(e.cm,"beforeSelectionChange",e.cm,r),r.ranges!=t.ranges?Li(e.cm,r.ranges,r.ranges.length-1):t}(e,t,n))
930
+ var r=n&&n.bias||(nt(t.primary().head,e.sel.primary().head)<0?-1:1)
931
+ to(e,ro(e,t,r,!0)),n&&!1===n.scroll||!e.cm||Fr(e.cm)}function to(e,t){t.equals(e.sel)||(e.sel=t,e.cm&&(e.cm.curOp.updateInput=1,e.cm.curOp.selectionChanged=!0,ve(e.cm)),un(e,"cursorActivity",e))}function no(e){to(e,ro(e,e.sel,null,!1))}function ro(e,t,n,r){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=oo(e,a.anchor,l&&l.anchor,n,r),u=oo(e,a.head,l&&l.head,n,r);(i||s!=a.anchor||u!=a.head)&&(i||(i=t.ranges.slice(0,o)),i[o]=new Si(s,u))}return i?Li(e.cm,i,t.primIndex):t}function io(e,t,n,r,i){var o=$e(e,t.line)
932
932
  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
933
- 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
933
+ 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&&(me(s,"beforeCursorEnter"),s.explicitlyCleared)){if(o.markedSpans){--a
934
934
  continue}break}if(!s.atomic)continue
935
935
  if(n){var f=s.find(r<0?1:-1),d=void 0
936
- if((r<0?c:u)&&(f=oo(e,f,-r,f&&f.line==t.line?o:null)),f&&f.line==t.line&&(d=tt(f,n))&&(r<0?d<0:d>0))return ro(e,f,t,r,i)}var h=s.find(r<0?-1:1)
937
- return(r<0?u:c)&&(h=oo(e,h,r,h.line==t.line?o:null)),h?ro(e,h,t,r,i):null}}return t}function io(e,t,n,r,i){var o=r||1
938
- return ro(e,t,n,o,i)||!i&&ro(e,t,n,o,!0)||ro(e,t,n,-o,i)||!i&&ro(e,t,n,-o,!0)||(e.cantEdit=!0,et(e.first,0))}function oo(e,t,n,r){return n<0&&0==t.ch?t.line>e.first?lt(e,et(t.line-1)):null:n>0&&t.ch==(r||Ve(e,t.line)).text.length?t.line<e.first+e.size-1?et(t.line+1,0):null:new et(t.line,t.ch+n)}function ao(e){e.setSelection(et(e.firstLine(),0),et(e.lastLine()),_)}function lo(e,t,n){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return r.canceled=!0}}
939
- return n&&(r.update=function(t,n,i,o){t&&(r.from=lt(e,t)),n&&(r.to=lt(e,n)),i&&(r.text=i),void 0!==o&&(r.origin=o)}),pe(e,"beforeChange",e,r),e.cm&&pe(e.cm,"beforeChange",e.cm,r),r.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:r.from,to:r.to,text:r.text,origin:r.origin}}function so(e,t,n){if(e.cm){if(!e.cm.curOp)return ei(e.cm,so)(e,t,n)
940
- if(e.cm.state.suppressEdits)return}if(!(ve(e,"beforeChange")||e.cm&&ve(e.cm,"beforeChange"))||(t=lo(e,t,!0))){var r=wt&&!n&&function(e,t,n){var r=null
936
+ if((r<0?c:u)&&(f=ao(e,f,-r,f&&f.line==t.line?o:null)),f&&f.line==t.line&&(d=nt(f,n))&&(r<0?d<0:d>0))return io(e,f,t,r,i)}var h=s.find(r<0?-1:1)
937
+ return(r<0?u:c)&&(h=ao(e,h,r,h.line==t.line?o:null)),h?io(e,h,t,r,i):null}}return t}function oo(e,t,n,r,i){var o=r||1
938
+ return io(e,t,n,o,i)||!i&&io(e,t,n,o,!0)||io(e,t,n,-o,i)||!i&&io(e,t,n,-o,!0)||(e.cantEdit=!0,tt(e.first,0))}function ao(e,t,n,r){return n<0&&0==t.ch?t.line>e.first?st(e,tt(t.line-1)):null:n>0&&t.ch==(r||$e(e,t.line)).text.length?t.line<e.first+e.size-1?tt(t.line+1,0):null:new tt(t.line,t.ch+n)}function lo(e){e.setSelection(tt(e.firstLine(),0),tt(e.lastLine()),U)}function so(e,t,n){var r={canceled:!1,from:t.from,to:t.to,text:t.text,origin:t.origin,cancel:function(){return r.canceled=!0}}
939
+ return n&&(r.update=function(t,n,i,o){t&&(r.from=st(e,t)),n&&(r.to=st(e,n)),i&&(r.text=i),void 0!==o&&(r.origin=o)}),me(e,"beforeChange",e,r),e.cm&&me(e.cm,"beforeChange",e.cm,r),r.canceled?(e.cm&&(e.cm.curOp.updateInput=2),null):{from:r.from,to:r.to,text:r.text,origin:r.origin}}function uo(e,t,n){if(e.cm){if(!e.cm.curOp)return ti(e.cm,uo)(e,t,n)
940
+ if(e.cm.state.suppressEdits)return}if(!(ye(e,"beforeChange")||e.cm&&ye(e.cm,"beforeChange"))||(t=so(e,t,!0))){var r=Ct&&!n&&function(e,t,n){var r=null
941
941
  if(e.iter(t.line,n.line+1,(function(e){if(e.markedSpans)for(var t=0;t<e.markedSpans.length;++t){var n=e.markedSpans[t].marker
942
942
  !n.readOnly||r&&-1!=z(r,n)||(r||(r=[])).push(n)}})),!r)return null
943
943
  for(var i=[{from:t,to:n}],o=0;o<r.length;++o)for(var a=r[o],l=a.find(0),s=0;s<i.length;++s){var u=i[s]
944
- if(!(tt(u.to,l.from)<0||tt(u.from,l.to)>0)){var c=[s,1],f=tt(u.from,l.from),d=tt(u.to,l.to);(f<0||!a.inclusiveLeft&&!f)&&c.push({from:u.from,to:l.from}),(d>0||!a.inclusiveRight&&!d)&&c.push({from:l.to,to:u.to}),i.splice.apply(i,c),s+=c.length-3}}return i}(e,t.from,t.to)
945
- if(r)for(var i=r.length-1;i>=0;--i)uo(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin})
946
- else uo(e,t)}}function uo(e,t){if(1!=t.text.length||""!=t.text[0]||0!=tt(t.from,t.to)){var n=Ai(e,t)
947
- zi(e,t,n,e.cm?e.cm.curOp.id:NaN),ho(e,t,n,Tt(e,t))
944
+ if(!(nt(u.to,l.from)<0||nt(u.from,l.to)>0)){var c=[s,1],f=nt(u.from,l.from),d=nt(u.to,l.to);(f<0||!a.inclusiveLeft&&!f)&&c.push({from:u.from,to:l.from}),(d>0||!a.inclusiveRight&&!d)&&c.push({from:l.to,to:u.to}),i.splice.apply(i,c),s+=c.length-3}}return i}(e,t.from,t.to)
945
+ if(r)for(var i=r.length-1;i>=0;--i)co(e,{from:r[i].from,to:r[i].to,text:i?[""]:t.text,origin:t.origin})
946
+ else co(e,t)}}function co(e,t){if(1!=t.text.length||""!=t.text[0]||0!=nt(t.from,t.to)){var n=Ni(e,t)
947
+ ji(e,t,n,e.cm?e.cm.curOp.id:NaN),po(e,t,n,Mt(e,t))
948
948
  var r=[]
949
- Ii(e,(function(e,n){n||-1!=z(r,e.history)||(vo(e.history,t),r.push(e.history)),ho(e,t,null,Tt(e,t))}))}}function co(e,t,n){var r=e.cm&&e.cm.state.suppressEdits
949
+ Bi(e,(function(e,n){n||-1!=z(r,e.history)||(yo(e.history,t),r.push(e.history)),po(e,t,null,Mt(e,t))}))}}function fo(e,t,n){var r=e.cm&&e.cm.state.suppressEdits
950
950
  if(!r||n){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],n?!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(r)return void l.push(i)
951
- break}if(ji(i,s),n&&!i.equals(e.sel))return void Qi(e,i,{clearRedo:!1})
951
+ break}if(_i(i,s),n&&!i.equals(e.sel))return void Ji(e,i,{clearRedo:!1})
952
952
  a=i}var c=[]
953
- ji(a,s),s.push({changes:c,generation:o.generation}),o.generation=i.generation||++o.maxGeneration
954
- for(var f=ve(e,"beforeChange")||e.cm&&ve(e.cm,"beforeChange"),d=function(n){var r=i.changes[n]
955
- if(r.origin=t,f&&!lo(e,r,!1))return l.length=0,{}
956
- c.push(Pi(e,r))
957
- var o=n?Ai(e,r):X(l)
958
- ho(e,r,o,qi(e,r)),!n&&e.cm&&e.cm.scrollIntoView({from:r.from,to:Ti(r)})
953
+ _i(a,s),s.push({changes:c,generation:o.generation}),o.generation=i.generation||++o.maxGeneration
954
+ for(var f=ye(e,"beforeChange")||e.cm&&ye(e.cm,"beforeChange"),d=function(n){var r=i.changes[n]
955
+ if(r.origin=t,f&&!so(e,r,!1))return l.length=0,{}
956
+ c.push(Ri(e,r))
957
+ var o=n?Ni(e,r):K(l)
958
+ po(e,r,o,Gi(e,r)),!n&&e.cm&&e.cm.scrollIntoView({from:r.from,to:Mi(r)})
959
959
  var a=[]
960
- Ii(e,(function(e,t){t||-1!=z(a,e.history)||(vo(e.history,r),a.push(e.history)),ho(e,r,null,qi(e,r))}))},h=i.changes.length-1;h>=0;--h){var p=d(h)
961
- if(p)return p.v}}}}function fo(e,t){if(0!=t&&(e.first+=t,e.sel=new Ci(K(e.sel.ranges,(function(e){return new ki(et(e.anchor.line+t,e.anchor.ch),et(e.head.line+t,e.head.ch))})),e.sel.primIndex),e.cm)){fr(e.cm,e.first,e.first-t,t)
962
- for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)dr(e.cm,r,"gutter")}}function ho(e,t,n,r){if(e.cm&&!e.cm.curOp)return ei(e.cm,ho)(e,t,n,r)
963
- if(t.to.line<e.first)fo(e,t.text.length-1-(t.to.line-t.from.line))
960
+ Bi(e,(function(e,t){t||-1!=z(a,e.history)||(yo(e.history,r),a.push(e.history)),po(e,r,null,Gi(e,r))}))},h=i.changes.length-1;h>=0;--h){var p=d(h)
961
+ if(p)return p.v}}}}function ho(e,t){if(0!=t&&(e.first+=t,e.sel=new ki(Y(e.sel.ranges,(function(e){return new Si(tt(e.anchor.line+t,e.anchor.ch),tt(e.head.line+t,e.head.ch))})),e.sel.primIndex),e.cm)){dr(e.cm,e.first,e.first-t,t)
962
+ for(var n=e.cm.display,r=n.viewFrom;r<n.viewTo;r++)hr(e.cm,r,"gutter")}}function po(e,t,n,r){if(e.cm&&!e.cm.curOp)return ti(e.cm,po)(e,t,n,r)
963
+ if(t.to.line<e.first)ho(e,t.text.length-1-(t.to.line-t.from.line))
964
964
  else if(!(t.from.line>e.lastLine())){if(t.from.line<e.first){var i=t.text.length-1-(e.first-t.from.line)
965
- fo(e,i),t={from:et(e.first,0),to:et(t.to.line+i,t.to.ch),text:[X(t.text)],origin:t.origin}}var o=e.lastLine()
966
- t.to.line>o&&(t={from:t.from,to:et(o,Ve(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=$e(e,t.from,t.to),n||(n=Ai(e,t)),e.cm?function(e,t,n){var r=e.doc,i=e.display,o=t.from,a=t.to,l=!1,s=o.line
967
- e.options.lineWrapping||(s=Ye(Pt(Ve(r,o.line))),r.iter(s,a.line+1,(function(e){if(e==i.maxLine)return l=!0,!0}))),r.sel.contains(t.from,t.to)>-1&&ge(e),Oi(r,t,n,lr(e)),e.options.lineWrapping||(r.iter(s,o.line+t.text.length,(function(e){var t=qt(e)
968
- 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 n=e.first,r=t-1;r>n;r--){var i=Ve(e,r).stateAfter
969
- if(i&&(!(i instanceof ut)||r+i.lookAhead<t)){n=r+1
970
- break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}}(r,o.line),ri(e,400)
965
+ ho(e,i),t={from:tt(e.first,0),to:tt(t.to.line+i,t.to.ch),text:[K(t.text)],origin:t.origin}}var o=e.lastLine()
966
+ t.to.line>o&&(t={from:t.from,to:tt(o,$e(e,o).text.length),text:[t.text[0]],origin:t.origin}),t.removed=Xe(e,t.from,t.to),n||(n=Ni(e,t)),e.cm?function(e,t,n){var r=e.doc,i=e.display,o=t.from,a=t.to,l=!1,s=o.line
967
+ e.options.lineWrapping||(s=Ze(Rt($e(r,o.line))),r.iter(s,a.line+1,(function(e){if(e==i.maxLine)return l=!0,!0}))),r.sel.contains(t.from,t.to)>-1&&ve(e),Ii(r,t,n,sr(e)),e.options.lineWrapping||(r.iter(s,o.line+t.text.length,(function(e){var t=Gt(e)
968
+ 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 n=e.first,r=t-1;r>n;r--){var i=$e(e,r).stateAfter
969
+ if(i&&(!(i instanceof ct)||r+i.lookAhead<t)){n=r+1
970
+ break}}e.highlightFrontier=Math.min(e.highlightFrontier,n)}}(r,o.line),ii(e,400)
971
971
  var u=t.text.length-(a.line-o.line)-1
972
- t.full?fr(e):o.line!=a.line||1!=t.text.length||Fi(e.doc,t)?fr(e,o.line,a.line+1,u):dr(e,o.line,"text")
973
- var c=ve(e,"changes"),f=ve(e,"change")
972
+ t.full?dr(e):o.line!=a.line||1!=t.text.length||Oi(e.doc,t)?dr(e,o.line,a.line+1,u):hr(e,o.line,"text")
973
+ var c=ye(e,"changes"),f=ye(e,"change")
974
974
  if(f||c){var d={from:o,to:a,text:t.text,removed:t.removed,origin:t.origin}
975
- f&&sn(e,"change",e,d),c&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(d)}e.display.selForContextMenu=null}(e.cm,t,r):Oi(e,t,r),Ji(e,n,_)}}function po(e,t,n,r,i){var o
976
- r||(r=n),tt(r,n)<0&&(n=(o=[r,n])[0],r=o[1]),"string"==typeof t&&(t=e.splitLines(t)),so(e,{from:n,to:r,text:t,origin:i})}function mo(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function go(e,t,n,r){for(var i=0;i<e.length;++i){var o=e[i],a=!0
975
+ f&&un(e,"change",e,d),c&&(e.curOp.changeObjs||(e.curOp.changeObjs=[])).push(d)}e.display.selForContextMenu=null}(e.cm,t,r):Ii(e,t,r),eo(e,n,U)}}function mo(e,t,n,r,i){var o
976
+ r||(r=n),nt(r,n)<0&&(n=(o=[r,n])[0],r=o[1]),"string"==typeof t&&(t=e.splitLines(t)),uo(e,{from:n,to:r,text:t,origin:i})}function go(e,t,n,r){n<e.line?e.line+=r:t<e.line&&(e.line=t,e.ch=0)}function vo(e,t,n,r){for(var i=0;i<e.length;++i){var o=e[i],a=!0
977
977
  if(o.ranges){o.copied||((o=e[i]=o.deepCopy()).copied=!0)
978
- for(var l=0;l<o.ranges.length;l++)mo(o.ranges[l].anchor,t,n,r),mo(o.ranges[l].head,t,n,r)}else{for(var s=0;s<o.changes.length;++s){var u=o.changes[s]
979
- if(n<u.from.line)u.from=et(u.from.line+r,u.from.ch),u.to=et(u.to.line+r,u.to.ch)
978
+ for(var l=0;l<o.ranges.length;l++)go(o.ranges[l].anchor,t,n,r),go(o.ranges[l].head,t,n,r)}else{for(var s=0;s<o.changes.length;++s){var u=o.changes[s]
979
+ if(n<u.from.line)u.from=tt(u.from.line+r,u.from.ch),u.to=tt(u.to.line+r,u.to.ch)
980
980
  else if(t<=u.to.line){a=!1
981
- break}}a||(e.splice(0,i+1),i=0)}}}function vo(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1
982
- go(e.done,n,r,i),go(e.undone,n,r,i)}function yo(e,t,n,r){var i=t,o=t
983
- return"number"==typeof t?o=Ve(e,at(e,t)):i=Ye(t),null==i?null:(r(o,i)&&e.cm&&dr(e.cm,i,n),o)}function xo(e){this.lines=e,this.parent=null
981
+ break}}a||(e.splice(0,i+1),i=0)}}}function yo(e,t){var n=t.from.line,r=t.to.line,i=t.text.length-(r-n)-1
982
+ vo(e.done,n,r,i),vo(e.undone,n,r,i)}function xo(e,t,n,r){var i=t,o=t
983
+ return"number"==typeof t?o=$e(e,lt(e,t)):i=Ze(t),null==i?null:(r(o,i)&&e.cm&&hr(e.cm,i,n),o)}function bo(e){this.lines=e,this.parent=null
984
984
  for(var t=0,n=0;n<e.length;++n)e[n].parent=this,t+=e[n].height
985
- this.height=t}function bo(e){this.children=e
985
+ this.height=t}function wo(e){this.children=e
986
986
  for(var t=0,n=0,r=0;r<e.length;++r){var i=e[r]
987
- t+=i.chunkSize(),n+=i.height,i.parent=this}this.size=t,this.height=n,this.parent=null}ki.prototype.from=function(){return ot(this.anchor,this.head)},ki.prototype.to=function(){return it(this.anchor,this.head)},ki.prototype.empty=function(){return this.head.line==this.anchor.line&&this.head.ch==this.anchor.ch},xo.prototype={chunkSize:function(){return this.lines.length},removeInner:function(e,t){for(var n=e,r=e+t;n<r;++n){var i=this.lines[n]
988
- this.height-=i.height,$t(i),sn(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,n){this.height+=n,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e))
989
- for(var r=0;r<t.length;++r)t[r].parent=this},iterN:function(e,t,n){for(var r=e+t;e<r;++e)if(n(this.lines[e]))return!0}},bo.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){var n=this
987
+ t+=i.chunkSize(),n+=i.height,i.parent=this}this.size=t,this.height=n,this.parent=null}Si.prototype.from=function(){return at(this.anchor,this.head)},Si.prototype.to=function(){return ot(this.anchor,this.head)},Si.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 n=e,r=e+t;n<r;++n){var i=this.lines[n]
988
+ this.height-=i.height,Xt(i),un(i,"delete")}this.lines.splice(e,t)},collapse:function(e){e.push.apply(e,this.lines)},insertInner:function(e,t,n){this.height+=n,this.lines=this.lines.slice(0,e).concat(t).concat(this.lines.slice(e))
989
+ for(var r=0;r<t.length;++r)t[r].parent=this},iterN:function(e,t,n){for(var r=e+t;e<r;++e)if(n(this.lines[e]))return!0}},wo.prototype={chunkSize:function(){return this.size},removeInner:function(e,t){var n=this
990
990
  this.size-=t
991
991
  for(var r=0;r<this.children.length;++r){var i=n.children[r],o=i.chunkSize()
992
992
  if(e<o){var a=Math.min(t,o-e),l=i.height
993
993
  if(i.removeInner(e,a),n.height-=l-i.height,o==a&&(n.children.splice(r--,1),i.parent=null),0==(t-=a))break
994
- e=0}else e-=o}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof xo))){var s=[]
995
- this.collapse(s),this.children=[new xo(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,n){var r=this
994
+ e=0}else e-=o}if(this.size-t<25&&(this.children.length>1||!(this.children[0]instanceof bo))){var s=[]
995
+ 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,n){var r=this
996
996
  this.size+=t.length,this.height+=n
997
997
  for(var i=0;i<this.children.length;++i){var o=r.children[i],a=o.chunkSize()
998
- if(e<=a){if(o.insertInner(e,t,n),o.lines&&o.lines.length>50){for(var l=o.lines.length%25+25,s=l;s<o.lines.length;){var u=new xo(o.lines.slice(s,s+=25))
998
+ if(e<=a){if(o.insertInner(e,t,n),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))
999
999
  o.height-=u.height,r.children.splice(++i,0,u),u.parent=r}o.lines=o.lines.slice(0,l),r.maybeSpill()}break}e-=a}},maybeSpill:function(){if(!(this.children.length<=10)){var e=this
1000
- do{var t=new bo(e.children.splice(e.children.length-5,5))
1000
+ do{var t=new wo(e.children.splice(e.children.length-5,5))
1001
1001
  if(e.parent){e.size-=t.size,e.height-=t.height
1002
1002
  var n=z(e.parent.children,e)
1003
- e.parent.children.splice(n+1,0,t)}else{var r=new bo(e.children)
1003
+ e.parent.children.splice(n+1,0,t)}else{var r=new wo(e.children)
1004
1004
  r.parent=e,e.children=[r,t],e=r}t.parent=e.parent}while(e.children.length>10)
1005
1005
  e.parent.maybeSpill()}},iterN:function(e,t,n){for(var r=0;r<this.children.length;++r){var i=this.children[r],o=i.chunkSize()
1006
1006
  if(e<o){var a=Math.min(t,o-e)
1007
1007
  if(i.iterN(e,a,n))return!0
1008
1008
  if(0==(t-=a))break
1009
1009
  e=0}else e-=o}}}
1010
- var wo=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r])
1010
+ var Co=function(e,t,n){if(n)for(var r in n)n.hasOwnProperty(r)&&(this[r]=n[r])
1011
1011
  this.doc=e,this.node=t}
1012
- function Co(e,t,n){Ut(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Er(e,n)}wo.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=Ye(n)
1012
+ function ko(e,t,n){qt(t)<(e.curOp&&e.curOp.scrollTop||e.doc.scrollTop)&&Dr(e,n)}Co.prototype.clear=function(){var e=this.doc.cm,t=this.line.widgets,n=this.line,r=Ze(n)
1013
1013
  if(null!=r&&t){for(var i=0;i<t.length;++i)t[i]==this&&t.splice(i--,1)
1014
1014
  t.length||(n.widgets=null)
1015
- var o=wn(this)
1016
- Ke(n,Math.max(0,n.height-o)),e&&(Jr(e,(function(){Co(e,n,-o),dr(e,r,"widget")})),sn(e,"lineWidgetCleared",e,this,r))}},wo.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line
1015
+ var o=Cn(this)
1016
+ Ye(n,Math.max(0,n.height-o)),e&&(ei(e,(function(){ko(e,n,-o),hr(e,r,"widget")})),un(e,"lineWidgetCleared",e,this,r))}},Co.prototype.changed=function(){var e=this,t=this.height,n=this.doc.cm,r=this.line
1017
1017
  this.height=null
1018
- var i=wn(this)-t
1019
- i&&(jt(this.doc,r)||Ke(r,r.height+i),n&&Jr(n,(function(){n.curOp.forceUpdate=!0,Co(n,r,i),sn(n,"lineWidgetChanged",n,e,Ye(r))})))},ye(wo)
1020
- var ko=0,So=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++ko}
1021
- function Lo(e,t,n,r,i){if(r&&r.shared)return function(e,t,n,r,i){(r=W(r)).shared=!1
1022
- var o=[Lo(e,t,n,r,i)],a=o[0],l=r.widgetNode
1023
- return Ii(e,(function(e){l&&(r.widgetNode=l.cloneNode(!0)),o.push(Lo(e,lt(e,t),lt(e,n),r,i))
1018
+ var i=Cn(this)-t
1019
+ i&&(_t(this.doc,r)||Ye(r,r.height+i),n&&ei(n,(function(){n.curOp.forceUpdate=!0,ko(n,r,i),un(n,"lineWidgetChanged",n,e,Ze(r))})))},xe(Co)
1020
+ var So=0,Lo=function(e,t){this.lines=[],this.type=t,this.doc=e,this.id=++So}
1021
+ function To(e,t,n,r,i){if(r&&r.shared)return function(e,t,n,r,i){(r=W(r)).shared=!1
1022
+ var o=[To(e,t,n,r,i)],a=o[0],l=r.widgetNode
1023
+ return Bi(e,(function(e){l&&(r.widgetNode=l.cloneNode(!0)),o.push(To(e,st(e,t),st(e,n),r,i))
1024
1024
  for(var s=0;s<e.linked.length;++s)if(e.linked[s].isParent)return
1025
- a=X(o)})),new To(o,a)}(e,t,n,r,i)
1026
- if(e.cm&&!e.cm.curOp)return ei(e.cm,Lo)(e,t,n,r,i)
1027
- var o=new So(e,i),a=tt(t,n)
1025
+ a=K(o)})),new Mo(o,a)}(e,t,n,r,i)
1026
+ if(e.cm&&!e.cm.curOp)return ti(e.cm,To)(e,t,n,r,i)
1027
+ var o=new Lo(e,i),a=nt(t,n)
1028
1028
  if(r&&W(r,o,!1),a>0||0==a&&!1!==o.clearWhenEmpty)return o
1029
- if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=E("span",[o.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(Wt(e,t.line,t,n,o)||t.line!=n.line&&Wt(e,n.line,t,n,o))throw new Error("Inserting collapsed marker partially overlapping an existing one")
1030
- Ct=!0}o.addToHistory&&zi(e,{from:t,to:n,origin:"markText"},e.sel,NaN)
1029
+ if(o.replacedWith&&(o.collapsed=!0,o.widgetNode=E("span",[o.replacedWith],"CodeMirror-widget"),r.handleMouseEvents||o.widgetNode.setAttribute("cm-ignore-events","true"),r.insertLeft&&(o.widgetNode.insertLeft=!0)),o.collapsed){if(Pt(e,t.line,t,n,o)||t.line!=n.line&&Pt(e,n.line,t,n,o))throw new Error("Inserting collapsed marker partially overlapping an existing one")
1030
+ kt=!0}o.addToHistory&&ji(e,{from:t,to:n,origin:"markText"},e.sel,NaN)
1031
1031
  var l,s=t.line,u=e.cm
1032
- if(e.iter(s,n.line+1,(function(e){u&&o.collapsed&&!u.options.lineWrapping&&Pt(e)==u.display.maxLine&&(l=!0),o.collapsed&&s!=t.line&&Ke(e,0),function(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}(e,new kt(o,s==t.line?t.ch:null,s==n.line?n.ch:null)),++s})),o.collapsed&&e.iter(t.line,n.line+1,(function(t){jt(e,t)&&Ke(t,0)})),o.clearOnEnter&&fe(o,"beforeCursorEnter",(function(){return o.clear()})),o.readOnly&&(wt=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++ko,o.atomic=!0),u){if(l&&(u.curOp.updateMaxLine=!0),o.collapsed)fr(u,t.line,n.line+1)
1033
- else if(o.className||o.startStyle||o.endStyle||o.css||o.attributes||o.title)for(var c=t.line;c<=n.line;c++)dr(u,c,"text")
1034
- o.atomic&&to(u.doc),sn(u,"markerAdded",u,o)}return o}So.prototype.clear=function(){var e=this
1032
+ if(e.iter(s,n.line+1,(function(e){u&&o.collapsed&&!u.options.lineWrapping&&Rt(e)==u.display.maxLine&&(l=!0),o.collapsed&&s!=t.line&&Ye(e,0),function(e,t){e.markedSpans=e.markedSpans?e.markedSpans.concat([t]):[t],t.marker.attachLine(e)}(e,new St(o,s==t.line?t.ch:null,s==n.line?n.ch:null)),++s})),o.collapsed&&e.iter(t.line,n.line+1,(function(t){_t(e,t)&&Ye(t,0)})),o.clearOnEnter&&de(o,"beforeCursorEnter",(function(){return o.clear()})),o.readOnly&&(Ct=!0,(e.history.done.length||e.history.undone.length)&&e.clearHistory()),o.collapsed&&(o.id=++So,o.atomic=!0),u){if(l&&(u.curOp.updateMaxLine=!0),o.collapsed)dr(u,t.line,n.line+1)
1033
+ else if(o.className||o.startStyle||o.endStyle||o.css||o.attributes||o.title)for(var c=t.line;c<=n.line;c++)hr(u,c,"text")
1034
+ o.atomic&&no(u.doc),un(u,"markerAdded",u,o)}return o}Lo.prototype.clear=function(){var e=this
1035
1035
  if(!this.explicitlyCleared){var t=this.doc.cm,n=t&&!t.curOp
1036
- if(n&&Vr(t),ve(this,"clear")){var r=this.find()
1037
- r&&sn(this,"clear",r.from,r.to)}for(var i=null,o=null,a=0;a<this.lines.length;++a){var l=e.lines[a],s=St(l.markedSpans,e)
1038
- t&&!e.collapsed?dr(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&&Ke(l,rr(t.display))}if(t&&this.collapsed&&!t.options.lineWrapping)for(var u=0;u<this.lines.length;++u){var c=Pt(e.lines[u]),f=qt(c)
1039
- f>t.display.maxLineLength&&(t.display.maxLine=c,t.display.maxLineLength=f,t.display.maxLineChanged=!0)}null!=i&&t&&this.collapsed&&fr(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&&sn(t,"markerCleared",t,this,i,o),n&&$r(t),this.parent&&this.parent.clear()}},So.prototype.find=function(e,t){var n,r
1036
+ if(n&&$r(t),ye(this,"clear")){var r=this.find()
1037
+ r&&un(this,"clear",r.from,r.to)}for(var i=null,o=null,a=0;a<this.lines.length;++a){var l=e.lines[a],s=Lt(l.markedSpans,e)
1038
+ t&&!e.collapsed?hr(t,Ze(l),"text"):t&&(null!=s.to&&(o=Ze(l)),null!=s.from&&(i=Ze(l))),l.markedSpans=Tt(l.markedSpans,s),null==s.from&&e.collapsed&&!_t(e.doc,l)&&t&&Ye(l,ir(t.display))}if(t&&this.collapsed&&!t.options.lineWrapping)for(var u=0;u<this.lines.length;++u){var c=Rt(e.lines[u]),f=Gt(c)
1039
+ f>t.display.maxLineLength&&(t.display.maxLine=c,t.display.maxLineLength=f,t.display.maxLineChanged=!0)}null!=i&&t&&this.collapsed&&dr(t,i,o+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,t&&no(t.doc)),t&&un(t,"markerCleared",t,this,i,o),n&&Xr(t),this.parent&&this.parent.clear()}},Lo.prototype.find=function(e,t){var n,r
1040
1040
  null==e&&"bookmark"==this.type&&(e=1)
1041
- for(var i=0;i<this.lines.length;++i){var o=this.lines[i],a=St(o.markedSpans,this)
1042
- if(null!=a.from&&(n=et(t?o:Ye(o),a.from),-1==e))return n
1043
- if(null!=a.to&&(r=et(t?o:Ye(o),a.to),1==e))return r}return n&&{from:n,to:r}},So.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,r=this.doc.cm
1044
- t&&r&&Jr(r,(function(){var i=t.line,o=Ye(t.line),a=Dn(r,o)
1045
- if(a&&(Pn(a),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!jt(n.doc,i)&&null!=n.height){var l=n.height
1041
+ for(var i=0;i<this.lines.length;++i){var o=this.lines[i],a=Lt(o.markedSpans,this)
1042
+ if(null!=a.from&&(n=tt(t?o:Ze(o),a.from),-1==e))return n
1043
+ if(null!=a.to&&(r=tt(t?o:Ze(o),a.to),1==e))return r}return n&&{from:n,to:r}},Lo.prototype.changed=function(){var e=this,t=this.find(-1,!0),n=this,r=this.doc.cm
1044
+ t&&r&&ei(r,(function(){var i=t.line,o=Ze(t.line),a=Fn(r,o)
1045
+ if(a&&(Rn(a),r.curOp.selectionChanged=r.curOp.forceUpdate=!0),r.curOp.updateMaxLine=!0,!_t(n.doc,i)&&null!=n.height){var l=n.height
1046
1046
  n.height=null
1047
- var s=wn(n)-l
1048
- s&&Ke(i,i.height+s)}sn(r,"markerChanged",r,e)}))},So.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp
1049
- t.maybeHiddenMarkers&&-1!=z(t.maybeHiddenMarkers,this)||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},So.prototype.detachLine=function(e){if(this.lines.splice(z(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},ye(So)
1050
- var To=function(e,t){this.markers=e,this.primary=t
1047
+ var s=Cn(n)-l
1048
+ s&&Ye(i,i.height+s)}un(r,"markerChanged",r,e)}))},Lo.prototype.attachLine=function(e){if(!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp
1049
+ t.maybeHiddenMarkers&&-1!=z(t.maybeHiddenMarkers,this)||(t.maybeUnhiddenMarkers||(t.maybeUnhiddenMarkers=[])).push(this)}this.lines.push(e)},Lo.prototype.detachLine=function(e){if(this.lines.splice(z(this.lines,e),1),!this.lines.length&&this.doc.cm){var t=this.doc.cm.curOp;(t.maybeHiddenMarkers||(t.maybeHiddenMarkers=[])).push(this)}},xe(Lo)
1050
+ var Mo=function(e,t){this.markers=e,this.primary=t
1051
1051
  for(var n=0;n<e.length;++n)e[n].parent=this}
1052
- function Mo(e){return e.findMarks(et(e.first,0),e.clipPos(et(e.lastLine())),(function(e){return e.parent}))}function Ao(e){for(var t=function(t){var n=e[t],r=[n.primary.doc]
1053
- Ii(n.primary.doc,(function(e){return r.push(e)}))
1054
- for(var i=0;i<n.markers.length;i++){var o=n.markers[i];-1==z(r,o.doc)&&(o.parent=null,n.markers.splice(i--,1))}},n=0;n<e.length;n++)t(n)}To.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0
1052
+ function Ao(e){return e.findMarks(tt(e.first,0),e.clipPos(tt(e.lastLine())),(function(e){return e.parent}))}function No(e){for(var t=function(t){var n=e[t],r=[n.primary.doc]
1053
+ Bi(n.primary.doc,(function(e){return r.push(e)}))
1054
+ for(var i=0;i<n.markers.length;i++){var o=n.markers[i];-1==z(r,o.doc)&&(o.parent=null,n.markers.splice(i--,1))}},n=0;n<e.length;n++)t(n)}Mo.prototype.clear=function(){if(!this.explicitlyCleared){this.explicitlyCleared=!0
1055
1055
  for(var e=0;e<this.markers.length;++e)this.markers[e].clear()
1056
- sn(this,"clear")}},To.prototype.find=function(e,t){return this.primary.find(e,t)},ye(To)
1057
- var No=0,Eo=function(e,t,n,r,i){if(!(this instanceof Eo))return new Eo(e,t,n,r,i)
1058
- null==n&&(n=0),bo.call(this,[new xo([new Vt("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n
1059
- var o=et(n,0)
1060
- this.sel=Li(o),this.history=new Wi(null),this.id=++No,this.modeOption=t,this.lineSep=r,this.direction="rtl"==i?"rtl":"ltr",this.extend=!1,"string"==typeof e&&(e=this.splitLines(e)),Oi(this,{from:o,to:o,text:e}),Qi(this,Li(o),_)}
1061
- Eo.prototype=Z(bo.prototype,{constructor:Eo,iter:function(e,t,n){n?this.iterN(e-this.first,t-e,n):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var n=0,r=0;r<t.length;++r)n+=t[r].height
1062
- this.insertInner(e-this.first,t,n)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=Xe(this,this.first,this.first+this.size)
1063
- return!1===e?t:t.join(e||this.lineSeparator())},setValue:ni((function(e){var t=et(this.first,0),n=this.first+this.size-1
1064
- so(this,{from:t,to:et(n,Ve(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&Fr(this.cm,0,0),Qi(this,Li(t),_)})),replaceRange:function(e,t,n,r){po(this,e,t=lt(this,t),n=n?lt(this,n):t,r)},getRange:function(e,t,n){var r=$e(this,lt(this,e),lt(this,t))
1056
+ un(this,"clear")}},Mo.prototype.find=function(e,t){return this.primary.find(e,t)},xe(Mo)
1057
+ var Eo=0,Do=function(e,t,n,r,i){if(!(this instanceof Do))return new Do(e,t,n,r,i)
1058
+ null==n&&(n=0),wo.call(this,[new bo([new $t("",null)])]),this.first=n,this.scrollTop=this.scrollLeft=0,this.cantEdit=!1,this.cleanGeneration=1,this.modeFrontier=this.highlightFrontier=n
1059
+ var o=tt(n,0)
1060
+ this.sel=Ti(o),this.history=new Pi(null),this.id=++Eo,this.modeOption=t,this.lineSep=r,this.direction="rtl"==i?"rtl":"ltr",this.extend=!1,"string"==typeof e&&(e=this.splitLines(e)),Ii(this,{from:o,to:o,text:e}),Ji(this,Ti(o),U)}
1061
+ Do.prototype=Q(wo.prototype,{constructor:Do,iter:function(e,t,n){n?this.iterN(e-this.first,t-e,n):this.iterN(this.first,this.first+this.size,e)},insert:function(e,t){for(var n=0,r=0;r<t.length;++r)n+=t[r].height
1062
+ this.insertInner(e-this.first,t,n)},remove:function(e,t){this.removeInner(e-this.first,t)},getValue:function(e){var t=Ke(this,this.first,this.first+this.size)
1063
+ return!1===e?t:t.join(e||this.lineSeparator())},setValue:ri((function(e){var t=tt(this.first,0),n=this.first+this.size-1
1064
+ uo(this,{from:t,to:tt(n,$e(this,n).text.length),text:this.splitLines(e),origin:"setValue",full:!0},!0),this.cm&&Or(this.cm,0,0),Ji(this,Ti(t),U)})),replaceRange:function(e,t,n,r){mo(this,e,t=st(this,t),n=n?st(this,n):t,r)},getRange:function(e,t,n){var r=Xe(this,st(this,e),st(this,t))
1065
1065
  return!1===n?r:r.join(n||this.lineSeparator())},getLine:function(e){var t=this.getLineHandle(e)
1066
- return t&&t.text},getLineHandle:function(e){if(Qe(this,e))return Ve(this,e)},getLineNumber:function(e){return Ye(e)},getLineHandleVisualStart:function(e){return"number"==typeof e&&(e=Ve(this,e)),Pt(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()
1067
- 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:ni((function(e,t,n){Yi(this,lt(this,"number"==typeof e?et(e,t||0):e),null,n)})),setSelection:ni((function(e,t,n){Yi(this,lt(this,e),lt(this,t||e),n)})),extendSelection:ni((function(e,t,n){$i(this,lt(this,e),t&&lt(this,t),n)})),extendSelections:ni((function(e,t){Xi(this,st(this,e),t)})),extendSelectionsBy:ni((function(e,t){Xi(this,st(this,K(this.sel.ranges,e)),t)})),setSelections:ni((function(e,t,n){if(e.length){for(var r=[],i=0;i<e.length;i++)r[i]=new ki(lt(this,e[i].anchor),lt(this,e[i].head))
1068
- null==t&&(t=Math.min(e.length-1,this.sel.primIndex)),Qi(this,Si(this.cm,r,t),n)}})),addSelection:ni((function(e,t,n){var r=this.sel.ranges.slice(0)
1069
- r.push(new ki(lt(this,e),lt(this,t||e))),Qi(this,Si(this.cm,r,r.length-1),n)})),getSelection:function(e){for(var t,n=this.sel.ranges,r=0;r<n.length;r++){var i=$e(this,n[r].from(),n[r].to())
1070
- t=t?t.concat(i):i}return!1===e?t:t.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],n=this.sel.ranges,r=0;r<n.length;r++){var i=$e(this,n[r].from(),n[r].to())
1066
+ return t&&t.text},getLineHandle:function(e){if(Je(this,e))return $e(this,e)},getLineNumber:function(e){return Ze(e)},getLineHandleVisualStart:function(e){return"number"==typeof e&&(e=$e(this,e)),Rt(e)},lineCount:function(){return this.size},firstLine:function(){return this.first},lastLine:function(){return this.first+this.size-1},clipPos:function(e){return st(this,e)},getCursor:function(e){var t=this.sel.primary()
1067
+ 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,n){Zi(this,st(this,"number"==typeof e?tt(e,t||0):e),null,n)})),setSelection:ri((function(e,t,n){Zi(this,st(this,e),st(this,t||e),n)})),extendSelection:ri((function(e,t,n){Xi(this,st(this,e),t&&st(this,t),n)})),extendSelections:ri((function(e,t){Ki(this,ut(this,e),t)})),extendSelectionsBy:ri((function(e,t){Ki(this,ut(this,Y(this.sel.ranges,e)),t)})),setSelections:ri((function(e,t,n){if(e.length){for(var r=[],i=0;i<e.length;i++)r[i]=new Si(st(this,e[i].anchor),st(this,e[i].head))
1068
+ null==t&&(t=Math.min(e.length-1,this.sel.primIndex)),Ji(this,Li(this.cm,r,t),n)}})),addSelection:ri((function(e,t,n){var r=this.sel.ranges.slice(0)
1069
+ r.push(new Si(st(this,e),st(this,t||e))),Ji(this,Li(this.cm,r,r.length-1),n)})),getSelection:function(e){for(var t,n=this.sel.ranges,r=0;r<n.length;r++){var i=Xe(this,n[r].from(),n[r].to())
1070
+ t=t?t.concat(i):i}return!1===e?t:t.join(e||this.lineSeparator())},getSelections:function(e){for(var t=[],n=this.sel.ranges,r=0;r<n.length;r++){var i=Xe(this,n[r].from(),n[r].to())
1071
1071
  !1!==e&&(i=i.join(e||this.lineSeparator())),t[r]=i}return t},replaceSelection:function(e,t,n){for(var r=[],i=0;i<this.sel.ranges.length;i++)r[i]=e
1072
- this.replaceSelections(r,t,n||"+input")},replaceSelections:ni((function(e,t,n){for(var r=[],i=this.sel,o=0;o<i.ranges.length;o++){var a=i.ranges[o]
1073
- r[o]={from:a.from(),to:a.to(),text:this.splitLines(e[o]),origin:n}}for(var l=t&&"end"!=t&&function(e,t,n){for(var r=[],i=et(e.first,0),o=i,a=0;a<t.length;a++){var l=t[a],s=Ni(l.from,i,o),u=Ni(Ti(l),i,o)
1074
- if(i=l.to,o=u,"around"==n){var c=e.sel.ranges[a],f=tt(c.head,c.anchor)<0
1075
- r[a]=new ki(f?u:s,f?s:u)}else r[a]=new ki(s,s)}return new Ci(r,e.sel.primIndex)}(this,r,t),s=r.length-1;s>=0;s--)so(this,r[s])
1076
- l?Zi(this,l):this.cm&&Dr(this.cm)})),undo:ni((function(){co(this,"undo")})),redo:ni((function(){co(this,"redo")})),undoSelection:ni((function(){co(this,"undo",!0)})),redoSelection:ni((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,n=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t
1072
+ this.replaceSelections(r,t,n||"+input")},replaceSelections:ri((function(e,t,n){for(var r=[],i=this.sel,o=0;o<i.ranges.length;o++){var a=i.ranges[o]
1073
+ r[o]={from:a.from(),to:a.to(),text:this.splitLines(e[o]),origin:n}}for(var l=t&&"end"!=t&&function(e,t,n){for(var r=[],i=tt(e.first,0),o=i,a=0;a<t.length;a++){var l=t[a],s=Ei(l.from,i,o),u=Ei(Mi(l),i,o)
1074
+ if(i=l.to,o=u,"around"==n){var c=e.sel.ranges[a],f=nt(c.head,c.anchor)<0
1075
+ r[a]=new Si(f?u:s,f?s:u)}else r[a]=new Si(s,s)}return new ki(r,e.sel.primIndex)}(this,r,t),s=r.length-1;s>=0;s--)uo(this,r[s])
1076
+ l?Qi(this,l):this.cm&&Fr(this.cm)})),undo:ri((function(){fo(this,"undo")})),redo:ri((function(){fo(this,"redo")})),undoSelection:ri((function(){fo(this,"undo",!0)})),redoSelection:ri((function(){fo(this,"redo",!0)})),setExtending:function(e){this.extend=e},getExtending:function(){return this.extend},historySize:function(){for(var e=this.history,t=0,n=0,r=0;r<e.done.length;r++)e.done[r].ranges||++t
1077
1077
  for(var i=0;i<e.undone.length;i++)e.undone[i].ranges||++n
1078
- return{undo:t,redo:n}},clearHistory:function(){this.history=new Wi(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:Gi(this.history.done),undone:Gi(this.history.undone)}},setHistory:function(e){var t=this.history=new Wi(this.history.maxGeneration)
1079
- t.done=Gi(e.done.slice(0),null,!0),t.undone=Gi(e.undone.slice(0),null,!0)},setGutterMarker:ni((function(e,t,n){return yo(this,e,"gutter",(function(e){var r=e.gutterMarkers||(e.gutterMarkers={})
1080
- return r[t]=n,!n&&te(r)&&(e.gutterMarkers=null),!0}))})),clearGutter:ni((function(e){var t=this
1081
- this.iter((function(n){n.gutterMarkers&&n.gutterMarkers[e]&&yo(t,n,"gutter",(function(){return n.gutterMarkers[e]=null,te(n.gutterMarkers)&&(n.gutterMarkers=null),!0}))}))})),lineInfo:function(e){var t
1082
- if("number"==typeof e){if(!Qe(this,e))return null
1083
- if(t=e,!(e=Ve(this,e)))return null}else if(null==(t=Ye(e)))return null
1084
- return{line:t,handle:e,text:e.text,gutterMarkers:e.gutterMarkers,textClass:e.textClass,bgClass:e.bgClass,wrapClass:e.wrapClass,widgets:e.widgets}},addLineClass:ni((function(e,t,n){return yo(this,e,"gutter"==t?"gutter":"class",(function(e){var r="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass"
1078
+ return{undo:t,redo:n}},clearHistory:function(){this.history=new Pi(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:Vi(this.history.done),undone:Vi(this.history.undone)}},setHistory:function(e){var t=this.history=new Pi(this.history.maxGeneration)
1079
+ t.done=Vi(e.done.slice(0),null,!0),t.undone=Vi(e.undone.slice(0),null,!0)},setGutterMarker:ri((function(e,t,n){return xo(this,e,"gutter",(function(e){var r=e.gutterMarkers||(e.gutterMarkers={})
1080
+ return r[t]=n,!n&&ne(r)&&(e.gutterMarkers=null),!0}))})),clearGutter:ri((function(e){var t=this
1081
+ this.iter((function(n){n.gutterMarkers&&n.gutterMarkers[e]&&xo(t,n,"gutter",(function(){return n.gutterMarkers[e]=null,ne(n.gutterMarkers)&&(n.gutterMarkers=null),!0}))}))})),lineInfo:function(e){var t
1082
+ if("number"==typeof e){if(!Je(this,e))return null
1083
+ if(t=e,!(e=$e(this,e)))return null}else if(null==(t=Ze(e)))return null
1084
+ 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,n){return xo(this,e,"gutter"==t?"gutter":"class",(function(e){var r="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass"
1085
1085
  if(e[r]){if(S(n).test(e[r]))return!1
1086
1086
  e[r]+=" "+n}else e[r]=n
1087
- return!0}))})),removeLineClass:ni((function(e,t,n){return yo(this,e,"gutter"==t?"gutter":"class",(function(e){var r="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass",i=e[r]
1087
+ return!0}))})),removeLineClass:ri((function(e,t,n){return xo(this,e,"gutter"==t?"gutter":"class",(function(e){var r="text"==t?"textClass":"background"==t?"bgClass":"gutter"==t?"gutterClass":"wrapClass",i=e[r]
1088
1088
  if(!i)return!1
1089
1089
  if(null==n)e[r]=null
1090
1090
  else{var o=i.match(S(n))
1091
1091
  if(!o)return!1
1092
1092
  var a=o.index+o[0].length
1093
- e[r]=i.slice(0,o.index)+(o.index&&a!=i.length?" ":"")+i.slice(a)||null}return!0}))})),addLineWidget:ni((function(e,t,n){return function(e,t,n,r){var i=new wo(e,n,r),o=e.cm
1094
- return o&&i.noHScroll&&(o.display.alignWidgets=!0),yo(e,t,"widget",(function(t){var n=t.widgets||(t.widgets=[])
1095
- if(null==i.insertAt?n.push(i):n.splice(Math.min(n.length-1,Math.max(0,i.insertAt)),0,i),i.line=t,o&&!jt(e,t)){var r=Ut(t)<e.scrollTop
1096
- Ke(t,t.height+wn(i)),r&&Er(o,i.height),o.curOp.forceUpdate=!0}return!0})),o&&sn(o,"lineWidgetAdded",o,i,"number"==typeof t?t:Ye(t)),i}(this,e,t,n)})),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return Lo(this,lt(this,e),lt(this,t),n,n&&n.type||"range")},setBookmark:function(e,t){var n={replacedWith:t&&(null==t.nodeType?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents}
1097
- return Lo(this,e=lt(this,e),e,n,"bookmark")},findMarksAt:function(e){var t=[],n=Ve(this,(e=lt(this,e)).line).markedSpans
1098
- if(n)for(var r=0;r<n.length;++r){var i=n[r];(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,n){e=lt(this,e),t=lt(this,t)
1093
+ e[r]=i.slice(0,o.index)+(o.index&&a!=i.length?" ":"")+i.slice(a)||null}return!0}))})),addLineWidget:ri((function(e,t,n){return function(e,t,n,r){var i=new Co(e,n,r),o=e.cm
1094
+ return o&&i.noHScroll&&(o.display.alignWidgets=!0),xo(e,t,"widget",(function(t){var n=t.widgets||(t.widgets=[])
1095
+ if(null==i.insertAt?n.push(i):n.splice(Math.min(n.length-1,Math.max(0,i.insertAt)),0,i),i.line=t,o&&!_t(e,t)){var r=qt(t)<e.scrollTop
1096
+ Ye(t,t.height+Cn(i)),r&&Dr(o,i.height),o.curOp.forceUpdate=!0}return!0})),o&&un(o,"lineWidgetAdded",o,i,"number"==typeof t?t:Ze(t)),i}(this,e,t,n)})),removeLineWidget:function(e){e.clear()},markText:function(e,t,n){return To(this,st(this,e),st(this,t),n,n&&n.type||"range")},setBookmark:function(e,t){var n={replacedWith:t&&(null==t.nodeType?t.widget:t),insertLeft:t&&t.insertLeft,clearWhenEmpty:!1,shared:t&&t.shared,handleMouseEvents:t&&t.handleMouseEvents}
1097
+ return To(this,e=st(this,e),e,n,"bookmark")},findMarksAt:function(e){var t=[],n=$e(this,(e=st(this,e)).line).markedSpans
1098
+ if(n)for(var r=0;r<n.length;++r){var i=n[r];(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,n){e=st(this,e),t=st(this,t)
1099
1099
  var r=[],i=e.line
1100
1100
  return this.iter(e.line,t.line+1,(function(o){var a=o.markedSpans
1101
1101
  if(a)for(var l=0;l<a.length;l++){var s=a[l]
@@ -1104,392 +1104,392 @@ return this.iter((function(t){var n=t.markedSpans
1104
1104
  if(n)for(var r=0;r<n.length;++r)null!=n[r].from&&e.push(n[r].marker)})),e},posFromIndex:function(e){var t,n=this.first,r=this.lineSeparator().length
1105
1105
  return this.iter((function(i){var o=i.text.length+r
1106
1106
  if(o>e)return t=e,!0
1107
- e-=o,++n})),lt(this,et(n,t))},indexFromPos:function(e){var t=(e=lt(this,e)).ch
1107
+ e-=o,++n})),st(this,tt(n,t))},indexFromPos:function(e){var t=(e=st(this,e)).ch
1108
1108
  if(e.line<this.first||e.ch<0)return 0
1109
1109
  var n=this.lineSeparator().length
1110
- return this.iter(this.first,e.line,(function(e){t+=e.text.length+n})),t},copy:function(e){var t=new Eo(Xe(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction)
1110
+ return this.iter(this.first,e.line,(function(e){t+=e.text.length+n})),t},copy:function(e){var t=new Do(Ke(this,this.first,this.first+this.size),this.modeOption,this.first,this.lineSep,this.direction)
1111
1111
  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={})
1112
1112
  var t=this.first,n=this.first+this.size
1113
1113
  null!=e.from&&e.from>t&&(t=e.from),null!=e.to&&e.to<n&&(n=e.to)
1114
- var r=new Eo(Xe(this,t,n),e.mode||this.modeOption,t,this.lineSep,this.direction)
1114
+ var r=new Do(Ke(this,t,n),e.mode||this.modeOption,t,this.lineSep,this.direction)
1115
1115
  return e.sharedHist&&(r.history=this.history),(this.linked||(this.linked=[])).push({doc:r,sharedHist:e.sharedHist}),r.linked=[{doc:this,isParent:!0,sharedHist:e.sharedHist}],function(e,t){for(var n=0;n<t.length;n++){var r=t[n],i=r.find(),o=e.clipPos(i.from),a=e.clipPos(i.to)
1116
- if(tt(o,a)){var l=Lo(e,o,a,r.primary,r.primary.type)
1117
- r.markers.push(l),l.parent=r}}}(r,Mo(this)),r},unlinkDoc:function(e){var t=this
1118
- if(e instanceof Sa&&(e=e.doc),this.linked)for(var n=0;n<this.linked.length;++n)if(t.linked[n].doc==e){t.linked.splice(n,1),e.unlinkDoc(t),Ao(Mo(t))
1116
+ if(nt(o,a)){var l=To(e,o,a,r.primary,r.primary.type)
1117
+ r.markers.push(l),l.parent=r}}}(r,Ao(this)),r},unlinkDoc:function(e){var t=this
1118
+ if(e instanceof La&&(e=e.doc),this.linked)for(var n=0;n<this.linked.length;++n)if(t.linked[n].doc==e){t.linked.splice(n,1),e.unlinkDoc(t),No(Ao(t))
1119
1119
  break}if(e.history==this.history){var r=[e.id]
1120
- Ii(e,(function(e){return r.push(e.id)}),!0),e.history=new Wi(null),e.history.done=Gi(this.history.done,r),e.history.undone=Gi(this.history.undone,r)}},iterLinkedDocs:function(e){Ii(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):De(e)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:ni((function(e){var t
1121
- "rtl"!=e&&(e="ltr"),e!=this.direction&&(this.direction=e,this.iter((function(e){return e.order=null})),this.cm&&Jr(t=this.cm,(function(){Hi(t),fr(t)})))}))}),Eo.prototype.eachLine=Eo.prototype.iter
1122
- var Do=0
1123
- function Fo(e){var t=this
1124
- if(Oo(t),!me(t,e)&&!Cn(t.display,e)){xe(e),a&&(Do=+new Date)
1125
- var n=ur(t,e,!0),r=e.dataTransfer.files
1120
+ Bi(e,(function(e){return r.push(e.id)}),!0),e.history=new Pi(null),e.history.done=Vi(this.history.done,r),e.history.undone=Vi(this.history.undone,r)}},iterLinkedDocs:function(e){Bi(this,e)},getMode:function(){return this.mode},getEditor:function(){return this.cm},splitLines:function(e){return this.lineSep?e.split(this.lineSep):Fe(e)},lineSeparator:function(){return this.lineSep||"\n"},setDirection:ri((function(e){var t
1121
+ "rtl"!=e&&(e="ltr"),e!=this.direction&&(this.direction=e,this.iter((function(e){return e.order=null})),this.cm&&ei(t=this.cm,(function(){Wi(t),dr(t)})))}))}),Do.prototype.eachLine=Do.prototype.iter
1122
+ var Fo=0
1123
+ function Oo(e){var t=this
1124
+ if(Io(t),!ge(t,e)&&!kn(t.display,e)){be(e),a&&(Fo=+new Date)
1125
+ var n=cr(t,e,!0),r=e.dataTransfer.files
1126
1126
  if(n&&!t.isReadOnly())if(r&&r.length&&window.FileReader&&window.File)for(var i=r.length,o=Array(i),l=0,s=function(e,r){if(!t.options.allowDropFileTypes||-1!=z(t.options.allowDropFileTypes,e.type)){var a=new FileReader
1127
- a.onload=ei(t,(function(){var e=a.result
1128
- if(/[\x00-\x08\x0e-\x1f]{2}/.test(e)&&(e=""),o[r]=e,++l==i){var s={from:n=lt(t.doc,n),to:n,text:t.doc.splitLines(o.join(t.doc.lineSeparator())),origin:"paste"}
1129
- so(t.doc,s),Zi(t.doc,Li(n,Ti(s)))}})),a.readAsText(e)}},u=0;u<i;++u)s(r[u],u)
1127
+ a.onload=ti(t,(function(){var e=a.result
1128
+ if(/[\x00-\x08\x0e-\x1f]{2}/.test(e)&&(e=""),o[r]=e,++l==i){var s={from:n=st(t.doc,n),to:n,text:t.doc.splitLines(o.join(t.doc.lineSeparator())),origin:"paste"}
1129
+ uo(t.doc,s),Qi(t.doc,Ti(n,Mi(s)))}})),a.readAsText(e)}},u=0;u<i;++u)s(r[u],u)
1130
1130
  else{if(t.state.draggingText&&t.doc.sel.contains(n)>-1)return t.state.draggingText(e),void setTimeout((function(){return t.display.input.focus()}),20)
1131
1131
  try{var c=e.dataTransfer.getData("Text")
1132
1132
  if(c){var f
1133
- if(t.state.draggingText&&!t.state.draggingText.copy&&(f=t.listSelections()),Ji(t.doc,Li(n,n)),f)for(var d=0;d<f.length;++d)po(t.doc,"",f[d].anchor,f[d].head,"drag")
1134
- t.replaceSelection(c,"around","paste"),t.display.input.focus()}}catch(e){}}}}function Oo(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function Io(e){if(document.getElementsByClassName){for(var t=document.getElementsByClassName("CodeMirror"),n=[],r=0;r<t.length;r++){var i=t[r].CodeMirror
1135
- i&&n.push(i)}n.length&&n[0].operation((function(){for(var t=0;t<n.length;t++)e(n[t])}))}}var Bo=!1
1136
- function Ho(e){var t=e.display
1137
- t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Wo={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"},Po=0;Po<10;Po++)Wo[Po+48]=Wo[Po+96]=String(Po)
1138
- for(var Ro=65;Ro<=90;Ro++)Wo[Ro]=String.fromCharCode(Ro)
1139
- for(var zo=1;zo<=12;zo++)Wo[zo+111]=Wo[zo+63235]="F"+zo
1140
- var jo={}
1141
- function _o(e){var t,n,r,i,o=e.split(/-(?!$)/)
1133
+ if(t.state.draggingText&&!t.state.draggingText.copy&&(f=t.listSelections()),eo(t.doc,Ti(n,n)),f)for(var d=0;d<f.length;++d)mo(t.doc,"",f[d].anchor,f[d].head,"drag")
1134
+ t.replaceSelection(c,"around","paste"),t.display.input.focus()}}catch(e){}}}}function Io(e){e.display.dragCursor&&(e.display.lineSpace.removeChild(e.display.dragCursor),e.display.dragCursor=null)}function Bo(e){if(document.getElementsByClassName){for(var t=document.getElementsByClassName("CodeMirror"),n=[],r=0;r<t.length;r++){var i=t[r].CodeMirror
1135
+ i&&n.push(i)}n.length&&n[0].operation((function(){for(var t=0;t<n.length;t++)e(n[t])}))}}var Ho=!1
1136
+ function Wo(e){var t=e.display
1137
+ t.cachedCharWidth=t.cachedTextHeight=t.cachedPaddingH=null,t.scrollbarsClipped=!1,e.setSize()}for(var Po={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"},Ro=0;Ro<10;Ro++)Po[Ro+48]=Po[Ro+96]=String(Ro)
1138
+ for(var zo=65;zo<=90;zo++)Po[zo]=String.fromCharCode(zo)
1139
+ for(var jo=1;jo<=12;jo++)Po[jo+111]=Po[jo+63235]="F"+jo
1140
+ var _o={}
1141
+ function Uo(e){var t,n,r,i,o=e.split(/-(?!$)/)
1142
1142
  e=o[o.length-1]
1143
1143
  for(var a=0;a<o.length-1;a++){var l=o[a]
1144
1144
  if(/^(cmd|meta|m)$/i.test(l))i=!0
1145
1145
  else if(/^a(lt)?$/i.test(l))t=!0
1146
1146
  else if(/^(c|ctrl|control)$/i.test(l))n=!0
1147
1147
  else{if(!/^s(hift)?$/i.test(l))throw new Error("Unrecognized modifier name: "+l)
1148
- r=!0}}return t&&(e="Alt-"+e),n&&(e="Ctrl-"+e),i&&(e="Cmd-"+e),r&&(e="Shift-"+e),e}function Uo(e){var t={}
1148
+ r=!0}}return t&&(e="Alt-"+e),n&&(e="Ctrl-"+e),i&&(e="Cmd-"+e),r&&(e="Shift-"+e),e}function qo(e){var t={}
1149
1149
  for(var n in e)if(e.hasOwnProperty(n)){var r=e[n]
1150
1150
  if(/^(name|fallthrough|(de|at)tach)$/.test(n))continue
1151
1151
  if("..."==r){delete e[n]
1152
- continue}for(var i=K(n.split(" "),_o),o=0;o<i.length;o++){var a=void 0,l=void 0
1152
+ continue}for(var i=Y(n.split(" "),Uo),o=0;o<i.length;o++){var a=void 0,l=void 0
1153
1153
  o==i.length-1?(l=i.join(" "),a=r):(l=i.slice(0,o+1).join(" "),a="...")
1154
1154
  var s=t[l]
1155
1155
  if(s){if(s!=a)throw new Error("Inconsistent bindings for "+l)}else t[l]=a}delete e[n]}for(var u in t)e[u]=t[u]
1156
- return e}function qo(e,t,n,r){var i=(t=Xo(t)).call?t.call(e,r):t[e]
1156
+ return e}function Go(e,t,n,r){var i=(t=Ko(t)).call?t.call(e,r):t[e]
1157
1157
  if(!1===i)return"nothing"
1158
1158
  if("..."===i)return"multi"
1159
1159
  if(null!=i&&n(i))return"handled"
1160
- if(t.fallthrough){if("[object Array]"!=Object.prototype.toString.call(t.fallthrough))return qo(e,t.fallthrough,n,r)
1161
- for(var o=0;o<t.fallthrough.length;o++){var a=qo(e,t.fallthrough[o],n,r)
1162
- if(a)return a}}}function Go(e){var t="string"==typeof e?e:Wo[e.keyCode]
1163
- return"Ctrl"==t||"Alt"==t||"Shift"==t||"Mod"==t}function Vo(e,t,n){var r=e
1164
- return t.altKey&&"Alt"!=r&&(e="Alt-"+e),(C?t.metaKey:t.ctrlKey)&&"Ctrl"!=r&&(e="Ctrl-"+e),(C?t.ctrlKey:t.metaKey)&&"Cmd"!=r&&(e="Cmd-"+e),!n&&t.shiftKey&&"Shift"!=r&&(e="Shift-"+e),e}function $o(e,t){if(f&&34==e.keyCode&&e.char)return!1
1165
- var n=Wo[e.keyCode]
1166
- return null!=n&&!e.altGraphKey&&(3==e.keyCode&&e.code&&(n=e.code),Vo(n,e,t))}function Xo(e){return"string"==typeof e?jo[e]:e}function Ko(e,t){for(var n=e.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var o=t(n[i]);r.length&&tt(o.from,X(r).to)<=0;){var a=r.pop()
1167
- if(tt(a.from,o.from)<0){o.from=a.from
1168
- break}}r.push(o)}Jr(e,(function(){for(var t=r.length-1;t>=0;t--)po(e.doc,"",r[t].from,r[t].to,"+delete")
1169
- Dr(e)}))}function Yo(e,t,n){var r=ie(e.text,t+n,n)
1170
- return r<0||r>e.text.length?null:r}function Zo(e,t,n){var r=Yo(e,t.ch,n)
1171
- return null==r?null:new et(t.line,r,n<0?"after":"before")}function Qo(e,t,n,r,i){if(e){var o=ue(n,t.doc.direction)
1172
- if(o){var a,l=i<0?X(o):o[0],s=i<0==(1==l.level)?"after":"before"
1173
- if(l.level>0||"rtl"==t.doc.direction){var u=Fn(t,n)
1160
+ if(t.fallthrough){if("[object Array]"!=Object.prototype.toString.call(t.fallthrough))return Go(e,t.fallthrough,n,r)
1161
+ for(var o=0;o<t.fallthrough.length;o++){var a=Go(e,t.fallthrough[o],n,r)
1162
+ if(a)return a}}}function Vo(e){var t="string"==typeof e?e:Po[e.keyCode]
1163
+ return"Ctrl"==t||"Alt"==t||"Shift"==t||"Mod"==t}function $o(e,t,n){var r=e
1164
+ return t.altKey&&"Alt"!=r&&(e="Alt-"+e),(C?t.metaKey:t.ctrlKey)&&"Ctrl"!=r&&(e="Ctrl-"+e),(C?t.ctrlKey:t.metaKey)&&"Cmd"!=r&&(e="Cmd-"+e),!n&&t.shiftKey&&"Shift"!=r&&(e="Shift-"+e),e}function Xo(e,t){if(f&&34==e.keyCode&&e.char)return!1
1165
+ var n=Po[e.keyCode]
1166
+ return null!=n&&!e.altGraphKey&&(3==e.keyCode&&e.code&&(n=e.code),$o(n,e,t))}function Ko(e){return"string"==typeof e?_o[e]:e}function Yo(e,t){for(var n=e.doc.sel.ranges,r=[],i=0;i<n.length;i++){for(var o=t(n[i]);r.length&&nt(o.from,K(r).to)<=0;){var a=r.pop()
1167
+ if(nt(a.from,o.from)<0){o.from=a.from
1168
+ break}}r.push(o)}ei(e,(function(){for(var t=r.length-1;t>=0;t--)mo(e.doc,"",r[t].from,r[t].to,"+delete")
1169
+ Fr(e)}))}function Zo(e,t,n){var r=oe(e.text,t+n,n)
1170
+ return r<0||r>e.text.length?null:r}function Qo(e,t,n){var r=Zo(e,t.ch,n)
1171
+ return null==r?null:new tt(t.line,r,n<0?"after":"before")}function Jo(e,t,n,r,i){if(e){var o=ce(n,t.doc.direction)
1172
+ if(o){var a,l=i<0?K(o):o[0],s=i<0==(1==l.level)?"after":"before"
1173
+ if(l.level>0||"rtl"==t.doc.direction){var u=On(t,n)
1174
1174
  a=i<0?n.text.length-1:0
1175
- var c=On(t,u,a).top
1176
- a=oe((function(e){return On(t,u,e).top==c}),i<0==(1==l.level)?l.from:l.to-1,a),"before"==s&&(a=Yo(n,a,1))}else a=i<0?l.to:l.from
1177
- return new et(r,a,s)}}return new et(r,i<0?n.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
1178
- var Jo={selectAll:ao,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),_)},killLine:function(e){return Ko(e,(function(t){if(t.empty()){var n=Ve(e.doc,t.head.line).text.length
1179
- return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:et(t.head.line+1,0)}:{from:t.head,to:et(t.head.line,n)}}return{from:t.from(),to:t.to()}}))},deleteLine:function(e){return Ko(e,(function(t){return{from:et(t.from().line,0),to:lt(e.doc,et(t.to().line+1,0))}}))},delLineLeft:function(e){return Ko(e,(function(e){return{from:et(e.from().line,0),to:e.from()}}))},delWrappedLineLeft:function(e){return Ko(e,(function(t){var n=e.charCoords(t.head,"div").top+5
1180
- return{from:e.coordsChar({left:0,top:n},"div"),to:t.from()}}))},delWrappedLineRight:function(e){return Ko(e,(function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div")
1181
- return{from:t.from(),to:r}}))},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 n=Ve(e.doc,t),r=function(e){for(var t;t=Bt(e);)e=t.find(1,!0).line
1175
+ var c=In(t,u,a).top
1176
+ a=ae((function(e){return In(t,u,e).top==c}),i<0==(1==l.level)?l.from:l.to-1,a),"before"==s&&(a=Zo(n,a,1))}else a=i<0?l.to:l.from
1177
+ return new tt(r,a,s)}}return new tt(r,i<0?n.text.length:0,i<0?"before":"after")}_o.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"},_o.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"},_o.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"},_o.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"]},_o.default=y?_o.macDefault:_o.pcDefault
1178
+ var ea={selectAll:lo,singleSelection:function(e){return e.setSelection(e.getCursor("anchor"),e.getCursor("head"),U)},killLine:function(e){return Yo(e,(function(t){if(t.empty()){var n=$e(e.doc,t.head.line).text.length
1179
+ return t.head.ch==n&&t.head.line<e.lastLine()?{from:t.head,to:tt(t.head.line+1,0)}:{from:t.head,to:tt(t.head.line,n)}}return{from:t.from(),to:t.to()}}))},deleteLine:function(e){return Yo(e,(function(t){return{from:tt(t.from().line,0),to:st(e.doc,tt(t.to().line+1,0))}}))},delLineLeft:function(e){return Yo(e,(function(e){return{from:tt(e.from().line,0),to:e.from()}}))},delWrappedLineLeft:function(e){return Yo(e,(function(t){var n=e.charCoords(t.head,"div").top+5
1180
+ return{from:e.coordsChar({left:0,top:n},"div"),to:t.from()}}))},delWrappedLineRight:function(e){return Yo(e,(function(t){var n=e.charCoords(t.head,"div").top+5,r=e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div")
1181
+ return{from:t.from(),to:r}}))},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(tt(e.firstLine(),0))},goDocEnd:function(e){return e.extendSelection(tt(e.lastLine()))},goLineStart:function(e){return e.extendSelectionsBy((function(t){return ta(e,t.head.line)}),{origin:"+move",bias:1})},goLineStartSmart:function(e){return e.extendSelectionsBy((function(t){return na(e,t.head)}),{origin:"+move",bias:1})},goLineEnd:function(e){return e.extendSelectionsBy((function(t){return function(e,t){var n=$e(e.doc,t),r=function(e){for(var t;t=Ht(e);)e=t.find(1,!0).line
1182
1182
  return e}(n)
1183
- return r!=n&&(t=Ye(r)),Qo(!0,e,n,t,-1)}(e,t.head.line)}),{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy((function(t){var n=e.cursorCoords(t.head,"div").top+5
1184
- return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div")}),q)},goLineLeft:function(e){return e.extendSelectionsBy((function(t){var n=e.cursorCoords(t.head,"div").top+5
1185
- return e.coordsChar({left:0,top:n},"div")}),q)},goLineLeftSmart:function(e){return e.extendSelectionsBy((function(t){var n=e.cursorCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div")
1186
- return r.ch<e.getLine(r.line).search(/\S/)?ta(e,t.head):r}),q)},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=[],n=e.listSelections(),r=e.options.tabSize,i=0;i<n.length;i++){var o=n[i].from(),a=P(e.getLine(o.line),o.ch,r)
1187
- t.push($(r-a%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return Jr(e,(function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++)if(t[r].empty()){var i=t[r].head,o=Ve(e.doc,i.line).text
1188
- 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")
1189
- else if(i.line>e.doc.first){var a=Ve(e.doc,i.line-1).text
1190
- 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"))}n.push(new ki(i,i))}e.setSelections(n)}))},newlineAndIndent:function(e){return Jr(e,(function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input")
1183
+ return r!=n&&(t=Ze(r)),Jo(!0,e,n,t,-1)}(e,t.head.line)}),{origin:"+move",bias:-1})},goLineRight:function(e){return e.extendSelectionsBy((function(t){var n=e.cursorCoords(t.head,"div").top+5
1184
+ return e.coordsChar({left:e.display.lineDiv.offsetWidth+100,top:n},"div")}),G)},goLineLeft:function(e){return e.extendSelectionsBy((function(t){var n=e.cursorCoords(t.head,"div").top+5
1185
+ return e.coordsChar({left:0,top:n},"div")}),G)},goLineLeftSmart:function(e){return e.extendSelectionsBy((function(t){var n=e.cursorCoords(t.head,"div").top+5,r=e.coordsChar({left:0,top:n},"div")
1186
+ return r.ch<e.getLine(r.line).search(/\S/)?na(e,t.head):r}),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=[],n=e.listSelections(),r=e.options.tabSize,i=0;i<n.length;i++){var o=n[i].from(),a=P(e.getLine(o.line),o.ch,r)
1187
+ t.push(X(r-a%r))}e.replaceSelections(t)},defaultTab:function(e){e.somethingSelected()?e.indentSelection("add"):e.execCommand("insertTab")},transposeChars:function(e){return ei(e,(function(){for(var t=e.listSelections(),n=[],r=0;r<t.length;r++)if(t[r].empty()){var i=t[r].head,o=$e(e.doc,i.line).text
1188
+ if(o)if(i.ch==o.length&&(i=new tt(i.line,i.ch-1)),i.ch>0)i=new tt(i.line,i.ch+1),e.replaceRange(o.charAt(i.ch-1)+o.charAt(i.ch-2),tt(i.line,i.ch-2),i,"+transpose")
1189
+ else if(i.line>e.doc.first){var a=$e(e.doc,i.line-1).text
1190
+ a&&(i=new tt(i.line,1),e.replaceRange(o.charAt(0)+e.doc.lineSeparator()+a.charAt(a.length-1),tt(i.line-1,a.length-1),i,"+transpose"))}n.push(new Si(i,i))}e.setSelections(n)}))},newlineAndIndent:function(e){return ei(e,(function(){for(var t=e.listSelections(),n=t.length-1;n>=0;n--)e.replaceRange(e.doc.lineSeparator(),t[n].anchor,t[n].head,"+input")
1191
1191
  t=e.listSelections()
1192
1192
  for(var r=0;r<t.length;r++)e.indentLine(t[r].from().line,null,!0)
1193
- Dr(e)}))},openLine:function(e){return e.replaceSelection("\n","start")},toggleOverwrite:function(e){return e.toggleOverwrite()}}
1194
- function ea(e,t){var n=Ve(e.doc,t),r=Pt(n)
1195
- return r!=n&&(t=Ye(r)),Qo(!0,e,r,t,1)}function ta(e,t){var n=ea(e,t.line),r=Ve(e.doc,n.line),i=ue(r,e.doc.direction)
1193
+ Fr(e)}))},openLine:function(e){return e.replaceSelection("\n","start")},toggleOverwrite:function(e){return e.toggleOverwrite()}}
1194
+ function ta(e,t){var n=$e(e.doc,t),r=Rt(n)
1195
+ return r!=n&&(t=Ze(r)),Jo(!0,e,r,t,1)}function na(e,t){var n=ta(e,t.line),r=$e(e.doc,n.line),i=ce(r,e.doc.direction)
1196
1196
  if(!i||0==i[0].level){var o=Math.max(0,r.text.search(/\S/)),a=t.line==n.line&&t.ch<=o&&t.ch
1197
- return et(n.line,a?0:o,n.sticky)}return n}function na(e,t,n){if("string"==typeof t&&!(t=Jo[t]))return!1
1197
+ return tt(n.line,a?0:o,n.sticky)}return n}function ra(e,t,n){if("string"==typeof t&&!(t=ea[t]))return!1
1198
1198
  e.display.input.ensurePolled()
1199
1199
  var r=e.display.shift,i=!1
1200
- try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),i=t(e)!=j}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}var ra=new R
1201
- function ia(e,t,n,r){var i=e.state.keySeq
1202
- if(i){if(Go(t))return"handled"
1203
- if(/\'$/.test(t)?e.state.keySeq=null:ra.set(50,(function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())})),oa(e,i+" "+t,n,r))return!0}return oa(e,t,n,r)}function oa(e,t,n,r){var i=function(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var i=qo(t,e.state.keyMaps[r],n,e)
1204
- if(i)return i}return e.options.extraKeys&&qo(t,e.options.extraKeys,n,e)||qo(t,e.options.keyMap,n,e)}(e,t,r)
1205
- return"multi"==i&&(e.state.keySeq=t),"handled"==i&&sn(e,"keyHandled",e,t,n),"handled"!=i&&"multi"!=i||(xe(n),wr(e)),!!i}function aa(e,t){var n=$o(t,!0)
1206
- return!!n&&(t.shiftKey&&!e.state.keySeq?ia(e,"Shift-"+n,t,(function(t){return na(e,t,!0)}))||ia(e,n,t,(function(t){if("string"==typeof t?/^go[A-Z]/.test(t):t.motion)return na(e,t)})):ia(e,n,t,(function(t){return na(e,t)})))}var la=null
1207
- function sa(e){var t=this
1208
- if(t.curOp.focus=F(),!me(t,e)){a&&l<11&&27==e.keyCode&&(e.returnValue=!1)
1200
+ try{e.isReadOnly()&&(e.state.suppressEdits=!0),n&&(e.display.shift=!1),i=t(e)!=_}finally{e.display.shift=r,e.state.suppressEdits=!1}return i}var ia=new R
1201
+ function oa(e,t,n,r){var i=e.state.keySeq
1202
+ if(i){if(Vo(t))return"handled"
1203
+ if(/\'$/.test(t)?e.state.keySeq=null:ia.set(50,(function(){e.state.keySeq==i&&(e.state.keySeq=null,e.display.input.reset())})),aa(e,i+" "+t,n,r))return!0}return aa(e,t,n,r)}function aa(e,t,n,r){var i=function(e,t,n){for(var r=0;r<e.state.keyMaps.length;r++){var i=Go(t,e.state.keyMaps[r],n,e)
1204
+ if(i)return i}return e.options.extraKeys&&Go(t,e.options.extraKeys,n,e)||Go(t,e.options.keyMap,n,e)}(e,t,r)
1205
+ return"multi"==i&&(e.state.keySeq=t),"handled"==i&&un(e,"keyHandled",e,t,n),"handled"!=i&&"multi"!=i||(be(n),Cr(e)),!!i}function la(e,t){var n=Xo(t,!0)
1206
+ return!!n&&(t.shiftKey&&!e.state.keySeq?oa(e,"Shift-"+n,t,(function(t){return ra(e,t,!0)}))||oa(e,n,t,(function(t){if("string"==typeof t?/^go[A-Z]/.test(t):t.motion)return ra(e,t)})):oa(e,n,t,(function(t){return ra(e,t)})))}var sa=null
1207
+ function ua(e){var t=this
1208
+ if(t.curOp.focus=F(),!ge(t,e)){a&&l<11&&27==e.keyCode&&(e.returnValue=!1)
1209
1209
  var n=e.keyCode
1210
1210
  t.display.shift=16==n||e.shiftKey
1211
- var r=aa(t,e)
1212
- f&&(la=r?n:null,r||88!=n||Oe||!(y?e.metaKey:e.ctrlKey)||t.replaceSelection("",null,"cut")),18!=n||/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)||function(e){var t=e.display.lineDiv
1213
- function n(e){18!=e.keyCode&&e.altKey||(T(t,"CodeMirror-crosshair"),he(document,"keyup",n),he(document,"mouseover",n))}O(t,"CodeMirror-crosshair"),fe(document,"keyup",n),fe(document,"mouseover",n)}(t)}}function ua(e){16==e.keyCode&&(this.doc.sel.shift=!1),me(this,e)}function ca(e){var t=this
1214
- if(!(Cn(t.display,e)||me(t,e)||e.ctrlKey&&!e.altKey||y&&e.metaKey)){var n=e.keyCode,r=e.charCode
1215
- if(f&&n==la)return la=null,void xe(e)
1216
- if(!f||e.which&&!(e.which<10)||!aa(t,e)){var i=String.fromCharCode(null==r?n:r)
1217
- "\b"!=i&&(function(e,t,n){return ia(e,"'"+n+"'",t,(function(t){return na(e,t,!0)}))}(t,e,i)||t.display.input.onKeyPress(e))}}}var fa,da,ha=function(e,t,n){this.time=e,this.pos=t,this.button=n}
1218
- function pa(e){var t=this,n=t.display
1219
- if(!(me(t,e)||n.activeTouch&&n.input.supportsTouch()))if(n.input.ensurePolled(),n.shift=e.shiftKey,Cn(n,e))s||(n.scroller.draggable=!1,setTimeout((function(){return n.scroller.draggable=!0}),100))
1220
- else if(!va(t,e)){var r=ur(t,e),i=Se(e),o=r?function(e,t){var n=+new Date
1221
- return da&&da.compare(n,e,t)?(fa=da=null,"triple"):fa&&fa.compare(n,e,t)?(da=new ha(n,e,t),fa=null,"double"):(fa=new ha(n,e,t),da=null,"single")}(r,i):"single"
1211
+ var r=la(t,e)
1212
+ f&&(sa=r?n:null,r||88!=n||Ie||!(y?e.metaKey:e.ctrlKey)||t.replaceSelection("",null,"cut")),18!=n||/\bCodeMirror-crosshair\b/.test(t.display.lineDiv.className)||function(e){var t=e.display.lineDiv
1213
+ function n(e){18!=e.keyCode&&e.altKey||(T(t,"CodeMirror-crosshair"),pe(document,"keyup",n),pe(document,"mouseover",n))}O(t,"CodeMirror-crosshair"),de(document,"keyup",n),de(document,"mouseover",n)}(t)}}function ca(e){16==e.keyCode&&(this.doc.sel.shift=!1),ge(this,e)}function fa(e){var t=this
1214
+ if(!(kn(t.display,e)||ge(t,e)||e.ctrlKey&&!e.altKey||y&&e.metaKey)){var n=e.keyCode,r=e.charCode
1215
+ if(f&&n==sa)return sa=null,void be(e)
1216
+ if(!f||e.which&&!(e.which<10)||!la(t,e)){var i=String.fromCharCode(null==r?n:r)
1217
+ "\b"!=i&&(function(e,t,n){return oa(e,"'"+n+"'",t,(function(t){return ra(e,t,!0)}))}(t,e,i)||t.display.input.onKeyPress(e))}}}var da,ha,pa=function(e,t,n){this.time=e,this.pos=t,this.button=n}
1218
+ function ma(e){var t=this,n=t.display
1219
+ if(!(ge(t,e)||n.activeTouch&&n.input.supportsTouch()))if(n.input.ensurePolled(),n.shift=e.shiftKey,kn(n,e))s||(n.scroller.draggable=!1,setTimeout((function(){return n.scroller.draggable=!0}),100))
1220
+ else if(!ya(t,e)){var r=cr(t,e),i=Le(e),o=r?function(e,t){var n=+new Date
1221
+ return ha&&ha.compare(n,e,t)?(da=ha=null,"triple"):da&&da.compare(n,e,t)?(ha=new pa(n,e,t),da=null,"double"):(da=new pa(n,e,t),ha=null,"single")}(r,i):"single"
1222
1222
  window.focus(),1==i&&t.state.selectingText&&t.state.selectingText(e),r&&function(e,t,n,r,i){var o="Click"
1223
- return"double"==r?o="Double"+o:"triple"==r&&(o="Triple"+o),ia(e,Vo(o=(1==t?"Left":2==t?"Middle":"Right")+o,i),i,(function(t){if("string"==typeof t&&(t=Jo[t]),!t)return!1
1223
+ return"double"==r?o="Double"+o:"triple"==r&&(o="Triple"+o),oa(e,$o(o=(1==t?"Left":2==t?"Middle":"Right")+o,i),i,(function(t){if("string"==typeof t&&(t=ea[t]),!t)return!1
1224
1224
  var r=!1
1225
- try{e.isReadOnly()&&(e.state.suppressEdits=!0),r=t(e,n)!=j}finally{e.state.suppressEdits=!1}return r}))}(t,i,r,o,e)||(1==i?r?function(e,t,n,r){a?setTimeout(H(Cr,e),0):e.curOp.focus=F()
1225
+ try{e.isReadOnly()&&(e.state.suppressEdits=!0),r=t(e,n)!=_}finally{e.state.suppressEdits=!1}return r}))}(t,i,r,o,e)||(1==i?r?function(e,t,n,r){a?setTimeout(H(kr,e),0):e.curOp.focus=F()
1226
1226
  var i,o=function(e,t,n){var r=e.getOption("configureMouse"),i=r?r(e,t,n):{}
1227
1227
  if(null==i.unit){var o=x?n.shiftKey&&n.metaKey:n.altKey
1228
1228
  i.unit=o?"rectangle":"single"==t?"char":"double"==t?"word":"line"}return(null==i.extend||e.doc.extend)&&(i.extend=e.doc.extend||n.shiftKey),null==i.addNew&&(i.addNew=y?n.metaKey:n.ctrlKey),null==i.moveOnDrag&&(i.moveOnDrag=!(y?n.altKey:n.ctrlKey)),i}(e,n,r),u=e.doc.sel
1229
- e.options.dragDrop&&Me&&!e.isReadOnly()&&"single"==n&&(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,n,r){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",f),he(i.scroller,"drop",u),o||(xe(t),r.addNew||$i(e.doc,n,null,null,r.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},f=function(){return o=!0}
1230
- s&&(i.scroller.draggable=!0),e.state.draggingText=u,u.copy=!r.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),fe(i.wrapper.ownerDocument,"mouseup",u),fe(i.wrapper.ownerDocument,"mousemove",c),fe(i.scroller,"dragstart",f),fe(i.scroller,"drop",u),kr(e),setTimeout((function(){return i.input.focus()}),20)}(e,r,t,o):function(e,t,n,r){var i=e.display,o=e.doc
1231
- xe(t)
1229
+ e.options.dragDrop&&Ae&&!e.isReadOnly()&&"single"==n&&(i=u.contains(t))>-1&&(nt((i=u.ranges[i]).from(),t)<0||t.xRel>0)&&(nt(i.to(),t)>0||t.xRel<0)?function(e,t,n,r){var i=e.display,o=!1,u=ti(e,(function(t){s&&(i.scroller.draggable=!1),e.state.draggingText=!1,pe(i.wrapper.ownerDocument,"mouseup",u),pe(i.wrapper.ownerDocument,"mousemove",c),pe(i.scroller,"dragstart",f),pe(i.scroller,"drop",u),o||(be(t),r.addNew||Xi(e.doc,n,null,null,r.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},f=function(){return o=!0}
1230
+ s&&(i.scroller.draggable=!0),e.state.draggingText=u,u.copy=!r.moveOnDrag,i.scroller.dragDrop&&i.scroller.dragDrop(),de(i.wrapper.ownerDocument,"mouseup",u),de(i.wrapper.ownerDocument,"mousemove",c),de(i.scroller,"dragstart",f),de(i.scroller,"drop",u),Sr(e),setTimeout((function(){return i.input.focus()}),20)}(e,r,t,o):function(e,t,n,r){var i=e.display,o=e.doc
1231
+ be(t)
1232
1232
  var a,l,s=o.sel,u=s.ranges
1233
- if(r.addNew&&!r.extend?(l=o.sel.contains(n),a=l>-1?u[l]:new ki(n,n)):(a=o.sel.primary(),l=o.sel.primIndex),"rectangle"==r.unit)r.addNew||(a=new ki(n,n)),n=ur(e,t,!0,!0),l=-1
1234
- else{var c=ma(e,n,r.unit)
1235
- a=r.extend?Vi(a,c.anchor,c.head,r.extend):c}r.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"==r.unit&&!r.extend?(Qi(o,Si(e,u.slice(0,l).concat(u.slice(l+1)),0),{scroll:!1,origin:"*mouse"}),s=o.sel):Ki(o,l,a,U):(l=0,Qi(o,new Ci([a],0),U),s=o.sel)
1233
+ if(r.addNew&&!r.extend?(l=o.sel.contains(n),a=l>-1?u[l]:new Si(n,n)):(a=o.sel.primary(),l=o.sel.primIndex),"rectangle"==r.unit)r.addNew||(a=new Si(n,n)),n=cr(e,t,!0,!0),l=-1
1234
+ else{var c=ga(e,n,r.unit)
1235
+ a=r.extend?$i(a,c.anchor,c.head,r.extend):c}r.addNew?-1==l?(l=u.length,Ji(o,Li(e,u.concat([a]),l),{scroll:!1,origin:"*mouse"})):u.length>1&&u[l].empty()&&"char"==r.unit&&!r.extend?(Ji(o,Li(e,u.slice(0,l).concat(u.slice(l+1)),0),{scroll:!1,origin:"*mouse"}),s=o.sel):Yi(o,l,a,q):(l=0,Ji(o,new ki([a],0),q),s=o.sel)
1236
1236
  var f=n
1237
- function d(t){if(0!=tt(f,t))if(f=t,"rectangle"==r.unit){for(var i=[],u=e.options.tabSize,c=P(Ve(o,n.line).text,n.ch,u),d=P(Ve(o,t.line).text,t.ch,u),h=Math.min(c,d),p=Math.max(c,d),m=Math.min(n.line,t.line),g=Math.min(e.lastLine(),Math.max(n.line,t.line));m<=g;m++){var v=Ve(o,m).text,y=G(v,h,u)
1238
- h==p?i.push(new ki(et(m,y),et(m,y))):v.length>y&&i.push(new ki(et(m,y),et(m,G(v,p,u))))}i.length||i.push(new ki(n,n)),Qi(o,Si(e,s.ranges.slice(0,l).concat(i),l),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var x,b=a,w=ma(e,t,r.unit),C=b.anchor
1239
- tt(w.anchor,C)>0?(x=w.head,C=ot(b.from(),w.anchor)):(x=w.anchor,C=it(b.to(),w.head))
1237
+ function d(t){if(0!=nt(f,t))if(f=t,"rectangle"==r.unit){for(var i=[],u=e.options.tabSize,c=P($e(o,n.line).text,n.ch,u),d=P($e(o,t.line).text,t.ch,u),h=Math.min(c,d),p=Math.max(c,d),m=Math.min(n.line,t.line),g=Math.min(e.lastLine(),Math.max(n.line,t.line));m<=g;m++){var v=$e(o,m).text,y=V(v,h,u)
1238
+ h==p?i.push(new Si(tt(m,y),tt(m,y))):v.length>y&&i.push(new Si(tt(m,y),tt(m,V(v,p,u))))}i.length||i.push(new Si(n,n)),Ji(o,Li(e,s.ranges.slice(0,l).concat(i),l),{origin:"*mouse",scroll:!1}),e.scrollIntoView(t)}else{var x,b=a,w=ga(e,t,r.unit),C=b.anchor
1239
+ nt(w.anchor,C)>0?(x=w.head,C=at(b.from(),w.anchor)):(x=w.anchor,C=ot(b.to(),w.head))
1240
1240
  var k=s.ranges.slice(0)
1241
- k[l]=function(e,t){var n=t.anchor,r=t.head,i=Ve(e.doc,n.line)
1242
- if(0==tt(n,r)&&n.sticky==r.sticky)return t
1243
- var o=ue(i)
1241
+ k[l]=function(e,t){var n=t.anchor,r=t.head,i=$e(e.doc,n.line)
1242
+ if(0==nt(n,r)&&n.sticky==r.sticky)return t
1243
+ var o=ce(i)
1244
1244
  if(!o)return t
1245
- var a=le(o,n.ch,n.sticky),l=o[a]
1245
+ var a=se(o,n.ch,n.sticky),l=o[a]
1246
1246
  if(l.from!=n.ch&&l.to!=n.ch)return t
1247
1247
  var s,u=a+(l.from==n.ch==(1!=l.level)?0:1)
1248
1248
  if(0==u||u==o.length)return t
1249
1249
  if(r.line!=n.line)s=(r.line-n.line)*("ltr"==e.doc.direction?1:-1)>0
1250
- else{var c=le(o,r.ch,r.sticky),f=c-a||(r.ch-n.ch)*(1==l.level?-1:1)
1250
+ else{var c=se(o,r.ch,r.sticky),f=c-a||(r.ch-n.ch)*(1==l.level?-1:1)
1251
1251
  s=c==u-1||c==u?f<0:f>0}var d=o[u+(s?-1:0)],h=s==(1==d.level),p=h?d.from:d.to,m=h?"after":"before"
1252
- return n.ch==p&&n.sticky==m?t:new ki(new et(n.line,p,m),r)}(e,new ki(lt(o,C),x)),Qi(o,Si(e,k,l),U)}}var h=i.wrapper.getBoundingClientRect(),p=0
1253
- function m(t){var n=++p,a=ur(e,t,!0,"rectangle"==r.unit)
1254
- if(a)if(0!=tt(a,f)){e.curOp.focus=F(),d(a)
1255
- var l=Ar(i,o);(a.line>=l.to||a.line<l.from)&&setTimeout(ei(e,(function(){p==n&&m(t)})),150)}else{var s=t.clientY<h.top?-20:t.clientY>h.bottom?20:0
1256
- s&&setTimeout(ei(e,(function(){p==n&&(i.scroller.scrollTop+=s,m(t))})),50)}}function g(t){e.state.selectingText=!1,p=1/0,t&&(xe(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)?m(e):g(e)})),y=ei(e,g)
1257
- e.state.selectingText=y,fe(i.wrapper.ownerDocument,"mousemove",v),fe(i.wrapper.ownerDocument,"mouseup",y)}(e,r,t,o)}(t,r,o,e):ke(e)==n.scroller&&xe(e):2==i?(r&&$i(t.doc,r),setTimeout((function(){return n.input.focus()}),20)):3==i&&(k?t.display.input.onContextMenu(e):kr(t)))}}function ma(e,t,n){if("char"==n)return new ki(t,t)
1252
+ return n.ch==p&&n.sticky==m?t:new Si(new tt(n.line,p,m),r)}(e,new Si(st(o,C),x)),Ji(o,Li(e,k,l),q)}}var h=i.wrapper.getBoundingClientRect(),p=0
1253
+ function m(t){var n=++p,a=cr(e,t,!0,"rectangle"==r.unit)
1254
+ if(a)if(0!=nt(a,f)){e.curOp.focus=F(),d(a)
1255
+ var l=Nr(i,o);(a.line>=l.to||a.line<l.from)&&setTimeout(ti(e,(function(){p==n&&m(t)})),150)}else{var s=t.clientY<h.top?-20:t.clientY>h.bottom?20:0
1256
+ s&&setTimeout(ti(e,(function(){p==n&&(i.scroller.scrollTop+=s,m(t))})),50)}}function g(t){e.state.selectingText=!1,p=1/0,t&&(be(t),i.input.focus()),pe(i.wrapper.ownerDocument,"mousemove",v),pe(i.wrapper.ownerDocument,"mouseup",y),o.history.lastSelOrigin=null}var v=ti(e,(function(e){0!==e.buttons&&Le(e)?m(e):g(e)})),y=ti(e,g)
1257
+ e.state.selectingText=y,de(i.wrapper.ownerDocument,"mousemove",v),de(i.wrapper.ownerDocument,"mouseup",y)}(e,r,t,o)}(t,r,o,e):Se(e)==n.scroller&&be(e):2==i?(r&&Xi(t.doc,r),setTimeout((function(){return n.input.focus()}),20)):3==i&&(k?t.display.input.onContextMenu(e):Sr(t)))}}function ga(e,t,n){if("char"==n)return new Si(t,t)
1258
1258
  if("word"==n)return e.findWordAt(t)
1259
- if("line"==n)return new ki(et(t.line,0),lt(e.doc,et(t.line+1,0)))
1259
+ if("line"==n)return new Si(tt(t.line,0),st(e.doc,tt(t.line+1,0)))
1260
1260
  var r=n(e,t)
1261
- return new ki(r.from,r.to)}function ga(e,t,n,r){var i,o
1261
+ return new Si(r.from,r.to)}function va(e,t,n,r){var i,o
1262
1262
  if(t.touches)i=t.touches[0].clientX,o=t.touches[0].clientY
1263
1263
  else try{i=t.clientX,o=t.clientY}catch(t){return!1}if(i>=Math.floor(e.display.gutters.getBoundingClientRect().right))return!1
1264
- r&&xe(t)
1264
+ r&&be(t)
1265
1265
  var a=e.display,l=a.lineDiv.getBoundingClientRect()
1266
- if(o>l.bottom||!ve(e,n))return we(t)
1266
+ if(o>l.bottom||!ye(e,n))return Ce(t)
1267
1267
  o-=l.top-a.viewOffset
1268
1268
  for(var s=0;s<e.display.gutterSpecs.length;++s){var u=a.gutters.childNodes[s]
1269
- if(u&&u.getBoundingClientRect().right>=i)return pe(e,n,e,Ze(e.doc,o),e.display.gutterSpecs[s].className,t),we(t)}}function va(e,t){return ga(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-"),zn(e)}ha.prototype.compare=function(e,t,n){return this.time+400>e&&0==tt(t,this.pos)&&n==this.button}
1270
- var xa={toString:function(){return"CodeMirror.Init"}},ba={},wa={}
1271
- function Ca(e,t,n){if(!t!=!(n&&n!=xa)){var r=e.display.dragFunctions,i=t?fe:he
1272
- i(e.display.scroller,"dragstart",r.start),i(e.display.scroller,"dragenter",r.enter),i(e.display.scroller,"dragover",r.over),i(e.display.scroller,"dragleave",r.leave),i(e.display.scroller,"drop",r.drop)}}function ka(e){e.options.lineWrapping?(O(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(T(e.display.wrapper,"CodeMirror-wrap"),Gt(e)),sr(e),fr(e),zn(e),setTimeout((function(){return jr(e)}),100)}function Sa(e,t){var n=this
1273
- if(!(this instanceof Sa))return new Sa(e,t)
1274
- this.options=t=t?W(t):{},W(ba,t,!1)
1269
+ if(u&&u.getBoundingClientRect().right>=i)return me(e,n,e,Qe(e.doc,o),e.display.gutterSpecs[s].className,t),Ce(t)}}function ya(e,t){return va(e,t,"gutterClick",!0)}function xa(e){e.display.wrapper.className=e.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+e.options.theme.replace(/(^|\s)\s*/g," cm-s-"),jn(e)}pa.prototype.compare=function(e,t,n){return this.time+400>e&&0==nt(t,this.pos)&&n==this.button}
1270
+ var ba={toString:function(){return"CodeMirror.Init"}},wa={},Ca={}
1271
+ function ka(e,t,n){if(!t!=!(n&&n!=ba)){var r=e.display.dragFunctions,i=t?de:pe
1272
+ i(e.display.scroller,"dragstart",r.start),i(e.display.scroller,"dragenter",r.enter),i(e.display.scroller,"dragover",r.over),i(e.display.scroller,"dragleave",r.leave),i(e.display.scroller,"drop",r.drop)}}function Sa(e){e.options.lineWrapping?(O(e.display.wrapper,"CodeMirror-wrap"),e.display.sizer.style.minWidth="",e.display.sizerWidth=null):(T(e.display.wrapper,"CodeMirror-wrap"),Vt(e)),ur(e),dr(e),jn(e),setTimeout((function(){return _r(e)}),100)}function La(e,t){var n=this
1273
+ if(!(this instanceof La))return new La(e,t)
1274
+ this.options=t=t?W(t):{},W(wa,t,!1)
1275
1275
  var r=t.value
1276
- "string"==typeof r?r=new Eo(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r
1277
- var i=new Sa.inputStyles[t.inputStyle](this),o=this.display=new gi(e,r,i,t)
1278
- for(var u in o.wrapper.CodeMirror=this,ya(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),qr(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 n.display.input.reset(!0)}),20),function(e){var t=e.display
1279
- fe(t.scroller,"mousedown",ei(e,pa)),fe(t.scroller,"dblclick",a&&l<11?ei(e,(function(t){if(!me(e,t)){var n=ur(e,t)
1280
- if(n&&!va(e,t)&&!Cn(e.display,t)){xe(t)
1276
+ "string"==typeof r?r=new Do(r,t.mode,null,t.lineSeparator,t.direction):t.mode&&(r.modeOption=t.mode),this.doc=r
1277
+ var i=new La.inputStyles[t.inputStyle](this),o=this.display=new vi(e,r,i,t)
1278
+ for(var u in o.wrapper.CodeMirror=this,xa(this),t.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),Gr(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 n.display.input.reset(!0)}),20),function(e){var t=e.display
1279
+ de(t.scroller,"mousedown",ti(e,ma)),de(t.scroller,"dblclick",a&&l<11?ti(e,(function(t){if(!ge(e,t)){var n=cr(e,t)
1280
+ if(n&&!ya(e,t)&&!kn(e.display,t)){be(t)
1281
1281
  var r=e.findWordAt(n)
1282
- $i(e.doc,r.anchor,r.head)}}})):function(t){return me(e,t)||xe(t)}),fe(t.scroller,"contextmenu",(function(t){return function(e,t){Cn(e.display,t)||function(e,t){return!!ve(e,"gutterContextMenu")&&ga(e,t,"gutterContextMenu",!1)}(e,t)||me(e,t,"contextmenu")||k||e.display.input.onContextMenu(t)}(e,t)}))
1282
+ Xi(e.doc,r.anchor,r.head)}}})):function(t){return ge(e,t)||be(t)}),de(t.scroller,"contextmenu",(function(t){return function(e,t){kn(e.display,t)||function(e,t){return!!ye(e,"gutterContextMenu")&&va(e,t,"gutterContextMenu",!1)}(e,t)||ge(e,t,"contextmenu")||k||e.display.input.onContextMenu(t)}(e,t)}))
1283
1283
  var n,r={end:0}
1284
1284
  function i(){t.activeTouch&&(n=setTimeout((function(){return t.activeTouch=null}),1e3),(r=t.activeTouch).end=+new Date)}function o(e,t){if(null==t.left)return!0
1285
1285
  var n=t.left-e.left,r=t.top-e.top
1286
- return n*n+r*r>400}fe(t.scroller,"touchstart",(function(i){if(!me(e,i)&&!function(e){if(1!=e.touches.length)return!1
1286
+ return n*n+r*r>400}de(t.scroller,"touchstart",(function(i){if(!ge(e,i)&&!function(e){if(1!=e.touches.length)return!1
1287
1287
  var t=e.touches[0]
1288
- return t.radiusX<=1&&t.radiusY<=1}(i)&&!va(e,i)){t.input.ensurePolled(),clearTimeout(n)
1288
+ return t.radiusX<=1&&t.radiusY<=1}(i)&&!ya(e,i)){t.input.ensurePolled(),clearTimeout(n)
1289
1289
  var o=+new Date
1290
- t.activeTouch={start:o,moved:!1,prev:o-r.end<=300?r:null},1==i.touches.length&&(t.activeTouch.left=i.touches[0].pageX,t.activeTouch.top=i.touches[0].pageY)}})),fe(t.scroller,"touchmove",(function(){t.activeTouch&&(t.activeTouch.moved=!0)})),fe(t.scroller,"touchend",(function(n){var r=t.activeTouch
1291
- if(r&&!Cn(t,n)&&null!=r.left&&!r.moved&&new Date-r.start<300){var a,l=e.coordsChar(t.activeTouch,"page")
1292
- a=!r.prev||o(r,r.prev)?new ki(l,l):!r.prev.prev||o(r,r.prev.prev)?e.findWordAt(l):new ki(et(l.line,0),lt(e.doc,et(l.line+1,0))),e.setSelection(a.anchor,a.head),e.focus(),xe(n)}i()})),fe(t.scroller,"touchcancel",i),fe(t.scroller,"scroll",(function(){t.scroller.clientHeight&&(Br(e,t.scroller.scrollTop),Wr(e,t.scroller.scrollLeft,!0),pe(e,"scroll",e))})),fe(t.scroller,"mousewheel",(function(t){return wi(e,t)})),fe(t.scroller,"DOMMouseScroll",(function(t){return wi(e,t)})),fe(t.wrapper,"scroll",(function(){return t.wrapper.scrollTop=t.wrapper.scrollLeft=0})),t.dragFunctions={enter:function(t){me(e,t)||Ce(t)},over:function(t){me(e,t)||(function(e,t){var n=ur(e,t)
1290
+ t.activeTouch={start:o,moved:!1,prev:o-r.end<=300?r: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(n){var r=t.activeTouch
1291
+ if(r&&!kn(t,n)&&null!=r.left&&!r.moved&&new Date-r.start<300){var a,l=e.coordsChar(t.activeTouch,"page")
1292
+ a=!r.prev||o(r,r.prev)?new Si(l,l):!r.prev.prev||o(r,r.prev.prev)?e.findWordAt(l):new Si(tt(l.line,0),st(e.doc,tt(l.line+1,0))),e.setSelection(a.anchor,a.head),e.focus(),be(n)}i()})),de(t.scroller,"touchcancel",i),de(t.scroller,"scroll",(function(){t.scroller.clientHeight&&(Hr(e,t.scroller.scrollTop),Pr(e,t.scroller.scrollLeft,!0),me(e,"scroll",e))})),de(t.scroller,"mousewheel",(function(t){return Ci(e,t)})),de(t.scroller,"DOMMouseScroll",(function(t){return Ci(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 n=cr(e,t)
1293
1293
  if(n){var r=document.createDocumentFragment()
1294
- yr(e,n,r),e.display.dragCursor||(e.display.dragCursor=N("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),A(e.display.dragCursor,r)}}(e,t),Ce(t))},start:function(t){return function(e,t){if(a&&(!e.state.draggingText||+new Date-Do<100))Ce(t)
1295
- else if(!me(e,t)&&!Cn(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!d)){var n=N("img",null,null,"position: fixed; left: 0; top: 0;")
1296
- n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",f&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),f&&n.parentNode.removeChild(n)}}(e,t)},drop:ei(e,Fo),leave:function(t){me(e,t)||Oo(e)}}
1294
+ xr(e,n,r),e.display.dragCursor||(e.display.dragCursor=N("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),e.display.lineSpace.insertBefore(e.display.dragCursor,e.display.cursorDiv)),A(e.display.dragCursor,r)}}(e,t),ke(t))},start:function(t){return function(e,t){if(a&&(!e.state.draggingText||+new Date-Fo<100))ke(t)
1295
+ else if(!ge(e,t)&&!kn(e.display,t)&&(t.dataTransfer.setData("Text",e.getSelection()),t.dataTransfer.effectAllowed="copyMove",t.dataTransfer.setDragImage&&!d)){var n=N("img",null,null,"position: fixed; left: 0; top: 0;")
1296
+ n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",f&&(n.width=n.height=1,e.display.wrapper.appendChild(n),n._top=n.offsetTop),t.dataTransfer.setDragImage(n,0,0),f&&n.parentNode.removeChild(n)}}(e,t)},drop:ti(e,Oo),leave:function(t){ge(e,t)||Io(e)}}
1297
1297
  var s=t.input.getField()
1298
- fe(s,"keyup",(function(t){return ua.call(e,t)})),fe(s,"keydown",ei(e,sa)),fe(s,"keypress",ei(e,ca)),fe(s,"focus",(function(t){return Sr(e,t)})),fe(s,"blur",(function(t){return Lr(e,t)}))}(this),function(){var e
1299
- Bo||(fe(window,"resize",(function(){null==e&&(e=setTimeout((function(){e=null,Io(Ho)}),100))})),fe(window,"blur",(function(){return Io(Lr)})),Bo=!0)}(),Vr(this),this.curOp.forceUpdate=!0,Bi(this,r),t.autofocus&&!v||this.hasFocus()?setTimeout(H(Sr,this),20):Lr(this),wa)wa.hasOwnProperty(u)&&wa[u](n,t[u],xa)
1300
- di(this),t.finishInit&&t.finishInit(this)
1301
- for(var c=0;c<La.length;++c)La[c](n)
1302
- $r(this),s&&t.lineWrapping&&"optimizelegibility"==getComputedStyle(o.lineDiv).textRendering&&(o.lineDiv.style.textRendering="auto")}Sa.defaults=ba,Sa.optionHandlers=wa
1303
- var La=[]
1304
- function Ta(e,t,n,r){var i,o=e.doc
1305
- null==n&&(n="add"),"smart"==n&&(o.mode.indent?i=ht(e,t).state:n="prev")
1306
- var a=e.options.tabSize,l=Ve(o,t),s=P(l.text,null,a)
1298
+ de(s,"keyup",(function(t){return ca.call(e,t)})),de(s,"keydown",ti(e,ua)),de(s,"keypress",ti(e,fa)),de(s,"focus",(function(t){return Lr(e,t)})),de(s,"blur",(function(t){return Tr(e,t)}))}(this),function(){var e
1299
+ Ho||(de(window,"resize",(function(){null==e&&(e=setTimeout((function(){e=null,Bo(Wo)}),100))})),de(window,"blur",(function(){return Bo(Tr)})),Ho=!0)}(),$r(this),this.curOp.forceUpdate=!0,Hi(this,r),t.autofocus&&!v||this.hasFocus()?setTimeout(H(Lr,this),20):Tr(this),Ca)Ca.hasOwnProperty(u)&&Ca[u](n,t[u],ba)
1300
+ hi(this),t.finishInit&&t.finishInit(this)
1301
+ for(var c=0;c<Ta.length;++c)Ta[c](n)
1302
+ Xr(this),s&&t.lineWrapping&&"optimizelegibility"==getComputedStyle(o.lineDiv).textRendering&&(o.lineDiv.style.textRendering="auto")}La.defaults=wa,La.optionHandlers=Ca
1303
+ var Ta=[]
1304
+ function Ma(e,t,n,r){var i,o=e.doc
1305
+ null==n&&(n="add"),"smart"==n&&(o.mode.indent?i=pt(e,t).state:n="prev")
1306
+ var a=e.options.tabSize,l=$e(o,t),s=P(l.text,null,a)
1307
1307
  l.stateAfter&&(l.stateAfter=null)
1308
1308
  var u,c=l.text.match(/^\s*/)[0]
1309
- if(r||/\S/.test(l.text)){if("smart"==n&&((u=o.mode.indent(i,l.text.slice(c.length),l.text))==j||u>150)){if(!r)return
1309
+ if(r||/\S/.test(l.text)){if("smart"==n&&((u=o.mode.indent(i,l.text.slice(c.length),l.text))==_||u>150)){if(!r)return
1310
1310
  n="prev"}}else u=0,n="not"
1311
- "prev"==n?u=t>o.first?P(Ve(o,t-1).text,null,a):0:"add"==n?u=s+e.options.indentUnit:"subtract"==n?u=s-e.options.indentUnit:"number"==typeof n&&(u=s+n),u=Math.max(0,u)
1311
+ "prev"==n?u=t>o.first?P($e(o,t-1).text,null,a):0:"add"==n?u=s+e.options.indentUnit:"subtract"==n?u=s-e.options.indentUnit:"number"==typeof n&&(u=s+n),u=Math.max(0,u)
1312
1312
  var f="",d=0
1313
1313
  if(e.options.indentWithTabs)for(var h=Math.floor(u/a);h;--h)d+=a,f+="\t"
1314
- if(d<u&&(f+=$(u-d)),f!=c)return po(o,f,et(t,0),et(t,c.length),"+input"),l.stateAfter=null,!0
1314
+ if(d<u&&(f+=X(u-d)),f!=c)return mo(o,f,tt(t,0),tt(t,c.length),"+input"),l.stateAfter=null,!0
1315
1315
  for(var p=0;p<o.sel.ranges.length;p++){var m=o.sel.ranges[p]
1316
- if(m.head.line==t&&m.head.ch<c.length){var g=et(t,c.length)
1317
- Ki(o,p,new ki(g,g))
1318
- break}}}Sa.defineInitHook=function(e){return La.push(e)}
1319
- var Ma=null
1320
- function Aa(e){Ma=e}function Na(e,t,n,r,i){var o=e.doc
1316
+ if(m.head.line==t&&m.head.ch<c.length){var g=tt(t,c.length)
1317
+ Yi(o,p,new Si(g,g))
1318
+ break}}}La.defineInitHook=function(e){return Ta.push(e)}
1319
+ var Aa=null
1320
+ function Na(e){Aa=e}function Ea(e,t,n,r,i){var o=e.doc
1321
1321
  e.display.shift=!1,r||(r=o.sel)
1322
- var a=+new Date-200,l="paste"==i||e.state.pasteIncoming>a,s=De(t),u=null
1323
- if(l&&r.ranges.length>1)if(Ma&&Ma.text.join("\n")==t){if(r.ranges.length%Ma.text.length==0){u=[]
1324
- for(var c=0;c<Ma.text.length;c++)u.push(o.splitLines(Ma.text[c]))}}else s.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(u=K(s,(function(e){return[e]})))
1322
+ var a=+new Date-200,l="paste"==i||e.state.pasteIncoming>a,s=Fe(t),u=null
1323
+ if(l&&r.ranges.length>1)if(Aa&&Aa.text.join("\n")==t){if(r.ranges.length%Aa.text.length==0){u=[]
1324
+ for(var c=0;c<Aa.text.length;c++)u.push(o.splitLines(Aa.text[c]))}}else s.length==r.ranges.length&&e.options.pasteLinesPerSelection&&(u=Y(s,(function(e){return[e]})))
1325
1325
  for(var f=e.curOp.updateInput,d=r.ranges.length-1;d>=0;d--){var h=r.ranges[d],p=h.from(),m=h.to()
1326
- h.empty()&&(n&&n>0?p=et(p.line,p.ch-n):e.state.overwrite&&!l?m=et(m.line,Math.min(Ve(o,m.line).text.length,m.ch+X(s).length)):l&&Ma&&Ma.lineWise&&Ma.text.join("\n")==t&&(p=m=et(p.line,0)))
1326
+ h.empty()&&(n&&n>0?p=tt(p.line,p.ch-n):e.state.overwrite&&!l?m=tt(m.line,Math.min($e(o,m.line).text.length,m.ch+K(s).length)):l&&Aa&&Aa.lineWise&&Aa.text.join("\n")==t&&(p=m=tt(p.line,0)))
1327
1327
  var g={from:p,to:m,text:u?u[d%u.length]:s,origin:i||(l?"paste":e.state.cutIncoming>a?"cut":"+input")}
1328
- so(e.doc,g),sn(e,"inputRead",e,g)}t&&!l&&Da(e,t),Dr(e),e.curOp.updateInput<2&&(e.curOp.updateInput=f),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Ea(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text")
1329
- if(n)return e.preventDefault(),t.isReadOnly()||t.options.disableInput||Jr(t,(function(){return Na(t,n,0,null,"paste")})),!0}function Da(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r]
1328
+ uo(e.doc,g),un(e,"inputRead",e,g)}t&&!l&&Fa(e,t),Fr(e),e.curOp.updateInput<2&&(e.curOp.updateInput=f),e.curOp.typing=!0,e.state.pasteIncoming=e.state.cutIncoming=-1}function Da(e,t){var n=e.clipboardData&&e.clipboardData.getData("Text")
1329
+ if(n)return e.preventDefault(),t.isReadOnly()||t.options.disableInput||ei(t,(function(){return Ea(t,n,0,null,"paste")})),!0}function Fa(e,t){if(e.options.electricChars&&e.options.smartIndent)for(var n=e.doc.sel,r=n.ranges.length-1;r>=0;r--){var i=n.ranges[r]
1330
1330
  if(!(i.head.ch>100||r&&n.ranges[r-1].head.line==i.head.line)){var o=e.getModeAt(i.head),a=!1
1331
- 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")
1332
- break}}else o.electricInput&&o.electricInput.test(Ve(e.doc,i.head.line).text.slice(0,i.head.ch))&&(a=Ta(e,i.head.line,"smart"))
1333
- a&&sn(e,"electricInput",e,i.head.line)}}}function Fa(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,o={anchor:et(i,0),head:et(i+1,0)}
1334
- n.push(o),t.push(e.getRange(o.anchor,o.head))}return{text:t,ranges:n}}function Oa(e,t,n,r){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function Ia(){var e=N("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=N("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;")
1335
- return s?e.style.width="1000px":e.setAttribute("wrap","off"),m&&(e.style.border="1px solid black"),Oa(e),t}function Ba(e,t,n,r,i){var o=t,a=n,l=Ve(e,t.line)
1331
+ if(o.electricChars){for(var l=0;l<o.electricChars.length;l++)if(t.indexOf(o.electricChars.charAt(l))>-1){a=Ma(e,i.head.line,"smart")
1332
+ break}}else o.electricInput&&o.electricInput.test($e(e.doc,i.head.line).text.slice(0,i.head.ch))&&(a=Ma(e,i.head.line,"smart"))
1333
+ a&&un(e,"electricInput",e,i.head.line)}}}function Oa(e){for(var t=[],n=[],r=0;r<e.doc.sel.ranges.length;r++){var i=e.doc.sel.ranges[r].head.line,o={anchor:tt(i,0),head:tt(i+1,0)}
1334
+ n.push(o),t.push(e.getRange(o.anchor,o.head))}return{text:t,ranges:n}}function Ia(e,t,n,r){e.setAttribute("autocorrect",n?"":"off"),e.setAttribute("autocapitalize",r?"":"off"),e.setAttribute("spellcheck",!!t)}function Ba(){var e=N("textarea",null,null,"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none"),t=N("div",[e],null,"overflow: hidden; position: relative; width: 3px; height: 0px;")
1335
+ return s?e.style.width="1000px":e.setAttribute("wrap","off"),m&&(e.style.border="1px solid black"),Ia(e),t}function Ha(e,t,n,r,i){var o=t,a=n,l=$e(e,t.line)
1336
1336
  function s(r){var o,a
1337
- if(o=i?function(e,t,n,r){var i=ue(t,e.doc.direction)
1338
- if(!i)return Zo(t,n,r)
1337
+ if(o=i?function(e,t,n,r){var i=ce(t,e.doc.direction)
1338
+ if(!i)return Qo(t,n,r)
1339
1339
  n.ch>=t.text.length?(n.ch=t.text.length,n.sticky="before"):n.ch<=0&&(n.ch=0,n.sticky="after")
1340
- var o=le(i,n.ch,n.sticky),a=i[o]
1341
- if("ltr"==e.doc.direction&&a.level%2==0&&(r>0?a.to>n.ch:a.from<n.ch))return Zo(t,n,r)
1342
- var l,s=function(e,n){return Yo(t,e instanceof et?e.ch:e,n)},u=function(n){return e.options.lineWrapping?(l=l||Fn(e,t),Qn(e,t,l,n)):{begin:0,end:t.text.length}},c=u("before"==n.sticky?s(n,-1):n.ch)
1340
+ var o=se(i,n.ch,n.sticky),a=i[o]
1341
+ if("ltr"==e.doc.direction&&a.level%2==0&&(r>0?a.to>n.ch:a.from<n.ch))return Qo(t,n,r)
1342
+ var l,s=function(e,n){return Zo(t,e instanceof tt?e.ch:e,n)},u=function(n){return e.options.lineWrapping?(l=l||On(e,t),Jn(e,t,l,n)):{begin:0,end:t.text.length}},c=u("before"==n.sticky?s(n,-1):n.ch)
1343
1343
  if("rtl"==e.doc.direction||1==a.level){var f=1==a.level==r<0,d=s(n,f?1:-1)
1344
1344
  if(null!=d&&(f?d<=a.to&&d<=c.end:d>=a.from&&d>=c.begin)){var h=f?"before":"after"
1345
- return new et(n.line,d,h)}}var p=function(e,t,r){for(var o=function(e,t){return t?new et(n.line,s(e,1),"before"):new et(n.line,e,"after")};e>=0&&e<i.length;e+=t){var a=i[e],l=t>0==(1!=a.level),u=l?r.begin:s(r.end,-1)
1345
+ return new tt(n.line,d,h)}}var p=function(e,t,r){for(var o=function(e,t){return t?new tt(n.line,s(e,1),"before"):new tt(n.line,e,"after")};e>=0&&e<i.length;e+=t){var a=i[e],l=t>0==(1!=a.level),u=l?r.begin:s(r.end,-1)
1346
1346
  if(a.from<=u&&u<a.to)return o(u,l)
1347
1347
  if(u=l?a.from:s(a.to,-1),r.begin<=u&&u<r.end)return o(u,l)}},m=p(o+r,r,c)
1348
1348
  if(m)return m
1349
1349
  var g=r>0?c.end:s(c.begin,-1)
1350
- return null==g||r>0&&g==t.text.length||!(m=p(r>0?0:i.length-1,r,u(g)))?null:m}(e.cm,l,t,n):Zo(l,t,n),null==o){if(r||(a=t.line+n)<e.first||a>=e.first+e.size||(t=new et(a,t.ch,t.sticky),!(l=Ve(e,a))))return!1
1351
- t=Qo(i,e.cm,l,t.line,n)}else t=o
1350
+ return null==g||r>0&&g==t.text.length||!(m=p(r>0?0:i.length-1,r,u(g)))?null:m}(e.cm,l,t,n):Qo(l,t,n),null==o){if(r||(a=t.line+n)<e.first||a>=e.first+e.size||(t=new tt(a,t.ch,t.sticky),!(l=$e(e,a))))return!1
1351
+ t=Jo(i,e.cm,l,t.line,n)}else t=o
1352
1352
  return!0}if("char"==r)s()
1353
1353
  else if("column"==r)s(!0)
1354
- else if("word"==r||"group"==r)for(var u=null,c="group"==r,f=e.cm&&e.cm.getHelper(t,"wordChars"),d=!0;!(n<0)||s(!d);d=!1){var h=l.text.charAt(t.ch)||"\n",p=ee(h,f)?"w":c&&"\n"==h?"n":!c||/\s/.test(h)?null:"p"
1354
+ else if("word"==r||"group"==r)for(var u=null,c="group"==r,f=e.cm&&e.cm.getHelper(t,"wordChars"),d=!0;!(n<0)||s(!d);d=!1){var h=l.text.charAt(t.ch)||"\n",p=te(h,f)?"w":c&&"\n"==h?"n":!c||/\s/.test(h)?null:"p"
1355
1355
  if(!c||d||p||(p="s"),u&&u!=p){n<0&&(n=1,s(),t.sticky="after")
1356
- break}if(p&&(u=p),n>0&&!s(!d))break}var m=io(e,t,o,a,!0)
1357
- return nt(o,m)&&(m.hitSide=!0),m}function Ha(e,t,n,r){var i,o,a=e.doc,l=t.left
1358
- if("page"==r){var s=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),u=Math.max(s-.5*rr(e.display),3)
1356
+ break}if(p&&(u=p),n>0&&!s(!d))break}var m=oo(e,t,o,a,!0)
1357
+ return rt(o,m)&&(m.hitSide=!0),m}function Wa(e,t,n,r){var i,o,a=e.doc,l=t.left
1358
+ if("page"==r){var s=Math.min(e.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),u=Math.max(s-.5*ir(e.display),3)
1359
1359
  i=(n>0?t.bottom:t.top)+n*u}else"line"==r&&(i=n>0?t.bottom+3:t.top-3)
1360
- for(;(o=Yn(e,l,i)).outside;){if(n<0?i<=0:i>=a.height){o.hitSide=!0
1361
- break}i+=5*n}return o}var Wa=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}
1362
- function Pa(e,t){var n=Dn(e,t.line)
1360
+ for(;(o=Zn(e,l,i)).outside;){if(n<0?i<=0:i>=a.height){o.hitSide=!0
1361
+ break}i+=5*n}return o}var Pa=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}
1362
+ function Ra(e,t){var n=Fn(e,t.line)
1363
1363
  if(!n||n.hidden)return null
1364
- var r=Ve(e.doc,t.line),i=Nn(n,r,t.line),o=ue(r,e.doc.direction),a="left"
1365
- o&&(a=le(o,t.ch)%2?"right":"left")
1366
- var l=Hn(i.map,t.ch,a)
1367
- return l.offset="right"==l.collapse?l.end:l.start,l}function Ra(e,t){return t&&(e.bad=!0),e}function za(e,t,n){var r
1368
- if(t==e.display.lineDiv){if(!(r=e.display.lineDiv.childNodes[n]))return Ra(e.clipPos(et(e.display.viewTo-1)),!0)
1364
+ var r=$e(e.doc,t.line),i=En(n,r,t.line),o=ce(r,e.doc.direction),a="left"
1365
+ o&&(a=se(o,t.ch)%2?"right":"left")
1366
+ var l=Wn(i.map,t.ch,a)
1367
+ return l.offset="right"==l.collapse?l.end:l.start,l}function za(e,t){return t&&(e.bad=!0),e}function ja(e,t,n){var r
1368
+ if(t==e.display.lineDiv){if(!(r=e.display.lineDiv.childNodes[n]))return za(e.clipPos(tt(e.display.viewTo-1)),!0)
1369
1369
  t=null,n=0}else for(r=t;;r=r.parentNode){if(!r||r==e.display.lineDiv)return null
1370
1370
  if(r.parentNode&&r.parentNode==e.display.lineDiv)break}for(var i=0;i<e.display.view.length;i++){var o=e.display.view[i]
1371
- if(o.node==r)return ja(o,t,n)}}function ja(e,t,n){var r=e.text.firstChild,i=!1
1372
- if(!t||!D(r,t))return Ra(et(Ye(e.line),0),!0)
1373
- if(t==r&&(i=!0,t=r.childNodes[n],n=0,!t)){var o=e.rest?X(e.rest):e.line
1374
- return Ra(et(Ye(o),o.text.length),i)}var a=3==t.nodeType?t:null,l=t
1371
+ if(o.node==r)return _a(o,t,n)}}function _a(e,t,n){var r=e.text.firstChild,i=!1
1372
+ if(!t||!D(r,t))return za(tt(Ze(e.line),0),!0)
1373
+ if(t==r&&(i=!0,t=r.childNodes[n],n=0,!t)){var o=e.rest?K(e.rest):e.line
1374
+ return za(tt(Ze(o),o.text.length),i)}var a=3==t.nodeType?t:null,l=t
1375
1375
  for(a||1!=t.childNodes.length||3!=t.firstChild.nodeType||(a=t.firstChild,n&&(n=a.nodeValue.length));l.parentNode!=r;)l=l.parentNode
1376
1376
  var s=e.measure,u=s.maps
1377
1377
  function c(t,n,r){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]
1378
- if(l==t||l==n){var c=Ye(i<0?e.line:e.rest[i]),f=o[a]+r
1379
- return(r<0||l!=t)&&(f=o[a+(r?1:0)]),et(c,f)}}}var f=c(a,l,n)
1380
- if(f)return Ra(f,i)
1381
- for(var d=l.nextSibling,h=a?a.nodeValue.length-n:0;d;d=d.nextSibling){if(f=c(d,d.firstChild,0))return Ra(et(f.line,f.ch-h),i)
1382
- h+=d.textContent.length}for(var p=l.previousSibling,m=n;p;p=p.previousSibling){if(f=c(p,p.firstChild,-1))return Ra(et(f.line,f.ch+m),i)
1383
- m+=p.textContent.length}}Wa.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv
1384
- function o(e){if(!me(r,e)){if(r.somethingSelected())Aa({lineWise:!1,text:r.getSelections()}),"cut"==e.type&&r.replaceSelection("",null,"cut")
1378
+ if(l==t||l==n){var c=Ze(i<0?e.line:e.rest[i]),f=o[a]+r
1379
+ return(r<0||l!=t)&&(f=o[a+(r?1:0)]),tt(c,f)}}}var f=c(a,l,n)
1380
+ if(f)return za(f,i)
1381
+ for(var d=l.nextSibling,h=a?a.nodeValue.length-n:0;d;d=d.nextSibling){if(f=c(d,d.firstChild,0))return za(tt(f.line,f.ch-h),i)
1382
+ h+=d.textContent.length}for(var p=l.previousSibling,m=n;p;p=p.previousSibling){if(f=c(p,p.firstChild,-1))return za(tt(f.line,f.ch+m),i)
1383
+ m+=p.textContent.length}}Pa.prototype.init=function(e){var t=this,n=this,r=n.cm,i=n.div=e.lineDiv
1384
+ function o(e){if(!ge(r,e)){if(r.somethingSelected())Na({lineWise:!1,text:r.getSelections()}),"cut"==e.type&&r.replaceSelection("",null,"cut")
1385
1385
  else{if(!r.options.lineWiseCopyCut)return
1386
- var t=Fa(r)
1387
- Aa({lineWise:!0,text:t.text}),"cut"==e.type&&r.operation((function(){r.setSelections(t.ranges,0,_),r.replaceSelection("",null,"cut")}))}if(e.clipboardData){e.clipboardData.clearData()
1388
- var o=Ma.text.join("\n")
1389
- if(e.clipboardData.setData("Text",o),e.clipboardData.getData("Text")==o)return void e.preventDefault()}var a=Ia(),l=a.firstChild
1390
- r.display.lineSpace.insertBefore(a,r.display.lineSpace.firstChild),l.value=Ma.text.join("\n")
1386
+ var t=Oa(r)
1387
+ Na({lineWise:!0,text:t.text}),"cut"==e.type&&r.operation((function(){r.setSelections(t.ranges,0,U),r.replaceSelection("",null,"cut")}))}if(e.clipboardData){e.clipboardData.clearData()
1388
+ var o=Aa.text.join("\n")
1389
+ if(e.clipboardData.setData("Text",o),e.clipboardData.getData("Text")==o)return void e.preventDefault()}var a=Ba(),l=a.firstChild
1390
+ r.display.lineSpace.insertBefore(a,r.display.lineSpace.firstChild),l.value=Aa.text.join("\n")
1391
1391
  var s=document.activeElement
1392
- B(l),setTimeout((function(){r.display.lineSpace.removeChild(a),s.focus(),s==i&&n.showPrimarySelection()}),50)}}Oa(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize),fe(i,"paste",(function(e){me(r,e)||Ea(e,r)||l<=11&&setTimeout(ei(r,(function(){return t.updateFromDOM()})),20)})),fe(i,"compositionstart",(function(e){t.composing={data:e.data,done:!1}})),fe(i,"compositionupdate",(function(e){t.composing||(t.composing={data:e.data,done:!1})})),fe(i,"compositionend",(function(e){t.composing&&(e.data!=t.composing.data&&t.readFromDOMSoon(),t.composing.done=!0)})),fe(i,"touchstart",(function(){return n.forceCompositionEnd()})),fe(i,"input",(function(){t.composing||t.readFromDOMSoon()})),fe(i,"copy",o),fe(i,"cut",o)},Wa.prototype.prepareSelection=function(){var e=vr(this.cm,!1)
1393
- return e.focus=this.cm.state.focused,e},Wa.prototype.showSelection=function(e,t){e&&this.cm.display.view.length&&((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},Wa.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Wa.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,r=t.doc.sel.primary(),i=r.from(),o=r.to()
1392
+ B(l),setTimeout((function(){r.display.lineSpace.removeChild(a),s.focus(),s==i&&n.showPrimarySelection()}),50)}}Ia(i,r.options.spellcheck,r.options.autocorrect,r.options.autocapitalize),de(i,"paste",(function(e){ge(r,e)||Da(e,r)||l<=11&&setTimeout(ti(r,(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 n.forceCompositionEnd()})),de(i,"input",(function(){t.composing||t.readFromDOMSoon()})),de(i,"copy",o),de(i,"cut",o)},Pa.prototype.prepareSelection=function(){var e=yr(this.cm,!1)
1393
+ return e.focus=this.cm.state.focused,e},Pa.prototype.showSelection=function(e,t){e&&this.cm.display.view.length&&((e.focus||t)&&this.showPrimarySelection(),this.showMultipleSelections(e))},Pa.prototype.getSelection=function(){return this.cm.display.wrapper.ownerDocument.getSelection()},Pa.prototype.showPrimarySelection=function(){var e=this.getSelection(),t=this.cm,r=t.doc.sel.primary(),i=r.from(),o=r.to()
1394
1394
  if(t.display.viewTo==t.display.viewFrom||i.line>=t.display.viewTo||o.line<t.display.viewFrom)e.removeAllRanges()
1395
- else{var a=za(t,e.anchorNode,e.anchorOffset),l=za(t,e.focusNode,e.focusOffset)
1396
- 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&&Pa(t,i)||{node:s[0].measure.map[2],offset:0},c=o.line<t.display.viewTo&&Pa(t,o)
1395
+ else{var a=ja(t,e.anchorNode,e.anchorOffset),l=ja(t,e.focusNode,e.focusOffset)
1396
+ if(!a||a.bad||!l||l.bad||0!=nt(at(a,l),i)||0!=nt(ot(a,l),o)){var s=t.display.view,u=i.line>=t.display.viewFrom&&Ra(t,i)||{node:s[0].measure.map[2],offset:0},c=o.line<t.display.viewTo&&Ra(t,o)
1397
1397
  if(!c){var f=s[s.length-1].measure,d=f.maps?f.maps[f.maps.length-1]:f.map
1398
1398
  c={node:d[d.length-1],offset:d[d.length-2]-d[d.length-3]}}if(u&&c){var h,p=e.rangeCount&&e.getRangeAt(0)
1399
- try{h=L(u.node,u.offset,c.offset,c.node)}catch(e){}h&&(!n&&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):n&&this.startGracePeriod()),this.rememberSelection()}else e.removeAllRanges()}}},Wa.prototype.startGracePeriod=function(){var e=this
1400
- clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout((function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation((function(){return e.cm.curOp.selectionChanged=!0}))}),20)},Wa.prototype.showMultipleSelections=function(e){A(this.cm.display.cursorDiv,e.cursors),A(this.cm.display.selectionDiv,e.selection)},Wa.prototype.rememberSelection=function(){var e=this.getSelection()
1401
- this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Wa.prototype.selectionInEditor=function(){var e=this.getSelection()
1399
+ try{h=L(u.node,u.offset,c.offset,c.node)}catch(e){}h&&(!n&&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):n&&this.startGracePeriod()),this.rememberSelection()}else e.removeAllRanges()}}},Pa.prototype.startGracePeriod=function(){var e=this
1400
+ clearTimeout(this.gracePeriod),this.gracePeriod=setTimeout((function(){e.gracePeriod=!1,e.selectionChanged()&&e.cm.operation((function(){return e.cm.curOp.selectionChanged=!0}))}),20)},Pa.prototype.showMultipleSelections=function(e){A(this.cm.display.cursorDiv,e.cursors),A(this.cm.display.selectionDiv,e.selection)},Pa.prototype.rememberSelection=function(){var e=this.getSelection()
1401
+ this.lastAnchorNode=e.anchorNode,this.lastAnchorOffset=e.anchorOffset,this.lastFocusNode=e.focusNode,this.lastFocusOffset=e.focusOffset},Pa.prototype.selectionInEditor=function(){var e=this.getSelection()
1402
1402
  if(!e.rangeCount)return!1
1403
1403
  var t=e.getRangeAt(0).commonAncestorContainer
1404
- return D(this.div,t)},Wa.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()||this.showSelection(this.prepareSelection(),!0),this.div.focus())},Wa.prototype.blur=function(){this.div.blur()},Wa.prototype.getField=function(){return this.div},Wa.prototype.supportsTouch=function(){return!0},Wa.prototype.receivedFocus=function(){var e=this
1405
- this.selectionInEditor()?this.pollSelection():Jr(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))}))},Wa.prototype.selectionChanged=function(){var e=this.getSelection()
1406
- return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Wa.prototype.pollSelection=function(){if(null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var e=this.getSelection(),t=this.cm
1404
+ return D(this.div,t)},Pa.prototype.focus=function(){"nocursor"!=this.cm.options.readOnly&&(this.selectionInEditor()||this.showSelection(this.prepareSelection(),!0),this.div.focus())},Pa.prototype.blur=function(){this.div.blur()},Pa.prototype.getField=function(){return this.div},Pa.prototype.supportsTouch=function(){return!0},Pa.prototype.receivedFocus=function(){var e=this
1405
+ this.selectionInEditor()?this.pollSelection():ei(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))}))},Pa.prototype.selectionChanged=function(){var e=this.getSelection()
1406
+ return e.anchorNode!=this.lastAnchorNode||e.anchorOffset!=this.lastAnchorOffset||e.focusNode!=this.lastFocusNode||e.focusOffset!=this.lastFocusOffset},Pa.prototype.pollSelection=function(){if(null==this.readDOMTimeout&&!this.gracePeriod&&this.selectionChanged()){var e=this.getSelection(),t=this.cm
1407
1407
  if(g&&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
1408
1408
  return!1}(e.anchorNode))return this.cm.triggerOnKeyDown({type:"keydown",keyCode:8,preventDefault:Math.abs}),this.blur(),void this.focus()
1409
1409
  if(!this.composing){this.rememberSelection()
1410
- var n=za(t,e.anchorNode,e.anchorOffset),r=za(t,e.focusNode,e.focusOffset)
1411
- n&&r&&Jr(t,(function(){Qi(t.doc,Li(n,r),_),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)}))}}},Wa.prototype.pollContent=function(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null)
1410
+ var n=ja(t,e.anchorNode,e.anchorOffset),r=ja(t,e.focusNode,e.focusOffset)
1411
+ n&&r&&ei(t,(function(){Ji(t.doc,Ti(n,r),U),(n.bad||r.bad)&&(t.curOp.selectionChanged=!0)}))}}},Pa.prototype.pollContent=function(){null!=this.readDOMTimeout&&(clearTimeout(this.readDOMTimeout),this.readDOMTimeout=null)
1412
1412
  var e,t,n,r=this.cm,i=r.display,o=r.doc.sel.primary(),a=o.from(),l=o.to()
1413
- if(0==a.ch&&a.line>r.firstLine()&&(a=et(a.line-1,Ve(r.doc,a.line-1).length)),l.ch==Ve(r.doc,l.line).text.length&&l.line<r.lastLine()&&(l=et(l.line+1,0)),a.line<i.viewFrom||l.line>i.viewTo-1)return!1
1414
- a.line==i.viewFrom||0==(e=cr(r,a.line))?(t=Ye(i.view[0].line),n=i.view[0].node):(t=Ye(i.view[e].line),n=i.view[e-1].node.nextSibling)
1415
- var s,u,c=cr(r,l.line)
1416
- 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),!n)return!1
1413
+ if(0==a.ch&&a.line>r.firstLine()&&(a=tt(a.line-1,$e(r.doc,a.line-1).length)),l.ch==$e(r.doc,l.line).text.length&&l.line<r.lastLine()&&(l=tt(l.line+1,0)),a.line<i.viewFrom||l.line>i.viewTo-1)return!1
1414
+ a.line==i.viewFrom||0==(e=fr(r,a.line))?(t=Ze(i.view[0].line),n=i.view[0].node):(t=Ze(i.view[e].line),n=i.view[e-1].node.nextSibling)
1415
+ var s,u,c=fr(r,l.line)
1416
+ if(c==i.view.length-1?(s=i.viewTo-1,u=i.lineDiv.lastChild):(s=Ze(i.view[c+1].line)-1,u=i.view[c+1].node.previousSibling),!n)return!1
1417
1417
  for(var f=r.doc.splitLines(function(e,t,n,r,i){var o="",a=!1,l=e.doc.lineSeparator(),s=!1
1418
1418
  function u(){a&&(o+=l,s&&(o+=l),a=s=!1)}function c(e){e&&(u(),o+=e)}function f(t){if(1==t.nodeType){var n=t.getAttribute("cm-text")
1419
1419
  if(n)return void c(n)
1420
1420
  var o,d=t.getAttribute("cm-marker")
1421
- if(d){var h=e.findMarks(et(r,0),et(i+1,0),function(e){return function(t){return t.id==e}}(+d))
1422
- 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
1421
+ if(d){var h=e.findMarks(tt(r,0),tt(i+1,0),function(e){return function(t){return t.id==e}}(+d))
1422
+ return void(h.length&&(o=h[0].find(0))&&c(Xe(e.doc,o.from,o.to).join(l)))}if("false"==t.getAttribute("contenteditable"))return
1423
1423
  var p=/^(pre|div|p|li|table|br)$/i.test(t.nodeName)
1424
1424
  if(!/^br$/i.test(t.nodeName)&&0==t.textContent.length)return
1425
1425
  p&&u()
1426
1426
  for(var m=0;m<t.childNodes.length;m++)f(t.childNodes[m]);/^(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(;f(t),t!=n;)t=t.nextSibling,s=!1
1427
- return o}(r,n,u,t,s)),d=$e(r.doc,et(t,0),et(s,Ve(r.doc,s).text.length));f.length>1&&d.length>1;)if(X(f)==X(d))f.pop(),d.pop(),s--
1427
+ return o}(r,n,u,t,s)),d=Xe(r.doc,tt(t,0),tt(s,$e(r.doc,s).text.length));f.length>1&&d.length>1;)if(K(f)==K(d))f.pop(),d.pop(),s--
1428
1428
  else{if(f[0]!=d[0])break
1429
1429
  f.shift(),d.shift(),t++}for(var h=0,p=0,m=f[0],g=d[0],v=Math.min(m.length,g.length);h<v&&m.charCodeAt(h)==g.charCodeAt(h);)++h
1430
- for(var y=X(f),x=X(d),b=Math.min(y.length-(1==f.length?h:0),x.length-(1==d.length?h:0));p<b&&y.charCodeAt(y.length-p-1)==x.charCodeAt(x.length-p-1);)++p
1430
+ for(var y=K(f),x=K(d),b=Math.min(y.length-(1==f.length?h:0),x.length-(1==d.length?h:0));p<b&&y.charCodeAt(y.length-p-1)==x.charCodeAt(x.length-p-1);)++p
1431
1431
  if(1==f.length&&1==d.length&&t==a.line)for(;h&&h>a.ch&&y.charCodeAt(y.length-p-1)==x.charCodeAt(x.length-p-1);)h--,p++
1432
1432
  f[f.length-1]=y.slice(0,y.length-p).replace(/^\u200b+/,""),f[0]=f[0].slice(h).replace(/\u200b+$/,"")
1433
- var w=et(t,h),C=et(s,d.length?X(d).length-p:0)
1434
- return f.length>1||f[0]||tt(w,C)?(po(r.doc,f,w,C,"+input"),!0):void 0},Wa.prototype.ensurePolled=function(){this.forceCompositionEnd()},Wa.prototype.reset=function(){this.forceCompositionEnd()},Wa.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Wa.prototype.readFromDOMSoon=function(){var e=this
1433
+ var w=tt(t,h),C=tt(s,d.length?K(d).length-p:0)
1434
+ return f.length>1||f[0]||nt(w,C)?(mo(r.doc,f,w,C,"+input"),!0):void 0},Pa.prototype.ensurePolled=function(){this.forceCompositionEnd()},Pa.prototype.reset=function(){this.forceCompositionEnd()},Pa.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},Pa.prototype.readFromDOMSoon=function(){var e=this
1435
1435
  null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout((function(){if(e.readDOMTimeout=null,e.composing){if(!e.composing.done)return
1436
- e.composing=null}e.updateFromDOM()}),80))},Wa.prototype.updateFromDOM=function(){var e=this
1437
- !this.cm.isReadOnly()&&this.pollContent()||Jr(this.cm,(function(){return fr(e.cm)}))},Wa.prototype.setUneditable=function(e){e.contentEditable="false"},Wa.prototype.onKeyPress=function(e){0==e.charCode||this.composing||(e.preventDefault(),this.cm.isReadOnly()||ei(this.cm,Na)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},Wa.prototype.readOnlyChanged=function(e){this.div.contentEditable=String("nocursor"!=e)},Wa.prototype.onContextMenu=function(){},Wa.prototype.resetPosition=function(){},Wa.prototype.needsContentAttribute=!0
1438
- var _a=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new R,this.hasSelection=!1,this.composing=null}
1439
- _a.prototype.init=function(e){var t=this,n=this,r=this.cm
1436
+ e.composing=null}e.updateFromDOM()}),80))},Pa.prototype.updateFromDOM=function(){var e=this
1437
+ !this.cm.isReadOnly()&&this.pollContent()||ei(this.cm,(function(){return dr(e.cm)}))},Pa.prototype.setUneditable=function(e){e.contentEditable="false"},Pa.prototype.onKeyPress=function(e){0==e.charCode||this.composing||(e.preventDefault(),this.cm.isReadOnly()||ti(this.cm,Ea)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},Pa.prototype.readOnlyChanged=function(e){this.div.contentEditable=String("nocursor"!=e)},Pa.prototype.onContextMenu=function(){},Pa.prototype.resetPosition=function(){},Pa.prototype.needsContentAttribute=!0
1438
+ var Ua=function(e){this.cm=e,this.prevInput="",this.pollingFast=!1,this.polling=new R,this.hasSelection=!1,this.composing=null}
1439
+ Ua.prototype.init=function(e){var t=this,n=this,r=this.cm
1440
1440
  this.createField(e)
1441
1441
  var i=this.textarea
1442
- function o(e){if(!me(r,e)){if(r.somethingSelected())Aa({lineWise:!1,text:r.getSelections()})
1442
+ function o(e){if(!ge(r,e)){if(r.somethingSelected())Na({lineWise:!1,text:r.getSelections()})
1443
1443
  else{if(!r.options.lineWiseCopyCut)return
1444
- var t=Fa(r)
1445
- Aa({lineWise:!0,text:t.text}),"cut"==e.type?r.setSelections(t.ranges,null,_):(n.prevInput="",i.value=t.text.join("\n"),B(i))}"cut"==e.type&&(r.state.cutIncoming=+new Date)}}e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),m&&(i.style.width="0px"),fe(i,"input",(function(){a&&l>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()})),fe(i,"paste",(function(e){me(r,e)||Ea(e,r)||(r.state.pasteIncoming=+new Date,n.fastPoll())})),fe(i,"cut",o),fe(i,"copy",o),fe(e.scroller,"paste",(function(t){if(!Cn(e,t)&&!me(r,t)){if(!i.dispatchEvent)return r.state.pasteIncoming=+new Date,void n.focus()
1444
+ var t=Oa(r)
1445
+ Na({lineWise:!0,text:t.text}),"cut"==e.type?r.setSelections(t.ranges,null,U):(n.prevInput="",i.value=t.text.join("\n"),B(i))}"cut"==e.type&&(r.state.cutIncoming=+new Date)}}e.wrapper.insertBefore(this.wrapper,e.wrapper.firstChild),m&&(i.style.width="0px"),de(i,"input",(function(){a&&l>=9&&t.hasSelection&&(t.hasSelection=null),n.poll()})),de(i,"paste",(function(e){ge(r,e)||Da(e,r)||(r.state.pasteIncoming=+new Date,n.fastPoll())})),de(i,"cut",o),de(i,"copy",o),de(e.scroller,"paste",(function(t){if(!kn(e,t)&&!ge(r,t)){if(!i.dispatchEvent)return r.state.pasteIncoming=+new Date,void n.focus()
1446
1446
  var o=new Event("paste")
1447
- o.clipboardData=t.clipboardData,i.dispatchEvent(o)}})),fe(e.lineSpace,"selectstart",(function(t){Cn(e,t)||xe(t)})),fe(i,"compositionstart",(function(){var e=r.getCursor("from")
1448
- n.composing&&n.composing.range.clear(),n.composing={start:e,range:r.markText(e,r.getCursor("to"),{className:"CodeMirror-composing"})}})),fe(i,"compositionend",(function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)}))},_a.prototype.createField=function(e){this.wrapper=Ia(),this.textarea=this.wrapper.firstChild},_a.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=vr(e)
1449
- if(e.options.moveInputWithCursor){var i=$n(e,n.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),a=t.lineDiv.getBoundingClientRect()
1450
- r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+a.top-o.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+a.left-o.left))}return r},_a.prototype.showSelection=function(e){var t=this.cm.display
1451
- A(t.cursorDiv,e.cursors),A(t.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},_a.prototype.reset=function(e){if(!this.contextMenuPending&&!this.composing){var t=this.cm
1447
+ o.clipboardData=t.clipboardData,i.dispatchEvent(o)}})),de(e.lineSpace,"selectstart",(function(t){kn(e,t)||be(t)})),de(i,"compositionstart",(function(){var e=r.getCursor("from")
1448
+ n.composing&&n.composing.range.clear(),n.composing={start:e,range:r.markText(e,r.getCursor("to"),{className:"CodeMirror-composing"})}})),de(i,"compositionend",(function(){n.composing&&(n.poll(),n.composing.range.clear(),n.composing=null)}))},Ua.prototype.createField=function(e){this.wrapper=Ba(),this.textarea=this.wrapper.firstChild},Ua.prototype.prepareSelection=function(){var e=this.cm,t=e.display,n=e.doc,r=yr(e)
1449
+ if(e.options.moveInputWithCursor){var i=Xn(e,n.sel.primary().head,"div"),o=t.wrapper.getBoundingClientRect(),a=t.lineDiv.getBoundingClientRect()
1450
+ r.teTop=Math.max(0,Math.min(t.wrapper.clientHeight-10,i.top+a.top-o.top)),r.teLeft=Math.max(0,Math.min(t.wrapper.clientWidth-10,i.left+a.left-o.left))}return r},Ua.prototype.showSelection=function(e){var t=this.cm.display
1451
+ A(t.cursorDiv,e.cursors),A(t.selectionDiv,e.selection),null!=e.teTop&&(this.wrapper.style.top=e.teTop+"px",this.wrapper.style.left=e.teLeft+"px")},Ua.prototype.reset=function(e){if(!this.contextMenuPending&&!this.composing){var t=this.cm
1452
1452
  if(t.somethingSelected()){this.prevInput=""
1453
1453
  var n=t.getSelection()
1454
- this.textarea.value=n,t.state.focused&&B(this.textarea),a&&l>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",a&&l>=9&&(this.hasSelection=null))}},_a.prototype.getField=function(){return this.textarea},_a.prototype.supportsTouch=function(){return!1},_a.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!v||F()!=this.textarea))try{this.textarea.focus()}catch(e){}},_a.prototype.blur=function(){this.textarea.blur()},_a.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},_a.prototype.receivedFocus=function(){this.slowPoll()},_a.prototype.slowPoll=function(){var e=this
1455
- this.pollingFast||this.polling.set(this.cm.options.pollInterval,(function(){e.poll(),e.cm.state.focused&&e.slowPoll()}))},_a.prototype.fastPoll=function(){var e=!1,t=this
1456
- t.pollingFast=!0,t.polling.set(20,(function n(){t.poll()||e?(t.pollingFast=!1,t.slowPoll()):(e=!0,t.polling.set(60,n))}))},_a.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput
1457
- if(this.contextMenuPending||!t.state.focused||Fe(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1
1454
+ this.textarea.value=n,t.state.focused&&B(this.textarea),a&&l>=9&&(this.hasSelection=n)}else e||(this.prevInput=this.textarea.value="",a&&l>=9&&(this.hasSelection=null))}},Ua.prototype.getField=function(){return this.textarea},Ua.prototype.supportsTouch=function(){return!1},Ua.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!v||F()!=this.textarea))try{this.textarea.focus()}catch(e){}},Ua.prototype.blur=function(){this.textarea.blur()},Ua.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},Ua.prototype.receivedFocus=function(){this.slowPoll()},Ua.prototype.slowPoll=function(){var e=this
1455
+ this.pollingFast||this.polling.set(this.cm.options.pollInterval,(function(){e.poll(),e.cm.state.focused&&e.slowPoll()}))},Ua.prototype.fastPoll=function(){var e=!1,t=this
1456
+ t.pollingFast=!0,t.polling.set(20,(function n(){t.poll()||e?(t.pollingFast=!1,t.slowPoll()):(e=!0,t.polling.set(60,n))}))},Ua.prototype.poll=function(){var e=this,t=this.cm,n=this.textarea,r=this.prevInput
1457
+ if(this.contextMenuPending||!t.state.focused||Oe(n)&&!r&&!this.composing||t.isReadOnly()||t.options.disableInput||t.state.keySeq)return!1
1458
1458
  var i=n.value
1459
1459
  if(i==r&&!t.somethingSelected())return!1
1460
1460
  if(a&&l>=9&&this.hasSelection===i||y&&/[\uf700-\uf7ff]/.test(i))return t.display.input.reset(),!1
1461
1461
  if(t.doc.sel==t.display.selForContextMenu){var o=i.charCodeAt(0)
1462
1462
  if(8203!=o||r||(r="​"),8666==o)return this.reset(),this.cm.execCommand("undo")}for(var s=0,u=Math.min(r.length,i.length);s<u&&r.charCodeAt(s)==i.charCodeAt(s);)++s
1463
- return Jr(t,(function(){Na(t,i.slice(s),r.length-s,null,e.composing?"*compose":null),i.length>1e3||i.indexOf("\n")>-1?n.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},_a.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},_a.prototype.onKeyPress=function(){a&&l>=9&&(this.hasSelection=null),this.fastPoll()},_a.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea
1463
+ return ei(t,(function(){Ea(t,i.slice(s),r.length-s,null,e.composing?"*compose":null),i.length>1e3||i.indexOf("\n")>-1?n.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},Ua.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},Ua.prototype.onKeyPress=function(){a&&l>=9&&(this.hasSelection=null),this.fastPoll()},Ua.prototype.onContextMenu=function(e){var t=this,n=t.cm,r=n.display,i=t.textarea
1464
1464
  t.contextMenuPending&&t.contextMenuPending()
1465
- var o=ur(n,e),u=r.scroller.scrollTop
1466
- if(o&&!f){n.options.resetSelectionOnContextMenu&&-1==n.doc.sel.contains(o)&&ei(n,Qi)(n.doc,Li(o),_)
1465
+ var o=cr(n,e),u=r.scroller.scrollTop
1466
+ if(o&&!f){n.options.resetSelectionOnContextMenu&&-1==n.doc.sel.contains(o)&&ti(n,Ji)(n.doc,Ti(o),U)
1467
1467
  var c,d=i.style.cssText,h=t.wrapper.style.cssText,p=t.wrapper.offsetParent.getBoundingClientRect()
1468
- 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),r.input.focus(),s&&window.scrollTo(null,c),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=v,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll),a&&l>=9&&g(),k){Ce(e)
1469
- var m=function(){he(window,"mouseup",m),setTimeout(v,20)}
1470
- fe(window,"mouseup",m)}else setTimeout(v,50)}function g(){if(null!=i.selectionStart){var e=n.somethingSelected(),o="​"+(e?i.value:"")
1468
+ 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),r.input.focus(),s&&window.scrollTo(null,c),r.input.reset(),n.somethingSelected()||(i.value=t.prevInput=" "),t.contextMenuPending=v,r.selForContextMenu=n.doc.sel,clearTimeout(r.detectingSelectAll),a&&l>=9&&g(),k){ke(e)
1469
+ var m=function(){pe(window,"mouseup",m),setTimeout(v,20)}
1470
+ de(window,"mouseup",m)}else setTimeout(v,50)}function g(){if(null!=i.selectionStart){var e=n.somethingSelected(),o="​"+(e?i.value:"")
1471
1471
  i.value="⇚",i.value=o,t.prevInput=e?"":"​",i.selectionStart=1,i.selectionEnd=o.length,r.selForContextMenu=n.doc.sel}}function v(){if(t.contextMenuPending==v&&(t.contextMenuPending=!1,t.wrapper.style.cssText=h,i.style.cssText=d,a&&l<9&&r.scrollbars.setScrollTop(r.scroller.scrollTop=u),null!=i.selectionStart)){(!a||a&&l<9)&&g()
1472
- var e=0,o=function(){r.selForContextMenu==n.doc.sel&&0==i.selectionStart&&i.selectionEnd>0&&"​"==t.prevInput?ei(n,ao)(n):e++<10?r.detectingSelectAll=setTimeout(o,500):(r.selForContextMenu=null,r.input.reset())}
1473
- r.detectingSelectAll=setTimeout(o,200)}}},_a.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled="nocursor"==e},_a.prototype.setUneditable=function(){},_a.prototype.needsContentAttribute=!1,function(e){var t=e.optionHandlers
1474
- function n(n,r,i,o){e.defaults[n]=r,i&&(t[n]=o?function(e,t,n){n!=xa&&i(e,t,n)}:i)}e.defineOption=n,e.Init=xa,n("value","",(function(e,t){return e.setValue(t)}),!0),n("mode",null,(function(e,t){e.doc.modeOption=t,Ei(e)}),!0),n("indentUnit",2,Ei,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,(function(e){Di(e),zn(e),fr(e)}),!0),n("lineSeparator",null,(function(e,t){if(e.doc.lineSep=t,t){var n=[],r=e.doc.first
1472
+ var e=0,o=function(){r.selForContextMenu==n.doc.sel&&0==i.selectionStart&&i.selectionEnd>0&&"​"==t.prevInput?ti(n,lo)(n):e++<10?r.detectingSelectAll=setTimeout(o,500):(r.selForContextMenu=null,r.input.reset())}
1473
+ r.detectingSelectAll=setTimeout(o,200)}}},Ua.prototype.readOnlyChanged=function(e){e||this.reset(),this.textarea.disabled="nocursor"==e},Ua.prototype.setUneditable=function(){},Ua.prototype.needsContentAttribute=!1,function(e){var t=e.optionHandlers
1474
+ function n(n,r,i,o){e.defaults[n]=r,i&&(t[n]=o?function(e,t,n){n!=ba&&i(e,t,n)}:i)}e.defineOption=n,e.Init=ba,n("value","",(function(e,t){return e.setValue(t)}),!0),n("mode",null,(function(e,t){e.doc.modeOption=t,Di(e)}),!0),n("indentUnit",2,Di,!0),n("indentWithTabs",!1),n("smartIndent",!0),n("tabSize",4,(function(e){Fi(e),jn(e),dr(e)}),!0),n("lineSeparator",null,(function(e,t){if(e.doc.lineSep=t,t){var n=[],r=e.doc.first
1475
1475
  e.doc.iter((function(e){for(var i=0;;){var o=e.text.indexOf(t,i)
1476
1476
  if(-1==o)break
1477
- i=o+t.length,n.push(et(r,o))}r++}))
1478
- for(var i=n.length-1;i>=0;i--)po(e.doc,t,n[i],et(n[i].line,n[i].ch+t.length))}})),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,(function(e,t,n){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g"),n!=xa&&e.refresh()})),n("specialCharPlaceholder",Qt,(function(e){return e.refresh()}),!0),n("electricChars",!0),n("inputStyle",v?"contenteditable":"textarea",(function(){throw new Error("inputStyle can not (yet) be changed in a running editor")}),!0),n("spellcheck",!1,(function(e,t){return e.getInputField().spellcheck=t}),!0),n("autocorrect",!1,(function(e,t){return e.getInputField().autocorrect=t}),!0),n("autocapitalize",!1,(function(e,t){return e.getInputField().autocapitalize=t}),!0),n("rtlMoveVisually",!b),n("wholeLineUpdateBefore",!0),n("theme","default",(function(e){ya(e),mi(e)}),!0),n("keyMap","default",(function(e,t,n){var r=Xo(t),i=n!=xa&&Xo(n)
1479
- i&&i.detach&&i.detach(e,r),r.attach&&r.attach(e,i||null)})),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,ka,!0),n("gutters",[],(function(e,t){e.display.gutterSpecs=hi(t,e.options.lineNumbers),mi(e)}),!0),n("fixedGutter",!0,(function(e,t){e.display.gutters.style.left=t?ar(e.display)+"px":"0",e.refresh()}),!0),n("coverGutterNextToScrollbar",!1,(function(e){return jr(e)}),!0),n("scrollbarStyle","native",(function(e){qr(e),jr(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)}),!0),n("lineNumbers",!1,(function(e,t){e.display.gutterSpecs=hi(e.options.gutters,t),mi(e)}),!0),n("firstLineNumber",1,mi,!0),n("lineNumberFormatter",(function(e){return e}),mi,!0),n("showCursorWhenSelecting",!1,gr,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,(function(e,t){"nocursor"==t&&(Lr(e),e.display.input.blur()),e.display.input.readOnlyChanged(t)})),n("disableInput",!1,(function(e,t){t||e.display.input.reset()}),!0),n("dragDrop",!0,Ca),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,gr,!0),n("singleCursorHeightPerLine",!0,gr,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,Di,!0),n("addModeClass",!1,Di,!0),n("pollInterval",100),n("undoDepth",200,(function(e,t){return e.doc.history.undoDepth=t})),n("historyEventDelay",1250),n("viewportMargin",10,(function(e){return e.refresh()}),!0),n("maxHighlightLength",1e4,Di,!0),n("moveInputWithCursor",!0,(function(e,t){t||e.display.input.resetPosition()})),n("tabindex",null,(function(e,t){return e.display.input.getField().tabIndex=t||""})),n("autofocus",null),n("direction","ltr",(function(e,t){return e.doc.setDirection(t)}),!0),n("phrases",null)}(Sa),function(e){var t=e.optionHandlers,n=e.helpers={}
1477
+ i=o+t.length,n.push(tt(r,o))}r++}))
1478
+ for(var i=n.length-1;i>=0;i--)mo(e.doc,t,n[i],tt(n[i].line,n[i].ch+t.length))}})),n("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff\ufff9-\ufffc]/g,(function(e,t,n){e.state.specialChars=new RegExp(t.source+(t.test("\t")?"":"|\t"),"g"),n!=ba&&e.refresh()})),n("specialCharPlaceholder",Jt,(function(e){return e.refresh()}),!0),n("electricChars",!0),n("inputStyle",v?"contenteditable":"textarea",(function(){throw new Error("inputStyle can not (yet) be changed in a running editor")}),!0),n("spellcheck",!1,(function(e,t){return e.getInputField().spellcheck=t}),!0),n("autocorrect",!1,(function(e,t){return e.getInputField().autocorrect=t}),!0),n("autocapitalize",!1,(function(e,t){return e.getInputField().autocapitalize=t}),!0),n("rtlMoveVisually",!b),n("wholeLineUpdateBefore",!0),n("theme","default",(function(e){xa(e),gi(e)}),!0),n("keyMap","default",(function(e,t,n){var r=Ko(t),i=n!=ba&&Ko(n)
1479
+ i&&i.detach&&i.detach(e,r),r.attach&&r.attach(e,i||null)})),n("extraKeys",null),n("configureMouse",null),n("lineWrapping",!1,Sa,!0),n("gutters",[],(function(e,t){e.display.gutterSpecs=pi(t,e.options.lineNumbers),gi(e)}),!0),n("fixedGutter",!0,(function(e,t){e.display.gutters.style.left=t?lr(e.display)+"px":"0",e.refresh()}),!0),n("coverGutterNextToScrollbar",!1,(function(e){return _r(e)}),!0),n("scrollbarStyle","native",(function(e){Gr(e),_r(e),e.display.scrollbars.setScrollTop(e.doc.scrollTop),e.display.scrollbars.setScrollLeft(e.doc.scrollLeft)}),!0),n("lineNumbers",!1,(function(e,t){e.display.gutterSpecs=pi(e.options.gutters,t),gi(e)}),!0),n("firstLineNumber",1,gi,!0),n("lineNumberFormatter",(function(e){return e}),gi,!0),n("showCursorWhenSelecting",!1,vr,!0),n("resetSelectionOnContextMenu",!0),n("lineWiseCopyCut",!0),n("pasteLinesPerSelection",!0),n("selectionsMayTouch",!1),n("readOnly",!1,(function(e,t){"nocursor"==t&&(Tr(e),e.display.input.blur()),e.display.input.readOnlyChanged(t)})),n("disableInput",!1,(function(e,t){t||e.display.input.reset()}),!0),n("dragDrop",!0,ka),n("allowDropFileTypes",null),n("cursorBlinkRate",530),n("cursorScrollMargin",0),n("cursorHeight",1,vr,!0),n("singleCursorHeightPerLine",!0,vr,!0),n("workTime",100),n("workDelay",100),n("flattenSpans",!0,Fi,!0),n("addModeClass",!1,Fi,!0),n("pollInterval",100),n("undoDepth",200,(function(e,t){return e.doc.history.undoDepth=t})),n("historyEventDelay",1250),n("viewportMargin",10,(function(e){return e.refresh()}),!0),n("maxHighlightLength",1e4,Fi,!0),n("moveInputWithCursor",!0,(function(e,t){t||e.display.input.resetPosition()})),n("tabindex",null,(function(e,t){return e.display.input.getField().tabIndex=t||""})),n("autofocus",null),n("direction","ltr",(function(e,t){return e.doc.setDirection(t)}),!0),n("phrases",null)}(La),function(e){var t=e.optionHandlers,n=e.helpers={}
1480
1480
  e.prototype={constructor:e,focus:function(){window.focus(),this.display.input.focus()},setOption:function(e,n){var r=this.options,i=r[e]
1481
- r[e]==n&&"mode"!=e||(r[e]=n,t.hasOwnProperty(e)&&ei(this,t[e])(this,n,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"](Xo(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,n=0;n<t.length;++n)if(t[n]==e||t[n].name==e)return t.splice(n,1),!0},addOverlay:ti((function(t,n){var r=t.token?t:e.getMode(this.options,t)
1481
+ r[e]==n&&"mode"!=e||(r[e]=n,t.hasOwnProperty(e)&&ti(this,t[e])(this,n,i),me(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"](Ko(e))},removeKeyMap:function(e){for(var t=this.state.keyMaps,n=0;n<t.length;++n)if(t[n]==e||t[n].name==e)return t.splice(n,1),!0},addOverlay:ni((function(t,n){var r=t.token?t:e.getMode(this.options,t)
1482
1482
  if(r.startState)throw new Error("Overlays may not be stateful.")
1483
1483
  !function(e,t,n){for(var r=0,i=n(t);r<e.length&&n(e[r])<=i;)r++
1484
- e.splice(r,0,t)}(this.state.overlays,{mode:r,modeSpec:t,opaque:n&&n.opaque,priority:n&&n.priority||0},(function(e){return e.priority})),this.state.modeGen++,fr(this)})),removeOverlay:ti((function(e){for(var t=this.state.overlays,n=0;n<t.length;++n){var r=t[n].modeSpec
1485
- if(r==e||"string"==typeof e&&r.name==e)return t.splice(n,1),this.state.modeGen++,void fr(this)}})),indentLine:ti((function(e,t,n){"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,n)})),indentSelection:ti((function(e){for(var t=this,n=this.doc.sel.ranges,r=-1,i=0;i<n.length;i++){var o=n[i]
1486
- if(o.empty())o.head.line>r&&(Ta(t,o.head.line,e,!0),r=o.head.line,i==t.doc.sel.primIndex&&Dr(t))
1484
+ e.splice(r,0,t)}(this.state.overlays,{mode:r,modeSpec:t,opaque:n&&n.opaque,priority:n&&n.priority||0},(function(e){return e.priority})),this.state.modeGen++,dr(this)})),removeOverlay:ni((function(e){for(var t=this.state.overlays,n=0;n<t.length;++n){var r=t[n].modeSpec
1485
+ if(r==e||"string"==typeof e&&r.name==e)return t.splice(n,1),this.state.modeGen++,void dr(this)}})),indentLine:ni((function(e,t,n){"string"!=typeof t&&"number"!=typeof t&&(t=null==t?this.options.smartIndent?"smart":"prev":t?"add":"subtract"),Je(this.doc,e)&&Ma(this,e,t,n)})),indentSelection:ni((function(e){for(var t=this,n=this.doc.sel.ranges,r=-1,i=0;i<n.length;i++){var o=n[i]
1486
+ if(o.empty())o.head.line>r&&(Ma(t,o.head.line,e,!0),r=o.head.line,i==t.doc.sel.primIndex&&Fr(t))
1487
1487
  else{var a=o.from(),l=o.to(),s=Math.max(r,a.line)
1488
1488
  r=Math.min(t.lastLine(),l.line-(l.ch?0:1))+1
1489
- for(var u=s;u<r;++u)Ta(t,u,e)
1489
+ for(var u=s;u<r;++u)Ma(t,u,e)
1490
1490
  var c=t.doc.sel.ranges
1491
- 0==a.ch&&n.length==c.length&&c[i].from().ch>0&&Ki(t.doc,i,new ki(a,c[i].to()),_)}}})),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)
1492
- var t,n=dt(this,Ve(this.doc,e.line)),r=0,i=(n.length-1)/2,o=e.ch
1491
+ 0==a.ch&&n.length==c.length&&c[i].from().ch>0&&Yi(t.doc,i,new Si(a,c[i].to()),U)}}})),getTokenAt:function(e,t){return xt(this,e,t)},getLineTokens:function(e,t){return xt(this,tt(e),t,!0)},getTokenTypeAt:function(e){e=st(this.doc,e)
1492
+ var t,n=ht(this,$e(this.doc,e.line)),r=0,i=(n.length-1)/2,o=e.ch
1493
1493
  if(0==o)t=n[2]
1494
1494
  else for(;;){var a=r+i>>1
1495
1495
  if((a?n[2*a-1]:0)>=o)i=a
@@ -1504,47 +1504,47 @@ else if(o[t])for(var a=0;a<o[t].length;a++){var l=i[o[t][a]]
1504
1504
  l&&r.push(l)}else o.helperType&&i[o.helperType]?r.push(i[o.helperType]):i[o.name]&&r.push(i[o.name])
1505
1505
  for(var s=0;s<i._global.length;s++){var u=i._global[s]
1506
1506
  u.pred(o,this)&&-1==z(r,u.val)&&r.push(u.val)}return r},getStateAfter:function(e,t){var n=this.doc
1507
- return ht(this,(e=at(n,null==e?n.first+n.size-1:e))+1,t).state},cursorCoords:function(e,t){var n=this.doc.sel.primary()
1508
- return $n(this,null==e?n.head:"object"==typeof e?lt(this.doc,e):e?n.from():n.to(),t||"page")},charCoords:function(e,t){return Vn(this,lt(this.doc,e),t||"page")},coordsChar:function(e,t){return Yn(this,(e=Gn(this,e,t||"page")).left,e.top)},lineAtHeight:function(e,t){return e=Gn(this,{top:e,left:0},t||"page").top,Ze(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t,n){var r,i=!1
1507
+ return pt(this,(e=lt(n,null==e?n.first+n.size-1:e))+1,t).state},cursorCoords:function(e,t){var n=this.doc.sel.primary()
1508
+ return Xn(this,null==e?n.head:"object"==typeof e?st(this.doc,e):e?n.from():n.to(),t||"page")},charCoords:function(e,t){return $n(this,st(this.doc,e),t||"page")},coordsChar:function(e,t){return Zn(this,(e=Vn(this,e,t||"page")).left,e.top)},lineAtHeight:function(e,t){return e=Vn(this,{top:e,left:0},t||"page").top,Qe(this.doc,e+this.display.viewOffset)},heightAtLine:function(e,t,n){var r,i=!1
1509
1509
  if("number"==typeof e){var o=this.doc.first+this.doc.size-1
1510
- e<this.doc.first?e=this.doc.first:e>o&&(e=o,i=!0),r=Ve(this.doc,e)}else r=e
1511
- return qn(this,r,{top:0,left:0},t||"page",n||i).top+(i?this.doc.height-Ut(r):0)},defaultTextHeight:function(){return rr(this.display)},defaultCharWidth:function(){return ir(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,n,r,i){var o,a,l=this.display,s=(e=$n(this,lt(this.doc,e))).bottom,u=e.left
1510
+ e<this.doc.first?e=this.doc.first:e>o&&(e=o,i=!0),r=$e(this.doc,e)}else r=e
1511
+ return Gn(this,r,{top:0,left:0},t||"page",n||i).top+(i?this.doc.height-qt(r):0)},defaultTextHeight:function(){return ir(this.display)},defaultCharWidth:function(){return or(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(e,t,n,r,i){var o,a,l=this.display,s=(e=Xn(this,st(this.doc,e))).bottom,u=e.left
1512
1512
  if(t.style.position="absolute",t.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(t),l.sizer.appendChild(t),"over"==r)s=e.top
1513
- else if("above"==r||"near"==r){var c=Math.max(l.wrapper.clientHeight,this.doc.height),f=Math.max(l.sizer.clientWidth,l.lineSpace.clientWidth);("above"==r||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>f&&(u=f-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"),n&&(null!=(a=Nr(o=this,{left:u,top:s,right:u+t.offsetWidth,bottom:s+t.offsetHeight})).scrollTop&&Br(o,a.scrollTop),null!=a.scrollLeft&&Wr(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){Da(this,e)})),findPosH:function(e,t,n,r){var i=1
1513
+ else if("above"==r||"near"==r){var c=Math.max(l.wrapper.clientHeight,this.doc.height),f=Math.max(l.sizer.clientWidth,l.lineSpace.clientWidth);("above"==r||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>f&&(u=f-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"),n&&(null!=(a=Er(o=this,{left:u,top:s,right:u+t.offsetWidth,bottom:s+t.offsetHeight})).scrollTop&&Hr(o,a.scrollTop),null!=a.scrollLeft&&Pr(o,a.scrollLeft))},triggerOnKeyDown:ni(ua),triggerOnKeyPress:ni(fa),triggerOnKeyUp:ca,triggerOnMouseDown:ni(ma),execCommand:function(e){if(ea.hasOwnProperty(e))return ea[e].call(null,this)},triggerElectric:ni((function(e){Fa(this,e)})),findPosH:function(e,t,n,r){var i=1
1514
1514
  t<0&&(i=-1,t=-t)
1515
- for(var o=lt(this.doc,e),a=0;a<t&&!(o=Ba(this.doc,o,i,n,r)).hitSide;++a);return o},moveH:ti((function(e,t){var n=this
1516
- this.extendSelectionsBy((function(r){return n.display.shift||n.doc.extend||r.empty()?Ba(n.doc,r.head,e,t,n.options.rtlMoveVisually):e<0?r.from():r.to()}),q)})),deleteH:ti((function(e,t){var n=this.doc.sel,r=this.doc
1517
- n.somethingSelected()?r.replaceSelection("",null,"+delete"):Ko(this,(function(n){var i=Ba(r,n.head,e,t,!1)
1515
+ for(var o=st(this.doc,e),a=0;a<t&&!(o=Ha(this.doc,o,i,n,r)).hitSide;++a);return o},moveH:ni((function(e,t){var n=this
1516
+ this.extendSelectionsBy((function(r){return n.display.shift||n.doc.extend||r.empty()?Ha(n.doc,r.head,e,t,n.options.rtlMoveVisually):e<0?r.from():r.to()}),G)})),deleteH:ni((function(e,t){var n=this.doc.sel,r=this.doc
1517
+ n.somethingSelected()?r.replaceSelection("",null,"+delete"):Yo(this,(function(n){var i=Ha(r,n.head,e,t,!1)
1518
1518
  return e<0?{from:i,to:n.head}:{from:n.head,to:i}}))})),findPosV:function(e,t,n,r){var i=1,o=r
1519
1519
  t<0&&(i=-1,t=-t)
1520
- for(var a=lt(this.doc,e),l=0;l<t;++l){var s=$n(this,a,"div")
1521
- if(null==o?o=s.left:s.left=o,(a=Ha(this,s,i,n)).hitSide)break}return a},moveV:ti((function(e,t){var n=this,r=this.doc,i=[],o=!this.display.shift&&!r.extend&&r.sel.somethingSelected()
1520
+ for(var a=st(this.doc,e),l=0;l<t;++l){var s=Xn(this,a,"div")
1521
+ if(null==o?o=s.left:s.left=o,(a=Wa(this,s,i,n)).hitSide)break}return a},moveV:ni((function(e,t){var n=this,r=this.doc,i=[],o=!this.display.shift&&!r.extend&&r.sel.somethingSelected()
1522
1522
  if(r.extendSelectionsBy((function(a){if(o)return e<0?a.from():a.to()
1523
- var l=$n(n,a.head,"div")
1523
+ var l=Xn(n,a.head,"div")
1524
1524
  null!=a.goalColumn&&(l.left=a.goalColumn),i.push(l.left)
1525
- var s=Ha(n,l,e,t)
1526
- return"page"==t&&a==r.sel.primary()&&Er(n,Vn(n,s,"div").top-l.top),s}),q),i.length)for(var a=0;a<r.sel.ranges.length;a++)r.sel.ranges[a].goalColumn=i[a]})),findWordAt:function(e){var t=Ve(this.doc,e.line).text,n=e.ch,r=e.ch
1525
+ var s=Wa(n,l,e,t)
1526
+ return"page"==t&&a==r.sel.primary()&&Dr(n,$n(n,s,"div").top-l.top),s}),G),i.length)for(var a=0;a<r.sel.ranges.length;a++)r.sel.ranges[a].goalColumn=i[a]})),findWordAt:function(e){var t=$e(this.doc,e.line).text,n=e.ch,r=e.ch
1527
1527
  if(t){var i=this.getHelper(e,"wordChars")
1528
1528
  "before"!=e.sticky&&r!=t.length||!n?++r:--n
1529
- for(var o=t.charAt(n),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)};n>0&&a(t.charAt(n-1));)--n
1530
- for(;r<t.length&&a(t.charAt(r));)++r}return new ki(et(e.line,n),et(e.line,r))},toggleOverwrite:function(e){null!=e&&e==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?O(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()==F()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:ti((function(e,t){Fr(this,e,t)})),getScrollInfo:function(){var e=this.display.scroller
1531
- return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-Tn(this)-this.display.barHeight,width:e.scrollWidth-Tn(this)-this.display.barWidth,clientHeight:An(this),clientWidth:Mn(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){Or(e),e.curOp.scrollToPos=t}(this,e):Ir(this,e.from,e.to,e.margin)})),setSize:ti((function(e,t){var n=this,r=function(e){return"number"==typeof e||/^\d+$/.test(String(e))?e+"px":e}
1532
- null!=e&&(this.display.wrapper.style.width=r(e)),null!=t&&(this.display.wrapper.style.height=r(t)),this.options.lineWrapping&&Rn(this)
1529
+ for(var o=t.charAt(n),a=te(o,i)?function(e){return te(e,i)}:/\s/.test(o)?function(e){return/\s/.test(e)}:function(e){return!/\s/.test(e)&&!te(e)};n>0&&a(t.charAt(n-1));)--n
1530
+ for(;r<t.length&&a(t.charAt(r));)++r}return new Si(tt(e.line,n),tt(e.line,r))},toggleOverwrite:function(e){null!=e&&e==this.state.overwrite||((this.state.overwrite=!this.state.overwrite)?O(this.display.cursorDiv,"CodeMirror-overwrite"):T(this.display.cursorDiv,"CodeMirror-overwrite"),me(this,"overwriteToggle",this,this.state.overwrite))},hasFocus:function(){return this.display.input.getField()==F()},isReadOnly:function(){return!(!this.options.readOnly&&!this.doc.cantEdit)},scrollTo:ni((function(e,t){Or(this,e,t)})),getScrollInfo:function(){var e=this.display.scroller
1531
+ return{left:e.scrollLeft,top:e.scrollTop,height:e.scrollHeight-Mn(this)-this.display.barHeight,width:e.scrollWidth-Mn(this)-this.display.barWidth,clientHeight:Nn(this),clientWidth:An(this)}},scrollIntoView:ni((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:tt(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){Ir(e),e.curOp.scrollToPos=t}(this,e):Br(this,e.from,e.to,e.margin)})),setSize:ni((function(e,t){var n=this,r=function(e){return"number"==typeof e||/^\d+$/.test(String(e))?e+"px":e}
1532
+ null!=e&&(this.display.wrapper.style.width=r(e)),null!=t&&(this.display.wrapper.style.height=r(t)),this.options.lineWrapping&&zn(this)
1533
1533
  var i=this.display.viewFrom
1534
- 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){dr(n,i,"widget")
1535
- break}++i})),this.curOp.forceUpdate=!0,pe(this,"refresh",this)})),operation:function(e){return Jr(this,e)},startOperation:function(){return Vr(this)},endOperation:function(){return $r(this)},refresh:ti((function(){var e=this.display.cachedTextHeight
1536
- fr(this),this.curOp.forceUpdate=!0,zn(this),Fr(this,this.doc.scrollLeft,this.doc.scrollTop),ui(this.display),(null==e||Math.abs(e-rr(this.display))>.5)&&sr(this),pe(this,"refresh",this)})),swapDoc:ti((function(e){var t=this.doc
1537
- return t.cm=null,this.state.selectingText&&this.state.selectingText(),Bi(this,e),zn(this),this.display.input.reset(),Fr(this,e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,sn(this,"swapDoc",this,t),t})),phrase:function(e){var t=this.options.phrases
1538
- 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,r,i){n.hasOwnProperty(t)||(n[t]=e[t]={_global:[]}),n[t][r]=i},e.registerGlobalHelper=function(t,r,i,o){e.registerHelper(t,r,o),n[t]._global.push({pred:i,val:o})}}(Sa)
1539
- var Ua="iter insert remove copy getEditor constructor".split(" ")
1540
- for(var qa in Eo.prototype)Eo.prototype.hasOwnProperty(qa)&&z(Ua,qa)<0&&(Sa.prototype[qa]=function(e){return function(){return e.apply(this.doc,arguments)}}(Eo.prototype[qa]))
1541
- return ye(Eo),Sa.inputStyles={textarea:_a,contenteditable:Wa},Sa.defineMode=function(e){Sa.defaults.mode||"null"==e||(Sa.defaults.mode=e),We.apply(this,arguments)},Sa.defineMIME=function(e,t){He[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){Eo.prototype[e]=t},Sa.fromTextArea=function(e,t){if((t=t?W(t):{}).value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),null==t.autofocus){var n=F()
1534
+ 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){hr(n,i,"widget")
1535
+ break}++i})),this.curOp.forceUpdate=!0,me(this,"refresh",this)})),operation:function(e){return ei(this,e)},startOperation:function(){return $r(this)},endOperation:function(){return Xr(this)},refresh:ni((function(){var e=this.display.cachedTextHeight
1536
+ dr(this),this.curOp.forceUpdate=!0,jn(this),Or(this,this.doc.scrollLeft,this.doc.scrollTop),ci(this.display),(null==e||Math.abs(e-ir(this.display))>.5)&&ur(this),me(this,"refresh",this)})),swapDoc:ni((function(e){var t=this.doc
1537
+ return t.cm=null,this.state.selectingText&&this.state.selectingText(),Hi(this,e),jn(this),this.display.input.reset(),Or(this,e.scrollLeft,e.scrollTop),this.curOp.forceScroll=!0,un(this,"swapDoc",this,t),t})),phrase:function(e){var t=this.options.phrases
1538
+ 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}},xe(e),e.registerHelper=function(t,r,i){n.hasOwnProperty(t)||(n[t]=e[t]={_global:[]}),n[t][r]=i},e.registerGlobalHelper=function(t,r,i,o){e.registerHelper(t,r,o),n[t]._global.push({pred:i,val:o})}}(La)
1539
+ var qa="iter insert remove copy getEditor constructor".split(" ")
1540
+ for(var Ga in Do.prototype)Do.prototype.hasOwnProperty(Ga)&&z(qa,Ga)<0&&(La.prototype[Ga]=function(e){return function(){return e.apply(this.doc,arguments)}}(Do.prototype[Ga]))
1541
+ return xe(Do),La.inputStyles={textarea:Ua,contenteditable:Pa},La.defineMode=function(e){La.defaults.mode||"null"==e||(La.defaults.mode=e),Pe.apply(this,arguments)},La.defineMIME=function(e,t){We[e]=t},La.defineMode("null",(function(){return{token:function(e){return e.skipToEnd()}}})),La.defineMIME("text/plain","null"),La.defineExtension=function(e,t){La.prototype[e]=t},La.defineDocExtension=function(e,t){Do.prototype[e]=t},La.fromTextArea=function(e,t){if((t=t?W(t):{}).value=e.value,!t.tabindex&&e.tabIndex&&(t.tabindex=e.tabIndex),!t.placeholder&&e.placeholder&&(t.placeholder=e.placeholder),null==t.autofocus){var n=F()
1542
1542
  t.autofocus=n==e||null!=e.getAttribute("autofocus")&&n==document.body}function r(){e.value=l.getValue()}var i
1543
- if(e.form&&(fe(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var o=e.form
1543
+ if(e.form&&(de(e.form,"submit",r),!t.leaveSubmitMethodAlone)){var o=e.form
1544
1544
  i=o.submit
1545
- try{var a=o.submit=function(){r(),o.submit=i,o.submit(),o.submit=a}}catch(e){}}t.finishInit=function(t){t.save=r,t.getTextArea=function(){return e},t.toTextArea=function(){t.toTextArea=isNaN,r(),e.parentNode.removeChild(t.getWrapperElement()),e.style.display="",e.form&&(he(e.form,"submit",r),"function"==typeof e.form.submit&&(e.form.submit=i))}},e.style.display="none"
1546
- var l=Sa((function(t){return e.parentNode.insertBefore(t,e.nextSibling)}),t)
1547
- return l},function(e){e.off=he,e.on=fe,e.wheelEventPixels=bi,e.Doc=Eo,e.splitLines=De,e.countColumn=P,e.findColumn=G,e.isWordChar=J,e.Pass=j,e.signal=pe,e.Line=Vt,e.changeEnd=Ti,e.scrollbarModel=Ur,e.Pos=et,e.cmpPos=tt,e.modes=Be,e.mimeModes=He,e.resolveMode=Pe,e.getMode=Re,e.modeExtensions=ze,e.extendMode=je,e.copyState=_e,e.startState=qe,e.innerMode=Ue,e.commands=Jo,e.keyMap=jo,e.keyName=$o,e.isModifierKey=Go,e.lookupKey=qo,e.normalizeKeyMap=Uo,e.StringStream=Ge,e.SharedTextMarker=To,e.TextMarker=So,e.LineWidget=wo,e.e_preventDefault=xe,e.e_stopPropagation=be,e.e_stop=Ce,e.addClass=O,e.contains=D,e.rmClass=T,e.keyNames=Wo}(Sa),Sa.version="5.48.0",Sa}))},{}],11:[function(e,t,n){var r
1545
+ try{var a=o.submit=function(){r(),o.submit=i,o.submit(),o.submit=a}}catch(e){}}t.finishInit=function(t){t.save=r,t.getTextArea=function(){return e},t.toTextArea=function(){t.toTextArea=isNaN,r(),e.parentNode.removeChild(t.getWrapperElement()),e.style.display="",e.form&&(pe(e.form,"submit",r),"function"==typeof e.form.submit&&(e.form.submit=i))}},e.style.display="none"
1546
+ var l=La((function(t){return e.parentNode.insertBefore(t,e.nextSibling)}),t)
1547
+ return l},function(e){e.off=pe,e.on=de,e.wheelEventPixels=wi,e.Doc=Do,e.splitLines=Fe,e.countColumn=P,e.findColumn=V,e.isWordChar=ee,e.Pass=_,e.signal=me,e.Line=$t,e.changeEnd=Mi,e.scrollbarModel=qr,e.Pos=tt,e.cmpPos=nt,e.modes=He,e.mimeModes=We,e.resolveMode=Re,e.getMode=ze,e.modeExtensions=je,e.extendMode=_e,e.copyState=Ue,e.startState=Ge,e.innerMode=qe,e.commands=ea,e.keyMap=_o,e.keyName=Xo,e.isModifierKey=Vo,e.lookupKey=Go,e.normalizeKeyMap=qo,e.StringStream=Ve,e.SharedTextMarker=Mo,e.TextMarker=Lo,e.LineWidget=Co,e.e_preventDefault=be,e.e_stopPropagation=we,e.e_stop=ke,e.addClass=O,e.contains=D,e.rmClass=T,e.keyNames=Po}(La),La.version="5.48.0",La}))},{}],11:[function(e,t,n){var r
1548
1548
  r=function(e){"use strict"
1549
1549
  var t=/^((?:(?:aaas?|about|acap|adiumxtra|af[ps]|aim|apt|attachment|aw|beshare|bitcoin|bolo|callto|cap|chrome(?:-extension)?|cid|coap|com-eventbrite-attendee|content|crid|cvs|data|dav|dict|dlna-(?:playcontainer|playsingle)|dns|doi|dtn|dvb|ed2k|facetime|feed|file|finger|fish|ftp|geo|gg|git|gizmoproject|go|gopher|gtalk|h323|hcp|https?|iax|icap|icon|im|imap|info|ipn|ipp|irc[6s]?|iris(?:\.beep|\.lwz|\.xpc|\.xpcs)?|itms|jar|javascript|jms|keyparc|lastfm|ldaps?|magnet|mailto|maps|market|message|mid|mms|ms-help|msnim|msrps?|mtqp|mumble|mupdate|mvn|news|nfs|nih?|nntp|notes|oid|opaquelocktoken|palm|paparazzi|platform|pop|pres|proxy|psyc|query|res(?:ource)?|rmi|rsync|rtmp|rtsp|secondlife|service|session|sftp|sgn|shttp|sieve|sips?|skype|sm[bs]|snmp|soap\.beeps?|soldat|spotify|ssh|steam|svn|tag|teamspeak|tel(?:net)?|tftp|things|thismessage|tip|tn3270|tv|udp|unreal|urn|ut2004|vemmi|ventrilo|view-source|webcal|wss?|wtai|wyciwyg|xcon(?:-userid)?|xfire|xmlrpc\.beeps?|xmpp|xri|ymsgr|z39\.50[rs]?):(?:\/{1,3}|[a-z0-9%])|www\d{0,3}[.]|[a-z0-9.\-]+[.][a-z]{2,4}\/)(?:[^\s()<>]|\([^\s()<>]*\))+(?:\([^\s()<>]*\)|[^\s`*!()\[\]{};:'".,<>?«»“”‘’]))/i
1550
1550
  e.defineMode("gfm",(function(n,r){var i=0,o={startState:function(){return{code:!1,codeBlock:!1,ateSpace:!1}},copyState:function(e){return{code:e.code,codeBlock:e.codeBlock,ateSpace:e.ateSpace}},token:function(e,n){if(n.combineTokens=null,n.codeBlock)return e.match(/^```+/)?(n.codeBlock=!1,null):(e.skipToEnd(),null)
@@ -1757,22 +1757,22 @@ else{var n=Array(e.options.tabSize+1).join(" ")
1757
1757
  e.replaceSelection(n)}}},{codemirror:10}],18:[function(e,t,n){"use strict"
1758
1758
  var r=e("codemirror")
1759
1759
  e("codemirror/addon/edit/continuelist.js"),e("./codemirror/tablist"),e("codemirror/addon/display/fullscreen.js"),e("codemirror/mode/markdown/markdown.js"),e("codemirror/addon/mode/overlay.js"),e("codemirror/addon/display/placeholder.js"),e("codemirror/addon/selection/mark-selection.js"),e("codemirror/mode/gfm/gfm.js"),e("codemirror/mode/xml/xml.js")
1760
- var i=e("codemirror-spell-checker"),o=navigator.userAgent,a=navigator.platform,l=!/Edge\/(\d+)/.exec(o)&&/AppleWebKit/.test(o)&&/Mobile\/\w+/.test(o)||/Mac/.test(a),s=/win/i.test(a),u={toggleBold:v,toggleItalic:y,drawLink:E,toggleHeadingSmaller:C,toggleHeadingBigger:k,drawImage:D,toggleBlockquote:w,toggleOrderedList:A,toggleUnorderedList:M,toggleCodeBlock:b,togglePreview:W,toggleStrikethrough:x,toggleHeading1:S,toggleHeading2:L,toggleHeading3:T,cleanBlock:N,drawTable:F,drawHorizontalRule:O,undo:I,redo:B,toggleSideBySide:H,toggleFullScreen:g},c={toggleBold:"Cmd-B",toggleItalic:"Cmd-I",drawLink:"Cmd-K",toggleHeadingSmaller:"Cmd-H",toggleHeadingBigger:"Shift-Cmd-H",cleanBlock:"Cmd-E",drawImage:"Cmd-Alt-I",toggleBlockquote:"Cmd-'",toggleOrderedList:"Cmd-Alt-L",toggleUnorderedList:"Cmd-L",toggleCodeBlock:"Cmd-Alt-C",togglePreview:"Cmd-P",toggleSideBySide:"F9",toggleFullScreen:"F11"}
1761
- function f(e){return l?e.replace("Ctrl","Cmd"):e.replace("Cmd","Ctrl")}function d(e,t,n){e=e||{}
1760
+ var i=e("codemirror-spell-checker"),o=navigator.userAgent,a=navigator.platform,l=!/Edge\/(\d+)/.exec(o)&&/AppleWebKit/.test(o)&&/Mobile\/\w+/.test(o)||/Mac/.test(a),s=/win/i.test(a),u={toggleBold:y,toggleItalic:x,drawLink:D,toggleHeadingSmaller:k,toggleHeadingBigger:S,drawImage:F,toggleBlockquote:C,toggleOrderedList:N,toggleUnorderedList:A,toggleCodeBlock:w,togglePreview:P,toggleStrikethrough:b,toggleHeading1:L,toggleHeading2:T,toggleHeading3:M,cleanBlock:E,drawTable:O,drawHorizontalRule:I,undo:B,redo:H,toggleSideBySide:W,toggleFullScreen:v},c={toggleBold:"Cmd-B",toggleItalic:"Cmd-I",drawLink:"Cmd-K",toggleHeadingSmaller:"Cmd-H",toggleHeadingBigger:"Shift-Cmd-H",cleanBlock:"Cmd-E",drawImage:"Cmd-Alt-I",toggleBlockquote:"Cmd-'",toggleOrderedList:"Cmd-Alt-L",toggleUnorderedList:"Cmd-L",toggleCodeBlock:"Cmd-Alt-C",togglePreview:"Cmd-P",toggleSideBySide:"F9",toggleFullScreen:"F11"},f=function(e){for(var t in u)if(u[t]===e)return t
1761
+ return null}
1762
+ function d(e){return l?e.replace("Ctrl","Cmd"):e.replace("Cmd","Ctrl")}function h(e,t,n){e=e||{}
1762
1763
  var r=document.createElement("a")
1763
1764
  return t=null==t||t,e.title&&t&&(r.title=function(e,t,n){var r,i=e
1764
- return t&&n[r=function(e){for(var t in u)if(u[t]===e)return t
1765
- return null}(t)]&&(i+=" ("+f(n[r])+")"),i}(e.title,e.action,n),l&&!e.useCtrlOnMac&&(r.title=r.title.replace("Ctrl","⌘")),l&&(r.title=r.title.replace("Alt","⌥"))),r.tabIndex=-1,r.className=e.className,r}function h(){var e=document.createElement("i")
1766
- return e.className="separator",e.innerHTML="|",e}function p(e,t){t=t||e.getCursor("start")
1765
+ return t&&n[r=f(t)]&&(i+=" ("+d(n[r])+")"),i}(e.title,e.action,n),l&&!e.useCtrlOnMac&&(r.title=r.title.replace("Ctrl","⌘")),l&&(r.title=r.title.replace("Alt","⌥"))),r.tabIndex=-1,r.className=e.className,r}function p(){var e=document.createElement("i")
1766
+ return e.className="separator",e.innerHTML="|",e}function m(e,t){t=t||e.getCursor("start")
1767
1767
  var n=e.getTokenAt(t)
1768
1768
  if(!n.type)return{}
1769
1769
  for(var r,i,o=n.type.split(" "),a={},l=0;l<o.length;l++)"strong"===(r=o[l])?a.bold=!0:"variable-2"===r?(i=e.getLine(t.line),/^\s*\d+\.\s/.test(i)?a["ordered-list"]=!0:a["unordered-list"]=!0):"atom"===r?a.quote=!0:"em"===r?a.italic=!0:"quote"===r?a.quote=!0:"strikethrough"===r?a.strikethrough=!0:"comment"===r?a.code=!0:"link"===r?a.link=!0:"tag"===r?a.image=!0:r.match(/^header(\-[1-6])?$/)&&(a[r.replace("header","heading")]=!0)
1770
- return a}var m=""
1771
- function g(e){var t=e.codemirror
1772
- t.setOption("fullScreen",!t.getOption("fullScreen")),t.getOption("fullScreen")?(m=document.body.style.overflow,document.body.style.overflow="hidden"):document.body.style.overflow=m
1770
+ return a}var g=""
1771
+ function v(e){var t=e.codemirror
1772
+ t.setOption("fullScreen",!t.getOption("fullScreen")),t.getOption("fullScreen")?(g=document.body.style.overflow,document.body.style.overflow="hidden"):document.body.style.overflow=g
1773
1773
  var n=t.getWrapperElement();/fullscreen/.test(n.previousSibling.className)?n.previousSibling.className=n.previousSibling.className.replace(/\s*fullscreen\b/,""):n.previousSibling.className+=" fullscreen"
1774
1774
  var r=e.toolbarElements.fullscreen;/active/.test(r.className)?r.className=r.className.replace(/\s*active\s*/g,""):r.className+=" active"
1775
- var i=t.getWrapperElement().nextSibling;/editor-preview-active-side/.test(i.className)&&H(e)}function v(e){j(e,"bold",e.options.blockStyles.bold)}function y(e){j(e,"italic",e.options.blockStyles.italic)}function x(e){j(e,"strikethrough","~~")}function b(e){var t=e.options.blockStyles.code
1775
+ var i=t.getWrapperElement().nextSibling;/editor-preview-active-side/.test(i.className)&&W(e)}function y(e){_(e,"bold",e.options.blockStyles.bold)}function x(e){_(e,"italic",e.options.blockStyles.italic)}function b(e){_(e,"strikethrough","~~")}function w(e){var t=e.options.blockStyles.code
1776
1776
  function n(e){if("object"!=typeof e)throw"fencing_line() takes a 'line' object (not a line number, or line text). Got: "+typeof e+": "+e
1777
1777
  return e.styles&&e.styles[2]&&-1!==e.styles[2].indexOf("formatting-code-block")}function r(e){return e.state.base.base||e.state.base}function i(e,t,i,o,a){i=i||e.getLineHandle(t),o=o||e.getTokenAt({line:t,ch:1}),a=a||!!i.text&&e.getTokenAt({line:t,ch:i.text.length-1})
1778
1778
  var l=o.type?o.type.split(" "):[]
@@ -1788,54 +1788,54 @@ k&&r(k).indentedCode&&s.replaceRange("\n",{line:a+1,ch:0})
1788
1788
  for(var S=o;S<=a;S++)s.indentLine(S,"subtract")
1789
1789
  s.focus()}else{var L=u.line===c.line&&u.ch===c.ch&&0===u.ch,T=u.line!==c.line
1790
1790
  L||T?function(e,t,n,r){var i=t.line+1,o=n.line+1,a=t.line!==n.line,l=r+"\n",s="\n"+r
1791
- a&&o++,a&&0===n.ch&&(s=r+"\n",o--),P(e,!1,[l,s]),e.setSelection({line:i,ch:0},{line:o,ch:0})}(s,u,c,t):P(s,!1,["`","`"])}}function w(e){z(e.codemirror,"quote")}function C(e){R(e.codemirror,"smaller")}function k(e){R(e.codemirror,"bigger")}function S(e){R(e.codemirror,void 0,1)}function L(e){R(e.codemirror,void 0,2)}function T(e){R(e.codemirror,void 0,3)}function M(e){z(e.codemirror,"unordered-list")}function A(e){z(e.codemirror,"ordered-list")}function N(e){!function(e){if(!/editor-preview-active/.test(e.getWrapperElement().lastChild.className))for(var t,n=e.getCursor("start"),r=e.getCursor("end"),i=n.line;i<=r.line;i++)t=(t=e.getLine(i)).replace(/^[ ]*([# ]+|\*|\-|[> ]+|[0-9]+(.|\)))[ ]*/,""),e.replaceRange(t,{line:i,ch:0},{line:i,ch:99999999999999})}(e.codemirror)}function E(e){var t=e.codemirror,n=p(t),r=e.options,i="http://"
1791
+ a&&o++,a&&0===n.ch&&(s=r+"\n",o--),R(e,!1,[l,s]),e.setSelection({line:i,ch:0},{line:o,ch:0})}(s,u,c,t):R(s,!1,["`","`"])}}function C(e){j(e.codemirror,"quote")}function k(e){z(e.codemirror,"smaller")}function S(e){z(e.codemirror,"bigger")}function L(e){z(e.codemirror,void 0,1)}function T(e){z(e.codemirror,void 0,2)}function M(e){z(e.codemirror,void 0,3)}function A(e){j(e.codemirror,"unordered-list")}function N(e){j(e.codemirror,"ordered-list")}function E(e){!function(e){if(!/editor-preview-active/.test(e.getWrapperElement().lastChild.className))for(var t,n=e.getCursor("start"),r=e.getCursor("end"),i=n.line;i<=r.line;i++)t=(t=e.getLine(i)).replace(/^[ ]*([# ]+|\*|\-|[> ]+|[0-9]+(.|\)))[ ]*/,""),e.replaceRange(t,{line:i,ch:0},{line:i,ch:99999999999999})}(e.codemirror)}function D(e){var t=e.codemirror,n=m(t),r=e.options,i="http://"
1792
1792
  if(r.promptURLs&&!(i=prompt(r.promptTexts.link)))return!1
1793
- P(t,n.link,r.insertTexts.link,i)}function D(e){var t=e.codemirror,n=p(t),r=e.options,i="http://"
1793
+ R(t,n.link,r.insertTexts.link,i)}function F(e){var t=e.codemirror,n=m(t),r=e.options,i="http://"
1794
1794
  if(r.promptURLs&&!(i=prompt(r.promptTexts.image)))return!1
1795
- P(t,n.image,r.insertTexts.image,i)}function F(e){var t=e.codemirror,n=p(t),r=e.options
1796
- P(t,n.table,r.insertTexts.table)}function O(e){var t=e.codemirror,n=p(t),r=e.options
1797
- P(t,n.image,r.insertTexts.horizontalRule)}function I(e){var t=e.codemirror
1798
- t.undo(),t.focus()}function B(e){var t=e.codemirror
1799
- t.redo(),t.focus()}function H(e){var t=e.codemirror,n=t.getWrapperElement(),r=n.nextSibling,i=e.toolbarElements["side-by-side"],o=!1;/editor-preview-active-side/.test(r.className)?(r.className=r.className.replace(/\s*editor-preview-active-side\s*/g,""),i.className=i.className.replace(/\s*active\s*/g,""),n.className=n.className.replace(/\s*CodeMirror-sided\s*/g," ")):(setTimeout((function(){t.getOption("fullScreen")||g(e),r.className+=" editor-preview-active-side"}),1),i.className+=" active",n.className+=" CodeMirror-sided",o=!0)
1795
+ R(t,n.image,r.insertTexts.image,i)}function O(e){var t=e.codemirror,n=m(t),r=e.options
1796
+ R(t,n.table,r.insertTexts.table)}function I(e){var t=e.codemirror,n=m(t),r=e.options
1797
+ R(t,n.image,r.insertTexts.horizontalRule)}function B(e){var t=e.codemirror
1798
+ t.undo(),t.focus()}function H(e){var t=e.codemirror
1799
+ t.redo(),t.focus()}function W(e){var t=e.codemirror,n=t.getWrapperElement(),r=n.nextSibling,i=e.toolbarElements["side-by-side"],o=!1;/editor-preview-active-side/.test(r.className)?(r.className=r.className.replace(/\s*editor-preview-active-side\s*/g,""),i.className=i.className.replace(/\s*active\s*/g,""),n.className=n.className.replace(/\s*CodeMirror-sided\s*/g," ")):(setTimeout((function(){t.getOption("fullScreen")||v(e),r.className+=" editor-preview-active-side"}),1),i.className+=" active",n.className+=" CodeMirror-sided",o=!0)
1800
1800
  var a=n.lastChild
1801
1801
  if(/editor-preview-active/.test(a.className)){a.className=a.className.replace(/\s*editor-preview-active\s*/g,"")
1802
1802
  var l=e.toolbarElements.preview,s=n.previousSibling
1803
- l.className=l.className.replace(/\s*active\s*/g,""),s.className=s.className.replace(/\s*disabled-for-preview*/g,"")}t.sideBySideRenderingFunction||(t.sideBySideRenderingFunction=function(){r.innerHTML=e.options.previewRender(e.value(),r)}),o?(r.innerHTML=e.options.previewRender(e.value(),r),t.on("update",t.sideBySideRenderingFunction)):t.off("update",t.sideBySideRenderingFunction),t.refresh()}function W(e){var t=e.codemirror,n=t.getWrapperElement(),r=n.previousSibling,i=!!e.options.toolbar&&e.toolbarElements.preview,o=n.lastChild
1803
+ l.className=l.className.replace(/\s*active\s*/g,""),s.className=s.className.replace(/\s*disabled-for-preview*/g,"")}t.sideBySideRenderingFunction||(t.sideBySideRenderingFunction=function(){r.innerHTML=e.options.previewRender(e.value(),r)}),o?(r.innerHTML=e.options.previewRender(e.value(),r),t.on("update",t.sideBySideRenderingFunction)):t.off("update",t.sideBySideRenderingFunction),t.refresh()}function P(e){var t=e.codemirror,n=t.getWrapperElement(),r=n.previousSibling,i=!!e.options.toolbar&&e.toolbarElements.preview,o=n.lastChild
1804
1804
  o&&/editor-preview/.test(o.className)||((o=document.createElement("div")).className="editor-preview",n.appendChild(o)),/editor-preview-active/.test(o.className)?(o.className=o.className.replace(/\s*editor-preview-active\s*/g,""),i&&(i.className=i.className.replace(/\s*active\s*/g,""),r.className=r.className.replace(/\s*disabled-for-preview*/g,""))):(setTimeout((function(){o.className+=" editor-preview-active"}),1),i&&(i.className+=" active",r.className+=" disabled-for-preview")),o.innerHTML=e.options.previewRender(e.value(),o)
1805
- var a=t.getWrapperElement().nextSibling;/editor-preview-active-side/.test(a.className)&&H(e)}function P(e,t,n,r){if(!/editor-preview-active/.test(e.getWrapperElement().lastChild.className)){var i,o=n[0],a=n[1],l=e.getCursor("start"),s=e.getCursor("end")
1806
- r&&(a=a.replace("#url#",r)),t?(o=(i=e.getLine(l.line)).slice(0,l.ch),a=i.slice(l.ch),e.replaceRange(o+a,{line:l.line,ch:0})):(i=e.getSelection(),e.replaceSelection(o+i+a),l.ch+=o.length,l!==s&&(s.ch+=o.length)),e.setSelection(l,s),e.focus()}}function R(e,t,n){if(!/editor-preview-active/.test(e.getWrapperElement().lastChild.className)){for(var r=e.getCursor("start"),i=e.getCursor("end"),o=r.line;o<=i.line;o++)!function(r){var i=e.getLine(r),o=i.search(/[^#]/)
1805
+ var a=t.getWrapperElement().nextSibling;/editor-preview-active-side/.test(a.className)&&W(e)}function R(e,t,n,r){if(!/editor-preview-active/.test(e.getWrapperElement().lastChild.className)){var i,o=n[0],a=n[1],l=e.getCursor("start"),s=e.getCursor("end")
1806
+ r&&(a=a.replace("#url#",r)),t?(o=(i=e.getLine(l.line)).slice(0,l.ch),a=i.slice(l.ch),e.replaceRange(o+a,{line:l.line,ch:0})):(i=e.getSelection(),e.replaceSelection(o+i+a),l.ch+=o.length,l!==s&&(s.ch+=o.length)),e.setSelection(l,s),e.focus()}}function z(e,t,n){if(!/editor-preview-active/.test(e.getWrapperElement().lastChild.className)){for(var r=e.getCursor("start"),i=e.getCursor("end"),o=r.line;o<=i.line;o++)!function(r){var i=e.getLine(r),o=i.search(/[^#]/)
1807
1807
  i=void 0!==t?o<=0?"bigger"==t?"###### "+i:"# "+i:6==o&&"smaller"==t?i.substr(7):1==o&&"bigger"==t?i.substr(2):"bigger"==t?i.substr(1):"#"+i:1==n?o<=0?"# "+i:o==n?i.substr(o+1):"# "+i.substr(o+1):2==n?o<=0?"## "+i:o==n?i.substr(o+1):"## "+i.substr(o+1):o<=0?"### "+i:o==n?i.substr(o+1):"### "+i.substr(o+1),e.replaceRange(i,{line:r,ch:0},{line:r,ch:99999999999999})}(o)
1808
- e.focus()}}function z(e,t){if(!/editor-preview-active/.test(e.getWrapperElement().lastChild.className)){for(var n=p(e),r=e.getCursor("start"),i=e.getCursor("end"),o={quote:/^(\s*)\>\s+/,"unordered-list":/^(\s*)(\*|\-|\+)\s+/,"ordered-list":/^(\s*)\d+\.\s+/},a={quote:"> ","unordered-list":"* ","ordered-list":"1. "},l=r.line;l<=i.line;l++)!function(r){var i=e.getLine(r)
1808
+ e.focus()}}function j(e,t){if(!/editor-preview-active/.test(e.getWrapperElement().lastChild.className)){for(var n=m(e),r=e.getCursor("start"),i=e.getCursor("end"),o={quote:/^(\s*)\>\s+/,"unordered-list":/^(\s*)(\*|\-|\+)\s+/,"ordered-list":/^(\s*)\d+\.\s+/},a={quote:"> ","unordered-list":"* ","ordered-list":"1. "},l=r.line;l<=i.line;l++)!function(r){var i=e.getLine(r)
1809
1809
  i=n[t]?i.replace(o[t],"$1"):a[t]+i,e.replaceRange(i,{line:r,ch:0},{line:r,ch:99999999999999})}(l)
1810
- e.focus()}}function j(e,t,n,r){if(!/editor-preview-active/.test(e.codemirror.getWrapperElement().lastChild.className)){r=void 0===r?n:r
1811
- var i,o=e.codemirror,a=p(o),l=n,s=r,u=o.getCursor("start"),c=o.getCursor("end")
1812
- a[t]?(l=(i=o.getLine(u.line)).slice(0,u.ch),s=i.slice(u.ch),"bold"==t?(l=l.replace(/(\*\*|__)(?![\s\S]*(\*\*|__))/,""),s=s.replace(/(\*\*|__)/,"")):"italic"==t?(l=l.replace(/(\*|_)(?![\s\S]*(\*|_))/,""),s=s.replace(/(\*|_)/,"")):"strikethrough"==t&&(l=l.replace(/(\*\*|~~)(?![\s\S]*(\*\*|~~))/,""),s=s.replace(/(\*\*|~~)/,"")),o.replaceRange(l+s,{line:u.line,ch:0},{line:u.line,ch:99999999999999}),"bold"==t||"strikethrough"==t?(u.ch-=2,u!==c&&(c.ch-=2)):"italic"==t&&(u.ch-=1,u!==c&&(c.ch-=1))):(i=o.getSelection(),"bold"==t?i=(i=i.split("**").join("")).split("__").join(""):"italic"==t?i=(i=i.split("*").join("")).split("_").join(""):"strikethrough"==t&&(i=i.split("~~").join("")),o.replaceSelection(l+i+s),u.ch+=n.length,c.ch=u.ch+i.length),o.setSelection(u,c),o.focus()}}function _(e,t){for(var n in t)t.hasOwnProperty(n)&&(t[n]instanceof Array?e[n]=t[n].concat(e[n]instanceof Array?e[n]:[]):null!==t[n]&&"object"==typeof t[n]&&t[n].constructor===Object?e[n]=_(e[n]||{},t[n]):e[n]=t[n])
1813
- return e}function U(e){for(var t=1;t<arguments.length;t++)e=_(e,arguments[t])
1814
- return e}function q(e){var t=e.match(/[a-zA-Z0-9_\u0392-\u03c9\u0410-\u04F9]+|[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af]+/g),n=0
1810
+ e.focus()}}function _(e,t,n,r){if(!/editor-preview-active/.test(e.codemirror.getWrapperElement().lastChild.className)){r=void 0===r?n:r
1811
+ var i,o=e.codemirror,a=m(o),l=n,s=r,u=o.getCursor("start"),c=o.getCursor("end")
1812
+ a[t]?(l=(i=o.getLine(u.line)).slice(0,u.ch),s=i.slice(u.ch),"bold"==t?(l=l.replace(/(\*\*|__)(?![\s\S]*(\*\*|__))/,""),s=s.replace(/(\*\*|__)/,"")):"italic"==t?(l=l.replace(/(\*|_)(?![\s\S]*(\*|_))/,""),s=s.replace(/(\*|_)/,"")):"strikethrough"==t&&(l=l.replace(/(\*\*|~~)(?![\s\S]*(\*\*|~~))/,""),s=s.replace(/(\*\*|~~)/,"")),o.replaceRange(l+s,{line:u.line,ch:0},{line:u.line,ch:99999999999999}),"bold"==t||"strikethrough"==t?(u.ch-=2,u!==c&&(c.ch-=2)):"italic"==t&&(u.ch-=1,u!==c&&(c.ch-=1))):(i=o.getSelection(),"bold"==t?i=(i=i.split("**").join("")).split("__").join(""):"italic"==t?i=(i=i.split("*").join("")).split("_").join(""):"strikethrough"==t&&(i=i.split("~~").join("")),o.replaceSelection(l+i+s),u.ch+=n.length,c.ch=u.ch+i.length),o.setSelection(u,c),o.focus()}}function U(e,t){for(var n in t)t.hasOwnProperty(n)&&(t[n]instanceof Array?e[n]=t[n].concat(e[n]instanceof Array?e[n]:[]):null!==t[n]&&"object"==typeof t[n]&&t[n].constructor===Object?e[n]=U(e[n]||{},t[n]):e[n]=t[n])
1813
+ return e}function q(e){for(var t=1;t<arguments.length;t++)e=U(e,arguments[t])
1814
+ return e}function G(e){var t=e.match(/[a-zA-Z0-9_\u0392-\u03c9\u0410-\u04F9]+|[\u4E00-\u9FFF\u3400-\u4dbf\uf900-\ufaff\u3040-\u309f\uac00-\ud7af]+/g),n=0
1815
1815
  if(null===t)return n
1816
1816
  for(var r=0;r<t.length;r++)t[r].charCodeAt(0)>=19968?n+=t[r].length:n+=1
1817
- return n}var G={bold:{name:"bold",action:v,className:"fa fa-bold",title:"Bold",default:!0},italic:{name:"italic",action:y,className:"fa fa-italic",title:"Italic",default:!0},strikethrough:{name:"strikethrough",action:x,className:"fa fa-strikethrough",title:"Strikethrough"},heading:{name:"heading",action:C,className:"fa fa-header",title:"Heading",default:!0},"heading-smaller":{name:"heading-smaller",action:C,className:"fa fa-header fa-header-x fa-header-smaller",title:"Smaller Heading"},"heading-bigger":{name:"heading-bigger",action:k,className:"fa fa-header fa-header-x fa-header-bigger",title:"Bigger Heading"},"heading-1":{name:"heading-1",action:S,className:"fa fa-header fa-header-x fa-header-1",title:"Big Heading"},"heading-2":{name:"heading-2",action:L,className:"fa fa-header fa-header-x fa-header-2",title:"Medium Heading"},"heading-3":{name:"heading-3",action:T,className:"fa fa-header fa-header-x fa-header-3",title:"Small Heading"},"separator-1":{name:"separator-1"},code:{name:"code",action:b,className:"fa fa-code",title:"Code"},quote:{name:"quote",action:w,className:"fa fa-quote-left",title:"Quote",default:!0},"unordered-list":{name:"unordered-list",action:M,className:"fa fa-list-ul",title:"Generic List",default:!0},"ordered-list":{name:"ordered-list",action:A,className:"fa fa-list-ol",title:"Numbered List",default:!0},"clean-block":{name:"clean-block",action:N,className:"fa fa-eraser fa-clean-block",title:"Clean block"},"separator-2":{name:"separator-2"},link:{name:"link",action:E,className:"fa fa-link",title:"Create Link",default:!0},image:{name:"image",action:D,className:"fa fa-picture-o",title:"Insert Image",default:!0},table:{name:"table",action:F,className:"fa fa-table",title:"Insert Table"},"horizontal-rule":{name:"horizontal-rule",action:O,className:"fa fa-minus",title:"Insert Horizontal Line"},"separator-3":{name:"separator-3"},preview:{name:"preview",action:W,className:"fa fa-eye no-disable",title:"Toggle Preview",default:!0},"side-by-side":{name:"side-by-side",action:H,className:"fa fa-columns no-disable no-mobile",title:"Toggle Side by Side",default:!0},fullscreen:{name:"fullscreen",action:g,className:"fa fa-arrows-alt no-disable no-mobile",title:"Toggle Fullscreen",default:!0},"separator-4":{name:"separator-4"},guide:{name:"guide",action:"https://simplemde.com/markdown-guide",className:"fa fa-question-circle",title:"Markdown Guide",default:!0},"separator-5":{name:"separator-5"},undo:{name:"undo",action:I,className:"fa fa-undo no-disable",title:"Undo"},redo:{name:"redo",action:B,className:"fa fa-repeat no-disable",title:"Redo"}},V={link:["[","](#url#)"],image:["![](","#url#)"],table:["","\n\n| Column 1 | Column 2 | Column 3 |\n| -------- | -------- | -------- |\n| Text | Text | Text |\n\n"],horizontalRule:["","\n\n-----\n\n"]},$={link:"URL for the link:",image:"URL of the image:"},X={bold:"**",code:"```",italic:"*"}
1818
- function K(e){(e=e||{}).parent=this
1817
+ return n}var V={bold:{name:"bold",action:y,className:"fa fa-bold",title:"Bold",default:!0},italic:{name:"italic",action:x,className:"fa fa-italic",title:"Italic",default:!0},strikethrough:{name:"strikethrough",action:b,className:"fa fa-strikethrough",title:"Strikethrough"},heading:{name:"heading",action:k,className:"fa fa-header",title:"Heading",default:!0},"heading-smaller":{name:"heading-smaller",action:k,className:"fa fa-header fa-header-x fa-header-smaller",title:"Smaller Heading"},"heading-bigger":{name:"heading-bigger",action:S,className:"fa fa-header fa-header-x fa-header-bigger",title:"Bigger Heading"},"heading-1":{name:"heading-1",action:L,className:"fa fa-header fa-header-x fa-header-1",title:"Big Heading"},"heading-2":{name:"heading-2",action:T,className:"fa fa-header fa-header-x fa-header-2",title:"Medium Heading"},"heading-3":{name:"heading-3",action:M,className:"fa fa-header fa-header-x fa-header-3",title:"Small Heading"},"separator-1":{name:"separator-1"},code:{name:"code",action:w,className:"fa fa-code",title:"Code"},quote:{name:"quote",action:C,className:"fa fa-quote-left",title:"Quote",default:!0},"unordered-list":{name:"unordered-list",action:A,className:"fa fa-list-ul",title:"Generic List",default:!0},"ordered-list":{name:"ordered-list",action:N,className:"fa fa-list-ol",title:"Numbered List",default:!0},"clean-block":{name:"clean-block",action:E,className:"fa fa-eraser fa-clean-block",title:"Clean block"},"separator-2":{name:"separator-2"},link:{name:"link",action:D,className:"fa fa-link",title:"Create Link",default:!0},image:{name:"image",action:F,className:"fa fa-picture-o",title:"Insert Image",default:!0},table:{name:"table",action:O,className:"fa fa-table",title:"Insert Table"},"horizontal-rule":{name:"horizontal-rule",action:I,className:"fa fa-minus",title:"Insert Horizontal Line"},"separator-3":{name:"separator-3"},preview:{name:"preview",action:P,className:"fa fa-eye no-disable",title:"Toggle Preview",default:!0},"side-by-side":{name:"side-by-side",action:W,className:"fa fa-columns no-disable no-mobile",title:"Toggle Side by Side",default:!0},fullscreen:{name:"fullscreen",action:v,className:"fa fa-arrows-alt no-disable no-mobile",title:"Toggle Fullscreen",default:!0},"separator-4":{name:"separator-4"},guide:{name:"guide",action:"https://simplemde.com/markdown-guide",className:"fa fa-question-circle",title:"Markdown Guide",default:!0},"separator-5":{name:"separator-5"},undo:{name:"undo",action:B,className:"fa fa-undo no-disable",title:"Undo"},redo:{name:"redo",action:H,className:"fa fa-repeat no-disable",title:"Redo"}},$={link:["[","](#url#)"],image:["![](","#url#)"],table:["","\n\n| Column 1 | Column 2 | Column 3 |\n| -------- | -------- | -------- |\n| Text | Text | Text |\n\n"],horizontalRule:["","\n\n-----\n\n"]},X={link:"URL for the link:",image:"URL of the image:"},K={bold:"**",code:"```",italic:"*"}
1818
+ function Y(e){(e=e||{}).parent=this
1819
1819
  var t=!0
1820
1820
  if(!1===e.autoDownloadFontAwesome&&(t=!1),!0!==e.autoDownloadFontAwesome)for(var n=document.styleSheets,r=0;r<n.length;r++)n[r].href&&n[r].href.indexOf("//maxcdn.bootstrapcdn.com/font-awesome/")>-1&&(t=!1)
1821
1821
  if(t){var i=document.createElement("link")
1822
1822
  i.rel="stylesheet",i.href="https://maxcdn.bootstrapcdn.com/font-awesome/latest/css/font-awesome.min.css",document.getElementsByTagName("head")[0].appendChild(i)}if(e.element)this.element=e.element
1823
1823
  else if(null===e.element)return void console.log("SimpleMDE: Error. No element was found.")
1824
- if(void 0===e.toolbar)for(var o in e.toolbar=[],G)G.hasOwnProperty(o)&&(-1!=o.indexOf("separator-")&&e.toolbar.push("|"),(!0===G[o].default||e.showIcons&&e.showIcons.constructor===Array&&-1!=e.showIcons.indexOf(o))&&e.toolbar.push(o))
1825
- e.hasOwnProperty("status")||(e.status=["autosave","lines","words","cursor"]),e.previewRender||(e.previewRender=function(e){return this.parent.markdown(e)}),e.parsingConfig=U({highlightFormatting:!0},e.parsingConfig||{}),e.insertTexts=U({},V,e.insertTexts||{}),e.promptTexts=$,e.blockStyles=U({},X,e.blockStyles||{}),e.shortcuts=U({},c,e.shortcuts||{}),null!=e.autosave&&null!=e.autosave.unique_id&&""!=e.autosave.unique_id&&(e.autosave.uniqueId=e.autosave.unique_id),this.options=e,this.render(),!e.initialValue||this.options.autosave&&!0===this.options.autosave.foundSavedValue||this.value(e.initialValue)}function Y(){if("object"!=typeof localStorage)return!1
1826
- try{localStorage.setItem("smde_localStorage",1),localStorage.removeItem("smde_localStorage")}catch(e){return!1}return!0}K.prototype.markdown=function(e){},K.prototype.render=function(e){if(e||(e=this.element||document.getElementsByTagName("textarea")[0]),!this._rendered||this._rendered!==e){this.element=e
1824
+ if(void 0===e.toolbar)for(var o in e.toolbar=[],V)V.hasOwnProperty(o)&&(-1!=o.indexOf("separator-")&&e.toolbar.push("|"),(!0===V[o].default||e.showIcons&&e.showIcons.constructor===Array&&-1!=e.showIcons.indexOf(o))&&e.toolbar.push(o))
1825
+ e.hasOwnProperty("status")||(e.status=["autosave","lines","words","cursor"]),e.previewRender||(e.previewRender=function(e){return this.parent.markdown(e)}),e.parsingConfig=q({highlightFormatting:!0},e.parsingConfig||{}),e.insertTexts=q({},$,e.insertTexts||{}),e.promptTexts=X,e.blockStyles=q({},K,e.blockStyles||{}),e.shortcuts=q({},c,e.shortcuts||{}),null!=e.autosave&&null!=e.autosave.unique_id&&""!=e.autosave.unique_id&&(e.autosave.uniqueId=e.autosave.unique_id),this.options=e,this.render(),!e.initialValue||this.options.autosave&&!0===this.options.autosave.foundSavedValue||this.value(e.initialValue)}function Z(){if("object"!=typeof localStorage)return!1
1826
+ try{localStorage.setItem("smde_localStorage",1),localStorage.removeItem("smde_localStorage")}catch(e){return!1}return!0}Y.prototype.markdown=function(e){},Y.prototype.render=function(e){if(e||(e=this.element||document.getElementsByTagName("textarea")[0]),!this._rendered||this._rendered!==e){this.element=e
1827
1827
  var t,n,o=this.options,a=this,l={}
1828
- for(var c in o.shortcuts)null!==o.shortcuts[c]&&null!==u[c]&&function(e){l[f(o.shortcuts[e])]=function(){u[e](a)}}(c)
1829
- if(l.Enter="newlineAndIndentContinueMarkdownList",l.Tab="tabAndIndentMarkdownList",l["Shift-Tab"]="shiftTabAndUnindentMarkdownList",l.Esc=function(e){e.getOption("fullScreen")&&g(a)},s&&(l.Home="goLineLeftSmart",l.End="goLineRight"),document.addEventListener("keydown",(function(e){27==(e=e||window.event).keyCode&&a.codemirror.getOption("fullScreen")&&g(a)}),!1),!1!==o.spellChecker?(t="spell-checker",(n=o.parsingConfig).name="gfm",n.gitHubSpice=!1,i({codeMirrorInstance:r})):((t=o.parsingConfig).name="gfm",t.gitHubSpice=!1),this.codemirror=r.fromTextArea(e,{mode:t,backdrop:n,theme:"paper",tabSize:null!=o.tabSize?o.tabSize:2,indentUnit:null!=o.tabSize?o.tabSize:2,indentWithTabs:!1!==o.indentWithTabs,lineNumbers:!1,autofocus:!0===o.autofocus,extraKeys:l,lineWrapping:!1!==o.lineWrapping,allowDropFileTypes:["text/plain"],placeholder:o.placeholder||e.getAttribute("placeholder")||"",styleSelectedText:null==o.styleSelectedText||o.styleSelectedText}),!0===o.forceSync){var d=this.codemirror
1830
- d.on("change",(function(){d.save()}))}this.gui={},!1!==o.toolbar&&(this.gui.toolbar=this.createToolbar()),!1!==o.status&&(this.gui.statusbar=this.createStatusbar()),null!=o.autosave&&!0===o.autosave.enabled&&this.autosave(),this.gui.sideBySide=this.createSideBySide(),this._rendered=this.element
1828
+ for(var c in o.shortcuts)null!==o.shortcuts[c]&&null!==u[c]&&function(e){l[d(o.shortcuts[e])]=function(){u[e](a)}}(c)
1829
+ if(l.Enter="newlineAndIndentContinueMarkdownList",l.Tab="tabAndIndentMarkdownList",l["Shift-Tab"]="shiftTabAndUnindentMarkdownList",l.Esc=function(e){e.getOption("fullScreen")&&v(a)},s&&(l.Home="goLineLeftSmart",l.End="goLineRight"),document.addEventListener("keydown",(function(e){27==(e=e||window.event).keyCode&&a.codemirror.getOption("fullScreen")&&v(a)}),!1),!1!==o.spellChecker?(t="spell-checker",(n=o.parsingConfig).name="gfm",n.gitHubSpice=!1,i({codeMirrorInstance:r})):((t=o.parsingConfig).name="gfm",t.gitHubSpice=!1),this.codemirror=r.fromTextArea(e,{mode:t,backdrop:n,theme:"paper",tabSize:null!=o.tabSize?o.tabSize:2,indentUnit:null!=o.tabSize?o.tabSize:2,indentWithTabs:!1!==o.indentWithTabs,lineNumbers:!1,autofocus:!0===o.autofocus,extraKeys:l,lineWrapping:!1!==o.lineWrapping,allowDropFileTypes:["text/plain"],placeholder:o.placeholder||e.getAttribute("placeholder")||"",styleSelectedText:null==o.styleSelectedText||o.styleSelectedText}),!0===o.forceSync){var f=this.codemirror
1830
+ f.on("change",(function(){f.save()}))}this.gui={},!1!==o.toolbar&&(this.gui.toolbar=this.createToolbar()),!1!==o.status&&(this.gui.statusbar=this.createStatusbar()),null!=o.autosave&&!0===o.autosave.enabled&&this.autosave(),this.gui.sideBySide=this.createSideBySide(),this._rendered=this.element
1831
1831
  var h=this.codemirror
1832
- setTimeout(function(){h.refresh()}.bind(h),0)}},K.prototype.autosave=function(){if(Y()){var e=this
1832
+ setTimeout(function(){h.refresh()}.bind(h),0)}},Y.prototype.autosave=function(){if(Z()){var e=this
1833
1833
  if(null==this.options.autosave.uniqueId||""==this.options.autosave.uniqueId)return void console.log("SimpleMDE: You must set a uniqueId to use the autosave feature")
1834
1834
  null!=e.element.form&&null!=e.element.form&&e.element.form.addEventListener("submit",(function(){localStorage.removeItem("smde_"+e.options.autosave.uniqueId)})),!0!==this.options.autosave.loaded&&("string"==typeof localStorage.getItem("smde_"+this.options.autosave.uniqueId)&&""!=localStorage.getItem("smde_"+this.options.autosave.uniqueId)&&(this.codemirror.setValue(localStorage.getItem("smde_"+this.options.autosave.uniqueId)),this.options.autosave.foundSavedValue=!0),this.options.autosave.loaded=!0),localStorage.setItem("smde_"+this.options.autosave.uniqueId,e.value())
1835
1835
  var t=document.getElementById("autosaved")
1836
1836
  if(null!=t&&null!=t&&""!=t){var n=new Date,r=n.getHours(),i=n.getMinutes(),o="am",a=r
1837
- a>=12&&(a=r-12,o="pm"),0==a&&(a=12),i=i<10?"0"+i:i,t.innerHTML="Autosaved: "+a+":"+i+" "+o}this.autosaveTimeoutId=setTimeout((function(){e.autosave()}),this.options.autosave.delay||1e4)}else console.log("SimpleMDE: localStorage not available, cannot autosave")},K.prototype.clearAutosavedValue=function(){if(Y()){if(null==this.options.autosave||null==this.options.autosave.uniqueId||""==this.options.autosave.uniqueId)return void console.log("SimpleMDE: You must set a uniqueId to clear the autosave value")
1838
- localStorage.removeItem("smde_"+this.options.autosave.uniqueId)}else console.log("SimpleMDE: localStorage not available, cannot autosave")},K.prototype.createSideBySide=function(){var e=this.codemirror,t=e.getWrapperElement(),n=t.nextSibling
1837
+ a>=12&&(a=r-12,o="pm"),0==a&&(a=12),i=i<10?"0"+i:i,t.innerHTML="Autosaved: "+a+":"+i+" "+o}this.autosaveTimeoutId=setTimeout((function(){e.autosave()}),this.options.autosave.delay||1e4)}else console.log("SimpleMDE: localStorage not available, cannot autosave")},Y.prototype.clearAutosavedValue=function(){if(Z()){if(null==this.options.autosave||null==this.options.autosave.uniqueId||""==this.options.autosave.uniqueId)return void console.log("SimpleMDE: You must set a uniqueId to clear the autosave value")
1838
+ localStorage.removeItem("smde_"+this.options.autosave.uniqueId)}else console.log("SimpleMDE: localStorage not available, cannot autosave")},Y.prototype.createSideBySide=function(){var e=this.codemirror,t=e.getWrapperElement(),n=t.nextSibling
1839
1839
  n&&/editor-preview-side/.test(n.className)||((n=document.createElement("div")).className="editor-preview-side",t.parentNode.insertBefore(n,t.nextSibling))
1840
1840
  var r=!1,i=!1
1841
1841
  return e.on("scroll",(function(e){if(r)r=!1
@@ -1844,31 +1844,31 @@ var t=e.getScrollInfo().height-e.getScrollInfo().clientHeight,o=parseFloat(e.get
1844
1844
  n.scrollTop=a}})),n.onscroll=function(){if(i)i=!1
1845
1845
  else{r=!0
1846
1846
  var t=n.scrollHeight-n.clientHeight,o=parseFloat(n.scrollTop)/t,a=(e.getScrollInfo().height-e.getScrollInfo().clientHeight)*o
1847
- e.scrollTo(0,a)}},n},K.prototype.createToolbar=function(e){if((e=e||this.options.toolbar)&&0!==e.length){var t
1848
- for(t=0;t<e.length;t++)null!=G[e[t]]&&(e[t]=G[e[t]])
1847
+ e.scrollTo(0,a)}},n},Y.prototype.createToolbar=function(e){if((e=e||this.options.toolbar)&&0!==e.length){var t
1848
+ for(t=0;t<e.length;t++)null!=V[e[t]]&&(e[t]=V[e[t]])
1849
1849
  var n=document.createElement("div")
1850
1850
  n.className="editor-toolbar"
1851
1851
  var r,i,o=this,a={}
1852
1852
  for(o.toolbar=e,t=0;t<e.length;t++)if(("guide"!=e[t].name||!1!==o.options.toolbarGuideIcon)&&!(o.options.hideIcons&&-1!=o.options.hideIcons.indexOf(e[t].name)||("fullscreen"==e[t].name||"side-by-side"==e[t].name)&&(r=void 0,i=void 0,i=!1,r=navigator.userAgent||navigator.vendor||window.opera,(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i.test(r)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(r.substr(0,4)))&&(i=!0),i))){if("|"===e[t]){for(var l=!1,s=t+1;s<e.length;s++)"|"===e[s]||o.options.hideIcons&&-1!=o.options.hideIcons.indexOf(e[s].name)||(l=!0)
1853
1853
  if(!l)continue}!function(e){var t
1854
- t="|"===e?h():d(e,o.options.toolbarTips,o.options.shortcuts),e.action&&("function"==typeof e.action?t.onclick=function(t){t.preventDefault(),e.action(o)}:"string"==typeof e.action&&(t.href=e.action,t.target="_blank")),a[e.name||e]=t,n.appendChild(t)}(e[t])}o.toolbarElements=a
1854
+ t="|"===e?p():h(e,o.options.toolbarTips,o.options.shortcuts),e.action&&("function"==typeof e.action?t.onclick=function(t){t.preventDefault(),e.action(o)}:"string"==typeof e.action&&(t.href=e.action,t.target="_blank")),a[e.name||e]=t,n.appendChild(t)}(e[t])}o.toolbarElements=a
1855
1855
  var u=this.codemirror
1856
- u.on("cursorActivity",(function(){var e=p(u)
1856
+ u.on("cursorActivity",(function(){var e=m(u)
1857
1857
  for(var t in a)!function(t){var n=a[t]
1858
1858
  e[t]?n.className+=" active":"fullscreen"!=t&&"side-by-side"!=t&&"spellcheck"!=t&&"hemmingway"!=t&&(n.className=n.className.replace(/\s*active\s*/g,""))}(t)}))
1859
1859
  var c=u.getWrapperElement()
1860
- return c.parentNode.insertBefore(n,c),n}},K.prototype.createStatusbar=function(e){e=e||this.options.status
1860
+ return c.parentNode.insertBefore(n,c),n}},Y.prototype.createStatusbar=function(e){e=e||this.options.status
1861
1861
  var t=this.options,n=this.codemirror
1862
1862
  if(e&&0!==e.length){var r,i,o,a=[]
1863
1863
  for(r=0;r<e.length;r++)if(i=void 0,o=void 0,"object"==typeof e[r])a.push({className:e[r].className,defaultValue:e[r].defaultValue,onUpdate:e[r].onUpdate})
1864
1864
  else{var l=e[r]
1865
- "words"===l?(o=function(e){e.innerHTML=q(n.getValue())},i=function(e){e.innerHTML=q(n.getValue())}):"lines"===l?(o=function(e){e.innerHTML=n.lineCount()},i=function(e){e.innerHTML=n.lineCount()}):"cursor"===l?(o=function(e){e.innerHTML="0:0"},i=function(e){var t=n.getCursor()
1865
+ "words"===l?(o=function(e){e.innerHTML=G(n.getValue())},i=function(e){e.innerHTML=G(n.getValue())}):"lines"===l?(o=function(e){e.innerHTML=n.lineCount()},i=function(e){e.innerHTML=n.lineCount()}):"cursor"===l?(o=function(e){e.innerHTML="0:0"},i=function(e){var t=n.getCursor()
1866
1866
  e.innerHTML=t.line+":"+t.ch}):"autosave"===l&&(o=function(e){null!=t.autosave&&!0===t.autosave.enabled&&e.setAttribute("id","autosaved")}),a.push({className:l,defaultValue:o,onUpdate:i})}var s=document.createElement("div")
1867
1867
  for(s.className="editor-statusbar",r=0;r<a.length;r++){var u=a[r],c=document.createElement("span")
1868
1868
  c.className=u.className,"function"==typeof u.defaultValue&&u.defaultValue(c),"function"==typeof u.onUpdate&&this.codemirror.on("update",function(e,t){return function(){t.onUpdate(e)}}(c,u)),s.appendChild(c)}var f=this.codemirror.getWrapperElement()
1869
- return f.parentNode.insertBefore(s,f.nextSibling),s}},K.prototype.value=function(e){return void 0===e?this.codemirror.getValue():(this.codemirror.getDoc().setValue(e),this)},K.toggleBold=v,K.toggleItalic=y,K.toggleStrikethrough=x,K.toggleBlockquote=w,K.toggleHeadingSmaller=C,K.toggleHeadingBigger=k,K.toggleHeading1=S,K.toggleHeading2=L,K.toggleHeading3=T,K.toggleCodeBlock=b,K.toggleUnorderedList=M,K.toggleOrderedList=A,K.cleanBlock=N,K.drawLink=E,K.drawImage=D,K.drawTable=F,K.drawHorizontalRule=O,K.undo=I,K.redo=B,K.togglePreview=W,K.toggleSideBySide=H,K.toggleFullScreen=g,K.prototype.toggleBold=function(){v(this)},K.prototype.toggleItalic=function(){y(this)},K.prototype.toggleStrikethrough=function(){x(this)},K.prototype.toggleBlockquote=function(){w(this)},K.prototype.toggleHeadingSmaller=function(){C(this)},K.prototype.toggleHeadingBigger=function(){k(this)},K.prototype.toggleHeading1=function(){S(this)},K.prototype.toggleHeading2=function(){L(this)},K.prototype.toggleHeading3=function(){T(this)},K.prototype.toggleCodeBlock=function(){b(this)},K.prototype.toggleUnorderedList=function(){M(this)},K.prototype.toggleOrderedList=function(){A(this)},K.prototype.cleanBlock=function(){N(this)},K.prototype.drawLink=function(){E(this)},K.prototype.drawImage=function(){D(this)},K.prototype.drawTable=function(){F(this)},K.prototype.drawHorizontalRule=function(){O(this)},K.prototype.undo=function(){I(this)},K.prototype.redo=function(){B(this)},K.prototype.togglePreview=function(){W(this)},K.prototype.toggleSideBySide=function(){H(this)},K.prototype.toggleFullScreen=function(){g(this)},K.prototype.isPreviewActive=function(){var e=this.codemirror.getWrapperElement().lastChild
1870
- return/editor-preview-active/.test(e.className)},K.prototype.isSideBySideActive=function(){var e=this.codemirror.getWrapperElement().nextSibling
1871
- return/editor-preview-active-side/.test(e.className)},K.prototype.isFullscreenActive=function(){return this.codemirror.getOption("fullScreen")},K.prototype.getState=function(){return p(this.codemirror)},K.prototype.toTextArea=function(){var e=this.codemirror,t=e.getWrapperElement()
1872
- t.parentNode&&(this.gui.toolbar&&t.parentNode.removeChild(this.gui.toolbar),this.gui.statusbar&&t.parentNode.removeChild(this.gui.statusbar),this.gui.sideBySide&&t.parentNode.removeChild(this.gui.sideBySide)),e.toTextArea(),this.autosaveTimeoutId&&(clearTimeout(this.autosaveTimeoutId),this.autosaveTimeoutId=void 0,this.clearAutosavedValue())},t.exports=K},{"./codemirror/tablist":17,codemirror:10,"codemirror-spell-checker":4,"codemirror/addon/display/fullscreen.js":5,"codemirror/addon/display/placeholder.js":6,"codemirror/addon/edit/continuelist.js":7,"codemirror/addon/mode/overlay.js":8,"codemirror/addon/selection/mark-selection.js":9,"codemirror/mode/gfm/gfm.js":11,"codemirror/mode/markdown/markdown.js":12,"codemirror/mode/xml/xml.js":14}]},{},[18])(18)}))
1869
+ return f.parentNode.insertBefore(s,f.nextSibling),s}},Y.prototype.value=function(e){return void 0===e?this.codemirror.getValue():(this.codemirror.getDoc().setValue(e),this)},Y.toggleBold=y,Y.toggleItalic=x,Y.toggleStrikethrough=b,Y.toggleBlockquote=C,Y.toggleHeadingSmaller=k,Y.toggleHeadingBigger=S,Y.toggleHeading1=L,Y.toggleHeading2=T,Y.toggleHeading3=M,Y.toggleCodeBlock=w,Y.toggleUnorderedList=A,Y.toggleOrderedList=N,Y.cleanBlock=E,Y.drawLink=D,Y.drawImage=F,Y.drawTable=O,Y.drawHorizontalRule=I,Y.undo=B,Y.redo=H,Y.togglePreview=P,Y.toggleSideBySide=W,Y.toggleFullScreen=v,Y.prototype.toggleBold=function(){y(this)},Y.prototype.toggleItalic=function(){x(this)},Y.prototype.toggleStrikethrough=function(){b(this)},Y.prototype.toggleBlockquote=function(){C(this)},Y.prototype.toggleHeadingSmaller=function(){k(this)},Y.prototype.toggleHeadingBigger=function(){S(this)},Y.prototype.toggleHeading1=function(){L(this)},Y.prototype.toggleHeading2=function(){T(this)},Y.prototype.toggleHeading3=function(){M(this)},Y.prototype.toggleCodeBlock=function(){w(this)},Y.prototype.toggleUnorderedList=function(){A(this)},Y.prototype.toggleOrderedList=function(){N(this)},Y.prototype.cleanBlock=function(){E(this)},Y.prototype.drawLink=function(){D(this)},Y.prototype.drawImage=function(){F(this)},Y.prototype.drawTable=function(){O(this)},Y.prototype.drawHorizontalRule=function(){I(this)},Y.prototype.undo=function(){B(this)},Y.prototype.redo=function(){H(this)},Y.prototype.togglePreview=function(){P(this)},Y.prototype.toggleSideBySide=function(){W(this)},Y.prototype.toggleFullScreen=function(){v(this)},Y.prototype.isPreviewActive=function(){var e=this.codemirror.getWrapperElement().lastChild
1870
+ return/editor-preview-active/.test(e.className)},Y.prototype.isSideBySideActive=function(){var e=this.codemirror.getWrapperElement().nextSibling
1871
+ return/editor-preview-active-side/.test(e.className)},Y.prototype.isFullscreenActive=function(){return this.codemirror.getOption("fullScreen")},Y.prototype.getState=function(){return m(this.codemirror)},Y.prototype.toTextArea=function(){var e=this.codemirror,t=e.getWrapperElement()
1872
+ t.parentNode&&(this.gui.toolbar&&t.parentNode.removeChild(this.gui.toolbar),this.gui.statusbar&&t.parentNode.removeChild(this.gui.statusbar),this.gui.sideBySide&&t.parentNode.removeChild(this.gui.sideBySide)),e.toTextArea(),this.autosaveTimeoutId&&(clearTimeout(this.autosaveTimeoutId),this.autosaveTimeoutId=void 0,this.clearAutosavedValue())},t.exports=Y},{"./codemirror/tablist":17,codemirror:10,"codemirror-spell-checker":4,"codemirror/addon/display/fullscreen.js":5,"codemirror/addon/display/placeholder.js":6,"codemirror/addon/edit/continuelist.js":7,"codemirror/addon/mode/overlay.js":8,"codemirror/addon/selection/mark-selection.js":9,"codemirror/mode/gfm/gfm.js":11,"codemirror/mode/markdown/markdown.js":12,"codemirror/mode/xml/xml.js":14}]},{},[18])(18)}))
1873
1873
 
1874
- //# sourceMappingURL=simplemde-2885e4a40ed66fcae974595584efe50b.map
1874
+ //# sourceMappingURL=simplemde-28049a9bd7f432b0648747eb26958a33.map