mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-14 23:22:52 +01:00
1 line
1.7 MiB
1 line
1.7 MiB
{"version":3,"sources":["grapes.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"grapes.min.js","sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse if(typeof exports === 'object')\n\t\texports[\"grapesjs\"] = factory();\n\telse\n\t\troot[\"grapesjs\"] = factory();\n})(this, function() {\nreturn /******/ (function(modules) { // webpackBootstrap\n/******/ \t// The module cache\n/******/ \tvar installedModules = {};\n/******/\n/******/ \t// The require function\n/******/ \tfunction __webpack_require__(moduleId) {\n/******/\n/******/ \t\t// Check if module is in cache\n/******/ \t\tif(installedModules[moduleId]) {\n/******/ \t\t\treturn installedModules[moduleId].exports;\n/******/ \t\t}\n/******/ \t\t// Create a new module (and put it into the cache)\n/******/ \t\tvar module = installedModules[moduleId] = {\n/******/ \t\t\ti: moduleId,\n/******/ \t\t\tl: false,\n/******/ \t\t\texports: {}\n/******/ \t\t};\n/******/\n/******/ \t\t// Execute the module function\n/******/ \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n/******/\n/******/ \t\t// Flag the module as loaded\n/******/ \t\tmodule.l = true;\n/******/\n/******/ \t\t// Return the exports of the module\n/******/ \t\treturn module.exports;\n/******/ \t}\n/******/\n/******/\n/******/ \t// expose the modules object (__webpack_modules__)\n/******/ \t__webpack_require__.m = modules;\n/******/\n/******/ \t// expose the module cache\n/******/ \t__webpack_require__.c = installedModules;\n/******/\n/******/ \t// define getter function for harmony exports\n/******/ \t__webpack_require__.d = function(exports, name, getter) {\n/******/ \t\tif(!__webpack_require__.o(exports, name)) {\n/******/ \t\t\tObject.defineProperty(exports, name, {\n/******/ \t\t\t\tconfigurable: false,\n/******/ \t\t\t\tenumerable: true,\n/******/ \t\t\t\tget: getter\n/******/ \t\t\t});\n/******/ \t\t}\n/******/ \t};\n/******/\n/******/ \t// getDefaultExport function for compatibility with non-harmony modules\n/******/ \t__webpack_require__.n = function(module) {\n/******/ \t\tvar getter = module && module.__esModule ?\n/******/ \t\t\tfunction getDefault() { return module['default']; } :\n/******/ \t\t\tfunction getModuleExports() { return module; };\n/******/ \t\t__webpack_require__.d(getter, 'a', getter);\n/******/ \t\treturn getter;\n/******/ \t};\n/******/\n/******/ \t// Object.prototype.hasOwnProperty.call\n/******/ \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n/******/\n/******/ \t// __webpack_public_path__\n/******/ \t__webpack_require__.p = \"\";\n/******/\n/******/ \t// Load entry module and return exports\n/******/ \treturn __webpack_require__(__webpack_require__.s = 59);\n/******/ })\n/************************************************************************/\n/******/ ([\n/* 0 */\n/***/ (function(module, exports, __webpack_require__) {\n\n/* WEBPACK VAR INJECTION */(function(global) {var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;// Backbone.js 1.3.3\n\n// (c) 2010-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n// Backbone may be freely distributed under the MIT license.\n// For all details and documentation:\n// http://backbonejs.org\n\n(function(factory) {\n\n // Establish the root object, `window` (`self`) in the browser, or `global` on the server.\n // We use `self` instead of `window` for `WebWorker` support.\n var root = (typeof self == 'object' && self.self === self && self) ||\n (typeof global == 'object' && global.global === global && global);\n\n // Set up Backbone appropriately for the environment. Start with AMD.\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(9), exports], __WEBPACK_AMD_DEFINE_RESULT__ = function(_, $, exports) {\n // Export global even in AMD case in case this script is loaded with\n // others that may still expect a global Backbone.\n root.Backbone = factory(root, exports, _, $);\n }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\n // Next for Node.js or CommonJS. jQuery may not be needed as a module.\n } else if (typeof exports !== 'undefined') {\n var _ = require('underscore'), $;\n try { $ = require('jquery'); } catch (e) {}\n factory(root, exports, _, $);\n\n // Finally, as a browser global.\n } else {\n root.Backbone = factory(root, {}, root._, (root.jQuery || root.Zepto || root.ender || root.$));\n }\n\n})(function(root, Backbone, _, $) {\n\n // Initial Setup\n // -------------\n\n // Save the previous value of the `Backbone` variable, so that it can be\n // restored later on, if `noConflict` is used.\n var previousBackbone = root.Backbone;\n\n // Create a local reference to a common array method we'll want to use later.\n var slice = Array.prototype.slice;\n\n // Current version of the library. Keep in sync with `package.json`.\n Backbone.VERSION = '1.3.3';\n\n // For Backbone's purposes, jQuery, Zepto, Ender, or My Library (kidding) owns\n // the `$` variable.\n Backbone.$ = $;\n\n // Runs Backbone.js in *noConflict* mode, returning the `Backbone` variable\n // to its previous owner. Returns a reference to this Backbone object.\n Backbone.noConflict = function() {\n root.Backbone = previousBackbone;\n return this;\n };\n\n // Turn on `emulateHTTP` to support legacy HTTP servers. Setting this option\n // will fake `\"PATCH\"`, `\"PUT\"` and `\"DELETE\"` requests via the `_method` parameter and\n // set a `X-Http-Method-Override` header.\n Backbone.emulateHTTP = false;\n\n // Turn on `emulateJSON` to support legacy servers that can't deal with direct\n // `application/json` requests ... this will encode the body as\n // `application/x-www-form-urlencoded` instead and will send the model in a\n // form param named `model`.\n Backbone.emulateJSON = false;\n\n // Proxy Backbone class methods to Underscore functions, wrapping the model's\n // `attributes` object or collection's `models` array behind the scenes.\n //\n // collection.filter(function(model) { return model.get('age') > 10 });\n // collection.each(this.addView);\n //\n // `Function#apply` can be slow so we use the method's arg count, if we know it.\n var addMethod = function(length, method, attribute) {\n switch (length) {\n case 1: return function() {\n return _[method](this[attribute]);\n };\n case 2: return function(value) {\n return _[method](this[attribute], value);\n };\n case 3: return function(iteratee, context) {\n return _[method](this[attribute], cb(iteratee, this), context);\n };\n case 4: return function(iteratee, defaultVal, context) {\n return _[method](this[attribute], cb(iteratee, this), defaultVal, context);\n };\n default: return function() {\n var args = slice.call(arguments);\n args.unshift(this[attribute]);\n return _[method].apply(_, args);\n };\n }\n };\n var addUnderscoreMethods = function(Class, methods, attribute) {\n _.each(methods, function(length, method) {\n if (_[method]) Class.prototype[method] = addMethod(length, method, attribute);\n });\n };\n\n // Support `collection.sortBy('attr')` and `collection.findWhere({id: 1})`.\n var cb = function(iteratee, instance) {\n if (_.isFunction(iteratee)) return iteratee;\n if (_.isObject(iteratee) && !instance._isModel(iteratee)) return modelMatcher(iteratee);\n if (_.isString(iteratee)) return function(model) { return model.get(iteratee); };\n return iteratee;\n };\n var modelMatcher = function(attrs) {\n var matcher = _.matches(attrs);\n return function(model) {\n return matcher(model.attributes);\n };\n };\n\n // Backbone.Events\n // ---------------\n\n // A module that can be mixed in to *any object* in order to provide it with\n // a custom event channel. You may bind a callback to an event with `on` or\n // remove with `off`; `trigger`-ing an event fires all callbacks in\n // succession.\n //\n // var object = {};\n // _.extend(object, Backbone.Events);\n // object.on('expand', function(){ alert('expanded'); });\n // object.trigger('expand');\n //\n var Events = Backbone.Events = {};\n\n // Regular expression used to split event strings.\n var eventSplitter = /\\s+/;\n\n // Iterates over the standard `event, callback` (as well as the fancy multiple\n // space-separated events `\"change blur\", callback` and jQuery-style event\n // maps `{event: callback}`).\n var eventsApi = function(iteratee, events, name, callback, opts) {\n var i = 0, names;\n if (name && typeof name === 'object') {\n // Handle event maps.\n if (callback !== void 0 && 'context' in opts && opts.context === void 0) opts.context = callback;\n for (names = _.keys(name); i < names.length ; i++) {\n events = eventsApi(iteratee, events, names[i], name[names[i]], opts);\n }\n } else if (name && eventSplitter.test(name)) {\n // Handle space-separated event names by delegating them individually.\n for (names = name.split(eventSplitter); i < names.length; i++) {\n events = iteratee(events, names[i], callback, opts);\n }\n } else {\n // Finally, standard events.\n events = iteratee(events, name, callback, opts);\n }\n return events;\n };\n\n // Bind an event to a `callback` function. Passing `\"all\"` will bind\n // the callback to all events fired.\n Events.on = function(name, callback, context) {\n return internalOn(this, name, callback, context);\n };\n\n // Guard the `listening` argument from the public API.\n var internalOn = function(obj, name, callback, context, listening) {\n obj._events = eventsApi(onApi, obj._events || {}, name, callback, {\n context: context,\n ctx: obj,\n listening: listening\n });\n\n if (listening) {\n var listeners = obj._listeners || (obj._listeners = {});\n listeners[listening.id] = listening;\n }\n\n return obj;\n };\n\n // Inversion-of-control versions of `on`. Tell *this* object to listen to\n // an event in another object... keeping track of what it's listening to\n // for easier unbinding later.\n Events.listenTo = function(obj, name, callback) {\n if (!obj) return this;\n var id = obj._listenId || (obj._listenId = _.uniqueId('l'));\n var listeningTo = this._listeningTo || (this._listeningTo = {});\n var listening = listeningTo[id];\n\n // This object is not listening to any other events on `obj` yet.\n // Setup the necessary references to track the listening callbacks.\n if (!listening) {\n var thisId = this._listenId || (this._listenId = _.uniqueId('l'));\n listening = listeningTo[id] = {obj: obj, objId: id, id: thisId, listeningTo: listeningTo, count: 0};\n }\n\n // Bind callbacks on obj, and keep track of them on listening.\n internalOn(obj, name, callback, this, listening);\n return this;\n };\n\n // The reducing API that adds a callback to the `events` object.\n var onApi = function(events, name, callback, options) {\n if (callback) {\n var handlers = events[name] || (events[name] = []);\n var context = options.context, ctx = options.ctx, listening = options.listening;\n if (listening) listening.count++;\n\n handlers.push({callback: callback, context: context, ctx: context || ctx, listening: listening});\n }\n return events;\n };\n\n // Remove one or many callbacks. If `context` is null, removes all\n // callbacks with that function. If `callback` is null, removes all\n // callbacks for the event. If `name` is null, removes all bound\n // callbacks for all events.\n Events.off = function(name, callback, context) {\n if (!this._events) return this;\n this._events = eventsApi(offApi, this._events, name, callback, {\n context: context,\n listeners: this._listeners\n });\n return this;\n };\n\n // Tell this object to stop listening to either specific events ... or\n // to every object it's currently listening to.\n Events.stopListening = function(obj, name, callback) {\n var listeningTo = this._listeningTo;\n if (!listeningTo) return this;\n\n var ids = obj ? [obj._listenId] : _.keys(listeningTo);\n\n for (var i = 0; i < ids.length; i++) {\n var listening = listeningTo[ids[i]];\n\n // If listening doesn't exist, this object is not currently\n // listening to obj. Break out early.\n if (!listening) break;\n\n listening.obj.off(name, callback, this);\n }\n\n return this;\n };\n\n // The reducing API that removes a callback from the `events` object.\n var offApi = function(events, name, callback, options) {\n if (!events) return;\n\n var i = 0, listening;\n var context = options.context, listeners = options.listeners;\n\n // Delete all events listeners and \"drop\" events.\n if (!name && !callback && !context) {\n var ids = _.keys(listeners);\n for (; i < ids.length; i++) {\n listening = listeners[ids[i]];\n delete listeners[listening.id];\n delete listening.listeningTo[listening.objId];\n }\n return;\n }\n\n var names = name ? [name] : _.keys(events);\n for (; i < names.length; i++) {\n name = names[i];\n var handlers = events[name];\n\n // Bail out if there are no events stored.\n if (!handlers) break;\n\n // Replace events if there are any remaining. Otherwise, clean up.\n var remaining = [];\n for (var j = 0; j < handlers.length; j++) {\n var handler = handlers[j];\n if (\n callback && callback !== handler.callback &&\n callback !== handler.callback._callback ||\n context && context !== handler.context\n ) {\n remaining.push(handler);\n } else {\n listening = handler.listening;\n if (listening && --listening.count === 0) {\n delete listeners[listening.id];\n delete listening.listeningTo[listening.objId];\n }\n }\n }\n\n // Update tail event if the list has any events. Otherwise, clean up.\n if (remaining.length) {\n events[name] = remaining;\n } else {\n delete events[name];\n }\n }\n return events;\n };\n\n // Bind an event to only be triggered a single time. After the first time\n // the callback is invoked, its listener will be removed. If multiple events\n // are passed in using the space-separated syntax, the handler will fire\n // once for each event, not once for a combination of all events.\n Events.once = function(name, callback, context) {\n // Map the event into a `{event: once}` object.\n var events = eventsApi(onceMap, {}, name, callback, _.bind(this.off, this));\n if (typeof name === 'string' && context == null) callback = void 0;\n return this.on(events, callback, context);\n };\n\n // Inversion-of-control versions of `once`.\n Events.listenToOnce = function(obj, name, callback) {\n // Map the event into a `{event: once}` object.\n var events = eventsApi(onceMap, {}, name, callback, _.bind(this.stopListening, this, obj));\n return this.listenTo(obj, events);\n };\n\n // Reduces the event callbacks into a map of `{event: onceWrapper}`.\n // `offer` unbinds the `onceWrapper` after it has been called.\n var onceMap = function(map, name, callback, offer) {\n if (callback) {\n var once = map[name] = _.once(function() {\n offer(name, once);\n callback.apply(this, arguments);\n });\n once._callback = callback;\n }\n return map;\n };\n\n // Trigger one or many events, firing all bound callbacks. Callbacks are\n // passed the same arguments as `trigger` is, apart from the event name\n // (unless you're listening on `\"all\"`, which will cause your callback to\n // receive the true name of the event as the first argument).\n Events.trigger = function(name) {\n if (!this._events) return this;\n\n var length = Math.max(0, arguments.length - 1);\n var args = Array(length);\n for (var i = 0; i < length; i++) args[i] = arguments[i + 1];\n\n eventsApi(triggerApi, this._events, name, void 0, args);\n return this;\n };\n\n // Handles triggering the appropriate event callbacks.\n var triggerApi = function(objEvents, name, callback, args) {\n if (objEvents) {\n var events = objEvents[name];\n var allEvents = objEvents.all;\n if (events && allEvents) allEvents = allEvents.slice();\n if (events) triggerEvents(events, args);\n if (allEvents) triggerEvents(allEvents, [name].concat(args));\n }\n return objEvents;\n };\n\n // A difficult-to-believe, but optimized internal dispatch function for\n // triggering events. Tries to keep the usual cases speedy (most internal\n // Backbone events have 3 arguments).\n var triggerEvents = function(events, args) {\n var ev, i = -1, l = events.length, a1 = args[0], a2 = args[1], a3 = args[2];\n switch (args.length) {\n case 0: while (++i < l) (ev = events[i]).callback.call(ev.ctx); return;\n case 1: while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1); return;\n case 2: while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1, a2); return;\n case 3: while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1, a2, a3); return;\n default: while (++i < l) (ev = events[i]).callback.apply(ev.ctx, args); return;\n }\n };\n\n // Aliases for backwards compatibility.\n Events.bind = Events.on;\n Events.unbind = Events.off;\n\n // Allow the `Backbone` object to serve as a global event bus, for folks who\n // want global \"pubsub\" in a convenient place.\n _.extend(Backbone, Events);\n\n // Backbone.Model\n // --------------\n\n // Backbone **Models** are the basic data object in the framework --\n // frequently representing a row in a table in a database on your server.\n // A discrete chunk of data and a bunch of useful, related methods for\n // performing computations and transformations on that data.\n\n // Create a new model with the specified attributes. A client id (`cid`)\n // is automatically generated and assigned for you.\n var Model = Backbone.Model = function(attributes, options) {\n var attrs = attributes || {};\n options || (options = {});\n this.cid = _.uniqueId(this.cidPrefix);\n this.attributes = {};\n if (options.collection) this.collection = options.collection;\n if (options.parse) attrs = this.parse(attrs, options) || {};\n var defaults = _.result(this, 'defaults');\n attrs = _.defaults(_.extend({}, defaults, attrs), defaults);\n this.set(attrs, options);\n this.changed = {};\n this.initialize.apply(this, arguments);\n };\n\n // Attach all inheritable methods to the Model prototype.\n _.extend(Model.prototype, Events, {\n\n // A hash of attributes whose current and previous value differ.\n changed: null,\n\n // The value returned during the last failed validation.\n validationError: null,\n\n // The default name for the JSON `id` attribute is `\"id\"`. MongoDB and\n // CouchDB users may want to set this to `\"_id\"`.\n idAttribute: 'id',\n\n // The prefix is used to create the client id which is used to identify models locally.\n // You may want to override this if you're experiencing name clashes with model ids.\n cidPrefix: 'c',\n\n // Initialize is an empty function by default. Override it with your own\n // initialization logic.\n initialize: function(){},\n\n // Return a copy of the model's `attributes` object.\n toJSON: function(options) {\n return _.clone(this.attributes);\n },\n\n // Proxy `Backbone.sync` by default -- but override this if you need\n // custom syncing semantics for *this* particular model.\n sync: function() {\n return Backbone.sync.apply(this, arguments);\n },\n\n // Get the value of an attribute.\n get: function(attr) {\n return this.attributes[attr];\n },\n\n // Get the HTML-escaped value of an attribute.\n escape: function(attr) {\n return _.escape(this.get(attr));\n },\n\n // Returns `true` if the attribute contains a value that is not null\n // or undefined.\n has: function(attr) {\n return this.get(attr) != null;\n },\n\n // Special-cased proxy to underscore's `_.matches` method.\n matches: function(attrs) {\n return !!_.iteratee(attrs, this)(this.attributes);\n },\n\n // Set a hash of model attributes on the object, firing `\"change\"`. This is\n // the core primitive operation of a model, updating the data and notifying\n // anyone who needs to know about the change in state. The heart of the beast.\n set: function(key, val, options) {\n if (key == null) return this;\n\n // Handle both `\"key\", value` and `{key: value}` -style arguments.\n var attrs;\n if (typeof key === 'object') {\n attrs = key;\n options = val;\n } else {\n (attrs = {})[key] = val;\n }\n\n options || (options = {});\n\n // Run validation.\n if (!this._validate(attrs, options)) return false;\n\n // Extract attributes and options.\n var unset = options.unset;\n var silent = options.silent;\n var changes = [];\n var changing = this._changing;\n this._changing = true;\n\n if (!changing) {\n this._previousAttributes = _.clone(this.attributes);\n this.changed = {};\n }\n\n var current = this.attributes;\n var changed = this.changed;\n var prev = this._previousAttributes;\n\n // For each `set` attribute, update or delete the current value.\n for (var attr in attrs) {\n val = attrs[attr];\n if (!_.isEqual(current[attr], val)) changes.push(attr);\n if (!_.isEqual(prev[attr], val)) {\n changed[attr] = val;\n } else {\n delete changed[attr];\n }\n unset ? delete current[attr] : current[attr] = val;\n }\n\n // Update the `id`.\n if (this.idAttribute in attrs) this.id = this.get(this.idAttribute);\n\n // Trigger all relevant attribute changes.\n if (!silent) {\n if (changes.length) this._pending = options;\n for (var i = 0; i < changes.length; i++) {\n this.trigger('change:' + changes[i], this, current[changes[i]], options);\n }\n }\n\n // You might be wondering why there's a `while` loop here. Changes can\n // be recursively nested within `\"change\"` events.\n if (changing) return this;\n if (!silent) {\n while (this._pending) {\n options = this._pending;\n this._pending = false;\n this.trigger('change', this, options);\n }\n }\n this._pending = false;\n this._changing = false;\n return this;\n },\n\n // Remove an attribute from the model, firing `\"change\"`. `unset` is a noop\n // if the attribute doesn't exist.\n unset: function(attr, options) {\n return this.set(attr, void 0, _.extend({}, options, {unset: true}));\n },\n\n // Clear all attributes on the model, firing `\"change\"`.\n clear: function(options) {\n var attrs = {};\n for (var key in this.attributes) attrs[key] = void 0;\n return this.set(attrs, _.extend({}, options, {unset: true}));\n },\n\n // Determine if the model has changed since the last `\"change\"` event.\n // If you specify an attribute name, determine if that attribute has changed.\n hasChanged: function(attr) {\n if (attr == null) return !_.isEmpty(this.changed);\n return _.has(this.changed, attr);\n },\n\n // Return an object containing all the attributes that have changed, or\n // false if there are no changed attributes. Useful for determining what\n // parts of a view need to be updated and/or what attributes need to be\n // persisted to the server. Unset attributes will be set to undefined.\n // You can also pass an attributes object to diff against the model,\n // determining if there *would be* a change.\n changedAttributes: function(diff) {\n if (!diff) return this.hasChanged() ? _.clone(this.changed) : false;\n var old = this._changing ? this._previousAttributes : this.attributes;\n var changed = {};\n for (var attr in diff) {\n var val = diff[attr];\n if (_.isEqual(old[attr], val)) continue;\n changed[attr] = val;\n }\n return _.size(changed) ? changed : false;\n },\n\n // Get the previous value of an attribute, recorded at the time the last\n // `\"change\"` event was fired.\n previous: function(attr) {\n if (attr == null || !this._previousAttributes) return null;\n return this._previousAttributes[attr];\n },\n\n // Get all of the attributes of the model at the time of the previous\n // `\"change\"` event.\n previousAttributes: function() {\n return _.clone(this._previousAttributes);\n },\n\n // Fetch the model from the server, merging the response with the model's\n // local attributes. Any changed attributes will trigger a \"change\" event.\n fetch: function(options) {\n options = _.extend({parse: true}, options);\n var model = this;\n var success = options.success;\n options.success = function(resp) {\n var serverAttrs = options.parse ? model.parse(resp, options) : resp;\n if (!model.set(serverAttrs, options)) return false;\n if (success) success.call(options.context, model, resp, options);\n model.trigger('sync', model, resp, options);\n };\n wrapError(this, options);\n return this.sync('read', this, options);\n },\n\n // Set a hash of model attributes, and sync the model to the server.\n // If the server returns an attributes hash that differs, the model's\n // state will be `set` again.\n save: function(key, val, options) {\n // Handle both `\"key\", value` and `{key: value}` -style arguments.\n var attrs;\n if (key == null || typeof key === 'object') {\n attrs = key;\n options = val;\n } else {\n (attrs = {})[key] = val;\n }\n\n options = _.extend({validate: true, parse: true}, options);\n var wait = options.wait;\n\n // If we're not waiting and attributes exist, save acts as\n // `set(attr).save(null, opts)` with validation. Otherwise, check if\n // the model will be valid when the attributes, if any, are set.\n if (attrs && !wait) {\n if (!this.set(attrs, options)) return false;\n } else if (!this._validate(attrs, options)) {\n return false;\n }\n\n // After a successful server-side save, the client is (optionally)\n // updated with the server-side state.\n var model = this;\n var success = options.success;\n var attributes = this.attributes;\n options.success = function(resp) {\n // Ensure attributes are restored during synchronous saves.\n model.attributes = attributes;\n var serverAttrs = options.parse ? model.parse(resp, options) : resp;\n if (wait) serverAttrs = _.extend({}, attrs, serverAttrs);\n if (serverAttrs && !model.set(serverAttrs, options)) return false;\n if (success) success.call(options.context, model, resp, options);\n model.trigger('sync', model, resp, options);\n };\n wrapError(this, options);\n\n // Set temporary attributes if `{wait: true}` to properly find new ids.\n if (attrs && wait) this.attributes = _.extend({}, attributes, attrs);\n\n var method = this.isNew() ? 'create' : (options.patch ? 'patch' : 'update');\n if (method === 'patch' && !options.attrs) options.attrs = attrs;\n var xhr = this.sync(method, this, options);\n\n // Restore attributes.\n this.attributes = attributes;\n\n return xhr;\n },\n\n // Destroy this model on the server if it was already persisted.\n // Optimistically removes the model from its collection, if it has one.\n // If `wait: true` is passed, waits for the server to respond before removal.\n destroy: function(options) {\n options = options ? _.clone(options) : {};\n var model = this;\n var success = options.success;\n var wait = options.wait;\n\n var destroy = function() {\n model.stopListening();\n model.trigger('destroy', model, model.collection, options);\n };\n\n options.success = function(resp) {\n if (wait) destroy();\n if (success) success.call(options.context, model, resp, options);\n if (!model.isNew()) model.trigger('sync', model, resp, options);\n };\n\n var xhr = false;\n if (this.isNew()) {\n _.defer(options.success);\n } else {\n wrapError(this, options);\n xhr = this.sync('delete', this, options);\n }\n if (!wait) destroy();\n return xhr;\n },\n\n // Default URL for the model's representation on the server -- if you're\n // using Backbone's restful methods, override this to change the endpoint\n // that will be called.\n url: function() {\n var base =\n _.result(this, 'urlRoot') ||\n _.result(this.collection, 'url') ||\n urlError();\n if (this.isNew()) return base;\n var id = this.get(this.idAttribute);\n return base.replace(/[^\\/]$/, '$&/') + encodeURIComponent(id);\n },\n\n // **parse** converts a response into the hash of attributes to be `set` on\n // the model. The default implementation is just to pass the response along.\n parse: function(resp, options) {\n return resp;\n },\n\n // Create a new model with identical attributes to this one.\n clone: function() {\n return new this.constructor(this.attributes);\n },\n\n // A model is new if it has never been saved to the server, and lacks an id.\n isNew: function() {\n return !this.has(this.idAttribute);\n },\n\n // Check if the model is currently in a valid state.\n isValid: function(options) {\n return this._validate({}, _.extend({}, options, {validate: true}));\n },\n\n // Run validation against the next complete set of model attributes,\n // returning `true` if all is well. Otherwise, fire an `\"invalid\"` event.\n _validate: function(attrs, options) {\n if (!options.validate || !this.validate) return true;\n attrs = _.extend({}, this.attributes, attrs);\n var error = this.validationError = this.validate(attrs, options) || null;\n if (!error) return true;\n this.trigger('invalid', this, error, _.extend(options, {validationError: error}));\n return false;\n }\n\n });\n\n // Underscore methods that we want to implement on the Model, mapped to the\n // number of arguments they take.\n var modelMethods = {keys: 1, values: 1, pairs: 1, invert: 1, pick: 0,\n omit: 0, chain: 1, isEmpty: 1};\n\n // Mix in each Underscore method as a proxy to `Model#attributes`.\n addUnderscoreMethods(Model, modelMethods, 'attributes');\n\n // Backbone.Collection\n // -------------------\n\n // If models tend to represent a single row of data, a Backbone Collection is\n // more analogous to a table full of data ... or a small slice or page of that\n // table, or a collection of rows that belong together for a particular reason\n // -- all of the messages in this particular folder, all of the documents\n // belonging to this particular author, and so on. Collections maintain\n // indexes of their models, both in order, and for lookup by `id`.\n\n // Create a new **Collection**, perhaps to contain a specific type of `model`.\n // If a `comparator` is specified, the Collection will maintain\n // its models in sort order, as they're added and removed.\n var Collection = Backbone.Collection = function(models, options) {\n options || (options = {});\n if (options.model) this.model = options.model;\n if (options.comparator !== void 0) this.comparator = options.comparator;\n this._reset();\n this.initialize.apply(this, arguments);\n if (models) this.reset(models, _.extend({silent: true}, options));\n };\n\n // Default options for `Collection#set`.\n var setOptions = {add: true, remove: true, merge: true};\n var addOptions = {add: true, remove: false};\n\n // Splices `insert` into `array` at index `at`.\n var splice = function(array, insert, at) {\n at = Math.min(Math.max(at, 0), array.length);\n var tail = Array(array.length - at);\n var length = insert.length;\n var i;\n for (i = 0; i < tail.length; i++) tail[i] = array[i + at];\n for (i = 0; i < length; i++) array[i + at] = insert[i];\n for (i = 0; i < tail.length; i++) array[i + length + at] = tail[i];\n };\n\n // Define the Collection's inheritable methods.\n _.extend(Collection.prototype, Events, {\n\n // The default model for a collection is just a **Backbone.Model**.\n // This should be overridden in most cases.\n model: Model,\n\n // Initialize is an empty function by default. Override it with your own\n // initialization logic.\n initialize: function(){},\n\n // The JSON representation of a Collection is an array of the\n // models' attributes.\n toJSON: function(options) {\n return this.map(function(model) { return model.toJSON(options); });\n },\n\n // Proxy `Backbone.sync` by default.\n sync: function() {\n return Backbone.sync.apply(this, arguments);\n },\n\n // Add a model, or list of models to the set. `models` may be Backbone\n // Models or raw JavaScript objects to be converted to Models, or any\n // combination of the two.\n add: function(models, options) {\n return this.set(models, _.extend({merge: false}, options, addOptions));\n },\n\n // Remove a model, or a list of models from the set.\n remove: function(models, options) {\n options = _.extend({}, options);\n var singular = !_.isArray(models);\n models = singular ? [models] : models.slice();\n var removed = this._removeModels(models, options);\n if (!options.silent && removed.length) {\n options.changes = {added: [], merged: [], removed: removed};\n this.trigger('update', this, options);\n }\n return singular ? removed[0] : removed;\n },\n\n // Update a collection by `set`-ing a new list of models, adding new ones,\n // removing models that are no longer present, and merging models that\n // already exist in the collection, as necessary. Similar to **Model#set**,\n // the core operation for updating the data contained by the collection.\n set: function(models, options) {\n if (models == null) return;\n\n options = _.extend({}, setOptions, options);\n if (options.parse && !this._isModel(models)) {\n models = this.parse(models, options) || [];\n }\n\n var singular = !_.isArray(models);\n models = singular ? [models] : models.slice();\n\n var at = options.at;\n if (at != null) at = +at;\n if (at > this.length) at = this.length;\n if (at < 0) at += this.length + 1;\n\n var set = [];\n var toAdd = [];\n var toMerge = [];\n var toRemove = [];\n var modelMap = {};\n\n var add = options.add;\n var merge = options.merge;\n var remove = options.remove;\n\n var sort = false;\n var sortable = this.comparator && at == null && options.sort !== false;\n var sortAttr = _.isString(this.comparator) ? this.comparator : null;\n\n // Turn bare objects into model references, and prevent invalid models\n // from being added.\n var model, i;\n for (i = 0; i < models.length; i++) {\n model = models[i];\n\n // If a duplicate is found, prevent it from being added and\n // optionally merge it into the existing model.\n var existing = this.get(model);\n if (existing) {\n if (merge && model !== existing) {\n var attrs = this._isModel(model) ? model.attributes : model;\n if (options.parse) attrs = existing.parse(attrs, options);\n existing.set(attrs, options);\n toMerge.push(existing);\n if (sortable && !sort) sort = existing.hasChanged(sortAttr);\n }\n if (!modelMap[existing.cid]) {\n modelMap[existing.cid] = true;\n set.push(existing);\n }\n models[i] = existing;\n\n // If this is a new, valid model, push it to the `toAdd` list.\n } else if (add) {\n model = models[i] = this._prepareModel(model, options);\n if (model) {\n toAdd.push(model);\n this._addReference(model, options);\n modelMap[model.cid] = true;\n set.push(model);\n }\n }\n }\n\n // Remove stale models.\n if (remove) {\n for (i = 0; i < this.length; i++) {\n model = this.models[i];\n if (!modelMap[model.cid]) toRemove.push(model);\n }\n if (toRemove.length) this._removeModels(toRemove, options);\n }\n\n // See if sorting is needed, update `length` and splice in new models.\n var orderChanged = false;\n var replace = !sortable && add && remove;\n if (set.length && replace) {\n orderChanged = this.length !== set.length || _.some(this.models, function(m, index) {\n return m !== set[index];\n });\n this.models.length = 0;\n splice(this.models, set, 0);\n this.length = this.models.length;\n } else if (toAdd.length) {\n if (sortable) sort = true;\n splice(this.models, toAdd, at == null ? this.length : at);\n this.length = this.models.length;\n }\n\n // Silently sort the collection if appropriate.\n if (sort) this.sort({silent: true});\n\n // Unless silenced, it's time to fire all appropriate add/sort/update events.\n if (!options.silent) {\n for (i = 0; i < toAdd.length; i++) {\n if (at != null) options.index = at + i;\n model = toAdd[i];\n model.trigger('add', model, this, options);\n }\n if (sort || orderChanged) this.trigger('sort', this, options);\n if (toAdd.length || toRemove.length || toMerge.length) {\n options.changes = {\n added: toAdd,\n removed: toRemove,\n merged: toMerge\n };\n this.trigger('update', this, options);\n }\n }\n\n // Return the added (or merged) model (or models).\n return singular ? models[0] : models;\n },\n\n // When you have more items than you want to add or remove individually,\n // you can reset the entire set with a new list of models, without firing\n // any granular `add` or `remove` events. Fires `reset` when finished.\n // Useful for bulk operations and optimizations.\n reset: function(models, options) {\n options = options ? _.clone(options) : {};\n for (var i = 0; i < this.models.length; i++) {\n this._removeReference(this.models[i], options);\n }\n options.previousModels = this.models;\n this._reset();\n models = this.add(models, _.extend({silent: true}, options));\n if (!options.silent) this.trigger('reset', this, options);\n return models;\n },\n\n // Add a model to the end of the collection.\n push: function(model, options) {\n return this.add(model, _.extend({at: this.length}, options));\n },\n\n // Remove a model from the end of the collection.\n pop: function(options) {\n var model = this.at(this.length - 1);\n return this.remove(model, options);\n },\n\n // Add a model to the beginning of the collection.\n unshift: function(model, options) {\n return this.add(model, _.extend({at: 0}, options));\n },\n\n // Remove a model from the beginning of the collection.\n shift: function(options) {\n var model = this.at(0);\n return this.remove(model, options);\n },\n\n // Slice out a sub-array of models from the collection.\n slice: function() {\n return slice.apply(this.models, arguments);\n },\n\n // Get a model from the set by id, cid, model object with id or cid\n // properties, or an attributes object that is transformed through modelId.\n get: function(obj) {\n if (obj == null) return void 0;\n return this._byId[obj] ||\n this._byId[this.modelId(obj.attributes || obj)] ||\n obj.cid && this._byId[obj.cid];\n },\n\n // Returns `true` if the model is in the collection.\n has: function(obj) {\n return this.get(obj) != null;\n },\n\n // Get the model at the given index.\n at: function(index) {\n if (index < 0) index += this.length;\n return this.models[index];\n },\n\n // Return models with matching attributes. Useful for simple cases of\n // `filter`.\n where: function(attrs, first) {\n return this[first ? 'find' : 'filter'](attrs);\n },\n\n // Return the first model with matching attributes. Useful for simple cases\n // of `find`.\n findWhere: function(attrs) {\n return this.where(attrs, true);\n },\n\n // Force the collection to re-sort itself. You don't need to call this under\n // normal circumstances, as the set will maintain sort order as each item\n // is added.\n sort: function(options) {\n var comparator = this.comparator;\n if (!comparator) throw new Error('Cannot sort a set without a comparator');\n options || (options = {});\n\n var length = comparator.length;\n if (_.isFunction(comparator)) comparator = _.bind(comparator, this);\n\n // Run sort based on type of `comparator`.\n if (length === 1 || _.isString(comparator)) {\n this.models = this.sortBy(comparator);\n } else {\n this.models.sort(comparator);\n }\n if (!options.silent) this.trigger('sort', this, options);\n return this;\n },\n\n // Pluck an attribute from each model in the collection.\n pluck: function(attr) {\n return this.map(attr + '');\n },\n\n // Fetch the default set of models for this collection, resetting the\n // collection when they arrive. If `reset: true` is passed, the response\n // data will be passed through the `reset` method instead of `set`.\n fetch: function(options) {\n options = _.extend({parse: true}, options);\n var success = options.success;\n var collection = this;\n options.success = function(resp) {\n var method = options.reset ? 'reset' : 'set';\n collection[method](resp, options);\n if (success) success.call(options.context, collection, resp, options);\n collection.trigger('sync', collection, resp, options);\n };\n wrapError(this, options);\n return this.sync('read', this, options);\n },\n\n // Create a new instance of a model in this collection. Add the model to the\n // collection immediately, unless `wait: true` is passed, in which case we\n // wait for the server to agree.\n create: function(model, options) {\n options = options ? _.clone(options) : {};\n var wait = options.wait;\n model = this._prepareModel(model, options);\n if (!model) return false;\n if (!wait) this.add(model, options);\n var collection = this;\n var success = options.success;\n options.success = function(m, resp, callbackOpts) {\n if (wait) collection.add(m, callbackOpts);\n if (success) success.call(callbackOpts.context, m, resp, callbackOpts);\n };\n model.save(null, options);\n return model;\n },\n\n // **parse** converts a response into a list of models to be added to the\n // collection. The default implementation is just to pass it through.\n parse: function(resp, options) {\n return resp;\n },\n\n // Create a new collection with an identical list of models as this one.\n clone: function() {\n return new this.constructor(this.models, {\n model: this.model,\n comparator: this.comparator\n });\n },\n\n // Define how to uniquely identify models in the collection.\n modelId: function(attrs) {\n return attrs[this.model.prototype.idAttribute || 'id'];\n },\n\n // Private method to reset all internal state. Called when the collection\n // is first initialized or reset.\n _reset: function() {\n this.length = 0;\n this.models = [];\n this._byId = {};\n },\n\n // Prepare a hash of attributes (or other model) to be added to this\n // collection.\n _prepareModel: function(attrs, options) {\n if (this._isModel(attrs)) {\n if (!attrs.collection) attrs.collection = this;\n return attrs;\n }\n options = options ? _.clone(options) : {};\n options.collection = this;\n var model = new this.model(attrs, options);\n if (!model.validationError) return model;\n this.trigger('invalid', this, model.validationError, options);\n return false;\n },\n\n // Internal method called by both remove and set.\n _removeModels: function(models, options) {\n var removed = [];\n for (var i = 0; i < models.length; i++) {\n var model = this.get(models[i]);\n if (!model) continue;\n\n var index = this.indexOf(model);\n this.models.splice(index, 1);\n this.length--;\n\n // Remove references before triggering 'remove' event to prevent an\n // infinite loop. #3693\n delete this._byId[model.cid];\n var id = this.modelId(model.attributes);\n if (id != null) delete this._byId[id];\n\n if (!options.silent) {\n options.index = index;\n model.trigger('remove', model, this, options);\n }\n\n removed.push(model);\n this._removeReference(model, options);\n }\n return removed;\n },\n\n // Method for checking whether an object should be considered a model for\n // the purposes of adding to the collection.\n _isModel: function(model) {\n return model instanceof Model;\n },\n\n // Internal method to create a model's ties to a collection.\n _addReference: function(model, options) {\n this._byId[model.cid] = model;\n var id = this.modelId(model.attributes);\n if (id != null) this._byId[id] = model;\n model.on('all', this._onModelEvent, this);\n },\n\n // Internal method to sever a model's ties to a collection.\n _removeReference: function(model, options) {\n delete this._byId[model.cid];\n var id = this.modelId(model.attributes);\n if (id != null) delete this._byId[id];\n if (this === model.collection) delete model.collection;\n model.off('all', this._onModelEvent, this);\n },\n\n // Internal method called every time a model in the set fires an event.\n // Sets need to update their indexes when models change ids. All other\n // events simply proxy through. \"add\" and \"remove\" events that originate\n // in other collections are ignored.\n _onModelEvent: function(event, model, collection, options) {\n if (model) {\n if ((event === 'add' || event === 'remove') && collection !== this) return;\n if (event === 'destroy') this.remove(model, options);\n if (event === 'change') {\n var prevId = this.modelId(model.previousAttributes());\n var id = this.modelId(model.attributes);\n if (prevId !== id) {\n if (prevId != null) delete this._byId[prevId];\n if (id != null) this._byId[id] = model;\n }\n }\n }\n this.trigger.apply(this, arguments);\n }\n\n });\n\n // Underscore methods that we want to implement on the Collection.\n // 90% of the core usefulness of Backbone Collections is actually implemented\n // right here:\n var collectionMethods = {forEach: 3, each: 3, map: 3, collect: 3, reduce: 0,\n foldl: 0, inject: 0, reduceRight: 0, foldr: 0, find: 3, detect: 3, filter: 3,\n select: 3, reject: 3, every: 3, all: 3, some: 3, any: 3, include: 3, includes: 3,\n contains: 3, invoke: 0, max: 3, min: 3, toArray: 1, size: 1, first: 3,\n head: 3, take: 3, initial: 3, rest: 3, tail: 3, drop: 3, last: 3,\n without: 0, difference: 0, indexOf: 3, shuffle: 1, lastIndexOf: 3,\n isEmpty: 1, chain: 1, sample: 3, partition: 3, groupBy: 3, countBy: 3,\n sortBy: 3, indexBy: 3, findIndex: 3, findLastIndex: 3};\n\n // Mix in each Underscore method as a proxy to `Collection#models`.\n addUnderscoreMethods(Collection, collectionMethods, 'models');\n\n // Backbone.View\n // -------------\n\n // Backbone Views are almost more convention than they are actual code. A View\n // is simply a JavaScript object that represents a logical chunk of UI in the\n // DOM. This might be a single item, an entire list, a sidebar or panel, or\n // even the surrounding frame which wraps your whole app. Defining a chunk of\n // UI as a **View** allows you to define your DOM events declaratively, without\n // having to worry about render order ... and makes it easy for the view to\n // react to specific changes in the state of your models.\n\n // Creating a Backbone.View creates its initial element outside of the DOM,\n // if an existing element is not provided...\n var View = Backbone.View = function(options) {\n this.cid = _.uniqueId('view');\n _.extend(this, _.pick(options, viewOptions));\n this._ensureElement();\n this.initialize.apply(this, arguments);\n };\n\n // Cached regex to split keys for `delegate`.\n var delegateEventSplitter = /^(\\S+)\\s*(.*)$/;\n\n // List of view options to be set as properties.\n var viewOptions = ['model', 'collection', 'el', 'id', 'attributes', 'className', 'tagName', 'events'];\n\n // Set up all inheritable **Backbone.View** properties and methods.\n _.extend(View.prototype, Events, {\n\n // The default `tagName` of a View's element is `\"div\"`.\n tagName: 'div',\n\n // jQuery delegate for element lookup, scoped to DOM elements within the\n // current view. This should be preferred to global lookups where possible.\n $: function(selector) {\n return this.$el.find(selector);\n },\n\n // Initialize is an empty function by default. Override it with your own\n // initialization logic.\n initialize: function(){},\n\n // **render** is the core function that your view should override, in order\n // to populate its element (`this.el`), with the appropriate HTML. The\n // convention is for **render** to always return `this`.\n render: function() {\n return this;\n },\n\n // Remove this view by taking the element out of the DOM, and removing any\n // applicable Backbone.Events listeners.\n remove: function() {\n this._removeElement();\n this.stopListening();\n return this;\n },\n\n // Remove this view's element from the document and all event listeners\n // attached to it. Exposed for subclasses using an alternative DOM\n // manipulation API.\n _removeElement: function() {\n this.$el.remove();\n },\n\n // Change the view's element (`this.el` property) and re-delegate the\n // view's events on the new element.\n setElement: function(element) {\n this.undelegateEvents();\n this._setElement(element);\n this.delegateEvents();\n return this;\n },\n\n // Creates the `this.el` and `this.$el` references for this view using the\n // given `el`. `el` can be a CSS selector or an HTML string, a jQuery\n // context or an element. Subclasses can override this to utilize an\n // alternative DOM manipulation API and are only required to set the\n // `this.el` property.\n _setElement: function(el) {\n this.$el = el instanceof Backbone.$ ? el : Backbone.$(el);\n this.el = this.$el[0];\n },\n\n // Set callbacks, where `this.events` is a hash of\n //\n // *{\"event selector\": \"callback\"}*\n //\n // {\n // 'mousedown .title': 'edit',\n // 'click .button': 'save',\n // 'click .open': function(e) { ... }\n // }\n //\n // pairs. Callbacks will be bound to the view, with `this` set properly.\n // Uses event delegation for efficiency.\n // Omitting the selector binds the event to `this.el`.\n delegateEvents: function(events) {\n events || (events = _.result(this, 'events'));\n if (!events) return this;\n this.undelegateEvents();\n for (var key in events) {\n var method = events[key];\n if (!_.isFunction(method)) method = this[method];\n if (!method) continue;\n var match = key.match(delegateEventSplitter);\n this.delegate(match[1], match[2], _.bind(method, this));\n }\n return this;\n },\n\n // Add a single event listener to the view's element (or a child element\n // using `selector`). This only works for delegate-able events: not `focus`,\n // `blur`, and not `change`, `submit`, and `reset` in Internet Explorer.\n delegate: function(eventName, selector, listener) {\n this.$el.on(eventName + '.delegateEvents' + this.cid, selector, listener);\n return this;\n },\n\n // Clears all callbacks previously bound to the view by `delegateEvents`.\n // You usually don't need to use this, but may wish to if you have multiple\n // Backbone views attached to the same DOM element.\n undelegateEvents: function() {\n if (this.$el) this.$el.off('.delegateEvents' + this.cid);\n return this;\n },\n\n // A finer-grained `undelegateEvents` for removing a single delegated event.\n // `selector` and `listener` are both optional.\n undelegate: function(eventName, selector, listener) {\n this.$el.off(eventName + '.delegateEvents' + this.cid, selector, listener);\n return this;\n },\n\n // Produces a DOM element to be assigned to your view. Exposed for\n // subclasses using an alternative DOM manipulation API.\n _createElement: function(tagName) {\n return document.createElement(tagName);\n },\n\n // Ensure that the View has a DOM element to render into.\n // If `this.el` is a string, pass it through `$()`, take the first\n // matching element, and re-assign it to `el`. Otherwise, create\n // an element from the `id`, `className` and `tagName` properties.\n _ensureElement: function() {\n if (!this.el) {\n var attrs = _.extend({}, _.result(this, 'attributes'));\n if (this.id) attrs.id = _.result(this, 'id');\n if (this.className) attrs['class'] = _.result(this, 'className');\n this.setElement(this._createElement(_.result(this, 'tagName')));\n this._setAttributes(attrs);\n } else {\n this.setElement(_.result(this, 'el'));\n }\n },\n\n // Set attributes from a hash on this view's element. Exposed for\n // subclasses using an alternative DOM manipulation API.\n _setAttributes: function(attributes) {\n this.$el.attr(attributes);\n }\n\n });\n\n // Backbone.sync\n // -------------\n\n // Override this function to change the manner in which Backbone persists\n // models to the server. You will be passed the type of request, and the\n // model in question. By default, makes a RESTful Ajax request\n // to the model's `url()`. Some possible customizations could be:\n //\n // * Use `setTimeout` to batch rapid-fire updates into a single request.\n // * Send up the models as XML instead of JSON.\n // * Persist models via WebSockets instead of Ajax.\n //\n // Turn on `Backbone.emulateHTTP` in order to send `PUT` and `DELETE` requests\n // as `POST`, with a `_method` parameter containing the true HTTP method,\n // as well as all requests with the body as `application/x-www-form-urlencoded`\n // instead of `application/json` with the model in a param named `model`.\n // Useful when interfacing with server-side languages like **PHP** that make\n // it difficult to read the body of `PUT` requests.\n Backbone.sync = function(method, model, options) {\n var type = methodMap[method];\n\n // Default options, unless specified.\n _.defaults(options || (options = {}), {\n emulateHTTP: Backbone.emulateHTTP,\n emulateJSON: Backbone.emulateJSON\n });\n\n // Default JSON-request options.\n var params = {type: type, dataType: 'json'};\n\n // Ensure that we have a URL.\n if (!options.url) {\n params.url = _.result(model, 'url') || urlError();\n }\n\n // Ensure that we have the appropriate request data.\n if (options.data == null && model && (method === 'create' || method === 'update' || method === 'patch')) {\n params.contentType = 'application/json';\n params.data = JSON.stringify(options.attrs || model.toJSON(options));\n }\n\n // For older servers, emulate JSON by encoding the request into an HTML-form.\n if (options.emulateJSON) {\n params.contentType = 'application/x-www-form-urlencoded';\n params.data = params.data ? {model: params.data} : {};\n }\n\n // For older servers, emulate HTTP by mimicking the HTTP method with `_method`\n // And an `X-HTTP-Method-Override` header.\n if (options.emulateHTTP && (type === 'PUT' || type === 'DELETE' || type === 'PATCH')) {\n params.type = 'POST';\n if (options.emulateJSON) params.data._method = type;\n var beforeSend = options.beforeSend;\n options.beforeSend = function(xhr) {\n xhr.setRequestHeader('X-HTTP-Method-Override', type);\n if (beforeSend) return beforeSend.apply(this, arguments);\n };\n }\n\n // Don't process data on a non-GET request.\n if (params.type !== 'GET' && !options.emulateJSON) {\n params.processData = false;\n }\n\n // Pass along `textStatus` and `errorThrown` from jQuery.\n var error = options.error;\n options.error = function(xhr, textStatus, errorThrown) {\n options.textStatus = textStatus;\n options.errorThrown = errorThrown;\n if (error) error.call(options.context, xhr, textStatus, errorThrown);\n };\n\n // Make the request, allowing the user to override any Ajax options.\n var xhr = options.xhr = Backbone.ajax(_.extend(params, options));\n model.trigger('request', model, xhr, options);\n return xhr;\n };\n\n // Map from CRUD to HTTP for our default `Backbone.sync` implementation.\n var methodMap = {\n 'create': 'POST',\n 'update': 'PUT',\n 'patch': 'PATCH',\n 'delete': 'DELETE',\n 'read': 'GET'\n };\n\n // Set the default implementation of `Backbone.ajax` to proxy through to `$`.\n // Override this if you'd like to use a different library.\n Backbone.ajax = function() {\n return Backbone.$.ajax.apply(Backbone.$, arguments);\n };\n\n // Backbone.Router\n // ---------------\n\n // Routers map faux-URLs to actions, and fire events when routes are\n // matched. Creating a new one sets its `routes` hash, if not set statically.\n var Router = Backbone.Router = function(options) {\n options || (options = {});\n if (options.routes) this.routes = options.routes;\n this._bindRoutes();\n this.initialize.apply(this, arguments);\n };\n\n // Cached regular expressions for matching named param parts and splatted\n // parts of route strings.\n var optionalParam = /\\((.*?)\\)/g;\n var namedParam = /(\\(\\?)?:\\w+/g;\n var splatParam = /\\*\\w+/g;\n var escapeRegExp = /[\\-{}\\[\\]+?.,\\\\\\^$|#\\s]/g;\n\n // Set up all inheritable **Backbone.Router** properties and methods.\n _.extend(Router.prototype, Events, {\n\n // Initialize is an empty function by default. Override it with your own\n // initialization logic.\n initialize: function(){},\n\n // Manually bind a single named route to a callback. For example:\n //\n // this.route('search/:query/p:num', 'search', function(query, num) {\n // ...\n // });\n //\n route: function(route, name, callback) {\n if (!_.isRegExp(route)) route = this._routeToRegExp(route);\n if (_.isFunction(name)) {\n callback = name;\n name = '';\n }\n if (!callback) callback = this[name];\n var router = this;\n Backbone.history.route(route, function(fragment) {\n var args = router._extractParameters(route, fragment);\n if (router.execute(callback, args, name) !== false) {\n router.trigger.apply(router, ['route:' + name].concat(args));\n router.trigger('route', name, args);\n Backbone.history.trigger('route', router, name, args);\n }\n });\n return this;\n },\n\n // Execute a route handler with the provided parameters. This is an\n // excellent place to do pre-route setup or post-route cleanup.\n execute: function(callback, args, name) {\n if (callback) callback.apply(this, args);\n },\n\n // Simple proxy to `Backbone.history` to save a fragment into the history.\n navigate: function(fragment, options) {\n Backbone.history.navigate(fragment, options);\n return this;\n },\n\n // Bind all defined routes to `Backbone.history`. We have to reverse the\n // order of the routes here to support behavior where the most general\n // routes can be defined at the bottom of the route map.\n _bindRoutes: function() {\n if (!this.routes) return;\n this.routes = _.result(this, 'routes');\n var route, routes = _.keys(this.routes);\n while ((route = routes.pop()) != null) {\n this.route(route, this.routes[route]);\n }\n },\n\n // Convert a route string into a regular expression, suitable for matching\n // against the current location hash.\n _routeToRegExp: function(route) {\n route = route.replace(escapeRegExp, '\\\\$&')\n .replace(optionalParam, '(?:$1)?')\n .replace(namedParam, function(match, optional) {\n return optional ? match : '([^/?]+)';\n })\n .replace(splatParam, '([^?]*?)');\n return new RegExp('^' + route + '(?:\\\\?([\\\\s\\\\S]*))?$');\n },\n\n // Given a route, and a URL fragment that it matches, return the array of\n // extracted decoded parameters. Empty or unmatched parameters will be\n // treated as `null` to normalize cross-browser behavior.\n _extractParameters: function(route, fragment) {\n var params = route.exec(fragment).slice(1);\n return _.map(params, function(param, i) {\n // Don't decode the search params.\n if (i === params.length - 1) return param || null;\n return param ? decodeURIComponent(param) : null;\n });\n }\n\n });\n\n // Backbone.History\n // ----------------\n\n // Handles cross-browser history management, based on either\n // [pushState](http://diveintohtml5.info/history.html) and real URLs, or\n // [onhashchange](https://developer.mozilla.org/en-US/docs/DOM/window.onhashchange)\n // and URL fragments. If the browser supports neither (old IE, natch),\n // falls back to polling.\n var History = Backbone.History = function() {\n this.handlers = [];\n this.checkUrl = _.bind(this.checkUrl, this);\n\n // Ensure that `History` can be used outside of the browser.\n if (typeof window !== 'undefined') {\n this.location = window.location;\n this.history = window.history;\n }\n };\n\n // Cached regex for stripping a leading hash/slash and trailing space.\n var routeStripper = /^[#\\/]|\\s+$/g;\n\n // Cached regex for stripping leading and trailing slashes.\n var rootStripper = /^\\/+|\\/+$/g;\n\n // Cached regex for stripping urls of hash.\n var pathStripper = /#.*$/;\n\n // Has the history handling already been started?\n History.started = false;\n\n // Set up all inheritable **Backbone.History** properties and methods.\n _.extend(History.prototype, Events, {\n\n // The default interval to poll for hash changes, if necessary, is\n // twenty times a second.\n interval: 50,\n\n // Are we at the app root?\n atRoot: function() {\n var path = this.location.pathname.replace(/[^\\/]$/, '$&/');\n return path === this.root && !this.getSearch();\n },\n\n // Does the pathname match the root?\n matchRoot: function() {\n var path = this.decodeFragment(this.location.pathname);\n var rootPath = path.slice(0, this.root.length - 1) + '/';\n return rootPath === this.root;\n },\n\n // Unicode characters in `location.pathname` are percent encoded so they're\n // decoded for comparison. `%25` should not be decoded since it may be part\n // of an encoded parameter.\n decodeFragment: function(fragment) {\n return decodeURI(fragment.replace(/%25/g, '%2525'));\n },\n\n // In IE6, the hash fragment and search params are incorrect if the\n // fragment contains `?`.\n getSearch: function() {\n var match = this.location.href.replace(/#.*/, '').match(/\\?.+/);\n return match ? match[0] : '';\n },\n\n // Gets the true hash value. Cannot use location.hash directly due to bug\n // in Firefox where location.hash will always be decoded.\n getHash: function(window) {\n var match = (window || this).location.href.match(/#(.*)$/);\n return match ? match[1] : '';\n },\n\n // Get the pathname and search params, without the root.\n getPath: function() {\n var path = this.decodeFragment(\n this.location.pathname + this.getSearch()\n ).slice(this.root.length - 1);\n return path.charAt(0) === '/' ? path.slice(1) : path;\n },\n\n // Get the cross-browser normalized URL fragment from the path or hash.\n getFragment: function(fragment) {\n if (fragment == null) {\n if (this._usePushState || !this._wantsHashChange) {\n fragment = this.getPath();\n } else {\n fragment = this.getHash();\n }\n }\n return fragment.replace(routeStripper, '');\n },\n\n // Start the hash change handling, returning `true` if the current URL matches\n // an existing route, and `false` otherwise.\n start: function(options) {\n if (History.started) throw new Error('Backbone.history has already been started');\n History.started = true;\n\n // Figure out the initial configuration. Do we need an iframe?\n // Is pushState desired ... is it available?\n this.options = _.extend({root: '/'}, this.options, options);\n this.root = this.options.root;\n this._wantsHashChange = this.options.hashChange !== false;\n this._hasHashChange = 'onhashchange' in window && (document.documentMode === void 0 || document.documentMode > 7);\n this._useHashChange = this._wantsHashChange && this._hasHashChange;\n this._wantsPushState = !!this.options.pushState;\n this._hasPushState = !!(this.history && this.history.pushState);\n this._usePushState = this._wantsPushState && this._hasPushState;\n this.fragment = this.getFragment();\n\n // Normalize root to always include a leading and trailing slash.\n this.root = ('/' + this.root + '/').replace(rootStripper, '/');\n\n // Transition from hashChange to pushState or vice versa if both are\n // requested.\n if (this._wantsHashChange && this._wantsPushState) {\n\n // If we've started off with a route from a `pushState`-enabled\n // browser, but we're currently in a browser that doesn't support it...\n if (!this._hasPushState && !this.atRoot()) {\n var rootPath = this.root.slice(0, -1) || '/';\n this.location.replace(rootPath + '#' + this.getPath());\n // Return immediately as browser will do redirect to new url\n return true;\n\n // Or if we've started out with a hash-based route, but we're currently\n // in a browser where it could be `pushState`-based instead...\n } else if (this._hasPushState && this.atRoot()) {\n this.navigate(this.getHash(), {replace: true});\n }\n\n }\n\n // Proxy an iframe to handle location events if the browser doesn't\n // support the `hashchange` event, HTML5 history, or the user wants\n // `hashChange` but not `pushState`.\n if (!this._hasHashChange && this._wantsHashChange && !this._usePushState) {\n this.iframe = document.createElement('iframe');\n this.iframe.src = 'javascript:0';\n this.iframe.style.display = 'none';\n this.iframe.tabIndex = -1;\n var body = document.body;\n // Using `appendChild` will throw on IE < 9 if the document is not ready.\n var iWindow = body.insertBefore(this.iframe, body.firstChild).contentWindow;\n iWindow.document.open();\n iWindow.document.close();\n iWindow.location.hash = '#' + this.fragment;\n }\n\n // Add a cross-platform `addEventListener` shim for older browsers.\n var addEventListener = window.addEventListener || function(eventName, listener) {\n return attachEvent('on' + eventName, listener);\n };\n\n // Depending on whether we're using pushState or hashes, and whether\n // 'onhashchange' is supported, determine how we check the URL state.\n if (this._usePushState) {\n addEventListener('popstate', this.checkUrl, false);\n } else if (this._useHashChange && !this.iframe) {\n addEventListener('hashchange', this.checkUrl, false);\n } else if (this._wantsHashChange) {\n this._checkUrlInterval = setInterval(this.checkUrl, this.interval);\n }\n\n if (!this.options.silent) return this.loadUrl();\n },\n\n // Disable Backbone.history, perhaps temporarily. Not useful in a real app,\n // but possibly useful for unit testing Routers.\n stop: function() {\n // Add a cross-platform `removeEventListener` shim for older browsers.\n var removeEventListener = window.removeEventListener || function(eventName, listener) {\n return detachEvent('on' + eventName, listener);\n };\n\n // Remove window listeners.\n if (this._usePushState) {\n removeEventListener('popstate', this.checkUrl, false);\n } else if (this._useHashChange && !this.iframe) {\n removeEventListener('hashchange', this.checkUrl, false);\n }\n\n // Clean up the iframe if necessary.\n if (this.iframe) {\n document.body.removeChild(this.iframe);\n this.iframe = null;\n }\n\n // Some environments will throw when clearing an undefined interval.\n if (this._checkUrlInterval) clearInterval(this._checkUrlInterval);\n History.started = false;\n },\n\n // Add a route to be tested when the fragment changes. Routes added later\n // may override previous routes.\n route: function(route, callback) {\n this.handlers.unshift({route: route, callback: callback});\n },\n\n // Checks the current URL to see if it has changed, and if it has,\n // calls `loadUrl`, normalizing across the hidden iframe.\n checkUrl: function(e) {\n var current = this.getFragment();\n\n // If the user pressed the back button, the iframe's hash will have\n // changed and we should use that for comparison.\n if (current === this.fragment && this.iframe) {\n current = this.getHash(this.iframe.contentWindow);\n }\n\n if (current === this.fragment) return false;\n if (this.iframe) this.navigate(current);\n this.loadUrl();\n },\n\n // Attempt to load the current URL fragment. If a route succeeds with a\n // match, returns `true`. If no defined routes matches the fragment,\n // returns `false`.\n loadUrl: function(fragment) {\n // If the root doesn't match, no routes can match either.\n if (!this.matchRoot()) return false;\n fragment = this.fragment = this.getFragment(fragment);\n return _.some(this.handlers, function(handler) {\n if (handler.route.test(fragment)) {\n handler.callback(fragment);\n return true;\n }\n });\n },\n\n // Save a fragment into the hash history, or replace the URL state if the\n // 'replace' option is passed. You are responsible for properly URL-encoding\n // the fragment in advance.\n //\n // The options object can contain `trigger: true` if you wish to have the\n // route callback be fired (not usually desirable), or `replace: true`, if\n // you wish to modify the current URL without adding an entry to the history.\n navigate: function(fragment, options) {\n if (!History.started) return false;\n if (!options || options === true) options = {trigger: !!options};\n\n // Normalize the fragment.\n fragment = this.getFragment(fragment || '');\n\n // Don't include a trailing slash on the root.\n var rootPath = this.root;\n if (fragment === '' || fragment.charAt(0) === '?') {\n rootPath = rootPath.slice(0, -1) || '/';\n }\n var url = rootPath + fragment;\n\n // Strip the hash and decode for matching.\n fragment = this.decodeFragment(fragment.replace(pathStripper, ''));\n\n if (this.fragment === fragment) return;\n this.fragment = fragment;\n\n // If pushState is available, we use it to set the fragment as a real URL.\n if (this._usePushState) {\n this.history[options.replace ? 'replaceState' : 'pushState']({}, document.title, url);\n\n // If hash changes haven't been explicitly disabled, update the hash\n // fragment to store history.\n } else if (this._wantsHashChange) {\n this._updateHash(this.location, fragment, options.replace);\n if (this.iframe && fragment !== this.getHash(this.iframe.contentWindow)) {\n var iWindow = this.iframe.contentWindow;\n\n // Opening and closing the iframe tricks IE7 and earlier to push a\n // history entry on hash-tag change. When replace is true, we don't\n // want this.\n if (!options.replace) {\n iWindow.document.open();\n iWindow.document.close();\n }\n\n this._updateHash(iWindow.location, fragment, options.replace);\n }\n\n // If you've told us that you explicitly don't want fallback hashchange-\n // based history, then `navigate` becomes a page refresh.\n } else {\n return this.location.assign(url);\n }\n if (options.trigger) return this.loadUrl(fragment);\n },\n\n // Update the hash location, either replacing the current entry, or adding\n // a new one to the browser history.\n _updateHash: function(location, fragment, replace) {\n if (replace) {\n var href = location.href.replace(/(javascript:|#).*$/, '');\n location.replace(href + '#' + fragment);\n } else {\n // Some browsers require that `hash` contains a leading #.\n location.hash = '#' + fragment;\n }\n }\n\n });\n\n // Create the default Backbone.history.\n Backbone.history = new History;\n\n // Helpers\n // -------\n\n // Helper function to correctly set up the prototype chain for subclasses.\n // Similar to `goog.inherits`, but uses a hash of prototype properties and\n // class properties to be extended.\n var extend = function(protoProps, staticProps) {\n var parent = this;\n var child;\n\n // The constructor function for the new subclass is either defined by you\n // (the \"constructor\" property in your `extend` definition), or defaulted\n // by us to simply call the parent constructor.\n if (protoProps && _.has(protoProps, 'constructor')) {\n child = protoProps.constructor;\n } else {\n child = function(){ return parent.apply(this, arguments); };\n }\n\n // Add static properties to the constructor function, if supplied.\n _.extend(child, parent, staticProps);\n\n // Set the prototype chain to inherit from `parent`, without calling\n // `parent`'s constructor function and add the prototype properties.\n child.prototype = _.create(parent.prototype, protoProps);\n child.prototype.constructor = child;\n\n // Set a convenience property in case the parent's prototype is needed\n // later.\n child.__super__ = parent.prototype;\n\n return child;\n };\n\n // Set up inheritance for the model, collection, router, view and history.\n Model.extend = Collection.extend = Router.extend = View.extend = History.extend = extend;\n\n // Throw an error when a URL is needed, and none is supplied.\n var urlError = function() {\n throw new Error('A \"url\" property or function must be specified');\n };\n\n // Wrap an optional error callback with a fallback error event.\n var wrapError = function(model, options) {\n var error = options.error;\n options.error = function(resp) {\n if (error) error.call(options.context, model, resp, options);\n model.trigger('error', model, resp, options);\n };\n };\n\n return Backbone;\n});\n\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(16)))\n\n/***/ }),\n/* 1 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;// Underscore.js 1.8.3\n// http://underscorejs.org\n// (c) 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n// Underscore may be freely distributed under the MIT license.\n\n(function() {\n\n // Baseline setup\n // --------------\n\n // Establish the root object, `window` in the browser, or `exports` on the server.\n var root = this;\n\n // Save the previous value of the `_` variable.\n var previousUnderscore = root._;\n\n // Save bytes in the minified (but not gzipped) version:\n var ArrayProto = Array.prototype, ObjProto = Object.prototype, FuncProto = Function.prototype;\n\n // Create quick reference variables for speed access to core prototypes.\n var\n push = ArrayProto.push,\n slice = ArrayProto.slice,\n toString = ObjProto.toString,\n hasOwnProperty = ObjProto.hasOwnProperty;\n\n // All **ECMAScript 5** native function implementations that we hope to use\n // are declared here.\n var\n nativeIsArray = Array.isArray,\n nativeKeys = Object.keys,\n nativeBind = FuncProto.bind,\n nativeCreate = Object.create;\n\n // Naked function reference for surrogate-prototype-swapping.\n var Ctor = function(){};\n\n // Create a safe reference to the Underscore object for use below.\n var _ = function(obj) {\n if (obj instanceof _) return obj;\n if (!(this instanceof _)) return new _(obj);\n this._wrapped = obj;\n };\n\n // Export the Underscore object for **Node.js**, with\n // backwards-compatibility for the old `require()` API. If we're in\n // the browser, add `_` as a global object.\n if (true) {\n if (typeof module !== 'undefined' && module.exports) {\n exports = module.exports = _;\n }\n exports._ = _;\n } else {\n root._ = _;\n }\n\n // Current version.\n _.VERSION = '1.8.3';\n\n // Internal function that returns an efficient (for current engines) version\n // of the passed-in callback, to be repeatedly applied in other Underscore\n // functions.\n var optimizeCb = function(func, context, argCount) {\n if (context === void 0) return func;\n switch (argCount == null ? 3 : argCount) {\n case 1: return function(value) {\n return func.call(context, value);\n };\n case 2: return function(value, other) {\n return func.call(context, value, other);\n };\n case 3: return function(value, index, collection) {\n return func.call(context, value, index, collection);\n };\n case 4: return function(accumulator, value, index, collection) {\n return func.call(context, accumulator, value, index, collection);\n };\n }\n return function() {\n return func.apply(context, arguments);\n };\n };\n\n // A mostly-internal function to generate callbacks that can be applied\n // to each element in a collection, returning the desired result — either\n // identity, an arbitrary callback, a property matcher, or a property accessor.\n var cb = function(value, context, argCount) {\n if (value == null) return _.identity;\n if (_.isFunction(value)) return optimizeCb(value, context, argCount);\n if (_.isObject(value)) return _.matcher(value);\n return _.property(value);\n };\n _.iteratee = function(value, context) {\n return cb(value, context, Infinity);\n };\n\n // An internal function for creating assigner functions.\n var createAssigner = function(keysFunc, undefinedOnly) {\n return function(obj) {\n var length = arguments.length;\n if (length < 2 || obj == null) return obj;\n for (var index = 1; index < length; index++) {\n var source = arguments[index],\n keys = keysFunc(source),\n l = keys.length;\n for (var i = 0; i < l; i++) {\n var key = keys[i];\n if (!undefinedOnly || obj[key] === void 0) obj[key] = source[key];\n }\n }\n return obj;\n };\n };\n\n // An internal function for creating a new object that inherits from another.\n var baseCreate = function(prototype) {\n if (!_.isObject(prototype)) return {};\n if (nativeCreate) return nativeCreate(prototype);\n Ctor.prototype = prototype;\n var result = new Ctor;\n Ctor.prototype = null;\n return result;\n };\n\n var property = function(key) {\n return function(obj) {\n return obj == null ? void 0 : obj[key];\n };\n };\n\n // Helper for collection methods to determine whether a collection\n // should be iterated as an array or as an object\n // Related: http://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength\n // Avoids a very nasty iOS 8 JIT bug on ARM-64. #2094\n var MAX_ARRAY_INDEX = Math.pow(2, 53) - 1;\n var getLength = property('length');\n var isArrayLike = function(collection) {\n var length = getLength(collection);\n return typeof length == 'number' && length >= 0 && length <= MAX_ARRAY_INDEX;\n };\n\n // Collection Functions\n // --------------------\n\n // The cornerstone, an `each` implementation, aka `forEach`.\n // Handles raw objects in addition to array-likes. Treats all\n // sparse array-likes as if they were dense.\n _.each = _.forEach = function(obj, iteratee, context) {\n iteratee = optimizeCb(iteratee, context);\n var i, length;\n if (isArrayLike(obj)) {\n for (i = 0, length = obj.length; i < length; i++) {\n iteratee(obj[i], i, obj);\n }\n } else {\n var keys = _.keys(obj);\n for (i = 0, length = keys.length; i < length; i++) {\n iteratee(obj[keys[i]], keys[i], obj);\n }\n }\n return obj;\n };\n\n // Return the results of applying the iteratee to each element.\n _.map = _.collect = function(obj, iteratee, context) {\n iteratee = cb(iteratee, context);\n var keys = !isArrayLike(obj) && _.keys(obj),\n length = (keys || obj).length,\n results = Array(length);\n for (var index = 0; index < length; index++) {\n var currentKey = keys ? keys[index] : index;\n results[index] = iteratee(obj[currentKey], currentKey, obj);\n }\n return results;\n };\n\n // Create a reducing function iterating left or right.\n function createReduce(dir) {\n // Optimized iterator function as using arguments.length\n // in the main function will deoptimize the, see #1991.\n function iterator(obj, iteratee, memo, keys, index, length) {\n for (; index >= 0 && index < length; index += dir) {\n var currentKey = keys ? keys[index] : index;\n memo = iteratee(memo, obj[currentKey], currentKey, obj);\n }\n return memo;\n }\n\n return function(obj, iteratee, memo, context) {\n iteratee = optimizeCb(iteratee, context, 4);\n var keys = !isArrayLike(obj) && _.keys(obj),\n length = (keys || obj).length,\n index = dir > 0 ? 0 : length - 1;\n // Determine the initial value if none is provided.\n if (arguments.length < 3) {\n memo = obj[keys ? keys[index] : index];\n index += dir;\n }\n return iterator(obj, iteratee, memo, keys, index, length);\n };\n }\n\n // **Reduce** builds up a single result from a list of values, aka `inject`,\n // or `foldl`.\n _.reduce = _.foldl = _.inject = createReduce(1);\n\n // The right-associative version of reduce, also known as `foldr`.\n _.reduceRight = _.foldr = createReduce(-1);\n\n // Return the first value which passes a truth test. Aliased as `detect`.\n _.find = _.detect = function(obj, predicate, context) {\n var key;\n if (isArrayLike(obj)) {\n key = _.findIndex(obj, predicate, context);\n } else {\n key = _.findKey(obj, predicate, context);\n }\n if (key !== void 0 && key !== -1) return obj[key];\n };\n\n // Return all the elements that pass a truth test.\n // Aliased as `select`.\n _.filter = _.select = function(obj, predicate, context) {\n var results = [];\n predicate = cb(predicate, context);\n _.each(obj, function(value, index, list) {\n if (predicate(value, index, list)) results.push(value);\n });\n return results;\n };\n\n // Return all the elements for which a truth test fails.\n _.reject = function(obj, predicate, context) {\n return _.filter(obj, _.negate(cb(predicate)), context);\n };\n\n // Determine whether all of the elements match a truth test.\n // Aliased as `all`.\n _.every = _.all = function(obj, predicate, context) {\n predicate = cb(predicate, context);\n var keys = !isArrayLike(obj) && _.keys(obj),\n length = (keys || obj).length;\n for (var index = 0; index < length; index++) {\n var currentKey = keys ? keys[index] : index;\n if (!predicate(obj[currentKey], currentKey, obj)) return false;\n }\n return true;\n };\n\n // Determine if at least one element in the object matches a truth test.\n // Aliased as `any`.\n _.some = _.any = function(obj, predicate, context) {\n predicate = cb(predicate, context);\n var keys = !isArrayLike(obj) && _.keys(obj),\n length = (keys || obj).length;\n for (var index = 0; index < length; index++) {\n var currentKey = keys ? keys[index] : index;\n if (predicate(obj[currentKey], currentKey, obj)) return true;\n }\n return false;\n };\n\n // Determine if the array or object contains a given item (using `===`).\n // Aliased as `includes` and `include`.\n _.contains = _.includes = _.include = function(obj, item, fromIndex, guard) {\n if (!isArrayLike(obj)) obj = _.values(obj);\n if (typeof fromIndex != 'number' || guard) fromIndex = 0;\n return _.indexOf(obj, item, fromIndex) >= 0;\n };\n\n // Invoke a method (with arguments) on every item in a collection.\n _.invoke = function(obj, method) {\n var args = slice.call(arguments, 2);\n var isFunc = _.isFunction(method);\n return _.map(obj, function(value) {\n var func = isFunc ? method : value[method];\n return func == null ? func : func.apply(value, args);\n });\n };\n\n // Convenience version of a common use case of `map`: fetching a property.\n _.pluck = function(obj, key) {\n return _.map(obj, _.property(key));\n };\n\n // Convenience version of a common use case of `filter`: selecting only objects\n // containing specific `key:value` pairs.\n _.where = function(obj, attrs) {\n return _.filter(obj, _.matcher(attrs));\n };\n\n // Convenience version of a common use case of `find`: getting the first object\n // containing specific `key:value` pairs.\n _.findWhere = function(obj, attrs) {\n return _.find(obj, _.matcher(attrs));\n };\n\n // Return the maximum element (or element-based computation).\n _.max = function(obj, iteratee, context) {\n var result = -Infinity, lastComputed = -Infinity,\n value, computed;\n if (iteratee == null && obj != null) {\n obj = isArrayLike(obj) ? obj : _.values(obj);\n for (var i = 0, length = obj.length; i < length; i++) {\n value = obj[i];\n if (value > result) {\n result = value;\n }\n }\n } else {\n iteratee = cb(iteratee, context);\n _.each(obj, function(value, index, list) {\n computed = iteratee(value, index, list);\n if (computed > lastComputed || computed === -Infinity && result === -Infinity) {\n result = value;\n lastComputed = computed;\n }\n });\n }\n return result;\n };\n\n // Return the minimum element (or element-based computation).\n _.min = function(obj, iteratee, context) {\n var result = Infinity, lastComputed = Infinity,\n value, computed;\n if (iteratee == null && obj != null) {\n obj = isArrayLike(obj) ? obj : _.values(obj);\n for (var i = 0, length = obj.length; i < length; i++) {\n value = obj[i];\n if (value < result) {\n result = value;\n }\n }\n } else {\n iteratee = cb(iteratee, context);\n _.each(obj, function(value, index, list) {\n computed = iteratee(value, index, list);\n if (computed < lastComputed || computed === Infinity && result === Infinity) {\n result = value;\n lastComputed = computed;\n }\n });\n }\n return result;\n };\n\n // Shuffle a collection, using the modern version of the\n // [Fisher-Yates shuffle](http://en.wikipedia.org/wiki/Fisher–Yates_shuffle).\n _.shuffle = function(obj) {\n var set = isArrayLike(obj) ? obj : _.values(obj);\n var length = set.length;\n var shuffled = Array(length);\n for (var index = 0, rand; index < length; index++) {\n rand = _.random(0, index);\n if (rand !== index) shuffled[index] = shuffled[rand];\n shuffled[rand] = set[index];\n }\n return shuffled;\n };\n\n // Sample **n** random values from a collection.\n // If **n** is not specified, returns a single random element.\n // The internal `guard` argument allows it to work with `map`.\n _.sample = function(obj, n, guard) {\n if (n == null || guard) {\n if (!isArrayLike(obj)) obj = _.values(obj);\n return obj[_.random(obj.length - 1)];\n }\n return _.shuffle(obj).slice(0, Math.max(0, n));\n };\n\n // Sort the object's values by a criterion produced by an iteratee.\n _.sortBy = function(obj, iteratee, context) {\n iteratee = cb(iteratee, context);\n return _.pluck(_.map(obj, function(value, index, list) {\n return {\n value: value,\n index: index,\n criteria: iteratee(value, index, list)\n };\n }).sort(function(left, right) {\n var a = left.criteria;\n var b = right.criteria;\n if (a !== b) {\n if (a > b || a === void 0) return 1;\n if (a < b || b === void 0) return -1;\n }\n return left.index - right.index;\n }), 'value');\n };\n\n // An internal function used for aggregate \"group by\" operations.\n var group = function(behavior) {\n return function(obj, iteratee, context) {\n var result = {};\n iteratee = cb(iteratee, context);\n _.each(obj, function(value, index) {\n var key = iteratee(value, index, obj);\n behavior(result, value, key);\n });\n return result;\n };\n };\n\n // Groups the object's values by a criterion. Pass either a string attribute\n // to group by, or a function that returns the criterion.\n _.groupBy = group(function(result, value, key) {\n if (_.has(result, key)) result[key].push(value); else result[key] = [value];\n });\n\n // Indexes the object's values by a criterion, similar to `groupBy`, but for\n // when you know that your index values will be unique.\n _.indexBy = group(function(result, value, key) {\n result[key] = value;\n });\n\n // Counts instances of an object that group by a certain criterion. Pass\n // either a string attribute to count by, or a function that returns the\n // criterion.\n _.countBy = group(function(result, value, key) {\n if (_.has(result, key)) result[key]++; else result[key] = 1;\n });\n\n // Safely create a real, live array from anything iterable.\n _.toArray = function(obj) {\n if (!obj) return [];\n if (_.isArray(obj)) return slice.call(obj);\n if (isArrayLike(obj)) return _.map(obj, _.identity);\n return _.values(obj);\n };\n\n // Return the number of elements in an object.\n _.size = function(obj) {\n if (obj == null) return 0;\n return isArrayLike(obj) ? obj.length : _.keys(obj).length;\n };\n\n // Split a collection into two arrays: one whose elements all satisfy the given\n // predicate, and one whose elements all do not satisfy the predicate.\n _.partition = function(obj, predicate, context) {\n predicate = cb(predicate, context);\n var pass = [], fail = [];\n _.each(obj, function(value, key, obj) {\n (predicate(value, key, obj) ? pass : fail).push(value);\n });\n return [pass, fail];\n };\n\n // Array Functions\n // ---------------\n\n // Get the first element of an array. Passing **n** will return the first N\n // values in the array. Aliased as `head` and `take`. The **guard** check\n // allows it to work with `_.map`.\n _.first = _.head = _.take = function(array, n, guard) {\n if (array == null) return void 0;\n if (n == null || guard) return array[0];\n return _.initial(array, array.length - n);\n };\n\n // Returns everything but the last entry of the array. Especially useful on\n // the arguments object. Passing **n** will return all the values in\n // the array, excluding the last N.\n _.initial = function(array, n, guard) {\n return slice.call(array, 0, Math.max(0, array.length - (n == null || guard ? 1 : n)));\n };\n\n // Get the last element of an array. Passing **n** will return the last N\n // values in the array.\n _.last = function(array, n, guard) {\n if (array == null) return void 0;\n if (n == null || guard) return array[array.length - 1];\n return _.rest(array, Math.max(0, array.length - n));\n };\n\n // Returns everything but the first entry of the array. Aliased as `tail` and `drop`.\n // Especially useful on the arguments object. Passing an **n** will return\n // the rest N values in the array.\n _.rest = _.tail = _.drop = function(array, n, guard) {\n return slice.call(array, n == null || guard ? 1 : n);\n };\n\n // Trim out all falsy values from an array.\n _.compact = function(array) {\n return _.filter(array, _.identity);\n };\n\n // Internal implementation of a recursive `flatten` function.\n var flatten = function(input, shallow, strict, startIndex) {\n var output = [], idx = 0;\n for (var i = startIndex || 0, length = getLength(input); i < length; i++) {\n var value = input[i];\n if (isArrayLike(value) && (_.isArray(value) || _.isArguments(value))) {\n //flatten current level of array or arguments object\n if (!shallow) value = flatten(value, shallow, strict);\n var j = 0, len = value.length;\n output.length += len;\n while (j < len) {\n output[idx++] = value[j++];\n }\n } else if (!strict) {\n output[idx++] = value;\n }\n }\n return output;\n };\n\n // Flatten out an array, either recursively (by default), or just one level.\n _.flatten = function(array, shallow) {\n return flatten(array, shallow, false);\n };\n\n // Return a version of the array that does not contain the specified value(s).\n _.without = function(array) {\n return _.difference(array, slice.call(arguments, 1));\n };\n\n // Produce a duplicate-free version of the array. If the array has already\n // been sorted, you have the option of using a faster algorithm.\n // Aliased as `unique`.\n _.uniq = _.unique = function(array, isSorted, iteratee, context) {\n if (!_.isBoolean(isSorted)) {\n context = iteratee;\n iteratee = isSorted;\n isSorted = false;\n }\n if (iteratee != null) iteratee = cb(iteratee, context);\n var result = [];\n var seen = [];\n for (var i = 0, length = getLength(array); i < length; i++) {\n var value = array[i],\n computed = iteratee ? iteratee(value, i, array) : value;\n if (isSorted) {\n if (!i || seen !== computed) result.push(value);\n seen = computed;\n } else if (iteratee) {\n if (!_.contains(seen, computed)) {\n seen.push(computed);\n result.push(value);\n }\n } else if (!_.contains(result, value)) {\n result.push(value);\n }\n }\n return result;\n };\n\n // Produce an array that contains the union: each distinct element from all of\n // the passed-in arrays.\n _.union = function() {\n return _.uniq(flatten(arguments, true, true));\n };\n\n // Produce an array that contains every item shared between all the\n // passed-in arrays.\n _.intersection = function(array) {\n var result = [];\n var argsLength = arguments.length;\n for (var i = 0, length = getLength(array); i < length; i++) {\n var item = array[i];\n if (_.contains(result, item)) continue;\n for (var j = 1; j < argsLength; j++) {\n if (!_.contains(arguments[j], item)) break;\n }\n if (j === argsLength) result.push(item);\n }\n return result;\n };\n\n // Take the difference between one array and a number of other arrays.\n // Only the elements present in just the first array will remain.\n _.difference = function(array) {\n var rest = flatten(arguments, true, true, 1);\n return _.filter(array, function(value){\n return !_.contains(rest, value);\n });\n };\n\n // Zip together multiple lists into a single array -- elements that share\n // an index go together.\n _.zip = function() {\n return _.unzip(arguments);\n };\n\n // Complement of _.zip. Unzip accepts an array of arrays and groups\n // each array's elements on shared indices\n _.unzip = function(array) {\n var length = array && _.max(array, getLength).length || 0;\n var result = Array(length);\n\n for (var index = 0; index < length; index++) {\n result[index] = _.pluck(array, index);\n }\n return result;\n };\n\n // Converts lists into objects. Pass either a single array of `[key, value]`\n // pairs, or two parallel arrays of the same length -- one of keys, and one of\n // the corresponding values.\n _.object = function(list, values) {\n var result = {};\n for (var i = 0, length = getLength(list); i < length; i++) {\n if (values) {\n result[list[i]] = values[i];\n } else {\n result[list[i][0]] = list[i][1];\n }\n }\n return result;\n };\n\n // Generator function to create the findIndex and findLastIndex functions\n function createPredicateIndexFinder(dir) {\n return function(array, predicate, context) {\n predicate = cb(predicate, context);\n var length = getLength(array);\n var index = dir > 0 ? 0 : length - 1;\n for (; index >= 0 && index < length; index += dir) {\n if (predicate(array[index], index, array)) return index;\n }\n return -1;\n };\n }\n\n // Returns the first index on an array-like that passes a predicate test\n _.findIndex = createPredicateIndexFinder(1);\n _.findLastIndex = createPredicateIndexFinder(-1);\n\n // Use a comparator function to figure out the smallest index at which\n // an object should be inserted so as to maintain order. Uses binary search.\n _.sortedIndex = function(array, obj, iteratee, context) {\n iteratee = cb(iteratee, context, 1);\n var value = iteratee(obj);\n var low = 0, high = getLength(array);\n while (low < high) {\n var mid = Math.floor((low + high) / 2);\n if (iteratee(array[mid]) < value) low = mid + 1; else high = mid;\n }\n return low;\n };\n\n // Generator function to create the indexOf and lastIndexOf functions\n function createIndexFinder(dir, predicateFind, sortedIndex) {\n return function(array, item, idx) {\n var i = 0, length = getLength(array);\n if (typeof idx == 'number') {\n if (dir > 0) {\n i = idx >= 0 ? idx : Math.max(idx + length, i);\n } else {\n length = idx >= 0 ? Math.min(idx + 1, length) : idx + length + 1;\n }\n } else if (sortedIndex && idx && length) {\n idx = sortedIndex(array, item);\n return array[idx] === item ? idx : -1;\n }\n if (item !== item) {\n idx = predicateFind(slice.call(array, i, length), _.isNaN);\n return idx >= 0 ? idx + i : -1;\n }\n for (idx = dir > 0 ? i : length - 1; idx >= 0 && idx < length; idx += dir) {\n if (array[idx] === item) return idx;\n }\n return -1;\n };\n }\n\n // Return the position of the first occurrence of an item in an array,\n // or -1 if the item is not included in the array.\n // If the array is large and already in sort order, pass `true`\n // for **isSorted** to use binary search.\n _.indexOf = createIndexFinder(1, _.findIndex, _.sortedIndex);\n _.lastIndexOf = createIndexFinder(-1, _.findLastIndex);\n\n // Generate an integer Array containing an arithmetic progression. A port of\n // the native Python `range()` function. See\n // [the Python documentation](http://docs.python.org/library/functions.html#range).\n _.range = function(start, stop, step) {\n if (stop == null) {\n stop = start || 0;\n start = 0;\n }\n step = step || 1;\n\n var length = Math.max(Math.ceil((stop - start) / step), 0);\n var range = Array(length);\n\n for (var idx = 0; idx < length; idx++, start += step) {\n range[idx] = start;\n }\n\n return range;\n };\n\n // Function (ahem) Functions\n // ------------------\n\n // Determines whether to execute a function as a constructor\n // or a normal function with the provided arguments\n var executeBound = function(sourceFunc, boundFunc, context, callingContext, args) {\n if (!(callingContext instanceof boundFunc)) return sourceFunc.apply(context, args);\n var self = baseCreate(sourceFunc.prototype);\n var result = sourceFunc.apply(self, args);\n if (_.isObject(result)) return result;\n return self;\n };\n\n // Create a function bound to a given object (assigning `this`, and arguments,\n // optionally). Delegates to **ECMAScript 5**'s native `Function.bind` if\n // available.\n _.bind = function(func, context) {\n if (nativeBind && func.bind === nativeBind) return nativeBind.apply(func, slice.call(arguments, 1));\n if (!_.isFunction(func)) throw new TypeError('Bind must be called on a function');\n var args = slice.call(arguments, 2);\n var bound = function() {\n return executeBound(func, bound, context, this, args.concat(slice.call(arguments)));\n };\n return bound;\n };\n\n // Partially apply a function by creating a version that has had some of its\n // arguments pre-filled, without changing its dynamic `this` context. _ acts\n // as a placeholder, allowing any combination of arguments to be pre-filled.\n _.partial = function(func) {\n var boundArgs = slice.call(arguments, 1);\n var bound = function() {\n var position = 0, length = boundArgs.length;\n var args = Array(length);\n for (var i = 0; i < length; i++) {\n args[i] = boundArgs[i] === _ ? arguments[position++] : boundArgs[i];\n }\n while (position < arguments.length) args.push(arguments[position++]);\n return executeBound(func, bound, this, this, args);\n };\n return bound;\n };\n\n // Bind a number of an object's methods to that object. Remaining arguments\n // are the method names to be bound. Useful for ensuring that all callbacks\n // defined on an object belong to it.\n _.bindAll = function(obj) {\n var i, length = arguments.length, key;\n if (length <= 1) throw new Error('bindAll must be passed function names');\n for (i = 1; i < length; i++) {\n key = arguments[i];\n obj[key] = _.bind(obj[key], obj);\n }\n return obj;\n };\n\n // Memoize an expensive function by storing its results.\n _.memoize = function(func, hasher) {\n var memoize = function(key) {\n var cache = memoize.cache;\n var address = '' + (hasher ? hasher.apply(this, arguments) : key);\n if (!_.has(cache, address)) cache[address] = func.apply(this, arguments);\n return cache[address];\n };\n memoize.cache = {};\n return memoize;\n };\n\n // Delays a function for the given number of milliseconds, and then calls\n // it with the arguments supplied.\n _.delay = function(func, wait) {\n var args = slice.call(arguments, 2);\n return setTimeout(function(){\n return func.apply(null, args);\n }, wait);\n };\n\n // Defers a function, scheduling it to run after the current call stack has\n // cleared.\n _.defer = _.partial(_.delay, _, 1);\n\n // Returns a function, that, when invoked, will only be triggered at most once\n // during a given window of time. Normally, the throttled function will run\n // as much as it can, without ever going more than once per `wait` duration;\n // but if you'd like to disable the execution on the leading edge, pass\n // `{leading: false}`. To disable execution on the trailing edge, ditto.\n _.throttle = function(func, wait, options) {\n var context, args, result;\n var timeout = null;\n var previous = 0;\n if (!options) options = {};\n var later = function() {\n previous = options.leading === false ? 0 : _.now();\n timeout = null;\n result = func.apply(context, args);\n if (!timeout) context = args = null;\n };\n return function() {\n var now = _.now();\n if (!previous && options.leading === false) previous = now;\n var remaining = wait - (now - previous);\n context = this;\n args = arguments;\n if (remaining <= 0 || remaining > wait) {\n if (timeout) {\n clearTimeout(timeout);\n timeout = null;\n }\n previous = now;\n result = func.apply(context, args);\n if (!timeout) context = args = null;\n } else if (!timeout && options.trailing !== false) {\n timeout = setTimeout(later, remaining);\n }\n return result;\n };\n };\n\n // Returns a function, that, as long as it continues to be invoked, will not\n // be triggered. The function will be called after it stops being called for\n // N milliseconds. If `immediate` is passed, trigger the function on the\n // leading edge, instead of the trailing.\n _.debounce = function(func, wait, immediate) {\n var timeout, args, context, timestamp, result;\n\n var later = function() {\n var last = _.now() - timestamp;\n\n if (last < wait && last >= 0) {\n timeout = setTimeout(later, wait - last);\n } else {\n timeout = null;\n if (!immediate) {\n result = func.apply(context, args);\n if (!timeout) context = args = null;\n }\n }\n };\n\n return function() {\n context = this;\n args = arguments;\n timestamp = _.now();\n var callNow = immediate && !timeout;\n if (!timeout) timeout = setTimeout(later, wait);\n if (callNow) {\n result = func.apply(context, args);\n context = args = null;\n }\n\n return result;\n };\n };\n\n // Returns the first function passed as an argument to the second,\n // allowing you to adjust arguments, run code before and after, and\n // conditionally execute the original function.\n _.wrap = function(func, wrapper) {\n return _.partial(wrapper, func);\n };\n\n // Returns a negated version of the passed-in predicate.\n _.negate = function(predicate) {\n return function() {\n return !predicate.apply(this, arguments);\n };\n };\n\n // Returns a function that is the composition of a list of functions, each\n // consuming the return value of the function that follows.\n _.compose = function() {\n var args = arguments;\n var start = args.length - 1;\n return function() {\n var i = start;\n var result = args[start].apply(this, arguments);\n while (i--) result = args[i].call(this, result);\n return result;\n };\n };\n\n // Returns a function that will only be executed on and after the Nth call.\n _.after = function(times, func) {\n return function() {\n if (--times < 1) {\n return func.apply(this, arguments);\n }\n };\n };\n\n // Returns a function that will only be executed up to (but not including) the Nth call.\n _.before = function(times, func) {\n var memo;\n return function() {\n if (--times > 0) {\n memo = func.apply(this, arguments);\n }\n if (times <= 1) func = null;\n return memo;\n };\n };\n\n // Returns a function that will be executed at most one time, no matter how\n // often you call it. Useful for lazy initialization.\n _.once = _.partial(_.before, 2);\n\n // Object Functions\n // ----------------\n\n // Keys in IE < 9 that won't be iterated by `for key in ...` and thus missed.\n var hasEnumBug = !{toString: null}.propertyIsEnumerable('toString');\n var nonEnumerableProps = ['valueOf', 'isPrototypeOf', 'toString',\n 'propertyIsEnumerable', 'hasOwnProperty', 'toLocaleString'];\n\n function collectNonEnumProps(obj, keys) {\n var nonEnumIdx = nonEnumerableProps.length;\n var constructor = obj.constructor;\n var proto = (_.isFunction(constructor) && constructor.prototype) || ObjProto;\n\n // Constructor is a special case.\n var prop = 'constructor';\n if (_.has(obj, prop) && !_.contains(keys, prop)) keys.push(prop);\n\n while (nonEnumIdx--) {\n prop = nonEnumerableProps[nonEnumIdx];\n if (prop in obj && obj[prop] !== proto[prop] && !_.contains(keys, prop)) {\n keys.push(prop);\n }\n }\n }\n\n // Retrieve the names of an object's own properties.\n // Delegates to **ECMAScript 5**'s native `Object.keys`\n _.keys = function(obj) {\n if (!_.isObject(obj)) return [];\n if (nativeKeys) return nativeKeys(obj);\n var keys = [];\n for (var key in obj) if (_.has(obj, key)) keys.push(key);\n // Ahem, IE < 9.\n if (hasEnumBug) collectNonEnumProps(obj, keys);\n return keys;\n };\n\n // Retrieve all the property names of an object.\n _.allKeys = function(obj) {\n if (!_.isObject(obj)) return [];\n var keys = [];\n for (var key in obj) keys.push(key);\n // Ahem, IE < 9.\n if (hasEnumBug) collectNonEnumProps(obj, keys);\n return keys;\n };\n\n // Retrieve the values of an object's properties.\n _.values = function(obj) {\n var keys = _.keys(obj);\n var length = keys.length;\n var values = Array(length);\n for (var i = 0; i < length; i++) {\n values[i] = obj[keys[i]];\n }\n return values;\n };\n\n // Returns the results of applying the iteratee to each element of the object\n // In contrast to _.map it returns an object\n _.mapObject = function(obj, iteratee, context) {\n iteratee = cb(iteratee, context);\n var keys = _.keys(obj),\n length = keys.length,\n results = {},\n currentKey;\n for (var index = 0; index < length; index++) {\n currentKey = keys[index];\n results[currentKey] = iteratee(obj[currentKey], currentKey, obj);\n }\n return results;\n };\n\n // Convert an object into a list of `[key, value]` pairs.\n _.pairs = function(obj) {\n var keys = _.keys(obj);\n var length = keys.length;\n var pairs = Array(length);\n for (var i = 0; i < length; i++) {\n pairs[i] = [keys[i], obj[keys[i]]];\n }\n return pairs;\n };\n\n // Invert the keys and values of an object. The values must be serializable.\n _.invert = function(obj) {\n var result = {};\n var keys = _.keys(obj);\n for (var i = 0, length = keys.length; i < length; i++) {\n result[obj[keys[i]]] = keys[i];\n }\n return result;\n };\n\n // Return a sorted list of the function names available on the object.\n // Aliased as `methods`\n _.functions = _.methods = function(obj) {\n var names = [];\n for (var key in obj) {\n if (_.isFunction(obj[key])) names.push(key);\n }\n return names.sort();\n };\n\n // Extend a given object with all the properties in passed-in object(s).\n _.extend = createAssigner(_.allKeys);\n\n // Assigns a given object with all the own properties in the passed-in object(s)\n // (https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/assign)\n _.extendOwn = _.assign = createAssigner(_.keys);\n\n // Returns the first key on an object that passes a predicate test\n _.findKey = function(obj, predicate, context) {\n predicate = cb(predicate, context);\n var keys = _.keys(obj), key;\n for (var i = 0, length = keys.length; i < length; i++) {\n key = keys[i];\n if (predicate(obj[key], key, obj)) return key;\n }\n };\n\n // Return a copy of the object only containing the whitelisted properties.\n _.pick = function(object, oiteratee, context) {\n var result = {}, obj = object, iteratee, keys;\n if (obj == null) return result;\n if (_.isFunction(oiteratee)) {\n keys = _.allKeys(obj);\n iteratee = optimizeCb(oiteratee, context);\n } else {\n keys = flatten(arguments, false, false, 1);\n iteratee = function(value, key, obj) { return key in obj; };\n obj = Object(obj);\n }\n for (var i = 0, length = keys.length; i < length; i++) {\n var key = keys[i];\n var value = obj[key];\n if (iteratee(value, key, obj)) result[key] = value;\n }\n return result;\n };\n\n // Return a copy of the object without the blacklisted properties.\n _.omit = function(obj, iteratee, context) {\n if (_.isFunction(iteratee)) {\n iteratee = _.negate(iteratee);\n } else {\n var keys = _.map(flatten(arguments, false, false, 1), String);\n iteratee = function(value, key) {\n return !_.contains(keys, key);\n };\n }\n return _.pick(obj, iteratee, context);\n };\n\n // Fill in a given object with default properties.\n _.defaults = createAssigner(_.allKeys, true);\n\n // Creates an object that inherits from the given prototype object.\n // If additional properties are provided then they will be added to the\n // created object.\n _.create = function(prototype, props) {\n var result = baseCreate(prototype);\n if (props) _.extendOwn(result, props);\n return result;\n };\n\n // Create a (shallow-cloned) duplicate of an object.\n _.clone = function(obj) {\n if (!_.isObject(obj)) return obj;\n return _.isArray(obj) ? obj.slice() : _.extend({}, obj);\n };\n\n // Invokes interceptor with the obj, and then returns obj.\n // The primary purpose of this method is to \"tap into\" a method chain, in\n // order to perform operations on intermediate results within the chain.\n _.tap = function(obj, interceptor) {\n interceptor(obj);\n return obj;\n };\n\n // Returns whether an object has a given set of `key:value` pairs.\n _.isMatch = function(object, attrs) {\n var keys = _.keys(attrs), length = keys.length;\n if (object == null) return !length;\n var obj = Object(object);\n for (var i = 0; i < length; i++) {\n var key = keys[i];\n if (attrs[key] !== obj[key] || !(key in obj)) return false;\n }\n return true;\n };\n\n\n // Internal recursive comparison function for `isEqual`.\n var eq = function(a, b, aStack, bStack) {\n // Identical objects are equal. `0 === -0`, but they aren't identical.\n // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).\n if (a === b) return a !== 0 || 1 / a === 1 / b;\n // A strict comparison is necessary because `null == undefined`.\n if (a == null || b == null) return a === b;\n // Unwrap any wrapped objects.\n if (a instanceof _) a = a._wrapped;\n if (b instanceof _) b = b._wrapped;\n // Compare `[[Class]]` names.\n var className = toString.call(a);\n if (className !== toString.call(b)) return false;\n switch (className) {\n // Strings, numbers, regular expressions, dates, and booleans are compared by value.\n case '[object RegExp]':\n // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i')\n case '[object String]':\n // Primitives and their corresponding object wrappers are equivalent; thus, `\"5\"` is\n // equivalent to `new String(\"5\")`.\n return '' + a === '' + b;\n case '[object Number]':\n // `NaN`s are equivalent, but non-reflexive.\n // Object(NaN) is equivalent to NaN\n if (+a !== +a) return +b !== +b;\n // An `egal` comparison is performed for other numeric values.\n return +a === 0 ? 1 / +a === 1 / b : +a === +b;\n case '[object Date]':\n case '[object Boolean]':\n // Coerce dates and booleans to numeric primitive values. Dates are compared by their\n // millisecond representations. Note that invalid dates with millisecond representations\n // of `NaN` are not equivalent.\n return +a === +b;\n }\n\n var areArrays = className === '[object Array]';\n if (!areArrays) {\n if (typeof a != 'object' || typeof b != 'object') return false;\n\n // Objects with different constructors are not equivalent, but `Object`s or `Array`s\n // from different frames are.\n var aCtor = a.constructor, bCtor = b.constructor;\n if (aCtor !== bCtor && !(_.isFunction(aCtor) && aCtor instanceof aCtor &&\n _.isFunction(bCtor) && bCtor instanceof bCtor)\n && ('constructor' in a && 'constructor' in b)) {\n return false;\n }\n }\n // Assume equality for cyclic structures. The algorithm for detecting cyclic\n // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`.\n\n // Initializing stack of traversed objects.\n // It's done here since we only need them for objects and arrays comparison.\n aStack = aStack || [];\n bStack = bStack || [];\n var length = aStack.length;\n while (length--) {\n // Linear search. Performance is inversely proportional to the number of\n // unique nested structures.\n if (aStack[length] === a) return bStack[length] === b;\n }\n\n // Add the first object to the stack of traversed objects.\n aStack.push(a);\n bStack.push(b);\n\n // Recursively compare objects and arrays.\n if (areArrays) {\n // Compare array lengths to determine if a deep comparison is necessary.\n length = a.length;\n if (length !== b.length) return false;\n // Deep compare the contents, ignoring non-numeric properties.\n while (length--) {\n if (!eq(a[length], b[length], aStack, bStack)) return false;\n }\n } else {\n // Deep compare objects.\n var keys = _.keys(a), key;\n length = keys.length;\n // Ensure that both objects contain the same number of properties before comparing deep equality.\n if (_.keys(b).length !== length) return false;\n while (length--) {\n // Deep compare each member\n key = keys[length];\n if (!(_.has(b, key) && eq(a[key], b[key], aStack, bStack))) return false;\n }\n }\n // Remove the first object from the stack of traversed objects.\n aStack.pop();\n bStack.pop();\n return true;\n };\n\n // Perform a deep comparison to check if two objects are equal.\n _.isEqual = function(a, b) {\n return eq(a, b);\n };\n\n // Is a given array, string, or object empty?\n // An \"empty\" object has no enumerable own-properties.\n _.isEmpty = function(obj) {\n if (obj == null) return true;\n if (isArrayLike(obj) && (_.isArray(obj) || _.isString(obj) || _.isArguments(obj))) return obj.length === 0;\n return _.keys(obj).length === 0;\n };\n\n // Is a given value a DOM element?\n _.isElement = function(obj) {\n return !!(obj && obj.nodeType === 1);\n };\n\n // Is a given value an array?\n // Delegates to ECMA5's native Array.isArray\n _.isArray = nativeIsArray || function(obj) {\n return toString.call(obj) === '[object Array]';\n };\n\n // Is a given variable an object?\n _.isObject = function(obj) {\n var type = typeof obj;\n return type === 'function' || type === 'object' && !!obj;\n };\n\n // Add some isType methods: isArguments, isFunction, isString, isNumber, isDate, isRegExp, isError.\n _.each(['Arguments', 'Function', 'String', 'Number', 'Date', 'RegExp', 'Error'], function(name) {\n _['is' + name] = function(obj) {\n return toString.call(obj) === '[object ' + name + ']';\n };\n });\n\n // Define a fallback version of the method in browsers (ahem, IE < 9), where\n // there isn't any inspectable \"Arguments\" type.\n if (!_.isArguments(arguments)) {\n _.isArguments = function(obj) {\n return _.has(obj, 'callee');\n };\n }\n\n // Optimize `isFunction` if appropriate. Work around some typeof bugs in old v8,\n // IE 11 (#1621), and in Safari 8 (#1929).\n if (typeof /./ != 'function' && typeof Int8Array != 'object') {\n _.isFunction = function(obj) {\n return typeof obj == 'function' || false;\n };\n }\n\n // Is a given object a finite number?\n _.isFinite = function(obj) {\n return isFinite(obj) && !isNaN(parseFloat(obj));\n };\n\n // Is the given value `NaN`? (NaN is the only number which does not equal itself).\n _.isNaN = function(obj) {\n return _.isNumber(obj) && obj !== +obj;\n };\n\n // Is a given value a boolean?\n _.isBoolean = function(obj) {\n return obj === true || obj === false || toString.call(obj) === '[object Boolean]';\n };\n\n // Is a given value equal to null?\n _.isNull = function(obj) {\n return obj === null;\n };\n\n // Is a given variable undefined?\n _.isUndefined = function(obj) {\n return obj === void 0;\n };\n\n // Shortcut function for checking if an object has a given property directly\n // on itself (in other words, not on a prototype).\n _.has = function(obj, key) {\n return obj != null && hasOwnProperty.call(obj, key);\n };\n\n // Utility Functions\n // -----------------\n\n // Run Underscore.js in *noConflict* mode, returning the `_` variable to its\n // previous owner. Returns a reference to the Underscore object.\n _.noConflict = function() {\n root._ = previousUnderscore;\n return this;\n };\n\n // Keep the identity function around for default iteratees.\n _.identity = function(value) {\n return value;\n };\n\n // Predicate-generating functions. Often useful outside of Underscore.\n _.constant = function(value) {\n return function() {\n return value;\n };\n };\n\n _.noop = function(){};\n\n _.property = property;\n\n // Generates a function for a given object that returns a given property.\n _.propertyOf = function(obj) {\n return obj == null ? function(){} : function(key) {\n return obj[key];\n };\n };\n\n // Returns a predicate for checking whether an object has a given set of\n // `key:value` pairs.\n _.matcher = _.matches = function(attrs) {\n attrs = _.extendOwn({}, attrs);\n return function(obj) {\n return _.isMatch(obj, attrs);\n };\n };\n\n // Run a function **n** times.\n _.times = function(n, iteratee, context) {\n var accum = Array(Math.max(0, n));\n iteratee = optimizeCb(iteratee, context, 1);\n for (var i = 0; i < n; i++) accum[i] = iteratee(i);\n return accum;\n };\n\n // Return a random integer between min and max (inclusive).\n _.random = function(min, max) {\n if (max == null) {\n max = min;\n min = 0;\n }\n return min + Math.floor(Math.random() * (max - min + 1));\n };\n\n // A (possibly faster) way to get the current timestamp as an integer.\n _.now = Date.now || function() {\n return new Date().getTime();\n };\n\n // List of HTML entities for escaping.\n var escapeMap = {\n '&': '&',\n '<': '<',\n '>': '>',\n '\"': '"',\n \"'\": ''',\n '`': '`'\n };\n var unescapeMap = _.invert(escapeMap);\n\n // Functions for escaping and unescaping strings to/from HTML interpolation.\n var createEscaper = function(map) {\n var escaper = function(match) {\n return map[match];\n };\n // Regexes for identifying a key that needs to be escaped\n var source = '(?:' + _.keys(map).join('|') + ')';\n var testRegexp = RegExp(source);\n var replaceRegexp = RegExp(source, 'g');\n return function(string) {\n string = string == null ? '' : '' + string;\n return testRegexp.test(string) ? string.replace(replaceRegexp, escaper) : string;\n };\n };\n _.escape = createEscaper(escapeMap);\n _.unescape = createEscaper(unescapeMap);\n\n // If the value of the named `property` is a function then invoke it with the\n // `object` as context; otherwise, return it.\n _.result = function(object, property, fallback) {\n var value = object == null ? void 0 : object[property];\n if (value === void 0) {\n value = fallback;\n }\n return _.isFunction(value) ? value.call(object) : value;\n };\n\n // Generate a unique integer id (unique within the entire client session).\n // Useful for temporary DOM ids.\n var idCounter = 0;\n _.uniqueId = function(prefix) {\n var id = ++idCounter + '';\n return prefix ? prefix + id : id;\n };\n\n // By default, Underscore uses ERB-style template delimiters, change the\n // following template settings to use alternative delimiters.\n _.templateSettings = {\n evaluate : /<%([\\s\\S]+?)%>/g,\n interpolate : /<%=([\\s\\S]+?)%>/g,\n escape : /<%-([\\s\\S]+?)%>/g\n };\n\n // When customizing `templateSettings`, if you don't want to define an\n // interpolation, evaluation or escaping regex, we need one that is\n // guaranteed not to match.\n var noMatch = /(.)^/;\n\n // Certain characters need to be escaped so that they can be put into a\n // string literal.\n var escapes = {\n \"'\": \"'\",\n '\\\\': '\\\\',\n '\\r': 'r',\n '\\n': 'n',\n '\\u2028': 'u2028',\n '\\u2029': 'u2029'\n };\n\n var escaper = /\\\\|'|\\r|\\n|\\u2028|\\u2029/g;\n\n var escapeChar = function(match) {\n return '\\\\' + escapes[match];\n };\n\n // JavaScript micro-templating, similar to John Resig's implementation.\n // Underscore templating handles arbitrary delimiters, preserves whitespace,\n // and correctly escapes quotes within interpolated code.\n // NB: `oldSettings` only exists for backwards compatibility.\n _.template = function(text, settings, oldSettings) {\n if (!settings && oldSettings) settings = oldSettings;\n settings = _.defaults({}, settings, _.templateSettings);\n\n // Combine delimiters into one regular expression via alternation.\n var matcher = RegExp([\n (settings.escape || noMatch).source,\n (settings.interpolate || noMatch).source,\n (settings.evaluate || noMatch).source\n ].join('|') + '|$', 'g');\n\n // Compile the template source, escaping string literals appropriately.\n var index = 0;\n var source = \"__p+='\";\n text.replace(matcher, function(match, escape, interpolate, evaluate, offset) {\n source += text.slice(index, offset).replace(escaper, escapeChar);\n index = offset + match.length;\n\n if (escape) {\n source += \"'+\\n((__t=(\" + escape + \"))==null?'':_.escape(__t))+\\n'\";\n } else if (interpolate) {\n source += \"'+\\n((__t=(\" + interpolate + \"))==null?'':__t)+\\n'\";\n } else if (evaluate) {\n source += \"';\\n\" + evaluate + \"\\n__p+='\";\n }\n\n // Adobe VMs need the match returned to produce the correct offest.\n return match;\n });\n source += \"';\\n\";\n\n // If a variable is not specified, place data values in local scope.\n if (!settings.variable) source = 'with(obj||{}){\\n' + source + '}\\n';\n\n source = \"var __t,__p='',__j=Array.prototype.join,\" +\n \"print=function(){__p+=__j.call(arguments,'');};\\n\" +\n source + 'return __p;\\n';\n\n try {\n var render = new Function(settings.variable || 'obj', '_', source);\n } catch (e) {\n e.source = source;\n throw e;\n }\n\n var template = function(data) {\n return render.call(this, data, _);\n };\n\n // Provide the compiled source as a convenience for precompilation.\n var argument = settings.variable || 'obj';\n template.source = 'function(' + argument + '){\\n' + source + '}';\n\n return template;\n };\n\n // Add a \"chain\" function. Start chaining a wrapped Underscore object.\n _.chain = function(obj) {\n var instance = _(obj);\n instance._chain = true;\n return instance;\n };\n\n // OOP\n // ---------------\n // If Underscore is called as a function, it returns a wrapped object that\n // can be used OO-style. This wrapper holds altered versions of all the\n // underscore functions. Wrapped objects may be chained.\n\n // Helper function to continue chaining intermediate results.\n var result = function(instance, obj) {\n return instance._chain ? _(obj).chain() : obj;\n };\n\n // Add your own custom functions to the Underscore object.\n _.mixin = function(obj) {\n _.each(_.functions(obj), function(name) {\n var func = _[name] = obj[name];\n _.prototype[name] = function() {\n var args = [this._wrapped];\n push.apply(args, arguments);\n return result(this, func.apply(_, args));\n };\n });\n };\n\n // Add all of the Underscore functions to the wrapper object.\n _.mixin(_);\n\n // Add all mutator Array functions to the wrapper.\n _.each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) {\n var method = ArrayProto[name];\n _.prototype[name] = function() {\n var obj = this._wrapped;\n method.apply(obj, arguments);\n if ((name === 'shift' || name === 'splice') && obj.length === 0) delete obj[0];\n return result(this, obj);\n };\n });\n\n // Add all accessor Array functions to the wrapper.\n _.each(['concat', 'join', 'slice'], function(name) {\n var method = ArrayProto[name];\n _.prototype[name] = function() {\n return result(this, method.apply(this._wrapped, arguments));\n };\n });\n\n // Extracts the result from a wrapped and chained object.\n _.prototype.value = function() {\n return this._wrapped;\n };\n\n // Provide unwrapping proxy for some methods used in engine operations\n // such as arithmetic and JSON stringification.\n _.prototype.valueOf = _.prototype.toJSON = _.prototype.value;\n\n _.prototype.toString = function() {\n return '' + this._wrapped;\n };\n\n // AMD registration happens at the end for compatibility with AMD loaders\n // that may not enforce next-turn semantics on modules. Even though general\n // practice for AMD registration is to be anonymous, underscore registers\n // as a named module because, like jQuery, it is a base library that is\n // popular enough to be bundled in a third party lib, but not be part of\n // an AMD load request. Those cases could generate an error when an\n // anonymous define() is called outside of a loader request.\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function() {\n return _;\n }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n }\n}.call(this));\n\n\n/***/ }),\n/* 2 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.getUnitFromValue = exports.normalizeFloat = exports.shallowDiff = exports.camelCase = exports.matches = exports.upFirst = exports.hasDnd = exports.off = exports.on = undefined;\n\nvar _underscore = __webpack_require__(1);\n\nvar elProt = window.Element.prototype;\nvar matches = elProt.matches || elProt.webkitMatchesSelector || elProt.mozMatchesSelector || elProt.msMatchesSelector;\n\n/**\n * Returns shallow diff between 2 objects\n * @param {Object} objOrig\n * @param {Objec} objNew\n * @return {Object}\n * @example\n * var a = {foo: 'bar', baz: 1, faz: 'sop'};\n * var b = {foo: 'bar', baz: 2, bar: ''};\n * shallowDiff(a, b);\n * // -> {baz: 2, faz: null, bar: ''};\n */\nvar shallowDiff = function shallowDiff(objOrig, objNew) {\n var result = {};\n var keysNew = (0, _underscore.keys)(objNew);\n\n for (var prop in objOrig) {\n if (objOrig.hasOwnProperty(prop)) {\n var origValue = objOrig[prop];\n var newValue = objNew[prop];\n\n if (keysNew.indexOf(prop) >= 0) {\n if (origValue !== newValue) {\n result[prop] = newValue;\n }\n } else {\n result[prop] = null;\n }\n }\n }\n\n for (var _prop in objNew) {\n if (objNew.hasOwnProperty(_prop)) {\n if ((0, _underscore.isUndefined)(objOrig[_prop])) {\n result[_prop] = objNew[_prop];\n }\n }\n }\n\n return result;\n};\n\nvar on = function on(el, ev, fn) {\n ev = ev.split(/\\s+/);\n el = el instanceof Array ? el : [el];\n\n var _loop = function _loop(i) {\n el.forEach(function (elem) {\n return elem.addEventListener(ev[i], fn);\n });\n };\n\n for (var i = 0; i < ev.length; ++i) {\n _loop(i);\n }\n};\n\nvar off = function off(el, ev, fn) {\n ev = ev.split(/\\s+/);\n el = el instanceof Array ? el : [el];\n\n var _loop2 = function _loop2(i) {\n el.forEach(function (elem) {\n return elem.removeEventListener(ev[i], fn);\n });\n };\n\n for (var i = 0; i < ev.length; ++i) {\n _loop2(i);\n }\n};\n\nvar getUnitFromValue = function getUnitFromValue(value) {\n return value.replace(parseFloat(value), '');\n};\n\nvar upFirst = function upFirst(value) {\n return value[0].toUpperCase() + value.toLowerCase().slice(1);\n};\n\nvar camelCase = function camelCase(value) {\n var values = value.split('-');\n return values[0].toLowerCase() + values.slice(1).map(upFirst);\n};\n\nvar normalizeFloat = function normalizeFloat(value) {\n var step = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;\n var valueDef = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0;\n\n var stepDecimals = 0;\n if (isNaN(value)) return valueDef;\n value = parseFloat(value);\n\n if (Math.floor(value) !== value) {\n var side = step.toString().split('.')[1];\n stepDecimals = side ? side.length : 0;\n }\n\n return stepDecimals ? parseFloat(value.toFixed(stepDecimals)) : value;\n};\n\nvar hasDnd = function hasDnd(em) {\n return 'draggable' in document.createElement('i') && (em ? em.get('Config').nativeDnD : 1);\n};\n\nexports.on = on;\nexports.off = off;\nexports.hasDnd = hasDnd;\nexports.upFirst = upFirst;\nexports.matches = matches;\nexports.camelCase = camelCase;\nexports.shallowDiff = shallowDiff;\nexports.normalizeFloat = normalizeFloat;\nexports.getUnitFromValue = getUnitFromValue;\n\n/***/ }),\n/* 3 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Backbone) {\n\nvar _underscore = __webpack_require__(1);\n\nvar ComponentsView = __webpack_require__(51);\n\nmodule.exports = Backbone.View.extend({\n className: function className() {\n return this.getClasses();\n },\n tagName: function tagName() {\n return this.model.get('tagName');\n },\n initialize: function initialize() {\n var opt = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n var model = this.model;\n var config = opt.config || {};\n this.opts = opt;\n this.config = config;\n this.em = config.em || '';\n this.pfx = config.stylePrefix || '';\n this.ppfx = config.pStylePrefix || '';\n this.attr = model.get('attributes');\n this.classe = this.attr.class || [];\n var $el = this.$el;\n var classes = model.get('classes');\n this.listenTo(model, 'destroy remove', this.remove);\n this.listenTo(model, 'change:style', this.updateStyle);\n this.listenTo(model, 'change:attributes', this.updateAttributes);\n this.listenTo(model, 'change:highlightable', this.updateHighlight);\n this.listenTo(model, 'change:status', this.updateStatus);\n this.listenTo(model, 'change:state', this.updateState);\n this.listenTo(model, 'change:script', this.render);\n this.listenTo(model, 'change', this.handleChange);\n this.listenTo(classes, 'add remove change', this.updateClasses);\n $el.data('model', model);\n $el.data('collection', model.get('components'));\n model.view = this;\n classes.length && this.importClasses();\n this.init();\n },\n remove: function remove() {\n Backbone.View.prototype.remove.apply(this);\n var children = this.childrenView;\n children && children.stopListening();\n },\n\n\n /**\n * Initialize callback\n */\n init: function init() {},\n\n\n /**\n * Handle any property change\n * @private\n */\n handleChange: function handleChange() {\n var model = this.model;\n model.emitUpdate();\n\n for (var prop in model.changed) {\n model.emitUpdate(prop);\n }\n },\n\n\n /**\n * Import, if possible, classes inside main container\n * @private\n * */\n importClasses: function importClasses() {\n var clm = this.config.em.get('SelectorManager');\n\n if (clm) {\n this.model.get('classes').each(function (m) {\n clm.add(m.get('name'));\n });\n }\n },\n\n\n /**\n * Fires on state update. If the state is not empty will add a helper class\n * @param {Event} e\n * @private\n * */\n updateState: function updateState(e) {\n var cl = 'hc-state';\n var state = this.model.get('state');\n\n if (state) {\n this.$el.addClass(cl);\n } else {\n this.$el.removeClass(cl);\n }\n },\n\n\n /**\n * Update item on status change\n * @param {Event} e\n * @private\n * */\n updateStatus: function updateStatus(e) {\n var el = this.el;\n var status = this.model.get('status');\n var pfx = this.pfx;\n var ppfx = this.ppfx;\n var selectedCls = pfx + 'selected';\n var selectedParentCls = selectedCls + '-parent';\n var freezedCls = ppfx + 'freezed';\n var actualCls = el.getAttribute('class') || '';\n var cls = '';\n\n switch (status) {\n case 'selected':\n cls = actualCls + ' ' + selectedCls;\n break;\n case 'selected-parent':\n cls = actualCls + ' ' + selectedParentCls;\n break;\n case 'freezed':\n cls = actualCls + ' ' + freezedCls;\n break;\n default:\n this.$el.removeClass(selectedCls + ' ' + selectedParentCls + ' ' + freezedCls);\n }\n\n cls = cls.trim();\n\n if (cls) {\n el.setAttribute('class', cls);\n }\n },\n\n\n /**\n * Update highlight attribute\n * @private\n * */\n updateHighlight: function updateHighlight() {\n var hl = this.model.get('highlightable');\n this.setAttribute('data-highlightable', hl ? 1 : '');\n },\n\n\n /**\n * Update style attribute\n * @private\n * */\n updateStyle: function updateStyle() {\n var em = this.em;\n var model = this.model;\n\n if (em && em.get('avoidInlineStyle')) {\n this.el.id = model.getId();\n model.setStyle(model.getStyle());\n } else {\n this.setAttribute('style', model.styleToString());\n }\n },\n\n\n /**\n * Update classe attribute\n * @private\n * */\n updateClasses: function updateClasses() {\n var str = this.model.get('classes').pluck('name').join(' ');\n this.setAttribute('class', str);\n\n // Regenerate status class\n this.updateStatus();\n },\n\n\n /**\n * Update single attribute\n * @param {[type]} name [description]\n * @param {[type]} value [description]\n */\n setAttribute: function setAttribute(name, value) {\n var el = this.$el;\n value ? el.attr(name, value) : el.removeAttr(name);\n },\n\n\n /**\n * Get classes from attributes.\n * This method is called before initialize\n *\n * @return {Array}|null\n * @private\n * */\n getClasses: function getClasses() {\n var attr = this.model.get('attributes'),\n classes = attr['class'] || [];\n classes = (0, _underscore.isArray)(classes) ? classes : [classes];\n\n if (classes.length) {\n return classes.join(' ');\n } else {\n return null;\n }\n },\n\n\n /**\n * Update attributes\n * @private\n * */\n updateAttributes: function updateAttributes() {\n var model = this.model;\n var attrs = {};\n var attr = model.get('attributes');\n var src = model.get('src');\n\n for (var key in attr) {\n attrs[key] = attr[key];\n }\n\n src && (attrs.src = src);\n this.$el.attr(attrs);\n this.updateHighlight();\n this.updateStyle();\n },\n\n\n /**\n * Update component content\n * @private\n * */\n updateContent: function updateContent() {\n this.getChildrenContainer().innerHTML = this.model.get('content');\n },\n\n\n /**\n * Prevent default helper\n * @param {Event} e\n * @private\n */\n prevDef: function prevDef(e) {\n e.preventDefault();\n },\n\n\n /**\n * Render component's script\n * @private\n */\n updateScript: function updateScript() {\n if (!this.model.get('script')) {\n return;\n }\n\n var em = this.em;\n if (em) {\n var canvas = em.get('Canvas');\n canvas.getCanvasView().updateScript(this);\n }\n },\n\n\n /**\n * Return children container\n * Differently from a simple component where children container is the\n * component itself\n * <my-comp>\n * <!--\n * <child></child> ...\n * -->\n * </my-comp>\n * You could have the children container more deeper\n * <my-comp>\n * <div></div>\n * <div></div>\n * <div>\n * <div>\n * <!--\n * <child></child> ...\n * -->\n * </div>\n * </div>\n * </my-comp>\n * @return HTMLElement\n * @private\n */\n getChildrenContainer: function getChildrenContainer() {\n var container = this.el;\n\n if (typeof this.getChildrenSelector == 'function') {\n container = this.el.querySelector(this.getChildrenSelector());\n } else if (typeof this.getTemplate == 'function') {\n // Need to find deepest first child\n }\n\n return container;\n },\n\n\n /**\n * Render children components\n * @private\n */\n renderChildren: function renderChildren() {\n var container = this.getChildrenContainer();\n var view = new ComponentsView({\n collection: this.model.get('components'),\n config: this.config,\n componentTypes: this.opts.componentTypes\n });\n\n view.render(container);\n this.childrenView = view;\n var childNodes = Array.prototype.slice.call(view.el.childNodes);\n\n for (var i = 0, len = childNodes.length; i < len; i++) {\n container.appendChild(childNodes.shift());\n }\n\n // If the children container is not the same as the component\n // (so likely fetched with getChildrenSelector()) is necessary\n // to disable pointer-events for all nested components as they\n // might prevent the component to be selected\n if (container !== this.el) {\n var disableNode = function disableNode(el) {\n var children = Array.prototype.slice.call(el.children);\n children.forEach(function (el) {\n el.style['pointer-events'] = 'none';\n if (container !== el) {\n disableNode(el);\n }\n });\n };\n disableNode(this.el);\n }\n },\n renderAttributes: function renderAttributes() {\n this.updateAttributes();\n this.updateClasses();\n },\n render: function render() {\n this.renderAttributes();\n this.updateContent();\n this.renderChildren();\n this.updateScript();\n this.onRender();\n return this;\n },\n onRender: function onRender() {}\n});\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))\n\n/***/ }),\n/* 4 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar _underscore = __webpack_require__(1);\n\nvar _mixins = __webpack_require__(2);\n\nvar _Styleable = __webpack_require__(47);\n\nvar _Styleable2 = _interopRequireDefault(_Styleable);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar Backbone = __webpack_require__(0);\nvar Components = __webpack_require__(50);\nvar Selector = __webpack_require__(7);\nvar Selectors = __webpack_require__(10);\nvar Traits = __webpack_require__(150);\nvar componentList = {};\nvar componentIndex = 0;\n\nvar escapeRegExp = function escapeRegExp(str) {\n return str.replace(/[|\\\\{}()[\\]^$+*?.]/g, '\\\\$&');\n};\n\nvar Component = Backbone.Model.extend(_Styleable2.default).extend({\n defaults: {\n // HTML tag of the component\n tagName: 'div',\n\n // Component type, eg. 'text', 'image', 'video', etc.\n type: '',\n\n // Name of the component. Will be used, for example, in layers and badges\n name: '',\n\n // True if the component is removable from the canvas\n removable: true,\n\n // Indicates if it's possible to drag the component inside others\n // Tip: Indicate an array of selectors where it could be dropped inside\n draggable: true,\n\n // Indicates if it's possible to drop other components inside\n // Tip: Indicate an array of selectors which could be dropped inside\n droppable: true,\n\n // Set false if don't want to see the badge (with the name) over the component\n badgable: true,\n\n // True if it's possible to style it\n // Tip:\n // Indicate an array of CSS properties which is possible to style, eg. ['color', 'width']\n // All other properties will be hidden from the style manager\n stylable: true,\n\n // Indicate an array of style properties to show up which has been marked as `toRequire`\n 'stylable-require': '',\n\n // Indicate an array of style properties which should be hidden from the style manager\n unstylable: '',\n\n // Highlightable with 'dotted' style if true\n highlightable: true,\n\n // True if it's possible to clone the component\n copyable: true,\n\n // Indicates if it's possible to resize the component (at the moment implemented only on Image Components)\n // It's also possible to pass an object as options for the Resizer\n resizable: false,\n\n // Allow to edit the content of the component (used on Text components)\n editable: false,\n\n // Hide the component inside Layers\n layerable: true,\n\n // Allow component to be selected when clicked\n selectable: true,\n\n // Shows a highlight outline when hovering on the element if true\n hoverable: true,\n\n // This property is used by the HTML exporter as void elements do not\n // have closing tag, eg. <br/>, <hr/>, etc.\n void: false,\n\n // Indicates if the component is in some CSS state like ':hover', ':active', etc.\n state: '',\n\n // State, eg. 'selected'\n status: '',\n\n // Content of the component (not escaped) which will be appended before children rendering\n content: '',\n\n // Component icon, this string will be inserted before the name, eg. '<i class=\"fa fa-square-o\"></i>'\n icon: '',\n\n // Component related style\n style: '',\n\n // Key-value object of the component's attributes\n attributes: '',\n\n // Array of classes\n classes: '',\n\n // Component's javascript\n script: '',\n\n // Traits\n traits: ['id', 'title'],\n\n // Indicates an array of properties which will be inhereted by\n // all NEW appended children\n //\n // If you create a model likes this\n // removable: false,\n // draggable: false,\n // propagate: ['removable', 'draggable']\n // When you append some new component inside, the new added model\n // will get the exact same properties indicated in `propagate` array\n // (as the `propagate` property itself)\n //\n propagate: '',\n\n /**\n * Set an array of items to show up inside the toolbar (eg. move, clone, delete)\n * when the component is selected\n * toolbar: [{\n * attributes: {class: 'fa fa-arrows'},\n * command: 'tlb-move',\n * },{\n * attributes: {class: 'fa fa-clone'},\n * command: 'tlb-clone',\n * }]\n */\n toolbar: null\n },\n\n initialize: function initialize() {\n var _this = this;\n\n var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n var em = opt.em;\n\n // Propagate properties from parent if indicated\n var parent = this.parent();\n var parentAttr = parent && parent.attributes;\n\n if (parentAttr && parentAttr.propagate) {\n var newAttr = {};\n var toPropagate = parentAttr.propagate;\n toPropagate.forEach(function (prop) {\n return newAttr[prop] = parent.get(prop);\n });\n newAttr.propagate = toPropagate;\n newAttr = _extends({}, newAttr, props);\n this.set(newAttr);\n }\n\n var propagate = this.get('propagate');\n propagate && this.set('propagate', (0, _underscore.isArray)(propagate) ? propagate : [propagate]);\n\n // Check void elements\n if (opt && opt.config && opt.config.voidElements.indexOf(this.get('tagName')) >= 0) {\n this.set('void', true);\n }\n\n opt.em = em;\n this.opt = opt;\n this.em = em;\n this.config = opt.config || {};\n this.ccid = Component.createId(this);\n this.set('attributes', this.get('attributes') || {});\n this.on('remove', this.handleRemove);\n this.listenTo(this, 'change:script', this.scriptUpdated);\n this.listenTo(this, 'change:traits', this.traitsUpdated);\n this.listenTo(this, 'change:tagName', this.tagUpdated);\n this.listenTo(this, 'change:attributes', this.attrUpdated);\n this.initClasses();\n this.loadTraits();\n this.initComponents();\n this.initToolbar();\n this.set('status', '');\n this.listenTo(this.get('classes'), 'add remove change', function () {\n return _this.emitUpdate('classes');\n });\n this.init();\n },\n\n\n /**\n * Triggered on model remove\n * @param {Model} removed Removed model\n * @private\n */\n handleRemove: function handleRemove(removed) {\n var em = this.em;\n em && em.trigger('component:remove', removed);\n },\n\n\n /**\n * Check component's type\n * @param {string} type Component type\n * @return {Boolean}\n * @example\n * model.is('image')\n * // -> false\n */\n is: function is(type) {\n return !!(this.get('type') == type);\n },\n\n\n /**\n * Find inner models by query string\n * ATTENTION: this method works only with alredy rendered component\n * @param {string} query Query string\n * @return {Array} Array of models\n * @example\n * model.find('div > .class');\n * // -> [Component, Component, ...]\n */\n find: function find(query) {\n var result = [];\n\n this.view.$el.find(query).each(function (el, i, $els) {\n var $el = $els.eq(i);\n var model = $el.data('model');\n model && result.push(model);\n });\n\n return result;\n },\n\n\n /**\n * Find closest model by query string\n * ATTENTION: this method works only with alredy rendered component\n * @param {string} query Query string\n * @return {Component}\n * @example\n * model.closest('div');\n */\n closest: function closest(query) {\n var result = this.view.$el.closest(query);\n return result.length && result.data('model');\n },\n\n\n /**\n * Once the tag is updated I have to remove the node and replace it\n */\n tagUpdated: function tagUpdated() {\n var coll = this.collection;\n var at = coll.indexOf(this);\n coll.remove(this);\n coll.add(this, { at: at });\n },\n\n\n /**\n * Emit changes for each updated attribute\n */\n attrUpdated: function attrUpdated() {\n var _this2 = this;\n\n var attrPrev = _extends({}, this.previous('attributes'));\n var attrCurrent = _extends({}, this.get('attributes'));\n var diff = (0, _mixins.shallowDiff)(attrPrev, attrCurrent);\n (0, _underscore.keys)(diff).forEach(function (pr) {\n return _this2.trigger('change:attributes:' + pr);\n });\n },\n\n\n /**\n * Update attributes of the model\n * @param {Object} attrs Key value attributes\n * @example\n * model.setAttributes({id: 'test', 'data-key': 'value'});\n */\n setAttributes: function setAttributes(attrs) {\n attrs = _extends({}, attrs);\n\n // Handle classes\n var classes = attrs.class;\n classes && this.setClass(classes);\n delete attrs.class;\n\n // Handle style\n var style = attrs.style;\n style && this.setStyle(style);\n delete attrs.style;\n\n this.set('attributes', attrs);\n },\n\n\n /**\n * Add attributes to the model\n * @param {Object} attrs Key value attributes\n * @example\n * model.addAttributes({id: 'test'});\n */\n addAttributes: function addAttributes(attrs) {\n var newAttrs = _extends({}, this.getAttributes(), attrs);\n this.setAttributes(newAttrs);\n },\n getStyle: function getStyle() {\n var em = this.em;\n\n if (em && em.getConfig('avoidInlineStyle')) {\n var state = this.get('state');\n var cc = em.get('CssComposer');\n var rule = cc.getIdRule(this.getId(), { state: state });\n this.rule = rule;\n\n if (rule) {\n return rule.getStyle();\n }\n }\n\n return _Styleable2.default.getStyle.call(this);\n },\n setStyle: function setStyle() {\n var _this3 = this;\n\n var prop = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n var em = this.em;\n\n if (em && em.getConfig('avoidInlineStyle')) {\n prop = (0, _underscore.isString)(prop) ? this.parseStyle(prop) : prop;\n var state = this.get('state');\n var cc = em.get('CssComposer');\n var propOrig = this.getStyle();\n this.rule = cc.setIdRule(this.getId(), prop, _extends({}, opts, { state: state }));\n var diff = (0, _mixins.shallowDiff)(propOrig, prop);\n (0, _underscore.keys)(diff).forEach(function (pr) {\n return _this3.trigger('change:style:' + pr);\n });\n } else {\n prop = _Styleable2.default.setStyle.apply(this, arguments);\n }\n\n return prop;\n },\n\n\n /**\n * Return attributes\n * @return {Object}\n */\n getAttributes: function getAttributes() {\n var classes = [];\n var attributes = _extends({}, this.get('attributes'));\n\n // Add classes\n this.get('classes').each(function (cls) {\n return classes.push(cls.get('name'));\n });\n classes.length && (attributes.class = classes.join(' '));\n\n // If style is not empty I need an ID attached to the component\n if (!(0, _underscore.isEmpty)(this.getStyle()) && !(0, _underscore.has)(attributes, 'id')) {\n attributes.id = this.getId();\n }\n\n return attributes;\n },\n\n\n /**\n * Add classes\n * @param {Array|string} classes Array or string of classes\n * @return {Array} Array of added selectors\n * @example\n * model.addClass('class1');\n * model.addClass('class1 class2');\n * model.addClass(['class1', 'class2']);\n * // -> [SelectorObject, ...]\n */\n addClass: function addClass(classes) {\n var added = this.em.get('SelectorManager').addClass(classes);\n return this.get('classes').add(added);\n },\n\n\n /**\n * Set classes (resets current collection)\n * @param {Array|string} classes Array or string of classes\n * @return {Array} Array of added selectors\n * @example\n * model.setClass('class1');\n * model.setClass('class1 class2');\n * model.setClass(['class1', 'class2']);\n * // -> [SelectorObject, ...]\n */\n setClass: function setClass(classes) {\n this.get('classes').reset();\n return this.addClass(classes);\n },\n\n\n /**\n * Remove classes\n * @param {Array|string} classes Array or string of classes\n * @return {Array} Array of removed selectors\n * @example\n * model.removeClass('class1');\n * model.removeClass('class1 class2');\n * model.removeClass(['class1', 'class2']);\n * // -> [SelectorObject, ...]\n */\n removeClass: function removeClass(classes) {\n var removed = [];\n classes = (0, _underscore.isArray)(classes) ? classes : [classes];\n var selectors = this.get('classes');\n var type = Selector.TYPE_CLASS;\n\n classes.forEach(function (classe) {\n var classes = classe.split(' ');\n classes.forEach(function (name) {\n var selector = selectors.where({ name: name, type: type })[0];\n selector && removed.push(selectors.remove(selector));\n });\n });\n\n return removed;\n },\n initClasses: function initClasses() {\n var classes = this.normalizeClasses(this.get('classes') || []);\n this.set('classes', new Selectors(classes));\n return this;\n },\n initComponents: function initComponents() {\n // Have to add components after the init, otherwise the parent\n // is not visible\n var comps = new Components(null, this.opt);\n comps.parent = this;\n !this.opt.avoidChildren && comps.reset(this.get('components'));\n this.set('components', comps);\n return this;\n },\n\n\n /**\n * Initialize callback\n */\n init: function init() {},\n\n\n /**\n * Add new component children\n * @param {Component|string} components Component to add\n * @param {Object} [opts={}] Options, same as in `model.add()`(from backbone)\n * @return {Array} Array of appended components\n * @example\n * someModel.get('components').lenght // -> 0\n * const videoComponent = someModel.append('<video></video><div></div>')[0];\n * // This will add 2 components (`video` and `div`) to your `someModel`\n * someModel.get('components').lenght // -> 2\n * // You can pass components directly\n * otherModel.append(otherModel2);\n * otherModel.append([otherModel3, otherModel4]);\n */\n append: function append(components) {\n var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n var result = this.components().add(components, opts);\n return (0, _underscore.isArray)(result) ? result : [result];\n },\n\n\n /**\n * Set new collection if `components` are provided, otherwise the\n * current collection is returned\n * @param {Component|string} [components] Components to set\n * @return {Collection|undefined}\n * @example\n * // Get current collection\n * const collection = model.components();\n * // Set new collection\n * model.components('<span></span><div></div>');\n */\n components: function components(_components) {\n var coll = this.get('components');\n\n if ((0, _underscore.isUndefined)(_components)) {\n return coll;\n } else {\n coll.reset();\n _components && this.append(_components);\n }\n },\n\n\n /**\n * Get parent model\n * @return {Component}\n */\n parent: function parent() {\n var coll = this.collection;\n return coll && coll.parent;\n },\n\n\n /**\n * Script updated\n */\n scriptUpdated: function scriptUpdated() {\n this.set('scriptUpdated', 1);\n },\n\n\n /**\n * Once traits are updated I have to populates model's attributes\n */\n traitsUpdated: function traitsUpdated() {\n var found = 0;\n var attrs = _extends({}, this.get('attributes'));\n var traits = this.get('traits');\n\n if (!(traits instanceof Traits)) {\n this.loadTraits();\n return;\n }\n\n traits.each(function (trait) {\n found = 1;\n if (!trait.get('changeProp')) {\n var value = trait.getInitValue();\n if (value) {\n attrs[trait.get('name')] = value;\n }\n }\n });\n\n found && this.set('attributes', attrs);\n },\n\n\n /**\n * Init toolbar\n */\n initToolbar: function initToolbar() {\n var model = this;\n if (!model.get('toolbar')) {\n var tb = [];\n if (model.collection) {\n tb.push({\n attributes: { class: 'fa fa-arrow-up' },\n command: 'select-parent'\n });\n }\n if (model.get('draggable')) {\n tb.push({\n attributes: { class: 'fa fa-arrows', draggable: true },\n //events: hasDnd(this.em) ? { dragstart: 'execCommand' } : '',\n command: 'tlb-move'\n });\n }\n if (model.get('copyable')) {\n tb.push({\n attributes: { class: 'fa fa-clone' },\n command: 'tlb-clone'\n });\n }\n if (model.get('removable')) {\n tb.push({\n attributes: { class: 'fa fa-trash-o' },\n command: 'tlb-delete'\n });\n }\n model.set('toolbar', tb);\n }\n },\n\n\n /**\n * Load traits\n * @param {Array} traits\n * @private\n */\n loadTraits: function loadTraits(traits) {\n var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n var trt = new Traits([], this.opt);\n trt.setTarget(this);\n traits = traits || this.get('traits');\n\n if (traits.length) {\n trt.add(traits);\n }\n\n this.set('traits', trt, opts);\n return this;\n },\n\n\n /**\n * Normalize input classes from array to array of objects\n * @param {Array} arr\n * @return {Array}\n * @private\n */\n normalizeClasses: function normalizeClasses(arr) {\n var res = [];\n var em = this.em;\n\n if (!em) return;\n\n var clm = em.get('SelectorManager');\n if (!clm) return;\n\n arr.forEach(function (val) {\n var name = '';\n\n if (typeof val === 'string') name = val;else name = val.name;\n\n var model = clm.add(name);\n res.push(model);\n });\n return res;\n },\n\n\n /**\n * Override original clone method\n * @private\n */\n clone: function clone() {\n var em = this.em;\n var style = this.getStyle();\n var attr = _extends({}, this.attributes);\n var opts = _extends({}, this.opt);\n attr.attributes = _extends({}, attr.attributes);\n delete attr.attributes.id;\n attr.components = [];\n attr.classes = [];\n attr.traits = [];\n\n this.get('components').each(function (md, i) {\n attr.components[i] = md.clone();\n });\n this.get('traits').each(function (md, i) {\n attr.traits[i] = md.clone();\n });\n this.get('classes').each(function (md, i) {\n attr.classes[i] = md.get('name');\n });\n\n attr.status = '';\n attr.view = '';\n opts.collection = null;\n\n if (em && em.getConfig('avoidInlineStyle') && !(0, _underscore.isEmpty)(style)) {\n attr.style = style;\n }\n\n return new this.constructor(attr, opts);\n },\n\n\n /**\n * Get the name of the component\n * @return {string}\n * */\n getName: function getName() {\n var customName = this.get('name') || this.get('custom-name');\n var tag = this.get('tagName');\n tag = tag == 'div' ? 'box' : tag;\n var name = this.get('type') || tag;\n name = name.charAt(0).toUpperCase() + name.slice(1);\n return customName || name;\n },\n\n\n /**\n * Get the icon string\n * @return {string}\n */\n getIcon: function getIcon() {\n var icon = this.get('icon');\n return icon ? icon + ' ' : '';\n },\n\n\n /**\n * Return HTML string of the component\n * @param {Object} opts Options\n * @return {string} HTML string\n * @private\n */\n toHTML: function toHTML(opts) {\n var model = this;\n var attrs = [];\n var classes = [];\n var tag = model.get('tagName');\n var sTag = model.get('void');\n var attributes = this.getAttrToHTML();\n\n for (var attr in attributes) {\n var value = attributes[attr];\n\n if (!(0, _underscore.isUndefined)(value)) {\n attrs.push(attr + '=\"' + value + '\"');\n }\n }\n\n var attrString = attrs.length ? ' ' + attrs.join(' ') : '';\n var code = '<' + tag + attrString + (sTag ? '/' : '') + '>' + model.get('content');\n model.get('components').each(function (comp) {\n return code += comp.toHTML();\n });\n !sTag && (code += '</' + tag + '>');\n\n return code;\n },\n\n\n /**\n * Returns object of attributes for HTML\n * @return {Object}\n * @private\n */\n getAttrToHTML: function getAttrToHTML() {\n var attr = this.getAttributes();\n delete attr.style;\n return attr;\n },\n\n\n /**\n * Return a shallow copy of the model's attributes for JSON\n * stringification.\n * @return {Object}\n * @private\n */\n toJSON: function toJSON() {\n for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n var obj = Backbone.Model.prototype.toJSON.apply(this, args);\n var scriptStr = this.getScriptString();\n obj.attributes = this.getAttributes();\n delete obj.attributes.class;\n delete obj.toolbar;\n scriptStr && (obj.script = scriptStr);\n\n return obj;\n },\n\n\n /**\n * Return model id\n * @return {string}\n */\n getId: function getId() {\n var attrs = this.get('attributes') || {};\n return attrs.id || this.ccid || this.cid;\n },\n\n\n /**\n * Get the DOM element of the model. This works only of the\n * model is alredy rendered\n * @return {HTMLElement}\n */\n getEl: function getEl() {\n return this.view && this.view.el;\n },\n\n\n /**\n * Return script in string format, cleans 'function() {..' from scripts\n * if it's a function\n * @param {string|Function} script\n * @return {string}\n * @private\n */\n getScriptString: function getScriptString(script) {\n var _this4 = this;\n\n var scr = script || this.get('script');\n\n if (!scr) {\n return scr;\n }\n\n // Need to convert script functions to strings\n if (typeof scr == 'function') {\n var scrStr = scr.toString().trim();\n scrStr = scrStr.replace(/^function[\\s\\w]*\\(\\)\\s?\\{/, '').replace(/\\}$/, '');\n scr = scrStr.trim();\n }\n\n var config = this.em.getConfig();\n var tagVarStart = escapeRegExp(config.tagVarStart || '{[ ');\n var tagVarEnd = escapeRegExp(config.tagVarEnd || ' ]}');\n var reg = new RegExp(tagVarStart + '([\\\\w\\\\d-]*)' + tagVarEnd, 'g');\n scr = scr.replace(reg, function (match, v) {\n // If at least one match is found I have to track this change for a\n // better optimization inside JS generator\n _this4.scriptUpdated();\n return _this4.attributes[v] || '';\n });\n\n return scr;\n },\n emitUpdate: function emitUpdate(property) {\n var em = this.em;\n var event = 'component:update' + (property ? ':' + property : '');\n em && em.trigger(event, this);\n }\n}, {\n /**\n * Detect if the passed element is a valid component.\n * In case the element is valid an object abstracted\n * from the element will be returned\n * @param {HTMLElement}\n * @return {Object}\n * @private\n */\n isComponent: function isComponent(el) {\n return { tagName: el.tagName ? el.tagName.toLowerCase() : '' };\n },\n\n\n /**\n * Relying simply on the number of components becomes a problem when you\n * store and load them back, you might hit collisions with new components\n * @param {Model} model\n * @return {string}\n */\n createId: function createId(model) {\n componentIndex++;\n // Testing 1000000 components with `+ 2` returns 0 collisions\n var ilen = componentIndex.toString().length + 2;\n var uid = (Math.random() + 1.1).toString(36).slice(-ilen);\n var nextId = 'i' + uid;\n componentList[nextId] = model;\n return nextId;\n },\n getList: function getList() {\n return componentList;\n }\n});\n\nmodule.exports = Component;\n\n/***/ }),\n/* 5 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Backbone) {\n\nvar _underscore = __webpack_require__(1);\n\nvar _mixins = __webpack_require__(2);\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nvar clearProp = 'data-clear-style';\n\nmodule.exports = Backbone.View.extend({\n template: function template(model) {\n var pfx = this.pfx;\n return '\\n <div class=\"' + pfx + 'label\">\\n ' + this.templateLabel(model) + '\\n </div>\\n <div class=\"' + this.ppfx + 'fields\">\\n ' + this.templateInput(model) + '\\n </div>\\n ';\n },\n templateLabel: function templateLabel(model) {\n var pfx = this.pfx;\n var icon = model.get('icon');\n var info = model.get('info');\n return '\\n <span class=\"' + pfx + 'icon ' + icon + '\" title=\"' + info + '\">\\n ' + model.get('name') + '\\n </span>\\n <b class=\"' + pfx + 'clear\" ' + clearProp + '>⨯</b>\\n ';\n },\n templateInput: function templateInput(model) {\n return '\\n <div class=\"' + this.ppfx + 'field\">\\n <input placeholder=\"' + model.getDefaultValue() + '\"/>\\n </div>\\n ';\n },\n\n\n events: _defineProperty({\n change: 'inputValueChanged'\n }, 'click [' + clearProp + ']', 'clear'),\n\n initialize: function initialize() {\n var o = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n (0, _underscore.bindAll)(this, 'targetUpdated');\n this.config = o.config || {};\n var em = this.config.em;\n this.em = em;\n this.pfx = this.config.stylePrefix || '';\n this.ppfx = this.config.pStylePrefix || '';\n this.target = o.target || {};\n this.propTarget = o.propTarget || {};\n this.onChange = o.onChange;\n this.onInputRender = o.onInputRender || {};\n this.customValue = o.customValue || {};\n var model = this.model;\n this.property = model.get('property');\n this.input = null;\n var pfx = this.pfx;\n this.inputHolderId = '#' + pfx + 'input-holder';\n this.sector = model.collection && model.collection.sector;\n model.view = this;\n\n if (!model.get('value')) {\n model.set('value', model.getDefaultValue());\n }\n\n em && em.on('update:component:style:' + this.property, this.targetUpdated);\n this.listenTo(this.propTarget, 'update', this.targetUpdated);\n this.listenTo(model, 'destroy remove', this.remove);\n this.listenTo(model, 'change:value', this.modelValueChanged);\n this.listenTo(model, 'targetUpdated', this.targetUpdated);\n this.listenTo(model, 'change:visible', this.updateVisibility);\n this.listenTo(model, 'change:status', this.updateStatus);\n\n var init = this.init && this.init.bind(this);\n init && init();\n },\n\n\n /**\n * Triggers when the status changes. The status indicates if the value of\n * the proprerty is changed or inherited\n * @private\n */\n updateStatus: function updateStatus() {\n var status = this.model.get('status');\n var pfx = this.pfx;\n var ppfx = this.ppfx;\n var config = this.config;\n var updatedCls = ppfx + 'four-color';\n var computedCls = ppfx + 'color-warn';\n var labelEl = this.$el.children('.' + pfx + 'label');\n var clearStyle = this.getClearEl().style;\n labelEl.removeClass(updatedCls + ' ' + computedCls);\n clearStyle.display = 'none';\n\n switch (status) {\n case 'updated':\n labelEl.addClass(updatedCls);\n\n if (config.clearProperties) {\n clearStyle.display = 'inline';\n }\n break;\n case 'computed':\n labelEl.addClass(computedCls);\n break;\n }\n },\n\n\n /**\n * Clear the property from the target\n */\n clear: function clear() {\n var target = this.getTargetModel();\n target.removeStyle(this.model.get('property'));\n this.targetUpdated();\n },\n\n\n /**\n * Get clear element\n * @return {HTMLElement}\n */\n getClearEl: function getClearEl() {\n return this.el.querySelector('[' + clearProp + ']');\n },\n\n\n /**\n * Returns selected target which should have 'style' property\n * @return {Model|null}\n */\n getTarget: function getTarget() {\n return this.getTargetModel();\n },\n\n\n /**\n * Returns Styleable model\n * @return {Model|null}\n */\n getTargetModel: function getTargetModel() {\n return this.propTarget && this.propTarget.model;\n },\n\n\n /**\n * Returns helper Styleable model\n * @return {Model|null}\n */\n getHelperModel: function getHelperModel() {\n return this.propTarget && this.propTarget.helper;\n },\n\n\n /**\n * Triggers when the value of element input/s is changed, so have to update\n * the value of the model which will propogate those changes to the target\n */\n inputValueChanged: function inputValueChanged(e) {\n e && e.stopPropagation();\n this.model.setValue(this.getInputValue(), 1, { fromInput: 1 });\n this.elementUpdated();\n },\n\n\n /**\n * Fired when the element of the property is updated\n */\n elementUpdated: function elementUpdated() {\n this.setStatus('updated');\n },\n setStatus: function setStatus(value) {\n this.model.set('status', value);\n var parent = this.model.parent;\n parent && parent.set('status', value);\n },\n\n\n /**\n * Fired when the target is changed\n * */\n targetUpdated: function targetUpdated() {\n if (!this.checkVisibility()) {\n return;\n }\n\n var config = this.config;\n var em = config.em;\n var model = this.model;\n var value = '';\n var status = '';\n var targetValue = this.getTargetValue({ ignoreDefault: 1 });\n var defaultValue = model.getDefaultValue();\n var computedValue = this.getComputedValue();\n\n if (targetValue) {\n value = targetValue;\n\n if (config.highlightChanged) {\n status = 'updated';\n }\n } else if (computedValue && config.showComputed && computedValue != defaultValue) {\n value = computedValue;\n\n if (config.highlightComputed) {\n status = 'computed';\n }\n } else {\n value = defaultValue;\n status = '';\n }\n\n model.setValue(value, 0, { fromTarget: 1 });\n this.setStatus(status);\n\n if (em) {\n em.trigger('styleManager:change', this);\n em.trigger('styleManager:change:' + model.get('property'), this);\n }\n },\n checkVisibility: function checkVisibility() {\n var result = 1;\n\n // Check if need to hide the property\n if (this.config.hideNotStylable) {\n if (!this.isTargetStylable() || !this.isComponentStylable()) {\n this.hide();\n result = 0;\n } else {\n this.show();\n }\n // Sector is not passed to Composite and Stack types\n if (this.sector) {\n this.sector.trigger('updateVisibility');\n }\n }\n\n return result;\n },\n\n\n /**\n * Get the value of this property from the target (eg, Component, CSSRule)\n * @param {Object} [opts] Options\n * @param {Boolean} [options.fetchFromFunction]\n * @param {Boolean} [options.ignoreDefault]\n * @return string\n * @private\n */\n getTargetValue: function getTargetValue() {\n var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n var result;\n var model = this.model;\n var target = this.getTargetModel();\n var customFetchValue = this.customValue;\n\n if (!target) {\n return result;\n }\n\n result = target.getStyle()[model.get('property')];\n\n if (!result && !opts.ignoreDefault) {\n result = model.getDefaultValue();\n }\n\n if (typeof customFetchValue == 'function' && !opts.ignoreCustomValue) {\n var index = model.collection.indexOf(model);\n var customValue = customFetchValue(this, index);\n\n if (customValue) {\n result = customValue;\n }\n }\n\n return result;\n },\n\n\n /**\n * Returns computed value\n * @return {String}\n * @private\n */\n getComputedValue: function getComputedValue() {\n var target = this.propTarget;\n var computed = target.computed || {};\n var computedDef = target.computedDefault || {};\n var avoid = this.config.avoidComputed || [];\n var property = this.model.get('property');\n var notToSkip = avoid.indexOf(property) < 0;\n var value = computed[property];\n var valueDef = computedDef[(0, _mixins.camelCase)(property)];\n return computed && notToSkip && valueDef !== value && value;\n },\n\n\n /**\n * Returns value from input\n * @return {string}\n */\n getInputValue: function getInputValue() {\n var input = this.getInputEl();\n return input ? input.value : '';\n },\n\n\n /**\n * Triggers when the `value` of the model changes, so the target and\n * the input element should be updated\n * @param {Object} e Event\n * @param {Mixed} val Value\n * @param {Object} opt Options\n * */\n modelValueChanged: function modelValueChanged(e, val) {\n var opt = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n var em = this.config.em;\n var model = this.model;\n var value = model.getFullValue();\n var target = this.getTarget();\n var onChange = this.onChange;\n\n // Avoid element update if the change comes from it\n if (!opt.fromInput) {\n this.setValue(value);\n }\n\n // Check if component is allowed to be styled\n if (!target || !this.isTargetStylable() || !this.isComponentStylable()) {\n return;\n }\n\n // Avoid target update if the changes comes from it\n if (!opt.fromTarget) {\n // The onChange is used by Composite/Stack properties, so I'd avoid sending\n // it back if the change comes from one of those\n if (onChange && !opt.fromParent) {\n onChange(target, this, opt);\n } else {\n this.updateTargetStyle(value, null, opt);\n }\n }\n\n if (em) {\n em.trigger('component:update', target);\n em.trigger('component:styleUpdate', target);\n em.trigger('component:styleUpdate:' + model.get('property'), target);\n }\n },\n\n\n /**\n * Update target style\n * @param {string} value\n * @param {string} name\n * @param {Object} opts\n */\n updateTargetStyle: function updateTargetStyle(value) {\n var name = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';\n var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n var property = name || this.model.get('property');\n var target = this.getTarget();\n var style = target.getStyle();\n\n if (value) {\n style[property] = value;\n } else {\n delete style[property];\n }\n\n target.setStyle(style, opts);\n\n // Helper is used by `states` like ':hover' to show its preview\n var helper = this.getHelperModel();\n helper && helper.setStyle(style, opts);\n },\n\n\n /**\n * Check if target is stylable with this property\n * The target could be the Component as the CSS Rule\n * @return {Boolean}\n */\n isTargetStylable: function isTargetStylable(target) {\n var trg = target || this.getTarget();\n var model = this.model;\n var property = model.get('property');\n var toRequire = model.get('toRequire');\n var unstylable = trg.get('unstylable');\n var stylableReq = trg.get('stylable-require');\n var stylable = trg.get('stylable');\n\n // Stylable could also be an array indicating with which property\n // the target could be styled\n if ((0, _underscore.isArray)(stylable)) {\n stylable = stylable.indexOf(property) >= 0;\n }\n\n // Check if the property was signed as unstylable\n if ((0, _underscore.isArray)(unstylable)) {\n stylable = unstylable.indexOf(property) < 0;\n }\n\n // Check if the property is available only if requested\n if (toRequire) {\n stylable = stylableReq && stylableReq.indexOf(property) >= 0 || !target;\n }\n\n return stylable;\n },\n\n\n /**\n * Check if the selected component is stylable with this property\n * The target could be the Component as the CSS Rule\n * @return {Boolean}\n */\n isComponentStylable: function isComponentStylable() {\n var em = this.em;\n var component = em && em.get('selectedComponent');\n\n if (!component) {\n return true;\n }\n\n return this.isTargetStylable(component);\n },\n\n\n /**\n * Passed a raw value you have to update the input element, generally\n * is the value fetched from targets, so you can receive values with\n * functions, units, etc. (eg. `rotateY(45deg)`)\n * get also\n * @param {string} value\n * @private\n */\n setRawValue: function setRawValue(value) {\n this.setValue(this.model.parseValue(value));\n },\n\n\n /**\n * Update the element input.\n * Usually the value is a result of `model.getFullValue()`\n * @param {String} value The value from the model\n * */\n setValue: function setValue(value) {\n var model = this.model;\n var val = value || model.getDefaultValue();\n var input = this.getInputEl();\n input && (input.value = val);\n },\n getInputEl: function getInputEl() {\n if (!this.input) {\n this.input = this.el.querySelector('input');\n }\n\n return this.input;\n },\n updateVisibility: function updateVisibility() {\n this.el.style.display = this.model.get('visible') ? 'block' : 'none';\n },\n show: function show() {\n this.model.set('visible', 1);\n },\n hide: function hide() {\n this.model.set('visible', 0);\n },\n\n\n /**\n * Clean input\n * */\n cleanValue: function cleanValue() {\n this.setValue('');\n },\n render: function render() {\n var pfx = this.pfx;\n var model = this.model;\n var el = this.el;\n el.innerHTML = this.template(model);\n el.className = pfx + 'property ' + pfx + model.get('type');\n this.updateStatus();\n\n var onRender = this.onRender && this.onRender.bind(this);\n onRender && onRender();\n this.setValue(model.get('value'), { targetUpdate: 1 });\n }\n});\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))\n\n/***/ }),\n/* 6 */\n/***/ (function(module, exports, __webpack_require__) {\n\n// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: http://codemirror.net/LICENSE\n\n// This is CodeMirror (http://codemirror.net), a code editor\n// implemented in JavaScript on top of the browser's DOM.\n//\n// You can find some technical background for some of the code below\n// at http://marijnhaverbeke.nl/blog/#cm-internals .\n\n(function (global, factory) {\n\t true ? module.exports = factory() :\n\ttypeof define === 'function' && define.amd ? define(factory) :\n\t(global.CodeMirror = factory());\n}(this, (function () { 'use strict';\n\n// Kludges for bugs and behavior differences that can't be feature\n// detected are enabled based on userAgent etc sniffing.\nvar userAgent = navigator.userAgent;\nvar platform = navigator.platform;\n\nvar gecko = /gecko\\/\\d/i.test(userAgent);\nvar ie_upto10 = /MSIE \\d/.test(userAgent);\nvar ie_11up = /Trident\\/(?:[7-9]|\\d{2,})\\..*rv:(\\d+)/.exec(userAgent);\nvar edge = /Edge\\/(\\d+)/.exec(userAgent);\nvar ie = ie_upto10 || ie_11up || edge;\nvar ie_version = ie && (ie_upto10 ? document.documentMode || 6 : +(edge || ie_11up)[1]);\nvar webkit = !edge && /WebKit\\//.test(userAgent);\nvar qtwebkit = webkit && /Qt\\/\\d+\\.\\d+/.test(userAgent);\nvar chrome = !edge && /Chrome\\//.test(userAgent);\nvar presto = /Opera\\//.test(userAgent);\nvar safari = /Apple Computer/.test(navigator.vendor);\nvar mac_geMountainLion = /Mac OS X 1\\d\\D([8-9]|\\d\\d)\\D/.test(userAgent);\nvar phantom = /PhantomJS/.test(userAgent);\n\nvar ios = !edge && /AppleWebKit/.test(userAgent) && /Mobile\\/\\w+/.test(userAgent);\nvar android = /Android/.test(userAgent);\n// This is woefully incomplete. Suggestions for alternative methods welcome.\nvar mobile = ios || android || /webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(userAgent);\nvar mac = ios || /Mac/.test(platform);\nvar chromeOS = /\\bCrOS\\b/.test(userAgent);\nvar windows = /win/i.test(platform);\n\nvar presto_version = presto && userAgent.match(/Version\\/(\\d*\\.\\d*)/);\nif (presto_version) { presto_version = Number(presto_version[1]); }\nif (presto_version && presto_version >= 15) { presto = false; webkit = true; }\n// Some browsers use the wrong event properties to signal cmd/ctrl on OS X\nvar flipCtrlCmd = mac && (qtwebkit || presto && (presto_version == null || presto_version < 12.11));\nvar captureRightClick = gecko || (ie && ie_version >= 9);\n\nfunction classTest(cls) { return new RegExp(\"(^|\\\\s)\" + cls + \"(?:$|\\\\s)\\\\s*\") }\n\nvar rmClass = function(node, cls) {\n var current = node.className;\n var match = classTest(cls).exec(current);\n if (match) {\n var after = current.slice(match.index + match[0].length);\n node.className = current.slice(0, match.index) + (after ? match[1] + after : \"\");\n }\n};\n\nfunction removeChildren(e) {\n for (var count = e.childNodes.length; count > 0; --count)\n { e.removeChild(e.firstChild); }\n return e\n}\n\nfunction removeChildrenAndAdd(parent, e) {\n return removeChildren(parent).appendChild(e)\n}\n\nfunction elt(tag, content, className, style) {\n var e = document.createElement(tag);\n if (className) { e.className = className; }\n if (style) { e.style.cssText = style; }\n if (typeof content == \"string\") { e.appendChild(document.createTextNode(content)); }\n else if (content) { for (var i = 0; i < content.length; ++i) { e.appendChild(content[i]); } }\n return e\n}\n// wrapper for elt, which removes the elt from the accessibility tree\nfunction eltP(tag, content, className, style) {\n var e = elt(tag, content, className, style);\n e.setAttribute(\"role\", \"presentation\");\n return e\n}\n\nvar range;\nif (document.createRange) { range = function(node, start, end, endNode) {\n var r = document.createRange();\n r.setEnd(endNode || node, end);\n r.setStart(node, start);\n return r\n}; }\nelse { range = function(node, start, end) {\n var r = document.body.createTextRange();\n try { r.moveToElementText(node.parentNode); }\n catch(e) { return r }\n r.collapse(true);\n r.moveEnd(\"character\", end);\n r.moveStart(\"character\", start);\n return r\n}; }\n\nfunction contains(parent, child) {\n if (child.nodeType == 3) // Android browser always returns false when child is a textnode\n { child = child.parentNode; }\n if (parent.contains)\n { return parent.contains(child) }\n do {\n if (child.nodeType == 11) { child = child.host; }\n if (child == parent) { return true }\n } while (child = child.parentNode)\n}\n\nfunction activeElt() {\n // IE and Edge may throw an \"Unspecified Error\" when accessing document.activeElement.\n // IE < 10 will throw when accessed while the page is loading or in an iframe.\n // IE > 9 and Edge will throw when accessed in an iframe if document.body is unavailable.\n var activeElement;\n try {\n activeElement = document.activeElement;\n } catch(e) {\n activeElement = document.body || null;\n }\n while (activeElement && activeElement.shadowRoot && activeElement.shadowRoot.activeElement)\n { activeElement = activeElement.shadowRoot.activeElement; }\n return activeElement\n}\n\nfunction addClass(node, cls) {\n var current = node.className;\n if (!classTest(cls).test(current)) { node.className += (current ? \" \" : \"\") + cls; }\n}\nfunction joinClasses(a, b) {\n var as = a.split(\" \");\n for (var i = 0; i < as.length; i++)\n { if (as[i] && !classTest(as[i]).test(b)) { b += \" \" + as[i]; } }\n return b\n}\n\nvar selectInput = function(node) { node.select(); };\nif (ios) // Mobile Safari apparently has a bug where select() is broken.\n { selectInput = function(node) { node.selectionStart = 0; node.selectionEnd = node.value.length; }; }\nelse if (ie) // Suppress mysterious IE10 errors\n { selectInput = function(node) { try { node.select(); } catch(_e) {} }; }\n\nfunction bind(f) {\n var args = Array.prototype.slice.call(arguments, 1);\n return function(){return f.apply(null, args)}\n}\n\nfunction copyObj(obj, target, overwrite) {\n if (!target) { target = {}; }\n for (var prop in obj)\n { if (obj.hasOwnProperty(prop) && (overwrite !== false || !target.hasOwnProperty(prop)))\n { target[prop] = obj[prop]; } }\n return target\n}\n\n// Counts the column offset in a string, taking tabs into account.\n// Used mostly to find indentation.\nfunction countColumn(string, end, tabSize, startIndex, startValue) {\n if (end == null) {\n end = string.search(/[^\\s\\u00a0]/);\n if (end == -1) { end = string.length; }\n }\n for (var i = startIndex || 0, n = startValue || 0;;) {\n var nextTab = string.indexOf(\"\\t\", i);\n if (nextTab < 0 || nextTab >= end)\n { return n + (end - i) }\n n += nextTab - i;\n n += tabSize - (n % tabSize);\n i = nextTab + 1;\n }\n}\n\nvar Delayed = function() {this.id = null;};\nDelayed.prototype.set = function (ms, f) {\n clearTimeout(this.id);\n this.id = setTimeout(f, ms);\n};\n\nfunction indexOf(array, elt) {\n for (var i = 0; i < array.length; ++i)\n { if (array[i] == elt) { return i } }\n return -1\n}\n\n// Number of pixels added to scroller and sizer to hide scrollbar\nvar scrollerGap = 30;\n\n// Returned or thrown by various protocols to signal 'I'm not\n// handling this'.\nvar Pass = {toString: function(){return \"CodeMirror.Pass\"}};\n\n// Reused option objects for setSelection & friends\nvar sel_dontScroll = {scroll: false};\nvar sel_mouse = {origin: \"*mouse\"};\nvar sel_move = {origin: \"+move\"};\n\n// The inverse of countColumn -- find the offset that corresponds to\n// a particular column.\nfunction findColumn(string, goal, tabSize) {\n for (var pos = 0, col = 0;;) {\n var nextTab = string.indexOf(\"\\t\", pos);\n if (nextTab == -1) { nextTab = string.length; }\n var skipped = nextTab - pos;\n if (nextTab == string.length || col + skipped >= goal)\n { return pos + Math.min(skipped, goal - col) }\n col += nextTab - pos;\n col += tabSize - (col % tabSize);\n pos = nextTab + 1;\n if (col >= goal) { return pos }\n }\n}\n\nvar spaceStrs = [\"\"];\nfunction spaceStr(n) {\n while (spaceStrs.length <= n)\n { spaceStrs.push(lst(spaceStrs) + \" \"); }\n return spaceStrs[n]\n}\n\nfunction lst(arr) { return arr[arr.length-1] }\n\nfunction map(array, f) {\n var out = [];\n for (var i = 0; i < array.length; i++) { out[i] = f(array[i], i); }\n return out\n}\n\nfunction insertSorted(array, value, score) {\n var pos = 0, priority = score(value);\n while (pos < array.length && score(array[pos]) <= priority) { pos++; }\n array.splice(pos, 0, value);\n}\n\nfunction nothing() {}\n\nfunction createObj(base, props) {\n var inst;\n if (Object.create) {\n inst = Object.create(base);\n } else {\n nothing.prototype = base;\n inst = new nothing();\n }\n if (props) { copyObj(props, inst); }\n return inst\n}\n\nvar nonASCIISingleCaseWordChar = /[\\u00df\\u0587\\u0590-\\u05f4\\u0600-\\u06ff\\u3040-\\u309f\\u30a0-\\u30ff\\u3400-\\u4db5\\u4e00-\\u9fcc\\uac00-\\ud7af]/;\nfunction isWordCharBasic(ch) {\n return /\\w/.test(ch) || ch > \"\\x80\" &&\n (ch.toUpperCase() != ch.toLowerCase() || nonASCIISingleCaseWordChar.test(ch))\n}\nfunction isWordChar(ch, helper) {\n if (!helper) { return isWordCharBasic(ch) }\n if (helper.source.indexOf(\"\\\\w\") > -1 && isWordCharBasic(ch)) { return true }\n return helper.test(ch)\n}\n\nfunction isEmpty(obj) {\n for (var n in obj) { if (obj.hasOwnProperty(n) && obj[n]) { return false } }\n return true\n}\n\n// Extending unicode characters. A series of a non-extending char +\n// any number of extending chars is treated as a single unit as far\n// as editing and measuring is concerned. This is not fully correct,\n// since some scripts/fonts/browsers also treat other configurations\n// of code points as a group.\nvar extendingChars = /[\\u0300-\\u036f\\u0483-\\u0489\\u0591-\\u05bd\\u05bf\\u05c1\\u05c2\\u05c4\\u05c5\\u05c7\\u0610-\\u061a\\u064b-\\u065e\\u0670\\u06d6-\\u06dc\\u06de-\\u06e4\\u06e7\\u06e8\\u06ea-\\u06ed\\u0711\\u0730-\\u074a\\u07a6-\\u07b0\\u07eb-\\u07f3\\u0816-\\u0819\\u081b-\\u0823\\u0825-\\u0827\\u0829-\\u082d\\u0900-\\u0902\\u093c\\u0941-\\u0948\\u094d\\u0951-\\u0955\\u0962\\u0963\\u0981\\u09bc\\u09be\\u09c1-\\u09c4\\u09cd\\u09d7\\u09e2\\u09e3\\u0a01\\u0a02\\u0a3c\\u0a41\\u0a42\\u0a47\\u0a48\\u0a4b-\\u0a4d\\u0a51\\u0a70\\u0a71\\u0a75\\u0a81\\u0a82\\u0abc\\u0ac1-\\u0ac5\\u0ac7\\u0ac8\\u0acd\\u0ae2\\u0ae3\\u0b01\\u0b3c\\u0b3e\\u0b3f\\u0b41-\\u0b44\\u0b4d\\u0b56\\u0b57\\u0b62\\u0b63\\u0b82\\u0bbe\\u0bc0\\u0bcd\\u0bd7\\u0c3e-\\u0c40\\u0c46-\\u0c48\\u0c4a-\\u0c4d\\u0c55\\u0c56\\u0c62\\u0c63\\u0cbc\\u0cbf\\u0cc2\\u0cc6\\u0ccc\\u0ccd\\u0cd5\\u0cd6\\u0ce2\\u0ce3\\u0d3e\\u0d41-\\u0d44\\u0d4d\\u0d57\\u0d62\\u0d63\\u0dca\\u0dcf\\u0dd2-\\u0dd4\\u0dd6\\u0ddf\\u0e31\\u0e34-\\u0e3a\\u0e47-\\u0e4e\\u0eb1\\u0eb4-\\u0eb9\\u0ebb\\u0ebc\\u0ec8-\\u0ecd\\u0f18\\u0f19\\u0f35\\u0f37\\u0f39\\u0f71-\\u0f7e\\u0f80-\\u0f84\\u0f86\\u0f87\\u0f90-\\u0f97\\u0f99-\\u0fbc\\u0fc6\\u102d-\\u1030\\u1032-\\u1037\\u1039\\u103a\\u103d\\u103e\\u1058\\u1059\\u105e-\\u1060\\u1071-\\u1074\\u1082\\u1085\\u1086\\u108d\\u109d\\u135f\\u1712-\\u1714\\u1732-\\u1734\\u1752\\u1753\\u1772\\u1773\\u17b7-\\u17bd\\u17c6\\u17c9-\\u17d3\\u17dd\\u180b-\\u180d\\u18a9\\u1920-\\u1922\\u1927\\u1928\\u1932\\u1939-\\u193b\\u1a17\\u1a18\\u1a56\\u1a58-\\u1a5e\\u1a60\\u1a62\\u1a65-\\u1a6c\\u1a73-\\u1a7c\\u1a7f\\u1b00-\\u1b03\\u1b34\\u1b36-\\u1b3a\\u1b3c\\u1b42\\u1b6b-\\u1b73\\u1b80\\u1b81\\u1ba2-\\u1ba5\\u1ba8\\u1ba9\\u1c2c-\\u1c33\\u1c36\\u1c37\\u1cd0-\\u1cd2\\u1cd4-\\u1ce0\\u1ce2-\\u1ce8\\u1ced\\u1dc0-\\u1de6\\u1dfd-\\u1dff\\u200c\\u200d\\u20d0-\\u20f0\\u2cef-\\u2cf1\\u2de0-\\u2dff\\u302a-\\u302f\\u3099\\u309a\\ua66f-\\ua672\\ua67c\\ua67d\\ua6f0\\ua6f1\\ua802\\ua806\\ua80b\\ua825\\ua826\\ua8c4\\ua8e0-\\ua8f1\\ua926-\\ua92d\\ua947-\\ua951\\ua980-\\ua982\\ua9b3\\ua9b6-\\ua9b9\\ua9bc\\uaa29-\\uaa2e\\uaa31\\uaa32\\uaa35\\uaa36\\uaa43\\uaa4c\\uaab0\\uaab2-\\uaab4\\uaab7\\uaab8\\uaabe\\uaabf\\uaac1\\uabe5\\uabe8\\uabed\\udc00-\\udfff\\ufb1e\\ufe00-\\ufe0f\\ufe20-\\ufe26\\uff9e\\uff9f]/;\nfunction isExtendingChar(ch) { return ch.charCodeAt(0) >= 768 && extendingChars.test(ch) }\n\n// Returns a number from the range [`0`; `str.length`] unless `pos` is outside that range.\nfunction skipExtendingChars(str, pos, dir) {\n while ((dir < 0 ? pos > 0 : pos < str.length) && isExtendingChar(str.charAt(pos))) { pos += dir; }\n return pos\n}\n\n// Returns the value from the range [`from`; `to`] that satisfies\n// `pred` and is closest to `from`. Assumes that at least `to`\n// satisfies `pred`. Supports `from` being greater than `to`.\nfunction findFirst(pred, from, to) {\n // At any point we are certain `to` satisfies `pred`, don't know\n // whether `from` does.\n var dir = from > to ? -1 : 1;\n for (;;) {\n if (from == to) { return from }\n var midF = (from + to) / 2, mid = dir < 0 ? Math.ceil(midF) : Math.floor(midF);\n if (mid == from) { return pred(mid) ? from : to }\n if (pred(mid)) { to = mid; }\n else { from = mid + dir; }\n }\n}\n\n// The display handles the DOM integration, both for input reading\n// and content drawing. It holds references to DOM nodes and\n// display-related state.\n\nfunction Display(place, doc, input) {\n var d = this;\n this.input = input;\n\n // Covers bottom-right square when both scrollbars are present.\n d.scrollbarFiller = elt(\"div\", null, \"CodeMirror-scrollbar-filler\");\n d.scrollbarFiller.setAttribute(\"cm-not-content\", \"true\");\n // Covers bottom of gutter when coverGutterNextToScrollbar is on\n // and h scrollbar is present.\n d.gutterFiller = elt(\"div\", null, \"CodeMirror-gutter-filler\");\n d.gutterFiller.setAttribute(\"cm-not-content\", \"true\");\n // Will contain the actual code, positioned to cover the viewport.\n d.lineDiv = eltP(\"div\", null, \"CodeMirror-code\");\n // Elements are added to these to represent selection and cursors.\n d.selectionDiv = elt(\"div\", null, null, \"position: relative; z-index: 1\");\n d.cursorDiv = elt(\"div\", null, \"CodeMirror-cursors\");\n // A visibility: hidden element used to find the size of things.\n d.measure = elt(\"div\", null, \"CodeMirror-measure\");\n // When lines outside of the viewport are measured, they are drawn in this.\n d.lineMeasure = elt(\"div\", null, \"CodeMirror-measure\");\n // Wraps everything that needs to exist inside the vertically-padded coordinate system\n d.lineSpace = eltP(\"div\", [d.measure, d.lineMeasure, d.selectionDiv, d.cursorDiv, d.lineDiv],\n null, \"position: relative; outline: none\");\n var lines = eltP(\"div\", [d.lineSpace], \"CodeMirror-lines\");\n // Moved around its parent to cover visible view.\n d.mover = elt(\"div\", [lines], null, \"position: relative\");\n // Set to the height of the document, allowing scrolling.\n d.sizer = elt(\"div\", [d.mover], \"CodeMirror-sizer\");\n d.sizerWidth = null;\n // Behavior of elts with overflow: auto and padding is\n // inconsistent across browsers. This is used to ensure the\n // scrollable area is big enough.\n d.heightForcer = elt(\"div\", null, null, \"position: absolute; height: \" + scrollerGap + \"px; width: 1px;\");\n // Will contain the gutters, if any.\n d.gutters = elt(\"div\", null, \"CodeMirror-gutters\");\n d.lineGutter = null;\n // Actual scrollable element.\n d.scroller = elt(\"div\", [d.sizer, d.heightForcer, d.gutters], \"CodeMirror-scroll\");\n d.scroller.setAttribute(\"tabIndex\", \"-1\");\n // The element in which the editor lives.\n d.wrapper = elt(\"div\", [d.scrollbarFiller, d.gutterFiller, d.scroller], \"CodeMirror\");\n\n // Work around IE7 z-index bug (not perfect, hence IE7 not really being supported)\n if (ie && ie_version < 8) { d.gutters.style.zIndex = -1; d.scroller.style.paddingRight = 0; }\n if (!webkit && !(gecko && mobile)) { d.scroller.draggable = true; }\n\n if (place) {\n if (place.appendChild) { place.appendChild(d.wrapper); }\n else { place(d.wrapper); }\n }\n\n // Current rendered range (may be bigger than the view window).\n d.viewFrom = d.viewTo = doc.first;\n d.reportedViewFrom = d.reportedViewTo = doc.first;\n // Information about the rendered lines.\n d.view = [];\n d.renderedView = null;\n // Holds info about a single rendered line when it was rendered\n // for measurement, while not in view.\n d.externalMeasured = null;\n // Empty space (in pixels) above the view\n d.viewOffset = 0;\n d.lastWrapHeight = d.lastWrapWidth = 0;\n d.updateLineNumbers = null;\n\n d.nativeBarWidth = d.barHeight = d.barWidth = 0;\n d.scrollbarsClipped = false;\n\n // Used to only resize the line number gutter when necessary (when\n // the amount of lines crosses a boundary that makes its width change)\n d.lineNumWidth = d.lineNumInnerWidth = d.lineNumChars = null;\n // Set to true when a non-horizontal-scrolling line widget is\n // added. As an optimization, line widget aligning is skipped when\n // this is false.\n d.alignWidgets = false;\n\n d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;\n\n // Tracks the maximum line length so that the horizontal scrollbar\n // can be kept static when scrolling.\n d.maxLine = null;\n d.maxLineLength = 0;\n d.maxLineChanged = false;\n\n // Used for measuring wheel scrolling granularity\n d.wheelDX = d.wheelDY = d.wheelStartX = d.wheelStartY = null;\n\n // True when shift is held down.\n d.shift = false;\n\n // Used to track whether anything happened since the context menu\n // was opened.\n d.selForContextMenu = null;\n\n d.activeTouch = null;\n\n input.init(d);\n}\n\n// Find the line object corresponding to the given line number.\nfunction getLine(doc, n) {\n n -= doc.first;\n if (n < 0 || n >= doc.size) { throw new Error(\"There is no line \" + (n + doc.first) + \" in the document.\") }\n var chunk = doc;\n while (!chunk.lines) {\n for (var i = 0;; ++i) {\n var child = chunk.children[i], sz = child.chunkSize();\n if (n < sz) { chunk = child; break }\n n -= sz;\n }\n }\n return chunk.lines[n]\n}\n\n// Get the part of a document between two positions, as an array of\n// strings.\nfunction getBetween(doc, start, end) {\n var out = [], n = start.line;\n doc.iter(start.line, end.line + 1, function (line) {\n var text = line.text;\n if (n == end.line) { text = text.slice(0, end.ch); }\n if (n == start.line) { text = text.slice(start.ch); }\n out.push(text);\n ++n;\n });\n return out\n}\n// Get the lines between from and to, as array of strings.\nfunction getLines(doc, from, to) {\n var out = [];\n doc.iter(from, to, function (line) { out.push(line.text); }); // iter aborts when callback returns truthy value\n return out\n}\n\n// Update the height of a line, propagating the height change\n// upwards to parent nodes.\nfunction updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }\n}\n\n// Given a line object, find its line number by walking up through\n// its parent links.\nfunction lineNo(line) {\n if (line.parent == null) { return null }\n var cur = line.parent, no = indexOf(cur.lines, line);\n for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) {\n for (var i = 0;; ++i) {\n if (chunk.children[i] == cur) { break }\n no += chunk.children[i].chunkSize();\n }\n }\n return no + cur.first\n}\n\n// Find the line at the given vertical position, using the height\n// information in the document tree.\nfunction lineAtHeight(chunk, h) {\n var n = chunk.first;\n outer: do {\n for (var i$1 = 0; i$1 < chunk.children.length; ++i$1) {\n var child = chunk.children[i$1], ch = child.height;\n if (h < ch) { chunk = child; continue outer }\n h -= ch;\n n += child.chunkSize();\n }\n return n\n } while (!chunk.lines)\n var i = 0;\n for (; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i], lh = line.height;\n if (h < lh) { break }\n h -= lh;\n }\n return n + i\n}\n\nfunction isLine(doc, l) {return l >= doc.first && l < doc.first + doc.size}\n\nfunction lineNumberFor(options, i) {\n return String(options.lineNumberFormatter(i + options.firstLineNumber))\n}\n\n// A Pos instance represents a position within the text.\nfunction Pos(line, ch, sticky) {\n if ( sticky === void 0 ) sticky = null;\n\n if (!(this instanceof Pos)) { return new Pos(line, ch, sticky) }\n this.line = line;\n this.ch = ch;\n this.sticky = sticky;\n}\n\n// Compare two positions, return 0 if they are the same, a negative\n// number when a is less, and a positive number otherwise.\nfunction cmp(a, b) { return a.line - b.line || a.ch - b.ch }\n\nfunction equalCursorPos(a, b) { return a.sticky == b.sticky && cmp(a, b) == 0 }\n\nfunction copyPos(x) {return Pos(x.line, x.ch)}\nfunction maxPos(a, b) { return cmp(a, b) < 0 ? b : a }\nfunction minPos(a, b) { return cmp(a, b) < 0 ? a : b }\n\n// Most of the external API clips given positions to make sure they\n// actually exist within the document.\nfunction clipLine(doc, n) {return Math.max(doc.first, Math.min(n, doc.first + doc.size - 1))}\nfunction clipPos(doc, pos) {\n if (pos.line < doc.first) { return Pos(doc.first, 0) }\n var last = doc.first + doc.size - 1;\n if (pos.line > last) { return Pos(last, getLine(doc, last).text.length) }\n return clipToLen(pos, getLine(doc, pos.line).text.length)\n}\nfunction clipToLen(pos, linelen) {\n var ch = pos.ch;\n if (ch == null || ch > linelen) { return Pos(pos.line, linelen) }\n else if (ch < 0) { return Pos(pos.line, 0) }\n else { return pos }\n}\nfunction clipPosArray(doc, array) {\n var out = [];\n for (var i = 0; i < array.length; i++) { out[i] = clipPos(doc, array[i]); }\n return out\n}\n\n// Optimize some code when these features are not used.\nvar sawReadOnlySpans = false;\nvar sawCollapsedSpans = false;\n\nfunction seeReadOnlySpans() {\n sawReadOnlySpans = true;\n}\n\nfunction seeCollapsedSpans() {\n sawCollapsedSpans = true;\n}\n\n// TEXTMARKER SPANS\n\nfunction MarkedSpan(marker, from, to) {\n this.marker = marker;\n this.from = from; this.to = to;\n}\n\n// Search an array of spans for a span matching the given marker.\nfunction getMarkedSpanFor(spans, marker) {\n if (spans) { for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) { return span }\n } }\n}\n// Remove a span from an array, returning undefined if no spans are\n// left (we don't store arrays for lines without spans).\nfunction removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n}\n// Add a span to a line.\nfunction addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n}\n\n// Used for the algorithm that adjusts markers for a change in the\n// document. These functions cut an array of spans at a given\n// character position, returning an array of remaining chunks (or\n// undefined if nothing remains).\nfunction markedSpansBefore(old, startCh, isInsert) {\n var nw;\n if (old) { for (var i = 0; i < old.length; ++i) {\n var span = old[i], marker = span.marker;\n var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= startCh : span.from < startCh);\n if (startsBefore || span.from == startCh && marker.type == \"bookmark\" && (!isInsert || !span.marker.insertLeft)) {\n var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= startCh : span.to > startCh);(nw || (nw = [])).push(new MarkedSpan(marker, span.from, endsAfter ? null : span.to));\n }\n } }\n return nw\n}\nfunction markedSpansAfter(old, endCh, isInsert) {\n var nw;\n if (old) { for (var i = 0; i < old.length; ++i) {\n var span = old[i], marker = span.marker;\n var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= endCh : span.to > endCh);\n if (endsAfter || span.from == endCh && marker.type == \"bookmark\" && (!isInsert || span.marker.insertLeft)) {\n var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= endCh : span.from < endCh);(nw || (nw = [])).push(new MarkedSpan(marker, startsBefore ? null : span.from - endCh,\n span.to == null ? null : span.to - endCh));\n }\n } }\n return nw\n}\n\n// Given a change object, compute the new set of marker spans that\n// cover the line in which the change took place. Removes spans\n// entirely within the change, reconnects spans belonging to the\n// same marker that appear on both sides of the change, and cuts off\n// spans partially within the change. Returns an array of span\n// arrays with one element for each line in (after) the change.\nfunction stretchSpansOverChange(doc, change) {\n if (change.full) { return null }\n var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans;\n var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans;\n if (!oldFirst && !oldLast) { return null }\n\n var startCh = change.from.ch, endCh = change.to.ch, isInsert = cmp(change.from, change.to) == 0;\n // Get the spans that 'stick out' on both sides\n var first = markedSpansBefore(oldFirst, startCh, isInsert);\n var last = markedSpansAfter(oldLast, endCh, isInsert);\n\n // Next, merge those two ends\n var sameLine = change.text.length == 1, offset = lst(change.text).length + (sameLine ? startCh : 0);\n if (first) {\n // Fix up .to properties of first\n for (var i = 0; i < first.length; ++i) {\n var span = first[i];\n if (span.to == null) {\n var found = getMarkedSpanFor(last, span.marker);\n if (!found) { span.to = startCh; }\n else if (sameLine) { span.to = found.to == null ? null : found.to + offset; }\n }\n }\n }\n if (last) {\n // Fix up .from in last (or move them into first in case of sameLine)\n for (var i$1 = 0; i$1 < last.length; ++i$1) {\n var span$1 = last[i$1];\n if (span$1.to != null) { span$1.to += offset; }\n if (span$1.from == null) {\n var found$1 = getMarkedSpanFor(first, span$1.marker);\n if (!found$1) {\n span$1.from = offset;\n if (sameLine) { (first || (first = [])).push(span$1); }\n }\n } else {\n span$1.from += offset;\n if (sameLine) { (first || (first = [])).push(span$1); }\n }\n }\n }\n // Make sure we didn't create any zero-length spans\n if (first) { first = clearEmptySpans(first); }\n if (last && last != first) { last = clearEmptySpans(last); }\n\n var newMarkers = [first];\n if (!sameLine) {\n // Fill gap with whole-line-spans\n var gap = change.text.length - 2, gapMarkers;\n if (gap > 0 && first)\n { for (var i$2 = 0; i$2 < first.length; ++i$2)\n { if (first[i$2].to == null)\n { (gapMarkers || (gapMarkers = [])).push(new MarkedSpan(first[i$2].marker, null, null)); } } }\n for (var i$3 = 0; i$3 < gap; ++i$3)\n { newMarkers.push(gapMarkers); }\n newMarkers.push(last);\n }\n return newMarkers\n}\n\n// Remove spans that are empty and don't have a clearWhenEmpty\n// option of false.\nfunction clearEmptySpans(spans) {\n for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.from != null && span.from == span.to && span.marker.clearWhenEmpty !== false)\n { spans.splice(i--, 1); }\n }\n if (!spans.length) { return null }\n return spans\n}\n\n// Used to 'clip' out readOnly ranges when making a change.\nfunction removeReadOnlyRanges(doc, from, to) {\n var markers = null;\n doc.iter(from.line, to.line + 1, function (line) {\n if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) {\n var mark = line.markedSpans[i].marker;\n if (mark.readOnly && (!markers || indexOf(markers, mark) == -1))\n { (markers || (markers = [])).push(mark); }\n } }\n });\n if (!markers) { return null }\n var parts = [{from: from, to: to}];\n for (var i = 0; i < markers.length; ++i) {\n var mk = markers[i], m = mk.find(0);\n for (var j = 0; j < parts.length; ++j) {\n var p = parts[j];\n if (cmp(p.to, m.from) < 0 || cmp(p.from, m.to) > 0) { continue }\n var newParts = [j, 1], dfrom = cmp(p.from, m.from), dto = cmp(p.to, m.to);\n if (dfrom < 0 || !mk.inclusiveLeft && !dfrom)\n { newParts.push({from: p.from, to: m.from}); }\n if (dto > 0 || !mk.inclusiveRight && !dto)\n { newParts.push({from: m.to, to: p.to}); }\n parts.splice.apply(parts, newParts);\n j += newParts.length - 3;\n }\n }\n return parts\n}\n\n// Connect or disconnect spans from a line.\nfunction detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n}\nfunction attachMarkedSpans(line, spans) {\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.attachLine(line); }\n line.markedSpans = spans;\n}\n\n// Helpers used when computing which overlapping collapsed span\n// counts as the larger one.\nfunction extraLeft(marker) { return marker.inclusiveLeft ? -1 : 0 }\nfunction extraRight(marker) { return marker.inclusiveRight ? 1 : 0 }\n\n// Returns a number indicating which of two overlapping collapsed\n// spans is larger (and thus includes the other). Falls back to\n// comparing ids when the spans cover exactly the same range.\nfunction compareCollapsedMarkers(a, b) {\n var lenDiff = a.lines.length - b.lines.length;\n if (lenDiff != 0) { return lenDiff }\n var aPos = a.find(), bPos = b.find();\n var fromCmp = cmp(aPos.from, bPos.from) || extraLeft(a) - extraLeft(b);\n if (fromCmp) { return -fromCmp }\n var toCmp = cmp(aPos.to, bPos.to) || extraRight(a) - extraRight(b);\n if (toCmp) { return toCmp }\n return b.id - a.id\n}\n\n// Find out whether a line ends or starts in a collapsed span. If\n// so, return the marker for that span.\nfunction collapsedSpanAtSide(line, start) {\n var sps = sawCollapsedSpans && line.markedSpans, found;\n if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) {\n sp = sps[i];\n if (sp.marker.collapsed && (start ? sp.from : sp.to) == null &&\n (!found || compareCollapsedMarkers(found, sp.marker) < 0))\n { found = sp.marker; }\n } }\n return found\n}\nfunction collapsedSpanAtStart(line) { return collapsedSpanAtSide(line, true) }\nfunction collapsedSpanAtEnd(line) { return collapsedSpanAtSide(line, false) }\n\n// Test whether there exists a collapsed span that partially\n// overlaps (covers the start or end, but not both) of a new span.\n// Such overlap is not allowed.\nfunction conflictingCollapsedRange(doc, lineNo$$1, from, to, marker) {\n var line = getLine(doc, lineNo$$1);\n var sps = sawCollapsedSpans && line.markedSpans;\n if (sps) { for (var i = 0; i < sps.length; ++i) {\n var sp = sps[i];\n if (!sp.marker.collapsed) { continue }\n var found = sp.marker.find(0);\n var fromCmp = cmp(found.from, from) || extraLeft(sp.marker) - extraLeft(marker);\n var toCmp = cmp(found.to, to) || extraRight(sp.marker) - extraRight(marker);\n if (fromCmp >= 0 && toCmp <= 0 || fromCmp <= 0 && toCmp >= 0) { continue }\n if (fromCmp <= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.to, from) >= 0 : cmp(found.to, from) > 0) ||\n fromCmp >= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.from, to) <= 0 : cmp(found.from, to) < 0))\n { return true }\n } }\n}\n\n// A visual line is a line as drawn on the screen. Folding, for\n// example, can cause multiple logical lines to appear on the same\n// visual line. This finds the start of the visual line that the\n// given line is part of (usually that is the line itself).\nfunction visualLine(line) {\n var merged;\n while (merged = collapsedSpanAtStart(line))\n { line = merged.find(-1, true).line; }\n return line\n}\n\nfunction visualLineEnd(line) {\n var merged;\n while (merged = collapsedSpanAtEnd(line))\n { line = merged.find(1, true).line; }\n return line\n}\n\n// Returns an array of logical lines that continue the visual line\n// started by the argument, or undefined if there are no such lines.\nfunction visualLineContinued(line) {\n var merged, lines;\n while (merged = collapsedSpanAtEnd(line)) {\n line = merged.find(1, true).line\n ;(lines || (lines = [])).push(line);\n }\n return lines\n}\n\n// Get the line number of the start of the visual line that the\n// given line number is part of.\nfunction visualLineNo(doc, lineN) {\n var line = getLine(doc, lineN), vis = visualLine(line);\n if (line == vis) { return lineN }\n return lineNo(vis)\n}\n\n// Get the line number of the start of the next visual line after\n// the given line.\nfunction visualLineEndNo(doc, lineN) {\n if (lineN > doc.lastLine()) { return lineN }\n var line = getLine(doc, lineN), merged;\n if (!lineIsHidden(doc, line)) { return lineN }\n while (merged = collapsedSpanAtEnd(line))\n { line = merged.find(1, true).line; }\n return lineNo(line) + 1\n}\n\n// Compute whether a line is hidden. Lines count as hidden when they\n// are part of a visual line that starts with another line, or when\n// they are entirely covered by collapsed, non-widget span.\nfunction lineIsHidden(doc, line) {\n var sps = sawCollapsedSpans && line.markedSpans;\n if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) {\n sp = sps[i];\n if (!sp.marker.collapsed) { continue }\n if (sp.from == null) { return true }\n if (sp.marker.widgetNode) { continue }\n if (sp.from == 0 && sp.marker.inclusiveLeft && lineIsHiddenInner(doc, line, sp))\n { return true }\n } }\n}\nfunction lineIsHiddenInner(doc, line, span) {\n if (span.to == null) {\n var end = span.marker.find(1, true);\n return lineIsHiddenInner(doc, end.line, getMarkedSpanFor(end.line.markedSpans, span.marker))\n }\n if (span.marker.inclusiveRight && span.to == line.text.length)\n { return true }\n for (var sp = (void 0), i = 0; i < line.markedSpans.length; ++i) {\n sp = line.markedSpans[i];\n if (sp.marker.collapsed && !sp.marker.widgetNode && sp.from == span.to &&\n (sp.to == null || sp.to != span.from) &&\n (sp.marker.inclusiveLeft || span.marker.inclusiveRight) &&\n lineIsHiddenInner(doc, line, sp)) { return true }\n }\n}\n\n// Find the height above the given line.\nfunction heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) { break }\n else { h += line.height; }\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\n var cur = p.children[i$1];\n if (cur == chunk) { break }\n else { h += cur.height; }\n }\n }\n return h\n}\n\n// Compute the character length of a line, taking into account\n// collapsed ranges (see markText) that might hide parts, and join\n// other lines onto it.\nfunction lineLength(line) {\n if (line.height == 0) { return 0 }\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found$1 = merged.find(0, true);\n len -= cur.text.length - found$1.from.ch;\n cur = found$1.to.line;\n len += cur.text.length - found$1.to.ch;\n }\n return len\n}\n\n// Find the longest line in the document.\nfunction findMaxLine(cm) {\n var d = cm.display, doc = cm.doc;\n d.maxLine = getLine(doc, doc.first);\n d.maxLineLength = lineLength(d.maxLine);\n d.maxLineChanged = true;\n doc.iter(function (line) {\n var len = lineLength(line);\n if (len > d.maxLineLength) {\n d.maxLineLength = len;\n d.maxLine = line;\n }\n });\n}\n\n// BIDI HELPERS\n\nfunction iterateBidiSections(order, from, to, f) {\n if (!order) { return f(from, to, \"ltr\", 0) }\n var found = false;\n for (var i = 0; i < order.length; ++i) {\n var part = order[i];\n if (part.from < to && part.to > from || from == to && part.to == from) {\n f(Math.max(part.from, from), Math.min(part.to, to), part.level == 1 ? \"rtl\" : \"ltr\", i);\n found = true;\n }\n }\n if (!found) { f(from, to, \"ltr\"); }\n}\n\nvar bidiOther = null;\nfunction getBidiPartAt(order, ch, sticky) {\n var found;\n bidiOther = null;\n for (var i = 0; i < order.length; ++i) {\n var cur = order[i];\n if (cur.from < ch && cur.to > ch) { return i }\n if (cur.to == ch) {\n if (cur.from != cur.to && sticky == \"before\") { found = i; }\n else { bidiOther = i; }\n }\n if (cur.from == ch) {\n if (cur.from != cur.to && sticky != \"before\") { found = i; }\n else { bidiOther = i; }\n }\n }\n return found != null ? found : bidiOther\n}\n\n// Bidirectional ordering algorithm\n// See http://unicode.org/reports/tr9/tr9-13.html for the algorithm\n// that this (partially) implements.\n\n// One-char codes used for character types:\n// L (L): Left-to-Right\n// R (R): Right-to-Left\n// r (AL): Right-to-Left Arabic\n// 1 (EN): European Number\n// + (ES): European Number Separator\n// % (ET): European Number Terminator\n// n (AN): Arabic Number\n// , (CS): Common Number Separator\n// m (NSM): Non-Spacing Mark\n// b (BN): Boundary Neutral\n// s (B): Paragraph Separator\n// t (S): Segment Separator\n// w (WS): Whitespace\n// N (ON): Other Neutrals\n\n// Returns null if characters are ordered as they appear\n// (left-to-right), or an array of sections ({from, to, level}\n// objects) in the order in which they occur visually.\nvar bidiOrdering = (function() {\n // Character types for codepoints 0 to 0xff\n var lowTypes = \"bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN\";\n // Character types for codepoints 0x600 to 0x6f9\n var arabicTypes = \"nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111\";\n function charType(code) {\n if (code <= 0xf7) { return lowTypes.charAt(code) }\n else if (0x590 <= code && code <= 0x5f4) { return \"R\" }\n else if (0x600 <= code && code <= 0x6f9) { return arabicTypes.charAt(code - 0x600) }\n else if (0x6ee <= code && code <= 0x8ac) { return \"r\" }\n else if (0x2000 <= code && code <= 0x200b) { return \"w\" }\n else if (code == 0x200c) { return \"b\" }\n else { return \"L\" }\n }\n\n var bidiRE = /[\\u0590-\\u05f4\\u0600-\\u06ff\\u0700-\\u08ac]/;\n var isNeutral = /[stwN]/, isStrong = /[LRr]/, countsAsLeft = /[Lb1n]/, countsAsNum = /[1n]/;\n\n function BidiSpan(level, from, to) {\n this.level = level;\n this.from = from; this.to = to;\n }\n\n return function(str, direction) {\n var outerType = direction == \"ltr\" ? \"L\" : \"R\";\n\n if (str.length == 0 || direction == \"ltr\" && !bidiRE.test(str)) { return false }\n var len = str.length, types = [];\n for (var i = 0; i < len; ++i)\n { types.push(charType(str.charCodeAt(i))); }\n\n // W1. Examine each non-spacing mark (NSM) in the level run, and\n // change the type of the NSM to the type of the previous\n // character. If the NSM is at the start of the level run, it will\n // get the type of sor.\n for (var i$1 = 0, prev = outerType; i$1 < len; ++i$1) {\n var type = types[i$1];\n if (type == \"m\") { types[i$1] = prev; }\n else { prev = type; }\n }\n\n // W2. Search backwards from each instance of a European number\n // until the first strong type (R, L, AL, or sor) is found. If an\n // AL is found, change the type of the European number to Arabic\n // number.\n // W3. Change all ALs to R.\n for (var i$2 = 0, cur = outerType; i$2 < len; ++i$2) {\n var type$1 = types[i$2];\n if (type$1 == \"1\" && cur == \"r\") { types[i$2] = \"n\"; }\n else if (isStrong.test(type$1)) { cur = type$1; if (type$1 == \"r\") { types[i$2] = \"R\"; } }\n }\n\n // W4. A single European separator between two European numbers\n // changes to a European number. A single common separator between\n // two numbers of the same type changes to that type.\n for (var i$3 = 1, prev$1 = types[0]; i$3 < len - 1; ++i$3) {\n var type$2 = types[i$3];\n if (type$2 == \"+\" && prev$1 == \"1\" && types[i$3+1] == \"1\") { types[i$3] = \"1\"; }\n else if (type$2 == \",\" && prev$1 == types[i$3+1] &&\n (prev$1 == \"1\" || prev$1 == \"n\")) { types[i$3] = prev$1; }\n prev$1 = type$2;\n }\n\n // W5. A sequence of European terminators adjacent to European\n // numbers changes to all European numbers.\n // W6. Otherwise, separators and terminators change to Other\n // Neutral.\n for (var i$4 = 0; i$4 < len; ++i$4) {\n var type$3 = types[i$4];\n if (type$3 == \",\") { types[i$4] = \"N\"; }\n else if (type$3 == \"%\") {\n var end = (void 0);\n for (end = i$4 + 1; end < len && types[end] == \"%\"; ++end) {}\n var replace = (i$4 && types[i$4-1] == \"!\") || (end < len && types[end] == \"1\") ? \"1\" : \"N\";\n for (var j = i$4; j < end; ++j) { types[j] = replace; }\n i$4 = end - 1;\n }\n }\n\n // W7. Search backwards from each instance of a European number\n // until the first strong type (R, L, or sor) is found. If an L is\n // found, then change the type of the European number to L.\n for (var i$5 = 0, cur$1 = outerType; i$5 < len; ++i$5) {\n var type$4 = types[i$5];\n if (cur$1 == \"L\" && type$4 == \"1\") { types[i$5] = \"L\"; }\n else if (isStrong.test(type$4)) { cur$1 = type$4; }\n }\n\n // N1. A sequence of neutrals takes the direction of the\n // surrounding strong text if the text on both sides has the same\n // direction. European and Arabic numbers act as if they were R in\n // terms of their influence on neutrals. Start-of-level-run (sor)\n // and end-of-level-run (eor) are used at level run boundaries.\n // N2. Any remaining neutrals take the embedding direction.\n for (var i$6 = 0; i$6 < len; ++i$6) {\n if (isNeutral.test(types[i$6])) {\n var end$1 = (void 0);\n for (end$1 = i$6 + 1; end$1 < len && isNeutral.test(types[end$1]); ++end$1) {}\n var before = (i$6 ? types[i$6-1] : outerType) == \"L\";\n var after = (end$1 < len ? types[end$1] : outerType) == \"L\";\n var replace$1 = before == after ? (before ? \"L\" : \"R\") : outerType;\n for (var j$1 = i$6; j$1 < end$1; ++j$1) { types[j$1] = replace$1; }\n i$6 = end$1 - 1;\n }\n }\n\n // Here we depart from the documented algorithm, in order to avoid\n // building up an actual levels array. Since there are only three\n // levels (0, 1, 2) in an implementation that doesn't take\n // explicit embedding into account, we can build up the order on\n // the fly, without following the level-based algorithm.\n var order = [], m;\n for (var i$7 = 0; i$7 < len;) {\n if (countsAsLeft.test(types[i$7])) {\n var start = i$7;\n for (++i$7; i$7 < len && countsAsLeft.test(types[i$7]); ++i$7) {}\n order.push(new BidiSpan(0, start, i$7));\n } else {\n var pos = i$7, at = order.length;\n for (++i$7; i$7 < len && types[i$7] != \"L\"; ++i$7) {}\n for (var j$2 = pos; j$2 < i$7;) {\n if (countsAsNum.test(types[j$2])) {\n if (pos < j$2) { order.splice(at, 0, new BidiSpan(1, pos, j$2)); }\n var nstart = j$2;\n for (++j$2; j$2 < i$7 && countsAsNum.test(types[j$2]); ++j$2) {}\n order.splice(at, 0, new BidiSpan(2, nstart, j$2));\n pos = j$2;\n } else { ++j$2; }\n }\n if (pos < i$7) { order.splice(at, 0, new BidiSpan(1, pos, i$7)); }\n }\n }\n if (direction == \"ltr\") {\n if (order[0].level == 1 && (m = str.match(/^\\s+/))) {\n order[0].from = m[0].length;\n order.unshift(new BidiSpan(0, 0, m[0].length));\n }\n if (lst(order).level == 1 && (m = str.match(/\\s+$/))) {\n lst(order).to -= m[0].length;\n order.push(new BidiSpan(0, len - m[0].length, len));\n }\n }\n\n return direction == \"rtl\" ? order.reverse() : order\n }\n})();\n\n// Get the bidi ordering for the given line (and cache it). Returns\n// false for lines that are fully left-to-right, and an array of\n// BidiSpan objects otherwise.\nfunction getOrder(line, direction) {\n var order = line.order;\n if (order == null) { order = line.order = bidiOrdering(line.text, direction); }\n return order\n}\n\n// EVENT HANDLING\n\n// Lightweight event framework. on/off also work on DOM nodes,\n// registering native DOM handlers.\n\nvar noHandlers = [];\n\nvar on = function(emitter, type, f) {\n if (emitter.addEventListener) {\n emitter.addEventListener(type, f, false);\n } else if (emitter.attachEvent) {\n emitter.attachEvent(\"on\" + type, f);\n } else {\n var map$$1 = emitter._handlers || (emitter._handlers = {});\n map$$1[type] = (map$$1[type] || noHandlers).concat(f);\n }\n};\n\nfunction getHandlers(emitter, type) {\n return emitter._handlers && emitter._handlers[type] || noHandlers\n}\n\nfunction off(emitter, type, f) {\n if (emitter.removeEventListener) {\n emitter.removeEventListener(type, f, false);\n } else if (emitter.detachEvent) {\n emitter.detachEvent(\"on\" + type, f);\n } else {\n var map$$1 = emitter._handlers, arr = map$$1 && map$$1[type];\n if (arr) {\n var index = indexOf(arr, f);\n if (index > -1)\n { map$$1[type] = arr.slice(0, index).concat(arr.slice(index + 1)); }\n }\n }\n}\n\nfunction signal(emitter, type /*, values...*/) {\n var handlers = getHandlers(emitter, type);\n if (!handlers.length) { return }\n var args = Array.prototype.slice.call(arguments, 2);\n for (var i = 0; i < handlers.length; ++i) { handlers[i].apply(null, args); }\n}\n\n// The DOM events that CodeMirror handles can be overridden by\n// registering a (non-DOM) handler on the editor for the event name,\n// and preventDefault-ing the event in that handler.\nfunction signalDOMEvent(cm, e, override) {\n if (typeof e == \"string\")\n { e = {type: e, preventDefault: function() { this.defaultPrevented = true; }}; }\n signal(cm, override || e.type, cm, e);\n return e_defaultPrevented(e) || e.codemirrorIgnore\n}\n\nfunction signalCursorActivity(cm) {\n var arr = cm._handlers && cm._handlers.cursorActivity;\n if (!arr) { return }\n var set = cm.curOp.cursorActivityHandlers || (cm.curOp.cursorActivityHandlers = []);\n for (var i = 0; i < arr.length; ++i) { if (indexOf(set, arr[i]) == -1)\n { set.push(arr[i]); } }\n}\n\nfunction hasHandler(emitter, type) {\n return getHandlers(emitter, type).length > 0\n}\n\n// Add on and off methods to a constructor's prototype, to make\n// registering events on such objects more convenient.\nfunction eventMixin(ctor) {\n ctor.prototype.on = function(type, f) {on(this, type, f);};\n ctor.prototype.off = function(type, f) {off(this, type, f);};\n}\n\n// Due to the fact that we still support jurassic IE versions, some\n// compatibility wrappers are needed.\n\nfunction e_preventDefault(e) {\n if (e.preventDefault) { e.preventDefault(); }\n else { e.returnValue = false; }\n}\nfunction e_stopPropagation(e) {\n if (e.stopPropagation) { e.stopPropagation(); }\n else { e.cancelBubble = true; }\n}\nfunction e_defaultPrevented(e) {\n return e.defaultPrevented != null ? e.defaultPrevented : e.returnValue == false\n}\nfunction e_stop(e) {e_preventDefault(e); e_stopPropagation(e);}\n\nfunction e_target(e) {return e.target || e.srcElement}\nfunction e_button(e) {\n var b = e.which;\n if (b == null) {\n if (e.button & 1) { b = 1; }\n else if (e.button & 2) { b = 3; }\n else if (e.button & 4) { b = 2; }\n }\n if (mac && e.ctrlKey && b == 1) { b = 3; }\n return b\n}\n\n// Detect drag-and-drop\nvar dragAndDrop = function() {\n // There is *some* kind of drag-and-drop support in IE6-8, but I\n // couldn't get it to work yet.\n if (ie && ie_version < 9) { return false }\n var div = elt('div');\n return \"draggable\" in div || \"dragDrop\" in div\n}();\n\nvar zwspSupported;\nfunction zeroWidthElement(measure) {\n if (zwspSupported == null) {\n var test = elt(\"span\", \"\\u200b\");\n removeChildrenAndAdd(measure, elt(\"span\", [test, document.createTextNode(\"x\")]));\n if (measure.firstChild.offsetHeight != 0)\n { zwspSupported = test.offsetWidth <= 1 && test.offsetHeight > 2 && !(ie && ie_version < 8); }\n }\n var node = zwspSupported ? elt(\"span\", \"\\u200b\") :\n elt(\"span\", \"\\u00a0\", null, \"display: inline-block; width: 1px; margin-right: -1px\");\n node.setAttribute(\"cm-text\", \"\");\n return node\n}\n\n// Feature-detect IE's crummy client rect reporting for bidi text\nvar badBidiRects;\nfunction hasBadBidiRects(measure) {\n if (badBidiRects != null) { return badBidiRects }\n var txt = removeChildrenAndAdd(measure, document.createTextNode(\"A\\u062eA\"));\n var r0 = range(txt, 0, 1).getBoundingClientRect();\n var r1 = range(txt, 1, 2).getBoundingClientRect();\n removeChildren(measure);\n if (!r0 || r0.left == r0.right) { return false } // Safari returns null in some cases (#2780)\n return badBidiRects = (r1.right - r0.right < 3)\n}\n\n// See if \"\".split is the broken IE version, if so, provide an\n// alternative way to split lines.\nvar splitLinesAuto = \"\\n\\nb\".split(/\\n/).length != 3 ? function (string) {\n var pos = 0, result = [], l = string.length;\n while (pos <= l) {\n var nl = string.indexOf(\"\\n\", pos);\n if (nl == -1) { nl = string.length; }\n var line = string.slice(pos, string.charAt(nl - 1) == \"\\r\" ? nl - 1 : nl);\n var rt = line.indexOf(\"\\r\");\n if (rt != -1) {\n result.push(line.slice(0, rt));\n pos += rt + 1;\n } else {\n result.push(line);\n pos = nl + 1;\n }\n }\n return result\n} : function (string) { return string.split(/\\r\\n?|\\n/); };\n\nvar hasSelection = window.getSelection ? function (te) {\n try { return te.selectionStart != te.selectionEnd }\n catch(e) { return false }\n} : function (te) {\n var range$$1;\n try {range$$1 = te.ownerDocument.selection.createRange();}\n catch(e) {}\n if (!range$$1 || range$$1.parentElement() != te) { return false }\n return range$$1.compareEndPoints(\"StartToEnd\", range$$1) != 0\n};\n\nvar hasCopyEvent = (function () {\n var e = elt(\"div\");\n if (\"oncopy\" in e) { return true }\n e.setAttribute(\"oncopy\", \"return;\");\n return typeof e.oncopy == \"function\"\n})();\n\nvar badZoomedRects = null;\nfunction hasBadZoomedRects(measure) {\n if (badZoomedRects != null) { return badZoomedRects }\n var node = removeChildrenAndAdd(measure, elt(\"span\", \"x\"));\n var normal = node.getBoundingClientRect();\n var fromRange = range(node, 0, 1).getBoundingClientRect();\n return badZoomedRects = Math.abs(normal.left - fromRange.left) > 1\n}\n\n// Known modes, by name and by MIME\nvar modes = {};\nvar mimeModes = {};\n\n// Extra arguments are stored as the mode's dependencies, which is\n// used by (legacy) mechanisms like loadmode.js to automatically\n// load a mode. (Preferred mechanism is the require/define calls.)\nfunction defineMode(name, mode) {\n if (arguments.length > 2)\n { mode.dependencies = Array.prototype.slice.call(arguments, 2); }\n modes[name] = mode;\n}\n\nfunction defineMIME(mime, spec) {\n mimeModes[mime] = spec;\n}\n\n// Given a MIME type, a {name, ...options} config object, or a name\n// string, return a mode config object.\nfunction resolveMode(spec) {\n if (typeof spec == \"string\" && mimeModes.hasOwnProperty(spec)) {\n spec = mimeModes[spec];\n } else if (spec && typeof spec.name == \"string\" && mimeModes.hasOwnProperty(spec.name)) {\n var found = mimeModes[spec.name];\n if (typeof found == \"string\") { found = {name: found}; }\n spec = createObj(found, spec);\n spec.name = found.name;\n } else if (typeof spec == \"string\" && /^[\\w\\-]+\\/[\\w\\-]+\\+xml$/.test(spec)) {\n return resolveMode(\"application/xml\")\n } else if (typeof spec == \"string\" && /^[\\w\\-]+\\/[\\w\\-]+\\+json$/.test(spec)) {\n return resolveMode(\"application/json\")\n }\n if (typeof spec == \"string\") { return {name: spec} }\n else { return spec || {name: \"null\"} }\n}\n\n// Given a mode spec (anything that resolveMode accepts), find and\n// initialize an actual mode object.\nfunction getMode(options, spec) {\n spec = resolveMode(spec);\n var mfactory = modes[spec.name];\n if (!mfactory) { return getMode(options, \"text/plain\") }\n var modeObj = mfactory(options, spec);\n if (modeExtensions.hasOwnProperty(spec.name)) {\n var exts = modeExtensions[spec.name];\n for (var prop in exts) {\n if (!exts.hasOwnProperty(prop)) { continue }\n if (modeObj.hasOwnProperty(prop)) { modeObj[\"_\" + prop] = modeObj[prop]; }\n modeObj[prop] = exts[prop];\n }\n }\n modeObj.name = spec.name;\n if (spec.helperType) { modeObj.helperType = spec.helperType; }\n if (spec.modeProps) { for (var prop$1 in spec.modeProps)\n { modeObj[prop$1] = spec.modeProps[prop$1]; } }\n\n return modeObj\n}\n\n// This can be used to attach properties to mode objects from\n// outside the actual mode definition.\nvar modeExtensions = {};\nfunction extendMode(mode, properties) {\n var exts = modeExtensions.hasOwnProperty(mode) ? modeExtensions[mode] : (modeExtensions[mode] = {});\n copyObj(properties, exts);\n}\n\nfunction copyState(mode, state) {\n if (state === true) { return state }\n if (mode.copyState) { return mode.copyState(state) }\n var nstate = {};\n for (var n in state) {\n var val = state[n];\n if (val instanceof Array) { val = val.concat([]); }\n nstate[n] = val;\n }\n return nstate\n}\n\n// Given a mode and a state (for that mode), find the inner mode and\n// state at the position that the state refers to.\nfunction innerMode(mode, state) {\n var info;\n while (mode.innerMode) {\n info = mode.innerMode(state);\n if (!info || info.mode == mode) { break }\n state = info.state;\n mode = info.mode;\n }\n return info || {mode: mode, state: state}\n}\n\nfunction startState(mode, a1, a2) {\n return mode.startState ? mode.startState(a1, a2) : true\n}\n\n// STRING STREAM\n\n// Fed to the mode parsers, provides helper functions to make\n// parsers more succinct.\n\nvar StringStream = function(string, tabSize, lineOracle) {\n this.pos = this.start = 0;\n this.string = string;\n this.tabSize = tabSize || 8;\n this.lastColumnPos = this.lastColumnValue = 0;\n this.lineStart = 0;\n this.lineOracle = lineOracle;\n};\n\nStringStream.prototype.eol = function () {return this.pos >= this.string.length};\nStringStream.prototype.sol = function () {return this.pos == this.lineStart};\nStringStream.prototype.peek = function () {return this.string.charAt(this.pos) || undefined};\nStringStream.prototype.next = function () {\n if (this.pos < this.string.length)\n { return this.string.charAt(this.pos++) }\n};\nStringStream.prototype.eat = function (match) {\n var ch = this.string.charAt(this.pos);\n var ok;\n if (typeof match == \"string\") { ok = ch == match; }\n else { ok = ch && (match.test ? match.test(ch) : match(ch)); }\n if (ok) {++this.pos; return ch}\n};\nStringStream.prototype.eatWhile = function (match) {\n var start = this.pos;\n while (this.eat(match)){}\n return this.pos > start\n};\nStringStream.prototype.eatSpace = function () {\n var this$1 = this;\n\n var start = this.pos;\n while (/[\\s\\u00a0]/.test(this.string.charAt(this.pos))) { ++this$1.pos; }\n return this.pos > start\n};\nStringStream.prototype.skipToEnd = function () {this.pos = this.string.length;};\nStringStream.prototype.skipTo = function (ch) {\n var found = this.string.indexOf(ch, this.pos);\n if (found > -1) {this.pos = found; return true}\n};\nStringStream.prototype.backUp = function (n) {this.pos -= n;};\nStringStream.prototype.column = function () {\n if (this.lastColumnPos < this.start) {\n this.lastColumnValue = countColumn(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue);\n this.lastColumnPos = this.start;\n }\n return this.lastColumnValue - (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)\n};\nStringStream.prototype.indentation = function () {\n return countColumn(this.string, null, this.tabSize) -\n (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)\n};\nStringStream.prototype.match = function (pattern, consume, caseInsensitive) {\n if (typeof pattern == \"string\") {\n var cased = function (str) { return caseInsensitive ? str.toLowerCase() : str; };\n var substr = this.string.substr(this.pos, pattern.length);\n if (cased(substr) == cased(pattern)) {\n if (consume !== false) { this.pos += pattern.length; }\n return true\n }\n } else {\n var match = this.string.slice(this.pos).match(pattern);\n if (match && match.index > 0) { return null }\n if (match && consume !== false) { this.pos += match[0].length; }\n return match\n }\n};\nStringStream.prototype.current = function (){return this.string.slice(this.start, this.pos)};\nStringStream.prototype.hideFirstChars = function (n, inner) {\n this.lineStart += n;\n try { return inner() }\n finally { this.lineStart -= n; }\n};\nStringStream.prototype.lookAhead = function (n) {\n var oracle = this.lineOracle;\n return oracle && oracle.lookAhead(n)\n};\nStringStream.prototype.baseToken = function () {\n var oracle = this.lineOracle;\n return oracle && oracle.baseToken(this.pos)\n};\n\nvar SavedContext = function(state, lookAhead) {\n this.state = state;\n this.lookAhead = lookAhead;\n};\n\nvar Context = function(doc, state, line, lookAhead) {\n this.state = state;\n this.doc = doc;\n this.line = line;\n this.maxLookAhead = lookAhead || 0;\n this.baseTokens = null;\n this.baseTokenPos = 1;\n};\n\nContext.prototype.lookAhead = function (n) {\n var line = this.doc.getLine(this.line + n);\n if (line != null && n > this.maxLookAhead) { this.maxLookAhead = n; }\n return line\n};\n\nContext.prototype.baseToken = function (n) {\n var this$1 = this;\n\n if (!this.baseTokens) { return null }\n while (this.baseTokens[this.baseTokenPos] <= n)\n { this$1.baseTokenPos += 2; }\n var type = this.baseTokens[this.baseTokenPos + 1];\n return {type: type && type.replace(/( |^)overlay .*/, \"\"),\n size: this.baseTokens[this.baseTokenPos] - n}\n};\n\nContext.prototype.nextLine = function () {\n this.line++;\n if (this.maxLookAhead > 0) { this.maxLookAhead--; }\n};\n\nContext.fromSaved = function (doc, saved, line) {\n if (saved instanceof SavedContext)\n { return new Context(doc, copyState(doc.mode, saved.state), line, saved.lookAhead) }\n else\n { return new Context(doc, copyState(doc.mode, saved), line) }\n};\n\nContext.prototype.save = function (copy) {\n var state = copy !== false ? copyState(this.doc.mode, this.state) : this.state;\n return this.maxLookAhead > 0 ? new SavedContext(state, this.maxLookAhead) : state\n};\n\n\n// Compute a style array (an array starting with a mode generation\n// -- for invalidation -- followed by pairs of end positions and\n// style strings), which is used to highlight the tokens on the\n// line.\nfunction highlightLine(cm, line, context, forceToEnd) {\n // A styles array always starts with a number identifying the\n // mode/overlays that it is based on (for easy invalidation).\n var st = [cm.state.modeGen], lineClasses = {};\n // Compute the base array of styles\n runMode(cm, line.text, cm.doc.mode, context, function (end, style) { return st.push(end, style); },\n lineClasses, forceToEnd);\n var state = context.state;\n\n // Run overlays, adjust style array.\n var loop = function ( o ) {\n context.baseTokens = st;\n var overlay = cm.state.overlays[o], i = 1, at = 0;\n context.state = true;\n runMode(cm, line.text, overlay.mode, context, function (end, style) {\n var start = i;\n // Ensure there's a token end at the current position, and that i points at it\n while (at < end) {\n var i_end = st[i];\n if (i_end > end)\n { st.splice(i, 1, end, st[i+1], i_end); }\n i += 2;\n at = Math.min(end, i_end);\n }\n if (!style) { return }\n if (overlay.opaque) {\n st.splice(start, i - start, end, \"overlay \" + style);\n i = start + 2;\n } else {\n for (; start < i; start += 2) {\n var cur = st[start+1];\n st[start+1] = (cur ? cur + \" \" : \"\") + \"overlay \" + style;\n }\n }\n }, lineClasses);\n context.state = state;\n context.baseTokens = null;\n context.baseTokenPos = 1;\n };\n\n for (var o = 0; o < cm.state.overlays.length; ++o) loop( o );\n\n return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}\n}\n\nfunction getLineStyles(cm, line, updateFrontier) {\n if (!line.styles || line.styles[0] != cm.state.modeGen) {\n var context = getContextBefore(cm, lineNo(line));\n var resetState = line.text.length > cm.options.maxHighlightLength && copyState(cm.doc.mode, context.state);\n var result = highlightLine(cm, line, context);\n if (resetState) { context.state = resetState; }\n line.stateAfter = context.save(!resetState);\n line.styles = result.styles;\n if (result.classes) { line.styleClasses = result.classes; }\n else if (line.styleClasses) { line.styleClasses = null; }\n if (updateFrontier === cm.doc.highlightFrontier)\n { cm.doc.modeFrontier = Math.max(cm.doc.modeFrontier, ++cm.doc.highlightFrontier); }\n }\n return line.styles\n}\n\nfunction getContextBefore(cm, n, precise) {\n var doc = cm.doc, display = cm.display;\n if (!doc.mode.startState) { return new Context(doc, true, n) }\n var start = findStartLine(cm, n, precise);\n var saved = start > doc.first && getLine(doc, start - 1).stateAfter;\n var context = saved ? Context.fromSaved(doc, saved, start) : new Context(doc, startState(doc.mode), start);\n\n doc.iter(start, n, function (line) {\n processLine(cm, line.text, context);\n var pos = context.line;\n line.stateAfter = pos == n - 1 || pos % 5 == 0 || pos >= display.viewFrom && pos < display.viewTo ? context.save() : null;\n context.nextLine();\n });\n if (precise) { doc.modeFrontier = context.line; }\n return context\n}\n\n// Lightweight form of highlight -- proceed over this line and\n// update state, but don't save a style array. Used for lines that\n// aren't currently visible.\nfunction processLine(cm, text, context, startAt) {\n var mode = cm.doc.mode;\n var stream = new StringStream(text, cm.options.tabSize, context);\n stream.start = stream.pos = startAt || 0;\n if (text == \"\") { callBlankLine(mode, context.state); }\n while (!stream.eol()) {\n readToken(mode, stream, context.state);\n stream.start = stream.pos;\n }\n}\n\nfunction callBlankLine(mode, state) {\n if (mode.blankLine) { return mode.blankLine(state) }\n if (!mode.innerMode) { return }\n var inner = innerMode(mode, state);\n if (inner.mode.blankLine) { return inner.mode.blankLine(inner.state) }\n}\n\nfunction readToken(mode, stream, state, inner) {\n for (var i = 0; i < 10; i++) {\n if (inner) { inner[0] = innerMode(mode, state).mode; }\n var style = mode.token(stream, state);\n if (stream.pos > stream.start) { return style }\n }\n throw new Error(\"Mode \" + mode.name + \" failed to advance stream.\")\n}\n\nvar Token = function(stream, type, state) {\n this.start = stream.start; this.end = stream.pos;\n this.string = stream.current();\n this.type = type || null;\n this.state = state;\n};\n\n// Utility for getTokenAt and getLineTokens\nfunction takeToken(cm, pos, precise, asArray) {\n var doc = cm.doc, mode = doc.mode, style;\n pos = clipPos(doc, pos);\n var line = getLine(doc, pos.line), context = getContextBefore(cm, pos.line, precise);\n var stream = new StringStream(line.text, cm.options.tabSize, context), tokens;\n if (asArray) { tokens = []; }\n while ((asArray || stream.pos < pos.ch) && !stream.eol()) {\n stream.start = stream.pos;\n style = readToken(mode, stream, context.state);\n if (asArray) { tokens.push(new Token(stream, style, copyState(doc.mode, context.state))); }\n }\n return asArray ? tokens : new Token(stream, style, context.state)\n}\n\nfunction extractLineClasses(type, output) {\n if (type) { for (;;) {\n var lineClass = type.match(/(?:^|\\s+)line-(background-)?(\\S+)/);\n if (!lineClass) { break }\n type = type.slice(0, lineClass.index) + type.slice(lineClass.index + lineClass[0].length);\n var prop = lineClass[1] ? \"bgClass\" : \"textClass\";\n if (output[prop] == null)\n { output[prop] = lineClass[2]; }\n else if (!(new RegExp(\"(?:^|\\s)\" + lineClass[2] + \"(?:$|\\s)\")).test(output[prop]))\n { output[prop] += \" \" + lineClass[2]; }\n } }\n return type\n}\n\n// Run the given mode's parser over a line, calling f for each token.\nfunction runMode(cm, text, mode, context, f, lineClasses, forceToEnd) {\n var flattenSpans = mode.flattenSpans;\n if (flattenSpans == null) { flattenSpans = cm.options.flattenSpans; }\n var curStart = 0, curStyle = null;\n var stream = new StringStream(text, cm.options.tabSize, context), style;\n var inner = cm.options.addModeClass && [null];\n if (text == \"\") { extractLineClasses(callBlankLine(mode, context.state), lineClasses); }\n while (!stream.eol()) {\n if (stream.pos > cm.options.maxHighlightLength) {\n flattenSpans = false;\n if (forceToEnd) { processLine(cm, text, context, stream.pos); }\n stream.pos = text.length;\n style = null;\n } else {\n style = extractLineClasses(readToken(mode, stream, context.state, inner), lineClasses);\n }\n if (inner) {\n var mName = inner[0].name;\n if (mName) { style = \"m-\" + (style ? mName + \" \" + style : mName); }\n }\n if (!flattenSpans || curStyle != style) {\n while (curStart < stream.start) {\n curStart = Math.min(stream.start, curStart + 5000);\n f(curStart, curStyle);\n }\n curStyle = style;\n }\n stream.start = stream.pos;\n }\n while (curStart < stream.pos) {\n // Webkit seems to refuse to render text nodes longer than 57444\n // characters, and returns inaccurate measurements in nodes\n // starting around 5000 chars.\n var pos = Math.min(stream.pos, curStart + 5000);\n f(pos, curStyle);\n curStart = pos;\n }\n}\n\n// Finds the line to start with when starting a parse. Tries to\n// find a line with a stateAfter, so that it can start with a\n// valid state. If that fails, it returns the line with the\n// smallest indentation, which tends to need the least context to\n// parse correctly.\nfunction findStartLine(cm, n, precise) {\n var minindent, minline, doc = cm.doc;\n var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100);\n for (var search = n; search > lim; --search) {\n if (search <= doc.first) { return doc.first }\n var line = getLine(doc, search - 1), after = line.stateAfter;\n if (after && (!precise || search + (after instanceof SavedContext ? after.lookAhead : 0) <= doc.modeFrontier))\n { return search }\n var indented = countColumn(line.text, null, cm.options.tabSize);\n if (minline == null || minindent > indented) {\n minline = search - 1;\n minindent = indented;\n }\n }\n return minline\n}\n\nfunction retreatFrontier(doc, n) {\n doc.modeFrontier = Math.min(doc.modeFrontier, n);\n if (doc.highlightFrontier < n - 10) { return }\n var start = doc.first;\n for (var line = n - 1; line > start; line--) {\n var saved = getLine(doc, line).stateAfter;\n // change is on 3\n // state on line 1 looked ahead 2 -- so saw 3\n // test 1 + 2 < 3 should cover this\n if (saved && (!(saved instanceof SavedContext) || line + saved.lookAhead < n)) {\n start = line + 1;\n break\n }\n }\n doc.highlightFrontier = Math.min(doc.highlightFrontier, start);\n}\n\n// LINE DATA STRUCTURE\n\n// Line objects. These hold state related to a line, including\n// highlighting info (the styles array).\nvar Line = function(text, markedSpans, estimateHeight) {\n this.text = text;\n attachMarkedSpans(this, markedSpans);\n this.height = estimateHeight ? estimateHeight(this) : 1;\n};\n\nLine.prototype.lineNo = function () { return lineNo(this) };\neventMixin(Line);\n\n// Change the content (text, markers) of a line. Automatically\n// invalidates cached information and tries to re-estimate the\n// line's height.\nfunction updateLine(line, text, markedSpans, estimateHeight) {\n line.text = text;\n if (line.stateAfter) { line.stateAfter = null; }\n if (line.styles) { line.styles = null; }\n if (line.order != null) { line.order = null; }\n detachMarkedSpans(line);\n attachMarkedSpans(line, markedSpans);\n var estHeight = estimateHeight ? estimateHeight(line) : 1;\n if (estHeight != line.height) { updateLineHeight(line, estHeight); }\n}\n\n// Detach a line from the document tree and its markers.\nfunction cleanUpLine(line) {\n line.parent = null;\n detachMarkedSpans(line);\n}\n\n// Convert a style as returned by a mode (either null, or a string\n// containing one or more styles) to a CSS style. This is cached,\n// and also looks for line-wide styles.\nvar styleToClassCache = {};\nvar styleToClassCacheWithMode = {};\nfunction interpretTokenStyle(style, options) {\n if (!style || /^\\s*$/.test(style)) { return null }\n var cache = options.addModeClass ? styleToClassCacheWithMode : styleToClassCache;\n return cache[style] ||\n (cache[style] = style.replace(/\\S+/g, \"cm-$&\"))\n}\n\n// Render the DOM representation of the text of a line. Also builds\n// up a 'line map', which points at the DOM nodes that represent\n// specific stretches of text, and is used by the measuring code.\n// The returned object contains the DOM node, this map, and\n// information about line-wide styles that were set by the mode.\nfunction buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: (ie || webkit) && cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n}\n\nfunction defaultSpecialCharPlaceholder(ch) {\n var token = elt(\"span\", \"\\u2022\", \"cm-invalidchar\");\n token.title = \"\\\\u\" + ch.charCodeAt(0).toString(16);\n token.setAttribute(\"aria-label\", token.title);\n return token\n}\n\n// Build up the DOM representation for a single token, and add it to\n// the line map. Takes care to render special characters separately.\nfunction buildToken(builder, text, style, startStyle, endStyle, title, css) {\n if (!text) { return }\n var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text;\n var special = builder.cm.state.specialChars, mustWrap = false;\n var content;\n if (!special.test(text)) {\n builder.col += text.length;\n content = document.createTextNode(displayText);\n builder.map.push(builder.pos, builder.pos + text.length, content);\n if (ie && ie_version < 9) { mustWrap = true; }\n builder.pos += text.length;\n } else {\n content = document.createDocumentFragment();\n var pos = 0;\n while (true) {\n special.lastIndex = pos;\n var m = special.exec(text);\n var skipped = m ? m.index - pos : text.length - pos;\n if (skipped) {\n var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt])); }\n else { content.appendChild(txt); }\n builder.map.push(builder.pos, builder.pos + skipped, txt);\n builder.col += skipped;\n builder.pos += skipped;\n }\n if (!m) { break }\n pos += skipped + 1;\n var txt$1 = (void 0);\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n txt$1 = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n txt$1.setAttribute(\"role\", \"presentation\");\n txt$1.setAttribute(\"cm-text\", \"\\t\");\n builder.col += tabWidth;\n } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n txt$1 = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"));\n txt$1.setAttribute(\"cm-text\", m[0]);\n builder.col += 1;\n } else {\n txt$1 = builder.cm.options.specialCharPlaceholder(m[0]);\n txt$1.setAttribute(\"cm-text\", m[0]);\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt$1])); }\n else { content.appendChild(txt$1); }\n builder.col += 1;\n }\n builder.map.push(builder.pos, builder.pos + 1, txt$1);\n builder.pos++;\n }\n }\n builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32;\n if (style || startStyle || endStyle || mustWrap || css) {\n var fullStyle = style || \"\";\n if (startStyle) { fullStyle += startStyle; }\n if (endStyle) { fullStyle += endStyle; }\n var token = elt(\"span\", [content], fullStyle, css);\n if (title) { token.title = title; }\n return builder.content.appendChild(token)\n }\n builder.content.appendChild(content);\n}\n\nfunction splitSpaces(text, trailingBefore) {\n if (text.length > 1 && !/ /.test(text)) { return text }\n var spaceBefore = trailingBefore, result = \"\";\n for (var i = 0; i < text.length; i++) {\n var ch = text.charAt(i);\n if (ch == \" \" && spaceBefore && (i == text.length - 1 || text.charCodeAt(i + 1) == 32))\n { ch = \"\\u00a0\"; }\n result += ch;\n spaceBefore = ch == \" \";\n }\n return result\n}\n\n// Work around nonsense dimensions being reported for stretches of\n// right-to-left text.\nfunction buildTokenBadBidi(inner, order) {\n return function (builder, text, style, startStyle, endStyle, title, css) {\n style = style ? style + \" cm-force-border\" : \"cm-force-border\";\n var start = builder.pos, end = start + text.length;\n for (;;) {\n // Find the part that overlaps with the start of this text\n var part = (void 0);\n for (var i = 0; i < order.length; i++) {\n part = order[i];\n if (part.to > start && part.from <= start) { break }\n }\n if (part.to >= end) { return inner(builder, text, style, startStyle, endStyle, title, css) }\n inner(builder, text.slice(0, part.to - start), style, startStyle, null, title, css);\n startStyle = null;\n text = text.slice(part.to - start);\n start = part.to;\n }\n }\n}\n\nfunction buildCollapsedSpan(builder, size, marker, ignoreWidget) {\n var widget = !ignoreWidget && marker.widgetNode;\n if (widget) { builder.map.push(builder.pos, builder.pos + size, widget); }\n if (!ignoreWidget && builder.cm.display.input.needsContentAttribute) {\n if (!widget)\n { widget = builder.content.appendChild(document.createElement(\"span\")); }\n widget.setAttribute(\"cm-marker\", marker.id);\n }\n if (widget) {\n builder.cm.display.input.setUneditable(widget);\n builder.content.appendChild(widget);\n }\n builder.pos += size;\n builder.trailingSpace = false;\n}\n\n// Outputs a number of spans to make up a line, taking highlighting\n// and marked text into account.\nfunction insertLineContent(line, builder, styles) {\n var spans = line.markedSpans, allText = line.text, at = 0;\n if (!spans) {\n for (var i$1 = 1; i$1 < styles.length; i$1+=2)\n { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)); }\n return\n }\n\n var len = allText.length, pos = 0, i = 1, text = \"\", style, css;\n var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed;\n for (;;) {\n if (nextChange == pos) { // Update current marker set\n spanStyle = spanEndStyle = spanStartStyle = title = css = \"\";\n collapsed = null; nextChange = Infinity;\n var foundBookmarks = [], endStyles = (void 0);\n for (var j = 0; j < spans.length; ++j) {\n var sp = spans[j], m = sp.marker;\n if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) {\n foundBookmarks.push(m);\n } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {\n if (sp.to != null && sp.to != pos && nextChange > sp.to) {\n nextChange = sp.to;\n spanEndStyle = \"\";\n }\n if (m.className) { spanStyle += \" \" + m.className; }\n if (m.css) { css = (css ? css + \";\" : \"\") + m.css; }\n if (m.startStyle && sp.from == pos) { spanStartStyle += \" \" + m.startStyle; }\n if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to); }\n if (m.title && !title) { title = m.title; }\n if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))\n { collapsed = sp; }\n } else if (sp.from > pos && nextChange > sp.from) {\n nextChange = sp.from;\n }\n }\n if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2)\n { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += \" \" + endStyles[j$1]; } } }\n\n if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2)\n { buildCollapsedSpan(builder, 0, foundBookmarks[j$2]); } }\n if (collapsed && (collapsed.from || 0) == pos) {\n buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,\n collapsed.marker, collapsed.from == null);\n if (collapsed.to == null) { return }\n if (collapsed.to == pos) { collapsed = false; }\n }\n }\n if (pos >= len) { break }\n\n var upto = Math.min(len, nextChange);\n while (true) {\n if (text) {\n var end = pos + text.length;\n if (!collapsed) {\n var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\n spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", title, css);\n }\n if (end >= upto) {text = text.slice(upto - pos); pos = upto; break}\n pos = end;\n spanStartStyle = \"\";\n }\n text = allText.slice(at, at = styles[i++]);\n style = interpretTokenStyle(styles[i++], builder.cm.options);\n }\n }\n}\n\n\n// These objects are used to represent the visible (currently drawn)\n// part of the document. A LineView may correspond to multiple\n// logical lines, if those are connected by collapsed ranges.\nfunction LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n}\n\n// Create a range of LineView objects for the given lines.\nfunction buildViewArray(cm, from, to) {\n var array = [], nextPos;\n for (var pos = from; pos < to; pos = nextPos) {\n var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);\n nextPos = pos + view.size;\n array.push(view);\n }\n return array\n}\n\nvar operationGroup = null;\n\nfunction pushOperation(op) {\n if (operationGroup) {\n operationGroup.ops.push(op);\n } else {\n op.ownsGroup = operationGroup = {\n ops: [op],\n delayedCallbacks: []\n };\n }\n}\n\nfunction fireCallbacksForOps(group) {\n // Calls delayed callbacks and cursorActivity handlers until no\n // new ones appear\n var callbacks = group.delayedCallbacks, i = 0;\n do {\n for (; i < callbacks.length; i++)\n { callbacks[i].call(null); }\n for (var j = 0; j < group.ops.length; j++) {\n var op = group.ops[j];\n if (op.cursorActivityHandlers)\n { while (op.cursorActivityCalled < op.cursorActivityHandlers.length)\n { op.cursorActivityHandlers[op.cursorActivityCalled++].call(null, op.cm); } }\n }\n } while (i < callbacks.length)\n}\n\nfunction finishOperation(op, endCb) {\n var group = op.ownsGroup;\n if (!group) { return }\n\n try { fireCallbacksForOps(group); }\n finally {\n operationGroup = null;\n endCb(group);\n }\n}\n\nvar orphanDelayedCallbacks = null;\n\n// Often, we want to signal events at a point where we are in the\n// middle of some work, but don't want the handler to start calling\n// other methods on the editor, which might be in an inconsistent\n// state or simply not expect any other events to happen.\n// signalLater looks whether there are any handlers, and schedules\n// them to be executed when the last operation ends, or, if no\n// operation is active, when a timeout fires.\nfunction signalLater(emitter, type /*, values...*/) {\n var arr = getHandlers(emitter, type);\n if (!arr.length) { return }\n var args = Array.prototype.slice.call(arguments, 2), list;\n if (operationGroup) {\n list = operationGroup.delayedCallbacks;\n } else if (orphanDelayedCallbacks) {\n list = orphanDelayedCallbacks;\n } else {\n list = orphanDelayedCallbacks = [];\n setTimeout(fireOrphanDelayed, 0);\n }\n var loop = function ( i ) {\n list.push(function () { return arr[i].apply(null, args); });\n };\n\n for (var i = 0; i < arr.length; ++i)\n loop( i );\n}\n\nfunction fireOrphanDelayed() {\n var delayed = orphanDelayedCallbacks;\n orphanDelayedCallbacks = null;\n for (var i = 0; i < delayed.length; ++i) { delayed[i](); }\n}\n\n// When an aspect of a line changes, a string is added to\n// lineView.changes. This updates the relevant part of the line's\n// DOM structure.\nfunction updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") { updateLineText(cm, lineView); }\n else if (type == \"gutter\") { updateLineGutter(cm, lineView, lineN, dims); }\n else if (type == \"class\") { updateLineClasses(cm, lineView); }\n else if (type == \"widget\") { updateLineWidgets(cm, lineView, dims); }\n }\n lineView.changes = null;\n}\n\n// Lines with gutter elements, widgets or a background class need to\n// be wrapped, and have the extra elements added to the wrapper div\nfunction ensureLineWrapped(lineView) {\n if (lineView.node == lineView.text) {\n lineView.node = elt(\"div\", null, null, \"position: relative\");\n if (lineView.text.parentNode)\n { lineView.text.parentNode.replaceChild(lineView.node, lineView.text); }\n lineView.node.appendChild(lineView.text);\n if (ie && ie_version < 8) { lineView.node.style.zIndex = 2; }\n }\n return lineView.node\n}\n\nfunction updateLineBackground(cm, lineView) {\n var cls = lineView.bgClass ? lineView.bgClass + \" \" + (lineView.line.bgClass || \"\") : lineView.line.bgClass;\n if (cls) { cls += \" CodeMirror-linebackground\"; }\n if (lineView.background) {\n if (cls) { lineView.background.className = cls; }\n else { lineView.background.parentNode.removeChild(lineView.background); lineView.background = null; }\n } else if (cls) {\n var wrap = ensureLineWrapped(lineView);\n lineView.background = wrap.insertBefore(elt(\"div\", null, cls), wrap.firstChild);\n cm.display.input.setUneditable(lineView.background);\n }\n}\n\n// Wrapper around buildLineContent which will reuse the structure\n// in display.externalMeasured when possible.\nfunction getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n}\n\n// Redraw the line's text. Interacts with the background and text\n// classes because the mode may output tokens that influence these\n// classes.\nfunction updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n}\n\nfunction updateLineClasses(cm, lineView) {\n updateLineBackground(cm, lineView);\n if (lineView.line.wrapClass)\n { ensureLineWrapped(lineView).className = lineView.line.wrapClass; }\n else if (lineView.node != lineView.text)\n { lineView.node.className = \"\"; }\n var textClass = lineView.textClass ? lineView.textClass + \" \" + (lineView.line.textClass || \"\") : lineView.line.textClass;\n lineView.text.className = textClass || \"\";\n}\n\nfunction updateLineGutter(cm, lineView, lineN, dims) {\n if (lineView.gutter) {\n lineView.node.removeChild(lineView.gutter);\n lineView.gutter = null;\n }\n if (lineView.gutterBackground) {\n lineView.node.removeChild(lineView.gutterBackground);\n lineView.gutterBackground = null;\n }\n if (lineView.line.gutterClass) {\n var wrap = ensureLineWrapped(lineView);\n lineView.gutterBackground = elt(\"div\", null, \"CodeMirror-gutter-background \" + lineView.line.gutterClass,\n (\"left: \" + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + \"px; width: \" + (dims.gutterTotalWidth) + \"px\"));\n cm.display.input.setUneditable(lineView.gutterBackground);\n wrap.insertBefore(lineView.gutterBackground, lineView.text);\n }\n var markers = lineView.line.gutterMarkers;\n if (cm.options.lineNumbers || markers) {\n var wrap$1 = ensureLineWrapped(lineView);\n var gutterWrap = lineView.gutter = elt(\"div\", null, \"CodeMirror-gutter-wrapper\", (\"left: \" + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + \"px\"));\n cm.display.input.setUneditable(gutterWrap);\n wrap$1.insertBefore(gutterWrap, lineView.text);\n if (lineView.line.gutterClass)\n { gutterWrap.className += \" \" + lineView.line.gutterClass; }\n if (cm.options.lineNumbers && (!markers || !markers[\"CodeMirror-linenumbers\"]))\n { lineView.lineNumber = gutterWrap.appendChild(\n elt(\"div\", lineNumberFor(cm.options, lineN),\n \"CodeMirror-linenumber CodeMirror-gutter-elt\",\n (\"left: \" + (dims.gutterLeft[\"CodeMirror-linenumbers\"]) + \"px; width: \" + (cm.display.lineNumInnerWidth) + \"px\"))); }\n if (markers) { for (var k = 0; k < cm.options.gutters.length; ++k) {\n var id = cm.options.gutters[k], found = markers.hasOwnProperty(id) && markers[id];\n if (found)\n { gutterWrap.appendChild(elt(\"div\", [found], \"CodeMirror-gutter-elt\",\n (\"left: \" + (dims.gutterLeft[id]) + \"px; width: \" + (dims.gutterWidth[id]) + \"px\"))); }\n } }\n }\n}\n\nfunction updateLineWidgets(cm, lineView, dims) {\n if (lineView.alignable) { lineView.alignable = null; }\n for (var node = lineView.node.firstChild, next = (void 0); node; node = next) {\n next = node.nextSibling;\n if (node.className == \"CodeMirror-linewidget\")\n { lineView.node.removeChild(node); }\n }\n insertLineWidgets(cm, lineView, dims);\n}\n\n// Build a line's DOM representation from scratch\nfunction buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) { lineView.bgClass = built.bgClass; }\n if (built.textClass) { lineView.textClass = built.textClass; }\n\n updateLineClasses(cm, lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(cm, lineView, dims);\n return lineView.node\n}\n\n// A lineView may contain multiple logical lines (when merged by\n// collapsed spans). The widgets for all of them need to be drawn.\nfunction insertLineWidgets(cm, lineView, dims) {\n insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);\n if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)\n { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false); } }\n}\n\nfunction insertLineWidgetsFor(cm, line, lineView, dims, allowAbove) {\n if (!line.widgets) { return }\n var wrap = ensureLineWrapped(lineView);\n for (var i = 0, ws = line.widgets; i < ws.length; ++i) {\n var widget = ws[i], node = elt(\"div\", [widget.node], \"CodeMirror-linewidget\");\n if (!widget.handleMouseEvents) { node.setAttribute(\"cm-ignore-events\", \"true\"); }\n positionLineWidget(widget, node, lineView, dims);\n cm.display.input.setUneditable(node);\n if (allowAbove && widget.above)\n { wrap.insertBefore(node, lineView.gutter || lineView.text); }\n else\n { wrap.appendChild(node); }\n signalLater(widget, \"redraw\");\n }\n}\n\nfunction positionLineWidget(widget, node, lineView, dims) {\n if (widget.noHScroll) {\n (lineView.alignable || (lineView.alignable = [])).push(node);\n var width = dims.wrapperWidth;\n node.style.left = dims.fixedPos + \"px\";\n if (!widget.coverGutter) {\n width -= dims.gutterTotalWidth;\n node.style.paddingLeft = dims.gutterTotalWidth + \"px\";\n }\n node.style.width = width + \"px\";\n }\n if (widget.coverGutter) {\n node.style.zIndex = 5;\n node.style.position = \"relative\";\n if (!widget.noHScroll) { node.style.marginLeft = -dims.gutterTotalWidth + \"px\"; }\n }\n}\n\nfunction widgetHeight(widget) {\n if (widget.height != null) { return widget.height }\n var cm = widget.doc.cm;\n if (!cm) { return 0 }\n if (!contains(document.body, widget.node)) {\n var parentStyle = \"position: relative;\";\n if (widget.coverGutter)\n { parentStyle += \"margin-left: -\" + cm.display.gutters.offsetWidth + \"px;\"; }\n if (widget.noHScroll)\n { parentStyle += \"width: \" + cm.display.wrapper.clientWidth + \"px;\"; }\n removeChildrenAndAdd(cm.display.measure, elt(\"div\", [widget.node], null, parentStyle));\n }\n return widget.height = widget.node.parentNode.offsetHeight\n}\n\n// Return true when the given mouse event happened in a widget\nfunction eventInWidget(display, e) {\n for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {\n if (!n || (n.nodeType == 1 && n.getAttribute(\"cm-ignore-events\") == \"true\") ||\n (n.parentNode == display.sizer && n != display.mover))\n { return true }\n }\n}\n\n// POSITION MEASUREMENT\n\nfunction paddingTop(display) {return display.lineSpace.offsetTop}\nfunction paddingVert(display) {return display.mover.offsetHeight - display.lineSpace.offsetHeight}\nfunction paddingH(display) {\n if (display.cachedPaddingH) { return display.cachedPaddingH }\n var e = removeChildrenAndAdd(display.measure, elt(\"pre\", \"x\"));\n var style = window.getComputedStyle ? window.getComputedStyle(e) : e.currentStyle;\n var data = {left: parseInt(style.paddingLeft), right: parseInt(style.paddingRight)};\n if (!isNaN(data.left) && !isNaN(data.right)) { display.cachedPaddingH = data; }\n return data\n}\n\nfunction scrollGap(cm) { return scrollerGap - cm.display.nativeBarWidth }\nfunction displayWidth(cm) {\n return cm.display.scroller.clientWidth - scrollGap(cm) - cm.display.barWidth\n}\nfunction displayHeight(cm) {\n return cm.display.scroller.clientHeight - scrollGap(cm) - cm.display.barHeight\n}\n\n// Ensure the lineView.wrapping.heights array is populated. This is\n// an array of bottom offsets for the lines that make up a drawn\n// line. When lineWrapping is on, there might be more than one\n// height.\nfunction ensureLineHeights(cm, lineView, rect) {\n var wrapping = cm.options.lineWrapping;\n var curWidth = wrapping && displayWidth(cm);\n if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {\n var heights = lineView.measure.heights = [];\n if (wrapping) {\n lineView.measure.width = curWidth;\n var rects = lineView.text.firstChild.getClientRects();\n for (var i = 0; i < rects.length - 1; i++) {\n var cur = rects[i], next = rects[i + 1];\n if (Math.abs(cur.bottom - next.bottom) > 2)\n { heights.push((cur.bottom + next.top) / 2 - rect.top); }\n }\n }\n heights.push(rect.bottom - rect.top);\n }\n}\n\n// Find a line map (mapping character offsets to text nodes) and a\n// measurement cache for the given line number. (A line view might\n// contain multiple lines when collapsed ranges are present.)\nfunction mapFromLineView(lineView, line, lineN) {\n if (lineView.line == line)\n { return {map: lineView.measure.map, cache: lineView.measure.cache} }\n for (var i = 0; i < lineView.rest.length; i++)\n { if (lineView.rest[i] == line)\n { return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } }\n for (var i$1 = 0; i$1 < lineView.rest.length; i$1++)\n { if (lineNo(lineView.rest[i$1]) > lineN)\n { return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } }\n}\n\n// Render a line into the hidden node display.externalMeasured. Used\n// when measurement is needed for a line that's not in the viewport.\nfunction updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view\n}\n\n// Get a {top, bottom, left, right} box (in line-local coordinates)\n// for a given character.\nfunction measureChar(cm, line, ch, bias) {\n return measureCharPrepared(cm, prepareMeasureForLine(cm, line), ch, bias)\n}\n\n// Find a line view that corresponds to the given line number.\nfunction findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n { return cm.display.view[findViewIndex(cm, lineN)] }\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n { return ext }\n}\n\n// Measurement can be split in two steps, the set-up work that\n// applies to the whole line, and the measurement of the actual\n// character. Functions like coordsChar, that need to do a lot of\n// measurements in a row, can thus ensure that the set-up work is\n// only done once.\nfunction prepareMeasureForLine(cm, line) {\n var lineN = lineNo(line);\n var view = findViewForLine(cm, lineN);\n if (view && !view.text) {\n view = null;\n } else if (view && view.changes) {\n updateLineForChanges(cm, view, lineN, getDimensions(cm));\n cm.curOp.forceUpdate = true;\n }\n if (!view)\n { view = updateExternalMeasurement(cm, line); }\n\n var info = mapFromLineView(view, line, lineN);\n return {\n line: line, view: view, rect: null,\n map: info.map, cache: info.cache, before: info.before,\n hasHeights: false\n }\n}\n\n// Given a prepared measurement object, measures the position of an\n// actual character (or fetches it from the cache).\nfunction measureCharPrepared(cm, prepared, ch, bias, varHeight) {\n if (prepared.before) { ch = -1; }\n var key = ch + (bias || \"\"), found;\n if (prepared.cache.hasOwnProperty(key)) {\n found = prepared.cache[key];\n } else {\n if (!prepared.rect)\n { prepared.rect = prepared.view.text.getBoundingClientRect(); }\n if (!prepared.hasHeights) {\n ensureLineHeights(cm, prepared.view, prepared.rect);\n prepared.hasHeights = true;\n }\n found = measureCharInner(cm, prepared, ch, bias);\n if (!found.bogus) { prepared.cache[key] = found; }\n }\n return {left: found.left, right: found.right,\n top: varHeight ? found.rtop : found.top,\n bottom: varHeight ? found.rbottom : found.bottom}\n}\n\nvar nullRect = {left: 0, right: 0, top: 0, bottom: 0};\n\nfunction nodeAndOffsetInLineMap(map$$1, ch, bias) {\n var node, start, end, collapse, mStart, mEnd;\n // First, search the line map for the text node corresponding to,\n // or closest to, the target character.\n for (var i = 0; i < map$$1.length; i += 3) {\n mStart = map$$1[i];\n mEnd = map$$1[i + 1];\n if (ch < mStart) {\n start = 0; end = 1;\n collapse = \"left\";\n } else if (ch < mEnd) {\n start = ch - mStart;\n end = start + 1;\n } else if (i == map$$1.length - 3 || ch == mEnd && map$$1[i + 3] > ch) {\n end = mEnd - mStart;\n start = end - 1;\n if (ch >= mEnd) { collapse = \"right\"; }\n }\n if (start != null) {\n node = map$$1[i + 2];\n if (mStart == mEnd && bias == (node.insertLeft ? \"left\" : \"right\"))\n { collapse = bias; }\n if (bias == \"left\" && start == 0)\n { while (i && map$$1[i - 2] == map$$1[i - 3] && map$$1[i - 1].insertLeft) {\n node = map$$1[(i -= 3) + 2];\n collapse = \"left\";\n } }\n if (bias == \"right\" && start == mEnd - mStart)\n { while (i < map$$1.length - 3 && map$$1[i + 3] == map$$1[i + 4] && !map$$1[i + 5].insertLeft) {\n node = map$$1[(i += 3) + 2];\n collapse = \"right\";\n } }\n break\n }\n }\n return {node: node, start: start, end: end, collapse: collapse, coverStart: mStart, coverEnd: mEnd}\n}\n\nfunction getUsefulRect(rects, bias) {\n var rect = nullRect;\n if (bias == \"left\") { for (var i = 0; i < rects.length; i++) {\n if ((rect = rects[i]).left != rect.right) { break }\n } } else { for (var i$1 = rects.length - 1; i$1 >= 0; i$1--) {\n if ((rect = rects[i$1]).left != rect.right) { break }\n } }\n return rect\n}\n\nfunction measureCharInner(cm, prepared, ch, bias) {\n var place = nodeAndOffsetInLineMap(prepared.map, ch, bias);\n var node = place.node, start = place.start, end = place.end, collapse = place.collapse;\n\n var rect;\n if (node.nodeType == 3) { // If it is a text node, use a range to retrieve the coordinates.\n for (var i$1 = 0; i$1 < 4; i$1++) { // Retry a maximum of 4 times when nonsense rectangles are returned\n while (start && isExtendingChar(prepared.line.text.charAt(place.coverStart + start))) { --start; }\n while (place.coverStart + end < place.coverEnd && isExtendingChar(prepared.line.text.charAt(place.coverStart + end))) { ++end; }\n if (ie && ie_version < 9 && start == 0 && end == place.coverEnd - place.coverStart)\n { rect = node.parentNode.getBoundingClientRect(); }\n else\n { rect = getUsefulRect(range(node, start, end).getClientRects(), bias); }\n if (rect.left || rect.right || start == 0) { break }\n end = start;\n start = start - 1;\n collapse = \"right\";\n }\n if (ie && ie_version < 11) { rect = maybeUpdateRectForZooming(cm.display.measure, rect); }\n } else { // If it is a widget, simply get the box for the whole widget.\n if (start > 0) { collapse = bias = \"right\"; }\n var rects;\n if (cm.options.lineWrapping && (rects = node.getClientRects()).length > 1)\n { rect = rects[bias == \"right\" ? rects.length - 1 : 0]; }\n else\n { rect = node.getBoundingClientRect(); }\n }\n if (ie && ie_version < 9 && !start && (!rect || !rect.left && !rect.right)) {\n var rSpan = node.parentNode.getClientRects()[0];\n if (rSpan)\n { rect = {left: rSpan.left, right: rSpan.left + charWidth(cm.display), top: rSpan.top, bottom: rSpan.bottom}; }\n else\n { rect = nullRect; }\n }\n\n var rtop = rect.top - prepared.rect.top, rbot = rect.bottom - prepared.rect.top;\n var mid = (rtop + rbot) / 2;\n var heights = prepared.view.measure.heights;\n var i = 0;\n for (; i < heights.length - 1; i++)\n { if (mid < heights[i]) { break } }\n var top = i ? heights[i - 1] : 0, bot = heights[i];\n var result = {left: (collapse == \"right\" ? rect.right : rect.left) - prepared.rect.left,\n right: (collapse == \"left\" ? rect.left : rect.right) - prepared.rect.left,\n top: top, bottom: bot};\n if (!rect.left && !rect.right) { result.bogus = true; }\n if (!cm.options.singleCursorHeightPerLine) { result.rtop = rtop; result.rbottom = rbot; }\n\n return result\n}\n\n// Work around problem with bounding client rects on ranges being\n// returned incorrectly when zoomed on IE10 and below.\nfunction maybeUpdateRectForZooming(measure, rect) {\n if (!window.screen || screen.logicalXDPI == null ||\n screen.logicalXDPI == screen.deviceXDPI || !hasBadZoomedRects(measure))\n { return rect }\n var scaleX = screen.logicalXDPI / screen.deviceXDPI;\n var scaleY = screen.logicalYDPI / screen.deviceYDPI;\n return {left: rect.left * scaleX, right: rect.right * scaleX,\n top: rect.top * scaleY, bottom: rect.bottom * scaleY}\n}\n\nfunction clearLineMeasurementCacheFor(lineView) {\n if (lineView.measure) {\n lineView.measure.cache = {};\n lineView.measure.heights = null;\n if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)\n { lineView.measure.caches[i] = {}; } }\n }\n}\n\nfunction clearLineMeasurementCache(cm) {\n cm.display.externalMeasure = null;\n removeChildren(cm.display.lineMeasure);\n for (var i = 0; i < cm.display.view.length; i++)\n { clearLineMeasurementCacheFor(cm.display.view[i]); }\n}\n\nfunction clearCaches(cm) {\n clearLineMeasurementCache(cm);\n cm.display.cachedCharWidth = cm.display.cachedTextHeight = cm.display.cachedPaddingH = null;\n if (!cm.options.lineWrapping) { cm.display.maxLineChanged = true; }\n cm.display.lineNumChars = null;\n}\n\nfunction pageScrollX() {\n // Work around https://bugs.chromium.org/p/chromium/issues/detail?id=489206\n // which causes page_Offset and bounding client rects to use\n // different reference viewports and invalidate our calculations.\n if (chrome && android) { return -(document.body.getBoundingClientRect().left - parseInt(getComputedStyle(document.body).marginLeft)) }\n return window.pageXOffset || (document.documentElement || document.body).scrollLeft\n}\nfunction pageScrollY() {\n if (chrome && android) { return -(document.body.getBoundingClientRect().top - parseInt(getComputedStyle(document.body).marginTop)) }\n return window.pageYOffset || (document.documentElement || document.body).scrollTop\n}\n\nfunction widgetTopHeight(lineObj) {\n var height = 0;\n if (lineObj.widgets) { for (var i = 0; i < lineObj.widgets.length; ++i) { if (lineObj.widgets[i].above)\n { height += widgetHeight(lineObj.widgets[i]); } } }\n return height\n}\n\n// Converts a {top, bottom, left, right} box from line-local\n// coordinates into another coordinate system. Context may be one of\n// \"line\", \"div\" (display.lineDiv), \"local\"./null (editor), \"window\",\n// or \"page\".\nfunction intoCoordSystem(cm, lineObj, rect, context, includeWidgets) {\n if (!includeWidgets) {\n var height = widgetTopHeight(lineObj);\n rect.top += height; rect.bottom += height;\n }\n if (context == \"line\") { return rect }\n if (!context) { context = \"local\"; }\n var yOff = heightAtLine(lineObj);\n if (context == \"local\") { yOff += paddingTop(cm.display); }\n else { yOff -= cm.display.viewOffset; }\n if (context == \"page\" || context == \"window\") {\n var lOff = cm.display.lineSpace.getBoundingClientRect();\n yOff += lOff.top + (context == \"window\" ? 0 : pageScrollY());\n var xOff = lOff.left + (context == \"window\" ? 0 : pageScrollX());\n rect.left += xOff; rect.right += xOff;\n }\n rect.top += yOff; rect.bottom += yOff;\n return rect\n}\n\n// Coverts a box from \"div\" coords to another coordinate system.\n// Context may be \"window\", \"page\", \"div\", or \"local\"./null.\nfunction fromCoordSystem(cm, coords, context) {\n if (context == \"div\") { return coords }\n var left = coords.left, top = coords.top;\n // First move into \"page\" coordinate system\n if (context == \"page\") {\n left -= pageScrollX();\n top -= pageScrollY();\n } else if (context == \"local\" || !context) {\n var localBox = cm.display.sizer.getBoundingClientRect();\n left += localBox.left;\n top += localBox.top;\n }\n\n var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();\n return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top}\n}\n\nfunction charCoords(cm, pos, context, lineObj, bias) {\n if (!lineObj) { lineObj = getLine(cm.doc, pos.line); }\n return intoCoordSystem(cm, lineObj, measureChar(cm, lineObj, pos.ch, bias), context)\n}\n\n// Returns a box for a given cursor position, which may have an\n// 'other' property containing the position of the secondary cursor\n// on a bidi boundary.\n// A cursor Pos(line, char, \"before\") is on the same visual line as `char - 1`\n// and after `char - 1` in writing order of `char - 1`\n// A cursor Pos(line, char, \"after\") is on the same visual line as `char`\n// and before `char` in writing order of `char`\n// Examples (upper-case letters are RTL, lower-case are LTR):\n// Pos(0, 1, ...)\n// before after\n// ab a|b a|b\n// aB a|B aB|\n// Ab |Ab A|b\n// AB B|A B|A\n// Every position after the last character on a line is considered to stick\n// to the last character on the line.\nfunction cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n}\n\n// Used to cheaply estimate the coordinates for a position. Used for\n// intermediate scroll updates.\nfunction estimateCoords(cm, pos) {\n var left = 0;\n pos = clipPos(cm.doc, pos);\n if (!cm.options.lineWrapping) { left = charWidth(cm.display) * pos.ch; }\n var lineObj = getLine(cm.doc, pos.line);\n var top = heightAtLine(lineObj) + paddingTop(cm.display);\n return {left: left, right: left, top: top, bottom: top + lineObj.height}\n}\n\n// Positions returned by coordsChar contain some extra information.\n// xRel is the relative x position of the input coordinates compared\n// to the found position (so xRel > 0 means the coordinates are to\n// the right of the character position, for example). When outside\n// is true, that means the coordinates lie outside the line's\n// vertical range.\nfunction PosWithInfo(line, ch, sticky, outside, xRel) {\n var pos = Pos(line, ch, sticky);\n pos.xRel = xRel;\n if (outside) { pos.outside = true; }\n return pos\n}\n\n// Compute the character position closest to the given coordinates.\n// Input must be lineSpace-local (\"div\" coordinate system).\nfunction coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var merged = collapsedSpanAtEnd(lineObj);\n var mergedPos = merged && merged.find(0, true);\n if (merged && (found.ch > mergedPos.from.ch || found.ch == mergedPos.from.ch && found.xRel > 0))\n { lineN = lineNo(lineObj = mergedPos.to.line); }\n else\n { return found }\n }\n}\n\nfunction wrappedLineExtent(cm, lineObj, preparedMeasure, y) {\n y -= widgetTopHeight(lineObj);\n var end = lineObj.text.length;\n var begin = findFirst(function (ch) { return measureCharPrepared(cm, preparedMeasure, ch - 1).bottom <= y; }, end, 0);\n end = findFirst(function (ch) { return measureCharPrepared(cm, preparedMeasure, ch).top > y; }, begin, end);\n return {begin: begin, end: end}\n}\n\nfunction wrappedLineExtentChar(cm, lineObj, preparedMeasure, target) {\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n var targetTop = intoCoordSystem(cm, lineObj, measureCharPrepared(cm, preparedMeasure, target), \"line\").top;\n return wrappedLineExtent(cm, lineObj, preparedMeasure, targetTop)\n}\n\n// Returns true if the given side of a box is after the given\n// coordinates, in top-to-bottom, left-to-right order.\nfunction boxIsAfter(box, x, y, left) {\n return box.bottom <= y ? false : box.top > y ? true : (left ? box.left : box.right) > x\n}\n\nfunction coordsCharInner(cm, lineObj, lineNo$$1, x, y) {\n // Move y into line-local coordinate space\n y -= heightAtLine(lineObj);\n var preparedMeasure = prepareMeasureForLine(cm, lineObj);\n // When directly calling `measureCharPrepared`, we have to adjust\n // for the widgets at this line.\n var widgetHeight$$1 = widgetTopHeight(lineObj);\n var begin = 0, end = lineObj.text.length, ltr = true;\n\n var order = getOrder(lineObj, cm.doc.direction);\n // If the line isn't plain left-to-right text, first figure out\n // which bidi section the coordinates fall into.\n if (order) {\n var part = (cm.options.lineWrapping ? coordsBidiPartWrapped : coordsBidiPart)\n (cm, lineObj, lineNo$$1, preparedMeasure, order, x, y);\n ltr = part.level != 1;\n // The awkward -1 offsets are needed because findFirst (called\n // on these below) will treat its first bound as inclusive,\n // second as exclusive, but we want to actually address the\n // characters in the part's range\n begin = ltr ? part.from : part.to - 1;\n end = ltr ? part.to : part.from - 1;\n }\n\n // A binary search to find the first character whose bounding box\n // starts after the coordinates. If we run across any whose box wrap\n // the coordinates, store that.\n var chAround = null, boxAround = null;\n var ch = findFirst(function (ch) {\n var box = measureCharPrepared(cm, preparedMeasure, ch);\n box.top += widgetHeight$$1; box.bottom += widgetHeight$$1;\n if (!boxIsAfter(box, x, y, false)) { return false }\n if (box.top <= y && box.left <= x) {\n chAround = ch;\n boxAround = box;\n }\n return true\n }, begin, end);\n\n var baseX, sticky, outside = false;\n // If a box around the coordinates was found, use that\n if (boxAround) {\n // Distinguish coordinates nearer to the left or right side of the box\n var atLeft = x - boxAround.left < boxAround.right - x, atStart = atLeft == ltr;\n ch = chAround + (atStart ? 0 : 1);\n sticky = atStart ? \"after\" : \"before\";\n baseX = atLeft ? boxAround.left : boxAround.right;\n } else {\n // (Adjust for extended bound, if necessary.)\n if (!ltr && (ch == end || ch == begin)) { ch++; }\n // To determine which side to associate with, get the box to the\n // left of the character and compare it's vertical position to the\n // coordinates\n sticky = ch == 0 ? \"after\" : ch == lineObj.text.length ? \"before\" :\n (measureCharPrepared(cm, preparedMeasure, ch - (ltr ? 1 : 0)).bottom + widgetHeight$$1 <= y) == ltr ?\n \"after\" : \"before\";\n // Now get accurate coordinates for this place, in order to get a\n // base X position\n var coords = cursorCoords(cm, Pos(lineNo$$1, ch, sticky), \"line\", lineObj, preparedMeasure);\n baseX = coords.left;\n outside = y < coords.top || y >= coords.bottom;\n }\n\n ch = skipExtendingChars(lineObj.text, ch, 1);\n return PosWithInfo(lineNo$$1, ch, sticky, outside, x - baseX)\n}\n\nfunction coordsBidiPart(cm, lineObj, lineNo$$1, preparedMeasure, order, x, y) {\n // Bidi parts are sorted left-to-right, and in a non-line-wrapping\n // situation, we can take this ordering to correspond to the visual\n // ordering. This finds the first part whose end is after the given\n // coordinates.\n var index = findFirst(function (i) {\n var part = order[i], ltr = part.level != 1;\n return boxIsAfter(cursorCoords(cm, Pos(lineNo$$1, ltr ? part.to : part.from, ltr ? \"before\" : \"after\"),\n \"line\", lineObj, preparedMeasure), x, y, true)\n }, 0, order.length - 1);\n var part = order[index];\n // If this isn't the first part, the part's start is also after\n // the coordinates, and the coordinates aren't on the same line as\n // that start, move one part back.\n if (index > 0) {\n var ltr = part.level != 1;\n var start = cursorCoords(cm, Pos(lineNo$$1, ltr ? part.from : part.to, ltr ? \"after\" : \"before\"),\n \"line\", lineObj, preparedMeasure);\n if (boxIsAfter(start, x, y, true) && start.top > y)\n { part = order[index - 1]; }\n }\n return part\n}\n\nfunction coordsBidiPartWrapped(cm, lineObj, _lineNo, preparedMeasure, order, x, y) {\n // In a wrapped line, rtl text on wrapping boundaries can do things\n // that don't correspond to the ordering in our `order` array at\n // all, so a binary search doesn't work, and we want to return a\n // part that only spans one line so that the binary search in\n // coordsCharInner is safe. As such, we first find the extent of the\n // wrapped line, and then do a flat search in which we discard any\n // spans that aren't on the line.\n var ref = wrappedLineExtent(cm, lineObj, preparedMeasure, y);\n var begin = ref.begin;\n var end = ref.end;\n if (/\\s/.test(lineObj.text.charAt(end - 1))) { end--; }\n var part = null, closestDist = null;\n for (var i = 0; i < order.length; i++) {\n var p = order[i];\n if (p.from >= end || p.to <= begin) { continue }\n var ltr = p.level != 1;\n var endX = measureCharPrepared(cm, preparedMeasure, ltr ? Math.min(end, p.to) - 1 : Math.max(begin, p.from)).right;\n // Weigh against spans ending before this, so that they are only\n // picked if nothing ends after\n var dist = endX < x ? x - endX + 1e9 : endX - x;\n if (!part || closestDist > dist) {\n part = p;\n closestDist = dist;\n }\n }\n if (!part) { part = order[order.length - 1]; }\n // Clip the part to the wrapped line.\n if (part.from < begin) { part = {from: begin, to: part.to, level: part.level}; }\n if (part.to > end) { part = {from: part.from, to: end, level: part.level}; }\n return part\n}\n\nvar measureText;\n// Compute the default text height.\nfunction textHeight(display) {\n if (display.cachedTextHeight != null) { return display.cachedTextHeight }\n if (measureText == null) {\n measureText = elt(\"pre\");\n // Measure a bunch of lines, for browsers that compute\n // fractional heights.\n for (var i = 0; i < 49; ++i) {\n measureText.appendChild(document.createTextNode(\"x\"));\n measureText.appendChild(elt(\"br\"));\n }\n measureText.appendChild(document.createTextNode(\"x\"));\n }\n removeChildrenAndAdd(display.measure, measureText);\n var height = measureText.offsetHeight / 50;\n if (height > 3) { display.cachedTextHeight = height; }\n removeChildren(display.measure);\n return height || 1\n}\n\n// Compute the default character width.\nfunction charWidth(display) {\n if (display.cachedCharWidth != null) { return display.cachedCharWidth }\n var anchor = elt(\"span\", \"xxxxxxxxxx\");\n var pre = elt(\"pre\", [anchor]);\n removeChildrenAndAdd(display.measure, pre);\n var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;\n if (width > 2) { display.cachedCharWidth = width; }\n return width || 10\n}\n\n// Do a bulk-read of the DOM positions and sizes needed to draw the\n// view, so that we don't interleave reading and writing to the DOM.\nfunction getDimensions(cm) {\n var d = cm.display, left = {}, width = {};\n var gutterLeft = d.gutters.clientLeft;\n for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {\n left[cm.options.gutters[i]] = n.offsetLeft + n.clientLeft + gutterLeft;\n width[cm.options.gutters[i]] = n.clientWidth;\n }\n return {fixedPos: compensateForHScroll(d),\n gutterTotalWidth: d.gutters.offsetWidth,\n gutterLeft: left,\n gutterWidth: width,\n wrapperWidth: d.wrapper.clientWidth}\n}\n\n// Computes display.scroller.scrollLeft + display.gutters.offsetWidth,\n// but using getBoundingClientRect to get a sub-pixel-accurate\n// result.\nfunction compensateForHScroll(display) {\n return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left\n}\n\n// Returns a function that estimates the height of a line, to use as\n// first approximation until the line becomes visible (and is thus\n// properly measurable).\nfunction estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function (line) {\n if (lineIsHidden(cm.doc, line)) { return 0 }\n\n var widgetsHeight = 0;\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }\n } }\n\n if (wrapping)\n { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }\n else\n { return widgetsHeight + th }\n }\n}\n\nfunction estimateLineHeights(cm) {\n var doc = cm.doc, est = estimateHeight(cm);\n doc.iter(function (line) {\n var estHeight = est(line);\n if (estHeight != line.height) { updateLineHeight(line, estHeight); }\n });\n}\n\n// Given a mouse event, find the corresponding position. If liberal\n// is false, it checks whether a gutter or scrollbar was clicked,\n// and returns null if it was. forRect is used by rectangular\n// selections, and tries to estimate a character position even for\n// coordinates beyond the right of the text.\nfunction posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") { return null }\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e) { return null }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords\n}\n\n// Find the view element corresponding to a given line. Return null\n// when the line isn't visible.\nfunction findViewIndex(cm, n) {\n if (n >= cm.display.viewTo) { return null }\n n -= cm.display.viewFrom;\n if (n < 0) { return null }\n var view = cm.display.view;\n for (var i = 0; i < view.length; i++) {\n n -= view[i].size;\n if (n < 0) { return i }\n }\n}\n\nfunction updateSelection(cm) {\n cm.display.input.showSelection(cm.display.input.prepareSelection());\n}\n\nfunction prepareSelection(cm, primary) {\n if ( primary === void 0 ) primary = true;\n\n var doc = cm.doc, result = {};\n var curFragment = result.cursors = document.createDocumentFragment();\n var selFragment = result.selection = document.createDocumentFragment();\n\n for (var i = 0; i < doc.sel.ranges.length; i++) {\n if (!primary && i == doc.sel.primIndex) { continue }\n var range$$1 = doc.sel.ranges[i];\n if (range$$1.from().line >= cm.display.viewTo || range$$1.to().line < cm.display.viewFrom) { continue }\n var collapsed = range$$1.empty();\n if (collapsed || cm.options.showCursorWhenSelecting)\n { drawSelectionCursor(cm, range$$1.head, curFragment); }\n if (!collapsed)\n { drawSelectionRange(cm, range$$1, selFragment); }\n }\n return result\n}\n\n// Draws a cursor for the given range\nfunction drawSelectionCursor(cm, head, output) {\n var pos = cursorCoords(cm, head, \"div\", null, null, !cm.options.singleCursorHeightPerLine);\n\n var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"));\n cursor.style.left = pos.left + \"px\";\n cursor.style.top = pos.top + \"px\";\n cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n\n if (pos.other) {\n // Secondary cursor, shown when on a 'jump' in bi-directional text\n var otherCursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor CodeMirror-secondarycursor\"));\n otherCursor.style.display = \"\";\n otherCursor.style.left = pos.other.left + \"px\";\n otherCursor.style.top = pos.other.top + \"px\";\n otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n }\n}\n\nfunction cmpCoords(a, b) { return a.top - b.top || a.left - b.left }\n\n// Draws the given range as a highlighted selection\nfunction drawSelectionRange(cm, range$$1, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n var docLTR = doc.direction == \"ltr\";\n\n function add(left, top, width, bottom) {\n if (top < 0) { top = 0; }\n top = Math.round(top);\n bottom = Math.round(bottom);\n fragment.appendChild(elt(\"div\", null, \"CodeMirror-selected\", (\"position: absolute; left: \" + left + \"px;\\n top: \" + top + \"px; width: \" + (width == null ? rightSide - left : width) + \"px;\\n height: \" + (bottom - top) + \"px\")));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n }\n\n function wrapX(pos, dir, side) {\n var extent = wrappedLineExtentChar(cm, lineObj, null, pos);\n var prop = (dir == \"ltr\") == (side == \"after\") ? \"left\" : \"right\";\n var ch = side == \"after\" ? extent.begin : extent.end - (/\\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);\n return coords(ch, prop)[prop]\n }\n\n var order = getOrder(lineObj, doc.direction);\n iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {\n var ltr = dir == \"ltr\";\n var fromPos = coords(from, ltr ? \"left\" : \"right\");\n var toPos = coords(to - 1, ltr ? \"right\" : \"left\");\n\n var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;\n var first = i == 0, last = !order || i == order.length - 1;\n if (toPos.top - fromPos.top <= 3) { // Single line\n var openLeft = (docLTR ? openStart : openEnd) && first;\n var openRight = (docLTR ? openEnd : openStart) && last;\n var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;\n var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;\n add(left, fromPos.top, right - left, fromPos.bottom);\n } else { // Multiple lines\n var topLeft, topRight, botLeft, botRight;\n if (ltr) {\n topLeft = docLTR && openStart && first ? leftSide : fromPos.left;\n topRight = docLTR ? rightSide : wrapX(from, dir, \"before\");\n botLeft = docLTR ? leftSide : wrapX(to, dir, \"after\");\n botRight = docLTR && openEnd && last ? rightSide : toPos.right;\n } else {\n topLeft = !docLTR ? leftSide : wrapX(from, dir, \"before\");\n topRight = !docLTR && openStart && first ? rightSide : fromPos.right;\n botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;\n botRight = !docLTR ? rightSide : wrapX(to, dir, \"after\");\n }\n add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);\n if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }\n add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);\n }\n\n if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }\n if (cmpCoords(toPos, start) < 0) { start = toPos; }\n if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }\n if (cmpCoords(toPos, end) < 0) { end = toPos; }\n });\n return {start: start, end: end}\n }\n\n var sFrom = range$$1.from(), sTo = range$$1.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n { add(leftSide, leftEnd.bottom, null, rightStart.top); }\n }\n\n output.appendChild(fragment);\n}\n\n// Cursor-blinking\nfunction restartBlink(cm) {\n if (!cm.state.focused) { return }\n var display = cm.display;\n clearInterval(display.blinker);\n var on = true;\n display.cursorDiv.style.visibility = \"\";\n if (cm.options.cursorBlinkRate > 0)\n { display.blinker = setInterval(function () { return display.cursorDiv.style.visibility = (on = !on) ? \"\" : \"hidden\"; },\n cm.options.cursorBlinkRate); }\n else if (cm.options.cursorBlinkRate < 0)\n { display.cursorDiv.style.visibility = \"hidden\"; }\n}\n\nfunction ensureFocus(cm) {\n if (!cm.state.focused) { cm.display.input.focus(); onFocus(cm); }\n}\n\nfunction delayBlurEvent(cm) {\n cm.state.delayingBlurEvent = true;\n setTimeout(function () { if (cm.state.delayingBlurEvent) {\n cm.state.delayingBlurEvent = false;\n onBlur(cm);\n } }, 100);\n}\n\nfunction onFocus(cm, e) {\n if (cm.state.delayingBlurEvent) { cm.state.delayingBlurEvent = false; }\n\n if (cm.options.readOnly == \"nocursor\") { return }\n if (!cm.state.focused) {\n signal(cm, \"focus\", cm, e);\n cm.state.focused = true;\n addClass(cm.display.wrapper, \"CodeMirror-focused\");\n // This test prevents this from firing when a context\n // menu is closed (since the input reset would kill the\n // select-all detection hack)\n if (!cm.curOp && cm.display.selForContextMenu != cm.doc.sel) {\n cm.display.input.reset();\n if (webkit) { setTimeout(function () { return cm.display.input.reset(true); }, 20); } // Issue #1730\n }\n cm.display.input.receivedFocus();\n }\n restartBlink(cm);\n}\nfunction onBlur(cm, e) {\n if (cm.state.delayingBlurEvent) { return }\n\n if (cm.state.focused) {\n signal(cm, \"blur\", cm, e);\n cm.state.focused = false;\n rmClass(cm.display.wrapper, \"CodeMirror-focused\");\n }\n clearInterval(cm.display.blinker);\n setTimeout(function () { if (!cm.state.focused) { cm.display.shift = false; } }, 150);\n}\n\n// Read the actual heights of the rendered lines, and update their\n// stored heights to match.\nfunction updateHeightsInViewport(cm) {\n var display = cm.display;\n var prevBottom = display.lineDiv.offsetTop;\n for (var i = 0; i < display.view.length; i++) {\n var cur = display.view[i], height = (void 0);\n if (cur.hidden) { continue }\n if (ie && ie_version < 8) {\n var bot = cur.node.offsetTop + cur.node.offsetHeight;\n height = bot - prevBottom;\n prevBottom = bot;\n } else {\n var box = cur.node.getBoundingClientRect();\n height = box.bottom - box.top;\n }\n var diff = cur.line.height - height;\n if (height < 2) { height = textHeight(display); }\n if (diff > .005 || diff < -.005) {\n updateLineHeight(cur.line, height);\n updateWidgetHeight(cur.line);\n if (cur.rest) { for (var j = 0; j < cur.rest.length; j++)\n { updateWidgetHeight(cur.rest[j]); } }\n }\n }\n}\n\n// Read and store the height of line widgets associated with the\n// given line.\nfunction updateWidgetHeight(line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i)\n { line.widgets[i].height = line.widgets[i].node.parentNode.offsetHeight; } }\n}\n\n// Compute the lines that are visible in a given viewport (defaults\n// the the current scroll position). viewport may contain top,\n// height, and ensure (see op.scrollToPos) properties.\nfunction visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n}\n\n// Re-align line numbers and gutter marks to compensate for\n// horizontal scrolling.\nfunction alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n}\n\n// Used to ensure that the line number gutter is still the right\n// size for the current document size. Returns true when an update\n// is needed.\nfunction maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) { return false }\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm);\n return true\n }\n return false\n}\n\n// SCROLLING THINGS INTO VIEW\n\n// If an editor sits on the top or bottom of the window, partially\n// scrolled out of view, this ensures that the cursor is visible.\nfunction maybeScrollWindow(cm, rect) {\n if (signalDOMEvent(cm, \"scrollCursorIntoView\")) { return }\n\n var display = cm.display, box = display.sizer.getBoundingClientRect(), doScroll = null;\n if (rect.top + box.top < 0) { doScroll = true; }\n else if (rect.bottom + box.top > (window.innerHeight || document.documentElement.clientHeight)) { doScroll = false; }\n if (doScroll != null && !phantom) {\n var scrollNode = elt(\"div\", \"\\u200b\", null, (\"position: absolute;\\n top: \" + (rect.top - display.viewOffset - paddingTop(cm.display)) + \"px;\\n height: \" + (rect.bottom - rect.top + scrollGap(cm) + display.barHeight) + \"px;\\n left: \" + (rect.left) + \"px; width: \" + (Math.max(2, rect.right - rect.left)) + \"px;\"));\n cm.display.lineSpace.appendChild(scrollNode);\n scrollNode.scrollIntoView(doScroll);\n cm.display.lineSpace.removeChild(scrollNode);\n }\n}\n\n// Scroll a given position into view (immediately), verifying that\n// it actually became visible (as line heights are accurately\n// measured, the position of something may 'drift' during drawing).\nfunction scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) { margin = 0; }\n var rect;\n if (!cm.options.lineWrapping && pos == end) {\n // Set pos and end to the cursor positions around the character pos sticks to\n // If pos.sticky == \"before\", that is around pos.ch - 1, otherwise around pos.ch\n // If pos == Pos(_, 0, \"before\"), pos and end are unchanged\n pos = pos.ch ? Pos(pos.line, pos.sticky == \"before\" ? pos.ch - 1 : pos.ch, \"after\") : pos;\n end = pos.sticky == \"before\" ? Pos(pos.line, pos.ch + 1, \"before\") : pos;\n }\n for (var limit = 0; limit < 5; limit++) {\n var changed = false;\n var coords = cursorCoords(cm, pos);\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n rect = {left: Math.min(coords.left, endCoords.left),\n top: Math.min(coords.top, endCoords.top) - margin,\n right: Math.max(coords.left, endCoords.left),\n bottom: Math.max(coords.bottom, endCoords.bottom) + margin};\n var scrollPos = calculateScrollPos(cm, rect);\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n if (scrollPos.scrollTop != null) {\n updateScrollTop(cm, scrollPos.scrollTop);\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }\n }\n if (!changed) { break }\n }\n return rect\n}\n\n// Scroll a given set of coordinates into view (immediately).\nfunction scrollIntoView(cm, rect) {\n var scrollPos = calculateScrollPos(cm, rect);\n if (scrollPos.scrollTop != null) { updateScrollTop(cm, scrollPos.scrollTop); }\n if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft); }\n}\n\n// Calculate a new scroll position needed to scroll the given\n// rectangle into view. Returns an object with scrollTop and\n// scrollLeft properties. When these are undefined, the\n// vertical/horizontal position does not need to be adjusted.\nfunction calculateScrollPos(cm, rect) {\n var display = cm.display, snapMargin = textHeight(cm.display);\n if (rect.top < 0) { rect.top = 0; }\n var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;\n var screen = displayHeight(cm), result = {};\n if (rect.bottom - rect.top > screen) { rect.bottom = rect.top + screen; }\n var docBottom = cm.doc.height + paddingVert(display);\n var atTop = rect.top < snapMargin, atBottom = rect.bottom > docBottom - snapMargin;\n if (rect.top < screentop) {\n result.scrollTop = atTop ? 0 : rect.top;\n } else if (rect.bottom > screentop + screen) {\n var newTop = Math.min(rect.top, (atBottom ? docBottom : rect.bottom) - screen);\n if (newTop != screentop) { result.scrollTop = newTop; }\n }\n\n var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft;\n var screenw = displayWidth(cm) - (cm.options.fixedGutter ? display.gutters.offsetWidth : 0);\n var tooWide = rect.right - rect.left > screenw;\n if (tooWide) { rect.right = rect.left + screenw; }\n if (rect.left < 10)\n { result.scrollLeft = 0; }\n else if (rect.left < screenleft)\n { result.scrollLeft = Math.max(0, rect.left - (tooWide ? 0 : 10)); }\n else if (rect.right > screenw + screenleft - 3)\n { result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw; }\n return result\n}\n\n// Store a relative adjustment to the scroll position in the current\n// operation (to be applied when the operation finishes).\nfunction addToScrollTop(cm, top) {\n if (top == null) { return }\n resolveScrollToPos(cm);\n cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top;\n}\n\n// Make sure that at the end of the operation the current cursor is\n// shown.\nfunction ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor();\n cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin};\n}\n\nfunction scrollToCoords(cm, x, y) {\n if (x != null || y != null) { resolveScrollToPos(cm); }\n if (x != null) { cm.curOp.scrollLeft = x; }\n if (y != null) { cm.curOp.scrollTop = y; }\n}\n\nfunction scrollToRange(cm, range$$1) {\n resolveScrollToPos(cm);\n cm.curOp.scrollToPos = range$$1;\n}\n\n// When an operation has its scrollToPos property set, and another\n// scroll action is applied before the end of the operation, this\n// 'simulates' scrolling that position into view in a cheap way, so\n// that the effect of intermediate scroll commands is not ignored.\nfunction resolveScrollToPos(cm) {\n var range$$1 = cm.curOp.scrollToPos;\n if (range$$1) {\n cm.curOp.scrollToPos = null;\n var from = estimateCoords(cm, range$$1.from), to = estimateCoords(cm, range$$1.to);\n scrollToCoordsRange(cm, from, to, range$$1.margin);\n }\n}\n\nfunction scrollToCoordsRange(cm, from, to, margin) {\n var sPos = calculateScrollPos(cm, {\n left: Math.min(from.left, to.left),\n top: Math.min(from.top, to.top) - margin,\n right: Math.max(from.right, to.right),\n bottom: Math.max(from.bottom, to.bottom) + margin\n });\n scrollToCoords(cm, sPos.scrollLeft, sPos.scrollTop);\n}\n\n// Sync the scrollable area and scrollbars, ensure the viewport\n// covers the visible area.\nfunction updateScrollTop(cm, val) {\n if (Math.abs(cm.doc.scrollTop - val) < 2) { return }\n if (!gecko) { updateDisplaySimple(cm, {top: val}); }\n setScrollTop(cm, val, true);\n if (gecko) { updateDisplaySimple(cm); }\n startWorker(cm, 100);\n}\n\nfunction setScrollTop(cm, val, forceScroll) {\n val = Math.min(cm.display.scroller.scrollHeight - cm.display.scroller.clientHeight, val);\n if (cm.display.scroller.scrollTop == val && !forceScroll) { return }\n cm.doc.scrollTop = val;\n cm.display.scrollbars.setScrollTop(val);\n if (cm.display.scroller.scrollTop != val) { cm.display.scroller.scrollTop = val; }\n}\n\n// Sync scroller and scrollbar, ensure the gutter elements are\n// aligned.\nfunction setScrollLeft(cm, val, isScroller, forceScroll) {\n val = Math.min(val, cm.display.scroller.scrollWidth - cm.display.scroller.clientWidth);\n if ((isScroller ? val == cm.doc.scrollLeft : Math.abs(cm.doc.scrollLeft - val) < 2) && !forceScroll) { return }\n cm.doc.scrollLeft = val;\n alignHorizontally(cm);\n if (cm.display.scroller.scrollLeft != val) { cm.display.scroller.scrollLeft = val; }\n cm.display.scrollbars.setScrollLeft(val);\n}\n\n// SCROLLBARS\n\n// Prepare DOM reads needed to update the scrollbars. Done in one\n// shot to minimize update/measure roundtrips.\nfunction measureForScrollbars(cm) {\n var d = cm.display, gutterW = d.gutters.offsetWidth;\n var docH = Math.round(cm.doc.height + paddingVert(cm.display));\n return {\n clientHeight: d.scroller.clientHeight,\n viewHeight: d.wrapper.clientHeight,\n scrollWidth: d.scroller.scrollWidth, clientWidth: d.scroller.clientWidth,\n viewWidth: d.wrapper.clientWidth,\n barLeft: cm.options.fixedGutter ? gutterW : 0,\n docHeight: docH,\n scrollHeight: docH + scrollGap(cm) + d.barHeight,\n nativeBarWidth: d.nativeBarWidth,\n gutterWidth: gutterW\n }\n}\n\nvar NativeScrollbars = function(place, scroll, cm) {\n this.cm = cm;\n var vert = this.vert = elt(\"div\", [elt(\"div\", null, null, \"min-width: 1px\")], \"CodeMirror-vscrollbar\");\n var horiz = this.horiz = elt(\"div\", [elt(\"div\", null, null, \"height: 100%; min-height: 1px\")], \"CodeMirror-hscrollbar\");\n place(vert); place(horiz);\n\n on(vert, \"scroll\", function () {\n if (vert.clientHeight) { scroll(vert.scrollTop, \"vertical\"); }\n });\n on(horiz, \"scroll\", function () {\n if (horiz.clientWidth) { scroll(horiz.scrollLeft, \"horizontal\"); }\n });\n\n this.checkedZeroWidth = false;\n // Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8).\n if (ie && ie_version < 8) { this.horiz.style.minHeight = this.vert.style.minWidth = \"18px\"; }\n};\n\nNativeScrollbars.prototype.update = function (measure) {\n var needsH = measure.scrollWidth > measure.clientWidth + 1;\n var needsV = measure.scrollHeight > measure.clientHeight + 1;\n var sWidth = measure.nativeBarWidth;\n\n if (needsV) {\n this.vert.style.display = \"block\";\n this.vert.style.bottom = needsH ? sWidth + \"px\" : \"0\";\n var totalHeight = measure.viewHeight - (needsH ? sWidth : 0);\n // A bug in IE8 can cause this value to be negative, so guard it.\n this.vert.firstChild.style.height =\n Math.max(0, measure.scrollHeight - measure.clientHeight + totalHeight) + \"px\";\n } else {\n this.vert.style.display = \"\";\n this.vert.firstChild.style.height = \"0\";\n }\n\n if (needsH) {\n this.horiz.style.display = \"block\";\n this.horiz.style.right = needsV ? sWidth + \"px\" : \"0\";\n this.horiz.style.left = measure.barLeft + \"px\";\n var totalWidth = measure.viewWidth - measure.barLeft - (needsV ? sWidth : 0);\n this.horiz.firstChild.style.width =\n Math.max(0, measure.scrollWidth - measure.clientWidth + totalWidth) + \"px\";\n } else {\n this.horiz.style.display = \"\";\n this.horiz.firstChild.style.width = \"0\";\n }\n\n if (!this.checkedZeroWidth && measure.clientHeight > 0) {\n if (sWidth == 0) { this.zeroWidthHack(); }\n this.checkedZeroWidth = true;\n }\n\n return {right: needsV ? sWidth : 0, bottom: needsH ? sWidth : 0}\n};\n\nNativeScrollbars.prototype.setScrollLeft = function (pos) {\n if (this.horiz.scrollLeft != pos) { this.horiz.scrollLeft = pos; }\n if (this.disableHoriz) { this.enableZeroWidthBar(this.horiz, this.disableHoriz, \"horiz\"); }\n};\n\nNativeScrollbars.prototype.setScrollTop = function (pos) {\n if (this.vert.scrollTop != pos) { this.vert.scrollTop = pos; }\n if (this.disableVert) { this.enableZeroWidthBar(this.vert, this.disableVert, \"vert\"); }\n};\n\nNativeScrollbars.prototype.zeroWidthHack = function () {\n var w = mac && !mac_geMountainLion ? \"12px\" : \"18px\";\n this.horiz.style.height = this.vert.style.width = w;\n this.horiz.style.pointerEvents = this.vert.style.pointerEvents = \"none\";\n this.disableHoriz = new Delayed;\n this.disableVert = new Delayed;\n};\n\nNativeScrollbars.prototype.enableZeroWidthBar = function (bar, delay, type) {\n bar.style.pointerEvents = \"auto\";\n function maybeDisable() {\n // To find out whether the scrollbar is still visible, we\n // check whether the element under the pixel in the bottom\n // right corner of the scrollbar box is the scrollbar box\n // itself (when the bar is still visible) or its filler child\n // (when the bar is hidden). If it is still visible, we keep\n // it enabled, if it's hidden, we disable pointer events.\n var box = bar.getBoundingClientRect();\n var elt$$1 = type == \"vert\" ? document.elementFromPoint(box.right - 1, (box.top + box.bottom) / 2)\n : document.elementFromPoint((box.right + box.left) / 2, box.bottom - 1);\n if (elt$$1 != bar) { bar.style.pointerEvents = \"none\"; }\n else { delay.set(1000, maybeDisable); }\n }\n delay.set(1000, maybeDisable);\n};\n\nNativeScrollbars.prototype.clear = function () {\n var parent = this.horiz.parentNode;\n parent.removeChild(this.horiz);\n parent.removeChild(this.vert);\n};\n\nvar NullScrollbars = function () {};\n\nNullScrollbars.prototype.update = function () { return {bottom: 0, right: 0} };\nNullScrollbars.prototype.setScrollLeft = function () {};\nNullScrollbars.prototype.setScrollTop = function () {};\nNullScrollbars.prototype.clear = function () {};\n\nfunction updateScrollbars(cm, measure) {\n if (!measure) { measure = measureForScrollbars(cm); }\n var startWidth = cm.display.barWidth, startHeight = cm.display.barHeight;\n updateScrollbarsInner(cm, measure);\n for (var i = 0; i < 4 && startWidth != cm.display.barWidth || startHeight != cm.display.barHeight; i++) {\n if (startWidth != cm.display.barWidth && cm.options.lineWrapping)\n { updateHeightsInViewport(cm); }\n updateScrollbarsInner(cm, measureForScrollbars(cm));\n startWidth = cm.display.barWidth; startHeight = cm.display.barHeight;\n }\n}\n\n// Re-synchronize the fake scrollbars with the actual size of the\n// content.\nfunction updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n}\n\nvar scrollbarModel = {\"native\": NativeScrollbars, \"null\": NullScrollbars};\n\nfunction initScrollbars(cm) {\n if (cm.display.scrollbars) {\n cm.display.scrollbars.clear();\n if (cm.display.scrollbars.addClass)\n { rmClass(cm.display.wrapper, cm.display.scrollbars.addClass); }\n }\n\n cm.display.scrollbars = new scrollbarModel[cm.options.scrollbarStyle](function (node) {\n cm.display.wrapper.insertBefore(node, cm.display.scrollbarFiller);\n // Prevent clicks in the scrollbars from killing focus\n on(node, \"mousedown\", function () {\n if (cm.state.focused) { setTimeout(function () { return cm.display.input.focus(); }, 0); }\n });\n node.setAttribute(\"cm-not-content\", \"true\");\n }, function (pos, axis) {\n if (axis == \"horizontal\") { setScrollLeft(cm, pos); }\n else { updateScrollTop(cm, pos); }\n }, cm);\n if (cm.display.scrollbars.addClass)\n { addClass(cm.display.wrapper, cm.display.scrollbars.addClass); }\n}\n\n// Operations are used to wrap a series of changes to the editor\n// state in such a way that each change won't have to update the\n// cursor and display (which would be awkward, slow, and\n// error-prone). Instead, display updates are batched and then all\n// combined and executed at once.\n\nvar nextOpId = 0;\n// Start a new operation.\nfunction startOperation(cm) {\n cm.curOp = {\n cm: cm,\n viewChanged: false, // Flag that indicates that lines might need to be redrawn\n startHeight: cm.doc.height, // Used to detect need to update scrollbar\n forceUpdate: false, // Used to force a redraw\n updateInput: null, // Whether to reset the input textarea\n typing: false, // Whether this reset should be careful to leave existing text (for compositing)\n changeObjs: null, // Accumulated changes, for firing change events\n cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on\n cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already\n selectionChanged: false, // Whether the selection needs to be redrawn\n updateMaxLine: false, // Set when the widest line needs to be determined anew\n scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet\n scrollToPos: null, // Used to scroll to a specific position\n focus: false,\n id: ++nextOpId // Unique ID\n };\n pushOperation(cm.curOp);\n}\n\n// Finish an operation, updating the display and signalling delayed events\nfunction endOperation(cm) {\n var op = cm.curOp;\n finishOperation(op, function (group) {\n for (var i = 0; i < group.ops.length; i++)\n { group.ops[i].cm.curOp = null; }\n endOperations(group);\n });\n}\n\n// The DOM updates done when an operation finishes are batched so\n// that the minimum number of relayouts are required.\nfunction endOperations(group) {\n var ops = group.ops;\n for (var i = 0; i < ops.length; i++) // Read DOM\n { endOperation_R1(ops[i]); }\n for (var i$1 = 0; i$1 < ops.length; i$1++) // Write DOM (maybe)\n { endOperation_W1(ops[i$1]); }\n for (var i$2 = 0; i$2 < ops.length; i$2++) // Read DOM\n { endOperation_R2(ops[i$2]); }\n for (var i$3 = 0; i$3 < ops.length; i$3++) // Write DOM (maybe)\n { endOperation_W2(ops[i$3]); }\n for (var i$4 = 0; i$4 < ops.length; i$4++) // Read DOM\n { endOperation_finish(ops[i$4]); }\n}\n\nfunction endOperation_R1(op) {\n var cm = op.cm, display = cm.display;\n maybeClipScrollbars(cm);\n if (op.updateMaxLine) { findMaxLine(cm); }\n\n op.mustUpdate = op.viewChanged || op.forceUpdate || op.scrollTop != null ||\n op.scrollToPos && (op.scrollToPos.from.line < display.viewFrom ||\n op.scrollToPos.to.line >= display.viewTo) ||\n display.maxLineChanged && cm.options.lineWrapping;\n op.update = op.mustUpdate &&\n new DisplayUpdate(cm, op.mustUpdate && {top: op.scrollTop, ensure: op.scrollToPos}, op.forceUpdate);\n}\n\nfunction endOperation_W1(op) {\n op.updatedDisplay = op.mustUpdate && updateDisplayIfNeeded(op.cm, op.update);\n}\n\nfunction endOperation_R2(op) {\n var cm = op.cm, display = cm.display;\n if (op.updatedDisplay) { updateHeightsInViewport(cm); }\n\n op.barMeasure = measureForScrollbars(cm);\n\n // If the max line changed since it was last measured, measure it,\n // and ensure the document's width matches it.\n // updateDisplay_W2 will use these properties to do the actual resizing\n if (display.maxLineChanged && !cm.options.lineWrapping) {\n op.adjustWidthTo = measureChar(cm, display.maxLine, display.maxLine.text.length).left + 3;\n cm.display.sizerWidth = op.adjustWidthTo;\n op.barMeasure.scrollWidth =\n Math.max(display.scroller.clientWidth, display.sizer.offsetLeft + op.adjustWidthTo + scrollGap(cm) + cm.display.barWidth);\n op.maxScrollLeft = Math.max(0, display.sizer.offsetLeft + op.adjustWidthTo - displayWidth(cm));\n }\n\n if (op.updatedDisplay || op.selectionChanged)\n { op.preparedSelection = display.input.prepareSelection(); }\n}\n\nfunction endOperation_W2(op) {\n var cm = op.cm;\n\n if (op.adjustWidthTo != null) {\n cm.display.sizer.style.minWidth = op.adjustWidthTo + \"px\";\n if (op.maxScrollLeft < cm.doc.scrollLeft)\n { setScrollLeft(cm, Math.min(cm.display.scroller.scrollLeft, op.maxScrollLeft), true); }\n cm.display.maxLineChanged = false;\n }\n\n var takeFocus = op.focus && op.focus == activeElt();\n if (op.preparedSelection)\n { cm.display.input.showSelection(op.preparedSelection, takeFocus); }\n if (op.updatedDisplay || op.startHeight != cm.doc.height)\n { updateScrollbars(cm, op.barMeasure); }\n if (op.updatedDisplay)\n { setDocumentHeight(cm, op.barMeasure); }\n\n if (op.selectionChanged) { restartBlink(cm); }\n\n if (cm.state.focused && op.updateInput)\n { cm.display.input.reset(op.typing); }\n if (takeFocus) { ensureFocus(op.cm); }\n}\n\nfunction endOperation_finish(op) {\n var cm = op.cm, display = cm.display, doc = cm.doc;\n\n if (op.updatedDisplay) { postUpdateDisplay(cm, op.update); }\n\n // Abort mouse wheel delta measurement, when scrolling explicitly\n if (display.wheelStartX != null && (op.scrollTop != null || op.scrollLeft != null || op.scrollToPos))\n { display.wheelStartX = display.wheelStartY = null; }\n\n // Propagate the scroll position to the actual DOM scroller\n if (op.scrollTop != null) { setScrollTop(cm, op.scrollTop, op.forceScroll); }\n\n if (op.scrollLeft != null) { setScrollLeft(cm, op.scrollLeft, true, true); }\n // If we need to scroll a specific position into view, do so.\n if (op.scrollToPos) {\n var rect = scrollPosIntoView(cm, clipPos(doc, op.scrollToPos.from),\n clipPos(doc, op.scrollToPos.to), op.scrollToPos.margin);\n maybeScrollWindow(cm, rect);\n }\n\n // Fire events for markers that are hidden/unidden by editing or\n // undoing\n var hidden = op.maybeHiddenMarkers, unhidden = op.maybeUnhiddenMarkers;\n if (hidden) { for (var i = 0; i < hidden.length; ++i)\n { if (!hidden[i].lines.length) { signal(hidden[i], \"hide\"); } } }\n if (unhidden) { for (var i$1 = 0; i$1 < unhidden.length; ++i$1)\n { if (unhidden[i$1].lines.length) { signal(unhidden[i$1], \"unhide\"); } } }\n\n if (display.wrapper.offsetHeight)\n { doc.scrollTop = cm.display.scroller.scrollTop; }\n\n // Fire change events, and delayed event handlers\n if (op.changeObjs)\n { signal(cm, \"changes\", cm, op.changeObjs); }\n if (op.update)\n { op.update.finish(); }\n}\n\n// Run the given function in an operation\nfunction runInOp(cm, f) {\n if (cm.curOp) { return f() }\n startOperation(cm);\n try { return f() }\n finally { endOperation(cm); }\n}\n// Wraps a function in an operation. Returns the wrapped function.\nfunction operation(cm, f) {\n return function() {\n if (cm.curOp) { return f.apply(cm, arguments) }\n startOperation(cm);\n try { return f.apply(cm, arguments) }\n finally { endOperation(cm); }\n }\n}\n// Used to add methods to editor and doc instances, wrapping them in\n// operations.\nfunction methodOp(f) {\n return function() {\n if (this.curOp) { return f.apply(this, arguments) }\n startOperation(this);\n try { return f.apply(this, arguments) }\n finally { endOperation(this); }\n }\n}\nfunction docMethodOp(f) {\n return function() {\n var cm = this.cm;\n if (!cm || cm.curOp) { return f.apply(this, arguments) }\n startOperation(cm);\n try { return f.apply(this, arguments) }\n finally { endOperation(cm); }\n }\n}\n\n// Updates the display.view data structure for a given change to the\n// document. From and to are in pre-change coordinates. Lendiff is\n// the amount of lines added or subtracted by the change. This is\n// used for changes that span multiple lines, or change the way\n// lines are divided into visual lines. regLineChange (below)\n// registers single-line changes.\nfunction regChange(cm, from, to, lendiff) {\n if (from == null) { from = cm.doc.first; }\n if (to == null) { to = cm.doc.first + cm.doc.size; }\n if (!lendiff) { lendiff = 0; }\n\n var display = cm.display;\n if (lendiff && to < display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers > from))\n { display.updateLineNumbers = from; }\n\n cm.curOp.viewChanged = true;\n\n if (from >= display.viewTo) { // Change after\n if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)\n { resetView(cm); }\n } else if (to <= display.viewFrom) { // Change before\n if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {\n resetView(cm);\n } else {\n display.viewFrom += lendiff;\n display.viewTo += lendiff;\n }\n } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap\n resetView(cm);\n } else if (from <= display.viewFrom) { // Top overlap\n var cut = viewCuttingPoint(cm, to, to + lendiff, 1);\n if (cut) {\n display.view = display.view.slice(cut.index);\n display.viewFrom = cut.lineN;\n display.viewTo += lendiff;\n } else {\n resetView(cm);\n }\n } else if (to >= display.viewTo) { // Bottom overlap\n var cut$1 = viewCuttingPoint(cm, from, from, -1);\n if (cut$1) {\n display.view = display.view.slice(0, cut$1.index);\n display.viewTo = cut$1.lineN;\n } else {\n resetView(cm);\n }\n } else { // Gap in the middle\n var cutTop = viewCuttingPoint(cm, from, from, -1);\n var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1);\n if (cutTop && cutBot) {\n display.view = display.view.slice(0, cutTop.index)\n .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))\n .concat(display.view.slice(cutBot.index));\n display.viewTo += lendiff;\n } else {\n resetView(cm);\n }\n }\n\n var ext = display.externalMeasured;\n if (ext) {\n if (to < ext.lineN)\n { ext.lineN += lendiff; }\n else if (from < ext.lineN + ext.size)\n { display.externalMeasured = null; }\n }\n}\n\n// Register a change to a single line. Type must be one of \"text\",\n// \"gutter\", \"class\", \"widget\"\nfunction regLineChange(cm, line, type) {\n cm.curOp.viewChanged = true;\n var display = cm.display, ext = cm.display.externalMeasured;\n if (ext && line >= ext.lineN && line < ext.lineN + ext.size)\n { display.externalMeasured = null; }\n\n if (line < display.viewFrom || line >= display.viewTo) { return }\n var lineView = display.view[findViewIndex(cm, line)];\n if (lineView.node == null) { return }\n var arr = lineView.changes || (lineView.changes = []);\n if (indexOf(arr, type) == -1) { arr.push(type); }\n}\n\n// Clear the view.\nfunction resetView(cm) {\n cm.display.viewFrom = cm.display.viewTo = cm.doc.first;\n cm.display.view = [];\n cm.display.viewOffset = 0;\n}\n\nfunction viewCuttingPoint(cm, oldN, newN, dir) {\n var index = findViewIndex(cm, oldN), diff, view = cm.display.view;\n if (!sawCollapsedSpans || newN == cm.doc.first + cm.doc.size)\n { return {index: index, lineN: newN} }\n var n = cm.display.viewFrom;\n for (var i = 0; i < index; i++)\n { n += view[i].size; }\n if (n != oldN) {\n if (dir > 0) {\n if (index == view.length - 1) { return null }\n diff = (n + view[index].size) - oldN;\n index++;\n } else {\n diff = n - oldN;\n }\n oldN += diff; newN += diff;\n }\n while (visualLineNo(cm.doc, newN) != newN) {\n if (index == (dir < 0 ? 0 : view.length - 1)) { return null }\n newN += dir * view[index - (dir < 0 ? 1 : 0)].size;\n index += dir;\n }\n return {index: index, lineN: newN}\n}\n\n// Force the view to cover a given range, adding empty view element\n// or clipping off existing ones as needed.\nfunction adjustView(cm, from, to) {\n var display = cm.display, view = display.view;\n if (view.length == 0 || from >= display.viewTo || to <= display.viewFrom) {\n display.view = buildViewArray(cm, from, to);\n display.viewFrom = from;\n } else {\n if (display.viewFrom > from)\n { display.view = buildViewArray(cm, from, display.viewFrom).concat(display.view); }\n else if (display.viewFrom < from)\n { display.view = display.view.slice(findViewIndex(cm, from)); }\n display.viewFrom = from;\n if (display.viewTo < to)\n { display.view = display.view.concat(buildViewArray(cm, display.viewTo, to)); }\n else if (display.viewTo > to)\n { display.view = display.view.slice(0, findViewIndex(cm, to)); }\n }\n display.viewTo = to;\n}\n\n// Count the number of lines in the view whose DOM representation is\n// out of date (or nonexistent).\nfunction countDirtyView(cm) {\n var view = cm.display.view, dirty = 0;\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i];\n if (!lineView.hidden && (!lineView.node || lineView.changes)) { ++dirty; }\n }\n return dirty\n}\n\n// HIGHLIGHT WORKER\n\nfunction startWorker(cm, time) {\n if (cm.doc.highlightFrontier < cm.display.viewTo)\n { cm.state.highlight.set(time, bind(highlightWorker, cm)); }\n}\n\nfunction highlightWorker(cm) {\n var doc = cm.doc;\n if (doc.highlightFrontier >= cm.display.viewTo) { return }\n var end = +new Date + cm.options.workTime;\n var context = getContextBefore(cm, doc.highlightFrontier);\n var changedLines = [];\n\n doc.iter(context.line, Math.min(doc.first + doc.size, cm.display.viewTo + 500), function (line) {\n if (context.line >= cm.display.viewFrom) { // Visible\n var oldStyles = line.styles;\n var resetState = line.text.length > cm.options.maxHighlightLength ? copyState(doc.mode, context.state) : null;\n var highlighted = highlightLine(cm, line, context, true);\n if (resetState) { context.state = resetState; }\n line.styles = highlighted.styles;\n var oldCls = line.styleClasses, newCls = highlighted.classes;\n if (newCls) { line.styleClasses = newCls; }\n else if (oldCls) { line.styleClasses = null; }\n var ischange = !oldStyles || oldStyles.length != line.styles.length ||\n oldCls != newCls && (!oldCls || !newCls || oldCls.bgClass != newCls.bgClass || oldCls.textClass != newCls.textClass);\n for (var i = 0; !ischange && i < oldStyles.length; ++i) { ischange = oldStyles[i] != line.styles[i]; }\n if (ischange) { changedLines.push(context.line); }\n line.stateAfter = context.save();\n context.nextLine();\n } else {\n if (line.text.length <= cm.options.maxHighlightLength)\n { processLine(cm, line.text, context); }\n line.stateAfter = context.line % 5 == 0 ? context.save() : null;\n context.nextLine();\n }\n if (+new Date > end) {\n startWorker(cm, cm.options.workDelay);\n return true\n }\n });\n doc.highlightFrontier = context.line;\n doc.modeFrontier = Math.max(doc.modeFrontier, context.line);\n if (changedLines.length) { runInOp(cm, function () {\n for (var i = 0; i < changedLines.length; i++)\n { regLineChange(cm, changedLines[i], \"text\"); }\n }); }\n}\n\n// DISPLAY DRAWING\n\nvar DisplayUpdate = function(cm, viewport, force) {\n var display = cm.display;\n\n this.viewport = viewport;\n // Store some values that we'll need later (but don't want to force a relayout for)\n this.visible = visibleLines(display, cm.doc, viewport);\n this.editorIsHidden = !display.wrapper.offsetWidth;\n this.wrapperHeight = display.wrapper.clientHeight;\n this.wrapperWidth = display.wrapper.clientWidth;\n this.oldDisplayWidth = displayWidth(cm);\n this.force = force;\n this.dims = getDimensions(cm);\n this.events = [];\n};\n\nDisplayUpdate.prototype.signal = function (emitter, type) {\n if (hasHandler(emitter, type))\n { this.events.push(arguments); }\n};\nDisplayUpdate.prototype.finish = function () {\n var this$1 = this;\n\n for (var i = 0; i < this.events.length; i++)\n { signal.apply(null, this$1.events[i]); }\n};\n\nfunction maybeClipScrollbars(cm) {\n var display = cm.display;\n if (!display.scrollbarsClipped && display.scroller.offsetWidth) {\n display.nativeBarWidth = display.scroller.offsetWidth - display.scroller.clientWidth;\n display.heightForcer.style.height = scrollGap(cm) + \"px\";\n display.sizer.style.marginBottom = -display.nativeBarWidth + \"px\";\n display.sizer.style.borderRightWidth = scrollGap(cm) + \"px\";\n display.scrollbarsClipped = true;\n }\n}\n\nfunction selectionSnapshot(cm) {\n if (cm.hasFocus()) { return null }\n var active = activeElt();\n if (!active || !contains(cm.display.lineDiv, active)) { return null }\n var result = {activeElt: active};\n if (window.getSelection) {\n var sel = window.getSelection();\n if (sel.anchorNode && sel.extend && contains(cm.display.lineDiv, sel.anchorNode)) {\n result.anchorNode = sel.anchorNode;\n result.anchorOffset = sel.anchorOffset;\n result.focusNode = sel.focusNode;\n result.focusOffset = sel.focusOffset;\n }\n }\n return result\n}\n\nfunction restoreSelection(snapshot) {\n if (!snapshot || !snapshot.activeElt || snapshot.activeElt == activeElt()) { return }\n snapshot.activeElt.focus();\n if (snapshot.anchorNode && contains(document.body, snapshot.anchorNode) && contains(document.body, snapshot.focusNode)) {\n var sel = window.getSelection(), range$$1 = document.createRange();\n range$$1.setEnd(snapshot.anchorNode, snapshot.anchorOffset);\n range$$1.collapse(false);\n sel.removeAllRanges();\n sel.addRange(range$$1);\n sel.extend(snapshot.focusNode, snapshot.focusOffset);\n }\n}\n\n// Does the actual updating of the line display. Bails out\n// (returning false) when there is nothing to be done and forced is\n// false.\nfunction updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n}\n\nfunction postUpdateDisplay(cm, update) {\n var viewport = update.viewport;\n\n for (var first = true;; first = false) {\n if (!first || !cm.options.lineWrapping || update.oldDisplayWidth == displayWidth(cm)) {\n // Clip forced viewport to actual scrollable area.\n if (viewport && viewport.top != null)\n { viewport = {top: Math.min(cm.doc.height + paddingVert(cm.display) - displayHeight(cm), viewport.top)}; }\n // Updated line heights might result in the drawn area not\n // actually covering the viewport. Keep looping until it does.\n update.visible = visibleLines(cm.display, cm.doc, viewport);\n if (update.visible.from >= cm.display.viewFrom && update.visible.to <= cm.display.viewTo)\n { break }\n }\n if (!updateDisplayIfNeeded(cm, update)) { break }\n updateHeightsInViewport(cm);\n var barMeasure = measureForScrollbars(cm);\n updateSelection(cm);\n updateScrollbars(cm, barMeasure);\n setDocumentHeight(cm, barMeasure);\n update.force = false;\n }\n\n update.signal(cm, \"update\", cm);\n if (cm.display.viewFrom != cm.display.reportedViewFrom || cm.display.viewTo != cm.display.reportedViewTo) {\n update.signal(cm, \"viewportChange\", cm, cm.display.viewFrom, cm.display.viewTo);\n cm.display.reportedViewFrom = cm.display.viewFrom; cm.display.reportedViewTo = cm.display.viewTo;\n }\n}\n\nfunction updateDisplaySimple(cm, viewport) {\n var update = new DisplayUpdate(cm, viewport);\n if (updateDisplayIfNeeded(cm, update)) {\n updateHeightsInViewport(cm);\n postUpdateDisplay(cm, update);\n var barMeasure = measureForScrollbars(cm);\n updateSelection(cm);\n updateScrollbars(cm, barMeasure);\n setDocumentHeight(cm, barMeasure);\n update.finish();\n }\n}\n\n// Sync the actual display DOM structure with display.view, removing\n// nodes for lines that are no longer in view, and creating the ones\n// that are not there yet, and updating the ones that are out of\n// date.\nfunction patchDisplay(cm, updateNumbersFrom, dims) {\n var display = cm.display, lineNumbers = cm.options.lineNumbers;\n var container = display.lineDiv, cur = container.firstChild;\n\n function rm(node) {\n var next = node.nextSibling;\n // Works around a throw-scroll bug in OS X Webkit\n if (webkit && mac && cm.display.currentWheelTarget == node)\n { node.style.display = \"none\"; }\n else\n { node.parentNode.removeChild(node); }\n return next\n }\n\n var view = display.view, lineN = display.viewFrom;\n // Loop over the elements in the view, syncing cur (the DOM nodes\n // in display.lineDiv) with the view as we go.\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i];\n if (lineView.hidden) {\n } else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet\n var node = buildLineElement(cm, lineView, lineN, dims);\n container.insertBefore(node, cur);\n } else { // Already drawn\n while (cur != lineView.node) { cur = rm(cur); }\n var updateNumber = lineNumbers && updateNumbersFrom != null &&\n updateNumbersFrom <= lineN && lineView.lineNumber;\n if (lineView.changes) {\n if (indexOf(lineView.changes, \"gutter\") > -1) { updateNumber = false; }\n updateLineForChanges(cm, lineView, lineN, dims);\n }\n if (updateNumber) {\n removeChildren(lineView.lineNumber);\n lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)));\n }\n cur = lineView.node.nextSibling;\n }\n lineN += lineView.size;\n }\n while (cur) { cur = rm(cur); }\n}\n\nfunction updateGutterSpace(cm) {\n var width = cm.display.gutters.offsetWidth;\n cm.display.sizer.style.marginLeft = width + \"px\";\n}\n\nfunction setDocumentHeight(cm, measure) {\n cm.display.sizer.style.minHeight = measure.docHeight + \"px\";\n cm.display.heightForcer.style.top = measure.docHeight + \"px\";\n cm.display.gutters.style.height = (measure.docHeight + cm.display.barHeight + scrollGap(cm)) + \"px\";\n}\n\n// Rebuild the gutter elements, ensure the margin to the left of the\n// code matches their width.\nfunction updateGutters(cm) {\n var gutters = cm.display.gutters, specs = cm.options.gutters;\n removeChildren(gutters);\n var i = 0;\n for (; i < specs.length; ++i) {\n var gutterClass = specs[i];\n var gElt = gutters.appendChild(elt(\"div\", null, \"CodeMirror-gutter \" + gutterClass));\n if (gutterClass == \"CodeMirror-linenumbers\") {\n cm.display.lineGutter = gElt;\n gElt.style.width = (cm.display.lineNumWidth || 1) + \"px\";\n }\n }\n gutters.style.display = i ? \"\" : \"none\";\n updateGutterSpace(cm);\n}\n\n// Make sure the gutters options contains the element\n// \"CodeMirror-linenumbers\" when the lineNumbers option is true.\nfunction setGuttersForLineNumbers(options) {\n var found = indexOf(options.gutters, \"CodeMirror-linenumbers\");\n if (found == -1 && options.lineNumbers) {\n options.gutters = options.gutters.concat([\"CodeMirror-linenumbers\"]);\n } else if (found > -1 && !options.lineNumbers) {\n options.gutters = options.gutters.slice(0);\n options.gutters.splice(found, 1);\n }\n}\n\n// Since the delta values reported on mouse wheel events are\n// unstandardized between browsers and even browser versions, and\n// generally horribly unpredictable, this code starts by measuring\n// the scroll effect that the first few mouse wheel events have,\n// and, from that, detects the way it can convert deltas to pixel\n// offsets afterwards.\n//\n// The reason we want to know the amount a wheel event will scroll\n// is that it gives us a chance to update the display before the\n// actual scrolling happens, reducing flickering.\n\nvar wheelSamples = 0;\nvar wheelPixelsPerUnit = null;\n// Fill in a browser-detected starting value on browsers where we\n// know one. These don't have to be accurate -- the result of them\n// being wrong would just be a slight flicker on the first wheel\n// scroll (if it is large enough).\nif (ie) { wheelPixelsPerUnit = -.53; }\nelse if (gecko) { wheelPixelsPerUnit = 15; }\nelse if (chrome) { wheelPixelsPerUnit = -.7; }\nelse if (safari) { wheelPixelsPerUnit = -1/3; }\n\nfunction wheelEventDelta(e) {\n var dx = e.wheelDeltaX, dy = e.wheelDeltaY;\n if (dx == null && e.detail && e.axis == e.HORIZONTAL_AXIS) { dx = e.detail; }\n if (dy == null && e.detail && e.axis == e.VERTICAL_AXIS) { dy = e.detail; }\n else if (dy == null) { dy = e.wheelDelta; }\n return {x: dx, y: dy}\n}\nfunction wheelEventPixels(e) {\n var delta = wheelEventDelta(e);\n delta.x *= wheelPixelsPerUnit;\n delta.y *= wheelPixelsPerUnit;\n return delta\n}\n\nfunction onScrollWheel(cm, e) {\n var delta = wheelEventDelta(e), dx = delta.x, dy = delta.y;\n\n var display = cm.display, scroll = display.scroller;\n // Quit if there's nothing to scroll here\n var canScrollX = scroll.scrollWidth > scroll.clientWidth;\n var canScrollY = scroll.scrollHeight > scroll.clientHeight;\n if (!(dx && canScrollX || dy && canScrollY)) { return }\n\n // Webkit browsers on OS X abort momentum scrolls when the target\n // of the scroll event is removed from the scrollable element.\n // This hack (see related code in patchDisplay) makes sure the\n // element is kept around.\n if (dy && mac && webkit) {\n outer: for (var cur = e.target, view = display.view; cur != scroll; cur = cur.parentNode) {\n for (var i = 0; i < view.length; i++) {\n if (view[i].node == cur) {\n cm.display.currentWheelTarget = cur;\n break outer\n }\n }\n }\n }\n\n // On some browsers, horizontal scrolling will cause redraws to\n // happen before the gutter has been realigned, causing it to\n // wriggle around in a most unseemly way. When we have an\n // estimated pixels/delta value, we just handle horizontal\n // scrolling entirely here. It'll be slightly off from native, but\n // better than glitching out.\n if (dx && !gecko && !presto && wheelPixelsPerUnit != null) {\n if (dy && canScrollY)\n { updateScrollTop(cm, Math.max(0, scroll.scrollTop + dy * wheelPixelsPerUnit)); }\n setScrollLeft(cm, Math.max(0, scroll.scrollLeft + dx * wheelPixelsPerUnit));\n // Only prevent default scrolling if vertical scrolling is\n // actually possible. Otherwise, it causes vertical scroll\n // jitter on OSX trackpads when deltaX is small and deltaY\n // is large (issue #3579)\n if (!dy || (dy && canScrollY))\n { e_preventDefault(e); }\n display.wheelStartX = null; // Abort measurement, if in progress\n return\n }\n\n // 'Project' the visible viewport to cover the area that is being\n // scrolled into view (if we know enough to estimate it).\n if (dy && wheelPixelsPerUnit != null) {\n var pixels = dy * wheelPixelsPerUnit;\n var top = cm.doc.scrollTop, bot = top + display.wrapper.clientHeight;\n if (pixels < 0) { top = Math.max(0, top + pixels - 50); }\n else { bot = Math.min(cm.doc.height, bot + pixels + 50); }\n updateDisplaySimple(cm, {top: top, bottom: bot});\n }\n\n if (wheelSamples < 20) {\n if (display.wheelStartX == null) {\n display.wheelStartX = scroll.scrollLeft; display.wheelStartY = scroll.scrollTop;\n display.wheelDX = dx; display.wheelDY = dy;\n setTimeout(function () {\n if (display.wheelStartX == null) { return }\n var movedX = scroll.scrollLeft - display.wheelStartX;\n var movedY = scroll.scrollTop - display.wheelStartY;\n var sample = (movedY && display.wheelDY && movedY / display.wheelDY) ||\n (movedX && display.wheelDX && movedX / display.wheelDX);\n display.wheelStartX = display.wheelStartY = null;\n if (!sample) { return }\n wheelPixelsPerUnit = (wheelPixelsPerUnit * wheelSamples + sample) / (wheelSamples + 1);\n ++wheelSamples;\n }, 200);\n } else {\n display.wheelDX += dx; display.wheelDY += dy;\n }\n }\n}\n\n// Selection objects are immutable. A new one is created every time\n// the selection changes. A selection is one or more non-overlapping\n// (and non-touching) ranges, sorted, and an integer that indicates\n// which one is the primary selection (the one that's scrolled into\n// view, that getCursor returns, etc).\nvar Selection = function(ranges, primIndex) {\n this.ranges = ranges;\n this.primIndex = primIndex;\n};\n\nSelection.prototype.primary = function () { return this.ranges[this.primIndex] };\n\nSelection.prototype.equals = function (other) {\n var this$1 = this;\n\n if (other == this) { return true }\n if (other.primIndex != this.primIndex || other.ranges.length != this.ranges.length) { return false }\n for (var i = 0; i < this.ranges.length; i++) {\n var here = this$1.ranges[i], there = other.ranges[i];\n if (!equalCursorPos(here.anchor, there.anchor) || !equalCursorPos(here.head, there.head)) { return false }\n }\n return true\n};\n\nSelection.prototype.deepCopy = function () {\n var this$1 = this;\n\n var out = [];\n for (var i = 0; i < this.ranges.length; i++)\n { out[i] = new Range(copyPos(this$1.ranges[i].anchor), copyPos(this$1.ranges[i].head)); }\n return new Selection(out, this.primIndex)\n};\n\nSelection.prototype.somethingSelected = function () {\n var this$1 = this;\n\n for (var i = 0; i < this.ranges.length; i++)\n { if (!this$1.ranges[i].empty()) { return true } }\n return false\n};\n\nSelection.prototype.contains = function (pos, end) {\n var this$1 = this;\n\n if (!end) { end = pos; }\n for (var i = 0; i < this.ranges.length; i++) {\n var range = this$1.ranges[i];\n if (cmp(end, range.from()) >= 0 && cmp(pos, range.to()) <= 0)\n { return i }\n }\n return -1\n};\n\nvar Range = function(anchor, head) {\n this.anchor = anchor; this.head = head;\n};\n\nRange.prototype.from = function () { return minPos(this.anchor, this.head) };\nRange.prototype.to = function () { return maxPos(this.anchor, this.head) };\nRange.prototype.empty = function () { return this.head.line == this.anchor.line && this.head.ch == this.anchor.ch };\n\n// Take an unsorted, potentially overlapping set of ranges, and\n// build a selection out of it. 'Consumes' ranges array (modifying\n// it).\nfunction normalizeSelection(ranges, primIndex) {\n var prim = ranges[primIndex];\n ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n if (cmp(prev.to(), cur.from()) >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) { --primIndex; }\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex)\n}\n\nfunction simpleSelection(anchor, head) {\n return new Selection([new Range(anchor, head || anchor)], 0)\n}\n\n// Compute the position of the end of a change (its 'to' property\n// refers to the pre-change end).\nfunction changeEnd(change) {\n if (!change.text) { return change.to }\n return Pos(change.from.line + change.text.length - 1,\n lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))\n}\n\n// Adjust a position to refer to the post-change position of the\n// same text, or the end of the change if the change covers it.\nfunction adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) { return pos }\n if (cmp(pos, change.to) <= 0) { return changeEnd(change) }\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }\n return Pos(line, ch)\n}\n\nfunction computeSelAfterChange(doc, change) {\n var out = [];\n for (var i = 0; i < doc.sel.ranges.length; i++) {\n var range = doc.sel.ranges[i];\n out.push(new Range(adjustForChange(range.anchor, change),\n adjustForChange(range.head, change)));\n }\n return normalizeSelection(out, doc.sel.primIndex)\n}\n\nfunction offsetPos(pos, old, nw) {\n if (pos.line == old.line)\n { return Pos(nw.line, pos.ch - old.ch + nw.ch) }\n else\n { return Pos(nw.line + (pos.line - old.line), pos.ch) }\n}\n\n// Used by replaceSelections to allow moving the selection to the\n// start or around the replaced test. Hint may be \"start\" or \"around\".\nfunction computeReplacedSel(doc, changes, hint) {\n var out = [];\n var oldPrev = Pos(doc.first, 0), newPrev = oldPrev;\n for (var i = 0; i < changes.length; i++) {\n var change = changes[i];\n var from = offsetPos(change.from, oldPrev, newPrev);\n var to = offsetPos(changeEnd(change), oldPrev, newPrev);\n oldPrev = change.to;\n newPrev = to;\n if (hint == \"around\") {\n var range = doc.sel.ranges[i], inv = cmp(range.head, range.anchor) < 0;\n out[i] = new Range(inv ? to : from, inv ? from : to);\n } else {\n out[i] = new Range(from, from);\n }\n }\n return new Selection(out, doc.sel.primIndex)\n}\n\n// Used to get the editor into a consistent state again when options change.\n\nfunction loadMode(cm) {\n cm.doc.mode = getMode(cm.options, cm.doc.modeOption);\n resetModeState(cm);\n}\n\nfunction resetModeState(cm) {\n cm.doc.iter(function (line) {\n if (line.stateAfter) { line.stateAfter = null; }\n if (line.styles) { line.styles = null; }\n });\n cm.doc.modeFrontier = cm.doc.highlightFrontier = cm.doc.first;\n startWorker(cm, 100);\n cm.state.modeGen++;\n if (cm.curOp) { regChange(cm); }\n}\n\n// DOCUMENT DATA STRUCTURE\n\n// By default, updates that start and end at the beginning of a line\n// are treated specially, in order to make the association of line\n// widgets and marker elements with the text behave more intuitive.\nfunction isWholeLineUpdate(doc, change) {\n return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == \"\" &&\n (!doc.cm || doc.cm.options.wholeLineUpdateBefore)\n}\n\n// Perform a change on the document data structure.\nfunction updateDoc(doc, change, markedSpans, estimateHeight$$1) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight$$1);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight$$1)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight$$1));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n}\n\n// Call f for all linked documents.\nfunction linkedDocs(doc, f, sharedHistOnly) {\n function propagate(doc, skip, sharedHist) {\n if (doc.linked) { for (var i = 0; i < doc.linked.length; ++i) {\n var rel = doc.linked[i];\n if (rel.doc == skip) { continue }\n var shared = sharedHist && rel.sharedHist;\n if (sharedHistOnly && !shared) { continue }\n f(rel.doc, shared);\n propagate(rel.doc, doc, shared);\n } }\n }\n propagate(doc, null, true);\n}\n\n// Attach a document to an editor.\nfunction attachDoc(cm, doc) {\n if (doc.cm) { throw new Error(\"This document is already in use.\") }\n cm.doc = doc;\n doc.cm = cm;\n estimateLineHeights(cm);\n loadMode(cm);\n setDirectionClass(cm);\n if (!cm.options.lineWrapping) { findMaxLine(cm); }\n cm.options.mode = doc.modeOption;\n regChange(cm);\n}\n\nfunction setDirectionClass(cm) {\n (cm.doc.direction == \"rtl\" ? addClass : rmClass)(cm.display.lineDiv, \"CodeMirror-rtl\");\n}\n\nfunction directionChanged(cm) {\n runInOp(cm, function () {\n setDirectionClass(cm);\n regChange(cm);\n });\n}\n\nfunction History(startGen) {\n // Arrays of change events and selections. Doing something adds an\n // event to done and clears undo. Undoing moves events from done\n // to undone, redoing moves them in the other direction.\n this.done = []; this.undone = [];\n this.undoDepth = Infinity;\n // Used to track when changes can be merged into a single undo\n // event\n this.lastModTime = this.lastSelTime = 0;\n this.lastOp = this.lastSelOp = null;\n this.lastOrigin = this.lastSelOrigin = null;\n // Used by the isClean() method\n this.generation = this.maxGeneration = startGen || 1;\n}\n\n// Create a history change event from an updateDoc-style change\n// object.\nfunction historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n}\n\n// Pop all selection events off the end of a history array. Stop at\n// a change event.\nfunction clearSelectionEvents(array) {\n while (array.length) {\n var last = lst(array);\n if (last.ranges) { array.pop(); }\n else { break }\n }\n}\n\n// Find the top change event in the history. Pop off selection\n// events that are in the way.\nfunction lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done)\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done)\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done)\n }\n}\n\n// Register a change in the history. Merges changes that are within\n// a single operation, or are close together with an origin that\n// allows merging (starting with \"+\") into a single event.\nfunction addChangeToHistory(doc, change, selAfter, opId) {\n var hist = doc.history;\n hist.undone.length = 0;\n var time = +new Date, cur;\n var last;\n\n if ((hist.lastOp == opId ||\n hist.lastOrigin == change.origin && change.origin &&\n ((change.origin.charAt(0) == \"+\" && doc.cm && hist.lastModTime > time - doc.cm.options.historyEventDelay) ||\n change.origin.charAt(0) == \"*\")) &&\n (cur = lastChangeEvent(hist, hist.lastOp == opId))) {\n // Merge this change into the last event\n last = lst(cur.changes);\n if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {\n // Optimized case for simple insertion -- don't want to add\n // new changesets for every character typed\n last.to = changeEnd(change);\n } else {\n // Add new sub-event\n cur.changes.push(historyChangeFromChange(doc, change));\n }\n } else {\n // Can not be merged, start a new event.\n var before = lst(hist.done);\n if (!before || !before.ranges)\n { pushSelectionToHistory(doc.sel, hist.done); }\n cur = {changes: [historyChangeFromChange(doc, change)],\n generation: hist.generation};\n hist.done.push(cur);\n while (hist.done.length > hist.undoDepth) {\n hist.done.shift();\n if (!hist.done[0].ranges) { hist.done.shift(); }\n }\n }\n hist.done.push(selAfter);\n hist.generation = ++hist.maxGeneration;\n hist.lastModTime = hist.lastSelTime = time;\n hist.lastOp = hist.lastSelOp = opId;\n hist.lastOrigin = hist.lastSelOrigin = change.origin;\n\n if (!last) { signal(doc, \"historyAdded\"); }\n}\n\nfunction selectionEventCanBeMerged(doc, origin, prev, sel) {\n var ch = origin.charAt(0);\n return ch == \"*\" ||\n ch == \"+\" &&\n prev.ranges.length == sel.ranges.length &&\n prev.somethingSelected() == sel.somethingSelected() &&\n new Date - doc.history.lastSelTime <= (doc.cm ? doc.cm.options.historyEventDelay : 500)\n}\n\n// Called whenever the selection changes, sets the new selection as\n// the pending selection in the history, and pushes the old pending\n// selection into the 'done' array when it was significantly\n// different (in number of selected ranges, emptiness, or time).\nfunction addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n { hist.done[hist.done.length - 1] = sel; }\n else\n { pushSelectionToHistory(sel, hist.done); }\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false)\n { clearSelectionEvents(hist.undone); }\n}\n\nfunction pushSelectionToHistory(sel, dest) {\n var top = lst(dest);\n if (!(top && top.ranges && top.equals(sel)))\n { dest.push(sel); }\n}\n\n// Used to store marked span information in the history.\nfunction attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n}\n\n// When un/re-doing restores text containing marked spans, those\n// that have been explicitly cleared should not be restored.\nfunction removeClearedSpans(spans) {\n if (!spans) { return null }\n var out;\n for (var i = 0; i < spans.length; ++i) {\n if (spans[i].marker.explicitlyCleared) { if (!out) { out = spans.slice(0, i); } }\n else if (out) { out.push(spans[i]); }\n }\n return !out ? spans : out.length ? out : null\n}\n\n// Retrieve and filter the old marked spans stored in a change event.\nfunction getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) { return null }\n var nw = [];\n for (var i = 0; i < change.text.length; ++i)\n { nw.push(removeClearedSpans(found[i])); }\n return nw\n}\n\n// Used for un/re-doing changes from the history. Combines the\n// result of computing the existing spans with the set of spans that\n// existed in the history (so that deleting around a span and then\n// undoing brings back the span).\nfunction mergeOldSpans(doc, change) {\n var old = getOldSpans(doc, change);\n var stretched = stretchSpansOverChange(doc, change);\n if (!old) { return stretched }\n if (!stretched) { return old }\n\n for (var i = 0; i < old.length; ++i) {\n var oldCur = old[i], stretchCur = stretched[i];\n if (oldCur && stretchCur) {\n spans: for (var j = 0; j < stretchCur.length; ++j) {\n var span = stretchCur[j];\n for (var k = 0; k < oldCur.length; ++k)\n { if (oldCur[k].marker == span.marker) { continue spans } }\n oldCur.push(span);\n }\n } else if (stretchCur) {\n old[i] = stretchCur;\n }\n }\n return old\n}\n\n// Used both to provide a JSON-safe object in .getHistory, and, when\n// detaching a document, to split the history in two\nfunction copyHistoryArray(events, newGroup, instantiateSel) {\n var copy = [];\n for (var i = 0; i < events.length; ++i) {\n var event = events[i];\n if (event.ranges) {\n copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event);\n continue\n }\n var changes = event.changes, newChanges = [];\n copy.push({changes: newChanges});\n for (var j = 0; j < changes.length; ++j) {\n var change = changes[j], m = (void 0);\n newChanges.push({from: change.from, to: change.to, text: change.text});\n if (newGroup) { for (var prop in change) { if (m = prop.match(/^spans_(\\d+)$/)) {\n if (indexOf(newGroup, Number(m[1])) > -1) {\n lst(newChanges)[prop] = change[prop];\n delete change[prop];\n }\n } } }\n }\n }\n return copy\n}\n\n// The 'scroll' parameter given to many of these indicated whether\n// the new cursor position should be scrolled into view after\n// modifying the selection.\n\n// If shift is held or the extend flag is set, extends a range to\n// include a given position (and optionally a second position).\n// Otherwise, simply returns the range between the given positions.\n// Used for cursor motion and such.\nfunction extendRange(range, head, other, extend) {\n if (extend) {\n var anchor = range.anchor;\n if (other) {\n var posBefore = cmp(head, anchor) < 0;\n if (posBefore != (cmp(other, anchor) < 0)) {\n anchor = head;\n head = other;\n } else if (posBefore != (cmp(head, other) < 0)) {\n head = other;\n }\n }\n return new Range(anchor, head)\n } else {\n return new Range(other || head, head)\n }\n}\n\n// Extend the primary selection range, discard the rest.\nfunction extendSelection(doc, head, other, options, extend) {\n if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }\n setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);\n}\n\n// Extend all selections (pos is an array of selections with length\n// equal the number of selections)\nfunction extendSelections(doc, heads, options) {\n var out = [];\n var extend = doc.cm && (doc.cm.display.shift || doc.extend);\n for (var i = 0; i < doc.sel.ranges.length; i++)\n { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); }\n var newSel = normalizeSelection(out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n}\n\n// Updates a single range in the selection.\nfunction replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options);\n}\n\n// Reset the selection to a single range.\nfunction setSimpleSelection(doc, anchor, head, options) {\n setSelection(doc, simpleSelection(anchor, head), options);\n}\n\n// Give beforeSelectionChange handlers a change to influence a\n// selection update.\nfunction filterSelectionChange(doc, sel, options) {\n var obj = {\n ranges: sel.ranges,\n update: function(ranges) {\n var this$1 = this;\n\n this.ranges = [];\n for (var i = 0; i < ranges.length; i++)\n { this$1.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),\n clipPos(doc, ranges[i].head)); }\n },\n origin: options && options.origin\n };\n signal(doc, \"beforeSelectionChange\", doc, obj);\n if (doc.cm) { signal(doc.cm, \"beforeSelectionChange\", doc.cm, obj); }\n if (obj.ranges != sel.ranges) { return normalizeSelection(obj.ranges, obj.ranges.length - 1) }\n else { return sel }\n}\n\nfunction setSelectionReplaceHistory(doc, sel, options) {\n var done = doc.history.done, last = lst(done);\n if (last && last.ranges) {\n done[done.length - 1] = sel;\n setSelectionNoUndo(doc, sel, options);\n } else {\n setSelection(doc, sel, options);\n }\n}\n\n// Set a new selection.\nfunction setSelection(doc, sel, options) {\n setSelectionNoUndo(doc, sel, options);\n addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options);\n}\n\nfunction setSelectionNoUndo(doc, sel, options) {\n if (hasHandler(doc, \"beforeSelectionChange\") || doc.cm && hasHandler(doc.cm, \"beforeSelectionChange\"))\n { sel = filterSelectionChange(doc, sel, options); }\n\n var bias = options && options.bias ||\n (cmp(sel.primary().head, doc.sel.primary().head) < 0 ? -1 : 1);\n setSelectionInner(doc, skipAtomicInSelection(doc, sel, bias, true));\n\n if (!(options && options.scroll === false) && doc.cm)\n { ensureCursorVisible(doc.cm); }\n}\n\nfunction setSelectionInner(doc, sel) {\n if (sel.equals(doc.sel)) { return }\n\n doc.sel = sel;\n\n if (doc.cm) {\n doc.cm.curOp.updateInput = doc.cm.curOp.selectionChanged = true;\n signalCursorActivity(doc.cm);\n }\n signalLater(doc, \"cursorActivity\", doc);\n}\n\n// Verify that the selection does not partially select any atomic\n// marked ranges.\nfunction reCheckSelection(doc) {\n setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false));\n}\n\n// Return a selection that does not partially select any atomic\n// ranges.\nfunction skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) { out = sel.ranges.slice(0, i); }\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(out, sel.primIndex) : sel\n}\n\nfunction skipAtomicInner(doc, pos, oldPos, dir, mayClear) {\n var line = getLine(doc, pos.line);\n if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) {\n var sp = line.markedSpans[i], m = sp.marker;\n if ((sp.from == null || (m.inclusiveLeft ? sp.from <= pos.ch : sp.from < pos.ch)) &&\n (sp.to == null || (m.inclusiveRight ? sp.to >= pos.ch : sp.to > pos.ch))) {\n if (mayClear) {\n signal(m, \"beforeCursorEnter\");\n if (m.explicitlyCleared) {\n if (!line.markedSpans) { break }\n else {--i; continue}\n }\n }\n if (!m.atomic) { continue }\n\n if (oldPos) {\n var near = m.find(dir < 0 ? 1 : -1), diff = (void 0);\n if (dir < 0 ? m.inclusiveRight : m.inclusiveLeft)\n { near = movePos(doc, near, -dir, near && near.line == pos.line ? line : null); }\n if (near && near.line == pos.line && (diff = cmp(near, oldPos)) && (dir < 0 ? diff < 0 : diff > 0))\n { return skipAtomicInner(doc, near, pos, dir, mayClear) }\n }\n\n var far = m.find(dir < 0 ? -1 : 1);\n if (dir < 0 ? m.inclusiveLeft : m.inclusiveRight)\n { far = movePos(doc, far, dir, far.line == pos.line ? line : null); }\n return far ? skipAtomicInner(doc, far, pos, dir, mayClear) : null\n }\n } }\n return pos\n}\n\n// Ensure a given position is not inside an atomic range.\nfunction skipAtomic(doc, pos, oldPos, bias, mayClear) {\n var dir = bias || 1;\n var found = skipAtomicInner(doc, pos, oldPos, dir, mayClear) ||\n (!mayClear && skipAtomicInner(doc, pos, oldPos, dir, true)) ||\n skipAtomicInner(doc, pos, oldPos, -dir, mayClear) ||\n (!mayClear && skipAtomicInner(doc, pos, oldPos, -dir, true));\n if (!found) {\n doc.cantEdit = true;\n return Pos(doc.first, 0)\n }\n return found\n}\n\nfunction movePos(doc, pos, dir, line) {\n if (dir < 0 && pos.ch == 0) {\n if (pos.line > doc.first) { return clipPos(doc, Pos(pos.line - 1)) }\n else { return null }\n } else if (dir > 0 && pos.ch == (line || getLine(doc, pos.line)).text.length) {\n if (pos.line < doc.first + doc.size - 1) { return Pos(pos.line + 1, 0) }\n else { return null }\n } else {\n return new Pos(pos.line, pos.ch + dir)\n }\n}\n\nfunction selectAll(cm) {\n cm.setSelection(Pos(cm.firstLine(), 0), Pos(cm.lastLine()), sel_dontScroll);\n}\n\n// UPDATING\n\n// Allow \"beforeChange\" event handlers to influence a change\nfunction filterChange(doc, change, update) {\n var obj = {\n canceled: false,\n from: change.from,\n to: change.to,\n text: change.text,\n origin: change.origin,\n cancel: function () { return obj.canceled = true; }\n };\n if (update) { obj.update = function (from, to, text, origin) {\n if (from) { obj.from = clipPos(doc, from); }\n if (to) { obj.to = clipPos(doc, to); }\n if (text) { obj.text = text; }\n if (origin !== undefined) { obj.origin = origin; }\n }; }\n signal(doc, \"beforeChange\", doc, obj);\n if (doc.cm) { signal(doc.cm, \"beforeChange\", doc.cm, obj); }\n\n if (obj.canceled) { return null }\n return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}\n}\n\n// Apply a change to a document, and add it to the document's\n// history, and propagating it to all linked documents.\nfunction makeChange(doc, change, ignoreReadOnly) {\n if (doc.cm) {\n if (!doc.cm.curOp) { return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly) }\n if (doc.cm.state.suppressEdits) { return }\n }\n\n if (hasHandler(doc, \"beforeChange\") || doc.cm && hasHandler(doc.cm, \"beforeChange\")) {\n change = filterChange(doc, change, true);\n if (!change) { return }\n }\n\n // Possibly split or suppress the update based on the presence\n // of read-only spans in its range.\n var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to);\n if (split) {\n for (var i = split.length - 1; i >= 0; --i)\n { makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [\"\"] : change.text, origin: change.origin}); }\n } else {\n makeChangeInner(doc, change);\n }\n}\n\nfunction makeChangeInner(doc, change) {\n if (change.text.length == 1 && change.text[0] == \"\" && cmp(change.from, change.to) == 0) { return }\n var selAfter = computeSelAfterChange(doc, change);\n addChangeToHistory(doc, change, selAfter, doc.cm ? doc.cm.curOp.id : NaN);\n\n makeChangeSingleDoc(doc, change, selAfter, stretchSpansOverChange(doc, change));\n var rebased = [];\n\n linkedDocs(doc, function (doc, sharedHist) {\n if (!sharedHist && indexOf(rebased, doc.history) == -1) {\n rebaseHist(doc.history, change);\n rebased.push(doc.history);\n }\n makeChangeSingleDoc(doc, change, null, stretchSpansOverChange(doc, change));\n });\n}\n\n// Revert a change stored in a document's history.\nfunction makeChangeFromHistory(doc, type, allowSelectionOnly) {\n if (doc.cm && doc.cm.state.suppressEdits && !allowSelectionOnly) { return }\n\n var hist = doc.history, event, selAfter = doc.sel;\n var source = type == \"undo\" ? hist.done : hist.undone, dest = type == \"undo\" ? hist.undone : hist.done;\n\n // Verify that there is a useable event (so that ctrl-z won't\n // needlessly clear selection events)\n var i = 0;\n for (; i < source.length; i++) {\n event = source[i];\n if (allowSelectionOnly ? event.ranges && !event.equals(doc.sel) : !event.ranges)\n { break }\n }\n if (i == source.length) { return }\n hist.lastOrigin = hist.lastSelOrigin = null;\n\n for (;;) {\n event = source.pop();\n if (event.ranges) {\n pushSelectionToHistory(event, dest);\n if (allowSelectionOnly && !event.equals(doc.sel)) {\n setSelection(doc, event, {clearRedo: false});\n return\n }\n selAfter = event;\n }\n else { break }\n }\n\n // Build up a reverse change object to add to the opposite history\n // stack (redo when undoing, and vice versa).\n var antiChanges = [];\n pushSelectionToHistory(selAfter, dest);\n dest.push({changes: antiChanges, generation: hist.generation});\n hist.generation = event.generation || ++hist.maxGeneration;\n\n var filter = hasHandler(doc, \"beforeChange\") || doc.cm && hasHandler(doc.cm, \"beforeChange\");\n\n var loop = function ( i ) {\n var change = event.changes[i];\n change.origin = type;\n if (filter && !filterChange(doc, change, false)) {\n source.length = 0;\n return {}\n }\n\n antiChanges.push(historyChangeFromChange(doc, change));\n\n var after = i ? computeSelAfterChange(doc, change) : lst(source);\n makeChangeSingleDoc(doc, change, after, mergeOldSpans(doc, change));\n if (!i && doc.cm) { doc.cm.scrollIntoView({from: change.from, to: changeEnd(change)}); }\n var rebased = [];\n\n // Propagate to the linked documents\n linkedDocs(doc, function (doc, sharedHist) {\n if (!sharedHist && indexOf(rebased, doc.history) == -1) {\n rebaseHist(doc.history, change);\n rebased.push(doc.history);\n }\n makeChangeSingleDoc(doc, change, null, mergeOldSpans(doc, change));\n });\n };\n\n for (var i$1 = event.changes.length - 1; i$1 >= 0; --i$1) {\n var returned = loop( i$1 );\n\n if ( returned ) return returned.v;\n }\n}\n\n// Sub-views need their line numbers shifted when text is added\n// above or below them in the parent document.\nfunction shiftDoc(doc, distance) {\n if (distance == 0) { return }\n doc.first += distance;\n doc.sel = new Selection(map(doc.sel.ranges, function (range) { return new Range(\n Pos(range.anchor.line + distance, range.anchor.ch),\n Pos(range.head.line + distance, range.head.ch)\n ); }), doc.sel.primIndex);\n if (doc.cm) {\n regChange(doc.cm, doc.first, doc.first - distance, distance);\n for (var d = doc.cm.display, l = d.viewFrom; l < d.viewTo; l++)\n { regLineChange(doc.cm, l, \"gutter\"); }\n }\n}\n\n// More lower-level change function, handling only a single document\n// (not linked ones).\nfunction makeChangeSingleDoc(doc, change, selAfter, spans) {\n if (doc.cm && !doc.cm.curOp)\n { return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) }\n\n if (change.to.line < doc.first) {\n shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));\n return\n }\n if (change.from.line > doc.lastLine()) { return }\n\n // Clip the change to the size of this doc\n if (change.from.line < doc.first) {\n var shift = change.text.length - 1 - (doc.first - change.from.line);\n shiftDoc(doc, shift);\n change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),\n text: [lst(change.text)], origin: change.origin};\n }\n var last = doc.lastLine();\n if (change.to.line > last) {\n change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),\n text: [change.text[0]], origin: change.origin};\n }\n\n change.removed = getBetween(doc, change.from, change.to);\n\n if (!selAfter) { selAfter = computeSelAfterChange(doc, change); }\n if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans); }\n else { updateDoc(doc, change, spans); }\n setSelectionNoUndo(doc, selAfter, sel_dontScroll);\n}\n\n// Handle the interaction of a change to a document with the editor\n// that this document is part of.\nfunction makeChangeSingleDocInEditor(cm, change, spans) {\n var doc = cm.doc, display = cm.display, from = change.from, to = change.to;\n\n var recomputeMaxLength = false, checkWidthStart = from.line;\n if (!cm.options.lineWrapping) {\n checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));\n doc.iter(checkWidthStart, to.line + 1, function (line) {\n if (line == display.maxLine) {\n recomputeMaxLength = true;\n return true\n }\n });\n }\n\n if (doc.sel.contains(change.from, change.to) > -1)\n { signalCursorActivity(cm); }\n\n updateDoc(doc, change, spans, estimateHeight(cm));\n\n if (!cm.options.lineWrapping) {\n doc.iter(checkWidthStart, from.line + change.text.length, function (line) {\n var len = lineLength(line);\n if (len > display.maxLineLength) {\n display.maxLine = line;\n display.maxLineLength = len;\n display.maxLineChanged = true;\n recomputeMaxLength = false;\n }\n });\n if (recomputeMaxLength) { cm.curOp.updateMaxLine = true; }\n }\n\n retreatFrontier(doc, from.line);\n startWorker(cm, 400);\n\n var lendiff = change.text.length - (to.line - from.line) - 1;\n // Remember that these lines changed, for updating the display\n if (change.full)\n { regChange(cm); }\n else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))\n { regLineChange(cm, from.line, \"text\"); }\n else\n { regChange(cm, from.line, to.line + 1, lendiff); }\n\n var changesHandler = hasHandler(cm, \"changes\"), changeHandler = hasHandler(cm, \"change\");\n if (changeHandler || changesHandler) {\n var obj = {\n from: from, to: to,\n text: change.text,\n removed: change.removed,\n origin: change.origin\n };\n if (changeHandler) { signalLater(cm, \"change\", cm, obj); }\n if (changesHandler) { (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj); }\n }\n cm.display.selForContextMenu = null;\n}\n\nfunction replaceRange(doc, code, from, to, origin) {\n if (!to) { to = from; }\n if (cmp(to, from) < 0) { var assign;\n (assign = [to, from], from = assign[0], to = assign[1], assign); }\n if (typeof code == \"string\") { code = doc.splitLines(code); }\n makeChange(doc, {from: from, to: to, text: code, origin: origin});\n}\n\n// Rebasing/resetting history to deal with externally-sourced changes\n\nfunction rebaseHistSelSingle(pos, from, to, diff) {\n if (to < pos.line) {\n pos.line += diff;\n } else if (from < pos.line) {\n pos.line = from;\n pos.ch = 0;\n }\n}\n\n// Tries to rebase an array of history events given a change in the\n// document. If the change touches the same lines as the event, the\n// event, and everything 'behind' it, is discarded. If the change is\n// before the event, the event's positions are updated. Uses a\n// copy-on-write scheme for the positions, to avoid having to\n// reallocate them all on every rebase, but also avoid problems with\n// shared position objects being unsafely updated.\nfunction rebaseHistArray(array, from, to, diff) {\n for (var i = 0; i < array.length; ++i) {\n var sub = array[i], ok = true;\n if (sub.ranges) {\n if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; }\n for (var j = 0; j < sub.ranges.length; j++) {\n rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff);\n rebaseHistSelSingle(sub.ranges[j].head, from, to, diff);\n }\n continue\n }\n for (var j$1 = 0; j$1 < sub.changes.length; ++j$1) {\n var cur = sub.changes[j$1];\n if (to < cur.from.line) {\n cur.from = Pos(cur.from.line + diff, cur.from.ch);\n cur.to = Pos(cur.to.line + diff, cur.to.ch);\n } else if (from <= cur.to.line) {\n ok = false;\n break\n }\n }\n if (!ok) {\n array.splice(0, i + 1);\n i = 0;\n }\n }\n}\n\nfunction rebaseHist(hist, change) {\n var from = change.from.line, to = change.to.line, diff = change.text.length - (to - from) - 1;\n rebaseHistArray(hist.done, from, to, diff);\n rebaseHistArray(hist.undone, from, to, diff);\n}\n\n// Utility for applying a change to a line by handle or number,\n// returning the number and optionally registering the line as\n// changed.\nfunction changeLine(doc, handle, changeType, op) {\n var no = handle, line = handle;\n if (typeof handle == \"number\") { line = getLine(doc, clipLine(doc, handle)); }\n else { no = lineNo(handle); }\n if (no == null) { return null }\n if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType); }\n return line\n}\n\n// The document is represented as a BTree consisting of leaves, with\n// chunk of lines in them, and branches, with up to ten leaves or\n// other branch nodes below them. The top node is always a branch\n// node, and is the document object itself (meaning it has\n// additional methods and properties).\n//\n// All nodes have parent links. The tree is used both to go from\n// line numbers to line objects, and to go from objects to numbers.\n// It also indexes by height, and is used to convert between height\n// and line object, and to find the total height of the document.\n//\n// See also http://marijnhaverbeke.nl/blog/codemirror-line-tree.html\n\nfunction LeafChunk(lines) {\n var this$1 = this;\n\n this.lines = lines;\n this.parent = null;\n var height = 0;\n for (var i = 0; i < lines.length; ++i) {\n lines[i].parent = this$1;\n height += lines[i].height;\n }\n this.height = height;\n}\n\nLeafChunk.prototype = {\n chunkSize: function chunkSize() { return this.lines.length },\n\n // Remove the n lines at offset 'at'.\n removeInner: function removeInner(at, n) {\n var this$1 = this;\n\n for (var i = at, e = at + n; i < e; ++i) {\n var line = this$1.lines[i];\n this$1.height -= line.height;\n cleanUpLine(line);\n signalLater(line, \"delete\");\n }\n this.lines.splice(at, n);\n },\n\n // Helper used to collapse a small branch into a single leaf.\n collapse: function collapse(lines) {\n lines.push.apply(lines, this.lines);\n },\n\n // Insert the given array of lines at offset 'at', count them as\n // having the given height.\n insertInner: function insertInner(at, lines, height) {\n var this$1 = this;\n\n this.height += height;\n this.lines = this.lines.slice(0, at).concat(lines).concat(this.lines.slice(at));\n for (var i = 0; i < lines.length; ++i) { lines[i].parent = this$1; }\n },\n\n // Used to iterate over a part of the tree.\n iterN: function iterN(at, n, op) {\n var this$1 = this;\n\n for (var e = at + n; at < e; ++at)\n { if (op(this$1.lines[at])) { return true } }\n }\n};\n\nfunction BranchChunk(children) {\n var this$1 = this;\n\n this.children = children;\n var size = 0, height = 0;\n for (var i = 0; i < children.length; ++i) {\n var ch = children[i];\n size += ch.chunkSize(); height += ch.height;\n ch.parent = this$1;\n }\n this.size = size;\n this.height = height;\n this.parent = null;\n}\n\nBranchChunk.prototype = {\n chunkSize: function chunkSize() { return this.size },\n\n removeInner: function removeInner(at, n) {\n var this$1 = this;\n\n this.size -= n;\n for (var i = 0; i < this.children.length; ++i) {\n var child = this$1.children[i], sz = child.chunkSize();\n if (at < sz) {\n var rm = Math.min(n, sz - at), oldHeight = child.height;\n child.removeInner(at, rm);\n this$1.height -= oldHeight - child.height;\n if (sz == rm) { this$1.children.splice(i--, 1); child.parent = null; }\n if ((n -= rm) == 0) { break }\n at = 0;\n } else { at -= sz; }\n }\n // If the result is smaller than 25 lines, ensure that it is a\n // single leaf node.\n if (this.size - n < 25 &&\n (this.children.length > 1 || !(this.children[0] instanceof LeafChunk))) {\n var lines = [];\n this.collapse(lines);\n this.children = [new LeafChunk(lines)];\n this.children[0].parent = this;\n }\n },\n\n collapse: function collapse(lines) {\n var this$1 = this;\n\n for (var i = 0; i < this.children.length; ++i) { this$1.children[i].collapse(lines); }\n },\n\n insertInner: function insertInner(at, lines, height) {\n var this$1 = this;\n\n this.size += lines.length;\n this.height += height;\n for (var i = 0; i < this.children.length; ++i) {\n var child = this$1.children[i], sz = child.chunkSize();\n if (at <= sz) {\n child.insertInner(at, lines, height);\n if (child.lines && child.lines.length > 50) {\n // To avoid memory thrashing when child.lines is huge (e.g. first view of a large file), it's never spliced.\n // Instead, small slices are taken. They're taken in order because sequential memory accesses are fastest.\n var remaining = child.lines.length % 25 + 25;\n for (var pos = remaining; pos < child.lines.length;) {\n var leaf = new LeafChunk(child.lines.slice(pos, pos += 25));\n child.height -= leaf.height;\n this$1.children.splice(++i, 0, leaf);\n leaf.parent = this$1;\n }\n child.lines = child.lines.slice(0, remaining);\n this$1.maybeSpill();\n }\n break\n }\n at -= sz;\n }\n },\n\n // When a node has grown, check whether it should be split.\n maybeSpill: function maybeSpill() {\n if (this.children.length <= 10) { return }\n var me = this;\n do {\n var spilled = me.children.splice(me.children.length - 5, 5);\n var sibling = new BranchChunk(spilled);\n if (!me.parent) { // Become the parent node\n var copy = new BranchChunk(me.children);\n copy.parent = me;\n me.children = [copy, sibling];\n me = copy;\n } else {\n me.size -= sibling.size;\n me.height -= sibling.height;\n var myIndex = indexOf(me.parent.children, me);\n me.parent.children.splice(myIndex + 1, 0, sibling);\n }\n sibling.parent = me.parent;\n } while (me.children.length > 10)\n me.parent.maybeSpill();\n },\n\n iterN: function iterN(at, n, op) {\n var this$1 = this;\n\n for (var i = 0; i < this.children.length; ++i) {\n var child = this$1.children[i], sz = child.chunkSize();\n if (at < sz) {\n var used = Math.min(n, sz - at);\n if (child.iterN(at, used, op)) { return true }\n if ((n -= used) == 0) { break }\n at = 0;\n } else { at -= sz; }\n }\n }\n};\n\n// Line widgets are block elements displayed above or below a line.\n\nvar LineWidget = function(doc, node, options) {\n var this$1 = this;\n\n if (options) { for (var opt in options) { if (options.hasOwnProperty(opt))\n { this$1[opt] = options[opt]; } } }\n this.doc = doc;\n this.node = node;\n};\n\nLineWidget.prototype.clear = function () {\n var this$1 = this;\n\n var cm = this.doc.cm, ws = this.line.widgets, line = this.line, no = lineNo(line);\n if (no == null || !ws) { return }\n for (var i = 0; i < ws.length; ++i) { if (ws[i] == this$1) { ws.splice(i--, 1); } }\n if (!ws.length) { line.widgets = null; }\n var height = widgetHeight(this);\n updateLineHeight(line, Math.max(0, line.height - height));\n if (cm) {\n runInOp(cm, function () {\n adjustScrollWhenAboveVisible(cm, line, -height);\n regLineChange(cm, no, \"widget\");\n });\n signalLater(cm, \"lineWidgetCleared\", cm, this, no);\n }\n};\n\nLineWidget.prototype.changed = function () {\n var this$1 = this;\n\n var oldH = this.height, cm = this.doc.cm, line = this.line;\n this.height = null;\n var diff = widgetHeight(this) - oldH;\n if (!diff) { return }\n updateLineHeight(line, line.height + diff);\n if (cm) {\n runInOp(cm, function () {\n cm.curOp.forceUpdate = true;\n adjustScrollWhenAboveVisible(cm, line, diff);\n signalLater(cm, \"lineWidgetChanged\", cm, this$1, lineNo(line));\n });\n }\n};\neventMixin(LineWidget);\n\nfunction adjustScrollWhenAboveVisible(cm, line, diff) {\n if (heightAtLine(line) < ((cm.curOp && cm.curOp.scrollTop) || cm.doc.scrollTop))\n { addToScrollTop(cm, diff); }\n}\n\nfunction addLineWidget(doc, handle, node, options) {\n var widget = new LineWidget(doc, node, options);\n var cm = doc.cm;\n if (cm && widget.noHScroll) { cm.display.alignWidgets = true; }\n changeLine(doc, handle, \"widget\", function (line) {\n var widgets = line.widgets || (line.widgets = []);\n if (widget.insertAt == null) { widgets.push(widget); }\n else { widgets.splice(Math.min(widgets.length - 1, Math.max(0, widget.insertAt)), 0, widget); }\n widget.line = line;\n if (cm && !lineIsHidden(doc, line)) {\n var aboveVisible = heightAtLine(line) < doc.scrollTop;\n updateLineHeight(line, line.height + widgetHeight(widget));\n if (aboveVisible) { addToScrollTop(cm, widget.height); }\n cm.curOp.forceUpdate = true;\n }\n return true\n });\n signalLater(cm, \"lineWidgetAdded\", cm, widget, typeof handle == \"number\" ? handle : lineNo(handle));\n return widget\n}\n\n// TEXTMARKERS\n\n// Created with markText and setBookmark methods. A TextMarker is a\n// handle that can be used to clear or find a marked position in the\n// document. Line objects hold arrays (markedSpans) containing\n// {from, to, marker} object pointing to such marker objects, and\n// indicating that such a marker is present on that line. Multiple\n// lines may point to the same marker when it spans across lines.\n// The spans will have null for their from/to properties when the\n// marker continues beyond the start/end of the line. Markers have\n// links back to the lines they currently touch.\n\n// Collapsed markers have unique ids, in order to be able to order\n// them, which is needed for uniquely determining an outer marker\n// when they overlap (they may nest, but not partially overlap).\nvar nextMarkerId = 0;\n\nvar TextMarker = function(doc, type) {\n this.lines = [];\n this.type = type;\n this.doc = doc;\n this.id = ++nextMarkerId;\n};\n\n// Clear the marker.\nTextMarker.prototype.clear = function () {\n var this$1 = this;\n\n if (this.explicitlyCleared) { return }\n var cm = this.doc.cm, withOp = cm && !cm.curOp;\n if (withOp) { startOperation(cm); }\n if (hasHandler(this, \"clear\")) {\n var found = this.find();\n if (found) { signalLater(this, \"clear\", found.from, found.to); }\n }\n var min = null, max = null;\n for (var i = 0; i < this.lines.length; ++i) {\n var line = this$1.lines[i];\n var span = getMarkedSpanFor(line.markedSpans, this$1);\n if (cm && !this$1.collapsed) { regLineChange(cm, lineNo(line), \"text\"); }\n else if (cm) {\n if (span.to != null) { max = lineNo(line); }\n if (span.from != null) { min = lineNo(line); }\n }\n line.markedSpans = removeMarkedSpan(line.markedSpans, span);\n if (span.from == null && this$1.collapsed && !lineIsHidden(this$1.doc, line) && cm)\n { updateLineHeight(line, textHeight(cm.display)); }\n }\n if (cm && this.collapsed && !cm.options.lineWrapping) { for (var i$1 = 0; i$1 < this.lines.length; ++i$1) {\n var visual = visualLine(this$1.lines[i$1]), len = lineLength(visual);\n if (len > cm.display.maxLineLength) {\n cm.display.maxLine = visual;\n cm.display.maxLineLength = len;\n cm.display.maxLineChanged = true;\n }\n } }\n\n if (min != null && cm && this.collapsed) { regChange(cm, min, max + 1); }\n this.lines.length = 0;\n this.explicitlyCleared = true;\n if (this.atomic && this.doc.cantEdit) {\n this.doc.cantEdit = false;\n if (cm) { reCheckSelection(cm.doc); }\n }\n if (cm) { signalLater(cm, \"markerCleared\", cm, this, min, max); }\n if (withOp) { endOperation(cm); }\n if (this.parent) { this.parent.clear(); }\n};\n\n// Find the position of the marker in the document. Returns a {from,\n// to} object by default. Side can be passed to get a specific side\n// -- 0 (both), -1 (left), or 1 (right). When lineObj is true, the\n// Pos objects returned contain a line object, rather than a line\n// number (used to prevent looking up the same line twice).\nTextMarker.prototype.find = function (side, lineObj) {\n var this$1 = this;\n\n if (side == null && this.type == \"bookmark\") { side = 1; }\n var from, to;\n for (var i = 0; i < this.lines.length; ++i) {\n var line = this$1.lines[i];\n var span = getMarkedSpanFor(line.markedSpans, this$1);\n if (span.from != null) {\n from = Pos(lineObj ? line : lineNo(line), span.from);\n if (side == -1) { return from }\n }\n if (span.to != null) {\n to = Pos(lineObj ? line : lineNo(line), span.to);\n if (side == 1) { return to }\n }\n }\n return from && {from: from, to: to}\n};\n\n// Signals that the marker's widget changed, and surrounding layout\n// should be recomputed.\nTextMarker.prototype.changed = function () {\n var this$1 = this;\n\n var pos = this.find(-1, true), widget = this, cm = this.doc.cm;\n if (!pos || !cm) { return }\n runInOp(cm, function () {\n var line = pos.line, lineN = lineNo(pos.line);\n var view = findViewForLine(cm, lineN);\n if (view) {\n clearLineMeasurementCacheFor(view);\n cm.curOp.selectionChanged = cm.curOp.forceUpdate = true;\n }\n cm.curOp.updateMaxLine = true;\n if (!lineIsHidden(widget.doc, line) && widget.height != null) {\n var oldHeight = widget.height;\n widget.height = null;\n var dHeight = widgetHeight(widget) - oldHeight;\n if (dHeight)\n { updateLineHeight(line, line.height + dHeight); }\n }\n signalLater(cm, \"markerChanged\", cm, this$1);\n });\n};\n\nTextMarker.prototype.attachLine = function (line) {\n if (!this.lines.length && this.doc.cm) {\n var op = this.doc.cm.curOp;\n if (!op.maybeHiddenMarkers || indexOf(op.maybeHiddenMarkers, this) == -1)\n { (op.maybeUnhiddenMarkers || (op.maybeUnhiddenMarkers = [])).push(this); }\n }\n this.lines.push(line);\n};\n\nTextMarker.prototype.detachLine = function (line) {\n this.lines.splice(indexOf(this.lines, line), 1);\n if (!this.lines.length && this.doc.cm) {\n var op = this.doc.cm.curOp;(op.maybeHiddenMarkers || (op.maybeHiddenMarkers = [])).push(this);\n }\n};\neventMixin(TextMarker);\n\n// Create a marker, wire it up to the right lines, and\nfunction markText(doc, from, to, options, type) {\n // Shared markers (across linked documents) are handled separately\n // (markTextShared will call out to this again, once per\n // document).\n if (options && options.shared) { return markTextShared(doc, from, to, options, type) }\n // Ensure we are in an operation.\n if (doc.cm && !doc.cm.curOp) { return operation(doc.cm, markText)(doc, from, to, options, type) }\n\n var marker = new TextMarker(doc, type), diff = cmp(from, to);\n if (options) { copyObj(options, marker, false); }\n // Don't connect empty markers unless clearWhenEmpty is false\n if (diff > 0 || diff == 0 && marker.clearWhenEmpty !== false)\n { return marker }\n if (marker.replacedWith) {\n // Showing up as a widget implies collapsed (widget replaces text)\n marker.collapsed = true;\n marker.widgetNode = eltP(\"span\", [marker.replacedWith], \"CodeMirror-widget\");\n if (!options.handleMouseEvents) { marker.widgetNode.setAttribute(\"cm-ignore-events\", \"true\"); }\n if (options.insertLeft) { marker.widgetNode.insertLeft = true; }\n }\n if (marker.collapsed) {\n if (conflictingCollapsedRange(doc, from.line, from, to, marker) ||\n from.line != to.line && conflictingCollapsedRange(doc, to.line, from, to, marker))\n { throw new Error(\"Inserting collapsed marker partially overlapping an existing one\") }\n seeCollapsedSpans();\n }\n\n if (marker.addToHistory)\n { addChangeToHistory(doc, {from: from, to: to, origin: \"markText\"}, doc.sel, NaN); }\n\n var curLine = from.line, cm = doc.cm, updateMaxLine;\n doc.iter(curLine, to.line + 1, function (line) {\n if (cm && marker.collapsed && !cm.options.lineWrapping && visualLine(line) == cm.display.maxLine)\n { updateMaxLine = true; }\n if (marker.collapsed && curLine != from.line) { updateLineHeight(line, 0); }\n addMarkedSpan(line, new MarkedSpan(marker,\n curLine == from.line ? from.ch : null,\n curLine == to.line ? to.ch : null));\n ++curLine;\n });\n // lineIsHidden depends on the presence of the spans, so needs a second pass\n if (marker.collapsed) { doc.iter(from.line, to.line + 1, function (line) {\n if (lineIsHidden(doc, line)) { updateLineHeight(line, 0); }\n }); }\n\n if (marker.clearOnEnter) { on(marker, \"beforeCursorEnter\", function () { return marker.clear(); }); }\n\n if (marker.readOnly) {\n seeReadOnlySpans();\n if (doc.history.done.length || doc.history.undone.length)\n { doc.clearHistory(); }\n }\n if (marker.collapsed) {\n marker.id = ++nextMarkerId;\n marker.atomic = true;\n }\n if (cm) {\n // Sync editor state\n if (updateMaxLine) { cm.curOp.updateMaxLine = true; }\n if (marker.collapsed)\n { regChange(cm, from.line, to.line + 1); }\n else if (marker.className || marker.title || marker.startStyle || marker.endStyle || marker.css)\n { for (var i = from.line; i <= to.line; i++) { regLineChange(cm, i, \"text\"); } }\n if (marker.atomic) { reCheckSelection(cm.doc); }\n signalLater(cm, \"markerAdded\", cm, marker);\n }\n return marker\n}\n\n// SHARED TEXTMARKERS\n\n// A shared marker spans multiple linked documents. It is\n// implemented as a meta-marker-object controlling multiple normal\n// markers.\nvar SharedTextMarker = function(markers, primary) {\n var this$1 = this;\n\n this.markers = markers;\n this.primary = primary;\n for (var i = 0; i < markers.length; ++i)\n { markers[i].parent = this$1; }\n};\n\nSharedTextMarker.prototype.clear = function () {\n var this$1 = this;\n\n if (this.explicitlyCleared) { return }\n this.explicitlyCleared = true;\n for (var i = 0; i < this.markers.length; ++i)\n { this$1.markers[i].clear(); }\n signalLater(this, \"clear\");\n};\n\nSharedTextMarker.prototype.find = function (side, lineObj) {\n return this.primary.find(side, lineObj)\n};\neventMixin(SharedTextMarker);\n\nfunction markTextShared(doc, from, to, options, type) {\n options = copyObj(options);\n options.shared = false;\n var markers = [markText(doc, from, to, options, type)], primary = markers[0];\n var widget = options.widgetNode;\n linkedDocs(doc, function (doc) {\n if (widget) { options.widgetNode = widget.cloneNode(true); }\n markers.push(markText(doc, clipPos(doc, from), clipPos(doc, to), options, type));\n for (var i = 0; i < doc.linked.length; ++i)\n { if (doc.linked[i].isParent) { return } }\n primary = lst(markers);\n });\n return new SharedTextMarker(markers, primary)\n}\n\nfunction findSharedMarkers(doc) {\n return doc.findMarks(Pos(doc.first, 0), doc.clipPos(Pos(doc.lastLine())), function (m) { return m.parent; })\n}\n\nfunction copySharedMarkers(doc, markers) {\n for (var i = 0; i < markers.length; i++) {\n var marker = markers[i], pos = marker.find();\n var mFrom = doc.clipPos(pos.from), mTo = doc.clipPos(pos.to);\n if (cmp(mFrom, mTo)) {\n var subMark = markText(doc, mFrom, mTo, marker.primary, marker.primary.type);\n marker.markers.push(subMark);\n subMark.parent = marker;\n }\n }\n}\n\nfunction detachSharedMarkers(markers) {\n var loop = function ( i ) {\n var marker = markers[i], linked = [marker.primary.doc];\n linkedDocs(marker.primary.doc, function (d) { return linked.push(d); });\n for (var j = 0; j < marker.markers.length; j++) {\n var subMarker = marker.markers[j];\n if (indexOf(linked, subMarker.doc) == -1) {\n subMarker.parent = null;\n marker.markers.splice(j--, 1);\n }\n }\n };\n\n for (var i = 0; i < markers.length; i++) loop( i );\n}\n\nvar nextDocId = 0;\nvar Doc = function(text, mode, firstLine, lineSep, direction) {\n if (!(this instanceof Doc)) { return new Doc(text, mode, firstLine, lineSep, direction) }\n if (firstLine == null) { firstLine = 0; }\n\n BranchChunk.call(this, [new LeafChunk([new Line(\"\", null)])]);\n this.first = firstLine;\n this.scrollTop = this.scrollLeft = 0;\n this.cantEdit = false;\n this.cleanGeneration = 1;\n this.modeFrontier = this.highlightFrontier = firstLine;\n var start = Pos(firstLine, 0);\n this.sel = simpleSelection(start);\n this.history = new History(null);\n this.id = ++nextDocId;\n this.modeOption = mode;\n this.lineSep = lineSep;\n this.direction = (direction == \"rtl\") ? \"rtl\" : \"ltr\";\n this.extend = false;\n\n if (typeof text == \"string\") { text = this.splitLines(text); }\n updateDoc(this, {from: start, to: start, text: text});\n setSelection(this, simpleSelection(start), sel_dontScroll);\n};\n\nDoc.prototype = createObj(BranchChunk.prototype, {\n constructor: Doc,\n // Iterate over the document. Supports two forms -- with only one\n // argument, it calls that for each line in the document. With\n // three, it iterates over the range given by the first two (with\n // the second being non-inclusive).\n iter: function(from, to, op) {\n if (op) { this.iterN(from - this.first, to - from, op); }\n else { this.iterN(this.first, this.first + this.size, from); }\n },\n\n // Non-public interface for adding and removing lines.\n insert: function(at, lines) {\n var height = 0;\n for (var i = 0; i < lines.length; ++i) { height += lines[i].height; }\n this.insertInner(at - this.first, lines, height);\n },\n remove: function(at, n) { this.removeInner(at - this.first, n); },\n\n // From here, the methods are part of the public interface. Most\n // are also available from CodeMirror (editor) instances.\n\n getValue: function(lineSep) {\n var lines = getLines(this, this.first, this.first + this.size);\n if (lineSep === false) { return lines }\n return lines.join(lineSep || this.lineSeparator())\n },\n setValue: docMethodOp(function(code) {\n var top = Pos(this.first, 0), last = this.first + this.size - 1;\n makeChange(this, {from: top, to: Pos(last, getLine(this, last).text.length),\n text: this.splitLines(code), origin: \"setValue\", full: true}, true);\n if (this.cm) { scrollToCoords(this.cm, 0, 0); }\n setSelection(this, simpleSelection(top), sel_dontScroll);\n }),\n replaceRange: function(code, from, to, origin) {\n from = clipPos(this, from);\n to = to ? clipPos(this, to) : from;\n replaceRange(this, code, from, to, origin);\n },\n getRange: function(from, to, lineSep) {\n var lines = getBetween(this, clipPos(this, from), clipPos(this, to));\n if (lineSep === false) { return lines }\n return lines.join(lineSep || this.lineSeparator())\n },\n\n getLine: function(line) {var l = this.getLineHandle(line); return l && l.text},\n\n getLineHandle: function(line) {if (isLine(this, line)) { return getLine(this, line) }},\n getLineNumber: function(line) {return lineNo(line)},\n\n getLineHandleVisualStart: function(line) {\n if (typeof line == \"number\") { line = getLine(this, line); }\n return visualLine(line)\n },\n\n lineCount: function() {return this.size},\n firstLine: function() {return this.first},\n lastLine: function() {return this.first + this.size - 1},\n\n clipPos: function(pos) {return clipPos(this, pos)},\n\n getCursor: function(start) {\n var range$$1 = this.sel.primary(), pos;\n if (start == null || start == \"head\") { pos = range$$1.head; }\n else if (start == \"anchor\") { pos = range$$1.anchor; }\n else if (start == \"end\" || start == \"to\" || start === false) { pos = range$$1.to(); }\n else { pos = range$$1.from(); }\n return pos\n },\n listSelections: function() { return this.sel.ranges },\n somethingSelected: function() {return this.sel.somethingSelected()},\n\n setCursor: docMethodOp(function(line, ch, options) {\n setSimpleSelection(this, clipPos(this, typeof line == \"number\" ? Pos(line, ch || 0) : line), null, options);\n }),\n setSelection: docMethodOp(function(anchor, head, options) {\n setSimpleSelection(this, clipPos(this, anchor), clipPos(this, head || anchor), options);\n }),\n extendSelection: docMethodOp(function(head, other, options) {\n extendSelection(this, clipPos(this, head), other && clipPos(this, other), options);\n }),\n extendSelections: docMethodOp(function(heads, options) {\n extendSelections(this, clipPosArray(this, heads), options);\n }),\n extendSelectionsBy: docMethodOp(function(f, options) {\n var heads = map(this.sel.ranges, f);\n extendSelections(this, clipPosArray(this, heads), options);\n }),\n setSelections: docMethodOp(function(ranges, primary, options) {\n var this$1 = this;\n\n if (!ranges.length) { return }\n var out = [];\n for (var i = 0; i < ranges.length; i++)\n { out[i] = new Range(clipPos(this$1, ranges[i].anchor),\n clipPos(this$1, ranges[i].head)); }\n if (primary == null) { primary = Math.min(ranges.length - 1, this.sel.primIndex); }\n setSelection(this, normalizeSelection(out, primary), options);\n }),\n addSelection: docMethodOp(function(anchor, head, options) {\n var ranges = this.sel.ranges.slice(0);\n ranges.push(new Range(clipPos(this, anchor), clipPos(this, head || anchor)));\n setSelection(this, normalizeSelection(ranges, ranges.length - 1), options);\n }),\n\n getSelection: function(lineSep) {\n var this$1 = this;\n\n var ranges = this.sel.ranges, lines;\n for (var i = 0; i < ranges.length; i++) {\n var sel = getBetween(this$1, ranges[i].from(), ranges[i].to());\n lines = lines ? lines.concat(sel) : sel;\n }\n if (lineSep === false) { return lines }\n else { return lines.join(lineSep || this.lineSeparator()) }\n },\n getSelections: function(lineSep) {\n var this$1 = this;\n\n var parts = [], ranges = this.sel.ranges;\n for (var i = 0; i < ranges.length; i++) {\n var sel = getBetween(this$1, ranges[i].from(), ranges[i].to());\n if (lineSep !== false) { sel = sel.join(lineSep || this$1.lineSeparator()); }\n parts[i] = sel;\n }\n return parts\n },\n replaceSelection: function(code, collapse, origin) {\n var dup = [];\n for (var i = 0; i < this.sel.ranges.length; i++)\n { dup[i] = code; }\n this.replaceSelections(dup, collapse, origin || \"+input\");\n },\n replaceSelections: docMethodOp(function(code, collapse, origin) {\n var this$1 = this;\n\n var changes = [], sel = this.sel;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range$$1 = sel.ranges[i];\n changes[i] = {from: range$$1.from(), to: range$$1.to(), text: this$1.splitLines(code[i]), origin: origin};\n }\n var newSel = collapse && collapse != \"end\" && computeReplacedSel(this, changes, collapse);\n for (var i$1 = changes.length - 1; i$1 >= 0; i$1--)\n { makeChange(this$1, changes[i$1]); }\n if (newSel) { setSelectionReplaceHistory(this, newSel); }\n else if (this.cm) { ensureCursorVisible(this.cm); }\n }),\n undo: docMethodOp(function() {makeChangeFromHistory(this, \"undo\");}),\n redo: docMethodOp(function() {makeChangeFromHistory(this, \"redo\");}),\n undoSelection: docMethodOp(function() {makeChangeFromHistory(this, \"undo\", true);}),\n redoSelection: docMethodOp(function() {makeChangeFromHistory(this, \"redo\", true);}),\n\n setExtending: function(val) {this.extend = val;},\n getExtending: function() {return this.extend},\n\n historySize: function() {\n var hist = this.history, done = 0, undone = 0;\n for (var i = 0; i < hist.done.length; i++) { if (!hist.done[i].ranges) { ++done; } }\n for (var i$1 = 0; i$1 < hist.undone.length; i$1++) { if (!hist.undone[i$1].ranges) { ++undone; } }\n return {undo: done, redo: undone}\n },\n clearHistory: function() {this.history = new History(this.history.maxGeneration);},\n\n markClean: function() {\n this.cleanGeneration = this.changeGeneration(true);\n },\n changeGeneration: function(forceSplit) {\n if (forceSplit)\n { this.history.lastOp = this.history.lastSelOp = this.history.lastOrigin = null; }\n return this.history.generation\n },\n isClean: function (gen) {\n return this.history.generation == (gen || this.cleanGeneration)\n },\n\n getHistory: function() {\n return {done: copyHistoryArray(this.history.done),\n undone: copyHistoryArray(this.history.undone)}\n },\n setHistory: function(histData) {\n var hist = this.history = new History(this.history.maxGeneration);\n hist.done = copyHistoryArray(histData.done.slice(0), null, true);\n hist.undone = copyHistoryArray(histData.undone.slice(0), null, true);\n },\n\n setGutterMarker: docMethodOp(function(line, gutterID, value) {\n return changeLine(this, line, \"gutter\", function (line) {\n var markers = line.gutterMarkers || (line.gutterMarkers = {});\n markers[gutterID] = value;\n if (!value && isEmpty(markers)) { line.gutterMarkers = null; }\n return true\n })\n }),\n\n clearGutter: docMethodOp(function(gutterID) {\n var this$1 = this;\n\n this.iter(function (line) {\n if (line.gutterMarkers && line.gutterMarkers[gutterID]) {\n changeLine(this$1, line, \"gutter\", function () {\n line.gutterMarkers[gutterID] = null;\n if (isEmpty(line.gutterMarkers)) { line.gutterMarkers = null; }\n return true\n });\n }\n });\n }),\n\n lineInfo: function(line) {\n var n;\n if (typeof line == \"number\") {\n if (!isLine(this, line)) { return null }\n n = line;\n line = getLine(this, line);\n if (!line) { return null }\n } else {\n n = lineNo(line);\n if (n == null) { return null }\n }\n return {line: n, handle: line, text: line.text, gutterMarkers: line.gutterMarkers,\n textClass: line.textClass, bgClass: line.bgClass, wrapClass: line.wrapClass,\n widgets: line.widgets}\n },\n\n addLineClass: docMethodOp(function(handle, where, cls) {\n return changeLine(this, handle, where == \"gutter\" ? \"gutter\" : \"class\", function (line) {\n var prop = where == \"text\" ? \"textClass\"\n : where == \"background\" ? \"bgClass\"\n : where == \"gutter\" ? \"gutterClass\" : \"wrapClass\";\n if (!line[prop]) { line[prop] = cls; }\n else if (classTest(cls).test(line[prop])) { return false }\n else { line[prop] += \" \" + cls; }\n return true\n })\n }),\n removeLineClass: docMethodOp(function(handle, where, cls) {\n return changeLine(this, handle, where == \"gutter\" ? \"gutter\" : \"class\", function (line) {\n var prop = where == \"text\" ? \"textClass\"\n : where == \"background\" ? \"bgClass\"\n : where == \"gutter\" ? \"gutterClass\" : \"wrapClass\";\n var cur = line[prop];\n if (!cur) { return false }\n else if (cls == null) { line[prop] = null; }\n else {\n var found = cur.match(classTest(cls));\n if (!found) { return false }\n var end = found.index + found[0].length;\n line[prop] = cur.slice(0, found.index) + (!found.index || end == cur.length ? \"\" : \" \") + cur.slice(end) || null;\n }\n return true\n })\n }),\n\n addLineWidget: docMethodOp(function(handle, node, options) {\n return addLineWidget(this, handle, node, options)\n }),\n removeLineWidget: function(widget) { widget.clear(); },\n\n markText: function(from, to, options) {\n return markText(this, clipPos(this, from), clipPos(this, to), options, options && options.type || \"range\")\n },\n setBookmark: function(pos, options) {\n var realOpts = {replacedWith: options && (options.nodeType == null ? options.widget : options),\n insertLeft: options && options.insertLeft,\n clearWhenEmpty: false, shared: options && options.shared,\n handleMouseEvents: options && options.handleMouseEvents};\n pos = clipPos(this, pos);\n return markText(this, pos, pos, realOpts, \"bookmark\")\n },\n findMarksAt: function(pos) {\n pos = clipPos(this, pos);\n var markers = [], spans = getLine(this, pos.line).markedSpans;\n if (spans) { for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if ((span.from == null || span.from <= pos.ch) &&\n (span.to == null || span.to >= pos.ch))\n { markers.push(span.marker.parent || span.marker); }\n } }\n return markers\n },\n findMarks: function(from, to, filter) {\n from = clipPos(this, from); to = clipPos(this, to);\n var found = [], lineNo$$1 = from.line;\n this.iter(from.line, to.line + 1, function (line) {\n var spans = line.markedSpans;\n if (spans) { for (var i = 0; i < spans.length; i++) {\n var span = spans[i];\n if (!(span.to != null && lineNo$$1 == from.line && from.ch >= span.to ||\n span.from == null && lineNo$$1 != from.line ||\n span.from != null && lineNo$$1 == to.line && span.from >= to.ch) &&\n (!filter || filter(span.marker)))\n { found.push(span.marker.parent || span.marker); }\n } }\n ++lineNo$$1;\n });\n return found\n },\n getAllMarks: function() {\n var markers = [];\n this.iter(function (line) {\n var sps = line.markedSpans;\n if (sps) { for (var i = 0; i < sps.length; ++i)\n { if (sps[i].from != null) { markers.push(sps[i].marker); } } }\n });\n return markers\n },\n\n posFromIndex: function(off) {\n var ch, lineNo$$1 = this.first, sepSize = this.lineSeparator().length;\n this.iter(function (line) {\n var sz = line.text.length + sepSize;\n if (sz > off) { ch = off; return true }\n off -= sz;\n ++lineNo$$1;\n });\n return clipPos(this, Pos(lineNo$$1, ch))\n },\n indexFromPos: function (coords) {\n coords = clipPos(this, coords);\n var index = coords.ch;\n if (coords.line < this.first || coords.ch < 0) { return 0 }\n var sepSize = this.lineSeparator().length;\n this.iter(this.first, coords.line, function (line) { // iter aborts when callback returns a truthy value\n index += line.text.length + sepSize;\n });\n return index\n },\n\n copy: function(copyHistory) {\n var doc = new Doc(getLines(this, this.first, this.first + this.size),\n this.modeOption, this.first, this.lineSep, this.direction);\n doc.scrollTop = this.scrollTop; doc.scrollLeft = this.scrollLeft;\n doc.sel = this.sel;\n doc.extend = false;\n if (copyHistory) {\n doc.history.undoDepth = this.history.undoDepth;\n doc.setHistory(this.getHistory());\n }\n return doc\n },\n\n linkedDoc: function(options) {\n if (!options) { options = {}; }\n var from = this.first, to = this.first + this.size;\n if (options.from != null && options.from > from) { from = options.from; }\n if (options.to != null && options.to < to) { to = options.to; }\n var copy = new Doc(getLines(this, from, to), options.mode || this.modeOption, from, this.lineSep, this.direction);\n if (options.sharedHist) { copy.history = this.history\n ; }(this.linked || (this.linked = [])).push({doc: copy, sharedHist: options.sharedHist});\n copy.linked = [{doc: this, isParent: true, sharedHist: options.sharedHist}];\n copySharedMarkers(copy, findSharedMarkers(this));\n return copy\n },\n unlinkDoc: function(other) {\n var this$1 = this;\n\n if (other instanceof CodeMirror$1) { other = other.doc; }\n if (this.linked) { for (var i = 0; i < this.linked.length; ++i) {\n var link = this$1.linked[i];\n if (link.doc != other) { continue }\n this$1.linked.splice(i, 1);\n other.unlinkDoc(this$1);\n detachSharedMarkers(findSharedMarkers(this$1));\n break\n } }\n // If the histories were shared, split them again\n if (other.history == this.history) {\n var splitIds = [other.id];\n linkedDocs(other, function (doc) { return splitIds.push(doc.id); }, true);\n other.history = new History(null);\n other.history.done = copyHistoryArray(this.history.done, splitIds);\n other.history.undone = copyHistoryArray(this.history.undone, splitIds);\n }\n },\n iterLinkedDocs: function(f) {linkedDocs(this, f);},\n\n getMode: function() {return this.mode},\n getEditor: function() {return this.cm},\n\n splitLines: function(str) {\n if (this.lineSep) { return str.split(this.lineSep) }\n return splitLinesAuto(str)\n },\n lineSeparator: function() { return this.lineSep || \"\\n\" },\n\n setDirection: docMethodOp(function (dir) {\n if (dir != \"rtl\") { dir = \"ltr\"; }\n if (dir == this.direction) { return }\n this.direction = dir;\n this.iter(function (line) { return line.order = null; });\n if (this.cm) { directionChanged(this.cm); }\n })\n});\n\n// Public alias.\nDoc.prototype.eachLine = Doc.prototype.iter;\n\n// Kludge to work around strange IE behavior where it'll sometimes\n// re-fire a series of drag-related events right after the drop (#1551)\nvar lastDrop = 0;\n\nfunction onDrop(e) {\n var cm = this;\n clearDragCursor(cm);\n if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e))\n { return }\n e_preventDefault(e);\n if (ie) { lastDrop = +new Date; }\n var pos = posFromMouse(cm, e, true), files = e.dataTransfer.files;\n if (!pos || cm.isReadOnly()) { return }\n // Might be a file drop, in which case we simply extract the text\n // and insert it.\n if (files && files.length && window.FileReader && window.File) {\n var n = files.length, text = Array(n), read = 0;\n var loadFile = function (file, i) {\n if (cm.options.allowDropFileTypes &&\n indexOf(cm.options.allowDropFileTypes, file.type) == -1)\n { return }\n\n var reader = new FileReader;\n reader.onload = operation(cm, function () {\n var content = reader.result;\n if (/[\\x00-\\x08\\x0e-\\x1f]{2}/.test(content)) { content = \"\"; }\n text[i] = content;\n if (++read == n) {\n pos = clipPos(cm.doc, pos);\n var change = {from: pos, to: pos,\n text: cm.doc.splitLines(text.join(cm.doc.lineSeparator())),\n origin: \"paste\"};\n makeChange(cm.doc, change);\n setSelectionReplaceHistory(cm.doc, simpleSelection(pos, changeEnd(change)));\n }\n });\n reader.readAsText(file);\n };\n for (var i = 0; i < n; ++i) { loadFile(files[i], i); }\n } else { // Normal drop\n // Don't do a replace if the drop happened inside of the selected text.\n if (cm.state.draggingText && cm.doc.sel.contains(pos) > -1) {\n cm.state.draggingText(e);\n // Ensure the editor is re-focused\n setTimeout(function () { return cm.display.input.focus(); }, 20);\n return\n }\n try {\n var text$1 = e.dataTransfer.getData(\"Text\");\n if (text$1) {\n var selected;\n if (cm.state.draggingText && !cm.state.draggingText.copy)\n { selected = cm.listSelections(); }\n setSelectionNoUndo(cm.doc, simpleSelection(pos, pos));\n if (selected) { for (var i$1 = 0; i$1 < selected.length; ++i$1)\n { replaceRange(cm.doc, \"\", selected[i$1].anchor, selected[i$1].head, \"drag\"); } }\n cm.replaceSelection(text$1, \"around\", \"paste\");\n cm.display.input.focus();\n }\n }\n catch(e){}\n }\n}\n\nfunction onDragStart(cm, e) {\n if (ie && (!cm.state.draggingText || +new Date - lastDrop < 100)) { e_stop(e); return }\n if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e)) { return }\n\n e.dataTransfer.setData(\"Text\", cm.getSelection());\n e.dataTransfer.effectAllowed = \"copyMove\";\n\n // Use dummy image instead of default browsers image.\n // Recent Safari (~6.0.2) have a tendency to segfault when this happens, so we don't do it there.\n if (e.dataTransfer.setDragImage && !safari) {\n var img = elt(\"img\", null, null, \"position: fixed; left: 0; top: 0;\");\n img.src = \"data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==\";\n if (presto) {\n img.width = img.height = 1;\n cm.display.wrapper.appendChild(img);\n // Force a relayout, or Opera won't use our image for some obscure reason\n img._top = img.offsetTop;\n }\n e.dataTransfer.setDragImage(img, 0, 0);\n if (presto) { img.parentNode.removeChild(img); }\n }\n}\n\nfunction onDragOver(cm, e) {\n var pos = posFromMouse(cm, e);\n if (!pos) { return }\n var frag = document.createDocumentFragment();\n drawSelectionCursor(cm, pos, frag);\n if (!cm.display.dragCursor) {\n cm.display.dragCursor = elt(\"div\", null, \"CodeMirror-cursors CodeMirror-dragcursors\");\n cm.display.lineSpace.insertBefore(cm.display.dragCursor, cm.display.cursorDiv);\n }\n removeChildrenAndAdd(cm.display.dragCursor, frag);\n}\n\nfunction clearDragCursor(cm) {\n if (cm.display.dragCursor) {\n cm.display.lineSpace.removeChild(cm.display.dragCursor);\n cm.display.dragCursor = null;\n }\n}\n\n// These must be handled carefully, because naively registering a\n// handler for each editor will cause the editors to never be\n// garbage collected.\n\nfunction forEachCodeMirror(f) {\n if (!document.getElementsByClassName) { return }\n var byClass = document.getElementsByClassName(\"CodeMirror\");\n for (var i = 0; i < byClass.length; i++) {\n var cm = byClass[i].CodeMirror;\n if (cm) { f(cm); }\n }\n}\n\nvar globalsRegistered = false;\nfunction ensureGlobalHandlers() {\n if (globalsRegistered) { return }\n registerGlobalHandlers();\n globalsRegistered = true;\n}\nfunction registerGlobalHandlers() {\n // When the window resizes, we need to refresh active editors.\n var resizeTimer;\n on(window, \"resize\", function () {\n if (resizeTimer == null) { resizeTimer = setTimeout(function () {\n resizeTimer = null;\n forEachCodeMirror(onResize);\n }, 100); }\n });\n // When the window loses focus, we want to show the editor as blurred\n on(window, \"blur\", function () { return forEachCodeMirror(onBlur); });\n}\n// Called when the window resizes\nfunction onResize(cm) {\n var d = cm.display;\n if (d.lastWrapHeight == d.wrapper.clientHeight && d.lastWrapWidth == d.wrapper.clientWidth)\n { return }\n // Might be a text scaling operation, clear size caches.\n d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;\n d.scrollbarsClipped = false;\n cm.setSize();\n}\n\nvar keyNames = {\n 3: \"Enter\", 8: \"Backspace\", 9: \"Tab\", 13: \"Enter\", 16: \"Shift\", 17: \"Ctrl\", 18: \"Alt\",\n 19: \"Pause\", 20: \"CapsLock\", 27: \"Esc\", 32: \"Space\", 33: \"PageUp\", 34: \"PageDown\", 35: \"End\",\n 36: \"Home\", 37: \"Left\", 38: \"Up\", 39: \"Right\", 40: \"Down\", 44: \"PrintScrn\", 45: \"Insert\",\n 46: \"Delete\", 59: \";\", 61: \"=\", 91: \"Mod\", 92: \"Mod\", 93: \"Mod\",\n 106: \"*\", 107: \"=\", 109: \"-\", 110: \".\", 111: \"/\", 127: \"Delete\",\n 173: \"-\", 186: \";\", 187: \"=\", 188: \",\", 189: \"-\", 190: \".\", 191: \"/\", 192: \"`\", 219: \"[\", 220: \"\\\\\",\n 221: \"]\", 222: \"'\", 63232: \"Up\", 63233: \"Down\", 63234: \"Left\", 63235: \"Right\", 63272: \"Delete\",\n 63273: \"Home\", 63275: \"End\", 63276: \"PageUp\", 63277: \"PageDown\", 63302: \"Insert\"\n};\n\n// Number keys\nfor (var i = 0; i < 10; i++) { keyNames[i + 48] = keyNames[i + 96] = String(i); }\n// Alphabetic keys\nfor (var i$1 = 65; i$1 <= 90; i$1++) { keyNames[i$1] = String.fromCharCode(i$1); }\n// Function keys\nfor (var i$2 = 1; i$2 <= 12; i$2++) { keyNames[i$2 + 111] = keyNames[i$2 + 63235] = \"F\" + i$2; }\n\nvar keyMap = {};\n\nkeyMap.basic = {\n \"Left\": \"goCharLeft\", \"Right\": \"goCharRight\", \"Up\": \"goLineUp\", \"Down\": \"goLineDown\",\n \"End\": \"goLineEnd\", \"Home\": \"goLineStartSmart\", \"PageUp\": \"goPageUp\", \"PageDown\": \"goPageDown\",\n \"Delete\": \"delCharAfter\", \"Backspace\": \"delCharBefore\", \"Shift-Backspace\": \"delCharBefore\",\n \"Tab\": \"defaultTab\", \"Shift-Tab\": \"indentAuto\",\n \"Enter\": \"newlineAndIndent\", \"Insert\": \"toggleOverwrite\",\n \"Esc\": \"singleSelection\"\n};\n// Note that the save and find-related commands aren't defined by\n// default. User code or addons can define them. Unknown commands\n// are simply ignored.\nkeyMap.pcDefault = {\n \"Ctrl-A\": \"selectAll\", \"Ctrl-D\": \"deleteLine\", \"Ctrl-Z\": \"undo\", \"Shift-Ctrl-Z\": \"redo\", \"Ctrl-Y\": \"redo\",\n \"Ctrl-Home\": \"goDocStart\", \"Ctrl-End\": \"goDocEnd\", \"Ctrl-Up\": \"goLineUp\", \"Ctrl-Down\": \"goLineDown\",\n \"Ctrl-Left\": \"goGroupLeft\", \"Ctrl-Right\": \"goGroupRight\", \"Alt-Left\": \"goLineStart\", \"Alt-Right\": \"goLineEnd\",\n \"Ctrl-Backspace\": \"delGroupBefore\", \"Ctrl-Delete\": \"delGroupAfter\", \"Ctrl-S\": \"save\", \"Ctrl-F\": \"find\",\n \"Ctrl-G\": \"findNext\", \"Shift-Ctrl-G\": \"findPrev\", \"Shift-Ctrl-F\": \"replace\", \"Shift-Ctrl-R\": \"replaceAll\",\n \"Ctrl-[\": \"indentLess\", \"Ctrl-]\": \"indentMore\",\n \"Ctrl-U\": \"undoSelection\", \"Shift-Ctrl-U\": \"redoSelection\", \"Alt-U\": \"redoSelection\",\n fallthrough: \"basic\"\n};\n// Very basic readline/emacs-style bindings, which are standard on Mac.\nkeyMap.emacsy = {\n \"Ctrl-F\": \"goCharRight\", \"Ctrl-B\": \"goCharLeft\", \"Ctrl-P\": \"goLineUp\", \"Ctrl-N\": \"goLineDown\",\n \"Alt-F\": \"goWordRight\", \"Alt-B\": \"goWordLeft\", \"Ctrl-A\": \"goLineStart\", \"Ctrl-E\": \"goLineEnd\",\n \"Ctrl-V\": \"goPageDown\", \"Shift-Ctrl-V\": \"goPageUp\", \"Ctrl-D\": \"delCharAfter\", \"Ctrl-H\": \"delCharBefore\",\n \"Alt-D\": \"delWordAfter\", \"Alt-Backspace\": \"delWordBefore\", \"Ctrl-K\": \"killLine\", \"Ctrl-T\": \"transposeChars\",\n \"Ctrl-O\": \"openLine\"\n};\nkeyMap.macDefault = {\n \"Cmd-A\": \"selectAll\", \"Cmd-D\": \"deleteLine\", \"Cmd-Z\": \"undo\", \"Shift-Cmd-Z\": \"redo\", \"Cmd-Y\": \"redo\",\n \"Cmd-Home\": \"goDocStart\", \"Cmd-Up\": \"goDocStart\", \"Cmd-End\": \"goDocEnd\", \"Cmd-Down\": \"goDocEnd\", \"Alt-Left\": \"goGroupLeft\",\n \"Alt-Right\": \"goGroupRight\", \"Cmd-Left\": \"goLineLeft\", \"Cmd-Right\": \"goLineRight\", \"Alt-Backspace\": \"delGroupBefore\",\n \"Ctrl-Alt-Backspace\": \"delGroupAfter\", \"Alt-Delete\": \"delGroupAfter\", \"Cmd-S\": \"save\", \"Cmd-F\": \"find\",\n \"Cmd-G\": \"findNext\", \"Shift-Cmd-G\": \"findPrev\", \"Cmd-Alt-F\": \"replace\", \"Shift-Cmd-Alt-F\": \"replaceAll\",\n \"Cmd-[\": \"indentLess\", \"Cmd-]\": \"indentMore\", \"Cmd-Backspace\": \"delWrappedLineLeft\", \"Cmd-Delete\": \"delWrappedLineRight\",\n \"Cmd-U\": \"undoSelection\", \"Shift-Cmd-U\": \"redoSelection\", \"Ctrl-Up\": \"goDocStart\", \"Ctrl-Down\": \"goDocEnd\",\n fallthrough: [\"basic\", \"emacsy\"]\n};\nkeyMap[\"default\"] = mac ? keyMap.macDefault : keyMap.pcDefault;\n\n// KEYMAP DISPATCH\n\nfunction normalizeKeyName(name) {\n var parts = name.split(/-(?!$)/);\n name = parts[parts.length - 1];\n var alt, ctrl, shift, cmd;\n for (var i = 0; i < parts.length - 1; i++) {\n var mod = parts[i];\n if (/^(cmd|meta|m)$/i.test(mod)) { cmd = true; }\n else if (/^a(lt)?$/i.test(mod)) { alt = true; }\n else if (/^(c|ctrl|control)$/i.test(mod)) { ctrl = true; }\n else if (/^s(hift)?$/i.test(mod)) { shift = true; }\n else { throw new Error(\"Unrecognized modifier name: \" + mod) }\n }\n if (alt) { name = \"Alt-\" + name; }\n if (ctrl) { name = \"Ctrl-\" + name; }\n if (cmd) { name = \"Cmd-\" + name; }\n if (shift) { name = \"Shift-\" + name; }\n return name\n}\n\n// This is a kludge to keep keymaps mostly working as raw objects\n// (backwards compatibility) while at the same time support features\n// like normalization and multi-stroke key bindings. It compiles a\n// new normalized keymap, and then updates the old object to reflect\n// this.\nfunction normalizeKeyMap(keymap) {\n var copy = {};\n for (var keyname in keymap) { if (keymap.hasOwnProperty(keyname)) {\n var value = keymap[keyname];\n if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) { continue }\n if (value == \"...\") { delete keymap[keyname]; continue }\n\n var keys = map(keyname.split(\" \"), normalizeKeyName);\n for (var i = 0; i < keys.length; i++) {\n var val = (void 0), name = (void 0);\n if (i == keys.length - 1) {\n name = keys.join(\" \");\n val = value;\n } else {\n name = keys.slice(0, i + 1).join(\" \");\n val = \"...\";\n }\n var prev = copy[name];\n if (!prev) { copy[name] = val; }\n else if (prev != val) { throw new Error(\"Inconsistent bindings for \" + name) }\n }\n delete keymap[keyname];\n } }\n for (var prop in copy) { keymap[prop] = copy[prop]; }\n return keymap\n}\n\nfunction lookupKey(key, map$$1, handle, context) {\n map$$1 = getKeyMap(map$$1);\n var found = map$$1.call ? map$$1.call(key, context) : map$$1[key];\n if (found === false) { return \"nothing\" }\n if (found === \"...\") { return \"multi\" }\n if (found != null && handle(found)) { return \"handled\" }\n\n if (map$$1.fallthrough) {\n if (Object.prototype.toString.call(map$$1.fallthrough) != \"[object Array]\")\n { return lookupKey(key, map$$1.fallthrough, handle, context) }\n for (var i = 0; i < map$$1.fallthrough.length; i++) {\n var result = lookupKey(key, map$$1.fallthrough[i], handle, context);\n if (result) { return result }\n }\n }\n}\n\n// Modifier key presses don't count as 'real' key presses for the\n// purpose of keymap fallthrough.\nfunction isModifierKey(value) {\n var name = typeof value == \"string\" ? value : keyNames[value.keyCode];\n return name == \"Ctrl\" || name == \"Alt\" || name == \"Shift\" || name == \"Mod\"\n}\n\nfunction addModifierNames(name, event, noShift) {\n var base = name;\n if (event.altKey && base != \"Alt\") { name = \"Alt-\" + name; }\n if ((flipCtrlCmd ? event.metaKey : event.ctrlKey) && base != \"Ctrl\") { name = \"Ctrl-\" + name; }\n if ((flipCtrlCmd ? event.ctrlKey : event.metaKey) && base != \"Cmd\") { name = \"Cmd-\" + name; }\n if (!noShift && event.shiftKey && base != \"Shift\") { name = \"Shift-\" + name; }\n return name\n}\n\n// Look up the name of a key as indicated by an event object.\nfunction keyName(event, noShift) {\n if (presto && event.keyCode == 34 && event[\"char\"]) { return false }\n var name = keyNames[event.keyCode];\n if (name == null || event.altGraphKey) { return false }\n return addModifierNames(name, event, noShift)\n}\n\nfunction getKeyMap(val) {\n return typeof val == \"string\" ? keyMap[val] : val\n}\n\n// Helper for deleting text near the selection(s), used to implement\n// backspace, delete, and similar functionality.\nfunction deleteNearSelection(cm, compute) {\n var ranges = cm.doc.sel.ranges, kill = [];\n // Build up a set of ranges to kill first, merging overlapping\n // ranges.\n for (var i = 0; i < ranges.length; i++) {\n var toKill = compute(ranges[i]);\n while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) {\n var replaced = kill.pop();\n if (cmp(replaced.from, toKill.from) < 0) {\n toKill.from = replaced.from;\n break\n }\n }\n kill.push(toKill);\n }\n // Next, remove those actual ranges.\n runInOp(cm, function () {\n for (var i = kill.length - 1; i >= 0; i--)\n { replaceRange(cm.doc, \"\", kill[i].from, kill[i].to, \"+delete\"); }\n ensureCursorVisible(cm);\n });\n}\n\nfunction moveCharLogically(line, ch, dir) {\n var target = skipExtendingChars(line.text, ch + dir, dir);\n return target < 0 || target > line.text.length ? null : target\n}\n\nfunction moveLogically(line, start, dir) {\n var ch = moveCharLogically(line, start.ch, dir);\n return ch == null ? null : new Pos(start.line, ch, dir < 0 ? \"after\" : \"before\")\n}\n\nfunction endOfLine(visually, cm, lineObj, lineNo, dir) {\n if (visually) {\n var order = getOrder(lineObj, cm.doc.direction);\n if (order) {\n var part = dir < 0 ? lst(order) : order[0];\n var moveInStorageOrder = (dir < 0) == (part.level == 1);\n var sticky = moveInStorageOrder ? \"after\" : \"before\";\n var ch;\n // With a wrapped rtl chunk (possibly spanning multiple bidi parts),\n // it could be that the last bidi part is not on the last visual line,\n // since visual lines contain content order-consecutive chunks.\n // Thus, in rtl, we are looking for the first (content-order) character\n // in the rtl chunk that is on the last line (that is, the same line\n // as the last (content-order) character).\n if (part.level > 0 || cm.doc.direction == \"rtl\") {\n var prep = prepareMeasureForLine(cm, lineObj);\n ch = dir < 0 ? lineObj.text.length - 1 : 0;\n var targetTop = measureCharPrepared(cm, prep, ch).top;\n ch = findFirst(function (ch) { return measureCharPrepared(cm, prep, ch).top == targetTop; }, (dir < 0) == (part.level == 1) ? part.from : part.to - 1, ch);\n if (sticky == \"before\") { ch = moveCharLogically(lineObj, ch, 1); }\n } else { ch = dir < 0 ? part.to : part.from; }\n return new Pos(lineNo, ch, sticky)\n }\n }\n return new Pos(lineNo, dir < 0 ? lineObj.text.length : 0, dir < 0 ? \"before\" : \"after\")\n}\n\nfunction moveVisually(cm, line, start, dir) {\n var bidi = getOrder(line, cm.doc.direction);\n if (!bidi) { return moveLogically(line, start, dir) }\n if (start.ch >= line.text.length) {\n start.ch = line.text.length;\n start.sticky = \"before\";\n } else if (start.ch <= 0) {\n start.ch = 0;\n start.sticky = \"after\";\n }\n var partPos = getBidiPartAt(bidi, start.ch, start.sticky), part = bidi[partPos];\n if (cm.doc.direction == \"ltr\" && part.level % 2 == 0 && (dir > 0 ? part.to > start.ch : part.from < start.ch)) {\n // Case 1: We move within an ltr part in an ltr editor. Even with wrapped lines,\n // nothing interesting happens.\n return moveLogically(line, start, dir)\n }\n\n var mv = function (pos, dir) { return moveCharLogically(line, pos instanceof Pos ? pos.ch : pos, dir); };\n var prep;\n var getWrappedLineExtent = function (ch) {\n if (!cm.options.lineWrapping) { return {begin: 0, end: line.text.length} }\n prep = prep || prepareMeasureForLine(cm, line);\n return wrappedLineExtentChar(cm, line, prep, ch)\n };\n var wrappedLineExtent = getWrappedLineExtent(start.sticky == \"before\" ? mv(start, -1) : start.ch);\n\n if (cm.doc.direction == \"rtl\" || part.level == 1) {\n var moveInStorageOrder = (part.level == 1) == (dir < 0);\n var ch = mv(start, moveInStorageOrder ? 1 : -1);\n if (ch != null && (!moveInStorageOrder ? ch >= part.from && ch >= wrappedLineExtent.begin : ch <= part.to && ch <= wrappedLineExtent.end)) {\n // Case 2: We move within an rtl part or in an rtl editor on the same visual line\n var sticky = moveInStorageOrder ? \"before\" : \"after\";\n return new Pos(start.line, ch, sticky)\n }\n }\n\n // Case 3: Could not move within this bidi part in this visual line, so leave\n // the current bidi part\n\n var searchInVisualLine = function (partPos, dir, wrappedLineExtent) {\n var getRes = function (ch, moveInStorageOrder) { return moveInStorageOrder\n ? new Pos(start.line, mv(ch, 1), \"before\")\n : new Pos(start.line, ch, \"after\"); };\n\n for (; partPos >= 0 && partPos < bidi.length; partPos += dir) {\n var part = bidi[partPos];\n var moveInStorageOrder = (dir > 0) == (part.level != 1);\n var ch = moveInStorageOrder ? wrappedLineExtent.begin : mv(wrappedLineExtent.end, -1);\n if (part.from <= ch && ch < part.to) { return getRes(ch, moveInStorageOrder) }\n ch = moveInStorageOrder ? part.from : mv(part.to, -1);\n if (wrappedLineExtent.begin <= ch && ch < wrappedLineExtent.end) { return getRes(ch, moveInStorageOrder) }\n }\n };\n\n // Case 3a: Look for other bidi parts on the same visual line\n var res = searchInVisualLine(partPos + dir, dir, wrappedLineExtent);\n if (res) { return res }\n\n // Case 3b: Look for other bidi parts on the next visual line\n var nextCh = dir > 0 ? wrappedLineExtent.end : mv(wrappedLineExtent.begin, -1);\n if (nextCh != null && !(dir > 0 && nextCh == line.text.length)) {\n res = searchInVisualLine(dir > 0 ? 0 : bidi.length - 1, dir, getWrappedLineExtent(nextCh));\n if (res) { return res }\n }\n\n // Case 4: Nowhere to move\n return null\n}\n\n// Commands are parameter-less actions that can be performed on an\n// editor, mostly used for keybindings.\nvar commands = {\n selectAll: selectAll,\n singleSelection: function (cm) { return cm.setSelection(cm.getCursor(\"anchor\"), cm.getCursor(\"head\"), sel_dontScroll); },\n killLine: function (cm) { return deleteNearSelection(cm, function (range) {\n if (range.empty()) {\n var len = getLine(cm.doc, range.head.line).text.length;\n if (range.head.ch == len && range.head.line < cm.lastLine())\n { return {from: range.head, to: Pos(range.head.line + 1, 0)} }\n else\n { return {from: range.head, to: Pos(range.head.line, len)} }\n } else {\n return {from: range.from(), to: range.to()}\n }\n }); },\n deleteLine: function (cm) { return deleteNearSelection(cm, function (range) { return ({\n from: Pos(range.from().line, 0),\n to: clipPos(cm.doc, Pos(range.to().line + 1, 0))\n }); }); },\n delLineLeft: function (cm) { return deleteNearSelection(cm, function (range) { return ({\n from: Pos(range.from().line, 0), to: range.from()\n }); }); },\n delWrappedLineLeft: function (cm) { return deleteNearSelection(cm, function (range) {\n var top = cm.charCoords(range.head, \"div\").top + 5;\n var leftPos = cm.coordsChar({left: 0, top: top}, \"div\");\n return {from: leftPos, to: range.from()}\n }); },\n delWrappedLineRight: function (cm) { return deleteNearSelection(cm, function (range) {\n var top = cm.charCoords(range.head, \"div\").top + 5;\n var rightPos = cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, \"div\");\n return {from: range.from(), to: rightPos }\n }); },\n undo: function (cm) { return cm.undo(); },\n redo: function (cm) { return cm.redo(); },\n undoSelection: function (cm) { return cm.undoSelection(); },\n redoSelection: function (cm) { return cm.redoSelection(); },\n goDocStart: function (cm) { return cm.extendSelection(Pos(cm.firstLine(), 0)); },\n goDocEnd: function (cm) { return cm.extendSelection(Pos(cm.lastLine())); },\n goLineStart: function (cm) { return cm.extendSelectionsBy(function (range) { return lineStart(cm, range.head.line); },\n {origin: \"+move\", bias: 1}\n ); },\n goLineStartSmart: function (cm) { return cm.extendSelectionsBy(function (range) { return lineStartSmart(cm, range.head); },\n {origin: \"+move\", bias: 1}\n ); },\n goLineEnd: function (cm) { return cm.extendSelectionsBy(function (range) { return lineEnd(cm, range.head.line); },\n {origin: \"+move\", bias: -1}\n ); },\n goLineRight: function (cm) { return cm.extendSelectionsBy(function (range) {\n var top = cm.cursorCoords(range.head, \"div\").top + 5;\n return cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, \"div\")\n }, sel_move); },\n goLineLeft: function (cm) { return cm.extendSelectionsBy(function (range) {\n var top = cm.cursorCoords(range.head, \"div\").top + 5;\n return cm.coordsChar({left: 0, top: top}, \"div\")\n }, sel_move); },\n goLineLeftSmart: function (cm) { return cm.extendSelectionsBy(function (range) {\n var top = cm.cursorCoords(range.head, \"div\").top + 5;\n var pos = cm.coordsChar({left: 0, top: top}, \"div\");\n if (pos.ch < cm.getLine(pos.line).search(/\\S/)) { return lineStartSmart(cm, range.head) }\n return pos\n }, sel_move); },\n goLineUp: function (cm) { return cm.moveV(-1, \"line\"); },\n goLineDown: function (cm) { return cm.moveV(1, \"line\"); },\n goPageUp: function (cm) { return cm.moveV(-1, \"page\"); },\n goPageDown: function (cm) { return cm.moveV(1, \"page\"); },\n goCharLeft: function (cm) { return cm.moveH(-1, \"char\"); },\n goCharRight: function (cm) { return cm.moveH(1, \"char\"); },\n goColumnLeft: function (cm) { return cm.moveH(-1, \"column\"); },\n goColumnRight: function (cm) { return cm.moveH(1, \"column\"); },\n goWordLeft: function (cm) { return cm.moveH(-1, \"word\"); },\n goGroupRight: function (cm) { return cm.moveH(1, \"group\"); },\n goGroupLeft: function (cm) { return cm.moveH(-1, \"group\"); },\n goWordRight: function (cm) { return cm.moveH(1, \"word\"); },\n delCharBefore: function (cm) { return cm.deleteH(-1, \"char\"); },\n delCharAfter: function (cm) { return cm.deleteH(1, \"char\"); },\n delWordBefore: function (cm) { return cm.deleteH(-1, \"word\"); },\n delWordAfter: function (cm) { return cm.deleteH(1, \"word\"); },\n delGroupBefore: function (cm) { return cm.deleteH(-1, \"group\"); },\n delGroupAfter: function (cm) { return cm.deleteH(1, \"group\"); },\n indentAuto: function (cm) { return cm.indentSelection(\"smart\"); },\n indentMore: function (cm) { return cm.indentSelection(\"add\"); },\n indentLess: function (cm) { return cm.indentSelection(\"subtract\"); },\n insertTab: function (cm) { return cm.replaceSelection(\"\\t\"); },\n insertSoftTab: function (cm) {\n var spaces = [], ranges = cm.listSelections(), tabSize = cm.options.tabSize;\n for (var i = 0; i < ranges.length; i++) {\n var pos = ranges[i].from();\n var col = countColumn(cm.getLine(pos.line), pos.ch, tabSize);\n spaces.push(spaceStr(tabSize - col % tabSize));\n }\n cm.replaceSelections(spaces);\n },\n defaultTab: function (cm) {\n if (cm.somethingSelected()) { cm.indentSelection(\"add\"); }\n else { cm.execCommand(\"insertTab\"); }\n },\n // Swap the two chars left and right of each selection's head.\n // Move cursor behind the two swapped characters afterwards.\n //\n // Doesn't consider line feeds a character.\n // Doesn't scan more than one line above to find a character.\n // Doesn't do anything on an empty line.\n // Doesn't do anything with non-empty selections.\n transposeChars: function (cm) { return runInOp(cm, function () {\n var ranges = cm.listSelections(), newSel = [];\n for (var i = 0; i < ranges.length; i++) {\n if (!ranges[i].empty()) { continue }\n var cur = ranges[i].head, line = getLine(cm.doc, cur.line).text;\n if (line) {\n if (cur.ch == line.length) { cur = new Pos(cur.line, cur.ch - 1); }\n if (cur.ch > 0) {\n cur = new Pos(cur.line, cur.ch + 1);\n cm.replaceRange(line.charAt(cur.ch - 1) + line.charAt(cur.ch - 2),\n Pos(cur.line, cur.ch - 2), cur, \"+transpose\");\n } else if (cur.line > cm.doc.first) {\n var prev = getLine(cm.doc, cur.line - 1).text;\n if (prev) {\n cur = new Pos(cur.line, 1);\n cm.replaceRange(line.charAt(0) + cm.doc.lineSeparator() +\n prev.charAt(prev.length - 1),\n Pos(cur.line - 1, prev.length - 1), cur, \"+transpose\");\n }\n }\n }\n newSel.push(new Range(cur, cur));\n }\n cm.setSelections(newSel);\n }); },\n newlineAndIndent: function (cm) { return runInOp(cm, function () {\n var sels = cm.listSelections();\n for (var i = sels.length - 1; i >= 0; i--)\n { cm.replaceRange(cm.doc.lineSeparator(), sels[i].anchor, sels[i].head, \"+input\"); }\n sels = cm.listSelections();\n for (var i$1 = 0; i$1 < sels.length; i$1++)\n { cm.indentLine(sels[i$1].from().line, null, true); }\n ensureCursorVisible(cm);\n }); },\n openLine: function (cm) { return cm.replaceSelection(\"\\n\", \"start\"); },\n toggleOverwrite: function (cm) { return cm.toggleOverwrite(); }\n};\n\n\nfunction lineStart(cm, lineN) {\n var line = getLine(cm.doc, lineN);\n var visual = visualLine(line);\n if (visual != line) { lineN = lineNo(visual); }\n return endOfLine(true, cm, visual, lineN, 1)\n}\nfunction lineEnd(cm, lineN) {\n var line = getLine(cm.doc, lineN);\n var visual = visualLineEnd(line);\n if (visual != line) { lineN = lineNo(visual); }\n return endOfLine(true, cm, line, lineN, -1)\n}\nfunction lineStartSmart(cm, pos) {\n var start = lineStart(cm, pos.line);\n var line = getLine(cm.doc, start.line);\n var order = getOrder(line, cm.doc.direction);\n if (!order || order[0].level == 0) {\n var firstNonWS = Math.max(0, line.text.search(/\\S/));\n var inWS = pos.line == start.line && pos.ch <= firstNonWS && pos.ch;\n return Pos(start.line, inWS ? 0 : firstNonWS, start.sticky)\n }\n return start\n}\n\n// Run a handler that was bound to a key.\nfunction doHandleBinding(cm, bound, dropShift) {\n if (typeof bound == \"string\") {\n bound = commands[bound];\n if (!bound) { return false }\n }\n // Ensure previous input has been read, so that the handler sees a\n // consistent view of the document\n cm.display.input.ensurePolled();\n var prevShift = cm.display.shift, done = false;\n try {\n if (cm.isReadOnly()) { cm.state.suppressEdits = true; }\n if (dropShift) { cm.display.shift = false; }\n done = bound(cm) != Pass;\n } finally {\n cm.display.shift = prevShift;\n cm.state.suppressEdits = false;\n }\n return done\n}\n\nfunction lookupKeyForEditor(cm, name, handle) {\n for (var i = 0; i < cm.state.keyMaps.length; i++) {\n var result = lookupKey(name, cm.state.keyMaps[i], handle, cm);\n if (result) { return result }\n }\n return (cm.options.extraKeys && lookupKey(name, cm.options.extraKeys, handle, cm))\n || lookupKey(name, cm.options.keyMap, handle, cm)\n}\n\n// Note that, despite the name, this function is also used to check\n// for bound mouse clicks.\n\nvar stopSeq = new Delayed;\nfunction dispatchKey(cm, name, e, handle) {\n var seq = cm.state.keySeq;\n if (seq) {\n if (isModifierKey(name)) { return \"handled\" }\n stopSeq.set(50, function () {\n if (cm.state.keySeq == seq) {\n cm.state.keySeq = null;\n cm.display.input.reset();\n }\n });\n name = seq + \" \" + name;\n }\n var result = lookupKeyForEditor(cm, name, handle);\n\n if (result == \"multi\")\n { cm.state.keySeq = name; }\n if (result == \"handled\")\n { signalLater(cm, \"keyHandled\", cm, name, e); }\n\n if (result == \"handled\" || result == \"multi\") {\n e_preventDefault(e);\n restartBlink(cm);\n }\n\n if (seq && !result && /\\'$/.test(name)) {\n e_preventDefault(e);\n return true\n }\n return !!result\n}\n\n// Handle a key from the keydown event.\nfunction handleKeyBinding(cm, e) {\n var name = keyName(e, true);\n if (!name) { return false }\n\n if (e.shiftKey && !cm.state.keySeq) {\n // First try to resolve full name (including 'Shift-'). Failing\n // that, see if there is a cursor-motion command (starting with\n // 'go') bound to the keyname without 'Shift-'.\n return dispatchKey(cm, \"Shift-\" + name, e, function (b) { return doHandleBinding(cm, b, true); })\n || dispatchKey(cm, name, e, function (b) {\n if (typeof b == \"string\" ? /^go[A-Z]/.test(b) : b.motion)\n { return doHandleBinding(cm, b) }\n })\n } else {\n return dispatchKey(cm, name, e, function (b) { return doHandleBinding(cm, b); })\n }\n}\n\n// Handle a key from the keypress event\nfunction handleCharBinding(cm, e, ch) {\n return dispatchKey(cm, \"'\" + ch + \"'\", e, function (b) { return doHandleBinding(cm, b, true); })\n}\n\nvar lastStoppedKey = null;\nfunction onKeyDown(e) {\n var cm = this;\n cm.curOp.focus = activeElt();\n if (signalDOMEvent(cm, e)) { return }\n // IE does strange things with escape.\n if (ie && ie_version < 11 && e.keyCode == 27) { e.returnValue = false; }\n var code = e.keyCode;\n cm.display.shift = code == 16 || e.shiftKey;\n var handled = handleKeyBinding(cm, e);\n if (presto) {\n lastStoppedKey = handled ? code : null;\n // Opera has no cut event... we try to at least catch the key combo\n if (!handled && code == 88 && !hasCopyEvent && (mac ? e.metaKey : e.ctrlKey))\n { cm.replaceSelection(\"\", null, \"cut\"); }\n }\n\n // Turn mouse into crosshair when Alt is held on Mac.\n if (code == 18 && !/\\bCodeMirror-crosshair\\b/.test(cm.display.lineDiv.className))\n { showCrossHair(cm); }\n}\n\nfunction showCrossHair(cm) {\n var lineDiv = cm.display.lineDiv;\n addClass(lineDiv, \"CodeMirror-crosshair\");\n\n function up(e) {\n if (e.keyCode == 18 || !e.altKey) {\n rmClass(lineDiv, \"CodeMirror-crosshair\");\n off(document, \"keyup\", up);\n off(document, \"mouseover\", up);\n }\n }\n on(document, \"keyup\", up);\n on(document, \"mouseover\", up);\n}\n\nfunction onKeyUp(e) {\n if (e.keyCode == 16) { this.doc.sel.shift = false; }\n signalDOMEvent(this, e);\n}\n\nfunction onKeyPress(e) {\n var cm = this;\n if (eventInWidget(cm.display, e) || signalDOMEvent(cm, e) || e.ctrlKey && !e.altKey || mac && e.metaKey) { return }\n var keyCode = e.keyCode, charCode = e.charCode;\n if (presto && keyCode == lastStoppedKey) {lastStoppedKey = null; e_preventDefault(e); return}\n if ((presto && (!e.which || e.which < 10)) && handleKeyBinding(cm, e)) { return }\n var ch = String.fromCharCode(charCode == null ? keyCode : charCode);\n // Some browsers fire keypress events for backspace\n if (ch == \"\\x08\") { return }\n if (handleCharBinding(cm, e, ch)) { return }\n cm.display.input.onKeyPress(e);\n}\n\nvar DOUBLECLICK_DELAY = 400;\n\nvar PastClick = function(time, pos, button) {\n this.time = time;\n this.pos = pos;\n this.button = button;\n};\n\nPastClick.prototype.compare = function (time, pos, button) {\n return this.time + DOUBLECLICK_DELAY > time &&\n cmp(pos, this.pos) == 0 && button == this.button\n};\n\nvar lastClick;\nvar lastDoubleClick;\nfunction clickRepeat(pos, button) {\n var now = +new Date;\n if (lastDoubleClick && lastDoubleClick.compare(now, pos, button)) {\n lastClick = lastDoubleClick = null;\n return \"triple\"\n } else if (lastClick && lastClick.compare(now, pos, button)) {\n lastDoubleClick = new PastClick(now, pos, button);\n lastClick = null;\n return \"double\"\n } else {\n lastClick = new PastClick(now, pos, button);\n lastDoubleClick = null;\n return \"single\"\n }\n}\n\n// A mouse down can be a single click, double click, triple click,\n// start of selection drag, start of text drag, new cursor\n// (ctrl-click), rectangle drag (alt-drag), or xwin\n// middle-click-paste. Or it might be a click on something we should\n// not interfere with, such as a scrollbar or widget.\nfunction onMouseDown(e) {\n var cm = this, display = cm.display;\n if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) { return }\n display.input.ensurePolled();\n display.shift = e.shiftKey;\n\n if (eventInWidget(display, e)) {\n if (!webkit) {\n // Briefly turn off draggability, to allow widgets to do\n // normal dragging things.\n display.scroller.draggable = false;\n setTimeout(function () { return display.scroller.draggable = true; }, 100);\n }\n return\n }\n if (clickInGutter(cm, e)) { return }\n var pos = posFromMouse(cm, e), button = e_button(e), repeat = pos ? clickRepeat(pos, button) : \"single\";\n window.focus();\n\n // #3261: make sure, that we're not starting a second selection\n if (button == 1 && cm.state.selectingText)\n { cm.state.selectingText(e); }\n\n if (pos && handleMappedButton(cm, button, pos, repeat, e)) { return }\n\n if (button == 1) {\n if (pos) { leftButtonDown(cm, pos, repeat, e); }\n else if (e_target(e) == display.scroller) { e_preventDefault(e); }\n } else if (button == 2) {\n if (pos) { extendSelection(cm.doc, pos); }\n setTimeout(function () { return display.input.focus(); }, 20);\n } else if (button == 3) {\n if (captureRightClick) { onContextMenu(cm, e); }\n else { delayBlurEvent(cm); }\n }\n}\n\nfunction handleMappedButton(cm, button, pos, repeat, event) {\n var name = \"Click\";\n if (repeat == \"double\") { name = \"Double\" + name; }\n else if (repeat == \"triple\") { name = \"Triple\" + name; }\n name = (button == 1 ? \"Left\" : button == 2 ? \"Middle\" : \"Right\") + name;\n\n return dispatchKey(cm, addModifierNames(name, event), event, function (bound) {\n if (typeof bound == \"string\") { bound = commands[bound]; }\n if (!bound) { return false }\n var done = false;\n try {\n if (cm.isReadOnly()) { cm.state.suppressEdits = true; }\n done = bound(cm, pos) != Pass;\n } finally {\n cm.state.suppressEdits = false;\n }\n return done\n })\n}\n\nfunction configureMouse(cm, repeat, event) {\n var option = cm.getOption(\"configureMouse\");\n var value = option ? option(cm, repeat, event) : {};\n if (value.unit == null) {\n var rect = chromeOS ? event.shiftKey && event.metaKey : event.altKey;\n value.unit = rect ? \"rectangle\" : repeat == \"single\" ? \"char\" : repeat == \"double\" ? \"word\" : \"line\";\n }\n if (value.extend == null || cm.doc.extend) { value.extend = cm.doc.extend || event.shiftKey; }\n if (value.addNew == null) { value.addNew = mac ? event.metaKey : event.ctrlKey; }\n if (value.moveOnDrag == null) { value.moveOnDrag = !(mac ? event.altKey : event.ctrlKey); }\n return value\n}\n\nfunction leftButtonDown(cm, pos, repeat, event) {\n if (ie) { setTimeout(bind(ensureFocus, cm), 0); }\n else { cm.curOp.focus = activeElt(); }\n\n var behavior = configureMouse(cm, repeat, event);\n\n var sel = cm.doc.sel, contained;\n if (cm.options.dragDrop && dragAndDrop && !cm.isReadOnly() &&\n repeat == \"single\" && (contained = sel.contains(pos)) > -1 &&\n (cmp((contained = sel.ranges[contained]).from(), pos) < 0 || pos.xRel > 0) &&\n (cmp(contained.to(), pos) > 0 || pos.xRel < 0))\n { leftButtonStartDrag(cm, event, pos, behavior); }\n else\n { leftButtonSelect(cm, event, pos, behavior); }\n}\n\n// Start a text drag. When it ends, see if any dragging actually\n// happen, and treat as a click if it didn't.\nfunction leftButtonStartDrag(cm, event, pos, behavior) {\n var display = cm.display, moved = false;\n var dragEnd = operation(cm, function (e) {\n if (webkit) { display.scroller.draggable = false; }\n cm.state.draggingText = false;\n off(document, \"mouseup\", dragEnd);\n off(document, \"mousemove\", mouseMove);\n off(display.scroller, \"dragstart\", dragStart);\n off(display.scroller, \"drop\", dragEnd);\n if (!moved) {\n e_preventDefault(e);\n if (!behavior.addNew)\n { extendSelection(cm.doc, pos, null, null, behavior.extend); }\n // Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081)\n if (webkit || ie && ie_version == 9)\n { setTimeout(function () {document.body.focus(); display.input.focus();}, 20); }\n else\n { display.input.focus(); }\n }\n });\n var mouseMove = function(e2) {\n moved = moved || Math.abs(event.clientX - e2.clientX) + Math.abs(event.clientY - e2.clientY) >= 10;\n };\n var dragStart = function () { return moved = true; };\n // Let the drag handler handle this.\n if (webkit) { display.scroller.draggable = true; }\n cm.state.draggingText = dragEnd;\n dragEnd.copy = !behavior.moveOnDrag;\n // IE's approach to draggable\n if (display.scroller.dragDrop) { display.scroller.dragDrop(); }\n on(document, \"mouseup\", dragEnd);\n on(document, \"mousemove\", mouseMove);\n on(display.scroller, \"dragstart\", dragStart);\n on(display.scroller, \"drop\", dragEnd);\n\n delayBlurEvent(cm);\n setTimeout(function () { return display.input.focus(); }, 20);\n}\n\nfunction rangeForUnit(cm, pos, unit) {\n if (unit == \"char\") { return new Range(pos, pos) }\n if (unit == \"word\") { return cm.findWordAt(pos) }\n if (unit == \"line\") { return new Range(Pos(pos.line, 0), clipPos(cm.doc, Pos(pos.line + 1, 0))) }\n var result = unit(cm, pos);\n return new Range(result.from, result.to)\n}\n\n// Normal selection, as opposed to text dragging.\nfunction leftButtonSelect(cm, event, start, behavior) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(event);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (behavior.addNew && !behavior.extend) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n { ourRange = ranges[ourIndex]; }\n else\n { ourRange = new Range(start, start); }\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (behavior.unit == \"rectangle\") {\n if (!behavior.addNew) { ourRange = new Range(start, start); }\n start = posFromMouse(cm, event, true, true);\n ourIndex = -1;\n } else {\n var range$$1 = rangeForUnit(cm, start, behavior.unit);\n if (behavior.extend)\n { ourRange = extendRange(ourRange, range$$1.anchor, range$$1.head, behavior.extend); }\n else\n { ourRange = range$$1; }\n }\n\n if (!behavior.addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == \"char\" && !behavior.extend) {\n setSelection(doc, normalizeSelection(ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n {scroll: false, origin: \"*mouse\"});\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) { return }\n lastPos = pos;\n\n if (behavior.unit == \"rectangle\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }\n else if (text.length > leftPos)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }\n }\n if (!ranges.length) { ranges.push(new Range(start, start)); }\n setSelection(doc, normalizeSelection(startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var range$$1 = rangeForUnit(cm, pos, behavior.unit);\n var anchor = oldRange.anchor, head;\n if (cmp(range$$1.anchor, anchor) > 0) {\n head = range$$1.head;\n anchor = minPos(oldRange.from(), range$$1.anchor);\n } else {\n head = range$$1.anchor;\n anchor = maxPos(oldRange.to(), range$$1.head);\n }\n var ranges$1 = startSel.ranges.slice(0);\n ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head));\n setSelection(doc, normalizeSelection(ranges$1, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, behavior.unit == \"rectangle\");\n if (!cur) { return }\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) { setTimeout(operation(cm, function () {\n if (counter != curCount) { return }\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50); }\n }\n }\n\n function done(e) {\n cm.state.selectingText = false;\n counter = Infinity;\n e_preventDefault(e);\n display.input.focus();\n off(document, \"mousemove\", move);\n off(document, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function (e) {\n if (!e_button(e)) { done(e); }\n else { extend(e); }\n });\n var up = operation(cm, done);\n cm.state.selectingText = up;\n on(document, \"mousemove\", move);\n on(document, \"mouseup\", up);\n}\n\n// Used when mouse-selecting to adjust the anchor to the proper side\n// of a bidi jump depending on the visual position of the head.\nfunction bidiSimplify(cm, range$$1) {\n var anchor = range$$1.anchor;\n var head = range$$1.head;\n var anchorLine = getLine(cm.doc, anchor.line);\n if (cmp(anchor, head) == 0 && anchor.sticky == head.sticky) { return range$$1 }\n var order = getOrder(anchorLine);\n if (!order) { return range$$1 }\n var index = getBidiPartAt(order, anchor.ch, anchor.sticky), part = order[index];\n if (part.from != anchor.ch && part.to != anchor.ch) { return range$$1 }\n var boundary = index + ((part.from == anchor.ch) == (part.level != 1) ? 0 : 1);\n if (boundary == 0 || boundary == order.length) { return range$$1 }\n\n // Compute the relative visual position of the head compared to the\n // anchor (<0 is to the left, >0 to the right)\n var leftSide;\n if (head.line != anchor.line) {\n leftSide = (head.line - anchor.line) * (cm.doc.direction == \"ltr\" ? 1 : -1) > 0;\n } else {\n var headIndex = getBidiPartAt(order, head.ch, head.sticky);\n var dir = headIndex - index || (head.ch - anchor.ch) * (part.level == 1 ? -1 : 1);\n if (headIndex == boundary - 1 || headIndex == boundary)\n { leftSide = dir < 0; }\n else\n { leftSide = dir > 0; }\n }\n\n var usePart = order[boundary + (leftSide ? -1 : 0)];\n var from = leftSide == (usePart.level == 1);\n var ch = from ? usePart.from : usePart.to, sticky = from ? \"after\" : \"before\";\n return anchor.ch == ch && anchor.sticky == sticky ? range$$1 : new Range(new Pos(anchor.line, ch, sticky), head)\n}\n\n\n// Determines whether an event happened in the gutter, and fires the\n// handlers for the corresponding event.\nfunction gutterEvent(cm, e, type, prevent) {\n var mX, mY;\n if (e.touches) {\n mX = e.touches[0].clientX;\n mY = e.touches[0].clientY;\n } else {\n try { mX = e.clientX; mY = e.clientY; }\n catch(e) { return false }\n }\n if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) { return false }\n if (prevent) { e_preventDefault(e); }\n\n var display = cm.display;\n var lineBox = display.lineDiv.getBoundingClientRect();\n\n if (mY > lineBox.bottom || !hasHandler(cm, type)) { return e_defaultPrevented(e) }\n mY -= lineBox.top - display.viewOffset;\n\n for (var i = 0; i < cm.options.gutters.length; ++i) {\n var g = display.gutters.childNodes[i];\n if (g && g.getBoundingClientRect().right >= mX) {\n var line = lineAtHeight(cm.doc, mY);\n var gutter = cm.options.gutters[i];\n signal(cm, type, cm, line, gutter, e);\n return e_defaultPrevented(e)\n }\n }\n}\n\nfunction clickInGutter(cm, e) {\n return gutterEvent(cm, e, \"gutterClick\", true)\n}\n\n// CONTEXT MENU HANDLING\n\n// To make the context menu work, we need to briefly unhide the\n// textarea (making it as unobtrusive as possible) to let the\n// right-click take effect on it.\nfunction onContextMenu(cm, e) {\n if (eventInWidget(cm.display, e) || contextMenuInGutter(cm, e)) { return }\n if (signalDOMEvent(cm, e, \"contextmenu\")) { return }\n cm.display.input.onContextMenu(e);\n}\n\nfunction contextMenuInGutter(cm, e) {\n if (!hasHandler(cm, \"gutterContextMenu\")) { return false }\n return gutterEvent(cm, e, \"gutterContextMenu\", false)\n}\n\nfunction themeChanged(cm) {\n cm.display.wrapper.className = cm.display.wrapper.className.replace(/\\s*cm-s-\\S+/g, \"\") +\n cm.options.theme.replace(/(^|\\s)\\s*/g, \" cm-s-\");\n clearCaches(cm);\n}\n\nvar Init = {toString: function(){return \"CodeMirror.Init\"}};\n\nvar defaults = {};\nvar optionHandlers = {};\n\nfunction defineOptions(CodeMirror) {\n var optionHandlers = CodeMirror.optionHandlers;\n\n function option(name, deflt, handle, notOnInit) {\n CodeMirror.defaults[name] = deflt;\n if (handle) { optionHandlers[name] =\n notOnInit ? function (cm, val, old) {if (old != Init) { handle(cm, val, old); }} : handle; }\n }\n\n CodeMirror.defineOption = option;\n\n // Passed to option handlers when there is no old value.\n CodeMirror.Init = Init;\n\n // These two are, on init, called from the constructor because they\n // have to be initialized before the editor can start at all.\n option(\"value\", \"\", function (cm, val) { return cm.setValue(val); }, true);\n option(\"mode\", null, function (cm, val) {\n cm.doc.modeOption = val;\n loadMode(cm);\n }, true);\n\n option(\"indentUnit\", 2, loadMode, true);\n option(\"indentWithTabs\", false);\n option(\"smartIndent\", true);\n option(\"tabSize\", 4, function (cm) {\n resetModeState(cm);\n clearCaches(cm);\n regChange(cm);\n }, true);\n option(\"lineSeparator\", null, function (cm, val) {\n cm.doc.lineSep = val;\n if (!val) { return }\n var newBreaks = [], lineNo = cm.doc.first;\n cm.doc.iter(function (line) {\n for (var pos = 0;;) {\n var found = line.text.indexOf(val, pos);\n if (found == -1) { break }\n pos = found + val.length;\n newBreaks.push(Pos(lineNo, found));\n }\n lineNo++;\n });\n for (var i = newBreaks.length - 1; i >= 0; i--)\n { replaceRange(cm.doc, val, newBreaks[i], Pos(newBreaks[i].line, newBreaks[i].ch + val.length)); }\n });\n option(\"specialChars\", /[\\u0000-\\u001f\\u007f-\\u009f\\u00ad\\u061c\\u200b-\\u200f\\u2028\\u2029\\ufeff]/g, function (cm, val, old) {\n cm.state.specialChars = new RegExp(val.source + (val.test(\"\\t\") ? \"\" : \"|\\t\"), \"g\");\n if (old != Init) { cm.refresh(); }\n });\n option(\"specialCharPlaceholder\", defaultSpecialCharPlaceholder, function (cm) { return cm.refresh(); }, true);\n option(\"electricChars\", true);\n option(\"inputStyle\", mobile ? \"contenteditable\" : \"textarea\", function () {\n throw new Error(\"inputStyle can not (yet) be changed in a running editor\") // FIXME\n }, true);\n option(\"spellcheck\", false, function (cm, val) { return cm.getInputField().spellcheck = val; }, true);\n option(\"rtlMoveVisually\", !windows);\n option(\"wholeLineUpdateBefore\", true);\n\n option(\"theme\", \"default\", function (cm) {\n themeChanged(cm);\n guttersChanged(cm);\n }, true);\n option(\"keyMap\", \"default\", function (cm, val, old) {\n var next = getKeyMap(val);\n var prev = old != Init && getKeyMap(old);\n if (prev && prev.detach) { prev.detach(cm, next); }\n if (next.attach) { next.attach(cm, prev || null); }\n });\n option(\"extraKeys\", null);\n option(\"configureMouse\", null);\n\n option(\"lineWrapping\", false, wrappingChanged, true);\n option(\"gutters\", [], function (cm) {\n setGuttersForLineNumbers(cm.options);\n guttersChanged(cm);\n }, true);\n option(\"fixedGutter\", true, function (cm, val) {\n cm.display.gutters.style.left = val ? compensateForHScroll(cm.display) + \"px\" : \"0\";\n cm.refresh();\n }, true);\n option(\"coverGutterNextToScrollbar\", false, function (cm) { return updateScrollbars(cm); }, true);\n option(\"scrollbarStyle\", \"native\", function (cm) {\n initScrollbars(cm);\n updateScrollbars(cm);\n cm.display.scrollbars.setScrollTop(cm.doc.scrollTop);\n cm.display.scrollbars.setScrollLeft(cm.doc.scrollLeft);\n }, true);\n option(\"lineNumbers\", false, function (cm) {\n setGuttersForLineNumbers(cm.options);\n guttersChanged(cm);\n }, true);\n option(\"firstLineNumber\", 1, guttersChanged, true);\n option(\"lineNumberFormatter\", function (integer) { return integer; }, guttersChanged, true);\n option(\"showCursorWhenSelecting\", false, updateSelection, true);\n\n option(\"resetSelectionOnContextMenu\", true);\n option(\"lineWiseCopyCut\", true);\n option(\"pasteLinesPerSelection\", true);\n\n option(\"readOnly\", false, function (cm, val) {\n if (val == \"nocursor\") {\n onBlur(cm);\n cm.display.input.blur();\n }\n cm.display.input.readOnlyChanged(val);\n });\n option(\"disableInput\", false, function (cm, val) {if (!val) { cm.display.input.reset(); }}, true);\n option(\"dragDrop\", true, dragDropChanged);\n option(\"allowDropFileTypes\", null);\n\n option(\"cursorBlinkRate\", 530);\n option(\"cursorScrollMargin\", 0);\n option(\"cursorHeight\", 1, updateSelection, true);\n option(\"singleCursorHeightPerLine\", true, updateSelection, true);\n option(\"workTime\", 100);\n option(\"workDelay\", 100);\n option(\"flattenSpans\", true, resetModeState, true);\n option(\"addModeClass\", false, resetModeState, true);\n option(\"pollInterval\", 100);\n option(\"undoDepth\", 200, function (cm, val) { return cm.doc.history.undoDepth = val; });\n option(\"historyEventDelay\", 1250);\n option(\"viewportMargin\", 10, function (cm) { return cm.refresh(); }, true);\n option(\"maxHighlightLength\", 10000, resetModeState, true);\n option(\"moveInputWithCursor\", true, function (cm, val) {\n if (!val) { cm.display.input.resetPosition(); }\n });\n\n option(\"tabindex\", null, function (cm, val) { return cm.display.input.getField().tabIndex = val || \"\"; });\n option(\"autofocus\", null);\n option(\"direction\", \"ltr\", function (cm, val) { return cm.doc.setDirection(val); }, true);\n}\n\nfunction guttersChanged(cm) {\n updateGutters(cm);\n regChange(cm);\n alignHorizontally(cm);\n}\n\nfunction dragDropChanged(cm, value, old) {\n var wasOn = old && old != Init;\n if (!value != !wasOn) {\n var funcs = cm.display.dragFunctions;\n var toggle = value ? on : off;\n toggle(cm.display.scroller, \"dragstart\", funcs.start);\n toggle(cm.display.scroller, \"dragenter\", funcs.enter);\n toggle(cm.display.scroller, \"dragover\", funcs.over);\n toggle(cm.display.scroller, \"dragleave\", funcs.leave);\n toggle(cm.display.scroller, \"drop\", funcs.drop);\n }\n}\n\nfunction wrappingChanged(cm) {\n if (cm.options.lineWrapping) {\n addClass(cm.display.wrapper, \"CodeMirror-wrap\");\n cm.display.sizer.style.minWidth = \"\";\n cm.display.sizerWidth = null;\n } else {\n rmClass(cm.display.wrapper, \"CodeMirror-wrap\");\n findMaxLine(cm);\n }\n estimateLineHeights(cm);\n regChange(cm);\n clearCaches(cm);\n setTimeout(function () { return updateScrollbars(cm); }, 100);\n}\n\n// A CodeMirror instance represents an editor. This is the object\n// that user code is usually dealing with.\n\nfunction CodeMirror$1(place, options) {\n var this$1 = this;\n\n if (!(this instanceof CodeMirror$1)) { return new CodeMirror$1(place, options) }\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n setGuttersForLineNumbers(options);\n\n var doc = options.value;\n if (typeof doc == \"string\") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }\n this.doc = doc;\n\n var input = new CodeMirror$1.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input);\n display.wrapper.CodeMirror = this;\n updateGutters(this);\n themeChanged(this);\n if (options.lineWrapping)\n { this.display.wrapper.className += \" CodeMirror-wrap\"; }\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n };\n\n if (options.autofocus && !mobile) { display.input.focus(); }\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || this.hasFocus())\n { setTimeout(bind(onFocus, this), 20); }\n else\n { onBlur(this); }\n\n for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))\n { optionHandlers[opt](this$1, options[opt], Init); } }\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) { options.finishInit(this); }\n for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this$1); }\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n { display.lineDiv.style.textRendering = \"auto\"; }\n}\n\n// The default configuration options.\nCodeMirror$1.defaults = defaults;\n// Functions to run when options are changed.\nCodeMirror$1.optionHandlers = optionHandlers;\n\n// Attach the necessary event handlers when initializing the editor\nfunction registerEventHandlers(cm) {\n var d = cm.display;\n on(d.scroller, \"mousedown\", operation(cm, onMouseDown));\n // Older IE's will not fire a second mousedown for a double click\n if (ie && ie_version < 11)\n { on(d.scroller, \"dblclick\", operation(cm, function (e) {\n if (signalDOMEvent(cm, e)) { return }\n var pos = posFromMouse(cm, e);\n if (!pos || clickInGutter(cm, e) || eventInWidget(cm.display, e)) { return }\n e_preventDefault(e);\n var word = cm.findWordAt(pos);\n extendSelection(cm.doc, word.anchor, word.head);\n })); }\n else\n { on(d.scroller, \"dblclick\", function (e) { return signalDOMEvent(cm, e) || e_preventDefault(e); }); }\n // Some browsers fire contextmenu *after* opening the menu, at\n // which point we can't mess with it anymore. Context menu is\n // handled in onMouseDown for these browsers.\n if (!captureRightClick) { on(d.scroller, \"contextmenu\", function (e) { return onContextMenu(cm, e); }); }\n\n // Used to suppress mouse event handling when a touch happens\n var touchFinished, prevTouch = {end: 0};\n function finishTouch() {\n if (d.activeTouch) {\n touchFinished = setTimeout(function () { return d.activeTouch = null; }, 1000);\n prevTouch = d.activeTouch;\n prevTouch.end = +new Date;\n }\n }\n function isMouseLikeTouchEvent(e) {\n if (e.touches.length != 1) { return false }\n var touch = e.touches[0];\n return touch.radiusX <= 1 && touch.radiusY <= 1\n }\n function farAway(touch, other) {\n if (other.left == null) { return true }\n var dx = other.left - touch.left, dy = other.top - touch.top;\n return dx * dx + dy * dy > 20 * 20\n }\n on(d.scroller, \"touchstart\", function (e) {\n if (!signalDOMEvent(cm, e) && !isMouseLikeTouchEvent(e) && !clickInGutter(cm, e)) {\n d.input.ensurePolled();\n clearTimeout(touchFinished);\n var now = +new Date;\n d.activeTouch = {start: now, moved: false,\n prev: now - prevTouch.end <= 300 ? prevTouch : null};\n if (e.touches.length == 1) {\n d.activeTouch.left = e.touches[0].pageX;\n d.activeTouch.top = e.touches[0].pageY;\n }\n }\n });\n on(d.scroller, \"touchmove\", function () {\n if (d.activeTouch) { d.activeTouch.moved = true; }\n });\n on(d.scroller, \"touchend\", function (e) {\n var touch = d.activeTouch;\n if (touch && !eventInWidget(d, e) && touch.left != null &&\n !touch.moved && new Date - touch.start < 300) {\n var pos = cm.coordsChar(d.activeTouch, \"page\"), range;\n if (!touch.prev || farAway(touch, touch.prev)) // Single tap\n { range = new Range(pos, pos); }\n else if (!touch.prev.prev || farAway(touch, touch.prev.prev)) // Double tap\n { range = cm.findWordAt(pos); }\n else // Triple tap\n { range = new Range(Pos(pos.line, 0), clipPos(cm.doc, Pos(pos.line + 1, 0))); }\n cm.setSelection(range.anchor, range.head);\n cm.focus();\n e_preventDefault(e);\n }\n finishTouch();\n });\n on(d.scroller, \"touchcancel\", finishTouch);\n\n // Sync scrolling between fake scrollbars and real scrollable\n // area, ensure viewport is updated when scrolling.\n on(d.scroller, \"scroll\", function () {\n if (d.scroller.clientHeight) {\n updateScrollTop(cm, d.scroller.scrollTop);\n setScrollLeft(cm, d.scroller.scrollLeft, true);\n signal(cm, \"scroll\", cm);\n }\n });\n\n // Listen to wheel events in order to try and update the viewport on time.\n on(d.scroller, \"mousewheel\", function (e) { return onScrollWheel(cm, e); });\n on(d.scroller, \"DOMMouseScroll\", function (e) { return onScrollWheel(cm, e); });\n\n // Prevent wrapper from ever scrolling\n on(d.wrapper, \"scroll\", function () { return d.wrapper.scrollTop = d.wrapper.scrollLeft = 0; });\n\n d.dragFunctions = {\n enter: function (e) {if (!signalDOMEvent(cm, e)) { e_stop(e); }},\n over: function (e) {if (!signalDOMEvent(cm, e)) { onDragOver(cm, e); e_stop(e); }},\n start: function (e) { return onDragStart(cm, e); },\n drop: operation(cm, onDrop),\n leave: function (e) {if (!signalDOMEvent(cm, e)) { clearDragCursor(cm); }}\n };\n\n var inp = d.input.getField();\n on(inp, \"keyup\", function (e) { return onKeyUp.call(cm, e); });\n on(inp, \"keydown\", operation(cm, onKeyDown));\n on(inp, \"keypress\", operation(cm, onKeyPress));\n on(inp, \"focus\", function (e) { return onFocus(cm, e); });\n on(inp, \"blur\", function (e) { return onBlur(cm, e); });\n}\n\nvar initHooks = [];\nCodeMirror$1.defineInitHook = function (f) { return initHooks.push(f); };\n\n// Indent the given line. The how parameter can be \"smart\",\n// \"add\"/null, \"subtract\", or \"prev\". When aggressive is false\n// (typically set to true for forced single-line indents), empty\n// lines are not indented, and places where the mode returns Pass\n// are left alone.\nfunction indentLine(cm, n, how, aggressive) {\n var doc = cm.doc, state;\n if (how == null) { how = \"add\"; }\n if (how == \"smart\") {\n // Fall back to \"prev\" when the mode doesn't have an indentation\n // method.\n if (!doc.mode.indent) { how = \"prev\"; }\n else { state = getContextBefore(cm, n).state; }\n }\n\n var tabSize = cm.options.tabSize;\n var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize);\n if (line.stateAfter) { line.stateAfter = null; }\n var curSpaceString = line.text.match(/^\\s*/)[0], indentation;\n if (!aggressive && !/\\S/.test(line.text)) {\n indentation = 0;\n how = \"not\";\n } else if (how == \"smart\") {\n indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text);\n if (indentation == Pass || indentation > 150) {\n if (!aggressive) { return }\n how = \"prev\";\n }\n }\n if (how == \"prev\") {\n if (n > doc.first) { indentation = countColumn(getLine(doc, n-1).text, null, tabSize); }\n else { indentation = 0; }\n } else if (how == \"add\") {\n indentation = curSpace + cm.options.indentUnit;\n } else if (how == \"subtract\") {\n indentation = curSpace - cm.options.indentUnit;\n } else if (typeof how == \"number\") {\n indentation = curSpace + how;\n }\n indentation = Math.max(0, indentation);\n\n var indentString = \"\", pos = 0;\n if (cm.options.indentWithTabs)\n { for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += \"\\t\";} }\n if (pos < indentation) { indentString += spaceStr(indentation - pos); }\n\n if (indentString != curSpaceString) {\n replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), \"+input\");\n line.stateAfter = null;\n return true\n } else {\n // Ensure that, if the cursor was in the whitespace at the start\n // of the line, it is moved to the end of that space.\n for (var i$1 = 0; i$1 < doc.sel.ranges.length; i$1++) {\n var range = doc.sel.ranges[i$1];\n if (range.head.line == n && range.head.ch < curSpaceString.length) {\n var pos$1 = Pos(n, curSpaceString.length);\n replaceOneSelection(doc, i$1, new Range(pos$1, pos$1));\n break\n }\n }\n }\n}\n\n// This will be set to a {lineWise: bool, text: [string]} object, so\n// that, when pasting, we know what kind of selections the copied\n// text was made out of.\nvar lastCopied = null;\n\nfunction setLastCopied(newLastCopied) {\n lastCopied = newLastCopied;\n}\n\nfunction applyTextInput(cm, inserted, deleted, sel, origin) {\n var doc = cm.doc;\n cm.display.shift = false;\n if (!sel) { sel = doc.sel; }\n\n var paste = cm.state.pasteIncoming || origin == \"paste\";\n var textLines = splitLinesAuto(inserted), multiPaste = null;\n // When pasing N lines into N selections, insert one line per selection\n if (paste && sel.ranges.length > 1) {\n if (lastCopied && lastCopied.text.join(\"\\n\") == inserted) {\n if (sel.ranges.length % lastCopied.text.length == 0) {\n multiPaste = [];\n for (var i = 0; i < lastCopied.text.length; i++)\n { multiPaste.push(doc.splitLines(lastCopied.text[i])); }\n }\n } else if (textLines.length == sel.ranges.length && cm.options.pasteLinesPerSelection) {\n multiPaste = map(textLines, function (l) { return [l]; });\n }\n }\n\n var updateInput;\n // Normal behavior is to insert the new text into every selection\n for (var i$1 = sel.ranges.length - 1; i$1 >= 0; i$1--) {\n var range$$1 = sel.ranges[i$1];\n var from = range$$1.from(), to = range$$1.to();\n if (range$$1.empty()) {\n if (deleted && deleted > 0) // Handle deletion\n { from = Pos(from.line, from.ch - deleted); }\n else if (cm.state.overwrite && !paste) // Handle overwrite\n { to = Pos(to.line, Math.min(getLine(doc, to.line).text.length, to.ch + lst(textLines).length)); }\n else if (lastCopied && lastCopied.lineWise && lastCopied.text.join(\"\\n\") == inserted)\n { from = to = Pos(from.line, 0); }\n }\n updateInput = cm.curOp.updateInput;\n var changeEvent = {from: from, to: to, text: multiPaste ? multiPaste[i$1 % multiPaste.length] : textLines,\n origin: origin || (paste ? \"paste\" : cm.state.cutIncoming ? \"cut\" : \"+input\")};\n makeChange(cm.doc, changeEvent);\n signalLater(cm, \"inputRead\", cm, changeEvent);\n }\n if (inserted && !paste)\n { triggerElectric(cm, inserted); }\n\n ensureCursorVisible(cm);\n cm.curOp.updateInput = updateInput;\n cm.curOp.typing = true;\n cm.state.pasteIncoming = cm.state.cutIncoming = false;\n}\n\nfunction handlePaste(e, cm) {\n var pasted = e.clipboardData && e.clipboardData.getData(\"Text\");\n if (pasted) {\n e.preventDefault();\n if (!cm.isReadOnly() && !cm.options.disableInput)\n { runInOp(cm, function () { return applyTextInput(cm, pasted, 0, null, \"paste\"); }); }\n return true\n }\n}\n\nfunction triggerElectric(cm, inserted) {\n // When an 'electric' character is inserted, immediately trigger a reindent\n if (!cm.options.electricChars || !cm.options.smartIndent) { return }\n var sel = cm.doc.sel;\n\n for (var i = sel.ranges.length - 1; i >= 0; i--) {\n var range$$1 = sel.ranges[i];\n if (range$$1.head.ch > 100 || (i && sel.ranges[i - 1].head.line == range$$1.head.line)) { continue }\n var mode = cm.getModeAt(range$$1.head);\n var indented = false;\n if (mode.electricChars) {\n for (var j = 0; j < mode.electricChars.length; j++)\n { if (inserted.indexOf(mode.electricChars.charAt(j)) > -1) {\n indented = indentLine(cm, range$$1.head.line, \"smart\");\n break\n } }\n } else if (mode.electricInput) {\n if (mode.electricInput.test(getLine(cm.doc, range$$1.head.line).text.slice(0, range$$1.head.ch)))\n { indented = indentLine(cm, range$$1.head.line, \"smart\"); }\n }\n if (indented) { signalLater(cm, \"electricInput\", cm, range$$1.head.line); }\n }\n}\n\nfunction copyableRanges(cm) {\n var text = [], ranges = [];\n for (var i = 0; i < cm.doc.sel.ranges.length; i++) {\n var line = cm.doc.sel.ranges[i].head.line;\n var lineRange = {anchor: Pos(line, 0), head: Pos(line + 1, 0)};\n ranges.push(lineRange);\n text.push(cm.getRange(lineRange.anchor, lineRange.head));\n }\n return {text: text, ranges: ranges}\n}\n\nfunction disableBrowserMagic(field, spellcheck) {\n field.setAttribute(\"autocorrect\", \"off\");\n field.setAttribute(\"autocapitalize\", \"off\");\n field.setAttribute(\"spellcheck\", !!spellcheck);\n}\n\nfunction hiddenTextarea() {\n var te = elt(\"textarea\", null, null, \"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none\");\n var div = elt(\"div\", [te], null, \"overflow: hidden; position: relative; width: 3px; height: 0px;\");\n // The textarea is kept positioned near the cursor to prevent the\n // fact that it'll be scrolled into view on input from scrolling\n // our fake cursor out of view. On webkit, when wrap=off, paste is\n // very slow. So make the area wide instead.\n if (webkit) { te.style.width = \"1000px\"; }\n else { te.setAttribute(\"wrap\", \"off\"); }\n // If border: 0; -- iOS fails to open keyboard (issue #1287)\n if (ios) { te.style.border = \"1px solid black\"; }\n disableBrowserMagic(te);\n return div\n}\n\n// The publicly visible API. Note that methodOp(f) means\n// 'wrap f in an operation, performed on its `this` parameter'.\n\n// This is not the complete set of editor methods. Most of the\n// methods defined on the Doc type are also injected into\n// CodeMirror.prototype, for backwards compatibility and\n// convenience.\n\nvar addEditorMethods = function(CodeMirror) {\n var optionHandlers = CodeMirror.optionHandlers;\n\n var helpers = CodeMirror.helpers = {};\n\n CodeMirror.prototype = {\n constructor: CodeMirror,\n focus: function(){window.focus(); this.display.input.focus();},\n\n setOption: function(option, value) {\n var options = this.options, old = options[option];\n if (options[option] == value && option != \"mode\") { return }\n options[option] = value;\n if (optionHandlers.hasOwnProperty(option))\n { operation(this, optionHandlers[option])(this, value, old); }\n signal(this, \"optionChange\", this, option);\n },\n\n getOption: function(option) {return this.options[option]},\n getDoc: function() {return this.doc},\n\n addKeyMap: function(map$$1, bottom) {\n this.state.keyMaps[bottom ? \"push\" : \"unshift\"](getKeyMap(map$$1));\n },\n removeKeyMap: function(map$$1) {\n var maps = this.state.keyMaps;\n for (var i = 0; i < maps.length; ++i)\n { if (maps[i] == map$$1 || maps[i].name == map$$1) {\n maps.splice(i, 1);\n return true\n } }\n },\n\n addOverlay: methodOp(function(spec, options) {\n var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);\n if (mode.startState) { throw new Error(\"Overlays may not be stateful.\") }\n insertSorted(this.state.overlays,\n {mode: mode, modeSpec: spec, opaque: options && options.opaque,\n priority: (options && options.priority) || 0},\n function (overlay) { return overlay.priority; });\n this.state.modeGen++;\n regChange(this);\n }),\n removeOverlay: methodOp(function(spec) {\n var this$1 = this;\n\n var overlays = this.state.overlays;\n for (var i = 0; i < overlays.length; ++i) {\n var cur = overlays[i].modeSpec;\n if (cur == spec || typeof spec == \"string\" && cur.name == spec) {\n overlays.splice(i, 1);\n this$1.state.modeGen++;\n regChange(this$1);\n return\n }\n }\n }),\n\n indentLine: methodOp(function(n, dir, aggressive) {\n if (typeof dir != \"string\" && typeof dir != \"number\") {\n if (dir == null) { dir = this.options.smartIndent ? \"smart\" : \"prev\"; }\n else { dir = dir ? \"add\" : \"subtract\"; }\n }\n if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); }\n }),\n indentSelection: methodOp(function(how) {\n var this$1 = this;\n\n var ranges = this.doc.sel.ranges, end = -1;\n for (var i = 0; i < ranges.length; i++) {\n var range$$1 = ranges[i];\n if (!range$$1.empty()) {\n var from = range$$1.from(), to = range$$1.to();\n var start = Math.max(end, from.line);\n end = Math.min(this$1.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;\n for (var j = start; j < end; ++j)\n { indentLine(this$1, j, how); }\n var newRanges = this$1.doc.sel.ranges;\n if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)\n { replaceOneSelection(this$1.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); }\n } else if (range$$1.head.line > end) {\n indentLine(this$1, range$$1.head.line, how, true);\n end = range$$1.head.line;\n if (i == this$1.doc.sel.primIndex) { ensureCursorVisible(this$1); }\n }\n }\n }),\n\n // Fetch the parser token for a given character. Useful for hacks\n // that want to inspect the mode state (say, for completion).\n getTokenAt: function(pos, precise) {\n return takeToken(this, pos, precise)\n },\n\n getLineTokens: function(line, precise) {\n return takeToken(this, Pos(line), precise, true)\n },\n\n getTokenTypeAt: function(pos) {\n pos = clipPos(this.doc, pos);\n var styles = getLineStyles(this, getLine(this.doc, pos.line));\n var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;\n var type;\n if (ch == 0) { type = styles[2]; }\n else { for (;;) {\n var mid = (before + after) >> 1;\n if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid; }\n else if (styles[mid * 2 + 1] < ch) { before = mid + 1; }\n else { type = styles[mid * 2 + 2]; break }\n } }\n var cut = type ? type.indexOf(\"overlay \") : -1;\n return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)\n },\n\n getModeAt: function(pos) {\n var mode = this.doc.mode;\n if (!mode.innerMode) { return mode }\n return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode\n },\n\n getHelper: function(pos, type) {\n return this.getHelpers(pos, type)[0]\n },\n\n getHelpers: function(pos, type) {\n var this$1 = this;\n\n var found = [];\n if (!helpers.hasOwnProperty(type)) { return found }\n var help = helpers[type], mode = this.getModeAt(pos);\n if (typeof mode[type] == \"string\") {\n if (help[mode[type]]) { found.push(help[mode[type]]); }\n } else if (mode[type]) {\n for (var i = 0; i < mode[type].length; i++) {\n var val = help[mode[type][i]];\n if (val) { found.push(val); }\n }\n } else if (mode.helperType && help[mode.helperType]) {\n found.push(help[mode.helperType]);\n } else if (help[mode.name]) {\n found.push(help[mode.name]);\n }\n for (var i$1 = 0; i$1 < help._global.length; i$1++) {\n var cur = help._global[i$1];\n if (cur.pred(mode, this$1) && indexOf(found, cur.val) == -1)\n { found.push(cur.val); }\n }\n return found\n },\n\n getStateAfter: function(line, precise) {\n var doc = this.doc;\n line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);\n return getContextBefore(this, line + 1, precise).state\n },\n\n cursorCoords: function(start, mode) {\n var pos, range$$1 = this.doc.sel.primary();\n if (start == null) { pos = range$$1.head; }\n else if (typeof start == \"object\") { pos = clipPos(this.doc, start); }\n else { pos = start ? range$$1.from() : range$$1.to(); }\n return cursorCoords(this, pos, mode || \"page\")\n },\n\n charCoords: function(pos, mode) {\n return charCoords(this, clipPos(this.doc, pos), mode || \"page\")\n },\n\n coordsChar: function(coords, mode) {\n coords = fromCoordSystem(this, coords, mode || \"page\");\n return coordsChar(this, coords.left, coords.top)\n },\n\n lineAtHeight: function(height, mode) {\n height = fromCoordSystem(this, {top: height, left: 0}, mode || \"page\").top;\n return lineAtHeight(this.doc, height + this.display.viewOffset)\n },\n heightAtLine: function(line, mode, includeWidgets) {\n var end = false, lineObj;\n if (typeof line == \"number\") {\n var last = this.doc.first + this.doc.size - 1;\n if (line < this.doc.first) { line = this.doc.first; }\n else if (line > last) { line = last; end = true; }\n lineObj = getLine(this.doc, line);\n } else {\n lineObj = line;\n }\n return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || \"page\", includeWidgets || end).top +\n (end ? this.doc.height - heightAtLine(lineObj) : 0)\n },\n\n defaultTextHeight: function() { return textHeight(this.display) },\n defaultCharWidth: function() { return charWidth(this.display) },\n\n getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},\n\n addWidget: function(pos, node, scroll, vert, horiz) {\n var display = this.display;\n pos = cursorCoords(this, clipPos(this.doc, pos));\n var top = pos.bottom, left = pos.left;\n node.style.position = \"absolute\";\n node.setAttribute(\"cm-ignore-events\", \"true\");\n this.display.input.setUneditable(node);\n display.sizer.appendChild(node);\n if (vert == \"over\") {\n top = pos.top;\n } else if (vert == \"above\" || vert == \"near\") {\n var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),\n hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);\n // Default to positioning above (if specified and possible); otherwise default to positioning below\n if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)\n { top = pos.top - node.offsetHeight; }\n else if (pos.bottom + node.offsetHeight <= vspace)\n { top = pos.bottom; }\n if (left + node.offsetWidth > hspace)\n { left = hspace - node.offsetWidth; }\n }\n node.style.top = top + \"px\";\n node.style.left = node.style.right = \"\";\n if (horiz == \"right\") {\n left = display.sizer.clientWidth - node.offsetWidth;\n node.style.right = \"0px\";\n } else {\n if (horiz == \"left\") { left = 0; }\n else if (horiz == \"middle\") { left = (display.sizer.clientWidth - node.offsetWidth) / 2; }\n node.style.left = left + \"px\";\n }\n if (scroll)\n { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}); }\n },\n\n triggerOnKeyDown: methodOp(onKeyDown),\n triggerOnKeyPress: methodOp(onKeyPress),\n triggerOnKeyUp: onKeyUp,\n triggerOnMouseDown: methodOp(onMouseDown),\n\n execCommand: function(cmd) {\n if (commands.hasOwnProperty(cmd))\n { return commands[cmd].call(null, this) }\n },\n\n triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),\n\n findPosH: function(from, amount, unit, visually) {\n var this$1 = this;\n\n var dir = 1;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n cur = findPosH(this$1.doc, cur, dir, unit, visually);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveH: methodOp(function(dir, unit) {\n var this$1 = this;\n\n this.extendSelectionsBy(function (range$$1) {\n if (this$1.display.shift || this$1.doc.extend || range$$1.empty())\n { return findPosH(this$1.doc, range$$1.head, dir, unit, this$1.options.rtlMoveVisually) }\n else\n { return dir < 0 ? range$$1.from() : range$$1.to() }\n }, sel_move);\n }),\n\n deleteH: methodOp(function(dir, unit) {\n var sel = this.doc.sel, doc = this.doc;\n if (sel.somethingSelected())\n { doc.replaceSelection(\"\", null, \"+delete\"); }\n else\n { deleteNearSelection(this, function (range$$1) {\n var other = findPosH(doc, range$$1.head, dir, unit, false);\n return dir < 0 ? {from: other, to: range$$1.head} : {from: range$$1.head, to: other}\n }); }\n }),\n\n findPosV: function(from, amount, unit, goalColumn) {\n var this$1 = this;\n\n var dir = 1, x = goalColumn;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n var coords = cursorCoords(this$1, cur, \"div\");\n if (x == null) { x = coords.left; }\n else { coords.left = x; }\n cur = findPosV(this$1, coords, dir, unit);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveV: methodOp(function(dir, unit) {\n var this$1 = this;\n\n var doc = this.doc, goals = [];\n var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();\n doc.extendSelectionsBy(function (range$$1) {\n if (collapse)\n { return dir < 0 ? range$$1.from() : range$$1.to() }\n var headPos = cursorCoords(this$1, range$$1.head, \"div\");\n if (range$$1.goalColumn != null) { headPos.left = range$$1.goalColumn; }\n goals.push(headPos.left);\n var pos = findPosV(this$1, headPos, dir, unit);\n if (unit == \"page\" && range$$1 == doc.sel.primary())\n { addToScrollTop(this$1, charCoords(this$1, pos, \"div\").top - headPos.top); }\n return pos\n }, sel_move);\n if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)\n { doc.sel.ranges[i].goalColumn = goals[i]; } }\n }),\n\n // Find the word at the given position (as returned by coordsChar).\n findWordAt: function(pos) {\n var doc = this.doc, line = getLine(doc, pos.line).text;\n var start = pos.ch, end = pos.ch;\n if (line) {\n var helper = this.getHelper(pos, \"wordChars\");\n if ((pos.sticky == \"before\" || end == line.length) && start) { --start; } else { ++end; }\n var startChar = line.charAt(start);\n var check = isWordChar(startChar, helper)\n ? function (ch) { return isWordChar(ch, helper); }\n : /\\s/.test(startChar) ? function (ch) { return /\\s/.test(ch); }\n : function (ch) { return (!/\\s/.test(ch) && !isWordChar(ch)); };\n while (start > 0 && check(line.charAt(start - 1))) { --start; }\n while (end < line.length && check(line.charAt(end))) { ++end; }\n }\n return new Range(Pos(pos.line, start), Pos(pos.line, end))\n },\n\n toggleOverwrite: function(value) {\n if (value != null && value == this.state.overwrite) { return }\n if (this.state.overwrite = !this.state.overwrite)\n { addClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n else\n { rmClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n\n signal(this, \"overwriteToggle\", this, this.state.overwrite);\n },\n hasFocus: function() { return this.display.input.getField() == activeElt() },\n isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },\n\n scrollTo: methodOp(function (x, y) { scrollToCoords(this, x, y); }),\n getScrollInfo: function() {\n var scroller = this.display.scroller;\n return {left: scroller.scrollLeft, top: scroller.scrollTop,\n height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,\n width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,\n clientHeight: displayHeight(this), clientWidth: displayWidth(this)}\n },\n\n scrollIntoView: methodOp(function(range$$1, margin) {\n if (range$$1 == null) {\n range$$1 = {from: this.doc.sel.primary().head, to: null};\n if (margin == null) { margin = this.options.cursorScrollMargin; }\n } else if (typeof range$$1 == \"number\") {\n range$$1 = {from: Pos(range$$1, 0), to: null};\n } else if (range$$1.from == null) {\n range$$1 = {from: range$$1, to: null};\n }\n if (!range$$1.to) { range$$1.to = range$$1.from; }\n range$$1.margin = margin || 0;\n\n if (range$$1.from.line != null) {\n scrollToRange(this, range$$1);\n } else {\n scrollToCoordsRange(this, range$$1.from, range$$1.to, range$$1.margin);\n }\n }),\n\n setSize: methodOp(function(width, height) {\n var this$1 = this;\n\n var interpret = function (val) { return typeof val == \"number\" || /^\\d+$/.test(String(val)) ? val + \"px\" : val; };\n if (width != null) { this.display.wrapper.style.width = interpret(width); }\n if (height != null) { this.display.wrapper.style.height = interpret(height); }\n if (this.options.lineWrapping) { clearLineMeasurementCache(this); }\n var lineNo$$1 = this.display.viewFrom;\n this.doc.iter(lineNo$$1, this.display.viewTo, function (line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)\n { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo$$1, \"widget\"); break } } }\n ++lineNo$$1;\n });\n this.curOp.forceUpdate = true;\n signal(this, \"refresh\", this);\n }),\n\n operation: function(f){return runInOp(this, f)},\n startOperation: function(){return startOperation(this)},\n endOperation: function(){return endOperation(this)},\n\n refresh: methodOp(function() {\n var oldHeight = this.display.cachedTextHeight;\n regChange(this);\n this.curOp.forceUpdate = true;\n clearCaches(this);\n scrollToCoords(this, this.doc.scrollLeft, this.doc.scrollTop);\n updateGutterSpace(this);\n if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5)\n { estimateLineHeights(this); }\n signal(this, \"refresh\", this);\n }),\n\n swapDoc: methodOp(function(doc) {\n var old = this.doc;\n old.cm = null;\n attachDoc(this, doc);\n clearCaches(this);\n this.display.input.reset();\n scrollToCoords(this, doc.scrollLeft, doc.scrollTop);\n this.curOp.forceScroll = true;\n signalLater(this, \"swapDoc\", this, old);\n return old\n }),\n\n getInputField: function(){return this.display.input.getField()},\n getWrapperElement: function(){return this.display.wrapper},\n getScrollerElement: function(){return this.display.scroller},\n getGutterElement: function(){return this.display.gutters}\n };\n eventMixin(CodeMirror);\n\n CodeMirror.registerHelper = function(type, name, value) {\n if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []}; }\n helpers[type][name] = value;\n };\n CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {\n CodeMirror.registerHelper(type, name, value);\n helpers[type]._global.push({pred: predicate, val: value});\n };\n};\n\n// Used for horizontal relative motion. Dir is -1 or 1 (left or\n// right), unit can be \"char\", \"column\" (like char, but doesn't\n// cross line boundaries), \"word\" (across next word), or \"group\" (to\n// the start of next group of word or non-word-non-whitespace\n// chars). The visually param controls whether, in right-to-left\n// text, direction 1 means to move towards the next index in the\n// string, or towards the character to the right of the current\n// position. The resulting position will have a hitSide=true\n// property if it reached the end of the document.\nfunction findPosH(doc, pos, dir, unit, visually) {\n var oldPos = pos;\n var origDir = dir;\n var lineObj = getLine(doc, pos.line);\n function findNextLine() {\n var l = pos.line + dir;\n if (l < doc.first || l >= doc.first + doc.size) { return false }\n pos = new Pos(l, pos.ch, pos.sticky);\n return lineObj = getLine(doc, l)\n }\n function moveOnce(boundToLine) {\n var next;\n if (visually) {\n next = moveVisually(doc.cm, lineObj, pos, dir);\n } else {\n next = moveLogically(lineObj, pos, dir);\n }\n if (next == null) {\n if (!boundToLine && findNextLine())\n { pos = endOfLine(visually, doc.cm, lineObj, pos.line, dir); }\n else\n { return false }\n } else {\n pos = next;\n }\n return true\n }\n\n if (unit == \"char\") {\n moveOnce();\n } else if (unit == \"column\") {\n moveOnce(true);\n } else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) { break }\n var cur = lineObj.text.charAt(pos.ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) { type = \"s\"; }\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce(); pos.sticky = \"after\";}\n break\n }\n\n if (type) { sawType = type; }\n if (dir > 0 && !moveOnce(!first)) { break }\n }\n }\n var result = skipAtomic(doc, pos, oldPos, origDir, true);\n if (equalCursorPos(oldPos, result)) { result.hitSide = true; }\n return result\n}\n\n// For relative vertical movement. Dir may be -1 or 1. Unit can be\n// \"page\" or \"line\". The resulting position will have a hitSide=true\n// property if it reached the end of the document.\nfunction findPosV(cm, pos, dir, unit) {\n var doc = cm.doc, x = pos.left, y;\n if (unit == \"page\") {\n var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);\n var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);\n y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;\n\n } else if (unit == \"line\") {\n y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n }\n var target;\n for (;;) {\n target = coordsChar(cm, x, y);\n if (!target.outside) { break }\n if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }\n y += dir * 5;\n }\n return target\n}\n\n// CONTENTEDITABLE INPUT STYLE\n\nvar ContentEditableInput = function(cm) {\n this.cm = cm;\n this.lastAnchorNode = this.lastAnchorOffset = this.lastFocusNode = this.lastFocusOffset = null;\n this.polling = new Delayed();\n this.composing = null;\n this.gracePeriod = false;\n this.readDOMTimeout = null;\n};\n\nContentEditableInput.prototype.init = function (display) {\n var this$1 = this;\n\n var input = this, cm = input.cm;\n var div = input.div = display.lineDiv;\n disableBrowserMagic(div, cm.options.spellcheck);\n\n on(div, \"paste\", function (e) {\n if (signalDOMEvent(cm, e) || handlePaste(e, cm)) { return }\n // IE doesn't fire input events, so we schedule a read for the pasted content in this way\n if (ie_version <= 11) { setTimeout(operation(cm, function () { return this$1.updateFromDOM(); }), 20); }\n });\n\n on(div, \"compositionstart\", function (e) {\n this$1.composing = {data: e.data, done: false};\n });\n on(div, \"compositionupdate\", function (e) {\n if (!this$1.composing) { this$1.composing = {data: e.data, done: false}; }\n });\n on(div, \"compositionend\", function (e) {\n if (this$1.composing) {\n if (e.data != this$1.composing.data) { this$1.readFromDOMSoon(); }\n this$1.composing.done = true;\n }\n });\n\n on(div, \"touchstart\", function () { return input.forceCompositionEnd(); });\n\n on(div, \"input\", function () {\n if (!this$1.composing) { this$1.readFromDOMSoon(); }\n });\n\n function onCopyCut(e) {\n if (signalDOMEvent(cm, e)) { return }\n if (cm.somethingSelected()) {\n setLastCopied({lineWise: false, text: cm.getSelections()});\n if (e.type == \"cut\") { cm.replaceSelection(\"\", null, \"cut\"); }\n } else if (!cm.options.lineWiseCopyCut) {\n return\n } else {\n var ranges = copyableRanges(cm);\n setLastCopied({lineWise: true, text: ranges.text});\n if (e.type == \"cut\") {\n cm.operation(function () {\n cm.setSelections(ranges.ranges, 0, sel_dontScroll);\n cm.replaceSelection(\"\", null, \"cut\");\n });\n }\n }\n if (e.clipboardData) {\n e.clipboardData.clearData();\n var content = lastCopied.text.join(\"\\n\");\n // iOS exposes the clipboard API, but seems to discard content inserted into it\n e.clipboardData.setData(\"Text\", content);\n if (e.clipboardData.getData(\"Text\") == content) {\n e.preventDefault();\n return\n }\n }\n // Old-fashioned briefly-focus-a-textarea hack\n var kludge = hiddenTextarea(), te = kludge.firstChild;\n cm.display.lineSpace.insertBefore(kludge, cm.display.lineSpace.firstChild);\n te.value = lastCopied.text.join(\"\\n\");\n var hadFocus = document.activeElement;\n selectInput(te);\n setTimeout(function () {\n cm.display.lineSpace.removeChild(kludge);\n hadFocus.focus();\n if (hadFocus == div) { input.showPrimarySelection(); }\n }, 50);\n }\n on(div, \"copy\", onCopyCut);\n on(div, \"cut\", onCopyCut);\n};\n\nContentEditableInput.prototype.prepareSelection = function () {\n var result = prepareSelection(this.cm, false);\n result.focus = this.cm.state.focused;\n return result\n};\n\nContentEditableInput.prototype.showSelection = function (info, takeFocus) {\n if (!info || !this.cm.display.view.length) { return }\n if (info.focus || takeFocus) { this.showPrimarySelection(); }\n this.showMultipleSelections(info);\n};\n\nContentEditableInput.prototype.showPrimarySelection = function () {\n var sel = window.getSelection(), cm = this.cm, prim = cm.doc.sel.primary();\n var from = prim.from(), to = prim.to();\n\n if (cm.display.viewTo == cm.display.viewFrom || from.line >= cm.display.viewTo || to.line < cm.display.viewFrom) {\n sel.removeAllRanges();\n return\n }\n\n var curAnchor = domToPos(cm, sel.anchorNode, sel.anchorOffset);\n var curFocus = domToPos(cm, sel.focusNode, sel.focusOffset);\n if (curAnchor && !curAnchor.bad && curFocus && !curFocus.bad &&\n cmp(minPos(curAnchor, curFocus), from) == 0 &&\n cmp(maxPos(curAnchor, curFocus), to) == 0)\n { return }\n\n var view = cm.display.view;\n var start = (from.line >= cm.display.viewFrom && posToDOM(cm, from)) ||\n {node: view[0].measure.map[2], offset: 0};\n var end = to.line < cm.display.viewTo && posToDOM(cm, to);\n if (!end) {\n var measure = view[view.length - 1].measure;\n var map$$1 = measure.maps ? measure.maps[measure.maps.length - 1] : measure.map;\n end = {node: map$$1[map$$1.length - 1], offset: map$$1[map$$1.length - 2] - map$$1[map$$1.length - 3]};\n }\n\n if (!start || !end) {\n sel.removeAllRanges();\n return\n }\n\n var old = sel.rangeCount && sel.getRangeAt(0), rng;\n try { rng = range(start.node, start.offset, end.offset, end.node); }\n catch(e) {} // Our model of the DOM might be outdated, in which case the range we try to set can be impossible\n if (rng) {\n if (!gecko && cm.state.focused) {\n sel.collapse(start.node, start.offset);\n if (!rng.collapsed) {\n sel.removeAllRanges();\n sel.addRange(rng);\n }\n } else {\n sel.removeAllRanges();\n sel.addRange(rng);\n }\n if (old && sel.anchorNode == null) { sel.addRange(old); }\n else if (gecko) { this.startGracePeriod(); }\n }\n this.rememberSelection();\n};\n\nContentEditableInput.prototype.startGracePeriod = function () {\n var this$1 = this;\n\n clearTimeout(this.gracePeriod);\n this.gracePeriod = setTimeout(function () {\n this$1.gracePeriod = false;\n if (this$1.selectionChanged())\n { this$1.cm.operation(function () { return this$1.cm.curOp.selectionChanged = true; }); }\n }, 20);\n};\n\nContentEditableInput.prototype.showMultipleSelections = function (info) {\n removeChildrenAndAdd(this.cm.display.cursorDiv, info.cursors);\n removeChildrenAndAdd(this.cm.display.selectionDiv, info.selection);\n};\n\nContentEditableInput.prototype.rememberSelection = function () {\n var sel = window.getSelection();\n this.lastAnchorNode = sel.anchorNode; this.lastAnchorOffset = sel.anchorOffset;\n this.lastFocusNode = sel.focusNode; this.lastFocusOffset = sel.focusOffset;\n};\n\nContentEditableInput.prototype.selectionInEditor = function () {\n var sel = window.getSelection();\n if (!sel.rangeCount) { return false }\n var node = sel.getRangeAt(0).commonAncestorContainer;\n return contains(this.div, node)\n};\n\nContentEditableInput.prototype.focus = function () {\n if (this.cm.options.readOnly != \"nocursor\") {\n if (!this.selectionInEditor())\n { this.showSelection(this.prepareSelection(), true); }\n this.div.focus();\n }\n};\nContentEditableInput.prototype.blur = function () { this.div.blur(); };\nContentEditableInput.prototype.getField = function () { return this.div };\n\nContentEditableInput.prototype.supportsTouch = function () { return true };\n\nContentEditableInput.prototype.receivedFocus = function () {\n var input = this;\n if (this.selectionInEditor())\n { this.pollSelection(); }\n else\n { runInOp(this.cm, function () { return input.cm.curOp.selectionChanged = true; }); }\n\n function poll() {\n if (input.cm.state.focused) {\n input.pollSelection();\n input.polling.set(input.cm.options.pollInterval, poll);\n }\n }\n this.polling.set(this.cm.options.pollInterval, poll);\n};\n\nContentEditableInput.prototype.selectionChanged = function () {\n var sel = window.getSelection();\n return sel.anchorNode != this.lastAnchorNode || sel.anchorOffset != this.lastAnchorOffset ||\n sel.focusNode != this.lastFocusNode || sel.focusOffset != this.lastFocusOffset\n};\n\nContentEditableInput.prototype.pollSelection = function () {\n if (this.readDOMTimeout != null || this.gracePeriod || !this.selectionChanged()) { return }\n var sel = window.getSelection(), cm = this.cm;\n // On Android Chrome (version 56, at least), backspacing into an\n // uneditable block element will put the cursor in that element,\n // and then, because it's not editable, hide the virtual keyboard.\n // Because Android doesn't allow us to actually detect backspace\n // presses in a sane way, this code checks for when that happens\n // and simulates a backspace press in this case.\n if (android && chrome && this.cm.options.gutters.length && isInGutter(sel.anchorNode)) {\n this.cm.triggerOnKeyDown({type: \"keydown\", keyCode: 8, preventDefault: Math.abs});\n this.blur();\n this.focus();\n return\n }\n if (this.composing) { return }\n this.rememberSelection();\n var anchor = domToPos(cm, sel.anchorNode, sel.anchorOffset);\n var head = domToPos(cm, sel.focusNode, sel.focusOffset);\n if (anchor && head) { runInOp(cm, function () {\n setSelection(cm.doc, simpleSelection(anchor, head), sel_dontScroll);\n if (anchor.bad || head.bad) { cm.curOp.selectionChanged = true; }\n }); }\n};\n\nContentEditableInput.prototype.pollContent = function () {\n if (this.readDOMTimeout != null) {\n clearTimeout(this.readDOMTimeout);\n this.readDOMTimeout = null;\n }\n\n var cm = this.cm, display = cm.display, sel = cm.doc.sel.primary();\n var from = sel.from(), to = sel.to();\n if (from.ch == 0 && from.line > cm.firstLine())\n { from = Pos(from.line - 1, getLine(cm.doc, from.line - 1).length); }\n if (to.ch == getLine(cm.doc, to.line).text.length && to.line < cm.lastLine())\n { to = Pos(to.line + 1, 0); }\n if (from.line < display.viewFrom || to.line > display.viewTo - 1) { return false }\n\n var fromIndex, fromLine, fromNode;\n if (from.line == display.viewFrom || (fromIndex = findViewIndex(cm, from.line)) == 0) {\n fromLine = lineNo(display.view[0].line);\n fromNode = display.view[0].node;\n } else {\n fromLine = lineNo(display.view[fromIndex].line);\n fromNode = display.view[fromIndex - 1].node.nextSibling;\n }\n var toIndex = findViewIndex(cm, to.line);\n var toLine, toNode;\n if (toIndex == display.view.length - 1) {\n toLine = display.viewTo - 1;\n toNode = display.lineDiv.lastChild;\n } else {\n toLine = lineNo(display.view[toIndex + 1].line) - 1;\n toNode = display.view[toIndex + 1].node.previousSibling;\n }\n\n if (!fromNode) { return false }\n var newText = cm.doc.splitLines(domTextBetween(cm, fromNode, toNode, fromLine, toLine));\n var oldText = getBetween(cm.doc, Pos(fromLine, 0), Pos(toLine, getLine(cm.doc, toLine).text.length));\n while (newText.length > 1 && oldText.length > 1) {\n if (lst(newText) == lst(oldText)) { newText.pop(); oldText.pop(); toLine--; }\n else if (newText[0] == oldText[0]) { newText.shift(); oldText.shift(); fromLine++; }\n else { break }\n }\n\n var cutFront = 0, cutEnd = 0;\n var newTop = newText[0], oldTop = oldText[0], maxCutFront = Math.min(newTop.length, oldTop.length);\n while (cutFront < maxCutFront && newTop.charCodeAt(cutFront) == oldTop.charCodeAt(cutFront))\n { ++cutFront; }\n var newBot = lst(newText), oldBot = lst(oldText);\n var maxCutEnd = Math.min(newBot.length - (newText.length == 1 ? cutFront : 0),\n oldBot.length - (oldText.length == 1 ? cutFront : 0));\n while (cutEnd < maxCutEnd &&\n newBot.charCodeAt(newBot.length - cutEnd - 1) == oldBot.charCodeAt(oldBot.length - cutEnd - 1))\n { ++cutEnd; }\n // Try to move start of change to start of selection if ambiguous\n if (newText.length == 1 && oldText.length == 1 && fromLine == from.line) {\n while (cutFront && cutFront > from.ch &&\n newBot.charCodeAt(newBot.length - cutEnd - 1) == oldBot.charCodeAt(oldBot.length - cutEnd - 1)) {\n cutFront--;\n cutEnd++;\n }\n }\n\n newText[newText.length - 1] = newBot.slice(0, newBot.length - cutEnd).replace(/^\\u200b+/, \"\");\n newText[0] = newText[0].slice(cutFront).replace(/\\u200b+$/, \"\");\n\n var chFrom = Pos(fromLine, cutFront);\n var chTo = Pos(toLine, oldText.length ? lst(oldText).length - cutEnd : 0);\n if (newText.length > 1 || newText[0] || cmp(chFrom, chTo)) {\n replaceRange(cm.doc, newText, chFrom, chTo, \"+input\");\n return true\n }\n};\n\nContentEditableInput.prototype.ensurePolled = function () {\n this.forceCompositionEnd();\n};\nContentEditableInput.prototype.reset = function () {\n this.forceCompositionEnd();\n};\nContentEditableInput.prototype.forceCompositionEnd = function () {\n if (!this.composing) { return }\n clearTimeout(this.readDOMTimeout);\n this.composing = null;\n this.updateFromDOM();\n this.div.blur();\n this.div.focus();\n};\nContentEditableInput.prototype.readFromDOMSoon = function () {\n var this$1 = this;\n\n if (this.readDOMTimeout != null) { return }\n this.readDOMTimeout = setTimeout(function () {\n this$1.readDOMTimeout = null;\n if (this$1.composing) {\n if (this$1.composing.done) { this$1.composing = null; }\n else { return }\n }\n this$1.updateFromDOM();\n }, 80);\n};\n\nContentEditableInput.prototype.updateFromDOM = function () {\n var this$1 = this;\n\n if (this.cm.isReadOnly() || !this.pollContent())\n { runInOp(this.cm, function () { return regChange(this$1.cm); }); }\n};\n\nContentEditableInput.prototype.setUneditable = function (node) {\n node.contentEditable = \"false\";\n};\n\nContentEditableInput.prototype.onKeyPress = function (e) {\n if (e.charCode == 0) { return }\n e.preventDefault();\n if (!this.cm.isReadOnly())\n { operation(this.cm, applyTextInput)(this.cm, String.fromCharCode(e.charCode == null ? e.keyCode : e.charCode), 0); }\n};\n\nContentEditableInput.prototype.readOnlyChanged = function (val) {\n this.div.contentEditable = String(val != \"nocursor\");\n};\n\nContentEditableInput.prototype.onContextMenu = function () {};\nContentEditableInput.prototype.resetPosition = function () {};\n\nContentEditableInput.prototype.needsContentAttribute = true;\n\nfunction posToDOM(cm, pos) {\n var view = findViewForLine(cm, pos.line);\n if (!view || view.hidden) { return null }\n var line = getLine(cm.doc, pos.line);\n var info = mapFromLineView(view, line, pos.line);\n\n var order = getOrder(line, cm.doc.direction), side = \"left\";\n if (order) {\n var partPos = getBidiPartAt(order, pos.ch);\n side = partPos % 2 ? \"right\" : \"left\";\n }\n var result = nodeAndOffsetInLineMap(info.map, pos.ch, side);\n result.offset = result.collapse == \"right\" ? result.end : result.start;\n return result\n}\n\nfunction isInGutter(node) {\n for (var scan = node; scan; scan = scan.parentNode)\n { if (/CodeMirror-gutter-wrapper/.test(scan.className)) { return true } }\n return false\n}\n\nfunction badPos(pos, bad) { if (bad) { pos.bad = true; } return pos }\n\nfunction domTextBetween(cm, from, to, fromLine, toLine) {\n var text = \"\", closing = false, lineSep = cm.doc.lineSeparator();\n function recognizeMarker(id) { return function (marker) { return marker.id == id; } }\n function close() {\n if (closing) {\n text += lineSep;\n closing = false;\n }\n }\n function addText(str) {\n if (str) {\n close();\n text += str;\n }\n }\n function walk(node) {\n if (node.nodeType == 1) {\n var cmText = node.getAttribute(\"cm-text\");\n if (cmText != null) {\n addText(cmText || node.textContent.replace(/\\u200b/g, \"\"));\n return\n }\n var markerID = node.getAttribute(\"cm-marker\"), range$$1;\n if (markerID) {\n var found = cm.findMarks(Pos(fromLine, 0), Pos(toLine + 1, 0), recognizeMarker(+markerID));\n if (found.length && (range$$1 = found[0].find(0)))\n { addText(getBetween(cm.doc, range$$1.from, range$$1.to).join(lineSep)); }\n return\n }\n if (node.getAttribute(\"contenteditable\") == \"false\") { return }\n var isBlock = /^(pre|div|p)$/i.test(node.nodeName);\n if (isBlock) { close(); }\n for (var i = 0; i < node.childNodes.length; i++)\n { walk(node.childNodes[i]); }\n if (isBlock) { closing = true; }\n } else if (node.nodeType == 3) {\n addText(node.nodeValue);\n }\n }\n for (;;) {\n walk(from);\n if (from == to) { break }\n from = from.nextSibling;\n }\n return text\n}\n\nfunction domToPos(cm, node, offset) {\n var lineNode;\n if (node == cm.display.lineDiv) {\n lineNode = cm.display.lineDiv.childNodes[offset];\n if (!lineNode) { return badPos(cm.clipPos(Pos(cm.display.viewTo - 1)), true) }\n node = null; offset = 0;\n } else {\n for (lineNode = node;; lineNode = lineNode.parentNode) {\n if (!lineNode || lineNode == cm.display.lineDiv) { return null }\n if (lineNode.parentNode && lineNode.parentNode == cm.display.lineDiv) { break }\n }\n }\n for (var i = 0; i < cm.display.view.length; i++) {\n var lineView = cm.display.view[i];\n if (lineView.node == lineNode)\n { return locateNodeInLineView(lineView, node, offset) }\n }\n}\n\nfunction locateNodeInLineView(lineView, node, offset) {\n var wrapper = lineView.text.firstChild, bad = false;\n if (!node || !contains(wrapper, node)) { return badPos(Pos(lineNo(lineView.line), 0), true) }\n if (node == wrapper) {\n bad = true;\n node = wrapper.childNodes[offset];\n offset = 0;\n if (!node) {\n var line = lineView.rest ? lst(lineView.rest) : lineView.line;\n return badPos(Pos(lineNo(line), line.text.length), bad)\n }\n }\n\n var textNode = node.nodeType == 3 ? node : null, topNode = node;\n if (!textNode && node.childNodes.length == 1 && node.firstChild.nodeType == 3) {\n textNode = node.firstChild;\n if (offset) { offset = textNode.nodeValue.length; }\n }\n while (topNode.parentNode != wrapper) { topNode = topNode.parentNode; }\n var measure = lineView.measure, maps = measure.maps;\n\n function find(textNode, topNode, offset) {\n for (var i = -1; i < (maps ? maps.length : 0); i++) {\n var map$$1 = i < 0 ? measure.map : maps[i];\n for (var j = 0; j < map$$1.length; j += 3) {\n var curNode = map$$1[j + 2];\n if (curNode == textNode || curNode == topNode) {\n var line = lineNo(i < 0 ? lineView.line : lineView.rest[i]);\n var ch = map$$1[j] + offset;\n if (offset < 0 || curNode != textNode) { ch = map$$1[j + (offset ? 1 : 0)]; }\n return Pos(line, ch)\n }\n }\n }\n }\n var found = find(textNode, topNode, offset);\n if (found) { return badPos(found, bad) }\n\n // FIXME this is all really shaky. might handle the few cases it needs to handle, but likely to cause problems\n for (var after = topNode.nextSibling, dist = textNode ? textNode.nodeValue.length - offset : 0; after; after = after.nextSibling) {\n found = find(after, after.firstChild, 0);\n if (found)\n { return badPos(Pos(found.line, found.ch - dist), bad) }\n else\n { dist += after.textContent.length; }\n }\n for (var before = topNode.previousSibling, dist$1 = offset; before; before = before.previousSibling) {\n found = find(before, before.firstChild, -1);\n if (found)\n { return badPos(Pos(found.line, found.ch + dist$1), bad) }\n else\n { dist$1 += before.textContent.length; }\n }\n}\n\n// TEXTAREA INPUT STYLE\n\nvar TextareaInput = function(cm) {\n this.cm = cm;\n // See input.poll and input.reset\n this.prevInput = \"\";\n\n // Flag that indicates whether we expect input to appear real soon\n // now (after some event like 'keypress' or 'input') and are\n // polling intensively.\n this.pollingFast = false;\n // Self-resetting timeout for the poller\n this.polling = new Delayed();\n // Used to work around IE issue with selection being forgotten when focus moves away from textarea\n this.hasSelection = false;\n this.composing = null;\n};\n\nTextareaInput.prototype.init = function (display) {\n var this$1 = this;\n\n var input = this, cm = this.cm;\n\n // Wraps and hides input textarea\n var div = this.wrapper = hiddenTextarea();\n // The semihidden textarea that is focused when the editor is\n // focused, and receives input.\n var te = this.textarea = div.firstChild;\n display.wrapper.insertBefore(div, display.wrapper.firstChild);\n\n // Needed to hide big blue blinking cursor on Mobile Safari (doesn't seem to work in iOS 8 anymore)\n if (ios) { te.style.width = \"0px\"; }\n\n on(te, \"input\", function () {\n if (ie && ie_version >= 9 && this$1.hasSelection) { this$1.hasSelection = null; }\n input.poll();\n });\n\n on(te, \"paste\", function (e) {\n if (signalDOMEvent(cm, e) || handlePaste(e, cm)) { return }\n\n cm.state.pasteIncoming = true;\n input.fastPoll();\n });\n\n function prepareCopyCut(e) {\n if (signalDOMEvent(cm, e)) { return }\n if (cm.somethingSelected()) {\n setLastCopied({lineWise: false, text: cm.getSelections()});\n } else if (!cm.options.lineWiseCopyCut) {\n return\n } else {\n var ranges = copyableRanges(cm);\n setLastCopied({lineWise: true, text: ranges.text});\n if (e.type == \"cut\") {\n cm.setSelections(ranges.ranges, null, sel_dontScroll);\n } else {\n input.prevInput = \"\";\n te.value = ranges.text.join(\"\\n\");\n selectInput(te);\n }\n }\n if (e.type == \"cut\") { cm.state.cutIncoming = true; }\n }\n on(te, \"cut\", prepareCopyCut);\n on(te, \"copy\", prepareCopyCut);\n\n on(display.scroller, \"paste\", function (e) {\n if (eventInWidget(display, e) || signalDOMEvent(cm, e)) { return }\n cm.state.pasteIncoming = true;\n input.focus();\n });\n\n // Prevent normal selection in the editor (we handle our own)\n on(display.lineSpace, \"selectstart\", function (e) {\n if (!eventInWidget(display, e)) { e_preventDefault(e); }\n });\n\n on(te, \"compositionstart\", function () {\n var start = cm.getCursor(\"from\");\n if (input.composing) { input.composing.range.clear(); }\n input.composing = {\n start: start,\n range: cm.markText(start, cm.getCursor(\"to\"), {className: \"CodeMirror-composing\"})\n };\n });\n on(te, \"compositionend\", function () {\n if (input.composing) {\n input.poll();\n input.composing.range.clear();\n input.composing = null;\n }\n });\n};\n\nTextareaInput.prototype.prepareSelection = function () {\n // Redraw the selection and/or cursor\n var cm = this.cm, display = cm.display, doc = cm.doc;\n var result = prepareSelection(cm);\n\n // Move the hidden textarea near the cursor to prevent scrolling artifacts\n if (cm.options.moveInputWithCursor) {\n var headPos = cursorCoords(cm, doc.sel.primary().head, \"div\");\n var wrapOff = display.wrapper.getBoundingClientRect(), lineOff = display.lineDiv.getBoundingClientRect();\n result.teTop = Math.max(0, Math.min(display.wrapper.clientHeight - 10,\n headPos.top + lineOff.top - wrapOff.top));\n result.teLeft = Math.max(0, Math.min(display.wrapper.clientWidth - 10,\n headPos.left + lineOff.left - wrapOff.left));\n }\n\n return result\n};\n\nTextareaInput.prototype.showSelection = function (drawn) {\n var cm = this.cm, display = cm.display;\n removeChildrenAndAdd(display.cursorDiv, drawn.cursors);\n removeChildrenAndAdd(display.selectionDiv, drawn.selection);\n if (drawn.teTop != null) {\n this.wrapper.style.top = drawn.teTop + \"px\";\n this.wrapper.style.left = drawn.teLeft + \"px\";\n }\n};\n\n// Reset the input to correspond to the selection (or to be empty,\n// when not typing and nothing is selected)\nTextareaInput.prototype.reset = function (typing) {\n if (this.contextMenuPending || this.composing) { return }\n var cm = this.cm;\n if (cm.somethingSelected()) {\n this.prevInput = \"\";\n var content = cm.getSelection();\n this.textarea.value = content;\n if (cm.state.focused) { selectInput(this.textarea); }\n if (ie && ie_version >= 9) { this.hasSelection = content; }\n } else if (!typing) {\n this.prevInput = this.textarea.value = \"\";\n if (ie && ie_version >= 9) { this.hasSelection = null; }\n }\n};\n\nTextareaInput.prototype.getField = function () { return this.textarea };\n\nTextareaInput.prototype.supportsTouch = function () { return false };\n\nTextareaInput.prototype.focus = function () {\n if (this.cm.options.readOnly != \"nocursor\" && (!mobile || activeElt() != this.textarea)) {\n try { this.textarea.focus(); }\n catch (e) {} // IE8 will throw if the textarea is display: none or not in DOM\n }\n};\n\nTextareaInput.prototype.blur = function () { this.textarea.blur(); };\n\nTextareaInput.prototype.resetPosition = function () {\n this.wrapper.style.top = this.wrapper.style.left = 0;\n};\n\nTextareaInput.prototype.receivedFocus = function () { this.slowPoll(); };\n\n// Poll for input changes, using the normal rate of polling. This\n// runs as long as the editor is focused.\nTextareaInput.prototype.slowPoll = function () {\n var this$1 = this;\n\n if (this.pollingFast) { return }\n this.polling.set(this.cm.options.pollInterval, function () {\n this$1.poll();\n if (this$1.cm.state.focused) { this$1.slowPoll(); }\n });\n};\n\n// When an event has just come in that is likely to add or change\n// something in the input textarea, we poll faster, to ensure that\n// the change appears on the screen quickly.\nTextareaInput.prototype.fastPoll = function () {\n var missed = false, input = this;\n input.pollingFast = true;\n function p() {\n var changed = input.poll();\n if (!changed && !missed) {missed = true; input.polling.set(60, p);}\n else {input.pollingFast = false; input.slowPoll();}\n }\n input.polling.set(20, p);\n};\n\n// Read input from the textarea, and update the document to match.\n// When something is selected, it is present in the textarea, and\n// selected (unless it is huge, in which case a placeholder is\n// used). When nothing is selected, the cursor sits after previously\n// seen text (can be empty), which is stored in prevInput (we must\n// not reset the textarea when typing, because that breaks IME).\nTextareaInput.prototype.poll = function () {\n var this$1 = this;\n\n var cm = this.cm, input = this.textarea, prevInput = this.prevInput;\n // Since this is called a *lot*, try to bail out as cheaply as\n // possible when it is clear that nothing happened. hasSelection\n // will be the case when there is a lot of text in the textarea,\n // in which case reading its value would be expensive.\n if (this.contextMenuPending || !cm.state.focused ||\n (hasSelection(input) && !prevInput && !this.composing) ||\n cm.isReadOnly() || cm.options.disableInput || cm.state.keySeq)\n { return false }\n\n var text = input.value;\n // If nothing changed, bail.\n if (text == prevInput && !cm.somethingSelected()) { return false }\n // Work around nonsensical selection resetting in IE9/10, and\n // inexplicable appearance of private area unicode characters on\n // some key combos in Mac (#2689).\n if (ie && ie_version >= 9 && this.hasSelection === text ||\n mac && /[\\uf700-\\uf7ff]/.test(text)) {\n cm.display.input.reset();\n return false\n }\n\n if (cm.doc.sel == cm.display.selForContextMenu) {\n var first = text.charCodeAt(0);\n if (first == 0x200b && !prevInput) { prevInput = \"\\u200b\"; }\n if (first == 0x21da) { this.reset(); return this.cm.execCommand(\"undo\") }\n }\n // Find the part of the input that is actually new\n var same = 0, l = Math.min(prevInput.length, text.length);\n while (same < l && prevInput.charCodeAt(same) == text.charCodeAt(same)) { ++same; }\n\n runInOp(cm, function () {\n applyTextInput(cm, text.slice(same), prevInput.length - same,\n null, this$1.composing ? \"*compose\" : null);\n\n // Don't leave long text in the textarea, since it makes further polling slow\n if (text.length > 1000 || text.indexOf(\"\\n\") > -1) { input.value = this$1.prevInput = \"\"; }\n else { this$1.prevInput = text; }\n\n if (this$1.composing) {\n this$1.composing.range.clear();\n this$1.composing.range = cm.markText(this$1.composing.start, cm.getCursor(\"to\"),\n {className: \"CodeMirror-composing\"});\n }\n });\n return true\n};\n\nTextareaInput.prototype.ensurePolled = function () {\n if (this.pollingFast && this.poll()) { this.pollingFast = false; }\n};\n\nTextareaInput.prototype.onKeyPress = function () {\n if (ie && ie_version >= 9) { this.hasSelection = null; }\n this.fastPoll();\n};\n\nTextareaInput.prototype.onContextMenu = function (e) {\n var input = this, cm = input.cm, display = cm.display, te = input.textarea;\n var pos = posFromMouse(cm, e), scrollPos = display.scroller.scrollTop;\n if (!pos || presto) { return } // Opera is difficult.\n\n // Reset the current text selection only if the click is done outside of the selection\n // and 'resetSelectionOnContextMenu' option is true.\n var reset = cm.options.resetSelectionOnContextMenu;\n if (reset && cm.doc.sel.contains(pos) == -1)\n { operation(cm, setSelection)(cm.doc, simpleSelection(pos), sel_dontScroll); }\n\n var oldCSS = te.style.cssText, oldWrapperCSS = input.wrapper.style.cssText;\n input.wrapper.style.cssText = \"position: absolute\";\n var wrapperBox = input.wrapper.getBoundingClientRect();\n te.style.cssText = \"position: absolute; width: 30px; height: 30px;\\n top: \" + (e.clientY - wrapperBox.top - 5) + \"px; left: \" + (e.clientX - wrapperBox.left - 5) + \"px;\\n z-index: 1000; background: \" + (ie ? \"rgba(255, 255, 255, .05)\" : \"transparent\") + \";\\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);\";\n var oldScrollY;\n if (webkit) { oldScrollY = window.scrollY; } // Work around Chrome issue (#2712)\n display.input.focus();\n if (webkit) { window.scrollTo(null, oldScrollY); }\n display.input.reset();\n // Adds \"Select all\" to context menu in FF\n if (!cm.somethingSelected()) { te.value = input.prevInput = \" \"; }\n input.contextMenuPending = true;\n display.selForContextMenu = cm.doc.sel;\n clearTimeout(display.detectingSelectAll);\n\n // Select-all will be greyed out if there's nothing to select, so\n // this adds a zero-width space so that we can later check whether\n // it got selected.\n function prepareSelectAllHack() {\n if (te.selectionStart != null) {\n var selected = cm.somethingSelected();\n var extval = \"\\u200b\" + (selected ? te.value : \"\");\n te.value = \"\\u21da\"; // Used to catch context-menu undo\n te.value = extval;\n input.prevInput = selected ? \"\" : \"\\u200b\";\n te.selectionStart = 1; te.selectionEnd = extval.length;\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel;\n }\n }\n function rehide() {\n input.contextMenuPending = false;\n input.wrapper.style.cssText = oldWrapperCSS;\n te.style.cssText = oldCSS;\n if (ie && ie_version < 9) { display.scrollbars.setScrollTop(display.scroller.scrollTop = scrollPos); }\n\n // Try to detect the user choosing select-all\n if (te.selectionStart != null) {\n if (!ie || (ie && ie_version < 9)) { prepareSelectAllHack(); }\n var i = 0, poll = function () {\n if (display.selForContextMenu == cm.doc.sel && te.selectionStart == 0 &&\n te.selectionEnd > 0 && input.prevInput == \"\\u200b\") {\n operation(cm, selectAll)(cm);\n } else if (i++ < 10) {\n display.detectingSelectAll = setTimeout(poll, 500);\n } else {\n display.selForContextMenu = null;\n display.input.reset();\n }\n };\n display.detectingSelectAll = setTimeout(poll, 200);\n }\n }\n\n if (ie && ie_version >= 9) { prepareSelectAllHack(); }\n if (captureRightClick) {\n e_stop(e);\n var mouseup = function () {\n off(window, \"mouseup\", mouseup);\n setTimeout(rehide, 20);\n };\n on(window, \"mouseup\", mouseup);\n } else {\n setTimeout(rehide, 50);\n }\n};\n\nTextareaInput.prototype.readOnlyChanged = function (val) {\n if (!val) { this.reset(); }\n this.textarea.disabled = val == \"nocursor\";\n};\n\nTextareaInput.prototype.setUneditable = function () {};\n\nTextareaInput.prototype.needsContentAttribute = false;\n\nfunction fromTextArea(textarea, options) {\n options = options ? copyObj(options) : {};\n options.value = textarea.value;\n if (!options.tabindex && textarea.tabIndex)\n { options.tabindex = textarea.tabIndex; }\n if (!options.placeholder && textarea.placeholder)\n { options.placeholder = textarea.placeholder; }\n // Set autofocus to true if this textarea is focused, or if it has\n // autofocus and no other element is focused.\n if (options.autofocus == null) {\n var hasFocus = activeElt();\n options.autofocus = hasFocus == textarea ||\n textarea.getAttribute(\"autofocus\") != null && hasFocus == document.body;\n }\n\n function save() {textarea.value = cm.getValue();}\n\n var realSubmit;\n if (textarea.form) {\n on(textarea.form, \"submit\", save);\n // Deplorable hack to make the submit method do the right thing.\n if (!options.leaveSubmitMethodAlone) {\n var form = textarea.form;\n realSubmit = form.submit;\n try {\n var wrappedSubmit = form.submit = function () {\n save();\n form.submit = realSubmit;\n form.submit();\n form.submit = wrappedSubmit;\n };\n } catch(e) {}\n }\n }\n\n options.finishInit = function (cm) {\n cm.save = save;\n cm.getTextArea = function () { return textarea; };\n cm.toTextArea = function () {\n cm.toTextArea = isNaN; // Prevent this from being ran twice\n save();\n textarea.parentNode.removeChild(cm.getWrapperElement());\n textarea.style.display = \"\";\n if (textarea.form) {\n off(textarea.form, \"submit\", save);\n if (typeof textarea.form.submit == \"function\")\n { textarea.form.submit = realSubmit; }\n }\n };\n };\n\n textarea.style.display = \"none\";\n var cm = CodeMirror$1(function (node) { return textarea.parentNode.insertBefore(node, textarea.nextSibling); },\n options);\n return cm\n}\n\nfunction addLegacyProps(CodeMirror) {\n CodeMirror.off = off;\n CodeMirror.on = on;\n CodeMirror.wheelEventPixels = wheelEventPixels;\n CodeMirror.Doc = Doc;\n CodeMirror.splitLines = splitLinesAuto;\n CodeMirror.countColumn = countColumn;\n CodeMirror.findColumn = findColumn;\n CodeMirror.isWordChar = isWordCharBasic;\n CodeMirror.Pass = Pass;\n CodeMirror.signal = signal;\n CodeMirror.Line = Line;\n CodeMirror.changeEnd = changeEnd;\n CodeMirror.scrollbarModel = scrollbarModel;\n CodeMirror.Pos = Pos;\n CodeMirror.cmpPos = cmp;\n CodeMirror.modes = modes;\n CodeMirror.mimeModes = mimeModes;\n CodeMirror.resolveMode = resolveMode;\n CodeMirror.getMode = getMode;\n CodeMirror.modeExtensions = modeExtensions;\n CodeMirror.extendMode = extendMode;\n CodeMirror.copyState = copyState;\n CodeMirror.startState = startState;\n CodeMirror.innerMode = innerMode;\n CodeMirror.commands = commands;\n CodeMirror.keyMap = keyMap;\n CodeMirror.keyName = keyName;\n CodeMirror.isModifierKey = isModifierKey;\n CodeMirror.lookupKey = lookupKey;\n CodeMirror.normalizeKeyMap = normalizeKeyMap;\n CodeMirror.StringStream = StringStream;\n CodeMirror.SharedTextMarker = SharedTextMarker;\n CodeMirror.TextMarker = TextMarker;\n CodeMirror.LineWidget = LineWidget;\n CodeMirror.e_preventDefault = e_preventDefault;\n CodeMirror.e_stopPropagation = e_stopPropagation;\n CodeMirror.e_stop = e_stop;\n CodeMirror.addClass = addClass;\n CodeMirror.contains = contains;\n CodeMirror.rmClass = rmClass;\n CodeMirror.keyNames = keyNames;\n}\n\n// EDITOR CONSTRUCTOR\n\ndefineOptions(CodeMirror$1);\n\naddEditorMethods(CodeMirror$1);\n\n// Set up methods on CodeMirror's prototype to redirect to the editor's document.\nvar dontDelegate = \"iter insert remove copy getEditor constructor\".split(\" \");\nfor (var prop in Doc.prototype) { if (Doc.prototype.hasOwnProperty(prop) && indexOf(dontDelegate, prop) < 0)\n { CodeMirror$1.prototype[prop] = (function(method) {\n return function() {return method.apply(this.doc, arguments)}\n })(Doc.prototype[prop]); } }\n\neventMixin(Doc);\n\n// INPUT HANDLING\n\nCodeMirror$1.inputStyles = {\"textarea\": TextareaInput, \"contenteditable\": ContentEditableInput};\n\n// MODE DEFINITION AND QUERYING\n\n// Extra arguments are stored as the mode's dependencies, which is\n// used by (legacy) mechanisms like loadmode.js to automatically\n// load a mode. (Preferred mechanism is the require/define calls.)\nCodeMirror$1.defineMode = function(name/*, mode, …*/) {\n if (!CodeMirror$1.defaults.mode && name != \"null\") { CodeMirror$1.defaults.mode = name; }\n defineMode.apply(this, arguments);\n};\n\nCodeMirror$1.defineMIME = defineMIME;\n\n// Minimal default mode.\nCodeMirror$1.defineMode(\"null\", function () { return ({token: function (stream) { return stream.skipToEnd(); }}); });\nCodeMirror$1.defineMIME(\"text/plain\", \"null\");\n\n// EXTENSIONS\n\nCodeMirror$1.defineExtension = function (name, func) {\n CodeMirror$1.prototype[name] = func;\n};\nCodeMirror$1.defineDocExtension = function (name, func) {\n Doc.prototype[name] = func;\n};\n\nCodeMirror$1.fromTextArea = fromTextArea;\n\naddLegacyProps(CodeMirror$1);\n\nCodeMirror$1.version = \"5.31.0\";\n\nreturn CodeMirror$1;\n\n})));\n\n\n/***/ }),\n/* 7 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar Backbone = __webpack_require__(0);\n\nvar TYPE_CLASS = 1;\nvar TYPE_ID = 2;\n\nvar Selector = Backbone.Model.extend({\n idAttribute: 'name',\n\n defaults: {\n name: '',\n\n label: '',\n\n // Type of the selector\n type: TYPE_CLASS,\n\n // If not active it's not selectable by the style manager (uncheckboxed)\n active: true,\n\n // Can't be seen by the style manager, therefore even by the user\n // Will be rendered only in export code\n private: false,\n\n // If true, can't be removed from the attacched element\n protected: false\n },\n\n initialize: function initialize() {\n var name = this.get('name');\n var label = this.get('label');\n\n if (!name) {\n this.set('name', label);\n } else if (!label) {\n this.set('label', name);\n }\n\n this.set('name', Selector.escapeName(this.get('name')));\n },\n\n\n /**\n * Get full selector name\n * @return {string}\n */\n getFullName: function getFullName() {\n var init = '';\n\n switch (this.get('type')) {\n case TYPE_CLASS:\n init = '.';\n break;\n case TYPE_ID:\n init = '#';\n break;\n }\n\n return init + this.get('name');\n }\n}, {\n // All type selectors: https://developer.mozilla.org/it/docs/Web/CSS/CSS_Selectors\n // Here I define only what I need\n TYPE_CLASS: TYPE_CLASS,\n\n TYPE_ID: TYPE_ID,\n\n /**\n * Escape string\n * @param {string} name\n * @return {string}\n * @private\n */\n escapeName: function escapeName(name) {\n return ('' + name).trim().replace(/([^a-z0-9\\w-]+)/gi, '-');\n }\n});\n\nmodule.exports = Selector;\n\n/***/ }),\n/* 8 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _underscore = __webpack_require__(1);\n\nvar Backbone = __webpack_require__(0);\nvar $ = Backbone.$;\n\nmodule.exports = Backbone.View.extend({\n events: {\n change: 'onChange'\n },\n\n attributes: function attributes() {\n return this.model.get('attributes');\n },\n initialize: function initialize(o) {\n var model = this.model;\n var name = model.get('name');\n var target = model.target;\n this.config = o.config || {};\n this.pfx = this.config.stylePrefix || '';\n this.ppfx = this.config.pStylePrefix || '';\n this.target = target;\n this.className = this.pfx + 'trait';\n this.labelClass = this.ppfx + 'label';\n this.fieldClass = this.ppfx + 'field ' + this.ppfx + 'field-' + model.get('type');\n this.inputhClass = this.ppfx + 'input-holder';\n model.off('change:value', this.onValueChange);\n this.listenTo(model, 'change:value', this.onValueChange);\n this.tmpl = '<div class=\"' + this.fieldClass + '\"><div class=\"' + this.inputhClass + '\"></div></div>';\n },\n\n\n /**\n * Fires when the input is changed\n * @private\n */\n onChange: function onChange() {\n this.model.set('value', this.getInputEl().value);\n },\n getValueForTarget: function getValueForTarget() {\n return this.model.get('value');\n },\n setInputValue: function setInputValue(value) {\n this.getInputEl().value = value;\n },\n\n\n /**\n * On change callback\n * @private\n */\n onValueChange: function onValueChange(model, value) {\n var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n var mod = this.model;\n var trg = this.target;\n var name = mod.get('name');\n\n if (opts.fromTarget) {\n this.setInputValue(mod.get('value'));\n } else {\n var _value = this.getValueForTarget();\n mod.setTargetValue(_value);\n }\n },\n\n\n /**\n * Render label\n * @private\n */\n renderLabel: function renderLabel() {\n this.$el.html('<div class=\"' + this.labelClass + '\">' + this.getLabel() + '</div>');\n },\n\n\n /**\n * Returns label for the input\n * @return {string}\n * @private\n */\n getLabel: function getLabel() {\n var model = this.model;\n var label = model.get('label') || model.get('name');\n return label.charAt(0).toUpperCase() + label.slice(1).replace(/-/g, ' ');\n },\n\n\n /**\n * Returns input element\n * @return {HTMLElement}\n * @private\n */\n getInputEl: function getInputEl() {\n if (!this.$input) {\n var md = this.model;\n var trg = this.target;\n var name = md.get('name');\n var plh = md.get('placeholder') || md.get('default') || '';\n var type = md.get('type') || 'text';\n var attrs = trg.get('attributes');\n var min = md.get('min');\n var max = md.get('max');\n var value = md.get('changeProp') ? trg.get(name) : md.get('value') || attrs[name];\n var input = $('<input type=\"' + type + '\" placeholder=\"' + plh + '\">');\n\n if (value) {\n input.prop('value', value);\n }\n\n if (min) {\n input.prop('min', min);\n }\n\n if (max) {\n input.prop('max', max);\n }\n\n this.$input = input;\n }\n return this.$input.get(0);\n },\n getModelValue: function getModelValue() {\n var value;\n var model = this.model;\n var target = this.target;\n var name = model.get('name');\n\n if (model.get('changeProp')) {\n value = target.get(name);\n } else {\n var attrs = target.get('attributes');\n value = model.get('value') || attrs[name];\n }\n\n return value;\n },\n\n\n /**\n * Renders input\n * @private\n * */\n renderField: function renderField() {\n if (!this.$input) {\n this.$el.append(this.tmpl);\n var el = this.getInputEl();\n // I use prepand expecially for checkbox traits\n var inputWrap = this.el.querySelector('.' + this.inputhClass);\n inputWrap.insertBefore(el, inputWrap.childNodes[0]);\n }\n },\n render: function render() {\n this.renderLabel();\n this.renderField();\n this.el.className = this.className;\n return this;\n }\n});\n\n/***/ }),\n/* 9 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;\n\n/*! cash-dom 1.3.5, https://github.com/kenwheeler/cash @license MIT */\n;(function (root, factory) {\n if (true) {\n !(__WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :\n\t\t\t\t__WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n } else if (typeof exports !== \"undefined\") {\n module.exports = factory();\n } else {\n root.cash = root.$ = factory();\n }\n})(this, function () {\n var doc = document, win = window, ArrayProto = Array.prototype, slice = ArrayProto.slice, filter = ArrayProto.filter, push = ArrayProto.push;\n\n var noop = function () {}, isFunction = function (item) {\n // @see https://crbug.com/568448\n return typeof item === typeof noop && item.call;\n }, isString = function (item) {\n return typeof item === typeof \"\";\n };\n\n var idMatch = /^#[\\w-]*$/, classMatch = /^\\.[\\w-]*$/, htmlMatch = /<.+>/, singlet = /^\\w+$/;\n\n function find(selector, context) {\n context = context || doc;\n var elems = (classMatch.test(selector) ? context.getElementsByClassName(selector.slice(1)) : singlet.test(selector) ? context.getElementsByTagName(selector) : context.querySelectorAll(selector));\n return elems;\n }\n\n var frag;\n function parseHTML(str) {\n if (!frag) {\n frag = doc.implementation.createHTMLDocument();\n var base = frag.createElement(\"base\");\n base.href = doc.location.href;\n frag.head.appendChild(base);\n }\n\n frag.body.innerHTML = str;\n\n return frag.body.childNodes;\n }\n\n function onReady(fn) {\n if (doc.readyState !== \"loading\") {\n fn();\n } else {\n doc.addEventListener(\"DOMContentLoaded\", fn);\n }\n }\n\n function Init(selector, context) {\n if (!selector) {\n return this;\n }\n\n // If already a cash collection, don't do any further processing\n if (selector.cash && selector !== win) {\n return selector;\n }\n\n var elems = selector, i = 0, length;\n\n if (isString(selector)) {\n elems = (idMatch.test(selector) ?\n // If an ID use the faster getElementById check\n doc.getElementById(selector.slice(1)) : htmlMatch.test(selector) ?\n // If HTML, parse it into real elements\n parseHTML(selector) :\n // else use `find`\n find(selector, context));\n\n // If function, use as shortcut for DOM ready\n } else if (isFunction(selector)) {\n onReady(selector);return this;\n }\n\n if (!elems) {\n return this;\n }\n\n // If a single DOM element is passed in or received via ID, return the single element\n if (elems.nodeType || elems === win) {\n this[0] = elems;\n this.length = 1;\n } else {\n // Treat like an array and loop through each item.\n length = this.length = elems.length;\n for (; i < length; i++) {\n this[i] = elems[i];\n }\n }\n\n return this;\n }\n\n function cash(selector, context) {\n return new Init(selector, context);\n }\n\n var fn = cash.fn = cash.prototype = Init.prototype = { // jshint ignore:line\n cash: true,\n length: 0,\n push: push,\n splice: ArrayProto.splice,\n map: ArrayProto.map,\n init: Init\n };\n\n Object.defineProperty(fn, \"constructor\", { value: cash });\n\n cash.parseHTML = parseHTML;\n cash.noop = noop;\n cash.isFunction = isFunction;\n cash.isString = isString;\n\n cash.extend = fn.extend = function (target) {\n target = target || {};\n\n var args = slice.call(arguments), length = args.length, i = 1;\n\n if (args.length === 1) {\n target = this;\n i = 0;\n }\n\n for (; i < length; i++) {\n if (!args[i]) {\n continue;\n }\n for (var key in args[i]) {\n if (args[i].hasOwnProperty(key)) {\n target[key] = args[i][key];\n }\n }\n }\n\n return target;\n };\n\n function each(collection, callback) {\n var l = collection.length, i = 0;\n\n for (; i < l; i++) {\n if (callback.call(collection[i], collection[i], i, collection) === false) {\n break;\n }\n }\n }\n\n function matches(el, selector) {\n var m = el && (el.matches || el.webkitMatchesSelector || el.mozMatchesSelector || el.msMatchesSelector || el.oMatchesSelector);\n return !!m && m.call(el, selector);\n }\n\n function getCompareFunction(selector) {\n return (\n /* Use browser's `matches` function if string */\n isString(selector) ? matches :\n /* Match a cash element */\n selector.cash ? function (el) {\n return selector.is(el);\n } :\n /* Direct comparison */\n function (el, selector) {\n return el === selector;\n });\n }\n\n function unique(collection) {\n return cash(slice.call(collection).filter(function (item, index, self) {\n return self.indexOf(item) === index;\n }));\n }\n\n cash.extend({\n merge: function (first, second) {\n var len = +second.length, i = first.length, j = 0;\n\n for (; j < len; i++, j++) {\n first[i] = second[j];\n }\n\n first.length = i;\n return first;\n },\n\n each: each,\n matches: matches,\n unique: unique,\n isArray: Array.isArray,\n isNumeric: function (n) {\n return !isNaN(parseFloat(n)) && isFinite(n);\n }\n\n });\n\n var uid = cash.uid = \"_cash\" + Date.now();\n\n function getDataCache(node) {\n return (node[uid] = node[uid] || {});\n }\n\n function setData(node, key, value) {\n return (getDataCache(node)[key] = value);\n }\n\n function getData(node, key) {\n var c = getDataCache(node);\n if (c[key] === undefined) {\n c[key] = node.dataset ? node.dataset[key] : cash(node).attr(\"data-\" + key);\n }\n return c[key];\n }\n\n function removeData(node, key) {\n var c = getDataCache(node);\n if (c) {\n delete c[key];\n } else if (node.dataset) {\n delete node.dataset[key];\n } else {\n cash(node).removeAttr(\"data-\" + name);\n }\n }\n\n fn.extend({\n data: function (name, value) {\n if (isString(name)) {\n return (value === undefined ? getData(this[0], name) : this.each(function (v) {\n return setData(v, name, value);\n }));\n }\n\n for (var key in name) {\n this.data(key, name[key]);\n }\n\n return this;\n },\n\n removeData: function (key) {\n return this.each(function (v) {\n return removeData(v, key);\n });\n }\n\n });\n\n var notWhiteMatch = /\\S+/g;\n\n function getClasses(c) {\n return isString(c) && c.match(notWhiteMatch);\n }\n\n function hasClass(v, c) {\n return (v.classList ? v.classList.contains(c) : new RegExp(\"(^| )\" + c + \"( |$)\", \"gi\").test(v.className));\n }\n\n function addClass(v, c, spacedName) {\n if (v.classList) {\n v.classList.add(c);\n } else if (spacedName.indexOf(\" \" + c + \" \")) {\n v.className += \" \" + c;\n }\n }\n\n function removeClass(v, c) {\n if (v.classList) {\n v.classList.remove(c);\n } else {\n v.className = v.className.replace(c, \"\");\n }\n }\n\n fn.extend({\n addClass: function (c) {\n var classes = getClasses(c);\n\n return (classes ? this.each(function (v) {\n var spacedName = \" \" + v.className + \" \";\n each(classes, function (c) {\n addClass(v, c, spacedName);\n });\n }) : this);\n },\n\n attr: function (name, value) {\n if (!name) {\n return undefined;\n }\n\n if (isString(name)) {\n if (value === undefined) {\n return this[0] ? this[0].getAttribute ? this[0].getAttribute(name) : this[0][name] : undefined;\n }\n\n return this.each(function (v) {\n if (v.setAttribute) {\n v.setAttribute(name, value);\n } else {\n v[name] = value;\n }\n });\n }\n\n for (var key in name) {\n this.attr(key, name[key]);\n }\n\n return this;\n },\n\n hasClass: function (c) {\n var check = false, classes = getClasses(c);\n if (classes && classes.length) {\n this.each(function (v) {\n check = hasClass(v, classes[0]);\n return !check;\n });\n }\n return check;\n },\n\n prop: function (name, value) {\n if (isString(name)) {\n return (value === undefined ? this[0][name] : this.each(function (v) {\n v[name] = value;\n }));\n }\n\n for (var key in name) {\n this.prop(key, name[key]);\n }\n\n return this;\n },\n\n removeAttr: function (name) {\n return this.each(function (v) {\n if (v.removeAttribute) {\n v.removeAttribute(name);\n } else {\n delete v[name];\n }\n });\n },\n\n removeClass: function (c) {\n if (!arguments.length) {\n return this.attr(\"class\", \"\");\n }\n var classes = getClasses(c);\n return (classes ? this.each(function (v) {\n each(classes, function (c) {\n removeClass(v, c);\n });\n }) : this);\n },\n\n removeProp: function (name) {\n return this.each(function (v) {\n delete v[name];\n });\n },\n\n toggleClass: function (c, state) {\n if (state !== undefined) {\n return this[state ? \"addClass\" : \"removeClass\"](c);\n }\n var classes = getClasses(c);\n return (classes ? this.each(function (v) {\n var spacedName = \" \" + v.className + \" \";\n each(classes, function (c) {\n if (hasClass(v, c)) {\n removeClass(v, c);\n } else {\n addClass(v, c, spacedName);\n }\n });\n }) : this);\n } });\n\n fn.extend({\n add: function (selector, context) {\n return unique(cash.merge(this, cash(selector, context)));\n },\n\n each: function (callback) {\n each(this, callback);\n return this;\n },\n\n eq: function (index) {\n return cash(this.get(index));\n },\n\n filter: function (selector) {\n if (!selector) {\n return this;\n }\n\n var comparator = (isFunction(selector) ? selector : getCompareFunction(selector));\n\n return cash(filter.call(this, function (e) {\n return comparator(e, selector);\n }));\n },\n\n first: function () {\n return this.eq(0);\n },\n\n get: function (index) {\n if (index === undefined) {\n return slice.call(this);\n }\n return (index < 0 ? this[index + this.length] : this[index]);\n },\n\n index: function (elem) {\n var child = elem ? cash(elem)[0] : this[0], collection = elem ? this : cash(child).parent().children();\n return slice.call(collection).indexOf(child);\n },\n\n last: function () {\n return this.eq(-1);\n }\n\n });\n\n var camelCase = (function () {\n var camelRegex = /(?:^\\w|[A-Z]|\\b\\w)/g, whiteSpace = /[\\s-_]+/g;\n return function (str) {\n return str.replace(camelRegex, function (letter, index) {\n return letter[index === 0 ? \"toLowerCase\" : \"toUpperCase\"]();\n }).replace(whiteSpace, \"\");\n };\n }());\n\n var getPrefixedProp = (function () {\n var cache = {}, doc = document, div = doc.createElement(\"div\"), style = div.style;\n\n return function (prop) {\n prop = camelCase(prop);\n if (cache[prop]) {\n return cache[prop];\n }\n\n var ucProp = prop.charAt(0).toUpperCase() + prop.slice(1), prefixes = [\"webkit\", \"moz\", \"ms\", \"o\"], props = (prop + \" \" + (prefixes).join(ucProp + \" \") + ucProp).split(\" \");\n\n each(props, function (p) {\n if (p in style) {\n cache[p] = prop = cache[prop] = p;\n return false;\n }\n });\n\n return cache[prop];\n };\n }());\n\n cash.prefixedProp = getPrefixedProp;\n cash.camelCase = camelCase;\n\n fn.extend({\n css: function (prop, value) {\n if (isString(prop)) {\n prop = getPrefixedProp(prop);\n return (arguments.length > 1 ? this.each(function (v) {\n return v.style[prop] = value;\n }) : win.getComputedStyle(this[0])[prop]);\n }\n\n for (var key in prop) {\n this.css(key, prop[key]);\n }\n\n return this;\n }\n\n });\n\n function compute(el, prop) {\n return parseInt(win.getComputedStyle(el[0], null)[prop], 10) || 0;\n }\n\n each([\"Width\", \"Height\"], function (v) {\n var lower = v.toLowerCase();\n\n fn[lower] = function () {\n return this[0].getBoundingClientRect()[lower];\n };\n\n fn[\"inner\" + v] = function () {\n return this[0][\"client\" + v];\n };\n\n fn[\"outer\" + v] = function (margins) {\n return this[0][\"offset\" + v] + (margins ? compute(this, \"margin\" + (v === \"Width\" ? \"Left\" : \"Top\")) + compute(this, \"margin\" + (v === \"Width\" ? \"Right\" : \"Bottom\")) : 0);\n };\n });\n\n function registerEvent(node, eventName, callback) {\n var eventCache = getData(node, \"_cashEvents\") || setData(node, \"_cashEvents\", {});\n eventCache[eventName] = eventCache[eventName] || [];\n eventCache[eventName].push(callback);\n node.addEventListener(eventName, callback);\n }\n\n function removeEvent(node, eventName, callback) {\n var events = getData(node, \"_cashEvents\"), eventCache = (events && events[eventName]), index;\n\n if (!eventCache) {\n return;\n }\n\n if (callback) {\n node.removeEventListener(eventName, callback);\n index = eventCache.indexOf(callback);\n if (index >= 0) {\n eventCache.splice(index, 1);\n }\n } else {\n each(eventCache, function (event) {\n node.removeEventListener(eventName, event);\n });\n eventCache = [];\n }\n }\n\n fn.extend({\n off: function (eventName, callback) {\n return this.each(function (v) {\n return removeEvent(v, eventName, callback);\n });\n },\n\n on: function (eventName, delegate, callback, runOnce) {\n // jshint ignore:line\n\n var originalCallback;\n\n if (!isString(eventName)) {\n for (var key in eventName) {\n this.on(key, delegate, eventName[key]);\n }\n return this;\n }\n\n if (isFunction(delegate)) {\n callback = delegate;\n delegate = null;\n }\n\n if (eventName === \"ready\") {\n onReady(callback);\n return this;\n }\n\n if (delegate) {\n originalCallback = callback;\n callback = function (e) {\n var t = e.target;\n\n while (!matches(t, delegate)) {\n if (t === this) {\n return (t = false);\n }\n t = t.parentNode;\n }\n\n if (t) {\n originalCallback.call(t, e);\n }\n };\n }\n\n return this.each(function (v) {\n var finalCallback = callback;\n if (runOnce) {\n finalCallback = function () {\n callback.apply(this, arguments);\n removeEvent(v, eventName, finalCallback);\n };\n }\n registerEvent(v, eventName, finalCallback);\n });\n },\n\n one: function (eventName, delegate, callback) {\n return this.on(eventName, delegate, callback, true);\n },\n\n ready: onReady,\n\n trigger: function (eventName, data) {\n var evt = doc.createEvent(\"HTMLEvents\");\n evt.data = data;\n evt.initEvent(eventName, true, false);\n return this.each(function (v) {\n return v.dispatchEvent(evt);\n });\n }\n\n });\n\n function encode(name, value) {\n return \"&\" + encodeURIComponent(name) + \"=\" + encodeURIComponent(value).replace(/%20/g, \"+\");\n }\n\n function getSelectMultiple_(el) {\n var values = [];\n each(el.options, function (o) {\n if (o.selected) {\n values.push(o.value);\n }\n });\n return values.length ? values : null;\n }\n\n function getSelectSingle_(el) {\n var selectedIndex = el.selectedIndex;\n return selectedIndex >= 0 ? el.options[selectedIndex].value : null;\n }\n\n function getValue(el) {\n var type = el.type;\n if (!type) {\n return null;\n }\n switch (type.toLowerCase()) {\n case \"select-one\":\n return getSelectSingle_(el);\n case \"select-multiple\":\n return getSelectMultiple_(el);\n case \"radio\":\n return (el.checked) ? el.value : null;\n case \"checkbox\":\n return (el.checked) ? el.value : null;\n default:\n return el.value ? el.value : null;\n }\n }\n\n fn.extend({\n serialize: function () {\n var query = \"\";\n\n each(this[0].elements || this, function (el) {\n if (el.disabled || el.tagName === \"FIELDSET\") {\n return;\n }\n var name = el.name;\n switch (el.type.toLowerCase()) {\n case \"file\":\n case \"reset\":\n case \"submit\":\n case \"button\":\n break;\n case \"select-multiple\":\n var values = getValue(el);\n if (values !== null) {\n each(values, function (value) {\n query += encode(name, value);\n });\n }\n break;\n default:\n var value = getValue(el);\n if (value !== null) {\n query += encode(name, value);\n }\n }\n });\n\n return query.substr(1);\n },\n\n val: function (value) {\n if (value === undefined) {\n return getValue(this[0]);\n } else {\n return this.each(function (v) {\n return v.value = value;\n });\n }\n }\n\n });\n\n function insertElement(el, child, prepend) {\n if (prepend) {\n var first = el.childNodes[0];\n el.insertBefore(child, first);\n } else {\n el.appendChild(child);\n }\n }\n\n function insertContent(parent, child, prepend) {\n var str = isString(child);\n\n if (!str && child.length) {\n each(child, function (v) {\n return insertContent(parent, v, prepend);\n });\n return;\n }\n\n each(parent, str ? function (v) {\n return v.insertAdjacentHTML(prepend ? \"afterbegin\" : \"beforeend\", child);\n } : function (v, i) {\n return insertElement(v, (i === 0 ? child : child.cloneNode(true)), prepend);\n });\n }\n\n fn.extend({\n after: function (selector) {\n cash(selector).insertAfter(this);\n return this;\n },\n\n append: function (content) {\n insertContent(this, content);\n return this;\n },\n\n appendTo: function (parent) {\n insertContent(cash(parent), this);\n return this;\n },\n\n before: function (selector) {\n cash(selector).insertBefore(this);\n return this;\n },\n\n clone: function () {\n return cash(this.map(function (v) {\n return v.cloneNode(true);\n }));\n },\n\n empty: function () {\n this.html(\"\");\n return this;\n },\n\n html: function (content) {\n if (content === undefined) {\n return this[0].innerHTML;\n }\n var source = (content.nodeType ? content[0].outerHTML : content);\n return this.each(function (v) {\n return v.innerHTML = source;\n });\n },\n\n insertAfter: function (selector) {\n var _this = this;\n\n\n cash(selector).each(function (el, i) {\n var parent = el.parentNode, sibling = el.nextSibling;\n _this.each(function (v) {\n parent.insertBefore((i === 0 ? v : v.cloneNode(true)), sibling);\n });\n });\n\n return this;\n },\n\n insertBefore: function (selector) {\n var _this2 = this;\n cash(selector).each(function (el, i) {\n var parent = el.parentNode;\n _this2.each(function (v) {\n parent.insertBefore((i === 0 ? v : v.cloneNode(true)), el);\n });\n });\n return this;\n },\n\n prepend: function (content) {\n insertContent(this, content, true);\n return this;\n },\n\n prependTo: function (parent) {\n insertContent(cash(parent), this, true);\n return this;\n },\n\n remove: function () {\n return this.each(function (v) {\n return v.parentNode.removeChild(v);\n });\n },\n\n text: function (content) {\n if (content === undefined) {\n return this[0].textContent;\n }\n return this.each(function (v) {\n return v.textContent = content;\n });\n }\n\n });\n\n var docEl = doc.documentElement;\n\n fn.extend({\n position: function () {\n var el = this[0];\n return {\n left: el.offsetLeft,\n top: el.offsetTop\n };\n },\n\n offset: function () {\n var rect = this[0].getBoundingClientRect();\n return {\n top: rect.top + win.pageYOffset - docEl.clientTop,\n left: rect.left + win.pageXOffset - docEl.clientLeft\n };\n },\n\n offsetParent: function () {\n return cash(this[0].offsetParent);\n }\n\n });\n\n fn.extend({\n children: function (selector) {\n var elems = [];\n this.each(function (el) {\n push.apply(elems, el.children);\n });\n elems = unique(elems);\n\n return (!selector ? elems : elems.filter(function (v) {\n return matches(v, selector);\n }));\n },\n\n closest: function (selector) {\n if (!selector || this.length < 1) {\n return cash();\n }\n if (this.is(selector)) {\n return this.filter(selector);\n }\n return this.parent().closest(selector);\n },\n\n is: function (selector) {\n if (!selector) {\n return false;\n }\n\n var match = false, comparator = getCompareFunction(selector);\n\n this.each(function (el) {\n match = comparator(el, selector);\n return !match;\n });\n\n return match;\n },\n\n find: function (selector) {\n if (!selector || selector.nodeType) {\n return cash(selector && this.has(selector).length ? selector : null);\n }\n\n var elems = [];\n this.each(function (el) {\n push.apply(elems, find(selector, el));\n });\n\n return unique(elems);\n },\n\n has: function (selector) {\n var comparator = (isString(selector) ? function (el) {\n return find(selector, el).length !== 0;\n } : function (el) {\n return el.contains(selector);\n });\n\n return this.filter(comparator);\n },\n\n next: function () {\n return cash(this[0].nextElementSibling);\n },\n\n not: function (selector) {\n if (!selector) {\n return this;\n }\n\n var comparator = getCompareFunction(selector);\n\n return this.filter(function (el) {\n return !comparator(el, selector);\n });\n },\n\n parent: function () {\n var result = [];\n\n this.each(function (item) {\n if (item && item.parentNode) {\n result.push(item.parentNode);\n }\n });\n\n return unique(result);\n },\n\n parents: function (selector) {\n var last, result = [];\n\n this.each(function (item) {\n last = item;\n\n while (last && last.parentNode && last !== doc.body.parentNode) {\n last = last.parentNode;\n\n if (!selector || (selector && matches(last, selector))) {\n result.push(last);\n }\n }\n });\n\n return unique(result);\n },\n\n prev: function () {\n return cash(this[0].previousElementSibling);\n },\n\n siblings: function () {\n var collection = this.parent().children(), el = this[0];\n\n return collection.filter(function (i) {\n return i !== el;\n });\n }\n\n });\n\n\n return cash;\n});\n\n/***/ }),\n/* 10 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _underscore = __webpack_require__(1);\n\nvar Selector = __webpack_require__(7);\n\nmodule.exports = __webpack_require__(0).Collection.extend({\n model: Selector,\n\n getStyleable: function getStyleable() {\n return (0, _underscore.filter)(this.models, function (item) {\n return item.get('active') && !item.get('private');\n });\n },\n getValid: function getValid() {\n return (0, _underscore.filter)(this.models, function (item) {\n return !item.get('private');\n });\n },\n getFullString: function getFullString(collection) {\n var result = [];\n var coll = collection || this;\n coll.forEach(function (selector) {\n return result.push(selector.getFullName());\n });\n return result.join('').trim();\n }\n});\n\n/***/ }),\n/* 11 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar _TypeableCollection = __webpack_require__(32);\n\nvar _TypeableCollection2 = _interopRequireDefault(_TypeableCollection);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar Property = __webpack_require__(12);\n\nmodule.exports = __webpack_require__(0).Collection.extend(_TypeableCollection2.default).extend({\n types: [{\n id: 'stack',\n model: __webpack_require__(119),\n view: __webpack_require__(34),\n isType: function isType(value) {\n if (value && value.type == 'stack') {\n return value;\n }\n }\n }, {\n id: 'composite',\n model: __webpack_require__(33),\n view: __webpack_require__(17),\n isType: function isType(value) {\n if (value && value.type == 'composite') {\n return value;\n }\n }\n }, {\n id: 'file',\n model: Property,\n view: __webpack_require__(40),\n isType: function isType(value) {\n if (value && value.type == 'file') {\n return value;\n }\n }\n }, {\n id: 'color',\n model: Property,\n view: __webpack_require__(38),\n isType: function isType(value) {\n if (value && value.type == 'color') {\n return value;\n }\n }\n }, {\n id: 'select',\n model: __webpack_require__(41),\n view: __webpack_require__(37),\n isType: function isType(value) {\n if (value && value.type == 'select') {\n return value;\n }\n }\n }, {\n id: 'radio',\n model: __webpack_require__(41),\n view: __webpack_require__(36),\n isType: function isType(value) {\n if (value && value.type == 'radio') {\n return value;\n }\n }\n }, {\n id: 'slider',\n model: __webpack_require__(125),\n view: __webpack_require__(126),\n isType: function isType(value) {\n if (value && value.type == 'slider') {\n return value;\n }\n }\n }, {\n id: 'integer',\n model: __webpack_require__(42),\n view: __webpack_require__(14),\n isType: function isType(value) {\n if (value && value.type == 'integer') {\n return value;\n }\n }\n }, {\n id: 'base',\n model: Property,\n view: __webpack_require__(5),\n isType: function isType(value) {\n value.type = 'base';\n return value;\n }\n }],\n\n deepClone: function deepClone() {\n var collection = this.clone();\n collection.reset(collection.map(function (model) {\n var cloned = model.clone();\n cloned.typeView = model.typeView;\n return cloned;\n }));\n return collection;\n },\n\n\n /**\n * Parse a value and return an array splitted by properties\n * @param {string} value\n * @return {Array}\n * @return\n */\n parseValue: function parseValue(value) {\n var _this = this;\n\n var properties = [];\n var values = value.split(' ');\n values.forEach(function (value, i) {\n var property = _this.at(i);\n properties.push(_extends({}, property.attributes, { value: value }));\n });\n return properties;\n },\n getFullValue: function getFullValue() {\n var result = '';\n this.each(function (model) {\n return result += model.getFullValue() + ' ';\n });\n return result.trim();\n }\n});\n\n/***/ }),\n/* 12 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nmodule.exports = __webpack_require__(0).Model.extend({\n defaults: {\n name: '',\n property: '',\n type: '',\n defaults: '',\n info: '',\n value: '',\n icon: '',\n functionName: '',\n status: '',\n visible: true,\n fixedValues: ['initial', 'inherit'],\n\n // If true, will be hidden by default and will show up only for targets\n // which require this property (via `stylable-require`)\n // Use case:\n // you can add all SVG CSS properties with toRequire as true\n // and then require them on SVG Components\n toRequire: 0\n },\n\n initialize: function initialize(opt) {\n var o = opt || {};\n var name = this.get('name');\n var prop = this.get('property');\n\n if (!name) {\n this.set('name', prop.charAt(0).toUpperCase() + prop.slice(1).replace(/-/g, ' '));\n }\n\n var init = this.init && this.init.bind(this);\n init && init();\n },\n\n\n /**\n * Update value\n * @param {any} value\n * @param {Boolen} [complete=true] Indicates if it's a final state\n * @param {Object} [opts={}] Options\n */\n setValue: function setValue(value) {\n var complete = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;\n var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n var parsed = this.parseValue(value);\n this.set(parsed, _extends({}, opts, { avoidStore: 1 }));\n\n // It's important to set an empty value, otherwise the\n // UndoManager won't see the change\n if (complete) {\n this.set('value', '', opts);\n this.set(parsed, opts);\n }\n },\n\n\n /**\n * Like `setValue` but, in addition, prevents the update of the input element\n * as the changes should come from the input itself.\n * This method is useful with the definition of custom properties\n * @param {any} value\n * @param {Boolen} [complete=true] Indicates if it's a final state\n * @param {Object} [opts={}] Options\n */\n setValueFromInput: function setValueFromInput(value, complete) {\n var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n this.setValue(value, complete, _extends({}, opts, { fromInput: 1 }));\n },\n\n\n /**\n * Parse a raw value, generally fetched from the target, for this property\n * @param {string} value Raw value string\n * @return {Object}\n * @example\n * // example with an Input type\n * prop.parseValue('translateX(10deg)');\n * // -> { value: 10, unit: 'deg', functionName: 'translateX' }\n *\n */\n parseValue: function parseValue(value) {\n var result = { value: value };\n\n if (!this.get('functionName')) {\n return result;\n }\n\n var args = [];\n var valueStr = '' + value;\n var start = valueStr.indexOf('(') + 1;\n var end = valueStr.lastIndexOf(')');\n args.push(start);\n\n // Will try even if the last closing parentheses is not found\n if (end >= 0) {\n args.push(end);\n }\n\n result.value = String.prototype.substring.apply(valueStr, args);\n return result;\n },\n\n\n /**\n * Get the default value\n * @return {string}\n * @private\n */\n getDefaultValue: function getDefaultValue() {\n return this.get('defaults');\n },\n\n\n /**\n * Get a complete value of the property.\n * This probably will replace the getValue when all\n * properties models will be splitted\n * @param {string} val Custom value to replace the one on the model\n * @return {string}\n * @private\n */\n getFullValue: function getFullValue(val) {\n var fn = this.get('functionName');\n var value = val || this.get('value');\n\n if (fn) {\n value = fn + '(' + value + ')';\n }\n\n return value;\n }\n});\n\n/***/ }),\n/* 13 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Backbone) {\n\nvar PropertyView = __webpack_require__(5);\nvar PropertyIntegerView = __webpack_require__(14);\nvar PropertyRadioView = __webpack_require__(36);\nvar PropertySelectView = __webpack_require__(37);\nvar PropertyColorView = __webpack_require__(38);\nvar PropertyFileView = __webpack_require__(40);\nvar PropertyCompositeView = __webpack_require__(17);\nvar PropertyStackView = __webpack_require__(34);\n\nmodule.exports = Backbone.View.extend({\n initialize: function initialize(o) {\n this.config = o.config || {};\n this.pfx = this.config.stylePrefix || '';\n this.target = o.target || {};\n this.propTarget = o.propTarget || {};\n this.onChange = o.onChange;\n this.onInputRender = o.onInputRender || {};\n this.customValue = o.customValue || {};\n var coll = this.collection;\n this.listenTo(coll, 'add', this.addTo);\n this.listenTo(coll, 'reset', this.render);\n },\n addTo: function addTo(model) {\n this.add(model);\n },\n add: function add(model, frag) {\n var view = new model.typeView({\n model: model,\n name: model.get('name'),\n id: this.pfx + model.get('property'),\n target: this.target,\n propTarget: this.propTarget,\n onChange: this.onChange,\n onInputRender: this.onInputRender,\n config: this.config\n });\n\n if (model.get('type') != 'composite') {\n view.customValue = this.customValue;\n }\n\n view.render();\n var el = view.el;\n\n if (frag) {\n frag.appendChild(el);\n } else {\n this.el.appendChild(el);\n }\n },\n render: function render() {\n var _this = this;\n\n var fragment = document.createDocumentFragment();\n this.collection.each(function (model) {\n return _this.add(model, fragment);\n });\n this.$el.append(fragment);\n this.$el.attr('class', this.pfx + 'properties');\n return this;\n }\n});\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))\n\n/***/ }),\n/* 14 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Backbone) {\n\nvar InputNumber = __webpack_require__(18);\nvar $ = Backbone.$;\n\nmodule.exports = __webpack_require__(5).extend({\n templateInput: function templateInput() {\n return '';\n },\n init: function init() {\n var model = this.model;\n this.listenTo(model, 'change:unit', this.modelValueChanged);\n this.listenTo(model, 'el:change', this.elementUpdated);\n },\n setValue: function setValue(value) {\n this.inputInst.setValue(value, { silent: 1 });\n },\n onRender: function onRender() {\n var ppfx = this.ppfx;\n\n if (!this.input) {\n var input = this.model.input;\n input.ppfx = ppfx;\n input.render();\n var fields = this.el.querySelector('.' + ppfx + 'fields');\n fields.appendChild(input.el);\n this.$input = input.inputEl;\n this.unit = input.unitEl;\n this.$unit = $(this.unit);\n this.input = this.$input.get(0);\n this.inputInst = input;\n }\n }\n});\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))\n\n/***/ }),\n/* 15 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar Backbone = __webpack_require__(0);\nvar ComponentView = __webpack_require__(3);\n\nmodule.exports = ComponentView.extend({\n tagName: 'img',\n\n events: {\n dblclick: 'openModal',\n click: 'initResize'\n },\n\n initialize: function initialize(o) {\n var model = this.model;\n ComponentView.prototype.initialize.apply(this, arguments);\n this.listenTo(model, 'change:src', this.updateSrc);\n this.listenTo(model, 'dblclick active', this.openModal);\n this.classEmpty = this.ppfx + 'plh-image';\n var config = this.config;\n config.modal && (this.modal = config.modal);\n config.am && (this.am = config.am);\n this.fetchFile();\n },\n\n\n /**\n * Fetch file if exists\n */\n fetchFile: function fetchFile() {\n var model = this.model;\n var file = model.get('file');\n\n if (file) {\n var fu = this.em.get('AssetManager').FileUploader();\n fu.uploadFile({\n dataTransfer: { files: [file] }\n }, function (res) {\n var obj = res && res.data && res.data[0];\n var src = obj && obj.src;\n src && model.set({ src: src });\n });\n model.set('file', '');\n }\n },\n\n\n /**\n * Update src attribute\n * @private\n * */\n updateSrc: function updateSrc() {\n var src = this.model.get('src');\n var el = this.$el;\n el.attr('src', src);\n el[src ? 'removeClass' : 'addClass'](this.classEmpty);\n },\n\n\n /**\n * Open dialog for image changing\n * @param {Object} e Event\n * @private\n * */\n openModal: function openModal(e) {\n var em = this.opts.config.em;\n var editor = em ? em.get('Editor') : '';\n\n if (editor && this.model.get('editable')) {\n editor.runCommand('open-assets', {\n target: this.model,\n onSelect: function onSelect() {\n editor.Modal.close();\n editor.AssetManager.setTarget(null);\n }\n });\n }\n },\n render: function render() {\n this.updateAttributes();\n this.updateClasses();\n\n var actCls = this.$el.attr('class') || '';\n if (!this.model.get('src')) this.$el.attr('class', (actCls + ' ' + this.classEmpty).trim());\n\n // Avoid strange behaviours while try to drag\n this.$el.attr('onmousedown', 'return false');\n return this;\n }\n});\n\n/***/ }),\n/* 16 */\n/***/ (function(module, exports) {\n\nvar g;\n\n// This works in non-strict mode\ng = (function() {\n\treturn this;\n})();\n\ntry {\n\t// This works if eval is allowed (see CSP)\n\tg = g || Function(\"return this\")() || (1,eval)(\"this\");\n} catch(e) {\n\t// This works if the window reference is available\n\tif(typeof window === \"object\")\n\t\tg = window;\n}\n\n// g can still be undefined, but nothing to do about it...\n// We return undefined, instead of nothing here, so it's\n// easier to handle this case. if(!global) { ...}\n\nmodule.exports = g;\n\n\n/***/ }),\n/* 17 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Backbone) {\n\nvar PropertyView = __webpack_require__(5);\nvar $ = Backbone.$;\n\nmodule.exports = PropertyView.extend({\n templateInput: function templateInput() {\n var pfx = this.pfx;\n return '\\n <div class=\"' + pfx + 'field ' + pfx + 'composite\">\\n <span id=\"' + pfx + 'input-holder\"></span>\\n </div>\\n ';\n },\n inputValueChanged: function inputValueChanged() {\n // If it's not detached (eg. 'padding: 1px 2px 3px 4px;') it will follow\n // the same flow of PropertyView\n if (!this.model.get('detached')) {\n for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n PropertyView.prototype.inputValueChanged.apply(this, args);\n }\n },\n\n\n /**\n * Renders input\n * */\n onRender: function onRender() {\n var model = this.model;\n var props = model.get('properties') || [];\n var self = this;\n\n if (props.length) {\n if (!this.$input) {\n this.$input = $('<input type=\"hidden\" value=\"0\">');\n this.input = this.$input.get(0);\n }\n\n if (!this.props) {\n this.props = model.get('properties');\n }\n\n if (!this.$props) {\n //Not yet supported nested composite\n this.props.each(function (prop, index) {\n if (prop && prop.get('type') == 'composite') {\n this.props.remove(prop);\n console.warn('Nested composite types not yet allowed.');\n }\n prop.parent = model;\n }, this);\n\n var PropertiesView = __webpack_require__(13);\n var propsView = new PropertiesView(this.getPropsConfig());\n this.$props = propsView.render().$el;\n this.$el.find('#' + this.pfx + 'input-holder').append(this.$props);\n }\n }\n },\n\n\n /**\n * Returns configurations that should be past to properties\n * @param {Object} opts\n * @return {Object}\n */\n getPropsConfig: function getPropsConfig(opts) {\n var that = this;\n var model = this.model;\n\n var result = {\n config: this.config,\n collection: this.props,\n target: this.target,\n propTarget: this.propTarget,\n // On any change made to children I need to update composite value\n onChange: function onChange(el, view, opts) {\n model.set('value', model.getFullValue(), opts);\n },\n\n // Each child property will receive a full composite string, eg. '0px 0px 10px 0px'\n // I need to extract from that string the corresponding one to that property.\n customValue: function customValue(property, mIndex) {\n return that.valueOnIndex(mIndex, property);\n }\n };\n\n // If detached let follow its standard flow\n if (model.get('detached')) {\n delete result.onChange;\n }\n\n return result;\n },\n\n\n /**\n * Extract string from composite value\n * @param {number} index Index\n * @param {Object} view Property view\n * @return {string}\n * */\n valueOnIndex: function valueOnIndex(index, view) {\n var value = void 0;\n var targetValue = this.getTargetValue({ ignoreDefault: 1 });\n\n // If the target value of the composite is not empty I'll fetch\n // the corresponding value from the requested index, otherwise try\n // to get the value of the sub-property\n if (targetValue) {\n var values = targetValue.split(' ');\n value = values[index];\n } else {\n value = view && view.getTargetValue({ ignoreCustomValue: 1, ignoreDefault: 1 });\n }\n\n if (view) {\n value = view.model.parseValue(value).value;\n }\n\n return value;\n }\n});\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))\n\n/***/ }),\n/* 18 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(_) {\n\nvar _underscore = __webpack_require__(1);\n\nvar _mixins = __webpack_require__(2);\n\nvar Input = __webpack_require__(35);\nvar Backbone = __webpack_require__(0);\nvar $ = Backbone.$;\n\nmodule.exports = Input.extend({\n events: {\n 'change input': 'handleChange',\n 'change select': 'handleUnitChange',\n 'click [data-arrow-up]': 'upArrowClick',\n 'click [data-arrow-down]': 'downArrowClick',\n 'mousedown [data-arrows]': 'downIncrement'\n },\n\n template: function template() {\n var ppfx = this.ppfx;\n return '\\n <span class=\"' + ppfx + 'input-holder\"></span>\\n <span class=\"' + ppfx + 'field-units\"></span>\\n <div class=\"' + ppfx + 'field-arrows\" data-arrows>\\n <div class=\"' + ppfx + 'field-arrow-u\" data-arrow-up></div>\\n <div class=\"' + ppfx + 'field-arrow-d\" data-arrow-down></div>\\n </div>\\n ';\n },\n inputClass: function inputClass() {\n var ppfx = this.ppfx;\n return this.opts.contClass || ppfx + 'field ' + ppfx + 'field-integer';\n },\n initialize: function initialize() {\n var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n Input.prototype.initialize.apply(this, arguments);\n (0, _underscore.bindAll)(this, 'moveIncrement', 'upIncrement');\n this.doc = document;\n this.listenTo(this.model, 'change:unit', this.handleModelChange);\n },\n\n\n /**\n * Set value to the model\n * @param {string} value\n * @param {Object} opts\n */\n setValue: function setValue(value, opts) {\n var opt = opts || {};\n var valid = this.validateInputValue(value, { deepCheck: 1 });\n var validObj = { value: valid.value };\n\n // If found some unit value\n if (valid.unit || valid.force) {\n validObj.unit = valid.unit;\n }\n\n this.model.set(validObj, opt);\n\n // Generally I get silent when I need to reflect data to view without\n // reupdating the target\n if (opt.silent) {\n this.handleModelChange();\n }\n },\n\n\n /**\n * Handled when the view is changed\n */\n handleChange: function handleChange(e) {\n e.stopPropagation();\n this.setValue(this.getInputEl().value);\n this.elementUpdated();\n },\n\n\n /**\n * Handled when the view is changed\n */\n handleUnitChange: function handleUnitChange(e) {\n e.stopPropagation();\n var value = this.getUnitEl().value;\n this.model.set('unit', value);\n this.elementUpdated();\n },\n\n\n /**\n * Fired when the element of the property is updated\n */\n elementUpdated: function elementUpdated() {\n this.model.trigger('el:change');\n },\n\n\n /**\n * Updates the view when the model is changed\n * */\n handleModelChange: function handleModelChange() {\n var model = this.model;\n this.getInputEl().value = model.get('value');\n var unitEl = this.getUnitEl();\n unitEl && (unitEl.value = model.get('unit') || '');\n },\n\n\n /**\n * Get the unit element\n * @return {HTMLElement}\n */\n getUnitEl: function getUnitEl() {\n if (!this.unitEl) {\n var model = this.model;\n var units = model.get('units') || [];\n\n if (units.length) {\n var options = [];\n\n units.forEach(function (unit) {\n var selected = unit == model.get('unit') ? 'selected' : '';\n options.push('<option ' + selected + '>' + unit + '</option>');\n });\n\n var temp = document.createElement('div');\n temp.innerHTML = '<select class=\"' + this.ppfx + 'input-unit\">' + options.join('') + '</select>';\n this.unitEl = temp.firstChild;\n }\n }\n\n return this.unitEl;\n },\n\n\n /**\n * Invoked when the up arrow is clicked\n * */\n upArrowClick: function upArrowClick() {\n var model = this.model;\n var step = model.get('step');\n var value = parseInt(model.get('value'), 10);\n value = this.normalizeValue(value + step);\n var valid = this.validateInputValue(value);\n model.set('value', valid.value);\n this.elementUpdated();\n },\n\n\n /**\n * Invoked when the down arrow is clicked\n * */\n downArrowClick: function downArrowClick() {\n var model = this.model;\n var step = model.get('step');\n var value = parseInt(model.get('value'), 10);\n var val = this.normalizeValue(value - step);\n var valid = this.validateInputValue(val);\n model.set('value', valid.value);\n this.elementUpdated();\n },\n\n\n /**\n * Change easily integer input value with click&drag method\n * @param Event\n *\n * @return void\n * */\n downIncrement: function downIncrement(e) {\n e.preventDefault();\n this.moved = 0;\n var value = this.model.get('value');\n value = this.normalizeValue(value);\n this.current = { y: e.pageY, val: value };\n (0, _mixins.on)(this.doc, 'mousemove', this.moveIncrement);\n (0, _mixins.on)(this.doc, 'mouseup', this.upIncrement);\n },\n\n\n /** While the increment is clicked, moving the mouse will update input value\n * @param Object\n *\n * @return bool\n * */\n moveIncrement: function moveIncrement(ev) {\n this.moved = 1;\n var model = this.model;\n var step = model.get('step');\n var data = this.current;\n var pos = this.normalizeValue(data.val + (data.y - ev.pageY) * step);\n this.prValue = this.validateInputValue(pos).value;\n model.set('value', this.prValue, { avoidStore: 1 });\n return false;\n },\n\n\n /**\n * Stop moveIncrement method\n * */\n upIncrement: function upIncrement() {\n var model = this.model;\n var step = model.get('step');\n (0, _mixins.off)(this.doc, 'mouseup', this.upIncrement);\n (0, _mixins.off)(this.doc, 'mousemove', this.moveIncrement);\n\n if (this.prValue && this.moved) {\n var value = this.prValue - step;\n model.set('value', value, { avoidStore: 1 }).set('value', value + step);\n this.elementUpdated();\n }\n },\n normalizeValue: function normalizeValue(value) {\n var defValue = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n\n var model = this.model;\n var step = model.get('step');\n var stepDecimals = 0;\n\n if (isNaN(value)) {\n return defValue;\n }\n\n value = parseFloat(value);\n\n if (Math.floor(value) !== value) {\n var side = step.toString().split('.')[1];\n stepDecimals = side ? side.length : 0;\n }\n\n return stepDecimals ? parseFloat(value.toFixed(stepDecimals)) : value;\n },\n\n\n /**\n * Validate input value\n * @param {String} value Raw value\n * @param {Object} opts Options\n * @return {Object} Validated string\n */\n validateInputValue: function validateInputValue(value, opts) {\n var force = 0;\n var opt = opts || {};\n var model = this.model;\n var val = value !== '' ? value : model.get('defaults');\n var units = model.get('units') || [];\n var unit = model.get('unit') || units.length && units[0] || '';\n var max = model.get('max');\n var min = model.get('min');\n\n if (opt.deepCheck) {\n var fixed = model.get('fixedValues') || [];\n\n if (val) {\n // If the value is one of the fixed values I leave it as it is\n var regFixed = new RegExp('^' + fixed.join('|'), 'g');\n if (fixed.length && regFixed.test(val)) {\n val = val.match(regFixed)[0];\n unit = '';\n force = 1;\n } else {\n var valCopy = val + '';\n val += ''; // Make it suitable for replace\n val = parseFloat(val.replace(',', '.'));\n val = !isNaN(val) ? val : model.get('defaults');\n var uN = valCopy.replace(val, '');\n // Check if exists as unit\n if (_.indexOf(units, uN) >= 0) unit = uN;\n }\n }\n }\n\n if (typeof max !== 'undefined' && max !== '') val = val > max ? max : val;\n\n if (typeof min !== 'undefined' && min !== '') val = val < min ? min : val;\n\n return {\n force: force,\n value: val,\n unit: unit\n };\n },\n render: function render() {\n Input.prototype.render.call(this);\n var unit = this.getUnitEl();\n unit && this.$el.find('.' + this.ppfx + 'field-units').get(0).appendChild(unit);\n return this;\n }\n});\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))\n\n/***/ }),\n/* 19 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar Component = __webpack_require__(4);\n\nmodule.exports = Component.extend({\n defaults: _extends({}, Component.prototype.defaults, {\n type: 'tbody',\n tagName: 'tbody',\n draggable: ['table'],\n droppable: ['tr'],\n columns: 1,\n rows: 1\n }),\n\n initialize: function initialize(o, opt) {\n Component.prototype.initialize.apply(this, arguments);\n var components = this.get('components');\n var columns = this.get('columns');\n var rows = this.get('rows');\n\n // Init components if empty\n if (!components.length) {\n var rowsToAdd = [];\n\n while (rows--) {\n var columnsToAdd = [];\n var clm = columns;\n\n while (clm--) {\n columnsToAdd.push({\n type: 'cell',\n classes: ['cell']\n });\n }\n\n rowsToAdd.push({\n type: 'row',\n classes: ['row'],\n components: columnsToAdd\n });\n }\n\n components.add(rowsToAdd);\n }\n }\n}, {\n isComponent: function isComponent(el) {\n var result = '';\n\n if (el.tagName == 'TBODY') {\n result = { type: 'tbody' };\n }\n\n return result;\n }\n});\n\n/***/ }),\n/* 20 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar Component = __webpack_require__(4);\n\nmodule.exports = Component.extend({\n defaults: _extends({}, Component.prototype.defaults, {\n type: 'image',\n tagName: 'img',\n src: '',\n void: 1,\n droppable: 0,\n editable: 1,\n highlightable: 0,\n resizable: 1,\n traits: ['alt'],\n\n // File to load asynchronously once the model is rendered\n file: ''\n }),\n\n initialize: function initialize(o, opt) {\n Component.prototype.initialize.apply(this, arguments);\n var attr = this.get('attributes');\n if (attr.src) this.set('src', attr.src);\n },\n initToolbar: function initToolbar() {\n for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n Component.prototype.initToolbar.apply(this, args);\n var em = this.em;\n\n if (em) {\n var cmd = em.get('Commands');\n var cmdName = 'image-editor';\n\n // Add Image Editor button only if the default command exists\n if (cmd.has(cmdName)) {\n var tb = this.get('toolbar');\n tb.push({\n attributes: { class: 'fa fa-pencil' },\n command: cmdName\n });\n this.set('toolbar', tb);\n }\n }\n },\n\n\n /**\n * Returns object of attributes for HTML\n * @return {Object}\n * @private\n */\n getAttrToHTML: function getAttrToHTML() {\n for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n\n var attr = Component.prototype.getAttrToHTML.apply(this, args);\n delete attr.onmousedown;\n var src = this.get('src');\n if (src) attr.src = src;\n return attr;\n },\n\n\n /**\n * Parse uri\n * @param {string} uri\n * @return {object}\n * @private\n */\n parseUri: function parseUri(uri) {\n var el = document.createElement('a');\n el.href = uri;\n var query = {};\n var qrs = el.search.substring(1).split('&');\n for (var i = 0; i < qrs.length; i++) {\n var pair = qrs[i].split('=');\n var name = decodeURIComponent(pair[0]);\n if (name) query[name] = decodeURIComponent(pair[1]);\n }\n return {\n hostname: el.hostname,\n pathname: el.pathname,\n protocol: el.protocol,\n search: el.search,\n hash: el.hash,\n port: el.port,\n query: query\n };\n }\n}, {\n /**\n * Detect if the passed element is a valid component.\n * In case the element is valid an object abstracted\n * from the element will be returned\n * @param {HTMLElement}\n * @return {Object}\n * @private\n */\n isComponent: function isComponent(el) {\n var result = '';\n if (el.tagName == 'IMG') {\n result = { type: 'image' };\n }\n return result;\n }\n});\n\n/***/ }),\n/* 21 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nvar _underscore = __webpack_require__(1);\n\nvar _mixins = __webpack_require__(2);\n\nvar ToolbarView = __webpack_require__(187);\nvar Toolbar = __webpack_require__(189);\nvar key = __webpack_require__(23);\nvar $ = __webpack_require__(0).$;\nvar showOffsets = void 0;\n\nmodule.exports = {\n init: function init(o) {\n (0, _underscore.bindAll)(this, 'onHover', 'onOut', 'onClick', 'onKeyPress', 'onFrameScroll');\n },\n enable: function enable() {\n this.frameOff = this.canvasOff = this.adjScroll = null;\n var config = this.config.em.get('Config');\n this.startSelectComponent();\n var em = this.config.em;\n showOffsets = 1;\n\n em.on('component:update', this.updateAttached, this);\n em.on('change:canvasOffset', this.updateAttached, this);\n },\n\n\n /**\n * Start select component event\n * @private\n * */\n startSelectComponent: function startSelectComponent() {\n this.toggleSelectComponent(1);\n },\n\n\n /**\n * Stop select component event\n * @private\n * */\n stopSelectComponent: function stopSelectComponent() {\n this.toggleSelectComponent();\n },\n\n\n /**\n * Toggle select component event\n * @private\n * */\n toggleSelectComponent: function toggleSelectComponent(enable) {\n var em = this.em;\n var method = enable ? 'on' : 'off';\n var methods = { on: _mixins.on, off: _mixins.off };\n var body = this.getCanvasBody();\n var win = this.getContentWindow();\n methods[method](body, 'mouseover', this.onHover);\n methods[method](body, 'mouseout', this.onOut);\n methods[method](body, 'click', this.onClick);\n methods[method](win, 'scroll', this.onFrameScroll);\n methods[method](win, 'keydown', this.onKeyPress);\n em[method]('change:selectedComponent', this.onSelect, this);\n },\n\n\n /**\n * On key press event\n * @private\n * */\n onKeyPress: function onKeyPress(e) {\n var key = e.which || e.keyCode;\n var comp = this.editorModel.get('selectedComponent');\n var focused = this.frameEl.contentDocument.activeElement.tagName !== 'BODY';\n\n // On CANC (46) or Backspace (8)\n if (key == 8 || key == 46) {\n if (!focused) e.preventDefault();\n if (comp && !focused) {\n if (!comp.get('removable')) return;\n comp.set('status', '');\n comp.destroy();\n this.hideBadge();\n this.clean();\n this.hideHighlighter();\n this.editorModel.set('selectedComponent', null);\n }\n }\n },\n\n\n /**\n * Hover command\n * @param {Object} e\n * @private\n */\n onHover: function onHover(e) {\n e.stopPropagation();\n var trg = e.target;\n var model = $(trg).data('model');\n\n // Adjust tools scroll top\n if (!this.adjScroll) {\n this.adjScroll = 1;\n this.onFrameScroll(e);\n this.updateAttached();\n }\n\n if (model && !model.get('hoverable')) {\n var comp = model && model.parent();\n while (comp && !comp.get('hoverable')) {\n comp = comp.parent();\n }comp && (trg = comp.view.el);\n }\n\n var pos = this.getElementPos(trg);\n this.updateBadge(trg, pos);\n this.updateHighlighter(trg, pos);\n this.showElementOffset(trg, pos);\n },\n\n\n /**\n * Out command\n * @param {Object} e\n * @private\n */\n onOut: function onOut(e) {\n e.stopPropagation();\n this.hideBadge();\n this.hideHighlighter();\n this.hideElementOffset();\n },\n\n\n /**\n * Show element offset viewer\n * @param {HTMLElement} el\n * @param {Object} pos\n */\n showElementOffset: function showElementOffset(el, pos) {\n var $el = $(el);\n var model = $el.data('model');\n\n if (model && model.get('status') == 'selected' || !showOffsets) {\n return;\n }\n\n this.editor.runCommand('show-offset', {\n el: el,\n elPos: pos\n });\n },\n\n\n /**\n * Hide element offset viewer\n * @param {HTMLElement} el\n * @param {Object} pos\n */\n hideElementOffset: function hideElementOffset(el, pos) {\n this.editor.stopCommand('show-offset');\n },\n\n\n /**\n * Show fixed element offset viewer\n * @param {HTMLElement} el\n * @param {Object} pos\n */\n showFixedElementOffset: function showFixedElementOffset(el, pos) {\n this.editor.runCommand('show-offset', {\n el: el,\n elPos: pos,\n state: 'Fixed'\n });\n },\n\n\n /**\n * Hide fixed element offset viewer\n * @param {HTMLElement} el\n * @param {Object} pos\n */\n hideFixedElementOffset: function hideFixedElementOffset(el, pos) {\n if (this.editor) this.editor.stopCommand('show-offset', { state: 'Fixed' });\n },\n\n\n /**\n * Hide Highlighter element\n */\n hideHighlighter: function hideHighlighter() {\n this.canvas.getHighlighter().style.display = 'none';\n },\n\n\n /**\n * On element click\n * @param {Event} e\n * @private\n */\n onClick: function onClick(e) {\n e.stopPropagation();\n var model = $(e.target).data('model');\n var editor = this.editor;\n\n if (model) {\n if (model.get('selectable')) {\n editor.select(model);\n } else {\n var parent = model.parent();\n while (parent && !parent.get('selectable')) {\n parent = parent.parent();\n }parent && editor.select(parent);\n }\n }\n },\n\n\n /**\n * Update badge for the component\n * @param {Object} Component\n * @param {Object} pos Position object\n * @private\n * */\n updateBadge: function updateBadge(el, pos) {\n var $el = $(el);\n var canvas = this.canvas;\n var config = canvas.getConfig();\n var customeLabel = config.customBadgeLabel;\n this.cacheEl = el;\n var model = $el.data('model');\n if (!model || !model.get('badgable')) return;\n var badge = this.getBadge();\n var badgeLabel = model.getIcon() + model.getName();\n badgeLabel = customeLabel ? customeLabel(model) : badgeLabel;\n badge.innerHTML = badgeLabel;\n var bStyle = badge.style;\n var u = 'px';\n bStyle.display = 'block';\n var canvasPos = canvas.getCanvasView().getPosition();\n var badgeH = badge ? badge.offsetHeight : 0;\n var badgeW = badge ? badge.offsetWidth : 0;\n var top = pos.top - badgeH < canvasPos.top ? canvasPos.top : pos.top - badgeH;\n var left = pos.left + badgeW < canvasPos.left ? canvasPos.left : pos.left;\n bStyle.top = top + u;\n bStyle.left = left + u;\n },\n\n\n /**\n * Update highlighter element\n * @param {HTMLElement} el\n * @param {Object} pos Position object\n * @private\n */\n updateHighlighter: function updateHighlighter(el, pos) {\n var $el = $(el);\n var model = $el.data('model');\n\n if (!model || !model.get('hoverable') || model.get('status') == 'selected') {\n return;\n }\n\n var hlEl = this.canvas.getHighlighter();\n var hlStyle = hlEl.style;\n var unit = 'px';\n hlStyle.left = pos.left + unit;\n hlStyle.top = pos.top + unit;\n hlStyle.height = pos.height + unit;\n hlStyle.width = pos.width + unit;\n hlStyle.display = 'block';\n },\n\n\n /**\n * Say what to do after the component was selected\n * @param {Object} e\n * @param {Object} el\n * @private\n * */\n onSelect: function onSelect() {\n var editor = this.editor;\n var model = this.em.getSelected();\n this.updateToolbar(model);\n\n if (model) {\n var el = model.view.el;\n this.showFixedElementOffset(el);\n this.hideElementOffset();\n this.hideHighlighter();\n this.initResize(el);\n } else {\n editor.stopCommand('resize');\n }\n },\n\n\n /**\n * Init resizer on the element if possible\n * @param {HTMLElement} el\n * @private\n */\n initResize: function initResize(el) {\n var em = this.em;\n var editor = em ? em.get('Editor') : '';\n var config = em ? em.get('Config') : '';\n var pfx = config.stylePrefix || '';\n var attrName = 'data-' + pfx + 'handler';\n var resizeClass = pfx + 'resizing';\n var model = em.get('selectedComponent');\n var resizable = model.get('resizable');\n var options = {};\n var modelToStyle;\n\n var toggleBodyClass = function toggleBodyClass(method, e, opts) {\n var docs = opts.docs;\n docs && docs.forEach(function (doc) {\n var body = doc.body;\n var cls = body.className || '';\n body.className = (method == 'add' ? cls + ' ' + resizeClass : cls.replace(resizeClass, '')).trim();\n });\n };\n\n if (editor && resizable) {\n options = {\n // Here the resizer is updated with the current element height and width\n onStart: function onStart(e) {\n var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var el = opts.el,\n config = opts.config,\n resizer = opts.resizer;\n var keyHeight = config.keyHeight,\n keyWidth = config.keyWidth,\n currentUnit = config.currentUnit;\n\n toggleBodyClass('add', e, opts);\n modelToStyle = em.get('StyleManager').getModelToStyle(model);\n var computedStyle = getComputedStyle(el);\n var modelStyle = modelToStyle.getStyle();\n var currentWidth = modelStyle[keyWidth] || computedStyle[keyWidth];\n var currentHeight = modelStyle[keyHeight] || computedStyle[keyHeight];\n resizer.startDim.w = parseFloat(currentWidth);\n resizer.startDim.h = parseFloat(currentHeight);\n showOffsets = 0;\n\n if (currentUnit) {\n config.unitHeight = (0, _mixins.getUnitFromValue)(currentHeight);\n config.unitWidth = (0, _mixins.getUnitFromValue)(currentWidth);\n }\n },\n\n\n // Update all positioned elements (eg. component toolbar)\n onMove: function onMove() {\n editor.trigger('change:canvasOffset');\n },\n onEnd: function onEnd(e, opts) {\n toggleBodyClass('remove', e, opts);\n editor.trigger('change:canvasOffset');\n showOffsets = 1;\n },\n updateTarget: function updateTarget(el, rect) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n if (!modelToStyle) {\n return;\n }\n\n var store = options.store,\n selectedHandler = options.selectedHandler,\n config = options.config;\n var keyHeight = config.keyHeight,\n keyWidth = config.keyWidth;\n\n var onlyHeight = ['tc', 'bc'].indexOf(selectedHandler) >= 0;\n var onlyWidth = ['cl', 'cr'].indexOf(selectedHandler) >= 0;\n var style = modelToStyle.getStyle();\n\n if (!onlyHeight) {\n style[keyWidth] = rect.w + config.unitWidth;\n }\n\n if (!onlyWidth) {\n style[keyHeight] = rect.h + config.unitHeight;\n }\n\n modelToStyle.setStyle(style, { avoidStore: 1 });\n var updateEvent = 'update:component:style';\n em && em.trigger(updateEvent + ':' + keyHeight + ' ' + updateEvent + ':' + keyWidth);\n\n if (store) {\n modelToStyle.trigger('change:style', modelToStyle, style, {});\n }\n }\n };\n\n if ((typeof resizable === 'undefined' ? 'undefined' : _typeof(resizable)) == 'object') {\n options = _extends({}, options, resizable);\n }\n\n editor.runCommand('resize', { el: el, options: options });\n\n // On undo/redo the resizer rect is not updating, need somehow to call\n // this.updateRect on undo/redo action\n }\n },\n\n\n /**\n * Update toolbar if the component has one\n * @param {Object} mod\n */\n updateToolbar: function updateToolbar(mod) {\n var em = this.config.em;\n var model = mod == em ? em.get('selectedComponent') : mod;\n var toolbarEl = this.canvas.getToolbarEl();\n var toolbarStyle = toolbarEl.style;\n\n if (!model) {\n // By putting `toolbarStyle.display = 'none'` will cause kind\n // of freezed effect with component selection (probably by iframe\n // switching)\n toolbarStyle.opacity = 0;\n return;\n }\n\n var toolbar = model.get('toolbar');\n var ppfx = this.ppfx;\n var showToolbar = em.get('Config').showToolbar;\n\n if (showToolbar && toolbar && toolbar.length) {\n toolbarStyle.opacity = '';\n toolbarStyle.display = '';\n if (!this.toolbar) {\n toolbarEl.innerHTML = '';\n this.toolbar = new Toolbar(toolbar);\n var toolbarView = new ToolbarView({\n collection: this.toolbar,\n editor: this.editor\n });\n toolbarEl.appendChild(toolbarView.render().el);\n }\n\n this.toolbar.reset(toolbar);\n var view = model.view;\n view && this.updateToolbarPos(view.el);\n } else {\n toolbarStyle.display = 'none';\n }\n },\n\n\n /**\n * Update toolbar positions\n * @param {HTMLElement} el\n * @param {Object} pos\n */\n updateToolbarPos: function updateToolbarPos(el, elPos) {\n var unit = 'px';\n var toolbarEl = this.canvas.getToolbarEl();\n var toolbarStyle = toolbarEl.style;\n var origDisp = toolbarStyle.display;\n toolbarStyle.display = 'block';\n var pos = this.canvas.getTargetToElementDim(toolbarEl, el, {\n elPos: elPos,\n event: 'toolbarPosUpdate'\n });\n var leftPos = pos.left + pos.elementWidth - pos.targetWidth;\n toolbarStyle.top = pos.top + unit;\n toolbarStyle.left = (leftPos < 0 ? 0 : leftPos) + unit;\n toolbarStyle.display = origDisp;\n },\n\n\n /**\n * Return canvas dimensions and positions\n * @return {Object}\n */\n getCanvasPosition: function getCanvasPosition() {\n return this.canvas.getCanvasView().getPosition();\n },\n\n\n /**\n * Removes all highlighting effects on components\n * @private\n * */\n clean: function clean() {\n if (this.selEl) this.selEl.removeClass(this.hoverClass);\n },\n\n\n /**\n * Returns badge element\n * @return {HTMLElement}\n * @private\n */\n getBadge: function getBadge() {\n return this.canvas.getBadgeEl();\n },\n\n\n /**\n * On frame scroll callback\n * @private\n */\n onFrameScroll: function onFrameScroll(e) {\n var el = this.cacheEl;\n if (el) {\n var elPos = this.getElementPos(el);\n this.updateBadge(el, elPos);\n var model = this.em.get('selectedComponent');\n\n if (model) {\n this.updateToolbarPos(model.view.el);\n }\n }\n },\n\n\n /**\n * Update attached elements, eg. component toolbar\n * @return {[type]} [description]\n */\n updateAttached: function updateAttached(updated) {\n var model = this.em.getSelected();\n\n if (model) {\n var view = model.view;\n this.updateToolbarPos(view.el);\n this.showFixedElementOffset(view.el);\n }\n },\n\n\n /**\n * Returns element's data info\n * @param {HTMLElement} el\n * @return {Object}\n * @private\n */\n getElementPos: function getElementPos(el, badge) {\n return this.canvas.getCanvasView().getElementPos(el);\n },\n\n\n /**\n * Hide badge\n * @private\n * */\n hideBadge: function hideBadge() {\n this.getBadge().style.display = 'none';\n },\n\n\n /**\n * Clean previous model from different states\n * @param {Component} model\n * @private\n */\n cleanPrevious: function cleanPrevious(model) {\n model && model.set({\n status: '',\n state: ''\n });\n },\n\n\n /**\n * Returns content window\n * @private\n */\n getContentWindow: function getContentWindow() {\n return this.frameEl.contentWindow;\n },\n run: function run(editor) {\n this.editor = editor && editor.get('Editor');\n this.enable();\n this.onSelect();\n },\n stop: function stop(editor, sender) {\n var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n var em = this.em;\n this.stopSelectComponent();\n !opts.preserveSelected && em.setSelected(null);\n this.clean();\n this.hideBadge();\n this.hideFixedElementOffset();\n this.canvas.getToolbarEl().style.display = 'none';\n\n em.off('component:update', this.updateAttached, this);\n em.off('change:canvasOffset', this.updateAttached, this);\n em.off('change:selectedComponent', this.updateToolbar, this);\n }\n};\n\n/***/ }),\n/* 22 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Backbone, _) {\n\nvar SelectPosition = __webpack_require__(54);\nvar $ = Backbone.$;\n\nmodule.exports = _.extend({}, SelectPosition, {\n init: function init(opt) {\n _.bindAll(this, 'startDraw', 'draw', 'endDraw', 'rollback');\n this.config = opt || {};\n this.hType = this.config.newFixedH ? 'height' : 'min-height';\n this.allowDraw = 1;\n },\n\n\n /**\n * Start with enabling to select position and listening to start drawning\n * @private\n * */\n enable: function enable() {\n for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n SelectPosition.enable.apply(this, args);\n this.$wr.css('cursor', 'crosshair');\n if (this.allowDraw) this.$wr.on('mousedown', this.startDraw);\n this.ghost = this.canvas.getGhostEl();\n },\n\n\n /**\n * Start drawing component\n * @param {Object} e Event\n * @private\n * */\n startDraw: function startDraw(e) {\n e.preventDefault();\n this.stopSelectPosition();\n this.ghost.style.display = 'block';\n this.frameOff = this.getOffsetDim();\n this.startPos = {\n top: e.pageY + this.frameOff.top,\n left: e.pageX + this.frameOff.left\n };\n this.isDragged = false;\n this.tempComponent = { style: {} };\n this.beforeDraw(this.tempComponent);\n this.updateSize(this.startPos.top, this.startPos.left, 0, 0);\n this.toggleEvents(1);\n },\n\n\n /**\n * Enable/Disable events\n * @param {Boolean} enable\n */\n toggleEvents: function toggleEvents(enable) {\n var method = enable ? 'on' : 'off';\n this.$wr[method]('mousemove', this.draw);\n this.$wr[method]('mouseup', this.endDraw);\n this.$canvas[method]('mousemove', this.draw);\n $(document)[method]('mouseup', this.endDraw);\n $(document)[method]('keypress', this.rollback);\n },\n\n\n /**\n * While drawing the component\n * @param {Object} e Event\n * @private\n * */\n draw: function draw(e) {\n this.isDragged = true;\n this.updateComponentSize(e);\n },\n\n\n /**\n * End drawing component\n * @param {Object} e Event\n * @private\n * */\n endDraw: function endDraw(e) {\n this.toggleEvents();\n var model = {};\n // Only if the mouse was moved\n if (this.isDragged) {\n this.updateComponentSize(e);\n this.setRequirements(this.tempComponent);\n var lp = this.sorter.lastPos;\n model = this.create(this.sorter.target, this.tempComponent, lp.index, lp.method);\n this.sorter.prevTarget = null;\n }\n this.ghost.style.display = 'none';\n this.startSelectPosition();\n this.afterDraw(model);\n },\n\n\n /**\n * Create new component inside the target\n * @param {Object} target Tha target collection\n * @param {Object} component New component to create\n * @param {number} index Index inside the collection, 0 if no children inside\n * @param {string} method Before or after of the children\n * @param {Object} opts Options\n */\n create: function create(target, component, index, method, opts) {\n index = method === 'after' ? index + 1 : index;\n var opt = opts || {};\n var $trg = $(target);\n var trgModel = $trg.data('model');\n var trgCollection = $trg.data('collection');\n var droppable = trgModel ? trgModel.get('droppable') : 1;\n opt.at = index;\n if (trgCollection && droppable) return trgCollection.add(component, opt);else console.warn('Invalid target position');\n },\n\n\n /**\n * Check and set basic requirements for the component\n * @param {Object} component New component to be created\n * @return {Object} Component updated\n * @private\n * */\n setRequirements: function setRequirements(component) {\n var c = this.config;\n var compStl = component.style;\n // Check min width\n if (compStl.width.replace(/\\D/g, '') < c.minComponentW) compStl.width = c.minComponentW + 'px';\n // Check min height\n if (compStl[this.hType].replace(/\\D/g, '') < c.minComponentH) compStl[this.hType] = c.minComponentH + 'px';\n // Set overflow in case of fixed height\n if (c.newFixedH) compStl.overflow = 'auto';\n if (!this.absoluteMode) {\n delete compStl.left;\n delete compStl.top;\n } else compStl.position = 'absolute';\n var lp = this.sorter.lastPos;\n\n if (this.nearFloat(lp.index, lp.method, this.sorter.lastDims)) compStl.float = 'left';\n\n if (this.config.firstCentered && this.getCanvasWrapper() == this.sorter.target) {\n compStl.margin = '0 auto';\n }\n\n return component;\n },\n\n\n /**\n * Update new component size while drawing\n * @param {Object} e Event\n * @private\n * */\n updateComponentSize: function updateComponentSize(e) {\n var y = e.pageY + this.frameOff.top;\n var x = e.pageX + this.frameOff.left;\n var start = this.startPos;\n var top = start.top;\n var left = start.left;\n var height = y - top;\n var width = x - left;\n if (x < left) {\n left = x;\n width = start.left - x;\n }\n if (y < top) {\n top = y;\n height = start.top - y;\n }\n this.updateSize(top, left, width, height);\n },\n\n\n /**\n * Update size\n * @private\n */\n updateSize: function updateSize(top, left, width, height) {\n var u = 'px';\n var ghStl = this.ghost.style;\n var compStl = this.tempComponent.style;\n ghStl.top = compStl.top = top + u;\n ghStl.left = compStl.left = left + u;\n ghStl.width = compStl.width = width + u;\n ghStl[this.hType] = compStl[this.hType] = height + u;\n },\n\n\n /**\n * Used to bring the previous situation before event started\n * @param {Object} e Event\n * @param {Boolean} forse Indicates if rollback in anycase\n * @private\n * */\n rollback: function rollback(e, force) {\n var key = e.which || e.keyCode;\n if (key == this.config.ESCAPE_KEY || force) {\n this.isDragged = false;\n this.endDraw();\n }\n return;\n },\n\n\n /**\n * This event is triggered at the beginning of a draw operation\n * @param {Object} component Object component before creation\n * @private\n * */\n beforeDraw: function beforeDraw(component) {\n component.editable = false; //set this component editable\n },\n\n\n /**\n * This event is triggered at the end of a draw operation\n * @param {Object} model Component model created\n * @private\n * */\n afterDraw: function afterDraw(model) {},\n run: function run(editor, sender, opts) {\n this.editor = editor;\n this.sender = sender;\n this.$wr = this.$wrapper;\n this.enable();\n },\n stop: function stop() {\n this.stopSelectPosition();\n this.$wrapper.css('cursor', '');\n this.$wrapper.unbind();\n }\n});\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0), __webpack_require__(1)))\n\n/***/ }),\n/* 23 */\n/***/ (function(module, exports, __webpack_require__) {\n\n// keymaster.js\n// (c) 2011-2013 Thomas Fuchs\n// keymaster.js may be freely distributed under the MIT license.\n\n;(function(global){\n var k,\n _handlers = {},\n _mods = { 16: false, 18: false, 17: false, 91: false },\n _scope = 'all',\n // modifier keys\n _MODIFIERS = {\n '⇧': 16, shift: 16,\n '⌥': 18, alt: 18, option: 18,\n '⌃': 17, ctrl: 17, control: 17,\n '⌘': 91, command: 91\n },\n // special keys\n _MAP = {\n backspace: 8, tab: 9, clear: 12,\n enter: 13, 'return': 13,\n esc: 27, escape: 27, space: 32,\n left: 37, up: 38,\n right: 39, down: 40,\n del: 46, 'delete': 46,\n home: 36, end: 35,\n pageup: 33, pagedown: 34,\n ',': 188, '.': 190, '/': 191,\n '`': 192, '-': 189, '=': 187,\n ';': 186, '\\'': 222,\n '[': 219, ']': 221, '\\\\': 220\n },\n code = function(x){\n return _MAP[x] || x.toUpperCase().charCodeAt(0);\n },\n _downKeys = [];\n\n for(k=1;k<20;k++) _MAP['f'+k] = 111+k;\n\n // IE doesn't support Array#indexOf, so have a simple replacement\n function index(array, item){\n var i = array.length;\n while(i--) if(array[i]===item) return i;\n return -1;\n }\n\n // for comparing mods before unassignment\n function compareArray(a1, a2) {\n if (a1.length != a2.length) return false;\n for (var i = 0; i < a1.length; i++) {\n if (a1[i] !== a2[i]) return false;\n }\n return true;\n }\n\n var modifierMap = {\n 16:'shiftKey',\n 18:'altKey',\n 17:'ctrlKey',\n 91:'metaKey'\n };\n function updateModifierKey(event) {\n for(k in _mods) _mods[k] = event[modifierMap[k]];\n };\n\n // handle keydown event\n function dispatch(event) {\n var key, handler, k, i, modifiersMatch, scope;\n key = event.keyCode;\n\n if (index(_downKeys, key) == -1) {\n _downKeys.push(key);\n }\n\n // if a modifier key, set the key.<modifierkeyname> property to true and return\n if(key == 93 || key == 224) key = 91; // right command on webkit, command on Gecko\n if(key in _mods) {\n _mods[key] = true;\n // 'assignKey' from inside this closure is exported to window.key\n for(k in _MODIFIERS) if(_MODIFIERS[k] == key) assignKey[k] = true;\n return;\n }\n updateModifierKey(event);\n\n // see if we need to ignore the keypress (filter() can can be overridden)\n // by default ignore key presses if a select, textarea, or input is focused\n if(!assignKey.filter.call(this, event)) return;\n\n // abort if no potentially matching shortcuts found\n if (!(key in _handlers)) return;\n\n scope = getScope();\n\n // for each potential shortcut\n for (i = 0; i < _handlers[key].length; i++) {\n handler = _handlers[key][i];\n\n // see if it's in the current scope\n if(handler.scope == scope || handler.scope == 'all'){\n // check if modifiers match if any\n modifiersMatch = handler.mods.length > 0;\n for(k in _mods)\n if((!_mods[k] && index(handler.mods, +k) > -1) ||\n (_mods[k] && index(handler.mods, +k) == -1)) modifiersMatch = false;\n // call the handler and stop the event if neccessary\n if((handler.mods.length == 0 && !_mods[16] && !_mods[18] && !_mods[17] && !_mods[91]) || modifiersMatch){\n if(handler.method(event, handler)===false){\n if(event.preventDefault) event.preventDefault();\n else event.returnValue = false;\n if(event.stopPropagation) event.stopPropagation();\n if(event.cancelBubble) event.cancelBubble = true;\n }\n }\n }\n }\n };\n\n // unset modifier keys on keyup\n function clearModifier(event){\n var key = event.keyCode, k,\n i = index(_downKeys, key);\n\n // remove key from _downKeys\n if (i >= 0) {\n _downKeys.splice(i, 1);\n }\n\n if(key == 93 || key == 224) key = 91;\n if(key in _mods) {\n _mods[key] = false;\n for(k in _MODIFIERS) if(_MODIFIERS[k] == key) assignKey[k] = false;\n }\n };\n\n function resetModifiers() {\n for(k in _mods) _mods[k] = false;\n for(k in _MODIFIERS) assignKey[k] = false;\n };\n\n // parse and assign shortcut\n function assignKey(key, scope, method){\n var keys, mods;\n keys = getKeys(key);\n if (method === undefined) {\n method = scope;\n scope = 'all';\n }\n\n // for each shortcut\n for (var i = 0; i < keys.length; i++) {\n // set modifier keys if any\n mods = [];\n key = keys[i].split('+');\n if (key.length > 1){\n mods = getMods(key);\n key = [key[key.length-1]];\n }\n // convert to keycode and...\n key = key[0]\n key = code(key);\n // ...store handler\n if (!(key in _handlers)) _handlers[key] = [];\n _handlers[key].push({ shortcut: keys[i], scope: scope, method: method, key: keys[i], mods: mods });\n }\n };\n\n // unbind all handlers for given key in current scope\n function unbindKey(key, scope) {\n var multipleKeys, keys,\n mods = [],\n i, j, obj;\n\n multipleKeys = getKeys(key);\n\n for (j = 0; j < multipleKeys.length; j++) {\n keys = multipleKeys[j].split('+');\n\n if (keys.length > 1) {\n mods = getMods(keys);\n key = keys[keys.length - 1];\n }\n\n key = code(key);\n\n if (scope === undefined) {\n scope = getScope();\n }\n if (!_handlers[key]) {\n return;\n }\n for (i = 0; i < _handlers[key].length; i++) {\n obj = _handlers[key][i];\n // only clear handlers if correct scope and mods match\n if (obj.scope === scope && compareArray(obj.mods, mods)) {\n _handlers[key][i] = {};\n }\n }\n }\n };\n\n // Returns true if the key with code 'keyCode' is currently down\n // Converts strings into key codes.\n function isPressed(keyCode) {\n if (typeof(keyCode)=='string') {\n keyCode = code(keyCode);\n }\n return index(_downKeys, keyCode) != -1;\n }\n\n function getPressedKeyCodes() {\n return _downKeys.slice(0);\n }\n\n function filter(event){\n var tagName = (event.target || event.srcElement).tagName;\n // ignore keypressed in any elements that support keyboard data input\n return !(tagName == 'INPUT' || tagName == 'SELECT' || tagName == 'TEXTAREA');\n }\n\n // initialize key.<modifier> to false\n for(k in _MODIFIERS) assignKey[k] = false;\n\n // set current scope (default 'all')\n function setScope(scope){ _scope = scope || 'all' };\n function getScope(){ return _scope || 'all' };\n\n // delete all handlers for a given scope\n function deleteScope(scope){\n var key, handlers, i;\n\n for (key in _handlers) {\n handlers = _handlers[key];\n for (i = 0; i < handlers.length; ) {\n if (handlers[i].scope === scope) handlers.splice(i, 1);\n else i++;\n }\n }\n };\n\n // abstract key logic for assign and unassign\n function getKeys(key) {\n var keys;\n key = key.replace(/\\s/g, '');\n keys = key.split(',');\n if ((keys[keys.length - 1]) == '') {\n keys[keys.length - 2] += ',';\n }\n return keys;\n }\n\n // abstract mods logic for assign and unassign\n function getMods(key) {\n var mods = key.slice(0, key.length - 1);\n for (var mi = 0; mi < mods.length; mi++)\n mods[mi] = _MODIFIERS[mods[mi]];\n return mods;\n }\n\n // cross-browser events\n function addEvent(object, event, method) {\n if (object.addEventListener)\n object.addEventListener(event, method, false);\n else if(object.attachEvent)\n object.attachEvent('on'+event, function(){ method(window.event) });\n };\n\n // set the handlers globally on document\n addEvent(document, 'keydown', function(event) { dispatch(event) }); // Passing _scope to a callback to ensure it remains the same by execution. Fixes #48\n addEvent(document, 'keyup', clearModifier);\n\n // reset modifiers to false whenever the window is (re)focused.\n addEvent(window, 'focus', resetModifiers);\n\n // store previously defined key\n var previousKey = global.key;\n\n // restore previously defined key and return reference to our key object\n function noConflict() {\n var k = global.key;\n global.key = previousKey;\n return k;\n }\n\n // set window.key and window.key.set/get/deleteScope, and the default filter\n global.key = assignKey;\n global.key.setScope = setScope;\n global.key.getScope = getScope;\n global.key.deleteScope = deleteScope;\n global.key.filter = filter;\n global.key.isPressed = isPressed;\n global.key.getPressedKeyCodes = getPressedKeyCodes;\n global.key.noConflict = noConflict;\n global.key.unbind = unbindKey;\n\n if(true) module.exports = assignKey;\n\n})(this);\n\n\n/***/ }),\n/* 24 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _promisePolyfill = __webpack_require__(75);\n\nvar _promisePolyfill2 = _interopRequireDefault(_promisePolyfill);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nwindow.Promise = window.Promise || _promisePolyfill2.default;\n\nexports.default = typeof fetch == 'function' ? fetch.bind() : function (url, options) {\n return new _promisePolyfill2.default(function (res, rej) {\n var req = new XMLHttpRequest();\n req.open(options.method || 'get', url);\n req.withCredentials = options.credentials == 'include';\n\n for (var k in options.headers || {}) {\n req.setRequestHeader(k, options.headers[k]);\n }\n\n req.onload = function (e) {\n return res({\n status: req.status,\n statusText: req.statusText,\n text: function text() {\n return _promisePolyfill2.default.resolve(req.responseText);\n }\n });\n };\n req.onerror = rej;\n\n // Actually, fetch doesn't support onProgress feature\n if (req.upload && options.onProgress) {\n req.upload.onprogress = options.onProgress;\n }\n\n // Include body only if present\n options.body ? req.send(options.body) : req.send();\n });\n};\n\n/***/ }),\n/* 25 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = function (config) {\n var TEXT_NODE = 'span';\n var c = config;\n var modelAttrStart = 'data-gjs-';\n\n return {\n compTypes: '',\n\n /**\n * Parse style string to object\n * @param {string} str\n * @return {Object}\n * @example\n * var stl = ParserHtml.parseStyle('color:black; width:100px; test:value;');\n * console.log(stl);\n * // {color: 'black', width: '100px', test: 'value'}\n */\n parseStyle: function parseStyle(str) {\n var result = {};\n var decls = str.split(';');\n for (var i = 0, len = decls.length; i < len; i++) {\n var decl = decls[i].trim();\n if (!decl) continue;\n var prop = decl.split(':');\n result[prop[0].trim()] = prop.slice(1).join(':').trim();\n }\n return result;\n },\n\n\n /**\n * Parse class string to array\n * @param {string} str\n * @return {Array<string>}\n * @example\n * var res = ParserHtml.parseClass('test1 test2 test3');\n * console.log(res);\n * // ['test1', 'test2', 'test3']\n */\n parseClass: function parseClass(str) {\n var result = [];\n var cls = str.split(' ');\n for (var i = 0, len = cls.length; i < len; i++) {\n var cl = cls[i].trim();\n var reg = new RegExp('^' + c.pStylePrefix);\n if (!cl || reg.test(cl)) continue;\n result.push(cl);\n }\n return result;\n },\n\n\n /**\n * Get data from the node element\n * @param {HTMLElement} el DOM element to traverse\n * @return {Array<Object>}\n */\n parseNode: function parseNode(el) {\n var result = [];\n var nodes = el.childNodes;\n\n for (var i = 0, len = nodes.length; i < len; i++) {\n var node = nodes[i];\n var attrs = node.attributes || [];\n var attrsLen = attrs.length;\n var nodePrev = result[result.length - 1];\n var nodeChild = node.childNodes.length;\n var ct = this.compTypes;\n var model = {};\n\n // Start with understanding what kind of component it is\n if (ct) {\n var obj = '';\n\n // Iterate over all available Component Types and\n // the first with a valid result will be that component\n for (var it = 0; it < ct.length; it++) {\n obj = ct[it].model.isComponent(node);\n if (obj) break;\n }\n\n model = obj;\n }\n\n // Set tag name if not yet done\n if (!model.tagName) {\n model.tagName = node.tagName ? node.tagName.toLowerCase() : '';\n }\n\n if (attrsLen) {\n model.attributes = {};\n }\n\n // Parse attributes\n for (var j = 0; j < attrsLen; j++) {\n var nodeName = attrs[j].nodeName;\n var nodeValue = attrs[j].nodeValue;\n\n // Isolate attributes\n if (nodeName == 'style') {\n model.style = this.parseStyle(nodeValue);\n } else if (nodeName == 'class') {\n model.classes = this.parseClass(nodeValue);\n } else if (nodeName == 'contenteditable') {\n continue;\n } else if (nodeName.indexOf(modelAttrStart) === 0) {\n var modelAttr = nodeName.replace(modelAttrStart, '');\n var valueLen = nodeValue.length;\n var firstChar = nodeValue && nodeValue.substr(0, 1);\n var lastChar = nodeValue && nodeValue.substr(valueLen - 1);\n nodeValue = nodeValue === 'true' ? true : nodeValue;\n nodeValue = nodeValue === 'false' ? false : nodeValue;\n\n // Try to parse JSON where it's possible\n // I can get false positive here (eg. a selector '[data-attr]')\n // so put it under try/catch and let fail silently\n try {\n nodeValue = firstChar == '{' && lastChar == '}' || firstChar == '[' && lastChar == ']' ? JSON.parse(nodeValue) : nodeValue;\n } catch (e) {}\n\n model[modelAttr] = nodeValue;\n } else {\n model.attributes[nodeName] = nodeValue;\n }\n }\n\n // Check for nested elements but avoid it if already provided\n if (nodeChild && !model.components) {\n // Avoid infinite nested text nodes\n var firstChild = node.childNodes[0];\n\n // If there is only one child and it's a TEXTNODE\n // just make it content of the current node\n if (nodeChild === 1 && firstChild.nodeType === 3) {\n !model.type && (model.type = 'text');\n model.content = firstChild.nodeValue;\n } else {\n model.components = this.parseNode(node);\n }\n }\n\n // Check if it's a text node and if could be moved to the prevous model\n if (model.type == 'textnode') {\n if (nodePrev && nodePrev.type == 'textnode') {\n nodePrev.content += model.content;\n continue;\n }\n\n // Throw away empty nodes (keep spaces)\n var content = node.nodeValue;\n if (content != ' ' && !content.trim()) {\n continue;\n }\n }\n\n // If all children are texts and there is some textnode the parent should\n // be text too otherwise I'm unable to edit texnodes\n var comps = model.components;\n if (!model.type && comps) {\n var allTxt = 1;\n var foundTextNode = 0;\n\n for (var ci = 0; ci < comps.length; ci++) {\n var comp = comps[ci];\n var cType = comp.type;\n\n if (['text', 'textnode'].indexOf(cType) < 0 && c.textTags.indexOf(comp.tagName) < 0) {\n allTxt = 0;\n break;\n }\n\n if (cType == 'textnode') {\n foundTextNode = 1;\n }\n }\n\n if (allTxt && foundTextNode) {\n model.type = 'text';\n }\n }\n\n // If tagName is still empty and is not a textnode, do not push it\n if (!model.tagName && model.type != 'textnode') {\n continue;\n }\n\n result.push(model);\n }\n\n return result;\n },\n\n\n /**\n * Parse HTML string to a desired model object\n * @param {string} str HTML string\n * @param {ParserCss} parserCss In case there is style tags inside HTML\n * @return {Object}\n */\n parse: function parse(str, parserCss) {\n var config = c.em && c.em.get('Config') || {};\n var res = { html: '', css: '' };\n var el = document.createElement('div');\n el.innerHTML = str;\n var scripts = el.querySelectorAll('script');\n var i = scripts.length;\n\n // Remove all scripts\n if (!config.allowScripts) {\n while (i--) {\n scripts[i].parentNode.removeChild(scripts[i]);\n }\n }\n\n // Detach style tags and parse them\n if (parserCss) {\n var styleStr = '';\n var styles = el.querySelectorAll('style');\n var j = styles.length;\n\n while (j--) {\n styleStr = styles[j].innerHTML + styleStr;\n styles[j].parentNode.removeChild(styles[j]);\n }\n\n if (styleStr) res.css = parserCss.parse(styleStr);\n }\n\n var result = this.parseNode(el);\n\n if (result.length == 1) result = result[0];\n\n res.html = result;\n\n return res;\n }\n };\n};\n\n/***/ }),\n/* 26 */\n/***/ (function(module, exports, __webpack_require__) {\n\n// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: http://codemirror.net/LICENSE\n\n(function(mod) {\n if (true) // CommonJS\n mod(__webpack_require__(6));\n else if (typeof define == \"function\" && define.amd) // AMD\n define([\"../../lib/codemirror\"], mod);\n else // Plain browser env\n mod(CodeMirror);\n})(function(CodeMirror) {\n\"use strict\";\n\nCodeMirror.defineMode(\"css\", function(config, parserConfig) {\n var inline = parserConfig.inline\n if (!parserConfig.propertyKeywords) parserConfig = CodeMirror.resolveMode(\"text/css\");\n\n var indentUnit = config.indentUnit,\n tokenHooks = parserConfig.tokenHooks,\n documentTypes = parserConfig.documentTypes || {},\n mediaTypes = parserConfig.mediaTypes || {},\n mediaFeatures = parserConfig.mediaFeatures || {},\n mediaValueKeywords = parserConfig.mediaValueKeywords || {},\n propertyKeywords = parserConfig.propertyKeywords || {},\n nonStandardPropertyKeywords = parserConfig.nonStandardPropertyKeywords || {},\n fontProperties = parserConfig.fontProperties || {},\n counterDescriptors = parserConfig.counterDescriptors || {},\n colorKeywords = parserConfig.colorKeywords || {},\n valueKeywords = parserConfig.valueKeywords || {},\n allowNested = parserConfig.allowNested,\n lineComment = parserConfig.lineComment,\n supportsAtComponent = parserConfig.supportsAtComponent === true;\n\n var type, override;\n function ret(style, tp) { type = tp; return style; }\n\n // Tokenizers\n\n function tokenBase(stream, state) {\n var ch = stream.next();\n if (tokenHooks[ch]) {\n var result = tokenHooks[ch](stream, state);\n if (result !== false) return result;\n }\n if (ch == \"@\") {\n stream.eatWhile(/[\\w\\\\\\-]/);\n return ret(\"def\", stream.current());\n } else if (ch == \"=\" || (ch == \"~\" || ch == \"|\") && stream.eat(\"=\")) {\n return ret(null, \"compare\");\n } else if (ch == \"\\\"\" || ch == \"'\") {\n state.tokenize = tokenString(ch);\n return state.tokenize(stream, state);\n } else if (ch == \"#\") {\n stream.eatWhile(/[\\w\\\\\\-]/);\n return ret(\"atom\", \"hash\");\n } else if (ch == \"!\") {\n stream.match(/^\\s*\\w*/);\n return ret(\"keyword\", \"important\");\n } else if (/\\d/.test(ch) || ch == \".\" && stream.eat(/\\d/)) {\n stream.eatWhile(/[\\w.%]/);\n return ret(\"number\", \"unit\");\n } else if (ch === \"-\") {\n if (/[\\d.]/.test(stream.peek())) {\n stream.eatWhile(/[\\w.%]/);\n return ret(\"number\", \"unit\");\n } else if (stream.match(/^-[\\w\\\\\\-]+/)) {\n stream.eatWhile(/[\\w\\\\\\-]/);\n if (stream.match(/^\\s*:/, false))\n return ret(\"variable-2\", \"variable-definition\");\n return ret(\"variable-2\", \"variable\");\n } else if (stream.match(/^\\w+-/)) {\n return ret(\"meta\", \"meta\");\n }\n } else if (/[,+>*\\/]/.test(ch)) {\n return ret(null, \"select-op\");\n } else if (ch == \".\" && stream.match(/^-?[_a-z][_a-z0-9-]*/i)) {\n return ret(\"qualifier\", \"qualifier\");\n } else if (/[:;{}\\[\\]\\(\\)]/.test(ch)) {\n return ret(null, ch);\n } else if ((ch == \"u\" && stream.match(/rl(-prefix)?\\(/)) ||\n (ch == \"d\" && stream.match(\"omain(\")) ||\n (ch == \"r\" && stream.match(\"egexp(\"))) {\n stream.backUp(1);\n state.tokenize = tokenParenthesized;\n return ret(\"property\", \"word\");\n } else if (/[\\w\\\\\\-]/.test(ch)) {\n stream.eatWhile(/[\\w\\\\\\-]/);\n return ret(\"property\", \"word\");\n } else {\n return ret(null, null);\n }\n }\n\n function tokenString(quote) {\n return function(stream, state) {\n var escaped = false, ch;\n while ((ch = stream.next()) != null) {\n if (ch == quote && !escaped) {\n if (quote == \")\") stream.backUp(1);\n break;\n }\n escaped = !escaped && ch == \"\\\\\";\n }\n if (ch == quote || !escaped && quote != \")\") state.tokenize = null;\n return ret(\"string\", \"string\");\n };\n }\n\n function tokenParenthesized(stream, state) {\n stream.next(); // Must be '('\n if (!stream.match(/\\s*[\\\"\\')]/, false))\n state.tokenize = tokenString(\")\");\n else\n state.tokenize = null;\n return ret(null, \"(\");\n }\n\n // Context management\n\n function Context(type, indent, prev) {\n this.type = type;\n this.indent = indent;\n this.prev = prev;\n }\n\n function pushContext(state, stream, type, indent) {\n state.context = new Context(type, stream.indentation() + (indent === false ? 0 : indentUnit), state.context);\n return type;\n }\n\n function popContext(state) {\n if (state.context.prev)\n state.context = state.context.prev;\n return state.context.type;\n }\n\n function pass(type, stream, state) {\n return states[state.context.type](type, stream, state);\n }\n function popAndPass(type, stream, state, n) {\n for (var i = n || 1; i > 0; i--)\n state.context = state.context.prev;\n return pass(type, stream, state);\n }\n\n // Parser\n\n function wordAsValue(stream) {\n var word = stream.current().toLowerCase();\n if (valueKeywords.hasOwnProperty(word))\n override = \"atom\";\n else if (colorKeywords.hasOwnProperty(word))\n override = \"keyword\";\n else\n override = \"variable\";\n }\n\n var states = {};\n\n states.top = function(type, stream, state) {\n if (type == \"{\") {\n return pushContext(state, stream, \"block\");\n } else if (type == \"}\" && state.context.prev) {\n return popContext(state);\n } else if (supportsAtComponent && /@component/.test(type)) {\n return pushContext(state, stream, \"atComponentBlock\");\n } else if (/^@(-moz-)?document$/.test(type)) {\n return pushContext(state, stream, \"documentTypes\");\n } else if (/^@(media|supports|(-moz-)?document|import)$/.test(type)) {\n return pushContext(state, stream, \"atBlock\");\n } else if (/^@(font-face|counter-style)/.test(type)) {\n state.stateArg = type;\n return \"restricted_atBlock_before\";\n } else if (/^@(-(moz|ms|o|webkit)-)?keyframes$/.test(type)) {\n return \"keyframes\";\n } else if (type && type.charAt(0) == \"@\") {\n return pushContext(state, stream, \"at\");\n } else if (type == \"hash\") {\n override = \"builtin\";\n } else if (type == \"word\") {\n override = \"tag\";\n } else if (type == \"variable-definition\") {\n return \"maybeprop\";\n } else if (type == \"interpolation\") {\n return pushContext(state, stream, \"interpolation\");\n } else if (type == \":\") {\n return \"pseudo\";\n } else if (allowNested && type == \"(\") {\n return pushContext(state, stream, \"parens\");\n }\n return state.context.type;\n };\n\n states.block = function(type, stream, state) {\n if (type == \"word\") {\n var word = stream.current().toLowerCase();\n if (propertyKeywords.hasOwnProperty(word)) {\n override = \"property\";\n return \"maybeprop\";\n } else if (nonStandardPropertyKeywords.hasOwnProperty(word)) {\n override = \"string-2\";\n return \"maybeprop\";\n } else if (allowNested) {\n override = stream.match(/^\\s*:(?:\\s|$)/, false) ? \"property\" : \"tag\";\n return \"block\";\n } else {\n override += \" error\";\n return \"maybeprop\";\n }\n } else if (type == \"meta\") {\n return \"block\";\n } else if (!allowNested && (type == \"hash\" || type == \"qualifier\")) {\n override = \"error\";\n return \"block\";\n } else {\n return states.top(type, stream, state);\n }\n };\n\n states.maybeprop = function(type, stream, state) {\n if (type == \":\") return pushContext(state, stream, \"prop\");\n return pass(type, stream, state);\n };\n\n states.prop = function(type, stream, state) {\n if (type == \";\") return popContext(state);\n if (type == \"{\" && allowNested) return pushContext(state, stream, \"propBlock\");\n if (type == \"}\" || type == \"{\") return popAndPass(type, stream, state);\n if (type == \"(\") return pushContext(state, stream, \"parens\");\n\n if (type == \"hash\" && !/^#([0-9a-fA-f]{3,4}|[0-9a-fA-f]{6}|[0-9a-fA-f]{8})$/.test(stream.current())) {\n override += \" error\";\n } else if (type == \"word\") {\n wordAsValue(stream);\n } else if (type == \"interpolation\") {\n return pushContext(state, stream, \"interpolation\");\n }\n return \"prop\";\n };\n\n states.propBlock = function(type, _stream, state) {\n if (type == \"}\") return popContext(state);\n if (type == \"word\") { override = \"property\"; return \"maybeprop\"; }\n return state.context.type;\n };\n\n states.parens = function(type, stream, state) {\n if (type == \"{\" || type == \"}\") return popAndPass(type, stream, state);\n if (type == \")\") return popContext(state);\n if (type == \"(\") return pushContext(state, stream, \"parens\");\n if (type == \"interpolation\") return pushContext(state, stream, \"interpolation\");\n if (type == \"word\") wordAsValue(stream);\n return \"parens\";\n };\n\n states.pseudo = function(type, stream, state) {\n if (type == \"meta\") return \"pseudo\";\n\n if (type == \"word\") {\n override = \"variable-3\";\n return state.context.type;\n }\n return pass(type, stream, state);\n };\n\n states.documentTypes = function(type, stream, state) {\n if (type == \"word\" && documentTypes.hasOwnProperty(stream.current())) {\n override = \"tag\";\n return state.context.type;\n } else {\n return states.atBlock(type, stream, state);\n }\n };\n\n states.atBlock = function(type, stream, state) {\n if (type == \"(\") return pushContext(state, stream, \"atBlock_parens\");\n if (type == \"}\" || type == \";\") return popAndPass(type, stream, state);\n if (type == \"{\") return popContext(state) && pushContext(state, stream, allowNested ? \"block\" : \"top\");\n\n if (type == \"interpolation\") return pushContext(state, stream, \"interpolation\");\n\n if (type == \"word\") {\n var word = stream.current().toLowerCase();\n if (word == \"only\" || word == \"not\" || word == \"and\" || word == \"or\")\n override = \"keyword\";\n else if (mediaTypes.hasOwnProperty(word))\n override = \"attribute\";\n else if (mediaFeatures.hasOwnProperty(word))\n override = \"property\";\n else if (mediaValueKeywords.hasOwnProperty(word))\n override = \"keyword\";\n else if (propertyKeywords.hasOwnProperty(word))\n override = \"property\";\n else if (nonStandardPropertyKeywords.hasOwnProperty(word))\n override = \"string-2\";\n else if (valueKeywords.hasOwnProperty(word))\n override = \"atom\";\n else if (colorKeywords.hasOwnProperty(word))\n override = \"keyword\";\n else\n override = \"error\";\n }\n return state.context.type;\n };\n\n states.atComponentBlock = function(type, stream, state) {\n if (type == \"}\")\n return popAndPass(type, stream, state);\n if (type == \"{\")\n return popContext(state) && pushContext(state, stream, allowNested ? \"block\" : \"top\", false);\n if (type == \"word\")\n override = \"error\";\n return state.context.type;\n };\n\n states.atBlock_parens = function(type, stream, state) {\n if (type == \")\") return popContext(state);\n if (type == \"{\" || type == \"}\") return popAndPass(type, stream, state, 2);\n return states.atBlock(type, stream, state);\n };\n\n states.restricted_atBlock_before = function(type, stream, state) {\n if (type == \"{\")\n return pushContext(state, stream, \"restricted_atBlock\");\n if (type == \"word\" && state.stateArg == \"@counter-style\") {\n override = \"variable\";\n return \"restricted_atBlock_before\";\n }\n return pass(type, stream, state);\n };\n\n states.restricted_atBlock = function(type, stream, state) {\n if (type == \"}\") {\n state.stateArg = null;\n return popContext(state);\n }\n if (type == \"word\") {\n if ((state.stateArg == \"@font-face\" && !fontProperties.hasOwnProperty(stream.current().toLowerCase())) ||\n (state.stateArg == \"@counter-style\" && !counterDescriptors.hasOwnProperty(stream.current().toLowerCase())))\n override = \"error\";\n else\n override = \"property\";\n return \"maybeprop\";\n }\n return \"restricted_atBlock\";\n };\n\n states.keyframes = function(type, stream, state) {\n if (type == \"word\") { override = \"variable\"; return \"keyframes\"; }\n if (type == \"{\") return pushContext(state, stream, \"top\");\n return pass(type, stream, state);\n };\n\n states.at = function(type, stream, state) {\n if (type == \";\") return popContext(state);\n if (type == \"{\" || type == \"}\") return popAndPass(type, stream, state);\n if (type == \"word\") override = \"tag\";\n else if (type == \"hash\") override = \"builtin\";\n return \"at\";\n };\n\n states.interpolation = function(type, stream, state) {\n if (type == \"}\") return popContext(state);\n if (type == \"{\" || type == \";\") return popAndPass(type, stream, state);\n if (type == \"word\") override = \"variable\";\n else if (type != \"variable\" && type != \"(\" && type != \")\") override = \"error\";\n return \"interpolation\";\n };\n\n return {\n startState: function(base) {\n return {tokenize: null,\n state: inline ? \"block\" : \"top\",\n stateArg: null,\n context: new Context(inline ? \"block\" : \"top\", base || 0, null)};\n },\n\n token: function(stream, state) {\n if (!state.tokenize && stream.eatSpace()) return null;\n var style = (state.tokenize || tokenBase)(stream, state);\n if (style && typeof style == \"object\") {\n type = style[1];\n style = style[0];\n }\n override = style;\n if (type != \"comment\")\n state.state = states[state.state](type, stream, state);\n return override;\n },\n\n indent: function(state, textAfter) {\n var cx = state.context, ch = textAfter && textAfter.charAt(0);\n var indent = cx.indent;\n if (cx.type == \"prop\" && (ch == \"}\" || ch == \")\")) cx = cx.prev;\n if (cx.prev) {\n if (ch == \"}\" && (cx.type == \"block\" || cx.type == \"top\" ||\n cx.type == \"interpolation\" || cx.type == \"restricted_atBlock\")) {\n // Resume indentation from parent context.\n cx = cx.prev;\n indent = cx.indent;\n } else if (ch == \")\" && (cx.type == \"parens\" || cx.type == \"atBlock_parens\") ||\n ch == \"{\" && (cx.type == \"at\" || cx.type == \"atBlock\")) {\n // Dedent relative to current context.\n indent = Math.max(0, cx.indent - indentUnit);\n }\n }\n return indent;\n },\n\n electricChars: \"}\",\n blockCommentStart: \"/*\",\n blockCommentEnd: \"*/\",\n blockCommentContinue: \" * \",\n lineComment: lineComment,\n fold: \"brace\"\n };\n});\n\n function keySet(array) {\n var keys = {};\n for (var i = 0; i < array.length; ++i) {\n keys[array[i].toLowerCase()] = true;\n }\n return keys;\n }\n\n var documentTypes_ = [\n \"domain\", \"regexp\", \"url\", \"url-prefix\"\n ], documentTypes = keySet(documentTypes_);\n\n var mediaTypes_ = [\n \"all\", \"aural\", \"braille\", \"handheld\", \"print\", \"projection\", \"screen\",\n \"tty\", \"tv\", \"embossed\"\n ], mediaTypes = keySet(mediaTypes_);\n\n var mediaFeatures_ = [\n \"width\", \"min-width\", \"max-width\", \"height\", \"min-height\", \"max-height\",\n \"device-width\", \"min-device-width\", \"max-device-width\", \"device-height\",\n \"min-device-height\", \"max-device-height\", \"aspect-ratio\",\n \"min-aspect-ratio\", \"max-aspect-ratio\", \"device-aspect-ratio\",\n \"min-device-aspect-ratio\", \"max-device-aspect-ratio\", \"color\", \"min-color\",\n \"max-color\", \"color-index\", \"min-color-index\", \"max-color-index\",\n \"monochrome\", \"min-monochrome\", \"max-monochrome\", \"resolution\",\n \"min-resolution\", \"max-resolution\", \"scan\", \"grid\", \"orientation\",\n \"device-pixel-ratio\", \"min-device-pixel-ratio\", \"max-device-pixel-ratio\",\n \"pointer\", \"any-pointer\", \"hover\", \"any-hover\"\n ], mediaFeatures = keySet(mediaFeatures_);\n\n var mediaValueKeywords_ = [\n \"landscape\", \"portrait\", \"none\", \"coarse\", \"fine\", \"on-demand\", \"hover\",\n \"interlace\", \"progressive\"\n ], mediaValueKeywords = keySet(mediaValueKeywords_);\n\n var propertyKeywords_ = [\n \"align-content\", \"align-items\", \"align-self\", \"alignment-adjust\",\n \"alignment-baseline\", \"anchor-point\", \"animation\", \"animation-delay\",\n \"animation-direction\", \"animation-duration\", \"animation-fill-mode\",\n \"animation-iteration-count\", \"animation-name\", \"animation-play-state\",\n \"animation-timing-function\", \"appearance\", \"azimuth\", \"backface-visibility\",\n \"background\", \"background-attachment\", \"background-blend-mode\", \"background-clip\",\n \"background-color\", \"background-image\", \"background-origin\", \"background-position\",\n \"background-repeat\", \"background-size\", \"baseline-shift\", \"binding\",\n \"bleed\", \"bookmark-label\", \"bookmark-level\", \"bookmark-state\",\n \"bookmark-target\", \"border\", \"border-bottom\", \"border-bottom-color\",\n \"border-bottom-left-radius\", \"border-bottom-right-radius\",\n \"border-bottom-style\", \"border-bottom-width\", \"border-collapse\",\n \"border-color\", \"border-image\", \"border-image-outset\",\n \"border-image-repeat\", \"border-image-slice\", \"border-image-source\",\n \"border-image-width\", \"border-left\", \"border-left-color\",\n \"border-left-style\", \"border-left-width\", \"border-radius\", \"border-right\",\n \"border-right-color\", \"border-right-style\", \"border-right-width\",\n \"border-spacing\", \"border-style\", \"border-top\", \"border-top-color\",\n \"border-top-left-radius\", \"border-top-right-radius\", \"border-top-style\",\n \"border-top-width\", \"border-width\", \"bottom\", \"box-decoration-break\",\n \"box-shadow\", \"box-sizing\", \"break-after\", \"break-before\", \"break-inside\",\n \"caption-side\", \"caret-color\", \"clear\", \"clip\", \"color\", \"color-profile\", \"column-count\",\n \"column-fill\", \"column-gap\", \"column-rule\", \"column-rule-color\",\n \"column-rule-style\", \"column-rule-width\", \"column-span\", \"column-width\",\n \"columns\", \"content\", \"counter-increment\", \"counter-reset\", \"crop\", \"cue\",\n \"cue-after\", \"cue-before\", \"cursor\", \"direction\", \"display\",\n \"dominant-baseline\", \"drop-initial-after-adjust\",\n \"drop-initial-after-align\", \"drop-initial-before-adjust\",\n \"drop-initial-before-align\", \"drop-initial-size\", \"drop-initial-value\",\n \"elevation\", \"empty-cells\", \"fit\", \"fit-position\", \"flex\", \"flex-basis\",\n \"flex-direction\", \"flex-flow\", \"flex-grow\", \"flex-shrink\", \"flex-wrap\",\n \"float\", \"float-offset\", \"flow-from\", \"flow-into\", \"font\", \"font-feature-settings\",\n \"font-family\", \"font-kerning\", \"font-language-override\", \"font-size\", \"font-size-adjust\",\n \"font-stretch\", \"font-style\", \"font-synthesis\", \"font-variant\",\n \"font-variant-alternates\", \"font-variant-caps\", \"font-variant-east-asian\",\n \"font-variant-ligatures\", \"font-variant-numeric\", \"font-variant-position\",\n \"font-weight\", \"grid\", \"grid-area\", \"grid-auto-columns\", \"grid-auto-flow\",\n \"grid-auto-rows\", \"grid-column\", \"grid-column-end\", \"grid-column-gap\",\n \"grid-column-start\", \"grid-gap\", \"grid-row\", \"grid-row-end\", \"grid-row-gap\",\n \"grid-row-start\", \"grid-template\", \"grid-template-areas\", \"grid-template-columns\",\n \"grid-template-rows\", \"hanging-punctuation\", \"height\", \"hyphens\",\n \"icon\", \"image-orientation\", \"image-rendering\", \"image-resolution\",\n \"inline-box-align\", \"justify-content\", \"justify-items\", \"justify-self\", \"left\", \"letter-spacing\",\n \"line-break\", \"line-height\", \"line-stacking\", \"line-stacking-ruby\",\n \"line-stacking-shift\", \"line-stacking-strategy\", \"list-style\",\n \"list-style-image\", \"list-style-position\", \"list-style-type\", \"margin\",\n \"margin-bottom\", \"margin-left\", \"margin-right\", \"margin-top\",\n \"marks\", \"marquee-direction\", \"marquee-loop\",\n \"marquee-play-count\", \"marquee-speed\", \"marquee-style\", \"max-height\",\n \"max-width\", \"min-height\", \"min-width\", \"move-to\", \"nav-down\", \"nav-index\",\n \"nav-left\", \"nav-right\", \"nav-up\", \"object-fit\", \"object-position\",\n \"opacity\", \"order\", \"orphans\", \"outline\",\n \"outline-color\", \"outline-offset\", \"outline-style\", \"outline-width\",\n \"overflow\", \"overflow-style\", \"overflow-wrap\", \"overflow-x\", \"overflow-y\",\n \"padding\", \"padding-bottom\", \"padding-left\", \"padding-right\", \"padding-top\",\n \"page\", \"page-break-after\", \"page-break-before\", \"page-break-inside\",\n \"page-policy\", \"pause\", \"pause-after\", \"pause-before\", \"perspective\",\n \"perspective-origin\", \"pitch\", \"pitch-range\", \"place-content\", \"place-items\", \"place-self\", \"play-during\", \"position\",\n \"presentation-level\", \"punctuation-trim\", \"quotes\", \"region-break-after\",\n \"region-break-before\", \"region-break-inside\", \"region-fragment\",\n \"rendering-intent\", \"resize\", \"rest\", \"rest-after\", \"rest-before\", \"richness\",\n \"right\", \"rotation\", \"rotation-point\", \"ruby-align\", \"ruby-overhang\",\n \"ruby-position\", \"ruby-span\", \"shape-image-threshold\", \"shape-inside\", \"shape-margin\",\n \"shape-outside\", \"size\", \"speak\", \"speak-as\", \"speak-header\",\n \"speak-numeral\", \"speak-punctuation\", \"speech-rate\", \"stress\", \"string-set\",\n \"tab-size\", \"table-layout\", \"target\", \"target-name\", \"target-new\",\n \"target-position\", \"text-align\", \"text-align-last\", \"text-decoration\",\n \"text-decoration-color\", \"text-decoration-line\", \"text-decoration-skip\",\n \"text-decoration-style\", \"text-emphasis\", \"text-emphasis-color\",\n \"text-emphasis-position\", \"text-emphasis-style\", \"text-height\",\n \"text-indent\", \"text-justify\", \"text-outline\", \"text-overflow\", \"text-shadow\",\n \"text-size-adjust\", \"text-space-collapse\", \"text-transform\", \"text-underline-position\",\n \"text-wrap\", \"top\", \"transform\", \"transform-origin\", \"transform-style\",\n \"transition\", \"transition-delay\", \"transition-duration\",\n \"transition-property\", \"transition-timing-function\", \"unicode-bidi\",\n \"user-select\", \"vertical-align\", \"visibility\", \"voice-balance\", \"voice-duration\",\n \"voice-family\", \"voice-pitch\", \"voice-range\", \"voice-rate\", \"voice-stress\",\n \"voice-volume\", \"volume\", \"white-space\", \"widows\", \"width\", \"will-change\", \"word-break\",\n \"word-spacing\", \"word-wrap\", \"z-index\",\n // SVG-specific\n \"clip-path\", \"clip-rule\", \"mask\", \"enable-background\", \"filter\", \"flood-color\",\n \"flood-opacity\", \"lighting-color\", \"stop-color\", \"stop-opacity\", \"pointer-events\",\n \"color-interpolation\", \"color-interpolation-filters\",\n \"color-rendering\", \"fill\", \"fill-opacity\", \"fill-rule\", \"image-rendering\",\n \"marker\", \"marker-end\", \"marker-mid\", \"marker-start\", \"shape-rendering\", \"stroke\",\n \"stroke-dasharray\", \"stroke-dashoffset\", \"stroke-linecap\", \"stroke-linejoin\",\n \"stroke-miterlimit\", \"stroke-opacity\", \"stroke-width\", \"text-rendering\",\n \"baseline-shift\", \"dominant-baseline\", \"glyph-orientation-horizontal\",\n \"glyph-orientation-vertical\", \"text-anchor\", \"writing-mode\"\n ], propertyKeywords = keySet(propertyKeywords_);\n\n var nonStandardPropertyKeywords_ = [\n \"scrollbar-arrow-color\", \"scrollbar-base-color\", \"scrollbar-dark-shadow-color\",\n \"scrollbar-face-color\", \"scrollbar-highlight-color\", \"scrollbar-shadow-color\",\n \"scrollbar-3d-light-color\", \"scrollbar-track-color\", \"shape-inside\",\n \"searchfield-cancel-button\", \"searchfield-decoration\", \"searchfield-results-button\",\n \"searchfield-results-decoration\", \"zoom\"\n ], nonStandardPropertyKeywords = keySet(nonStandardPropertyKeywords_);\n\n var fontProperties_ = [\n \"font-family\", \"src\", \"unicode-range\", \"font-variant\", \"font-feature-settings\",\n \"font-stretch\", \"font-weight\", \"font-style\"\n ], fontProperties = keySet(fontProperties_);\n\n var counterDescriptors_ = [\n \"additive-symbols\", \"fallback\", \"negative\", \"pad\", \"prefix\", \"range\",\n \"speak-as\", \"suffix\", \"symbols\", \"system\"\n ], counterDescriptors = keySet(counterDescriptors_);\n\n var colorKeywords_ = [\n \"aliceblue\", \"antiquewhite\", \"aqua\", \"aquamarine\", \"azure\", \"beige\",\n \"bisque\", \"black\", \"blanchedalmond\", \"blue\", \"blueviolet\", \"brown\",\n \"burlywood\", \"cadetblue\", \"chartreuse\", \"chocolate\", \"coral\", \"cornflowerblue\",\n \"cornsilk\", \"crimson\", \"cyan\", \"darkblue\", \"darkcyan\", \"darkgoldenrod\",\n \"darkgray\", \"darkgreen\", \"darkkhaki\", \"darkmagenta\", \"darkolivegreen\",\n \"darkorange\", \"darkorchid\", \"darkred\", \"darksalmon\", \"darkseagreen\",\n \"darkslateblue\", \"darkslategray\", \"darkturquoise\", \"darkviolet\",\n \"deeppink\", \"deepskyblue\", \"dimgray\", \"dodgerblue\", \"firebrick\",\n \"floralwhite\", \"forestgreen\", \"fuchsia\", \"gainsboro\", \"ghostwhite\",\n \"gold\", \"goldenrod\", \"gray\", \"grey\", \"green\", \"greenyellow\", \"honeydew\",\n \"hotpink\", \"indianred\", \"indigo\", \"ivory\", \"khaki\", \"lavender\",\n \"lavenderblush\", \"lawngreen\", \"lemonchiffon\", \"lightblue\", \"lightcoral\",\n \"lightcyan\", \"lightgoldenrodyellow\", \"lightgray\", \"lightgreen\", \"lightpink\",\n \"lightsalmon\", \"lightseagreen\", \"lightskyblue\", \"lightslategray\",\n \"lightsteelblue\", \"lightyellow\", \"lime\", \"limegreen\", \"linen\", \"magenta\",\n \"maroon\", \"mediumaquamarine\", \"mediumblue\", \"mediumorchid\", \"mediumpurple\",\n \"mediumseagreen\", \"mediumslateblue\", \"mediumspringgreen\", \"mediumturquoise\",\n \"mediumvioletred\", \"midnightblue\", \"mintcream\", \"mistyrose\", \"moccasin\",\n \"navajowhite\", \"navy\", \"oldlace\", \"olive\", \"olivedrab\", \"orange\", \"orangered\",\n \"orchid\", \"palegoldenrod\", \"palegreen\", \"paleturquoise\", \"palevioletred\",\n \"papayawhip\", \"peachpuff\", \"peru\", \"pink\", \"plum\", \"powderblue\",\n \"purple\", \"rebeccapurple\", \"red\", \"rosybrown\", \"royalblue\", \"saddlebrown\",\n \"salmon\", \"sandybrown\", \"seagreen\", \"seashell\", \"sienna\", \"silver\", \"skyblue\",\n \"slateblue\", \"slategray\", \"snow\", \"springgreen\", \"steelblue\", \"tan\",\n \"teal\", \"thistle\", \"tomato\", \"turquoise\", \"violet\", \"wheat\", \"white\",\n \"whitesmoke\", \"yellow\", \"yellowgreen\"\n ], colorKeywords = keySet(colorKeywords_);\n\n var valueKeywords_ = [\n \"above\", \"absolute\", \"activeborder\", \"additive\", \"activecaption\", \"afar\",\n \"after-white-space\", \"ahead\", \"alias\", \"all\", \"all-scroll\", \"alphabetic\", \"alternate\",\n \"always\", \"amharic\", \"amharic-abegede\", \"antialiased\", \"appworkspace\",\n \"arabic-indic\", \"armenian\", \"asterisks\", \"attr\", \"auto\", \"auto-flow\", \"avoid\", \"avoid-column\", \"avoid-page\",\n \"avoid-region\", \"background\", \"backwards\", \"baseline\", \"below\", \"bidi-override\", \"binary\",\n \"bengali\", \"blink\", \"block\", \"block-axis\", \"bold\", \"bolder\", \"border\", \"border-box\",\n \"both\", \"bottom\", \"break\", \"break-all\", \"break-word\", \"bullets\", \"button\", \"button-bevel\",\n \"buttonface\", \"buttonhighlight\", \"buttonshadow\", \"buttontext\", \"calc\", \"cambodian\",\n \"capitalize\", \"caps-lock-indicator\", \"caption\", \"captiontext\", \"caret\",\n \"cell\", \"center\", \"checkbox\", \"circle\", \"cjk-decimal\", \"cjk-earthly-branch\",\n \"cjk-heavenly-stem\", \"cjk-ideographic\", \"clear\", \"clip\", \"close-quote\",\n \"col-resize\", \"collapse\", \"color\", \"color-burn\", \"color-dodge\", \"column\", \"column-reverse\",\n \"compact\", \"condensed\", \"contain\", \"content\", \"contents\",\n \"content-box\", \"context-menu\", \"continuous\", \"copy\", \"counter\", \"counters\", \"cover\", \"crop\",\n \"cross\", \"crosshair\", \"currentcolor\", \"cursive\", \"cyclic\", \"darken\", \"dashed\", \"decimal\",\n \"decimal-leading-zero\", \"default\", \"default-button\", \"dense\", \"destination-atop\",\n \"destination-in\", \"destination-out\", \"destination-over\", \"devanagari\", \"difference\",\n \"disc\", \"discard\", \"disclosure-closed\", \"disclosure-open\", \"document\",\n \"dot-dash\", \"dot-dot-dash\",\n \"dotted\", \"double\", \"down\", \"e-resize\", \"ease\", \"ease-in\", \"ease-in-out\", \"ease-out\",\n \"element\", \"ellipse\", \"ellipsis\", \"embed\", \"end\", \"ethiopic\", \"ethiopic-abegede\",\n \"ethiopic-abegede-am-et\", \"ethiopic-abegede-gez\", \"ethiopic-abegede-ti-er\",\n \"ethiopic-abegede-ti-et\", \"ethiopic-halehame-aa-er\",\n \"ethiopic-halehame-aa-et\", \"ethiopic-halehame-am-et\",\n \"ethiopic-halehame-gez\", \"ethiopic-halehame-om-et\",\n \"ethiopic-halehame-sid-et\", \"ethiopic-halehame-so-et\",\n \"ethiopic-halehame-ti-er\", \"ethiopic-halehame-ti-et\", \"ethiopic-halehame-tig\",\n \"ethiopic-numeric\", \"ew-resize\", \"exclusion\", \"expanded\", \"extends\", \"extra-condensed\",\n \"extra-expanded\", \"fantasy\", \"fast\", \"fill\", \"fixed\", \"flat\", \"flex\", \"flex-end\", \"flex-start\", \"footnotes\",\n \"forwards\", \"from\", \"geometricPrecision\", \"georgian\", \"graytext\", \"grid\", \"groove\",\n \"gujarati\", \"gurmukhi\", \"hand\", \"hangul\", \"hangul-consonant\", \"hard-light\", \"hebrew\",\n \"help\", \"hidden\", \"hide\", \"higher\", \"highlight\", \"highlighttext\",\n \"hiragana\", \"hiragana-iroha\", \"horizontal\", \"hsl\", \"hsla\", \"hue\", \"icon\", \"ignore\",\n \"inactiveborder\", \"inactivecaption\", \"inactivecaptiontext\", \"infinite\",\n \"infobackground\", \"infotext\", \"inherit\", \"initial\", \"inline\", \"inline-axis\",\n \"inline-block\", \"inline-flex\", \"inline-grid\", \"inline-table\", \"inset\", \"inside\", \"intrinsic\", \"invert\",\n \"italic\", \"japanese-formal\", \"japanese-informal\", \"justify\", \"kannada\",\n \"katakana\", \"katakana-iroha\", \"keep-all\", \"khmer\",\n \"korean-hangul-formal\", \"korean-hanja-formal\", \"korean-hanja-informal\",\n \"landscape\", \"lao\", \"large\", \"larger\", \"left\", \"level\", \"lighter\", \"lighten\",\n \"line-through\", \"linear\", \"linear-gradient\", \"lines\", \"list-item\", \"listbox\", \"listitem\",\n \"local\", \"logical\", \"loud\", \"lower\", \"lower-alpha\", \"lower-armenian\",\n \"lower-greek\", \"lower-hexadecimal\", \"lower-latin\", \"lower-norwegian\",\n \"lower-roman\", \"lowercase\", \"ltr\", \"luminosity\", \"malayalam\", \"match\", \"matrix\", \"matrix3d\",\n \"media-controls-background\", \"media-current-time-display\",\n \"media-fullscreen-button\", \"media-mute-button\", \"media-play-button\",\n \"media-return-to-realtime-button\", \"media-rewind-button\",\n \"media-seek-back-button\", \"media-seek-forward-button\", \"media-slider\",\n \"media-sliderthumb\", \"media-time-remaining-display\", \"media-volume-slider\",\n \"media-volume-slider-container\", \"media-volume-sliderthumb\", \"medium\",\n \"menu\", \"menulist\", \"menulist-button\", \"menulist-text\",\n \"menulist-textfield\", \"menutext\", \"message-box\", \"middle\", \"min-intrinsic\",\n \"mix\", \"mongolian\", \"monospace\", \"move\", \"multiple\", \"multiply\", \"myanmar\", \"n-resize\",\n \"narrower\", \"ne-resize\", \"nesw-resize\", \"no-close-quote\", \"no-drop\",\n \"no-open-quote\", \"no-repeat\", \"none\", \"normal\", \"not-allowed\", \"nowrap\",\n \"ns-resize\", \"numbers\", \"numeric\", \"nw-resize\", \"nwse-resize\", \"oblique\", \"octal\", \"opacity\", \"open-quote\",\n \"optimizeLegibility\", \"optimizeSpeed\", \"oriya\", \"oromo\", \"outset\",\n \"outside\", \"outside-shape\", \"overlay\", \"overline\", \"padding\", \"padding-box\",\n \"painted\", \"page\", \"paused\", \"persian\", \"perspective\", \"plus-darker\", \"plus-lighter\",\n \"pointer\", \"polygon\", \"portrait\", \"pre\", \"pre-line\", \"pre-wrap\", \"preserve-3d\",\n \"progress\", \"push-button\", \"radial-gradient\", \"radio\", \"read-only\",\n \"read-write\", \"read-write-plaintext-only\", \"rectangle\", \"region\",\n \"relative\", \"repeat\", \"repeating-linear-gradient\",\n \"repeating-radial-gradient\", \"repeat-x\", \"repeat-y\", \"reset\", \"reverse\",\n \"rgb\", \"rgba\", \"ridge\", \"right\", \"rotate\", \"rotate3d\", \"rotateX\", \"rotateY\",\n \"rotateZ\", \"round\", \"row\", \"row-resize\", \"row-reverse\", \"rtl\", \"run-in\", \"running\",\n \"s-resize\", \"sans-serif\", \"saturation\", \"scale\", \"scale3d\", \"scaleX\", \"scaleY\", \"scaleZ\", \"screen\",\n \"scroll\", \"scrollbar\", \"scroll-position\", \"se-resize\", \"searchfield\",\n \"searchfield-cancel-button\", \"searchfield-decoration\",\n \"searchfield-results-button\", \"searchfield-results-decoration\", \"self-start\", \"self-end\",\n \"semi-condensed\", \"semi-expanded\", \"separate\", \"serif\", \"show\", \"sidama\",\n \"simp-chinese-formal\", \"simp-chinese-informal\", \"single\",\n \"skew\", \"skewX\", \"skewY\", \"skip-white-space\", \"slide\", \"slider-horizontal\",\n \"slider-vertical\", \"sliderthumb-horizontal\", \"sliderthumb-vertical\", \"slow\",\n \"small\", \"small-caps\", \"small-caption\", \"smaller\", \"soft-light\", \"solid\", \"somali\",\n \"source-atop\", \"source-in\", \"source-out\", \"source-over\", \"space\", \"space-around\", \"space-between\", \"space-evenly\", \"spell-out\", \"square\",\n \"square-button\", \"start\", \"static\", \"status-bar\", \"stretch\", \"stroke\", \"sub\",\n \"subpixel-antialiased\", \"super\", \"sw-resize\", \"symbolic\", \"symbols\", \"system-ui\", \"table\",\n \"table-caption\", \"table-cell\", \"table-column\", \"table-column-group\",\n \"table-footer-group\", \"table-header-group\", \"table-row\", \"table-row-group\",\n \"tamil\",\n \"telugu\", \"text\", \"text-bottom\", \"text-top\", \"textarea\", \"textfield\", \"thai\",\n \"thick\", \"thin\", \"threeddarkshadow\", \"threedface\", \"threedhighlight\",\n \"threedlightshadow\", \"threedshadow\", \"tibetan\", \"tigre\", \"tigrinya-er\",\n \"tigrinya-er-abegede\", \"tigrinya-et\", \"tigrinya-et-abegede\", \"to\", \"top\",\n \"trad-chinese-formal\", \"trad-chinese-informal\", \"transform\",\n \"translate\", \"translate3d\", \"translateX\", \"translateY\", \"translateZ\",\n \"transparent\", \"ultra-condensed\", \"ultra-expanded\", \"underline\", \"unset\", \"up\",\n \"upper-alpha\", \"upper-armenian\", \"upper-greek\", \"upper-hexadecimal\",\n \"upper-latin\", \"upper-norwegian\", \"upper-roman\", \"uppercase\", \"urdu\", \"url\",\n \"var\", \"vertical\", \"vertical-text\", \"visible\", \"visibleFill\", \"visiblePainted\",\n \"visibleStroke\", \"visual\", \"w-resize\", \"wait\", \"wave\", \"wider\",\n \"window\", \"windowframe\", \"windowtext\", \"words\", \"wrap\", \"wrap-reverse\", \"x-large\", \"x-small\", \"xor\",\n \"xx-large\", \"xx-small\"\n ], valueKeywords = keySet(valueKeywords_);\n\n var allWords = documentTypes_.concat(mediaTypes_).concat(mediaFeatures_).concat(mediaValueKeywords_)\n .concat(propertyKeywords_).concat(nonStandardPropertyKeywords_).concat(colorKeywords_)\n .concat(valueKeywords_);\n CodeMirror.registerHelper(\"hintWords\", \"css\", allWords);\n\n function tokenCComment(stream, state) {\n var maybeEnd = false, ch;\n while ((ch = stream.next()) != null) {\n if (maybeEnd && ch == \"/\") {\n state.tokenize = null;\n break;\n }\n maybeEnd = (ch == \"*\");\n }\n return [\"comment\", \"comment\"];\n }\n\n CodeMirror.defineMIME(\"text/css\", {\n documentTypes: documentTypes,\n mediaTypes: mediaTypes,\n mediaFeatures: mediaFeatures,\n mediaValueKeywords: mediaValueKeywords,\n propertyKeywords: propertyKeywords,\n nonStandardPropertyKeywords: nonStandardPropertyKeywords,\n fontProperties: fontProperties,\n counterDescriptors: counterDescriptors,\n colorKeywords: colorKeywords,\n valueKeywords: valueKeywords,\n tokenHooks: {\n \"/\": function(stream, state) {\n if (!stream.eat(\"*\")) return false;\n state.tokenize = tokenCComment;\n return tokenCComment(stream, state);\n }\n },\n name: \"css\"\n });\n\n CodeMirror.defineMIME(\"text/x-scss\", {\n mediaTypes: mediaTypes,\n mediaFeatures: mediaFeatures,\n mediaValueKeywords: mediaValueKeywords,\n propertyKeywords: propertyKeywords,\n nonStandardPropertyKeywords: nonStandardPropertyKeywords,\n colorKeywords: colorKeywords,\n valueKeywords: valueKeywords,\n fontProperties: fontProperties,\n allowNested: true,\n lineComment: \"//\",\n tokenHooks: {\n \"/\": function(stream, state) {\n if (stream.eat(\"/\")) {\n stream.skipToEnd();\n return [\"comment\", \"comment\"];\n } else if (stream.eat(\"*\")) {\n state.tokenize = tokenCComment;\n return tokenCComment(stream, state);\n } else {\n return [\"operator\", \"operator\"];\n }\n },\n \":\": function(stream) {\n if (stream.match(/\\s*\\{/, false))\n return [null, null]\n return false;\n },\n \"$\": function(stream) {\n stream.match(/^[\\w-]+/);\n if (stream.match(/^\\s*:/, false))\n return [\"variable-2\", \"variable-definition\"];\n return [\"variable-2\", \"variable\"];\n },\n \"#\": function(stream) {\n if (!stream.eat(\"{\")) return false;\n return [null, \"interpolation\"];\n }\n },\n name: \"css\",\n helperType: \"scss\"\n });\n\n CodeMirror.defineMIME(\"text/x-less\", {\n mediaTypes: mediaTypes,\n mediaFeatures: mediaFeatures,\n mediaValueKeywords: mediaValueKeywords,\n propertyKeywords: propertyKeywords,\n nonStandardPropertyKeywords: nonStandardPropertyKeywords,\n colorKeywords: colorKeywords,\n valueKeywords: valueKeywords,\n fontProperties: fontProperties,\n allowNested: true,\n lineComment: \"//\",\n tokenHooks: {\n \"/\": function(stream, state) {\n if (stream.eat(\"/\")) {\n stream.skipToEnd();\n return [\"comment\", \"comment\"];\n } else if (stream.eat(\"*\")) {\n state.tokenize = tokenCComment;\n return tokenCComment(stream, state);\n } else {\n return [\"operator\", \"operator\"];\n }\n },\n \"@\": function(stream) {\n if (stream.eat(\"{\")) return [null, \"interpolation\"];\n if (stream.match(/^(charset|document|font-face|import|(-(moz|ms|o|webkit)-)?keyframes|media|namespace|page|supports)\\b/, false)) return false;\n stream.eatWhile(/[\\w\\\\\\-]/);\n if (stream.match(/^\\s*:/, false))\n return [\"variable-2\", \"variable-definition\"];\n return [\"variable-2\", \"variable\"];\n },\n \"&\": function() {\n return [\"atom\", \"atom\"];\n }\n },\n name: \"css\",\n helperType: \"less\"\n });\n\n CodeMirror.defineMIME(\"text/x-gss\", {\n documentTypes: documentTypes,\n mediaTypes: mediaTypes,\n mediaFeatures: mediaFeatures,\n propertyKeywords: propertyKeywords,\n nonStandardPropertyKeywords: nonStandardPropertyKeywords,\n fontProperties: fontProperties,\n counterDescriptors: counterDescriptors,\n colorKeywords: colorKeywords,\n valueKeywords: valueKeywords,\n supportsAtComponent: true,\n tokenHooks: {\n \"/\": function(stream, state) {\n if (!stream.eat(\"*\")) return false;\n state.tokenize = tokenCComment;\n return tokenCComment(stream, state);\n }\n },\n name: \"css\",\n helperType: \"gss\"\n });\n\n});\n\n\n/***/ }),\n/* 27 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar Backbone = __webpack_require__(0);\nvar Buttons = __webpack_require__(28);\n\nmodule.exports = Backbone.Model.extend({\n defaults: {\n id: '',\n content: '',\n visible: true,\n buttons: [],\n attributes: {}\n },\n\n initialize: function initialize(options) {\n this.btn = this.get('buttons') || [];\n this.buttons = new Buttons(this.btn);\n this.set('buttons', this.buttons);\n }\n});\n\n/***/ }),\n/* 28 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar Backbone = __webpack_require__(0);\nvar Button = __webpack_require__(109);\n\nmodule.exports = Backbone.Collection.extend({\n model: Button,\n\n /**\n * Deactivate all buttons, except one passed\n * @param {Object} except Model to ignore\n * @param {Boolean} r Recursive flag\n *\n * @return void\n * */\n deactivateAllExceptOne: function deactivateAllExceptOne(except, r) {\n this.forEach(function (model, index) {\n if (model !== except) {\n model.set('active', false);\n if (r && model.get('buttons').length) model.get('buttons').deactivateAllExceptOne(except, r);\n }\n });\n },\n\n\n /**\n * Deactivate all buttons\n * @param {String} ctx Context string\n *\n * @return void\n * */\n deactivateAll: function deactivateAll(ctx) {\n var context = ctx || '';\n this.forEach(function (model, index) {\n if (model.get('context') == context) {\n model.set('active', false);\n if (model.get('buttons').length) model.get('buttons').deactivateAll(context);\n }\n });\n },\n\n\n /**\n * Disables all buttons\n * @param {String} ctx Context string\n *\n * @return void\n * */\n disableAllButtons: function disableAllButtons(ctx) {\n var context = ctx || '';\n this.forEach(function (model, index) {\n if (model.get('context') == context) {\n model.set('disable', true);\n if (model.get('buttons').length) model.get('buttons').disableAllButtons(context);\n }\n });\n },\n\n\n /**\n * Disables all buttons, except one passed\n * @param {Object} except Model to ignore\n * @param {Boolean} r Recursive flag\n *\n * @return void\n * */\n disableAllButtonsExceptOne: function disableAllButtonsExceptOne(except, r) {\n this.forEach(function (model, index) {\n if (model !== except) {\n model.set('disable', true);\n if (r && model.get('buttons').length) model.get('buttons').disableAllButtonsExceptOne(except, r);\n }\n });\n }\n});\n\n/***/ }),\n/* 29 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar Backbone = __webpack_require__(0);\nvar ButtonsView = __webpack_require__(30);\n\nmodule.exports = Backbone.View.extend({\n initialize: function initialize(o) {\n var config = o.config || {};\n this.config = config;\n this.pfx = config.stylePrefix || '';\n this.ppfx = config.pStylePrefix || '';\n this.buttons = this.model.get('buttons');\n this.className = this.pfx + 'panel';\n this.id = this.pfx + this.model.get('id');\n this.listenTo(this.model, 'change:appendContent', this.appendContent);\n this.listenTo(this.model, 'change:content', this.updateContent);\n },\n\n\n /**\n * Append content of the panel\n * */\n appendContent: function appendContent() {\n this.$el.append(this.model.get('appendContent'));\n },\n\n\n /**\n * Update content\n * */\n updateContent: function updateContent() {\n this.$el.html(this.model.get('content'));\n },\n attributes: function attributes() {\n return this.model.get('attributes');\n },\n initResize: function initResize() {\n var em = this.config.em;\n var editor = em ? em.get('Editor') : '';\n var resizable = this.model.get('resizable');\n\n if (editor && resizable) {\n var resz = resizable === true ? [1, 1, 1, 1] : resizable;\n var resLen = resz.length;\n var tc,\n cr,\n bc,\n cl = 0;\n\n // Choose which sides of the panel are resizable\n if (resLen == 2) {\n tc = resz[0];\n bc = resz[0];\n cr = resz[1];\n cl = resz[1];\n } else if (resLen == 4) {\n tc = resz[0];\n cr = resz[1];\n bc = resz[2];\n cl = resz[3];\n }\n\n var resizer = editor.Utils.Resizer.init({\n tc: tc,\n cr: cr,\n bc: bc,\n cl: cl,\n tl: 0,\n tr: 0,\n bl: 0,\n br: 0,\n appendTo: this.el,\n prefix: editor.getConfig().stylePrefix,\n posFetcher: function posFetcher(el) {\n var rect = el.getBoundingClientRect();\n return {\n left: 0,\n top: 0,\n width: rect.width,\n height: rect.height\n };\n }\n });\n resizer.blur = function () {};\n resizer.focus(this.el);\n }\n },\n render: function render() {\n var el = this.$el;\n var pfx = this.ppfx;\n el.attr('class', this.className + ' ' + pfx + 'one-bg');\n this.id && el.attr('id', this.id);\n\n if (this.buttons.length) {\n var buttons = new ButtonsView({\n collection: this.buttons,\n config: this.config\n });\n el.append(buttons.render().el);\n }\n\n el.append(this.model.get('content'));\n return this;\n }\n});\n\n/***/ }),\n/* 30 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(_) {\n\nvar Backbone = __webpack_require__(0);\nvar ButtonView = __webpack_require__(111);\n\nmodule.exports = Backbone.View.extend({\n initialize: function initialize(o) {\n this.opt = o || {};\n this.config = this.opt.config || {};\n this.pfx = this.config.stylePrefix || '';\n this.parentM = this.opt.parentM || null;\n this.listenTo(this.collection, 'add', this.addTo);\n this.listenTo(this.collection, 'reset', this.render);\n this.className = this.pfx + 'buttons';\n },\n\n\n /**\n * Add to collection\n * @param Object Model\n *\n * @return Object\n * */\n addTo: function addTo(model) {\n this.addToCollection(model);\n },\n\n\n /**\n * Add new object to collection\n * @param Object Model\n * @param Object Fragment collection\n *\n * @return Object Object created\n * */\n addToCollection: function addToCollection(model, fragmentEl) {\n var fragment = fragmentEl || null;\n var viewObject = ButtonView;\n\n var view = new viewObject({\n model: model,\n config: this.config,\n parentM: this.parentM\n });\n var rendered = view.render().el;\n\n if (fragment) {\n fragment.appendChild(rendered);\n } else {\n this.$el.append(rendered);\n }\n\n return rendered;\n },\n render: function render() {\n var fragment = document.createDocumentFragment();\n this.$el.empty();\n\n this.collection.each(function (model) {\n this.addToCollection(model, fragment);\n }, this);\n\n this.$el.append(fragment);\n this.$el.attr('class', _.result(this, 'className'));\n return this;\n }\n});\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))\n\n/***/ }),\n/* 31 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\n/**\n * With Style Manager you basically build categories (called sectors) of CSS properties which could\n * be used to custom components and classes.\n * You can init the editor with all sectors and properties via configuration\n *\n * ```js\n * var editor = grapesjs.init({\n * ...\n * styleManager: {...} // Check below for the possible properties\n * ...\n * });\n * ```\n *\n * Before using methods you should get first the module from the editor instance, in this way:\n *\n * ```js\n * var styleManager = editor.StyleManager;\n * ```\n *\n * @module StyleManager\n * @param {Object} config Configurations\n * @param {Array<Object>} [config.sectors=[]] Array of possible sectors\n * @example\n * ...\n * styleManager: {\n * sectors: [{\n * id: 'dim',\n * name: 'Dimension',\n * properties: [{\n * name: 'Width',\n * property: 'width',\n * type: 'integer',\n * units: ['px', '%'],\n * defaults: 'auto',\n * min: 0,\n }],\n * }],\n * }\n * ...\n */\nmodule.exports = function () {\n var c = {},\n defaults = __webpack_require__(116),\n Sectors = __webpack_require__(117),\n Properties = __webpack_require__(11),\n SectorsView = __webpack_require__(128);\n var properties = void 0;\n var sectors, SectView;\n\n return {\n /**\n * Name of the module\n * @type {String}\n * @private\n */\n name: 'StyleManager',\n\n /**\n * Get configuration object\n * @return {Object}\n * @private\n */\n getConfig: function getConfig() {\n return c;\n },\n\n\n /**\n * Initialize module. Automatically called with a new instance of the editor\n * @param {Object} config Configurations\n */\n init: function init(config) {\n c = config || {};\n for (var name in defaults) {\n if (!(name in c)) c[name] = defaults[name];\n }\n\n var ppfx = c.pStylePrefix;\n if (ppfx) c.stylePrefix = ppfx + c.stylePrefix;\n\n properties = new Properties();\n sectors = new Sectors(c.sectors, c);\n SectView = new SectorsView({\n collection: sectors,\n target: c.em,\n config: c\n });\n return this;\n },\n\n\n /**\n * Add new sector to the collection. If the sector with the same id already exists,\n * that one will be returned\n * @param {string} id Sector id\n * @param {Object} sector Object representing sector\n * @param {string} [sector.name=''] Sector's label\n * @param {Boolean} [sector.open=true] Indicates if the sector should be opened\n * @param {Array<Object>} [sector.properties=[]] Array of properties\n * @return {Sector} Added Sector\n * @example\n * var sector = styleManager.addSector('mySector',{\n * name: 'My sector',\n * open: true,\n * properties: [{ name: 'My property'}]\n * });\n * */\n addSector: function addSector(id, sector) {\n var result = this.getSector(id);\n if (!result) {\n sector.id = id;\n result = sectors.add(sector);\n }\n return result;\n },\n\n\n /**\n * Get sector by id\n * @param {string} id Sector id\n * @return {Sector|null}\n * @example\n * var sector = styleManager.getSector('mySector');\n * */\n getSector: function getSector(id) {\n var res = sectors.where({ id: id });\n return res.length ? res[0] : null;\n },\n\n\n /**\n * Remove a sector by id\n * @param {string} id Sector id\n * @return {Sector} Removed sector\n * @example\n * const removed = styleManager.removeSector('mySector');\n */\n removeSector: function removeSector(id) {\n return this.getSectors().remove(this.getSector(id));\n },\n\n\n /**\n * Get all sectors\n * @return {Sectors} Collection of sectors\n * */\n getSectors: function getSectors() {\n return sectors;\n },\n\n\n /**\n * Add property to the sector identified by id\n * @param {string} sectorId Sector id\n * @param {Object} property Property object\n * @param {string} [property.name=''] Name of the property\n * @param {string} [property.property=''] CSS property, eg. `min-height`\n * @param {string} [property.type=''] Type of the property: integer | radio | select | color | file | composite | stack\n * @param {Array<string>} [property.units=[]] Unit of measure available, eg. ['px','%','em']. Only for integer type\n * @param {string} [property.unit=''] Default selected unit from `units`. Only for integer type\n * @param {number} [property.min=null] Min possible value. Only for integer type\n * @param {number} [property.max=null] Max possible value. Only for integer type\n * @param {string} [property.defaults=''] Default value\n * @param {string} [property.info=''] Some description\n * @param {string} [property.icon=''] Class name. If exists no text will be displayed\n * @param {Boolean} [property.preview=false] Show layers preview. Only for stack type\n * @param {string} [property.functionName=''] Indicates if value need to be wrapped in some function, for istance `transform: rotate(90deg)`\n * @param {Array<Object>} [property.properties=[]] Nested properties for composite and stack type\n * @param {Array<Object>} [property.layers=[]] Layers for stack properties\n * @param {Array<Object>} [property.list=[]] List of possible options for radio and select types\n * @return {Property|null} Added Property or `null` in case sector doesn't exist\n * @example\n * var property = styleManager.addProperty('mySector',{\n * name: 'Minimum height',\n * property: 'min-height',\n * type: 'select',\n * defaults: '100px',\n * list: [{\n * value: '100px',\n * name: '100',\n * },{\n * value: '200px',\n * name: '200',\n * }],\n * });\n */\n addProperty: function addProperty(sectorId, property) {\n var prop = null;\n var sector = this.getSector(sectorId);\n\n if (sector) prop = sector.get('properties').add(property);\n\n return prop;\n },\n\n\n /**\n * Get property by its CSS name and sector id\n * @param {string} sectorId Sector id\n * @param {string} name CSS property name, eg. 'min-height'\n * @return {Property|null}\n * @example\n * var property = styleManager.getProperty('mySector','min-height');\n */\n getProperty: function getProperty(sectorId, name) {\n var prop = null;\n var sector = this.getSector(sectorId);\n\n if (sector) {\n prop = sector.get('properties').where({ property: name });\n prop = prop.length == 1 ? prop[0] : prop;\n }\n\n return prop;\n },\n\n\n /**\n * Remove a property from the sector\n * @param {string} sectorId Sector id\n * @param {string} name CSS property name, eg. 'min-height'\n * @return {Property} Removed property\n * @example\n * const property = styleManager.removeProperty('mySector', 'min-height');\n */\n removeProperty: function removeProperty(sectorId, name) {\n var props = this.getProperties(sectorId);\n return props && props.remove(this.getProperty(sectorId, name));\n },\n\n\n /**\n * Get properties of the sector\n * @param {string} sectorId Sector id\n * @return {Properties} Collection of properties\n * @example\n * var properties = styleManager.getProperties('mySector');\n */\n getProperties: function getProperties(sectorId) {\n var props = null;\n var sector = this.getSector(sectorId);\n\n if (sector) props = sector.get('properties');\n\n return props;\n },\n\n\n /**\n * Get what to style inside Style Manager. If you select the component\n * without classes the entity is the Component itself and all changes will\n * go inside its 'style' property. Otherwise, if the selected component has\n * one or more classes, the function will return the corresponding CSS Rule\n * @param {Model} model\n * @return {Model}\n */\n getModelToStyle: function getModelToStyle(model) {\n var em = c.em;\n var classes = model.get('classes');\n var id = model.getId();\n\n if (em) {\n var config = em.getConfig();\n var um = em.get('UndoManager');\n var cssC = em.get('CssComposer');\n var state = !config.devicePreviewMode ? model.get('state') : '';\n var valid = classes.getStyleable();\n var hasClasses = valid.length;\n var opts = { state: state };\n var rule = void 0;\n\n if (hasClasses) {\n var deviceW = em.getCurrentMedia();\n rule = cssC.get(valid, state, deviceW);\n\n if (!rule) {\n // I stop undo manager here as after adding the CSSRule (generally after\n // selecting the component) and calling undo() it will remove the rule from\n // the collection, therefore updating it in style manager will not affect it\n // #268\n um.stop();\n rule = cssC.add(valid, state, deviceW);\n rule.setStyle(model.getStyle());\n model.setStyle({});\n um.start();\n }\n } else if (config.avoidInlineStyle) {\n rule = cssC.getIdRule(id, opts);\n !rule && (rule = cssC.setIdRule(id, {}, opts));\n }\n\n rule && (model = rule);\n }\n\n return model;\n },\n\n\n /**\n * Add new property type\n * @param {string} id Type ID\n * @param {Object} definition Definition of the type. Each definition contains\n * `model` (business logic), `view` (presentation logic)\n * and `isType` function which recognize the type of the\n * passed entity\n * addType('my-type', {\n * model: {},\n * view: {},\n * isType: (value) => {\n * if (value && value.type == 'my-type') {\n * return value;\n * }\n * },\n * })\n */\n addType: function addType(id, definition) {\n properties.addType(id, definition);\n },\n\n\n /**\n * Get type\n * @param {string} id Type ID\n * @return {Object} Type definition\n */\n getType: function getType(id) {\n return properties.getType(id);\n },\n\n\n /**\n * Get all types\n * @return {Array}\n */\n getTypes: function getTypes() {\n return properties.getTypes();\n },\n\n\n /**\n * Create new property from type\n * @param {string} id Type ID\n * @param {Object} [options={}] Options\n * @param {Object} [options.model={}] Custom model object\n * @param {Object} [options.view={}] Custom view object\n * @return {PropertyView}\n * @example\n * const propView = styleManager.createType('integer', {\n * model: {units: ['px', 'rem']}\n * });\n * propView.render();\n * propView.model.on('change:value', ...);\n * someContainer.appendChild(propView.el);\n */\n createType: function createType(id) {\n var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},\n _ref$model = _ref.model,\n model = _ref$model === undefined ? {} : _ref$model,\n _ref$view = _ref.view,\n view = _ref$view === undefined ? {} : _ref$view;\n\n var type = this.getType(id);\n\n if (type) {\n return new type.view(_extends({\n model: new type.model(model),\n config: c\n }, view));\n }\n },\n\n\n /**\n * Render sectors and properties\n * @return {HTMLElement}\n * */\n render: function render() {\n return SectView.render().el;\n }\n };\n};\n\n/***/ }),\n/* 32 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Backbone) {\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nvar Model = Backbone.Model;\nvar View = Backbone.View;\n\nexports.default = {\n types: [],\n\n initialize: function initialize(models, opts) {\n var _this = this;\n\n this.model = function () {\n var attrs = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n var Model = void 0,\n View = void 0,\n type = void 0;\n\n if (attrs && attrs.type) {\n var baseType = _this.getBaseType();\n type = _this.getType(attrs.type);\n Model = type ? type.model : baseType.model;\n View = type ? type.view : baseType.view;\n } else {\n var typeFound = _this.recognizeType(attrs);\n type = typeFound.type;\n Model = type.model;\n View = type.view;\n attrs = typeFound.attributes;\n }\n\n var model = new Model(attrs, options);\n model.typeView = View;\n return model;\n };\n var init = this.init && this.init.bind(this);\n init && init();\n },\n\n\n /**\n * Recognize type by any value\n * @param {mixed} value\n * @return {Object} Found type\n */\n recognizeType: function recognizeType(value) {\n var types = this.getTypes();\n\n for (var i = 0; i < types.length; i++) {\n var type = types[i];\n var typeFound = type.isType(value);\n typeFound = typeof typeFound == 'boolean' && typeFound ? { type: type.id } : typeFound;\n\n if (typeFound) {\n return {\n type: type,\n attributes: typeFound\n };\n }\n }\n\n // If, for any reason, the type is not found it'll return the base one\n return {\n type: this.getBaseType(),\n attributes: value\n };\n },\n\n\n /**\n * Returns the base type (last object in the stack)\n * @return {Object}\n */\n getBaseType: function getBaseType() {\n var types = this.getTypes();\n return types[types.length - 1];\n },\n\n\n /**\n * Get types\n * @return {Array}\n */\n getTypes: function getTypes() {\n return this.types;\n },\n\n\n /**\n * Get type\n * @param {string} id Type ID\n * @return {Object} Type definition\n */\n getType: function getType(id) {\n var types = this.getTypes();\n\n for (var i = 0; i < types.length; i++) {\n var type = types[i];\n if (type.id === id) {\n return type;\n }\n }\n },\n\n\n /**\n * Add new type\n * @param {string} id Type ID\n * @param {Object} definition Definition of the type. Each definition contains\n * `model` (business logic), `view` (presentation logic)\n * and `isType` function which recognize the type of the\n * passed entity\n * addType('my-type', {\n * model: {},\n * view: {},\n * isType: (value) => {},\n * })\n */\n addType: function addType(id, definition) {\n var type = this.getType(id);\n var baseType = this.getBaseType();\n var ModelInst = type ? type.model : baseType.model;\n var ViewInst = type ? type.view : baseType.view;\n var model = definition.model,\n view = definition.view,\n isType = definition.isType;\n\n model = model instanceof Model ? model : ModelInst.extend(model || {});\n view = view instanceof View ? view : ViewInst.extend(view || {});\n\n if (type) {\n type.model = model;\n type.view = view;\n type.isType = isType || type.isType;\n } else {\n definition.id = id;\n definition.model = model;\n definition.view = view;\n definition.isType = isType || function (value) {\n if (value && value.type == id) {\n return true;\n }\n };\n this.getTypes().unshift(definition);\n }\n }\n};\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))\n\n/***/ }),\n/* 33 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar Property = __webpack_require__(12);\n\nmodule.exports = Property.extend({\n defaults: _extends({}, Property.prototype.defaults, {\n // 'background' is a good example where to make a difference\n // between detached and not\n //\n // - NOT detached (default)\n // background: url(..) no-repeat center ...;\n // - Detached\n // background-image: url();\n // background-repeat: repeat;\n // ...\n detached: 0,\n\n // Array of sub properties\n properties: [],\n\n // Separator between properties\n separator: ' '\n }),\n\n init: function init() {\n var properties = this.get('properties') || [];\n var Properties = __webpack_require__(11);\n this.set('properties', new Properties(properties));\n this.listenTo(this, 'change:value', this.updateValues);\n },\n\n\n /**\n * Update property values\n */\n updateValues: function updateValues() {\n var values = this.get('value').split(this.get('separator'));\n this.get('properties').each(function (property, i) {\n var len = values.length;\n // Try to get value from a shorthand:\n // 11px -> 11px 11px 11px 11xp\n // 11px 22px -> 11px 22px 11px 22xp\n var value = values[i] || values[i % len + (len != 1 && len % 2 ? 1 : 0)];\n // There some issue with UndoManager\n //property.setValue(value, 0, {fromParent: 1});\n });\n },\n\n\n /**\n * Returns default value\n * @param {Boolean} defaultProps Force to get defaults from properties\n * @return {string}\n */\n getDefaultValue: function getDefaultValue(defaultProps) {\n var value = this.get('defaults');\n\n if (value && !defaultProps) {\n return value;\n }\n\n value = '';\n var properties = this.get('properties');\n properties.each(function (prop, index) {\n return value += prop.getDefaultValue() + ' ';\n });\n return value.trim();\n },\n getFullValue: function getFullValue() {\n if (this.get('detached')) {\n return '';\n }\n\n return this.get('properties').getFullValue();\n }\n});\n\n/***/ }),\n/* 34 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar PropertyCompositeView = __webpack_require__(17);\nvar LayersView = __webpack_require__(123);\n\nmodule.exports = PropertyCompositeView.extend({\n templateInput: function templateInput() {\n var pfx = this.pfx;\n var ppfx = this.ppfx;\n return '\\n <div class=\"' + pfx + 'field ' + pfx + 'stack\">\\n <button type=\"button\" id=\"' + pfx + 'add\" data-add-layer>+</button>\\n <div data-layers-wrapper></div>\\n </div>\\n ';\n },\n init: function init() {\n var model = this.model;\n var pfx = this.pfx;\n model.set('stackIndex', null);\n this.events['click [data-add-layer]'] = 'addLayer';\n this.listenTo(model, 'change:stackIndex', this.indexChanged);\n this.listenTo(model, 'updateValue', this.inputValueChanged);\n this.delegateEvents();\n },\n\n\n /**\n * Fired when the target is updated.\n * With detached mode the component will be always empty as its value\n * so we gonna check all props and find if it has any difference\n * */\n targetUpdated: function targetUpdated() {\n if (!this.model.get('detached')) {\n for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n PropertyCompositeView.prototype.targetUpdated.apply(this, args);\n } else {\n this.checkVisibility();\n }\n\n this.refreshLayers();\n },\n\n\n /**\n * Returns the collection of layers\n * @return {Collection}\n */\n getLayers: function getLayers() {\n return this.model.get('layers');\n },\n\n\n /**\n * Triggered when another layer has been selected.\n * This allow to move all rendered properties to a new\n * selected layer\n * @param {Event}\n *\n * @return {Object}\n * */\n indexChanged: function indexChanged(e) {\n var model = this.model;\n this.getLayers().active(model.get('stackIndex'));\n },\n addLayer: function addLayer() {\n var model = this.model;\n var layers = this.getLayers();\n var properties = model.get('properties').deepClone();\n properties.each(function (property) {\n return property.set('value', '');\n });\n var layer = layers.add({ properties: properties });\n\n // In detached mode inputValueChanged will add new 'layer value'\n // to all subprops\n this.inputValueChanged();\n\n // This will set subprops with a new default values\n model.set('stackIndex', layers.indexOf(layer));\n },\n inputValueChanged: function inputValueChanged() {\n var model = this.model;\n this.elementUpdated();\n\n // If not detached I'll just put all the values from layers to property\n // eg. background: layer1Value, layer2Value, layer3Value, ...\n if (!model.get('detached')) {\n model.set('value', this.getLayerValues());\n } else {\n model.get('properties').each(function (prop) {\n return prop.trigger('change:value');\n });\n }\n },\n\n\n /**\n * There is no need to handle input update by the property itself,\n * this will be done by layers\n * @private\n */\n setValue: function setValue() {},\n\n\n /**\n * Create value by layers\n * @return string\n * */\n getLayerValues: function getLayerValues() {\n return this.getLayers().getFullValue();\n },\n\n\n /**\n * Refresh layers\n * */\n refreshLayers: function refreshLayers() {\n var layersObj = [];\n var model = this.model;\n var layers = this.getLayers();\n var detached = model.get('detached');\n\n // With detached layers values will be assigned to their properties\n if (detached) {\n var target = this.getTarget();\n var style = target ? target.getStyle() : {};\n layersObj = layers.getLayersFromStyle(style);\n } else {\n var value = this.getTargetValue();\n value = value == model.getDefaultValue() ? '' : value;\n layersObj = layers.getLayersFromValue(value);\n }\n\n layers.reset();\n layers.add(layersObj);\n model.set({ stackIndex: null }, { silent: true });\n },\n onRender: function onRender() {\n var self = this;\n var model = this.model;\n var fieldEl = this.el.querySelector('[data-layers-wrapper]');\n var PropertiesView = __webpack_require__(13);\n var propsConfig = {\n target: this.target,\n propTarget: this.propTarget,\n\n // Things to do when a single sub-property is changed\n onChange: function onChange(el, view, opt) {\n var subModel = view.model;\n\n if (model.get('detached')) {\n var subProp = subModel.get('property');\n var values = self.getLayers().getPropertyValues(subProp);\n view.updateTargetStyle(values, null, opt);\n } else {\n model.set('value', model.getFullValue(), opt);\n }\n }\n };\n var layers = new LayersView({\n collection: this.getLayers(),\n stackModel: model,\n preview: model.get('preview'),\n config: this.config,\n propsConfig: propsConfig\n }).render().el;\n\n // Will use it to propogate changes\n new PropertiesView({\n target: this.target,\n collection: this.model.get('properties'),\n stackModel: model,\n config: this.config,\n onChange: propsConfig.onChange,\n propTarget: propsConfig.propTarget,\n customValue: propsConfig.customValue\n }).render();\n\n //model.get('properties')\n fieldEl.appendChild(layers);\n }\n});\n\n/***/ }),\n/* 35 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Backbone) {\n\nvar $ = Backbone.$;\n\nmodule.exports = Backbone.View.extend({\n events: {\n change: 'handleChange'\n },\n\n template: function template() {\n return '<span class=\"' + this.holderClass() + '\"></span>';\n },\n inputClass: function inputClass() {\n return this.ppfx + 'field';\n },\n holderClass: function holderClass() {\n return this.ppfx + 'input-holder';\n },\n initialize: function initialize() {\n var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n var ppfx = opts.ppfx || '';\n this.opts = opts;\n this.ppfx = ppfx;\n this.em = opts.target || {};\n this.listenTo(this.model, 'change:value', this.handleModelChange);\n },\n\n\n /**\n * Fired when the element of the property is updated\n */\n elementUpdated: function elementUpdated() {\n this.model.trigger('el:change');\n },\n\n\n /**\n * Set value to the input element\n * @param {string} value\n */\n setValue: function setValue(value) {\n var model = this.model;\n var val = value || model.get('defaults');\n var input = this.getInputEl();\n input && (input.value = val);\n },\n\n\n /**\n * Updates the view when the model is changed\n * */\n handleModelChange: function handleModelChange(model, value, opts) {\n this.setValue(value, opts);\n },\n\n\n /**\n * Handled when the view is changed\n */\n handleChange: function handleChange(e) {\n e.stopPropagation();\n this.model.set('value', this.getInputEl().value);\n this.elementUpdated();\n },\n\n\n /**\n * Get the input element\n * @return {HTMLElement}\n */\n getInputEl: function getInputEl() {\n if (!this.inputEl) {\n var plh = this.model.get('defaults');\n this.inputEl = $('<input type=\"text\" placeholder=\"' + plh + '\">');\n }\n\n return this.inputEl.get(0);\n },\n render: function render() {\n var el = this.$el;\n el.addClass(this.inputClass());\n el.html(this.template());\n el.find('.' + this.holderClass()).append(this.getInputEl());\n return this;\n }\n});\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))\n\n/***/ }),\n/* 36 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = __webpack_require__(5).extend({\n templateInput: function templateInput() {\n var pfx = this.pfx;\n var ppfx = this.ppfx;\n return '\\n <div class=\"' + ppfx + 'field ' + ppfx + 'field-radio\">\\n </div>\\n ';\n },\n onRender: function onRender() {\n var pfx = this.pfx;\n var ppfx = this.ppfx;\n var itemCls = ppfx + 'radio-item-label';\n var model = this.model;\n var prop = model.get('property');\n var options = model.get('list') || model.get('options') || [];\n\n if (!this.input) {\n if (options && options.length) {\n var inputStr = '';\n\n options.forEach(function (el) {\n var cl = el.className ? el.className + ' ' + pfx + 'icon ' + itemCls : '';\n var id = prop + '-' + el.value;\n var labelTxt = el.name || el.value;\n var titleAttr = el.title ? 'title=\"' + el.title + '\"' : '';\n inputStr += '\\n <div class=\"' + ppfx + 'radio-item\">\\n <input type=\"radio\" class=\"' + pfx + 'radio\" id=\"' + id + '\" name=\"' + prop + '\" value=\"' + el.value + '\"/>\\n <label class=\"' + (cl || itemCls) + '\" ' + titleAttr + ' for=\"' + id + '\">' + (cl ? '' : labelTxt) + '</label>\\n </div>\\n ';\n });\n\n var inputHld = this.el.querySelector('.' + ppfx + 'field');\n inputHld.innerHTML = '<div class=\"' + ppfx + 'radio-items\">' + inputStr + '</div>';\n this.input = inputHld.firstChild;\n }\n }\n },\n getInputValue: function getInputValue() {\n var inputChk = this.getCheckedEl();\n return inputChk ? inputChk.value : '';\n },\n getCheckedEl: function getCheckedEl() {\n var input = this.getInputEl();\n return input ? input.querySelector('input:checked') : '';\n },\n setValue: function setValue(value) {\n var model = this.model;\n var val = value || model.get('value') || model.getDefaultValue();\n var input = this.getInputEl();\n var inputIn = input ? input.querySelector('[value=\"' + val + '\"]') : '';\n\n if (inputIn) {\n inputIn.checked = true;\n } else {\n var inputChk = this.getCheckedEl();\n inputChk && (inputChk.checked = false);\n }\n }\n});\n\n/***/ }),\n/* 37 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Backbone) {\n\nvar $ = Backbone.$;\n\nmodule.exports = __webpack_require__(5).extend({\n templateInput: function templateInput() {\n var pfx = this.pfx;\n var ppfx = this.ppfx;\n return '\\n <div class=\"' + ppfx + 'field ' + ppfx + 'select\">\\n <span id=\"' + pfx + 'input-holder\"></span>\\n <div class=\"' + ppfx + 'sel-arrow\">\\n <div class=\"' + ppfx + 'd-s-arrow\"></div>\\n </div>\\n </div>\\n ';\n },\n onRender: function onRender() {\n var pfx = this.pfx;\n var model = this.model;\n var options = model.get('list') || model.get('options') || [];\n\n if (!this.input) {\n var optionsStr = '';\n\n options.forEach(function (option) {\n var name = option.name || option.value;\n var style = option.style ? option.style.replace(/\"/g, '"') : '';\n var styleAttr = style ? 'style=\"' + style + '\"' : '';\n var value = option.value.replace(/\"/g, '"');\n optionsStr += '<option value=\"' + value + '\" ' + styleAttr + '>' + name + '</option>';\n });\n\n var inputH = this.el.querySelector('#' + pfx + 'input-holder');\n inputH.innerHTML = '<select>' + optionsStr + '</select>';\n this.input = inputH.firstChild;\n }\n }\n});\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))\n\n/***/ }),\n/* 38 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar InputColor = __webpack_require__(39);\n\nmodule.exports = __webpack_require__(14).extend({\n setValue: function setValue(value) {\n var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n opts = _extends({}, opts, { silent: 1 });\n this.inputInst.setValue(value, opts);\n },\n onRender: function onRender() {\n if (!this.input) {\n var ppfx = this.ppfx;\n var inputColor = new InputColor({\n target: this.target,\n model: this.model,\n ppfx: ppfx\n });\n var input = inputColor.render();\n this.el.querySelector('.' + ppfx + 'fields').appendChild(input.el);\n this.$input = input.inputEl;\n this.$color = input.colorEl;\n this.input = this.$input.get(0);\n this.inputInst = input;\n }\n }\n});\n\n/***/ }),\n/* 39 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Backbone) {\n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\n__webpack_require__(122);\nvar Input = __webpack_require__(35);\nvar $ = Backbone.$;\n\nmodule.exports = Input.extend({\n template: function template() {\n var ppfx = this.ppfx;\n return '\\n <div class=\"' + this.holderClass() + '\"></div>\\n <div class=\"' + ppfx + 'field-colorp\">\\n <div class=\"' + ppfx + 'field-colorp-c\" data-colorp-c>\\n <div class=\"' + ppfx + 'checker-bg\"></div>\\n </div>\\n </div>\\n ';\n },\n inputClass: function inputClass() {\n var ppfx = this.ppfx;\n return ppfx + 'field ' + ppfx + 'field-color';\n },\n holderClass: function holderClass() {\n return this.ppfx + 'input-holder';\n },\n\n\n /**\n * Set value to the model\n * @param {string} val\n * @param {Object} opts\n */\n setValue: function setValue(val) {\n var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n var model = this.model;\n var value = val || model.get('defaults');\n var inputEl = this.getInputEl();\n var colorEl = this.getColorEl();\n var valueClr = value != 'none' ? value : '';\n inputEl.value = value;\n colorEl.get(0).style.backgroundColor = valueClr;\n\n // This prevents from adding multiple thumbs in spectrum\n if (opts.fromTarget) {\n colorEl.spectrum('set', valueClr);\n this.noneColor = value == 'none';\n }\n },\n\n\n /**\n * Get the color input element\n * @return {HTMLElement}\n */\n getColorEl: function getColorEl() {\n if (!this.colorEl) {\n var self = this;\n var ppfx = this.ppfx;\n var model = this.model;\n\n var colorEl = $('<div class=\"' + this.ppfx + 'field-color-picker\"></div>');\n var cpStyle = colorEl.get(0).style;\n var elToAppend = this.em && this.em.config ? this.em.config.el : '';\n var colorPickerConfig = this.em && this.em.getConfig && this.em.getConfig('colorPicker') || {};\n var getColor = function getColor(color) {\n var cl = color.getAlpha() == 1 ? color.toHexString() : color.toRgbString();\n return cl.replace(/ /g, '');\n };\n\n var changed = 0;\n var previousColor = void 0;\n this.$el.find('[data-colorp-c]').append(colorEl);\n colorEl.spectrum(_extends({\n containerClassName: ppfx + 'one-bg ' + ppfx + 'two-color',\n appendTo: elToAppend || 'body',\n maxSelectionSize: 8,\n showPalette: true,\n showAlpha: true,\n chooseText: 'Ok',\n cancelText: '⨯',\n palette: []\n\n }, colorPickerConfig, {\n move: function move(color) {\n var cl = getColor(color);\n cpStyle.backgroundColor = cl;\n model.setValueFromInput(cl, 0);\n },\n change: function change(color) {\n changed = 1;\n var cl = getColor(color);\n cpStyle.backgroundColor = cl;\n model.setValueFromInput(cl);\n self.noneColor = 0;\n },\n show: function show(color) {\n changed = 0;\n previousColor = getColor(color);\n },\n hide: function hide(color) {\n if (!changed && previousColor) {\n if (self.noneColor) {\n previousColor = '';\n }\n cpStyle.backgroundColor = previousColor;\n colorEl.spectrum('set', previousColor);\n model.setValueFromInput(previousColor, 0);\n }\n }\n }));\n\n this.colorEl = colorEl;\n }\n return this.colorEl;\n },\n render: function render() {\n Input.prototype.render.call(this);\n // This will make the color input available on render\n this.getColorEl();\n return this;\n }\n});\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))\n\n/***/ }),\n/* 40 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Backbone) {\n\nvar PropertyView = __webpack_require__(5);\nvar $ = Backbone.$;\n\nmodule.exports = PropertyView.extend({\n templateInput: function templateInput() {\n var pfx = this.pfx;\n var ppfx = this.ppfx;\n var assetsLabel = this.config.assetsLabel || 'Images';\n return '\\n <div class=\"' + pfx + 'field ' + pfx + 'file\">\\n <div id=\\'' + pfx + 'input-holder\\'>\\n <div class=\"' + pfx + 'btn-c\">\\n <button class=\"' + pfx + 'btn\" id=\"' + pfx + 'images\" type=\"button\">\\n ' + assetsLabel + '\\n </button>\\n </div>\\n <div style=\"clear:both;\"></div>\\n </div>\\n <div id=\"' + pfx + 'preview-box\">\\n <div id=\"' + pfx + 'preview-file\"></div>\\n <div id=\"' + pfx + 'close\">⨯</div>\\n </div>\\n </div>\\n ';\n },\n init: function init() {\n var em = this.em;\n this.modal = em.get('Modal');\n this.am = em.get('AssetManager');\n this.events['click #' + this.pfx + 'close'] = 'removeFile';\n this.events['click #' + this.pfx + 'images'] = 'openAssetManager';\n this.delegateEvents();\n },\n onRender: function onRender() {\n if (!this.$input) {\n var plh = this.model.getDefaultValue();\n this.$input = $('<input placeholder=\"' + plh + '\">');\n }\n\n if (!this.$preview) {\n this.$preview = this.$el.find('#' + this.pfx + 'preview-file');\n }\n\n if (!this.$previewBox) {\n this.$previewBox = this.$el.find('#' + this.pfx + 'preview-box');\n }\n\n this.setValue(this.componentValue, 0);\n },\n setValue: function setValue(value, f) {\n PropertyView.prototype.setValue.apply(this, arguments);\n this.setPreviewView(value && value != this.model.getDefaultValue());\n this.setPreview(value);\n },\n\n\n /**\n * Change visibility of the preview box\n * @param bool Visibility\n *\n * @return void\n * */\n setPreviewView: function setPreviewView(v) {\n var pv = this.$previewBox;\n pv && pv[v ? 'addClass' : 'removeClass'](this.pfx + 'show');\n },\n\n\n /**\n * Spread url\n * @param string Url\n *\n * @return void\n * */\n spreadUrl: function spreadUrl(url) {\n this.model.set('value', url);\n this.setPreviewView(1);\n },\n\n\n /**\n * Shows file preview\n * @param string Value\n * */\n setPreview: function setPreview(value) {\n var preview = this.$preview;\n value = value && value.indexOf('url(') < 0 ? 'url(' + value + ')' : value;\n preview && preview.css('background-image', value);\n },\n\n\n /** @inheritdoc */\n cleanValue: function cleanValue() {\n this.setPreviewView(0);\n this.model.set({ value: '' }, { silent: true });\n },\n\n\n /**\n * Remove file from input\n *\n * @return void\n * */\n removeFile: function removeFile() {\n this.model.set('value', this.model.getDefaultValue());\n\n for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n PropertyView.prototype.cleanValue.apply(this, args);\n this.setPreviewView(0);\n },\n\n\n /**\n * Open dialog for image selecting\n * @param {Object} e Event\n *\n * @return void\n * */\n openAssetManager: function openAssetManager(e) {\n var that = this;\n var em = this.em;\n var editor = em ? em.get('Editor') : '';\n\n if (editor) {\n this.modal.setTitle('Select image');\n this.modal.setContent(this.am.getContainer());\n this.am.setTarget(null);\n editor.runCommand('open-assets', {\n target: this.model,\n onSelect: function onSelect(target) {\n that.modal.close();\n that.spreadUrl(target.get('src'));\n }\n });\n }\n }\n});\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))\n\n/***/ }),\n/* 41 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar Property = __webpack_require__(12);\n\nmodule.exports = Property.extend({\n defaults: _extends({}, Property.prototype.defaults, {\n // Array of options, eg. [{name: 'Label ', value: '100'}]\n options: []\n })\n});\n\n/***/ }),\n/* 42 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar Property = __webpack_require__(12);\nvar InputNumber = __webpack_require__(18);\n\nmodule.exports = Property.extend({\n defaults: _extends({}, Property.prototype.defaults, {\n // Array of units, eg. ['px', '%']\n units: [],\n\n // Selected unit, eg. 'px'\n unit: '',\n\n // Integer value steps\n step: 1,\n\n // Minimum value\n min: '',\n\n // Maximum value\n max: ''\n }),\n\n init: function init() {\n var unit = this.get('unit');\n var units = this.get('units');\n this.input = new InputNumber({ model: this });\n\n if (units.length && !unit) {\n this.set('unit', units[0]);\n }\n },\n parseValue: function parseValue(val) {\n var parsed = Property.prototype.parseValue.apply(this, arguments);\n\n var _input$validateInputV = this.input.validateInputValue(parsed.value, {\n deepCheck: 1\n }),\n value = _input$validateInputV.value,\n unit = _input$validateInputV.unit;\n\n parsed.value = value;\n parsed.unit = unit;\n return parsed;\n },\n getFullValue: function getFullValue() {\n var value = this.get('value') + this.get('unit');\n return Property.prototype.getFullValue.apply(this, [value]);\n }\n});\n\n/***/ }),\n/* 43 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = __webpack_require__(44).extend({\n events: {\n 'click [data-toggle=asset-remove]': 'onRemove',\n click: 'onClick',\n dblclick: 'onDblClick'\n },\n\n getPreview: function getPreview() {\n var pfx = this.pfx;\n var src = this.model.get('src');\n return '\\n <div class=\"' + pfx + 'preview\" style=\"background-image: url(\\'' + src + '\\');\"></div>\\n <div class=\"' + pfx + 'preview-bg ' + this.ppfx + 'checker-bg\"></div>\\n ';\n },\n getInfo: function getInfo() {\n var pfx = this.pfx;\n var model = this.model;\n var name = model.get('name');\n var width = model.get('width');\n var height = model.get('height');\n var unit = model.get('unitDim');\n var dim = width && height ? width + 'x' + height + unit : '';\n name = name || model.getFilename();\n return '\\n <div class=\"' + pfx + 'name\">' + name + '</div>\\n <div class=\"' + pfx + 'dimensions\">' + dim + '</div>\\n ';\n },\n init: function init(o) {\n var pfx = this.pfx;\n this.className += ' ' + pfx + 'asset-image';\n },\n\n\n /**\n * Triggered when the asset is clicked\n * @private\n * */\n onClick: function onClick() {\n var onClick = this.config.onClick;\n var model = this.model;\n this.collection.trigger('deselectAll');\n this.$el.addClass(this.pfx + 'highlight');\n\n if (typeof onClick === 'function') {\n onClick(model);\n } else {\n this.updateTarget(this.collection.target);\n }\n },\n\n\n /**\n * Triggered when the asset is double clicked\n * @private\n * */\n onDblClick: function onDblClick() {\n var em = this.em;\n var onDblClick = this.config.onDblClick;\n var model = this.model;\n\n if (typeof onDblClick === 'function') {\n onDblClick(model);\n } else {\n this.updateTarget(this.collection.target);\n em && em.get('Modal').close();\n }\n\n var onSelect = this.collection.onSelect;\n if (typeof onSelect == 'function') {\n onSelect(this.model);\n }\n },\n\n\n /**\n * Remove asset from collection\n * @private\n * */\n onRemove: function onRemove(e) {\n e.stopImmediatePropagation();\n this.model.collection.remove(this.model);\n }\n});\n\n/***/ }),\n/* 44 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Backbone, _) {\n\nmodule.exports = Backbone.View.extend({\n initialize: function initialize() {\n var o = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n this.options = o;\n this.collection = o.collection;\n var config = o.config || {};\n this.config = config;\n this.pfx = config.stylePrefix || '';\n this.ppfx = config.pStylePrefix || '';\n this.em = config.em;\n this.className = this.pfx + 'asset';\n this.listenTo(this.model, 'destroy remove', this.remove);\n this.model.view = this;\n var init = this.init && this.init.bind(this);\n init && init(o);\n },\n template: function template() {\n var pfx = this.pfx;\n return '\\n <div class=\"' + pfx + 'preview-cont\">\\n ' + this.getPreview() + '\\n </div>\\n <div class=\"' + pfx + 'meta\">\\n ' + this.getInfo() + '\\n </div>\\n <div class=\"' + pfx + 'close\" data-toggle=\"asset-remove\">\\n ⨯\\n </div>\\n ';\n },\n\n\n /**\n * Update target if exists\n * @param {Model} target\n * @private\n * */\n updateTarget: function updateTarget(target) {\n if (target && target.set) {\n target.set('attributes', _.clone(target.get('attributes')));\n target.set('src', this.model.get('src'));\n }\n },\n getPreview: function getPreview() {\n return '';\n },\n getInfo: function getInfo() {\n return '';\n },\n render: function render() {\n var el = this.el;\n el.innerHTML = this.template(this, this.model);\n el.className = this.className;\n return this;\n }\n});\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0), __webpack_require__(1)))\n\n/***/ }),\n/* 45 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Backbone, _) {\n\nvar _fetch = __webpack_require__(24);\n\nvar _fetch2 = _interopRequireDefault(_fetch);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nmodule.exports = Backbone.View.extend({\n template: _.template('\\n <form>\\n <div id=\"<%= pfx %>title\"><%= title %></div>\\n <input type=\"file\" id=\"<%= uploadId %>\" name=\"file\" accept=\"image/*\" <%= disabled ? \\'disabled\\' : \\'\\' %> multiple/>\\n <div style=\"clear:both;\"></div>\\n </form>\\n '),\n\n events: {},\n\n initialize: function initialize() {\n var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n this.options = opts;\n var c = opts.config || {};\n this.config = c;\n this.pfx = c.stylePrefix || '';\n this.ppfx = c.pStylePrefix || '';\n this.target = this.options.globalCollection || {};\n this.uploadId = this.pfx + 'uploadFile';\n this.disabled = c.disableUpload !== undefined ? c.disableUpload : !c.upload && !c.embedAsBase64;\n this.events['change #' + this.uploadId] = 'uploadFile';\n var uploadFile = c.uploadFile;\n\n if (uploadFile) {\n this.uploadFile = uploadFile.bind(this);\n } else if (c.embedAsBase64) {\n this.uploadFile = this.constructor.embedAsBase64;\n }\n\n this.delegateEvents();\n },\n\n\n /**\n * Triggered before the upload is started\n * @private\n */\n onUploadStart: function onUploadStart() {\n var em = this.config.em;\n em && em.trigger('asset:upload:start');\n },\n\n\n /**\n * Triggered after the upload is ended\n * @param {Object|string} res End result\n * @private\n */\n onUploadEnd: function onUploadEnd(res) {\n var em = this.config.em;\n em && em.trigger('asset:upload:end', res);\n },\n\n\n /**\n * Triggered on upload error\n * @param {Object} err Error\n * @private\n */\n onUploadError: function onUploadError(err) {\n var em = this.config.em;\n console.error(err);\n this.onUploadEnd(err);\n em && em.trigger('asset:upload:error', err);\n },\n\n\n /**\n * Triggered on upload response\n * @param {string} text Response text\n * @private\n */\n onUploadResponse: function onUploadResponse(text, clb) {\n var em = this.config.em;\n var config = this.config;\n var target = this.target;\n var json = typeof text === 'string' ? JSON.parse(text) : text;\n em && em.trigger('asset:upload:response', json);\n\n if (config.autoAdd && target) {\n target.add(json.data, { at: 0 });\n }\n\n this.onUploadEnd(text);\n clb && clb(json);\n },\n\n\n /**\n * Upload files\n * @param {Object} e Event\n * @return {Promise}\n * @private\n * */\n uploadFile: function uploadFile(e, clb) {\n var _this = this;\n\n var files = e.dataTransfer ? e.dataTransfer.files : e.target.files;\n var body = new FormData();\n var config = this.config;\n var params = config.params;\n\n for (var i = 0; i < files.length; i++) {\n body.append(config.uploadName + '[]', files[i]);\n }\n\n for (var param in params) {\n body.append(param, params[param]);\n }\n\n var target = this.target;\n var url = config.upload;\n var headers = config.headers;\n var reqHead = 'X-Requested-With';\n\n if (typeof headers[reqHead] == 'undefined') {\n headers[reqHead] = 'XMLHttpRequest';\n }\n\n if (url) {\n this.onUploadStart();\n return (0, _fetch2.default)(url, {\n method: 'post',\n credentials: 'include',\n headers: headers,\n body: body\n }).then(function (res) {\n return (res.status / 200 | 0) == 1 ? res.text() : res.text().then(function (text) {\n return Promise.reject(text);\n });\n }).then(function (text) {\n return _this.onUploadResponse(text, clb);\n }).catch(function (err) {\n return _this.onUploadError(err);\n });\n }\n },\n\n\n /**\n * Make input file droppable\n * @private\n * */\n initDrop: function initDrop() {\n var that = this;\n if (!this.uploadForm) {\n this.uploadForm = this.$el.find('form').get(0);\n if ('draggable' in this.uploadForm) {\n var uploadFile = this.uploadFile;\n this.uploadForm.ondragover = function () {\n this.className = that.pfx + 'hover';\n return false;\n };\n this.uploadForm.ondragleave = function () {\n this.className = '';\n return false;\n };\n this.uploadForm.ondrop = function (e) {\n this.className = '';\n e.preventDefault();\n that.uploadFile(e);\n return;\n };\n }\n }\n },\n initDropzone: function initDropzone(ev) {\n var _this2 = this;\n\n var addedCls = 0;\n var c = this.config;\n var em = ev.model;\n var edEl = ev.el;\n var editor = em.get('Editor');\n var container = em.get('Config').el;\n var frameEl = em.get('Canvas').getBody();\n var ppfx = this.ppfx;\n var updatedCls = ppfx + 'dropzone-active';\n var dropzoneCls = ppfx + 'dropzone';\n var cleanEditorElCls = function cleanEditorElCls() {\n edEl.className = edEl.className.replace(updatedCls, '').trim();\n addedCls = 0;\n };\n var onDragOver = function onDragOver() {\n if (!addedCls) {\n edEl.className += ' ' + updatedCls;\n addedCls = 1;\n }\n return false;\n };\n var onDragLeave = function onDragLeave() {\n cleanEditorElCls();\n return false;\n };\n var onDrop = function onDrop(e) {\n cleanEditorElCls();\n e.preventDefault();\n e.stopPropagation();\n _this2.uploadFile(e);\n\n if (c.openAssetsOnDrop && editor) {\n var target = editor.getSelected();\n editor.runCommand('open-assets', {\n target: target,\n onSelect: function onSelect() {\n editor.Modal.close();\n editor.AssetManager.setTarget(null);\n }\n });\n }\n\n return false;\n };\n\n ev.$el.append('<div class=\"' + dropzoneCls + '\">' + c.dropzoneContent + '</div>');\n cleanEditorElCls();\n\n if ('draggable' in edEl) {\n [edEl, frameEl].forEach(function (item) {\n item.ondragover = onDragOver;\n item.ondragleave = onDragLeave;\n item.ondrop = onDrop;\n });\n }\n },\n render: function render() {\n this.$el.html(this.template({\n title: this.config.uploadText,\n uploadId: this.uploadId,\n disabled: this.disabled,\n pfx: this.pfx\n }));\n this.initDrop();\n this.$el.attr('class', this.pfx + 'file-uploader');\n return this;\n }\n}, {\n embedAsBase64: function embedAsBase64(e, clb) {\n var _this3 = this;\n\n // List files dropped\n var files = e.dataTransfer ? e.dataTransfer.files : e.target.files;\n var response = { data: [] };\n\n // Unlikely, widely supported now\n if (!FileReader) {\n this.onUploadError(new Error('Unsupported platform, FileReader is not defined'));\n return;\n }\n\n var promises = [];\n var mimeTypeMatcher = /^(.+)\\/(.+)$/;\n\n var _loop = function _loop(file) {\n // For each file a reader (to read the base64 URL)\n // and a promise (to track and merge results and errors)\n var promise = new Promise(function (resolve, reject) {\n var reader = new FileReader();\n reader.addEventListener('load', function (event) {\n var type = void 0;\n var name = file.name;\n\n // Try to find the MIME type of the file.\n var match = mimeTypeMatcher.exec(file.type);\n if (match) {\n type = match[1]; // The first part in the MIME, \"image\" in image/png\n } else {\n type = file.type;\n }\n\n /*\n // Show local video files, http://jsfiddle.net/dsbonev/cCCZ2/embedded/result,js,html,css/\n var URL = window.URL || window.webkitURL\n var file = this.files[0]\n var type = file.type\n var videoNode = document.createElement('video');\n var canPlay = videoNode.canPlayType(type) // can use also for 'audio' types\n if (canPlay === '') canPlay = 'no'\n var message = 'Can play type \"' + type + '\": ' + canPlay\n var isError = canPlay === 'no'\n displayMessage(message, isError)\n if (isError) {\n return\n }\n var fileURL = URL.createObjectURL(file)\n videoNode.src = fileURL\n */\n\n /*\n // Show local video files, http://jsfiddle.net/dsbonev/cCCZ2/embedded/result,js,html,css/\n var URL = window.URL || window.webkitURL\n var file = this.files[0]\n var type = file.type\n var videoNode = document.createElement('video');\n var canPlay = videoNode.canPlayType(type) // can use also for 'audio' types\n if (canPlay === '') canPlay = 'no'\n var message = 'Can play type \"' + type + '\": ' + canPlay\n var isError = canPlay === 'no'\n displayMessage(message, isError)\n if (isError) {\n return\n }\n var fileURL = URL.createObjectURL(file)\n videoNode.src = fileURL\n */\n\n // If it's an image, try to find its size\n if (type === 'image') {\n var data = {\n src: reader.result,\n name: name,\n type: type,\n height: 0,\n width: 0\n };\n\n var image = new Image();\n image.addEventListener('error', function (error) {\n reject(error);\n });\n image.addEventListener('load', function () {\n data.height = image.height;\n data.width = image.width;\n resolve(data);\n });\n image.src = data.src;\n } else if (type) {\n // Not an image, but has a type\n resolve({\n src: reader.result,\n name: name,\n type: type\n });\n } else {\n // No type found, resolve with the URL only\n resolve(reader.result);\n }\n });\n reader.addEventListener('error', function (error) {\n reject(error);\n });\n reader.addEventListener('abort', function (error) {\n reject('Aborted');\n });\n\n reader.readAsDataURL(file);\n });\n\n promises.push(promise);\n };\n\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n for (var _iterator = files[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var file = _step.value;\n\n _loop(file);\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator.return) {\n _iterator.return();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n\n Promise.all(promises).then(function (data) {\n response.data = data;\n _this3.onUploadResponse(response, clb);\n }, function (error) {\n _this3.onUploadError(error);\n });\n }\n});\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0), __webpack_require__(1)))\n\n/***/ }),\n/* 46 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(_) {\n\nvar _Styleable = __webpack_require__(47);\n\nvar _Styleable2 = _interopRequireDefault(_Styleable);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar Backbone = __webpack_require__(0);\nvar Selectors = __webpack_require__(10);\n\nmodule.exports = Backbone.Model.extend(_Styleable2.default).extend({\n defaults: {\n // Css selectors\n selectors: {},\n\n // Additional string css selectors\n selectorsAdd: '',\n\n // Css properties style\n style: {},\n\n // On which device width this rule should be rendered, eg. @media (max-width: 1000px)\n mediaText: '',\n\n // State of the rule, eg: hover | pressed | focused\n state: '',\n\n // Indicates if the rule is stylable\n stylable: true,\n\n // Type of at-rule, eg. 'media', 'font-face', etc.\n atRuleType: '',\n\n // This particolar property is used only on at-rules, like 'page' or\n // 'font-face', where the block containes only style declarations\n singleAtRule: 0,\n\n // If true, sets '!important' on all properties\n // You can use an array to specify properties to set important\n // Used in view\n important: 0\n },\n\n initialize: function initialize(c) {\n var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n this.config = c || {};\n var em = opt.em;\n var selectors = this.config.selectors || [];\n this.em = em;\n\n if (em) {\n var sm = em.get('SelectorManager');\n var slct = [];\n selectors.forEach(function (selector) {\n slct.push(sm.add(selector));\n });\n selectors = slct;\n }\n\n this.set('selectors', new Selectors(selectors));\n },\n\n\n /**\n * Returns an at-rule statement if possible, eg. '@media (...)', '@keyframes'\n * @return {string}\n */\n getAtRule: function getAtRule() {\n var type = this.get('atRuleType');\n var condition = this.get('mediaText');\n // Avoid breaks with the last condition\n var typeStr = type ? '@' + type : condition ? '@media' : '';\n\n return typeStr + (condition && typeStr ? ' ' + condition : '');\n },\n\n\n /**\n * Return selectors fo the rule as a string\n * @return {string}\n */\n selectorsToString: function selectorsToString() {\n var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n var result = [];\n var state = this.get('state');\n var addSelector = this.get('selectorsAdd');\n var selectors = this.get('selectors').getFullString();\n var stateStr = state ? ':' + state : '';\n selectors && result.push('' + selectors + stateStr);\n addSelector && !opts.skipAdd && result.push(addSelector);\n return result.join(', ');\n },\n\n\n /**\n * Get declaration block\n * @param {Object} [opts={}] Options\n * @return {string}\n */\n getDeclaration: function getDeclaration() {\n var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n var result = '';\n var selectors = this.selectorsToString();\n var style = this.styleToString(opts);\n var singleAtRule = this.get('singleAtRule');\n\n if ((selectors || singleAtRule) && style) {\n result = singleAtRule ? style : selectors + '{' + style + '}';\n }\n\n return result;\n },\n\n\n /**\n * Returns CSS string of the rule\n * @param {Object} [opts={}] Options\n * @return {string}\n */\n toCSS: function toCSS() {\n var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n var result = '';\n var atRule = this.getAtRule();\n var block = this.getDeclaration(opts);\n block && (result = block);\n\n if (atRule && result) {\n result = atRule + '{' + result + '}';\n }\n\n return result;\n },\n\n\n /**\n * Compare the actual model with parameters\n * @param {Object} selectors Collection of selectors\n * @param {String} state Css rule state\n * @param {String} width For which device this style is oriented\n * @param {Object} ruleProps Other rule props\n * @return {Boolean}\n * @private\n */\n compare: function compare(selectors, state, width) {\n var ruleProps = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};\n\n var st = state || '';\n var wd = width || '';\n var selectorsAdd = ruleProps.selectorsAdd || '';\n var atRuleType = ruleProps.atRuleType || '';\n var cId = 'cid';\n //var a1 = _.pluck(selectors.models || selectors, cId);\n //var a2 = _.pluck(this.get('selectors').models, cId);\n if (!(selectors instanceof Array) && !selectors.models) selectors = [selectors];\n var a1 = _.map(selectors.models || selectors, function (model) {\n return model.get('name');\n });\n var a2 = _.map(this.get('selectors').models, function (model) {\n return model.get('name');\n });\n var f = false;\n\n if (a1.length !== a2.length) return f;\n\n for (var i = 0; i < a1.length; i++) {\n var re = 0;\n for (var j = 0; j < a2.length; j++) {\n if (a1[i] === a2[j]) re = 1;\n }\n if (re === 0) return f;\n }\n\n if (this.get('state') !== st || this.get('mediaText') !== wd || this.get('selectorsAdd') !== selectorsAdd || this.get('atRuleType') !== atRuleType) {\n return f;\n }\n\n return true;\n }\n});\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))\n\n/***/ }),\n/* 47 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar _underscore = __webpack_require__(1);\n\nvar _mixins = __webpack_require__(2);\n\nvar _ParserHtml = __webpack_require__(25);\n\nvar _ParserHtml2 = _interopRequireDefault(_ParserHtml);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nvar parseStyle = (0, _ParserHtml2.default)().parseStyle;\nexports.default = {\n parseStyle: parseStyle,\n\n /**\n * To trigger the style change event on models I have to\n * pass a new object instance\n * @param {Object} prop\n * @return {Object}\n */\n extendStyle: function extendStyle(prop) {\n return _extends({}, this.getStyle(), prop);\n },\n\n\n /**\n * Get style object\n * @return {Object}\n */\n getStyle: function getStyle() {\n return _extends({}, this.get('style'));\n },\n\n\n /**\n * Set new style object\n * @param {Object|string} prop\n * @param {Object} opts\n * @return {Object} Applied properties\n */\n setStyle: function setStyle() {\n var _this = this;\n\n var prop = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n if ((0, _underscore.isString)(prop)) {\n prop = parseStyle(prop);\n }\n\n var propOrig = this.getStyle();\n var propNew = _extends({}, prop);\n this.set('style', propNew, opts);\n var diff = (0, _mixins.shallowDiff)(propOrig, propNew);\n (0, _underscore.keys)(diff).forEach(function (pr) {\n return _this.trigger('change:style:' + pr);\n });\n\n return propNew;\n },\n\n\n /**\n * Add style property\n * @param {Object|string} prop\n * @param {string} value\n * @example\n * this.addStyle({color: 'red'});\n * this.addStyle('color', 'blue');\n */\n addStyle: function addStyle(prop) {\n var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';\n var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n if (typeof prop == 'string') {\n prop = {\n prop: value\n };\n } else {\n opts = value || {};\n }\n\n prop = this.extendStyle(prop);\n this.setStyle(prop, opts);\n },\n\n\n /**\n * Remove style property\n * @param {string} prop\n */\n removeStyle: function removeStyle(prop) {\n var style = this.getStyle();\n delete style[prop];\n this.setStyle(style);\n },\n\n\n /**\n * Returns string of style properties\n * @param {Object} [opts={}] Options\n * @return {String}\n */\n styleToString: function styleToString() {\n var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n var result = [];\n var style = this.getStyle();\n\n for (var prop in style) {\n var imp = opts.important;\n var important = (0, _underscore.isArray)(imp) ? imp.indexOf(prop) >= 0 : imp;\n var value = '' + style[prop] + (important ? ' !important' : '');\n result.push(prop + ':' + value + ';');\n }\n\n return result.join('');\n }\n};\n\n/***/ }),\n/* 48 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = __webpack_require__(0).View.extend({\n tagName: 'style',\n\n initialize: function initialize() {\n var o = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n this.config = o.config || {};\n var model = this.model;\n var toTrack = 'change:style change:state change:mediaText';\n this.listenTo(model, toTrack, this.render);\n this.listenTo(model, 'destroy remove', this.remove);\n this.listenTo(model.get('selectors'), 'change', this.render);\n },\n render: function render() {\n var model = this.model;\n var important = model.get('important');\n this.el.innerHTML = this.model.toCSS({ important: important });\n return this;\n }\n});\n\n/***/ }),\n/* 49 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar Backbone = __webpack_require__(0);\n\nmodule.exports = Backbone.View.extend({\n // Default view\n itemView: '',\n\n // Defines the View per type\n itemsView: '',\n\n itemType: 'type',\n\n initialize: function initialize(opts, config) {\n this.config = config || {};\n },\n\n\n /**\n * Add new model to the collection\n * @param {Model} model\n * @private\n * */\n addTo: function addTo(model) {\n this.add(model);\n },\n\n\n /**\n * Render new model inside the view\n * @param {Model} model\n * @param {Object} fragment Fragment collection\n * @private\n * */\n add: function add(model, fragment) {\n var frag = fragment || null;\n var itemView = this.itemView;\n var typeField = model.get(this.itemType);\n if (this.itemsView && this.itemsView[typeField]) {\n itemView = this.itemsView[typeField];\n }\n var view = new itemView({\n model: model,\n config: this.config\n }, this.config);\n var rendered = view.render().el;\n\n if (frag) frag.appendChild(rendered);else this.$el.append(rendered);\n },\n render: function render() {\n var frag = document.createDocumentFragment();\n this.$el.empty();\n\n if (this.collection.length) this.collection.each(function (model) {\n this.add(model, frag);\n }, this);\n\n this.$el.append(frag);\n return this;\n }\n});\n\n/***/ }),\n/* 50 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _underscore = __webpack_require__(1);\n\nvar Backbone = __webpack_require__(0);\n\nmodule.exports = Backbone.Collection.extend({\n initialize: function initialize(models) {\n var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n this.listenTo(this, 'add', this.onAdd);\n this.config = opt.config;\n this.em = opt.em;\n\n this.model = function (attrs, options) {\n var model;\n var df = opt.componentTypes;\n options.em = opt.em;\n options.config = opt.config;\n options.componentTypes = df;\n\n for (var it = 0; it < df.length; it++) {\n var dfId = df[it].id;\n if (dfId == attrs.type) {\n model = df[it].model;\n break;\n }\n }\n\n if (!model) {\n // get the last one\n model = df[df.length - 1].model;\n }\n\n return new model(attrs, options);\n };\n },\n add: function add(models) {\n var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n if (typeof models === 'string') {\n var parsed = this.em.get('Parser').parseHtml(models);\n models = parsed.html;\n\n var cssc = this.em.get('CssComposer');\n\n if (parsed.css && cssc) {\n var avoidUpdateStyle = opt.avoidUpdateStyle;\n\n var added = cssc.addCollection(parsed.css, {\n extend: 1,\n avoidUpdateStyle: avoidUpdateStyle\n });\n }\n }\n\n return Backbone.Collection.prototype.add.apply(this, [models, opt]);\n },\n onAdd: function onAdd(model, c, opts) {\n var em = this.em;\n var style = model.getStyle();\n var avoidInline = em && em.getConfig('avoidInlineStyle');\n\n if (!(0, _underscore.isEmpty)(style) && !avoidInline && em && em.get && em.getConfig('forceClass')) {\n var name = model.cid;\n var rule = em.get('CssComposer').setClassRule(name, style);\n model.setStyle({});\n model.addClass(name);\n }\n }\n});\n\n/***/ }),\n/* 51 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Backbone) {\n\nvar _underscore = __webpack_require__(1);\n\nmodule.exports = Backbone.View.extend({\n initialize: function initialize(o) {\n this.opts = o || {};\n this.config = o.config || {};\n var coll = this.collection;\n this.listenTo(coll, 'add', this.addTo);\n this.listenTo(coll, 'reset', this.resetChildren);\n },\n\n\n /**\n * Add to collection\n * @param {Object} Model\n *\n * @return void\n * @private\n * */\n addTo: function addTo(model) {\n var em = this.config.em;\n var i = this.collection.indexOf(model);\n this.addToCollection(model, null, i);\n\n if (em && !model.opt.temporary) {\n em.trigger('add:component', model); // @deprecated\n em.trigger('component:add', model);\n }\n },\n\n\n /**\n * Add new object to collection\n * @param {Object} Model\n * @param {Object} Fragment collection\n * @param {Integer} Index of append\n *\n * @return {Object} Object rendered\n * @private\n * */\n addToCollection: function addToCollection(model, fragmentEl, index) {\n if (!this.compView) this.compView = __webpack_require__(3);\n var fragment = fragmentEl || null,\n viewObject = this.compView;\n\n var dt = this.opts.componentTypes;\n\n var type = model.get('type');\n\n for (var it = 0; it < dt.length; it++) {\n var dtId = dt[it].id;\n if (dtId == type) {\n viewObject = dt[it].view;\n break;\n }\n }\n //viewObject = dt[type] ? dt[type].view : dt.default.view;\n\n var view = new viewObject({\n model: model,\n config: this.config,\n componentTypes: dt\n });\n var rendered = view.render().el;\n if (view.model.get('type') == 'textnode') rendered = document.createTextNode(view.model.get('content'));\n\n if (fragment) {\n fragment.appendChild(rendered);\n } else {\n var parent = this.parentEl;\n var children = parent.childNodes;\n\n if (!(0, _underscore.isUndefined)(index)) {\n var lastIndex = children.length == index;\n\n // If the added model is the last of collection\n // need to change the logic of append\n if (lastIndex) {\n index--;\n }\n\n // In case the added is new in the collection index will be -1\n if (lastIndex || !children.length) {\n parent.appendChild(rendered);\n } else {\n parent.insertBefore(rendered, children[index]);\n }\n } else {\n parent.appendChild(rendered);\n }\n }\n\n return rendered;\n },\n resetChildren: function resetChildren() {\n var _this = this;\n\n this.parentEl.innerHTML = '';\n this.collection.each(function (model) {\n return _this.addToCollection(model);\n });\n },\n render: function render(parent) {\n var _this2 = this;\n\n var el = this.el;\n var frag = document.createDocumentFragment();\n this.parentEl = parent || this.el;\n this.collection.each(function (model) {\n return _this2.addToCollection(model, frag);\n });\n el.innerHTML = '';\n el.appendChild(frag);\n return this;\n }\n});\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))\n\n/***/ }),\n/* 52 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar Component = __webpack_require__(4);\n\nmodule.exports = Component.extend({\n defaults: _extends({}, Component.prototype.defaults, {\n type: 'text',\n droppable: false,\n editable: true\n })\n});\n\n/***/ }),\n/* 53 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _mixins = __webpack_require__(2);\n\nvar ComponentView = __webpack_require__(3);\n\nmodule.exports = ComponentView.extend({\n events: {\n dblclick: 'enableEditing'\n },\n\n initialize: function initialize(o) {\n ComponentView.prototype.initialize.apply(this, arguments);\n this.disableEditing = this.disableEditing.bind(this);\n var model = this.model;\n var em = this.em;\n this.listenTo(model, 'focus active', this.enableEditing);\n this.listenTo(model, 'change:content', this.updateContent);\n this.rte = em && em.get('RichTextEditor');\n },\n\n\n /**\n * Enable element content editing\n * @private\n * */\n enableEditing: function enableEditing() {\n var rte = this.rte;\n\n if (this.rteEnabled || !this.model.get('editable')) {\n return;\n }\n\n if (rte) {\n try {\n this.activeRte = rte.enable(this, this.activeRte);\n } catch (err) {\n console.error(err);\n }\n }\n\n this.rteEnabled = 1;\n this.toggleEvents(1);\n },\n\n\n /**\n * Disable element content editing\n * @private\n * */\n disableEditing: function disableEditing() {\n var model = this.model;\n var editable = model.get('editable');\n var rte = this.rte;\n\n if (rte && editable) {\n try {\n rte.disable(this, this.activeRte);\n } catch (err) {\n console.error(err);\n }\n\n var content = this.getChildrenContainer().innerHTML;\n var comps = model.get('components');\n comps.length && comps.reset();\n model.set('content', '');\n\n // If there is a custom RTE the content is just baked staticly\n // inside 'content'\n if (rte.customRte) {\n // Avoid double content by removing its children components\n // and force to trigger change\n model.set('content', content);\n } else {\n var clean = function clean(model) {\n model.set({\n editable: 0,\n highlightable: 0,\n removable: 0,\n draggable: 0,\n copyable: 0,\n toolbar: ''\n });\n model.get('components').each(function (model) {\n return clean(model);\n });\n };\n\n // Avoid re-render on reset with silent option\n model.trigger('change:content', model);\n comps.add(content);\n comps.each(function (model) {\n return clean(model);\n });\n comps.trigger('resetNavigator');\n }\n }\n\n this.rteEnabled = 0;\n this.toggleEvents();\n },\n\n\n /**\n * Isolate disable propagation method\n * @param {Event}\n * @private\n * */\n disablePropagation: function disablePropagation(e) {\n e.stopPropagation();\n },\n\n\n /**\n * Enable/Disable events\n * @param {Boolean} enable\n */\n toggleEvents: function toggleEvents(enable) {\n var method = enable ? 'on' : 'off';\n var mixins = { on: _mixins.on, off: _mixins.off };\n\n // The ownerDocument is from the frame\n var elDocs = [this.el.ownerDocument, document];\n mixins.off(elDocs, 'mousedown', this.disableEditing);\n mixins[method](elDocs, 'mousedown', this.disableEditing);\n\n // Avoid closing edit mode on component click\n this.$el.off('mousedown', this.disablePropagation);\n this.$el[method]('mousedown', this.disablePropagation);\n }\n});\n\n/***/ }),\n/* 54 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Backbone) {\n\nvar $ = Backbone.$;\n\nmodule.exports = {\n /**\n * Start select position event\n * @param {HTMLElement} trg\n * @private\n * */\n startSelectPosition: function startSelectPosition(trg, doc) {\n this.isPointed = false;\n var utils = this.editorModel.get('Utils');\n if (utils && !this.sorter) this.sorter = new utils.Sorter({\n container: this.getCanvasBody(),\n placer: this.canvas.getPlacerEl(),\n containerSel: '*',\n itemSel: '*',\n pfx: this.ppfx,\n direction: 'a',\n document: doc,\n wmargin: 1,\n nested: 1,\n em: this.editorModel,\n canvasRelative: 1\n });\n this.sorter.startSort(trg);\n },\n\n\n /**\n * Get frame position\n * @return {Object}\n * @private\n */\n getOffsetDim: function getOffsetDim() {\n var frameOff = this.offset(this.canvas.getFrameEl());\n var canvasOff = this.offset(this.canvas.getElement());\n var top = frameOff.top - canvasOff.top;\n var left = frameOff.left - canvasOff.left;\n return { top: top, left: left };\n },\n\n\n /**\n * Stop select position event\n * @private\n * */\n stopSelectPosition: function stopSelectPosition() {\n this.posTargetCollection = null;\n this.posIndex = this.posMethod == 'after' && this.cDim.length !== 0 ? this.posIndex + 1 : this.posIndex; //Normalize\n if (this.sorter) {\n this.sorter.moved = 0;\n this.sorter.endMove();\n }\n if (this.cDim) {\n this.posIsLastEl = this.cDim.length !== 0 && this.posMethod == 'after' && this.posIndex == this.cDim.length;\n this.posTargetEl = this.cDim.length === 0 ? $(this.outsideElem) : !this.posIsLastEl && this.cDim[this.posIndex] ? $(this.cDim[this.posIndex][5]).parent() : $(this.outsideElem);\n this.posTargetModel = this.posTargetEl.data('model');\n this.posTargetCollection = this.posTargetEl.data('model-comp');\n }\n },\n\n\n /**\n * Enabel select position\n * @private\n */\n enable: function enable() {\n this.startSelectPosition();\n },\n\n\n /**\n * Check if the pointer is near to the float component\n * @param {number} index\n * @param {string} method\n * @param {Array<Array>} dims\n * @return {Boolean}\n * @private\n * */\n nearFloat: function nearFloat(index, method, dims) {\n var i = index || 0;\n var m = method || 'before';\n var len = dims.length;\n var isLast = len !== 0 && m == 'after' && i == len;\n if (len !== 0 && (!isLast && !dims[i][4] || dims[i - 1] && !dims[i - 1][4] || isLast && !dims[i - 1][4])) return 1;\n return 0;\n },\n run: function run() {\n this.enable();\n },\n stop: function stop() {\n this.stopSelectPosition();\n this.$wrapper.css('cursor', '');\n this.$wrapper.unbind();\n }\n};\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))\n\n/***/ }),\n/* 55 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(_) {\n\nvar Backbone = __webpack_require__(0);\nvar CreateComponent = __webpack_require__(22);\n\nmodule.exports = _.extend({}, CreateComponent, {\n init: function init() {\n for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n CreateComponent.init.apply(this, args);\n _.bindAll(this, 'insertComponent');\n this.allowDraw = 0;\n },\n\n\n /**\n * Run method\n * @private\n * */\n run: function run(em, sender, options) {\n this.em = em;\n this.sender = sender;\n this.opt = options || {};\n this.$wr = this.$wrapper;\n this.enable();\n },\n enable: function enable() {\n for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n\n CreateComponent.enable.apply(this, args);\n this.$wr.on('click', this.insertComponent);\n },\n\n\n /**\n * Start insert event\n * @private\n * */\n insertComponent: function insertComponent() {\n this.$wr.off('click', this.insertComponent);\n this.stopSelectPosition();\n var object = this.buildContent();\n this.beforeInsert(object);\n var index = this.sorter.lastPos.index;\n // By default, collections do not trigger add event, so silent is used\n var model = this.create(this.sorter.target, object, index, null, {\n silent: false\n });\n\n if (this.opt.terminateAfterInsert && this.sender) this.sender.set('active', false);else this.enable();\n\n if (!model) return;\n\n this.afterInsert(model, this);\n },\n\n\n /**\n * Trigger before insert\n * @param {Object} obj\n * @private\n * */\n beforeInsert: function beforeInsert(obj) {},\n\n\n /**\n * Trigger after insert\n * @param {Object} model Model created after insert\n * @private\n * */\n afterInsert: function afterInsert(model) {},\n\n\n /**\n * Create different object, based on content, to insert inside canvas\n *\n * @return {Object}\n * @private\n * */\n buildContent: function buildContent() {\n return this.opt.content || {};\n }\n});\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))\n\n/***/ }),\n/* 56 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _underscore = __webpack_require__(1);\n\nvar ComponentView = __webpack_require__(3);\nvar ItemsView = void 0;\n\nmodule.exports = __webpack_require__(0).View.extend({\n events: {\n 'mousedown [data-toggle-move]': 'startSort',\n 'click [data-toggle-visible]': 'toggleVisibility',\n 'click [data-toggle-select]': 'handleSelect',\n 'click [data-toggle-open]': 'toggleOpening',\n 'dblclick input': 'handleEdit',\n 'focusout input': 'handleEditEnd'\n },\n\n template: function template(model) {\n var pfx = this.pfx;\n var ppfx = this.ppfx;\n var hidable = this.config.hidable;\n var count = this.countChildren(model);\n var addClass = !count ? pfx + 'no-chld' : '';\n var level = this.level + 1;\n return '\\n ' + (hidable ? '<i id=\"' + pfx + 'btn-eye\" class=\"' + pfx + 'btn fa fa-eye ' + (this.isVisible() ? '' : 'fa-eye-slash') + '\" data-toggle-visible></i>' : '') + '\\n\\n <div class=\"' + pfx + 'title-c ' + ppfx + 'one-bg\">\\n <div class=\"' + pfx + 'title ' + addClass + '\" style=\"padding-left: ' + (30 + level * 10) + 'px\" data-toggle-select>\\n <div class=\"' + pfx + 'title-inn\">\\n <i id=\"' + pfx + 'caret\" class=\"fa fa-chevron-right ' + this.caretCls + '\" data-toggle-open></i>\\n ' + model.getIcon() + '\\n <input class=\"' + ppfx + 'no-app ' + this.inputNameCls + '\" value=\"' + model.getName() + '\" readonly>\\n </div>\\n </div>\\n </div>\\n <div id=\"' + pfx + 'counter\">' + (count ? count : '') + '</div>\\n <div id=\"' + pfx + 'move\" data-toggle-move>\\n <i class=\"fa fa-arrows\"></i>\\n </div>\\n <div class=\"' + pfx + 'children\"></div>\\n ';\n },\n initialize: function initialize() {\n var o = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n this.opt = o;\n this.level = o.level;\n this.config = o.config;\n this.em = o.config.em;\n this.ppfx = this.em.get('Config').stylePrefix;\n this.sorter = o.sorter || '';\n this.pfx = this.config.stylePrefix;\n var pfx = this.pfx;\n var ppfx = this.ppfx;\n var model = this.model;\n var components = model.get('components');\n model.set('open', false);\n this.listenTo(components, 'remove add change reset', this.checkChildren);\n this.listenTo(model, 'destroy remove', this.remove);\n this.listenTo(model, 'change:status', this.updateStatus);\n this.listenTo(model, 'change:open', this.updateOpening);\n this.listenTo(model, 'change:style:display', this.updateVisibility);\n this.className = pfx + 'item no-select';\n this.editBtnCls = pfx + 'nav-item-edit';\n this.inputNameCls = ppfx + 'nav-comp-name';\n this.caretCls = ppfx + 'nav-item-caret';\n this.titleCls = pfx + 'title';\n this.$el.data('model', model);\n this.$el.data('collection', components);\n },\n getVisibilityEl: function getVisibilityEl() {\n if (!this.eyeEl) {\n this.eyeEl = this.$el.children('#' + this.pfx + 'btn-eye');\n }\n\n return this.eyeEl;\n },\n updateVisibility: function updateVisibility() {\n var pfx = this.pfx;\n var model = this.model;\n var hClass = pfx + 'hide';\n var hideIcon = 'fa-eye-slash';\n var hidden = model.getStyle().display == 'none';\n var method = hidden ? 'addClass' : 'removeClass';\n this.$el[method](hClass);\n this.getVisibilityEl()[method](hideIcon);\n },\n\n\n /**\n * Toggle visibility\n * @param\tEvent\n *\n * @return \tvoid\n * */\n toggleVisibility: function toggleVisibility(e) {\n e && e.stopPropagation();\n var model = this.model;\n var style = model.getStyle();\n var hidden = style.display == 'none';\n\n if (hidden) {\n delete style.display;\n } else {\n style.display = 'none';\n }\n\n model.setStyle(style);\n },\n\n\n /**\n * Handle the edit of the component name\n */\n handleEdit: function handleEdit(e) {\n e.stopPropagation();\n var inputName = this.getInputName();\n inputName.readOnly = false;\n inputName.focus();\n },\n\n\n /**\n * Handle with the end of editing of the component name\n */\n handleEditEnd: function handleEditEnd(e) {\n e.stopPropagation();\n var inputName = this.getInputName();\n inputName.readOnly = true;\n this.model.set('custom-name', inputName.value);\n },\n\n\n /**\n * Get the input containing the name of the component\n * @return {HTMLElement}\n */\n getInputName: function getInputName() {\n if (!this.inputName) {\n this.inputName = this.el.querySelector('.' + this.inputNameCls);\n }\n return this.inputName;\n },\n\n\n /**\n * Update item opening\n *\n * @return void\n * */\n updateOpening: function updateOpening() {\n var opened = this.opt.opened || {};\n var model = this.model;\n var chvDown = 'fa-chevron-down';\n\n if (model.get('open')) {\n this.$el.addClass('open');\n this.getCaret().addClass(chvDown);\n opened[model.cid] = model;\n } else {\n this.$el.removeClass('open');\n this.getCaret().removeClass(chvDown);\n delete opened[model.cid];\n }\n },\n\n\n /**\n * Toggle item opening\n * @param {Object}\te\n *\n * @return void\n * */\n toggleOpening: function toggleOpening(e) {\n e.stopPropagation();\n\n if (!this.model.get('components').length) return;\n\n this.model.set('open', !this.model.get('open'));\n },\n\n\n /**\n * Handle component selection\n */\n handleSelect: function handleSelect(e) {\n e.stopPropagation();\n this.em && this.em.setSelected(this.model, { fromLayers: 1 });\n },\n\n\n /**\n * Delegate to sorter\n * @param\tEvent\n * */\n startSort: function startSort(e) {\n e.stopPropagation();\n\n //Right or middel click\n if (e.button !== 0) {\n return;\n }\n\n this.sorter && this.sorter.startSort(e.target);\n },\n\n\n /**\n * Freeze item\n * @return\tvoid\n * */\n freeze: function freeze() {\n this.$el.addClass(this.pfx + 'opac50');\n this.model.set('open', 0);\n },\n\n\n /**\n * Unfreeze item\n * @return\tvoid\n * */\n unfreeze: function unfreeze() {\n this.$el.removeClass(this.pfx + 'opac50');\n },\n\n\n /**\n * Update item on status change\n * @param\tEvent\n * */\n updateStatus: function updateStatus(e) {\n ComponentView.prototype.updateStatus.apply(this, arguments);\n },\n\n\n /**\n * Check if component is visible\n *\n * @return bool\n * */\n isVisible: function isVisible() {\n var css = this.model.get('style'),\n pr = css.display;\n if (pr && pr == 'none') return;\n return 1;\n },\n\n\n /**\n * Update item aspect after children changes\n *\n * @return void\n * */\n checkChildren: function checkChildren() {\n var model = this.model;\n var c = this.countChildren(model);\n var pfx = this.pfx;\n var noChildCls = pfx + 'no-chld';\n var title = this.$el.children('.' + pfx + 'title-c').children('.' + pfx + 'title');\n //tC = `> .${pfx}title-c > .${pfx}title`;\n if (!this.$counter) {\n this.$counter = this.$el.children('#' + pfx + 'counter');\n }\n\n if (c) {\n title.removeClass(noChildCls);\n this.$counter.html(c);\n } else {\n title.addClass(noChildCls);\n this.$counter.empty();\n model.set('open', 0);\n }\n },\n\n\n /**\n * Count children inside model\n * @param {Object} model\n * @return {number}\n * @private\n */\n countChildren: function countChildren(model) {\n var count = 0;\n model.get('components').each(function (m) {\n var isCountable = this.opt.isCountable;\n var hide = this.config.hideTextnode;\n if (isCountable && !isCountable(m, hide)) return;\n count++;\n }, this);\n return count;\n },\n getCaret: function getCaret() {\n if (!this.caret) {\n var pfx = this.pfx;\n this.caret = this.$el.children('.' + pfx + 'title-c').find('#' + pfx + 'caret');\n }\n\n return this.caret;\n },\n render: function render() {\n var model = this.model;\n var pfx = this.pfx;\n var vis = this.isVisible();\n var el = this.$el;\n var level = this.level + 1;\n el.html(this.template(model));\n\n if ((0, _underscore.isUndefined)(ItemsView)) {\n ItemsView = __webpack_require__(57);\n }\n\n var children = new ItemsView({\n collection: model.get('components'),\n config: this.config,\n sorter: this.sorter,\n opened: this.opt.opened,\n parent: model,\n level: level\n }).render().$el;\n el.find('.' + pfx + 'children').append(children);\n\n if (!model.get('draggable') || !this.config.sortable) {\n el.children('#' + pfx + 'move').remove();\n }\n\n !vis && (this.className += ' ' + pfx + 'hide');\n el.attr('class', this.className);\n this.updateOpening();\n this.updateStatus();\n this.updateVisibility();\n return this;\n }\n});\n\n/***/ }),\n/* 57 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar Backbone = __webpack_require__(0);\nvar ItemView = __webpack_require__(56);\n\nmodule.exports = Backbone.View.extend({\n initialize: function initialize() {\n var o = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n this.opt = o;\n var config = o.config || {};\n this.level = o.level;\n this.config = config;\n this.preview = o.preview;\n this.ppfx = config.pStylePrefix || '';\n this.pfx = config.stylePrefix || '';\n this.parent = o.parent;\n this.listenTo(this.collection, 'add', this.addTo);\n this.listenTo(this.collection, 'reset resetNavigator', this.render);\n this.className = this.pfx + 'items';\n\n if (config.sortable && !this.opt.sorter) {\n var pfx = this.pfx;\n var utils = config.em.get('Utils');\n this.opt.sorter = new utils.Sorter({\n container: config.sortContainer || this.el,\n containerSel: '.' + pfx + 'items',\n itemSel: '.' + pfx + 'item',\n ppfx: this.ppfx,\n ignoreViewChildren: 1,\n avoidSelectOnEnd: 1,\n pfx: pfx,\n nested: 1\n });\n }\n\n this.sorter = this.opt.sorter || '';\n\n // For the sorter\n this.$el.data('collection', this.collection);\n\n if (this.parent) {\n this.$el.data('model', this.parent);\n }\n },\n\n\n /**\n * Add to collection\n * @param Object Model\n *\n * @return Object\n * */\n addTo: function addTo(model) {\n var i = this.collection.indexOf(model);\n this.addToCollection(model, null, i);\n },\n\n\n /**\n * Add new object to collection\n * @param Object Model\n * @param Object Fragment collection\n * @param integer Index of append\n *\n * @return Object Object created\n * */\n addToCollection: function addToCollection(model, fragmentEl, index) {\n var level = this.level;\n var fragment = fragmentEl || null;\n var viewObject = ItemView;\n\n if (!this.isCountable(model, this.config.hideTextnode)) {\n return;\n }\n\n var view = new viewObject({\n level: level,\n model: model,\n config: this.config,\n sorter: this.sorter,\n isCountable: this.isCountable,\n opened: this.opt.opened\n });\n var rendered = view.render().el;\n\n if (fragment) {\n fragment.appendChild(rendered);\n } else {\n if (typeof index != 'undefined') {\n var method = 'before';\n // If the added model is the last of collection\n // need to change the logic of append\n if (this.$el.children().length == index) {\n index--;\n method = 'after';\n }\n // In case the added is new in the collection index will be -1\n if (index < 0) {\n this.$el.append(rendered);\n } else this.$el.children().eq(index)[method](rendered);\n } else this.$el.append(rendered);\n }\n\n return rendered;\n },\n\n\n /**\n * Check if the model could be count by the navigator\n * @param {Object} model\n * @return {Boolean}\n * @private\n */\n isCountable: function isCountable(model, hide) {\n var type = model.get('type');\n var tag = model.get('tagName');\n if ((type == 'textnode' || tag == 'br') && hide || !model.get('layerable')) {\n return false;\n }\n return true;\n },\n render: function render() {\n var _this = this;\n\n var frag = document.createDocumentFragment();\n this.el.innerHTML = '';\n this.collection.each(function (model) {\n return _this.addToCollection(model, frag);\n });\n this.el.appendChild(frag);\n this.$el.attr('class', this.className);\n return this;\n }\n});\n\n/***/ }),\n/* 58 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar Backbone = __webpack_require__(0);\n\nmodule.exports = Backbone.Model.extend({\n defaults: {\n id: '',\n label: '',\n open: true,\n attributes: {}\n }\n});\n\n/***/ }),\n/* 59 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar _cashDom = __webpack_require__(9);\n\nvar _cashDom2 = _interopRequireDefault(_cashDom);\n\nvar _editor = __webpack_require__(60);\n\nvar _editor2 = _interopRequireDefault(_editor);\n\nvar _plugin_manager = __webpack_require__(219);\n\nvar _plugin_manager2 = _interopRequireDefault(_plugin_manager);\n\nvar _polyfills = __webpack_require__(221);\n\nvar _polyfills2 = _interopRequireDefault(_polyfills);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n(0, _polyfills2.default)();\n\nmodule.exports = function () {\n var plugins = new _plugin_manager2.default();\n var editors = [];\n var defaultConfig = {\n // If true renders editor on init\n autorender: 1,\n\n // Array of plugins to init\n plugins: [],\n\n // Custom options for plugins\n pluginsOpts: {}\n };\n\n return {\n $: _cashDom2.default,\n\n editors: editors,\n\n plugins: plugins,\n\n // Will be replaced on build\n version: '0.13.8',\n\n /**\n * Initializes an editor based on passed options\n * @param {Object} config Configuration object\n * @param {string|HTMLElement} config.container Selector which indicates where render the editor\n * @param {Boolean} [config.autorender=true] If true, auto-render the content\n * @param {Array} [config.plugins=[]] Array of plugins to execute on start\n * @param {Object} [config.pluginsOpts={}] Custom options for plugins\n * @return {Editor} Editor instance\n * @example\n * var editor = grapesjs.init({\n * container: '#myeditor',\n * components: '<article class=\"hello\">Hello world</article>',\n * style: '.hello{color: red}',\n * })\n */\n init: function init() {\n var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n var els = config.container;\n if (!els) throw new Error(\"'container' is required\");\n config = _extends({}, defaultConfig, config);\n var ilEl = els instanceof window.HTMLElement;\n config.el = ilEl ? els : document.querySelector(els);\n var editor = new _editor2.default(config).init();\n\n // Load plugins\n config.plugins.forEach(function (pluginId) {\n var plugin = plugins.get(pluginId);\n\n if (plugin) {\n plugin(editor, config.pluginsOpts[pluginId] || {});\n } else {\n console.warn('Plugin ' + pluginId + ' not found');\n }\n });\n\n // Execute `onLoad` on modules once all plugins are initialized.\n // A plugin might have extended/added some custom type so this\n // is a good point to load stuff like components, css rules, etc.\n editor.getModel().loadOnStart();\n config.autorender && editor.render();\n editors.push(editor);\n\n return editor;\n }\n };\n}();\n\n/***/ }),\n/* 60 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _cashDom = __webpack_require__(9);\n\nvar _cashDom2 = _interopRequireDefault(_cashDom);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nmodule.exports = function (config) {\n var c = config || {},\n defaults = __webpack_require__(61),\n EditorModel = __webpack_require__(62),\n EditorView = __webpack_require__(218);\n\n for (var name in defaults) {\n if (!(name in c)) c[name] = defaults[name];\n }\n\n c.pStylePrefix = c.stylePrefix;\n var em = new EditorModel(c);\n var editorView = new EditorView({\n model: em,\n config: c\n });\n\n return {\n $: _cashDom2.default,\n\n /**\n * @property {EditorModel}\n * @private\n */\n editor: em,\n\n /**\n * @property {DomComponents}\n * @private\n */\n DomComponents: em.get('DomComponents'),\n\n /**\n * @property {CssComposer}\n * @private\n */\n CssComposer: em.get('CssComposer'),\n\n /**\n * @property {StorageManager}\n * @private\n */\n StorageManager: em.get('StorageManager'),\n\n /**\n * @property {AssetManager}\n */\n AssetManager: em.get('AssetManager'),\n\n /**\n * @property {BlockManager}\n * @private\n */\n BlockManager: em.get('BlockManager'),\n\n /**\n * @property {TraitManager}\n * @private\n */\n TraitManager: em.get('TraitManager'),\n\n /**\n * @property {SelectorManager}\n * @private\n */\n SelectorManager: em.get('SelectorManager'),\n\n /**\n * @property {CodeManager}\n * @private\n */\n CodeManager: em.get('CodeManager'),\n\n /**\n * @property {Commands}\n * @private\n */\n Commands: em.get('Commands'),\n\n /**\n * @property {Keymaps}\n * @private\n */\n Keymaps: em.get('Keymaps'),\n\n /**\n * @property {Modal}\n * @private\n */\n Modal: em.get('Modal'),\n\n /**\n * @property {Panels}\n * @private\n */\n Panels: em.get('Panels'),\n\n /**\n * @property {StyleManager}\n * @private\n */\n StyleManager: em.get('StyleManager'),\n\n /**\n * @property {Canvas}\n * @private\n */\n Canvas: em.get('Canvas'),\n\n /**\n * @property {UndoManager}\n * @private\n */\n UndoManager: em.get('UndoManager'),\n\n /**\n * @property {DeviceManager}\n * @private\n */\n DeviceManager: em.get('DeviceManager'),\n\n /**\n * @property {RichTextEditor}\n * @private\n */\n RichTextEditor: em.get('RichTextEditor'),\n\n /**\n * @property {Utils}\n * @private\n */\n Utils: em.get('Utils'),\n\n /**\n * @property {Utils}\n * @private\n */\n Config: em.get('Config'),\n\n /**\n * Initialize editor model\n * @return {this}\n * @private\n */\n init: function init() {\n em.init(this);\n return this;\n },\n\n\n /**\n * Returns configuration object\n * @param {string} [prop] Property name\n * @return {any} Returns the configuration object or\n * the value of the specified property\n */\n getConfig: function getConfig(prop) {\n return em.getConfig(prop);\n },\n\n\n /**\n * Returns HTML built inside canvas\n * @return {string} HTML string\n */\n getHtml: function getHtml(opts) {\n return em.getHtml(opts);\n },\n\n\n /**\n * Returns CSS built inside canvas\n * @param {Object} [opts={}] Options\n * @return {string} CSS string\n */\n getCss: function getCss(opts) {\n return em.getCss(opts);\n },\n\n\n /**\n * Returns JS of all components\n * @return {string} JS string\n */\n getJs: function getJs() {\n return em.getJs();\n },\n\n\n /**\n * Returns components in JSON format object\n * @return {Object}\n */\n getComponents: function getComponents() {\n return em.get('DomComponents').getComponents();\n },\n\n\n /**\n * Set components inside editor's canvas. This method overrides actual components\n * @param {Array<Object>|Object|string} components HTML string or components model\n * @return {this}\n * @example\n * editor.setComponents('<div class=\"cls\">New component</div>');\n * // or\n * editor.setComponents({\n * type: 'text',\n * classes:['cls'],\n * content: 'New component'\n * });\n */\n setComponents: function setComponents(components) {\n em.setComponents(components);\n return this;\n },\n\n\n /**\n * Add components\n * @param {Array<Object>|Object|string} components HTML string or components model\n * @param {Object} opts Options\n * @param {Boolean} [opts.avoidUpdateStyle=false] If the HTML string contains styles,\n * by default, they will be created and, if already exist, updated. When this option\n * is true, styles already created will not be updated.\n * @return {Model|Array<Model>}\n * @example\n * editor.addComponents('<div class=\"cls\">New component</div>');\n * // or\n * editor.addComponents({\n * type: 'text',\n * classes:['cls'],\n * content: 'New component'\n * });\n */\n addComponents: function addComponents(components, opts) {\n return this.getComponents().add(components, opts);\n },\n\n\n /**\n * Returns style in JSON format object\n * @return {Object}\n */\n getStyle: function getStyle() {\n return em.get('CssComposer').getAll();\n },\n\n\n /**\n * Set style inside editor's canvas. This method overrides actual style\n * @param {Array<Object>|Object|string} style CSS string or style model\n * @return {this}\n * @example\n * editor.setStyle('.cls{color: red}');\n * //or\n * editor.setStyle({\n * selectors: ['cls']\n * style: { color: 'red' }\n * });\n */\n setStyle: function setStyle(style) {\n em.setStyle(style);\n return this;\n },\n\n\n /**\n * Returns selected component, if there is one\n * @return {Model}\n */\n getSelected: function getSelected() {\n return em.getSelected();\n },\n\n\n /**\n * Get a stylable entity from the selected component.\n * If you select a component without classes the entity is the Component\n * itself and all changes will go inside its 'style' attribute. Otherwise,\n * if the selected component has one or more classes, the function will\n * return the corresponding CSS Rule\n * @return {Model}\n */\n getSelectedToStyle: function getSelectedToStyle() {\n var selected = em.getSelected();\n\n if (selected) {\n return this.StyleManager.getModelToStyle(selected);\n }\n },\n\n\n /**\n * Select a component\n * @param {Component|HTMLElement} el Component to select\n * @return {this}\n * @example\n * // Select dropped block\n * editor.on('block:drag:stop', function(model) {\n * editor.select(model);\n * });\n */\n select: function select(el) {\n em.setSelected(el);\n return this;\n },\n\n\n /**\n * Set device to the editor. If the device exists it will\n * change the canvas to the proper width\n * @param {string} name Name of the device\n * @return {this}\n * @example\n * editor.setDevice('Tablet');\n */\n setDevice: function setDevice(name) {\n em.set('device', name);\n return this;\n },\n\n\n /**\n * Return the actual active device\n * @return {string} Device name\n * @example\n * var device = editor.getDevice();\n * console.log(device);\n * // 'Tablet'\n */\n getDevice: function getDevice() {\n return em.get('device');\n },\n\n\n /**\n * Execute command\n * @param {string} id Command ID\n * @param {Object} options Custom options\n * @return {*} The return is defined by the command\n * @example\n * editor.runCommand('myCommand', {someValue: 1});\n */\n runCommand: function runCommand(id, options) {\n var result;\n var command = em.get('Commands').get(id);\n\n if (command) {\n result = command.run(this, this, options);\n this.trigger('run:' + id);\n }\n return result;\n },\n\n\n /**\n * Stop the command if stop method was provided\n * @param {string} id Command ID\n * @param {Object} options Custom options\n * @return {*} The return is defined by the command\n * @example\n * editor.stopCommand('myCommand', {someValue: 1});\n */\n stopCommand: function stopCommand(id, options) {\n var result;\n var command = em.get('Commands').get(id);\n\n if (command) {\n result = command.stop(this, this, options);\n this.trigger('stop:' + id);\n }\n return result;\n },\n\n\n /**\n * Store data to the current storage\n * @param {Function} clb Callback function\n * @return {Object} Stored data\n */\n store: function store(clb) {\n return em.store(clb);\n },\n\n\n /**\n * Load data from the current storage\n * @param {Function} clb Callback function\n * @return {Object} Stored data\n */\n load: function load(clb) {\n return em.load(clb);\n },\n\n\n /**\n * Returns container element. The one which was indicated as 'container'\n * on init method\n * @return {HTMLElement}\n */\n getContainer: function getContainer() {\n return c.el;\n },\n\n\n /**\n * Update editor dimensions and refresh data useful for positioning of tools\n *\n * This method could be useful when you update, for example, some position\n * of the editor element (eg. canvas, panels, etc.) with CSS, where without\n * refresh you'll get misleading position of tools (eg. rich text editor,\n * component highlighter, etc.)\n *\n * @private\n */\n refresh: function refresh() {\n em.refreshCanvas();\n },\n\n\n /**\n * Replace the built-in Rich Text Editor with a custom one.\n * @param {Object} obj Custom RTE Interface\n * @example\n * editor.setCustomRte({\n * // Function for enabling custom RTE\n * // el is the HTMLElement of the double clicked Text Component\n * // rte is the same instance you have returned the first time you call\n * // enable(). This is useful if need to check if the RTE is already enabled so\n * // ion this case you'll need to return the RTE and the end of the function\n * enable: function(el, rte) {\n * rte = new MyCustomRte(el, {}); // this depends on the Custom RTE API\n * ...\n * return rte; // return the RTE instance\n * },\n *\n * // Disable the editor, called for example when you unfocus the Text Component\n * disable: function(el, rte) {\n * rte.blur(); // this depends on the Custom RTE API\n * }\n *\n * // Called when the Text Component is focused again. If you returned the RTE instance\n * // from the enable function, the enable won't be called again instead will call focus,\n * // in this case to avoid double binding of the editor\n * focus: function (el, rte) {\n * rte.focus(); // this depends on the Custom RTE API\n * }\n * });\n */\n setCustomRte: function setCustomRte(obj) {\n this.RichTextEditor.customRte = obj;\n },\n\n\n /**\n * Attach event\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @return {this}\n */\n on: function on(event, callback) {\n return em.on(event, callback);\n },\n\n\n /**\n * Detach event\n * @param {string} event Event name\n * @param {Function} callback Callback function\n * @return {this}\n */\n off: function off(event, callback) {\n return em.off(event, callback);\n },\n\n\n /**\n * Trigger event\n * @param {string} event Event to trigger\n * @return {this}\n */\n trigger: function trigger(event) {\n return em.trigger.apply(em, arguments);\n },\n\n\n /**\n * Returns editor element\n * @return {HTMLElement}\n * @private\n */\n getEl: function getEl() {\n return editorView.el;\n },\n\n\n /**\n * Returns editor model\n * @return {Model}\n * @private\n */\n getModel: function getModel() {\n return em;\n },\n\n\n /**\n * Render editor\n * @return {HTMLElement}\n */\n render: function render() {\n var _this = this;\n\n // Do post render stuff after the iframe is loaded otherwise it'll\n // be empty during tests\n em.on('loaded', function () {\n _this.UndoManager.clear();\n em.get('modules').forEach(function (module) {\n module.postRender && module.postRender(editorView);\n });\n });\n\n editorView.render();\n return editorView.el;\n }\n };\n}; /**\n * Editor class contains the top level API which you'll probably use to custom the editor or extend it with plugins.\n * You get the Editor instance on init method\n *\n * ```js\n * var editor = grapesjs.init({...});\n * ```\n *\n * # Available Events\n *\n * ## Components\n * * `component:add` - Triggered when a new component is added to the editor, the model is passed as an argument to the callback\n * * `component:remove` - Triggered when a component is removed, the model is passed as an argument to the callback\n * * `component:clone` - Triggered when a new component is added by a clone command, the model is passed as an argument to the callback\n * * `component:update` - Triggered when a component is updated (moved, styled, etc.), the model is passed as an argument to the callback\n * * `component:update:{propertyName}` - Listen any property change, the model is passed as an argument to the callback\n * * `component:styleUpdate` - Triggered when the style of the component is updated, the model is passed as an argument to the callback\n * * `component:styleUpdate:{propertyName}` - Listen for a specific style property change, the model is passed as an argument to the callback\n * * `component:selected` - New component selected, the selected model is passed as an argument to the callback\n * ## Blocks\n * * `block:add` - New block added\n * * `block:remove` - Block removed\n * * `block:drag:start` - Started dragging new block, Event object is passed as an argument\n * * `block:drag:stop` - Block dropped inside canvas, the new model is passed as an argument to the callback\n * ## Assets\n * * `asset:add` - New asset added\n * * `asset:remove` - Asset removed\n * * `asset:upload:start` - Before the upload is started\n * * `asset:upload:end` - After the upload is ended\n * * `asset:upload:error` - On any error in upload, passes the error as an argument\n * * `asset:upload:response` - On upload response, passes the result as an argument\n * ## Keymaps\n * * `keymap:add` - New keymap added. The new keyamp object is passed as an argument\n * * `keymap:remove` - Keymap removed. The removed keyamp object is passed as an argument\n * * `keymap:emit` - Some keymap emitted, in arguments you get keymapId, shortcutUsed, Event\n * * `keymap:emit:{keymapId}` - `keymapId` emitted, in arguments you get keymapId, shortcutUsed, Event\n * ## Style Manager\n * * `styleManager:change` - Triggered on style property change from new selected component, the view of the property is passed as an argument to the callback\n * * `styleManager:change:{propertyName}` - As above but for a specific style property\n * ## Storages\n * * `storage:start` - Before the storage request is started\n * * `storage:load` - Triggered when something was loaded from the storage, loaded object passed as an argumnet\n * * `storage:store` - Triggered when something is stored to the storage, stored object passed as an argumnet\n * * `storage:end` - After the storage request is ended\n * * `storage:error` - On any error on storage request, passes the error as an argument\n * ## Canvas\n * * `canvas:dragenter` - When something is dragged inside the canvas, `DataTransfer` instance passed as an argument\n * * `canvas:dragover` - When something is dragging on canvas, `DataTransfer` instance passed as an argument\n * * `canvas:drop` - Something is dropped in canvas, `DataTransfer` instance and the dropped model are passed as arguments\n * * `canvas:dragend` - When a drag operation is ended, `DataTransfer` instance passed as an argument\n * * `canvas:dragdata` - On any dataTransfer parse, `DataTransfer` instance and the `result` are passed as arguments.\n * By changing `result.content` you're able to customize what is dropped\n * ## Selectors\n * * `selector:add` - Triggers when a new selector/class is created\n * ## RTE\n * * `rte:enable` - RTE enabled. The view, on which RTE is enabled, is passed as an argument\n * * `rte:disable` - RTE disabled. The view, on which RTE is disabled, is passed as an argument\n * ## Commands\n * * `run:{commandName}` - Triggered when some command is called to run (eg. editor.runCommand('preview'))\n * * `stop:{commandName}` - Triggered when some command is called to stop (eg. editor.stopCommand('preview'))\n * ## General\n * * `canvasScroll` - Triggered when the canvas is scrolle\n * * `undo` - Undo executed\n * * `redo` - Redo executed\n * * `load` - When the editor is loaded\n *\n * @param {Object} config Configurations\n * @param {string} config.container='' Selector for the editor container, eg. '#myEditor'\n * @param {string|Array<Object>} [config.components=''] HTML string or object of components\n * @param {string|Array<Object>} [config.style=''] CSS string or object of rules\n * @param {Boolean} [config.fromElement=false] If true, will fetch HTML and CSS from selected container\n * @param {Boolean} [config.undoManager=true] Enable/Disable undo manager\n * @param {Boolean} [config.autorender=true] If true renders editor on init\n * @param {Boolean} [config.noticeOnUnload=true] Enable/Disable alert message before unload the page\n * @param {string} [config.height='900px'] Height for the editor container\n * @param {string} [config.width='100%'] Width for the editor container\n * @param {Object} [config.storage={}] Storage manager configuration, see the relative documentation\n * @param {Object} [config.styleManager={}] Style manager configuration, see the relative documentation\n * @param {Object} [config.commands={}] Commands configuration, see the relative documentation\n * @param {Object} [config.domComponents={}] Components configuration, see the relative documentation\n * @param {Object} [config.panels={}] Panels configuration, see the relative documentation\n * @param {Object} [config.showDevices=true] If true render a select of available devices inside style manager panel\n * @param {string} [config.defaultCommand='select-comp'] Command to execute when no other command is running\n * @param {Array} [config.plugins=[]] Array of plugins to execute on start\n * @param {Object} [config.pluginsOpts={}] Custom options for plugins\n * @example\n * var editor = grapesjs.init({\n * container : '#gjs',\n * components: '<div class=\"txt-red\">Hello world!</div>',\n * style: '.txt-red{color: red}',\n * });\n */\n\n/***/ }),\n/* 61 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = {\n // Style prefix\n stylePrefix: 'gjs-',\n\n // HTML string or object of components\n components: '',\n\n // CSS string or object of rules\n style: '',\n\n // If true, will fetch HTML and CSS from selected container\n fromElement: 0,\n\n // Show an alert before unload the page with unsaved changes\n noticeOnUnload: true,\n\n // Show paddings and margins\n showOffsets: false,\n\n // Show paddings and margins on selected component\n showOffsetsSelected: false,\n\n // On creation of a new Component (via object), if the 'style' attribute is not\n // empty, all those roles will be moved in its new class\n forceClass: true,\n\n // Height for the editor container\n height: '900px',\n\n // Width for the editor container\n width: '100%',\n\n // CSS that could only be seen (for instance, inside the code viewer)\n protectedCss: '* { box-sizing: border-box; } body {margin: 0;}',\n\n // CSS for the iframe which containing the canvas, useful if you need to custom something inside\n // (eg. the style of the selected component)\n canvasCss: '',\n\n // Default command\n defaultCommand: 'select-comp',\n\n // Show a toolbar when the component is selected\n showToolbar: 1,\n\n // Allow script tag importing\n allowScripts: 0,\n\n // If true render a select of available devices\n showDevices: 1,\n\n // When enabled, on device change media rules won't be created\n devicePreviewMode: 0,\n\n // THe condition to use for media queries, eg. 'max-width'\n // Comes handy for mobile-first cases\n mediaCondition: 'max-width',\n\n // Starting tag for variable inside scripts in Components\n tagVarStart: '{[ ',\n\n // Ending tag for variable inside scripts in Components\n tagVarEnd: ' ]}',\n\n // Return JS of components inside HTML from 'editor.getHtml()'\n jsInHtml: true,\n\n // Enable native HTML5 drag and drop\n nativeDnD: 1,\n\n // Show the wrapper component in the final code, eg. in editor.getHtml()\n exportWrapper: 0,\n\n // The wrapper, if visible, will be shown as a `<body>`\n wrappesIsBody: 1,\n\n // Usually when you update the `style` of the component this changes the\n // element's `style` attribute. Unfortunately, inline styling doesn't allow\n // use of media queries (@media) or even pseudo selectors (eg. :hover).\n // When `avoidInlineStyle` is true all styles are inserted inside the css rule\n avoidInlineStyle: 0,\n\n // (experimental)\n // The structure of components is always on the screen but it's not the same\n // for style rules. When you delete a component you might leave a lot of styles\n // which will never be used again, therefore they might be removed.\n // With this option set to true, styles not used from the CSS generator (so in\n // any case where `CssGenerator.build` is used) will be removed automatically.\n // But be careful, not always leaving the style not used mean you wouldn't\n // use it later, but this option comes really handy when deal with big templates.\n clearStyles: 0,\n\n // Dom element\n el: '',\n\n // Configurations for Undo Manager\n undoManager: {},\n\n //Configurations for Asset Manager\n assetManager: {},\n\n //Configurations for Canvas\n canvas: {},\n\n //Configurations for Layers\n layers: {},\n\n //Configurations for Storage Manager\n storageManager: {},\n\n //Configurations for Rich Text Editor\n rte: {},\n\n //Configurations for DomComponents\n domComponents: {},\n\n //Configurations for Modal Dialog\n modal: {},\n\n //Configurations for Code Manager\n codeManager: {},\n\n //Configurations for Panels\n panels: {},\n\n //Configurations for Commands\n commands: {},\n\n //Configurations for Css Composer\n cssComposer: {},\n\n //Configurations for Selector Manager\n selectorManager: {},\n\n //Configurations for Device Manager\n deviceManager: {\n devices: [{\n name: 'Desktop',\n width: ''\n }, {\n name: 'Tablet',\n width: '768px',\n widthMedia: '992px'\n }, {\n name: 'Mobile landscape',\n width: '568px',\n widthMedia: '768px'\n }, {\n name: 'Mobile portrait',\n width: '320px',\n widthMedia: '480px'\n }]\n },\n\n //Configurations for Style Manager\n styleManager: {\n sectors: [{\n name: 'General',\n open: false,\n buildProps: ['float', 'display', 'position', 'top', 'right', 'left', 'bottom']\n }, {\n name: 'Dimension',\n open: false,\n buildProps: ['width', 'height', 'max-width', 'min-height', 'margin', 'padding']\n }, {\n name: 'Typography',\n open: false,\n buildProps: ['font-family', 'font-size', 'font-weight', 'letter-spacing', 'color', 'line-height', 'text-align', 'text-shadow'],\n properties: [{\n property: 'text-align',\n list: [{ value: 'left', className: 'fa fa-align-left' }, { value: 'center', className: 'fa fa-align-center' }, { value: 'right', className: 'fa fa-align-right' }, { value: 'justify', className: 'fa fa-align-justify' }]\n }]\n }, {\n name: 'Decorations',\n open: false,\n buildProps: ['border-radius-c', 'background-color', 'border-radius', 'border', 'box-shadow', 'background']\n }, {\n name: 'Extra',\n open: false,\n buildProps: ['transition', 'perspective', 'transform']\n }]\n },\n\n //Configurations for Block Manager\n blockManager: {},\n\n // Texts\n\n textViewCode: 'Code'\n};\n\n/***/ }),\n/* 62 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar _underscore = __webpack_require__(1);\n\nvar deps = [__webpack_require__(63), __webpack_require__(67), __webpack_require__(68), __webpack_require__(71), __webpack_require__(79), __webpack_require__(84), __webpack_require__(87), __webpack_require__(91), __webpack_require__(95), __webpack_require__(107), __webpack_require__(113), __webpack_require__(31), __webpack_require__(130), __webpack_require__(136), __webpack_require__(141), __webpack_require__(148), __webpack_require__(176), __webpack_require__(183), __webpack_require__(209)];\n\nvar Backbone = __webpack_require__(0);\nvar timedInterval = void 0;\n\n__webpack_require__(217)({\n Backbone: Backbone,\n $: Backbone.$\n});\n\nvar $ = Backbone.$;\n\nmodule.exports = Backbone.Model.extend({\n defaults: {\n clipboard: null,\n designerMode: false,\n selectedComponent: null,\n previousModel: null,\n changesCount: 0,\n storables: [],\n modules: [],\n toLoad: [],\n opened: {},\n device: ''\n },\n\n initialize: function initialize() {\n var _this = this;\n\n var c = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n this.config = c;\n this.set('Config', c);\n this.set('modules', []);\n this.set('toLoad', []);\n\n if (c.el && c.fromElement) this.config.components = c.el.innerHTML;\n\n // Load modules\n deps.forEach(function (name) {\n return _this.loadModule(name);\n });\n this.on('change:selectedComponent', this.componentSelected, this);\n this.on('change:changesCount', this.updateChanges, this);\n },\n\n\n /**\n * Get configurations\n * @param {string} [prop] Property name\n * @return {any} Returns the configuration object or\n * the value of the specified property\n */\n getConfig: function getConfig(prop) {\n var config = this.config;\n return (0, _underscore.isUndefined)(prop) ? config : config[prop];\n },\n\n\n /**\n * Should be called after all modules and plugins are loaded\n * @param {Function} clb\n * @private\n */\n loadOnStart: function loadOnStart() {\n var _this2 = this;\n\n var clb = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n\n var sm = this.get('StorageManager');\n\n // Generally, with `onLoad`, the module will try to load the data from\n // its configurations\n this.get('toLoad').forEach(function (module) {\n module.onLoad();\n });\n\n // Stuff to do post load\n var postLoad = function postLoad() {\n var modules = _this2.get('modules');\n modules.forEach(function (module) {\n return module.postLoad && module.postLoad(_this2);\n });\n clb && clb();\n };\n\n if (sm && sm.getConfig().autoload) {\n this.load(postLoad);\n } else {\n postLoad();\n }\n },\n\n\n /**\n * Set the alert before unload in case it's requested\n * and there are unsaved changes\n * @private\n */\n updateChanges: function updateChanges() {\n var stm = this.get('StorageManager');\n var changes = this.get('changesCount');\n\n if (this.config.noticeOnUnload && changes) {\n window.onbeforeunload = function (e) {\n return 1;\n };\n } else {\n window.onbeforeunload = null;\n }\n\n if (stm.isAutosave() && changes >= stm.getStepsBeforeSave()) {\n this.store();\n }\n },\n\n\n /**\n * Load generic module\n * @param {String} moduleName Module name\n * @return {this}\n * @private\n */\n loadModule: function loadModule(moduleName) {\n var c = this.config;\n var Mod = new moduleName();\n var name = Mod.name.charAt(0).toLowerCase() + Mod.name.slice(1);\n var cfg = c[name] || c[Mod.name] || {};\n cfg.pStylePrefix = c.pStylePrefix || '';\n\n // Check if module is storable\n var sm = this.get('StorageManager');\n\n if (Mod.storageKey && Mod.store && Mod.load && sm) {\n cfg.stm = sm;\n var storables = this.get('storables');\n storables.push(Mod);\n this.set('storables', storables);\n }\n\n cfg.em = this;\n Mod.init(_extends({}, cfg));\n\n // Bind the module to the editor model if public\n !Mod.private && this.set(Mod.name, Mod);\n Mod.onLoad && this.get('toLoad').push(Mod);\n this.get('modules').push(Mod);\n return this;\n },\n\n\n /**\n * Initialize editor model and set editor instance\n * @param {Editor} editor Editor instance\n * @return {this}\n * @private\n */\n init: function init(editor) {\n this.set('Editor', editor);\n },\n getEditor: function getEditor() {\n return this.get('Editor');\n },\n\n\n /**\n * This method handles updates on the editor and tries to store them\n * if requested and if the changesCount is exceeded\n * @param {Object} model\n * @param {any} val Value\n * @param {Object} opt Options\n * @private\n * */\n handleUpdates: function handleUpdates(model, val) {\n var _this3 = this;\n\n var opt = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n // Component has been added temporarily - do not update storage or record changes\n if (opt.temporary) {\n return;\n }\n\n timedInterval && clearInterval(timedInterval);\n timedInterval = setTimeout(function () {\n if (!opt.avoidStore) {\n _this3.set('changesCount', _this3.get('changesCount') + 1, opt);\n }\n }, 0);\n },\n\n\n /**\n * Callback on component selection\n * @param {Object} Model\n * @param {Mixed} New value\n * @param {Object} Options\n * @private\n * */\n componentSelected: function componentSelected(model, val, options) {\n if (!this.get('selectedComponent')) {\n this.trigger('deselect-comp');\n } else {\n this.trigger('select-comp', [model, val, options]);\n this.trigger('component:selected', arguments);\n }\n },\n\n\n /**\n * Returns model of the selected component\n * @return {Component|null}\n * @private\n */\n getSelected: function getSelected() {\n return this.get('selectedComponent');\n },\n\n\n /**\n * Select a component\n * @param {Component|HTMLElement} el Component to select\n * @param {Object} opts Options, optional\n * @private\n */\n setSelected: function setSelected(el) {\n var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n var model = el;\n\n if (el instanceof window.HTMLElement) {\n model = $(el).data('model');\n }\n\n if (model && !model.get('selectable')) {\n return;\n }\n\n this.set('selectedComponent', model, opts);\n },\n\n\n /**\n * Set components inside editor's canvas. This method overrides actual components\n * @param {Object|string} components HTML string or components model\n * @return {this}\n * @private\n */\n setComponents: function setComponents(components) {\n return this.get('DomComponents').setComponents(components);\n },\n\n\n /**\n * Returns components model from the editor's canvas\n * @return {Components}\n * @private\n */\n getComponents: function getComponents() {\n var cmp = this.get('DomComponents');\n var cm = this.get('CodeManager');\n\n if (!cmp || !cm) return;\n\n var wrp = cmp.getComponents();\n return cm.getCode(wrp, 'json');\n },\n\n\n /**\n * Set style inside editor's canvas. This method overrides actual style\n * @param {Object|string} style CSS string or style model\n * @return {this}\n * @private\n */\n setStyle: function setStyle(style) {\n var rules = this.get('CssComposer').getAll();\n for (var i = 0, len = rules.length; i < len; i++) {\n rules.pop();\n }rules.add(style);\n return this;\n },\n\n\n /**\n * Returns rules/style model from the editor's canvas\n * @return {Rules}\n * @private\n */\n getStyle: function getStyle() {\n return this.get('CssComposer').getAll();\n },\n\n\n /**\n * Returns HTML built inside canvas\n * @return {string} HTML string\n * @private\n */\n getHtml: function getHtml() {\n var config = this.config;\n var exportWrapper = config.exportWrapper;\n var wrappesIsBody = config.wrappesIsBody;\n var js = config.jsInHtml ? this.getJs() : '';\n var wrp = this.get('DomComponents').getComponent();\n var html = this.get('CodeManager').getCode(wrp, 'html', {\n exportWrapper: exportWrapper,\n wrappesIsBody: wrappesIsBody\n });\n html += js ? '<script>' + js + '</script>' : '';\n return html;\n },\n\n\n /**\n * Returns CSS built inside canvas\n * @param {Object} [opts={}] Options\n * @return {string} CSS string\n * @private\n */\n getCss: function getCss() {\n var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n var config = this.config;\n var wrappesIsBody = config.wrappesIsBody;\n var avoidProt = opts.avoidProtected;\n var cssc = this.get('CssComposer');\n var wrp = this.get('DomComponents').getComponent();\n var protCss = !avoidProt ? config.protectedCss : '';\n\n return protCss + this.get('CodeManager').getCode(wrp, 'css', {\n cssc: cssc,\n wrappesIsBody: wrappesIsBody\n });\n },\n\n\n /**\n * Returns JS of all components\n * @return {string} JS string\n * @private\n */\n getJs: function getJs() {\n var wrp = this.get('DomComponents').getWrapper();\n return this.get('CodeManager').getCode(wrp, 'js').trim();\n },\n\n\n /**\n * Store data to the current storage\n * @param {Function} clb Callback function\n * @return {Object} Stored data\n * @private\n */\n store: function store(clb) {\n var _this4 = this;\n\n var sm = this.get('StorageManager');\n var store = {};\n if (!sm) return;\n\n // Fetch what to store\n this.get('storables').forEach(function (m) {\n var obj = m.store(1);\n for (var el in obj) {\n store[el] = obj[el];\n }\n });\n\n sm.store(store, function () {\n clb && clb();\n _this4.set('changesCount', 0);\n _this4.trigger('storage:store', store);\n });\n\n return store;\n },\n\n\n /**\n * Load data from the current storage\n * @param {Function} clb Callback function\n * @private\n */\n load: function load() {\n var _this5 = this;\n\n var clb = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null;\n\n this.getCacheLoad(1, function (res) {\n _this5.get('storables').forEach(function (module) {\n return module.load(res);\n });\n clb && clb(res);\n });\n },\n\n\n /**\n * Returns cached load\n * @param {Boolean} force Force to reload\n * @param {Function} clb Callback function\n * @return {Object}\n * @private\n */\n getCacheLoad: function getCacheLoad(force, clb) {\n var _this6 = this;\n\n var f = force ? 1 : 0;\n if (this.cacheLoad && !f) return this.cacheLoad;\n var sm = this.get('StorageManager');\n var load = [];\n\n if (!sm) return {};\n\n this.get('storables').forEach(function (m) {\n var key = m.storageKey;\n key = typeof key === 'function' ? key() : key;\n var keys = key instanceof Array ? key : [key];\n keys.forEach(function (k) {\n load.push(k);\n });\n });\n\n sm.load(load, function (res) {\n _this6.cacheLoad = res;\n clb && clb(res);\n _this6.trigger('storage:load', res);\n });\n },\n\n\n /**\n * Returns device model by name\n * @return {Device|null}\n * @private\n */\n getDeviceModel: function getDeviceModel() {\n var name = this.get('device');\n return this.get('DeviceManager').get(name);\n },\n\n\n /**\n * Run default command if setted\n * @param {Object} [opts={}] Options\n * @private\n */\n runDefault: function runDefault() {\n var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n var command = this.get('Commands').get(this.config.defaultCommand);\n if (!command || this.defaultRunning) return;\n command.stop(this, this, opts);\n command.run(this, this, opts);\n this.defaultRunning = 1;\n },\n\n\n /**\n * Stop default command\n * @param {Object} [opts={}] Options\n * @private\n */\n stopDefault: function stopDefault() {\n var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n var command = this.get('Commands').get(this.config.defaultCommand);\n if (!command) return;\n command.stop(this, this, opts);\n this.defaultRunning = 0;\n },\n\n\n /**\n * Update canvas dimensions and refresh data useful for tools positioning\n * @private\n */\n refreshCanvas: function refreshCanvas() {\n this.set('canvasOffset', this.get('Canvas').getOffset());\n },\n\n\n /**\n * Clear all selected stuf inside the window, sometimes is useful to call before\n * doing some dragging opearation\n * @param {Window} win If not passed the current one will be used\n * @private\n */\n clearSelection: function clearSelection(win) {\n var w = win || window;\n w.getSelection().removeAllRanges();\n },\n\n\n /**\n * Get the current media text\n * @return {string}\n */\n getCurrentMedia: function getCurrentMedia() {\n var config = this.config;\n var device = this.getDeviceModel();\n var condition = config.mediaCondition;\n var preview = config.devicePreviewMode;\n var width = device && device.get('widthMedia');\n return device && width && !preview ? '(' + condition + ': ' + width + ')' : '';\n },\n\n\n /**\n * Set/get data from the HTMLElement\n * @param {HTMLElement} el\n * @param {string} name Data name\n * @param {any} value Date value\n * @return {any}\n * @private\n */\n data: function data(el, name, value) {\n var varName = '_gjs-data';\n\n if (!el[varName]) {\n el[varName] = {};\n }\n\n if ((0, _underscore.isUndefined)(value)) {\n return el[varName][name];\n } else {\n el[varName][name] = value;\n }\n }\n});\n\n/***/ }),\n/* 63 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = function () {\n var Sorter = __webpack_require__(64);\n var Resizer = __webpack_require__(65);\n var Dragger = __webpack_require__(66);\n\n return {\n /**\n * Name of the module\n * @type {String}\n * @private\n */\n name: 'Utils',\n\n /**\n * Initialize module\n */\n init: function init() {\n return this;\n },\n\n\n Sorter: Sorter,\n Resizer: Resizer,\n Dragger: Dragger\n };\n};\n\n/***/ }),\n/* 64 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Backbone, _) {\n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar _underscore = __webpack_require__(1);\n\nvar _mixins = __webpack_require__(2);\n\nvar $ = Backbone.$;\n\nmodule.exports = Backbone.View.extend({\n initialize: function initialize(opt) {\n this.opt = opt || {};\n _.bindAll(this, 'startSort', 'onMove', 'endMove', 'rollback', 'udpateOffset', 'moveDragHelper');\n var o = opt || {};\n this.elT = 0;\n this.elL = 0;\n this.borderOffset = o.borderOffset || 10;\n\n var el = o.container;\n this.el = typeof el === 'string' ? document.querySelector(el) : el;\n this.$el = $(this.el);\n\n this.containerSel = o.containerSel || 'div';\n this.itemSel = o.itemSel || 'div';\n this.draggable = o.draggable || true;\n this.nested = o.nested || 0;\n this.pfx = o.pfx || '';\n this.ppfx = o.ppfx || '';\n this.freezeClass = o.freezeClass || this.pfx + 'freezed';\n this.onStart = o.onStart || '';\n this.onEndMove = o.onEndMove || '';\n this.direction = o.direction || 'v'; // v (vertical), h (horizontal), a (auto)\n this.onMoveClb = o.onMove || '';\n this.relative = o.relative || 0;\n this.ignoreViewChildren = o.ignoreViewChildren || 0;\n this.ignoreModels = o.ignoreModels || 0;\n this.plh = o.placer || '';\n // Frame offset\n this.wmargin = o.wmargin || 0;\n this.offTop = o.offsetTop || 0;\n this.offLeft = o.offsetLeft || 0;\n this.document = o.document || document;\n this.$document = $(this.document);\n this.dropContent = null;\n this.em = o.em || '';\n this.dragHelper = null;\n this.canvasRelative = o.canvasRelative || 0;\n this.selectOnEnd = !o.avoidSelectOnEnd;\n\n if (this.em && this.em.on) {\n this.em.on('change:canvasOffset', this.udpateOffset);\n this.udpateOffset();\n }\n },\n getContainerEl: function getContainerEl() {\n if (!this.el) {\n var el = this.opt.container;\n this.el = typeof el === 'string' ? document.querySelector(el) : el;\n this.$el = $(this.el);\n }\n return this.el;\n },\n getDocuments: function getDocuments() {\n var em = this.em;\n var canvasDoc = em && em.get('Canvas').getBody().ownerDocument;\n var docs = [document];\n canvasDoc && docs.push(canvasDoc);\n return docs;\n },\n\n\n /**\n * Triggered when the offset of the editro is changed\n */\n udpateOffset: function udpateOffset() {\n var offset = this.em.get('canvasOffset');\n this.offTop = offset.top;\n this.offLeft = offset.left;\n },\n\n\n /**\n * Set content to drop\n * @param {String|Object} content\n */\n setDropContent: function setDropContent(content) {\n this.dropContent = content;\n },\n\n\n /**\n * Toggle cursor while sorting\n * @param {Boolean} active\n */\n toggleSortCursor: function toggleSortCursor(active) {\n var em = this.em;\n var body = document.body;\n var pfx = this.ppfx || this.pfx;\n var sortCls = pfx + 'grabbing';\n var emBody = em ? em.get('Canvas').getBody() : '';\n\n // Avoid updating body className as it causes a huge repaint\n // Noticeable with \"fast\" drag of blocks\n if (active) {\n em && em.get('Canvas').startAutoscroll();\n //body.className += ' ' + sortCls;\n //if (em) emBody.className += ' ' + sortCls;\n } else {\n em && em.get('Canvas').stopAutoscroll();\n //body.className = body.className.replace(sortCls, '').trim();\n //if(em) emBody.className = emBody.className.replace(sortCls, '').trim();\n }\n },\n\n\n /**\n * Set drag helper\n * @param {HTMLElement} el\n * @param {Event} event\n */\n setDragHelper: function setDragHelper(el, event) {\n var ev = event || '';\n var clonedEl = el.cloneNode(1);\n var rect = el.getBoundingClientRect();\n var computed = getComputedStyle(el);\n var style = '';\n\n for (var i = 0; i < computed.length; i++) {\n var prop = computed[i];\n style += prop + ':' + computed.getPropertyValue(prop) + ';';\n }\n\n document.body.appendChild(clonedEl);\n clonedEl.className += ' ' + this.pfx + 'bdrag';\n clonedEl.setAttribute('style', style);\n this.dragHelper = clonedEl;\n clonedEl.style.width = rect.width + 'px';\n clonedEl.style.height = rect.height + 'px';\n ev && this.moveDragHelper(ev);\n\n // Listen mouse move events\n if (this.em) {\n $(this.em.get('Canvas').getBody().ownerDocument).off('mousemove', this.moveDragHelper).on('mousemove', this.moveDragHelper);\n }\n $(document).off('mousemove', this.moveDragHelper).on('mousemove', this.moveDragHelper);\n },\n\n\n /**\n * Update the position of the helper\n * @param {Event} e\n */\n moveDragHelper: function moveDragHelper(e) {\n var doc = e.target.ownerDocument;\n\n if (!this.dragHelper || !doc) {\n return;\n }\n\n var posY = e.pageY;\n var posX = e.pageX;\n var addTop = 0;\n var addLeft = 0;\n var window = doc.defaultView || doc.parentWindow;\n var frame = window.frameElement;\n var dragHelperStyle = this.dragHelper.style;\n\n // If frame is present that means mouse has moved over the editor's canvas,\n // which is rendered inside the iframe and the mouse move event comes from\n // the iframe, not the parent window. Mouse position relative to the frame's\n // parent window needs to account for the frame's position relative to the\n // parent window.\n if (frame) {\n var frameRect = frame.getBoundingClientRect();\n addTop = frameRect.top + document.documentElement.scrollTop;\n addLeft = frameRect.left + document.documentElement.scrollLeft;\n posY = e.clientY;\n posX = e.clientX;\n }\n\n dragHelperStyle.top = posY + addTop + 'px';\n dragHelperStyle.left = posX + addLeft + 'px';\n },\n\n\n /**\n * Returns true if the element matches with selector\n * @param {Element} el\n * @param {String} selector\n * @return {Boolean}\n */\n matches: function matches(el, selector, useBody) {\n return _mixins.matches.call(el, selector);\n },\n\n\n /**\n * Closest parent\n * @param {Element} el\n * @param {String} selector\n * @return {Element|null}\n */\n closest: function closest(el, selector) {\n if (!el) return;\n var elem = el.parentNode;\n while (elem && elem.nodeType === 1) {\n if (this.matches(elem, selector)) return elem;\n elem = elem.parentNode;\n }\n return null;\n },\n\n\n /**\n * Get the offset of the element\n * @param {HTMLElement} el\n * @return {Object}\n */\n offset: function offset(el) {\n var rect = el.getBoundingClientRect();\n return {\n top: rect.top + document.body.scrollTop,\n left: rect.left + document.body.scrollLeft\n };\n },\n\n\n /**\n * Create placeholder\n * @return {HTMLElement}\n */\n createPlaceholder: function createPlaceholder() {\n var pfx = this.pfx;\n var el = document.createElement('div');\n var ins = document.createElement('div');\n el.className = pfx + 'placeholder';\n el.style.display = 'none';\n el.style['pointer-events'] = 'none';\n ins.className = pfx + 'placeholder-int';\n el.appendChild(ins);\n return el;\n },\n\n\n /**\n * Picking component to move\n * @param {HTMLElement} src\n * */\n startSort: function startSort(src) {\n var em = this.em;\n var itemSel = this.itemSel;\n var contSel = this.containerSel;\n var container = this.getContainerEl();\n var docs = this.getDocuments();\n var onStart = this.onStart;\n var srcModel = void 0;\n var plh = this.plh;\n this.dropModel = null;\n this.moved = 0;\n\n // Check if the start element is a valid one, if not get the\n // closest valid one\n if (src && !this.matches(src, itemSel + ', ' + contSel)) {\n src = this.closest(src, itemSel);\n }\n\n this.eV = src;\n\n // Create placeholder if not yet exists\n if (!plh) {\n plh = this.createPlaceholder();\n container.appendChild(plh);\n this.plh = plh;\n }\n\n if (src) {\n srcModel = this.getSourceModel(src);\n srcModel && srcModel.set && srcModel.set('status', 'freezed');\n }\n\n (0, _mixins.on)(container, 'mousemove dragover', this.onMove);\n (0, _mixins.on)(docs, 'mouseup dragend', this.endMove);\n (0, _mixins.on)(docs, 'keydown', this.rollback);\n onStart && onStart();\n\n // Avoid strange effects on dragging\n em && em.clearSelection();\n this.toggleSortCursor(1);\n\n em && em.trigger('sorter:drag:start', src, srcModel);\n },\n\n\n /**\n * Get the model from HTMLElement target\n * @return {Model|null}\n */\n getTargetModel: function getTargetModel(el) {\n var elem = el || this.target;\n return $(elem).data('model');\n },\n\n\n /**\n * Get the model of the current source element (element to drag)\n * @return {Model}\n */\n getSourceModel: function getSourceModel(source) {\n var src = source || this.eV;\n var dropContent = this.dropContent;\n var dropModel = this.dropModel;\n var em = this.em;\n\n if (dropContent && em) {\n if (!dropModel) {\n var comps = em.get('DomComponents').getComponents();\n var opts = {\n avoidStore: 1,\n avoidChildren: 1,\n avoidUpdateStyle: 1,\n temporary: 1\n };\n var tempModel = comps.add(dropContent, opts);\n dropModel = comps.remove(tempModel, opts);\n this.dropModel = dropModel instanceof Array ? dropModel[0] : dropModel;\n }\n return dropModel;\n }\n\n if (src) {\n return $(src).data('model');\n }\n },\n\n\n /**\n * Highlight target\n * @param {Model|null} model\n */\n selectTargetModel: function selectTargetModel(model) {\n if (model instanceof Backbone.Collection) {\n return;\n }\n\n var prevModel = this.targetModel;\n if (prevModel) {\n prevModel.set('status', '');\n }\n\n if (model && model.set) {\n model.set('status', 'selected-parent');\n this.targetModel = model;\n }\n },\n\n\n /**\n * During move\n * @param {Event} e\n * */\n onMove: function onMove(e) {\n var em = this.em;\n this.moved = 1;\n\n // Turn placeholder visibile\n var plh = this.plh;\n var dsp = plh.style.display;\n if (!dsp || dsp === 'none') plh.style.display = 'block';\n\n // Cache all necessary positions\n var eO = this.offset(this.el);\n this.elT = this.wmargin ? Math.abs(eO.top) : eO.top;\n this.elL = this.wmargin ? Math.abs(eO.left) : eO.left;\n var rY = e.pageY - this.elT + this.el.scrollTop;\n var rX = e.pageX - this.elL + this.el.scrollLeft;\n\n if (this.canvasRelative && em) {\n var mousePos = em.get('Canvas').getMouseRelativeCanvas(e);\n rX = mousePos.x;\n rY = mousePos.y;\n }\n\n this.rX = rX;\n this.rY = rY;\n this.eventMove = e;\n\n //var targetNew = this.getTargetFromEl(e.target);\n var dims = this.dimsFromTarget(e.target, rX, rY);\n var target = this.target;\n var targetModel = this.getTargetModel(target);\n this.selectTargetModel(targetModel);\n\n this.lastDims = dims;\n var pos = this.findPosition(dims, rX, rY);\n // If there is a significant changes with the pointer\n if (!this.lastPos || this.lastPos.index != pos.index || this.lastPos.method != pos.method) {\n this.movePlaceholder(this.plh, dims, pos, this.prevTargetDim);\n if (!this.$plh) this.$plh = $(this.plh);\n\n // With canvasRelative the offset is calculated automatically for\n // each element\n if (!this.canvasRelative) {\n if (this.offTop) this.$plh.css('top', '+=' + this.offTop + 'px');\n if (this.offLeft) this.$plh.css('left', '+=' + this.offLeft + 'px');\n }\n\n this.lastPos = pos;\n }\n\n if (typeof this.onMoveClb === 'function') this.onMoveClb(e);\n\n em && em.trigger('sorter:drag', {\n target: target,\n targetModel: targetModel,\n dims: dims,\n pos: pos,\n x: rX,\n y: rY\n });\n },\n\n\n /**\n * Returns true if the elements is in flow, so is not in flow where\n * for example the component is with float:left\n * @param {HTMLElement} el\n * @param {HTMLElement} parent\n * @return {Boolean}\n * @private\n * */\n isInFlow: function isInFlow(el, parent) {\n if (!el) return false;\n\n parent = parent || document.body;\n var ch = -1,\n h;\n var elem = el;\n h = elem.offsetHeight;\n if ( /*h < ch || */!this.styleInFlow(elem, parent)) return false;else return true;\n },\n\n\n /**\n * Check if el has style to be in flow\n * @param {HTMLElement} el\n * @param {HTMLElement} parent\n * @return {Boolean}\n * @private\n */\n styleInFlow: function styleInFlow(el, parent) {\n var style = el.style;\n var $el = $(el);\n if (style.overflow && style.overflow !== 'visible') return;\n if ($el.css('float') !== 'none') return;\n if (parent && $(parent).css('display') == 'flex') return;\n switch (style.position) {\n case 'static':\n case 'relative':\n case '':\n break;\n default:\n return;\n }\n switch (el.tagName) {\n case 'TR':\n case 'TBODY':\n case 'THEAD':\n case 'TFOOT':\n return true;\n }\n switch ($el.css('display')) {\n case 'block':\n case 'list-item':\n case 'table':\n case 'flex':\n return true;\n }\n return;\n },\n\n\n /**\n * Check if the target is valid with the actual source\n * @param {HTMLElement} trg\n * @return {Boolean}\n */\n validTarget: function validTarget(trg) {\n var srcModel = this.getSourceModel();\n var src = srcModel && srcModel.view && srcModel.view.el;\n var trgModel = this.getTargetModel(trg);\n trg = trgModel && trgModel.view && trgModel.view.el;\n var result = {\n valid: true,\n src: src,\n srcModel: srcModel,\n trg: trg,\n trgModel: trgModel\n };\n\n if (!src || !trg) {\n result.valid = false;\n return result;\n }\n\n // Check if the target could accept the source\n var droppable = trgModel.get('droppable');\n droppable = droppable instanceof Backbone.Collection ? 1 : droppable;\n droppable = droppable instanceof Array ? droppable.join(', ') : droppable;\n result.dropInfo = droppable;\n droppable = (0, _underscore.isString)(droppable) ? this.matches(src, droppable) : droppable;\n result.droppable = droppable;\n\n // check if the source is draggable in target\n var draggable = srcModel.get('draggable');\n draggable = draggable instanceof Array ? draggable.join(', ') : draggable;\n result.dragInfo = draggable;\n draggable = (0, _underscore.isString)(draggable) ? this.matches(trg, draggable) : draggable;\n result.draggable = draggable;\n\n if (!droppable || !draggable) {\n result.valid = false;\n }\n\n return result;\n },\n\n\n /**\n * Get dimensions of nodes relative to the coordinates\n * @param {HTMLElement} target\n * @param {number} rX Relative X position\n * @param {number} rY Relative Y position\n * @return {Array<Array>}\n */\n dimsFromTarget: function dimsFromTarget(target, rX, rY) {\n var em = this.em;\n var dims = [];\n\n if (!target) {\n return dims;\n }\n\n // Select the first valuable target\n if (!this.matches(target, this.itemSel + ', ' + this.containerSel)) {\n target = this.closest(target, this.itemSel);\n }\n\n // If draggable is an array the target will be one of those\n if (this.draggable instanceof Array) {\n target = this.closest(target, this.draggable.join(','));\n }\n\n if (!target) {\n return dims;\n }\n\n // Check if the target is different from the previous one\n if (this.prevTarget && this.prevTarget != target) {\n this.prevTarget = null;\n }\n\n // New target found\n if (!this.prevTarget) {\n this.targetP = this.closest(target, this.containerSel);\n\n // Check if the source is valid with the target\n var validResult = this.validTarget(target);\n em && em.trigger('sorter:drag:validation', validResult);\n\n if (!validResult.valid && this.targetP) {\n return this.dimsFromTarget(this.targetP, rX, rY);\n }\n\n this.prevTarget = target;\n this.prevTargetDim = this.getDim(target);\n this.cacheDimsP = this.getChildrenDim(this.targetP);\n this.cacheDims = this.getChildrenDim(target);\n }\n\n // If the target is the previous one will return the cached dims\n if (this.prevTarget == target) dims = this.cacheDims;\n\n // Target when I will drop element to sort\n this.target = this.prevTarget;\n\n // Generally, on any new target the poiner enters inside its area and\n // triggers nearBorders(), so have to take care of this\n if (this.nearBorders(this.prevTargetDim, rX, rY) || !this.nested && !this.cacheDims.length) {\n var targetParent = this.targetP;\n\n if (targetParent && this.validTarget(targetParent).valid) {\n dims = this.cacheDimsP;\n this.target = targetParent;\n }\n }\n\n this.lastPos = null;\n return dims;\n },\n\n\n /**\n * Get valid target from element\n * This method should replace dimsFromTarget()\n * @param {HTMLElement} el\n * @return {HTMLElement}\n */\n getTargetFromEl: function getTargetFromEl(el) {\n var target = el;\n var targetParent = void 0;\n var targetPrev = this.targetPrev;\n var em = this.em;\n var containerSel = this.containerSel;\n var itemSel = this.itemSel;\n\n // Select the first valuable target\n if (!this.matches(target, itemSel + ', ' + containerSel)) {\n target = this.closest(target, itemSel);\n }\n\n // If draggable is an array the target will be one of those\n // TODO check if this options is used somewhere\n if (this.draggable instanceof Array) {\n target = this.closest(target, this.draggable.join(','));\n }\n\n // Check if the target is different from the previous one\n if (targetPrev && targetPrev != target) {\n this.targetPrev = '';\n }\n\n // New target found\n if (!this.targetPrev) {\n targetParent = this.closest(target, containerSel);\n\n // If the current target is not valid (src/trg reasons) try with\n // the parent one (if exists)\n var validResult = this.validTarget(target);\n em && em.trigger('sorter:drag:validation', validResult);\n\n if (!validResult.valid && targetParent) {\n return this.getTargetFromEl(targetParent);\n }\n\n this.targetPrev = target;\n }\n\n // Generally, on any new target the poiner enters inside its area and\n // triggers nearBorders(), so have to take care of this\n if (this.nearElBorders(target)) {\n targetParent = this.closest(target, containerSel);\n\n if (targetParent && this.validTarget(targetParent).valid) {\n target = targetParent;\n }\n }\n\n return target;\n },\n\n\n /**\n * Check if the current pointer is neare to element borders\n * @return {Boolen}\n */\n nearElBorders: function nearElBorders(el) {\n var off = 10;\n var rect = el.getBoundingClientRect();\n var body = el.ownerDocument.body;\n\n var _getCurrentPos = this.getCurrentPos(),\n x = _getCurrentPos.x,\n y = _getCurrentPos.y;\n\n var top = rect.top + body.scrollTop;\n var left = rect.left + body.scrollLeft;\n var width = rect.width;\n var height = rect.height;\n\n //console.log(pos, {top, left});\n if (y < top + off || // near top edge\n y > top + height - off || // near bottom edge\n x < left + off || // near left edge\n x > left + width - off // near right edge\n ) {\n return 1;\n }\n },\n getCurrentPos: function getCurrentPos() {\n var ev = this.eventMove;\n var x = ev.pageX || 0;\n var y = ev.pageY || 0;\n return { x: x, y: y };\n },\n\n\n /**\n * Returns dimensions and positions about the element\n * @param {HTMLElement} el\n * @return {Array<number>}\n */\n getDim: function getDim(el) {\n var top, left, height, width;\n\n if (this.canvasRelative && this.em) {\n var pos = this.em.get('Canvas').getElementPos(el);\n var styles = window.getComputedStyle(el);\n var marginTop = parseFloat(styles['marginTop']);\n var marginBottom = parseFloat(styles['marginBottom']);\n var marginRight = parseFloat(styles['marginRight']);\n var marginLeft = parseFloat(styles['marginLeft']);\n top = pos.top - marginTop;\n left = pos.left - marginLeft;\n height = pos.height + marginTop + marginBottom;\n width = pos.width + marginLeft + marginRight;\n } else {\n var o = this.offset(el);\n top = this.relative ? el.offsetTop : o.top - (this.wmargin ? -1 : 1) * this.elT;\n left = this.relative ? el.offsetLeft : o.left - (this.wmargin ? -1 : 1) * this.elL;\n height = el.offsetHeight;\n width = el.offsetWidth;\n }\n\n //console.log('get dim', top, left, this.canvasRelative);\n\n return [top, left, height, width];\n },\n\n\n /**\n * Get children dimensions\n * @param {HTMLELement} el Element root\n * @retun {Array}\n * */\n getChildrenDim: function getChildrenDim(trg) {\n var dims = [];\n if (!trg) return dims;\n\n // Get children based on getChildrenContainer\n var trgModel = this.getTargetModel(trg);\n if (trgModel && trgModel.view && !this.ignoreViewChildren) {\n trg = trgModel.view.getChildrenContainer();\n }\n\n var ch = trg.children;\n\n for (var i = 0, len = ch.length; i < len; i++) {\n var el = ch[i];\n\n if (!this.matches(el, this.itemSel)) {\n continue;\n }\n\n var dim = this.getDim(el);\n var dir = this.direction;\n\n if (dir == 'v') dir = true;else if (dir == 'h') dir = false;else dir = this.isInFlow(el, trg);\n\n dim.push(dir);\n dim.push(el);\n dims.push(dim);\n }\n\n return dims;\n },\n\n\n /**\n * Check if the coordinates are near to the borders\n * @param {Array<number>} dim\n * @param {number} rX Relative X position\n * @param {number} rY Relative Y position\n * @return {Boolean}\n * */\n nearBorders: function nearBorders(dim, rX, rY) {\n var result = 0;\n var off = this.borderOffset;\n var x = rX || 0;\n var y = rY || 0;\n var t = dim[0];\n var l = dim[1];\n var h = dim[2];\n var w = dim[3];\n if (t + off > y || y > t + h - off || l + off > x || x > l + w - off) result = 1;\n\n return !!result;\n },\n\n\n /**\n * Find the position based on passed dimensions and coordinates\n * @param {Array<Array>} dims Dimensions of nodes to parse\n * @param {number} posX X coordindate\n * @param {number} posY Y coordindate\n * @retun {Object}\n * */\n findPosition: function findPosition(dims, posX, posY) {\n var result = { index: 0, method: 'before' };\n var leftLimit = 0,\n xLimit = 0,\n dimRight = 0,\n yLimit = 0,\n xCenter = 0,\n yCenter = 0,\n dimDown = 0,\n dim = 0;\n // Each dim is: Top, Left, Height, Width\n for (var i = 0, len = dims.length; i < len; i++) {\n dim = dims[i];\n // Right position of the element. Left + Width\n dimRight = dim[1] + dim[3];\n // Bottom position of the element. Top + Height\n dimDown = dim[0] + dim[2];\n // X center position of the element. Left + (Width / 2)\n xCenter = dim[1] + dim[3] / 2;\n // Y center position of the element. Top + (Height / 2)\n yCenter = dim[0] + dim[2] / 2;\n // Skip if over the limits\n if (xLimit && dim[1] > xLimit || yLimit && yCenter >= yLimit || // >= avoid issue with clearfixes\n leftLimit && dimRight < leftLimit) continue;\n result.index = i;\n // If it's not in flow (like 'float' element)\n if (!dim[4]) {\n if (posY < dimDown) yLimit = dimDown;\n //If x lefter than center\n if (posX < xCenter) {\n xLimit = xCenter;\n result.method = 'before';\n } else {\n leftLimit = xCenter;\n result.method = 'after';\n }\n } else {\n // If y upper than center\n if (posY < yCenter) {\n result.method = 'before';\n break;\n } else result.method = 'after'; // After last element\n }\n }\n return result;\n },\n\n\n /**\n * Updates the position of the placeholder\n * @param {HTMLElement} phl\n * @param {Array<Array>} dims\n * @param {Object} pos Position object\n * @param {Array<number>} trgDim target dimensions\n * */\n movePlaceholder: function movePlaceholder(plh, dims, pos, trgDim) {\n var marg = 0,\n t = 0,\n l = 0,\n w = 0,\n h = 0,\n un = 'px',\n margI = 5,\n brdCol = '#62c462',\n brd = 3,\n method = pos.method;\n var elDim = dims[pos.index];\n plh.style.borderColor = 'transparent ' + brdCol;\n plh.style.borderWidth = brd + un + ' ' + (brd + 2) + un;\n plh.style.margin = '-' + brd + 'px 0 0';\n if (elDim) {\n // If it's not in flow (like 'float' element)\n if (!elDim[4]) {\n w = 'auto';\n h = elDim[2] - marg * 2 + un;\n t = elDim[0] + marg;\n l = method == 'before' ? elDim[1] - marg : elDim[1] + elDim[3] - marg;\n plh.style.borderColor = brdCol + ' transparent';\n plh.style.borderWidth = brd + 2 + un + ' ' + brd + un;\n plh.style.margin = '0 0 0 -' + brd + 'px';\n } else {\n w = elDim[3] + un;\n h = 'auto';\n t = method == 'before' ? elDim[0] - marg : elDim[0] + elDim[2] - marg;\n l = elDim[1];\n }\n } else {\n if (!this.nested) {\n plh.style.display = 'none';\n return;\n }\n if (trgDim) {\n t = trgDim[0] + margI;\n l = trgDim[1] + margI;\n w = parseInt(trgDim[3]) - margI * 2 + un;\n h = 'auto';\n }\n }\n plh.style.top = t + un;\n plh.style.left = l + un;\n if (w) plh.style.width = w;\n if (h) plh.style.height = h;\n },\n\n\n /**\n * Leave item\n * @param event\n *\n * @return void\n * */\n endMove: function endMove(e) {\n var created;\n var docs = this.getDocuments();\n var container = this.getContainerEl();\n (0, _mixins.off)(container, 'mousemove dragover', this.onMove);\n (0, _mixins.off)(docs, 'mouseup dragend', this.endMove);\n (0, _mixins.off)(docs, 'keydown', this.rollback);\n //this.$document.off('mouseup', this.endMove);\n //this.$document.off('keydown', this.rollback);\n this.plh.style.display = 'none';\n var clsReg = new RegExp('(?:^|\\\\s)' + this.freezeClass + '(?!\\\\S)', 'gi');\n var src = this.eV;\n\n if (src) {\n var srcModel = this.getSourceModel();\n if (srcModel && srcModel.set) {\n srcModel.set('status', '');\n srcModel.set('status', 'selected');\n //this.selectOnEnd && srcModel.set('status', 'selected');\n }\n }\n\n if (this.moved) {\n created = this.move(this.target, src, this.lastPos);\n }\n\n if (this.plh) this.plh.style.display = 'none';\n\n if (typeof this.onEndMove === 'function') this.onEndMove(created);\n\n var dragHelper = this.dragHelper;\n\n if (dragHelper) {\n dragHelper.parentNode.removeChild(dragHelper);\n this.dragHelper = null;\n }\n\n this.selectTargetModel();\n this.toggleSortCursor();\n },\n\n\n /**\n * Move component to new position\n * @param {HTMLElement} dst Destination target\n * @param {HTMLElement} src Element to move\n * @param {Object} pos Object with position coordinates\n * */\n move: function move(dst, src, pos) {\n var em = this.em;\n em && em.trigger('component:dragEnd:before', dst, src, pos); // @depricated\n var warns = [];\n var index = pos.index;\n var modelToDrop, modelTemp, created;\n var validResult = this.validTarget(dst);\n var targetCollection = $(dst).data('collection');\n var model = validResult.srcModel;\n var droppable = validResult.droppable;\n var draggable = validResult.draggable;\n var dropInfo = validResult.dropInfo;\n var dragInfo = validResult.dragInfo;\n var dropContent = this.dropContent;\n droppable = validResult.trgModel instanceof Backbone.Collection ? 1 : droppable;\n\n if (targetCollection && droppable && draggable) {\n index = pos.method === 'after' ? index + 1 : index;\n var opts = { at: index, noIncrement: 1 };\n\n if (!dropContent) {\n modelTemp = targetCollection.add({}, _extends({}, opts, { avoidStore: 1 }));\n\n if (model) {\n modelToDrop = model.collection.remove(model);\n }\n } else {\n modelToDrop = dropContent;\n opts.silent = false;\n opts.avoidUpdateStyle = 1;\n }\n\n created = targetCollection.add(modelToDrop, opts);\n\n if (!dropContent) {\n targetCollection.remove(modelTemp, { avoidStore: 1 });\n } else {\n this.dropContent = null;\n }\n\n // This will cause to recalculate children dimensions\n this.prevTarget = null;\n } else {\n if (!targetCollection) {\n warns.push('Target collection not found');\n }\n\n if (!droppable) {\n warns.push('Target is not droppable, accepts [' + dropInfo + ']');\n }\n\n if (!draggable) {\n warns.push('Component not draggable, acceptable by [' + dragInfo + ']');\n }\n\n console.warn('Invalid target position: ' + warns.join(', '));\n }\n\n em && em.trigger('component:dragEnd', targetCollection, modelToDrop, warns); // @depricated\n em && em.trigger('sorter:drag:end', targetCollection, modelToDrop, warns);\n\n return created;\n },\n\n\n /**\n * Rollback to previous situation\n * @param {Event}\n * @param {Bool} Indicates if rollback in anycase\n * */\n rollback: function rollback(e) {\n (0, _mixins.off)(this.getDocuments(), 'keydown', this.rollback);\n var key = e.which || e.keyCode;\n\n if (key == 27) {\n this.moved = 0;\n this.endMove();\n }\n }\n});\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0), __webpack_require__(1)))\n\n/***/ }),\n/* 65 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();\n\nvar _underscore = __webpack_require__(1);\n\nvar _mixins = __webpack_require__(2);\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar defaultOpts = {\n // Function which returns custom X and Y coordinates of the mouse\n mousePosFetcher: null,\n // Indicates custom target updating strategy\n updateTarget: null,\n // Function which gets HTMLElement as an arg and returns it relative position\n ratioDefault: 0,\n posFetcher: null,\n onStart: null,\n onMove: null,\n onEnd: null,\n\n // Resize unit step\n step: 1,\n\n // Minimum dimension\n minDim: 32,\n\n // Maximum dimension\n maxDim: '',\n\n // Unit used for height resizing\n unitHeight: 'px',\n\n // Unit used for width resizing\n unitWidth: 'px',\n\n // The key used for height resizing\n keyHeight: 'height',\n\n // The key used for width resizing\n keyWidth: 'width',\n\n // If true, will override unitHeight and unitWidth, on start, with units\n // from the current focused element (currently used only in SelectComponent)\n currentUnit: 1,\n\n // Handlers\n tl: 1, // Top left\n tc: 1, // Top center\n tr: 1, // Top right\n cl: 1, // Center left\n cr: 1, // Center right\n bl: 1, // Bottom left\n bc: 1, // Bottom center\n br: 1 // Bottom right\n};\n\nvar createHandler = function createHandler(name, opts) {\n var pfx = opts.prefix || '';\n var el = document.createElement('i');\n el.className = pfx + 'resizer-h ' + pfx + 'resizer-h-' + name;\n el.setAttribute('data-' + pfx + 'handler', name);\n return el;\n};\n\nvar getBoundingRect = function getBoundingRect(el, win) {\n var w = win || window;\n var rect = el.getBoundingClientRect();\n return {\n left: rect.left + w.pageXOffset,\n top: rect.top + w.pageYOffset,\n width: rect.width,\n height: rect.height\n };\n};\n\nvar Resizer = function () {\n /**\n * Init the Resizer with options\n * @param {Object} options\n */\n function Resizer() {\n var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n _classCallCheck(this, Resizer);\n\n this.setOptions(opts);\n (0, _underscore.bindAll)(this, 'handleKeyDown', 'handleMouseDown', 'move', 'stop');\n return this;\n }\n\n /**\n * Get current connfiguration options\n * @return {Object}\n */\n\n\n _createClass(Resizer, [{\n key: 'getConfig',\n value: function getConfig() {\n return this.opts;\n }\n\n /**\n * Setup options\n * @param {Object} options\n */\n\n }, {\n key: 'setOptions',\n value: function setOptions() {\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n this.opts = (0, _underscore.defaults)(options, defaultOpts);\n this.setup();\n }\n\n /**\n * Setup resizer\n */\n\n }, {\n key: 'setup',\n value: function setup() {\n var opts = this.opts;\n var pfx = opts.prefix || '';\n var appendTo = opts.appendTo || document.body;\n var container = this.container;\n\n // Create container if not yet exist\n if (!container) {\n container = document.createElement('div');\n container.className = pfx + 'resizer-c';\n appendTo.appendChild(container);\n this.container = container;\n }\n\n while (container.firstChild) {\n container.removeChild(container.firstChild);\n }\n\n // Create handlers\n var handlers = {};\n ['tl', 'tc', 'tr', 'cl', 'cr', 'bl', 'bc', 'br'].forEach(function (hdl) {\n return handlers[hdl] = opts[hdl] ? createHandler(hdl, opts) : '';\n });\n\n for (var n in handlers) {\n var handler = handlers[n];\n handler && container.appendChild(handler);\n }\n\n this.handlers = handlers;\n this.mousePosFetcher = opts.mousePosFetcher;\n this.updateTarget = opts.updateTarget;\n this.posFetcher = opts.posFetcher;\n this.onStart = opts.onStart;\n this.onMove = opts.onMove;\n this.onEnd = opts.onEnd;\n }\n\n /**\n * Detects if the passed element is a resize handler\n * @param {HTMLElement} el\n * @return {Boolean}\n */\n\n }, {\n key: 'isHandler',\n value: function isHandler(el) {\n var handlers = this.handlers;\n\n for (var n in handlers) {\n if (handlers[n] === el) return true;\n }\n\n return false;\n }\n\n /**\n * Returns the focused element\n * @return {HTMLElement}\n */\n\n }, {\n key: 'getFocusedEl',\n value: function getFocusedEl() {\n return this.el;\n }\n\n /**\n * Returns documents\n */\n\n }, {\n key: 'getDocumentEl',\n value: function getDocumentEl() {\n return [this.el.ownerDocument, document];\n }\n\n /**\n * Return element position\n * @param {HTMLElement} el\n * @return {Object}\n */\n\n }, {\n key: 'getElementPos',\n value: function getElementPos(el) {\n var posFetcher = this.posFetcher || '';\n return posFetcher ? posFetcher(el) : getBoundingRect(el);\n }\n\n /**\n * Focus resizer on the element, attaches handlers to it\n * @param {HTMLElement} el\n */\n\n }, {\n key: 'focus',\n value: function focus(el) {\n // Avoid focusing on already focused element\n if (el && el === this.el) {\n return;\n }\n\n // Show the handlers\n this.el = el;\n var unit = 'px';\n var rect = this.getElementPos(el);\n var container = this.container;\n var contStyle = container.style;\n contStyle.left = rect.left + unit;\n contStyle.top = rect.top + unit;\n contStyle.width = rect.width + unit;\n contStyle.height = rect.height + unit;\n container.style.display = 'block';\n\n (0, _mixins.on)(this.getDocumentEl(), 'mousedown', this.handleMouseDown);\n }\n\n /**\n * Blur from element\n */\n\n }, {\n key: 'blur',\n value: function blur() {\n this.container.style.display = 'none';\n\n if (this.el) {\n (0, _mixins.off)(this.getDocumentEl(), 'mousedown', this.handleMouseDown);\n this.el = null;\n }\n }\n\n /**\n * Start resizing\n * @param {Event} e\n */\n\n }, {\n key: 'start',\n value: function start(e) {\n //Right or middel click\n if (e.button !== 0) {\n return;\n }\n e.preventDefault();\n e.stopPropagation();\n var el = this.el;\n var resizer = this;\n var config = this.opts || {};\n var attrName = 'data-' + config.prefix + 'handler';\n var rect = this.getElementPos(el);\n this.handlerAttr = e.target.getAttribute(attrName);\n this.clickedHandler = e.target;\n this.startDim = {\n t: rect.top,\n l: rect.left,\n w: rect.width,\n h: rect.height\n };\n this.rectDim = {\n t: rect.top,\n l: rect.left,\n w: rect.width,\n h: rect.height\n };\n this.startPos = {\n x: e.clientX,\n y: e.clientY\n };\n\n // Listen events\n var doc = this.getDocumentEl();\n (0, _mixins.on)(doc, 'mousemove', this.move);\n (0, _mixins.on)(doc, 'keydown', this.handleKeyDown);\n (0, _mixins.on)(doc, 'mouseup', this.stop);\n (0, _underscore.isFunction)(this.onStart) && this.onStart(e, { docs: doc, config: config, el: el, resizer: resizer });\n this.move(e);\n }\n\n /**\n * While resizing\n * @param {Event} e\n */\n\n }, {\n key: 'move',\n value: function move(e) {\n var onMove = this.onMove;\n var mouseFetch = this.mousePosFetcher;\n var currentPos = mouseFetch ? mouseFetch(e) : {\n x: e.clientX,\n y: e.clientY\n };\n\n this.currentPos = currentPos;\n this.delta = {\n x: currentPos.x - this.startPos.x,\n y: currentPos.y - this.startPos.y\n };\n this.keys = {\n shift: e.shiftKey,\n ctrl: e.ctrlKey,\n alt: e.altKey\n };\n\n this.rectDim = this.calc(this);\n this.updateRect(0);\n\n // Move callback\n onMove && onMove(e);\n\n // In case the mouse button was released outside of the window\n if (e.which === 0) {\n this.stop(e);\n }\n }\n\n /**\n * Stop resizing\n * @param {Event} e\n */\n\n }, {\n key: 'stop',\n value: function stop(e) {\n var config = this.opts;\n var doc = this.getDocumentEl();\n (0, _mixins.off)(doc, 'mousemove', this.move);\n (0, _mixins.off)(doc, 'keydown', this.handleKeyDown);\n (0, _mixins.off)(doc, 'mouseup', this.stop);\n this.updateRect(1);\n (0, _underscore.isFunction)(this.onEnd) && this.onEnd(e, { docs: doc, config: config });\n }\n\n /**\n * Update rect\n */\n\n }, {\n key: 'updateRect',\n value: function updateRect(store) {\n var el = this.el;\n var resizer = this;\n var config = this.opts;\n var rect = this.rectDim;\n var conStyle = this.container.style;\n var updateTarget = this.updateTarget;\n var selectedHandler = this.getSelectedHandler();\n var unitHeight = config.unitHeight,\n unitWidth = config.unitWidth;\n\n // Use custom updating strategy if requested\n\n if ((0, _underscore.isFunction)(updateTarget)) {\n updateTarget(el, rect, {\n store: store,\n selectedHandler: selectedHandler,\n resizer: resizer,\n config: config\n });\n } else {\n var elStyle = el.style;\n elStyle.width = rect.w + unitWidth;\n elStyle.height = rect.h + unitHeight;\n }\n\n var unitRect = 'px';\n var rectEl = this.getElementPos(el);\n conStyle.left = rectEl.left + unitRect;\n conStyle.top = rectEl.top + unitRect;\n conStyle.width = rectEl.width + unitRect;\n conStyle.height = rectEl.height + unitRect;\n }\n\n /**\n * Get selected handler name\n * @return {string}\n */\n\n }, {\n key: 'getSelectedHandler',\n value: function getSelectedHandler() {\n var handlers = this.handlers;\n\n if (!this.selectedHandler) {\n return;\n }\n\n for (var n in handlers) {\n if (handlers[n] === this.selectedHandler) return n;\n }\n }\n\n /**\n * Handle ESC key\n * @param {Event} e\n */\n\n }, {\n key: 'handleKeyDown',\n value: function handleKeyDown(e) {\n if (e.keyCode === 27) {\n // Rollback to initial dimensions\n this.rectDim = this.startDim;\n this.stop(e);\n }\n }\n\n /**\n * Handle mousedown to check if it's possible to start resizing\n * @param {Event} e\n */\n\n }, {\n key: 'handleMouseDown',\n value: function handleMouseDown(e) {\n var el = e.target;\n if (this.isHandler(el)) {\n this.selectedHandler = el;\n this.start(e);\n } else if (el !== this.el) {\n this.selectedHandler = '';\n this.blur();\n }\n }\n\n /**\n * All positioning logic\n * @return {Object}\n */\n\n }, {\n key: 'calc',\n value: function calc(data) {\n var value = void 0;\n var opts = this.opts || {};\n var step = opts.step;\n var startDim = this.startDim;\n var minDim = opts.minDim;\n var maxDim = opts.maxDim;\n var deltaX = data.delta.x;\n var deltaY = data.delta.y;\n var startW = startDim.w;\n var startH = startDim.h;\n var box = {\n t: 0,\n l: 0,\n w: startW,\n h: startH\n };\n\n if (!data) return;\n\n var attr = data.handlerAttr;\n if (~attr.indexOf('r')) {\n value = (0, _mixins.normalizeFloat)(startW + deltaX * step, step);\n value = Math.max(minDim, value);\n maxDim && (value = Math.min(maxDim, value));\n box.w = value;\n }\n if (~attr.indexOf('b')) {\n value = (0, _mixins.normalizeFloat)(startH + deltaY * step, step);\n value = Math.max(minDim, value);\n maxDim && (value = Math.min(maxDim, value));\n box.h = value;\n }\n if (~attr.indexOf('l')) {\n value = (0, _mixins.normalizeFloat)(startW - deltaX * step, step);\n value = Math.max(minDim, value);\n maxDim && (value = Math.min(maxDim, value));\n box.w = value;\n }\n if (~attr.indexOf('t')) {\n value = (0, _mixins.normalizeFloat)(startH - deltaY * step, step);\n value = Math.max(minDim, value);\n maxDim && (value = Math.min(maxDim, value));\n box.h = value;\n }\n\n // Enforce aspect ratio (unless shift key is being held)\n var ratioActive = opts.ratioDefault ? !data.keys.shift : data.keys.shift;\n if (attr.indexOf('c') < 0 && ratioActive) {\n var ratio = startDim.w / startDim.h;\n if (box.w / box.h > ratio) {\n box.h = Math.round(box.w / ratio);\n } else {\n box.w = Math.round(box.h * ratio);\n }\n }\n\n if (~attr.indexOf('l')) {\n box.l = startDim.w - box.w;\n }\n if (~attr.indexOf('t')) {\n box.t = startDim.h - box.h;\n }\n\n return box;\n }\n }]);\n\n return Resizer;\n}();\n\nmodule.exports = {\n init: function init(opts) {\n return new Resizer(opts);\n }\n};\n\n/***/ }),\n/* 66 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Backbone) {\n\nvar $ = Backbone.$;\n\nvar getBoundingRect = function getBoundingRect(el, win) {\n var w = win || window;\n var rect = el.getBoundingClientRect();\n return {\n left: rect.left + w.pageXOffset,\n top: rect.top + w.pageYOffset,\n width: rect.width,\n height: rect.height\n };\n};\n\nmodule.exports = {\n // TODO move to opts\n setKey: function setKey(keys, command) {\n //key(keys, command);\n },\n\n\n /**\n * Return element position\n * @param {HTMLElement} el\n * @return {Object}\n */\n getElementRect: function getElementRect(el) {\n var posFetcher = this.opts.posFetcher || '';\n return posFetcher ? posFetcher(el, {\n avoidFrameOffset: 1\n }) : getBoundingRect(el);\n },\n\n\n /**\n * Init the resizer\n * @param {Object} opts\n */\n init: function init(opts) {\n this.setOptions(opts);\n this.handleMouseDown = this.handleMouseDown.bind(this);\n this.drag = this.drag.bind(this);\n this.move = this.move.bind(this);\n this.stop = this.stop.bind(this);\n this.setKey('up, right, down, left', this.handleKey);\n return this;\n },\n\n\n /**\n * Update options\n * @param {Object} options\n */\n setOptions: function setOptions(opts) {\n this.opts = opts || {};\n },\n\n\n /**\n * Focus dragger on the element\n * @param {HTMLElement} el\n */\n focus: function focus(el) {\n // Avoid focusing on already focused element\n if (el && el === this.el) {\n return;\n }\n\n this.getDocumentEl(el);\n this.blur();\n this.el = el;\n this.handlers = this.opts.dragHandlers || [el];\n\n var elRect = this.getElementRect(el); //<-- TODO have wrong top:left\n this.elRect = elRect;\n this.startTop = elRect.top;\n this.startLeft = elRect.left;\n\n // TODO init snapper\n\n this.getDocumentEl().on('mousedown', this.handleMouseDown);\n },\n\n\n /**\n * Blur from the focused element\n */\n blur: function blur() {\n this.getDocumentEl().off('mousedown', this.handleMouseDown);\n this.el = null;\n },\n\n\n /**\n * Start dragging\n * @param {Event} e\n */\n start: function start(e) {\n this.startPos = this.getMousePos(e);\n var docs = this.getDocumentEl();\n docs.on('mousemove', this.drag);\n docs.on('mouseup', this.stop);\n\n // Start callback\n var onStart = this.opts.onStart;\n if (typeof onStart === 'function') {\n onStart(e, {\n docs: docs,\n el: this.el,\n start: this.startPos,\n elRect: this.elRect\n });\n }\n\n this.drag(e);\n },\n\n\n /**\n * Stop dragging\n */\n stop: function stop(e) {\n var docs = this.getDocumentEl();\n docs.off('mousemove', this.drag);\n docs.off('mouseup', this.stop);\n this.lockedAxis = null;\n\n // Stop callback\n var onEnd = this.opts.onEnd;\n if (typeof onEnd === 'function') {\n onEnd(e, {\n docs: docs,\n delta: this.delta,\n end: {\n x: this.startLeft + this.delta.x,\n y: this.startTop + this.delta.y\n }\n });\n }\n },\n\n\n /**\n * Handle mousedown to check if it's possible to drag\n * @param {Event} e\n */\n handleMouseDown: function handleMouseDown(e) {\n var el = e.target;\n if (this.isHandler(el)) {\n this.start(e);\n }\n },\n\n\n /**\n * Detects if the clicked element is a valid handler\n * @param {HTMLElement} el\n * @return {Boolean}\n */\n isHandler: function isHandler(el) {\n var handlers = this.handlers;\n\n for (var n in handlers) {\n if (handlers[n] === el) return true;\n }\n\n return false;\n },\n\n\n /**\n * Handle key press\n * @param {Event} e\n * @param {Object} handler\n */\n handleKey: function handleKey(e, handler) {\n switch (handler.shortcut) {\n case 'up':\n this.move(0, -1);\n break;\n case 'right':\n this.move(1, 0);\n break;\n case 'down':\n this.move(0, 1);\n break;\n case 'left':\n this.move(-1, 0);\n break;\n }\n },\n\n\n /**\n * Returns documents\n */\n getDocumentEl: function getDocumentEl(el) {\n var el = el || this.el;\n if (!this.$doc) {\n var docs = [document];\n if (el) {\n docs.push(el.ownerDocument);\n }\n this.$doc = $(docs);\n }\n return this.$doc;\n },\n\n\n /**\n * Get mouse coordinates\n * @param {Event} event\n * @return {Object}\n */\n getMousePos: function getMousePos(e) {\n var mouseFetch = this.opts.mousePosFetcher;\n return mouseFetch ? mouseFetch(e) : {\n x: e.clientX,\n y: e.clientY\n };\n },\n\n\n /**\n * Drag event\n * @param {Event} event\n */\n drag: function drag(e) {\n var lockedAxis = this.lockedAxis;\n var currentPos = this.getMousePos(e);\n var delta = {\n x: currentPos.x - this.startPos.x,\n y: currentPos.y - this.startPos.y\n };\n // Lock one axis\n if (e.shiftKey) {\n if (!lockedAxis) {\n var relX = delta.x;\n var relY = delta.y;\n var absX = Math.abs(relX);\n var absY = Math.abs(relY);\n\n // Vertical or Horizontal lock\n if (relY >= absX || relY <= -absX) {\n lockedAxis = 'x';\n } else if (relX > absY || relX < -absY) {\n lockedAxis = 'y';\n }\n }\n } else {\n lockedAxis = null;\n }\n\n if (lockedAxis === 'x') {\n delta.x = this.startPos.x;\n }\n\n if (lockedAxis === 'y') {\n delta.y = this.startPos.y;\n }\n\n this.lockedAxis = lockedAxis;\n this.delta = delta;\n this.move(delta.x, delta.y);\n\n // Drag callback\n var onDrag = this.opts.onDrag;\n if (typeof onDrag === 'function') {\n onDrag(e, {\n delta: delta,\n current: {\n x: this.startLeft + delta.x,\n y: this.startTop + delta.y\n },\n lockedAxis: lockedAxis\n });\n }\n\n // In case the mouse button was released outside of the window\n if (e.which === 0) {\n this.stop(e);\n }\n },\n\n\n /**\n * Move the element\n * @param {integer} x\n * @param {integer} y\n */\n move: function move(x, y) {\n this.moveX(x);\n this.moveY(y);\n },\n\n /**\n * Move in x direction\n * @param {integer} x\n */\n moveX: function moveX(x) {\n var el = this.el;\n var opts = this.opts;\n var xPos = this.startLeft + x;\n var setX = this.opts.setX;\n\n if (typeof setX === 'function') {\n setX(xPos, {\n el: el,\n start: this.startLeft,\n delta: x\n });\n } else {\n el.style.left = xPos + 'px';\n }\n },\n\n\n /**\n * Move in y direction\n * @param {integer} y\n */\n moveY: function moveY(y) {\n var el = this.el;\n var opts = this.opts;\n var yPos = this.startTop + y;\n var setY = this.opts.setY;\n\n if (typeof setY === 'function') {\n setY(yPos, {\n el: el,\n start: this.startTop,\n delta: y\n });\n } else {\n el.style.top = yPos + 'px';\n }\n }\n};\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))\n\n/***/ }),\n/* 67 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; /**\n * This module allows to create shortcuts for functions and commands (via command id)\n *\n * You can access the module in this way\n * ```js\n * const keymaps = editor.Keymaps;\n * ```\n *\n */\n\n\nvar _underscore = __webpack_require__(1);\n\nvar keymaster = __webpack_require__(23);\n\nmodule.exports = function () {\n var em = void 0;\n var config = void 0;\n var keymaps = {};\n var configDef = {\n defaults: {\n 'core:undo': {\n keys: '⌘+z, ctrl+z',\n handler: 'core:undo'\n },\n 'core:redo': {\n keys: '⌘+shift+z, ctrl+shift+z',\n handler: 'core:redo'\n },\n 'core:copy': {\n keys: '⌘+c, ctrl+c',\n handler: 'core:copy'\n },\n 'core:paste': {\n keys: '⌘+v, ctrl+v',\n handler: 'core:paste'\n }\n }\n };\n\n return {\n keymaster: keymaster,\n\n name: 'Keymaps',\n\n /**\n * Get module configurations\n * @return {Object} Configuration object\n */\n getConfig: function getConfig() {\n return config;\n },\n\n\n /**\n * Initialize module\n * @param {Object} config Configurations\n * @private\n */\n init: function init() {\n var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n config = _extends({}, configDef, opts);\n em = config.em;\n this.em = em;\n return this;\n },\n onLoad: function onLoad() {\n var defKeys = config.defaults;\n\n for (var id in defKeys) {\n var value = defKeys[id];\n this.add(id, value.keys, value.handler);\n }\n },\n\n\n /**\n * Add new keymap\n * @param {string} id Keymap id\n * @param {string} keys Keymap keys, eg. `ctrl+a`, `⌘+z, ctrl+z`\n * @param {Function|string} handler Keymap handler, might be a function\n * @return {Object} Added keymap\n * or just a command id as a string\n * @example\n * // 'ns' is just a custom namespace\n * keymaps.add('ns:my-keymap', '⌘+j, ⌘+u, ctrl+j, alt+u', editor => {\n * console.log('do stuff');\n * });\n * // or\n * keymaps.add('ns:my-keymap', '⌘+s, ctrl+s', 'some-gjs-command');\n *\n * // listen to events\n * editor.on('keymap:emit', (id, shortcut, e) => {\n * // ...\n * })\n */\n add: function add(id, keys, handler) {\n var em = this.em;\n var cmd = em.get('Commands');\n var editor = em.getEditor();\n var keymap = { id: id, keys: keys, handler: handler };\n var pk = keymaps[id];\n pk && this.remove(id);\n keymaps[id] = keymap;\n keymaster(keys, function (e, h) {\n // It's safer putting handlers resolution inside the callback\n handler = (0, _underscore.isString)(handler) ? cmd.get(handler) : handler;\n (typeof handler === 'undefined' ? 'undefined' : _typeof(handler)) == 'object' ? handler.run(editor) : handler(editor);\n var args = [id, h.shortcut, e];\n em.trigger.apply(em, ['keymap:emit'].concat(args));\n em.trigger.apply(em, ['keymap:emit:' + id].concat(args));\n });\n em.trigger('keymap:add', keymap);\n return keymap;\n },\n\n\n /**\n * Get the keymap by id\n * @param {string} id Keymap id\n * @return {Object} Keymap object\n * @example\n * keymaps.get('ns:my-keymap');\n * // -> {keys, handler};\n */\n get: function get(id) {\n return keymaps[id];\n },\n\n\n /**\n * Get all keymaps\n * @return {Object}\n * @example\n * keymaps.getAll();\n * // -> {id1: {}, id2: {}};\n */\n getAll: function getAll() {\n return keymaps;\n },\n\n\n /**\n * Remove the keymap by id\n * @param {string} id Keymap id\n * @return {Object} Removed keymap\n * @example\n * keymaps.remove('ns:my-keymap');\n * // -> {keys, handler};\n */\n remove: function remove(id) {\n var em = this.em;\n var keymap = this.get(id);\n\n if (keymap) {\n delete keymaps[id];\n keymaster.unbind(keymap.keys);\n em && em.trigger('keymap:remove', keymap);\n return keymap;\n }\n }\n };\n};\n\n/***/ }),\n/* 68 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; /**\n * This module allows to manage the stack of changes applied in canvas\n *\n * You can access the module in this way\n * ```js\n * const um = editor.UndoManager;\n * ```\n *\n */\n\n\nvar _backboneUndo = __webpack_require__(69);\n\nvar _backboneUndo2 = _interopRequireDefault(_backboneUndo);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nmodule.exports = function () {\n var em = void 0;\n var um = void 0;\n var config = void 0;\n var beforeCache = void 0;\n var configDef = {};\n\n return {\n name: 'UndoManager',\n\n /**\n * Initialize module\n * @param {Object} config Configurations\n * @private\n */\n init: function init() {\n var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n config = _extends({}, opts, configDef);\n em = config.em;\n this.em = em;\n um = new _backboneUndo2.default({ track: true, register: [] });\n um.changeUndoType('change', { condition: false });\n um.changeUndoType('add', {\n on: function on(model, collection) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n if (options.avoidStore) return;\n return {\n object: collection,\n before: undefined,\n after: model,\n options: _extends({}, options)\n };\n }\n });\n um.changeUndoType('remove', {\n on: function on(model, collection) {\n var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n if (options.avoidStore) return;\n return {\n object: collection,\n before: model,\n after: undefined,\n options: _extends({}, options)\n };\n }\n });\n var customUndoType = {\n on: function on(object, value) {\n var opt = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n !beforeCache && (beforeCache = object.previousAttributes());\n\n if (opt.avoidStore) {\n return;\n } else {\n var result = {\n object: object,\n before: beforeCache,\n after: object.toJSON()\n };\n beforeCache = null;\n return result;\n }\n },\n undo: function undo(model, bf, af, opt) {\n model.set(bf);\n },\n redo: function redo(model, bf, af, opt) {\n model.set(af);\n }\n };\n\n var events = ['style', 'attributes', 'content', 'src'];\n events.forEach(function (ev) {\n return um.addUndoType('change:' + ev, customUndoType);\n });\n um.on('undo redo', function () {\n return em.trigger('change:selectedComponent change:canvasOffset');\n });\n ['undo', 'redo'].forEach(function (ev) {\n return um.on(ev, function () {\n return em.trigger(ev);\n });\n });\n\n return this;\n },\n\n\n /**\n * Get module configurations\n * @return {Object} Configuration object\n * @example\n * const config = um.getConfig();\n * // { ... }\n */\n getConfig: function getConfig() {\n return config;\n },\n\n\n /**\n * Add an entity (Model/Collection) to track\n * Note: New Components and CSSRules will be added automatically\n * @param {Model|Collection} entity Entity to track\n * @return {this}\n * @example\n * um.add(someModelOrCollection);\n */\n add: function add(entity) {\n um.register(entity);\n return this;\n },\n\n\n /**\n * Remove and stop tracking the entity (Model/Collection)\n * @param {Model|Collection} entity Entity to remove\n * @return {this}\n * @example\n * um.remove(someModelOrCollection);\n */\n remove: function remove(entity) {\n um.unregister(entity);\n return this;\n },\n\n\n /**\n * Remove all entities\n * @return {this}\n * @example\n * um.removeAll();\n */\n removeAll: function removeAll() {\n um.unregisterAll();\n return this;\n },\n\n\n /**\n * Start/resume tracking changes\n * @return {this}\n * @example\n * um.start();\n */\n start: function start() {\n um.startTracking();\n return this;\n },\n\n\n /**\n * Stop tracking changes\n * @return {this}\n * @example\n * um.stop();\n */\n stop: function stop() {\n um.stopTracking();\n return this;\n },\n\n\n /**\n * Undo last change\n * @return {this}\n * @example\n * um.undo();\n */\n undo: function undo() {\n if (!em.get('Canvas').isInputFocused()) um.undo(1);\n return this;\n },\n\n\n /**\n * Undo all changes\n * @return {this}\n * @example\n * um.undoAll();\n */\n undoAll: function undoAll() {\n um.undoAll();\n return this;\n },\n\n\n /**\n * Redo last change\n * @return {this}\n * @example\n * um.redo();\n */\n redo: function redo() {\n if (!em.get('Canvas').isInputFocused()) um.redo(1);\n return this;\n },\n\n\n /**\n * Redo all changes\n * @return {this}\n * @example\n * um.redoAll();\n */\n redoAll: function redoAll() {\n um.redoAll();\n return this;\n },\n\n\n /**\n * Checks if exists an available undo\n * @return {Boolean}\n * @example\n * um.hasUndo();\n */\n hasUndo: function hasUndo() {\n return um.isAvailable('undo');\n },\n\n\n /**\n * Checks if exists an available redo\n * @return {Boolean}\n * @example\n * um.hasRedo();\n */\n hasRedo: function hasRedo() {\n return um.isAvailable('redo');\n },\n\n\n /**\n * Get stack of changes\n * @return {Collection}\n * @example\n * const stack = um.getStack();\n * stack.each(item => ...);\n */\n getStack: function getStack() {\n return um.stack;\n },\n\n\n /**\n * Clear the stack\n * @return {this}\n * @example\n * um.clear();\n */\n clear: function clear() {\n um.clear();\n return this;\n },\n getInstance: function getInstance() {\n return um;\n }\n };\n};\n\n/***/ }),\n/* 69 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!\n * Backbone.Undo.js v0.2\n * \n * Copyright (c)2013 Oliver Sartun\n * Released under the MIT License\n *\n * Documentation and full license available at\n * https://github.com/osartun/Backbone.Undo.js\n */\n\n\n(function (factory) {\n\tif (true) {\n\t\t// AMD support\n\t\t!(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(70)], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\t} else if (typeof exports !== 'undefined') {\n\t\t// CommonJS support\n\t\tmodule.exports = factory(\n\t\t\trequire(\"underscore\"),\n\t\t\trequire(\"backbone\")\n\t\t);\n\t} else {\n\t\t// Non-modular execution\n\t\tfactory(_, Backbone);\n }\n})(function (_, Backbone) {\n\n\tvar core_slice = Array.prototype.slice;\n\n\t/**\n\t * As call is faster than apply, this is a faster version of apply as it uses call.\n\t * \n\t * @param {Function} fn \tThe function to execute \n\t * @param {Object} ctx \tThe context the function should be called in\n\t * @param {Array} args \tThe array of arguments that should be applied to the function\n\t * @return Forwards whatever the called function returns\n\t */\n\tfunction apply (fn, ctx, args) {\n\t\treturn args.length <= 4 ?\n\t\t\tfn.call(ctx, args[0], args[1], args[2], args[3]) :\n\t\t\tfn.apply(ctx, args);\n\t}\n\n\t/**\n\t * Uses slice on an array or an array-like object.\n\t * \n\t * @param {Array|Object} \tarr \tThe array or array-like object.\n\t * @param {Number} \t\t[index]\tThe index from where the array should be sliced. Default is 0.\n\t * @return {Array} The sliced array\n\t */\n\tfunction slice (arr, index) {\n\t\treturn core_slice.call(arr, index);\n\t}\n\n\t/**\n\t * Checks if an object has one or more specific keys. The keys \n\t * don't have to be an owned property.\n\t * You can call this function either this way:\n\t * hasKeys(obj, [\"a\", \"b\", \"c\"])\n\t * or this way:\n\t * hasKeys(obj, \"a\", \"b\", \"c\")\n\t * \n\t * @param {Object} \tobj \tThe object to check on\n\t * @param {Array} \tkeys \tThe keys to check for\n\t * @return {Boolean} True, if the object has all those keys\n\t */\n\tfunction hasKeys (obj, keys) {\n\t\tif (obj == null) return false;\n\t\tif (!_.isArray(keys)) {\n\t\t\tkeys = slice(arguments, 1);\n\t\t}\n\t\treturn _.all(keys, function (key) {\n\t\t\treturn key in obj;\n\t\t});\n\t}\n\n\t/**\n\t * Returns a number that is unique per call stack. The number gets \n\t * changed after the call stack has been completely processed.\n\t * \n\t * @return {number} MagicFusionIndex\n\t */\n\tvar getMagicFusionIndex = (function () {\n\t\t// If you add several models to a collection or set several\n\t\t// attributes on a model all in sequence and yet all for\n\t\t// example in one function, then several Undo-Actions are\n\t\t// generated.\n\t\t// If you want to undo your last action only the last model\n\t\t// would be removed from the collection or the last set\n\t\t// attribute would be changed back to its previous value.\n\t\t// To prevent that we have to figure out a way to combine\n\t\t// all those actions that happened \"at the same time\". \n\t\t// Timestamps aren't exact enough. A complex routine could \n\t\t// run several milliseconds and in that time produce a lot \n\t\t// of actions with different timestamps.\n\t\t// Instead we take advantage of the single-threadedness of\n\t\t// JavaScript:\n\n\t\tvar callstackWasIndexed = false, magicFusionIndex = -1;\n\t\tfunction indexCycle() {\n\t\t\tmagicFusionIndex++;\n\t\t\tcallstackWasIndexed = true;\n\t\t\t_.defer(function () {\n\t\t\t\t// Here comes the magic. With a Timeout of 0 \n\t\t\t\t// milliseconds this function gets called whenever\n\t\t\t\t// the current callstack is completed\n\t\t\t\tcallstackWasIndexed = false;\n\t\t\t})\n\t\t}\n\t\treturn function () {\n\t\t\tif (!callstackWasIndexed) {\n\t\t\t\tindexCycle();\n\t\t\t}\n\t\t\treturn magicFusionIndex;\n\t\t}\n\t})();\n\n\t/**\n\t * To prevent binding a listener several times to one \n\t * object, we register the objects in an ObjectRegistry\n\t *\n\t * @constructor\n\t */\n\tfunction ObjectRegistry () {\n\t\t// This uses two different ways of storing\n\t\t// objects: In case the object has a cid\n\t\t// (which Backbone objects typically have)\n\t\t// it uses this cid as an index. That way\n\t\t// the Array's length attribute doesn't \n\t\t// change and the object isn't an item \n\t\t// in the array, but an object-property.\n\t\t// Otherwise it's added to the Array as an\n\t\t// item.\n\t\t// That way we can use the fast property-\n\t\t// lookup and only have to fall back to \n\t\t// iterating over the array in case \n\t\t// non-Backbone-objects are registered.\n\t\tthis.registeredObjects = [];\n\t\t// To return a list of all registered \n\t\t// objects in the 'get' method we have to\n\t\t// store the objects that have a cid in\n\t\t// an additional array. \n\t\tthis.cidIndexes = [];\n\t}\n\tObjectRegistry.prototype = {\n\t\t/**\n\t\t * Returns whether the object is already registered in this ObjectRegistry or not.\n\t\t * \n\t\t * @this \t{ObjectRegistry}\n\t\t * @param \t{Object} \t\t obj \tThe object to check\n\t\t * @return \t{Boolean} True if the object is already registered\n\t\t */\n\t\tisRegistered: function (obj) {\n\t\t\t// This is where we get a performance boost \n\t\t\t// by using the two different ways of storing \n\t\t\t// objects.\n\t\t\treturn obj && obj.cid ? this.registeredObjects[obj.cid] : _.contains(this.registeredObjects, obj);\n\t\t},\n\t\t/**\n\t\t * Registers an object in this ObjectRegistry.\n\t\t * \n\t\t * @this \t{ObjectRegistry}\n\t\t * @param \t{Object} \t\t obj \tThe object to register\n\t\t * @return \t{undefined}\n\t\t */\n\t\tregister: function (obj) {\n\t\t\tif (!this.isRegistered(obj)) {\n\t\t\t\tif (obj && obj.cid) {\n\t\t\t\t\tthis.registeredObjects[obj.cid] = obj;\n\t\t\t\t\tthis.cidIndexes.push(obj.cid);\n\t\t\t\t} else {\n\t\t\t\t\tthis.registeredObjects.push(obj);\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn false;\n\t\t},\n\t\t/**\n\t\t * Unregisters an object from this ObjectRegistry.\n\t\t * \n\t\t * @this {ObjectRegistry}\n\t\t * @param {Object} obj The object to unregister\n\t\t * @return {undefined}\n\t\t */\n\t\tunregister: function (obj) {\n\t\t\tif (this.isRegistered(obj)) {\n\t\t\t\tif (obj && obj.cid) {\n\t\t\t\t\tdelete this.registeredObjects[obj.cid];\n\t\t\t\t\tthis.cidIndexes.splice(_.indexOf(this.cidIndexes, obj.cid), 1);\n\t\t\t\t} else {\n\t\t\t\t\tvar i = _.indexOf(this.registeredObjects, obj);\n\t\t\t\t\tthis.registeredObjects.splice(i, 1);\n\t\t\t\t}\n\t\t\t\treturn true;\n\t\t\t}\n\t\t\treturn false;\n\t\t},\n\t\t/**\n\t\t * Returns an array of all objects that are currently in this ObjectRegistry.\n\t\t * \n\t\t * @return {Array} An array of all the objects which are currently in the ObjectRegistry\n\t\t */\n\t\tget: function () {\n\t\t\treturn (_.map(this.cidIndexes, function (cid) {return this.registeredObjects[cid];}, this)).concat(this.registeredObjects);\n\t\t}\n\t}\n\n\t/**\n\t * Binds or unbinds the \"all\"-listener for one or more objects.\n\t * \n\t * @param {String} which \tEither \"on\" or \"off\"\n\t * @param {Object[]} objects \tArray of the objects on which the \"all\"-listener should be bound / unbound to\n\t * @param {Function} [fn] \t\tThe function that should be bound / unbound. Optional in case of \"off\"\n\t * @param {Object} [ctx] \tThe context the function should be called in\n\t * @return {undefined}\n\t */\n\tfunction onoff(which, objects, fn, ctx) {\n\t\tfor (var i = 0, l = objects.length, obj; i < l; i++) {\n\t\t\tobj = objects[i];\n\t\t\tif (!obj) continue;\n\t\t\tif (which === \"on\") {\n\t\t\t\tif (!ctx.objectRegistry.register(obj)) {\n\t\t\t\t\t// register returned false, so obj was already registered\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif (!ctx.objectRegistry.unregister(obj)) {\n\t\t\t\t\t// unregister returned false, so obj wasn't registered\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (_.isFunction(obj[which])) {\n\t\t\t\tobj[which](\"all\", fn, ctx);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Calls the undo/redo-function for a specific action.\n\t * \n\t * @param {String} which \tEither \"undo\" or \"redo\"\n\t * @param {Object} action \tThe Action's attributes\n\t * @return {undefined}\n\t */\n\tfunction actionUndoRedo (which, action) {\n\t\tvar type = action.type, undoTypes = action.undoTypes, fn = !undoTypes[type] || undoTypes[type][which];\n\t\tif (_.isFunction(fn)) {\n\t\t\tfn(action.object, action.before, action.after, action.options);\n\t\t}\n\t}\n\n\t/**\n\t * The main undo/redo function.\n\t *\n\t * @param {String} \t\twhich \t Either \"undo\" or \"redo\"\n\t * @param {UndoManager} \tmanager\t The UndoManager-instance on which an \"undo\"/\"redo\"-Event is triggered afterwards\n\t * @param {UndoStack} \t\tstack \t The UndoStack on which we perform\n\t * @param {Boolean} \t\tmagic \t If true, undoes / redoes all actions with the same magicFusionIndex\n\t * @param {Boolean} \t\teverything If true, undoes / redoes every action that had been tracked\n\t * @return {undefined}\n\t */\n\tfunction managerUndoRedo (which, manager, stack, magic, everything) {\n\t\tif (stack.isCurrentlyUndoRedoing || \n\t\t\t(which === \"undo\" && stack.pointer === -1) ||\n\t\t\t(which === \"redo\" && stack.pointer === stack.length - 1)) {\n\t\t\t// We're either currently in an undo- / redo-process or \n\t\t\t// we reached the end of the stack\n\t\t\treturn;\n\t\t}\n\t\tstack.isCurrentlyUndoRedoing = true;\n\t\tvar action, actions, isUndo = which === \"undo\";\n\t\tif (everything) {\n\t\t\t// Undo / Redo all steps until you reach the stack's beginning / end\n\t\t\tactions = isUndo && stack.pointer === stack.length - 1 || // If at the stack's end calling undo\n\t\t\t\t\t !isUndo && stack.pointer === -1 ? // or at the stack's beginning calling redo\n\t\t\t\t\t _.clone(stack.models) : // => Take all the models. Otherwise:\n\t\t\t\t\t core_slice.apply(stack.models, isUndo ? [0, stack.pointer] : [stack.pointer, stack.length - 1]);\n\t\t} else {\n\t\t\t// Undo / Redo only one step\n\t\t\taction = stack.at(isUndo ? stack.pointer : stack.pointer + 1);\n\t\t\tactions = magic ? stack.where({\"magicFusionIndex\": action.get(\"magicFusionIndex\")}) : [action];\n\t\t}\n\t\t\n\t\tstack.pointer += (isUndo ? -1 : 1) * actions.length;\n\t\twhile (action = isUndo ? actions.pop() : actions.shift()) {\n\t\t\t// Here we're calling the Action's undo / redo method\n\t\t\taction[which]();\n\t\t}\n\t\tstack.isCurrentlyUndoRedoing = false;\n\n\t\tmanager.trigger(which, manager);\n\t}\n\n\t/**\n\t * Checks whether an UndoAction should be created or not. Therefore it checks\n\t * whether a \"condition\" property is set in the undoTypes-object of the specific\n\t * event type. If not, it returns true. If it's set and a boolean, it returns it.\n\t * If it's a function, it returns its result, converting it into a boolean. \n\t * Otherwise it returns true.\n\t * \n\t * @param {Object} \tundoTypesType \tThe object within the UndoTypes that holds the function for this event type (i.e. \"change\")\n\t * @param {Arguments} \targs \t\tThe arguments the \"condition\" function is called with\n\t * @return {Boolean} \tTrue, if an UndoAction should be created\n\t */\n\tfunction validateUndoActionCreation (undoTypesType, args) {\n\t\tvar condition = undoTypesType.condition, type = typeof condition;\n\t\treturn type === \"function\" ? !!apply(condition, undoTypesType, args) :\n\t\t\ttype === \"boolean\" ? condition : true;\n\t}\n\n\t/**\n\t * Adds an Undo-Action to the stack.\n\t * \n\t * @param {UndoStack} \t\tstack \t\tThe undostack the action should be added to.\n\t * @param {String} \t\t\ttype \t\tThe event type (i.e. \"change\")\n\t * @param {Arguments} \t\targs \t\tThe arguments passed to the undoTypes' \"on\"-handler\n\t * @param {OwnedUndoTypes} \tundoTypes \tThe undoTypes-object which has the \"on\"-handler\n\t * @return {undefined}\n\t */\n\tfunction addToStack(stack, type, args, undoTypes) {\n\t\tif (stack.track && !stack.isCurrentlyUndoRedoing && type in undoTypes &&\n\t\t\tvalidateUndoActionCreation(undoTypes[type], args)) {\n\t\t\t// An UndoAction should be created\n\t\t\tvar res = apply(undoTypes[type][\"on\"], undoTypes[type], args), diff;\n\t\t\tif (hasKeys(res, \"object\", \"before\", \"after\")) {\n\t\t\t\tres.type = type;\n\t\t\t\tres.magicFusionIndex = getMagicFusionIndex();\n\t\t\t\tres.undoTypes = undoTypes;\n\t\t\t\tif (stack.pointer < stack.length - 1) {\n\t\t\t\t\t// New Actions must always be added to the end of the stack.\n\t\t\t\t\t// If the pointer is not pointed to the last action in the\n\t\t\t\t\t// stack, presumably because actions were undone before, then\n\t\t\t\t\t// all following actions must be discarded\n\t\t\t\t\tvar diff = stack.length - stack.pointer - 1;\n\t\t\t\t\twhile (diff--) {\n\t\t\t\t\t\tstack.pop();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tstack.pointer = stack.length;\n\t\t\t\tstack.add(res);\n\t\t\t\tif (stack.length > stack.maximumStackLength) {\n\t\t\t\t\tstack.shift();\n\t\t\t\t\tstack.pointer--;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\n\n\t/**\n\t * Predefined UndoTypes object with default handlers for the most common events.\n\t * @type {Object}\n\t */\n\tvar UndoTypes = {\n\t\t\"add\": {\n\t\t\t\"undo\": function (collection, ignore, model, options) {\n\t\t\t\t// Undo add = remove\n\t\t\t\tcollection.remove(model, options);\n\t\t\t},\n\t\t\t\"redo\": function (collection, ignore, model, options) {\n\t\t\t\t// Redo add = add\n\t\t\t\tif (options.index) {\n\t\t\t\t\toptions.at = options.index;\n\t\t\t\t}\n\t\t\t\tcollection.add(model, options);\n\t\t\t},\n\t\t\t\"on\": function (model, collection, options) {\n\t\t\t\treturn {\n\t\t\t\t\tobject: collection,\n\t\t\t\t\tbefore: undefined,\n\t\t\t\t\tafter: model,\n\t\t\t\t\toptions: _.clone(options)\n\t\t\t\t};\n\t\t\t}\n\t\t},\n\t\t\"remove\": {\n\t\t\t\"undo\": function (collection, model, ignore, options) {\n\t\t\t\tif (\"index\" in options) {\n\t\t\t\t\toptions.at = options.index;\n\t\t\t\t}\n\t\t\t\tcollection.add(model, options);\n\t\t\t},\n\t\t\t\"redo\": function (collection, model, ignore, options) {\n\t\t\t\tcollection.remove(model, options);\n\t\t\t},\n\t\t\t\"on\": function (model, collection, options) {\n\t\t\t\treturn {\n\t\t\t\t\tobject: collection,\n\t\t\t\t\tbefore: model,\n\t\t\t\t\tafter: undefined,\n\t\t\t\t\toptions: _.clone(options)\n\t\t\t\t};\n\t\t\t}\n\t\t},\n\t\t\"change\": {\n\t\t\t\"undo\": function (model, before, after, options) {\n\t\t\t\tif (_.isEmpty(before)) {\n\t\t\t\t\t_.each(_.keys(after), model.unset, model);\n\t\t\t\t} else {\n\t\t\t\t\tmodel.set(before);\n\t\t\t\t\tif (options && options.unsetData && options.unsetData.before && options.unsetData.before.length) {\n\t\t\t\t\t\t_.each(options.unsetData.before, model.unset, model);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"redo\": function (model, before, after, options) {\n\t\t\t\tif (_.isEmpty(after)) {\n\t\t\t\t\t_.each(_.keys(before), model.unset, model);\n\t\t\t\t} else {\n\t\t\t\t\tmodel.set(after);\n\t\t\t\t\tif (options && options.unsetData && options.unsetData.after && options.unsetData.after.length) {\n\t\t\t\t\t\t_.each(options.unsetData.after, model.unset, model);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t},\n\t\t\t\"on\": function (model, options) {\n\t\t\t\tvar\n\t\t\t\tafterAttributes = model.changedAttributes(),\n\t\t\t\tkeysAfter = _.keys(afterAttributes),\n\t\t\t\tpreviousAttributes = _.pick(model.previousAttributes(), keysAfter),\n\t\t\t\tkeysPrevious = _.keys(previousAttributes),\n\t\t\t\tunsetData = (options || (options = {})).unsetData = {\n\t\t\t\t\tafter: [],\n\t\t\t\t\tbefore: []\n\t\t\t\t};\n\n\t\t\t\tif (keysAfter.length != keysPrevious.length) {\n\t\t\t\t\t// There are new attributes or old attributes have been unset\n\t\t\t\t\tif (keysAfter.length > keysPrevious.length) {\n\t\t\t\t\t\t// New attributes have been added\n\t\t\t\t\t\t_.each(keysAfter, function (val) {\n\t\t\t\t\t\t\tif (!(val in previousAttributes)) {\n\t\t\t\t\t\t\t\tunsetData.before.push(val);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}, this);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Old attributes have been unset\n\t\t\t\t\t\t_.each(keysPrevious, function (val) {\n\t\t\t\t\t\t\tif (!(val in afterAttributes)) {\n\t\t\t\t\t\t\t\tunsetData.after.push(val);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t})\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\treturn {\n\t\t\t\t\tobject: model,\n\t\t\t\t\tbefore: previousAttributes,\n\t\t\t\t\tafter: afterAttributes,\n\t\t\t\t\toptions: _.clone(options)\n\t\t\t\t};\n\t\t\t}\n\t\t},\n\t\t\"reset\": {\n\t\t\t\"undo\": function (collection, before, after) {\n\t\t\t\tcollection.reset(before);\n\t\t\t},\n\t\t\t\"redo\": function (collection, before, after) {\n\t\t\t\tcollection.reset(after);\n\t\t\t},\n\t\t\t\"on\": function (collection, options) {\n\t\t\t\treturn {\n\t\t\t\t\tobject: collection,\n\t\t\t\t\tbefore: options.previousModels,\n\t\t\t\t\tafter: _.clone(collection.models)\n\t\t\t\t};\n\t\t\t}\n\t\t}\n\t};\n\n\t/**\n\t * Every UndoManager instance has an own undoTypes object\n\t * which is an instance of OwnedUndoTypes. OwnedUndoTypes' \n\t * prototype is the global UndoTypes object. Changes to the \n\t * global UndoTypes object take effect on every instance of\n\t * UndoManager as the object is its prototype. And yet every \n\t * local UndoTypes object can be changed individually.\n\t *\n\t * @constructor\n\t */\n\tfunction OwnedUndoTypes () {}\n\tOwnedUndoTypes.prototype = UndoTypes;\n\n\t/**\n\t * Adds, changes or removes an undo-type from an UndoTypes-object.\n\t * You can call it this way:\n\t * manipulateUndoType (1, \"reset\", {\"on\": function () {}}, undoTypes)\n\t * or this way to perform bulk actions:\n\t * manipulateUndoType (1, {\"reset\": {\"on\": function () {}}}, undoTypes)\n\t * In case of removing undo-types you can pass an Array for performing\n\t * bulk actions:\n\t * manipulateUndoType(2, [\"reset\", \"change\"], undoTypes)\n\t * \n\t * @param {Number} \t\t\t\t manipType \t\tIndicates the kind of action to execute: 0 for add, 1 for change, 2 for remove\n\t * @param {String|Object|Array} \t undoType \t\t\tThe type of undoType that should be added/changed/removed. Can be an object / array to perform bulk actions\n\t * @param {Object} \t\t\t\t [fns] \t\t\tObject with the functions to add / change. Is optional in case you passed an object as undoType that contains these functions\n\t * @param {OwnedUndoTypes|UndoTypes} undoTypesInstance The undoTypes object to act on\n\t * @return {undefined}\n\t */\n\tfunction manipulateUndoType (manipType, undoType, fns, undoTypesInstance) {\n\t\t// manipType, passed by the calling function\n\t\t// 0: add\n\t\t// 1: change\n\t\t// 2: remove\n\t\tif (typeof undoType === \"object\") {\n\t\t\t// bulk action. Iterate over this data.\n\t\t\treturn _.each(undoType, function (val, key) {\n\t\t\t\t\tif (manipType === 2) { // remove\n\t\t\t\t\t\t// undoType is an array\n\t\t\t\t\t\tmanipulateUndoType (manipType, val, fns, undoTypesInstance);\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// undoType is an object\n\t\t\t\t\t\tmanipulateUndoType (manipType, key, val, fns);\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t}\n\n\t\tswitch (manipType) {\n\t\t\tcase 0: // add\n\t\t\t\tif (hasKeys(fns, \"undo\", \"redo\", \"on\") && _.all(_.pick(fns, \"undo\", \"redo\", \"on\"), _.isFunction)) {\n\t\t\t\t\tundoTypesInstance[undoType] = fns;\n\t\t\t\t} \n\t\t\tbreak;\n\t\t\tcase 1: // change\n\t\t\t\tif (undoTypesInstance[undoType] && _.isObject(fns)) {\n\t\t\t\t\t// undoTypeInstance[undoType] may be a prototype's property\n\t\t\t\t\t// So, if we did this _.extend(undoTypeInstance[undoType], fns)\n\t\t\t\t\t// we would extend the object on the prototype which means\n\t\t\t\t\t// that this change would have a global effect\n\t\t\t\t\t// Instead we just want to manipulate this instance. That's why\n\t\t\t\t\t// we're doing this:\n\t\t\t\t\tundoTypesInstance[undoType] = _.extend({}, undoTypesInstance[undoType], fns);\n\t\t\t\t} \n\t\t\tbreak;\n\t\t\tcase 2: // remove\n\t\t\t\tdelete undoTypesInstance[undoType]; \n\t\t\tbreak;\n\t\t}\n\t\treturn this;\n\t}\n\n\t/**\n\t * Instantiating \"Action\" creates the UndoActions that \n\t * are collected in an UndoStack. It holds all relevant \n\t * data to undo / redo an action and has an undo / redo \n\t * method.\n\t */\n\tvar Action = Backbone.Model.extend({\n\t\tdefaults: {\n\t\t\ttype: null, // \"add\", \"change\", \"reset\", etc.\n\t\t\tobject: null, // The object on which the action occurred\n\t\t\tbefore: null, // The previous values which were changed with this action\n\t\t\tafter: null, // The values after this action\n\t\t\tmagicFusionIndex: null // The magicFusionIndex helps to combine \n\t\t\t// all actions that occurred \"at the same time\" to undo/redo them altogether\n\t\t},\n\t\t/**\n\t\t * Undoes this action.\n\t\t * @param {OwnedUndoTypes|UndoTypes} undoTypes The undoTypes object which contains the \"undo\"-handler that should be used\n\t\t * @return {undefined}\n\t\t */\n\t\tundo: function (undoTypes) {\n\t\t\tactionUndoRedo(\"undo\", this.attributes);\n\t\t},\n\t\t/**\n\t\t * Redoes this action.\n\t\t * @param {OwnedUndoTypes|UndoTypes} undoTypes The undoTypes object which contains the \"redo\"-handler that should be used\n\t\t * @return {undefined}\n\t\t */\n\t\tredo: function (undoTypes) {\n\t\t\tactionUndoRedo(\"redo\", this.attributes);\n\t\t}\n\t}),\n\t/**\n\t * An UndoStack is a collection of UndoActions in \n\t * chronological order.\n\t */\n\tUndoStack = Backbone.Collection.extend({\n\t\tmodel: Action,\n\t\tpointer: -1, // The pointer indicates the index where we are located within the stack. We start at -1\n\t\ttrack: false,\n\t\tisCurrentlyUndoRedoing: false,\n\t\tmaximumStackLength: Infinity,\n\t\tsetMaxLength: function (val) {\n\t\t\tthis.maximumStackLength = val;\n\t\t}\n\t}),\n\t/**\n\t * An instance of UndoManager can keep track of \n\t * changes to objects and helps to undo them.\n\t */\n\tUndoManager = Backbone.Model.extend({\n\t\tdefaults: {\n\t\t\tmaximumStackLength: Infinity,\n\t\t\ttrack: false\n\t\t},\n\t\t/**\n\t\t * The constructor function.\n\t\t * @param {attr} \t\t[attr] Object with parameters. The available parameters are:\n\t\t * \t - maximumStackLength {number} \tSet the undo-stack's maximum size\n\t\t * - track \t\t\t\t{boolean}\tStart tracking changes right away\n\t\t * @return {undefined}\n\t\t */\n\t\tinitialize: function (attr) {\n\t\t\tthis.stack = new UndoStack;\n\t\t\tthis.objectRegistry = new ObjectRegistry();\n\t\t\tthis.undoTypes = new OwnedUndoTypes();\n\n\t\t\t// sync the maximumStackLength attribute with our stack\n\t\t\tthis.stack.setMaxLength(this.get(\"maximumStackLength\"));\n\t\t\tthis.on(\"change:maximumStackLength\", function (model, value) {\n\t\t\t\tthis.stack.setMaxLength(value);\n\t\t\t}, this);\n\n\t\t\t// Start tracking, if attr.track == true\n\t\t\tif (attr && attr.track) {\n\t\t\t\tthis.startTracking();\n\t\t\t}\n\n\t\t\t// Register objects passed in the \"register\" attribute\n\t\t\tif (attr && attr.register) {\n\t\t\t\tif (_.isArray(attr.register) || _.isArguments(attr.register)) {\n\t\t\t\t\tapply(this.register, this, attr.register);\n\t\t\t\t} else {\n\t\t\t\t\tthis.register(attr.register);\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t/**\n\t\t * Starts tracking. Changes of registered objects won't be processed until you've called this function\n\t\t * @return {undefined}\n\t\t */\n\t\tstartTracking: function () {\n\t\t\tthis.set(\"track\", true);\n\t\t\tthis.stack.track = true;\n\t\t},\n\t\t/**\n\t\t * Stops tracking. Afterwards changes of registered objects won't be processed.\n\t\t * @return {undefined}\n\t\t */\n\t\tstopTracking: function () {\n\t\t\tthis.set(\"track\", false);\n\t\t\tthis.stack.track = false;\n\t\t},\n\t\t/**\n\t\t * Return the state of the tracking\n\t\t * @return {boolean}\n\t\t */\n\t\tisTracking: function () {\n\t\t\treturn this.get(\"track\");\n\t\t},\n\t\t/**\n\t\t * This is the \"all\"-handler which is bound to registered \n\t\t * objects. It creates an UndoAction from the event and adds \n\t\t * it to the stack.\n\t\t * \n\t\t * @param {String} \ttype \tThe event type\n\t\t * @return {undefined}\n\t\t */\n\t\t_addToStack: function (type) {\n\t\t\taddToStack(this.stack, type, slice(arguments, 1), this.undoTypes);\n\t\t},\n\t\t/**\n\t\t * Registers one or more objects to track their changes.\n\t\t * @param {...Object} \tobj \tThe object or objects of which changes should be tracked\n\t\t * @return {undefined}\n\t\t */\n\t\tregister: function () {\n\t\t\tonoff(\"on\", arguments, this._addToStack, this);\n\t\t},\n\t\t/**\n\t\t * Unregisters one or more objects.\n\t\t * @param {...Object} \tobj \tThe object or objects of which changes shouldn't be tracked any longer\n\t\t * @return {undefined}\n\t\t */\n\t\tunregister: function () {\n\t\t\tonoff(\"off\", arguments, this._addToStack, this);\n\t\t},\n\t\t/**\n\t\t * Unregisters all previously registered objects.\n\t\t * @return {undefined}\n\t\t */\n\t\tunregisterAll: function () {\n\t\t\tapply(this.unregister, this, this.objectRegistry.get());\n\t\t},\n\t\t/**\n\t\t * Undoes the last action or the last set of actions in case 'magic' is true.\n\t\t * @param {Boolean} \t[magic] \tIf true, all actions that happened basically at the same time are undone together\n\t\t * @return {undefined}\n\t\t */\n\t\tundo: function (magic) {\n\t\t\tmanagerUndoRedo(\"undo\", this, this.stack, magic);\n\t\t},\n\n\t\t/**\n\t\t * Undoes all actions ever tracked by the undo manager\n\t\t * @return {undefined}\n\t\t */\n\t\tundoAll: function () {\n\t\t\tmanagerUndoRedo(\"undo\", this, this.stack, false, true);\n\t\t},\n\n\t\t/**\n\t\t * Redoes a previously undone action or a set of actions.\n\t\t * @param {Boolean} \t[magic] \tIf true, all actions that happened basically at the same time are redone together\n\t\t * @return {undefined}\n\t\t */\n\t\tredo: function (magic) {\n\t\t\tmanagerUndoRedo(\"redo\", this, this.stack, magic);\n\t\t},\n\n\t\t/**\n\t\t * Redoes all actions ever tracked by the undo manager\n\t\t * @return {undefined}\n\t\t */\n\t\tredoAll: function () {\n\t\t\tmanagerUndoRedo(\"redo\", this, this.stack, false, true);\n\t\t},\n\t\t/**\n\t\t * Checks if there's an action in the stack that can be undone / redone\n\t\t * @param {String} \ttype \tEither \"undo\" or \"redo\"\n\t\t * @return {Boolean} True if there is a set of actions which can be undone / redone\n\t\t */\n\t\tisAvailable: function (type) {\n\t\t\tvar s = this.stack, l = s.length;\n\n\t\t\tswitch (type) {\n\t\t\t\tcase \"undo\": return l > 0 && s.pointer > -1;\n\t\t\t\tcase \"redo\": return l > 0 && s.pointer < l - 1;\n\t\t\t\tdefault: return false;\n\t\t\t}\n\t\t},\n\t\t/**\n\t\t * Sets the stack-reference to the stack of another undoManager.\n\t\t * @param {UndoManager} \tundoManager \tThe undoManager whose stack-reference is set to this stack\n\t\t * @return {undefined}\n\t\t */\n\t\tmerge: function (undoManager) {\n\t\t\t// This sets the stack-reference to the stack of another \n\t\t\t// undoManager so that the stack of this other undoManager \n\t\t\t// is used by two different managers.\n\t\t\t// This enables to set up a main-undoManager and besides it\n\t\t\t// several others for special, exceptional cases (by using\n\t\t\t// instance-based custom UndoTypes). Models / collections \n\t\t\t// which need this special treatment are only registered at \n\t\t\t// those special undoManagers. Those special ones are then \n\t\t\t// merged into the main-undoManager to write on its stack. \n\t\t\t// That way it's easier to manage exceptional cases.\n\t\t\tvar args = _.isArray(undoManager) ? undoManager : slice(arguments), manager;\n\t\t\twhile (manager = args.pop()) {\n\t\t\t\tif (manager instanceof UndoManager &&\n\t\t\t\t\tmanager.stack instanceof UndoStack) {\n\t\t\t\t\t// set the stack reference to our stack\n\t\t\t\t\tmanager.stack = this.stack;\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\t\t/**\n\t\t * Add an UndoType to this specific UndoManager-instance.\n\t\t * @param {String} type The event this UndoType is made for\n\t\t * @param {Object} fns An object of functions that are called to generate the data for an UndoAction or to process it. Must have the properties \"undo\", \"redo\" and \"on\". Can have the property \"condition\".\n\t\t * @return {undefined}\n\t\t */\n\t\taddUndoType: function (type, fns) {\n\t\t\tmanipulateUndoType(0, type, fns, this.undoTypes);\n\t\t},\n\t\t/**\n\t\t * Overwrite properties of an existing UndoType for this specific UndoManager-instance.\n\t\t * @param {String} type The event the UndoType is made for\n\t\t * @param {Object} fns An object of functions that are called to generate the data for an UndoAction or to process it. It extends the existing object.\n\t\t * @return {undefined}\n\t\t */\n\t\tchangeUndoType: function (type, fns) {\n\t\t\tmanipulateUndoType(1, type, fns, this.undoTypes);\n\t\t},\n\t\t/**\n\t\t * Remove one or more UndoTypes of this specific UndoManager-instance to fall back to the global UndoTypes.\n\t\t * @param {String|Array} type The event the UndoType that should be removed is made for. You can also pass an array of events.\n\t\t * @return {undefined}\n\t\t */\n\t\tremoveUndoType: function (type) {\n\t\t\tmanipulateUndoType(2, type, undefined, this.undoTypes);\n\t\t},\n\n\t\t/**\n\t\t * Removes all actions from the stack.\n\t\t * @return {undefined}\n\t\t */\n\t\tclear: function() {\n\t\t\tthis.stack.reset();\n\t\t\tthis.stack.pointer = -1;\n\t\t}\n\t});\n\n\t_.extend(UndoManager, {\n\t\t/**\n\t\t * Change the UndoManager's default attributes\n\t\t * @param {Object} defaultAttributes An object with the new default values.\n\t\t * @return {undefined}\n\t\t */\n\t\tdefaults: function (defaultAttributes) {\n\t\t\t_.extend(UndoManager.prototype.defaults, defaultAttributes);\n\t\t},\n\t\t/**\n\t\t * Add an UndoType to the global UndoTypes-object.\n\t\t * @param {String} type The event this UndoType is made for\n\t\t * @param {Object} fns An object of functions that are called to generate the data for an UndoAction or to process it. Must have the properties \"undo\", \"redo\" and \"on\". Can have the property \"condition\".\n\t\t * @return {undefined}\n\t\t */\n\t\t\"addUndoType\": function (type, fns) {\n\t\t\tmanipulateUndoType(0, type, fns, UndoTypes);\n\t\t},\n\t\t/**\n\t\t * Overwrite properties of an existing UndoType in the global UndoTypes-object.\n\t\t * @param {String} type The event the UndoType is made for\n\t\t * @param {Object} fns An object of functions that are called to generate the data for an UndoAction or to process it. It extends the existing object.\n\t\t * @return {undefined}\n\t\t */\n\t\t\"changeUndoType\": function (type, fns) {\n\t\t\tmanipulateUndoType(1, type, fns, UndoTypes)\n\t\t},\n\t\t/**\n\t\t * Remove one or more UndoTypes of this specific UndoManager-instance to fall back to the global UndoTypes.\n\t\t * @param {String|Array} type The event the UndoType that should be removed is made for. You can also pass an array of events.\n\t\t * @return {undefined}\n\t\t */\n\t\t\"removeUndoType\": function (type) {\n\t\t\tmanipulateUndoType(2, type, undefined, UndoTypes);\n\t\t}\n\t})\n\n\treturn Backbone.UndoManager = UndoManager;\n\n});\n\n\n/***/ }),\n/* 70 */\n/***/ (function(module, exports, __webpack_require__) {\n\n/* WEBPACK VAR INJECTION */(function(global) {var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;// Backbone.js 1.2.1\n\n// (c) 2010-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n// Backbone may be freely distributed under the MIT license.\n// For all details and documentation:\n// http://backbonejs.org\n\n(function(factory) {\n\n // Establish the root object, `window` (`self`) in the browser, or `global` on the server.\n // We use `self` instead of `window` for `WebWorker` support.\n var root = (typeof self == 'object' && self.self == self && self) ||\n (typeof global == 'object' && global.global == global && global);\n\n // Set up Backbone appropriately for the environment. Start with AMD.\n if (true) {\n !(__WEBPACK_AMD_DEFINE_ARRAY__ = [__webpack_require__(1), __webpack_require__(9), exports], __WEBPACK_AMD_DEFINE_RESULT__ = function(_, $, exports) {\n // Export global even in AMD case in case this script is loaded with\n // others that may still expect a global Backbone.\n root.Backbone = factory(root, exports, _, $);\n }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),\n\t\t\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n\n // Next for Node.js or CommonJS. jQuery may not be needed as a module.\n } else if (typeof exports !== 'undefined') {\n var _ = require('underscore'), $;\n try { $ = require('jquery'); } catch(e) {}\n factory(root, exports, _, $);\n\n // Finally, as a browser global.\n } else {\n root.Backbone = factory(root, {}, root._, (root.jQuery || root.Zepto || root.ender || root.$));\n }\n\n}(function(root, Backbone, _, $) {\n\n // Initial Setup\n // -------------\n\n // Save the previous value of the `Backbone` variable, so that it can be\n // restored later on, if `noConflict` is used.\n var previousBackbone = root.Backbone;\n\n // Create a local reference to a common array method we'll want to use later.\n var slice = [].slice;\n\n // Current version of the library. Keep in sync with `package.json`.\n Backbone.VERSION = '1.2.1';\n\n // For Backbone's purposes, jQuery, Zepto, Ender, or My Library (kidding) owns\n // the `$` variable.\n Backbone.$ = $;\n\n // Runs Backbone.js in *noConflict* mode, returning the `Backbone` variable\n // to its previous owner. Returns a reference to this Backbone object.\n Backbone.noConflict = function() {\n root.Backbone = previousBackbone;\n return this;\n };\n\n // Turn on `emulateHTTP` to support legacy HTTP servers. Setting this option\n // will fake `\"PATCH\"`, `\"PUT\"` and `\"DELETE\"` requests via the `_method` parameter and\n // set a `X-Http-Method-Override` header.\n Backbone.emulateHTTP = false;\n\n // Turn on `emulateJSON` to support legacy servers that can't deal with direct\n // `application/json` requests ... this will encode the body as\n // `application/x-www-form-urlencoded` instead and will send the model in a\n // form param named `model`.\n Backbone.emulateJSON = false;\n\n // Proxy Underscore methods to a Backbone class' prototype using a\n // particular attribute as the data argument\n var addMethod = function(length, method, attribute) {\n switch (length) {\n case 1: return function() {\n return _[method](this[attribute]);\n };\n case 2: return function(value) {\n return _[method](this[attribute], value);\n };\n case 3: return function(iteratee, context) {\n return _[method](this[attribute], iteratee, context);\n };\n case 4: return function(iteratee, defaultVal, context) {\n return _[method](this[attribute], iteratee, defaultVal, context);\n };\n default: return function() {\n var args = slice.call(arguments);\n args.unshift(this[attribute]);\n return _[method].apply(_, args);\n };\n }\n };\n var addUnderscoreMethods = function(Class, methods, attribute) {\n _.each(methods, function(length, method) {\n if (_[method]) Class.prototype[method] = addMethod(length, method, attribute);\n });\n };\n\n // Backbone.Events\n // ---------------\n\n // A module that can be mixed in to *any object* in order to provide it with\n // custom events. You may bind with `on` or remove with `off` callback\n // functions to an event; `trigger`-ing an event fires all callbacks in\n // succession.\n //\n // var object = {};\n // _.extend(object, Backbone.Events);\n // object.on('expand', function(){ alert('expanded'); });\n // object.trigger('expand');\n //\n var Events = Backbone.Events = {};\n\n // Regular expression used to split event strings.\n var eventSplitter = /\\s+/;\n\n // Iterates over the standard `event, callback` (as well as the fancy multiple\n // space-separated events `\"change blur\", callback` and jQuery-style event\n // maps `{event: callback}`), reducing them by manipulating `memo`.\n // Passes a normalized single event name and callback, as well as any\n // optional `opts`.\n var eventsApi = function(iteratee, memo, name, callback, opts) {\n var i = 0, names;\n if (name && typeof name === 'object') {\n // Handle event maps.\n if (callback !== void 0 && 'context' in opts && opts.context === void 0) opts.context = callback;\n for (names = _.keys(name); i < names.length ; i++) {\n memo = iteratee(memo, names[i], name[names[i]], opts);\n }\n } else if (name && eventSplitter.test(name)) {\n // Handle space separated event names.\n for (names = name.split(eventSplitter); i < names.length; i++) {\n memo = iteratee(memo, names[i], callback, opts);\n }\n } else {\n memo = iteratee(memo, name, callback, opts);\n }\n return memo;\n };\n\n // Bind an event to a `callback` function. Passing `\"all\"` will bind\n // the callback to all events fired.\n Events.on = function(name, callback, context) {\n return internalOn(this, name, callback, context);\n };\n\n // An internal use `on` function, used to guard the `listening` argument from\n // the public API.\n var internalOn = function(obj, name, callback, context, listening) {\n obj._events = eventsApi(onApi, obj._events || {}, name, callback, {\n context: context,\n ctx: obj,\n listening: listening\n });\n\n if (listening) {\n var listeners = obj._listeners || (obj._listeners = {});\n listeners[listening.id] = listening;\n }\n\n return obj;\n };\n\n // Inversion-of-control versions of `on`. Tell *this* object to listen to\n // an event in another object... keeping track of what it's listening to.\n Events.listenTo = function(obj, name, callback) {\n if (!obj) return this;\n var id = obj._listenId || (obj._listenId = _.uniqueId('l'));\n var listeningTo = this._listeningTo || (this._listeningTo = {});\n var listening = listeningTo[id];\n\n // This object is not listening to any other events on `obj` yet.\n // Setup the necessary references to track the listening callbacks.\n if (!listening) {\n var thisId = this._listenId || (this._listenId = _.uniqueId('l'));\n listening = listeningTo[id] = {obj: obj, objId: id, id: thisId, listeningTo: listeningTo, count: 0};\n }\n\n // Bind callbacks on obj, and keep track of them on listening.\n internalOn(obj, name, callback, this, listening);\n return this;\n };\n\n // The reducing API that adds a callback to the `events` object.\n var onApi = function(events, name, callback, options) {\n if (callback) {\n var handlers = events[name] || (events[name] = []);\n var context = options.context, ctx = options.ctx, listening = options.listening;\n if (listening) listening.count++;\n\n handlers.push({ callback: callback, context: context, ctx: context || ctx, listening: listening });\n }\n return events;\n };\n\n // Remove one or many callbacks. If `context` is null, removes all\n // callbacks with that function. If `callback` is null, removes all\n // callbacks for the event. If `name` is null, removes all bound\n // callbacks for all events.\n Events.off = function(name, callback, context) {\n if (!this._events) return this;\n this._events = eventsApi(offApi, this._events, name, callback, {\n context: context,\n listeners: this._listeners\n });\n return this;\n };\n\n // Tell this object to stop listening to either specific events ... or\n // to every object it's currently listening to.\n Events.stopListening = function(obj, name, callback) {\n var listeningTo = this._listeningTo;\n if (!listeningTo) return this;\n\n var ids = obj ? [obj._listenId] : _.keys(listeningTo);\n\n for (var i = 0; i < ids.length; i++) {\n var listening = listeningTo[ids[i]];\n\n // If listening doesn't exist, this object is not currently\n // listening to obj. Break out early.\n if (!listening) break;\n\n listening.obj.off(name, callback, this);\n }\n if (_.isEmpty(listeningTo)) this._listeningTo = void 0;\n\n return this;\n };\n\n // The reducing API that removes a callback from the `events` object.\n var offApi = function(events, name, callback, options) {\n // No events to consider.\n if (!events) return;\n\n var i = 0, listening;\n var context = options.context, listeners = options.listeners;\n\n // Delete all events listeners and \"drop\" events.\n if (!name && !callback && !context) {\n var ids = _.keys(listeners);\n for (; i < ids.length; i++) {\n listening = listeners[ids[i]];\n delete listeners[listening.id];\n delete listening.listeningTo[listening.objId];\n }\n return;\n }\n\n var names = name ? [name] : _.keys(events);\n for (; i < names.length; i++) {\n name = names[i];\n var handlers = events[name];\n\n // Bail out if there are no events stored.\n if (!handlers) break;\n\n // Replace events if there are any remaining. Otherwise, clean up.\n var remaining = [];\n for (var j = 0; j < handlers.length; j++) {\n var handler = handlers[j];\n if (\n callback && callback !== handler.callback &&\n callback !== handler.callback._callback ||\n context && context !== handler.context\n ) {\n remaining.push(handler);\n } else {\n listening = handler.listening;\n if (listening && --listening.count === 0) {\n delete listeners[listening.id];\n delete listening.listeningTo[listening.objId];\n }\n }\n }\n\n // Update tail event if the list has any events. Otherwise, clean up.\n if (remaining.length) {\n events[name] = remaining;\n } else {\n delete events[name];\n }\n }\n if (_.size(events)) return events;\n };\n\n // Bind an event to only be triggered a single time. After the first time\n // the callback is invoked, it will be removed. When multiple events are\n // passed in using the space-separated syntax, the event will fire once for every\n // event you passed in, not once for a combination of all events\n Events.once = function(name, callback, context) {\n // Map the event into a `{event: once}` object.\n var events = eventsApi(onceMap, {}, name, callback, _.bind(this.off, this));\n return this.on(events, void 0, context);\n };\n\n // Inversion-of-control versions of `once`.\n Events.listenToOnce = function(obj, name, callback) {\n // Map the event into a `{event: once}` object.\n var events = eventsApi(onceMap, {}, name, callback, _.bind(this.stopListening, this, obj));\n return this.listenTo(obj, events);\n };\n\n // Reduces the event callbacks into a map of `{event: onceWrapper}`.\n // `offer` unbinds the `onceWrapper` after it has been called.\n var onceMap = function(map, name, callback, offer) {\n if (callback) {\n var once = map[name] = _.once(function() {\n offer(name, once);\n callback.apply(this, arguments);\n });\n once._callback = callback;\n }\n return map;\n };\n\n // Trigger one or many events, firing all bound callbacks. Callbacks are\n // passed the same arguments as `trigger` is, apart from the event name\n // (unless you're listening on `\"all\"`, which will cause your callback to\n // receive the true name of the event as the first argument).\n Events.trigger = function(name) {\n if (!this._events) return this;\n\n var length = Math.max(0, arguments.length - 1);\n var args = Array(length);\n for (var i = 0; i < length; i++) args[i] = arguments[i + 1];\n\n eventsApi(triggerApi, this._events, name, void 0, args);\n return this;\n };\n\n // Handles triggering the appropriate event callbacks.\n var triggerApi = function(objEvents, name, cb, args) {\n if (objEvents) {\n var events = objEvents[name];\n var allEvents = objEvents.all;\n if (events && allEvents) allEvents = allEvents.slice();\n if (events) triggerEvents(events, args);\n if (allEvents) triggerEvents(allEvents, [name].concat(args));\n }\n return objEvents;\n };\n\n // A difficult-to-believe, but optimized internal dispatch function for\n // triggering events. Tries to keep the usual cases speedy (most internal\n // Backbone events have 3 arguments).\n var triggerEvents = function(events, args) {\n var ev, i = -1, l = events.length, a1 = args[0], a2 = args[1], a3 = args[2];\n switch (args.length) {\n case 0: while (++i < l) (ev = events[i]).callback.call(ev.ctx); return;\n case 1: while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1); return;\n case 2: while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1, a2); return;\n case 3: while (++i < l) (ev = events[i]).callback.call(ev.ctx, a1, a2, a3); return;\n default: while (++i < l) (ev = events[i]).callback.apply(ev.ctx, args); return;\n }\n };\n\n // Aliases for backwards compatibility.\n Events.bind = Events.on;\n Events.unbind = Events.off;\n\n // Allow the `Backbone` object to serve as a global event bus, for folks who\n // want global \"pubsub\" in a convenient place.\n _.extend(Backbone, Events);\n\n // Backbone.Model\n // --------------\n\n // Backbone **Models** are the basic data object in the framework --\n // frequently representing a row in a table in a database on your server.\n // A discrete chunk of data and a bunch of useful, related methods for\n // performing computations and transformations on that data.\n\n // Create a new model with the specified attributes. A client id (`cid`)\n // is automatically generated and assigned for you.\n var Model = Backbone.Model = function(attributes, options) {\n var attrs = attributes || {};\n options || (options = {});\n this.cid = _.uniqueId(this.cidPrefix);\n this.attributes = {};\n if (options.collection) this.collection = options.collection;\n if (options.parse) attrs = this.parse(attrs, options) || {};\n attrs = _.defaults({}, attrs, _.result(this, 'defaults'));\n this.set(attrs, options);\n this.changed = {};\n this.initialize.apply(this, arguments);\n };\n\n // Attach all inheritable methods to the Model prototype.\n _.extend(Model.prototype, Events, {\n\n // A hash of attributes whose current and previous value differ.\n changed: null,\n\n // The value returned during the last failed validation.\n validationError: null,\n\n // The default name for the JSON `id` attribute is `\"id\"`. MongoDB and\n // CouchDB users may want to set this to `\"_id\"`.\n idAttribute: 'id',\n\n // The prefix is used to create the client id which is used to identify models locally.\n // You may want to override this if you're experiencing name clashes with model ids.\n cidPrefix: 'c',\n\n // Initialize is an empty function by default. Override it with your own\n // initialization logic.\n initialize: function(){},\n\n // Return a copy of the model's `attributes` object.\n toJSON: function(options) {\n return _.clone(this.attributes);\n },\n\n // Proxy `Backbone.sync` by default -- but override this if you need\n // custom syncing semantics for *this* particular model.\n sync: function() {\n return Backbone.sync.apply(this, arguments);\n },\n\n // Get the value of an attribute.\n get: function(attr) {\n return this.attributes[attr];\n },\n\n // Get the HTML-escaped value of an attribute.\n escape: function(attr) {\n return _.escape(this.get(attr));\n },\n\n // Returns `true` if the attribute contains a value that is not null\n // or undefined.\n has: function(attr) {\n return this.get(attr) != null;\n },\n\n // Special-cased proxy to underscore's `_.matches` method.\n matches: function(attrs) {\n return !!_.iteratee(attrs, this)(this.attributes);\n },\n\n // Set a hash of model attributes on the object, firing `\"change\"`. This is\n // the core primitive operation of a model, updating the data and notifying\n // anyone who needs to know about the change in state. The heart of the beast.\n set: function(key, val, options) {\n if (key == null) return this;\n\n // Handle both `\"key\", value` and `{key: value}` -style arguments.\n var attrs;\n if (typeof key === 'object') {\n attrs = key;\n options = val;\n } else {\n (attrs = {})[key] = val;\n }\n\n options || (options = {});\n\n // Run validation.\n if (!this._validate(attrs, options)) return false;\n\n // Extract attributes and options.\n var unset = options.unset;\n var silent = options.silent;\n var changes = [];\n var changing = this._changing;\n this._changing = true;\n\n if (!changing) {\n this._previousAttributes = _.clone(this.attributes);\n this.changed = {};\n }\n\n var current = this.attributes;\n var changed = this.changed;\n var prev = this._previousAttributes;\n\n // Check for changes of `id`.\n if (this.idAttribute in attrs) this.id = attrs[this.idAttribute];\n\n // For each `set` attribute, update or delete the current value.\n for (var attr in attrs) {\n val = attrs[attr];\n if (!_.isEqual(current[attr], val)) changes.push(attr);\n if (!_.isEqual(prev[attr], val)) {\n changed[attr] = val;\n } else {\n delete changed[attr];\n }\n unset ? delete current[attr] : current[attr] = val;\n }\n\n // Trigger all relevant attribute changes.\n if (!silent) {\n if (changes.length) this._pending = options;\n for (var i = 0; i < changes.length; i++) {\n this.trigger('change:' + changes[i], this, current[changes[i]], options);\n }\n }\n\n // You might be wondering why there's a `while` loop here. Changes can\n // be recursively nested within `\"change\"` events.\n if (changing) return this;\n if (!silent) {\n while (this._pending) {\n options = this._pending;\n this._pending = false;\n this.trigger('change', this, options);\n }\n }\n this._pending = false;\n this._changing = false;\n return this;\n },\n\n // Remove an attribute from the model, firing `\"change\"`. `unset` is a noop\n // if the attribute doesn't exist.\n unset: function(attr, options) {\n return this.set(attr, void 0, _.extend({}, options, {unset: true}));\n },\n\n // Clear all attributes on the model, firing `\"change\"`.\n clear: function(options) {\n var attrs = {};\n for (var key in this.attributes) attrs[key] = void 0;\n return this.set(attrs, _.extend({}, options, {unset: true}));\n },\n\n // Determine if the model has changed since the last `\"change\"` event.\n // If you specify an attribute name, determine if that attribute has changed.\n hasChanged: function(attr) {\n if (attr == null) return !_.isEmpty(this.changed);\n return _.has(this.changed, attr);\n },\n\n // Return an object containing all the attributes that have changed, or\n // false if there are no changed attributes. Useful for determining what\n // parts of a view need to be updated and/or what attributes need to be\n // persisted to the server. Unset attributes will be set to undefined.\n // You can also pass an attributes object to diff against the model,\n // determining if there *would be* a change.\n changedAttributes: function(diff) {\n if (!diff) return this.hasChanged() ? _.clone(this.changed) : false;\n var old = this._changing ? this._previousAttributes : this.attributes;\n var changed = {};\n for (var attr in diff) {\n var val = diff[attr];\n if (_.isEqual(old[attr], val)) continue;\n changed[attr] = val;\n }\n return _.size(changed) ? changed : false;\n },\n\n // Get the previous value of an attribute, recorded at the time the last\n // `\"change\"` event was fired.\n previous: function(attr) {\n if (attr == null || !this._previousAttributes) return null;\n return this._previousAttributes[attr];\n },\n\n // Get all of the attributes of the model at the time of the previous\n // `\"change\"` event.\n previousAttributes: function() {\n return _.clone(this._previousAttributes);\n },\n\n // Fetch the model from the server, merging the response with the model's\n // local attributes. Any changed attributes will trigger a \"change\" event.\n fetch: function(options) {\n options = _.extend({parse: true}, options);\n var model = this;\n var success = options.success;\n options.success = function(resp) {\n var serverAttrs = options.parse ? model.parse(resp, options) : resp;\n if (!model.set(serverAttrs, options)) return false;\n if (success) success.call(options.context, model, resp, options);\n model.trigger('sync', model, resp, options);\n };\n wrapError(this, options);\n return this.sync('read', this, options);\n },\n\n // Set a hash of model attributes, and sync the model to the server.\n // If the server returns an attributes hash that differs, the model's\n // state will be `set` again.\n save: function(key, val, options) {\n // Handle both `\"key\", value` and `{key: value}` -style arguments.\n var attrs;\n if (key == null || typeof key === 'object') {\n attrs = key;\n options = val;\n } else {\n (attrs = {})[key] = val;\n }\n\n options = _.extend({validate: true, parse: true}, options);\n var wait = options.wait;\n\n // If we're not waiting and attributes exist, save acts as\n // `set(attr).save(null, opts)` with validation. Otherwise, check if\n // the model will be valid when the attributes, if any, are set.\n if (attrs && !wait) {\n if (!this.set(attrs, options)) return false;\n } else {\n if (!this._validate(attrs, options)) return false;\n }\n\n // After a successful server-side save, the client is (optionally)\n // updated with the server-side state.\n var model = this;\n var success = options.success;\n var attributes = this.attributes;\n options.success = function(resp) {\n // Ensure attributes are restored during synchronous saves.\n model.attributes = attributes;\n var serverAttrs = options.parse ? model.parse(resp, options) : resp;\n if (wait) serverAttrs = _.extend({}, attrs, serverAttrs);\n if (serverAttrs && !model.set(serverAttrs, options)) return false;\n if (success) success.call(options.context, model, resp, options);\n model.trigger('sync', model, resp, options);\n };\n wrapError(this, options);\n\n // Set temporary attributes if `{wait: true}` to properly find new ids.\n if (attrs && wait) this.attributes = _.extend({}, attributes, attrs);\n\n var method = this.isNew() ? 'create' : (options.patch ? 'patch' : 'update');\n if (method === 'patch' && !options.attrs) options.attrs = attrs;\n var xhr = this.sync(method, this, options);\n\n // Restore attributes.\n this.attributes = attributes;\n\n return xhr;\n },\n\n // Destroy this model on the server if it was already persisted.\n // Optimistically removes the model from its collection, if it has one.\n // If `wait: true` is passed, waits for the server to respond before removal.\n destroy: function(options) {\n options = options ? _.clone(options) : {};\n var model = this;\n var success = options.success;\n var wait = options.wait;\n\n var destroy = function() {\n model.stopListening();\n model.trigger('destroy', model, model.collection, options);\n };\n\n options.success = function(resp) {\n if (wait) destroy();\n if (success) success.call(options.context, model, resp, options);\n if (!model.isNew()) model.trigger('sync', model, resp, options);\n };\n\n var xhr = false;\n if (this.isNew()) {\n _.defer(options.success);\n } else {\n wrapError(this, options);\n xhr = this.sync('delete', this, options);\n }\n if (!wait) destroy();\n return xhr;\n },\n\n // Default URL for the model's representation on the server -- if you're\n // using Backbone's restful methods, override this to change the endpoint\n // that will be called.\n url: function() {\n var base =\n _.result(this, 'urlRoot') ||\n _.result(this.collection, 'url') ||\n urlError();\n if (this.isNew()) return base;\n var id = this.get(this.idAttribute);\n return base.replace(/[^\\/]$/, '$&/') + encodeURIComponent(id);\n },\n\n // **parse** converts a response into the hash of attributes to be `set` on\n // the model. The default implementation is just to pass the response along.\n parse: function(resp, options) {\n return resp;\n },\n\n // Create a new model with identical attributes to this one.\n clone: function() {\n return new this.constructor(this.attributes);\n },\n\n // A model is new if it has never been saved to the server, and lacks an id.\n isNew: function() {\n return !this.has(this.idAttribute);\n },\n\n // Check if the model is currently in a valid state.\n isValid: function(options) {\n return this._validate({}, _.defaults({validate: true}, options));\n },\n\n // Run validation against the next complete set of model attributes,\n // returning `true` if all is well. Otherwise, fire an `\"invalid\"` event.\n _validate: function(attrs, options) {\n if (!options.validate || !this.validate) return true;\n attrs = _.extend({}, this.attributes, attrs);\n var error = this.validationError = this.validate(attrs, options) || null;\n if (!error) return true;\n this.trigger('invalid', this, error, _.extend(options, {validationError: error}));\n return false;\n }\n\n });\n\n // Underscore methods that we want to implement on the Model.\n var modelMethods = { keys: 1, values: 1, pairs: 1, invert: 1, pick: 0,\n omit: 0, chain: 1, isEmpty: 1 };\n\n // Mix in each Underscore method as a proxy to `Model#attributes`.\n addUnderscoreMethods(Model, modelMethods, 'attributes');\n\n // Backbone.Collection\n // -------------------\n\n // If models tend to represent a single row of data, a Backbone Collection is\n // more analogous to a table full of data ... or a small slice or page of that\n // table, or a collection of rows that belong together for a particular reason\n // -- all of the messages in this particular folder, all of the documents\n // belonging to this particular author, and so on. Collections maintain\n // indexes of their models, both in order, and for lookup by `id`.\n\n // Create a new **Collection**, perhaps to contain a specific type of `model`.\n // If a `comparator` is specified, the Collection will maintain\n // its models in sort order, as they're added and removed.\n var Collection = Backbone.Collection = function(models, options) {\n options || (options = {});\n if (options.model) this.model = options.model;\n if (options.comparator !== void 0) this.comparator = options.comparator;\n this._reset();\n this.initialize.apply(this, arguments);\n if (models) this.reset(models, _.extend({silent: true}, options));\n };\n\n // Default options for `Collection#set`.\n var setOptions = {add: true, remove: true, merge: true};\n var addOptions = {add: true, remove: false};\n\n // Define the Collection's inheritable methods.\n _.extend(Collection.prototype, Events, {\n\n // The default model for a collection is just a **Backbone.Model**.\n // This should be overridden in most cases.\n model: Model,\n\n // Initialize is an empty function by default. Override it with your own\n // initialization logic.\n initialize: function(){},\n\n // The JSON representation of a Collection is an array of the\n // models' attributes.\n toJSON: function(options) {\n return this.map(function(model) { return model.toJSON(options); });\n },\n\n // Proxy `Backbone.sync` by default.\n sync: function() {\n return Backbone.sync.apply(this, arguments);\n },\n\n // Add a model, or list of models to the set.\n add: function(models, options) {\n return this.set(models, _.extend({merge: false}, options, addOptions));\n },\n\n // Remove a model, or a list of models from the set.\n remove: function(models, options) {\n options = _.extend({}, options);\n var singular = !_.isArray(models);\n models = singular ? [models] : _.clone(models);\n var removed = this._removeModels(models, options);\n if (!options.silent && removed) this.trigger('update', this, options);\n return singular ? removed[0] : removed;\n },\n\n // Update a collection by `set`-ing a new list of models, adding new ones,\n // removing models that are no longer present, and merging models that\n // already exist in the collection, as necessary. Similar to **Model#set**,\n // the core operation for updating the data contained by the collection.\n set: function(models, options) {\n options = _.defaults({}, options, setOptions);\n if (options.parse && !this._isModel(models)) models = this.parse(models, options);\n var singular = !_.isArray(models);\n models = singular ? (models ? [models] : []) : models.slice();\n var id, model, attrs, existing, sort;\n var at = options.at;\n if (at != null) at = +at;\n if (at < 0) at += this.length + 1;\n var sortable = this.comparator && (at == null) && options.sort !== false;\n var sortAttr = _.isString(this.comparator) ? this.comparator : null;\n var toAdd = [], toRemove = [], modelMap = {};\n var add = options.add, merge = options.merge, remove = options.remove;\n var order = !sortable && add && remove ? [] : false;\n var orderChanged = false;\n\n // Turn bare objects into model references, and prevent invalid models\n // from being added.\n for (var i = 0; i < models.length; i++) {\n attrs = models[i];\n\n // If a duplicate is found, prevent it from being added and\n // optionally merge it into the existing model.\n if (existing = this.get(attrs)) {\n if (remove) modelMap[existing.cid] = true;\n if (merge && attrs !== existing) {\n attrs = this._isModel(attrs) ? attrs.attributes : attrs;\n if (options.parse) attrs = existing.parse(attrs, options);\n existing.set(attrs, options);\n if (sortable && !sort && existing.hasChanged(sortAttr)) sort = true;\n }\n models[i] = existing;\n\n // If this is a new, valid model, push it to the `toAdd` list.\n } else if (add) {\n model = models[i] = this._prepareModel(attrs, options);\n if (!model) continue;\n toAdd.push(model);\n this._addReference(model, options);\n }\n\n // Do not add multiple models with the same `id`.\n model = existing || model;\n if (!model) continue;\n id = this.modelId(model.attributes);\n if (order && (model.isNew() || !modelMap[id])) {\n order.push(model);\n\n // Check to see if this is actually a new model at this index.\n orderChanged = orderChanged || !this.models[i] || model.cid !== this.models[i].cid;\n }\n\n modelMap[id] = true;\n }\n\n // Remove nonexistent models if appropriate.\n if (remove) {\n for (var i = 0; i < this.length; i++) {\n if (!modelMap[(model = this.models[i]).cid]) toRemove.push(model);\n }\n if (toRemove.length) this._removeModels(toRemove, options);\n }\n\n // See if sorting is needed, update `length` and splice in new models.\n if (toAdd.length || orderChanged) {\n if (sortable) sort = true;\n this.length += toAdd.length;\n if (at != null) {\n for (var i = 0; i < toAdd.length; i++) {\n this.models.splice(at + i, 0, toAdd[i]);\n }\n } else {\n if (order) this.models.length = 0;\n var orderedModels = order || toAdd;\n for (var i = 0; i < orderedModels.length; i++) {\n this.models.push(orderedModels[i]);\n }\n }\n }\n\n // Silently sort the collection if appropriate.\n if (sort) this.sort({silent: true});\n\n // Unless silenced, it's time to fire all appropriate add/sort events.\n if (!options.silent) {\n var addOpts = at != null ? _.clone(options) : options;\n for (var i = 0; i < toAdd.length; i++) {\n if (at != null) addOpts.index = at + i;\n (model = toAdd[i]).trigger('add', model, this, addOpts);\n }\n if (sort || orderChanged) this.trigger('sort', this, options);\n if (toAdd.length || toRemove.length) this.trigger('update', this, options);\n }\n\n // Return the added (or merged) model (or models).\n return singular ? models[0] : models;\n },\n\n // When you have more items than you want to add or remove individually,\n // you can reset the entire set with a new list of models, without firing\n // any granular `add` or `remove` events. Fires `reset` when finished.\n // Useful for bulk operations and optimizations.\n reset: function(models, options) {\n options = options ? _.clone(options) : {};\n for (var i = 0; i < this.models.length; i++) {\n this._removeReference(this.models[i], options);\n }\n options.previousModels = this.models;\n this._reset();\n models = this.add(models, _.extend({silent: true}, options));\n if (!options.silent) this.trigger('reset', this, options);\n return models;\n },\n\n // Add a model to the end of the collection.\n push: function(model, options) {\n return this.add(model, _.extend({at: this.length}, options));\n },\n\n // Remove a model from the end of the collection.\n pop: function(options) {\n var model = this.at(this.length - 1);\n return this.remove(model, options);\n },\n\n // Add a model to the beginning of the collection.\n unshift: function(model, options) {\n return this.add(model, _.extend({at: 0}, options));\n },\n\n // Remove a model from the beginning of the collection.\n shift: function(options) {\n var model = this.at(0);\n return this.remove(model, options);\n },\n\n // Slice out a sub-array of models from the collection.\n slice: function() {\n return slice.apply(this.models, arguments);\n },\n\n // Get a model from the set by id.\n get: function(obj) {\n if (obj == null) return void 0;\n var id = this.modelId(this._isModel(obj) ? obj.attributes : obj);\n return this._byId[obj] || this._byId[id] || this._byId[obj.cid];\n },\n\n // Get the model at the given index.\n at: function(index) {\n if (index < 0) index += this.length;\n return this.models[index];\n },\n\n // Return models with matching attributes. Useful for simple cases of\n // `filter`.\n where: function(attrs, first) {\n var matches = _.matches(attrs);\n return this[first ? 'find' : 'filter'](function(model) {\n return matches(model.attributes);\n });\n },\n\n // Return the first model with matching attributes. Useful for simple cases\n // of `find`.\n findWhere: function(attrs) {\n return this.where(attrs, true);\n },\n\n // Force the collection to re-sort itself. You don't need to call this under\n // normal circumstances, as the set will maintain sort order as each item\n // is added.\n sort: function(options) {\n if (!this.comparator) throw new Error('Cannot sort a set without a comparator');\n options || (options = {});\n\n // Run sort based on type of `comparator`.\n if (_.isString(this.comparator) || this.comparator.length === 1) {\n this.models = this.sortBy(this.comparator, this);\n } else {\n this.models.sort(_.bind(this.comparator, this));\n }\n\n if (!options.silent) this.trigger('sort', this, options);\n return this;\n },\n\n // Pluck an attribute from each model in the collection.\n pluck: function(attr) {\n return _.invoke(this.models, 'get', attr);\n },\n\n // Fetch the default set of models for this collection, resetting the\n // collection when they arrive. If `reset: true` is passed, the response\n // data will be passed through the `reset` method instead of `set`.\n fetch: function(options) {\n options = _.extend({parse: true}, options);\n var success = options.success;\n var collection = this;\n options.success = function(resp) {\n var method = options.reset ? 'reset' : 'set';\n collection[method](resp, options);\n if (success) success.call(options.context, collection, resp, options);\n collection.trigger('sync', collection, resp, options);\n };\n wrapError(this, options);\n return this.sync('read', this, options);\n },\n\n // Create a new instance of a model in this collection. Add the model to the\n // collection immediately, unless `wait: true` is passed, in which case we\n // wait for the server to agree.\n create: function(model, options) {\n options = options ? _.clone(options) : {};\n var wait = options.wait;\n model = this._prepareModel(model, options);\n if (!model) return false;\n if (!wait) this.add(model, options);\n var collection = this;\n var success = options.success;\n options.success = function(model, resp, callbackOpts) {\n if (wait) collection.add(model, callbackOpts);\n if (success) success.call(callbackOpts.context, model, resp, callbackOpts);\n };\n model.save(null, options);\n return model;\n },\n\n // **parse** converts a response into a list of models to be added to the\n // collection. The default implementation is just to pass it through.\n parse: function(resp, options) {\n return resp;\n },\n\n // Create a new collection with an identical list of models as this one.\n clone: function() {\n return new this.constructor(this.models, {\n model: this.model,\n comparator: this.comparator\n });\n },\n\n // Define how to uniquely identify models in the collection.\n modelId: function (attrs) {\n return attrs[this.model.prototype.idAttribute || 'id'];\n },\n\n // Private method to reset all internal state. Called when the collection\n // is first initialized or reset.\n _reset: function() {\n this.length = 0;\n this.models = [];\n this._byId = {};\n },\n\n // Prepare a hash of attributes (or other model) to be added to this\n // collection.\n _prepareModel: function(attrs, options) {\n if (this._isModel(attrs)) {\n if (!attrs.collection) attrs.collection = this;\n return attrs;\n }\n options = options ? _.clone(options) : {};\n options.collection = this;\n var model = new this.model(attrs, options);\n if (!model.validationError) return model;\n this.trigger('invalid', this, model.validationError, options);\n return false;\n },\n\n // Internal method called by both remove and set.\n // Returns removed models, or false if nothing is removed.\n _removeModels: function(models, options) {\n var removed = [];\n for (var i = 0; i < models.length; i++) {\n var model = this.get(models[i]);\n if (!model) continue;\n\n var index = this.indexOf(model);\n this.models.splice(index, 1);\n this.length--;\n\n if (!options.silent) {\n options.index = index;\n model.trigger('remove', model, this, options);\n }\n\n removed.push(model);\n this._removeReference(model, options);\n }\n return removed.length ? removed : false;\n },\n\n // Method for checking whether an object should be considered a model for\n // the purposes of adding to the collection.\n _isModel: function (model) {\n return model instanceof Model;\n },\n\n // Internal method to create a model's ties to a collection.\n _addReference: function(model, options) {\n this._byId[model.cid] = model;\n var id = this.modelId(model.attributes);\n if (id != null) this._byId[id] = model;\n model.on('all', this._onModelEvent, this);\n },\n\n // Internal method to sever a model's ties to a collection.\n _removeReference: function(model, options) {\n delete this._byId[model.cid];\n var id = this.modelId(model.attributes);\n if (id != null) delete this._byId[id];\n if (this === model.collection) delete model.collection;\n model.off('all', this._onModelEvent, this);\n },\n\n // Internal method called every time a model in the set fires an event.\n // Sets need to update their indexes when models change ids. All other\n // events simply proxy through. \"add\" and \"remove\" events that originate\n // in other collections are ignored.\n _onModelEvent: function(event, model, collection, options) {\n if ((event === 'add' || event === 'remove') && collection !== this) return;\n if (event === 'destroy') this.remove(model, options);\n if (event === 'change') {\n var prevId = this.modelId(model.previousAttributes());\n var id = this.modelId(model.attributes);\n if (prevId !== id) {\n if (prevId != null) delete this._byId[prevId];\n if (id != null) this._byId[id] = model;\n }\n }\n this.trigger.apply(this, arguments);\n }\n\n });\n\n // Underscore methods that we want to implement on the Collection.\n // 90% of the core usefulness of Backbone Collections is actually implemented\n // right here:\n var collectionMethods = { forEach: 3, each: 3, map: 3, collect: 3, reduce: 4,\n foldl: 4, inject: 4, reduceRight: 4, foldr: 4, find: 3, detect: 3, filter: 3,\n select: 3, reject: 3, every: 3, all: 3, some: 3, any: 3, include: 2,\n contains: 2, invoke: 0, max: 3, min: 3, toArray: 1, size: 1, first: 3,\n head: 3, take: 3, initial: 3, rest: 3, tail: 3, drop: 3, last: 3,\n without: 0, difference: 0, indexOf: 3, shuffle: 1, lastIndexOf: 3,\n isEmpty: 1, chain: 1, sample: 3, partition: 3 };\n\n // Mix in each Underscore method as a proxy to `Collection#models`.\n addUnderscoreMethods(Collection, collectionMethods, 'models');\n\n // Underscore methods that take a property name as an argument.\n var attributeMethods = ['groupBy', 'countBy', 'sortBy', 'indexBy'];\n\n // Use attributes instead of properties.\n _.each(attributeMethods, function(method) {\n if (!_[method]) return;\n Collection.prototype[method] = function(value, context) {\n var iterator = _.isFunction(value) ? value : function(model) {\n return model.get(value);\n };\n return _[method](this.models, iterator, context);\n };\n });\n\n // Backbone.View\n // -------------\n\n // Backbone Views are almost more convention than they are actual code. A View\n // is simply a JavaScript object that represents a logical chunk of UI in the\n // DOM. This might be a single item, an entire list, a sidebar or panel, or\n // even the surrounding frame which wraps your whole app. Defining a chunk of\n // UI as a **View** allows you to define your DOM events declaratively, without\n // having to worry about render order ... and makes it easy for the view to\n // react to specific changes in the state of your models.\n\n // Creating a Backbone.View creates its initial element outside of the DOM,\n // if an existing element is not provided...\n var View = Backbone.View = function(options) {\n this.cid = _.uniqueId('view');\n _.extend(this, _.pick(options, viewOptions));\n this._ensureElement();\n this.initialize.apply(this, arguments);\n };\n\n // Cached regex to split keys for `delegate`.\n var delegateEventSplitter = /^(\\S+)\\s*(.*)$/;\n\n // List of view options to be merged as properties.\n var viewOptions = ['model', 'collection', 'el', 'id', 'attributes', 'className', 'tagName', 'events'];\n\n // Set up all inheritable **Backbone.View** properties and methods.\n _.extend(View.prototype, Events, {\n\n // The default `tagName` of a View's element is `\"div\"`.\n tagName: 'div',\n\n // jQuery delegate for element lookup, scoped to DOM elements within the\n // current view. This should be preferred to global lookups where possible.\n $: function(selector) {\n return this.$el.find(selector);\n },\n\n // Initialize is an empty function by default. Override it with your own\n // initialization logic.\n initialize: function(){},\n\n // **render** is the core function that your view should override, in order\n // to populate its element (`this.el`), with the appropriate HTML. The\n // convention is for **render** to always return `this`.\n render: function() {\n return this;\n },\n\n // Remove this view by taking the element out of the DOM, and removing any\n // applicable Backbone.Events listeners.\n remove: function() {\n this._removeElement();\n this.stopListening();\n return this;\n },\n\n // Remove this view's element from the document and all event listeners\n // attached to it. Exposed for subclasses using an alternative DOM\n // manipulation API.\n _removeElement: function() {\n this.$el.remove();\n },\n\n // Change the view's element (`this.el` property) and re-delegate the\n // view's events on the new element.\n setElement: function(element) {\n this.undelegateEvents();\n this._setElement(element);\n this.delegateEvents();\n return this;\n },\n\n // Creates the `this.el` and `this.$el` references for this view using the\n // given `el`. `el` can be a CSS selector or an HTML string, a jQuery\n // context or an element. Subclasses can override this to utilize an\n // alternative DOM manipulation API and are only required to set the\n // `this.el` property.\n _setElement: function(el) {\n this.$el = el instanceof Backbone.$ ? el : Backbone.$(el);\n this.el = this.$el[0];\n },\n\n // Set callbacks, where `this.events` is a hash of\n //\n // *{\"event selector\": \"callback\"}*\n //\n // {\n // 'mousedown .title': 'edit',\n // 'click .button': 'save',\n // 'click .open': function(e) { ... }\n // }\n //\n // pairs. Callbacks will be bound to the view, with `this` set properly.\n // Uses event delegation for efficiency.\n // Omitting the selector binds the event to `this.el`.\n delegateEvents: function(events) {\n events || (events = _.result(this, 'events'));\n if (!events) return this;\n this.undelegateEvents();\n for (var key in events) {\n var method = events[key];\n if (!_.isFunction(method)) method = this[method];\n if (!method) continue;\n var match = key.match(delegateEventSplitter);\n this.delegate(match[1], match[2], _.bind(method, this));\n }\n return this;\n },\n\n // Add a single event listener to the view's element (or a child element\n // using `selector`). This only works for delegate-able events: not `focus`,\n // `blur`, and not `change`, `submit`, and `reset` in Internet Explorer.\n delegate: function(eventName, selector, listener) {\n this.$el.on(eventName + '.delegateEvents' + this.cid, selector, listener);\n return this;\n },\n\n // Clears all callbacks previously bound to the view by `delegateEvents`.\n // You usually don't need to use this, but may wish to if you have multiple\n // Backbone views attached to the same DOM element.\n undelegateEvents: function() {\n if (this.$el) this.$el.off('.delegateEvents' + this.cid);\n return this;\n },\n\n // A finer-grained `undelegateEvents` for removing a single delegated event.\n // `selector` and `listener` are both optional.\n undelegate: function(eventName, selector, listener) {\n this.$el.off(eventName + '.delegateEvents' + this.cid, selector, listener);\n return this;\n },\n\n // Produces a DOM element to be assigned to your view. Exposed for\n // subclasses using an alternative DOM manipulation API.\n _createElement: function(tagName) {\n return document.createElement(tagName);\n },\n\n // Ensure that the View has a DOM element to render into.\n // If `this.el` is a string, pass it through `$()`, take the first\n // matching element, and re-assign it to `el`. Otherwise, create\n // an element from the `id`, `className` and `tagName` properties.\n _ensureElement: function() {\n if (!this.el) {\n var attrs = _.extend({}, _.result(this, 'attributes'));\n if (this.id) attrs.id = _.result(this, 'id');\n if (this.className) attrs['class'] = _.result(this, 'className');\n this.setElement(this._createElement(_.result(this, 'tagName')));\n this._setAttributes(attrs);\n } else {\n this.setElement(_.result(this, 'el'));\n }\n },\n\n // Set attributes from a hash on this view's element. Exposed for\n // subclasses using an alternative DOM manipulation API.\n _setAttributes: function(attributes) {\n this.$el.attr(attributes);\n }\n\n });\n\n // Backbone.sync\n // -------------\n\n // Override this function to change the manner in which Backbone persists\n // models to the server. You will be passed the type of request, and the\n // model in question. By default, makes a RESTful Ajax request\n // to the model's `url()`. Some possible customizations could be:\n //\n // * Use `setTimeout` to batch rapid-fire updates into a single request.\n // * Send up the models as XML instead of JSON.\n // * Persist models via WebSockets instead of Ajax.\n //\n // Turn on `Backbone.emulateHTTP` in order to send `PUT` and `DELETE` requests\n // as `POST`, with a `_method` parameter containing the true HTTP method,\n // as well as all requests with the body as `application/x-www-form-urlencoded`\n // instead of `application/json` with the model in a param named `model`.\n // Useful when interfacing with server-side languages like **PHP** that make\n // it difficult to read the body of `PUT` requests.\n Backbone.sync = function(method, model, options) {\n var type = methodMap[method];\n\n // Default options, unless specified.\n _.defaults(options || (options = {}), {\n emulateHTTP: Backbone.emulateHTTP,\n emulateJSON: Backbone.emulateJSON\n });\n\n // Default JSON-request options.\n var params = {type: type, dataType: 'json'};\n\n // Ensure that we have a URL.\n if (!options.url) {\n params.url = _.result(model, 'url') || urlError();\n }\n\n // Ensure that we have the appropriate request data.\n if (options.data == null && model && (method === 'create' || method === 'update' || method === 'patch')) {\n params.contentType = 'application/json';\n params.data = JSON.stringify(options.attrs || model.toJSON(options));\n }\n\n // For older servers, emulate JSON by encoding the request into an HTML-form.\n if (options.emulateJSON) {\n params.contentType = 'application/x-www-form-urlencoded';\n params.data = params.data ? {model: params.data} : {};\n }\n\n // For older servers, emulate HTTP by mimicking the HTTP method with `_method`\n // And an `X-HTTP-Method-Override` header.\n if (options.emulateHTTP && (type === 'PUT' || type === 'DELETE' || type === 'PATCH')) {\n params.type = 'POST';\n if (options.emulateJSON) params.data._method = type;\n var beforeSend = options.beforeSend;\n options.beforeSend = function(xhr) {\n xhr.setRequestHeader('X-HTTP-Method-Override', type);\n if (beforeSend) return beforeSend.apply(this, arguments);\n };\n }\n\n // Don't process data on a non-GET request.\n if (params.type !== 'GET' && !options.emulateJSON) {\n params.processData = false;\n }\n\n // Pass along `textStatus` and `errorThrown` from jQuery.\n var error = options.error;\n options.error = function(xhr, textStatus, errorThrown) {\n options.textStatus = textStatus;\n options.errorThrown = errorThrown;\n if (error) error.call(options.context, xhr, textStatus, errorThrown);\n };\n\n // Make the request, allowing the user to override any Ajax options.\n var xhr = options.xhr = Backbone.ajax(_.extend(params, options));\n model.trigger('request', model, xhr, options);\n return xhr;\n };\n\n // Map from CRUD to HTTP for our default `Backbone.sync` implementation.\n var methodMap = {\n 'create': 'POST',\n 'update': 'PUT',\n 'patch': 'PATCH',\n 'delete': 'DELETE',\n 'read': 'GET'\n };\n\n // Set the default implementation of `Backbone.ajax` to proxy through to `$`.\n // Override this if you'd like to use a different library.\n Backbone.ajax = function() {\n return Backbone.$.ajax.apply(Backbone.$, arguments);\n };\n\n // Backbone.Router\n // ---------------\n\n // Routers map faux-URLs to actions, and fire events when routes are\n // matched. Creating a new one sets its `routes` hash, if not set statically.\n var Router = Backbone.Router = function(options) {\n options || (options = {});\n if (options.routes) this.routes = options.routes;\n this._bindRoutes();\n this.initialize.apply(this, arguments);\n };\n\n // Cached regular expressions for matching named param parts and splatted\n // parts of route strings.\n var optionalParam = /\\((.*?)\\)/g;\n var namedParam = /(\\(\\?)?:\\w+/g;\n var splatParam = /\\*\\w+/g;\n var escapeRegExp = /[\\-{}\\[\\]+?.,\\\\\\^$|#\\s]/g;\n\n // Set up all inheritable **Backbone.Router** properties and methods.\n _.extend(Router.prototype, Events, {\n\n // Initialize is an empty function by default. Override it with your own\n // initialization logic.\n initialize: function(){},\n\n // Manually bind a single named route to a callback. For example:\n //\n // this.route('search/:query/p:num', 'search', function(query, num) {\n // ...\n // });\n //\n route: function(route, name, callback) {\n if (!_.isRegExp(route)) route = this._routeToRegExp(route);\n if (_.isFunction(name)) {\n callback = name;\n name = '';\n }\n if (!callback) callback = this[name];\n var router = this;\n Backbone.history.route(route, function(fragment) {\n var args = router._extractParameters(route, fragment);\n if (router.execute(callback, args, name) !== false) {\n router.trigger.apply(router, ['route:' + name].concat(args));\n router.trigger('route', name, args);\n Backbone.history.trigger('route', router, name, args);\n }\n });\n return this;\n },\n\n // Execute a route handler with the provided parameters. This is an\n // excellent place to do pre-route setup or post-route cleanup.\n execute: function(callback, args, name) {\n if (callback) callback.apply(this, args);\n },\n\n // Simple proxy to `Backbone.history` to save a fragment into the history.\n navigate: function(fragment, options) {\n Backbone.history.navigate(fragment, options);\n return this;\n },\n\n // Bind all defined routes to `Backbone.history`. We have to reverse the\n // order of the routes here to support behavior where the most general\n // routes can be defined at the bottom of the route map.\n _bindRoutes: function() {\n if (!this.routes) return;\n this.routes = _.result(this, 'routes');\n var route, routes = _.keys(this.routes);\n while ((route = routes.pop()) != null) {\n this.route(route, this.routes[route]);\n }\n },\n\n // Convert a route string into a regular expression, suitable for matching\n // against the current location hash.\n _routeToRegExp: function(route) {\n route = route.replace(escapeRegExp, '\\\\$&')\n .replace(optionalParam, '(?:$1)?')\n .replace(namedParam, function(match, optional) {\n return optional ? match : '([^/?]+)';\n })\n .replace(splatParam, '([^?]*?)');\n return new RegExp('^' + route + '(?:\\\\?([\\\\s\\\\S]*))?$');\n },\n\n // Given a route, and a URL fragment that it matches, return the array of\n // extracted decoded parameters. Empty or unmatched parameters will be\n // treated as `null` to normalize cross-browser behavior.\n _extractParameters: function(route, fragment) {\n var params = route.exec(fragment).slice(1);\n return _.map(params, function(param, i) {\n // Don't decode the search params.\n if (i === params.length - 1) return param || null;\n return param ? decodeURIComponent(param) : null;\n });\n }\n\n });\n\n // Backbone.History\n // ----------------\n\n // Handles cross-browser history management, based on either\n // [pushState](http://diveintohtml5.info/history.html) and real URLs, or\n // [onhashchange](https://developer.mozilla.org/en-US/docs/DOM/window.onhashchange)\n // and URL fragments. If the browser supports neither (old IE, natch),\n // falls back to polling.\n var History = Backbone.History = function() {\n this.handlers = [];\n _.bindAll(this, 'checkUrl');\n\n // Ensure that `History` can be used outside of the browser.\n if (typeof window !== 'undefined') {\n this.location = window.location;\n this.history = window.history;\n }\n };\n\n // Cached regex for stripping a leading hash/slash and trailing space.\n var routeStripper = /^[#\\/]|\\s+$/g;\n\n // Cached regex for stripping leading and trailing slashes.\n var rootStripper = /^\\/+|\\/+$/g;\n\n // Cached regex for stripping urls of hash.\n var pathStripper = /#.*$/;\n\n // Has the history handling already been started?\n History.started = false;\n\n // Set up all inheritable **Backbone.History** properties and methods.\n _.extend(History.prototype, Events, {\n\n // The default interval to poll for hash changes, if necessary, is\n // twenty times a second.\n interval: 50,\n\n // Are we at the app root?\n atRoot: function() {\n var path = this.location.pathname.replace(/[^\\/]$/, '$&/');\n return path === this.root && !this.getSearch();\n },\n\n // Does the pathname match the root?\n matchRoot: function() {\n var path = this.decodeFragment(this.location.pathname);\n var root = path.slice(0, this.root.length - 1) + '/';\n return root === this.root;\n },\n\n // Unicode characters in `location.pathname` are percent encoded so they're\n // decoded for comparison. `%25` should not be decoded since it may be part\n // of an encoded parameter.\n decodeFragment: function(fragment) {\n return decodeURI(fragment.replace(/%25/g, '%2525'));\n },\n\n // In IE6, the hash fragment and search params are incorrect if the\n // fragment contains `?`.\n getSearch: function() {\n var match = this.location.href.replace(/#.*/, '').match(/\\?.+/);\n return match ? match[0] : '';\n },\n\n // Gets the true hash value. Cannot use location.hash directly due to bug\n // in Firefox where location.hash will always be decoded.\n getHash: function(window) {\n var match = (window || this).location.href.match(/#(.*)$/);\n return match ? match[1] : '';\n },\n\n // Get the pathname and search params, without the root.\n getPath: function() {\n var path = this.decodeFragment(\n this.location.pathname + this.getSearch()\n ).slice(this.root.length - 1);\n return path.charAt(0) === '/' ? path.slice(1) : path;\n },\n\n // Get the cross-browser normalized URL fragment from the path or hash.\n getFragment: function(fragment) {\n if (fragment == null) {\n if (this._usePushState || !this._wantsHashChange) {\n fragment = this.getPath();\n } else {\n fragment = this.getHash();\n }\n }\n return fragment.replace(routeStripper, '');\n },\n\n // Start the hash change handling, returning `true` if the current URL matches\n // an existing route, and `false` otherwise.\n start: function(options) {\n if (History.started) throw new Error('Backbone.history has already been started');\n History.started = true;\n\n // Figure out the initial configuration. Do we need an iframe?\n // Is pushState desired ... is it available?\n this.options = _.extend({root: '/'}, this.options, options);\n this.root = this.options.root;\n this._wantsHashChange = this.options.hashChange !== false;\n this._hasHashChange = 'onhashchange' in window;\n this._useHashChange = this._wantsHashChange && this._hasHashChange;\n this._wantsPushState = !!this.options.pushState;\n this._hasPushState = !!(this.history && this.history.pushState);\n this._usePushState = this._wantsPushState && this._hasPushState;\n this.fragment = this.getFragment();\n\n // Normalize root to always include a leading and trailing slash.\n this.root = ('/' + this.root + '/').replace(rootStripper, '/');\n\n // Transition from hashChange to pushState or vice versa if both are\n // requested.\n if (this._wantsHashChange && this._wantsPushState) {\n\n // If we've started off with a route from a `pushState`-enabled\n // browser, but we're currently in a browser that doesn't support it...\n if (!this._hasPushState && !this.atRoot()) {\n var root = this.root.slice(0, -1) || '/';\n this.location.replace(root + '#' + this.getPath());\n // Return immediately as browser will do redirect to new url\n return true;\n\n // Or if we've started out with a hash-based route, but we're currently\n // in a browser where it could be `pushState`-based instead...\n } else if (this._hasPushState && this.atRoot()) {\n this.navigate(this.getHash(), {replace: true});\n }\n\n }\n\n // Proxy an iframe to handle location events if the browser doesn't\n // support the `hashchange` event, HTML5 history, or the user wants\n // `hashChange` but not `pushState`.\n if (!this._hasHashChange && this._wantsHashChange && !this._usePushState) {\n this.iframe = document.createElement('iframe');\n this.iframe.src = 'javascript:0';\n this.iframe.style.display = 'none';\n this.iframe.tabIndex = -1;\n var body = document.body;\n // Using `appendChild` will throw on IE < 9 if the document is not ready.\n var iWindow = body.insertBefore(this.iframe, body.firstChild).contentWindow;\n iWindow.document.open();\n iWindow.document.close();\n iWindow.location.hash = '#' + this.fragment;\n }\n\n // Add a cross-platform `addEventListener` shim for older browsers.\n var addEventListener = window.addEventListener || function (eventName, listener) {\n return attachEvent('on' + eventName, listener);\n };\n\n // Depending on whether we're using pushState or hashes, and whether\n // 'onhashchange' is supported, determine how we check the URL state.\n if (this._usePushState) {\n addEventListener('popstate', this.checkUrl, false);\n } else if (this._useHashChange && !this.iframe) {\n addEventListener('hashchange', this.checkUrl, false);\n } else if (this._wantsHashChange) {\n this._checkUrlInterval = setInterval(this.checkUrl, this.interval);\n }\n\n if (!this.options.silent) return this.loadUrl();\n },\n\n // Disable Backbone.history, perhaps temporarily. Not useful in a real app,\n // but possibly useful for unit testing Routers.\n stop: function() {\n // Add a cross-platform `removeEventListener` shim for older browsers.\n var removeEventListener = window.removeEventListener || function (eventName, listener) {\n return detachEvent('on' + eventName, listener);\n };\n\n // Remove window listeners.\n if (this._usePushState) {\n removeEventListener('popstate', this.checkUrl, false);\n } else if (this._useHashChange && !this.iframe) {\n removeEventListener('hashchange', this.checkUrl, false);\n }\n\n // Clean up the iframe if necessary.\n if (this.iframe) {\n document.body.removeChild(this.iframe);\n this.iframe = null;\n }\n\n // Some environments will throw when clearing an undefined interval.\n if (this._checkUrlInterval) clearInterval(this._checkUrlInterval);\n History.started = false;\n },\n\n // Add a route to be tested when the fragment changes. Routes added later\n // may override previous routes.\n route: function(route, callback) {\n this.handlers.unshift({route: route, callback: callback});\n },\n\n // Checks the current URL to see if it has changed, and if it has,\n // calls `loadUrl`, normalizing across the hidden iframe.\n checkUrl: function(e) {\n var current = this.getFragment();\n\n // If the user pressed the back button, the iframe's hash will have\n // changed and we should use that for comparison.\n if (current === this.fragment && this.iframe) {\n current = this.getHash(this.iframe.contentWindow);\n }\n\n if (current === this.fragment) return false;\n if (this.iframe) this.navigate(current);\n this.loadUrl();\n },\n\n // Attempt to load the current URL fragment. If a route succeeds with a\n // match, returns `true`. If no defined routes matches the fragment,\n // returns `false`.\n loadUrl: function(fragment) {\n // If the root doesn't match, no routes can match either.\n if (!this.matchRoot()) return false;\n fragment = this.fragment = this.getFragment(fragment);\n return _.any(this.handlers, function(handler) {\n if (handler.route.test(fragment)) {\n handler.callback(fragment);\n return true;\n }\n });\n },\n\n // Save a fragment into the hash history, or replace the URL state if the\n // 'replace' option is passed. You are responsible for properly URL-encoding\n // the fragment in advance.\n //\n // The options object can contain `trigger: true` if you wish to have the\n // route callback be fired (not usually desirable), or `replace: true`, if\n // you wish to modify the current URL without adding an entry to the history.\n navigate: function(fragment, options) {\n if (!History.started) return false;\n if (!options || options === true) options = {trigger: !!options};\n\n // Normalize the fragment.\n fragment = this.getFragment(fragment || '');\n\n // Don't include a trailing slash on the root.\n var root = this.root;\n if (fragment === '' || fragment.charAt(0) === '?') {\n root = root.slice(0, -1) || '/';\n }\n var url = root + fragment;\n\n // Strip the hash and decode for matching.\n fragment = this.decodeFragment(fragment.replace(pathStripper, ''));\n\n if (this.fragment === fragment) return;\n this.fragment = fragment;\n\n // If pushState is available, we use it to set the fragment as a real URL.\n if (this._usePushState) {\n this.history[options.replace ? 'replaceState' : 'pushState']({}, document.title, url);\n\n // If hash changes haven't been explicitly disabled, update the hash\n // fragment to store history.\n } else if (this._wantsHashChange) {\n this._updateHash(this.location, fragment, options.replace);\n if (this.iframe && (fragment !== this.getHash(this.iframe.contentWindow))) {\n var iWindow = this.iframe.contentWindow;\n\n // Opening and closing the iframe tricks IE7 and earlier to push a\n // history entry on hash-tag change. When replace is true, we don't\n // want this.\n if (!options.replace) {\n iWindow.document.open();\n iWindow.document.close();\n }\n\n this._updateHash(iWindow.location, fragment, options.replace);\n }\n\n // If you've told us that you explicitly don't want fallback hashchange-\n // based history, then `navigate` becomes a page refresh.\n } else {\n return this.location.assign(url);\n }\n if (options.trigger) return this.loadUrl(fragment);\n },\n\n // Update the hash location, either replacing the current entry, or adding\n // a new one to the browser history.\n _updateHash: function(location, fragment, replace) {\n if (replace) {\n var href = location.href.replace(/(javascript:|#).*$/, '');\n location.replace(href + '#' + fragment);\n } else {\n // Some browsers require that `hash` contains a leading #.\n location.hash = '#' + fragment;\n }\n }\n\n });\n\n // Create the default Backbone.history.\n Backbone.history = new History;\n\n // Helpers\n // -------\n\n // Helper function to correctly set up the prototype chain for subclasses.\n // Similar to `goog.inherits`, but uses a hash of prototype properties and\n // class properties to be extended.\n var extend = function(protoProps, staticProps) {\n var parent = this;\n var child;\n\n // The constructor function for the new subclass is either defined by you\n // (the \"constructor\" property in your `extend` definition), or defaulted\n // by us to simply call the parent constructor.\n if (protoProps && _.has(protoProps, 'constructor')) {\n child = protoProps.constructor;\n } else {\n child = function(){ return parent.apply(this, arguments); };\n }\n\n // Add static properties to the constructor function, if supplied.\n _.extend(child, parent, staticProps);\n\n // Set the prototype chain to inherit from `parent`, without calling\n // `parent` constructor function.\n var Surrogate = function(){ this.constructor = child; };\n Surrogate.prototype = parent.prototype;\n child.prototype = new Surrogate;\n\n // Add prototype properties (instance properties) to the subclass,\n // if supplied.\n if (protoProps) _.extend(child.prototype, protoProps);\n\n // Set a convenience property in case the parent's prototype is needed\n // later.\n child.__super__ = parent.prototype;\n\n return child;\n };\n\n // Set up inheritance for the model, collection, router, view and history.\n Model.extend = Collection.extend = Router.extend = View.extend = History.extend = extend;\n\n // Throw an error when a URL is needed, and none is supplied.\n var urlError = function() {\n throw new Error('A \"url\" property or function must be specified');\n };\n\n // Wrap an optional error callback with a fallback error event.\n var wrapError = function(model, options) {\n var error = options.error;\n options.error = function(resp) {\n if (error) error.call(options.context, model, resp, options);\n model.trigger('error', model, resp, options);\n };\n };\n\n return Backbone;\n\n}));\n\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(16)))\n\n/***/ }),\n/* 71 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\n/**\n * Before using methods you should get first the module from the editor instance, in this way:\n *\n * ```js\n * var storageManager = editor.StorageManager;\n * ```\n */\nmodule.exports = function () {\n var c = {},\n defaults = __webpack_require__(72),\n LocalStorage = __webpack_require__(73),\n RemoteStorage = __webpack_require__(74);\n\n var storages = {};\n var defaultStorages = {};\n\n return {\n /**\n * Name of the module\n * @type {String}\n * @private\n */\n name: 'StorageManager',\n\n /**\n * Initialize module. Automatically called with a new instance of the editor\n * @param {Object} config Configurations\n * @param {string} [config.id='gjs-'] The prefix for the fields, useful to differentiate storing/loading\n * with multiple editors on the same page. For example, in local storage, the item of HTML will be saved like 'gjs-html'\n * @param {Boolean} [config.autosave=true] Indicates if autosave mode is enabled, works in conjunction with stepsBeforeSave\n * @param {number} [config.stepsBeforeSave=1] If autosave enabled, indicates how many steps/changes are necessary\n * before autosave is triggered\n * @param {string} [config.type='local'] Default storage type. Available: 'local' | 'remote' | ''(do not store)\n * @private\n * @example\n * ...\n * {\n * autosave: false,\n * type: 'remote',\n * }\n * ...\n */\n init: function init(config) {\n c = config || {};\n\n for (var name in defaults) {\n if (!(name in c)) c[name] = defaults[name];\n }\n\n defaultStorages.remote = new RemoteStorage(c);\n defaultStorages.local = new LocalStorage(c);\n c.currentStorage = c.type;\n this.loadDefaultProviders().setCurrent(c.type);\n return this;\n },\n\n\n /**\n * Checks if autosave is enabled\n * @return {Boolean}\n * */\n isAutosave: function isAutosave() {\n return !!c.autosave;\n },\n\n\n /**\n * Set autosave value\n * @param {Boolean} v\n * @return {this}\n * */\n setAutosave: function setAutosave(v) {\n c.autosave = !!v;\n return this;\n },\n\n\n /**\n * Returns number of steps required before trigger autosave\n * @return {number}\n * */\n getStepsBeforeSave: function getStepsBeforeSave() {\n return c.stepsBeforeSave;\n },\n\n\n /**\n * Set steps required before trigger autosave\n * @param {number} v\n * @return {this}\n * */\n setStepsBeforeSave: function setStepsBeforeSave(v) {\n c.stepsBeforeSave = v;\n return this;\n },\n\n\n /**\n * Add new storage\n * @param {string} id Storage ID\n * @param {Object} storage Storage wrapper\n * @param {Function} storage.load Load method\n * @param {Function} storage.store Store method\n * @return {this}\n * @example\n * storageManager.add('local2', {\n * load: function(keys, clb) {\n * var res = {};\n * for (var i = 0, len = keys.length; i < len; i++){\n * var v = localStorage.getItem(keys[i]);\n * if(v) res[keys[i]] = v;\n * }\n * clb(res); // might be called inside some async method\n * },\n * store: function(data, clb) {\n * for(var key in data)\n * localStorage.setItem(key, data[key]);\n * clb(); // might be called inside some async method\n * }\n * });\n * */\n add: function add(id, storage) {\n storages[id] = storage;\n return this;\n },\n\n\n /**\n * Returns storage by id\n * @param {string} id Storage ID\n * @return {Object|null}\n * */\n get: function get(id) {\n return storages[id] || null;\n },\n\n\n /**\n * Returns all storages\n * @return {Array}\n * */\n getStorages: function getStorages() {\n return storages;\n },\n\n\n /**\n * Returns current storage type\n * @return {string}\n * */\n getCurrent: function getCurrent() {\n return c.currentStorage;\n },\n\n\n /**\n * Set current storage type\n * @param {string} id Storage ID\n * @return {this}\n * */\n setCurrent: function setCurrent(id) {\n c.currentStorage = id;\n return this;\n },\n\n\n /**\n * Store key-value resources in the current storage\n * @param {Object} data Data in key-value format, eg. {item1: value1, item2: value2}\n * @param {Function} clb Callback function\n * @return {Object|null}\n * @example\n * storageManager.store({item1: value1, item2: value2});\n * */\n store: function store(data, clb) {\n var st = this.get(this.getCurrent());\n var dataF = {};\n\n for (var key in data) {\n dataF[c.id + key] = data[key];\n }return st ? st.store(dataF, clb) : null;\n },\n\n\n /**\n * Load resource from the current storage by keys\n * @param {string|Array<string>} keys Keys to load\n * @param {Function} clb Callback function\n * @example\n * storageManager.load(['item1', 'item2'], res => {\n * // res -> {item1: value1, item2: value2}\n * });\n * storageManager.load('item1', res => {\n * // res -> {item1: value1}\n * });\n * */\n load: function load(keys, clb) {\n var st = this.get(this.getCurrent());\n var keysF = [];\n var result = {};\n\n if (typeof keys === 'string') keys = [keys];\n\n for (var i = 0, len = keys.length; i < len; i++) {\n keysF.push(c.id + keys[i]);\n }st && st.load(keysF, function (res) {\n // Restore keys name\n var reg = new RegExp('^' + c.id + '');\n for (var itemKey in res) {\n var itemKeyR = itemKey.replace(reg, '');\n result[itemKeyR] = res[itemKey];\n }\n\n clb && clb(result);\n });\n },\n\n\n /**\n * Load default storages\n * @return {this}\n * @private\n * */\n loadDefaultProviders: function loadDefaultProviders() {\n for (var id in defaultStorages) {\n this.add(id, defaultStorages[id]);\n }return this;\n },\n\n\n /**\n * Get configuration object\n * @return {Object}\n * @private\n * */\n getConfig: function getConfig() {\n return c;\n }\n };\n};\n\n/***/ }),\n/* 72 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = {\n // Prefix identifier that will be used inside storing and loading\n id: 'gjs-',\n\n // Enable/Disable autosaving\n autosave: 1,\n\n // Indicates if load data inside editor after init\n autoload: 1,\n\n // Indicates which storage to use. Available: local | remote\n type: 'local',\n\n // If autosave enabled, indicates how many steps (general changes to structure)\n // need to be done before save. Useful with remoteStorage to reduce remote calls\n stepsBeforeSave: 1,\n\n //Enable/Disable components model (JSON format)\n storeComponents: 1,\n\n //Enable/Disable styles model (JSON format)\n storeStyles: 1,\n\n //Enable/Disable saving HTML template\n storeHtml: 1,\n\n //Enable/Disable saving CSS template\n storeCss: 1,\n\n // ONLY FOR LOCAL STORAGE\n // If enabled, checks if browser supports Local Storage\n checkLocal: 1,\n\n // ONLY FOR REMOTE STORAGE\n // Custom parameters to pass with the remote storage request, eg. csrf token\n params: {},\n\n // Custom headers for the remote storage request\n headers: {},\n\n // Endpoint where to save all stuff\n urlStore: '',\n\n // Endpoint where to fetch data\n urlLoad: '',\n\n //Callback before request\n beforeSend: function beforeSend(jqXHR, settings) {},\n\n\n //Callback after request\n onComplete: function onComplete(jqXHR, status) {},\n\n\n // set contentType paramater of $.ajax\n // true: application/json; charset=utf-8'\n // false: 'x-www-form-urlencoded'\n contentTypeJson: false\n};\n\n/***/ }),\n/* 73 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar Backbone = __webpack_require__(0);\n\nmodule.exports = Backbone.Model.extend({\n defaults: {\n checkLocal: true\n },\n\n /**\n * @private\n */\n store: function store(data, clb) {\n this.checkStorageEnvironment();\n\n for (var key in data) {\n localStorage.setItem(key, data[key]);\n }if (typeof clb == 'function') {\n clb();\n }\n },\n\n\n /**\n * @private\n */\n load: function load(keys, clb) {\n this.checkStorageEnvironment();\n var result = {};\n\n for (var i = 0, len = keys.length; i < len; i++) {\n var value = localStorage.getItem(keys[i]);\n if (value) result[keys[i]] = value;\n }\n\n if (typeof clb == 'function') {\n clb(result);\n }\n\n return result;\n },\n\n\n /**\n * @private\n */\n remove: function remove(keys) {\n this.checkStorageEnvironment();\n\n for (var i = 0, len = keys.length; i < len; i++) {\n localStorage.removeItem(keys[i]);\n }\n },\n\n\n /**\n * Check storage environment\n * @private\n * */\n checkStorageEnvironment: function checkStorageEnvironment() {\n if (this.get('checkLocal') && !localStorage) console.warn(\"Your browser doesn't support localStorage\");\n }\n});\n\n/***/ }),\n/* 74 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _fetch = __webpack_require__(24);\n\nvar _fetch2 = _interopRequireDefault(_fetch);\n\nvar _underscore = __webpack_require__(1);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nmodule.exports = __webpack_require__(0).Model.extend({\n fetch: _fetch2.default,\n\n defaults: {\n urlStore: '',\n urlLoad: '',\n params: {},\n beforeSend: function beforeSend() {},\n onComplete: function onComplete() {},\n\n contentTypeJson: false\n },\n\n /**\n * Triggered before the request is started\n * @private\n */\n onStart: function onStart() {\n var em = this.get('em');\n var before = this.get('beforeSend');\n before && before();\n em && em.trigger('storage:start');\n },\n\n\n /**\n * Triggered on request error\n * @param {Object} err Error\n * @private\n */\n onError: function onError(err) {\n var em = this.get('em');\n console.error(err);\n em && em.trigger('storage:error', err);\n this.onEnd(err);\n },\n\n\n /**\n * Triggered after the request is ended\n * @param {Object|string} res End result\n * @private\n */\n onEnd: function onEnd(res) {\n var em = this.get('em');\n em && em.trigger('storage:end', res);\n },\n\n\n /**\n * Triggered on request response\n * @param {string} text Response text\n * @private\n */\n onResponse: function onResponse(text, clb) {\n var em = this.get('em');\n var complete = this.get('onComplete');\n var typeJson = this.get('contentTypeJson');\n var parsable = text && typeof text === 'string';\n var res = typeJson && parsable ? JSON.parse(text) : text;\n complete && complete(res);\n clb && clb(res);\n em && em.trigger('storage:response', res);\n this.onEnd(text);\n },\n store: function store(data, clb) {\n var body = {};\n\n for (var key in data) {\n body[key] = data[key];\n }\n\n this.request(this.get('urlStore'), { body: body }, clb);\n },\n load: function load(keys, clb) {\n this.request(this.get('urlLoad'), { method: 'get' }, clb);\n },\n\n\n /**\n * Execute remote request\n * @param {string} url Url\n * @param {Object} [opts={}] Options\n * @param {[type]} [clb=null] Callback\n * @private\n */\n request: function request(url) {\n var _this = this;\n\n var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var clb = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;\n\n var typeJson = this.get('contentTypeJson');\n var headers = this.get('headers') || {};\n var params = this.get('params');\n var reqHead = 'X-Requested-With';\n var typeHead = 'Content-Type';\n var bodyObj = opts.body || {};\n var fetchOptions = void 0;\n var body = void 0;\n\n for (var param in params) {\n bodyObj[param] = params[param];\n }\n\n if ((0, _underscore.isUndefined)(headers[reqHead])) {\n headers[reqHead] = 'XMLHttpRequest';\n }\n\n // With `fetch`, have to send FormData without any 'Content-Type'\n // https://stackoverflow.com/questions/39280438/fetch-missing-boundary-in-multipart-form-data-post\n\n if ((0, _underscore.isUndefined)(headers[typeHead]) && typeJson) {\n headers[typeHead] = 'application/json; charset=utf-8';\n }\n\n if (typeJson) {\n body = JSON.stringify(bodyObj);\n } else {\n body = new FormData();\n\n for (var bodyKey in bodyObj) {\n body.append(bodyKey, bodyObj[bodyKey]);\n }\n }\n fetchOptions = {\n method: opts.method || 'post',\n credentials: 'include',\n headers: headers\n };\n\n // Body should only be included on POST method\n if (fetchOptions.method === 'post') {\n fetchOptions.body = body;\n }\n\n this.onStart();\n this.fetch(url, fetchOptions).then(function (res) {\n return (res.status / 200 | 0) == 1 ? res.text() : res.text().then(function (text) {\n return Promise.reject(text);\n });\n }).then(function (text) {\n return _this.onResponse(text, clb);\n }).catch(function (err) {\n return _this.onError(err);\n });\n }\n});\n\n/***/ }),\n/* 75 */\n/***/ (function(module, exports, __webpack_require__) {\n\n/* WEBPACK VAR INJECTION */(function(setImmediate) {(function (root) {\n\n // Store setTimeout reference so promise-polyfill will be unaffected by\n // other code modifying setTimeout (like sinon.useFakeTimers())\n var setTimeoutFunc = setTimeout;\n\n function noop() {}\n \n // Polyfill for Function.prototype.bind\n function bind(fn, thisArg) {\n return function () {\n fn.apply(thisArg, arguments);\n };\n }\n\n function Promise(fn) {\n if (typeof this !== 'object') throw new TypeError('Promises must be constructed via new');\n if (typeof fn !== 'function') throw new TypeError('not a function');\n this._state = 0;\n this._handled = false;\n this._value = undefined;\n this._deferreds = [];\n\n doResolve(fn, this);\n }\n\n function handle(self, deferred) {\n while (self._state === 3) {\n self = self._value;\n }\n if (self._state === 0) {\n self._deferreds.push(deferred);\n return;\n }\n self._handled = true;\n Promise._immediateFn(function () {\n var cb = self._state === 1 ? deferred.onFulfilled : deferred.onRejected;\n if (cb === null) {\n (self._state === 1 ? resolve : reject)(deferred.promise, self._value);\n return;\n }\n var ret;\n try {\n ret = cb(self._value);\n } catch (e) {\n reject(deferred.promise, e);\n return;\n }\n resolve(deferred.promise, ret);\n });\n }\n\n function resolve(self, newValue) {\n try {\n // Promise Resolution Procedure: https://github.com/promises-aplus/promises-spec#the-promise-resolution-procedure\n if (newValue === self) throw new TypeError('A promise cannot be resolved with itself.');\n if (newValue && (typeof newValue === 'object' || typeof newValue === 'function')) {\n var then = newValue.then;\n if (newValue instanceof Promise) {\n self._state = 3;\n self._value = newValue;\n finale(self);\n return;\n } else if (typeof then === 'function') {\n doResolve(bind(then, newValue), self);\n return;\n }\n }\n self._state = 1;\n self._value = newValue;\n finale(self);\n } catch (e) {\n reject(self, e);\n }\n }\n\n function reject(self, newValue) {\n self._state = 2;\n self._value = newValue;\n finale(self);\n }\n\n function finale(self) {\n if (self._state === 2 && self._deferreds.length === 0) {\n Promise._immediateFn(function() {\n if (!self._handled) {\n Promise._unhandledRejectionFn(self._value);\n }\n });\n }\n\n for (var i = 0, len = self._deferreds.length; i < len; i++) {\n handle(self, self._deferreds[i]);\n }\n self._deferreds = null;\n }\n\n function Handler(onFulfilled, onRejected, promise) {\n this.onFulfilled = typeof onFulfilled === 'function' ? onFulfilled : null;\n this.onRejected = typeof onRejected === 'function' ? onRejected : null;\n this.promise = promise;\n }\n\n /**\n * Take a potentially misbehaving resolver function and make sure\n * onFulfilled and onRejected are only called once.\n *\n * Makes no guarantees about asynchrony.\n */\n function doResolve(fn, self) {\n var done = false;\n try {\n fn(function (value) {\n if (done) return;\n done = true;\n resolve(self, value);\n }, function (reason) {\n if (done) return;\n done = true;\n reject(self, reason);\n });\n } catch (ex) {\n if (done) return;\n done = true;\n reject(self, ex);\n }\n }\n\n Promise.prototype['catch'] = function (onRejected) {\n return this.then(null, onRejected);\n };\n\n Promise.prototype.then = function (onFulfilled, onRejected) {\n var prom = new (this.constructor)(noop);\n\n handle(this, new Handler(onFulfilled, onRejected, prom));\n return prom;\n };\n\n Promise.all = function (arr) {\n var args = Array.prototype.slice.call(arr);\n\n return new Promise(function (resolve, reject) {\n if (args.length === 0) return resolve([]);\n var remaining = args.length;\n\n function res(i, val) {\n try {\n if (val && (typeof val === 'object' || typeof val === 'function')) {\n var then = val.then;\n if (typeof then === 'function') {\n then.call(val, function (val) {\n res(i, val);\n }, reject);\n return;\n }\n }\n args[i] = val;\n if (--remaining === 0) {\n resolve(args);\n }\n } catch (ex) {\n reject(ex);\n }\n }\n\n for (var i = 0; i < args.length; i++) {\n res(i, args[i]);\n }\n });\n };\n\n Promise.resolve = function (value) {\n if (value && typeof value === 'object' && value.constructor === Promise) {\n return value;\n }\n\n return new Promise(function (resolve) {\n resolve(value);\n });\n };\n\n Promise.reject = function (value) {\n return new Promise(function (resolve, reject) {\n reject(value);\n });\n };\n\n Promise.race = function (values) {\n return new Promise(function (resolve, reject) {\n for (var i = 0, len = values.length; i < len; i++) {\n values[i].then(resolve, reject);\n }\n });\n };\n\n // Use polyfill for setImmediate for performance gains\n Promise._immediateFn = (typeof setImmediate === 'function' && function (fn) { setImmediate(fn); }) ||\n function (fn) {\n setTimeoutFunc(fn, 0);\n };\n\n Promise._unhandledRejectionFn = function _unhandledRejectionFn(err) {\n if (typeof console !== 'undefined' && console) {\n console.warn('Possible Unhandled Promise Rejection:', err); // eslint-disable-line no-console\n }\n };\n\n /**\n * Set the immediate function to execute callbacks\n * @param fn {function} Function to execute\n * @deprecated\n */\n Promise._setImmediateFn = function _setImmediateFn(fn) {\n Promise._immediateFn = fn;\n };\n\n /**\n * Change the function to execute on unhandled rejection\n * @param {function} fn Function to execute on unhandled rejection\n * @deprecated\n */\n Promise._setUnhandledRejectionFn = function _setUnhandledRejectionFn(fn) {\n Promise._unhandledRejectionFn = fn;\n };\n \n if (typeof module !== 'undefined' && module.exports) {\n module.exports = Promise;\n } else if (!root.Promise) {\n root.Promise = Promise;\n }\n\n})(this);\n\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(76).setImmediate))\n\n/***/ }),\n/* 76 */\n/***/ (function(module, exports, __webpack_require__) {\n\nvar apply = Function.prototype.apply;\n\n// DOM APIs, for completeness\n\nexports.setTimeout = function() {\n return new Timeout(apply.call(setTimeout, window, arguments), clearTimeout);\n};\nexports.setInterval = function() {\n return new Timeout(apply.call(setInterval, window, arguments), clearInterval);\n};\nexports.clearTimeout =\nexports.clearInterval = function(timeout) {\n if (timeout) {\n timeout.close();\n }\n};\n\nfunction Timeout(id, clearFn) {\n this._id = id;\n this._clearFn = clearFn;\n}\nTimeout.prototype.unref = Timeout.prototype.ref = function() {};\nTimeout.prototype.close = function() {\n this._clearFn.call(window, this._id);\n};\n\n// Does not start the time, just sets up the members needed.\nexports.enroll = function(item, msecs) {\n clearTimeout(item._idleTimeoutId);\n item._idleTimeout = msecs;\n};\n\nexports.unenroll = function(item) {\n clearTimeout(item._idleTimeoutId);\n item._idleTimeout = -1;\n};\n\nexports._unrefActive = exports.active = function(item) {\n clearTimeout(item._idleTimeoutId);\n\n var msecs = item._idleTimeout;\n if (msecs >= 0) {\n item._idleTimeoutId = setTimeout(function onTimeout() {\n if (item._onTimeout)\n item._onTimeout();\n }, msecs);\n }\n};\n\n// setimmediate attaches itself to the global object\n__webpack_require__(77);\nexports.setImmediate = setImmediate;\nexports.clearImmediate = clearImmediate;\n\n\n/***/ }),\n/* 77 */\n/***/ (function(module, exports, __webpack_require__) {\n\n/* WEBPACK VAR INJECTION */(function(global, process) {(function (global, undefined) {\n \"use strict\";\n\n if (global.setImmediate) {\n return;\n }\n\n var nextHandle = 1; // Spec says greater than zero\n var tasksByHandle = {};\n var currentlyRunningATask = false;\n var doc = global.document;\n var registerImmediate;\n\n function setImmediate(callback) {\n // Callback can either be a function or a string\n if (typeof callback !== \"function\") {\n callback = new Function(\"\" + callback);\n }\n // Copy function arguments\n var args = new Array(arguments.length - 1);\n for (var i = 0; i < args.length; i++) {\n args[i] = arguments[i + 1];\n }\n // Store and register the task\n var task = { callback: callback, args: args };\n tasksByHandle[nextHandle] = task;\n registerImmediate(nextHandle);\n return nextHandle++;\n }\n\n function clearImmediate(handle) {\n delete tasksByHandle[handle];\n }\n\n function run(task) {\n var callback = task.callback;\n var args = task.args;\n switch (args.length) {\n case 0:\n callback();\n break;\n case 1:\n callback(args[0]);\n break;\n case 2:\n callback(args[0], args[1]);\n break;\n case 3:\n callback(args[0], args[1], args[2]);\n break;\n default:\n callback.apply(undefined, args);\n break;\n }\n }\n\n function runIfPresent(handle) {\n // From the spec: \"Wait until any invocations of this algorithm started before this one have completed.\"\n // So if we're currently running a task, we'll need to delay this invocation.\n if (currentlyRunningATask) {\n // Delay by doing a setTimeout. setImmediate was tried instead, but in Firefox 7 it generated a\n // \"too much recursion\" error.\n setTimeout(runIfPresent, 0, handle);\n } else {\n var task = tasksByHandle[handle];\n if (task) {\n currentlyRunningATask = true;\n try {\n run(task);\n } finally {\n clearImmediate(handle);\n currentlyRunningATask = false;\n }\n }\n }\n }\n\n function installNextTickImplementation() {\n registerImmediate = function(handle) {\n process.nextTick(function () { runIfPresent(handle); });\n };\n }\n\n function canUsePostMessage() {\n // The test against `importScripts` prevents this implementation from being installed inside a web worker,\n // where `global.postMessage` means something completely different and can't be used for this purpose.\n if (global.postMessage && !global.importScripts) {\n var postMessageIsAsynchronous = true;\n var oldOnMessage = global.onmessage;\n global.onmessage = function() {\n postMessageIsAsynchronous = false;\n };\n global.postMessage(\"\", \"*\");\n global.onmessage = oldOnMessage;\n return postMessageIsAsynchronous;\n }\n }\n\n function installPostMessageImplementation() {\n // Installs an event handler on `global` for the `message` event: see\n // * https://developer.mozilla.org/en/DOM/window.postMessage\n // * http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#crossDocumentMessages\n\n var messagePrefix = \"setImmediate$\" + Math.random() + \"$\";\n var onGlobalMessage = function(event) {\n if (event.source === global &&\n typeof event.data === \"string\" &&\n event.data.indexOf(messagePrefix) === 0) {\n runIfPresent(+event.data.slice(messagePrefix.length));\n }\n };\n\n if (global.addEventListener) {\n global.addEventListener(\"message\", onGlobalMessage, false);\n } else {\n global.attachEvent(\"onmessage\", onGlobalMessage);\n }\n\n registerImmediate = function(handle) {\n global.postMessage(messagePrefix + handle, \"*\");\n };\n }\n\n function installMessageChannelImplementation() {\n var channel = new MessageChannel();\n channel.port1.onmessage = function(event) {\n var handle = event.data;\n runIfPresent(handle);\n };\n\n registerImmediate = function(handle) {\n channel.port2.postMessage(handle);\n };\n }\n\n function installReadyStateChangeImplementation() {\n var html = doc.documentElement;\n registerImmediate = function(handle) {\n // Create a <script> element; its readystatechange event will be fired asynchronously once it is inserted\n // into the document. Do so, thus queuing up the task. Remember to clean up once it's been called.\n var script = doc.createElement(\"script\");\n script.onreadystatechange = function () {\n runIfPresent(handle);\n script.onreadystatechange = null;\n html.removeChild(script);\n script = null;\n };\n html.appendChild(script);\n };\n }\n\n function installSetTimeoutImplementation() {\n registerImmediate = function(handle) {\n setTimeout(runIfPresent, 0, handle);\n };\n }\n\n // If supported, we should attach to the prototype of global, since that is where setTimeout et al. live.\n var attachTo = Object.getPrototypeOf && Object.getPrototypeOf(global);\n attachTo = attachTo && attachTo.setTimeout ? attachTo : global;\n\n // Don't get fooled by e.g. browserify environments.\n if ({}.toString.call(global.process) === \"[object process]\") {\n // For Node.js before 0.9\n installNextTickImplementation();\n\n } else if (canUsePostMessage()) {\n // For non-IE10 modern browsers\n installPostMessageImplementation();\n\n } else if (global.MessageChannel) {\n // For web workers, where supported\n installMessageChannelImplementation();\n\n } else if (doc && \"onreadystatechange\" in doc.createElement(\"script\")) {\n // For IE 6–8\n installReadyStateChangeImplementation();\n\n } else {\n // For older browsers\n installSetTimeoutImplementation();\n }\n\n attachTo.setImmediate = setImmediate;\n attachTo.clearImmediate = clearImmediate;\n}(typeof self === \"undefined\" ? typeof global === \"undefined\" ? this : global : self));\n\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(16), __webpack_require__(78)))\n\n/***/ }),\n/* 78 */\n/***/ (function(module, exports) {\n\n// shim for using process in browser\nvar process = module.exports = {};\n\n// cached from whatever global is present so that test runners that stub it\n// don't break things. But we need to wrap it in a try catch in case it is\n// wrapped in strict mode code which doesn't define any globals. It's inside a\n// function because try/catches deoptimize in certain engines.\n\nvar cachedSetTimeout;\nvar cachedClearTimeout;\n\nfunction defaultSetTimout() {\n throw new Error('setTimeout has not been defined');\n}\nfunction defaultClearTimeout () {\n throw new Error('clearTimeout has not been defined');\n}\n(function () {\n try {\n if (typeof setTimeout === 'function') {\n cachedSetTimeout = setTimeout;\n } else {\n cachedSetTimeout = defaultSetTimout;\n }\n } catch (e) {\n cachedSetTimeout = defaultSetTimout;\n }\n try {\n if (typeof clearTimeout === 'function') {\n cachedClearTimeout = clearTimeout;\n } else {\n cachedClearTimeout = defaultClearTimeout;\n }\n } catch (e) {\n cachedClearTimeout = defaultClearTimeout;\n }\n} ())\nfunction runTimeout(fun) {\n if (cachedSetTimeout === setTimeout) {\n //normal enviroments in sane situations\n return setTimeout(fun, 0);\n }\n // if setTimeout wasn't available but was latter defined\n if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {\n cachedSetTimeout = setTimeout;\n return setTimeout(fun, 0);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedSetTimeout(fun, 0);\n } catch(e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedSetTimeout.call(null, fun, 0);\n } catch(e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error\n return cachedSetTimeout.call(this, fun, 0);\n }\n }\n\n\n}\nfunction runClearTimeout(marker) {\n if (cachedClearTimeout === clearTimeout) {\n //normal enviroments in sane situations\n return clearTimeout(marker);\n }\n // if clearTimeout wasn't available but was latter defined\n if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {\n cachedClearTimeout = clearTimeout;\n return clearTimeout(marker);\n }\n try {\n // when when somebody has screwed with setTimeout but no I.E. maddness\n return cachedClearTimeout(marker);\n } catch (e){\n try {\n // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally\n return cachedClearTimeout.call(null, marker);\n } catch (e){\n // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.\n // Some versions of I.E. have different rules for clearTimeout vs setTimeout\n return cachedClearTimeout.call(this, marker);\n }\n }\n\n\n\n}\nvar queue = [];\nvar draining = false;\nvar currentQueue;\nvar queueIndex = -1;\n\nfunction cleanUpNextTick() {\n if (!draining || !currentQueue) {\n return;\n }\n draining = false;\n if (currentQueue.length) {\n queue = currentQueue.concat(queue);\n } else {\n queueIndex = -1;\n }\n if (queue.length) {\n drainQueue();\n }\n}\n\nfunction drainQueue() {\n if (draining) {\n return;\n }\n var timeout = runTimeout(cleanUpNextTick);\n draining = true;\n\n var len = queue.length;\n while(len) {\n currentQueue = queue;\n queue = [];\n while (++queueIndex < len) {\n if (currentQueue) {\n currentQueue[queueIndex].run();\n }\n }\n queueIndex = -1;\n len = queue.length;\n }\n currentQueue = null;\n draining = false;\n runClearTimeout(timeout);\n}\n\nprocess.nextTick = function (fun) {\n var args = new Array(arguments.length - 1);\n if (arguments.length > 1) {\n for (var i = 1; i < arguments.length; i++) {\n args[i - 1] = arguments[i];\n }\n }\n queue.push(new Item(fun, args));\n if (queue.length === 1 && !draining) {\n runTimeout(drainQueue);\n }\n};\n\n// v8 likes predictible objects\nfunction Item(fun, array) {\n this.fun = fun;\n this.array = array;\n}\nItem.prototype.run = function () {\n this.fun.apply(null, this.array);\n};\nprocess.title = 'browser';\nprocess.browser = true;\nprocess.env = {};\nprocess.argv = [];\nprocess.version = ''; // empty string to avoid regexp issues\nprocess.versions = {};\n\nfunction noop() {}\n\nprocess.on = noop;\nprocess.addListener = noop;\nprocess.once = noop;\nprocess.off = noop;\nprocess.removeListener = noop;\nprocess.removeAllListeners = noop;\nprocess.emit = noop;\nprocess.prependListener = noop;\nprocess.prependOnceListener = noop;\n\nprocess.listeners = function (name) { return [] }\n\nprocess.binding = function (name) {\n throw new Error('process.binding is not supported');\n};\n\nprocess.cwd = function () { return '/' };\nprocess.chdir = function (dir) {\n throw new Error('process.chdir is not supported');\n};\nprocess.umask = function() { return 0; };\n\n\n/***/ }),\n/* 79 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\n/**\n * Before using methods you should get first the module from the editor instance, in this way:\n *\n * ```js\n * var deviceManager = editor.DeviceManager;\n * ```\n *\n * @module DeviceManager\n */\nmodule.exports = function () {\n var c = {},\n defaults = __webpack_require__(80),\n Devices = __webpack_require__(81),\n DevicesView = __webpack_require__(83);\n var devices, view;\n\n return {\n /**\n * Name of the module\n * @type {String}\n * @private\n */\n name: 'DeviceManager',\n\n /**\n * Initialize module. Automatically called with a new instance of the editor\n * @param {Object} config Configurations\n * @param {Array<Object>} [config.devices=[]] Default devices\n * @example\n * ...\n * {\n * devices: [\n * {name: 'Desktop', width: ''}\n * {name: 'Tablet', width: '991px'}\n * ],\n * }\n * ...\n * @return {this}\n * @private\n */\n init: function init(config) {\n c = config || {};\n for (var name in defaults) {\n if (!(name in c)) c[name] = defaults[name];\n }\n\n devices = new Devices(c.devices);\n view = new DevicesView({\n collection: devices,\n config: c\n });\n return this;\n },\n\n\n /**\n * Add new device to the collection. URLs are supposed to be unique\n * @param {string} name Device name\n * @param {string} width Width of the device\n * @param {Object} opts Custom options\n * @return {Device} Added device\n * @example\n * deviceManager.add('Tablet', '900px');\n * deviceManager.add('Tablet2', '900px', {\n * height: '300px',\n * widthMedia: '810px', // the width that will be used for the CSS media\n * });\n */\n add: function add(name, width, opts) {\n var obj = opts || {};\n obj.name = name;\n obj.width = width;\n return devices.add(obj);\n },\n\n\n /**\n * Return device by name\n * @param {string} name Name of the device\n * @example\n * var device = deviceManager.get('Tablet');\n * console.log(JSON.stringify(device));\n * // {name: 'Tablet', width: '900px'}\n */\n get: function get(name) {\n return devices.get(name);\n },\n\n\n /**\n * Return all devices\n * @return {Collection}\n * @example\n * var devices = deviceManager.getAll();\n * console.log(JSON.stringify(devices));\n * // [{name: 'Desktop', width: ''}, ...]\n */\n getAll: function getAll() {\n return devices;\n },\n\n\n /**\n * Render devices\n * @return {string} HTML string\n * @private\n */\n render: function render() {\n return view.render().el;\n }\n };\n};\n\n/***/ }),\n/* 80 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = {\n devices: [],\n\n deviceLabel: 'Device'\n};\n\n/***/ }),\n/* 81 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar Backbone = __webpack_require__(0);\nvar Device = __webpack_require__(82);\n\nmodule.exports = Backbone.Collection.extend({\n model: Device\n});\n\n/***/ }),\n/* 82 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar Backbone = __webpack_require__(0);\n\nmodule.exports = Backbone.Model.extend({\n idAttribute: 'name',\n\n defaults: {\n name: '',\n\n // Width to set for the editor iframe\n width: '',\n\n // Height to set for the editor iframe\n height: '',\n\n // The width which will be used in media queries,\n // If empty the width will be used\n widthMedia: null\n },\n\n initialize: function initialize() {\n if (this.get('widthMedia') == null) {\n this.set('widthMedia', this.get('width'));\n }\n }\n});\n\n/***/ }),\n/* 83 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(_) {\n\nvar Backbone = __webpack_require__(0);\n\nmodule.exports = Backbone.View.extend({\n template: _.template('\\n <div class=\"<%= ppfx %>device-label\"><%= deviceLabel %></div>\\n <div class=\"<%= ppfx %>field <%= ppfx %>select\">\\n <span id=\"<%= ppfx %>input-holder\">\\n <select class=\"<%= ppfx %>devices\"></select>\\n </span>\\n <div class=\"<%= ppfx %>sel-arrow\">\\n <div class=\"<%= ppfx %>d-s-arrow\"></div>\\n </div>\\n </div>\\n <button style=\"display:none\" class=\"<%= ppfx %>add-trasp\">+</button>'),\n\n events: {\n change: 'updateDevice'\n },\n\n initialize: function initialize(o) {\n this.config = o.config || {};\n this.em = this.config.em;\n this.ppfx = this.config.pStylePrefix || '';\n this.events['click .' + this.ppfx + 'add-trasp'] = this.startAdd;\n this.listenTo(this.em, 'change:device', this.updateSelect);\n this.delegateEvents();\n },\n\n\n /**\n * Start adding new device\n * @return {[type]} [description]\n * @private\n */\n startAdd: function startAdd() {},\n\n\n /**\n * Update device of the editor\n * @private\n */\n updateDevice: function updateDevice() {\n var em = this.em;\n if (em) {\n var devEl = this.devicesEl;\n var val = devEl ? devEl.val() : '';\n em.set('device', val);\n }\n },\n\n\n /**\n * Update select value on device update\n * @private\n */\n updateSelect: function updateSelect() {\n var em = this.em;\n var devEl = this.devicesEl;\n if (em && em.getDeviceModel && devEl) {\n var device = em.getDeviceModel();\n var name = device ? device.get('name') : '';\n devEl.val(name);\n }\n },\n\n\n /**\n * Return devices options\n * @return {string} String of options\n * @private\n */\n getOptions: function getOptions() {\n var result = '';\n this.collection.each(function (device) {\n var name = device.get('name');\n result += '<option value=\"' + name + '\">' + name + '</option>';\n });\n return result;\n },\n render: function render() {\n var pfx = this.ppfx;\n this.$el.html(this.template({\n ppfx: pfx,\n deviceLabel: this.config.deviceLabel\n }));\n this.devicesEl = this.$el.find('.' + pfx + 'devices');\n this.devicesEl.append(this.getOptions());\n this.el.className = pfx + 'devices-c';\n return this;\n }\n});\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))\n\n/***/ }),\n/* 84 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = function () {\n var c = {},\n defaults = __webpack_require__(85),\n parserCss = __webpack_require__(86),\n parserHtml = __webpack_require__(25);\n var pHtml, pCss;\n\n return {\n compTypes: '',\n\n /**\n * Name of the module\n * @type {String}\n * @private\n */\n name: 'Parser',\n\n /**\n * Initialize module. Automatically called with a new instance of the editor\n * @param {Object} config Configurations\n * @param {Array<Object>} [config.blocks=[]] Default blocks\n * @return {this}\n * @example\n * ...\n * {\n * blocks: [\n * {id:'h1-block' label: 'Heading', content:'<h1>...</h1>'},\n * ...\n * ],\n * }\n * ...\n */\n init: function init(config) {\n c = config || {};\n for (var name in defaults) {\n if (!(name in c)) c[name] = defaults[name];\n }\n pHtml = new parserHtml(c);\n pCss = new parserCss(c);\n return this;\n },\n\n\n /**\n * Parse HTML string and return valid model\n * @param {string} str HTML string\n * @return {Object}\n */\n parseHtml: function parseHtml(str) {\n pHtml.compTypes = this.compTypes;\n return pHtml.parse(str, pCss);\n },\n parseCss: function parseCss(str) {\n return pCss.parse(str);\n }\n };\n};\n\n/***/ }),\n/* 85 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = {\n textTags: ['br', 'b', 'i', 'u', 'a', 'ul', 'ol']\n};\n\n/***/ }),\n/* 86 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _underscore = __webpack_require__(1);\n\n// At-rules\n// https://developer.mozilla.org/it/docs/Web/API/CSSRule#Type_constants\nvar atRules = {\n 4: 'media',\n 5: 'font-face',\n 6: 'page',\n 7: 'keyframes',\n 11: 'counter-style',\n 12: 'supports',\n 13: 'document',\n 14: 'font-feature-values',\n 15: 'viewport'\n};\nvar atRuleKeys = (0, _underscore.keys)(atRules);\nvar singleAtRules = ['5', '6', '11', '15'];\n\nmodule.exports = function (config) {\n return {\n /**\n * Parse selector string to array.\n * Only classe based are valid as CSS rules inside editor, not valid\n * selectors will be dropped as additional\n * It's ok with the last part of the string as state (:hover, :active)\n * @param {string} str Selectors string\n * @return {Object}\n * @example\n * var res = ParserCss.parseSelector('.test1, .test1.test2, .test2 .test3');\n * console.log(res);\n * // {\n * //result: [['test1'], ['test1', 'test2']],\n * //add: ['.test2 .test3']\n * //}\n */\n parseSelector: function parseSelector() {\n var str = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n\n var add = [];\n var result = [];\n var sels = str.split(',');\n for (var i = 0, len = sels.length; i < len; i++) {\n var sel = sels[i].trim();\n // Will accept only concatenated classes and last\n // class might be with state (eg. :hover), nothing else.\n if (/^(\\.{1}[\\w\\-]+)+(:{1,2}[\\w\\-()]+)?$/gi.test(sel)) {\n var cls = sel.split('.').filter(Boolean);\n result.push(cls);\n } else {\n add.push(sel);\n }\n }\n return {\n result: result,\n add: add\n };\n },\n\n\n /**\n * Parse style declarations of the node\n * @param {CSSRule} node\n * @return {Object}\n */\n parseStyle: function parseStyle(node) {\n var stl = node.style;\n var style = {};\n\n for (var i = 0, len = stl.length; i < len; i++) {\n var propName = stl[i];\n var propValue = stl.getPropertyValue(propName);\n var important = stl.getPropertyPriority(propName);\n style[propName] = '' + propValue + (important ? ' !' + important : '');\n }\n\n return style;\n },\n\n\n /**\n * Get the condition when possible\n * @param {CSSRule} node\n * @return {string}\n */\n parseCondition: function parseCondition(node) {\n var condition = node.conditionText || node.media && node.media.mediaText || node.name || node.selectorText || '';\n return condition.trim();\n },\n\n\n /**\n * Fetch data from node\n * @param {StyleSheet|CSSRule} el\n * @return {Array<Object>}\n */\n parseNode: function parseNode(el) {\n var result = [];\n var nodes = el.cssRules || [];\n\n for (var i = 0, len = nodes.length; i < len; i++) {\n var node = nodes[i];\n var type = node.type.toString();\n var singleAtRule = 0;\n var atRuleType = '';\n var condition = '';\n // keyText is for CSSKeyframeRule\n var sels = node.selectorText || node.keyText;\n var isSingleAtRule = singleAtRules.indexOf(type) >= 0;\n\n // Check if the node is an at-rule\n if (isSingleAtRule) {\n singleAtRule = 1;\n atRuleType = atRules[type];\n condition = this.parseCondition(node);\n } else if (atRuleKeys.indexOf(type) >= 0) {\n var subRules = this.parseNode(node);\n condition = this.parseCondition(node);\n\n for (var s = 0, lens = subRules.length; s < lens; s++) {\n var subRule = subRules[s];\n condition && (subRule.mediaText = condition);\n subRule.atRuleType = atRules[type];\n }\n result = result.concat(subRules);\n }\n\n if (!sels && !isSingleAtRule) continue;\n var style = this.parseStyle(node);\n var selsParsed = this.parseSelector(sels);\n var selsAdd = selsParsed.add;\n sels = selsParsed.result;\n\n var lastRule = void 0;\n // For each group of selectors\n for (var k = 0, len3 = sels.length; k < len3; k++) {\n var selArr = sels[k];\n var model = {};\n singleAtRule && (model.singleAtRule = singleAtRule);\n atRuleType && (model.atRuleType = atRuleType);\n\n //Isolate state from selector\n var stateArr = selArr[selArr.length - 1].split(/:(.+)/);\n if (stateArr[1]) {\n selArr[selArr.length - 1] = stateArr[0];\n model.state = stateArr[1];\n stateArr.splice(stateArr.length - 1, 1);\n }\n\n model.selectors = selArr;\n model.style = style;\n lastRule = model;\n result.push(model);\n }\n\n // Need to push somewhere not class-based selectors, if some rule was\n // created will push them there, otherwise will create a new rule\n if (selsAdd.length) {\n var selsAddStr = selsAdd.join(', ');\n if (lastRule) {\n lastRule.selectorsAdd = selsAddStr;\n } else {\n var _model = {\n selectors: [],\n selectorsAdd: selsAddStr,\n style: style\n };\n singleAtRule && (_model.singleAtRule = singleAtRule);\n atRuleType && (_model.atRuleType = atRuleType);\n condition && (_model.mediaText = condition);\n result.push(_model);\n }\n }\n // console.log('LAST PUSH', result[result.length - 1]);\n }\n\n return result;\n },\n\n\n /**\n * Parse CSS string to a desired model object\n * @param {string} str HTML string\n * @return {Object|Array<Object>}\n */\n parse: function parse(str) {\n var el = document.createElement('style');\n el.innerHTML = str;\n\n // There is no .sheet before adding it to the <head>\n document.head.appendChild(el);\n var sheet = el.sheet;\n document.head.removeChild(el);\n var result = this.parseNode(sheet);\n\n return result.length == 1 ? result[0] : result;\n }\n };\n};\n\n/***/ }),\n/* 87 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; /**\n * Selectors in GrapesJS are used in CSS Composer inside Rules and in Components as classes. To get better this concept let's take\n * a look at this code:\n *\n * ```css\n * span > #send-btn.btn{\n * ...\n * }\n * ```\n * ```html\n * <span>\n * <button id=\"send-btn\" class=\"btn\"></button>\n * </span>\n * ```\n *\n * In this scenario we get:\n * span -> selector of type `tag`\n * send-btn -> selector of type `id`\n * btn -> selector of type `class`\n *\n * So, for example, being `btn` the same class entity it'll be easier to refactor and track things.\n *\n * Before using methods you should get first the module from the editor instance, in this way:\n *\n * ```js\n * var selectorManager = editor.SelectorManager;\n * ```\n *\n * @module SelectorManager\n * @param {Object} config Configurations\n * @param {Array<Object>} [config.selectors=[]] Default selectors\n * @param {Array<Object>} [config.states=[]] Default states\n * @param {String} [config.label='Classes'] Classes label\n * @param {String} [config.statesLabel='- State -'] The empty state label\n * @return {this}\n * @example\n * ...\n * {\n * selectors: [\n * {name:'myselector1'},\n * ...\n * ],\n * states: [{\n * name: 'hover', label: 'Hover'\n * },{\n * name: 'active', label: 'Click'\n * }],\n * statesLabel: '- Selecte State -',\n * }\n */\n\nvar _underscore = __webpack_require__(1);\n\nmodule.exports = function (config) {\n var c = config || {},\n defaults = __webpack_require__(88),\n Selector = __webpack_require__(7),\n Selectors = __webpack_require__(10),\n ClassTagsView = __webpack_require__(89);\n var selectors, selectorTags;\n\n return {\n Selector: Selector,\n\n Selectors: Selectors,\n\n /**\n * Name of the module\n * @type {String}\n * @private\n */\n name: 'SelectorManager',\n\n /**\n * Initialize module. Automatically called with a new instance of the editor\n * @param {Object} config Configurations\n * @return {this}\n * @private\n */\n init: function init(conf) {\n c = conf || {};\n\n for (var name in defaults) {\n if (!(name in c)) c[name] = defaults[name];\n }\n\n var em = c.em;\n var ppfx = c.pStylePrefix;\n\n if (ppfx) {\n c.stylePrefix = ppfx + c.stylePrefix;\n }\n\n selectorTags = new ClassTagsView({\n collection: new Selectors([], { em: em, config: c }),\n config: c\n });\n\n // Global selectors container\n selectors = new Selectors(c.selectors);\n selectors.on('add', function (model) {\n return em.trigger('selector:add', model);\n });\n\n return this;\n },\n\n\n /**\n * Add a new selector to collection if it's not already exists. Class type is a default one\n * @param {String} name Selector name\n * @param {Object} opts Selector options\n * @param {String} [opts.label=''] Label for the selector, if it's not provided the label will be the same as the name\n * @param {String} [opts.type='class'] Type of the selector. At the moment, only 'class' is available\n * @return {Model}\n * @example\n * var selector = selectorManager.add('selectorName');\n * // Same as\n * var selector = selectorManager.add('selectorName', {\n * type: 'class',\n * label: 'selectorName'\n * });\n * */\n add: function add(name) {\n var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n if ((typeof name === 'undefined' ? 'undefined' : _typeof(name)) == 'object') {\n opts = name;\n } else {\n opts.name = name;\n }\n\n if (opts.label && !opts.name) {\n opts.name = Selector.escapeName(opts.label);\n }\n\n var cname = opts.name;\n var selector = cname ? this.get(cname, opts.type) : selectors.where(opts)[0];\n\n if (!selector) {\n return selectors.add(opts);\n }\n\n return selector;\n },\n\n\n /**\n * Add class selectors\n * @param {Array|string} classes Array or string of classes\n * @return {Array} Array of added selectors\n * @example\n * sm.addClass('class1');\n * sm.addClass('class1 class2');\n * sm.addClass(['class1', 'class2']);\n * // -> [SelectorObject, ...]\n */\n addClass: function addClass(classes) {\n var added = [];\n\n if ((0, _underscore.isString)(classes)) {\n classes = classes.trim().split(' ');\n }\n\n classes.forEach(function (name) {\n return added.push(selectors.add({ name: name }));\n });\n return added;\n },\n\n\n /**\n * Get the selector by its name\n * @param {String} name Selector name\n * @param {String} tyoe Selector type\n * @return {Model|null}\n * @example\n * var selector = selectorManager.get('selectorName');\n * */\n get: function get(name) {\n var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Selector.TYPE_CLASS;\n\n return selectors.where({ name: name, type: type })[0];\n },\n\n\n /**\n * Get all selectors\n * @return {Collection}\n * */\n getAll: function getAll() {\n return selectors;\n },\n\n\n /**\n * Render class selectors. If an array of selectors is provided a new instance of the collection will be rendered\n * @param {Array<Object>} selectors\n * @return {HTMLElement}\n * @private\n */\n render: function render(selectors) {\n if (selectors) {\n var view = new ClassTagsView({\n collection: new Selectors(selectors),\n config: c\n });\n return view.render().el;\n } else return selectorTags.render().el;\n }\n };\n};\n\n/***/ }),\n/* 88 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = {\n // Style prefix\n stylePrefix: 'clm-',\n\n // Default selectors\n selectors: [],\n\n // Label for selectors\n label: 'Classes',\n\n // Label for states\n statesLabel: '- State -',\n\n selectedLabel: 'Selected',\n\n // States\n states: [{ name: 'hover', label: 'Hover' }, { name: 'active', label: 'Click' }, { name: 'nth-of-type(2n)', label: 'Even/Odd' }]\n};\n\n/***/ }),\n/* 89 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(_) {\n\nvar Backbone = __webpack_require__(0);\nvar ClassTagView = __webpack_require__(90);\n\nmodule.exports = Backbone.View.extend({\n template: _.template('\\n <div id=\"<%= pfx %>up\">\\n <div id=\"<%= pfx %>label\"><%= label %></div>\\n <div id=\"<%= pfx %>status-c\">\\n <span id=\"<%= pfx %>input-c\">\\n <div class=\"<%= ppfx %>field <%= ppfx %>select\">\\n <span id=\"<%= ppfx %>input-holder\">\\n <select id=\"<%= pfx %>states\">\\n <option value=\"\"><%= statesLabel %></option>\\n </select>\\n </span>\\n <div class=\"<%= ppfx %>sel-arrow\">\\n <div class=\"<%= ppfx %>d-s-arrow\"></div>\\n </div>\\n </div>\\n </span>\\n </div>\\n </div>\\n <div id=\"<%= pfx %>tags-field\" class=\"<%= ppfx %>field\">\\n <div id=\"<%= pfx %>tags-c\"></div>\\n <input id=\"<%= pfx %>new\" />\\n <span id=\"<%= pfx %>add-tag\" class=\"fa fa-plus\"></span>\\n </div>\\n <div id=\"<%= pfx %>sel-help\">\\n <div id=\"<%= pfx %>label\"><%= selectedLabel %></div>\\n <div id=\"<%= pfx %>sel\"></div>\\n <div style=\"clear:both\"></div>\\n </div>'),\n\n events: {},\n\n initialize: function initialize() {\n var o = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n this.config = o.config || {};\n this.pfx = this.config.stylePrefix || '';\n this.ppfx = this.config.pStylePrefix || '';\n this.className = this.pfx + 'tags';\n this.addBtnId = this.pfx + 'add-tag';\n this.newInputId = this.pfx + 'new';\n this.stateInputId = this.pfx + 'states';\n this.stateInputC = this.pfx + 'input-c';\n this.states = this.config.states || [];\n this.events['click #' + this.addBtnId] = 'startNewTag';\n this.events['blur #' + this.newInputId] = 'endNewTag';\n this.events['keyup #' + this.newInputId] = 'onInputKeyUp';\n this.events['change #' + this.stateInputId] = 'stateChanged';\n\n this.target = this.config.em;\n this.em = this.target;\n\n this.listenTo(this.target, 'change:selectedComponent', this.componentChanged);\n this.listenTo(this.target, 'component:update:classes', this.updateSelector);\n\n this.listenTo(this.collection, 'add', this.addNew);\n this.listenTo(this.collection, 'reset', this.renderClasses);\n this.listenTo(this.collection, 'remove', this.tagRemoved);\n\n this.delegateEvents();\n },\n\n\n /**\n * Triggered when a tag is removed from collection\n * @param {Object} model Removed model\n * @private\n */\n tagRemoved: function tagRemoved(model) {\n this.updateStateVis();\n },\n\n\n /**\n * Create select input with states\n * @return {string} String of options\n * @private\n */\n getStateOptions: function getStateOptions() {\n var strInput = '';\n for (var i = 0; i < this.states.length; i++) {\n strInput += '<option value=\"' + this.states[i].name + '\">' + this.states[i].label + '</option>';\n }\n return strInput;\n },\n\n\n /**\n * Add new model\n * @param {Object} model\n * @private\n */\n addNew: function addNew(model) {\n this.addToClasses(model);\n },\n\n\n /**\n * Start tag creation\n * @param {Object} e\n * @private\n */\n startNewTag: function startNewTag(e) {\n this.$addBtn.get(0).style.display = 'none';\n this.$input.show().focus();\n },\n\n\n /**\n * End tag creation\n * @param {Object} e\n * @private\n */\n endNewTag: function endNewTag(e) {\n this.$addBtn.get(0).style.display = '';\n this.$input.hide().val('');\n },\n\n\n /**\n * Checks what to do on keyup event\n * @param {Object} e\n * @private\n */\n onInputKeyUp: function onInputKeyUp(e) {\n if (e.keyCode === 13) this.addNewTag(this.$input.val());else if (e.keyCode === 27) this.endNewTag();\n },\n\n\n /**\n * Triggered when component is changed\n * @param {Object} e\n * @private\n */\n componentChanged: function componentChanged(e) {\n this.compTarget = this.target.get('selectedComponent');\n var target = this.compTarget;\n var validSelectors = [];\n\n if (target) {\n this.getStates().val(target.get('state'));\n validSelectors = target.get('classes').getValid();\n }\n\n this.collection.reset(validSelectors);\n this.updateStateVis();\n },\n\n\n /**\n * Update states visibility. Hides states in case there is no tags\n * inside collection\n * @private\n */\n updateStateVis: function updateStateVis() {\n var em = this.em;\n var avoidInline = em && em.getConfig('avoidInlineStyle');\n\n if (this.collection.length || avoidInline) this.getStatesC().css('display', 'block');else this.getStatesC().css('display', 'none');\n this.updateSelector();\n },\n\n\n /**\n * Udpate selector helper\n * @return {this}\n * @private\n */\n updateSelector: function updateSelector() {\n var selected = this.target.getSelected();\n this.compTarget = selected;\n\n if (!selected || !selected.get) {\n return;\n }\n\n var state = selected.get('state');\n var coll = this.collection;\n var result = coll.getFullString(coll.getStyleable());\n result = result || '#' + selected.getId();\n result += state ? ':' + state : '';\n var el = this.el.querySelector('#' + this.pfx + 'sel');\n el && (el.innerHTML = result);\n },\n\n\n /**\n * Triggered when the select with states is changed\n * @param {Object} e\n * @private\n */\n stateChanged: function stateChanged(e) {\n if (this.compTarget) {\n this.compTarget.set('state', this.$states.val());\n this.updateSelector();\n }\n },\n\n\n /**\n * Add new tag to collection, if possible, and to the component\n * @param {Object} e\n * @private\n */\n addNewTag: function addNewTag(label) {\n var target = this.target;\n var component = this.compTarget;\n\n if (!label.trim()) {\n return;\n }\n\n if (target) {\n var sm = target.get('SelectorManager');\n var model = sm.add({ label: label });\n\n if (component) {\n var compCls = component.get('classes');\n var lenB = compCls.length;\n compCls.add(model);\n var lenA = compCls.length;\n this.collection.add(model);\n this.updateStateVis();\n }\n }\n this.endNewTag();\n },\n\n\n /**\n * Add new object to collection\n * @param {Object} model Model\n * @param {Object} fragmentEl Fragment collection\n * @return {Object} Object created\n * @private\n * */\n addToClasses: function addToClasses(model, fragmentEl) {\n var fragment = fragmentEl || null;\n\n var view = new ClassTagView({\n model: model,\n config: this.config,\n coll: this.collection\n });\n var rendered = view.render().el;\n\n if (fragment) fragment.appendChild(rendered);else this.getClasses().append(rendered);\n\n return rendered;\n },\n\n\n /**\n * Render the collection of classes\n * @return {this}\n * @private\n */\n renderClasses: function renderClasses() {\n var fragment = document.createDocumentFragment();\n\n this.collection.each(function (model) {\n this.addToClasses(model, fragment);\n }, this);\n\n if (this.getClasses()) this.getClasses().empty().append(fragment);\n\n return this;\n },\n\n\n /**\n * Return classes element\n * @return {HTMLElement}\n * @private\n */\n getClasses: function getClasses() {\n if (!this.$classes) this.$classes = this.$el.find('#' + this.pfx + 'tags-c');\n return this.$classes;\n },\n\n\n /**\n * Return states element\n * @return {HTMLElement}\n * @private\n */\n getStates: function getStates() {\n if (!this.$states) this.$states = this.$el.find('#' + this.stateInputId);\n return this.$states;\n },\n\n\n /**\n * Return states container element\n * @return {HTMLElement}\n * @private\n */\n getStatesC: function getStatesC() {\n if (!this.$statesC) this.$statesC = this.$el.find('#' + this.stateInputC);\n return this.$statesC;\n },\n render: function render() {\n var config = this.config;\n this.$el.html(this.template({\n selectedLabel: config.selectedLabel,\n statesLabel: config.statesLabel,\n label: config.label,\n pfx: this.pfx,\n ppfx: this.ppfx\n }));\n this.$input = this.$el.find('input#' + this.newInputId);\n this.$addBtn = this.$el.find('#' + this.addBtnId);\n this.$classes = this.$el.find('#' + this.pfx + 'tags-c');\n this.$states = this.$el.find('#' + this.stateInputId);\n this.$statesC = this.$el.find('#' + this.stateInputC);\n this.$states.append(this.getStateOptions());\n this.renderClasses();\n this.$el.attr('class', this.className);\n return this;\n }\n});\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))\n\n/***/ }),\n/* 90 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar Selector = __webpack_require__(7);\nvar inputProp = 'contentEditable';\n\nmodule.exports = __webpack_require__(0).View.extend({\n template: function template() {\n var pfx = this.pfx;\n var ppfx = this.ppfx;\n var label = this.model.get('label') || '';\n return '\\n <span id=\"' + pfx + 'checkbox\" class=\"fa\" data-tag-status></span>\\n <span id=\"' + pfx + 'tag-label\" data-tag-name>' + label + '</span>\\n <span id=\"' + pfx + 'close\" data-tag-remove>\\n ⨯\\n </span>\\n ';\n },\n\n\n events: {\n 'click [data-tag-remove]': 'removeTag',\n 'click [data-tag-status]': 'changeStatus',\n 'dblclick [data-tag-name]': 'startEditTag',\n 'focusout [data-tag-name]': 'endEditTag'\n },\n\n initialize: function initialize(o) {\n this.config = o.config || {};\n this.coll = o.coll || null;\n this.pfx = this.config.stylePrefix || '';\n this.ppfx = this.config.pStylePrefix || '';\n this.target = this.config.em;\n this.listenTo(this.model, 'change:active', this.updateStatus);\n },\n\n\n /**\n * Returns the element which containes the anme of the tag\n * @return {HTMLElement}\n */\n getInputEl: function getInputEl() {\n if (!this.inputEl) {\n this.inputEl = this.el.querySelector('[data-tag-name]');\n }\n\n return this.inputEl;\n },\n\n\n /**\n * Start editing tag\n * @private\n */\n startEditTag: function startEditTag() {\n var inputEl = this.getInputEl();\n inputEl[inputProp] = true;\n inputEl.focus();\n },\n\n\n /**\n * End editing tag. If the class typed already exists the\n * old one will be restored otherwise will be changed\n * @private\n */\n endEditTag: function endEditTag() {\n var model = this.model;\n var inputEl = this.getInputEl();\n var label = inputEl.textContent;\n var name = Selector.escapeName(label);\n var em = this.target;\n var sm = em && em.get('SelectorManager');\n inputEl[inputProp] = false;\n\n if (sm) {\n if (sm.get(name)) {\n inputEl.innerText = model.get('label');\n } else {\n model.set({ name: name, label: label });\n }\n }\n },\n\n\n /**\n * Update status of the tag\n * @private\n */\n changeStatus: function changeStatus() {\n this.model.set('active', !this.model.get('active'));\n },\n\n\n /**\n * Remove tag from the selected component\n * @param {Object} e\n * @private\n */\n removeTag: function removeTag(e) {\n var _this = this;\n\n var em = this.target;\n var model = this.model;\n var coll = this.coll;\n var el = this.el;\n var sel = em && em.get('selectedComponent');\n sel && sel.get & sel.get('classes').remove(model);\n coll && coll.remove(model);\n setTimeout(function () {\n return _this.remove();\n }, 0);\n },\n\n\n /**\n * Update status of the checkbox\n * @private\n */\n updateStatus: function updateStatus() {\n var chkOn = 'fa-check-square-o';\n var chkOff = 'fa-square-o';\n\n if (!this.$chk) this.$chk = this.$el.find('#' + this.pfx + 'checkbox');\n\n if (this.model.get('active')) {\n this.$chk.removeClass(chkOff).addClass(chkOn);\n this.$el.removeClass('opac50');\n } else {\n this.$chk.removeClass(chkOn).addClass(chkOff);\n this.$el.addClass('opac50');\n }\n },\n render: function render() {\n var pfx = this.pfx;\n var ppfx = this.ppfx;\n this.$el.html(this.template());\n this.$el.attr('class', pfx + 'tag ' + ppfx + 'three-bg');\n this.updateStatus();\n return this;\n }\n});\n\n/***/ }),\n/* 91 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\n/**\n * * [open](#open)\n * * [close](#close)\n * * [isOpen](#isopen)\n * * [setTitle](#settitle)\n * * [getTitle](#gettitle)\n * * [setContent](#setcontent)\n * * [getContent](#getcontent)\n *\n * Before using the methods you should get first the module from the editor instance, in this way:\n *\n * ```js\n * var modal = editor.Modal;\n * ```\n * @module Modal\n */\nmodule.exports = function () {\n var c = {},\n defaults = __webpack_require__(92),\n ModalM = __webpack_require__(93),\n ModalView = __webpack_require__(94);\n var model, modal;\n\n return {\n /**\n * Name of the module\n * @type {String}\n * @private\n */\n name: 'Modal',\n\n /**\n * Initialize module. Automatically called with a new instance of the editor\n * @param {Object} config Configurations\n * @private\n */\n init: function init(config) {\n c = config || {};\n for (var name in defaults) {\n if (!(name in c)) c[name] = defaults[name];\n }\n\n var ppfx = c.pStylePrefix;\n if (ppfx) c.stylePrefix = ppfx + c.stylePrefix;\n\n model = new ModalM(c);\n modal = new ModalView({\n model: model,\n config: c\n });\n\n return this;\n },\n postRender: function postRender(editorView) {\n // c.em.config.el || 'body'\n this.render().appendTo(editorView.el);\n },\n\n\n /**\n * Open the modal window\n * @return {this}\n */\n open: function open() {\n modal.show();\n return this;\n },\n\n\n /**\n * Close the modal window\n * @return {this}\n */\n close: function close() {\n modal.hide();\n return this;\n },\n\n\n /**\n * Checks if the modal window is open\n * @return {Boolean}\n */\n isOpen: function isOpen() {\n return !!model.get('open');\n },\n\n\n /**\n * Set the title to the modal window\n * @param {string} title Title\n * @return {this}\n * @example\n * modal.setTitle('New title');\n */\n setTitle: function setTitle(title) {\n model.set('title', title);\n return this;\n },\n\n\n /**\n * Returns the title of the modal window\n * @return {string}\n */\n getTitle: function getTitle() {\n return model.get('title');\n },\n\n\n /**\n * Set the content of the modal window\n * @param {string|HTMLElement} content Content\n * @return {this}\n * @example\n * modal.setContent('<div>Some HTML content</div>');\n */\n setContent: function setContent(content) {\n model.set('content', ' ');\n model.set('content', content);\n return this;\n },\n\n\n /**\n * Get the content of the modal window\n * @return {string}\n */\n getContent: function getContent() {\n return model.get('content');\n },\n\n\n /**\n * Returns content element\n * @return {HTMLElement}\n * @private\n */\n getContentEl: function getContentEl() {\n return modal.getContent().get(0);\n },\n\n\n /**\n * Returns modal model\n * @return {Model}\n * @private\n */\n getModel: function getModel() {\n return model;\n },\n\n\n /**\n * Render the modal window\n * @return {HTMLElement}\n * @private\n */\n render: function render() {\n return modal.render().$el;\n }\n };\n};\n\n/***/ }),\n/* 92 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = {\n stylePrefix: 'mdl-',\n\n title: '',\n\n content: '',\n\n backdrop: true\n};\n\n/***/ }),\n/* 93 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar Backbone = __webpack_require__(0);\n\nmodule.exports = Backbone.Model.extend({\n defaults: {\n title: '',\n content: '',\n open: false\n }\n});\n\n/***/ }),\n/* 94 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = __webpack_require__(0).View.extend({\n template: function template(_ref) {\n var pfx = _ref.pfx,\n ppfx = _ref.ppfx,\n content = _ref.content,\n title = _ref.title;\n\n return '<div class=\"' + pfx + 'dialog ' + ppfx + 'one-bg\">\\n <div class=\"' + pfx + 'header\">\\n <div class=\"' + pfx + 'title\">' + title + '</div>\\n <div class=\"' + pfx + 'btn-close\">⨯</div>\\n </div>\\n <div class=\"' + pfx + 'content\">\\n <div id=\"' + pfx + 'c\">' + content + '</div>\\n <div style=\"clear:both\"></div>\\n </div>\\n </div>\\n <div class=\"' + pfx + 'backlayer\"></div>\\n <div class=\"' + pfx + 'collector\" style=\"display: none\"></div>';\n },\n\n\n events: {},\n\n initialize: function initialize(o) {\n var model = this.model;\n var config = o.config || {};\n var pfx = config.stylePrefix || '';\n var bkd = config.backdrop;\n this.config = config;\n this.pfx = pfx;\n this.ppfx = config.pStylePrefix || '';\n this.listenTo(model, 'change:open', this.updateOpen);\n this.listenTo(model, 'change:title', this.updateTitle);\n this.listenTo(model, 'change:content', this.updateContent);\n this.events['click .' + pfx + 'btn-close'] = 'hide';\n bkd && (this.events['click .' + pfx + 'backlayer'] = 'hide');\n this.delegateEvents();\n },\n\n\n /**\n * Returns collector element\n * @return {HTMLElement}\n * @private\n */\n getCollector: function getCollector() {\n if (!this.$collector) this.$collector = this.$el.find('.' + this.pfx + 'collector');\n return this.$collector;\n },\n\n\n /**\n * Returns content element\n * @return {HTMLElement}\n * @private\n */\n getContent: function getContent() {\n var pfx = this.pfx;\n\n if (!this.$content) {\n this.$content = this.$el.find('.' + pfx + 'content #' + pfx + 'c');\n }\n\n return this.$content;\n },\n\n\n /**\n * Returns title element\n * @return {HTMLElement}\n * @private\n */\n getTitle: function getTitle() {\n if (!this.$title) this.$title = this.$el.find('.' + this.pfx + 'title');\n return this.$title.get(0);\n },\n\n\n /**\n * Update content\n * @private\n * */\n updateContent: function updateContent() {\n var content = this.getContent();\n var children = content.children();\n var coll = this.getCollector();\n var body = this.model.get('content');\n children.length && coll.append(children);\n content.empty().append(body);\n },\n\n\n /**\n * Update title\n * @private\n * */\n updateTitle: function updateTitle() {\n var title = this.getTitle();\n if (title) title.innerHTML = this.model.get('title');\n },\n\n\n /**\n * Update open\n * @private\n * */\n updateOpen: function updateOpen() {\n this.el.style.display = this.model.get('open') ? '' : 'none';\n },\n\n\n /**\n * Hide modal\n * @private\n * */\n hide: function hide() {\n this.model.set('open', 0);\n },\n\n\n /**\n * Show modal\n * @private\n * */\n show: function show() {\n this.model.set('open', 1);\n },\n render: function render() {\n var el = this.$el;\n var pfx = this.pfx;\n var ppfx = this.ppfx;\n var obj = this.model.toJSON();\n obj.pfx = this.pfx;\n obj.ppfx = this.ppfx;\n el.html(this.template(obj));\n el.attr('class', pfx + 'container');\n this.updateOpen();\n return this;\n }\n});\n\n/***/ }),\n/* 95 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\n/**\n * - [addGenerator](#addgenerator)\n * - [getGenerator](#getgenerator)\n * - [getGenerators](#getgenerators)\n * - [addViewer](#addviewer)\n * - [getViewer](#getviewer)\n * - [getViewers](#getviewers)\n * - [updateViewer](#updateviewer)\n * - [getCode](#getcode)\n *\n *\n * Before using methods you should get first the module from the editor instance, in this way:\n *\n * ```js\n * var codeManager = editor.CodeManager;\n * ```\n *\n * @module CodeManager\n */\nmodule.exports = function () {\n var c = {},\n defaults = __webpack_require__(96),\n gHtml = __webpack_require__(97),\n gCss = __webpack_require__(98),\n gJson = __webpack_require__(99),\n gJs = __webpack_require__(100),\n eCM = __webpack_require__(101),\n editorView = __webpack_require__(106);\n\n var generators = {},\n defGenerators = {},\n viewers = {},\n defViewers = {};\n\n return {\n getConfig: function getConfig() {\n return c;\n },\n\n\n config: c,\n\n EditorView: editorView,\n\n /**\n * Name of the module\n * @type {String}\n * @private\n */\n name: 'CodeManager',\n\n /**\n * Initialize module. Automatically called with a new instance of the editor\n * @param {Object} config Configurations\n */\n init: function init(config) {\n c = config || {};\n for (var name in defaults) {\n if (!(name in c)) c[name] = defaults[name];\n }\n\n var ppfx = c.pStylePrefix;\n if (ppfx) c.stylePrefix = ppfx + c.stylePrefix;\n\n defGenerators.html = new gHtml();\n defGenerators.css = new gCss();\n defGenerators.json = new gJson();\n defGenerators.js = new gJs();\n defViewers.CodeMirror = new eCM();\n this.loadDefaultGenerators().loadDefaultViewers();\n\n return this;\n },\n\n\n /**\n * Add new code generator to the collection\n * @param {string} id Code generator ID\n * @param {Object} generator Code generator wrapper\n * @param {Function} generator.build Function that builds the code\n * @return {this}\n * @example\n * codeManager.addGenerator('html7',{\n * build: function(model){\n * return 'myCode';\n * }\n * });\n * */\n addGenerator: function addGenerator(id, generator) {\n generators[id] = generator;\n return this;\n },\n\n\n /**\n * Get code generator by id\n * @param {string} id Code generator ID\n * @return {Object|null}\n * @example\n * var generator = codeManager.getGenerator('html7');\n * generator.build = function(model){\n * //extend\n * };\n * */\n getGenerator: function getGenerator(id) {\n return generators[id] || null;\n },\n\n\n /**\n * Returns all code generators\n * @return {Array<Object>}\n * */\n getGenerators: function getGenerators() {\n return generators;\n },\n\n\n /**\n * Add new code viewer\n * @param {string} id Code viewer ID\n * @param {Object} viewer Code viewer wrapper\n * @param {Function} viewer.init Set element on which viewer will be displayed\n * @param {Function} viewer.setContent Set content to the viewer\n * @return {this}\n * @example\n * codeManager.addViewer('ace',{\n * init: function(el){\n * var ace = require('ace-editor');\n * this.editor = ace.edit(el.id);\n * },\n * setContent: function(code){\n * this.editor.setValue(code);\n * }\n * });\n * */\n addViewer: function addViewer(id, viewer) {\n viewers[id] = viewer;\n return this;\n },\n\n\n /**\n * Get code viewer by id\n * @param {string} id Code viewer ID\n * @return {Object|null}\n * @example\n * var viewer = codeManager.getViewer('ace');\n * */\n getViewer: function getViewer(id) {\n return viewers[id] || null;\n },\n\n\n /**\n * Returns all code viewers\n * @return {Array<Object>}\n * */\n getViewers: function getViewers() {\n return viewers;\n },\n\n\n /**\n * Update code viewer content\n * @param {Object} viewer Viewer instance\n * @param {string} code Code string\n * @example\n * var AceViewer = codeManager.getViewer('ace');\n * // ...\n * var viewer = AceViewer.init(el);\n * // ...\n * codeManager.updateViewer(AceViewer, 'code');\n * */\n updateViewer: function updateViewer(viewer, code) {\n viewer.setContent(code);\n },\n\n\n /**\n * Get code from model\n * @param {Object} model Any kind of model that will be passed to the build method of generator\n * @param {string} genId Code generator id\n * @param {Object} [opt] Options\n * @return {string}\n * @example\n * var codeStr = codeManager.getCode(model, 'html');\n * */\n getCode: function getCode(model, genId) {\n var opt = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n opt.em = c.em;\n var generator = this.getGenerator(genId);\n return generator ? generator.build(model, opt) : '';\n },\n\n\n /**\n * Load default code generators\n * @return {this}\n * @private\n * */\n loadDefaultGenerators: function loadDefaultGenerators() {\n for (var id in defGenerators) {\n this.addGenerator(id, defGenerators[id]);\n }return this;\n },\n\n\n /**\n * Load default code viewers\n * @return {this}\n * @private\n * */\n loadDefaultViewers: function loadDefaultViewers() {\n for (var id in defViewers) {\n this.addViewer(id, defViewers[id]);\n }return this;\n }\n };\n};\n\n/***/ }),\n/* 96 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = {\n // Style prefix\n stylePrefix: 'cm-',\n\n inlineCss: false\n};\n\n/***/ }),\n/* 97 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar Backbone = __webpack_require__(0);\n\nmodule.exports = Backbone.Model.extend({\n build: function build(model) {\n var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n var models = model.get('components');\n\n if (opts.exportWrapper) {\n return opts.wrappesIsBody ? '<body>' + this.buildModels(models) + '</body>' : model.toHTML();\n }\n\n return this.buildModels(models);\n },\n buildModels: function buildModels(models) {\n var code = '';\n models.each(function (model) {\n code += model.toHTML();\n });\n return code;\n }\n});\n\n/***/ }),\n/* 98 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = __webpack_require__(0).Model.extend({\n initialize: function initialize() {\n this.compCls = [];\n this.ids = [];\n },\n\n\n /**\n * Get CSS from a component\n * @param {Model} model\n * @return {String}\n */\n buildFromModel: function buildFromModel(model) {\n var _this = this;\n\n var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n var code = '';\n var em = this.em;\n var avoidInline = em && em.getConfig('avoidInlineStyle');\n var style = model.styleToString();\n var classes = model.get('classes');\n var wrappesIsBody = opts.wrappesIsBody;\n var isWrapper = model.get('wrapper');\n this.ids.push('#' + model.getId());\n\n // Let's know what classes I've found\n classes.each(function (model) {\n return _this.compCls.push(model.getFullName());\n });\n\n if ((!avoidInline || isWrapper) && style) {\n var selector = '#' + model.getId();\n selector = wrappesIsBody && isWrapper ? 'body' : selector;\n code = selector + '{' + style + '}';\n }\n\n var components = model.components();\n components.each(function (model) {\n return code += _this.buildFromModel(model, opts);\n });\n return code;\n },\n build: function build(model) {\n var _this2 = this;\n\n var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n var cssc = opts.cssc;\n var em = opts.em || '';\n this.em = em;\n this.compCls = [];\n this.ids = [];\n var code = this.buildFromModel(model, opts);\n\n if (cssc) {\n (function () {\n var rules = cssc.getAll();\n var atRules = {};\n var dump = [];\n\n rules.each(function (rule) {\n var atRule = rule.getAtRule();\n\n if (atRule) {\n var mRules = atRules[atRule];\n if (mRules) {\n mRules.push(rule);\n } else {\n atRules[atRule] = [rule];\n }\n return;\n }\n\n code += _this2.buildFromRule(rule, dump);\n });\n\n // Get at-rules\n for (var atRule in atRules) {\n var rulesStr = '';\n var mRules = atRules[atRule];\n mRules.forEach(function (rule) {\n return rulesStr += _this2.buildFromRule(rule, dump);\n });\n\n if (rulesStr) {\n code += atRule + '{' + rulesStr + '}';\n }\n }\n\n em && em.getConfig('clearStyles') && rules.remove(dump);\n })();\n }\n\n return code;\n },\n\n\n /**\n * Get CSS from the rule model\n * @param {Model} rule\n * @return {string} CSS string\n */\n buildFromRule: function buildFromRule(rule, dump) {\n var _this3 = this;\n\n var result = '';\n var selectorStrNoAdd = rule.selectorsToString({ skipAdd: 1 });\n var selectorsAdd = rule.get('selectorsAdd');\n var singleAtRule = rule.get('singleAtRule');\n var found = void 0;\n\n // This will not render a rule if there is no its component\n rule.get('selectors').each(function (selector) {\n var name = selector.getFullName();\n if (_this3.compCls.indexOf(name) >= 0 || _this3.ids.indexOf(name) >= 0) {\n found = 1;\n }\n });\n\n if (selectorStrNoAdd && found || selectorsAdd || singleAtRule) {\n var block = rule.getDeclaration();\n block && (result += block);\n } else {\n dump.push(rule);\n }\n\n return result;\n }\n});\n\n/***/ }),\n/* 99 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(_) {\n\nvar Backbone = __webpack_require__(0);\n\nmodule.exports = Backbone.Model.extend({\n /** @inheritdoc */\n build: function build(model) {\n var json = model.toJSON();\n this.beforeEach(json);\n\n _.each(json, function (v, attr) {\n var obj = json[attr];\n if (obj instanceof Backbone.Model) {\n json[attr] = this.build(obj);\n } else if (obj instanceof Backbone.Collection) {\n var coll = obj;\n json[attr] = [];\n if (coll.length) {\n coll.each(function (el, index) {\n json[attr][index] = this.build(el);\n }, this);\n }\n }\n }, this);\n\n return json;\n },\n\n\n /**\n * Execute on each object\n * @param {Object} obj\n */\n beforeEach: function beforeEach(obj) {\n delete obj.status;\n }\n});\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))\n\n/***/ }),\n/* 100 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(_) {\n\nvar Backbone = __webpack_require__(0);\n\nmodule.exports = Backbone.Model.extend({\n mapModel: function mapModel(model) {\n var code = '';\n var script = model.get('script');\n var type = model.get('type');\n var comps = model.get('components');\n var id = model.getId();\n\n if (script) {\n // If the component has scripts we need to expose his ID\n var attr = model.get('attributes');\n attr = _.extend({}, attr, { id: id });\n model.set('attributes', attr);\n var scrStr = model.getScriptString();\n\n // If the script was updated, I'll put its code in a separate container\n if (model.get('scriptUpdated')) {\n this.mapJs[type + '-' + id] = { ids: [id], code: scrStr };\n } else {\n var mapType = this.mapJs[type];\n\n if (mapType) {\n mapType.ids.push(id);\n } else {\n this.mapJs[type] = { ids: [id], code: scrStr };\n }\n }\n }\n\n comps.each(function (model) {\n code += this.mapModel(model);\n }, this);\n\n return code;\n },\n build: function build(model) {\n this.mapJs = {};\n this.mapModel(model);\n\n var code = '';\n\n for (var type in this.mapJs) {\n var mapType = this.mapJs[type];\n var ids = '#' + mapType.ids.join(', #');\n code += '\\n var items = document.querySelectorAll(\\'' + ids + '\\');\\n for (var i = 0, len = items.length; i < len; i++) {\\n (function(){' + mapType.code + '}.bind(items[i]))();\\n }';\n }\n\n return code;\n }\n});\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))\n\n/***/ }),\n/* 101 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar Backbone = __webpack_require__(0);\nvar CodeMirror = __webpack_require__(6);\nvar htmlMode = __webpack_require__(102);\nvar cssMode = __webpack_require__(26);\nvar formatting = __webpack_require__(105);\n\nmodule.exports = Backbone.Model.extend({\n defaults: {\n input: '',\n label: '',\n codeName: '',\n theme: '',\n readOnly: true,\n lineNumbers: true\n },\n\n /** @inheritdoc */\n init: function init(el) {\n this.editor = CodeMirror.fromTextArea(el, _extends({\n dragDrop: false,\n lineWrapping: true,\n mode: this.get('codeName')\n }, this.attributes));\n\n return this;\n },\n\n\n /** @inheritdoc */\n setContent: function setContent(v) {\n if (!this.editor) return;\n this.editor.setValue(v);\n if (this.editor.autoFormatRange) {\n CodeMirror.commands.selectAll(this.editor);\n this.editor.autoFormatRange(this.editor.getCursor(true), this.editor.getCursor(false));\n CodeMirror.commands.goDocStart(this.editor);\n }\n }\n});\n\n/***/ }),\n/* 102 */\n/***/ (function(module, exports, __webpack_require__) {\n\n// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: http://codemirror.net/LICENSE\n\n(function(mod) {\n if (true) // CommonJS\n mod(__webpack_require__(6), __webpack_require__(103), __webpack_require__(104), __webpack_require__(26));\n else if (typeof define == \"function\" && define.amd) // AMD\n define([\"../../lib/codemirror\", \"../xml/xml\", \"../javascript/javascript\", \"../css/css\"], mod);\n else // Plain browser env\n mod(CodeMirror);\n})(function(CodeMirror) {\n \"use strict\";\n\n var defaultTags = {\n script: [\n [\"lang\", /(javascript|babel)/i, \"javascript\"],\n [\"type\", /^(?:text|application)\\/(?:x-)?(?:java|ecma)script$|^module$|^$/i, \"javascript\"],\n [\"type\", /./, \"text/plain\"],\n [null, null, \"javascript\"]\n ],\n style: [\n [\"lang\", /^css$/i, \"css\"],\n [\"type\", /^(text\\/)?(x-)?(stylesheet|css)$/i, \"css\"],\n [\"type\", /./, \"text/plain\"],\n [null, null, \"css\"]\n ]\n };\n\n function maybeBackup(stream, pat, style) {\n var cur = stream.current(), close = cur.search(pat);\n if (close > -1) {\n stream.backUp(cur.length - close);\n } else if (cur.match(/<\\/?$/)) {\n stream.backUp(cur.length);\n if (!stream.match(pat, false)) stream.match(cur);\n }\n return style;\n }\n\n var attrRegexpCache = {};\n function getAttrRegexp(attr) {\n var regexp = attrRegexpCache[attr];\n if (regexp) return regexp;\n return attrRegexpCache[attr] = new RegExp(\"\\\\s+\" + attr + \"\\\\s*=\\\\s*('|\\\")?([^'\\\"]+)('|\\\")?\\\\s*\");\n }\n\n function getAttrValue(text, attr) {\n var match = text.match(getAttrRegexp(attr))\n return match ? /^\\s*(.*?)\\s*$/.exec(match[2])[1] : \"\"\n }\n\n function getTagRegexp(tagName, anchored) {\n return new RegExp((anchored ? \"^\" : \"\") + \"<\\/\\s*\" + tagName + \"\\s*>\", \"i\");\n }\n\n function addTags(from, to) {\n for (var tag in from) {\n var dest = to[tag] || (to[tag] = []);\n var source = from[tag];\n for (var i = source.length - 1; i >= 0; i--)\n dest.unshift(source[i])\n }\n }\n\n function findMatchingMode(tagInfo, tagText) {\n for (var i = 0; i < tagInfo.length; i++) {\n var spec = tagInfo[i];\n if (!spec[0] || spec[1].test(getAttrValue(tagText, spec[0]))) return spec[2];\n }\n }\n\n CodeMirror.defineMode(\"htmlmixed\", function (config, parserConfig) {\n var htmlMode = CodeMirror.getMode(config, {\n name: \"xml\",\n htmlMode: true,\n multilineTagIndentFactor: parserConfig.multilineTagIndentFactor,\n multilineTagIndentPastTag: parserConfig.multilineTagIndentPastTag\n });\n\n var tags = {};\n var configTags = parserConfig && parserConfig.tags, configScript = parserConfig && parserConfig.scriptTypes;\n addTags(defaultTags, tags);\n if (configTags) addTags(configTags, tags);\n if (configScript) for (var i = configScript.length - 1; i >= 0; i--)\n tags.script.unshift([\"type\", configScript[i].matches, configScript[i].mode])\n\n function html(stream, state) {\n var style = htmlMode.token(stream, state.htmlState), tag = /\\btag\\b/.test(style), tagName\n if (tag && !/[<>\\s\\/]/.test(stream.current()) &&\n (tagName = state.htmlState.tagName && state.htmlState.tagName.toLowerCase()) &&\n tags.hasOwnProperty(tagName)) {\n state.inTag = tagName + \" \"\n } else if (state.inTag && tag && />$/.test(stream.current())) {\n var inTag = /^([\\S]+) (.*)/.exec(state.inTag)\n state.inTag = null\n var modeSpec = stream.current() == \">\" && findMatchingMode(tags[inTag[1]], inTag[2])\n var mode = CodeMirror.getMode(config, modeSpec)\n var endTagA = getTagRegexp(inTag[1], true), endTag = getTagRegexp(inTag[1], false);\n state.token = function (stream, state) {\n if (stream.match(endTagA, false)) {\n state.token = html;\n state.localState = state.localMode = null;\n return null;\n }\n return maybeBackup(stream, endTag, state.localMode.token(stream, state.localState));\n };\n state.localMode = mode;\n state.localState = CodeMirror.startState(mode, htmlMode.indent(state.htmlState, \"\"));\n } else if (state.inTag) {\n state.inTag += stream.current()\n if (stream.eol()) state.inTag += \" \"\n }\n return style;\n };\n\n return {\n startState: function () {\n var state = CodeMirror.startState(htmlMode);\n return {token: html, inTag: null, localMode: null, localState: null, htmlState: state};\n },\n\n copyState: function (state) {\n var local;\n if (state.localState) {\n local = CodeMirror.copyState(state.localMode, state.localState);\n }\n return {token: state.token, inTag: state.inTag,\n localMode: state.localMode, localState: local,\n htmlState: CodeMirror.copyState(htmlMode, state.htmlState)};\n },\n\n token: function (stream, state) {\n return state.token(stream, state);\n },\n\n indent: function (state, textAfter, line) {\n if (!state.localMode || /^\\s*<\\//.test(textAfter))\n return htmlMode.indent(state.htmlState, textAfter);\n else if (state.localMode.indent)\n return state.localMode.indent(state.localState, textAfter, line);\n else\n return CodeMirror.Pass;\n },\n\n innerMode: function (state) {\n return {state: state.localState || state.htmlState, mode: state.localMode || htmlMode};\n }\n };\n }, \"xml\", \"javascript\", \"css\");\n\n CodeMirror.defineMIME(\"text/html\", \"htmlmixed\");\n});\n\n\n/***/ }),\n/* 103 */\n/***/ (function(module, exports, __webpack_require__) {\n\n// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: http://codemirror.net/LICENSE\n\n(function(mod) {\n if (true) // CommonJS\n mod(__webpack_require__(6));\n else if (typeof define == \"function\" && define.amd) // AMD\n define([\"../../lib/codemirror\"], mod);\n else // Plain browser env\n mod(CodeMirror);\n})(function(CodeMirror) {\n\"use strict\";\n\nvar htmlConfig = {\n autoSelfClosers: {'area': true, 'base': true, 'br': true, 'col': true, 'command': true,\n 'embed': true, 'frame': true, 'hr': true, 'img': true, 'input': true,\n 'keygen': true, 'link': true, 'meta': true, 'param': true, 'source': true,\n 'track': true, 'wbr': true, 'menuitem': true},\n implicitlyClosed: {'dd': true, 'li': true, 'optgroup': true, 'option': true, 'p': true,\n 'rp': true, 'rt': true, 'tbody': true, 'td': true, 'tfoot': true,\n 'th': true, 'tr': true},\n contextGrabbers: {\n 'dd': {'dd': true, 'dt': true},\n 'dt': {'dd': true, 'dt': true},\n 'li': {'li': true},\n 'option': {'option': true, 'optgroup': true},\n 'optgroup': {'optgroup': true},\n 'p': {'address': true, 'article': true, 'aside': true, 'blockquote': true, 'dir': true,\n 'div': true, 'dl': true, 'fieldset': true, 'footer': true, 'form': true,\n 'h1': true, 'h2': true, 'h3': true, 'h4': true, 'h5': true, 'h6': true,\n 'header': true, 'hgroup': true, 'hr': true, 'menu': true, 'nav': true, 'ol': true,\n 'p': true, 'pre': true, 'section': true, 'table': true, 'ul': true},\n 'rp': {'rp': true, 'rt': true},\n 'rt': {'rp': true, 'rt': true},\n 'tbody': {'tbody': true, 'tfoot': true},\n 'td': {'td': true, 'th': true},\n 'tfoot': {'tbody': true},\n 'th': {'td': true, 'th': true},\n 'thead': {'tbody': true, 'tfoot': true},\n 'tr': {'tr': true}\n },\n doNotIndent: {\"pre\": true},\n allowUnquoted: true,\n allowMissing: true,\n caseFold: true\n}\n\nvar xmlConfig = {\n autoSelfClosers: {},\n implicitlyClosed: {},\n contextGrabbers: {},\n doNotIndent: {},\n allowUnquoted: false,\n allowMissing: false,\n caseFold: false\n}\n\nCodeMirror.defineMode(\"xml\", function(editorConf, config_) {\n var indentUnit = editorConf.indentUnit\n var config = {}\n var defaults = config_.htmlMode ? htmlConfig : xmlConfig\n for (var prop in defaults) config[prop] = defaults[prop]\n for (var prop in config_) config[prop] = config_[prop]\n\n // Return variables for tokenizers\n var type, setStyle;\n\n function inText(stream, state) {\n function chain(parser) {\n state.tokenize = parser;\n return parser(stream, state);\n }\n\n var ch = stream.next();\n if (ch == \"<\") {\n if (stream.eat(\"!\")) {\n if (stream.eat(\"[\")) {\n if (stream.match(\"CDATA[\")) return chain(inBlock(\"atom\", \"]]>\"));\n else return null;\n } else if (stream.match(\"--\")) {\n return chain(inBlock(\"comment\", \"-->\"));\n } else if (stream.match(\"DOCTYPE\", true, true)) {\n stream.eatWhile(/[\\w\\._\\-]/);\n return chain(doctype(1));\n } else {\n return null;\n }\n } else if (stream.eat(\"?\")) {\n stream.eatWhile(/[\\w\\._\\-]/);\n state.tokenize = inBlock(\"meta\", \"?>\");\n return \"meta\";\n } else {\n type = stream.eat(\"/\") ? \"closeTag\" : \"openTag\";\n state.tokenize = inTag;\n return \"tag bracket\";\n }\n } else if (ch == \"&\") {\n var ok;\n if (stream.eat(\"#\")) {\n if (stream.eat(\"x\")) {\n ok = stream.eatWhile(/[a-fA-F\\d]/) && stream.eat(\";\");\n } else {\n ok = stream.eatWhile(/[\\d]/) && stream.eat(\";\");\n }\n } else {\n ok = stream.eatWhile(/[\\w\\.\\-:]/) && stream.eat(\";\");\n }\n return ok ? \"atom\" : \"error\";\n } else {\n stream.eatWhile(/[^&<]/);\n return null;\n }\n }\n inText.isInText = true;\n\n function inTag(stream, state) {\n var ch = stream.next();\n if (ch == \">\" || (ch == \"/\" && stream.eat(\">\"))) {\n state.tokenize = inText;\n type = ch == \">\" ? \"endTag\" : \"selfcloseTag\";\n return \"tag bracket\";\n } else if (ch == \"=\") {\n type = \"equals\";\n return null;\n } else if (ch == \"<\") {\n state.tokenize = inText;\n state.state = baseState;\n state.tagName = state.tagStart = null;\n var next = state.tokenize(stream, state);\n return next ? next + \" tag error\" : \"tag error\";\n } else if (/[\\'\\\"]/.test(ch)) {\n state.tokenize = inAttribute(ch);\n state.stringStartCol = stream.column();\n return state.tokenize(stream, state);\n } else {\n stream.match(/^[^\\s\\u00a0=<>\\\"\\']*[^\\s\\u00a0=<>\\\"\\'\\/]/);\n return \"word\";\n }\n }\n\n function inAttribute(quote) {\n var closure = function(stream, state) {\n while (!stream.eol()) {\n if (stream.next() == quote) {\n state.tokenize = inTag;\n break;\n }\n }\n return \"string\";\n };\n closure.isInAttribute = true;\n return closure;\n }\n\n function inBlock(style, terminator) {\n return function(stream, state) {\n while (!stream.eol()) {\n if (stream.match(terminator)) {\n state.tokenize = inText;\n break;\n }\n stream.next();\n }\n return style;\n };\n }\n function doctype(depth) {\n return function(stream, state) {\n var ch;\n while ((ch = stream.next()) != null) {\n if (ch == \"<\") {\n state.tokenize = doctype(depth + 1);\n return state.tokenize(stream, state);\n } else if (ch == \">\") {\n if (depth == 1) {\n state.tokenize = inText;\n break;\n } else {\n state.tokenize = doctype(depth - 1);\n return state.tokenize(stream, state);\n }\n }\n }\n return \"meta\";\n };\n }\n\n function Context(state, tagName, startOfLine) {\n this.prev = state.context;\n this.tagName = tagName;\n this.indent = state.indented;\n this.startOfLine = startOfLine;\n if (config.doNotIndent.hasOwnProperty(tagName) || (state.context && state.context.noIndent))\n this.noIndent = true;\n }\n function popContext(state) {\n if (state.context) state.context = state.context.prev;\n }\n function maybePopContext(state, nextTagName) {\n var parentTagName;\n while (true) {\n if (!state.context) {\n return;\n }\n parentTagName = state.context.tagName;\n if (!config.contextGrabbers.hasOwnProperty(parentTagName) ||\n !config.contextGrabbers[parentTagName].hasOwnProperty(nextTagName)) {\n return;\n }\n popContext(state);\n }\n }\n\n function baseState(type, stream, state) {\n if (type == \"openTag\") {\n state.tagStart = stream.column();\n return tagNameState;\n } else if (type == \"closeTag\") {\n return closeTagNameState;\n } else {\n return baseState;\n }\n }\n function tagNameState(type, stream, state) {\n if (type == \"word\") {\n state.tagName = stream.current();\n setStyle = \"tag\";\n return attrState;\n } else {\n setStyle = \"error\";\n return tagNameState;\n }\n }\n function closeTagNameState(type, stream, state) {\n if (type == \"word\") {\n var tagName = stream.current();\n if (state.context && state.context.tagName != tagName &&\n config.implicitlyClosed.hasOwnProperty(state.context.tagName))\n popContext(state);\n if ((state.context && state.context.tagName == tagName) || config.matchClosing === false) {\n setStyle = \"tag\";\n return closeState;\n } else {\n setStyle = \"tag error\";\n return closeStateErr;\n }\n } else {\n setStyle = \"error\";\n return closeStateErr;\n }\n }\n\n function closeState(type, _stream, state) {\n if (type != \"endTag\") {\n setStyle = \"error\";\n return closeState;\n }\n popContext(state);\n return baseState;\n }\n function closeStateErr(type, stream, state) {\n setStyle = \"error\";\n return closeState(type, stream, state);\n }\n\n function attrState(type, _stream, state) {\n if (type == \"word\") {\n setStyle = \"attribute\";\n return attrEqState;\n } else if (type == \"endTag\" || type == \"selfcloseTag\") {\n var tagName = state.tagName, tagStart = state.tagStart;\n state.tagName = state.tagStart = null;\n if (type == \"selfcloseTag\" ||\n config.autoSelfClosers.hasOwnProperty(tagName)) {\n maybePopContext(state, tagName);\n } else {\n maybePopContext(state, tagName);\n state.context = new Context(state, tagName, tagStart == state.indented);\n }\n return baseState;\n }\n setStyle = \"error\";\n return attrState;\n }\n function attrEqState(type, stream, state) {\n if (type == \"equals\") return attrValueState;\n if (!config.allowMissing) setStyle = \"error\";\n return attrState(type, stream, state);\n }\n function attrValueState(type, stream, state) {\n if (type == \"string\") return attrContinuedState;\n if (type == \"word\" && config.allowUnquoted) {setStyle = \"string\"; return attrState;}\n setStyle = \"error\";\n return attrState(type, stream, state);\n }\n function attrContinuedState(type, stream, state) {\n if (type == \"string\") return attrContinuedState;\n return attrState(type, stream, state);\n }\n\n return {\n startState: function(baseIndent) {\n var state = {tokenize: inText,\n state: baseState,\n indented: baseIndent || 0,\n tagName: null, tagStart: null,\n context: null}\n if (baseIndent != null) state.baseIndent = baseIndent\n return state\n },\n\n token: function(stream, state) {\n if (!state.tagName && stream.sol())\n state.indented = stream.indentation();\n\n if (stream.eatSpace()) return null;\n type = null;\n var style = state.tokenize(stream, state);\n if ((style || type) && style != \"comment\") {\n setStyle = null;\n state.state = state.state(type || style, stream, state);\n if (setStyle)\n style = setStyle == \"error\" ? style + \" error\" : setStyle;\n }\n return style;\n },\n\n indent: function(state, textAfter, fullLine) {\n var context = state.context;\n // Indent multi-line strings (e.g. css).\n if (state.tokenize.isInAttribute) {\n if (state.tagStart == state.indented)\n return state.stringStartCol + 1;\n else\n return state.indented + indentUnit;\n }\n if (context && context.noIndent) return CodeMirror.Pass;\n if (state.tokenize != inTag && state.tokenize != inText)\n return fullLine ? fullLine.match(/^(\\s*)/)[0].length : 0;\n // Indent the starts of attribute names.\n if (state.tagName) {\n if (config.multilineTagIndentPastTag !== false)\n return state.tagStart + state.tagName.length + 2;\n else\n return state.tagStart + indentUnit * (config.multilineTagIndentFactor || 1);\n }\n if (config.alignCDATA && /<!\\[CDATA\\[/.test(textAfter)) return 0;\n var tagAfter = textAfter && /^<(\\/)?([\\w_:\\.-]*)/.exec(textAfter);\n if (tagAfter && tagAfter[1]) { // Closing tag spotted\n while (context) {\n if (context.tagName == tagAfter[2]) {\n context = context.prev;\n break;\n } else if (config.implicitlyClosed.hasOwnProperty(context.tagName)) {\n context = context.prev;\n } else {\n break;\n }\n }\n } else if (tagAfter) { // Opening tag spotted\n while (context) {\n var grabbers = config.contextGrabbers[context.tagName];\n if (grabbers && grabbers.hasOwnProperty(tagAfter[2]))\n context = context.prev;\n else\n break;\n }\n }\n while (context && context.prev && !context.startOfLine)\n context = context.prev;\n if (context) return context.indent + indentUnit;\n else return state.baseIndent || 0;\n },\n\n electricInput: /<\\/[\\s\\w:]+>$/,\n blockCommentStart: \"<!--\",\n blockCommentEnd: \"-->\",\n\n configuration: config.htmlMode ? \"html\" : \"xml\",\n helperType: config.htmlMode ? \"html\" : \"xml\",\n\n skipAttribute: function(state) {\n if (state.state == attrValueState)\n state.state = attrState\n }\n };\n});\n\nCodeMirror.defineMIME(\"text/xml\", \"xml\");\nCodeMirror.defineMIME(\"application/xml\", \"xml\");\nif (!CodeMirror.mimeModes.hasOwnProperty(\"text/html\"))\n CodeMirror.defineMIME(\"text/html\", {name: \"xml\", htmlMode: true});\n\n});\n\n\n/***/ }),\n/* 104 */\n/***/ (function(module, exports, __webpack_require__) {\n\n// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: http://codemirror.net/LICENSE\n\n(function(mod) {\n if (true) // CommonJS\n mod(__webpack_require__(6));\n else if (typeof define == \"function\" && define.amd) // AMD\n define([\"../../lib/codemirror\"], mod);\n else // Plain browser env\n mod(CodeMirror);\n})(function(CodeMirror) {\n\"use strict\";\n\nCodeMirror.defineMode(\"javascript\", function(config, parserConfig) {\n var indentUnit = config.indentUnit;\n var statementIndent = parserConfig.statementIndent;\n var jsonldMode = parserConfig.jsonld;\n var jsonMode = parserConfig.json || jsonldMode;\n var isTS = parserConfig.typescript;\n var wordRE = parserConfig.wordCharacters || /[\\w$\\xa1-\\uffff]/;\n\n // Tokenizer\n\n var keywords = function(){\n function kw(type) {return {type: type, style: \"keyword\"};}\n var A = kw(\"keyword a\"), B = kw(\"keyword b\"), C = kw(\"keyword c\"), D = kw(\"keyword d\");\n var operator = kw(\"operator\"), atom = {type: \"atom\", style: \"atom\"};\n\n var jsKeywords = {\n \"if\": kw(\"if\"), \"while\": A, \"with\": A, \"else\": B, \"do\": B, \"try\": B, \"finally\": B,\n \"return\": D, \"break\": D, \"continue\": D, \"new\": kw(\"new\"), \"delete\": C, \"void\": C, \"throw\": C,\n \"debugger\": kw(\"debugger\"), \"var\": kw(\"var\"), \"const\": kw(\"var\"), \"let\": kw(\"var\"),\n \"function\": kw(\"function\"), \"catch\": kw(\"catch\"),\n \"for\": kw(\"for\"), \"switch\": kw(\"switch\"), \"case\": kw(\"case\"), \"default\": kw(\"default\"),\n \"in\": operator, \"typeof\": operator, \"instanceof\": operator,\n \"true\": atom, \"false\": atom, \"null\": atom, \"undefined\": atom, \"NaN\": atom, \"Infinity\": atom,\n \"this\": kw(\"this\"), \"class\": kw(\"class\"), \"super\": kw(\"atom\"),\n \"yield\": C, \"export\": kw(\"export\"), \"import\": kw(\"import\"), \"extends\": C,\n \"await\": C\n };\n\n // Extend the 'normal' keywords with the TypeScript language extensions\n if (isTS) {\n var type = {type: \"variable\", style: \"type\"};\n var tsKeywords = {\n // object-like things\n \"interface\": kw(\"class\"),\n \"implements\": C,\n \"namespace\": C,\n \"module\": kw(\"module\"),\n \"enum\": kw(\"module\"),\n\n // scope modifiers\n \"public\": kw(\"modifier\"),\n \"private\": kw(\"modifier\"),\n \"protected\": kw(\"modifier\"),\n \"abstract\": kw(\"modifier\"),\n \"readonly\": kw(\"modifier\"),\n\n // types\n \"string\": type, \"number\": type, \"boolean\": type, \"any\": type\n };\n\n for (var attr in tsKeywords) {\n jsKeywords[attr] = tsKeywords[attr];\n }\n }\n\n return jsKeywords;\n }();\n\n var isOperatorChar = /[+\\-*&%=<>!?|~^@]/;\n var isJsonldKeyword = /^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)\"/;\n\n function readRegexp(stream) {\n var escaped = false, next, inSet = false;\n while ((next = stream.next()) != null) {\n if (!escaped) {\n if (next == \"/\" && !inSet) return;\n if (next == \"[\") inSet = true;\n else if (inSet && next == \"]\") inSet = false;\n }\n escaped = !escaped && next == \"\\\\\";\n }\n }\n\n // Used as scratch variables to communicate multiple values without\n // consing up tons of objects.\n var type, content;\n function ret(tp, style, cont) {\n type = tp; content = cont;\n return style;\n }\n function tokenBase(stream, state) {\n var ch = stream.next();\n if (ch == '\"' || ch == \"'\") {\n state.tokenize = tokenString(ch);\n return state.tokenize(stream, state);\n } else if (ch == \".\" && stream.match(/^\\d+(?:[eE][+\\-]?\\d+)?/)) {\n return ret(\"number\", \"number\");\n } else if (ch == \".\" && stream.match(\"..\")) {\n return ret(\"spread\", \"meta\");\n } else if (/[\\[\\]{}\\(\\),;\\:\\.]/.test(ch)) {\n return ret(ch);\n } else if (ch == \"=\" && stream.eat(\">\")) {\n return ret(\"=>\", \"operator\");\n } else if (ch == \"0\" && stream.eat(/x/i)) {\n stream.eatWhile(/[\\da-f]/i);\n return ret(\"number\", \"number\");\n } else if (ch == \"0\" && stream.eat(/o/i)) {\n stream.eatWhile(/[0-7]/i);\n return ret(\"number\", \"number\");\n } else if (ch == \"0\" && stream.eat(/b/i)) {\n stream.eatWhile(/[01]/i);\n return ret(\"number\", \"number\");\n } else if (/\\d/.test(ch)) {\n stream.match(/^\\d*(?:\\.\\d*)?(?:[eE][+\\-]?\\d+)?/);\n return ret(\"number\", \"number\");\n } else if (ch == \"/\") {\n if (stream.eat(\"*\")) {\n state.tokenize = tokenComment;\n return tokenComment(stream, state);\n } else if (stream.eat(\"/\")) {\n stream.skipToEnd();\n return ret(\"comment\", \"comment\");\n } else if (expressionAllowed(stream, state, 1)) {\n readRegexp(stream);\n stream.match(/^\\b(([gimyu])(?![gimyu]*\\2))+\\b/);\n return ret(\"regexp\", \"string-2\");\n } else {\n stream.eat(\"=\");\n return ret(\"operator\", \"operator\", stream.current());\n }\n } else if (ch == \"`\") {\n state.tokenize = tokenQuasi;\n return tokenQuasi(stream, state);\n } else if (ch == \"#\") {\n stream.skipToEnd();\n return ret(\"error\", \"error\");\n } else if (isOperatorChar.test(ch)) {\n if (ch != \">\" || !state.lexical || state.lexical.type != \">\") {\n if (stream.eat(\"=\")) {\n if (ch == \"!\" || ch == \"=\") stream.eat(\"=\")\n } else if (/[<>*+\\-]/.test(ch)) {\n stream.eat(ch)\n if (ch == \">\") stream.eat(ch)\n }\n }\n return ret(\"operator\", \"operator\", stream.current());\n } else if (wordRE.test(ch)) {\n stream.eatWhile(wordRE);\n var word = stream.current()\n if (state.lastType != \".\") {\n if (keywords.propertyIsEnumerable(word)) {\n var kw = keywords[word]\n return ret(kw.type, kw.style, word)\n }\n if (word == \"async\" && stream.match(/^\\s*[\\(\\w]/, false))\n return ret(\"async\", \"keyword\", word)\n }\n return ret(\"variable\", \"variable\", word)\n }\n }\n\n function tokenString(quote) {\n return function(stream, state) {\n var escaped = false, next;\n if (jsonldMode && stream.peek() == \"@\" && stream.match(isJsonldKeyword)){\n state.tokenize = tokenBase;\n return ret(\"jsonld-keyword\", \"meta\");\n }\n while ((next = stream.next()) != null) {\n if (next == quote && !escaped) break;\n escaped = !escaped && next == \"\\\\\";\n }\n if (!escaped) state.tokenize = tokenBase;\n return ret(\"string\", \"string\");\n };\n }\n\n function tokenComment(stream, state) {\n var maybeEnd = false, ch;\n while (ch = stream.next()) {\n if (ch == \"/\" && maybeEnd) {\n state.tokenize = tokenBase;\n break;\n }\n maybeEnd = (ch == \"*\");\n }\n return ret(\"comment\", \"comment\");\n }\n\n function tokenQuasi(stream, state) {\n var escaped = false, next;\n while ((next = stream.next()) != null) {\n if (!escaped && (next == \"`\" || next == \"$\" && stream.eat(\"{\"))) {\n state.tokenize = tokenBase;\n break;\n }\n escaped = !escaped && next == \"\\\\\";\n }\n return ret(\"quasi\", \"string-2\", stream.current());\n }\n\n var brackets = \"([{}])\";\n // This is a crude lookahead trick to try and notice that we're\n // parsing the argument patterns for a fat-arrow function before we\n // actually hit the arrow token. It only works if the arrow is on\n // the same line as the arguments and there's no strange noise\n // (comments) in between. Fallback is to only notice when we hit the\n // arrow, and not declare the arguments as locals for the arrow\n // body.\n function findFatArrow(stream, state) {\n if (state.fatArrowAt) state.fatArrowAt = null;\n var arrow = stream.string.indexOf(\"=>\", stream.start);\n if (arrow < 0) return;\n\n if (isTS) { // Try to skip TypeScript return type declarations after the arguments\n var m = /:\\s*(?:\\w+(?:<[^>]*>|\\[\\])?|\\{[^}]*\\})\\s*$/.exec(stream.string.slice(stream.start, arrow))\n if (m) arrow = m.index\n }\n\n var depth = 0, sawSomething = false;\n for (var pos = arrow - 1; pos >= 0; --pos) {\n var ch = stream.string.charAt(pos);\n var bracket = brackets.indexOf(ch);\n if (bracket >= 0 && bracket < 3) {\n if (!depth) { ++pos; break; }\n if (--depth == 0) { if (ch == \"(\") sawSomething = true; break; }\n } else if (bracket >= 3 && bracket < 6) {\n ++depth;\n } else if (wordRE.test(ch)) {\n sawSomething = true;\n } else if (/[\"'\\/]/.test(ch)) {\n return;\n } else if (sawSomething && !depth) {\n ++pos;\n break;\n }\n }\n if (sawSomething && !depth) state.fatArrowAt = pos;\n }\n\n // Parser\n\n var atomicTypes = {\"atom\": true, \"number\": true, \"variable\": true, \"string\": true, \"regexp\": true, \"this\": true, \"jsonld-keyword\": true};\n\n function JSLexical(indented, column, type, align, prev, info) {\n this.indented = indented;\n this.column = column;\n this.type = type;\n this.prev = prev;\n this.info = info;\n if (align != null) this.align = align;\n }\n\n function inScope(state, varname) {\n for (var v = state.localVars; v; v = v.next)\n if (v.name == varname) return true;\n for (var cx = state.context; cx; cx = cx.prev) {\n for (var v = cx.vars; v; v = v.next)\n if (v.name == varname) return true;\n }\n }\n\n function parseJS(state, style, type, content, stream) {\n var cc = state.cc;\n // Communicate our context to the combinators.\n // (Less wasteful than consing up a hundred closures on every call.)\n cx.state = state; cx.stream = stream; cx.marked = null, cx.cc = cc; cx.style = style;\n\n if (!state.lexical.hasOwnProperty(\"align\"))\n state.lexical.align = true;\n\n while(true) {\n var combinator = cc.length ? cc.pop() : jsonMode ? expression : statement;\n if (combinator(type, content)) {\n while(cc.length && cc[cc.length - 1].lex)\n cc.pop()();\n if (cx.marked) return cx.marked;\n if (type == \"variable\" && inScope(state, content)) return \"variable-2\";\n return style;\n }\n }\n }\n\n // Combinator utils\n\n var cx = {state: null, column: null, marked: null, cc: null};\n function pass() {\n for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]);\n }\n function cont() {\n pass.apply(null, arguments);\n return true;\n }\n function register(varname) {\n function inList(list) {\n for (var v = list; v; v = v.next)\n if (v.name == varname) return true;\n return false;\n }\n var state = cx.state;\n cx.marked = \"def\";\n if (state.context) {\n if (inList(state.localVars)) return;\n state.localVars = {name: varname, next: state.localVars};\n } else {\n if (inList(state.globalVars)) return;\n if (parserConfig.globalVars)\n state.globalVars = {name: varname, next: state.globalVars};\n }\n }\n\n // Combinators\n\n var defaultVars = {name: \"this\", next: {name: \"arguments\"}};\n function pushcontext() {\n cx.state.context = {prev: cx.state.context, vars: cx.state.localVars};\n cx.state.localVars = defaultVars;\n }\n function popcontext() {\n cx.state.localVars = cx.state.context.vars;\n cx.state.context = cx.state.context.prev;\n }\n function pushlex(type, info) {\n var result = function() {\n var state = cx.state, indent = state.indented;\n if (state.lexical.type == \"stat\") indent = state.lexical.indented;\n else for (var outer = state.lexical; outer && outer.type == \")\" && outer.align; outer = outer.prev)\n indent = outer.indented;\n state.lexical = new JSLexical(indent, cx.stream.column(), type, null, state.lexical, info);\n };\n result.lex = true;\n return result;\n }\n function poplex() {\n var state = cx.state;\n if (state.lexical.prev) {\n if (state.lexical.type == \")\")\n state.indented = state.lexical.indented;\n state.lexical = state.lexical.prev;\n }\n }\n poplex.lex = true;\n\n function expect(wanted) {\n function exp(type) {\n if (type == wanted) return cont();\n else if (wanted == \";\") return pass();\n else return cont(exp);\n };\n return exp;\n }\n\n function statement(type, value) {\n if (type == \"var\") return cont(pushlex(\"vardef\", value.length), vardef, expect(\";\"), poplex);\n if (type == \"keyword a\") return cont(pushlex(\"form\"), parenExpr, statement, poplex);\n if (type == \"keyword b\") return cont(pushlex(\"form\"), statement, poplex);\n if (type == \"keyword d\") return cx.stream.match(/^\\s*$/, false) ? cont() : cont(pushlex(\"stat\"), maybeexpression, expect(\";\"), poplex);\n if (type == \"debugger\") return cont(expect(\";\"));\n if (type == \"{\") return cont(pushlex(\"}\"), block, poplex);\n if (type == \";\") return cont();\n if (type == \"if\") {\n if (cx.state.lexical.info == \"else\" && cx.state.cc[cx.state.cc.length - 1] == poplex)\n cx.state.cc.pop()();\n return cont(pushlex(\"form\"), parenExpr, statement, poplex, maybeelse);\n }\n if (type == \"function\") return cont(functiondef);\n if (type == \"for\") return cont(pushlex(\"form\"), forspec, statement, poplex);\n if (type == \"variable\") {\n if (isTS && value == \"type\") {\n cx.marked = \"keyword\"\n return cont(typeexpr, expect(\"operator\"), typeexpr, expect(\";\"));\n } if (isTS && value == \"declare\") {\n cx.marked = \"keyword\"\n return cont(statement)\n } else {\n return cont(pushlex(\"stat\"), maybelabel);\n }\n }\n if (type == \"switch\") return cont(pushlex(\"form\"), parenExpr, expect(\"{\"), pushlex(\"}\", \"switch\"),\n block, poplex, poplex);\n if (type == \"case\") return cont(expression, expect(\":\"));\n if (type == \"default\") return cont(expect(\":\"));\n if (type == \"catch\") return cont(pushlex(\"form\"), pushcontext, expect(\"(\"), funarg, expect(\")\"),\n statement, poplex, popcontext);\n if (type == \"class\") return cont(pushlex(\"form\"), className, poplex);\n if (type == \"export\") return cont(pushlex(\"stat\"), afterExport, poplex);\n if (type == \"import\") return cont(pushlex(\"stat\"), afterImport, poplex);\n if (type == \"module\") return cont(pushlex(\"form\"), pattern, expect(\"{\"), pushlex(\"}\"), block, poplex, poplex)\n if (type == \"async\") return cont(statement)\n if (value == \"@\") return cont(expression, statement)\n return pass(pushlex(\"stat\"), expression, expect(\";\"), poplex);\n }\n function expression(type) {\n return expressionInner(type, false);\n }\n function expressionNoComma(type) {\n return expressionInner(type, true);\n }\n function parenExpr(type) {\n if (type != \"(\") return pass()\n return cont(pushlex(\")\"), expression, expect(\")\"), poplex)\n }\n function expressionInner(type, noComma) {\n if (cx.state.fatArrowAt == cx.stream.start) {\n var body = noComma ? arrowBodyNoComma : arrowBody;\n if (type == \"(\") return cont(pushcontext, pushlex(\")\"), commasep(funarg, \")\"), poplex, expect(\"=>\"), body, popcontext);\n else if (type == \"variable\") return pass(pushcontext, pattern, expect(\"=>\"), body, popcontext);\n }\n\n var maybeop = noComma ? maybeoperatorNoComma : maybeoperatorComma;\n if (atomicTypes.hasOwnProperty(type)) return cont(maybeop);\n if (type == \"function\") return cont(functiondef, maybeop);\n if (type == \"class\") return cont(pushlex(\"form\"), classExpression, poplex);\n if (type == \"keyword c\" || type == \"async\") return cont(noComma ? expressionNoComma : expression);\n if (type == \"(\") return cont(pushlex(\")\"), maybeexpression, expect(\")\"), poplex, maybeop);\n if (type == \"operator\" || type == \"spread\") return cont(noComma ? expressionNoComma : expression);\n if (type == \"[\") return cont(pushlex(\"]\"), arrayLiteral, poplex, maybeop);\n if (type == \"{\") return contCommasep(objprop, \"}\", null, maybeop);\n if (type == \"quasi\") return pass(quasi, maybeop);\n if (type == \"new\") return cont(maybeTarget(noComma));\n return cont();\n }\n function maybeexpression(type) {\n if (type.match(/[;\\}\\)\\],]/)) return pass();\n return pass(expression);\n }\n\n function maybeoperatorComma(type, value) {\n if (type == \",\") return cont(expression);\n return maybeoperatorNoComma(type, value, false);\n }\n function maybeoperatorNoComma(type, value, noComma) {\n var me = noComma == false ? maybeoperatorComma : maybeoperatorNoComma;\n var expr = noComma == false ? expression : expressionNoComma;\n if (type == \"=>\") return cont(pushcontext, noComma ? arrowBodyNoComma : arrowBody, popcontext);\n if (type == \"operator\") {\n if (/\\+\\+|--/.test(value) || isTS && value == \"!\") return cont(me);\n if (value == \"?\") return cont(expression, expect(\":\"), expr);\n return cont(expr);\n }\n if (type == \"quasi\") { return pass(quasi, me); }\n if (type == \";\") return;\n if (type == \"(\") return contCommasep(expressionNoComma, \")\", \"call\", me);\n if (type == \".\") return cont(property, me);\n if (type == \"[\") return cont(pushlex(\"]\"), maybeexpression, expect(\"]\"), poplex, me);\n if (isTS && value == \"as\") { cx.marked = \"keyword\"; return cont(typeexpr, me) }\n if (type == \"regexp\") {\n cx.state.lastType = cx.marked = \"operator\"\n cx.stream.backUp(cx.stream.pos - cx.stream.start - 1)\n return cont(expr)\n }\n }\n function quasi(type, value) {\n if (type != \"quasi\") return pass();\n if (value.slice(value.length - 2) != \"${\") return cont(quasi);\n return cont(expression, continueQuasi);\n }\n function continueQuasi(type) {\n if (type == \"}\") {\n cx.marked = \"string-2\";\n cx.state.tokenize = tokenQuasi;\n return cont(quasi);\n }\n }\n function arrowBody(type) {\n findFatArrow(cx.stream, cx.state);\n return pass(type == \"{\" ? statement : expression);\n }\n function arrowBodyNoComma(type) {\n findFatArrow(cx.stream, cx.state);\n return pass(type == \"{\" ? statement : expressionNoComma);\n }\n function maybeTarget(noComma) {\n return function(type) {\n if (type == \".\") return cont(noComma ? targetNoComma : target);\n else if (type == \"variable\" && isTS) return cont(maybeTypeArgs, noComma ? maybeoperatorNoComma : maybeoperatorComma)\n else return pass(noComma ? expressionNoComma : expression);\n };\n }\n function target(_, value) {\n if (value == \"target\") { cx.marked = \"keyword\"; return cont(maybeoperatorComma); }\n }\n function targetNoComma(_, value) {\n if (value == \"target\") { cx.marked = \"keyword\"; return cont(maybeoperatorNoComma); }\n }\n function maybelabel(type) {\n if (type == \":\") return cont(poplex, statement);\n return pass(maybeoperatorComma, expect(\";\"), poplex);\n }\n function property(type) {\n if (type == \"variable\") {cx.marked = \"property\"; return cont();}\n }\n function objprop(type, value) {\n if (type == \"async\") {\n cx.marked = \"property\";\n return cont(objprop);\n } else if (type == \"variable\" || cx.style == \"keyword\") {\n cx.marked = \"property\";\n if (value == \"get\" || value == \"set\") return cont(getterSetter);\n var m // Work around fat-arrow-detection complication for detecting typescript typed arrow params\n if (isTS && cx.state.fatArrowAt == cx.stream.start && (m = cx.stream.match(/^\\s*:\\s*/, false)))\n cx.state.fatArrowAt = cx.stream.pos + m[0].length\n return cont(afterprop);\n } else if (type == \"number\" || type == \"string\") {\n cx.marked = jsonldMode ? \"property\" : (cx.style + \" property\");\n return cont(afterprop);\n } else if (type == \"jsonld-keyword\") {\n return cont(afterprop);\n } else if (type == \"modifier\") {\n return cont(objprop)\n } else if (type == \"[\") {\n return cont(expression, expect(\"]\"), afterprop);\n } else if (type == \"spread\") {\n return cont(expressionNoComma, afterprop);\n } else if (value == \"*\") {\n cx.marked = \"keyword\";\n return cont(objprop);\n } else if (type == \":\") {\n return pass(afterprop)\n }\n }\n function getterSetter(type) {\n if (type != \"variable\") return pass(afterprop);\n cx.marked = \"property\";\n return cont(functiondef);\n }\n function afterprop(type) {\n if (type == \":\") return cont(expressionNoComma);\n if (type == \"(\") return pass(functiondef);\n }\n function commasep(what, end, sep) {\n function proceed(type, value) {\n if (sep ? sep.indexOf(type) > -1 : type == \",\") {\n var lex = cx.state.lexical;\n if (lex.info == \"call\") lex.pos = (lex.pos || 0) + 1;\n return cont(function(type, value) {\n if (type == end || value == end) return pass()\n return pass(what)\n }, proceed);\n }\n if (type == end || value == end) return cont();\n return cont(expect(end));\n }\n return function(type, value) {\n if (type == end || value == end) return cont();\n return pass(what, proceed);\n };\n }\n function contCommasep(what, end, info) {\n for (var i = 3; i < arguments.length; i++)\n cx.cc.push(arguments[i]);\n return cont(pushlex(end, info), commasep(what, end), poplex);\n }\n function block(type) {\n if (type == \"}\") return cont();\n return pass(statement, block);\n }\n function maybetype(type, value) {\n if (isTS) {\n if (type == \":\") return cont(typeexpr);\n if (value == \"?\") return cont(maybetype);\n }\n }\n function typeexpr(type, value) {\n if (type == \"variable\" || value == \"void\") {\n if (value == \"keyof\") {\n cx.marked = \"keyword\"\n return cont(typeexpr)\n } else {\n cx.marked = \"type\"\n return cont(afterType)\n }\n }\n if (type == \"string\" || type == \"number\" || type == \"atom\") return cont(afterType);\n if (type == \"[\") return cont(pushlex(\"]\"), commasep(typeexpr, \"]\", \",\"), poplex, afterType)\n if (type == \"{\") return cont(pushlex(\"}\"), commasep(typeprop, \"}\", \",;\"), poplex, afterType)\n if (type == \"(\") return cont(commasep(typearg, \")\"), maybeReturnType)\n }\n function maybeReturnType(type) {\n if (type == \"=>\") return cont(typeexpr)\n }\n function typeprop(type, value) {\n if (type == \"variable\" || cx.style == \"keyword\") {\n cx.marked = \"property\"\n return cont(typeprop)\n } else if (value == \"?\") {\n return cont(typeprop)\n } else if (type == \":\") {\n return cont(typeexpr)\n } else if (type == \"[\") {\n return cont(expression, maybetype, expect(\"]\"), typeprop)\n }\n }\n function typearg(type) {\n if (type == \"variable\") return cont(typearg)\n else if (type == \":\") return cont(typeexpr)\n }\n function afterType(type, value) {\n if (value == \"<\") return cont(pushlex(\">\"), commasep(typeexpr, \">\"), poplex, afterType)\n if (value == \"|\" || type == \".\") return cont(typeexpr)\n if (type == \"[\") return cont(expect(\"]\"), afterType)\n if (value == \"extends\") return cont(typeexpr)\n }\n function maybeTypeArgs(_, value) {\n if (value == \"<\") return cont(pushlex(\">\"), commasep(typeexpr, \">\"), poplex, afterType)\n }\n function vardef() {\n return pass(pattern, maybetype, maybeAssign, vardefCont);\n }\n function pattern(type, value) {\n if (type == \"modifier\") return cont(pattern)\n if (type == \"variable\") { register(value); return cont(); }\n if (type == \"spread\") return cont(pattern);\n if (type == \"[\") return contCommasep(pattern, \"]\");\n if (type == \"{\") return contCommasep(proppattern, \"}\");\n }\n function proppattern(type, value) {\n if (type == \"variable\" && !cx.stream.match(/^\\s*:/, false)) {\n register(value);\n return cont(maybeAssign);\n }\n if (type == \"variable\") cx.marked = \"property\";\n if (type == \"spread\") return cont(pattern);\n if (type == \"}\") return pass();\n return cont(expect(\":\"), pattern, maybeAssign);\n }\n function maybeAssign(_type, value) {\n if (value == \"=\") return cont(expressionNoComma);\n }\n function vardefCont(type) {\n if (type == \",\") return cont(vardef);\n }\n function maybeelse(type, value) {\n if (type == \"keyword b\" && value == \"else\") return cont(pushlex(\"form\", \"else\"), statement, poplex);\n }\n function forspec(type) {\n if (type == \"(\") return cont(pushlex(\")\"), forspec1, expect(\")\"), poplex);\n }\n function forspec1(type) {\n if (type == \"var\") return cont(vardef, expect(\";\"), forspec2);\n if (type == \";\") return cont(forspec2);\n if (type == \"variable\") return cont(formaybeinof);\n return pass(expression, expect(\";\"), forspec2);\n }\n function formaybeinof(_type, value) {\n if (value == \"in\" || value == \"of\") { cx.marked = \"keyword\"; return cont(expression); }\n return cont(maybeoperatorComma, forspec2);\n }\n function forspec2(type, value) {\n if (type == \";\") return cont(forspec3);\n if (value == \"in\" || value == \"of\") { cx.marked = \"keyword\"; return cont(expression); }\n return pass(expression, expect(\";\"), forspec3);\n }\n function forspec3(type) {\n if (type != \")\") cont(expression);\n }\n function functiondef(type, value) {\n if (value == \"*\") {cx.marked = \"keyword\"; return cont(functiondef);}\n if (type == \"variable\") {register(value); return cont(functiondef);}\n if (type == \"(\") return cont(pushcontext, pushlex(\")\"), commasep(funarg, \")\"), poplex, maybetype, statement, popcontext);\n if (isTS && value == \"<\") return cont(pushlex(\">\"), commasep(typeexpr, \">\"), poplex, functiondef)\n }\n function funarg(type, value) {\n if (value == \"@\") cont(expression, funarg)\n if (type == \"spread\" || type == \"modifier\") return cont(funarg);\n return pass(pattern, maybetype, maybeAssign);\n }\n function classExpression(type, value) {\n // Class expressions may have an optional name.\n if (type == \"variable\") return className(type, value);\n return classNameAfter(type, value);\n }\n function className(type, value) {\n if (type == \"variable\") {register(value); return cont(classNameAfter);}\n }\n function classNameAfter(type, value) {\n if (value == \"<\") return cont(pushlex(\">\"), commasep(typeexpr, \">\"), poplex, classNameAfter)\n if (value == \"extends\" || value == \"implements\" || (isTS && type == \",\"))\n return cont(isTS ? typeexpr : expression, classNameAfter);\n if (type == \"{\") return cont(pushlex(\"}\"), classBody, poplex);\n }\n function classBody(type, value) {\n if (type == \"modifier\" || type == \"async\" ||\n (type == \"variable\" &&\n (value == \"static\" || value == \"get\" || value == \"set\") &&\n cx.stream.match(/^\\s+[\\w$\\xa1-\\uffff]/, false))) {\n cx.marked = \"keyword\";\n return cont(classBody);\n }\n if (type == \"variable\" || cx.style == \"keyword\") {\n cx.marked = \"property\";\n return cont(isTS ? classfield : functiondef, classBody);\n }\n if (type == \"[\")\n return cont(expression, expect(\"]\"), isTS ? classfield : functiondef, classBody)\n if (value == \"*\") {\n cx.marked = \"keyword\";\n return cont(classBody);\n }\n if (type == \";\") return cont(classBody);\n if (type == \"}\") return cont();\n if (value == \"@\") return cont(expression, classBody)\n }\n function classfield(type, value) {\n if (value == \"?\") return cont(classfield)\n if (type == \":\") return cont(typeexpr, maybeAssign)\n if (value == \"=\") return cont(expressionNoComma)\n return pass(functiondef)\n }\n function afterExport(type, value) {\n if (value == \"*\") { cx.marked = \"keyword\"; return cont(maybeFrom, expect(\";\")); }\n if (value == \"default\") { cx.marked = \"keyword\"; return cont(expression, expect(\";\")); }\n if (type == \"{\") return cont(commasep(exportField, \"}\"), maybeFrom, expect(\";\"));\n return pass(statement);\n }\n function exportField(type, value) {\n if (value == \"as\") { cx.marked = \"keyword\"; return cont(expect(\"variable\")); }\n if (type == \"variable\") return pass(expressionNoComma, exportField);\n }\n function afterImport(type) {\n if (type == \"string\") return cont();\n return pass(importSpec, maybeMoreImports, maybeFrom);\n }\n function importSpec(type, value) {\n if (type == \"{\") return contCommasep(importSpec, \"}\");\n if (type == \"variable\") register(value);\n if (value == \"*\") cx.marked = \"keyword\";\n return cont(maybeAs);\n }\n function maybeMoreImports(type) {\n if (type == \",\") return cont(importSpec, maybeMoreImports)\n }\n function maybeAs(_type, value) {\n if (value == \"as\") { cx.marked = \"keyword\"; return cont(importSpec); }\n }\n function maybeFrom(_type, value) {\n if (value == \"from\") { cx.marked = \"keyword\"; return cont(expression); }\n }\n function arrayLiteral(type) {\n if (type == \"]\") return cont();\n return pass(commasep(expressionNoComma, \"]\"));\n }\n\n function isContinuedStatement(state, textAfter) {\n return state.lastType == \"operator\" || state.lastType == \",\" ||\n isOperatorChar.test(textAfter.charAt(0)) ||\n /[,.]/.test(textAfter.charAt(0));\n }\n\n function expressionAllowed(stream, state, backUp) {\n return state.tokenize == tokenBase &&\n /^(?:operator|sof|keyword [bcd]|case|new|export|default|spread|[\\[{}\\(,;:]|=>)$/.test(state.lastType) ||\n (state.lastType == \"quasi\" && /\\{\\s*$/.test(stream.string.slice(0, stream.pos - (backUp || 0))))\n }\n\n // Interface\n\n return {\n startState: function(basecolumn) {\n var state = {\n tokenize: tokenBase,\n lastType: \"sof\",\n cc: [],\n lexical: new JSLexical((basecolumn || 0) - indentUnit, 0, \"block\", false),\n localVars: parserConfig.localVars,\n context: parserConfig.localVars && {vars: parserConfig.localVars},\n indented: basecolumn || 0\n };\n if (parserConfig.globalVars && typeof parserConfig.globalVars == \"object\")\n state.globalVars = parserConfig.globalVars;\n return state;\n },\n\n token: function(stream, state) {\n if (stream.sol()) {\n if (!state.lexical.hasOwnProperty(\"align\"))\n state.lexical.align = false;\n state.indented = stream.indentation();\n findFatArrow(stream, state);\n }\n if (state.tokenize != tokenComment && stream.eatSpace()) return null;\n var style = state.tokenize(stream, state);\n if (type == \"comment\") return style;\n state.lastType = type == \"operator\" && (content == \"++\" || content == \"--\") ? \"incdec\" : type;\n return parseJS(state, style, type, content, stream);\n },\n\n indent: function(state, textAfter) {\n if (state.tokenize == tokenComment) return CodeMirror.Pass;\n if (state.tokenize != tokenBase) return 0;\n var firstChar = textAfter && textAfter.charAt(0), lexical = state.lexical, top\n // Kludge to prevent 'maybelse' from blocking lexical scope pops\n if (!/^\\s*else\\b/.test(textAfter)) for (var i = state.cc.length - 1; i >= 0; --i) {\n var c = state.cc[i];\n if (c == poplex) lexical = lexical.prev;\n else if (c != maybeelse) break;\n }\n while ((lexical.type == \"stat\" || lexical.type == \"form\") &&\n (firstChar == \"}\" || ((top = state.cc[state.cc.length - 1]) &&\n (top == maybeoperatorComma || top == maybeoperatorNoComma) &&\n !/^[,\\.=+\\-*:?[\\(]/.test(textAfter))))\n lexical = lexical.prev;\n if (statementIndent && lexical.type == \")\" && lexical.prev.type == \"stat\")\n lexical = lexical.prev;\n var type = lexical.type, closing = firstChar == type;\n\n if (type == \"vardef\") return lexical.indented + (state.lastType == \"operator\" || state.lastType == \",\" ? lexical.info + 1 : 0);\n else if (type == \"form\" && firstChar == \"{\") return lexical.indented;\n else if (type == \"form\") return lexical.indented + indentUnit;\n else if (type == \"stat\")\n return lexical.indented + (isContinuedStatement(state, textAfter) ? statementIndent || indentUnit : 0);\n else if (lexical.info == \"switch\" && !closing && parserConfig.doubleIndentSwitch != false)\n return lexical.indented + (/^(?:case|default)\\b/.test(textAfter) ? indentUnit : 2 * indentUnit);\n else if (lexical.align) return lexical.column + (closing ? 0 : 1);\n else return lexical.indented + (closing ? 0 : indentUnit);\n },\n\n electricInput: /^\\s*(?:case .*?:|default:|\\{|\\})$/,\n blockCommentStart: jsonMode ? null : \"/*\",\n blockCommentEnd: jsonMode ? null : \"*/\",\n blockCommentContinue: jsonMode ? null : \" * \",\n lineComment: jsonMode ? null : \"//\",\n fold: \"brace\",\n closeBrackets: \"()[]{}''\\\"\\\"``\",\n\n helperType: jsonMode ? \"json\" : \"javascript\",\n jsonldMode: jsonldMode,\n jsonMode: jsonMode,\n\n expressionAllowed: expressionAllowed,\n\n skipExpression: function(state) {\n var top = state.cc[state.cc.length - 1]\n if (top == expression || top == expressionNoComma) state.cc.pop()\n }\n };\n});\n\nCodeMirror.registerHelper(\"wordChars\", \"javascript\", /[\\w$]/);\n\nCodeMirror.defineMIME(\"text/javascript\", \"javascript\");\nCodeMirror.defineMIME(\"text/ecmascript\", \"javascript\");\nCodeMirror.defineMIME(\"application/javascript\", \"javascript\");\nCodeMirror.defineMIME(\"application/x-javascript\", \"javascript\");\nCodeMirror.defineMIME(\"application/ecmascript\", \"javascript\");\nCodeMirror.defineMIME(\"application/json\", {name: \"javascript\", json: true});\nCodeMirror.defineMIME(\"application/x-json\", {name: \"javascript\", json: true});\nCodeMirror.defineMIME(\"application/ld+json\", {name: \"javascript\", jsonld: true});\nCodeMirror.defineMIME(\"text/typescript\", { name: \"javascript\", typescript: true });\nCodeMirror.defineMIME(\"application/typescript\", { name: \"javascript\", typescript: true });\n\n});\n\n\n/***/ }),\n/* 105 */\n/***/ (function(module, exports, __webpack_require__) {\n\n(function(mod) {\n if (true) // CommonJS\n mod(__webpack_require__(6));\n else if (typeof define == \"function\" && define.amd) // AMD\n define([\"codemirror/lib/codemirror\"], mod);\n else // Plain browser env\n mod(CodeMirror);\n})(function(CodeMirror) {\n\n CodeMirror.extendMode(\"css\", {\n commentStart: \"/*\",\n commentEnd: \"*/\",\n newlineAfterToken: function(_type, content) {\n return /^[;{}]$/.test(content);\n }\n });\n\n CodeMirror.extendMode(\"javascript\", {\n commentStart: \"/*\",\n commentEnd: \"*/\",\n // FIXME semicolons inside of for\n newlineAfterToken: function(_type, content, textAfter, state) {\n if (this.jsonMode) {\n return /^[\\[,{]$/.test(content) || /^}/.test(textAfter);\n } else {\n if (content == \";\" && state.lexical && state.lexical.type == \")\") return false;\n return /^[;{}]$/.test(content) && !/^;/.test(textAfter);\n }\n }\n });\n\n var inlineElements = /^(a|abbr|acronym|area|base|bdo|big|br|button|caption|cite|code|col|colgroup|dd|del|dfn|em|frame|hr|iframe|img|input|ins|kbd|label|legend|link|map|object|optgroup|option|param|q|samp|script|select|small|span|strong|sub|sup|textarea|tt|var)$/;\n\n CodeMirror.extendMode(\"xml\", {\n commentStart: \"<!--\",\n commentEnd: \"-->\",\n newlineAfterToken: function(type, content, textAfter, state) {\n var inline = false;\n if (this.configuration == \"html\")\n inline = state.context ? inlineElements.test(state.context.tagName) : false;\n return !inline && ((type == \"tag\" && />$/.test(content) && state.context) ||\n /^</.test(textAfter));\n }\n });\n\n // Comment/uncomment the specified range\n CodeMirror.defineExtension(\"commentRange\", function (isComment, from, to) {\n var cm = this, curMode = CodeMirror.innerMode(cm.getMode(), cm.getTokenAt(from).state).mode;\n cm.operation(function() {\n if (isComment) { // Comment range\n cm.replaceRange(curMode.commentEnd, to);\n cm.replaceRange(curMode.commentStart, from);\n if (from.line == to.line && from.ch == to.ch) // An empty comment inserted - put cursor inside\n cm.setCursor(from.line, from.ch + curMode.commentStart.length);\n } else { // Uncomment range\n var selText = cm.getRange(from, to);\n var startIndex = selText.indexOf(curMode.commentStart);\n var endIndex = selText.lastIndexOf(curMode.commentEnd);\n if (startIndex > -1 && endIndex > -1 && endIndex > startIndex) {\n // Take string till comment start\n selText = selText.substr(0, startIndex) +\n // From comment start till comment end\n selText.substring(startIndex + curMode.commentStart.length, endIndex) +\n // From comment end till string end\n selText.substr(endIndex + curMode.commentEnd.length);\n }\n cm.replaceRange(selText, from, to);\n }\n });\n });\n\n // Applies automatic mode-aware indentation to the specified range\n CodeMirror.defineExtension(\"autoIndentRange\", function (from, to) {\n var cmInstance = this;\n this.operation(function () {\n for (var i = from.line; i <= to.line; i++) {\n cmInstance.indentLine(i, \"smart\");\n }\n });\n });\n\n // Applies automatic formatting to the specified range\n CodeMirror.defineExtension(\"autoFormatRange\", function (from, to) {\n var cm = this;\n var outer = cm.getMode(), text = cm.getRange(from, to).split(\"\\n\");\n var state = CodeMirror.copyState(outer, cm.getTokenAt(from).state);\n var tabSize = cm.getOption(\"tabSize\");\n\n var out = \"\", lines = 0, atSol = from.ch === 0;\n function newline() {\n out += \"\\n\";\n atSol = true;\n ++lines;\n }\n\n for (var i = 0; i < text.length; ++i) {\n var stream = new CodeMirror.StringStream(text[i], tabSize);\n while (!stream.eol()) {\n var inner = CodeMirror.innerMode(outer, state);\n var style = outer.token(stream, state), cur = stream.current();\n stream.start = stream.pos;\n if (!atSol || /\\S/.test(cur)) {\n out += cur;\n atSol = false;\n }\n if (!atSol && inner.mode.newlineAfterToken &&\n inner.mode.newlineAfterToken(style, cur, stream.string.slice(stream.pos) || text[i+1] || \"\", inner.state))\n newline();\n }\n if (!stream.pos && outer.blankLine) outer.blankLine(state);\n if (!atSol && i < text.length - 1) newline();\n }\n\n cm.operation(function () {\n cm.replaceRange(out, from, to);\n for (var cur = from.line + 1, end = from.line + lines; cur <= end; ++cur)\n cm.indentLine(cur, \"smart\");\n cm.setSelection(from, cm.getCursor(false));\n });\n });\n});\n\n\n/***/ }),\n/* 106 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(_) {\n\nvar Backbone = __webpack_require__(0);\n\nmodule.exports = Backbone.View.extend({\n template: _.template('\\n <div class=\"<%= pfx %>editor\" id=\"<%= pfx %><%= codeName %>\">\\n \\t<div id=\"<%= pfx %>title\"><%= label %></div>\\n \\t<div id=\"<%= pfx %>code\"></div>\\n </div>'),\n\n initialize: function initialize(o) {\n this.config = o.config || {};\n this.pfx = this.config.stylePrefix;\n },\n render: function render() {\n var obj = this.model.toJSON();\n obj.pfx = this.pfx;\n this.$el.html(this.template(obj));\n this.$el.attr('class', this.pfx + 'editor-c');\n this.$el.find('#' + this.pfx + 'code').append(this.model.get('input'));\n return this;\n }\n});\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))\n\n/***/ }),\n/* 107 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\n/**\n *\n * * [addPanel](#addpanel)\n * * [addButton](#addbutton)\n * * [removeButton](#removebutton)\n * * [getButton](#getbutton)\n * * [getPanel](#getpanel)\n * * [getPanels](#getpanels)\n * * [render](#render)\n *\n * This module manages panels and buttons inside the editor.\n * You can init the editor with all panels and buttons necessary via configuration\n *\n * ```js\n * var editor = grapesjs.init({\n * ...\n * panels: {...} // Check below for the possible properties\n * ...\n * });\n * ```\n *\n *\n * Before using methods you should get first the module from the editor instance, in this way:\n *\n * ```js\n * var panelManager = editor.Panels;\n * ```\n *\n * @module Panels\n * @param {Object} config Configurations\n * @param {Array<Object>} [config.defaults=[]] Array of possible panels\n * @example\n * ...\n * panels: {\n * defaults: [{\n * id: 'main-toolbar',\n * buttons: [{\n * id: 'btn-id',\n * className: 'some',\n * attributes: {\n * title: 'MyTitle'\n * }\n * }],\n * }],\n * }\n * ...\n */\nmodule.exports = function () {\n var c = {},\n defaults = __webpack_require__(108),\n Panel = __webpack_require__(27),\n Panels = __webpack_require__(110),\n PanelView = __webpack_require__(29),\n PanelsView = __webpack_require__(112);\n var panels, PanelsViewObj;\n\n return {\n /**\n * Name of the module\n * @type {String}\n * @private\n */\n name: 'Panels',\n\n /**\n * Initialize module. Automatically called with a new instance of the editor\n * @param {Object} config Configurations\n */\n init: function init(config) {\n c = config || {};\n for (var name in defaults) {\n if (!(name in c)) c[name] = defaults[name];\n }\n\n var ppfx = c.pStylePrefix;\n if (ppfx) c.stylePrefix = ppfx + c.stylePrefix;\n\n panels = new Panels(c.defaults);\n PanelsViewObj = new PanelsView({\n collection: panels,\n config: c\n });\n return this;\n },\n\n\n /**\n * Returns the collection of panels\n * @return {Collection} Collection of panel\n */\n getPanels: function getPanels() {\n return panels;\n },\n\n\n /**\n * Returns panels element\n * @return {HTMLElement}\n */\n getPanelsEl: function getPanelsEl() {\n return PanelsViewObj.el;\n },\n\n\n /**\n * Add new panel to the collection\n * @param {Object|Panel} panel Object with right properties or an instance of Panel\n * @return {Panel} Added panel. Useful in case passed argument was an Object\n * @example\n * var newPanel = panelManager.addPanel({\n * id: 'myNewPanel',\n * visible : true,\n * buttons : [...],\n * });\n */\n addPanel: function addPanel(panel) {\n return panels.add(panel);\n },\n\n\n /**\n * Remove a panel from the collection\n * @param {Object|Panel|String} panel Object with right properties or an instance of Panel or Painel id\n * @return {Panel} Removed panel. Useful in case passed argument was an Object\n * @example\n * const newPanel = panelManager.removePanel({\n * id: 'myNewPanel',\n * visible : true,\n * buttons : [...],\n * });\n *\n * const newPanel = panelManager.removePanel('myNewPanel');\n *\n */\n removePanel: function removePanel(panel) {\n return panels.remove(panel);\n },\n\n\n /**\n * Get panel by ID\n * @param {string} id Id string\n * @return {Panel|null}\n * @example\n * var myPanel = panelManager.getPanel('myNewPanel');\n */\n getPanel: function getPanel(id) {\n var res = panels.where({ id: id });\n return res.length ? res[0] : null;\n },\n\n\n /**\n * Add button to the panel\n * @param {string} panelId Panel's ID\n * @param {Object|Button} button Button object or instance of Button\n * @return {Button|null} Added button. Useful in case passed button was an Object\n * @example\n * var newButton = panelManager.addButton('myNewPanel',{\n * id: 'myNewButton',\n * className: 'someClass',\n * command: 'someCommand',\n * attributes: { title: 'Some title'},\n * active: false,\n * });\n * // It's also possible to pass the command as an object\n * // with .run and .stop methods\n * ...\n * command: {\n * run: function(editor) {\n * ...\n * },\n * stop: function(editor) {\n * ...\n * }\n * },\n * // Or simply like a function which will be evaluated as a single .run command\n * ...\n * command: function(editor) {\n * ...\n * }\n */\n addButton: function addButton(panelId, button) {\n var pn = this.getPanel(panelId);\n return pn ? pn.get('buttons').add(button) : null;\n },\n\n\n /**\n * Remove button from the panel\n * @param {string} panelId Panel's ID\n * @param {Object|Button|String} button Button object or instance of Button or button id\n * @return {Button|null} Removed button.\n * @example\n * const removedButton = panelManager.removeButton('myNewPanel',{\n * id: 'myNewButton',\n * className: 'someClass',\n * command: 'someCommand',\n * attributes: { title: 'Some title'},\n * active: false,\n * });\n *\n * // It's also possible to use the button id\n * const removedButton = panelManager.removeButton('myNewPanel','myNewButton');\n *\n */\n removeButton: function removeButton(panelId, button) {\n var pn = this.getPanel(panelId);\n return pn && pn.get('buttons').remove(button);\n },\n\n\n /**\n * Get button from the panel\n * @param {string} panelId Panel's ID\n * @param {string} id Button's ID\n * @return {Button|null}\n * @example\n * var button = panelManager.getButton('myPanel','myButton');\n */\n getButton: function getButton(panelId, id) {\n var pn = this.getPanel(panelId);\n if (pn) {\n var res = pn.get('buttons').where({ id: id });\n return res.length ? res[0] : null;\n }\n return null;\n },\n\n\n /**\n * Render panels and buttons\n * @return {HTMLElement}\n */\n render: function render() {\n return PanelsViewObj.render().el;\n },\n\n\n /**\n * Active activable buttons\n * @private\n */\n active: function active() {\n this.getPanels().each(function (p) {\n p.get('buttons').each(function (btn) {\n if (btn.get('active')) btn.trigger('updateActive');\n });\n });\n },\n\n\n /**\n * Disable buttons flagged as disabled\n * @private\n */\n disableButtons: function disableButtons() {\n this.getPanels().each(function (p) {\n p.get('buttons').each(function (btn) {\n if (btn.get('disable')) btn.trigger('change:disable');\n });\n });\n },\n\n\n Panel: Panel\n };\n};\n\n/***/ }),\n/* 108 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar crc = 'create-comp';\nvar mvc = 'move-comp';\nvar swv = 'sw-visibility';\nvar expt = 'export-template';\nvar osm = 'open-sm';\nvar otm = 'open-tm';\nvar ola = 'open-layers';\nvar obl = 'open-blocks';\nvar ful = 'fullscreen';\nvar prv = 'preview';\n\nmodule.exports = {\n stylePrefix: 'pn-',\n\n // Default panels fa-sliders for features\n defaults: [{\n id: 'commands',\n buttons: [{}]\n }, {\n id: 'options',\n buttons: [{\n active: true,\n id: swv,\n className: 'fa fa-square-o',\n command: swv,\n context: swv,\n attributes: { title: 'View components' }\n }, {\n id: prv,\n className: 'fa fa-eye',\n command: prv,\n context: prv,\n attributes: { title: 'Preview' }\n }, {\n id: ful,\n className: 'fa fa-arrows-alt',\n command: ful,\n context: ful,\n attributes: { title: 'Fullscreen' }\n }, {\n id: expt,\n className: 'fa fa-code',\n command: expt,\n attributes: { title: 'View code' }\n }]\n }, {\n id: 'views',\n buttons: [{\n id: osm,\n className: 'fa fa-paint-brush',\n command: osm,\n active: true,\n attributes: { title: 'Open Style Manager' }\n }, {\n id: otm,\n className: 'fa fa-cog',\n command: otm,\n attributes: { title: 'Settings' }\n }, {\n id: ola,\n className: 'fa fa-bars',\n command: ola,\n attributes: { title: 'Open Layer Manager' }\n }, {\n id: obl,\n className: 'fa fa-th-large',\n command: obl,\n attributes: { title: 'Open Blocks' }\n }]\n }],\n\n // Editor model\n em: null,\n\n // Delay before show children buttons (in milliseconds)\n delayBtnsShow: 300\n};\n\n/***/ }),\n/* 109 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar Backbone = __webpack_require__(0);\n\nmodule.exports = Backbone.Model.extend({\n defaults: {\n id: '',\n className: '',\n command: '',\n context: '',\n buttons: [],\n attributes: {},\n options: {},\n active: false,\n dragDrop: false,\n runDefaultCommand: true,\n stopDefaultCommand: false,\n disable: false\n },\n\n initialize: function initialize(options) {\n if (this.get('buttons').length) {\n var Buttons = __webpack_require__(28);\n this.set('buttons', new Buttons(this.get('buttons')));\n }\n }\n});\n\n/***/ }),\n/* 110 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar Backbone = __webpack_require__(0);\nvar Panel = __webpack_require__(27);\n\nmodule.exports = Backbone.Collection.extend({\n model: Panel\n});\n\n/***/ }),\n/* 111 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Backbone, _) {\n\nvar _underscore = __webpack_require__(1);\n\nvar $ = Backbone.$;\n\nmodule.exports = Backbone.View.extend({\n tagName: 'span',\n\n initialize: function initialize(o) {\n _.bindAll(this, 'startTimer', 'stopTimer', 'showButtons', 'hideButtons', 'closeOnKeyPress', 'onDrop', 'initSorter', 'stopDrag');\n var cls = this.model.get('className');\n this.config = o.config || {};\n this.em = this.config.em || {};\n var pfx = this.config.stylePrefix || '';\n var ppfx = this.config.pStylePrefix || '';\n this.pfx = pfx;\n this.ppfx = this.config.pStylePrefix || '';\n this.id = pfx + this.model.get('id');\n this.activeCls = pfx + 'active ' + ppfx + 'four-color';\n this.disableCls = pfx + 'active';\n this.btnsVisCls = pfx + 'visible';\n this.parentM = o.parentM || null;\n this.className = pfx + 'btn' + (cls ? ' ' + cls : '');\n this.listenTo(this.model, 'change:active updateActive', this.updateActive);\n this.listenTo(this.model, 'checkActive', this.checkActive);\n this.listenTo(this.model, 'change:bntsVis', this.updateBtnsVis);\n this.listenTo(this.model, 'change:attributes', this.updateAttributes);\n this.listenTo(this.model, 'change:className', this.updateClassName);\n this.listenTo(this.model, 'change:disable', this.updateDisable);\n\n if (this.model.get('buttons').length) {\n this.$el.on('mousedown', this.startTimer);\n this.$el.append($('<div>', { class: pfx + 'arrow-rd' }));\n }\n\n if (this.em && this.em.get) this.commands = this.em.get('Commands');\n\n this.events = {};\n\n if (this.model.get('dragDrop')) {\n this.events.mousedown = 'initDrag';\n this.em.on('loaded', this.initSorter);\n } else this.events.click = 'clicked';\n this.delegateEvents();\n },\n initSorter: function initSorter() {\n if (this.em.Canvas) {\n var canvas = this.em.Canvas;\n this.canvasEl = canvas.getBody();\n this.sorter = new this.em.Utils.Sorter({\n container: this.canvasEl,\n placer: canvas.getPlacerEl(),\n containerSel: '*',\n itemSel: '*',\n pfx: this.ppfx,\n onMove: this.onDrag,\n onEndMove: this.onDrop,\n document: canvas.getFrameEl().contentDocument,\n direction: 'a',\n wmargin: 1,\n nested: 1\n });\n var offDim = canvas.getOffset();\n this.sorter.offTop = offDim.top;\n this.sorter.offLeft = offDim.left;\n }\n },\n\n\n /**\n * Init dragging element\n * @private\n */\n initDrag: function initDrag() {\n this.model.collection.deactivateAll(this.model.get('context'));\n this.sorter.startSort(this.el);\n this.sorter.setDropContent(this.model.get('options').content);\n this.canvasEl.style.cursor = 'grabbing';\n $(document).on('mouseup', this.stopDrag);\n },\n\n\n /**\n * Stop dragging\n * @private\n */\n stopDrag: function stopDrag() {\n $(document).off('mouseup', this.stopDrag);\n this.sorter.endMove();\n },\n\n\n /**\n * During drag method\n * @private\n */\n onDrag: function onDrag(e) {},\n\n\n /**\n * During drag method\n * @private\n */\n onDrop: function onDrop(e) {\n this.canvasEl.style.cursor = 'default';\n },\n\n\n /**\n * Updates class name of the button\n *\n * @return void\n * */\n updateClassName: function updateClassName() {\n var cls = this.model.get('className');\n this.$el.attr('class', this.pfx + 'btn' + (cls ? ' ' + cls : ''));\n },\n\n\n /**\n * Updates attributes of the button\n *\n * @return void\n * */\n updateAttributes: function updateAttributes() {\n this.$el.attr(this.model.get('attributes'));\n },\n\n\n /**\n * Updates visibility of children buttons\n *\n * @return void\n * */\n updateBtnsVis: function updateBtnsVis() {\n if (!this.$buttons) return;\n\n if (this.model.get('bntsVis')) this.$buttons.addClass(this.btnsVisCls);else this.$buttons.removeClass(this.btnsVisCls);\n },\n\n\n /**\n * Start timer for showing children buttons\n *\n * @return void\n * */\n startTimer: function startTimer() {\n this.timeout = setTimeout(this.showButtons, this.config.delayBtnsShow);\n $(document).on('mouseup', this.stopTimer);\n },\n\n\n /**\n * Stop timer for showing children buttons\n *\n * @return void\n * */\n stopTimer: function stopTimer() {\n $(document).off('mouseup', this.stopTimer);\n if (this.timeout) clearTimeout(this.timeout);\n },\n\n\n /**\n * Show children buttons\n *\n * @return void\n * */\n showButtons: function showButtons() {\n clearTimeout(this.timeout);\n this.model.set('bntsVis', true);\n $(document).on('mousedown', this.hideButtons);\n $(document).on('keypress', this.closeOnKeyPress);\n },\n\n\n /**\n * Hide children buttons\n *\n * @return void\n * */\n hideButtons: function hideButtons(e) {\n if (e) {\n $(e.target).trigger('click');\n }\n this.model.set('bntsVis', false);\n $(document).off('mousedown', this.hideButtons);\n $(document).off('keypress', this.closeOnKeyPress);\n },\n\n\n /**\n * Close buttons on ESC key press\n * @param {Object} e Event\n *\n * @return void\n * */\n closeOnKeyPress: function closeOnKeyPress(e) {\n var key = e.which || e.keyCode;\n if (key == 27) this.hideButtons();\n },\n\n\n /**\n * Update active status of the button\n *\n * @return void\n * */\n updateActive: function updateActive() {\n var model = this.model;\n var context = model.get('context');\n var parent = this.parentM;\n var command = {};\n var editor = this.em && this.em.get ? this.em.get('Editor') : null;\n var commandName = model.get('command');\n\n if (this.commands && (0, _underscore.isString)(commandName)) {\n command = this.commands.get(commandName) || {};\n } else if ((0, _underscore.isFunction)(commandName)) {\n command = { run: commandName };\n } else if (commandName !== null && (0, _underscore.isObject)(commandName)) {\n command = commandName;\n }\n\n if (model.get('active')) {\n model.collection.deactivateAll(context);\n model.set('active', true, { silent: true }).trigger('checkActive');\n parent && parent.set('active', true, { silent: true }).trigger('checkActive');\n\n if (command.run) {\n command.run(editor, model, model.get('options'));\n editor.trigger('run:' + commandName);\n }\n\n // Disable button if there is no stop method\n !command.stop && model.set('active', false);\n } else {\n this.$el.removeClass(this.activeCls);\n model.collection.deactivateAll(context);\n parent && parent.set('active', false, { silent: true }).trigger('checkActive');\n\n if (command.stop) {\n command.stop(editor, model, model.get('options'));\n editor.trigger('stop:' + commandName);\n }\n }\n },\n updateDisable: function updateDisable() {\n if (this.model.get('disable')) {\n this.$el.addClass(this.disableCls);\n } else {\n this.$el.removeClass(this.disableCls);\n }\n },\n\n\n /**\n * Update active style status\n *\n * @return void\n * */\n checkActive: function checkActive() {\n if (this.model.get('active')) this.$el.addClass(this.activeCls);else this.$el.removeClass(this.activeCls);\n },\n\n\n /**\n * Triggered when button is clicked\n * @param {Object} e Event\n *\n * @return void\n * */\n clicked: function clicked(e) {\n if (this.model.get('bntsVis')) return;\n\n if (this.model.get('disable')) return;\n\n this.toogleActive();\n },\n toogleActive: function toogleActive() {\n if (this.parentM) this.swapParent();\n\n var active = this.model.get('active');\n this.model.set('active', !active);\n\n // If the stop is requested\n var command = this.em.get('Commands').get('select-comp');\n\n if (active) {\n if (this.model.get('runDefaultCommand')) this.em.runDefault();\n } else {\n if (this.model.get('stopDefaultCommand')) this.em.stopDefault();\n }\n },\n\n\n /**\n * Updates parent model swapping properties\n *\n * @return void\n * */\n swapParent: function swapParent() {\n this.parentM.collection.deactivateAll(this.model.get('context'));\n this.parentM.set('attributes', this.model.get('attributes'));\n this.parentM.set('options', this.model.get('options'));\n this.parentM.set('command', this.model.get('command'));\n this.parentM.set('className', this.model.get('className'));\n this.parentM.set('active', true, { silent: true }).trigger('checkActive');\n },\n render: function render() {\n this.updateAttributes();\n this.$el.attr('class', this.className);\n\n if (this.model.get('buttons').length) {\n var btnsView = __webpack_require__(30); //Avoid Circular Dependencies\n var view = new btnsView({\n collection: this.model.get('buttons'),\n config: this.config,\n parentM: this.model\n });\n this.$buttons = view.render().$el;\n this.$buttons.append($('<div>', { class: this.pfx + 'arrow-l' }));\n this.$el.append(this.$buttons); //childNodes avoids wrapping 'div'\n }\n\n return this;\n }\n});\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0), __webpack_require__(1)))\n\n/***/ }),\n/* 112 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar Backbone = __webpack_require__(0);\nvar PanelView = __webpack_require__(29);\n\nmodule.exports = Backbone.View.extend({\n initialize: function initialize(o) {\n this.opt = o || {};\n this.config = this.opt.config || {};\n this.pfx = this.config.stylePrefix || '';\n this.listenTo(this.collection, 'add', this.addTo);\n this.listenTo(this.collection, 'reset', this.render);\n this.className = this.pfx + 'panels';\n },\n\n\n /**\n * Add to collection\n * @param Object Model\n *\n * @return Object\n * @private\n * */\n addTo: function addTo(model) {\n this.addToCollection(model);\n },\n\n\n /**\n * Add new object to collection\n * @param Object Model\n * @param Object Fragment collection\n * @param integer Index of append\n *\n * @return Object Object created\n * @private\n * */\n addToCollection: function addToCollection(model, fragmentEl) {\n var fragment = fragmentEl || null;\n var view = new PanelView({\n model: model,\n config: this.config\n });\n var rendered = view.render().el;\n var appendTo = model.get('appendTo');\n\n if (appendTo) {\n var appendEl = document.querySelector(appendTo);\n appendEl.appendChild(rendered);\n } else {\n if (fragment) {\n fragment.appendChild(rendered);\n } else {\n this.$el.append(rendered);\n }\n }\n\n view.initResize();\n return rendered;\n },\n render: function render() {\n var fragment = document.createDocumentFragment();\n this.$el.empty();\n\n this.collection.each(function (model) {\n this.addToCollection(model, fragment);\n }, this);\n\n this.$el.append(fragment);\n this.$el.attr('class', this.className);\n return this;\n }\n});\n\n/***/ }),\n/* 113 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _RichTextEditor = __webpack_require__(114);\n\nvar _RichTextEditor2 = _interopRequireDefault(_RichTextEditor);\n\nvar _mixins = __webpack_require__(2);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\n/**\n * This module allows to customize the toolbar of the Rich Text Editor and use commands from the HTML Editing APIs.\n * For more info about HTML Editing APIs check here:\n * https://developer.mozilla.org/en-US/docs/Web/API/Document/execCommand\n *\n * It's highly recommended to keep this toolbar as small as possible, especially from styling commands (eg. 'fontSize')\n * and leave this task to the Style Manager.\n *\n * Before using methods you should get first the module from the editor instance, in this way:\n *\n * ```js\n * var rte = editor.RichTextEditor;\n * ```\n * @module RichTextEditor\n */\nmodule.exports = function () {\n var config = {};\n var defaults = __webpack_require__(115);\n var toolbar = void 0,\n actions = void 0,\n lastEl = void 0,\n globalRte = void 0;\n\n var hideToolbar = function hideToolbar() {\n var style = toolbar.style;\n var size = '-100px';\n style.top = size;\n style.left = size;\n style.display = 'none';\n };\n\n return {\n customRte: null,\n\n /**\n * Name of the module\n * @type {String}\n * @private\n */\n name: 'RichTextEditor',\n\n /**\n * Initialize module. Automatically called with a new instance of the editor\n * @param {Object} opts Options\n * @private\n */\n init: function init() {\n var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n config = opts;\n\n for (var name in defaults) {\n if (!(name in config)) {\n config[name] = defaults[name];\n }\n }\n\n var ppfx = config.pStylePrefix;\n\n if (ppfx) {\n config.stylePrefix = ppfx + config.stylePrefix;\n }\n\n this.pfx = config.stylePrefix;\n actions = config.actions || [];\n toolbar = document.createElement('div');\n toolbar.className = ppfx + 'rte-toolbar ' + ppfx + 'one-bg';\n globalRte = this.initRte(document.createElement('div'));\n\n //Avoid closing on toolbar clicking\n (0, _mixins.on)(toolbar, 'mousedown', function (e) {\n return e.stopPropagation();\n });\n return this;\n },\n\n\n /**\n * Post render callback\n * @param {View} ev\n * @private\n */\n postRender: function postRender(ev) {\n var canvas = ev.model.get('Canvas');\n toolbar.style.pointerEvents = 'all';\n hideToolbar();\n canvas.getToolsEl().appendChild(toolbar);\n },\n\n\n /**\n * Init the built-in RTE\n * @param {HTMLElement} el\n * @return {RichTextEditor}\n * @private\n */\n initRte: function initRte(el) {\n var pfx = this.pfx;\n var actionbarContainer = toolbar;\n var actionbar = this.actionbar;\n var actions = this.actions || config.actions;\n var classes = {\n actionbar: pfx + 'actionbar',\n button: pfx + 'action',\n active: pfx + 'active'\n };\n var rte = new _RichTextEditor2.default({\n el: el,\n classes: classes,\n actions: actions,\n actionbar: actionbar,\n actionbarContainer: actionbarContainer\n });\n globalRte && globalRte.setEl(el);\n\n if (rte.actionbar) {\n this.actionbar = rte.actionbar;\n }\n\n if (rte.actions) {\n this.actions = rte.actions;\n }\n\n return rte;\n },\n\n\n /**\n * Add a new action to the built-in RTE toolbar\n * @param {string} name Action name\n * @param {Object} action Action options\n * @example\n * rte.add('bold', {\n * icon: '<b>B</b>',\n * attributes: {title: 'Bold',}\n * result: rte => rte.exec('bold')\n * });\n * rte.add('link', {\n * icon: document.getElementById('t'),\n * attributes: {title: 'Link',}\n * // Example on it's easy to wrap a selected content\n * result: rte => rte.insertHTML(`<a href=\"#\">${rte.selection()}</a>`)\n * });\n * // An example with fontSize\n * rte.add('fontSize', {\n * icon: `<select class=\"gjs-field\">\n * <option>1</option>\n * <option>4</option>\n * <option>7</option>\n * </select>`,\n * // Bind the 'result' on 'change' listener\n * event: 'change',\n * result: (rte, action) => rte.exec('fontSize', action.btn.firstChild.value),\n * // Callback on any input change (mousedown, keydown, etc..)\n * update: (rte, action) => {\n * const value = rte.doc.queryCommandValue(action.name);\n * if (value != 'false') { // value is a string\n * action.btn.firstChild.value = value;\n * }\n * }\n * })\n */\n add: function add(name) {\n var action = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n action.name = name;\n globalRte.addAction(action, { sync: 1 });\n },\n\n\n /**\n * Get the action by its name\n * @param {string} name Action name\n * @return {Object}\n * @example\n * const action = rte.get('bold');\n * // {name: 'bold', ...}\n */\n get: function get(name) {\n var result = void 0;\n globalRte.getActions().forEach(function (action) {\n if (action.name == name) {\n result = action;\n }\n });\n return result;\n },\n\n\n /**\n * Get all actions\n * @return {Array}\n */\n getAll: function getAll() {\n return globalRte.getActions();\n },\n\n\n /**\n * Remove the action from the toolbar\n * @param {string} name\n * @return {Object} Removed action\n * @example\n * const action = rte.remove('bold');\n * // {name: 'bold', ...}\n */\n remove: function remove(name) {\n var actions = this.getAll();\n var action = this.get(name);\n\n if (action) {\n var btn = action.btn;\n var index = actions.indexOf(action);\n btn.parentNode.removeChild(btn);\n actions.splice(index, 1);\n }\n\n return action;\n },\n\n\n /**\n * Get the toolbar element\n * @return {HTMLElement}\n */\n getToolbarEl: function getToolbarEl() {\n return toolbar;\n },\n\n\n /**\n * Triggered when the offset of the editor is changed\n * @private\n */\n udpatePosition: function udpatePosition() {\n var un = 'px';\n var canvas = config.em.get('Canvas');\n var pos = canvas.getTargetToElementDim(toolbar, lastEl, {\n event: 'rteToolbarPosUpdate'\n });\n\n if (config.adjustToolbar) {\n // Move the toolbar down when the top canvas edge is reached\n if (pos.top <= pos.canvasTop) {\n pos.top = pos.elementTop + pos.elementHeight;\n }\n }\n\n var toolbarStyle = toolbar.style;\n toolbarStyle.top = pos.top + un;\n toolbarStyle.left = pos.left + un;\n },\n\n\n /**\n * Enable rich text editor on the element\n * @param {View} view Component view\n * @param {Object} rte The instance of already defined RTE\n * @private\n * */\n enable: function enable(view, rte) {\n lastEl = view.el;\n var em = config.em;\n var el = view.getChildrenContainer();\n var customRte = this.customRte;\n\n toolbar.style.display = '';\n rte = customRte ? customRte.enable(el, rte) : this.initRte(el).enable();\n\n if (em) {\n setTimeout(this.udpatePosition.bind(this), 0);\n var event = 'change:canvasOffset canvasScroll';\n em.off(event, this.udpatePosition, this);\n em.on(event, this.udpatePosition, this);\n em.trigger('rte:enable', view, rte);\n }\n\n return rte;\n },\n\n\n /**\n * Unbind rich text editor from the element\n * @param {View} view\n * @param {Object} rte The instance of already defined RTE\n * @private\n * */\n disable: function disable(view, rte) {\n var em = config.em;\n var customRte = this.customRte;\n var el = view.getChildrenContainer();\n\n if (customRte) {\n customRte.disable(el, rte);\n } else {\n rte && rte.disable();\n }\n\n hideToolbar();\n em && em.trigger('rte:disable', view, rte);\n }\n };\n};\n\n/***/ }),\n/* 114 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); // The initial version of this RTE was borrowed from https://github.com/jaredreich/pell\n// and adapted to the GrapesJS's need\n\nvar _mixins = __webpack_require__(2);\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar RTE_KEY = '_rte';\n\nvar defActions = {\n bold: {\n name: 'bold',\n icon: '<b>B</b>',\n attributes: { title: 'Bold' },\n result: function result(rte) {\n return rte.exec('bold');\n }\n },\n italic: {\n name: 'italic',\n icon: '<i>I</i>',\n attributes: { title: 'Italic' },\n result: function result(rte) {\n return rte.exec('italic');\n }\n },\n underline: {\n name: 'underline',\n icon: '<u>U</u>',\n attributes: { title: 'Underline' },\n result: function result(rte) {\n return rte.exec('underline');\n }\n },\n strikethrough: {\n name: 'strikethrough',\n icon: '<strike>S</strike>',\n attributes: { title: 'Strike-through' },\n result: function result(rte) {\n return rte.exec('strikeThrough');\n }\n },\n link: {\n icon: '<span style=\"transform:rotate(45deg)\">⫘</span>',\n name: 'link',\n attributes: {\n style: 'font-size:1.4rem;padding:0 4px 2px;',\n title: 'Link'\n },\n result: function result(rte) {\n return rte.insertHTML('<a class=\"link\" href=\"\">' + rte.selection() + '</a>');\n }\n }\n};\n\nvar RichTextEditor = function () {\n function RichTextEditor() {\n var _this = this;\n\n var settings = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n _classCallCheck(this, RichTextEditor);\n\n var el = settings.el;\n\n if (el[RTE_KEY]) {\n return el[RTE_KEY];\n }\n\n el[RTE_KEY] = this;\n this.setEl(el);\n this.updateActiveActions = this.updateActiveActions.bind(this);\n\n var settAct = settings.actions || [];\n settAct.forEach(function (action, i) {\n if (typeof action === 'string') {\n action = defActions[action];\n } else if (defActions[action.name]) {\n action = _extends({}, defActions[action.name], action);\n }\n settAct[i] = action;\n });\n var actions = settAct.length ? settAct : Object.keys(defActions).map(function (action) {\n return defActions[action];\n });\n\n settings.classes = _extends({\n actionbar: 'actionbar',\n button: 'action',\n active: 'active'\n }, settings.classes);\n\n var classes = settings.classes;\n var actionbar = settings.actionbar;\n this.actionbar = actionbar;\n this.settings = settings;\n this.classes = classes;\n this.actions = actions;\n\n if (!actionbar) {\n var actionbarCont = settings.actionbarContainer;\n actionbar = document.createElement('div');\n actionbar.className = classes.actionbar;\n actionbarCont.appendChild(actionbar);\n this.actionbar = actionbar;\n actions.forEach(function (action) {\n return _this.addAction(action);\n });\n }\n\n settings.styleWithCSS && this.exec('styleWithCSS');\n this.syncActions();\n\n return this;\n }\n\n _createClass(RichTextEditor, [{\n key: 'setEl',\n value: function setEl(el) {\n this.el = el;\n this.doc = el.ownerDocument;\n }\n }, {\n key: 'updateActiveActions',\n value: function updateActiveActions() {\n var _this2 = this;\n\n this.getActions().forEach(function (action) {\n var btn = action.btn;\n var update = action.update;\n var active = _this2.classes.active;\n var name = action.name;\n var doc = _this2.doc;\n btn.className = btn.className.replace(active, '').trim();\n\n // doc.queryCommandValue(name) != 'false'\n if (doc.queryCommandState(name)) {\n btn.className += ' ' + active;\n }\n\n update && update(_this2, action);\n });\n }\n }, {\n key: 'enable',\n value: function enable() {\n if (this.enabled) {\n return this;\n }\n\n this.actionbarEl().style.display = '';\n this.el.contentEditable = true;\n (0, _mixins.on)(this.el, 'mouseup keyup', this.updateActiveActions);\n this.syncActions();\n this.updateActiveActions();\n this.el.focus();\n this.enabled = 1;\n return this;\n }\n }, {\n key: 'disable',\n value: function disable() {\n this.actionbarEl().style.display = 'none';\n this.el.contentEditable = false;\n (0, _mixins.off)(this.el, 'mouseup keyup', this.updateActiveActions);\n this.enabled = 0;\n return this;\n }\n\n /**\n * Sync actions with the current RTE\n */\n\n }, {\n key: 'syncActions',\n value: function syncActions() {\n var _this3 = this;\n\n this.getActions().forEach(function (action) {\n var event = action.event || 'click';\n action.btn['on' + event] = function (e) {\n action.result(_this3, action);\n _this3.updateActiveActions();\n };\n });\n }\n\n /**\n * Add new action to the actionbar\n * @param {Object} action\n * @param {Object} [opts={}]\n */\n\n }, {\n key: 'addAction',\n value: function addAction(action) {\n var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n var sync = opts.sync;\n var btn = document.createElement('span');\n var icon = action.icon;\n var attr = action.attributes || {};\n btn.className = this.classes.button;\n action.btn = btn;\n\n for (var key in attr) {\n btn.setAttribute(key, attr[key]);\n }\n\n if (typeof icon == 'string') {\n btn.innerHTML = icon;\n } else {\n btn.appendChild(icon);\n }\n\n this.actionbarEl().appendChild(btn);\n\n if (sync) {\n this.actions.push(action);\n this.syncActions();\n }\n }\n\n /**\n * Get the array of current actions\n * @return {Array}\n */\n\n }, {\n key: 'getActions',\n value: function getActions() {\n return this.actions;\n }\n\n /**\n * Returns the Selection instance\n * @return {Selection}\n */\n\n }, {\n key: 'selection',\n value: function selection() {\n return this.doc.getSelection();\n }\n\n /**\n * Execute the command\n * @param {string} command Command name\n * @param {any} [value=null Command's arguments\n */\n\n }, {\n key: 'exec',\n value: function exec(command) {\n var value = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n\n this.doc.execCommand(command, false, value);\n }\n\n /**\n * Get the actionbar element\n * @return {HTMLElement}\n */\n\n }, {\n key: 'actionbarEl',\n value: function actionbarEl() {\n return this.actionbar;\n }\n\n /**\n * Set custom HTML to the selection, useful as the default 'insertHTML' command\n * doesn't work in the same way on all browsers\n * @param {string} value HTML string\n */\n\n }, {\n key: 'insertHTML',\n value: function insertHTML(value) {\n var lastNode = void 0;\n var doc = this.doc;\n var sel = doc.getSelection();\n\n if (sel && sel.rangeCount) {\n var node = doc.createElement('div');\n var range = sel.getRangeAt(0);\n range.deleteContents();\n node.innerHTML = value;\n Array.prototype.slice.call(node.childNodes).forEach(function (nd) {\n range.insertNode(nd);\n lastNode = nd;\n });\n\n sel.removeAllRanges();\n sel.addRange(range);\n this.el.focus();\n }\n }\n }]);\n\n return RichTextEditor;\n}();\n\nexports.default = RichTextEditor;\n\n/***/ }),\n/* 115 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = {\n stylePrefix: 'rte-',\n\n // If true, moves the toolbar below the element when the top canvas\n // edge is reached\n adjustToolbar: 1,\n\n // Default RTE actions\n actions: ['bold', 'italic', 'underline', 'strikethrough', 'link']\n};\n\n/***/ }),\n/* 116 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = {\n stylePrefix: 'sm-',\n\n sectors: [],\n\n // Text to show in case no element selected\n textNoElement: 'Select an element before using Style Manager',\n\n // Hide the property in case it's not stylable for the\n // selected component (each component has 'stylable' property)\n hideNotStylable: true,\n\n // Highlight changed properties of the selected component\n highlightChanged: true,\n\n // Highlight computed properties of the selected component\n highlightComputed: true,\n\n // Show computed properties of the selected component, if this value\n // is set to false, highlightComputed will not take effect\n showComputed: true,\n\n // Adds the possibility to clear property value from the target style\n clearProperties: 0,\n\n // Properties not to take in account for computed styles\n avoidComputed: ['width', 'height']\n};\n\n/***/ }),\n/* 117 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar Sector = __webpack_require__(118);\n\nmodule.exports = __webpack_require__(0).Collection.extend({\n model: Sector\n});\n\n/***/ }),\n/* 118 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _underscore = __webpack_require__(1);\n\nvar Backbone = __webpack_require__(0);\nvar Properties = __webpack_require__(11);\nvar PropertyFactory = __webpack_require__(127);\n\nmodule.exports = Backbone.Model.extend({\n defaults: {\n id: '',\n name: '',\n open: true,\n buildProps: '',\n extendBuilded: 1,\n properties: []\n },\n\n initialize: function initialize(opts) {\n var o = opts || {};\n var props = [];\n var builded = this.buildProperties(o.buildProps);\n !this.get('id') && this.set('id', this.get('name'));\n\n if (!builded) props = this.get('properties');else props = this.extendProperties(builded);\n\n var propsModel = new Properties(props);\n propsModel.sector = this;\n this.set('properties', propsModel);\n },\n\n\n /**\n * Extend properties\n * @param {Array<Object>} props Start properties\n * @param {Array<Object>} moProps Model props\n * @param {Boolean} ex Returns the same amount of passed model props\n * @return {Array<Object>} Final props\n * @private\n */\n extendProperties: function extendProperties(props, moProps, ex) {\n var pLen = props.length;\n var mProps = moProps || this.get('properties');\n var ext = this.get('extendBuilded');\n var isolated = [];\n\n for (var i = 0, len = mProps.length; i < len; i++) {\n var mProp = mProps[i];\n var found = 0;\n\n for (var j = 0; j < pLen; j++) {\n var prop = props[j];\n if (mProp.property == prop.property || mProp.id == prop.property) {\n // Check for nested properties\n var mPProps = mProp.properties;\n if (mPProps && mPProps.length) {\n mProp.properties = this.extendProperties(prop.properties, mPProps, 1);\n }\n props[j] = ext ? (0, _underscore.extend)(prop, mProp) : mProp;\n isolated[j] = props[j];\n found = 1;\n continue;\n }\n }\n\n if (!found) {\n props.push(mProp);\n isolated.push(mProp);\n }\n }\n\n return ex ? isolated : props;\n },\n\n\n /**\n * Build properties\n * @param {Array<string>} propr Array of props as sting\n * @return {Array<Object>}\n * @private\n */\n buildProperties: function buildProperties(props) {\n var r;\n var buildP = props || [];\n\n if (!buildP.length) return;\n\n if (!this.propFactory) this.propFactory = new PropertyFactory();\n\n r = this.propFactory.build(buildP);\n\n return r;\n }\n});\n\n/***/ }),\n/* 119 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar Property = __webpack_require__(33);\nvar Layers = __webpack_require__(120);\n\nmodule.exports = Property.extend({\n defaults: _extends({}, Property.prototype.defaults, {\n // Array of layers (which contain properties)\n layers: [],\n\n // Layer preview\n preview: 0\n }),\n\n init: function init() {\n Property.prototype.init.apply(this, arguments);\n var layers = this.get('layers');\n var layersColl = new Layers(layers);\n layersColl.properties = this.get('properties');\n this.set('layers', layersColl);\n },\n getFullValue: function getFullValue() {\n return this.get('detached') ? '' : this.get('layers').getFullValue();\n }\n});\n\n/***/ }),\n/* 120 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Backbone) {\n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar Layer = __webpack_require__(121);\n\nmodule.exports = Backbone.Collection.extend({\n model: Layer,\n\n initialize: function initialize() {\n this.idx = 1;\n this.on('add', this.onAdd);\n this.on('reset', this.onReset);\n },\n onAdd: function onAdd(model, c, opts) {\n if (!opts.noIncrement) model.set('index', this.idx++);\n },\n onReset: function onReset() {\n this.idx = 1;\n },\n\n\n /**\n * Get layers from a value string (for not detached properties),\n * example of input:\n * `layer1Value, layer2Value, layer3Value, ...`\n * @param {string} value\n * @return {Array}\n * @private\n */\n getLayersFromValue: function getLayersFromValue(value) {\n var _this = this;\n\n var layers = [];\n // Remove spaces inside functions, eg:\n // From: 1px 1px rgba(2px, 2px, 2px), 2px 2px rgba(3px, 3px, 3px)\n // To: 1px 1px rgba(2px,2px,2px), 2px 2px rgba(3px,3px,3px)\n value.replace(/\\(([\\w\\s,.]*)\\)/g, function (match) {\n var cleaned = match.replace(/,\\s*/g, ',');\n value = value.replace(match, cleaned);\n });\n var layerValues = value ? value.split(', ') : [];\n layerValues.forEach(function (layerValue) {\n layers.push({ properties: _this.properties.parseValue(layerValue) });\n });\n return layers;\n },\n\n\n /**\n * Get layers from a style object (for detached properties),\n * example of input:\n * {\n * subPropname1: sub-propvalue11, sub-propvalue12, sub-propvalue13, ...\n * subPropname2: sub-propvalue21, sub-propvalue22, sub-propvalue23, ...\n * subPropname3: sub-propvalue31, sub-propvalue32, sub-propvalue33, ...\n * }\n * @param {Object} styleObj\n * @return {Array}\n * @private\n */\n getLayersFromStyle: function getLayersFromStyle(styleObj) {\n var layers = [];\n var properties = this.properties;\n var propNames = properties.pluck('property');\n\n properties.each(function (propModel) {\n var style = styleObj[propModel.get('property')];\n var values = style ? style.split(', ') : [];\n values.forEach(function (value, i) {\n value = propModel.parseValue(value.trim()).value;\n var layer = layers[i];\n var propertyObj = _extends({}, propModel.attributes, { value: value });\n\n if (layer) {\n layer.properties.push(propertyObj);\n } else {\n layers[i] = {\n properties: [propertyObj]\n };\n }\n });\n });\n\n // Now whit all layers in, will check missing properties\n layers.forEach(function (layer) {\n var layerProprs = layer.properties.map(function (prop) {\n return prop.property;\n });\n properties.each(function (propModel) {\n var propertyName = propModel.get('property');\n\n if (layerProprs.indexOf(propertyName) < 0) {\n layer.properties.push(_extends({}, propModel.attributes));\n }\n });\n });\n\n return layers;\n },\n active: function active(index) {\n this.each(function (layer) {\n return layer.set('active', 0);\n });\n var layer = this.at(index);\n layer && layer.set('active', 1);\n },\n getFullValue: function getFullValue() {\n var result = [];\n this.each(function (layer) {\n return result.push(layer.getFullValue());\n });\n return result.join(', ');\n },\n getPropertyValues: function getPropertyValues(property) {\n var result = [];\n this.each(function (layer) {\n var value = layer.getPropertyValue(property);\n value && result.push(value);\n });\n return result.join(', ');\n }\n});\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))\n\n/***/ }),\n/* 121 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Backbone) {\n\nmodule.exports = Backbone.Model.extend({\n defaults: {\n index: '',\n value: '',\n values: {},\n active: false,\n preview: false,\n properties: []\n },\n\n initialize: function initialize() {\n var Properties = __webpack_require__(11);\n var properties = this.get('properties');\n var value = this.get('value');\n this.set('properties', properties instanceof Properties ? properties : new Properties(properties));\n\n // If there is no value I'll try to get it from values\n // I need value setted to make preview working\n if (!value) {\n var val = '';\n var values = this.get('values');\n\n for (var prop in values) {\n val += ' ' + values[prop];\n }\n\n this.set('value', val.trim());\n }\n },\n getPropertyValue: function getPropertyValue(property) {\n var result = '';\n this.get('properties').each(function (prop) {\n if (prop.get('property') == property) {\n result = prop.getFullValue();\n }\n });\n return result;\n },\n getFullValue: function getFullValue() {\n var result = [];\n this.get('properties').each(function (prop) {\n return result.push(prop.getFullValue());\n });\n return result.join(' ');\n }\n});\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))\n\n/***/ }),\n/* 122 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Backbone) {\n\nvar _typeof = typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; };\n\n// Without jquery I have to update few stuff\n//\n// Spectrum Colorpicker v1.8.0\n// https://github.com/bgrins/spectrum\n// Author: Brian Grinstead\n// License: MIT\n\n(function (factory) {\n factory(Backbone.$);\n})(function ($, undefined) {\n 'use strict';\n\n var defaultOpts = {\n // Callbacks\n beforeShow: noop,\n move: noop,\n change: noop,\n show: noop,\n hide: noop,\n\n // Options\n color: false,\n flat: false,\n showInput: false,\n allowEmpty: false,\n showButtons: true,\n clickoutFiresChange: true,\n showInitial: false,\n showPalette: false,\n showPaletteOnly: false,\n hideAfterPaletteSelect: false,\n togglePaletteOnly: false,\n showSelectionPalette: true,\n localStorageKey: false,\n appendTo: 'body',\n maxSelectionSize: 7,\n cancelText: 'cancel',\n chooseText: 'choose',\n togglePaletteMoreText: 'more',\n togglePaletteLessText: 'less',\n clearText: 'Clear Color Selection',\n noColorSelectedText: 'No Color Selected',\n preferredFormat: false,\n className: '', // Deprecated - use containerClassName and replacerClassName instead.\n containerClassName: '',\n replacerClassName: '',\n showAlpha: false,\n theme: 'sp-light',\n palette: [['#ffffff', '#000000', '#ff0000', '#ff8000', '#ffff00', '#008000', '#0000ff', '#4b0082', '#9400d3']],\n selectionPalette: [],\n disabled: false,\n offset: null\n },\n spectrums = [],\n IE = !!/msie/i.exec(window.navigator.userAgent),\n rgbaSupport = function () {\n function contains(str, substr) {\n return !!~('' + str).indexOf(substr);\n }\n\n var elem = document.createElement('div');\n var style = elem.style;\n style.cssText = 'background-color:rgba(0,0,0,.5)';\n return contains(style.backgroundColor, 'rgba') || contains(style.backgroundColor, 'hsla');\n }(),\n replaceInput = [\"<div class='sp-replacer'>\", \"<div class='sp-preview'><div class='sp-preview-inner'></div></div>\", \"<div class='sp-dd'>▼</div>\", '</div>'].join(''),\n markup = function () {\n // IE does not support gradients with multiple stops, so we need to simulate\n // that for the rainbow slider with 8 divs that each have a single gradient\n var gradientFix = '';\n if (IE) {\n for (var i = 1; i <= 6; i++) {\n gradientFix += \"<div class='sp-\" + i + \"'></div>\";\n }\n }\n\n return [\"<div class='sp-container sp-hidden'>\", \"<div class='sp-palette-container'>\", \"<div class='sp-palette sp-thumb sp-cf'></div>\", \"<div class='sp-palette-button-container sp-cf'>\", \"<button type='button' class='sp-palette-toggle'></button>\", '</div>', '</div>', \"<div class='sp-picker-container'>\", \"<div class='sp-top sp-cf'>\", \"<div class='sp-fill'></div>\", \"<div class='sp-top-inner'>\", \"<div class='sp-color'>\", \"<div class='sp-sat'>\", \"<div class='sp-val'>\", \"<div class='sp-dragger'></div>\", '</div>', '</div>', '</div>', \"<div class='sp-clear sp-clear-display'>\", '</div>', \"<div class='sp-hue'>\", \"<div class='sp-slider'></div>\", gradientFix, '</div>', '</div>', \"<div class='sp-alpha'><div class='sp-alpha-inner'><div class='sp-alpha-handle'></div></div></div>\", '</div>', \"<div class='sp-input-container sp-cf'>\", \"<input class='sp-input' type='text' spellcheck='false' />\", '</div>', \"<div class='sp-initial sp-thumb sp-cf'></div>\", \"<div class='sp-button-container sp-cf'>\", \"<a class='sp-cancel' href='#'></a>\", \"<button type='button' class='sp-choose'></button>\", '</div>', '</div>', '</div>'].join('');\n }();\n\n function paletteTemplate(p, color, className, opts) {\n var html = [];\n for (var i = 0; i < p.length; i++) {\n var current = p[i];\n if (current) {\n var tiny = tinycolor(current);\n var c = tiny.toHsl().l < 0.5 ? 'sp-thumb-el sp-thumb-dark' : 'sp-thumb-el sp-thumb-light';\n c += tinycolor.equals(color, current) ? ' sp-thumb-active' : '';\n var formattedString = tiny.toString(opts.preferredFormat || 'rgb');\n var swatchStyle = rgbaSupport ? 'background-color:' + tiny.toRgbString() : 'filter:' + tiny.toFilter();\n html.push('<span title=\"' + formattedString + '\" data-color=\"' + tiny.toRgbString() + '\" class=\"' + c + '\"><span class=\"sp-thumb-inner\" style=\"' + swatchStyle + ';\"></span></span>');\n } else {\n var cls = 'sp-clear-display';\n html.push($('<div />').append($('<span data-color=\"\" style=\"background-color:transparent;\" class=\"' + cls + '\"></span>').attr('title', opts.noColorSelectedText)).html());\n }\n }\n return \"<div class='sp-cf \" + className + \"'>\" + html.join('') + '</div>';\n }\n\n function hideAll() {\n for (var i = 0; i < spectrums.length; i++) {\n if (spectrums[i]) {\n spectrums[i].hide();\n }\n }\n }\n\n function instanceOptions(o, callbackContext) {\n var opts = $.extend({}, defaultOpts, o);\n opts.callbacks = {\n move: bind(opts.move, callbackContext),\n change: bind(opts.change, callbackContext),\n show: bind(opts.show, callbackContext),\n hide: bind(opts.hide, callbackContext),\n beforeShow: bind(opts.beforeShow, callbackContext)\n };\n return opts;\n }\n\n function spectrum(element, o) {\n var opts = instanceOptions(o, element),\n flat = opts.flat,\n showSelectionPalette = opts.showSelectionPalette,\n localStorageKey = opts.localStorageKey,\n theme = opts.theme,\n callbacks = opts.callbacks,\n resize = throttle(reflow, 10),\n visible = false,\n isDragging = false,\n dragWidth = 0,\n dragHeight = 0,\n dragHelperHeight = 0,\n slideHeight = 0,\n slideWidth = 0,\n alphaWidth = 0,\n alphaSlideHelperWidth = 0,\n slideHelperHeight = 0,\n currentHue = 0,\n currentSaturation = 0,\n currentValue = 0,\n currentAlpha = 1,\n palette = [],\n paletteArray = [],\n paletteLookup = {},\n selectionPalette = opts.selectionPalette.slice(0),\n maxSelectionSize = opts.maxSelectionSize,\n draggingClass = 'sp-dragging',\n shiftMovementDirection = null;\n\n var doc = element.ownerDocument,\n body = doc.body,\n boundElement = $(element),\n disabled = false,\n container = $(markup, doc).addClass(theme),\n pickerContainer = container.find('.sp-picker-container'),\n dragger = container.find('.sp-color'),\n dragHelper = container.find('.sp-dragger'),\n slider = container.find('.sp-hue'),\n slideHelper = container.find('.sp-slider'),\n alphaSliderInner = container.find('.sp-alpha-inner'),\n alphaSlider = container.find('.sp-alpha'),\n alphaSlideHelper = container.find('.sp-alpha-handle'),\n textInput = container.find('.sp-input'),\n paletteContainer = container.find('.sp-palette'),\n initialColorContainer = container.find('.sp-initial'),\n cancelButton = container.find('.sp-cancel'),\n clearButton = container.find('.sp-clear'),\n chooseButton = container.find('.sp-choose'),\n toggleButton = container.find('.sp-palette-toggle'),\n isInput = boundElement.is('input'),\n isInputTypeColor = isInput && boundElement.attr('type') === 'color' && inputTypeColorSupport(),\n shouldReplace = isInput && !flat,\n replacer = shouldReplace ? $(replaceInput).addClass(theme).addClass(opts.className).addClass(opts.replacerClassName) : $([]),\n offsetElement = shouldReplace ? replacer : boundElement,\n previewElement = replacer.find('.sp-preview-inner'),\n initialColor = opts.color || isInput && boundElement.val(),\n colorOnShow = false,\n currentPreferredFormat = opts.preferredFormat,\n clickoutFiresChange = !opts.showButtons || opts.clickoutFiresChange,\n isEmpty = !initialColor,\n allowEmpty = opts.allowEmpty && !isInputTypeColor;\n\n function applyOptions() {\n if (opts.showPaletteOnly) {\n opts.showPalette = true;\n }\n\n toggleButton.text(opts.showPaletteOnly ? opts.togglePaletteMoreText : opts.togglePaletteLessText);\n\n if (opts.palette) {\n palette = opts.palette.slice(0);\n paletteArray = $.isArray(palette[0]) ? palette : [palette];\n paletteLookup = {};\n for (var i = 0; i < paletteArray.length; i++) {\n for (var j = 0; j < paletteArray[i].length; j++) {\n var rgb = tinycolor(paletteArray[i][j]).toRgbString();\n paletteLookup[rgb] = true;\n }\n }\n }\n\n container.toggleClass('sp-flat', flat);\n container.toggleClass('sp-input-disabled', !opts.showInput);\n container.toggleClass('sp-alpha-enabled', opts.showAlpha);\n container.toggleClass('sp-clear-enabled', allowEmpty);\n container.toggleClass('sp-buttons-disabled', !opts.showButtons);\n container.toggleClass('sp-palette-buttons-disabled', !opts.togglePaletteOnly);\n container.toggleClass('sp-palette-disabled', !opts.showPalette);\n container.toggleClass('sp-palette-only', opts.showPaletteOnly);\n container.toggleClass('sp-initial-disabled', !opts.showInitial);\n container.addClass(opts.className).addClass(opts.containerClassName);\n\n reflow();\n }\n\n function initialize() {\n if (IE) {\n container.find('*:not(input)').attr('unselectable', 'on');\n }\n\n applyOptions();\n\n if (shouldReplace) {\n boundElement.after(replacer).hide();\n }\n\n if (!allowEmpty) {\n clearButton.hide();\n }\n\n if (flat) {\n boundElement.after(container).hide();\n } else {\n var appendTo = opts.appendTo === 'parent' ? boundElement.parent() : $(opts.appendTo);\n if (appendTo.length !== 1) {\n appendTo = $('body');\n }\n\n appendTo.append(container);\n }\n\n updateSelectionPaletteFromStorage();\n\n offsetElement.bind('click.spectrum touchstart.spectrum', function (e) {\n if (!disabled) {\n toggle();\n }\n\n e.stopPropagation();\n\n if (!$(e.target).is('input')) {\n e.preventDefault();\n }\n });\n\n if (boundElement.is(':disabled') || opts.disabled === true) {\n disable();\n }\n\n // Prevent clicks from bubbling up to document. This would cause it to be hidden.\n container.click(stopPropagation);\n\n // Handle user typed input\n textInput.change(setFromTextInput);\n textInput.bind('paste', function () {\n setTimeout(setFromTextInput, 1);\n });\n textInput.keydown(function (e) {\n if (e.keyCode == 13) {\n setFromTextInput();\n }\n });\n\n cancelButton.text(opts.cancelText);\n cancelButton.bind('click.spectrum', function (e) {\n e.stopPropagation();\n e.preventDefault();\n revert();\n hide();\n });\n\n clearButton.attr('title', opts.clearText);\n clearButton.bind('click.spectrum', function (e) {\n e.stopPropagation();\n e.preventDefault();\n isEmpty = true;\n move();\n\n if (flat) {\n //for the flat style, this is a change event\n updateOriginalInput(true);\n }\n });\n\n chooseButton.text(opts.chooseText);\n chooseButton.bind('click.spectrum', function (e) {\n e.stopPropagation();\n e.preventDefault();\n\n if (IE && textInput.is(':focus')) {\n textInput.trigger('change');\n }\n\n if (isValid()) {\n updateOriginalInput(true);\n hide();\n }\n });\n\n toggleButton.text(opts.showPaletteOnly ? opts.togglePaletteMoreText : opts.togglePaletteLessText);\n toggleButton.bind('click.spectrum', function (e) {\n e.stopPropagation();\n e.preventDefault();\n\n opts.showPaletteOnly = !opts.showPaletteOnly;\n\n // To make sure the Picker area is drawn on the right, next to the\n // Palette area (and not below the palette), first move the Palette\n // to the left to make space for the picker, plus 5px extra.\n // The 'applyOptions' function puts the whole container back into place\n // and takes care of the button-text and the sp-palette-only CSS class.\n if (!opts.showPaletteOnly && !flat) {\n container.css('left', '-=' + (pickerContainer.outerWidth(true) + 5));\n }\n applyOptions();\n });\n\n draggable(alphaSlider, function (dragX, dragY, e) {\n currentAlpha = dragX / alphaWidth;\n isEmpty = false;\n if (e.shiftKey) {\n currentAlpha = Math.round(currentAlpha * 10) / 10;\n }\n\n move();\n }, dragStart, dragStop);\n\n draggable(slider, function (dragX, dragY) {\n currentHue = parseFloat(dragY / slideHeight);\n isEmpty = false;\n if (!opts.showAlpha) {\n currentAlpha = 1;\n }\n move();\n }, dragStart, dragStop);\n\n draggable(dragger, function (dragX, dragY, e) {\n // shift+drag should snap the movement to either the x or y axis.\n if (!e.shiftKey) {\n shiftMovementDirection = null;\n } else if (!shiftMovementDirection) {\n var oldDragX = currentSaturation * dragWidth;\n var oldDragY = dragHeight - currentValue * dragHeight;\n var furtherFromX = Math.abs(dragX - oldDragX) > Math.abs(dragY - oldDragY);\n\n shiftMovementDirection = furtherFromX ? 'x' : 'y';\n }\n\n var setSaturation = !shiftMovementDirection || shiftMovementDirection === 'x';\n var setValue = !shiftMovementDirection || shiftMovementDirection === 'y';\n\n if (setSaturation) {\n currentSaturation = parseFloat(dragX / dragWidth);\n }\n if (setValue) {\n currentValue = parseFloat((dragHeight - dragY) / dragHeight);\n }\n\n isEmpty = false;\n if (!opts.showAlpha) {\n currentAlpha = 1;\n }\n\n move();\n }, dragStart, dragStop);\n\n if (!!initialColor) {\n _set(initialColor);\n\n // In case color was black - update the preview UI and set the format\n // since the set function will not run (default color is black).\n updateUI();\n currentPreferredFormat = opts.preferredFormat || tinycolor(initialColor).format;\n\n addColorToSelectionPalette(initialColor);\n } else {\n updateUI();\n }\n\n if (flat) {\n show();\n }\n\n function paletteElementClick(e) {\n if (e.data && e.data.ignore) {\n _set($(e.target).closest('.sp-thumb-el').data('color'));\n move();\n } else {\n _set($(e.target).closest('.sp-thumb-el').data('color'));\n move();\n updateOriginalInput(true);\n if (opts.hideAfterPaletteSelect) {\n hide();\n }\n }\n\n return false;\n }\n\n var paletteEvent = IE ? 'mousedown.spectrum' : 'click.spectrum touchstart.spectrum';\n paletteContainer.delegate('.sp-thumb-el', paletteEvent, paletteElementClick);\n initialColorContainer.delegate('.sp-thumb-el:nth-child(1)', paletteEvent, { ignore: true }, paletteElementClick);\n }\n\n function updateSelectionPaletteFromStorage() {\n if (localStorageKey && window.localStorage) {\n // Migrate old palettes over to new format. May want to remove this eventually.\n try {\n var oldPalette = window.localStorage[localStorageKey].split(',#');\n if (oldPalette.length > 1) {\n delete window.localStorage[localStorageKey];\n $.each(oldPalette, function (i, c) {\n addColorToSelectionPalette(c);\n });\n }\n } catch (e) {}\n\n try {\n selectionPalette = window.localStorage[localStorageKey].split(';');\n } catch (e) {}\n }\n }\n\n function addColorToSelectionPalette(color) {\n if (showSelectionPalette) {\n var rgb = tinycolor(color).toRgbString();\n if (!paletteLookup[rgb] && $.inArray(rgb, selectionPalette) === -1) {\n selectionPalette.push(rgb);\n while (selectionPalette.length > maxSelectionSize) {\n selectionPalette.shift();\n }\n }\n\n if (localStorageKey && window.localStorage) {\n try {\n window.localStorage[localStorageKey] = selectionPalette.join(';');\n } catch (e) {}\n }\n }\n }\n\n function getUniqueSelectionPalette() {\n var unique = [];\n if (opts.showPalette) {\n for (var i = 0; i < selectionPalette.length; i++) {\n var rgb = tinycolor(selectionPalette[i]).toRgbString();\n\n if (!paletteLookup[rgb]) {\n unique.push(selectionPalette[i]);\n }\n }\n }\n\n return unique.reverse().slice(0, opts.maxSelectionSize);\n }\n\n function drawPalette() {\n var currentColor = get();\n\n var html = $.map(paletteArray, function (palette, i) {\n return paletteTemplate(palette, currentColor, 'sp-palette-row sp-palette-row-' + i, opts);\n });\n\n updateSelectionPaletteFromStorage();\n\n if (selectionPalette) {\n html.push(paletteTemplate(getUniqueSelectionPalette(), currentColor, 'sp-palette-row sp-palette-row-selection', opts));\n }\n\n paletteContainer.html(html.join(''));\n }\n\n function drawInitial() {\n if (opts.showInitial) {\n var initial = colorOnShow;\n var current = get();\n initialColorContainer.html(paletteTemplate([initial, current], current, 'sp-palette-row-initial', opts));\n }\n }\n\n function dragStart() {\n if (dragHeight <= 0 || dragWidth <= 0 || slideHeight <= 0) {\n reflow();\n }\n isDragging = true;\n container.addClass(draggingClass);\n shiftMovementDirection = null;\n boundElement.trigger('dragstart.spectrum', [get()]);\n }\n\n function dragStop() {\n isDragging = false;\n container.removeClass(draggingClass);\n boundElement.trigger('dragstop.spectrum', [get()]);\n }\n\n function setFromTextInput() {\n var value = textInput.val();\n\n if ((value === null || value === '') && allowEmpty) {\n _set(null);\n updateOriginalInput(true);\n } else {\n var tiny = tinycolor(value);\n if (tiny.isValid()) {\n _set(tiny);\n updateOriginalInput(true);\n } else {\n textInput.addClass('sp-validation-error');\n }\n }\n }\n\n function toggle() {\n if (visible) {\n hide();\n } else {\n show();\n }\n }\n\n function show() {\n var event = $.Event('beforeShow.spectrum');\n\n if (visible) {\n reflow();\n return;\n }\n\n boundElement.trigger(event, [get()]);\n\n if (callbacks.beforeShow(get()) === false || event.isDefaultPrevented()) {\n return;\n }\n\n hideAll();\n visible = true;\n\n var $doc = $(doc);\n $doc.bind('keydown.spectrum', onkeydown);\n $doc.bind('click.spectrum', clickout);\n $(window).bind('resize.spectrum', resize);\n replacer.addClass('sp-active');\n container.removeClass('sp-hidden');\n\n reflow();\n updateUI();\n\n colorOnShow = get();\n\n drawInitial();\n callbacks.show(colorOnShow);\n boundElement.trigger('show.spectrum', [colorOnShow]);\n }\n\n function onkeydown(e) {\n // Close on ESC\n if (e.keyCode === 27) {\n hide();\n }\n }\n\n function clickout(e) {\n // Return on right click.\n if (e.button == 2) {\n return;\n }\n\n // If a drag event was happening during the mouseup, don't hide\n // on click.\n if (isDragging) {\n return;\n }\n\n if (clickoutFiresChange) {\n updateOriginalInput(true);\n } else {\n revert();\n }\n hide();\n }\n\n function hide() {\n // Return if hiding is unnecessary\n if (!visible || flat) {\n return;\n }\n visible = false;\n\n $(doc).unbind('keydown.spectrum', onkeydown);\n $(doc).unbind('click.spectrum', clickout);\n $(window).unbind('resize.spectrum', resize);\n\n replacer.removeClass('sp-active');\n container.addClass('sp-hidden');\n\n callbacks.hide(get());\n boundElement.trigger('hide.spectrum', [get()]);\n }\n\n function revert() {\n _set(colorOnShow, true);\n }\n\n function _set(color, ignoreFormatChange) {\n if (tinycolor.equals(color, get())) {\n // Update UI just in case a validation error needs\n // to be cleared.\n updateUI();\n return;\n }\n\n var newColor, newHsv;\n if (!color && allowEmpty) {\n isEmpty = true;\n } else {\n isEmpty = false;\n newColor = tinycolor(color);\n newHsv = newColor.toHsv();\n\n currentHue = newHsv.h % 360 / 360;\n currentSaturation = newHsv.s;\n currentValue = newHsv.v;\n currentAlpha = newHsv.a;\n }\n updateUI();\n\n if (newColor && newColor.isValid() && !ignoreFormatChange) {\n currentPreferredFormat = opts.preferredFormat || newColor.getFormat();\n }\n }\n\n function get(opts) {\n opts = opts || {};\n\n if (allowEmpty && isEmpty) {\n return null;\n }\n\n return tinycolor.fromRatio({\n h: currentHue,\n s: currentSaturation,\n v: currentValue,\n a: Math.round(currentAlpha * 100) / 100\n }, { format: opts.format || currentPreferredFormat });\n }\n\n function isValid() {\n return !textInput.hasClass('sp-validation-error');\n }\n\n function move() {\n updateUI();\n\n callbacks.move(get());\n boundElement.trigger('move.spectrum', [get()]);\n }\n\n function updateUI() {\n textInput.removeClass('sp-validation-error');\n\n updateHelperLocations();\n\n // Update dragger background color (gradients take care of saturation and value).\n var flatColor = tinycolor.fromRatio({ h: currentHue, s: 1, v: 1 });\n dragger.css('background-color', flatColor.toHexString());\n\n // Get a format that alpha will be included in (hex and names ignore alpha)\n var format = currentPreferredFormat;\n if (currentAlpha < 1 && !(currentAlpha === 0 && format === 'name')) {\n if (format === 'hex' || format === 'hex3' || format === 'hex6' || format === 'name') {\n format = 'rgb';\n }\n }\n\n var realColor = get({ format: format }),\n displayColor = '';\n\n //reset background info for preview element\n previewElement.removeClass('sp-clear-display');\n previewElement.css('background-color', 'transparent');\n\n if (!realColor && allowEmpty) {\n // Update the replaced elements background with icon indicating no color selection\n previewElement.addClass('sp-clear-display');\n } else {\n var realHex = realColor.toHexString(),\n realRgb = realColor.toRgbString();\n\n // Update the replaced elements background color (with actual selected color)\n if (rgbaSupport || realColor.alpha === 1) {\n previewElement.css('background-color', realRgb);\n } else {\n previewElement.css('background-color', 'transparent');\n previewElement.css('filter', realColor.toFilter());\n }\n\n if (opts.showAlpha) {\n var rgb = realColor.toRgb();\n rgb.a = 0;\n var realAlpha = tinycolor(rgb).toRgbString();\n var gradient = 'linear-gradient(left, ' + realAlpha + ', ' + realHex + ')';\n\n if (IE) {\n alphaSliderInner.css('filter', tinycolor(realAlpha).toFilter({ gradientType: 1 }, realHex));\n } else {\n alphaSliderInner.css('background', '-webkit-' + gradient);\n alphaSliderInner.css('background', '-moz-' + gradient);\n alphaSliderInner.css('background', '-ms-' + gradient);\n // Use current syntax gradient on unprefixed property.\n alphaSliderInner.css('background', 'linear-gradient(to right, ' + realAlpha + ', ' + realHex + ')');\n }\n }\n\n displayColor = realColor.toString(format);\n }\n\n // Update the text entry input as it changes happen\n if (opts.showInput) {\n textInput.val(displayColor);\n }\n\n if (opts.showPalette) {\n drawPalette();\n }\n\n drawInitial();\n }\n\n function updateHelperLocations() {\n var s = currentSaturation;\n var v = currentValue;\n\n if (allowEmpty && isEmpty) {\n //if selected color is empty, hide the helpers\n alphaSlideHelper.hide();\n slideHelper.hide();\n dragHelper.hide();\n } else {\n //make sure helpers are visible\n alphaSlideHelper.show();\n slideHelper.show();\n dragHelper.show();\n\n // Where to show the little circle in that displays your current selected color\n var dragX = s * dragWidth;\n var dragY = dragHeight - v * dragHeight;\n dragX = Math.max(-dragHelperHeight, Math.min(dragWidth - dragHelperHeight, dragX - dragHelperHeight));\n dragY = Math.max(-dragHelperHeight, Math.min(dragHeight - dragHelperHeight, dragY - dragHelperHeight));\n dragHelper.css({\n top: dragY + 'px',\n left: dragX + 'px'\n });\n\n var alphaX = currentAlpha * alphaWidth;\n alphaSlideHelper.css({\n left: alphaX - alphaSlideHelperWidth / 2 + 'px'\n });\n\n // Where to show the bar that displays your current selected hue\n var slideY = currentHue * slideHeight;\n slideHelper.css({\n top: slideY - slideHelperHeight + 'px'\n });\n }\n }\n\n function updateOriginalInput(fireCallback) {\n var color = get(),\n displayColor = '',\n hasChanged = !tinycolor.equals(color, colorOnShow);\n\n if (color) {\n displayColor = color.toString(currentPreferredFormat);\n // Update the selection palette with the current color\n addColorToSelectionPalette(color);\n }\n\n if (isInput) {\n boundElement.val(displayColor);\n }\n\n if (fireCallback && hasChanged) {\n callbacks.change(color);\n boundElement.trigger('change', [color]);\n }\n }\n\n function reflow() {\n if (!visible) {\n return; // Calculations would be useless and wouldn't be reliable anyways\n }\n dragWidth = dragger.width();\n dragHeight = dragger.height();\n dragHelperHeight = dragHelper.height();\n slideWidth = slider.width();\n slideHeight = slider.height();\n slideHelperHeight = slideHelper.height();\n alphaWidth = alphaSlider.width();\n alphaSlideHelperWidth = alphaSlideHelper.width();\n\n if (!flat) {\n container.css('position', 'absolute');\n if (opts.offset) {\n container.offset(opts.offset);\n } else {\n container.offset(getOffset(container, offsetElement));\n }\n }\n\n updateHelperLocations();\n\n if (opts.showPalette) {\n drawPalette();\n }\n\n boundElement.trigger('reflow.spectrum');\n }\n\n function destroy() {\n boundElement.show();\n offsetElement.unbind('click.spectrum touchstart.spectrum');\n container.remove();\n replacer.remove();\n spectrums[spect.id] = null;\n }\n\n function option(optionName, optionValue) {\n if (optionName === undefined) {\n return $.extend({}, opts);\n }\n if (optionValue === undefined) {\n return opts[optionName];\n }\n\n opts[optionName] = optionValue;\n\n if (optionName === 'preferredFormat') {\n currentPreferredFormat = opts.preferredFormat;\n }\n applyOptions();\n }\n\n function enable() {\n disabled = false;\n boundElement.attr('disabled', false);\n offsetElement.removeClass('sp-disabled');\n }\n\n function disable() {\n hide();\n disabled = true;\n boundElement.attr('disabled', true);\n offsetElement.addClass('sp-disabled');\n }\n\n function setOffset(coord) {\n opts.offset = coord;\n reflow();\n }\n\n initialize();\n\n var spect = {\n show: show,\n hide: hide,\n toggle: toggle,\n reflow: reflow,\n option: option,\n enable: enable,\n disable: disable,\n offset: setOffset,\n set: function set(c) {\n _set(c);\n updateOriginalInput();\n },\n get: get,\n destroy: destroy,\n container: container\n };\n\n spect.id = spectrums.push(spect) - 1;\n\n return spect;\n }\n\n /**\n * checkOffset - get the offset below/above and left/right element depending on screen position\n * Thanks https://github.com/jquery/jquery-ui/blob/master/ui/jquery.ui.datepicker.js\n */\n function getOffset(picker, input) {\n var extraY = 0;\n var dpWidth = picker.outerWidth();\n var dpHeight = picker.outerHeight();\n var inputHeight = input.outerHeight();\n var doc = picker[0].ownerDocument;\n var docElem = doc.documentElement;\n var cW = docElem.clientWidth;\n var cH = docElem.clientHeight;\n var scL = $(doc).scrollLeft();\n var scT = $(doc).scrollTop();\n var viewWidth = cW + scL;\n var viewHeight = cH + scT;\n var offset = input.offset();\n\n offset.top += inputHeight;\n\n offset.left -= Math.min(offset.left, offset.left + dpWidth > viewWidth && viewWidth > dpWidth ? Math.abs(offset.left + dpWidth - viewWidth) : 0);\n\n offset.top -= Math.min(offset.top, offset.top + dpHeight > viewHeight && viewHeight > dpHeight ? Math.abs(dpHeight + inputHeight - extraY) : extraY);\n\n return offset;\n }\n\n /**\n * noop - do nothing\n */\n function noop() {}\n\n /**\n * stopPropagation - makes the code only doing this a little easier to read in line\n */\n function stopPropagation(e) {\n e.stopPropagation();\n }\n\n /**\n * Create a function bound to a given object\n * Thanks to underscore.js\n */\n function bind(func, obj) {\n var slice = Array.prototype.slice;\n var args = slice.call(arguments, 2);\n return function () {\n return func.apply(obj, args.concat(slice.call(arguments)));\n };\n }\n\n /**\n * Lightweight drag helper. Handles containment within the element, so that\n * when dragging, the x is within [0,element.width] and y is within [0,element.height]\n */\n function draggable(element, onmove, onstart, onstop) {\n onmove = onmove || function () {};\n onstart = onstart || function () {};\n onstop = onstop || function () {};\n var doc = document;\n var dragging = false;\n var offset = {};\n var maxHeight = 0;\n var maxWidth = 0;\n var hasTouch = 'ontouchstart' in window;\n\n var duringDragEvents = {};\n duringDragEvents['selectstart'] = prevent;\n duringDragEvents['dragstart'] = prevent;\n duringDragEvents['touchmove mousemove'] = move;\n duringDragEvents['touchend mouseup'] = stop;\n\n function prevent(e) {\n if (e.stopPropagation) {\n e.stopPropagation();\n }\n if (e.preventDefault) {\n e.preventDefault();\n }\n e.returnValue = false;\n }\n\n function move(e) {\n if (dragging) {\n // Mouseup happened outside of window\n if (IE && doc.documentMode < 9 && !e.button) {\n return stop();\n }\n\n var t0 = e.originalEvent && e.originalEvent.touches && e.originalEvent.touches[0];\n var pageX = t0 && t0.pageX || e.pageX;\n var pageY = t0 && t0.pageY || e.pageY;\n\n var dragX = Math.max(0, Math.min(pageX - offset.left, maxWidth));\n var dragY = Math.max(0, Math.min(pageY - offset.top, maxHeight));\n\n if (hasTouch) {\n // Stop scrolling in iOS\n prevent(e);\n }\n\n onmove.apply(element, [dragX, dragY, e]);\n }\n }\n\n function start(e) {\n var rightclick = e.which ? e.which == 3 : e.button == 2;\n\n if (!rightclick && !dragging) {\n if (onstart.apply(element, arguments) !== false) {\n dragging = true;\n maxHeight = $(element).height();\n maxWidth = $(element).width();\n offset = $(element).offset();\n\n $(doc).bind(duringDragEvents);\n $(doc.body).addClass('sp-dragging');\n\n move(e);\n\n prevent(e);\n }\n }\n }\n\n function stop() {\n if (dragging) {\n $(doc).unbind(duringDragEvents);\n $(doc.body).removeClass('sp-dragging');\n\n // Wait a tick before notifying observers to allow the click event\n // to fire in Chrome.\n setTimeout(function () {\n onstop.apply(element, arguments);\n }, 0);\n }\n dragging = false;\n }\n\n $(element).bind('touchstart mousedown', start);\n }\n\n function throttle(func, wait, debounce) {\n var timeout;\n return function () {\n var context = this,\n args = arguments;\n var throttler = function throttler() {\n timeout = null;\n func.apply(context, args);\n };\n if (debounce) clearTimeout(timeout);\n if (debounce || !timeout) timeout = setTimeout(throttler, wait);\n };\n }\n\n function inputTypeColorSupport() {\n return $.fn.spectrum.inputTypeColorSupport();\n }\n\n /**\n * Define a jQuery plugin\n */\n var dataID = 'spectrum.id';\n $.fn.spectrum = function (opts, extra) {\n if (typeof opts == 'string') {\n var returnValue = this;\n var args = Array.prototype.slice.call(arguments, 1);\n\n this.each(function () {\n var spect = spectrums[$(this).data(dataID)];\n if (spect) {\n var method = spect[opts];\n if (!method) {\n throw new Error(\"Spectrum: no such method: '\" + opts + \"'\");\n }\n\n if (opts == 'get') {\n returnValue = spect.get();\n } else if (opts == 'container') {\n returnValue = spect.container;\n } else if (opts == 'option') {\n returnValue = spect.option.apply(spect, args);\n } else if (opts == 'destroy') {\n spect.destroy();\n $(this).removeData(dataID);\n } else {\n method.apply(spect, args);\n }\n }\n });\n\n return returnValue;\n }\n\n // Initializing a new instance of spectrum\n return this.spectrum('destroy').each(function () {\n var options = $.extend({}, opts, $(this).data());\n var spect = spectrum(this, options);\n $(this).data(dataID, spect.id);\n });\n };\n\n $.fn.spectrum.load = true;\n $.fn.spectrum.loadOpts = {};\n $.fn.spectrum.draggable = draggable;\n $.fn.spectrum.defaults = defaultOpts;\n $.fn.spectrum.inputTypeColorSupport = function inputTypeColorSupport() {\n if (typeof inputTypeColorSupport._cachedResult === 'undefined') {\n var colorInput = $(\"<input type='color'/>\")[0]; // if color element is supported, value will default to not null\n inputTypeColorSupport._cachedResult = colorInput.type === 'color' && colorInput.value !== '';\n }\n return inputTypeColorSupport._cachedResult;\n };\n\n $.spectrum = {};\n $.spectrum.localization = {};\n $.spectrum.palettes = {};\n\n $.fn.spectrum.processNativeColorInputs = function () {\n var colorInputs = $('input[type=color]');\n if (colorInputs.length && !inputTypeColorSupport()) {\n colorInputs.spectrum({\n preferredFormat: 'hex6'\n });\n }\n };\n\n // TinyColor v1.1.2\n // https://github.com/bgrins/TinyColor\n // Brian Grinstead, MIT License\n\n //(function() {\n\n var trimLeft = /^[\\s,#]+/,\n trimRight = /\\s+$/,\n tinyCounter = 0,\n math = Math,\n mathRound = math.round,\n mathMin = math.min,\n mathMax = math.max,\n mathRandom = math.random;\n\n var tinycolor = function tinycolor(color, opts) {\n color = color ? color : '';\n opts = opts || {};\n\n // If input is already a tinycolor, return itself\n if (color instanceof tinycolor) {\n return color;\n }\n // If we are called as a function, call using new instead\n if (!(this instanceof tinycolor)) {\n return new tinycolor(color, opts);\n }\n\n var rgb = inputToRGB(color);\n this._originalInput = color, this._r = rgb.r, this._g = rgb.g, this._b = rgb.b, this._a = rgb.a, this._roundA = mathRound(100 * this._a) / 100, this._format = opts.format || rgb.format;\n this._gradientType = opts.gradientType;\n\n // Don't let the range of [0,255] come back in [0,1].\n // Potentially lose a little bit of precision here, but will fix issues where\n // .5 gets interpreted as half of the total, instead of half of 1\n // If it was supposed to be 128, this was already taken care of by `inputToRgb`\n if (this._r < 1) {\n this._r = mathRound(this._r);\n }\n if (this._g < 1) {\n this._g = mathRound(this._g);\n }\n if (this._b < 1) {\n this._b = mathRound(this._b);\n }\n\n this._ok = rgb.ok;\n this._tc_id = tinyCounter++;\n };\n\n tinycolor.prototype = {\n isDark: function isDark() {\n return this.getBrightness() < 128;\n },\n isLight: function isLight() {\n return !this.isDark();\n },\n isValid: function isValid() {\n return this._ok;\n },\n getOriginalInput: function getOriginalInput() {\n return this._originalInput;\n },\n getFormat: function getFormat() {\n return this._format;\n },\n getAlpha: function getAlpha() {\n return this._a;\n },\n getBrightness: function getBrightness() {\n var rgb = this.toRgb();\n return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000;\n },\n setAlpha: function setAlpha(value) {\n this._a = boundAlpha(value);\n this._roundA = mathRound(100 * this._a) / 100;\n return this;\n },\n toHsv: function toHsv() {\n var hsv = rgbToHsv(this._r, this._g, this._b);\n return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this._a };\n },\n toHsvString: function toHsvString() {\n var hsv = rgbToHsv(this._r, this._g, this._b);\n var h = mathRound(hsv.h * 360),\n s = mathRound(hsv.s * 100),\n v = mathRound(hsv.v * 100);\n return this._a == 1 ? 'hsv(' + h + ', ' + s + '%, ' + v + '%)' : 'hsva(' + h + ', ' + s + '%, ' + v + '%, ' + this._roundA + ')';\n },\n toHsl: function toHsl() {\n var hsl = rgbToHsl(this._r, this._g, this._b);\n return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this._a };\n },\n toHslString: function toHslString() {\n var hsl = rgbToHsl(this._r, this._g, this._b);\n var h = mathRound(hsl.h * 360),\n s = mathRound(hsl.s * 100),\n l = mathRound(hsl.l * 100);\n return this._a == 1 ? 'hsl(' + h + ', ' + s + '%, ' + l + '%)' : 'hsla(' + h + ', ' + s + '%, ' + l + '%, ' + this._roundA + ')';\n },\n toHex: function toHex(allow3Char) {\n return rgbToHex(this._r, this._g, this._b, allow3Char);\n },\n toHexString: function toHexString(allow3Char) {\n return '#' + this.toHex(allow3Char);\n },\n toHex8: function toHex8() {\n return rgbaToHex(this._r, this._g, this._b, this._a);\n },\n toHex8String: function toHex8String() {\n return '#' + this.toHex8();\n },\n toRgb: function toRgb() {\n return {\n r: mathRound(this._r),\n g: mathRound(this._g),\n b: mathRound(this._b),\n a: this._a\n };\n },\n toRgbString: function toRgbString() {\n return this._a == 1 ? 'rgb(' + mathRound(this._r) + ', ' + mathRound(this._g) + ', ' + mathRound(this._b) + ')' : 'rgba(' + mathRound(this._r) + ', ' + mathRound(this._g) + ', ' + mathRound(this._b) + ', ' + this._roundA + ')';\n },\n toPercentageRgb: function toPercentageRgb() {\n return {\n r: mathRound(bound01(this._r, 255) * 100) + '%',\n g: mathRound(bound01(this._g, 255) * 100) + '%',\n b: mathRound(bound01(this._b, 255) * 100) + '%',\n a: this._a\n };\n },\n toPercentageRgbString: function toPercentageRgbString() {\n return this._a == 1 ? 'rgb(' + mathRound(bound01(this._r, 255) * 100) + '%, ' + mathRound(bound01(this._g, 255) * 100) + '%, ' + mathRound(bound01(this._b, 255) * 100) + '%)' : 'rgba(' + mathRound(bound01(this._r, 255) * 100) + '%, ' + mathRound(bound01(this._g, 255) * 100) + '%, ' + mathRound(bound01(this._b, 255) * 100) + '%, ' + this._roundA + ')';\n },\n toName: function toName() {\n if (this._a === 0) {\n return 'transparent';\n }\n\n if (this._a < 1) {\n return false;\n }\n\n return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false;\n },\n toFilter: function toFilter(secondColor) {\n var hex8String = '#' + rgbaToHex(this._r, this._g, this._b, this._a);\n var secondHex8String = hex8String;\n var gradientType = this._gradientType ? 'GradientType = 1, ' : '';\n\n if (secondColor) {\n var s = tinycolor(secondColor);\n secondHex8String = s.toHex8String();\n }\n\n return 'progid:DXImageTransform.Microsoft.gradient(' + gradientType + 'startColorstr=' + hex8String + ',endColorstr=' + secondHex8String + ')';\n },\n toString: function toString(format) {\n var formatSet = !!format;\n format = format || this._format;\n\n var formattedString = false;\n var hasAlpha = this._a < 1 && this._a >= 0;\n var needsAlphaFormat = !formatSet && hasAlpha && (format === 'hex' || format === 'hex6' || format === 'hex3' || format === 'name');\n\n if (needsAlphaFormat) {\n // Special case for \"transparent\", all other non-alpha formats\n // will return rgba when there is transparency.\n if (format === 'name' && this._a === 0) {\n return this.toName();\n }\n return this.toRgbString();\n }\n if (format === 'rgb') {\n formattedString = this.toRgbString();\n }\n if (format === 'prgb') {\n formattedString = this.toPercentageRgbString();\n }\n if (format === 'hex' || format === 'hex6') {\n formattedString = this.toHexString();\n }\n if (format === 'hex3') {\n formattedString = this.toHexString(true);\n }\n if (format === 'hex8') {\n formattedString = this.toHex8String();\n }\n if (format === 'name') {\n formattedString = this.toName();\n }\n if (format === 'hsl') {\n formattedString = this.toHslString();\n }\n if (format === 'hsv') {\n formattedString = this.toHsvString();\n }\n\n return formattedString || this.toHexString();\n },\n\n _applyModification: function _applyModification(fn, args) {\n var color = fn.apply(null, [this].concat([].slice.call(args)));\n this._r = color._r;\n this._g = color._g;\n this._b = color._b;\n this.setAlpha(color._a);\n return this;\n },\n lighten: function lighten() {\n return this._applyModification(_lighten, arguments);\n },\n brighten: function brighten() {\n return this._applyModification(_brighten, arguments);\n },\n darken: function darken() {\n return this._applyModification(_darken, arguments);\n },\n desaturate: function desaturate() {\n return this._applyModification(_desaturate, arguments);\n },\n saturate: function saturate() {\n return this._applyModification(_saturate, arguments);\n },\n greyscale: function greyscale() {\n return this._applyModification(_greyscale, arguments);\n },\n spin: function spin() {\n return this._applyModification(_spin, arguments);\n },\n\n _applyCombination: function _applyCombination(fn, args) {\n return fn.apply(null, [this].concat([].slice.call(args)));\n },\n analogous: function analogous() {\n return this._applyCombination(_analogous, arguments);\n },\n complement: function complement() {\n return this._applyCombination(_complement, arguments);\n },\n monochromatic: function monochromatic() {\n return this._applyCombination(_monochromatic, arguments);\n },\n splitcomplement: function splitcomplement() {\n return this._applyCombination(_splitcomplement, arguments);\n },\n triad: function triad() {\n return this._applyCombination(_triad, arguments);\n },\n tetrad: function tetrad() {\n return this._applyCombination(_tetrad, arguments);\n }\n };\n\n // If input is an object, force 1 into \"1.0\" to handle ratios properly\n // String input requires \"1.0\" as input, so 1 will be treated as 1\n tinycolor.fromRatio = function (color, opts) {\n if ((typeof color === 'undefined' ? 'undefined' : _typeof(color)) == 'object') {\n var newColor = {};\n for (var i in color) {\n if (color.hasOwnProperty(i)) {\n if (i === 'a') {\n newColor[i] = color[i];\n } else {\n newColor[i] = convertToPercentage(color[i]);\n }\n }\n }\n color = newColor;\n }\n\n return tinycolor(color, opts);\n };\n\n // Given a string or object, convert that input to RGB\n // Possible string inputs:\n //\n // \"red\"\n // \"#f00\" or \"f00\"\n // \"#ff0000\" or \"ff0000\"\n // \"#ff000000\" or \"ff000000\"\n // \"rgb 255 0 0\" or \"rgb (255, 0, 0)\"\n // \"rgb 1.0 0 0\" or \"rgb (1, 0, 0)\"\n // \"rgba (255, 0, 0, 1)\" or \"rgba 255, 0, 0, 1\"\n // \"rgba (1.0, 0, 0, 1)\" or \"rgba 1.0, 0, 0, 1\"\n // \"hsl(0, 100%, 50%)\" or \"hsl 0 100% 50%\"\n // \"hsla(0, 100%, 50%, 1)\" or \"hsla 0 100% 50%, 1\"\n // \"hsv(0, 100%, 100%)\" or \"hsv 0 100% 100%\"\n //\n function inputToRGB(color) {\n var rgb = { r: 0, g: 0, b: 0 };\n var a = 1;\n var ok = false;\n var format = false;\n\n if (typeof color == 'string') {\n color = stringInputToObject(color);\n }\n\n if ((typeof color === 'undefined' ? 'undefined' : _typeof(color)) == 'object') {\n if (color.hasOwnProperty('r') && color.hasOwnProperty('g') && color.hasOwnProperty('b')) {\n rgb = rgbToRgb(color.r, color.g, color.b);\n ok = true;\n format = String(color.r).substr(-1) === '%' ? 'prgb' : 'rgb';\n } else if (color.hasOwnProperty('h') && color.hasOwnProperty('s') && color.hasOwnProperty('v')) {\n color.s = convertToPercentage(color.s);\n color.v = convertToPercentage(color.v);\n rgb = hsvToRgb(color.h, color.s, color.v);\n ok = true;\n format = 'hsv';\n } else if (color.hasOwnProperty('h') && color.hasOwnProperty('s') && color.hasOwnProperty('l')) {\n color.s = convertToPercentage(color.s);\n color.l = convertToPercentage(color.l);\n rgb = hslToRgb(color.h, color.s, color.l);\n ok = true;\n format = 'hsl';\n }\n\n if (color.hasOwnProperty('a')) {\n a = color.a;\n }\n }\n\n a = boundAlpha(a);\n\n return {\n ok: ok,\n format: color.format || format,\n r: mathMin(255, mathMax(rgb.r, 0)),\n g: mathMin(255, mathMax(rgb.g, 0)),\n b: mathMin(255, mathMax(rgb.b, 0)),\n a: a\n };\n }\n\n // Conversion Functions\n // --------------------\n\n // `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from:\n // <http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript>\n\n // `rgbToRgb`\n // Handle bounds / percentage checking to conform to CSS color spec\n // <http://www.w3.org/TR/css3-color/>\n // *Assumes:* r, g, b in [0, 255] or [0, 1]\n // *Returns:* { r, g, b } in [0, 255]\n function rgbToRgb(r, g, b) {\n return {\n r: bound01(r, 255) * 255,\n g: bound01(g, 255) * 255,\n b: bound01(b, 255) * 255\n };\n }\n\n // `rgbToHsl`\n // Converts an RGB color value to HSL.\n // *Assumes:* r, g, and b are contained in [0, 255] or [0, 1]\n // *Returns:* { h, s, l } in [0,1]\n function rgbToHsl(r, g, b) {\n r = bound01(r, 255);\n g = bound01(g, 255);\n b = bound01(b, 255);\n\n var max = mathMax(r, g, b),\n min = mathMin(r, g, b);\n var h,\n s,\n l = (max + min) / 2;\n\n if (max == min) {\n h = s = 0; // achromatic\n } else {\n var d = max - min;\n s = l > 0.5 ? d / (2 - max - min) : d / (max + min);\n switch (max) {\n case r:\n h = (g - b) / d + (g < b ? 6 : 0);\n break;\n case g:\n h = (b - r) / d + 2;\n break;\n case b:\n h = (r - g) / d + 4;\n break;\n }\n\n h /= 6;\n }\n\n return { h: h, s: s, l: l };\n }\n\n // `hslToRgb`\n // Converts an HSL color value to RGB.\n // *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100]\n // *Returns:* { r, g, b } in the set [0, 255]\n function hslToRgb(h, s, l) {\n var r, g, b;\n\n h = bound01(h, 360);\n s = bound01(s, 100);\n l = bound01(l, 100);\n\n function hue2rgb(p, q, t) {\n if (t < 0) t += 1;\n if (t > 1) t -= 1;\n if (t < 1 / 6) return p + (q - p) * 6 * t;\n if (t < 1 / 2) return q;\n if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;\n return p;\n }\n\n if (s === 0) {\n r = g = b = l; // achromatic\n } else {\n var q = l < 0.5 ? l * (1 + s) : l + s - l * s;\n var p = 2 * l - q;\n r = hue2rgb(p, q, h + 1 / 3);\n g = hue2rgb(p, q, h);\n b = hue2rgb(p, q, h - 1 / 3);\n }\n\n return { r: r * 255, g: g * 255, b: b * 255 };\n }\n\n // `rgbToHsv`\n // Converts an RGB color value to HSV\n // *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1]\n // *Returns:* { h, s, v } in [0,1]\n function rgbToHsv(r, g, b) {\n r = bound01(r, 255);\n g = bound01(g, 255);\n b = bound01(b, 255);\n\n var max = mathMax(r, g, b),\n min = mathMin(r, g, b);\n var h,\n s,\n v = max;\n\n var d = max - min;\n s = max === 0 ? 0 : d / max;\n\n if (max == min) {\n h = 0; // achromatic\n } else {\n switch (max) {\n case r:\n h = (g - b) / d + (g < b ? 6 : 0);\n break;\n case g:\n h = (b - r) / d + 2;\n break;\n case b:\n h = (r - g) / d + 4;\n break;\n }\n h /= 6;\n }\n return { h: h, s: s, v: v };\n }\n\n // `hsvToRgb`\n // Converts an HSV color value to RGB.\n // *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100]\n // *Returns:* { r, g, b } in the set [0, 255]\n function hsvToRgb(h, s, v) {\n h = bound01(h, 360) * 6;\n s = bound01(s, 100);\n v = bound01(v, 100);\n\n var i = math.floor(h),\n f = h - i,\n p = v * (1 - s),\n q = v * (1 - f * s),\n t = v * (1 - (1 - f) * s),\n mod = i % 6,\n r = [v, q, p, p, t, v][mod],\n g = [t, v, v, q, p, p][mod],\n b = [p, p, t, v, v, q][mod];\n\n return { r: r * 255, g: g * 255, b: b * 255 };\n }\n\n // `rgbToHex`\n // Converts an RGB color to hex\n // Assumes r, g, and b are contained in the set [0, 255]\n // Returns a 3 or 6 character hex\n function rgbToHex(r, g, b, allow3Char) {\n var hex = [pad2(mathRound(r).toString(16)), pad2(mathRound(g).toString(16)), pad2(mathRound(b).toString(16))];\n\n // Return a 3 character hex if possible\n if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {\n return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);\n }\n\n return hex.join('');\n }\n // `rgbaToHex`\n // Converts an RGBA color plus alpha transparency to hex\n // Assumes r, g, b and a are contained in the set [0, 255]\n // Returns an 8 character hex\n function rgbaToHex(r, g, b, a) {\n var hex = [pad2(convertDecimalToHex(a)), pad2(mathRound(r).toString(16)), pad2(mathRound(g).toString(16)), pad2(mathRound(b).toString(16))];\n\n return hex.join('');\n }\n\n // `equals`\n // Can be called with any tinycolor input\n tinycolor.equals = function (color1, color2) {\n if (!color1 || !color2) {\n return false;\n }\n return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString();\n };\n tinycolor.random = function () {\n return tinycolor.fromRatio({\n r: mathRandom(),\n g: mathRandom(),\n b: mathRandom()\n });\n };\n\n // Modification Functions\n // ----------------------\n // Thanks to less.js for some of the basics here\n // <https://github.com/cloudhead/less.js/blob/master/lib/less/functions.js>\n\n function _desaturate(color, amount) {\n amount = amount === 0 ? 0 : amount || 10;\n var hsl = tinycolor(color).toHsl();\n hsl.s -= amount / 100;\n hsl.s = clamp01(hsl.s);\n return tinycolor(hsl);\n }\n\n function _saturate(color, amount) {\n amount = amount === 0 ? 0 : amount || 10;\n var hsl = tinycolor(color).toHsl();\n hsl.s += amount / 100;\n hsl.s = clamp01(hsl.s);\n return tinycolor(hsl);\n }\n\n function _greyscale(color) {\n return tinycolor(color).desaturate(100);\n }\n\n function _lighten(color, amount) {\n amount = amount === 0 ? 0 : amount || 10;\n var hsl = tinycolor(color).toHsl();\n hsl.l += amount / 100;\n hsl.l = clamp01(hsl.l);\n return tinycolor(hsl);\n }\n\n function _brighten(color, amount) {\n amount = amount === 0 ? 0 : amount || 10;\n var rgb = tinycolor(color).toRgb();\n rgb.r = mathMax(0, mathMin(255, rgb.r - mathRound(255 * -(amount / 100))));\n rgb.g = mathMax(0, mathMin(255, rgb.g - mathRound(255 * -(amount / 100))));\n rgb.b = mathMax(0, mathMin(255, rgb.b - mathRound(255 * -(amount / 100))));\n return tinycolor(rgb);\n }\n\n function _darken(color, amount) {\n amount = amount === 0 ? 0 : amount || 10;\n var hsl = tinycolor(color).toHsl();\n hsl.l -= amount / 100;\n hsl.l = clamp01(hsl.l);\n return tinycolor(hsl);\n }\n\n // Spin takes a positive or negative amount within [-360, 360] indicating the change of hue.\n // Values outside of this range will be wrapped into this range.\n function _spin(color, amount) {\n var hsl = tinycolor(color).toHsl();\n var hue = (mathRound(hsl.h) + amount) % 360;\n hsl.h = hue < 0 ? 360 + hue : hue;\n return tinycolor(hsl);\n }\n\n // Combination Functions\n // ---------------------\n // Thanks to jQuery xColor for some of the ideas behind these\n // <https://github.com/infusion/jQuery-xcolor/blob/master/jquery.xcolor.js>\n\n function _complement(color) {\n var hsl = tinycolor(color).toHsl();\n hsl.h = (hsl.h + 180) % 360;\n return tinycolor(hsl);\n }\n\n function _triad(color) {\n var hsl = tinycolor(color).toHsl();\n var h = hsl.h;\n return [tinycolor(color), tinycolor({ h: (h + 120) % 360, s: hsl.s, l: hsl.l }), tinycolor({ h: (h + 240) % 360, s: hsl.s, l: hsl.l })];\n }\n\n function _tetrad(color) {\n var hsl = tinycolor(color).toHsl();\n var h = hsl.h;\n return [tinycolor(color), tinycolor({ h: (h + 90) % 360, s: hsl.s, l: hsl.l }), tinycolor({ h: (h + 180) % 360, s: hsl.s, l: hsl.l }), tinycolor({ h: (h + 270) % 360, s: hsl.s, l: hsl.l })];\n }\n\n function _splitcomplement(color) {\n var hsl = tinycolor(color).toHsl();\n var h = hsl.h;\n return [tinycolor(color), tinycolor({ h: (h + 72) % 360, s: hsl.s, l: hsl.l }), tinycolor({ h: (h + 216) % 360, s: hsl.s, l: hsl.l })];\n }\n\n function _analogous(color, results, slices) {\n results = results || 6;\n slices = slices || 30;\n\n var hsl = tinycolor(color).toHsl();\n var part = 360 / slices;\n var ret = [tinycolor(color)];\n\n for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results;) {\n hsl.h = (hsl.h + part) % 360;\n ret.push(tinycolor(hsl));\n }\n return ret;\n }\n\n function _monochromatic(color, results) {\n results = results || 6;\n var hsv = tinycolor(color).toHsv();\n var h = hsv.h,\n s = hsv.s,\n v = hsv.v;\n var ret = [];\n var modification = 1 / results;\n\n while (results--) {\n ret.push(tinycolor({ h: h, s: s, v: v }));\n v = (v + modification) % 1;\n }\n\n return ret;\n }\n\n // Utility Functions\n // ---------------------\n\n tinycolor.mix = function (color1, color2, amount) {\n amount = amount === 0 ? 0 : amount || 50;\n\n var rgb1 = tinycolor(color1).toRgb();\n var rgb2 = tinycolor(color2).toRgb();\n\n var p = amount / 100;\n var w = p * 2 - 1;\n var a = rgb2.a - rgb1.a;\n\n var w1;\n\n if (w * a == -1) {\n w1 = w;\n } else {\n w1 = (w + a) / (1 + w * a);\n }\n\n w1 = (w1 + 1) / 2;\n\n var w2 = 1 - w1;\n\n var rgba = {\n r: rgb2.r * w1 + rgb1.r * w2,\n g: rgb2.g * w1 + rgb1.g * w2,\n b: rgb2.b * w1 + rgb1.b * w2,\n a: rgb2.a * p + rgb1.a * (1 - p)\n };\n\n return tinycolor(rgba);\n };\n\n // Readability Functions\n // ---------------------\n // <http://www.w3.org/TR/AERT#color-contrast>\n\n // `readability`\n // Analyze the 2 colors and returns an object with the following properties:\n // `brightness`: difference in brightness between the two colors\n // `color`: difference in color/hue between the two colors\n tinycolor.readability = function (color1, color2) {\n var c1 = tinycolor(color1);\n var c2 = tinycolor(color2);\n var rgb1 = c1.toRgb();\n var rgb2 = c2.toRgb();\n var brightnessA = c1.getBrightness();\n var brightnessB = c2.getBrightness();\n var colorDiff = Math.max(rgb1.r, rgb2.r) - Math.min(rgb1.r, rgb2.r) + Math.max(rgb1.g, rgb2.g) - Math.min(rgb1.g, rgb2.g) + Math.max(rgb1.b, rgb2.b) - Math.min(rgb1.b, rgb2.b);\n\n return {\n brightness: Math.abs(brightnessA - brightnessB),\n color: colorDiff\n };\n };\n\n // `readable`\n // http://www.w3.org/TR/AERT#color-contrast\n // Ensure that foreground and background color combinations provide sufficient contrast.\n // *Example*\n // tinycolor.isReadable(\"#000\", \"#111\") => false\n tinycolor.isReadable = function (color1, color2) {\n var readability = tinycolor.readability(color1, color2);\n return readability.brightness > 125 && readability.color > 500;\n };\n\n // `mostReadable`\n // Given a base color and a list of possible foreground or background\n // colors for that base, returns the most readable color.\n // *Example*\n // tinycolor.mostReadable(\"#123\", [\"#fff\", \"#000\"]) => \"#000\"\n tinycolor.mostReadable = function (baseColor, colorList) {\n var bestColor = null;\n var bestScore = 0;\n var bestIsReadable = false;\n for (var i = 0; i < colorList.length; i++) {\n // We normalize both around the \"acceptable\" breaking point,\n // but rank brightness constrast higher than hue.\n\n var readability = tinycolor.readability(baseColor, colorList[i]);\n var readable = readability.brightness > 125 && readability.color > 500;\n var score = 3 * (readability.brightness / 125) + readability.color / 500;\n\n if (readable && !bestIsReadable || readable && bestIsReadable && score > bestScore || !readable && !bestIsReadable && score > bestScore) {\n bestIsReadable = readable;\n bestScore = score;\n bestColor = tinycolor(colorList[i]);\n }\n }\n return bestColor;\n };\n\n // Big List of Colors\n // ------------------\n // <http://www.w3.org/TR/css3-color/#svg-color>\n var names = tinycolor.names = {\n aliceblue: 'f0f8ff',\n antiquewhite: 'faebd7',\n aqua: '0ff',\n aquamarine: '7fffd4',\n azure: 'f0ffff',\n beige: 'f5f5dc',\n bisque: 'ffe4c4',\n black: '000',\n blanchedalmond: 'ffebcd',\n blue: '00f',\n blueviolet: '8a2be2',\n brown: 'a52a2a',\n burlywood: 'deb887',\n burntsienna: 'ea7e5d',\n cadetblue: '5f9ea0',\n chartreuse: '7fff00',\n chocolate: 'd2691e',\n coral: 'ff7f50',\n cornflowerblue: '6495ed',\n cornsilk: 'fff8dc',\n crimson: 'dc143c',\n cyan: '0ff',\n darkblue: '00008b',\n darkcyan: '008b8b',\n darkgoldenrod: 'b8860b',\n darkgray: 'a9a9a9',\n darkgreen: '006400',\n darkgrey: 'a9a9a9',\n darkkhaki: 'bdb76b',\n darkmagenta: '8b008b',\n darkolivegreen: '556b2f',\n darkorange: 'ff8c00',\n darkorchid: '9932cc',\n darkred: '8b0000',\n darksalmon: 'e9967a',\n darkseagreen: '8fbc8f',\n darkslateblue: '483d8b',\n darkslategray: '2f4f4f',\n darkslategrey: '2f4f4f',\n darkturquoise: '00ced1',\n darkviolet: '9400d3',\n deeppink: 'ff1493',\n deepskyblue: '00bfff',\n dimgray: '696969',\n dimgrey: '696969',\n dodgerblue: '1e90ff',\n firebrick: 'b22222',\n floralwhite: 'fffaf0',\n forestgreen: '228b22',\n fuchsia: 'f0f',\n gainsboro: 'dcdcdc',\n ghostwhite: 'f8f8ff',\n gold: 'ffd700',\n goldenrod: 'daa520',\n gray: '808080',\n green: '008000',\n greenyellow: 'adff2f',\n grey: '808080',\n honeydew: 'f0fff0',\n hotpink: 'ff69b4',\n indianred: 'cd5c5c',\n indigo: '4b0082',\n ivory: 'fffff0',\n khaki: 'f0e68c',\n lavender: 'e6e6fa',\n lavenderblush: 'fff0f5',\n lawngreen: '7cfc00',\n lemonchiffon: 'fffacd',\n lightblue: 'add8e6',\n lightcoral: 'f08080',\n lightcyan: 'e0ffff',\n lightgoldenrodyellow: 'fafad2',\n lightgray: 'd3d3d3',\n lightgreen: '90ee90',\n lightgrey: 'd3d3d3',\n lightpink: 'ffb6c1',\n lightsalmon: 'ffa07a',\n lightseagreen: '20b2aa',\n lightskyblue: '87cefa',\n lightslategray: '789',\n lightslategrey: '789',\n lightsteelblue: 'b0c4de',\n lightyellow: 'ffffe0',\n lime: '0f0',\n limegreen: '32cd32',\n linen: 'faf0e6',\n magenta: 'f0f',\n maroon: '800000',\n mediumaquamarine: '66cdaa',\n mediumblue: '0000cd',\n mediumorchid: 'ba55d3',\n mediumpurple: '9370db',\n mediumseagreen: '3cb371',\n mediumslateblue: '7b68ee',\n mediumspringgreen: '00fa9a',\n mediumturquoise: '48d1cc',\n mediumvioletred: 'c71585',\n midnightblue: '191970',\n mintcream: 'f5fffa',\n mistyrose: 'ffe4e1',\n moccasin: 'ffe4b5',\n navajowhite: 'ffdead',\n navy: '000080',\n oldlace: 'fdf5e6',\n olive: '808000',\n olivedrab: '6b8e23',\n orange: 'ffa500',\n orangered: 'ff4500',\n orchid: 'da70d6',\n palegoldenrod: 'eee8aa',\n palegreen: '98fb98',\n paleturquoise: 'afeeee',\n palevioletred: 'db7093',\n papayawhip: 'ffefd5',\n peachpuff: 'ffdab9',\n peru: 'cd853f',\n pink: 'ffc0cb',\n plum: 'dda0dd',\n powderblue: 'b0e0e6',\n purple: '800080',\n rebeccapurple: '663399',\n red: 'f00',\n rosybrown: 'bc8f8f',\n royalblue: '4169e1',\n saddlebrown: '8b4513',\n salmon: 'fa8072',\n sandybrown: 'f4a460',\n seagreen: '2e8b57',\n seashell: 'fff5ee',\n sienna: 'a0522d',\n silver: 'c0c0c0',\n skyblue: '87ceeb',\n slateblue: '6a5acd',\n slategray: '708090',\n slategrey: '708090',\n snow: 'fffafa',\n springgreen: '00ff7f',\n steelblue: '4682b4',\n tan: 'd2b48c',\n teal: '008080',\n thistle: 'd8bfd8',\n tomato: 'ff6347',\n turquoise: '40e0d0',\n violet: 'ee82ee',\n wheat: 'f5deb3',\n white: 'fff',\n whitesmoke: 'f5f5f5',\n yellow: 'ff0',\n yellowgreen: '9acd32'\n };\n\n // Make it easy to access colors via `hexNames[hex]`\n var hexNames = tinycolor.hexNames = flip(names);\n\n // Utilities\n // ---------\n\n // `{ 'name1': 'val1' }` becomes `{ 'val1': 'name1' }`\n function flip(o) {\n var flipped = {};\n for (var i in o) {\n if (o.hasOwnProperty(i)) {\n flipped[o[i]] = i;\n }\n }\n return flipped;\n }\n\n // Return a valid alpha value [0,1] with all invalid values being set to 1\n function boundAlpha(a) {\n a = parseFloat(a);\n\n if (isNaN(a) || a < 0 || a > 1) {\n a = 1;\n }\n\n return a;\n }\n\n // Take input from [0, n] and return it as [0, 1]\n function bound01(n, max) {\n if (isOnePointZero(n)) {\n n = '100%';\n }\n\n var processPercent = isPercentage(n);\n n = mathMin(max, mathMax(0, parseFloat(n)));\n\n // Automatically convert percentage into number\n if (processPercent) {\n n = parseInt(n * max, 10) / 100;\n }\n\n // Handle floating point rounding errors\n if (math.abs(n - max) < 0.000001) {\n return 1;\n }\n\n // Convert into [0, 1] range if it isn't already\n return n % max / parseFloat(max);\n }\n\n // Force a number between 0 and 1\n function clamp01(val) {\n return mathMin(1, mathMax(0, val));\n }\n\n // Parse a base-16 hex value into a base-10 integer\n function parseIntFromHex(val) {\n return parseInt(val, 16);\n }\n\n // Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1\n // <http://stackoverflow.com/questions/7422072/javascript-how-to-detect-number-as-a-decimal-including-1-0>\n function isOnePointZero(n) {\n return typeof n == 'string' && n.indexOf('.') != -1 && parseFloat(n) === 1;\n }\n\n // Check to see if string passed in is a percentage\n function isPercentage(n) {\n return typeof n === 'string' && n.indexOf('%') != -1;\n }\n\n // Force a hex value to have 2 characters\n function pad2(c) {\n return c.length == 1 ? '0' + c : '' + c;\n }\n\n // Replace a decimal with it's percentage value\n function convertToPercentage(n) {\n if (n <= 1) {\n n = n * 100 + '%';\n }\n\n return n;\n }\n\n // Converts a decimal to a hex value\n function convertDecimalToHex(d) {\n return Math.round(parseFloat(d) * 255).toString(16);\n }\n // Converts a hex value to a decimal\n function convertHexToDecimal(h) {\n return parseIntFromHex(h) / 255;\n }\n\n var matchers = function () {\n // <http://www.w3.org/TR/css3-values/#integers>\n var CSS_INTEGER = '[-\\\\+]?\\\\d+%?';\n\n // <http://www.w3.org/TR/css3-values/#number-value>\n var CSS_NUMBER = '[-\\\\+]?\\\\d*\\\\.\\\\d+%?';\n\n // Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome.\n var CSS_UNIT = '(?:' + CSS_NUMBER + ')|(?:' + CSS_INTEGER + ')';\n\n // Actual matching.\n // Parentheses and commas are optional, but not required.\n // Whitespace can take the place of commas or opening paren\n var PERMISSIVE_MATCH3 = '[\\\\s|\\\\(]+(' + CSS_UNIT + ')[,|\\\\s]+(' + CSS_UNIT + ')[,|\\\\s]+(' + CSS_UNIT + ')\\\\s*\\\\)?';\n var PERMISSIVE_MATCH4 = '[\\\\s|\\\\(]+(' + CSS_UNIT + ')[,|\\\\s]+(' + CSS_UNIT + ')[,|\\\\s]+(' + CSS_UNIT + ')[,|\\\\s]+(' + CSS_UNIT + ')\\\\s*\\\\)?';\n\n return {\n rgb: new RegExp('rgb' + PERMISSIVE_MATCH3),\n rgba: new RegExp('rgba' + PERMISSIVE_MATCH4),\n hsl: new RegExp('hsl' + PERMISSIVE_MATCH3),\n hsla: new RegExp('hsla' + PERMISSIVE_MATCH4),\n hsv: new RegExp('hsv' + PERMISSIVE_MATCH3),\n hsva: new RegExp('hsva' + PERMISSIVE_MATCH4),\n hex3: /^([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,\n hex6: /^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,\n hex8: /^([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/\n };\n }();\n\n // `stringInputToObject`\n // Permissive string parsing. Take in a number of formats, and output an object\n // based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}`\n function stringInputToObject(color) {\n color = color.replace(trimLeft, '').replace(trimRight, '').toLowerCase();\n var named = false;\n if (names[color]) {\n color = names[color];\n named = true;\n } else if (color == 'transparent') {\n return { r: 0, g: 0, b: 0, a: 0, format: 'name' };\n }\n\n // Try to match string input using regular expressions.\n // Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360]\n // Just return an object and let the conversion functions handle that.\n // This way the result will be the same whether the tinycolor is initialized with string or object.\n var match;\n if (match = matchers.rgb.exec(color)) {\n return { r: match[1], g: match[2], b: match[3] };\n }\n if (match = matchers.rgba.exec(color)) {\n return { r: match[1], g: match[2], b: match[3], a: match[4] };\n }\n if (match = matchers.hsl.exec(color)) {\n return { h: match[1], s: match[2], l: match[3] };\n }\n if (match = matchers.hsla.exec(color)) {\n return { h: match[1], s: match[2], l: match[3], a: match[4] };\n }\n if (match = matchers.hsv.exec(color)) {\n return { h: match[1], s: match[2], v: match[3] };\n }\n if (match = matchers.hsva.exec(color)) {\n return { h: match[1], s: match[2], v: match[3], a: match[4] };\n }\n if (match = matchers.hex8.exec(color)) {\n return {\n a: convertHexToDecimal(match[1]),\n r: parseIntFromHex(match[2]),\n g: parseIntFromHex(match[3]),\n b: parseIntFromHex(match[4]),\n format: named ? 'name' : 'hex8'\n };\n }\n if (match = matchers.hex6.exec(color)) {\n return {\n r: parseIntFromHex(match[1]),\n g: parseIntFromHex(match[2]),\n b: parseIntFromHex(match[3]),\n format: named ? 'name' : 'hex'\n };\n }\n if (match = matchers.hex3.exec(color)) {\n return {\n r: parseIntFromHex(match[1] + '' + match[1]),\n g: parseIntFromHex(match[2] + '' + match[2]),\n b: parseIntFromHex(match[3] + '' + match[3]),\n format: named ? 'name' : 'hex'\n };\n }\n\n return false;\n }\n\n window.tinycolor = tinycolor;\n //})();\n\n $(function () {\n if ($.fn.spectrum.load) {\n $.fn.spectrum.processNativeColorInputs();\n }\n });\n});\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))\n\n/***/ }),\n/* 123 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar Backbone = __webpack_require__(0);\nvar LayerView = __webpack_require__(124);\n\nmodule.exports = Backbone.View.extend({\n initialize: function initialize(o) {\n this.config = o.config || {};\n this.stackModel = o.stackModel;\n this.preview = o.preview;\n this.pfx = this.config.stylePrefix || '';\n this.ppfx = this.config.pStylePrefix || '';\n this.propsConfig = o.propsConfig;\n var pfx = this.pfx;\n var ppfx = this.ppfx;\n var collection = this.collection;\n this.className = pfx + 'layers ' + ppfx + 'field';\n this.listenTo(collection, 'add', this.addTo);\n this.listenTo(collection, 'deselectAll', this.deselectAll);\n this.listenTo(collection, 'reset', this.render);\n\n var em = this.config.em || '';\n var utils = em ? em.get('Utils') : '';\n\n this.sorter = utils ? new utils.Sorter({\n container: this.el,\n ignoreViewChildren: 1,\n containerSel: '.' + pfx + 'layers',\n itemSel: '.' + pfx + 'layer',\n pfx: this.config.pStylePrefix\n }) : '';\n\n // For the Sorter\n collection.view = this;\n this.$el.data('model', collection);\n this.$el.data('collection', collection);\n },\n\n\n /**\n * Add to collection\n * @param Object Model\n *\n * @return Object\n * */\n addTo: function addTo(model) {\n var i = this.collection.indexOf(model);\n this.addToCollection(model, null, i);\n },\n\n\n /**\n * Add new object to collection\n * @param Object Model\n * @param Object Fragment collection\n * @param {number} index Index of append\n *\n * @return Object Object created\n * */\n addToCollection: function addToCollection(model, fragmentEl, index) {\n var fragment = fragmentEl || null;\n var stackModel = this.stackModel;\n var config = this.config;\n var sorter = this.sorter;\n var propsConfig = this.propsConfig;\n\n if (typeof this.preview !== 'undefined') {\n model.set('preview', this.preview);\n }\n\n var view = new LayerView({\n model: model,\n config: config,\n sorter: sorter,\n stackModel: stackModel,\n propsConfig: propsConfig\n });\n var rendered = view.render().el;\n\n if (fragment) {\n fragment.appendChild(rendered);\n } else {\n if (typeof index != 'undefined') {\n var method = 'before';\n // If the added model is the last of collection\n // need to change the logic of append\n if (this.$el.children().length == index) {\n index--;\n method = 'after';\n }\n // In case the added is new in the collection index will be -1\n if (index < 0) {\n this.$el.append(rendered);\n } else this.$el.children().eq(index)[method](rendered);\n } else this.$el.append(rendered);\n }\n\n return rendered;\n },\n\n\n /**\n * Deselect all\n *\n * @return void\n * */\n deselectAll: function deselectAll() {\n this.$el.find('.' + this.pfx + 'layer').removeClass(this.pfx + 'active');\n },\n render: function render() {\n var fragment = document.createDocumentFragment();\n this.$el.empty();\n\n this.collection.each(function (model) {\n this.addToCollection(model, fragment);\n }, this);\n\n this.$el.append(fragment);\n this.$el.attr('class', this.className);\n\n if (this.sorter) this.sorter.plh = null;\n\n return this;\n }\n});\n\n/***/ }),\n/* 124 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Backbone) {\n\nmodule.exports = Backbone.View.extend({\n events: {\n click: 'active',\n 'click [data-close-layer]': 'remove',\n 'mousedown [data-move-layer]': 'initSorter'\n },\n\n template: function template(model) {\n var pfx = this.pfx;\n var label = 'Layer ' + model.get('index');\n\n return '\\n <div id=\"' + pfx + 'move\" data-move-layer>\\n <i class=\"fa fa-arrows\"></i>\\n </div>\\n <div id=\"' + pfx + 'label\">' + label + '</div>\\n <div id=\"' + pfx + 'preview-box\">\\n \\t<div id=\"' + pfx + 'preview\" data-preview></div>\\n </div>\\n <div id=\"' + pfx + 'close-layer\" class=\"' + pfx + 'btn-close\" data-close-layer>\\n ⨯\\n </div>\\n <div id=\"' + pfx + 'inputs\" data-properties></div>\\n <div style=\"clear:both\"></div>\\n ';\n },\n initialize: function initialize() {\n var o = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n var model = this.model;\n this.stackModel = o.stackModel || {};\n this.config = o.config || {};\n this.pfx = this.config.stylePrefix || '';\n this.sorter = o.sorter || null;\n this.propsConfig = o.propsConfig || {};\n this.customPreview = o.onPreview;\n this.listenTo(model, 'destroy remove', this.remove);\n this.listenTo(model, 'change:active', this.updateVisibility);\n this.listenTo(model.get('properties'), 'change', this.updatePreview);\n\n if (!model.get('preview')) {\n this.$el.addClass(this.pfx + 'no-preview');\n }\n\n // For the sorter\n model.view = this;\n model.set({ droppable: 0, draggable: 1 });\n this.$el.data('model', model);\n },\n\n\n /**\n * Delegate sorting\n * @param {Event} e\n * */\n initSorter: function initSorter(e) {\n if (this.sorter) this.sorter.startSort(this.el);\n },\n remove: function remove(e) {\n if (e && e.stopPropagation) e.stopPropagation();\n\n var model = this.model;\n var collection = model.collection;\n var stackModel = this.stackModel;\n\n Backbone.View.prototype.remove.apply(this, arguments);\n\n if (collection.contains(model)) {\n collection.remove(model);\n }\n\n if (stackModel && stackModel.set) {\n stackModel.set({ stackIndex: null }, { silent: true });\n stackModel.trigger('updateValue');\n }\n },\n\n\n /**\n * Default method for changing preview box\n * @param {Collection} props\n * @param {Element} $el\n */\n onPreview: function onPreview(value) {\n var values = value.split(' ');\n var lim = 3;\n var result = [];\n this.model.get('properties').each(function (prop, index) {\n var value = values[index] || '';\n\n if (value) {\n if (prop.get('type') == 'integer') {\n var valueInt = parseInt(value, 10);\n var unit = value.replace(valueInt, '');\n valueInt = !isNaN(valueInt) ? valueInt : 0;\n valueInt = valueInt > lim ? lim : valueInt;\n valueInt = valueInt < -lim ? -lim : valueInt;\n value = valueInt + unit;\n }\n }\n\n result.push(value);\n });\n\n return result.join(' ');\n },\n updatePreview: function updatePreview() {\n var stackModel = this.stackModel;\n var customPreview = this.customPreview;\n var previewEl = this.getPreviewEl();\n var value = this.model.getFullValue();\n var preview = customPreview ? customPreview(value) : this.onPreview(value);\n\n if (preview && stackModel && previewEl) {\n previewEl.style[stackModel.get('property')] = preview;\n }\n },\n getPropertiesWrapper: function getPropertiesWrapper() {\n if (!this.propsWrapEl) {\n this.propsWrapEl = this.el.querySelector('[data-properties]');\n }\n return this.propsWrapEl;\n },\n getPreviewEl: function getPreviewEl() {\n if (!this.previewEl) {\n this.previewEl = this.el.querySelector('[data-preview]');\n }\n return this.previewEl;\n },\n active: function active() {\n var model = this.model;\n var collection = model.collection;\n collection.active(collection.indexOf(model));\n },\n updateVisibility: function updateVisibility() {\n var pfx = this.pfx;\n var wrapEl = this.getPropertiesWrapper();\n var active = this.model.get('active');\n wrapEl.style.display = active ? '' : 'none';\n this.$el[active ? 'addClass' : 'removeClass'](pfx + 'active');\n },\n render: function render() {\n var PropertiesView = __webpack_require__(13);\n var propsConfig = this.propsConfig;\n var className = this.pfx + 'layer';\n var model = this.model;\n var el = this.el;\n var properties = new PropertiesView({\n collection: model.get('properties'),\n config: this.config,\n target: propsConfig.target,\n customValue: propsConfig.customValue,\n propTarget: propsConfig.propTarget,\n onChange: propsConfig.onChange\n }).render().el;\n el.innerHTML = this.template(model);\n el.className = className;\n this.getPropertiesWrapper().appendChild(properties);\n this.updateVisibility();\n this.updatePreview();\n return this;\n }\n});\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))\n\n/***/ }),\n/* 125 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar Property = __webpack_require__(42);\n\nmodule.exports = Property.extend({\n defaults: _extends({}, Property.prototype.defaults, {\n showInput: 1\n })\n});\n\n/***/ }),\n/* 126 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar Property = __webpack_require__(14);\n\nmodule.exports = Property.extend({\n events: {\n 'change [type=range]': 'inputValueChanged',\n 'input [type=range]': 'inputValueChangedSoft'\n },\n\n templateInput: function templateInput(model) {\n var ppfx = this.ppfx;\n return '\\n <div class=\"' + ppfx + 'field ' + ppfx + 'field-range\">\\n <input type=\"range\"\\n min=\"' + model.get('min') + '\"\\n max=\"' + model.get('max') + '\"\\n step=\"' + model.get('step') + '\"/>\\n </div>\\n ';\n },\n getSliderEl: function getSliderEl() {\n if (!this.slider) {\n this.slider = this.el.querySelector('input[type=range]');\n }\n\n return this.slider;\n },\n inputValueChanged: function inputValueChanged() {\n var model = this.model;\n var step = model.get('step');\n this.getInputEl().value = this.getSliderEl().value;\n var value = this.getInputValue() - step;\n model.set('value', value, { avoidStore: 1 }).set('value', value + step);\n this.elementUpdated();\n },\n inputValueChangedSoft: function inputValueChangedSoft() {\n this.getInputEl().value = this.getSliderEl().value;\n this.model.set('value', this.getInputValue(), { avoidStore: 1 });\n this.elementUpdated();\n },\n setValue: function setValue(value) {\n this.getSliderEl().value = value;\n this.inputInst.setValue(value, { silent: 1 });\n },\n onRender: function onRender() {\n Property.prototype.onRender.apply(this, arguments);\n\n if (!this.model.get('showInput')) {\n this.inputInst.el.style.display = 'none';\n }\n }\n});\n\n/***/ }),\n/* 127 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar Backbone = __webpack_require__(0);\n\nmodule.exports = function () {\n return {\n /**\n * Build props object by their name\n * @param {Array<string>|string} props Array of properties name\n * @return {Array<Object>}\n */\n build: function build(props) {\n var objs = [];\n var dftFixedValues = ['initial', 'inherit'];\n\n if (typeof props === 'string') props = [props];\n\n for (var i = 0, len = props.length; i < len; i++) {\n var obj = {};\n var prop = props[i];\n obj.property = prop;\n\n // Property\n switch (prop) {\n case 'border-radius-c':\n obj.property = 'border-radius';\n break;\n }\n\n // Fixed values\n switch (prop) {\n case 'margin-top':\n case 'margin-right':\n case 'margin-bottom':\n case 'margin-left':\n case 'padding-top':\n case 'padding-right':\n case 'padding-bottom':\n case 'padding-left':\n case 'width':\n case 'max-width':\n case 'min-width':\n case 'height':\n case 'max-height':\n case 'min-height':\n obj.fixedValues = ['initial', 'inherit', 'auto'];\n break;\n case 'font-size':\n obj.fixedValues = ['medium', 'xx-small', 'x-small', 'small', 'large', 'x-large', 'xx-large', 'smaller', 'larger', 'length', 'initial', 'inherit'];\n break;\n case 'letter-spacing':\n case 'line-height':\n obj.fixedValues = ['normal', 'initial', 'inherit'];\n break;\n }\n\n // Type\n switch (prop) {\n case 'float':\n case 'position':\n case 'text-align':\n obj.type = 'radio';\n break;\n case 'display':\n case 'font-family':\n case 'font-weight':\n case 'border-style':\n case 'box-shadow-type':\n case 'background-repeat':\n case 'background-position':\n case 'background-attachment':\n case 'background-size':\n case 'transition-property':\n case 'transition-timing-function':\n case 'cursor':\n case 'overflow':\n obj.type = 'select';\n break;\n case 'top':\n case 'right':\n case 'bottom':\n case 'left':\n case 'margin-top':\n case 'margin-right':\n case 'margin-bottom':\n case 'margin-left':\n case 'padding-top':\n case 'padding-right':\n case 'padding-bottom':\n case 'padding-left':\n case 'min-height':\n case 'min-width':\n case 'max-height':\n case 'max-width':\n case 'width':\n case 'height':\n case 'font-size':\n case 'letter-spacing':\n case 'line-height':\n case 'text-shadow-h':\n case 'text-shadow-v':\n case 'text-shadow-blur':\n case 'border-radius-c':\n case 'border-top-left-radius':\n case 'border-top-right-radius':\n case 'border-bottom-left-radius':\n case 'border-bottom-right-radius':\n case 'border-width':\n case 'box-shadow-h':\n case 'box-shadow-v':\n case 'box-shadow-blur':\n case 'box-shadow-spread':\n case 'transition-duration':\n case 'perspective':\n case 'transform-rotate-x':\n case 'transform-rotate-y':\n case 'transform-rotate-z':\n case 'transform-scale-x':\n case 'transform-scale-y':\n case 'transform-scale-z':\n obj.type = 'integer';\n break;\n case 'margin':\n case 'padding':\n case 'border-radius':\n case 'border':\n case 'transform':\n obj.type = 'composite';\n break;\n case 'color':\n case 'text-shadow-color':\n case 'background-color':\n case 'border-color':\n case 'box-shadow-color':\n obj.type = 'color';\n break;\n case 'text-shadow':\n case 'box-shadow':\n case 'background':\n case 'transition':\n obj.type = 'stack';\n break;\n case 'background-image':\n obj.type = 'file';\n break;\n }\n\n // Defaults\n switch (prop) {\n case 'float':\n case 'background-color':\n case 'background-image':\n case 'text-shadow':\n obj.defaults = 'none';\n break;\n case 'display':\n obj.defaults = 'block';\n break;\n case 'position':\n obj.defaults = 'static';\n break;\n case 'top':\n case 'right':\n case 'bottom':\n case 'left':\n case 'margin-top':\n case 'margin-right':\n case 'margin-bottom':\n case 'margin-left':\n case 'padding-top':\n case 'padding-right':\n case 'padding-bottom':\n case 'padding-left':\n case 'text-shadow-h':\n case 'text-shadow-v':\n case 'text-shadow-blur':\n case 'border-radius-c':\n case 'border-top-left-radius':\n case 'border-top-right-radius':\n case 'border-bottom-left-radius':\n case 'border-bottom-right-radius':\n case 'box-shadow-h':\n case 'box-shadow-v':\n case 'box-shadow-spread':\n case 'perspective':\n case 'transform-rotate-x':\n case 'transform-rotate-y':\n case 'transform-rotate-z':\n obj.defaults = 0;\n break;\n case 'transform-scale-x':\n case 'transform-scale-y':\n case 'transform-scale-z':\n obj.defaults = 1;\n break;\n case 'box-shadow-blur':\n obj.defaults = '5px';\n break;\n case 'min-height':\n case 'min-width':\n case 'max-height':\n case 'max-width':\n case 'width':\n case 'height':\n case 'background-size':\n case 'cursor':\n obj.defaults = 'auto';\n break;\n case 'font-family':\n obj.defaults = 'Arial, Helvetica, sans-serif';\n break;\n case 'font-size':\n case 'border-width':\n obj.defaults = 'medium';\n break;\n case 'font-weight':\n obj.defaults = '400';\n break;\n case 'letter-spacing':\n case 'line-height':\n obj.defaults = 'normal';\n break;\n case 'color':\n case 'text-shadow-color':\n case 'border-color':\n case 'box-shadow-color':\n obj.defaults = 'black';\n break;\n case 'text-align':\n obj.defaults = 'left';\n break;\n case 'border-style':\n obj.defaults = 'solid';\n break;\n case 'box-shadow-type':\n obj.defaults = '';\n break;\n case 'background-repeat':\n obj.defaults = 'repeat';\n break;\n case 'background-position':\n obj.defaults = 'left top';\n break;\n case 'background-attachment':\n obj.defaults = 'scroll';\n break;\n case 'transition-property':\n obj.defaults = 'width';\n break;\n case 'transition-duration':\n obj.defaults = '2';\n break;\n case 'transition-timing-function':\n obj.defaults = 'ease';\n break;\n case 'overflow':\n obj.defaults = 'visible';\n break;\n }\n\n // Units\n switch (prop) {\n case 'top':\n case 'right':\n case 'bottom':\n case 'left':\n case 'margin-top':\n case 'margin-right':\n case 'margin-bottom':\n case 'margin-left':\n case 'padding-top':\n case 'padding-right':\n case 'padding-bottom':\n case 'padding-left':\n case 'min-height':\n case 'min-width':\n case 'max-height':\n case 'max-width':\n case 'width':\n case 'height':\n case 'text-shadow-h':\n case 'text-shadow-v':\n case 'text-shadow-blur':\n case 'border-radius-c':\n case 'border-top-left-radius':\n case 'border-top-right-radius':\n case 'border-bottom-left-radius':\n case 'border-bottom-right-radius':\n case 'box-shadow-h':\n case 'box-shadow-v':\n obj.units = ['px', '%'];\n break;\n case 'font-size':\n case 'letter-spacing':\n case 'line-height':\n obj.units = ['px', 'em', 'rem', '%'];\n break;\n case 'border-width':\n obj.units = ['px', 'em'];\n break;\n case 'box-shadow-blur':\n case 'box-shadow-spread':\n case 'perspective':\n obj.units = ['px'];\n break;\n case 'transition-duration':\n obj.units = ['s'];\n break;\n case 'transform-rotate-x':\n case 'transform-rotate-y':\n case 'transform-rotate-z':\n obj.units = ['deg'];\n break;\n }\n\n // Min/Max\n switch (prop) {\n case 'padding-top':\n case 'padding-right':\n case 'padding-bottom':\n case 'padding-left':\n case 'min-height':\n case 'min-width':\n case 'max-height':\n case 'max-width':\n case 'width':\n case 'height':\n case 'font-size':\n case 'text-shadow-blur':\n case 'border-radius-c':\n case 'border-top-left-radius':\n case 'border-top-right-radius':\n case 'border-bottom-left-radius':\n case 'border-bottom-right-radius':\n case 'border-width':\n case 'box-shadow-blur':\n case 'transition-duration':\n case 'perspective':\n obj.min = 0;\n break;\n }\n\n // Preview\n switch (prop) {\n case 'text-shadow':\n case 'box-shadow':\n case 'background':\n obj.preview = true;\n break;\n }\n\n // Detached\n switch (prop) {\n case 'background':\n obj.detached = true;\n break;\n }\n\n // Functions\n switch (prop) {\n case 'transform-rotate-x':\n obj.functionName = 'rotateX';\n break;\n case 'transform-rotate-y':\n obj.functionName = 'rotateY';\n break;\n case 'transform-rotate-z':\n obj.functionName = 'rotateZ';\n break;\n case 'transform-scale-x':\n obj.functionName = 'scaleX';\n break;\n case 'transform-scale-y':\n obj.functionName = 'scaleY';\n break;\n case 'transform-scale-z':\n obj.functionName = 'scaleZ';\n break;\n case 'background-image':\n obj.functionName = 'url';\n break;\n }\n\n // Options\n switch (prop) {\n case 'float':\n obj.list = [{ value: 'none' }, { value: 'left' }, { value: 'right' }];\n break;\n case 'display':\n obj.list = [{ value: 'block' }, { value: 'inline' }, { value: 'inline-block' }, { value: 'none' }];\n break;\n case 'position':\n obj.list = [{ value: 'static' }, { value: 'relative' }, { value: 'absolute' }, { value: 'fixed' }];\n break;\n case 'font-family':\n var ss = ', sans-serif';\n var fonts = ['Arial, Helvetica' + ss, 'Arial Black, Gadget' + ss, 'Brush Script MT' + ss, 'Comic Sans MS, cursive' + ss, 'Courier New, Courier, monospace', 'Georgia, serif', 'Helvetica, serif', 'Impact, Charcoal' + ss, 'Lucida Sans Unicode, Lucida Grande' + ss, 'Tahoma, Geneva' + ss, 'Times New Roman, Times, serif', 'Trebuchet MS, Helvetica' + ss, 'Verdana, Geneva' + ss];\n obj.list = [];\n for (var j = 0, l = fonts.length; j < l; j++) {\n var font = {};\n font.value = fonts[j];\n font.name = fonts[j].split(',')[0];\n obj.list.push(font);\n }\n break;\n case 'font-weight':\n obj.list = [{ value: '100', name: 'Thin' }, { value: '200', name: 'Extra-Light' }, { value: '300', name: 'Light' }, { value: '400', name: 'Normal' }, { value: '500', name: 'Medium' }, { value: '600', name: 'Semi-Bold' }, { value: '700', name: 'Bold' }, { value: '800', name: 'Extra-Bold' }, { value: '900', name: 'Ultra-Bold' }];\n break;\n case 'text-align':\n obj.list = [{ value: 'left' }, { value: 'center' }, { value: 'right' }, { value: 'justify' }];\n break;\n case 'border-style':\n obj.list = [{ value: 'none' }, { value: 'solid' }, { value: 'dotted' }, { value: 'dashed' }, { value: 'double' }, { value: 'groove' }, { value: 'ridge' }, { value: 'inset' }, { value: 'outset' }];\n break;\n case 'box-shadow-type':\n obj.list = [{ value: '', name: 'Outside' }, { value: 'inset', name: 'Inside' }];\n break;\n case 'background-repeat':\n obj.list = [{ value: 'repeat' }, { value: 'repeat-x' }, { value: 'repeat-y' }, { value: 'no-repeat' }];\n break;\n case 'background-position':\n obj.list = [{ value: 'left top' }, { value: 'left center' }, { value: 'left bottom' }, { value: 'right top' }, { value: 'right center' }, { value: 'right bottom' }, { value: 'center top' }, { value: 'center center' }, { value: 'center bottom' }];\n break;\n case 'background-attachment':\n obj.list = [{ value: 'scroll' }, { value: 'fixed' }, { value: 'local' }];\n break;\n case 'background-size':\n obj.list = [{ value: 'auto' }, { value: 'cover' }, { value: 'contain' }];\n break;\n case 'transition-property':\n obj.list = [{ value: 'all' }, { value: 'width' }, { value: 'height' }, { value: 'background-color' }, { value: 'transform' }, { value: 'box-shadow' }, { value: 'opacity' }];\n break;\n case 'transition-timing-function':\n obj.list = [{ value: 'linear' }, { value: 'ease' }, { value: 'ease-in' }, { value: 'ease-out' }, { value: 'ease-in-out' }];\n break;\n case 'cursor':\n obj.list = [{ value: 'auto' }, { value: 'pointer' }, { value: 'copy' }, { value: 'crosshair' }, { value: 'grab' }, { value: 'grabbing' }, { value: 'help' }, { value: 'move' }, { value: 'text' }];\n break;\n case 'overflow':\n obj.list = [{ value: 'visible' }, { value: 'hidden' }, { value: 'scroll' }, { value: 'auto' }];\n break;\n }\n\n // Properties\n switch (prop) {\n case 'margin':\n obj.properties = this.build(['margin-top', 'margin-right', 'margin-bottom', 'margin-left']);\n break;\n case 'padding':\n obj.properties = this.build(['padding-top', 'padding-right', 'padding-bottom', 'padding-left']);\n break;\n case 'text-shadow':\n obj.properties = this.build(['text-shadow-h', 'text-shadow-v', 'text-shadow-blur', 'text-shadow-color']);\n break;\n case 'border':\n obj.properties = this.build(['border-width', 'border-style', 'border-color']);\n break;\n case 'border-radius':\n obj.properties = this.build(['border-top-left-radius', 'border-top-right-radius', 'border-bottom-left-radius', 'border-bottom-right-radius']);\n break;\n case 'box-shadow':\n obj.properties = this.build(['box-shadow-h', 'box-shadow-v', 'box-shadow-blur', 'box-shadow-spread', 'box-shadow-color', 'box-shadow-type']);\n break;\n case 'background':\n obj.properties = this.build(['background-image', 'background-repeat', 'background-position', 'background-attachment', 'background-size']);\n break;\n case 'transition':\n obj.properties = this.build(['transition-property', 'transition-duration', 'transition-timing-function']);\n break;\n case 'transform':\n obj.properties = this.build(['transform-rotate-x', 'transform-rotate-y', 'transform-rotate-z', 'transform-scale-x', 'transform-scale-y', 'transform-scale-z']);\n break;\n }\n\n objs.push(obj);\n }\n\n return objs;\n }\n };\n};\n\n/***/ }),\n/* 128 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Backbone) {\n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar _underscore = __webpack_require__(1);\n\nvar SectorView = __webpack_require__(129);\n\nmodule.exports = Backbone.View.extend({\n initialize: function initialize(o) {\n this.config = o.config || {};\n this.pfx = this.config.stylePrefix || '';\n this.target = o.target || {};\n\n // The target that will emit events for properties\n var target = {};\n (0, _underscore.extend)(target, Backbone.Events);\n var body = document.body;\n var dummy = document.createElement('el-' + new Date().getTime());\n body.appendChild(dummy);\n target.computedDefault = _extends({}, window.getComputedStyle(dummy));\n body.removeChild(dummy);\n this.propTarget = target;\n var coll = this.collection;\n var events = 'change:selectedComponent component:update:classes component:update:state change:device';\n this.listenTo(coll, 'add', this.addTo);\n this.listenTo(coll, 'reset', this.render);\n this.listenTo(this.target, events, this.targetUpdated);\n },\n\n\n /**\n * Add to collection\n * @param {Object} model Model\n * @return {Object}\n * @private\n * */\n addTo: function addTo(model) {\n this.addToCollection(model);\n },\n\n\n /**\n * Fired when target is updated\n * @private\n */\n targetUpdated: function targetUpdated() {\n var em = this.target;\n var pt = this.propTarget;\n var model = em.getSelected();\n if (!model) return;\n\n var config = em.get('Config');\n var state = !config.devicePreviewMode ? model.get('state') : '';\n var el = model.getEl();\n pt.helper = null;\n\n // Create computed style container\n if (el) {\n var stateStr = state ? ':' + state : null;\n pt.computed = window.getComputedStyle(el, stateStr);\n }\n\n // Create a new rule for the state as a helper\n var appendStateRule = function appendStateRule() {\n var style = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n var cc = em.get('CssComposer');\n var helperCls = 'hc-state';\n var rules = cc.getAll();\n var helperRule = cc.getClassRule(helperCls);\n\n if (!helperRule) {\n helperRule = cc.setClassRule(helperCls);\n } else {\n // I will make it last again, otherwise it could be overridden\n rules.remove(helperRule);\n rules.add(helperRule);\n }\n\n helperRule.set('important', 1);\n helperRule.setStyle(style);\n pt.helper = helperRule;\n };\n\n model = em.get('StyleManager').getModelToStyle(model);\n state && appendStateRule(model.getStyle());\n pt.model = model;\n pt.trigger('update');\n },\n\n\n /**\n * Add new object to collection\n * @param {Object} model Model\n * @param {Object} fragmentEl collection\n * @return {Object} Object created\n * @private\n * */\n addToCollection: function addToCollection(model, fragmentEl) {\n var fragment = fragmentEl || null;\n var view = new SectorView({\n model: model,\n id: this.pfx + model.get('name').replace(' ', '_').toLowerCase(),\n name: model.get('name'),\n properties: model.get('properties'),\n target: this.target,\n propTarget: this.propTarget,\n config: this.config\n });\n var rendered = view.render().el;\n\n if (fragment) {\n fragment.appendChild(rendered);\n } else {\n this.$el.append(rendered);\n }\n\n return rendered;\n },\n render: function render() {\n var fragment = document.createDocumentFragment();\n this.$el.empty();\n\n this.collection.each(function (model) {\n this.addToCollection(model, fragment);\n }, this);\n\n this.$el.attr('id', this.pfx + 'sectors');\n this.$el.append(fragment);\n return this;\n }\n});\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))\n\n/***/ }),\n/* 129 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(_) {\n\nvar Backbone = __webpack_require__(0);\nvar PropertiesView = __webpack_require__(13);\n\nmodule.exports = Backbone.View.extend({\n template: _.template('\\n <div class=\"<%= pfx %>title\" data-sector-title>\\n <i id=\"<%= pfx %>caret\" class=\"fa\"></i>\\n <%= label %>\\n </div>'),\n\n events: {\n 'click [data-sector-title]': 'toggle'\n },\n\n initialize: function initialize(o) {\n this.config = o.config || {};\n this.pfx = this.config.stylePrefix || '';\n this.target = o.target || {};\n this.propTarget = o.propTarget || {};\n this.caretR = 'fa-caret-right';\n this.caretD = 'fa-caret-down';\n var model = this.model;\n this.listenTo(model, 'change:open', this.updateOpen);\n this.listenTo(model, 'updateVisibility', this.updateVisibility);\n this.listenTo(model, 'destroy remove', this.remove);\n },\n\n\n /**\n * If all properties are hidden this will hide the sector\n */\n updateVisibility: function updateVisibility() {\n var show;\n this.model.get('properties').each(function (prop) {\n if (prop.get('visible')) {\n show = 1;\n }\n });\n this.el.style.display = show ? 'block' : 'none';\n },\n\n\n /**\n * Update visibility\n */\n updateOpen: function updateOpen() {\n if (this.model.get('open')) this.show();else this.hide();\n },\n\n\n /**\n * Show the content of the sector\n * */\n show: function show() {\n this.$el.addClass(this.pfx + 'open');\n this.getPropertiesEl().style.display = '';\n this.$caret.removeClass(this.caretR).addClass(this.caretD);\n },\n\n\n /**\n * Hide the content of the sector\n * */\n hide: function hide() {\n this.$el.removeClass(this.pfx + 'open');\n this.getPropertiesEl().style.display = 'none';\n this.$caret.removeClass(this.caretD).addClass(this.caretR);\n },\n getPropertiesEl: function getPropertiesEl() {\n return this.$el.find('.' + this.pfx + 'properties').get(0);\n },\n\n\n /**\n * Toggle visibility\n * */\n toggle: function toggle(e) {\n var v = this.model.get('open') ? 0 : 1;\n this.model.set('open', v);\n },\n render: function render() {\n this.$el.html(this.template({\n pfx: this.pfx,\n label: this.model.get('name')\n }));\n this.$caret = this.$el.find('#' + this.pfx + 'caret');\n this.renderProperties();\n this.$el.attr('class', this.pfx + 'sector no-select');\n this.updateOpen();\n return this;\n },\n renderProperties: function renderProperties() {\n var objs = this.model.get('properties');\n\n if (objs) {\n var view = new PropertiesView({\n collection: objs,\n target: this.target,\n propTarget: this.propTarget,\n config: this.config\n });\n this.$el.append(view.render().el);\n }\n }\n});\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))\n\n/***/ }),\n/* 130 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\n/**\n * * [add](#add)\n * * [get](#get)\n * * [getAll](#getall)\n * * [getAllVisible](#getallvisible)\n * * [remove](#remove)\n * * [getContainer](#getcontainer)\n * * [getAssetsEl](#getassetsel)\n * * [addType](#addtype)\n * * [getType](#gettype)\n * * [getTypes](#gettypes)\n * * [store](#store)\n * * [load](#load)\n *\n * Before using this methods you should get first the module from the editor instance, in this way:\n *\n * ```js\n * var assetManager = editor.AssetManager;\n * ```\n *\n * @module AssetManager\n * @param {Object} config Configurations\n * @param {Array<Object>} [config.assets=[]] Default assets\n * @param {String} [config.uploadText='Drop files here or click to upload'] Upload text\n * @param {String} [config.addBtnText='Add image'] Text for the add button\n * @param {String} [config.upload=''] Where to send upload data. Expects as return a JSON with asset/s object\n * as: {data: [{src:'...'}, {src:'...'}]}\n * @return {this}\n * @example\n * ...\n * {\n * \tassets: [\n * \t{src:'path/to/image.png'},\n * ...\n * ],\n * upload: 'http://dropbox/path', // Set to false to disable it\n * uploadText: 'Drop files here or click to upload',\n * }\n */\n\nmodule.exports = function () {\n var c = {};\n var defaults = __webpack_require__(131);\n var Assets = __webpack_require__(132);\n var AssetsView = __webpack_require__(135);\n var FileUpload = __webpack_require__(45);\n var assets = void 0,\n am = void 0,\n fu = void 0;\n\n return {\n /**\n * Name of the module\n * @type {String}\n * @private\n */\n name: 'AssetManager',\n\n /**\n * Mandatory for the storage manager\n * @type {String}\n * @private\n */\n storageKey: 'assets',\n\n getConfig: function getConfig() {\n return c;\n },\n\n\n /**\n * Initialize module\n * @param {Object} config Configurations\n * @private\n */\n init: function init(config) {\n var _this = this;\n\n c = config || {};\n\n for (var name in defaults) {\n if (!(name in c)) c[name] = defaults[name];\n }\n\n var ppfx = c.pStylePrefix;\n var em = c.em;\n\n if (ppfx) {\n c.stylePrefix = ppfx + c.stylePrefix;\n }\n\n // Global assets collection\n assets = new Assets([]);\n var obj = {\n // Collection visible in asset manager\n collection: new Assets([]),\n globalCollection: assets,\n config: c\n };\n fu = new FileUpload(obj);\n obj.fu = fu;\n am = new AssetsView(obj);\n\n // Setup the sync between the global and public collections\n assets.listenTo(assets, 'add', function (model) {\n _this.getAllVisible().add(model);\n em && em.trigger('asset:add', model);\n });\n\n assets.listenTo(assets, 'remove', function (model) {\n _this.getAllVisible().remove(model);\n em && em.trigger('asset:remove', model);\n });\n\n return this;\n },\n\n\n /**\n * Add new asset/s to the collection. URLs are supposed to be unique\n * @param {string|Object|Array<string>|Array<Object>} asset URL strings or an objects representing the resource.\n * @param {Object} [opts] Options\n * @return {Model}\n * @example\n * // In case of strings, would be interpreted as images\n * assetManager.add('http://img.jpg');\n * assetManager.add(['http://img.jpg', './path/to/img.png']);\n *\n * // Using objects you could indicate the type and other meta informations\n * assetManager.add({\n * \tsrc: 'http://img.jpg',\n * \t//type: 'image',\t//image is default\n * \theight: 300,\n *\twidth: 200,\n * });\n * assetManager.add([{\n * \tsrc: 'http://img.jpg',\n * },{\n * \tsrc: './path/to/img.png',\n * }]);\n */\n add: function add(asset) {\n var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n // Put the model at the beginning\n if (typeof opts.at == 'undefined') {\n opts.at = 0;\n }\n\n return assets.add(asset, opts);\n },\n\n\n /**\n * Returns the asset by URL\n * @param {string} src URL of the asset\n * @return {Object} Object representing the asset\n * @example\n * var asset = assetManager.get('http://img.jpg');\n */\n get: function get(src) {\n return assets.where({ src: src })[0];\n },\n\n\n /**\n * Return the global collection, containing all the assets\n * @return {Collection}\n */\n getAll: function getAll() {\n return assets;\n },\n\n\n /**\n * Return the visible collection, which containes assets actually rendered\n * @return {Collection}\n */\n getAllVisible: function getAllVisible() {\n return am.collection;\n },\n\n\n /**\n * Remove the asset by its URL\n * @param {string} src URL of the asset\n * @return {this}\n * @example\n * assetManager.remove('http://img.jpg');\n */\n remove: function remove(src) {\n var asset = this.get(src);\n this.getAll().remove(asset);\n return this;\n },\n\n\n /**\n * Store assets data to the selected storage\n * @param {Boolean} noStore If true, won't store\n * @return {Object} Data to store\n * @example\n * var assets = assetManager.store();\n */\n store: function store(noStore) {\n var obj = {};\n var assets = JSON.stringify(this.getAll().toJSON());\n obj[this.storageKey] = assets;\n if (!noStore && c.stm) c.stm.store(obj);\n return obj;\n },\n\n\n /**\n * Load data from the passed object.\n * The fetched data will be added to the collection.\n * @param {Object} data Object of data to load\n * @return {Object} Loaded assets\n * @example\n * var assets = assetManager.load({\n * \tassets: [...]\n * })\n *\n */\n load: function load() {\n var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n var name = this.storageKey;\n var assets = data[name] || [];\n\n if (typeof assets == 'string') {\n try {\n assets = JSON.parse(data[name]);\n } catch (err) {}\n }\n\n if (assets && assets.length) {\n this.getAll().reset(assets);\n }\n\n return assets;\n },\n\n\n /**\n * Return the Asset Manager Container\n * @return {HTMLElement}\n */\n getContainer: function getContainer() {\n return am.el;\n },\n\n\n /**\n * Get assets element container\n * @return {HTMLElement}\n */\n getAssetsEl: function getAssetsEl() {\n return am.el.querySelector('[data-el=assets]');\n },\n\n\n /**\n * Render assets\n * @param {array} assets Assets to render, without the argument will render\n * all global assets\n * @return {HTMLElement}\n * @example\n * // Render all assets\n * assetManager.render();\n *\n * // Render some of the assets\n * const assets = assetManager.getAll();\n * assetManager.render(assets.filter(\n * asset => asset.get('category') == 'cats'\n * ));\n */\n render: function render(assets) {\n var toRender = assets || this.getAll().models;\n\n if (!am.rendered) {\n am.render();\n }\n\n am.collection.reset(toRender);\n return this.getContainer();\n },\n\n\n /**\n * Add new type\n * @param {string} id Type ID\n * @param {Object} definition Definition of the type. Each definition contains\n * `model` (business logic), `view` (presentation logic)\n * and `isType` function which recognize the type of the\n * passed entity\n * addType('my-type', {\n * model: {},\n * view: {},\n * isType: (value) => {},\n * })\n */\n addType: function addType(id, definition) {\n this.getAll().addType(id, definition);\n },\n\n\n /**\n * Get type\n * @param {string} id Type ID\n * @return {Object} Type definition\n */\n getType: function getType(id) {\n return this.getAll().getType(id);\n },\n\n\n /**\n * Get types\n * @return {Array}\n */\n getTypes: function getTypes() {\n return this.getAll().getTypes();\n },\n\n\n //-------\n\n AssetsView: function AssetsView() {\n return am;\n },\n FileUploader: function FileUploader() {\n return fu;\n },\n onLoad: function onLoad() {\n this.getAll().reset(c.assets);\n },\n postRender: function postRender(editorView) {\n c.dropzone && fu.initDropzone(editorView);\n },\n\n\n /**\n * Set new target\n * @param\t{Object}\tm Model\n * @private\n * */\n setTarget: function setTarget(m) {\n am.collection.target = m;\n },\n\n\n /**\n * Set callback after asset was selected\n * @param\t{Object}\tf Callback function\n * @private\n * */\n onSelect: function onSelect(f) {\n am.collection.onSelect = f;\n },\n\n\n /**\n * Set callback to fire when the asset is clicked\n * @param {function} func\n * @private\n */\n onClick: function onClick(func) {\n c.onClick = func;\n },\n\n\n /**\n * Set callback to fire when the asset is double clicked\n * @param {function} func\n * @private\n */\n onDblClick: function onDblClick(func) {\n c.onDblClick = func;\n }\n };\n};\n\n/***/ }),\n/* 131 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = {\n // Default assets\n // eg. [\n // 'https://...image1.png',\n // 'https://...image2.png',\n // {type: 'image', src: 'https://...image3.png', someOtherCustomProp: 1},\n // ..\n // ]\n assets: [],\n\n // Content to add where there is no assets to show\n // eg. 'No <b>assets</b> here, drag to upload'\n noAssets: '',\n\n // Style prefix\n stylePrefix: 'am-',\n\n // Upload endpoint, set `false` to disable upload\n // upload: 'https://endpoint/upload/assets',\n // upload: false,\n upload: 0,\n\n // The name used in POST to pass uploaded files\n uploadName: 'files',\n\n // Custom headers to pass with the upload request\n headers: {},\n\n // Custom parameters to pass with the upload request, eg. csrf token\n params: {},\n\n // If true, tries to add automatically uploaded assets.\n // To make it work the server should respond with a JSON containing assets\n // in a data key, eg:\n // {\n // data: [\n // 'https://.../image.png',\n // ...\n // {src: 'https://.../image2.png'},\n // ...\n // ]\n // }\n autoAdd: 1,\n\n // Text on upload input\n uploadText: 'Drop files here or click to upload',\n\n // Label for the add button\n addBtnText: 'Add image',\n\n // Custom uploadFile function\n // @example\n // uploadFile: (e) => {\n // var files = e.dataTransfer ? e.dataTransfer.files : e.target.files;\n // // ...send somewhere\n // }\n uploadFile: '',\n\n // Handle the image url submit from the built-in 'Add image' form\n // @example\n // handleAdd: (textFromInput) => {\n // // some check...\n // editor.AssetManager.add(textFromInput);\n // }\n handleAdd: '',\n\n // Enable an upload dropzone on the entire editor (not document) when dragging\n // files over it\n // If active the dropzone disable/hide the upload dropzone in asset modal,\n // otherwise you will get double drops (#507)\n dropzone: 0,\n\n // Open the asset manager once files are been dropped via the dropzone\n openAssetsOnDrop: 1,\n\n // Any dropzone content to append inside dropzone element\n dropzoneContent: '',\n\n // Default title for the asset manager modal\n modalTitle: 'Select Image',\n\n //Default placeholder for input\n inputPlaceholder: 'http://path/to/the/image.jpg'\n};\n\n/***/ }),\n/* 132 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _TypeableCollection = __webpack_require__(32);\n\nvar _TypeableCollection2 = _interopRequireDefault(_TypeableCollection);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nmodule.exports = __webpack_require__(0).Collection.extend(_TypeableCollection2.default).extend({\n types: [{\n id: 'image',\n model: __webpack_require__(133),\n view: __webpack_require__(43),\n isType: function isType(value) {\n if (typeof value == 'string') {\n return {\n type: 'image',\n src: value\n };\n }\n return value;\n }\n }]\n});\n\n/***/ }),\n/* 133 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar Asset = __webpack_require__(134);\n\nmodule.exports = Asset.extend({\n defaults: _extends({}, Asset.prototype.defaults, {\n type: 'image',\n unitDim: 'px',\n height: 0,\n width: 0\n })\n});\n\n/***/ }),\n/* 134 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = __webpack_require__(0).Model.extend({\n idAttribute: 'src',\n\n defaults: {\n type: '',\n src: ''\n },\n\n /**\n * Get filename of the asset\n * @return {string}\n * @private\n * */\n getFilename: function getFilename() {\n return this.get('src').split('/').pop();\n },\n\n\n /**\n * Get extension of the asset\n * @return {string}\n * @private\n * */\n getExtension: function getExtension() {\n return this.getFilename().split('.').pop();\n }\n});\n\n/***/ }),\n/* 135 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Backbone) {\n\nvar AssetView = __webpack_require__(44);\nvar AssetImageView = __webpack_require__(43);\nvar FileUploader = __webpack_require__(45);\n\nmodule.exports = Backbone.View.extend({\n events: {\n submit: 'handleSubmit'\n },\n\n template: function template(view) {\n var pfx = view.pfx;\n var ppfx = view.ppfx;\n return '\\n <div class=\"' + pfx + 'assets-cont\">\\n <div class=\"' + pfx + 'assets-header\">\\n <form class=\"' + pfx + 'add-asset\">\\n <div class=\"' + ppfx + 'field ' + pfx + 'add-field\">\\n <input placeholder=\"' + view.config.inputPlaceholder + '\"/>\\n </div>\\n <button class=\"' + ppfx + 'btn-prim\">' + view.config.addBtnText + '</button>\\n <div style=\"clear:both\"></div>\\n </form>\\n <div class=\"' + pfx + 'dips\" style=\"display:none\">\\n <button class=\"fa fa-th <%' + ppfx + 'btnt\"></button>\\n <button class=\"fa fa-th-list <%' + ppfx + 'btnt\"></button>\\n </div>\\n </div>\\n <div class=\"' + pfx + 'assets\" data-el=\"assets\"></div>\\n <div style=\"clear:both\"></div>\\n </div>\\n ';\n },\n initialize: function initialize(o) {\n this.options = o;\n this.config = o.config;\n this.pfx = this.config.stylePrefix || '';\n this.ppfx = this.config.pStylePrefix || '';\n var coll = this.collection;\n this.listenTo(coll, 'reset', this.renderAssets);\n this.listenTo(coll, 'add', this.addToAsset);\n this.listenTo(coll, 'remove', this.removedAsset);\n this.listenTo(coll, 'deselectAll', this.deselectAll);\n },\n\n\n /**\n * Add new asset to the collection via string\n * @param {Event} e Event object\n * @return {this}\n * @private\n */\n handleSubmit: function handleSubmit(e) {\n e.preventDefault();\n var input = this.getAddInput();\n var url = input.value.trim();\n var handleAdd = this.config.handleAdd;\n\n if (!url) {\n return;\n }\n\n input.value = '';\n this.getAssetsEl().scrollTop = 0;\n\n if (handleAdd) {\n handleAdd(url);\n } else {\n this.options.globalCollection.add(url, { at: 0 });\n }\n },\n\n\n /**\n * Returns assets element\n * @return {HTMLElement}\n * @private\n */\n getAssetsEl: function getAssetsEl() {\n //if(!this.assets) // Not able to cache as after the rerender it losses the ref\n return this.el.querySelector('.' + this.pfx + 'assets');\n },\n\n\n /**\n * Returns input url element\n * @return {HTMLElement}\n * @private\n */\n getAddInput: function getAddInput() {\n if (!this.inputUrl || !this.inputUrl.value) this.inputUrl = this.el.querySelector('.' + this.pfx + 'add-asset input');\n return this.inputUrl;\n },\n\n\n /**\n * Triggered when an asset is removed\n * @param {Asset} model Removed asset\n * @private\n */\n removedAsset: function removedAsset(model) {\n if (!this.collection.length) {\n this.toggleNoAssets();\n }\n },\n\n\n /**\n * Add asset to collection\n * @private\n * */\n addToAsset: function addToAsset(model) {\n if (this.collection.length == 1) {\n this.toggleNoAssets(1);\n }\n this.addAsset(model);\n },\n\n\n /**\n * Add new asset to collection\n * @param Object Model\n * @param Object Fragment collection\n * @return Object Object created\n * @private\n * */\n addAsset: function addAsset(model) {\n var fragmentEl = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n\n var fragment = fragmentEl;\n var collection = this.collection;\n var config = this.config;\n var rendered = new model.typeView({\n model: model,\n collection: collection,\n config: config\n }).render().el;\n\n if (fragment) {\n fragment.appendChild(rendered);\n } else {\n var assetsEl = this.getAssetsEl();\n if (assetsEl) {\n assetsEl.insertBefore(rendered, assetsEl.firstChild);\n }\n }\n\n return rendered;\n },\n\n\n /**\n * Checks if to show noAssets\n * @param {Boolean} hide\n * @private\n */\n toggleNoAssets: function toggleNoAssets(hide) {\n var assetsEl = this.$el.find('.' + this.pfx + 'assets');\n\n if (hide) {\n assetsEl.empty();\n } else {\n var noAssets = this.config.noAssets;\n noAssets && assetsEl.append(noAssets);\n }\n },\n\n\n /**\n * Deselect all assets\n * @private\n * */\n deselectAll: function deselectAll() {\n var pfx = this.pfx;\n this.$el.find('.' + pfx + 'highlight').removeClass(pfx + 'highlight');\n },\n renderAssets: function renderAssets() {\n var _this = this;\n\n var fragment = document.createDocumentFragment();\n var assets = this.$el.find('.' + this.pfx + 'assets');\n assets.empty();\n this.toggleNoAssets(this.collection.length);\n this.collection.each(function (model) {\n return _this.addAsset(model, fragment);\n });\n assets.append(fragment);\n },\n render: function render() {\n var fuRendered = this.options.fu.render().el;\n this.$el.empty();\n this.$el.append(fuRendered).append(this.template(this));\n this.el.className = this.ppfx + 'asset-manager';\n this.renderAssets();\n this.rendered = 1;\n return this;\n }\n});\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))\n\n/***/ }),\n/* 136 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\n/**\n * This module contains and manage CSS rules for the template inside the canvas\n * Before using the methods you should get first the module from the editor instance, in this way:\n *\n * ```js\n * var cssComposer = editor.CssComposer;\n * ```\n *\n * @module CssComposer\n * @param {Object} config Configurations\n * @param {string|Array<Object>} [config.rules=[]] CSS string or an array of rule objects\n * @example\n * ...\n * CssComposer: {\n * rules: '.myClass{ color: red}',\n * }\n */\n\nmodule.exports = function () {\n var em = void 0;\n var c = {},\n defaults = __webpack_require__(137),\n CssRule = __webpack_require__(46),\n CssRules = __webpack_require__(138),\n CssRulesView = __webpack_require__(139);\n var Selectors = __webpack_require__(10);\n var Selector = __webpack_require__(7);\n\n var rules, rulesView;\n\n return {\n Selectors: Selectors,\n\n /**\n * Name of the module\n * @type {String}\n * @private\n */\n name: 'CssComposer',\n\n /**\n * Mandatory for the storage manager\n * @type {String}\n * @private\n */\n storageKey: function storageKey() {\n var keys = [];\n var smc = c.stm && c.stm.getConfig() || {};\n if (smc.storeCss) keys.push('css');\n if (smc.storeStyles) keys.push('styles');\n return keys;\n },\n\n\n /**\n * Initializes module. Automatically called with a new instance of the editor\n * @param {Object} config Configurations\n * @private\n */\n init: function init(config) {\n c = config || {};\n for (var name in defaults) {\n if (!(name in c)) c[name] = defaults[name];\n }\n\n var ppfx = c.pStylePrefix;\n if (ppfx) c.stylePrefix = ppfx + c.stylePrefix;\n\n var elStyle = c.em && c.em.config.style || '';\n c.rules = elStyle || c.rules;\n\n em = c.em;\n rules = new CssRules([], c);\n rulesView = new CssRulesView({\n collection: rules,\n config: c\n });\n return this;\n },\n\n\n /**\n * On load callback\n * @private\n */\n onLoad: function onLoad() {\n rules.add(c.rules);\n },\n\n\n /**\n * Do stuff after load\n * @param {Editor} em\n * @private\n */\n postLoad: function postLoad(em) {\n var _this = this;\n\n var ev = 'add remove';\n var rules = this.getAll();\n em.stopListening(rules, ev, this.handleChange);\n em.listenTo(rules, ev, this.handleChange);\n rules.each(function (rule) {\n return _this.handleChange(rule);\n });\n },\n\n\n /**\n * Handle rule changes\n * @private\n */\n handleChange: function handleChange(model) {\n var ev = 'change:style';\n var um = em.get('UndoManager');\n um && um.add(model);\n var handleUpdates = em.handleUpdates.bind(em);\n em.stopListening(model, ev, handleUpdates);\n em.listenTo(model, ev, handleUpdates);\n },\n\n\n /**\n * Load data from the passed object, if the object is empty will try to fetch them\n * autonomously from the storage manager.\n * The fetched data will be added to the collection\n * @param {Object} data Object of data to load\n * @return {Object} Loaded rules\n */\n load: function load(data) {\n var d = data || '';\n\n if (!d && c.stm) {\n d = c.em.getCacheLoad();\n }\n\n var obj = d.styles || '';\n\n if (d.styles) {\n try {\n obj = JSON.parse(d.styles);\n } catch (err) {}\n } else if (d.css) {\n obj = c.em.get('Parser').parseCss(d.css);\n }\n\n if (obj) {\n rules.reset(obj);\n }\n\n return obj;\n },\n\n\n /**\n * Store data to the selected storage\n * @param {Boolean} noStore If true, won't store\n * @return {Object} Data to store\n */\n store: function store(noStore) {\n if (!c.stm) return;\n var obj = {};\n var keys = this.storageKey();\n if (keys.indexOf('css') >= 0) obj.css = c.em.getCss();\n if (keys.indexOf('styles') >= 0) obj.styles = JSON.stringify(rules);\n if (!noStore) c.stm.store(obj);\n return obj;\n },\n\n\n /**\n * Add new rule to the collection, if not yet exists with the same selectors\n * @param {Array<Selector>} selectors Array of selectors\n * @param {String} state Css rule state\n * @param {String} width For which device this style is oriented\n * @param {Object} opts Other options for the rule\n * @return {Model}\n * @example\n * var sm = editor.SelectorManager;\n * var sel1 = sm.add('myClass1');\n * var sel2 = sm.add('myClass2');\n * var rule = cssComposer.add([sel1, sel2], 'hover');\n * rule.set('style', {\n * width: '100px',\n * color: '#fff',\n * });\n * */\n add: function add(selectors, state, width, opts) {\n var s = state || '';\n var w = width || '';\n var opt = opts || {};\n var rule = this.get(selectors, s, w, opt);\n if (rule) return rule;else {\n opt.state = s;\n opt.mediaText = w;\n opt.selectors = '';\n rule = new CssRule(opt, c);\n rule.get('selectors').add(selectors);\n rules.add(rule);\n return rule;\n }\n },\n\n\n /**\n * Get the rule\n * @param {Array<Selector>} selectors Array of selectors\n * @param {String} state Css rule state\n * @param {String} width For which device this style is oriented\n * @param {Object} ruleProps Other rule props\n * @return {Model|null}\n * @example\n * var sm = editor.SelectorManager;\n * var sel1 = sm.add('myClass1');\n * var sel2 = sm.add('myClass2');\n * var rule = cssComposer.get([sel1, sel2], 'hover');\n * // Update the style\n * rule.set('style', {\n * width: '300px',\n * color: '#000',\n * });\n * */\n get: function get(selectors, state, width, ruleProps) {\n var rule = null;\n rules.each(function (m) {\n if (rule) return;\n if (m.compare(selectors, state, width, ruleProps)) rule = m;\n });\n return rule;\n },\n\n\n /**\n * Get the collection of rules\n * @return {Collection}\n * */\n getAll: function getAll() {\n return rules;\n },\n\n\n /**\n * Remove all rules\n * @return {this}\n */\n clear: function clear() {\n this.getAll().reset();\n return this;\n },\n\n\n /**\n * Add a raw collection of rule objects\n * This method overrides styles, in case, of already defined rule\n * @param {Array<Object>} data Array of rule objects, eg . [{selectors: ['class1'], style: {....}}, ..]\n * @param {Object} opts Options\n * @return {Array<Model>}\n * @private\n */\n addCollection: function addCollection(data) {\n var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n var result = [];\n var d = data instanceof Array ? data : [data];\n\n for (var i = 0, l = d.length; i < l; i++) {\n var rule = d[i] || {};\n if (!rule.selectors) continue;\n var sm = c.em && c.em.get('SelectorManager');\n if (!sm) console.warn('Selector Manager not found');\n var sl = rule.selectors;\n var sels = sl instanceof Array ? sl : [sl];\n var newSels = [];\n\n for (var j = 0, le = sels.length; j < le; j++) {\n var selec = sm.add(sels[j]);\n newSels.push(selec);\n }\n\n var modelExists = this.get(newSels, rule.state, rule.mediaText, rule);\n var model = this.add(newSels, rule.state, rule.mediaText, rule);\n var updateStyle = !modelExists || !opts.avoidUpdateStyle;\n var style = rule.style || {};\n\n if (updateStyle) {\n var styleUpdate = opts.extend ? _extends({}, model.get('style'), style) : style;\n model.set('style', styleUpdate);\n }\n\n result.push(model);\n }\n\n return result;\n },\n\n\n /**\n * Add/update the CSS rule with id selector\n * @param {string} name Id selector name, eg. 'my-id'\n * @param {Object} style Style properties and values\n * @param {Object} [opts={}] Custom options, like `state` and `mediaText`\n * @return {CssRule} The new/updated rule\n * @example\n * const rule = cc.setIdRule('myid', { color: 'red' });\n * const ruleHover = cc.setIdRule('myid', { color: 'blue' }, { state: 'hover' });\n * // This will add current CSS:\n * // #myid { color: red }\n * // #myid:hover { color: blue }\n */\n setIdRule: function setIdRule(name) {\n var style = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n var state = opts.state || '';\n var media = opts.mediaText || em.getCurrentMedia();\n var sm = em.get('SelectorManager');\n var selector = sm.add({ name: name, type: Selector.TYPE_ID });\n var rule = this.add(selector, state, media);\n rule.setStyle(style, opts);\n return rule;\n },\n\n\n /**\n * Get the CSS rule by id selector\n * @param {string} name Id selector name, eg. 'my-id'\n * @param {Object} [opts={}] Custom options, like `state` and `mediaText`\n * @return {CssRule}\n * @example\n * const rule = cc.getIdRule('myid');\n * const ruleHover = cc.setIdRule('myid', { state: 'hover' });\n */\n getIdRule: function getIdRule(name) {\n var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n var state = opts.state || '';\n var media = opts.mediaText || em.getCurrentMedia();\n var selector = em.get('SelectorManager').get(name, Selector.TYPE_ID);\n return selector && this.get(selector, state, media);\n },\n\n\n /**\n * Add/update the CSS rule with class selector\n * @param {string} name Class selector name, eg. 'my-class'\n * @param {Object} style Style properties and values\n * @param {Object} [opts={}] Custom options, like `state` and `mediaText`\n * @return {CssRule} The new/updated rule\n * @example\n * const rule = cc.setClassRule('myclass', { color: 'red' });\n * const ruleHover = cc.setClassRule('myclass', { color: 'blue' }, { state: 'hover' });\n * // This will add current CSS:\n * // .myclass { color: red }\n * // .myclass:hover { color: blue }\n */\n setClassRule: function setClassRule(name) {\n var style = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n var state = opts.state || '';\n var media = opts.mediaText || em.getCurrentMedia();\n var sm = em.get('SelectorManager');\n var selector = sm.add({ name: name, type: Selector.TYPE_CLASS });\n var rule = this.add(selector, state, media);\n rule.setStyle(style, opts);\n return rule;\n },\n\n\n /**\n * Get the CSS rule by class selector\n * @param {string} name Class selector name, eg. 'my-class'\n * @param {Object} [opts={}] Custom options, like `state` and `mediaText`\n * @return {CssRule}\n * @example\n * const rule = cc.getClassRule('myclass');\n * const ruleHover = cc.getClassRule('myclass', { state: 'hover' });\n */\n getClassRule: function getClassRule(name) {\n var opts = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n var state = opts.state || '';\n var media = opts.mediaText || em.getCurrentMedia();\n var selector = em.get('SelectorManager').get(name, Selector.TYPE_CLASS);\n return selector && this.get(selector, state, media);\n },\n\n\n /**\n * Render the block of CSS rules\n * @return {HTMLElement}\n * @private\n */\n render: function render() {\n return rulesView.render().el;\n }\n };\n};\n\n/***/ }),\n/* 137 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = {\n // Style prefix\n stylePrefix: 'css-',\n\n // Custom CSS string to render on top\n staticRules: '',\n\n // Default CSS style\n rules: []\n};\n\n/***/ }),\n/* 138 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar Backbone = __webpack_require__(0);\nvar CssRule = __webpack_require__(46);\n\nmodule.exports = Backbone.Collection.extend({\n initialize: function initialize(models, opt) {\n // Inject editor\n if (opt && opt.em) this.editor = opt.em;\n\n // Not used\n this.model = function (attrs, options) {\n var model;\n\n if (!options.em && opt && opt.em) options.em = opt.em;\n\n switch (1) {\n default:\n model = new CssRule(attrs, options);\n }\n\n return model;\n };\n },\n add: function add(models) {\n var opt = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n if (typeof models === 'string') {\n models = this.editor.get('Parser').parseCss(models);\n }\n opt.em = this.editor;\n return Backbone.Collection.prototype.add.apply(this, [models, opt]);\n }\n});\n\n/***/ }),\n/* 139 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar CssRuleView = __webpack_require__(48);\nvar CssGroupRuleView = __webpack_require__(140);\n\nmodule.exports = __webpack_require__(0).View.extend({\n initialize: function initialize(o) {\n var config = o.config || {};\n this.atRules = {};\n this.config = config;\n this.em = config.em;\n this.pfx = config.stylePrefix || '';\n this.className = this.pfx + 'rules';\n var coll = this.collection;\n this.listenTo(coll, 'add', this.addTo);\n this.listenTo(coll, 'reset', this.render);\n },\n\n\n /**\n * Add to collection\n * @param {Object} model\n * @private\n * */\n addTo: function addTo(model) {\n this.addToCollection(model);\n },\n\n\n /**\n * Add new object to collection\n * @param {Object} model\n * @param {Object} fragmentEl\n * @return {Object}\n * @private\n * */\n addToCollection: function addToCollection(model, fragmentEl) {\n var fragment = fragmentEl || null;\n var viewObject = CssRuleView;\n var config = this.config;\n var rendered = void 0,\n view = void 0;\n var opts = { model: model, config: config };\n\n // I have to render keyframes of the same name together\n // Unfortunately at the moment I didn't find the way of appending them\n // if not staticly, via appendData\n if (model.get('atRuleType') == 'keyframes') {\n var atRule = model.getAtRule();\n var atRuleEl = this.atRules[atRule];\n\n if (!atRuleEl) {\n var styleEl = document.createElement('style');\n atRuleEl = document.createTextNode('');\n styleEl.appendChild(document.createTextNode(atRule + '{'));\n styleEl.appendChild(atRuleEl);\n styleEl.appendChild(document.createTextNode('}'));\n this.atRules[atRule] = atRuleEl;\n rendered = styleEl;\n }\n\n view = new CssGroupRuleView(opts);\n atRuleEl.appendData(view.render().el.textContent);\n } else {\n view = new CssRuleView(opts);\n rendered = view.render().el;\n }\n\n if (rendered) {\n if (fragment) fragment.appendChild(rendered);else this.$el.append(rendered);\n }\n\n return rendered;\n },\n render: function render() {\n var _this = this;\n\n this.atRules = {};\n var $el = this.$el;\n var frag = document.createDocumentFragment();\n $el.empty();\n this.collection.each(function (model) {\n return _this.addToCollection(model, frag);\n });\n $el.append(frag);\n $el.attr('class', this.className);\n return this;\n }\n});\n\n/***/ }),\n/* 140 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = __webpack_require__(48).extend({\n _createElement: function _createElement(tagName) {\n return document.createTextNode('');\n },\n\n render: function render() {\n var model = this.model;\n var important = model.get('important');\n this.el.textContent = model.getDeclaration({ important: important });\n return this;\n }\n});\n\n/***/ }),\n/* 141 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _underscore = __webpack_require__(1);\n\nmodule.exports = function () {\n var c = {};\n var defaultOpts = __webpack_require__(142);\n var TraitsView = __webpack_require__(143);\n var TraitsViewer = void 0;\n\n return {\n TraitsView: TraitsView,\n\n /**\n * Name of the module\n * @type {String}\n * @private\n */\n name: 'TraitManager',\n\n /**\n * Get configuration object\n * @return {Object}\n * @private\n */\n getConfig: function getConfig() {\n return c;\n },\n\n\n /**\n * Initialize module. Automatically called with a new instance of the editor\n * @param {Object} config Configurations\n */\n init: function init() {\n var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n c = config;\n (0, _underscore.defaults)(c, defaultOpts);\n var ppfx = c.pStylePrefix;\n ppfx && (c.stylePrefix = '' + ppfx + c.stylePrefix);\n TraitsViewer = new TraitsView({\n collection: [],\n editor: c.em,\n config: c\n });\n return this;\n },\n\n\n /**\n *\n * Get Traits viewer\n * @private\n */\n getTraitsViewer: function getTraitsViewer() {\n return TraitsViewer;\n },\n\n\n /**\n * Add new trait type\n * @param {string} name Type name\n * @param {Object} methods Object representing the trait\n */\n addType: function addType(name, trait) {\n var itemView = TraitsViewer.itemView;\n TraitsViewer.itemsView[name] = itemView.extend(trait);\n },\n\n\n /**\n * Get trait type\n * @param {string} name Type name\n * @return {Object}\n */\n getType: function getType(name) {\n return TraitsViewer.itemsView[name];\n }\n };\n};\n\n/***/ }),\n/* 142 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = {\n stylePrefix: 'trt-',\n\n labelContainer: 'Component settings',\n\n // Placeholder label for text input types\n labelPlhText: 'eg. Text here',\n\n // Placeholder label for href input\n labelPlhHref: 'eg. https://google.com',\n\n // Default options for the target input\n optionsTarget: [{ value: '', name: 'This window' }, { value: '_blank', name: 'New window' }]\n};\n\n/***/ }),\n/* 143 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar DomainViews = __webpack_require__(49);\nvar TraitView = __webpack_require__(8);\nvar TraitSelectView = __webpack_require__(144);\nvar TraitCheckboxView = __webpack_require__(145);\nvar TraitNumberView = __webpack_require__(146);\nvar TraitColorView = __webpack_require__(147);\n\nmodule.exports = DomainViews.extend({\n itemView: TraitView,\n\n itemsView: {\n text: TraitView,\n number: TraitNumberView,\n select: TraitSelectView,\n checkbox: TraitCheckboxView,\n color: TraitColorView\n },\n\n initialize: function initialize(o) {\n this.config = o.config || {};\n this.em = o.editor;\n this.pfx = this.config.stylePrefix || '';\n this.className = this.pfx + 'traits';\n this.listenTo(this.em, 'change:selectedComponent', this.updatedCollection);\n this.updatedCollection();\n },\n\n\n /**\n * Update view collection\n * @private\n */\n updatedCollection: function updatedCollection() {\n this.el.className = this.className;\n var comp = this.em.get('selectedComponent');\n if (comp) {\n this.collection = comp.get('traits');\n this.render();\n }\n }\n});\n\n/***/ }),\n/* 144 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Backbone, _) {\n\nvar TraitView = __webpack_require__(8);\nvar $ = Backbone.$;\n\nmodule.exports = TraitView.extend({\n initialize: function initialize(o) {\n TraitView.prototype.initialize.apply(this, arguments);\n var ppfx = this.ppfx;\n this.tmpl = '<div class=\"' + this.fieldClass + '\"><div class=\"' + this.inputhClass + '\"></div>' + '<div class=\"' + ppfx + 'sel-arrow\"><div class=\"' + ppfx + 'd-s-arrow\"></div></div> </div>';\n },\n\n\n /**\n * Returns input element\n * @return {HTMLElement}\n * @private\n */\n getInputEl: function getInputEl() {\n if (!this.$input) {\n var md = this.model;\n var opts = md.get('options') || [];\n var input = '<select>';\n\n if (opts.length) {\n _.each(opts, function (el) {\n var name, value, style;\n var attrs = '';\n if (typeof el === 'string') {\n name = el;\n value = el;\n } else {\n name = el.name ? el.name : el.value;\n value = el.value.replace(/\"/g, '"');\n style = el.style ? el.style.replace(/\"/g, '"') : '';\n attrs += style ? 'style=\"' + style + '\"' : '';\n }\n input += '<option value=\"' + value + '\" ' + attrs + '>' + name + '</option>';\n });\n }\n\n input += '</select>';\n this.input = input;\n this.$input = $(this.input);\n\n var target = this.target;\n var name = md.get('name');\n var val = md.get('value');\n\n if (md.get('changeProp')) {\n val = val || target.get(name);\n } else {\n var attrs = target.get('attributes');\n val = attrs[name];\n }\n\n if (val) this.$input.val(val);\n }\n\n return this.$input.get(0);\n }\n});\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0), __webpack_require__(1)))\n\n/***/ }),\n/* 145 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar TraitView = __webpack_require__(8);\n\nmodule.exports = TraitView.extend({\n initialize: function initialize(o) {\n TraitView.prototype.initialize.apply(this, arguments);\n var iconCls = this.ppfx + 'chk-icon';\n this.tmpl = '<div class=\"' + this.fieldClass + '\"><label class=\"' + this.inputhClass + '\"><i class=\"' + iconCls + '\"></i></label></div>';\n },\n\n\n /**\n * Fires when the input is changed\n * @private\n */\n onChange: function onChange() {\n this.model.set('value', this.getInputEl().checked);\n },\n\n\n /**\n * Returns input element\n * @return {HTMLElement}\n * @private\n */\n getInputEl: function getInputEl() {\n var first;\n if (!this.$input) first = 1;\n\n for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n var el = TraitView.prototype.getInputEl.apply(this, args);\n if (first) {\n var md = this.model;\n var name = md.get('name');\n var target = this.target;\n if (md.get('changeProp')) {\n el.checked = target.get(name);\n } else {\n var attrs = target.get('attributes');\n el.checked = !!attrs[name];\n }\n }\n return el;\n }\n});\n\n/***/ }),\n/* 146 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar TraitView = __webpack_require__(8);\nvar InputNumber = __webpack_require__(18);\n\nmodule.exports = TraitView.extend({\n getValueForTarget: function getValueForTarget() {\n var model = this.model;\n var value = model.get('value');\n var unit = model.get('unit');\n return value ? value + unit : '';\n },\n\n\n /**\n * Returns input element\n * @return {HTMLElement}\n * @private\n */\n getInputEl: function getInputEl() {\n if (!this.$input) {\n var value = this.getModelValue();\n var inputNumber = new InputNumber({\n contClass: this.ppfx + 'field-int',\n model: this.model,\n ppfx: this.ppfx\n });\n this.input = inputNumber.render();\n this.$input = this.input.inputEl;\n this.$unit = this.input.unitEl;\n this.model.set('value', value);\n this.$input.val(value);\n }\n return this.$input.get(0);\n },\n\n\n /**\n * Renders input\n * @private\n * */\n renderField: function renderField() {\n if (!this.$input) {\n this.$el.append(this.tmpl);\n this.getInputEl();\n this.$el.find('.' + this.inputhClass).prepend(this.input.el);\n }\n }\n});\n\n/***/ }),\n/* 147 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar TraitView = __webpack_require__(8);\nvar InputColor = __webpack_require__(39);\n\nmodule.exports = TraitView.extend({\n /**\n * Returns input element\n * @return {HTMLElement}\n * @private\n */\n getInputEl: function getInputEl() {\n if (!this.$input) {\n var value = this.getModelValue();\n var inputColor = new InputColor({\n target: this.config.em,\n contClass: this.ppfx + 'field-color',\n model: this.model,\n ppfx: this.ppfx\n });\n this.input = inputColor.render();\n this.$input = this.input.colorEl;\n value = value || '';\n this.model.set('value', value).trigger('change:value');\n this.input.setValue(value);\n }\n return this.$input.get(0);\n },\n\n\n /**\n * Renders input\n * @private\n * */\n renderField: function renderField() {\n if (!this.$input) {\n this.getInputEl();\n this.$el.append(this.input.el);\n }\n }\n});\n\n/***/ }),\n/* 148 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\n/**\n *\n * * [getWrapper](#getwrapper)\n * * [getComponents](#getcomponents)\n * * [addComponent](#addcomponent)\n * * [clear](#clear)\n * * [load](#load)\n * * [store](#store)\n * * [render](#render)\n *\n * With this module is possible to manage components inside the canvas.\n * Before using methods you should get first the module from the editor instance, in this way:\n *\n * ```js\n * var domComponents = editor.DomComponents;\n * ```\n *\n * @module DomComponents\n * @param {Object} config Configurations\n * @param {string|Array<Object>} [config.components=[]] HTML string or an array of possible components\n * @example\n * ...\n * domComponents: {\n * components: '<div>Hello world!</div>',\n * }\n * // Or\n * domComponents: {\n * components: [\n * { tagName: 'span', style: {color: 'red'}, content: 'Hello'},\n * { style: {width: '100px', content: 'world!'}}\n * ],\n * }\n * ...\n */\nmodule.exports = function () {\n var c = {};\n var em = void 0;\n var defaults = __webpack_require__(149);\n var Component = __webpack_require__(4);\n var ComponentView = __webpack_require__(3);\n var Components = __webpack_require__(50);\n var ComponentsView = __webpack_require__(51);\n\n var component, componentView;\n var componentTypes = [{\n id: 'cell',\n model: __webpack_require__(153),\n view: __webpack_require__(154)\n }, {\n id: 'row',\n model: __webpack_require__(155),\n view: __webpack_require__(156)\n }, {\n id: 'table',\n model: __webpack_require__(157),\n view: __webpack_require__(158)\n }, {\n id: 'thead',\n model: __webpack_require__(159),\n view: __webpack_require__(160)\n }, {\n id: 'tbody',\n model: __webpack_require__(19),\n view: __webpack_require__(161)\n }, {\n id: 'tfoot',\n model: __webpack_require__(162),\n view: __webpack_require__(163)\n }, {\n id: 'map',\n model: __webpack_require__(164),\n view: __webpack_require__(165)\n }, {\n id: 'link',\n model: __webpack_require__(166),\n view: __webpack_require__(167)\n }, {\n id: 'video',\n model: __webpack_require__(168),\n view: __webpack_require__(169)\n }, {\n id: 'image',\n model: __webpack_require__(20),\n view: __webpack_require__(15)\n }, {\n id: 'script',\n model: __webpack_require__(170),\n view: __webpack_require__(171)\n }, {\n id: 'svg',\n model: __webpack_require__(172),\n view: __webpack_require__(173)\n }, {\n id: 'textnode',\n model: __webpack_require__(174),\n view: __webpack_require__(175)\n }, {\n id: 'text',\n model: __webpack_require__(52),\n view: __webpack_require__(53)\n }, {\n id: 'default',\n model: Component,\n view: ComponentView\n }];\n\n return {\n Component: Component,\n\n Components: Components,\n\n ComponentsView: ComponentsView,\n\n componentTypes: componentTypes,\n\n /**\n * Name of the module\n * @type {String}\n * @private\n */\n name: 'DomComponents',\n\n /**\n * Returns config\n * @return {Object} Config object\n * @private\n */\n getConfig: function getConfig() {\n return c;\n },\n\n\n /**\n * Mandatory for the storage manager\n * @type {String}\n * @private\n */\n storageKey: function storageKey() {\n var keys = [];\n var smc = c.stm && c.stm.getConfig() || {};\n if (smc.storeHtml) keys.push('html');\n if (smc.storeComponents) keys.push('components');\n return keys;\n },\n\n\n /**\n * Initialize module. Called on a new instance of the editor with configurations passed\n * inside 'domComponents' field\n * @param {Object} config Configurations\n * @private\n */\n init: function init(config) {\n c = config || {};\n em = c.em;\n\n if (em) {\n c.components = em.config.components || c.components;\n }\n\n for (var name in defaults) {\n if (!(name in c)) c[name] = defaults[name];\n }\n\n var ppfx = c.pStylePrefix;\n if (ppfx) c.stylePrefix = ppfx + c.stylePrefix;\n\n // Load dependencies\n if (em) {\n c.modal = em.get('Modal') || '';\n c.am = em.get('AssetManager') || '';\n em.get('Parser').compTypes = componentTypes;\n em.on('change:selectedComponent', this.componentChanged, this);\n }\n\n // Build wrapper\n var components = c.components;\n var wrapper = _extends({}, c.wrapper);\n wrapper['custom-name'] = c.wrapperName;\n wrapper.wrapper = 1;\n\n // Components might be a wrapper\n if (components && components.constructor === Object && components.wrapper) {\n wrapper = _extends({}, components);\n components = components.components || [];\n wrapper.components = [];\n\n // Have to put back the real object of components\n if (em) {\n em.config.components = components;\n c.components = components;\n }\n }\n\n component = new Component(wrapper, {\n em: em,\n config: c,\n componentTypes: componentTypes\n });\n component.set({ attributes: { id: 'wrapper' } });\n\n componentView = new ComponentView({\n model: component,\n config: c,\n componentTypes: componentTypes\n });\n return this;\n },\n\n\n /**\n * On load callback\n * @private\n */\n onLoad: function onLoad() {\n this.setComponents(c.components);\n },\n\n\n /**\n * Do stuff after load\n * @param {Editor} em\n * @private\n */\n postLoad: function postLoad(em) {\n this.handleChanges(this.getWrapper(), null, { avoidStore: 1 });\n },\n\n\n /**\n * Handle component changes\n * @private\n */\n handleChanges: function handleChanges(model, value) {\n var _this = this;\n\n var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n var comps = model.components();\n var um = em.get('UndoManager');\n var handleUpdates = em.handleUpdates.bind(em);\n var handleChanges = this.handleChanges.bind(this);\n var handleRemoves = this.handleRemoves.bind(this);\n um && um.add(model);\n um && comps && um.add(comps);\n var evn = 'change:style change:content change:attributes change:src';\n\n [[model, evn, handleUpdates], [comps, 'add', handleChanges], [comps, 'remove', handleRemoves], [model.get('classes'), 'add remove', handleUpdates]].forEach(function (els) {\n em.stopListening(els[0], els[1], els[2]);\n em.listenTo(els[0], els[1], els[2]);\n });\n\n !opts.avoidStore && handleUpdates('', '', opts);\n comps.each(function (model) {\n return _this.handleChanges(model, value, opts);\n });\n },\n\n\n /**\n * Triggered when some component is removed\n * @private\n * */\n handleRemoves: function handleRemoves(model, value) {\n var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n !opts.avoidStore && em.handleUpdates(model, value, opts);\n },\n\n\n /**\n * Load components from the passed object, if the object is empty will try to fetch them\n * autonomously from the selected storage\n * The fetched data will be added to the collection\n * @param {Object} data Object of data to load\n * @return {Object} Loaded data\n */\n load: function load() {\n var data = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';\n\n var result = '';\n\n if (!data && c.stm) {\n data = c.em.getCacheLoad();\n }\n\n if (data.components) {\n try {\n result = JSON.parse(data.components);\n } catch (err) {}\n } else if (data.html) {\n result = data.html;\n }\n\n var isObj = result && result.constructor === Object;\n\n if (result && result.length || isObj) {\n this.clear();\n this.getComponents().reset();\n\n // If the result is an object I consider it the wrapper\n if (isObj) {\n this.getWrapper().set(result).initComponents().initClasses().loadTraits();\n } else {\n this.getComponents().add(result);\n }\n }\n\n return result;\n },\n\n\n /**\n * Store components on the selected storage\n * @param {Boolean} noStore If true, won't store\n * @return {Object} Data to store\n */\n store: function store(noStore) {\n if (!c.stm) {\n return;\n }\n\n var obj = {};\n var keys = this.storageKey();\n\n if (keys.indexOf('html') >= 0) {\n obj.html = c.em.getHtml();\n }\n\n if (keys.indexOf('components') >= 0) {\n var toStore = c.storeWrapper ? this.getWrapper() : this.getComponents();\n obj.components = JSON.stringify(toStore);\n }\n\n if (!noStore) {\n c.stm.store(obj);\n }\n\n return obj;\n },\n\n\n /**\n * Returns privately the main wrapper\n * @return {Object}\n * @private\n */\n getComponent: function getComponent() {\n return component;\n },\n\n\n /**\n * Returns root component inside the canvas. Something like <body> inside HTML page\n * The wrapper doesn't differ from the original Component Model\n * @return {Component} Root Component\n * @example\n * // Change background of the wrapper and set some attribute\n * var wrapper = domComponents.getWrapper();\n * wrapper.set('style', {'background-color': 'red'});\n * wrapper.set('attributes', {'title': 'Hello!'});\n */\n getWrapper: function getWrapper() {\n return this.getComponent();\n },\n\n\n /**\n * Returns wrapper's children collection. Once you have the collection you can\n * add other Components(Models) inside. Each component can have several nested\n * components inside and you can nest them as more as you wish.\n * @return {Components} Collection of components\n * @example\n * // Let's add some component\n * var wrapperChildren = domComponents.getComponents();\n * var comp1 = wrapperChildren.add({\n * style: { 'background-color': 'red'}\n * });\n * var comp2 = wrapperChildren.add({\n * tagName: 'span',\n * attributes: { title: 'Hello!'}\n * });\n * // Now let's add an other one inside first component\n * // First we have to get the collection inside. Each\n * // component has 'components' property\n * var comp1Children = comp1.get('components');\n * // Procede as before. You could also add multiple objects\n * comp1Children.add([\n * { style: { 'background-color': 'blue'}},\n * { style: { height: '100px', width: '100px'}}\n * ]);\n * // Remove comp2\n * wrapperChildren.remove(comp2);\n */\n getComponents: function getComponents() {\n return this.getWrapper().get('components');\n },\n\n\n /**\n * Add new components to the wrapper's children. It's the same\n * as 'domComponents.getComponents().add(...)'\n * @param {Object|Component|Array<Object>} component Component/s to add\n * @param {string} [component.tagName='div'] Tag name\n * @param {string} [component.type=''] Type of the component. Available: ''(default), 'text', 'image'\n * @param {boolean} [component.removable=true] If component is removable\n * @param {boolean} [component.draggable=true] If is possible to move the component around the structure\n * @param {boolean} [component.droppable=true] If is possible to drop inside other components\n * @param {boolean} [component.badgable=true] If the badge is visible when the component is selected\n * @param {boolean} [component.stylable=true] If is possible to style component\n * @param {boolean} [component.copyable=true] If is possible to copy&paste the component\n * @param {string} [component.content=''] String inside component\n * @param {Object} [component.style={}] Style object\n * @param {Object} [component.attributes={}] Attribute object\n * @return {Component|Array<Component>} Component/s added\n * @example\n * // Example of a new component with some extra property\n * var comp1 = domComponents.addComponent({\n * tagName: 'div',\n * removable: true, // Can't remove it\n * draggable: true, // Can't move it\n * copyable: true, // Disable copy/past\n * content: 'Content text', // Text inside component\n * style: { color: 'red'},\n * attributes: { title: 'here' }\n * });\n */\n addComponent: function addComponent(component) {\n return this.getComponents().add(component);\n },\n\n\n /**\n * Render and returns wrapper element with all components inside.\n * Once the wrapper is rendered, and it's what happens when you init the editor,\n * the all new components will be added automatically and property changes are all\n * updated immediately\n * @return {HTMLElement}\n */\n render: function render() {\n return componentView.render().el;\n },\n\n\n /**\n * Remove all components\n * @return {this}\n */\n clear: function clear() {\n var c = this.getComponents();\n for (var i = 0, len = c.length; i < len; i++) {\n c.pop();\n }return this;\n },\n\n\n /**\n * Set components\n * @param {Object|string} components HTML string or components model\n * @return {this}\n * @private\n */\n setComponents: function setComponents(components) {\n this.clear().addComponent(components);\n },\n\n\n /**\n * Add new component type\n * @param {string} type\n * @param {Object} methods\n * @private\n */\n addType: function addType(type, methods) {\n var compType = this.getType(type);\n if (compType) {\n compType.model = methods.model;\n compType.view = methods.view;\n } else {\n methods.id = type;\n componentTypes.unshift(methods);\n }\n },\n\n\n /**\n * Get component type\n * @param {string} type\n * @private\n */\n getType: function getType(type) {\n var df = componentTypes;\n\n for (var it = 0; it < df.length; it++) {\n var dfId = df[it].id;\n if (dfId == type) {\n return df[it];\n }\n }\n return;\n },\n\n\n /**\n * Triggered when the selected component is changed\n * @private\n */\n componentChanged: function componentChanged() {\n var em = c.em;\n var model = em.get('selectedComponent');\n var previousModel = em.previous('selectedComponent');\n\n // Deselect the previous component\n if (previousModel) {\n previousModel.set({\n status: '',\n state: ''\n });\n }\n\n model && model.set('status', 'selected');\n }\n };\n};\n\n/***/ }),\n/* 149 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = {\n stylePrefix: 'comp-',\n\n wrapperId: 'wrapper',\n\n wrapperName: 'Body',\n\n // Default wrapper configuration\n wrapper: {\n removable: false,\n copyable: false,\n draggable: false,\n components: [],\n traits: [],\n stylable: ['background', 'background-color', 'background-image', 'background-repeat', 'background-attachment', 'background-position', 'background-size']\n },\n\n // Could be used for default components\n components: [],\n\n // Class for new image component\n imageCompClass: 'fa fa-picture-o',\n\n // Open assets manager on create of image component\n oAssetsOnCreate: true,\n\n // TODO to remove\n // Editor should also store the wrapper informations, but as this change might\n // break stuff I set ii as an opt-in option, for now.\n storeWrapper: 0,\n\n // List of void elements\n voidElements: ['area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr']\n};\n\n/***/ }),\n/* 150 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _underscore = __webpack_require__(1);\n\nvar Backbone = __webpack_require__(0);\nvar Trait = __webpack_require__(151);\nvar TraitFactory = __webpack_require__(152);\n\nmodule.exports = Backbone.Collection.extend({\n model: Trait,\n\n initialize: function initialize(coll) {\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n this.em = options.em || '';\n },\n setTarget: function setTarget(target) {\n this.target = target;\n },\n add: function add(models, opt) {\n var em = this.em;\n\n // Use TraitFactory if necessary\n if ((0, _underscore.isString)(models) || (0, _underscore.isArray)(models)) {\n var tm = em && em.get && em.get('TraitManager');\n var tmOpts = tm && tm.getConfig();\n var tf = TraitFactory(tmOpts);\n\n if ((0, _underscore.isString)(models)) {\n models = [models];\n }\n\n for (var i = 0, len = models.length; i < len; i++) {\n var str = models[i];\n var model = (0, _underscore.isString)(str) ? tf.build(str)[0] : str;\n model.target = this.target;\n models[i] = model;\n }\n }\n\n return Backbone.Collection.prototype.add.apply(this, [models, opt]);\n }\n});\n\n/***/ }),\n/* 151 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar _underscore = __webpack_require__(1);\n\nmodule.exports = __webpack_require__(0).Model.extend({\n defaults: {\n type: 'text', // text, number, range, select\n label: '',\n name: '',\n min: '',\n max: '',\n unit: '',\n step: 1,\n value: '',\n target: '',\n default: '',\n placeholder: '',\n changeProp: 0,\n options: []\n },\n\n initialize: function initialize() {\n var target = this.get('target');\n var name = this.get('name');\n var changeProp = this.get('changeProp');\n\n if (target) {\n this.target = target;\n this.unset('target');\n var targetEvent = changeProp ? 'change:' + name : 'change:attributes:' + name;\n this.listenTo(target, targetEvent, this.targetUpdated);\n }\n },\n targetUpdated: function targetUpdated() {\n var value = this.getTargetValue();\n !(0, _underscore.isUndefined)(value) && this.set({ value: value }, { fromTarget: 1 });\n },\n getTargetValue: function getTargetValue() {\n var name = this.get('name');\n var target = this.target;\n var prop = this.get('changeProp');\n if (target) return prop ? target.get(name) : target.getAttributes()[name];\n },\n setTargetValue: function setTargetValue(value) {\n var target = this.target;\n var name = this.get('name');\n if ((0, _underscore.isUndefined)(value)) return;\n\n if (this.get('changeProp')) {\n target.set(name, value);\n } else {\n var attrs = _extends({}, target.get('attributes'));\n attrs[name] = value;\n target.set('attributes', attrs);\n }\n },\n setValueFromInput: function setValueFromInput(value) {\n var final = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;\n var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n var toSet = { value: value };\n this.set(toSet, _extends({}, opts, { avoidStore: 1 }));\n\n // Have to trigger the change\n if (final) {\n this.set('value', '', opts);\n this.set(toSet, opts);\n }\n },\n\n\n /**\n * Get the initial value of the trait\n * @return {string}\n */\n getInitValue: function getInitValue() {\n var target = this.target;\n var name = this.get('name');\n var value = void 0;\n\n if (target) {\n var attrs = target.get('attributes');\n value = this.get('changeProp') ? target.get(name) : attrs[name];\n }\n\n return value || this.get('value') || this.get('default');\n }\n});\n\n/***/ }),\n/* 152 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = function () {\n var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n return {\n /**\n * Build props object by their name\n * @param {Array<string>|string} props Array of properties name\n * @return {Array<Object>}\n */\n build: function build(props) {\n var objs = [];\n\n if (typeof props === 'string') props = [props];\n\n for (var i = 0; i < props.length; i++) {\n var obj = {};\n var prop = props[i];\n obj.name = prop;\n\n // Define type\n switch (prop) {\n case 'target':\n obj.type = 'select';\n break;\n }\n\n // Define placeholder\n switch (prop) {\n case 'title':\n case 'alt':\n case 'id':\n obj.placeholder = config.labelPlhText;\n break;\n case 'href':\n obj.placeholder = config.labelPlhHref;\n break;\n }\n\n // Define options\n switch (prop) {\n case 'target':\n obj.options = config.optionsTarget;\n break;\n }\n\n objs.push(obj);\n }\n\n return objs;\n }\n };\n};\n\n/***/ }),\n/* 153 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar Component = __webpack_require__(4);\n\nmodule.exports = Component.extend({\n defaults: _extends({}, Component.prototype.defaults, {\n type: 'cell',\n tagName: 'td',\n draggable: ['tr']\n })\n}, {\n isComponent: function isComponent(el) {\n var result = '';\n var tag = el.tagName;\n\n if (tag == 'TD' || tag == 'TH') {\n result = {\n type: 'cell',\n tagName: tag.toLowerCase()\n };\n }\n\n return result;\n }\n});\n\n/***/ }),\n/* 154 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar Backbone = __webpack_require__(0);\nvar ComponentView = __webpack_require__(3);\n\nmodule.exports = ComponentView.extend({});\n\n/***/ }),\n/* 155 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar Component = __webpack_require__(4);\n\nmodule.exports = Component.extend({\n defaults: _extends({}, Component.prototype.defaults, {\n type: 'row',\n tagName: 'tr',\n draggable: ['thead', 'tbody', 'tfoot'],\n droppable: ['th', 'td']\n }),\n\n initialize: function initialize(o, opt) {\n Component.prototype.initialize.apply(this, arguments);\n\n // Clean the row from non cell components\n var cells = [];\n var components = this.get('components');\n components.each(function (model) {\n return model.is('cell') && cells.push(model);\n });\n components.reset(cells);\n }\n}, {\n isComponent: function isComponent(el) {\n var result = '';\n\n if (el.tagName == 'TR') {\n result = { type: 'row' };\n }\n\n return result;\n }\n});\n\n/***/ }),\n/* 156 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar Backbone = __webpack_require__(0);\nvar ComponentView = __webpack_require__(3);\n\nmodule.exports = ComponentView.extend({});\n\n/***/ }),\n/* 157 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar Component = __webpack_require__(4);\n\nmodule.exports = Component.extend({\n defaults: _extends({}, Component.prototype.defaults, {\n type: 'table',\n tagName: 'table',\n droppable: ['tbody', 'thead', 'tfoot']\n }),\n\n initialize: function initialize(o, opt) {\n Component.prototype.initialize.apply(this, arguments);\n var components = this.get('components');\n !components.length && components.add({ type: 'tbody' });\n }\n}, {\n isComponent: function isComponent(el) {\n var result = '';\n\n if (el.tagName == 'TABLE') {\n result = { type: 'table' };\n }\n\n return result;\n }\n});\n\n/***/ }),\n/* 158 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar Backbone = __webpack_require__(0);\nvar ComponentView = __webpack_require__(3);\n\nmodule.exports = ComponentView.extend({\n events: {}\n});\n\n/***/ }),\n/* 159 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar ComponentTableBody = __webpack_require__(19);\n\nmodule.exports = ComponentTableBody.extend({\n defaults: _extends({}, ComponentTableBody.prototype.defaults, {\n type: 'thead',\n tagName: 'thead'\n })\n}, {\n isComponent: function isComponent(el) {\n var result = '';\n\n if (el.tagName == 'THEAD') {\n result = { type: 'thead' };\n }\n\n return result;\n }\n});\n\n/***/ }),\n/* 160 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar Backbone = __webpack_require__(0);\nvar ComponentView = __webpack_require__(3);\n\nmodule.exports = ComponentView.extend({});\n\n/***/ }),\n/* 161 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar Backbone = __webpack_require__(0);\nvar ComponentView = __webpack_require__(3);\n\nmodule.exports = ComponentView.extend({});\n\n/***/ }),\n/* 162 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar ComponentTableBody = __webpack_require__(19);\n\nmodule.exports = ComponentTableBody.extend({\n defaults: _extends({}, ComponentTableBody.prototype.defaults, {\n type: 'tfoot',\n tagName: 'tfoot'\n })\n}, {\n isComponent: function isComponent(el) {\n var result = '';\n\n if (el.tagName == 'TFOOT') {\n result = { type: 'tfoot' };\n }\n\n return result;\n }\n});\n\n/***/ }),\n/* 163 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar Backbone = __webpack_require__(0);\nvar ComponentView = __webpack_require__(3);\n\nmodule.exports = ComponentView.extend({});\n\n/***/ }),\n/* 164 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(_) {\n\nvar Component = __webpack_require__(20);\nvar OComponent = __webpack_require__(4);\n\nmodule.exports = Component.extend({\n defaults: _.extend({}, Component.prototype.defaults, {\n type: 'map',\n void: 0,\n mapUrl: 'https://maps.google.com/maps',\n tagName: 'iframe',\n mapType: 'q',\n address: '',\n zoom: '1',\n attributes: { frameborder: 0 },\n toolbar: OComponent.prototype.defaults.toolbar,\n traits: [{\n label: 'Address',\n name: 'address',\n placeholder: 'eg. London, UK',\n changeProp: 1\n }, {\n type: 'select',\n label: 'Map type',\n name: 'mapType',\n changeProp: 1,\n options: [{ value: 'q', name: 'Roadmap' }, { value: 'w', name: 'Satellite' }]\n }, {\n label: 'Zoom',\n name: 'zoom',\n type: 'range',\n min: '1',\n max: '20',\n changeProp: 1\n }]\n }),\n\n initialize: function initialize(o, opt) {\n if (this.get('src')) this.parseFromSrc();else this.updateSrc();\n Component.prototype.initialize.apply(this, arguments);\n this.listenTo(this, 'change:address change:zoom change:mapType', this.updateSrc);\n },\n updateSrc: function updateSrc() {\n this.set('src', this.getMapUrl());\n },\n\n\n /**\n * Returns url of the map\n * @return {string}\n * @private\n */\n getMapUrl: function getMapUrl() {\n var md = this;\n var addr = md.get('address');\n var zoom = md.get('zoom');\n var type = md.get('mapType');\n var size = '';\n addr = addr ? '&q=' + addr : '';\n zoom = zoom ? '&z=' + zoom : '';\n type = type ? '&t=' + type : '';\n var result = md.get('mapUrl') + '?' + addr + zoom + type;\n result += '&output=embed';\n return result;\n },\n\n\n /**\n * Set attributes by src string\n * @private\n */\n parseFromSrc: function parseFromSrc() {\n var uri = this.parseUri(this.get('src'));\n var qr = uri.query;\n if (qr.q) this.set('address', qr.q);\n if (qr.z) this.set('zoom', qr.z);\n if (qr.t) this.set('mapType', qr.t);\n }\n}, {\n /**\n * Detect if the passed element is a valid component.\n * In case the element is valid an object abstracted\n * from the element will be returned\n * @param {HTMLElement}\n * @return {Object}\n * @private\n */\n isComponent: function isComponent(el) {\n var result = '';\n if (el.tagName == 'IFRAME' && /maps\\.google\\.com/.test(el.src)) {\n result = { type: 'map', src: el.src };\n }\n return result;\n }\n});\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))\n\n/***/ }),\n/* 165 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar Backbone = __webpack_require__(0);\nvar ComponentView = __webpack_require__(15);\n\nmodule.exports = ComponentView.extend({\n tagName: 'div',\n\n events: {},\n\n initialize: function initialize(o) {\n ComponentView.prototype.initialize.apply(this, arguments);\n this.classEmpty = this.ppfx + 'plh-map';\n },\n\n\n /**\n * Update the map on the canvas\n * @private\n */\n updateSrc: function updateSrc() {\n this.getIframe().src = this.model.get('src');\n },\n getIframe: function getIframe() {\n if (!this.iframe) {\n var ifrm = document.createElement('iframe');\n ifrm.src = this.model.get('src');\n ifrm.frameBorder = 0;\n ifrm.style.height = '100%';\n ifrm.style.width = '100%';\n ifrm.className = this.ppfx + 'no-pointer';\n this.iframe = ifrm;\n }\n return this.iframe;\n },\n render: function render() {\n for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n ComponentView.prototype.render.apply(this, args);\n this.updateClasses();\n this.el.appendChild(this.getIframe());\n return this;\n }\n});\n\n/***/ }),\n/* 166 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar Component = __webpack_require__(52);\n\nmodule.exports = Component.extend({\n defaults: _extends({}, Component.prototype.defaults, {\n type: 'link',\n tagName: 'a',\n traits: ['title', 'href', 'target']\n }),\n\n /**\n * Returns object of attributes for HTML\n * @return {Object}\n * @private\n */\n getAttrToHTML: function getAttrToHTML() {\n for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n var attr = Component.prototype.getAttrToHTML.apply(this, args);\n delete attr.onmousedown;\n return attr;\n }\n}, {\n isComponent: function isComponent(el) {\n var result = void 0;\n var avoidEdit = void 0;\n\n if (el.tagName == 'A') {\n result = {\n type: 'link',\n editable: 0\n };\n\n // The link is editable only if, at least, one of its\n // children is a text node (not empty one)\n var children = el.childNodes;\n var len = children.length;\n if (!len) delete result.editable;\n\n for (var i = 0; i < len; i++) {\n var child = children[i];\n\n if (child.nodeType == 3 && child.textContent.trim() != '') {\n delete result.editable;\n break;\n }\n }\n }\n\n return result;\n }\n});\n\n/***/ }),\n/* 167 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar Backbone = __webpack_require__(0);\nvar ComponentView = __webpack_require__(53);\n\nmodule.exports = ComponentView.extend({\n render: function render() {\n for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n ComponentView.prototype.render.apply(this, args);\n\n // I need capturing instead of bubbling as bubbled clicks from other\n // children will execute the link event\n this.el.addEventListener('click', this.prevDef, true);\n\n return this;\n }\n});\n\n/***/ }),\n/* 168 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar Component = __webpack_require__(20);\nvar OComponent = __webpack_require__(4);\nvar yt = 'yt';\nvar vi = 'vi';\n\nmodule.exports = Component.extend({\n defaults: _extends({}, Component.prototype.defaults, {\n type: 'video',\n tagName: 'video',\n videoId: '',\n void: 0,\n provider: '', // on change of provider, traits are switched\n ytUrl: 'https://www.youtube.com/embed/',\n viUrl: 'https://player.vimeo.com/video/',\n loop: 0,\n muted: 0,\n autoplay: 0,\n controls: 1,\n color: '',\n sources: [],\n attributes: { allowfullscreen: 'allowfullscreen' },\n toolbar: OComponent.prototype.defaults.toolbar\n }),\n\n initialize: function initialize(o, opt) {\n var traits = [];\n var prov = this.get('provider');\n switch (prov) {\n case yt:\n traits = this.getYoutubeTraits();\n break;\n case vi:\n traits = this.getVimeoTraits();\n break;\n default:\n traits = this.getSourceTraits();\n }\n if (this.get('src')) this.parseFromSrc();\n this.set('traits', traits);\n Component.prototype.initialize.apply(this, arguments);\n this.listenTo(this, 'change:provider', this.updateTraits);\n this.listenTo(this, 'change:videoId', this.updateSrc);\n },\n initToolbar: function initToolbar() {\n for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n OComponent.prototype.initToolbar.apply(this, args);\n },\n\n\n /**\n * Set attributes by src string\n */\n parseFromSrc: function parseFromSrc() {\n var prov = this.get('provider');\n var uri = this.parseUri(this.get('src'));\n var qr = uri.query;\n switch (prov) {\n case yt:\n case vi:\n var videoId = uri.pathname.split('/').pop();\n this.set('videoId', videoId);\n if (qr.autoplay) this.set('autoplay', 1);\n if (qr.loop) this.set('loop', 1);\n if (parseInt(qr.controls) === 0) this.set('controls', 0);\n if (qr.color) this.set('color', qr.color);\n break;\n default:\n }\n },\n\n\n /**\n * Update src on change of video ID\n * @private\n */\n updateSrc: function updateSrc() {\n var prov = this.get('provider');\n switch (prov) {\n case yt:\n this.set('src', this.getYoutubeSrc());\n break;\n case vi:\n this.set('src', this.getVimeoSrc());\n break;\n }\n },\n\n\n /**\n * Returns object of attributes for HTML\n * @return {Object}\n * @private\n */\n getAttrToHTML: function getAttrToHTML() {\n for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n\n var attr = Component.prototype.getAttrToHTML.apply(this, args);\n var prov = this.get('provider');\n switch (prov) {\n case yt:\n case vi:\n break;\n default:\n if (this.get('loop')) attr.loop = 'loop';\n if (this.get('autoplay')) attr.autoplay = 'autoplay';\n if (this.get('controls')) attr.controls = 'controls';\n }\n return attr;\n },\n\n\n /**\n * Update traits by provider\n * @private\n */\n updateTraits: function updateTraits() {\n var prov = this.get('provider');\n var traits = this.getSourceTraits();\n switch (prov) {\n case yt:\n this.set('tagName', 'iframe');\n traits = this.getYoutubeTraits();\n break;\n case vi:\n this.set('tagName', 'iframe');\n traits = this.getVimeoTraits();\n break;\n default:\n this.set('tagName', 'video');\n }\n this.loadTraits(traits);\n this.em.trigger('change:selectedComponent');\n },\n\n\n // Listen provider change and switch traits, in TraitView listen traits change\n\n /**\n * Return the provider trait\n * @return {Object}\n * @private\n */\n getProviderTrait: function getProviderTrait() {\n return {\n type: 'select',\n label: 'Provider',\n name: 'provider',\n changeProp: 1,\n value: this.get('provider'),\n options: [{ value: 'so', name: 'HTML5 Source' }, { value: yt, name: 'Youtube' }, { value: vi, name: 'Vimeo' }]\n };\n },\n\n\n /**\n * Return traits for the source provider\n * @return {Array<Object>}\n * @private\n */\n getSourceTraits: function getSourceTraits() {\n return [this.getProviderTrait(), {\n label: 'Source',\n name: 'src',\n placeholder: 'eg. ./media/video.mp4',\n changeProp: 1\n }, this.getAutoplayTrait(), this.getLoopTrait(), this.getControlsTrait()];\n },\n\n /**\n * Return traits for the source provider\n * @return {Array<Object>}\n * @private\n */\n getYoutubeTraits: function getYoutubeTraits() {\n return [this.getProviderTrait(), {\n label: 'Video ID',\n name: 'videoId',\n placeholder: 'eg. jNQXAC9IVRw',\n changeProp: 1\n }, this.getAutoplayTrait(), this.getLoopTrait(), this.getControlsTrait()];\n },\n\n\n /**\n * Return traits for the source provider\n * @return {Array<Object>}\n * @private\n */\n getVimeoTraits: function getVimeoTraits() {\n return [this.getProviderTrait(), {\n label: 'Video ID',\n name: 'videoId',\n placeholder: 'eg. 123456789',\n changeProp: 1\n }, {\n label: 'Color',\n name: 'color',\n placeholder: 'eg. FF0000',\n changeProp: 1\n }, this.getAutoplayTrait(), this.getLoopTrait(), this.getControlsTrait()];\n },\n\n\n /**\n * Return object trait\n * @return {Object}\n * @private\n */\n getAutoplayTrait: function getAutoplayTrait() {\n return {\n type: 'checkbox',\n label: 'Autoplay',\n name: 'autoplay',\n changeProp: 1\n };\n },\n\n\n /**\n * Return object trait\n * @return {Object}\n * @private\n */\n getLoopTrait: function getLoopTrait() {\n return {\n type: 'checkbox',\n label: 'Loop',\n name: 'loop',\n changeProp: 1\n };\n },\n\n\n /**\n * Return object trait\n * @return {Object}\n * @private\n */\n getControlsTrait: function getControlsTrait() {\n return {\n type: 'checkbox',\n label: 'Controls',\n name: 'controls',\n changeProp: 1\n };\n },\n\n\n /**\n * Returns url to youtube video\n * @return {string}\n * @private\n */\n getYoutubeSrc: function getYoutubeSrc() {\n var url = this.get('ytUrl');\n url += this.get('videoId') + '?';\n url += this.get('autoplay') ? '&autoplay=1' : '';\n url += !this.get('controls') ? '&controls=0' : '';\n url += this.get('loop') ? '&loop=1' : '';\n return url;\n },\n\n\n /**\n * Returns url to vimeo video\n * @return {string}\n * @private\n */\n getVimeoSrc: function getVimeoSrc() {\n var url = this.get('viUrl');\n url += this.get('videoId') + '?';\n url += this.get('autoplay') ? '&autoplay=1' : '';\n url += this.get('loop') ? '&loop=1' : '';\n url += !this.get('controls') ? '&title=0&portrait=0&badge=0' : '';\n url += this.get('color') ? '&color=' + this.get('color') : '';\n return url;\n }\n}, {\n /**\n * Detect if the passed element is a valid component.\n * In case the element is valid an object abstracted\n * from the element will be returned\n * @param {HTMLElement}\n * @return {Object}\n * @private\n */\n isComponent: function isComponent(el) {\n var result = '';\n var isYtProv = /youtube\\.com\\/embed/.test(el.src);\n var isViProv = /player\\.vimeo\\.com\\/video/.test(el.src);\n var isExtProv = isYtProv || isViProv;\n if (el.tagName == 'VIDEO' || el.tagName == 'IFRAME' && isExtProv) {\n result = { type: 'video' };\n if (el.src) result.src = el.src;\n if (isExtProv) {\n if (isYtProv) result.provider = yt;else if (isViProv) result.provider = vi;\n }\n }\n return result;\n }\n});\n\n/***/ }),\n/* 169 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar Backbone = __webpack_require__(0);\nvar ComponentView = __webpack_require__(15);\nvar OComponentView = __webpack_require__(3);\n\nmodule.exports = ComponentView.extend({\n tagName: 'div',\n\n events: {},\n\n initialize: function initialize(o) {\n OComponentView.prototype.initialize.apply(this, arguments);\n this.listenTo(this.model, 'change:src', this.updateSrc);\n this.listenTo(this.model, 'change:loop change:autoplay change:controls change:color', this.updateVideo);\n this.listenTo(this.model, 'change:provider', this.updateProvider);\n },\n\n\n /**\n * Rerender on update of the provider\n * @private\n */\n updateProvider: function updateProvider() {\n var prov = this.model.get('provider');\n this.el.innerHTML = '';\n this.el.appendChild(this.renderByProvider(prov));\n },\n\n\n /**\n * Update the source of the video\n * @private\n */\n updateSrc: function updateSrc() {\n var prov = this.model.get('provider');\n var src = this.model.get('src');\n switch (prov) {\n case 'yt':\n src = this.model.getYoutubeSrc();\n break;\n case 'vi':\n src = this.model.getVimeoSrc();\n break;\n }\n this.videoEl.src = src;\n },\n\n\n /**\n * Update video parameters\n * @private\n */\n updateVideo: function updateVideo() {\n var prov = this.model.get('provider');\n var videoEl = this.videoEl;\n var md = this.model;\n switch (prov) {\n case 'yt':\n case 'vi':\n this.model.trigger('change:videoId');\n break;\n default:\n videoEl.loop = md.get('loop');\n videoEl.autoplay = md.get('autoplay');\n videoEl.controls = md.get('controls');\n }\n },\n renderByProvider: function renderByProvider(prov) {\n var videoEl;\n switch (prov) {\n case 'yt':\n videoEl = this.renderYoutube();\n break;\n case 'vi':\n videoEl = this.renderVimeo();\n break;\n default:\n videoEl = this.renderSource();\n }\n this.videoEl = videoEl;\n return videoEl;\n },\n renderSource: function renderSource() {\n var el = document.createElement('video');\n el.src = this.model.get('src');\n this.initVideoEl(el);\n return el;\n },\n renderYoutube: function renderYoutube() {\n var el = document.createElement('iframe');\n el.src = this.model.getYoutubeSrc();\n el.frameBorder = 0;\n el.setAttribute('allowfullscreen', true);\n this.initVideoEl(el);\n return el;\n },\n renderVimeo: function renderVimeo() {\n var el = document.createElement('iframe');\n el.src = this.model.getVimeoSrc();\n el.frameBorder = 0;\n el.setAttribute('allowfullscreen', true);\n this.initVideoEl(el);\n return el;\n },\n initVideoEl: function initVideoEl(el) {\n el.className = this.ppfx + 'no-pointer';\n el.style.height = '100%';\n el.style.width = '100%';\n },\n render: function render() {\n for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n ComponentView.prototype.render.apply(this, args);\n this.updateClasses();\n var prov = this.model.get('provider');\n this.el.appendChild(this.renderByProvider(prov));\n return this;\n }\n});\n\n/***/ }),\n/* 170 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(_) {\n\nvar Component = __webpack_require__(4);\n\nmodule.exports = Component.extend({\n defaults: _.extend({}, Component.prototype.defaults, {\n type: 'script',\n droppable: false,\n draggable: false,\n layerable: false\n })\n}, {\n isComponent: function isComponent(el) {\n if (el.tagName == 'SCRIPT') {\n var result = { type: 'script' };\n\n if (el.src) {\n result.src = el.src;\n result.onload = el.onload;\n }\n\n return result;\n }\n }\n});\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))\n\n/***/ }),\n/* 171 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar Backbone = __webpack_require__(0);\nvar ComponentView = __webpack_require__(15);\n\nmodule.exports = ComponentView.extend({\n tagName: 'script',\n\n events: {},\n\n render: function render() {\n var model = this.model;\n var src = model.get('src');\n var em = this.em;\n var scriptCount = em && em.get('scriptCount') ? em.get('scriptCount') : 0;\n var content = '';\n\n // If it's an external script\n if (src) {\n var onload = model.get('onload');\n var svar = 'script' + scriptCount;\n var svarNext = 'script' + (scriptCount + 1);\n content = 'var ' + svar + \" = document.createElement('script');\\n\" + svar + '.onload = function(){\\n' + (onload ? onload + '();\\n' : '') + 'typeof ' + svarNext + \"Start == 'function' && \" + svarNext + 'Start();\\n' + '};\\n' + svar + \".src = '\" + src + \"';\\n\" + 'function ' + svar + 'Start() { document.body.appendChild(' + svar + '); };\\n' + (!scriptCount ? svar + 'Start();' : '');\n if (em) {\n em.set('scriptCount', scriptCount + 1);\n }\n } else {\n content = model.get('content');\n }\n\n this.el.innerHTML = content;\n return this;\n }\n});\n\n/***/ }),\n/* 172 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };\n\nvar Component = __webpack_require__(4);\n\nmodule.exports = Component.extend({\n defaults: _extends({}, Component.prototype.defaults, {\n highlightable: 0\n }),\n\n getName: function getName() {\n var name = this.get('tagName');\n var customName = this.get('custom-name');\n name = name.charAt(0).toUpperCase() + name.slice(1);\n return customName || name;\n }\n}, {\n isComponent: function isComponent(el) {\n if (SVGElement && el instanceof SVGElement) {\n // Some SVG elements require uppercase letters (eg. <linearGradient>)\n var tagName = el.tagName;\n // Make the root resizable\n var resizable = tagName == 'svg' ? true : false;\n\n return {\n tagName: tagName,\n type: 'svg',\n resizable: resizable\n };\n }\n }\n});\n\n/***/ }),\n/* 173 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar ComponentView = __webpack_require__(3);\n\nmodule.exports = ComponentView.extend({\n _createElement: function _createElement(tagName) {\n return document.createElementNS('http://www.w3.org/2000/svg', tagName);\n }\n});\n\n/***/ }),\n/* 174 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(_) {\n\nvar Component = __webpack_require__(4);\n\nmodule.exports = Component.extend({\n defaults: _.extend({}, Component.prototype.defaults, {\n droppable: false,\n editable: true\n }),\n\n toHTML: function toHTML() {\n return this.get('content');\n }\n}, {\n isComponent: function isComponent(el) {\n var result = '';\n if (el.nodeType === 3) {\n result = {\n type: 'textnode',\n content: el.textContent\n };\n }\n return result;\n }\n});\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))\n\n/***/ }),\n/* 175 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = __webpack_require__(0).View.extend({});\n\n/***/ }),\n/* 176 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _mixins = __webpack_require__(2);\n\nvar _Droppable = __webpack_require__(177);\n\nvar _Droppable2 = _interopRequireDefault(_Droppable);\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }\n\nmodule.exports = function () {\n var c = {},\n defaults = __webpack_require__(178),\n Canvas = __webpack_require__(179),\n CanvasView = __webpack_require__(181);\n var canvas;\n var frameRect;\n\n return {\n /**\n * Used inside RTE\n * @private\n */\n getCanvasView: function getCanvasView() {\n return CanvasView;\n },\n\n\n /**\n * Name of the module\n * @type {String}\n * @private\n */\n name: 'Canvas',\n\n /**\n * Initialize module. Automatically called with a new instance of the editor\n * @param {Object} config Configurations\n */\n init: function init(config) {\n c = config || {};\n for (var name in defaults) {\n if (!(name in c)) c[name] = defaults[name];\n }\n\n var ppfx = c.pStylePrefix;\n if (ppfx) c.stylePrefix = ppfx + c.stylePrefix;\n\n canvas = new Canvas(config);\n CanvasView = new CanvasView({\n model: canvas,\n config: c\n });\n\n var cm = c.em.get('DomComponents');\n if (cm) this.setWrapper(cm);\n\n this.startAutoscroll = this.startAutoscroll.bind(this);\n this.stopAutoscroll = this.stopAutoscroll.bind(this);\n this.autoscroll = this.autoscroll.bind(this);\n return this;\n },\n\n\n /**\n * Return config object\n * @return {Object}\n */\n getConfig: function getConfig() {\n return c;\n },\n\n\n /**\n * Add wrapper\n * @param\t{Object}\twrp Wrapper\n *\n * */\n setWrapper: function setWrapper(wrp) {\n canvas.set('wrapper', wrp);\n },\n\n\n /**\n * Returns canvas element\n * @return {HTMLElement}\n */\n getElement: function getElement() {\n return CanvasView.el;\n },\n\n\n /**\n * Returns frame element of the canvas\n * @return {HTMLElement}\n */\n getFrameEl: function getFrameEl() {\n return CanvasView.frame.el;\n },\n\n\n /**\n * Returns body element of the frame\n * @return {HTMLElement}\n */\n getBody: function getBody() {\n return CanvasView.frame.el.contentDocument.body;\n },\n\n\n /**\n * Returns body wrapper element of the frame\n * @return {HTMLElement}\n */\n getWrapperEl: function getWrapperEl() {\n return this.getBody().querySelector('#wrapper');\n },\n\n\n /**\n * Returns element containing all canvas tools\n * @return {HTMLElement}\n */\n getToolsEl: function getToolsEl() {\n return CanvasView.toolsEl;\n },\n\n\n /**\n * Returns highlighter element\n * @return {HTMLElement}\n */\n getHighlighter: function getHighlighter() {\n return CanvasView.hlEl;\n },\n\n\n /**\n * Returns badge element\n * @return {HTMLElement}\n */\n getBadgeEl: function getBadgeEl() {\n return CanvasView.badgeEl;\n },\n\n\n /**\n * Returns placer element\n * @return {HTMLElement}\n */\n getPlacerEl: function getPlacerEl() {\n return CanvasView.placerEl;\n },\n\n\n /**\n * Returns ghost element\n * @return {HTMLElement}\n * @private\n */\n getGhostEl: function getGhostEl() {\n return CanvasView.ghostEl;\n },\n\n\n /**\n * Returns toolbar element\n * @return {HTMLElement}\n */\n getToolbarEl: function getToolbarEl() {\n return CanvasView.toolbarEl;\n },\n\n\n /**\n * Returns resizer element\n * @return {HTMLElement}\n */\n getResizerEl: function getResizerEl() {\n return CanvasView.resizerEl;\n },\n\n\n /**\n * Returns offset viewer element\n * @return {HTMLElement}\n */\n getOffsetViewerEl: function getOffsetViewerEl() {\n return CanvasView.offsetEl;\n },\n\n\n /**\n * Returns fixed offset viewer element\n * @return {HTMLElement}\n */\n getFixedOffsetViewerEl: function getFixedOffsetViewerEl() {\n return CanvasView.fixedOffsetEl;\n },\n\n\n /**\n * Render canvas\n * */\n render: function render() {\n return CanvasView.render().el;\n },\n\n\n /**\n * Get frame position\n * @return {Object}\n * @private\n */\n getOffset: function getOffset() {\n var frameOff = this.offset(this.getFrameEl());\n var canvasOff = this.offset(this.getElement());\n return {\n top: frameOff.top - canvasOff.top,\n left: frameOff.left - canvasOff.left\n };\n },\n\n\n /**\n * Get the offset of the element\n * @param {HTMLElement} el\n * @return {Object}\n * @private\n */\n offset: function offset(el) {\n return CanvasView.offset(el);\n },\n\n\n /**\n * Set custom badge naming strategy\n * @param {Function} f\n * @example\n * canvas.setCustomBadgeLabel(function(model){\n * return ComponentModel.getName();\n * });\n */\n setCustomBadgeLabel: function setCustomBadgeLabel(f) {\n c.customBadgeLabel = f;\n },\n\n\n /**\n * Get element position relative to the canvas\n * @param {HTMLElement} el\n * @return {Object}\n */\n getElementPos: function getElementPos(el, opts) {\n return CanvasView.getElementPos(el, opts);\n },\n\n\n /**\n * This method comes handy when you need to attach something like toolbars\n * to elements inside the canvas, dealing with all relative position,\n * offsets, etc. and returning as result the object with positions which are\n * viewable by the user (when the canvas is scrolled the top edge of the element\n * is not viewable by the user anymore so the new top edge is the one of the canvas)\n *\n * The target should be visible before being passed here as invisible elements\n * return empty string as width\n * @param {HTMLElement} target The target in this case could be the toolbar\n * @param {HTMLElement} element The element on which I'd attach the toolbar\n * @param {Object} options Custom options\n * @param {Boolean} options.toRight Set to true if you want the toolbar attached to the right\n * @return {Object}\n */\n getTargetToElementDim: function getTargetToElementDim(target, element, options) {\n var opts = options || {};\n var canvasPos = CanvasView.getPosition();\n var pos = opts.elPos || CanvasView.getElementPos(element);\n var toRight = options.toRight || 0;\n var targetHeight = opts.targetHeight || target.offsetHeight;\n var targetWidth = opts.targetWidth || target.offsetWidth;\n var eventToTrigger = opts.event || null;\n\n var elTop = pos.top - targetHeight;\n var elLeft = pos.left;\n elLeft += toRight ? pos.width : 0;\n elLeft = toRight ? elLeft - targetWidth : elLeft;\n\n var leftPos = elLeft < canvasPos.left ? canvasPos.left : elLeft;\n var topPos = elTop < canvasPos.top ? canvasPos.top : elTop;\n topPos = topPos > pos.top + pos.height ? pos.top + pos.height : topPos;\n\n var result = {\n top: topPos,\n left: leftPos,\n elementTop: pos.top,\n elementLeft: pos.left,\n elementWidth: pos.width,\n elementHeight: pos.height,\n targetWidth: target.offsetWidth,\n targetHeight: target.offsetHeight,\n canvasTop: canvasPos.top,\n canvasLeft: canvasPos.left\n };\n\n // In this way I can catch data and also change the position strategy\n if (eventToTrigger && c.em) {\n c.em.trigger(eventToTrigger, result);\n }\n\n return result;\n },\n\n\n /**\n * Instead of simply returning e.clientX and e.clientY this function\n * calculates also the offset based on the canvas. This is helpful when you\n * need to get X and Y position while moving between the editor area and\n * canvas area, which is in the iframe\n * @param {Event} e\n * @return {Object}\n */\n getMouseRelativePos: function getMouseRelativePos(e, options) {\n var opts = options || {};\n var addTop = 0;\n var addLeft = 0;\n var subWinOffset = opts.subWinOffset;\n var doc = e.target.ownerDocument;\n var win = doc.defaultView || doc.parentWindow;\n var frame = win.frameElement;\n var yOffset = subWinOffset ? win.pageYOffset : 0;\n var xOffset = subWinOffset ? win.pageXOffset : 0;\n\n if (frame) {\n var frameRect = frame.getBoundingClientRect();\n addTop = frameRect.top || 0;\n addLeft = frameRect.left || 0;\n }\n\n return {\n y: e.clientY + addTop - yOffset,\n x: e.clientX + addLeft - xOffset\n };\n },\n\n\n /**\n * X and Y mouse position relative to the canvas\n * @param {Event} e\n * @return {Object}\n */\n getMouseRelativeCanvas: function getMouseRelativeCanvas(e, options) {\n var opts = options || {};\n var frame = this.getFrameEl();\n var body = this.getBody();\n var addTop = frame.offsetTop || 0;\n var addLeft = frame.offsetLeft || 0;\n var yOffset = body.scrollTop || 0;\n var xOffset = body.scrollLeft || 0;\n\n return {\n y: e.clientY + addTop + yOffset,\n x: e.clientX + addLeft + xOffset\n };\n },\n\n\n /**\n * Detects if some input is focused (input elements, text components, etc.)\n * Used internally, for example, to avoid undo/redo in text editing mode\n * @return {Boolean}\n */\n isInputFocused: function isInputFocused() {\n return this.getFrameEl().contentDocument.activeElement.tagName !== 'BODY';\n },\n\n\n /**\n * Start autoscroll\n */\n startAutoscroll: function startAutoscroll() {\n var _this = this;\n\n this.dragging = 1;\n var toListen = this.getScrollListeners();\n frameRect = CanvasView.getFrameOffset(1);\n\n // By detaching those from the stack avoid browsers lags\n // Noticeable with \"fast\" drag of blocks\n setTimeout(function () {\n (0, _mixins.on)(toListen, 'mousemove', _this.autoscroll);\n (0, _mixins.on)(toListen, 'mouseup', _this.stopAutoscroll);\n }, 0);\n },\n autoscroll: function autoscroll(e) {\n e.preventDefault();\n if (this.dragging) {\n var frameWindow = this.getFrameEl().contentWindow;\n var actualTop = frameWindow.document.body.scrollTop;\n var nextTop = actualTop;\n var clientY = e.clientY;\n var limitTop = 50;\n var limitBottom = frameRect.height - limitTop;\n\n if (clientY < limitTop) {\n nextTop -= limitTop - clientY;\n }\n\n if (clientY > limitBottom) {\n nextTop += clientY - limitBottom;\n }\n\n //console.log(`actualTop: ${actualTop} clientY: ${clientY} nextTop: ${nextTop} frameHeigh: ${frameRect.height}`);\n frameWindow.scrollTo(0, nextTop);\n }\n },\n\n\n /**\n * Stop autoscroll\n */\n stopAutoscroll: function stopAutoscroll() {\n this.dragging = 0;\n var toListen = this.getScrollListeners();\n (0, _mixins.off)(toListen, 'mousemove', this.autoscroll);\n (0, _mixins.off)(toListen, 'mouseup', this.stopAutoscroll);\n },\n getScrollListeners: function getScrollListeners() {\n return [this.getFrameEl().contentWindow, this.getElement()];\n },\n postRender: function postRender() {\n if ((0, _mixins.hasDnd)(c.em)) this.droppable = new _Droppable2.default(c.em);\n },\n\n\n /**\n * Returns wrapper element\n * @return {HTMLElement}\n * ????\n */\n getFrameWrapperEl: function getFrameWrapperEl() {\n return CanvasView.frame.getWrapper();\n }\n };\n};\n\n/***/ }),\n/* 177 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\nvar _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); /*\n This class makes the canvas droppable\n */\n\nvar _mixins = __webpack_require__(2);\n\nvar _underscore = __webpack_require__(1);\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nvar Droppable = function () {\n function Droppable(em) {\n _classCallCheck(this, Droppable);\n\n this.em = em;\n var el = em.get('DomComponents').getWrapper().getEl();\n this.el = el;\n this.counter = 0;\n (0, _underscore.bindAll)(this, 'handleDragEnter', 'handleDragOver', 'handleDrop', 'handleDragLeave');\n (0, _mixins.on)(el, 'dragenter', this.handleDragEnter);\n (0, _mixins.on)(el, 'dragover', this.handleDragOver);\n (0, _mixins.on)(el, 'drop', this.handleDrop);\n (0, _mixins.on)(el, 'dragleave', this.handleDragLeave);\n\n return this;\n }\n\n _createClass(Droppable, [{\n key: 'endDrop',\n value: function endDrop(cancel, ev) {\n var em = this.em;\n this.counter = 0;\n this.over = 0;\n // force out like in BlockView\n var sorter = this.sorter;\n cancel && (sorter.moved = 0);\n sorter.endMove();\n em.trigger('canvas:dragend', ev);\n }\n }, {\n key: 'handleDragLeave',\n value: function handleDragLeave(ev) {\n this.updateCounter(-1, ev);\n }\n }, {\n key: 'updateCounter',\n value: function updateCounter(value, ev) {\n this.counter += value;\n this.counter === 0 && this.endDrop(1, ev);\n }\n }, {\n key: 'handleDragEnter',\n value: function handleDragEnter(ev) {\n var em = this.em;\n var dt = ev.dataTransfer;\n this.updateCounter(1, ev);\n if (this.over) return;\n this.over = 1;\n var utils = em.get('Utils');\n var canvas = em.get('Canvas');\n this.sorter = new utils.Sorter({\n em: em,\n wmargin: 1,\n nested: 1,\n canvasRelative: 1,\n direction: 'a',\n container: canvas.getBody(),\n placer: canvas.getPlacerEl(),\n eventMoving: 'mousemove dragover',\n containerSel: '*',\n itemSel: '*',\n pfx: 'gjs-',\n onStart: function onStart() {\n return em.stopDefault();\n },\n onEndMove: function onEndMove(model) {\n em.runDefault();\n\n if (model && model.get && model.get('activeOnRender')) {\n model.trigger('active');\n model.set('activeOnRender', 0);\n }\n\n model && em.trigger('canvas:drop', dt, model);\n },\n document: canvas.getFrameEl().contentDocument\n });\n // For security reason I can't read the drag data on dragenter, but\n // as I need it for the Sorter context I will use `dragContent` or just\n // any not empty element\n var content = em.get('dragContent') || '<br>';\n this.sorter.setDropContent(content);\n this.sorter.startSort();\n em.trigger('canvas:dragenter', dt, content);\n }\n\n /**\n * Always need to have this handler active for enabling the drop\n * @param {Event} ev\n */\n\n }, {\n key: 'handleDragOver',\n value: function handleDragOver(ev) {\n ev.preventDefault();\n this.em.trigger('canvas:dragover', ev);\n }\n }, {\n key: 'handleDrop',\n value: function handleDrop(ev) {\n ev.preventDefault();\n var dt = ev.dataTransfer;\n var content = this.getContentByData(dt).content;\n ev.target.style.border = '';\n\n if (content) {\n this.sorter.setDropContent(content);\n } else {\n this.sorter.moved = 0;\n }\n\n this.endDrop(0, ev);\n }\n }, {\n key: 'getContentByData',\n value: function getContentByData(dataTransfer) {\n var em = this.em;\n var types = dataTransfer.types;\n var files = dataTransfer.files;\n var dragContent = em.get('dragContent');\n var content = dataTransfer.getData('text');\n\n if (files.length) {\n content = [];\n for (var i = 0; i < files.length; i++) {\n var file = files[i];\n var type = file.type.split('/')[0];\n\n if (type == 'image') {\n content.push({\n type: type,\n file: file,\n attributes: { alt: file.name }\n });\n }\n }\n } else if (dragContent) {\n content = dragContent;\n } else if (types.indexOf('text/html') >= 0) {\n content = dataTransfer.getData('text/html').replace(/<\\/?meta[^>]*>/g, '');\n } else if (types.indexOf('text/uri-list') >= 0) {\n content = {\n type: 'link',\n attributes: { href: content },\n content: content\n };\n } else if (types.indexOf('text/json') >= 0) {\n var json = dataTransfer.getData('text/json');\n json && (content = JSON.parse(json));\n }\n\n var result = { content: content };\n em.trigger('canvas:dragdata', dataTransfer, result);\n\n return result;\n }\n }]);\n\n return Droppable;\n}();\n\nexports.default = Droppable;\n\n/***/ }),\n/* 178 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = {\n stylePrefix: 'cv-',\n\n // Coming soon\n rulers: false,\n\n /*\n * Append external scripts in head of the iframe before renderBody content\n * In this case, you have to add them manually later in the final HTML page\n * @example\n * scripts: [\n * 'https://...',\n * ]\n */\n scripts: [],\n\n /*\n * Append external styles. This styles won't be added to the final HTML/CSS\n * @example\n * styles: [\n * 'https://...',\n * ]\n */\n styles: [],\n\n /**\n * Add custom badge naming strategy\n * @example\n * customBadgeLabel: function(ComponentModel) {\n * return ComponentModel.getName();\n * }\n */\n customBadgeLabel: ''\n};\n\n/***/ }),\n/* 179 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar Backbone = __webpack_require__(0);\nvar Frame = __webpack_require__(180);\n\nmodule.exports = Backbone.Model.extend({\n defaults: {\n frame: '',\n wrapper: '',\n rulers: false\n },\n\n initialize: function initialize(config) {\n var conf = this.conf || {};\n this.set('frame', new Frame(conf.frame));\n }\n});\n\n/***/ }),\n/* 180 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar Backbone = __webpack_require__(0);\n\nmodule.exports = Backbone.Model.extend({\n defaults: {\n wrapper: '',\n width: '',\n height: '',\n attributes: {}\n }\n});\n\n/***/ }),\n/* 181 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Backbone, _) {\n\nvar _mixins = __webpack_require__(2);\n\nvar FrameView = __webpack_require__(182);\nvar $ = Backbone.$;\n\nmodule.exports = Backbone.View.extend({\n initialize: function initialize(o) {\n _.bindAll(this, 'renderBody', 'onFrameScroll', 'clearOff');\n (0, _mixins.on)(window, 'scroll resize', this.clearOff);\n this.config = o.config || {};\n this.em = this.config.em || {};\n this.ppfx = this.config.pStylePrefix || '';\n this.className = this.config.stylePrefix + 'canvas';\n this.listenTo(this.em, 'change:canvasOffset', this.clearOff);\n this.frame = new FrameView({\n model: this.model.get('frame'),\n config: this.config\n });\n },\n\n\n /**\n * Checks if the element is visible in the canvas's viewport\n * @param {HTMLElement} el\n * @return {Boolean}\n */\n isElInViewport: function isElInViewport(el) {\n var rect = el.getBoundingClientRect();\n var frameRect = this.getFrameOffset(1);\n var rTop = rect.top;\n var rLeft = rect.left;\n return rTop >= 0 && rLeft >= 0 && rTop <= frameRect.height && rLeft <= frameRect.width;\n },\n\n\n /**\n * Update tools position\n * @private\n */\n onFrameScroll: function onFrameScroll() {\n var u = 'px';\n var body = this.frame.el.contentDocument.body;\n this.toolsEl.style.top = '-' + body.scrollTop + u;\n this.toolsEl.style.left = '-' + body.scrollLeft + u;\n this.em.trigger('canvasScroll');\n },\n\n\n /**\n * Insert scripts into head, it will call renderBody after all scripts loaded or failed\n * @private\n */\n renderScripts: function renderScripts() {\n var frame = this.frame;\n var that = this;\n\n frame.el.onload = function () {\n var scripts = that.config.scripts.slice(0),\n // clone\n counter = 0;\n\n function appendScript(scripts) {\n if (scripts.length > 0) {\n var script = document.createElement('script');\n script.type = 'text/javascript';\n script.src = scripts.shift();\n script.onerror = script.onload = appendScript.bind(null, scripts);\n frame.el.contentDocument.head.appendChild(script);\n } else {\n that.renderBody();\n }\n }\n appendScript(scripts);\n };\n },\n\n\n /**\n * Render inside frame's body\n * @private\n */\n renderBody: function renderBody() {\n var wrap = this.model.get('frame').get('wrapper');\n var em = this.config.em;\n if (wrap) {\n var ppfx = this.ppfx;\n //var body = this.frame.$el.contents().find('body');\n var body = $(this.frame.el.contentWindow.document.body);\n var cssc = em.get('CssComposer');\n var conf = em.get('Config');\n var confCanvas = this.config;\n var protCss = conf.protectedCss;\n var externalStyles = '';\n\n confCanvas.styles.forEach(function (style) {\n externalStyles += '<link rel=\"stylesheet\" href=\"' + style + '\"/>';\n });\n\n var colorWarn = '#ffca6f';\n\n var baseCss = '\\n * {\\n box-sizing: border-box;\\n }\\n html, body, #wrapper {\\n min-height: 100%;\\n }\\n body {\\n margin: 0;\\n height: 100%;\\n background-color: #fff\\n }\\n #wrapper {\\n overflow: auto;\\n overflow-x: hidden;\\n }\\n ';\n // Remove `html { height: 100%;}` from the baseCss as it gives jumpings\n // effects (on ENTER) with RTE like CKEditor (maybe some bug there?!?)\n // With `body {height: auto;}` jumps in CKEditor are removed but in\n // Firefox is impossible to drag stuff in empty canvas, so bring back\n // `body {height: 100%;}`.\n // For the moment I give the priority to Firefox as it might be\n // CKEditor's issue\n\n // I need all this styles to make the editor work properly\n var frameCss = '\\n ' + baseCss + '\\n\\n .' + ppfx + 'dashed *[data-highlightable] {\\n outline: 1px dashed rgba(170,170,170,0.7);\\n outline-offset: -3px\\n }\\n\\n .' + ppfx + 'comp-selected {\\n outline: 3px solid #3b97e3 !important;\\n }\\n\\n .' + ppfx + 'comp-selected-parent {\\n outline: 2px solid ' + colorWarn + ' !important\\n }\\n\\n .' + ppfx + 'no-select {\\n user-select: none;\\n -webkit-user-select:none;\\n -moz-user-select: none;\\n }\\n\\n .' + ppfx + 'freezed {\\n opacity: 0.5;\\n pointer-events: none;\\n }\\n\\n .' + ppfx + 'no-pointer {\\n pointer-events: none;\\n }\\n\\n .' + ppfx + 'plh-image {\\n background: #f5f5f5;\\n border: none;\\n height: 50px;\\n width: 50px;\\n display: block;\\n outline: 3px solid #ffca6f;\\n cursor: pointer;\\n outline-offset: -2px\\n }\\n\\n .' + ppfx + 'grabbing {\\n cursor: grabbing;\\n cursor: -webkit-grabbing;\\n }\\n\\n * ::-webkit-scrollbar-track {\\n background: rgba(0, 0, 0, 0.1)\\n }\\n\\n * ::-webkit-scrollbar-thumb {\\n background: rgba(255, 255, 255, 0.2)\\n }\\n\\n * ::-webkit-scrollbar {\\n width: 10px\\n }\\n\\n ' + (conf.canvasCss || '') + '\\n ' + (protCss || '') + '\\n ';\n\n if (externalStyles) {\n body.append(externalStyles);\n }\n\n body.append('<style>' + frameCss + '</style>');\n body.append(wrap.render()).append(cssc.render());\n body.append(this.getJsContainer());\n em.trigger('loaded');\n this.frame.el.contentWindow.onscroll = this.onFrameScroll;\n this.frame.udpateOffset();\n\n // When the iframe is focused the event dispatcher is not the same so\n // I need to delegate all events to the parent document\n var doc = document;\n var fdoc = this.frame.el.contentDocument;\n\n // Unfortunately just creating `KeyboardEvent(e.type, e)` is not enough,\n // the keyCode/which will be always `0`. Even if it's an old/deprecated\n // property keymaster (and many others) still use it... using `defineProperty`\n // hack seems the only way\n var createCustomEvent = function createCustomEvent(e) {\n var oEvent = new KeyboardEvent(e.type, e);\n oEvent.keyCodeVal = e.keyCode;\n ['keyCode', 'which'].forEach(function (prop) {\n Object.defineProperty(oEvent, prop, {\n get: function get() {\n return this.keyCodeVal;\n }\n });\n });\n return oEvent;\n };\n fdoc.addEventListener('keydown', function (e) {\n doc.dispatchEvent(createCustomEvent(e));\n });\n fdoc.addEventListener('keyup', function (e) {\n doc.dispatchEvent(createCustomEvent(e));\n });\n }\n },\n\n\n /**\n * Get the offset of the element\n * @param {HTMLElement} el\n * @return {Object}\n */\n offset: function offset(el) {\n var rect = el.getBoundingClientRect();\n var docBody = el.ownerDocument.body;\n return {\n top: rect.top + docBody.scrollTop,\n left: rect.left + docBody.scrollLeft,\n width: rect.width,\n height: rect.height\n };\n },\n\n\n /**\n * Cleare cached offsets\n * @private\n */\n clearOff: function clearOff() {\n this.frmOff = null;\n this.cvsOff = null;\n },\n\n\n /**\n * Return frame offset\n * @return {Object}\n * @private\n */\n getFrameOffset: function getFrameOffset() {\n var force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0;\n\n if (!this.frmOff || force) this.frmOff = this.offset(this.frame.el);\n return this.frmOff;\n },\n\n\n /**\n * Return canvas offset\n * @return {Object}\n * @private\n */\n getCanvasOffset: function getCanvasOffset() {\n if (!this.cvsOff) this.cvsOff = this.offset(this.el);\n return this.cvsOff;\n },\n\n\n /**\n * Returns element's data info\n * @param {HTMLElement} el\n * @return {Object}\n * @private\n */\n getElementPos: function getElementPos(el, opts) {\n var opt = opts || {};\n var frmOff = this.getFrameOffset();\n var cvsOff = this.getCanvasOffset();\n var eo = this.offset(el);\n\n var frmTop = opt.avoidFrameOffset ? 0 : frmOff.top;\n var frmLeft = opt.avoidFrameOffset ? 0 : frmOff.left;\n\n var top = eo.top + frmTop - cvsOff.top;\n var left = eo.left + frmLeft - cvsOff.left;\n // clientHeight/clientWidth are for SVGs\n var height = el.offsetHeight || el.clientHeight;\n var width = el.offsetWidth || el.clientWidth;\n\n return { top: top, left: left, height: height, width: width };\n },\n\n\n /**\n * Returns position data of the canvas element\n * @return {Object} obj Position object\n * @private\n */\n getPosition: function getPosition() {\n var bEl = this.frame.el.contentDocument.body;\n var fo = this.getFrameOffset();\n var co = this.getCanvasOffset();\n return {\n top: fo.top + bEl.scrollTop - co.top,\n left: fo.left + bEl.scrollLeft - co.left\n };\n },\n\n\n /**\n * Update javascript of a specific component passed by its View\n * @param {View} view Component's View\n * @private\n */\n updateScript: function updateScript(view) {\n if (!view.scriptContainer) {\n view.scriptContainer = $('<div>');\n this.getJsContainer().append(view.scriptContainer.get(0));\n }\n\n var model = view.model;\n var id = model.getId();\n view.el.id = id;\n view.scriptContainer.html('');\n // In editor, I make use of setTimeout as during the append process of elements\n // those will not be available immediatly, therefore 'item' variable\n var script = document.createElement('script');\n script.innerText = '\\n setTimeout(function() {\\n var item = document.getElementById(\\'' + id + '\\');\\n if (!item) return;\\n (function(){\\n ' + model.getScriptString() + ';\\n }.bind(item))()\\n }, 1);';\n view.scriptContainer.get(0).appendChild(script);\n },\n\n\n /**\n * Get javascript container\n * @private\n */\n getJsContainer: function getJsContainer() {\n if (!this.jsContainer) {\n this.jsContainer = $('<div class=\"' + this.ppfx + 'js-cont\">').get(0);\n }\n return this.jsContainer;\n },\n render: function render() {\n this.wrapper = this.model.get('wrapper');\n\n if (this.wrapper && typeof this.wrapper.render == 'function') {\n this.model.get('frame').set('wrapper', this.wrapper);\n this.$el.append(this.frame.render().el);\n var frame = this.frame;\n if (this.config.scripts.length === 0) {\n frame.el.onload = this.renderBody;\n } else {\n this.renderScripts(); // will call renderBody later\n }\n }\n var ppfx = this.ppfx;\n this.$el.append('\\n <div id=\"' + ppfx + 'tools\" style=\"pointer-events:none\">\\n <div class=\"' + ppfx + 'highlighter\"></div>\\n <div class=\"' + ppfx + 'badge\"></div>\\n <div class=\"' + ppfx + 'placeholder\">\\n <div class=\"' + ppfx + 'placeholder-int\"></div>\\n </div>\\n <div class=\"' + ppfx + 'ghost\"></div>\\n <div class=\"' + ppfx + 'toolbar\" style=\"pointer-events:all\"></div>\\n <div class=\"' + ppfx + 'resizer\"></div>\\n <div class=\"' + ppfx + 'offset-v\"></div>\\n <div class=\"' + ppfx + 'offset-fixed-v\"></div>\\n </div>\\n ');\n var el = this.el;\n var toolsEl = el.querySelector('#' + ppfx + 'tools');\n this.hlEl = el.querySelector('.' + ppfx + 'highlighter');\n this.badgeEl = el.querySelector('.' + ppfx + 'badge');\n this.placerEl = el.querySelector('.' + ppfx + 'placeholder');\n this.ghostEl = el.querySelector('.' + ppfx + 'ghost');\n this.toolbarEl = el.querySelector('.' + ppfx + 'toolbar');\n this.resizerEl = el.querySelector('.' + ppfx + 'resizer');\n this.offsetEl = el.querySelector('.' + ppfx + 'offset-v');\n this.fixedOffsetEl = el.querySelector('.' + ppfx + 'offset-fixed-v');\n this.toolsEl = toolsEl;\n this.el.className = this.className;\n return this;\n }\n});\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0), __webpack_require__(1)))\n\n/***/ }),\n/* 182 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _underscore = __webpack_require__(1);\n\nvar motionsEv = 'transitionend oTransitionEnd transitionend webkitTransitionEnd';\n\nmodule.exports = __webpack_require__(0).View.extend({\n tagName: 'iframe',\n\n attributes: {\n allowfullscreen: 'allowfullscreen'\n },\n\n initialize: function initialize(o) {\n (0, _underscore.bindAll)(this, 'udpateOffset');\n this.config = o.config || {};\n this.ppfx = this.config.pStylePrefix || '';\n this.em = this.config.em;\n this.listenTo(this.em, 'change:device', this.updateDim);\n },\n\n\n /**\n * Update dimensions of the frame\n * @private\n */\n updateDim: function updateDim(model) {\n var em = this.em;\n var device = em.getDeviceModel();\n var style = this.el.style;\n var currW = style.width || '';\n var currH = style.height || '';\n var newW = device ? device.get('width') : '';\n var newH = device ? device.get('height') : '';\n var noChanges = currW == newW && currH == newH;\n style.width = newW;\n style.height = newH;\n this.udpateOffset();\n // Prevent fixed highlighting box which appears when on\n // component hover during the animation\n em.stopDefault({ preserveSelected: 1 });\n noChanges ? this.udpateOffset() : this.$el.on(motionsEv, this.udpateOffset);\n },\n udpateOffset: function udpateOffset() {\n var em = this.em;\n var offset = em.get('Canvas').getOffset();\n em.set('canvasOffset', offset);\n em.runDefault({ preserveSelected: 1 });\n this.$el.off(motionsEv, this.udpateOffset);\n },\n getBody: function getBody() {\n this.$el.contents().find('body');\n },\n getWrapper: function getWrapper() {\n return this.$el.contents().find('body > div');\n },\n render: function render() {\n this.$el.attr({ class: this.ppfx + 'frame' });\n return this;\n }\n});\n\n/***/ }),\n/* 183 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _underscore = __webpack_require__(1);\n\nmodule.exports = function () {\n var em = void 0;\n var c = {},\n commands = {},\n defaultCommands = {},\n defaults = __webpack_require__(184),\n AbsCommands = __webpack_require__(185);\n\n // Need it here as it would be used below\n var add = function add(id, obj) {\n if ((0, _underscore.isFunction)(obj)) {\n obj = { run: obj };\n }\n\n delete obj.initialize;\n commands[id] = AbsCommands.extend(obj);\n return this;\n };\n\n return {\n /**\n * Name of the module\n * @type {String}\n * @private\n */\n name: 'Commands',\n\n /**\n * Initialize module. Automatically called with a new instance of the editor\n * @param {Object} config Configurations\n * @private\n */\n init: function init(config) {\n c = config || {};\n for (var name in defaults) {\n if (!(name in c)) c[name] = defaults[name];\n }\n em = c.em;\n var ppfx = c.pStylePrefix;\n if (ppfx) c.stylePrefix = ppfx + c.stylePrefix;\n\n // Load commands passed via configuration\n for (var k in c.defaults) {\n var obj = c.defaults[k];\n if (obj.id) this.add(obj.id, obj);\n }\n\n var ViewCode = __webpack_require__(186);\n defaultCommands['select-comp'] = __webpack_require__(21);\n defaultCommands['create-comp'] = __webpack_require__(22);\n defaultCommands['delete-comp'] = __webpack_require__(191);\n defaultCommands['image-comp'] = __webpack_require__(192);\n defaultCommands['move-comp'] = __webpack_require__(193);\n defaultCommands['text-comp'] = __webpack_require__(194);\n defaultCommands['insert-custom'] = __webpack_require__(55);\n defaultCommands['export-template'] = ViewCode;\n defaultCommands['sw-visibility'] = __webpack_require__(195);\n defaultCommands['open-layers'] = __webpack_require__(196);\n defaultCommands['open-sm'] = __webpack_require__(199);\n defaultCommands['open-tm'] = __webpack_require__(200);\n defaultCommands['open-blocks'] = __webpack_require__(201);\n defaultCommands['open-assets'] = __webpack_require__(202);\n defaultCommands['show-offset'] = __webpack_require__(203);\n defaultCommands['select-parent'] = __webpack_require__(204);\n defaultCommands.fullscreen = __webpack_require__(205);\n defaultCommands.preview = __webpack_require__(206);\n defaultCommands.resize = __webpack_require__(207);\n defaultCommands.drag = __webpack_require__(208);\n\n defaultCommands['tlb-delete'] = {\n run: function run(ed) {\n var sel = ed.getSelected();\n\n if (!sel || !sel.get('removable')) {\n console.warn('The element is not removable');\n return;\n }\n\n ed.select(null);\n sel.destroy();\n }\n };\n\n defaultCommands['tlb-clone'] = {\n run: function run(ed) {\n var sel = ed.getSelected();\n\n if (!sel || !sel.get('copyable')) {\n console.warn('The element is not clonable');\n return;\n }\n\n var collection = sel.collection;\n var index = collection.indexOf(sel);\n var added = collection.add(sel.clone(), { at: index + 1 });\n sel.emitUpdate();\n ed.trigger('component:clone', added);\n }\n };\n\n defaultCommands['tlb-move'] = {\n run: function run(ed, sender, opts) {\n var dragger = void 0;\n var em = ed.getModel();\n var event = opts && opts.event;\n var sel = ed.getSelected();\n var toolbarStyle = ed.Canvas.getToolbarEl().style;\n var nativeDrag = event.type == 'dragstart';\n\n var hideTlb = function hideTlb() {\n toolbarStyle.display = 'none';\n em.stopDefault();\n };\n\n if (!sel || !sel.get('draggable')) {\n console.warn('The element is not draggable');\n return;\n }\n\n // Without setTimeout the ghost image disappears\n nativeDrag ? setTimeout(function () {\n return hideTlb;\n }, 0) : hideTlb();\n\n var onStart = function onStart(e, opts) {\n console.log('start mouse pos ', opts.start);\n console.log('el rect ', opts.elRect);\n var el = opts.el;\n el.style.position = 'absolute';\n el.style.margin = 0;\n };\n\n var onEnd = function onEnd(e, opts) {\n em.runDefault();\n em.setSelected(sel);\n sel.emitUpdate();\n dragger && dragger.blur();\n };\n\n var onDrag = function onDrag(e, opts) {\n console.log('Delta ', opts.delta);\n console.log('Current ', opts.current);\n };\n\n if (em.get('designerMode')) {\n // TODO move grabbing func in editor/canvas from the Sorter\n dragger = editor.runCommand('drag', {\n el: sel.view.el,\n options: {\n event: event,\n onStart: onStart,\n onDrag: onDrag,\n onEnd: onEnd\n }\n });\n } else {\n if (nativeDrag) {\n event.dataTransfer.setDragImage(sel.view.el, 0, 0);\n //sel.set('status', 'freezed');\n }\n\n var cmdMove = ed.Commands.get('move-comp');\n cmdMove.onEndMoveFromModel = onEnd;\n cmdMove.initSorterFromModel(sel);\n }\n\n sel.set('status', 'selected');\n }\n };\n\n // Core commands\n defaultCommands['core:undo'] = function (e) {\n return e.UndoManager.undo();\n };\n defaultCommands['core:redo'] = function (e) {\n return e.UndoManager.redo();\n };\n defaultCommands['core:canvas-clear'] = function (e) {\n e.DomComponents.clear();\n e.CssComposer.clear();\n };\n defaultCommands['core:copy'] = function (ed) {\n var em = ed.getModel();\n var model = ed.getSelected();\n\n if (model && model.get('copyable') && !ed.Canvas.isInputFocused()) {\n em.set('clipboard', model);\n }\n };\n defaultCommands['core:paste'] = function (ed) {\n var em = ed.getModel();\n var clp = em.get('clipboard');\n var model = ed.getSelected();\n var coll = model && model.collection;\n\n if (coll && clp && !ed.Canvas.isInputFocused()) {\n var at = coll.indexOf(model) + 1;\n coll.add(clp.clone(), { at: at });\n }\n };\n\n if (c.em) c.model = c.em.get('Canvas');\n\n this.loadDefaultCommands();\n\n return this;\n },\n\n\n /**\n * Add new command to the collection\n * @param\t{string} id Command's ID\n * @param\t{Object|Function} command Object representing your command,\n * By passing just a function it's intended as a stateless command\n * (just like passing an object with only `run` method).\n * @return {this}\n * @example\n * commands.add('myCommand', {\n * \trun(editor, sender) {\n * \t\talert('Hello world!');\n * \t},\n * \tstop(editor, sender) {\n * \t},\n * });\n * // As a function\n * commands.add('myCommand2', editor => { ... });\n * */\n add: add,\n\n /**\n * Get command by ID\n * @param\t{string}\tid Command's ID\n * @return {Object} Object representing the command\n * @example\n * var myCommand = commands.get('myCommand');\n * myCommand.run();\n * */\n get: function get(id) {\n var el = commands[id];\n\n if (typeof el == 'function') {\n el = new el(c);\n commands[id] = el;\n }\n\n return el;\n },\n\n\n /**\n * Check if command exists\n * @param\t{string}\tid Command's ID\n * @return {Boolean}\n * */\n has: function has(id) {\n return !!commands[id];\n },\n\n\n /**\n * Load default commands\n * @return {this}\n * @private\n * */\n loadDefaultCommands: function loadDefaultCommands() {\n for (var id in defaultCommands) {\n this.add(id, defaultCommands[id]);\n }\n\n return this;\n }\n };\n}; /**\n *\n * * [add](#add)\n * * [get](#get)\n * * [has](#has)\n *\n * You can init the editor with all necessary commands via configuration\n *\n * ```js\n * var editor = grapesjs.init({\n * \t...\n * commands: {...} // Check below for the properties\n * \t...\n * });\n * ```\n *\n * Before using methods you should get first the module from the editor instance, in this way:\n *\n * ```js\n * var commands = editor.Commands;\n * ```\n *\n * @module Commands\n * @param {Object} config Configurations\n * @param {Array<Object>} [config.defaults=[]] Array of possible commands\n * @example\n * ...\n * commands: {\n * \tdefaults: [{\n * \t\tid: 'helloWorld',\n * \t\trun: function(editor, sender){\n * \t\t\talert('Hello world!');\n * \t\t},\n * \t\tstop: function(editor, sender){\n * \t\t\talert('Stop!');\n * \t\t},\n * \t}],\n * },\n * ...\n */\n\n/***/ }),\n/* 184 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = {\n ESCAPE_KEY: 27,\n\n stylePrefix: 'com-',\n\n defaults: [],\n\n // Editor model\n em: null,\n\n // If true center new first-level components\n firstCentered: true,\n\n // If true the new component will created with 'height', else 'min-height'\n newFixedH: false,\n\n // Minimum height (in px) of new component\n minComponentH: 50,\n\n // Minimum width (in px) of component on creation\n minComponentW: 50\n};\n\n/***/ }),\n/* 185 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Backbone) {\n\nvar $ = Backbone.$;\n\nmodule.exports = Backbone.View.extend({\n /**\n * Initialize method that can't be removed\n * @param {Object} o Options\n * @private\n * */\n initialize: function initialize(o) {\n this.config = o || {};\n this.editorModel = this.em = this.config.em || {};\n this.pfx = this.config.stylePrefix;\n this.ppfx = this.config.pStylePrefix;\n this.hoverClass = this.pfx + 'hover';\n this.badgeClass = this.pfx + 'badge';\n this.plhClass = this.pfx + 'placeholder';\n this.freezClass = this.ppfx + 'freezed';\n\n this.canvas = this.em.get && this.em.get('Canvas');\n\n if (this.em.get) this.setElement(this.getCanvas());\n\n if (this.canvas) {\n this.$canvas = this.$el;\n this.$wrapper = $(this.getCanvasWrapper());\n this.frameEl = this.canvas.getFrameEl();\n this.canvasTool = this.getCanvasTools();\n this.bodyEl = this.getCanvasBody();\n }\n\n this.init(this.config);\n },\n\n\n /**\n * On frame scroll callback\n * @param {[type]} e [description]\n * @return {[type]} [description]\n */\n onFrameScroll: function onFrameScroll(e) {},\n\n\n /**\n * Returns canval element\n * @return {HTMLElement}\n */\n getCanvas: function getCanvas() {\n return this.canvas.getElement();\n },\n\n\n /**\n * Get canvas body element\n * @return {HTMLElement}\n */\n getCanvasBody: function getCanvasBody() {\n return this.canvas.getBody();\n },\n\n\n /**\n * Get canvas wrapper element\n * @return {HTMLElement}\n */\n getCanvasWrapper: function getCanvasWrapper() {\n return this.canvas.getWrapperEl();\n },\n\n\n /**\n * Get canvas wrapper element\n * @return {HTMLElement}\n */\n getCanvasTools: function getCanvasTools() {\n return this.canvas.getToolsEl();\n },\n\n\n /**\n * Get the offset of the element\n * @param {HTMLElement} el\n * @return {Object}\n */\n offset: function offset(el) {\n var rect = el.getBoundingClientRect();\n return {\n top: rect.top + el.ownerDocument.body.scrollTop,\n left: rect.left + el.ownerDocument.body.scrollLeft\n };\n },\n\n\n /**\n * Callback triggered after initialize\n * @param {Object} o Options\n * @private\n * */\n init: function init(o) {},\n\n\n /**\n * Method that run command\n * @param {Object} em Editor model\n * @param {Object} sender Button sender\n * @private\n * */\n run: function run(em, sender) {},\n\n\n /**\n * Method that stop command\n * @param {Object} em Editor model\n * @param {Object} sender Button sender\n * @private\n * */\n stop: function stop(em, sender) {}\n});\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))\n\n/***/ }),\n/* 186 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Backbone) {\n\nvar $ = Backbone.$;\n\nmodule.exports = {\n run: function run(editor, sender) {\n var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n sender && sender.set && sender.set('active', 0);\n var config = editor.getConfig();\n var modal = editor.Modal;\n var pfx = config.stylePrefix;\n this.cm = editor.CodeManager || null;\n\n if (!this.$editors) {\n var oHtmlEd = this.buildEditor('htmlmixed', 'hopscotch', 'HTML');\n var oCsslEd = this.buildEditor('css', 'hopscotch', 'CSS');\n this.htmlEditor = oHtmlEd.el;\n this.cssEditor = oCsslEd.el;\n var $editors = $('<div class=\"' + pfx + 'export-dl\"></div>');\n $editors.append(oHtmlEd.$el).append(oCsslEd.$el);\n this.$editors = $editors;\n }\n\n modal.setTitle(config.textViewCode);\n modal.setContent(this.$editors);\n modal.open();\n this.htmlEditor.setContent(editor.getHtml());\n this.cssEditor.setContent(editor.getCss());\n },\n stop: function stop(editor) {\n var modal = editor.Modal;\n modal && modal.close();\n },\n buildEditor: function buildEditor(codeName, theme, label) {\n var input = document.createElement('textarea');\n !this.codeMirror && (this.codeMirror = this.cm.getViewer('CodeMirror'));\n\n var el = this.codeMirror.clone().set({\n label: label,\n codeName: codeName,\n theme: theme,\n input: input\n });\n\n var $el = new this.cm.EditorView({\n model: el,\n config: this.cm.getConfig()\n }).render().$el;\n\n el.init(input);\n\n return { el: el, $el: $el };\n }\n};\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))\n\n/***/ }),\n/* 187 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar Backbone = __webpack_require__(0);\nvar DomainViews = __webpack_require__(49);\nvar ToolbarButtonView = __webpack_require__(188);\n\nmodule.exports = DomainViews.extend({\n itemView: ToolbarButtonView,\n\n initialize: function initialize(opts) {\n this.config = { editor: opts.editor || '' };\n this.listenTo(this.collection, 'reset', this.render);\n }\n});\n\n/***/ }),\n/* 188 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar Backbone = __webpack_require__(0);\n\nmodule.exports = Backbone.View.extend({\n events: function events() {\n return this.model.get('events') || {\n mousedown: 'handleClick'\n };\n },\n attributes: function attributes() {\n return this.model.get('attributes');\n },\n initialize: function initialize(opts) {\n this.editor = opts.config.editor;\n },\n handleClick: function handleClick(event) {\n event.preventDefault();\n event.stopPropagation();\n this.execCommand(event);\n },\n execCommand: function execCommand(event) {\n var opts = { event: event };\n var command = this.model.get('command');\n var editor = this.editor;\n\n if (typeof command === 'function') {\n command(editor, null, opts);\n }\n\n if (typeof command === 'string') {\n editor.runCommand(command, opts);\n }\n },\n render: function render() {\n var config = this.editor.getConfig();\n this.el.className += ' ' + config.stylePrefix + 'toolbar-item';\n return this;\n }\n});\n\n/***/ }),\n/* 189 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar Backbone = __webpack_require__(0);\nvar ToolbarButton = __webpack_require__(190);\n\nmodule.exports = Backbone.Collection.extend({ model: ToolbarButton });\n\n/***/ }),\n/* 190 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar Backbone = __webpack_require__(0);\n\nmodule.exports = Backbone.Model.extend({\n defaults: {\n command: '',\n attributes: {}\n }\n});\n\n/***/ }),\n/* 191 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Backbone, _) {\n\nvar SelectComponent = __webpack_require__(21);\nvar $ = Backbone.$;\n\nmodule.exports = _.extend({}, SelectComponent, {\n init: function init(o) {\n _.bindAll(this, 'startDelete', 'stopDelete', 'onDelete');\n this.hoverClass = this.pfx + 'hover-delete';\n this.badgeClass = this.pfx + 'badge-red';\n },\n enable: function enable() {\n var that = this;\n this.$el.find('*').mouseover(this.startDelete).mouseout(this.stopDelete).click(this.onDelete);\n },\n\n\n /**\n * Start command\n * @param {Object} e\n * @private\n */\n startDelete: function startDelete(e) {\n e.stopPropagation();\n var $this = $(e.target);\n\n // Show badge if possible\n if ($this.data('model').get('removable')) {\n $this.addClass(this.hoverClass);\n this.attachBadge($this.get(0));\n }\n },\n\n\n /**\n * Stop command\n * @param {Object} e\n * @private\n */\n stopDelete: function stopDelete(e) {\n e.stopPropagation();\n var $this = $(e.target);\n $this.removeClass(this.hoverClass);\n\n // Hide badge if possible\n if (this.badge) this.badge.css({ left: -1000, top: -1000 });\n },\n\n\n /**\n * Delete command\n * @param {Object} e\n * @private\n */\n onDelete: function onDelete(e) {\n e.stopPropagation();\n var $this = $(e.target);\n\n // Do nothing in case can't remove\n if (!$this.data('model').get('removable')) return;\n\n $this.data('model').destroy();\n this.removeBadge();\n this.clean();\n },\n\n\n /**\n * Updates badge label\n * @param {Object} model\n * @private\n * */\n updateBadgeLabel: function updateBadgeLabel(model) {\n this.badge.html('Remove ' + model.getName());\n }\n});\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0), __webpack_require__(1)))\n\n/***/ }),\n/* 192 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(_) {\n\nvar Backbone = __webpack_require__(0);\nvar InsertCustom = __webpack_require__(55);\n\nmodule.exports = _.extend({}, InsertCustom, {\n /**\n * Trigger before insert\n * @param {Object} object\n * @private\n *\n * */\n beforeInsert: function beforeInsert(object) {\n object.type = 'image';\n object.style = {};\n object.attributes = {};\n object.attributes.onmousedown = 'return false';\n if (this.config.firstCentered && this.getCanvasWrapper() == this.sorter.target) {\n object.style.margin = '0 auto';\n }\n },\n\n\n /**\n * Trigger after insert\n * @param {Object} model Model created after insert\n * @private\n * */\n afterInsert: function afterInsert(model) {\n model.trigger('dblclick');\n if (this.sender) this.sender.set('active', false);\n }\n});\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))\n\n/***/ }),\n/* 193 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Backbone, _) {\n\nvar _mixins = __webpack_require__(2);\n\nvar SelectComponent = __webpack_require__(21);\nvar SelectPosition = __webpack_require__(54);\nvar $ = Backbone.$;\n\nmodule.exports = _.extend({}, SelectPosition, SelectComponent, {\n init: function init(o) {\n SelectComponent.init.apply(this, arguments);\n _.bindAll(this, 'initSorter', 'rollback', 'onEndMove');\n this.opt = o;\n this.hoverClass = this.ppfx + 'highlighter-warning';\n this.badgeClass = this.ppfx + 'badge-warning';\n this.noSelClass = this.ppfx + 'no-select';\n },\n enable: function enable() {\n for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n SelectComponent.enable.apply(this, args);\n this.getBadgeEl().addClass(this.badgeClass);\n this.getHighlighterEl().addClass(this.hoverClass);\n var wp = this.$wrapper;\n wp.css('cursor', 'move');\n wp.on('mousedown', this.initSorter);\n\n // Avoid strange moving behavior\n wp.addClass(this.noSelClass);\n },\n\n\n /**\n * Overwrite for doing nothing\n * @private\n */\n toggleClipboard: function toggleClipboard() {},\n\n\n /**\n * Delegate sorting\n * @param {Event} e\n * @private\n * */\n initSorter: function initSorter(e) {\n var el = $(e.target).data('model');\n var drag = el.get('draggable');\n if (!drag) return;\n\n // Avoid badge showing on move\n this.cacheEl = null;\n this.startSelectPosition(e.target, this.frameEl.contentDocument);\n this.sorter.draggable = drag;\n this.sorter.onEndMove = this.onEndMove.bind(this);\n this.stopSelectComponent();\n this.$wrapper.off('mousedown', this.initSorter);\n (0, _mixins.on)(this.getContentWindow(), 'keydown', this.rollback);\n },\n\n\n /**\n * Init sorter from model\n * @param {Object} model\n * @private\n */\n initSorterFromModel: function initSorterFromModel(model) {\n var drag = model.get('draggable');\n if (!drag) return;\n // Avoid badge showing on move\n this.cacheEl = null;\n var el = model.view.el;\n this.startSelectPosition(el, this.frameEl.contentDocument);\n this.sorter.draggable = drag;\n this.sorter.onEndMove = this.onEndMoveFromModel.bind(this);\n\n /*\n this.sorter.setDragHelper(el);\n var dragHelper = this.sorter.dragHelper;\n dragHelper.className = this.ppfx + 'drag-helper';\n dragHelper.innerHTML = '';\n dragHelper.backgroundColor = 'white';\n */\n\n this.stopSelectComponent();\n (0, _mixins.on)(this.getContentWindow(), 'keydown', this.rollback);\n },\n onEndMoveFromModel: function onEndMoveFromModel() {\n (0, _mixins.off)(this.getContentWindow(), 'keydown', this.rollback);\n },\n\n\n /**\n * Callback after sorting\n * @private\n */\n onEndMove: function onEndMove() {\n this.enable();\n (0, _mixins.off)(this.getContentWindow(), 'keydown', this.rollback);\n },\n\n\n /**\n * Say what to do after the component was selected (selectComponent)\n * @param {Event} e\n * @param {Object} Selected element\n * @private\n * */\n onSelect: function onSelect(e, el) {},\n\n\n /**\n * Used to bring the previous situation before start moving the component\n * @param {Event} e\n * @param {Boolean} Indicates if rollback in anycase\n * @private\n * */\n rollback: function rollback(e, force) {\n var key = e.which || e.keyCode;\n if (key == this.opt.ESCAPE_KEY || force) {\n this.sorter.moved = false;\n this.sorter.endMove();\n }\n return;\n },\n\n\n /**\n * Returns badge element\n * @return {HTMLElement}\n * @private\n */\n getBadgeEl: function getBadgeEl() {\n if (!this.$badge) this.$badge = $(this.getBadge());\n return this.$badge;\n },\n\n\n /**\n * Returns highlighter element\n * @return {HTMLElement}\n * @private\n */\n getHighlighterEl: function getHighlighterEl() {\n if (!this.$hl) this.$hl = $(this.canvas.getHighlighter());\n return this.$hl;\n },\n stop: function stop() {\n for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {\n args[_key2] = arguments[_key2];\n }\n\n SelectComponent.stop.apply(this, args);\n this.getBadgeEl().removeClass(this.badgeClass);\n this.getHighlighterEl().removeClass(this.hoverClass);\n var wp = this.$wrapper;\n wp.css('cursor', '').unbind().removeClass(this.noSelClass);\n }\n});\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0), __webpack_require__(1)))\n\n/***/ }),\n/* 194 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(_) {\n\nvar Backbone = __webpack_require__(0);\nvar CreateComponent = __webpack_require__(22);\n\nmodule.exports = _.extend({}, CreateComponent, {\n /**\n * This event is triggered at the beginning of a draw operation\n * @param {Object} component Object component before creation\n * @private\n * */\n beforeDraw: function beforeDraw(component) {\n component.type = 'text';\n if (!component.style) component.style = {};\n component.style.padding = '10px';\n },\n\n\n /**\n * This event is triggered at the end of a draw operation\n * @param {Object} model Component model created\n * @private\n * */\n afterDraw: function afterDraw(model) {\n if (!model || !model.set) return;\n model.trigger('focus');\n if (this.sender) this.sender.set('active', false);\n }\n});\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))\n\n/***/ }),\n/* 195 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = {\n run: function run(ed) {\n ed.Canvas.getBody().className = this.ppfx + 'dashed';\n },\n stop: function stop(ed) {\n ed.Canvas.getBody().className = '';\n }\n};\n\n/***/ }),\n/* 196 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Backbone) {\n\nvar Layers = __webpack_require__(197);\nvar $ = Backbone.$;\n\nmodule.exports = {\n run: function run(em, sender) {\n if (!this.toAppend) {\n var collection = em.DomComponents.getComponent().get('components');\n var config = em.getConfig();\n var pfx = config.stylePrefix;\n var panels = em.Panels;\n var lyStylePfx = config.layers.stylePrefix || 'nv-';\n\n config.layers.stylePrefix = config.stylePrefix + lyStylePfx;\n config.layers.pStylePrefix = config.stylePrefix;\n config.layers.em = em.editor;\n config.layers.opened = em.editor.get('opened');\n\n // Check if panel exists otherwise crate it\n if (!panels.getPanel('views-container')) this.panel = panels.addPanel({ id: 'views-container' });else this.panel = panels.getPanel('views-container');\n\n var toAppend = $('<div class=\"' + pfx + 'layers\"></div>');\n this.panel.set('appendContent', toAppend).trigger('change:appendContent');\n config.layers.sortContainer = toAppend.get(0);\n var layers = new Layers().init(collection, config.layers);\n this.$layers = layers.render();\n toAppend.append(this.$layers);\n this.toAppend = toAppend;\n }\n this.toAppend.show();\n },\n stop: function stop() {\n this.toAppend && this.toAppend.hide();\n }\n};\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))\n\n/***/ }),\n/* 197 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = function () {\n var itemsView = void 0;\n var config = {};\n var defaults = __webpack_require__(198);\n var ItemView = __webpack_require__(56);\n var ItemsView = __webpack_require__(57);\n\n return {\n init: function init(collection, opts) {\n config = opts || config;\n var em = config.em;\n\n // Set default options\n for (var name in defaults) {\n if (!(name in config)) config[name] = defaults[name];\n }\n\n var View = ItemsView;\n var level = 0;\n var opened = opts.opened || {};\n var options = {\n level: level,\n config: config,\n opened: opened\n };\n\n // Show wrapper if requested\n if (config.showWrapper && collection.parent) {\n View = ItemView;\n options.model = collection.parent;\n } else {\n options.collection = collection;\n }\n\n itemsView = new View(options);\n em && em.on('change:selectedComponent', this.componentChanged);\n this.componentChanged();\n\n return this;\n },\n\n\n /**\n * Triggered when the selected component is changed\n * @private\n */\n componentChanged: function componentChanged(e, md) {\n var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n if (opts.fromLayers) {\n return;\n }\n\n var em = config.em;\n var opened = em.get('opened');\n var model = em.get('selectedComponent');\n var parent = model && model.collection ? model.collection.parent : null;\n\n for (var cid in opened) {\n opened[cid].set('open', 0);\n }\n\n while (parent) {\n parent.set('open', 1);\n opened[parent.cid] = parent;\n parent = parent.collection ? parent.collection.parent : null;\n }\n },\n render: function render() {\n return itemsView.render().$el;\n }\n };\n};\n\n/***/ }),\n/* 198 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = {\n stylePrefix: 'nv-',\n\n // Enable/Disable globally the possibility to sort layers\n sortable: 1,\n\n // Enable/Disable globally the possibility to hide layers\n hidable: 1,\n\n // Hide textnodes\n hideTextnode: 1,\n\n // Indicates if the wrapper is visible in layers\n showWrapper: 1\n};\n\n/***/ }),\n/* 199 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar StyleManager = __webpack_require__(31);\nvar Backbone = __webpack_require__(0);\nvar $ = Backbone.$;\n\nmodule.exports = {\n run: function run(em, sender) {\n this.sender = sender;\n if (!this.$cn) {\n var config = em.getConfig(),\n panels = em.Panels;\n // Main container\n this.$cn = $('<div></div>');\n // Secondary container\n this.$cn2 = $('<div></div>');\n this.$cn.append(this.$cn2);\n\n // Device Manager\n var dvm = em.DeviceManager;\n if (dvm && config.showDevices) {\n var devicePanel = panels.addPanel({ id: 'devices-c' });\n devicePanel.set('appendContent', dvm.render()).trigger('change:appendContent');\n }\n\n // Class Manager container\n var clm = em.SelectorManager;\n if (clm) this.$cn2.append(clm.render([]));\n\n this.$cn2.append(em.StyleManager.render());\n var smConfig = em.StyleManager.getConfig();\n var pfx = smConfig.stylePrefix;\n // Create header\n this.$header = $('<div class=\"' + pfx + 'header\">' + smConfig.textNoElement + '</div>');\n this.$cn.append(this.$header);\n\n // Create panel if not exists\n if (!panels.getPanel('views-container')) this.panel = panels.addPanel({ id: 'views-container' });else this.panel = panels.getPanel('views-container');\n\n // Add all containers to the panel\n this.panel.set('appendContent', this.$cn).trigger('change:appendContent');\n\n this.target = em.editor;\n this.listenTo(this.target, 'change:selectedComponent', this.toggleSm);\n }\n this.toggleSm();\n },\n\n\n /**\n * Toggle Style Manager visibility\n * @private\n */\n toggleSm: function toggleSm() {\n var sender = this.sender;\n if (sender && sender.get && !sender.get('active')) return;\n\n if (this.target.get('selectedComponent')) {\n this.$cn2.show();\n this.$header.hide();\n } else {\n this.$cn2.hide();\n this.$header.show();\n }\n },\n stop: function stop() {\n // Hide secondary container if exists\n if (this.$cn2) this.$cn2.hide();\n\n // Hide header container if exists\n if (this.$header) this.$header.hide();\n }\n};\n\n/***/ }),\n/* 200 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Backbone) {\n\nvar $ = Backbone.$;\n\nmodule.exports = {\n run: function run(editor, sender) {\n var config = editor.Config;\n var pfx = config.stylePrefix;\n var tm = editor.TraitManager;\n var panelC;\n if (!this.obj) {\n var tmView = tm.getTraitsViewer();\n var confTm = tm.getConfig();\n this.obj = $('<div></div>').append('<div class=\"' + pfx + 'traits-label\">' + confTm.labelContainer + '</div>').get(0);\n this.obj.appendChild(tmView.render().el);\n var panels = editor.Panels;\n if (!panels.getPanel('views-container')) panelC = panels.addPanel({ id: 'views-container' });else panelC = panels.getPanel('views-container');\n panelC.set('appendContent', this.obj).trigger('change:appendContent');\n }\n\n this.obj.style.display = 'block';\n },\n stop: function stop() {\n if (this.obj) this.obj.style.display = 'none';\n }\n};\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))\n\n/***/ }),\n/* 201 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = {\n run: function run(editor, sender) {\n var bm = editor.BlockManager;\n var pn = editor.Panels;\n\n if (!this.blocks) {\n bm.render();\n var id = 'views-container';\n var blocks = document.createElement('div');\n var panels = pn.getPanel(id) || pn.addPanel({ id: id });\n blocks.appendChild(bm.getContainer());\n panels.set('appendContent', blocks).trigger('change:appendContent');\n this.blocks = blocks;\n }\n\n this.blocks.style.display = 'block';\n },\n stop: function stop() {\n var blocks = this.blocks;\n blocks && (blocks.style.display = 'none');\n }\n};\n\n/***/ }),\n/* 202 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = {\n run: function run(editor, sender) {\n var opts = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n\n var modal = editor.Modal;\n var am = editor.AssetManager;\n var config = am.getConfig();\n var title = opts.modalTitle || config.modalTitle || '';\n\n am.setTarget(opts.target);\n am.onClick(opts.onClick);\n am.onDblClick(opts.onDblClick);\n am.onSelect(opts.onSelect);\n\n if (!this.rendered) {\n am.render(am.getAll().filter(function (asset) {\n return asset.get('type') == 'image';\n }));\n this.rendered = 1;\n }\n\n modal.setTitle(title);\n modal.setContent(am.getContainer());\n modal.open();\n }\n};\n\n/***/ }),\n/* 203 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Backbone) {\n\nvar $ = Backbone.$;\n\nmodule.exports = {\n getOffsetMethod: function getOffsetMethod(state) {\n var method = state || '';\n return 'get' + method + 'OffsetViewerEl';\n },\n run: function run(editor, sender, opts) {\n var opt = opts || {};\n var state = opt.state || '';\n var config = editor.getConfig();\n\n if (!config.showOffsets || !config.showOffsetsSelected && state == 'Fixed') {\n return;\n }\n\n var canvas = editor.Canvas;\n var el = opt.el || '';\n var pos = opt.elPos || canvas.getElementPos(el);\n var style = window.getComputedStyle(el);\n var ppfx = this.ppfx;\n var stateVar = state + 'State';\n var method = this.getOffsetMethod(state);\n var offsetViewer = canvas[method]();\n offsetViewer.style.display = 'block';\n\n var marginT = this['marginT' + state];\n var marginB = this['marginB' + state];\n var marginL = this['marginL' + state];\n var marginR = this['marginR' + state];\n var padT = this['padT' + state];\n var padB = this['padB' + state];\n var padL = this['padL' + state];\n var padR = this['padR' + state];\n\n if (!this[stateVar]) {\n var stateLow = state.toLowerCase();\n var marginName = stateLow + 'margin-v';\n var paddingName = stateLow + 'padding-v';\n var marginV = $('<div class=\"' + ppfx + 'marginName\">').get(0);\n var paddingV = $('<div class=\"' + ppfx + 'paddingName\">').get(0);\n var marginEls = ppfx + marginName + '-el';\n var paddingEls = ppfx + paddingName + '-el';\n var fullMargName = marginEls + ' ' + (ppfx + marginName);\n var fullPadName = paddingEls + ' ' + (ppfx + paddingName);\n marginT = $('<div class=\"' + fullMargName + '-top\"></div>').get(0);\n marginB = $('<div class=\"' + fullMargName + '-bottom\"></div>').get(0);\n marginL = $('<div class=\"' + fullMargName + '-left\"></div>').get(0);\n marginR = $('<div class=\"' + fullMargName + '-right\"></div>').get(0);\n padT = $('<div class=\"' + fullPadName + '-top\"></div>').get(0);\n padB = $('<div class=\"' + fullPadName + '-bottom\"></div>').get(0);\n padL = $('<div class=\"' + fullPadName + '-left\"></div>').get(0);\n padR = $('<div class=\"' + fullPadName + '-right\"></div>').get(0);\n this['marginT' + state] = marginT;\n this['marginB' + state] = marginB;\n this['marginL' + state] = marginL;\n this['marginR' + state] = marginR;\n this['padT' + state] = padT;\n this['padB' + state] = padB;\n this['padL' + state] = padL;\n this['padR' + state] = padR;\n marginV.appendChild(marginT);\n marginV.appendChild(marginB);\n marginV.appendChild(marginL);\n marginV.appendChild(marginR);\n paddingV.appendChild(padT);\n paddingV.appendChild(padB);\n paddingV.appendChild(padL);\n paddingV.appendChild(padR);\n offsetViewer.appendChild(marginV);\n offsetViewer.appendChild(paddingV);\n this[stateVar] = '1';\n }\n\n var unit = 'px';\n var marginLeftSt = style.marginLeft.replace(unit, '');\n var marginTopSt = parseInt(style.marginTop.replace(unit, ''));\n var marginBottomSt = parseInt(style.marginBottom.replace(unit, ''));\n var mtStyle = marginT.style;\n var mbStyle = marginB.style;\n var mlStyle = marginL.style;\n var mrStyle = marginR.style;\n var ptStyle = padT.style;\n var pbStyle = padB.style;\n var plStyle = padL.style;\n var prStyle = padR.style;\n var posLeft = parseInt(pos.left);\n\n // Margin style\n mtStyle.height = style.marginTop;\n mtStyle.width = style.width;\n mtStyle.top = pos.top - style.marginTop.replace(unit, '') + unit;\n mtStyle.left = posLeft + unit;\n\n mbStyle.height = style.marginBottom;\n mbStyle.width = style.width;\n mbStyle.top = pos.top + pos.height + unit;\n mbStyle.left = posLeft + unit;\n\n var marginSideH = pos.height + marginTopSt + marginBottomSt + unit;\n var marginSideT = pos.top - marginTopSt + unit;\n mlStyle.height = marginSideH;\n mlStyle.width = style.marginLeft;\n mlStyle.top = marginSideT;\n mlStyle.left = posLeft - marginLeftSt + unit;\n\n mrStyle.height = marginSideH;\n mrStyle.width = style.marginRight;\n mrStyle.top = marginSideT;\n mrStyle.left = posLeft + pos.width + unit;\n\n // Padding style\n var padTop = parseInt(style.paddingTop.replace(unit, ''));\n ptStyle.height = style.paddingTop;\n ptStyle.width = style.width;\n ptStyle.top = pos.top + unit;\n ptStyle.left = posLeft + unit;\n\n var padBot = parseInt(style.paddingBottom.replace(unit, ''));\n pbStyle.height = style.paddingBottom;\n pbStyle.width = style.width;\n pbStyle.top = pos.top + pos.height - padBot + unit;\n pbStyle.left = posLeft + unit;\n\n var padSideH = pos.height - padBot - padTop + unit;\n var padSideT = pos.top + padTop + unit;\n plStyle.height = padSideH;\n plStyle.width = style.paddingLeft;\n plStyle.top = padSideT;\n plStyle.left = pos.left + unit;\n\n var padRight = parseInt(style.paddingRight.replace(unit, ''));\n prStyle.height = padSideH;\n prStyle.width = style.paddingRight;\n prStyle.top = padSideT;\n prStyle.left = pos.left + pos.width - padRight + unit;\n },\n stop: function stop(editor, sender, opts) {\n var opt = opts || {};\n var state = opt.state || '';\n var method = this.getOffsetMethod(state);\n var canvas = editor.Canvas;\n var offsetViewer = canvas[method]();\n offsetViewer.style.display = 'none';\n }\n};\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))\n\n/***/ }),\n/* 204 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = {\n run: function run(editor) {\n var sel = editor.getSelected();\n var comp = sel && sel.parent();\n\n // Recurse through the parent() chain until a selectable parent is found\n while (comp && !comp.get('selectable')) {\n comp = comp.parent();\n }\n\n comp && editor.select(comp);\n }\n};\n\n/***/ }),\n/* 205 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = {\n /**\n * Check if fullscreen mode is enabled\n * @return {Boolean}\n */\n isEnabled: function isEnabled() {\n var d = document;\n if (d.fullscreenElement || d.webkitFullscreenElement || d.mozFullScreenElement) return 1;else return 0;\n },\n\n\n /**\n * Enable fullscreen mode and return browser prefix\n * @param {HTMLElement} el\n * @return {string}\n */\n enable: function enable(el) {\n var pfx = '';\n if (el.requestFullscreen) el.requestFullscreen();else if (el.webkitRequestFullscreen) {\n pfx = 'webkit';\n el.webkitRequestFullscreen();\n } else if (el.mozRequestFullScreen) {\n pfx = 'moz';\n el.mozRequestFullScreen();\n } else if (el.msRequestFullscreen) el.msRequestFullscreen();else console.warn('Fullscreen not supported');\n return pfx;\n },\n\n\n /**\n * Disable fullscreen mode\n */\n disable: function disable() {\n var d = document;\n if (d.exitFullscreen) d.exitFullscreen();else if (d.webkitExitFullscreen) d.webkitExitFullscreen();else if (d.mozCancelFullScreen) d.mozCancelFullScreen();else if (d.msExitFullscreen) d.msExitFullscreen();\n },\n\n\n /**\n * Triggered when the state of the fullscreen is changed. Inside detects if\n * it's enabled\n * @param {strinf} pfx Browser prefix\n * @param {Event} e\n */\n fsChanged: function fsChanged(pfx, e) {\n var d = document;\n var ev = (pfx || '') + 'fullscreenchange';\n if (!this.isEnabled()) {\n this.stop(null, this.sender);\n document.removeEventListener(ev, this.fsChanged);\n }\n },\n run: function run(editor, sender) {\n this.sender = sender;\n var pfx = this.enable(editor.getContainer());\n this.fsChanged = this.fsChanged.bind(this, pfx);\n document.addEventListener(pfx + 'fullscreenchange', this.fsChanged);\n if (editor) editor.trigger('change:canvasOffset');\n },\n stop: function stop(editor, sender) {\n if (sender && sender.set) sender.set('active', false);\n this.disable();\n if (editor) editor.trigger('change:canvasOffset');\n }\n};\n\n/***/ }),\n/* 206 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(_) {\n\nmodule.exports = {\n getPanels: function getPanels(editor) {\n if (!this.panels) this.panels = editor.Panels.getPanelsEl();\n return this.panels;\n },\n tglPointers: function tglPointers(editor, v) {\n var elP = editor.Canvas.getBody().querySelectorAll('.' + this.ppfx + 'no-pointer');\n _.each(elP, function (item) {\n item.style.pointerEvents = v ? '' : 'all';\n });\n },\n run: function run(editor, sender) {\n if (sender && sender.set) sender.set('active', false);\n editor.stopCommand('sw-visibility');\n editor.getModel().stopDefault();\n var that = this;\n var panels = this.getPanels(editor);\n var canvas = editor.Canvas.getElement();\n var editorEl = editor.getEl();\n var pfx = editor.Config.stylePrefix;\n if (!this.helper) {\n this.helper = document.createElement('span');\n this.helper.className = pfx + 'off-prv fa fa-eye-slash';\n editorEl.appendChild(this.helper);\n this.helper.onclick = function () {\n editor.stopCommand('preview');\n };\n }\n this.helper.style.display = 'inline-block';\n this.tglPointers(editor);\n\n /*\n editor.Canvas.getBody().querySelectorAll('.' + pfx + 'no-pointer').forEach(function(){\n this.style.pointerEvents = 'all';\n });*/\n\n panels.style.display = 'none';\n var canvasS = canvas.style;\n canvasS.width = '100%';\n canvasS.height = '100%';\n canvasS.top = '0';\n canvasS.left = '0';\n canvasS.padding = '0';\n canvasS.margin = '0';\n editor.trigger('change:canvasOffset');\n },\n stop: function stop(editor, sender) {\n var panels = this.getPanels(editor);\n editor.runCommand('sw-visibility');\n editor.getModel().runDefault();\n panels.style.display = 'block';\n var canvas = editor.Canvas.getElement();\n canvas.setAttribute('style', '');\n if (this.helper) {\n this.helper.style.display = 'none';\n }\n editor.trigger('change:canvasOffset');\n this.tglPointers(editor, 1);\n }\n};\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))\n\n/***/ }),\n/* 207 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = {\n run: function run(editor, sender, opts) {\n var opt = opts || {};\n var el = opt.el || '';\n var canvas = editor.Canvas;\n var canvasResizer = this.canvasResizer;\n var options = opt.options || {};\n var canvasView = canvas.getCanvasView();\n options.ratioDefault = 1;\n options.appendTo = canvas.getResizerEl();\n options.prefix = editor.getConfig().stylePrefix;\n options.posFetcher = canvasView.getElementPos.bind(canvasView);\n options.mousePosFetcher = canvas.getMouseRelativePos;\n\n // Create the resizer for the canvas if not yet created\n if (!canvasResizer || opt.forceNew) {\n this.canvasResizer = editor.Utils.Resizer.init(options);\n canvasResizer = this.canvasResizer;\n }\n\n canvasResizer.setOptions(options);\n canvasResizer.focus(el);\n return canvasResizer;\n },\n stop: function stop() {\n var resizer = this.canvasResizer;\n resizer && resizer.blur();\n }\n};\n\n/***/ }),\n/* 208 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = {\n run: function run(editor, sender, opts) {\n var el = opts && opts.el || '';\n var canvas = editor.Canvas;\n var dragger = this.dragger;\n var options = opts.options || {};\n var canvasView = canvas.getCanvasView();\n options.prefix = editor.getConfig().stylePrefix;\n options.mousePosFetcher = canvas.getMouseRelativePos;\n options.posFetcher = canvasView.getElementPos.bind(canvasView);\n\n // Create the resizer for the canvas if not yet created\n if (!dragger) {\n dragger = editor.Utils.Dragger.init(options);\n this.dragger = dragger;\n }\n\n dragger.setOptions(options);\n dragger.focus(el);\n\n if (options.event) {\n dragger.start(options.event);\n }\n\n return dragger;\n },\n stop: function stop() {\n if (this.canvasResizer) this.canvasResizer.blur();\n }\n};\n\n/***/ }),\n/* 209 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\n/**\n * * [add](#add)\n * * [get](#get)\n * * [getAll](#getall)\n * * [getAllVisible](#getallvisible)\n * * [getCategories](#getcategories)\n * * [getContainer](#getcontainer)\n * * [render](#render)\n *\n * Block manager helps managing various, draggable, piece of contents that could be easily reused inside templates.\n *\n * Before using methods you should get first the module from the editor instance, in this way:\n *\n * ```js\n * var blockManager = editor.BlockManager;\n * ```\n *\n * @module BlockManager\n * @param {Object} config Configurations\n * @param {Array<Object>} [config.blocks=[]] Default blocks\n * @example\n * ...\n * {\n * blocks: [\n * {id:'h1-block' label: 'Heading', content:'<h1>...</h1>'},\n * ...\n * ],\n * }\n * ...\n */\nmodule.exports = function () {\n var c = {},\n defaults = __webpack_require__(210),\n Blocks = __webpack_require__(211),\n BlockCategories = __webpack_require__(213),\n BlocksView = __webpack_require__(214);\n var blocks, blocksVisible, blocksView;\n var categories = [];\n\n return {\n /**\n * Name of the module\n * @type {String}\n * @private\n */\n name: 'BlockManager',\n\n /**\n * Initialize module. Automatically called with a new instance of the editor\n * @param {Object} config Configurations\n * @return {this}\n * @private\n */\n init: function init(config) {\n c = config || {};\n var em = c.em;\n\n for (var name in defaults) {\n if (!(name in c)) {\n c[name] = defaults[name];\n }\n }\n\n // Global blocks collection\n blocks = new Blocks([]);\n blocksVisible = new Blocks([]);\n categories = new BlockCategories(), blocksView = new BlocksView({\n // Visible collection\n collection: blocksVisible,\n categories: categories\n }, c);\n\n // Setup the sync between the global and public collections\n blocks.listenTo(blocks, 'add', function (model) {\n blocksVisible.add(model);\n em && em.trigger('block:add', model);\n });\n\n blocks.listenTo(blocks, 'remove', function (model) {\n blocksVisible.remove(model);\n em && em.trigger('block:remove', model);\n });\n\n blocks.listenTo(blocks, 'reset', function (coll) {\n blocksVisible.reset(coll.models);\n });\n\n return this;\n },\n\n\n /**\n * Get configuration object\n * @return {Object}\n */\n getConfig: function getConfig() {\n return c;\n },\n\n\n /**\n * Load default blocks if the collection is empty\n */\n onLoad: function onLoad() {\n var blocks = this.getAll();\n !blocks.length && blocks.reset(c.blocks);\n },\n\n\n /**\n * Add new block to the collection.\n * @param {string} id Block id\n * @param {Object} opts Options\n * @param {string} opts.label Name of the block\n * @param {string} opts.content HTML content\n * @param {string|Object} opts.category Group the block inside a catgegory.\n * You should pass objects with id property, eg:\n * {id: 'some-uid', label: 'My category'}\n * The string will be converted in:\n * 'someid' => {id: 'someid', label: 'someid'}\n * @param {Object} [opts.attributes={}] Block attributes\n * @return {Block} Added block\n * @example\n * blockManager.add('h1-block', {\n * label: 'Heading',\n * content: '<h1>Put your title here</h1>',\n * category: 'Basic',\n * attributes: {\n * title: 'Insert h1 block'\n * }\n * });\n */\n add: function add(id, opts) {\n var obj = opts || {};\n obj.id = id;\n return blocks.add(obj);\n },\n\n\n /**\n * Return the block by id\n * @param {string} id Block id\n * @example\n * const block = blockManager.get('h1-block');\n * console.log(JSON.stringify(block));\n * // {label: 'Heading', content: '<h1>Put your ...', ...}\n */\n get: function get(id) {\n return blocks.get(id);\n },\n\n\n /**\n * Return all blocks\n * @return {Collection}\n * @example\n * const blocks = blockManager.getAll();\n * console.log(JSON.stringify(blocks));\n * // [{label: 'Heading', content: '<h1>Put your ...'}, ...]\n */\n getAll: function getAll() {\n return blocks;\n },\n\n\n /**\n * Return the visible collection, which containes blocks actually rendered\n * @return {Collection}\n */\n getAllVisible: function getAllVisible() {\n return blocksVisible;\n },\n\n\n /**\n * Remove a block by id\n * @param {string} id Block id\n * @return {Block} Removed block\n */\n remove: function remove(id) {\n return blocks.remove(id);\n },\n\n\n /**\n * Get all available categories.\n * It's possible to add categories only within blocks via 'add()' method\n * @return {Array|Collection}\n */\n getCategories: function getCategories() {\n return categories;\n },\n\n\n /**\n * Return the Blocks container element\n * @return {HTMLElement}\n */\n getContainer: function getContainer() {\n return blocksView.el;\n },\n\n\n /**\n * Render blocks\n * @param {Array} blocks Blocks to render, without the argument will render\n * all global blocks\n * @example\n * // Render all blocks (inside the global collection)\n * blockManager.render();\n *\n * // Render new set of blocks\n * const blocks = blockManager.getAll();\n * blockManager.render(blocks.filter(\n * block => block.get('category') == 'sections'\n * ));\n * // Or a new set from an array\n * blockManager.render([\n * {label: 'Label text', content: '<div>Content</div>'}\n * ]);\n *\n * // Back to blocks from the global collection\n * blockManager.render();\n */\n render: function render(blocks) {\n var toRender = blocks || this.getAll().models;\n\n if (!blocksView.rendered) {\n blocksView.render();\n blocksView.rendered = 1;\n }\n\n blocksView.collection.reset(toRender);\n }\n };\n};\n\n/***/ }),\n/* 210 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = {\n blocks: [],\n\n appendTo: ''\n};\n\n/***/ }),\n/* 211 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar Backbone = __webpack_require__(0);\nvar Block = __webpack_require__(212);\n\nmodule.exports = Backbone.Collection.extend({\n model: Block\n});\n\n/***/ }),\n/* 212 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar Backbone = __webpack_require__(0);\nvar Category = __webpack_require__(58);\n\nmodule.exports = Backbone.Model.extend({\n defaults: {\n label: '',\n content: '',\n category: '',\n attributes: {}\n },\n\n initialize: function initialize() {\n var opts = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n\n var category = this.get('category');\n\n if (category) {\n if (typeof category == 'string') {\n var catObj = new Category({\n id: category,\n label: category\n });\n }\n }\n }\n});\n\n/***/ }),\n/* 213 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar Backbone = __webpack_require__(0);\n\nmodule.exports = Backbone.Collection.extend({\n model: __webpack_require__(58)\n});\n\n/***/ }),\n/* 214 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(_) {\n\nvar _underscore = __webpack_require__(1);\n\nvar BlockView = __webpack_require__(215);\nvar CategoryView = __webpack_require__(216);\n\nmodule.exports = __webpack_require__(0).View.extend({\n initialize: function initialize(opts, config) {\n _.bindAll(this, 'getSorter', 'onDrag', 'onDrop');\n this.config = config || {};\n this.categories = opts.categories || '';\n this.renderedCategories = [];\n var ppfx = this.config.pStylePrefix || '';\n this.ppfx = ppfx;\n this.noCatClass = ppfx + 'blocks-no-cat';\n this.blockContClass = ppfx + 'blocks-c';\n this.catsClass = ppfx + 'block-categories';\n var coll = this.collection;\n this.listenTo(coll, 'add', this.addTo);\n this.listenTo(coll, 'reset', this.render);\n this.em = this.config.em;\n this.tac = 'test-tac';\n this.grabbingCls = this.ppfx + 'grabbing';\n\n if (this.em) {\n this.config.getSorter = this.getSorter;\n this.canvas = this.em.get('Canvas');\n }\n },\n\n\n /**\n * Get sorter\n * @private\n */\n getSorter: function getSorter() {\n if (!this.em) return;\n if (!this.sorter) {\n var utils = this.em.get('Utils');\n var canvas = this.canvas;\n this.sorter = new utils.Sorter({\n container: canvas.getBody(),\n placer: canvas.getPlacerEl(),\n containerSel: '*',\n itemSel: '*',\n pfx: this.ppfx,\n onStart: this.onDrag,\n onEndMove: this.onDrop,\n onMove: this.onMove,\n document: canvas.getFrameEl().contentDocument,\n direction: 'a',\n wmargin: 1,\n nested: 1,\n em: this.em,\n canvasRelative: 1\n });\n }\n return this.sorter;\n },\n\n\n /**\n * Callback when block is on drag\n * @private\n */\n onDrag: function onDrag(e) {\n this.em.stopDefault();\n this.em.trigger('block:drag:start', e);\n },\n onMove: function onMove(e) {\n this.em.trigger('block:drag:move', e);\n },\n\n\n /**\n * Callback when block is dropped\n * @private\n */\n onDrop: function onDrop(model) {\n var em = this.em;\n em.runDefault();\n\n if (model && model.get) {\n if (model.get('activeOnRender')) {\n model.trigger('active');\n model.set('activeOnRender', 0);\n }\n\n em.trigger('block:drag:stop', model);\n }\n },\n\n\n /**\n * Add new model to the collection\n * @param {Model} model\n * @private\n * */\n addTo: function addTo(model) {\n this.add(model);\n },\n\n\n /**\n * Render new model inside the view\n * @param {Model} model\n * @param {Object} fragment Fragment collection\n * @private\n * */\n add: function add(model, fragment) {\n var frag = fragment || null;\n var view = new BlockView({\n model: model,\n attributes: model.get('attributes')\n }, this.config);\n var rendered = view.render().el;\n var category = model.get('category');\n\n // Check for categories\n if (category && this.categories) {\n if ((0, _underscore.isString)(category)) {\n category = {\n id: category,\n label: category\n };\n } else if ((0, _underscore.isObject)(category) && !category.id) {\n category.id = category.label;\n }\n\n var catModel = this.categories.add(category);\n var catId = catModel.get('id');\n var catView = this.renderedCategories[catId];\n var categories = this.getCategoriesEl();\n model.set('category', catModel);\n\n if (!catView && categories) {\n catView = new CategoryView({\n model: catModel\n }, this.config).render();\n this.renderedCategories[catId] = catView;\n categories.appendChild(catView.el);\n }\n\n catView && catView.append(rendered);\n return;\n }\n\n if (frag) frag.appendChild(rendered);else this.append(rendered);\n },\n getCategoriesEl: function getCategoriesEl() {\n if (!this.catsEl) {\n this.catsEl = this.el.querySelector('.' + this.catsClass);\n }\n\n return this.catsEl;\n },\n getBlocksEl: function getBlocksEl() {\n if (!this.blocksEl) {\n this.blocksEl = this.el.querySelector('.' + this.noCatClass + ' .' + this.blockContClass);\n }\n\n return this.blocksEl;\n },\n append: function append(el) {\n var blocks = this.getBlocksEl();\n blocks && blocks.appendChild(el);\n },\n render: function render() {\n var _this = this;\n\n var frag = document.createDocumentFragment();\n this.catsEl = null;\n this.blocksEl = null;\n this.renderedCategories = [];\n this.el.innerHTML = '\\n <div class=\"' + this.catsClass + '\"></div>\\n <div class=\"' + this.noCatClass + '\">\\n <div class=\"' + this.blockContClass + '\"></div>\\n </div>\\n ';\n\n this.collection.each(function (model) {\n return _this.add(model, frag);\n });\n this.append(frag);\n this.$el.addClass(this.blockContClass + 's');\n return this;\n }\n});\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))\n\n/***/ }),\n/* 215 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Backbone) {\n\nvar _underscore = __webpack_require__(1);\n\nvar _mixins = __webpack_require__(2);\n\nmodule.exports = Backbone.View.extend({\n events: {\n mousedown: 'startDrag',\n dragstart: 'handleDragStart',\n dragend: 'handleDragEnd'\n },\n\n initialize: function initialize(o) {\n var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n this.em = config.em;\n this.config = config;\n this.endDrag = this.endDrag.bind(this);\n this.ppfx = config.pStylePrefix || '';\n this.listenTo(this.model, 'destroy remove', this.remove);\n },\n\n\n /**\n * Start block dragging\n * @private\n */\n startDrag: function startDrag(e) {\n var config = this.config;\n //Right or middel click\n if (e.button !== 0 || !config.getSorter || this.el.draggable) return;\n config.em.refreshCanvas();\n var sorter = config.getSorter();\n sorter.setDragHelper(this.el, e);\n sorter.setDropContent(this.model.get('content'));\n sorter.startSort(this.el);\n (0, _mixins.on)(document, 'mouseup', this.endDrag);\n },\n handleDragStart: function handleDragStart(ev) {\n var content = this.model.get('content');\n var isObj = (0, _underscore.isObject)(content);\n var type = isObj ? 'text/json' : 'text';\n var data = isObj ? JSON.stringify(content) : content;\n\n // Note: data are not available on dragenter for security reason,\n // but will use dragContent as I need it for the Sorter context\n ev.dataTransfer.setData(type, data);\n this.em.set('dragContent', content);\n },\n handleDragEnd: function handleDragEnd() {\n this.em.set('dragContent', '');\n },\n\n\n /**\n * Drop block\n * @private\n */\n endDrag: function endDrag(e) {\n (0, _mixins.off)(document, 'mouseup', this.endDrag);\n var sorter = this.config.getSorter();\n\n // After dropping the block in the canvas the mouseup event is not yet\n // triggerd on 'this.doc' and so clicking outside, the sorter, tries to move\n // things (throws false positives). As this method just need to drop away\n // the block helper I use the trick of 'moved = 0' to void those errors.\n sorter.moved = 0;\n sorter.endMove();\n },\n render: function render() {\n var el = this.el;\n var pfx = this.ppfx;\n var className = pfx + 'block';\n var label = this.model.get('label');\n el.className += ' ' + className + ' ' + pfx + 'one-bg ' + pfx + 'four-color-h';\n el.innerHTML = '<div class=\"' + className + '-label\">' + label + '</div>';\n (0, _mixins.hasDnd)(this.em) && el.setAttribute('draggable', true);\n return this;\n }\n});\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))\n\n/***/ }),\n/* 216 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(_) {\n\nvar Backbone = __webpack_require__(0);\n\nmodule.exports = Backbone.View.extend({\n template: _.template('\\n <div class=\"<%= pfx %>title\">\\n <i class=\"<%= pfx %>caret-icon\"></i>\\n <%= label %>\\n </div>\\n <div class=\"<%= pfx %>blocks-c\"></div>\\n '),\n\n events: {},\n\n initialize: function initialize() {\n var o = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n\n this.config = config;\n var pfx = this.config.pStylePrefix || '';\n this.pfx = pfx;\n this.caretR = 'fa fa-caret-right';\n this.caretD = 'fa fa-caret-down';\n this.iconClass = pfx + 'caret-icon';\n this.activeClass = pfx + 'open';\n this.className = pfx + 'block-category';\n this.events['click .' + pfx + 'title'] = 'toggle';\n this.listenTo(this.model, 'change:open', this.updateVisibility);\n this.delegateEvents();\n },\n updateVisibility: function updateVisibility() {\n if (this.model.get('open')) this.open();else this.close();\n },\n open: function open() {\n this.el.className = this.className + ' ' + this.activeClass;\n this.getIconEl().className = this.iconClass + ' ' + this.caretD;\n this.getBlocksEl().style.display = '';\n },\n close: function close() {\n this.el.className = this.className;\n this.getIconEl().className = this.iconClass + ' ' + this.caretR;\n this.getBlocksEl().style.display = 'none';\n },\n toggle: function toggle() {\n var model = this.model;\n model.set('open', !model.get('open'));\n },\n getIconEl: function getIconEl() {\n if (!this.iconEl) {\n this.iconEl = this.el.querySelector('.' + this.iconClass);\n }\n\n return this.iconEl;\n },\n getBlocksEl: function getBlocksEl() {\n if (!this.blocksEl) {\n this.blocksEl = this.el.querySelector('.' + this.pfx + 'blocks-c');\n }\n\n return this.blocksEl;\n },\n append: function append(el) {\n this.getBlocksEl().appendChild(el);\n },\n render: function render() {\n this.el.innerHTML = this.template({\n pfx: this.pfx,\n label: this.model.get('label')\n });\n this.el.className = this.className;\n this.$el.css({ order: this.model.get('order') });\n this.updateVisibility();\n return this;\n }\n});\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(1)))\n\n/***/ }),\n/* 217 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nvar _underscore = __webpack_require__(1);\n\nmodule.exports = function (_ref) {\n var $ = _ref.$,\n Backbone = _ref.Backbone;\n\n if (Backbone) {\n var ViewProt = Backbone.View.prototype;\n var eventNsMap = {};\n ViewProt.eventNsMap = eventNsMap;\n\n ViewProt.delegate = function (eventName, selector, listener) {\n var vid = '.delegateEvents' + this.cid;\n this.$el.on(eventName, selector, listener);\n //return this;\n var eventMap = eventNsMap[vid];\n\n if (!eventMap) {\n eventMap = [];\n eventNsMap[vid] = eventMap;\n }\n\n eventMap.push({ eventName: eventName, selector: selector, listener: listener });\n return this;\n };\n\n ViewProt.undelegateEvents = function () {\n var _this = this;\n\n var vid = '.delegateEvents' + this.cid;\n if (this.$el) {\n //this.$el.off(); return this;\n var eventMap = eventNsMap[vid];\n\n if (eventMap) {\n eventMap.forEach(function (_ref2) {\n var eventName = _ref2.eventName,\n selector = _ref2.selector,\n listener = _ref2.listener;\n\n _this.$el.off(eventName);\n });\n }\n }\n return this;\n };\n\n ViewProt.undelegate = function (ev, sel, list) {\n var _this2 = this;\n\n var vid = '.delegateEvents' + this.cid;\n //this.$el.off(ev, sel, list); return this;\n var eventMap = eventNsMap[vid];\n\n if (eventMap) {\n eventMap.forEach(function (_ref3) {\n var eventName = _ref3.eventName,\n selector = _ref3.selector,\n listener = _ref3.listener;\n\n if (eventName == ev && selector == sel) {\n _this2.$el.off(eventName);\n }\n });\n }\n\n return this;\n };\n }\n\n if ($ && $.prototype.constructor.name !== 'jQuery') {\n var fn = $.fn;\n\n var splitNamespace = function splitNamespace(name) {\n var namespaceArray = name.split('.');\n return name.indexOf('.') !== 0 ? [namespaceArray[0], namespaceArray.slice(1)] : [null, namespaceArray];\n };\n\n var on = $.prototype.on;\n var off = $.prototype.off;\n var trigger = $.prototype.trigger;\n var offset = $.prototype.offset;\n var getEvents = function getEvents(eventName) {\n return eventName.split(/[,\\s]+/g);\n };\n var getNamespaces = function getNamespaces(eventName) {\n return eventName.split('.');\n };\n\n fn.on = function (eventName, delegate, callback, runOnce) {\n var _this3 = this;\n\n if (typeof eventName == 'string') {\n var events = getEvents(eventName);\n\n if (events.length == 1) {\n eventName = events[0];\n var namespaces = getNamespaces(eventName);\n\n if (eventName.indexOf('.') !== 0) {\n eventName = namespaces[0];\n }\n\n namespaces = namespaces.slice(1);\n\n if (namespaces.length) {\n //console.log('Found event with namespaces', namespaces, eventName, delegate, this);\n var cashNs = this.data('_cashNs') || [];\n // cashNs[namespace]\n this.data('_cashNs', namespaces); // for each ns need to store '.store' => eventName, delegate, callback\n }\n\n return on.call(this, eventName, delegate, callback, runOnce);\n } else {\n events.forEach(function (eventName) {\n return _this3.on(eventName, delegate, callback, runOnce);\n });\n return this;\n }\n } else {\n return on.call(this, eventName, delegate, callback, runOnce);\n }\n };\n\n fn.off = function (eventName, callback) {\n var _this4 = this;\n\n if (typeof eventName == 'string') {\n var events = getEvents(eventName);\n\n if (events.length == 1) {\n eventName = events[0];\n var namespaces = getNamespaces(eventName);\n\n if (eventName.indexOf('.') !== 0) {\n eventName = namespaces[0];\n }\n\n namespaces = namespaces.slice(1);\n\n if (namespaces.length) {\n // Have to off only with the same namespace\n }\n\n return off.call(this, eventName, callback);\n } else {\n events.forEach(function (eventName) {\n return _this4.off(eventName, callback);\n });\n return this;\n }\n } else {\n return off.call(this, eventName, callback);\n }\n };\n\n fn.trigger = function (eventName, data) {\n var _this5 = this;\n\n if (eventName instanceof $.Event) {\n return this.trigger(eventName.type, data);\n }\n\n if (typeof eventName == 'string') {\n var events = getEvents(eventName);\n\n if (events.length == 1) {\n eventName = events[0];\n var namespaces = getNamespaces(eventName);\n\n if (eventName.indexOf('.') !== 0) {\n eventName = namespaces[0];\n }\n\n namespaces = namespaces.slice(1);\n\n if (namespaces.length) {\n // have to trigger with same namespaces and eventName\n }\n\n return trigger.call(this, eventName, data);\n } else {\n events.forEach(function (eventName) {\n return _this5.trigger(eventName, data);\n });\n return this;\n }\n } else {\n return trigger.call(this, eventName, data);\n }\n };\n\n fn.hide = function () {\n return this.css('display', 'none');\n };\n\n fn.show = function () {\n return this.css('display', 'block');\n };\n\n fn.focus = function () {\n var el = this.get(0);\n el && el.focus();\n return this;\n };\n\n fn.remove = function () {\n return this.each(function (node) {\n return node.parentNode && node.parentNode.removeChild(node);\n });\n },\n // For spectrum compatibility\n fn.bind = function (ev, h) {\n return this.on(ev, h);\n };\n\n fn.unbind = function (ev, h) {\n if ((0, _underscore.isObject)(ev)) {\n for (var name in ev) {\n ev.hasOwnProperty(name) && this.off(name, ev[name]);\n }\n\n return this;\n } else {\n return this.off(ev, h);\n }\n };\n\n fn.click = function (h) {\n return h ? this.on('click', h) : this.trigger('click');\n };\n\n fn.change = function (h) {\n return h ? this.on('change', h) : this.trigger('change');\n };\n\n fn.keydown = function (h) {\n return h ? this.on('keydown', h) : this.trigger('keydown');\n };\n\n fn.delegate = function (selector, events, data, handler) {\n if (!handler) {\n handler = data;\n }\n\n return this.on(events, selector, function (e) {\n e.data = data;\n handler(e);\n });\n };\n\n fn.scrollLeft = function () {\n var el = this.get(0);\n el = el.nodeType == 9 ? el.defaultView : el;\n var win = el instanceof Window ? el : null;\n return win ? win.pageXOffset : el.scrollLeft || 0;\n };\n\n fn.scrollTop = function () {\n var el = this.get(0);\n el = el.nodeType == 9 ? el.defaultView : el;\n var win = el instanceof Window ? el : null;\n return win ? win.pageYOffset : el.scrollTop || 0;\n };\n\n fn.offset = function (coords) {\n var top = void 0,\n left = void 0;\n\n if (coords) {\n top = coords.top;\n left = coords.left;\n }\n\n if (typeof top != 'undefined') {\n this.css('top', top + 'px');\n }\n if (typeof left != 'undefined') {\n this.css('left', left + 'px');\n }\n\n return offset.call(this);\n };\n\n $.map = function (items, clb) {\n var ar = [];\n\n for (var i = 0; i < items.length; i++) {\n ar.push(clb(items[i], i));\n }\n\n return ar;\n };\n\n var indexOf = Array.prototype.indexOf;\n\n $.inArray = function (val, arr, i) {\n return arr == null ? -1 : indexOf.call(arr, val, i);\n };\n\n $.Event = function (src, props) {\n if (!(this instanceof $.Event)) {\n return new $.Event(src, props);\n }\n\n this.type = src;\n this.isDefaultPrevented = function () {\n return false;\n };\n };\n }\n};\n\n/***/ }),\n/* 218 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n/* WEBPACK VAR INJECTION */(function(Backbone) {\n\nvar $ = Backbone.$;\n\nmodule.exports = Backbone.View.extend({\n initialize: function initialize() {\n var _this = this;\n\n var model = this.model;\n model.view = this;\n this.conf = model.config;\n this.pn = model.get('Panels');\n model.on('loaded', function () {\n _this.pn.active();\n _this.pn.disableButtons();\n model.runDefault();\n setTimeout(function () {\n return model.trigger('load');\n }, 0);\n });\n },\n render: function render() {\n var model = this.model;\n var el = this.$el;\n var conf = this.conf;\n var contEl = $(conf.el || 'body ' + conf.container);\n var pfx = conf.stylePrefix;\n el.empty();\n\n if (conf.width) contEl.css('width', conf.width);\n\n if (conf.height) contEl.css('height', conf.height);\n\n el.append(model.get('Canvas').render());\n el.append(this.pn.render());\n el.attr('class', pfx + 'editor ' + pfx + 'one-bg ' + pfx + 'two-color');\n contEl.addClass(pfx + 'editor-cont').empty().append(el);\n\n return this;\n }\n});\n/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(0)))\n\n/***/ }),\n/* 219 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = function (config) {\n var c = config || {},\n defaults = __webpack_require__(220);\n\n // Set default options\n for (var name in defaults) {\n if (!(name in c)) c[name] = defaults[name];\n }\n\n var plugins = {};\n\n return {\n /**\n * Add new plugin. Plugins could not be overwritten\n * @param {string} id Plugin ID\n * @param {Function} plugin Function which contains all plugin logic\n * @return {Function} The plugin function\n * @example\n * PluginManager.add('some-plugin', function(editor){\n * editor.Commands.add('new-command', {\n * run: function(editor, senderBtn){\n * console.log('Executed new-command');\n * }\n * })\n * });\n */\n add: function add(id, plugin) {\n if (plugins[id]) {\n return plugins[id];\n }\n\n plugins[id] = plugin;\n return plugin;\n },\n\n\n /**\n * Returns plugin by ID\n * @param {string} id Plugin ID\n * @return {Function|undefined} Plugin\n * @example\n * var plugin = PluginManager.get('some-plugin');\n * plugin(editor);\n */\n get: function get(id) {\n return plugins[id];\n },\n\n\n /**\n * Returns object with all plugins\n * @return {Object}\n */\n getAll: function getAll() {\n return plugins;\n }\n };\n};\n\n/***/ }),\n/* 220 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nmodule.exports = {\n plugins: []\n};\n\n/***/ }),\n/* 221 */\n/***/ (function(module, exports, __webpack_require__) {\n\n\"use strict\";\n\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\n\n/**\n * File made for IE/Edge support\n * https://github.com/artf/grapesjs/issues/214\n */\n\nexports.default = function () {\n /**\n * Check if IE/Edge\n * @return {Boolean}\n */\n var isIE = function isIE() {\n var match = void 0;\n var agent = window.navigator.userAgent;\n var rules = [['edge', /Edge\\/([0-9\\._]+)/], ['ie', /MSIE\\s(7\\.0)/], ['ie', /MSIE\\s([0-9\\.]+);.*Trident\\/[4-7].0/], ['ie', /Trident\\/7\\.0.*rv\\:([0-9\\.]+).*\\).*Gecko$/]];\n\n for (var i = 0; i < rules.length; i++) {\n var rule = rules[i];\n match = rule[1].exec(agent);\n if (match) break;\n }\n\n return !!match;\n };\n\n if (isIE()) {\n var originalCreateHTMLDocument = DOMImplementation.prototype.createHTMLDocument;\n DOMImplementation.prototype.createHTMLDocument = function (title) {\n if (!title) title = '';\n return originalCreateHTMLDocument.apply(document.implementation, [title]);\n };\n }\n};\n\n/***/ })\n/******/ ]);\n});"]} |