~evanj/cms

3f5f3d96a1abd0190ebf29b332f36318db941e17 — Evan M Jones 5 months ago f9686e1
Fix(tinymce): Tiny mce breaking local links in editors.
2 files changed, 7 insertions(+), 1 deletions(-)

M internal/s/tmpl/js/content.js
M internal/s/tmpl/tmpls_embed.go
M internal/s/tmpl/js/content.js => internal/s/tmpl/js/content.js +6 -0
@@ 13,6 13,9 @@

  // HTML
  tinymce.init({ 
    relative_urls: false,
    convert_urls: false,
    remove_script_host : false,
    selector: 'textarea.input-html',
    plugins: "code",
    forced_root_block : "", /* No wrapping paragraph tag. */


@@ 27,6 30,9 @@

  // MARKDOWN
  tinymce.init({
    relative_urls: false,
    convert_urls: false,
    remove_script_host : false,
    selector: "textarea.input-markdown",
    plugin: 'textpattern',
    external_plugins: { 

M internal/s/tmpl/tmpls_embed.go => internal/s/tmpl/tmpls_embed.go +1 -1
@@ 38,7 38,7 @@ func init() {

	tmpls["html/space.html"] = tostring("PCFET0NUWVBFIGh0bWw+CjxodG1sIGxhbmc9ZW4+CjxoZWFkPgogIHt7IHRlbXBsYXRlICJodG1sL19oZWFkLmh0bWwiIH19CiAgPHRpdGxlPkNNUyB8IHt7IC5TcGFjZS5OYW1lIH19PC90aXRsZT4KPC9oZWFkPgo8Ym9keSBjbGFzcz0nc3BhY2UgYmctbGlnaHQnPgogIDxzdHlsZT57eyB0ZW1wbGF0ZSAiY3NzL21haW4uY3NzIiB9fTwvc3R5bGU+CiAgPG1haW4+CiAgICB7eyB0ZW1wbGF0ZSAiaHRtbC9faGVhZGVyLmh0bWwiICQgfX0KICAgIDxkaXYgY2xhc3M9InByaWNpbmctaGVhZGVyIHB4LTMgcHktMyBwdC1tZC01IHBiLW1kLTQgbXgtYXV0byB0ZXh0LWNlbnRlciI+CiAgICAgIDxoMSBjbGFzcz0iZGlzcGxheS00Ij57ey5TcGFjZS5OYW1lfX08L2gxPgogICAgICA8cCBjbGFzcz0ibGVhZCI+e3suU3BhY2UuRGVzY319PC9wPgogICAgPC9kaXY+Ci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CaWciPlN0cmluZyBCaWc8L29wdGlvbj4KICAgICAgICAgICAgICAgICAgICAgICAgPG9wdGlvbiBkaXNhYmxlZCB2YWx1ZT0iSW5wdXRIVE1MIj5IVE1MPC9vcHRpb24+CiAgICAgICAgICAgICAgICAgICAgICAgIDxvcHRpb24gZGlzYWJsZWQgdmFsdWU9IklucHV0TWFya2Rvd24iPk1hcmtkb3duPC9vcHRpb24+CiAgICAgICAgICAgICAgICAgICAgICAgIDxvcHRpb24gZGlzYWJsZWQgdmFsdWU9IkZpbGUiPkZpbGU8L29wdGlvbj4KICAgICAgICAgICAgICAgICAgICAgICAgPG9wdGlvbiBkaXNhYmxlZCB2YWx1ZT0iRGF0ZSI+RGF0ZTwvb3B0aW9uPgogICAgICAgICAgICAgICAgICAgICAgICA8b3B0aW9uIGRpc2FibGVkIHZhbHVlPSJSZWZlcmVuY2UiPlJlZmVyZW5jZTwvb3B0aW9uPgogICAgICAgICAgICAgICAgICAgICAgICA8b3B0aW9uIGRpc2FibGVkIHZhbHVlPSJSZWZlcmVuY2VMaXN0Ij5SZWZlcmVuY2VMaXN0PC9vcHRpb24+CiAgICAgICAgICAgICAgICAgICAgICA8L3NlbGVjdD4KICAgICAgICAgICAgICAgICAgICA8L2Rpdj4KICAgICAgICAgICAgICAgICAgICA8ZGl2IGNsYXNzPSdjb2wtNic+CiAgICAgICAgICAgICAgICAgICAgICA8YnV0dG9uIGNsYXNzPSd3LTEwMCBidG4gYnRuLXByaW1hcnknIGRpc2FibGVkIHR5cGU9YnV0dG9uPlJlbW92ZSBGaWVsZDwvYnV0dG9uPgogICAgICAgICAgICAgICAgICAgIDwvZGl2PgogICAgICAgICAgICAgICAgICA8L2Rpdj4KICAgICAgICAgICAgICAgIDwvZGl2PgogICAgICAgICAgICAgICAgPGEgaHJlZj0nIycgY2xhc3M9J2J0biBidG4tbGluaycgaWQ9J2FkZC1maWVsZGJ0bic+QWRkIEFub3RoZXIgRmllbGQ8L2E+CiAgICAgICAgICAgICAgPC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PkNyZWF0ZSBhIG5ldyBjb250ZW50IHR5cGU8L2E+CiAgICAgICAgICAgICAgICA8L3NtYWxsPgogICAgICAgICAgICAgIDxoNiBjbGFzcz0iYm9yZGVyLWJvdHRvbSBib3JkZXItZ3JheSBwYi0yIG1iLTAiPllvdXIgY29udGVudCB0eXBlczwvaDY+CiAgICAgICAgICAgICAge3sgaWYgLkNvbnRlbnRUeXBlcyB9fQogICAgICAgICAgICAgICAge3sgcmFuZ2UgLkNvbnRlbnRUeXBlcyB9fQogICAgICAgICAgICAgICAgPGRpdiBjbGFzcz0ibWVkaWEgdGV4dC1tdXRlZCBwdC0zIj4KICAgICAgICAgICAgICAgICAgPGEgaHJlZj0nL2NvbnRlbnR0eXBlL3t7ICQuU3BhY2UuSUQgfX0ve3sgLklEIH19JyAgY2xhc3M9ImQtYmxvY2sgbWVkaWEtYm9keSBwYi0zIG1iLTAgc21hbGwgbGgtMTI1IGJvcmRlci1ib3R0b20gYm9yZGVyLWdyYXkiPgogICAgICAgICAgICAgICAgICAgIDxzdHJvbmcgY2xhc3M9ImQtYmxvY2sgdGV4dC1ncmF5LWRhcmsiPnt7IC5OYW1lIH19PC9zdHJvbmc+CiAgICAgICAgICAgICAgICAgIDwvYT4KICAgICAgICAgICAgICAgIDwvZGl2PgogICAgICAgICAgICAgICAge3sgZW5kIH19CiAgICAgICAgICAgICAgICA8c21hbGwgY2xhc3M9ImQtYmxvY2sgdGV4dC1yaWdodCBtdC0zIj4KICAgICAgICAgICAgICAgICAgPGEgaHJlZj0iIyI+TG9hZCBtb3JlPC9hPgogICAgICAgICAgICAgICAgPC9zbWFsbD4KICAgICAgICAgICAgICB7eyBlbHNlIH19CiAgICAgICAgICAgICAgICA8ZGl2IGNsYXNzPSJtdC0zIGFsZXJ0IGFsZXJ0LXByaW1hcnkiIHJvbGU9ImFsZXJ0Ij4KICAgICAgICAgICAgICAgICAgWW91IGhhdmVuJ3QgY3JlYXRlZCBhbnkgY29udGVudCB0eXBlcyB5ZXQuIAogICAgICAgICAgICAgICAgPC9kaXY+CiAgICAgICAgICAgICAge3sgZW5kIH19CiAgICAgICAgICAgIDwvZGl2PgogICAgICAgICAgPC9kaXY+CiAgICAgICAgICA8ZGl2IGNsYXNzPSdjb2wtbGctNic+CiAgICAgICAgICAgIDxkaXYgY2xhc3M9Im15LTMgcC0zIGJnLXdoaXRlIHJvdW5kZWQgc2hhZG93LXNtIj4KICAgICAgICAgICAgICAgIDxzbWFsbCBjbGFzcz0iZC1ibG9jayB0ZXh0LXJpZ2h0IGZsb2F0LXJpZ2h0IiBkYXRhLXRvZ2dsZT0ibW9kYWwiIGRhdGEtdGFyZ2V0PSIjaG9va01vZGFsIj4KICAgICAgICAgICAgICAgICAgPGEgaHJlZj0iIyI+Q3JlYXRlIGEgbmV3IHdlYmhvb2s8L2E+CiAgICAgICAgICAgICAgICA8L3NtYWxsPgogICAgICAgICAgICAgIDxoNiBjbGFzcz0iYm9yZGVyLWJvdHRvbSBib3JkZXItZ3JheSBwYi0yIG1iLTAiPllvdXIgd2ViaG9va3M8L2g2PgogICAgICAgICAgICAgIHt7IGlmIC5Ib29rcyB9fQogICAgICAgICAgICAgICAge3sgcmFuZ2UgLkhvb2tzIH19CiAgICAgICAgICAgICAgICA8ZGl2IGNsYXNzPSJtZWRpYSB0ZXh0LW11dGVkIHB0LTMiPgogICAgICAgICAgICAgICAgICA8YSBocmVmPScvaG9vay97eyAkLlNwYWNlLklEIH19L3t7IC5JRCB9fScgIGNsYXNzPSJkLWJsb2NrIG1lZGlhLWJvZHkgcGItMyBtYi0wIHNtYWxsIGxoLTEyNSBib3JkZXItYm90dG9tIGJvcmRlci1ncmF5Ij4KICAgICAgICAgICAgICAgICAgICA8c3Ryb25nIGNsYXNzPSJkLWJsb2NrIHRleHQtZ3JheS1kYXJrIj57eyAuVVJMIH19PC9zdHJvbmc+CiAgICAgICAgICAgICAgICAgIDwvYT4KICAgICAgICAgICAgICAgIDwvZGl2PgogICAgICAgICAgICAgICAge3sgZW5kIH19CiAgICAgICAgICAgICAgICA8c21hbGwgY2xhc3M9ImQtYmxvY2sgdGV4dC1yaWdodCBtdC0zIj4KICAgICAgICAgICAgICAgICAgPGEgaHJlZj0iIyI+TG9hZCBtb3JlPC9hPgogICAgICAgICAgICAgICAgPC9zbWFsbD4KICAgICAgICAgICAgICB7eyBlbHNlIH19CiAgICAgICAgICAgICAgICA8ZGl2IGNsYXNzPSJtdC0zIGFsZXJ0IGFsZXJ0LXByaW1hcnkiIHJvbGU9ImFsZXJ0Ij4KICAgICAgICAgICAgICAgICAgWW91IGhhdmVuJ3QgY3JlYXRlZCBhbnkgd2ViaG9va3MgeWV0LiAKICAgICAgICAgICAgICAgIDwvZGl2PgogICAgICAgICAgICAgIHt7IGVuZCB9fQogICAgICAgICAgICA8L2Rpdj4KICAgICAgICAgIDwvZGl2PgogICAgICAgIDwvZGl2PgogICAgICA8L2Rpdj4KCiAgICA8L2FydGljbGU+CiAgICB7eyB0ZW1wbGF0ZSAiaHRtbC9fZm9vdGVyLmh0bWwiIH19CiAgPC9tYWluPgogIHt7IHRlbXBsYXRlICJodG1sL19zY3JpcHRzLmh0bWwiIH19CiAgPHNjcmlwdD57eyB0ZW1wbGF0ZSAianMvbWFpbi5qcyIgJCB9fTwvc2NyaXB0PgogIDxzY3JpcHQ+e3sgdGVtcGxhdGUgImpzL3NwYWNlLmpzIiAkIH19PC9zY3JpcHQ+CjwvYm9keT4KCjwvaHRtbD4K")

	tmpls["js/content.js"] = tostring("Ly8gU2V0dXAgaW5wdXRzIGZvciBjb250ZW50IGNyZWF0ZS91cGRhdGUuCihmdW5jdGlvbigpIHsgCgogIC8vIFNhdmUgYnV0dG9uIAogIHZhciBzYXZlQnRuID0gZG9jdW1lbnQucXVlcnlTZWxlY3RvcignaW5wdXRbdmFsdWU9U2F2ZV0nKQogIGlmIChzYXZlQnRuKSB7CiAgICBzYXZlQnRuLmFkZEV2ZW50TGlzdGVuZXIoJ2NsaWNrJywgZnVuY3Rpb24gY29ud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IGJlIHJlZiBsaXN0CiAgICAgIHZhciBjaG9zZW5Db250ZW50TmFtZXMgPSBbXSAvLyBvbmx5IHVzZWQgYmUgcmVmIGxpc3QKCiAgICAgIG1vZGFsLmFkZEV2ZW50TGlzdGVuZXIoJ3Nob3duLmJzLm1vZGFsJywgZnVuY3Rpb24oKSB7IAogICAgICAgIHZhciBvcHRzID0gewogICAgICAgICAgYXV0b3NlbGVjdDogdHJ1ZSwKICAgICAgICAgIGF1dG9zZWxlY3RPbkJsdXI6IHRydWUsIAogICAgICAgICAgdGFiQXV0b2NvbXBsZXRlOiB0cnVlLAogICAgICAgICAgLy8gY2xlYXJPblNlbGVjdGVkOiB0cnVlLAogICAgICAgICAgaGludDogZmFsc2UsCiAgICAgICAgICAvLyBkZWJ1ZzogdHJ1ZQogICAgICAgIH0KCiAgICAgICAgZnVuY3Rpb24gZ2V0b3B0cyh1cmwsIHRyYW5zZm9ybSwgZGlzcGxheUtleSkgeyAKICAgICAgICAgIHZhciBjb250ZW50dHlwZUFib3J0ID0gZnVuY3Rpb24oKSB7fQogICAgICAgICAgcmV0dXJuIHsKICAgICAgICAgICAgZGlzcGxheUtleTogZGlzcGxheUtleSwKICAgICAgICAgICAgc291cmNlOiBmdW5jdGlvbihxdWVyeSwgY2IpIHsgCiAgICAgICAgICAgICAgY2IoW10pCiAgICAgICAgICAgICAgY29udGVudHR5cGVBYm9ydCgpCiAgICAgICAgICAgICAgdmFyIHJlcSA9IG5ldyBYTUxIdHRwUmVxdWVzdCgpCiAgICAgICAgICAgICAgY29udGVudHR5cGVBYm9ydCA9IGZ1bmN0aW9uKCkgeyByZXEuYWJvcnQoKSB9IAogICAgICAgICAgICAgIHJlcS5vbnJlYWR5c3RhdGVjaGFuZ2UgPSBmdW5jdGlvbigpIHsKICAgICAgICAgICAgICAgIGlmICh0aGlzLnJlYWR5U3RhdGUgIT0gNCkgewogICAgICAgICAgICAgICAgICByZXR1cm4KICAgICAgICAgICAgICAgIH0KCiAgICAgICAgICAgICAgICBpZiAodGhpcy5zdGF0dXMgIT0gMjAwKSB7CiAgICAgICAgICAgICAgICAgIGlmICh0aGlzLnJlc3BvbnNlVGV4dCAhPSAiIikgewogICAgICAgICAgICAgICAgICAgIGFsZXJ0KHRoaXMucmVzcG9uc2VUZXh0KQogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICAgIGNiKFtdKQogICAgICAgICAgICAgICAgICByZXR1cm4KICAgICAgICAgICAgICAgIH0KCiAgICAgICAgICAgICAgICB0cnkgeyAKICAgICAgICAgICAgICAgICAgY2IodHJhbnNmb3JtKEpTT04ucGFyc2UodGhpcy5yZXNwb25zZVRleHQpKSkKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICAgIGNhdGNoKGUpIHsgCiAgICAgICAgICAgICAgICAgIHZhciBtc2cgPSBlLnRvU3RyaW5nKCkKICAgICAgICAgICAgICAgICAgY29uc29sZS5sb2coe2UsbXNnfSkKICAgICAgICAgICAgICAgICAgaWYgKG1zZyAhPSAiIikgeyAvLyBDYW5jZWxsZWQgcmVxdWVzdHMgaGl0IHRoaXMuCiAgICAgICAgICAgICAgICAgICAgYWxlcnQobXNnKQogICAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIHJlcS5vcGVuKCdHRVQnLCB1cmwoKSArIHF1ZXJ5LCB0cnVlKQogICAgICAgICAgICAgIHJlcS5zZW5kKCkKICAgICAgICAgICAgfQogICAgICAgICAgfQogICAgICAgIH0KCiAgICAgICAgdmFyIGNvbnRlbnR0eXBlT3B0cyA9IGdldG9wdHMoCiAgICAgICAgICBmdW5jdGlvbigpIHsgcmV0dXJuICcvY29udGVudHR5cGUvc2VhcmNoP3NwYWNlPXt7IC5TcGFjZS5JRCB9fSZxdWVyeT0nOyB9LCAKICAgICAgICAgIGZ1bmN0aW9uKGRhdGEpIHsgcmV0dXJuIGRhdGEgfSwKICAgICAgICAgICdDb250ZW50VHlwZU5h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ZCB9fQoKICAgICAgICAgICAgaWYgKGlzTGlzdCkgewogICAgICAgICAgICAgIGRhdGEgPSBkYXRhLmZpbHRlcihmdW5jdGlvbihpdGVtKSB7IHJldHVybiBjaG9zZW5Db250ZW50SURzLmluZGV4T2YoaXRlbS5Db250ZW50SUQpID09PSAtMTsgfSk7CiAgICAgICAgICAgIH0KCiAgICAgICAgICAgIGZvciAoaSA9IDA7IGkgPCBkYXRhLmxlbmd0aDsgaSsrKSB7IC8vIFRoaXMgcmVzcG9uc2UgaXMgcGFnZWQsIGRvbid0IHdvcnJ5IGFib3V0IE9eMi4gTWF4IG9mIDIwIGl0ZW1zLgoKICAgICAgICAgICAgICBmb3IgKGogPSAwOyBqIDwgZGF0YVtpXS5Db250ZW50VmFsdWVzLmxlbmd0aDsgaisrKSB7CiAgICAgICAgICAgICAgICBpZiAoZGF0YVtpXS5Db250ZW50VmFsdWVzW2pdLkZpZWxkTmFtZSA9PSAibmFtZSIpIHsgLy8gV2UncmUgZ3VhcmFudGVlZCB0byBoYXZlIHRoaXMuCiAgICAgICAgICAgICAgICAgIE9iamVjdC5hc3NpZ24oZGF0YVtpXSwgZGF0YVtpXS5Db250ZW50VmFsdWVzW2pdKQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIH0KICAgICAgICAgICAgfQogICAgICAgICAgICByZXR1cm4gZGF0YQogICAgICAgICAgfSwKICAgICAgICAgICdGaWVsZFZhbHVlJwogICAgICAgICkKCiAgICAgICAgLy8gVE9ETzogV2VpcmQgYmVoYXZpb3IgaGVyZSwgd2h5IGRvIEkgaGF2ZSB0byBpbmxpbmUgdGhpcyBjbGVhciBvbgogICAgICAgIC8vIHNlbGVjdGVkPyBXaHkgY2FuJ3QgaXQgZXhpc3RzIGluIGNvbnRlbnRPcHRzPwogICAgICAgIGF1dG9DID0gd2luZG93LmF1dG9jb21wbGV0ZShjb250ZW50LCBPYmplY3QuYXNzaWduKHt9LCBvcHRzLCB7Y2xlYXJPblNlbGVjdGVkOnRydWV9KSwgW2NvbnRlbnRPcHRzXSkub24oJ2F1dG9jb21wbGV0ZTpzZWxlY3RlZCcsIG9uQ29udGVudFNlbGVjdGVkKQogICAgICAgIGZ1bmN0aW9uIG9uQ29udGVudFNlbGVjdGVkKGUsIGl0ZW0sIGRhdGFzZXQsIGN0eCkgewogICAgICAgICAgaWYgKGlzTGlzdCkgewogICAgICAgICAgICBjaG9zZW5Db250ZW50SURzLnB1c2goaXRlbS5Db250ZW50SUQpCiAgICAgICAgICAgIGNob3NlbkNvbnRlbnROYW1lcy5wdXNoKGl0ZW0uRmllbGRWYWx1ZSkKICAgICAgICAgICAgb3V0cHV0LnZhbHVlID0gY2hvc2VuQ29udGVudElEcwogICAgICAgICAgICAgIC5maWx0ZXIoZnVuY3Rpb24odmFsLCBpLCBzZWxmKSB7IHJldHVybiBzZWxmLmluZGV4T2YodmFsKSA9PT0gaSB9KQogICAgICAgICAgICAgIC5qb2luKCctJykKICAgICAgICAgICAgYnRuLnZhbHVlID0gY2hvc2VuQ29udGVudE5hbWVzCiAgICAgICAgICAgICAgLmZpbHRlcihmdW5jdGlvbih2YWwsIGksIHNlbGYpIHsgcmV0dXJuIHNlbGYuaW5kZXhPZih2YWwpID09PSBpIH0pCiAgICAgICAgICAgICAgLmpvaW4oJywgJykKICAgICAgICAgIH0KICAgICAgICAgIGVsc2UgewogICAgICAgICAgICBvdXRwdXQudmFsdWUgPSBpdGVtLkNvbnRlbnRJRAogICAgICAgICAgICBidG4udmFsdWUgPSBpdGVtLkZpZWxkVmFsdWUKICAgICAgICAgICAgYm9vdHN0cmFwLk1vZGFsLmdldEluc3RhbmNlKG1vZGFsKS5oaWRlKCkKICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0pCgogICAgICBtb2RhbC5hZGRFdmVudExpc3RlbmVyKCdoaWRkZW4uYnMubW9kYWwnLCBmdW5jdGlvbigpIHsgCiAgICAgICAgaW5wdXRDVC52YWx1ZSA9ICcnCiAgICAgICAgYXV0b0NULmF1dG9jb21wbGV0ZS5kZXN0cm95KCkKICAgICAgICBhdXRvQ1QgPSBmYWxzZTsKICAgICAgICBpbnB1dEMudmFsdWUgPSAnJwogICAgICAgIGlucHV0Qy5kaXNhYmxlZCA9IHRydWUKICAgICAgICBhdXRvQy5hdXRvY29tcGxldGUuZGVzdHJveSgpCiAgICAgICAgYXV0b0MgPSBmYWxzZTsKICAgICAgfSkKCiAgICAgIGNsZWFyLmFkZEV2ZW50TGlzdGVuZXIoJ2NsaWNrJywgZnVuY3Rpb24oKSB7IAogICAgICAgIGlucHV0Q1QudmFsdWUgPSAnJzsKICAgICAgICBpbnB1dEMudmFsdWUgPSAnJzsKICAgICAgICBpbnB1dEMuZGlzYWJsZWQgPSB0cnVlOwogICAgICAgIGlucHV0Q1QuZm9jdXMoKTsKICAgICAgICBvdXRwdXQudmFsdWUgPSAnJzsKICAgICAgICBidG4udmFsdWUgPSAnT3Blbic7CiAgICAgICAgY2hvc2VuQ29udGVudFR5cGVJRCA9IHZvaWQgMDsKICAgICAgICBjaG9zZW5Db250ZW50SURzID0gW107CiAgICAgICAgY2hvc2VuQ29udGVudE5hbWVzID0gW107CiAgICAgIH0pCgogICAgfSkocmVmLCBvdXRwdXQsIGJ0biwgaW5wdXRDVCwgaW5wdXRDLCBtb2RhbCwgY2xlYXIpOwogIH0KCn0pKCk7Cg==")
	tmpls["js/content.js"] = tostring("Ly8gU2V0dXAgaW5wdXRzIGZvciBjb250ZW50IGNyZWF0ZS91cGRhdGUuCihmdW5jdGlvbigpIHsgCgogIC8vIFNhdmUgYnV0dG9uIAogIHZhciBzYXZlQnRuID0gZG9jdW1lbnQucXVlcnlTZWxlY3RvcignaW5wdXRbdmFsdWU9U2F2ZV0nKQogIGlmIChzYXZlQnRuKSB7CiAgICBzYXZlQnRuLmFkZEV2ZW50TGlzdGVuZXIoJ2NsaWNrJywgZnVuY3Rpb24gY29udGVudFVwZGF0ZShlKSB7IAogICAgICBlLnByZXZlbnREZWZhdWx0KCkKICAgICA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IHJlZi5jbGFzc05hbWUuaW5kZXhPZigncmVmLWxpc3QnKSAhPSAtMTsKCiAgICAgIHZhciBjaG9zZW5Db250ZW50VHlwZUlEIC8vIHVzZWQgYnkgYm90aAogICAgICB2YXIgY2hvc2VuQ29udGVudElEcyA9IFtdIC8vIG9ubHkgdXNlZCBiZSByZWYgbGlzdAogICAgICB2YXIgY2hvc2VuQ29udGVudE5hbWVzID0gW10gLy8gb25seSB1c2VkIGJlIHJlZiBsaXN0CgogICAgICBtb2RhbC5hZGRFdmVudExpc3RlbmVyKCdzaG93bi5icy5tb2RhbCcsIGZ1bmN0aW9uKCkgeyAKICAgICAgICB2YXIgb3B0cyA9IHsKICAgICAgICAgIGF1dG9zZWxlY3Q6IHRydWUsCiAgICAgICAgICBhdXRvc2VsZWN0T25CbHVyOiB0cnVlLCAKICAgICAgICAgIHRhYkF1dG9jb21wbGV0ZTogdHJ1ZSwKICAgICAgICAgIC8vIGNsZWFyT25TZWxlY3RlZDogdHJ1ZSwKICAgICAgICAgIGhpbnQ6IGZhbHNlLAogICAgICAgICAgLy8gZGVidWc6IHRydWUKICAgICAgICB9CgogICAgICAgIGZ1bmN0aW9uIGdldG9wdHModXJsLCB0cmFuc2Zvcm0sIGRpc3BsYXlLZXkpIHsgCiAgICAgICAgICB2YXIgY29udGVudHR5cGVBYm9ydCA9IGZ1bmN0aW9uKCkge30KICAgICAgICAgIHJldHVybiB7CiAgICAgICAgICAgIGRpc3BsYXlLZXk6IGRpc3BsYXlLZXksCiAgICAgICAgICAgIHNvdXJjZTogZnVuY3Rpb24ocXVlcnksIGNiKSB7IAogICAgICAgICAgICAgIGNiKFtdKQogICAgICAgICAgICAgIGNvbnRlbnR0eXBlQWJvcnQoKQogICAgICAgICAgICAgIHZhciByZXEgPSBuZXcgWE1MSHR0cFJlcXVlc3QoKQogICAgICAgICAgICAgIGNvbnRlbnR0eXBlQWJvcnQgPSBmdW5jdGlvbigpIHsgcmVxLmFib3J0KCkgfSAKICAgICAgICAgICAgICByZXEub25yZWFkeXN0YXRlY2hhbmdlID0gZnVuY3Rpb24oKSB7CiAgICAgICAgICAgICAgICBpZiAodGhpcy5yZWFkeVN0YXRlICE9IDQpIHsKICAgICAgICAgICAgICAgICAgcmV0dXJuCiAgICAgICAgICAgICAgICB9CgogICAgICAgICAgICAgICAgaWYgKHRoaXMuc3RhdHVzICE9IDIwMCkgewogICAgICAgICAgICAgICAgICBpZiAodGhpcy5yZXNwb25zZVRleHQgIT0gIiIpIHsKICAgICAgICAgICAgICAgICAgICBhbGVydCh0aGlzLnJlc3BvbnNlVGV4dCkKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgICBjYihbXSkKICAgICAgICAgICAgICAgICAgcmV0dXJuCiAgICAgICAgICAgICAgICB9CgogICAgICAgICAgICAgICAgdHJ5IHsgCiAgICAgICAgICAgICAgICAgIGNiKHRyYW5zZm9ybShKU09OLnBhcnNlKHRoaXMucmVzcG9uc2VUZXh0KSkpCiAgICAgICAgICAgICAgICB9CiAgICAgICAgICAgICAgICBjYXRjaChlKSB7IAogICAgICAgICAgICAgICAgICB2YXIgbXNnID0gZS50b1N0cmluZygpCiAgICAgICAgICAgICAgICAgIGNvbnNvbGUubG9nKHtlLG1zZ30pCiAgICAgICAgICAgICAgICAgIGlmIChtc2cgIT0gIiIpIHsgLy8gQ2FuY2VsbGVkIHJlcXVlc3RzIGhpdCB0aGlzLgogICAgICAgICAgICAgICAgICAgIGFsZXJ0KG1zZykKICAgICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgICAgfQogICAgICAgICAgICAgIH0KICAgICAgICAgICAgICByZXEub3BlbignR0VUJywgdXJsKCkgKyBxdWVyeSwgdHJ1ZSkKICAgICAgICAgICAgICByZXEuc2VuZCgpCiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9CgogICAgICAgIHZhciBjb250ZW50dHlwZU9wdHMgPSBnZXRvcHRzKAogICAgICAgICAgZnVuY3Rpb24oKSB7IHJldHVybiAnL2NvbnRlbnR0eXBlL3NlYXJjaD9zcGFjZT17eyAuU3BhY2UuSUQgfX0mcXVlcnk9JzsgfSwgCiAgICAgICAgICBmdW5jdGlvbihkYXRhKSB7IHJldHVybiBkYXRhIH0sCiAgICAgICAgICAnQ29udGVudFR5cGVOYW1lJwogICAgICAgICkKCiAgICAgICAgYXV0b0NUID0gd2luZG93LmF1dG9jb21wbGV0ZShjb250ZW50dHlwZSwgb3B0cywgW2NvbnRlbnR0eXBlT3B0c10pLm9uKCdhdXRvY29tcGxldGU6c2VsZWN0ZWQnLCBvbkNvbnRlbnRUeXBlU2VsZWN0ZWQpCiAgICAgICAgZnVuY3Rpb24gb25Db250ZW50VHlwZVNlbGVjdGVkKGUsIGl0ZW0sIGRhdGFzZXQsIGN0eCkgewogICAgICAgICAgY2hvc2VuQ29udGVudFR5cGVJRCA9IGl0ZW0uQ29udGVudFR5cGVJRAogICAgICAgICAgY29udGVudC5kaXNhYmxlZCA9IGZhbHNlCiAgICAgICAgICBjb250ZW50LmZvY3VzKCkKICAgICAgICB9CgogICAgICAgIHZhciBjb250ZW50T3B0cyA9IGdldG9wdHMoCiAgICAgICAgICBmdW5jdGlvbigpIHsgcmV0dXJuICcvY29udGVudC9zZWFyY2g/c3BhY2U9e3sgLlNwYWNlLklEIH19JmNvbnRlbnR0eXBlPScgKyBjaG9zZW5Db250ZW50VHlwZUlEICsgJyZxdWVyeT0nOyB9LCAKICAgICAgICAgIGZ1bmN0aW9uKGRhdGEpIHsgCiAgICAgICAgICAgIC8vIEJpZyBoYWNrLgogICAgICAgICAgICBkYXRhID0gZGF0YSA/IGRhdGEgOiBbXQoKICAgICAgICAgICAgLy8gVE9ETzogUmVtb3ZlIGN1cnJlbnQgY29udGVudCBmcm9tIGxpc3QgaWYgYXZhaWxhYmxlLiBUaGlzIAogICAgICAgICAgICAvLyBzaG91bGQgYmUgZG9uZSBvbiB0aGUgc2VydmVyLgogICAgICAgICAgICB7eyBpZiAuQ29udGVudCB9fQogICAgICAgICAgICBkYXRhID0gZGF0YS5maWx0ZXIoZnVuY3Rpb24oaXRlbSkgeyByZXR1cm4gaXRlbS5Db250ZW50SUQgIT0ge3sgLkNvbnRlbnQuSUQgfX07IH0pOwogICAgICAgICAgICB7eyBlbmQgfX0KCiAgICAgICAgICAgIGlmIChpc0xpc3QpIHsKICAgICAgICAgICAgICBkYXRhID0gZGF0YS5maWx0ZXIoZnVuY3Rpb24oaXRlbSkgeyByZXR1cm4gY2hvc2VuQ29udGVudElEcy5pbmRleE9mKGl0ZW0uQ29udGVudElEKSA9PT0gLTE7IH0pOwogICAgICAgICAgICB9CgogICAgICAgICAgICBmb3IgKGkgPSAwOyBpIDwgZGF0YS5sZW5ndGg7IGkrKykgeyAvLyBUaGlzIHJlc3BvbnNlIGlzIHBhZ2VkLCBkb24ndCB3b3JyeSBhYm91dCBPXjIuIE1heCBvZiAyMCBpdGVtcy4KCiAgICAgICAgICAgICAgZm9yIChqID0gMDsgaiA8IGRhdGFbaV0uQ29udGVudFZhbHVlcy5sZW5ndGg7IGorKykgewogICAgICAgICAgICAgICAgaWYgKGRhdGFbaV0uQ29udGVudFZhbHVlc1tqXS5GaWVsZE5hbWUgPT0gIm5hbWUiKSB7IC8vIFdlJ3JlIGd1YXJhbnRlZWQgdG8gaGF2ZSB0aGlzLgogICAgICAgICAgICAgICAgICBPYmplY3QuYXNzaWduKGRhdGFbaV0sIGRhdGFbaV0uQ29udGVudFZhbHVlc1tqXSkKICAgICAgICAgICAgICAgIH0KICAgICAgICAgICAgICB9CiAgICAgICAgICAgIH0KICAgICAgICAgICAgcmV0dXJuIGRhdGEKICAgICAgICAgIH0sCiAgICAgICAgICAnRmllbGRWYWx1ZScKICAgICAgICApCgogICAgICAgIC8vIFRPRE86IFdlaXJkIGJlaGF2aW9yIGhlcmUsIHdoeSBkbyBJIGhhdmUgdG8gaW5saW5lIHRoaXMgY2xlYXIgb24KICAgICAgICAvLyBzZWxlY3RlZD8gV2h5IGNhbid0IGl0IGV4aXN0cyBpbiBjb250ZW50T3B0cz8KICAgICAgICBhdXRvQyA9IHdpbmRvdy5hdXRvY29tcGxldGUoY29udGVudCwgT2JqZWN0LmFzc2lnbih7fSwgb3B0cywge2NsZWFyT25TZWxlY3RlZDp0cnVlfSksIFtjb250ZW50T3B0c10pLm9uKCdhdXRvY29tcGxldGU6c2VsZWN0ZWQnLCBvbkNvbnRlbnRTZWxlY3RlZCkKICAgICAgICBmdW5jdGlvbiBvbkNvbnRlbnRTZWxlY3RlZChlLCBpdGVtLCBkYXRhc2V0LCBjdHgpIHsKICAgICAgICAgIGlmIChpc0xpc3QpIHsKICAgICAgICAgICAgY2hvc2VuQ29udGVudElEcy5wdXNoKGl0ZW0uQ29udGVudElEKQogICAgICAgICAgICBjaG9zZW5Db250ZW50TmFtZXMucHVzaChpdGVtLkZpZWxkVmFsdWUpCiAgICAgICAgICAgIG91dHB1dC52YWx1ZSA9IGNob3NlbkNvbnRlbnRJRHMKICAgICAgICAgICAgICAuZmlsdGVyKGZ1bmN0aW9uKHZhbCwgaSwgc2VsZikgeyByZXR1cm4gc2VsZi5pbmRleE9mKHZhbCkgPT09IGkgfSkKICAgICAgICAgICAgICAuam9pbignLScpCiAgICAgICAgICAgIGJ0bi52YWx1ZSA9IGNob3NlbkNvbnRlbnROYW1lcwogICAgICAgICAgICAgIC5maWx0ZXIoZnVuY3Rpb24odmFsLCBpLCBzZWxmKSB7IHJldHVybiBzZWxmLmluZGV4T2YodmFsKSA9PT0gaSB9KQogICAgICAgICAgICAgIC5qb2luKCcsICcpCiAgICAgICAgICB9CiAgICAgICAgICBlbHNlIHsKICAgICAgICAgICAgb3V0cHV0LnZhbHVlID0gaXRlbS5Db250ZW50SUQKICAgICAgICAgICAgYnRuLnZhbHVlID0gaXRlbS5GaWVsZFZhbHVlCiAgICAgICAgICAgIGJvb3RzdHJhcC5Nb2RhbC5nZXRJbnN0YW5jZShtb2RhbCkuaGlkZSgpCiAgICAgICAgICB9CiAgICAgICAgfQogICAgICB9KQoKICAgICAgbW9kYWwuYWRkRXZlbnRMaXN0ZW5lcignaGlkZGVuLmJzLm1vZGFsJywgZnVuY3Rpb24oKSB7IAogICAgICAgIGlucHV0Q1QudmFsdWUgPSAnJwogICAgICAgIGF1dG9DVC5hdXRvY29tcGxldGUuZGVzdHJveSgpCiAgICAgICAgYXV0b0NUID0gZmFsc2U7CiAgICAgICAgaW5wdXRDLnZhbHVlID0gJycKICAgICAgICBpbnB1dEMuZGlzYWJsZWQgPSB0cnVlCiAgICAgICAgYXV0b0MuYXV0b2NvbXBsZXRlLmRlc3Ryb3koKQogICAgICAgIGF1dG9DID0gZmFsc2U7CiAgICAgIH0pCgogICAgICBjbGVhci5hZGRFdmVudExpc3RlbmVyKCdjbGljaycsIGZ1bmN0aW9uKCkgeyAKICAgICAgICBpbnB1dENULnZhbHVlID0gJyc7CiAgICAgICAgaW5wdXRDLnZhbHVlID0gJyc7CiAgICAgICAgaW5wdXRDLmRpc2FibGVkID0gdHJ1ZTsKICAgICAgICBpbnB1dENULmZvY3VzKCk7CiAgICAgICAgb3V0cHV0LnZhbHVlID0gJyc7CiAgICAgICAgYnRuLnZhbHVlID0gJ09wZW4nOwogICAgICAgIGNob3NlbkNvbnRlbnRUeXBlSUQgPSB2b2lkIDA7CiAgICAgICAgY2hvc2VuQ29udGVudElEcyA9IFtdOwogICAgICAgIGNob3NlbkNvbnRlbnROYW1lcyA9IFtdOwogICAgICB9KQoKICAgIH0pKHJlZiwgb3V0cHV0LCBidG4sIGlucHV0Q1QsIGlucHV0QywgbW9kYWwsIGNsZWFyKTsKICB9Cgp9KSgpOwo=")

	tmpls["js/main.js"] = tostring("Ly8gT24gbW9kYWwgb3BlbiBhbHdheXMgZm9jdXMgZmlyc3QgaW5wdXQgb3IgY2xvc2UgYnV0dG9uLiBBbHNvLCBmaXggYm9vdHN0cmFwIAovLyBtb2RhbCBldmVudCBidWJibGluZyBzbyBuZXN0ZWQgbW9kYWxzIHdvcmsuCihmdW5jdGlvbigp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