@verdocs/web-sdk 5.0.75 → 5.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{Datastore-Dn_pL6x4.js → Datastore-CIzsoGWH.js} +7 -6
- package/dist/cjs/Datastore-CIzsoGWH.js.map +1 -0
- package/dist/cjs/index-Be9PlTB7.js +10 -10
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/verdocs-build.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-build.cjs.entry.js.map +1 -1
- package/dist/cjs/verdocs-build.entry.cjs.js.map +1 -1
- package/dist/cjs/verdocs-button.verdocs-help-icon.verdocs-text-input.entry.cjs.js.map +1 -0
- package/dist/cjs/verdocs-button_3.cjs.entry.js +177 -0
- package/dist/cjs/verdocs-button_3.cjs.entry.js.map +1 -0
- package/dist/cjs/verdocs-checkbox.verdocs-component-error.verdocs-loader.verdocs-select-input.verdocs-template-field-properties.entry.cjs.js.map +1 -0
- package/dist/cjs/{verdocs-checkbox_6.cjs.entry.js → verdocs-checkbox_5.cjs.entry.js} +3 -91
- package/dist/{verdocs-web-sdk/verdocs-checkbox.verdocs-component-error.verdocs-loader.verdocs-select-input.verdocs-template-field-properties.verdocs-text-input.entry.esm.js.map → cjs/verdocs-checkbox_5.cjs.entry.js.map} +1 -1
- package/dist/cjs/verdocs-contact-picker.cjs.entry.js +7 -3
- package/dist/cjs/verdocs-contact-picker.cjs.entry.js.map +1 -1
- package/dist/cjs/verdocs-contact-picker.entry.cjs.js.map +1 -1
- package/dist/cjs/verdocs-envelope-recipient-link.verdocs-envelope-update-recipient.entry.cjs.js.map +1 -0
- package/dist/cjs/{verdocs-envelope-recipient-link.cjs.entry.js → verdocs-envelope-recipient-link_2.cjs.entry.js} +91 -4
- package/dist/cjs/verdocs-envelope-recipient-link_2.cjs.entry.js.map +1 -0
- package/dist/cjs/verdocs-envelope-recipient-summary.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-envelope-sidebar.cjs.entry.js +51 -1
- package/dist/cjs/verdocs-envelope-sidebar.cjs.entry.js.map +1 -1
- package/dist/cjs/verdocs-envelope-sidebar.entry.cjs.js.map +1 -1
- package/dist/cjs/verdocs-field-attachment_13.cjs.entry.js +2 -2
- package/dist/cjs/verdocs-field-attachment_13.cjs.entry.js.map +1 -1
- package/dist/cjs/verdocs-field-payment.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-kba-dialog_3.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-menu-panel_2.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-preview.verdocs-send.verdocs-template-attachments.verdocs-template-build-tabs.verdocs-template-fields.verdocs-template-roles.verdocs-template-settings.entry.cjs.js.map +1 -1
- package/dist/cjs/verdocs-preview_7.cjs.entry.js +1 -3
- package/dist/cjs/verdocs-preview_7.cjs.entry.js.map +1 -1
- package/dist/cjs/verdocs-radio-button.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-radio-button.cjs.entry.js.map +1 -1
- package/dist/cjs/verdocs-radio-button.entry.cjs.js.map +1 -1
- package/dist/cjs/verdocs-sign.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-template-document-page_2.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-web-sdk.cjs.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/controls/verdocs-radio-button/verdocs-radio-button.css +2 -2
- package/dist/collection/components/embeds/verdocs-build/verdocs-build.js +4 -4
- package/dist/collection/components/embeds/verdocs-build/verdocs-build.js.map +1 -1
- package/dist/collection/components/embeds/verdocs-send/verdocs-send.js +8 -10
- package/dist/collection/components/embeds/verdocs-send/verdocs-send.js.map +1 -1
- package/dist/collection/components/envelopes/verdocs-envelope-recipient-link/verdocs-envelope-recipient-link.js +1 -1
- package/dist/collection/components/envelopes/verdocs-envelope-recipient-link/verdocs-envelope-recipient-link.js.map +1 -1
- package/dist/collection/components/envelopes/verdocs-envelope-sidebar/verdocs-envelope-sidebar.js +52 -0
- package/dist/collection/components/envelopes/verdocs-envelope-sidebar/verdocs-envelope-sidebar.js.map +1 -1
- package/dist/collection/components/envelopes/verdocs-envelope-update-recipient/verdocs-envelope-update-recipient.css +96 -0
- package/dist/collection/components/envelopes/verdocs-envelope-update-recipient/verdocs-envelope-update-recipient.js +224 -0
- package/dist/collection/components/envelopes/verdocs-envelope-update-recipient/verdocs-envelope-update-recipient.js.map +1 -0
- package/dist/collection/components/fields/verdocs-field-radio/verdocs-field-radio.css +2 -2
- package/dist/collection/utils/Datastore.js +2 -2
- package/dist/collection/utils/Datastore.js.map +1 -1
- package/dist/components/index.js +2 -0
- package/dist/components/index.js.map +1 -1
- package/dist/components/{p-CWHHlD3o.js → p-B3jMBr0M.js} +9 -5
- package/dist/components/p-B3jMBr0M.js.map +1 -0
- package/dist/components/{p-Cn4wVEX4.js → p-B8nK0hJl.js} +4 -4
- package/dist/components/{p-Cn4wVEX4.js.map → p-B8nK0hJl.js.map} +1 -1
- package/dist/components/{p-DgfjnZPa.js → p-BGMd4wA7.js} +4 -4
- package/dist/components/{p-DgfjnZPa.js.map → p-BGMd4wA7.js.map} +1 -1
- package/dist/components/{p-03kDzdlZ.js → p-BHKb3X7a.js} +3 -3
- package/dist/components/{p-03kDzdlZ.js.map → p-BHKb3X7a.js.map} +1 -1
- package/dist/components/{p-CqQzEyUV.js → p-Bb2F00K4.js} +4 -4
- package/dist/components/{p-CqQzEyUV.js.map → p-Bb2F00K4.js.map} +1 -1
- package/dist/components/{p-z0ZD30Bi.js → p-BwIyL1sF.js} +4 -4
- package/dist/components/{p-z0ZD30Bi.js.map → p-BwIyL1sF.js.map} +1 -1
- package/dist/components/{p-Dw5jTBu3.js → p-C2Fb8G6A.js} +4 -4
- package/dist/components/{p-Dw5jTBu3.js.map → p-C2Fb8G6A.js.map} +1 -1
- package/dist/components/{p-IcjPGPO7.js → p-CPRS8f3I.js} +3 -3
- package/dist/components/{p-IcjPGPO7.js.map → p-CPRS8f3I.js.map} +1 -1
- package/dist/components/{p-CNJfehtH.js → p-Crehnwtj.js} +4 -4
- package/dist/components/{p-CNJfehtH.js.map → p-Crehnwtj.js.map} +1 -1
- package/dist/components/{p-B8HdsDVX.js → p-CunjhIft.js} +3 -3
- package/dist/components/{p-B8HdsDVX.js.map → p-CunjhIft.js.map} +1 -1
- package/dist/components/{p-CDTU_UJD.js → p-D3n1gA61.js} +5 -5
- package/dist/components/p-D3n1gA61.js.map +1 -0
- package/dist/components/{p-iwNYe5a0.js → p-DB-CFkUZ.js} +4 -4
- package/dist/components/{p-iwNYe5a0.js.map → p-DB-CFkUZ.js.map} +1 -1
- package/dist/components/{p-Cue-TDgY.js → p-DDAZR40U.js} +3 -3
- package/dist/components/{p-Cue-TDgY.js.map → p-DDAZR40U.js.map} +1 -1
- package/dist/components/{p-Cfx8TNcj.js → p-DGRiUZlM.js} +15 -15
- package/dist/components/{p-Cfx8TNcj.js.map → p-DGRiUZlM.js.map} +1 -1
- package/dist/components/{p-CpHTrnj5.js → p-DGiDigbo.js} +4 -6
- package/dist/components/p-DGiDigbo.js.map +1 -0
- package/dist/components/{p-B6IuryK-.js → p-DQh221R1.js} +4 -4
- package/dist/components/{p-B6IuryK-.js.map → p-DQh221R1.js.map} +1 -1
- package/dist/components/{p-BPEZpcEQ.js → p-D_x2HuZp.js} +4 -4
- package/dist/components/{p-BPEZpcEQ.js.map → p-D_x2HuZp.js.map} +1 -1
- package/dist/components/{p-C_IIZj49.js → p-DmsV595e.js} +8 -7
- package/dist/components/p-DmsV595e.js.map +1 -0
- package/dist/components/p-GUGCYQ6F.js +138 -0
- package/dist/components/p-GUGCYQ6F.js.map +1 -0
- package/dist/components/{p-De7UWCgq.js → p-WhDWrMQm.js} +4 -4
- package/dist/components/{p-De7UWCgq.js.map → p-WhDWrMQm.js.map} +1 -1
- package/dist/components/{p-iOb94GB3.js → p-X6ujIO0j.js} +3 -3
- package/dist/components/{p-iOb94GB3.js.map → p-X6ujIO0j.js.map} +1 -1
- package/dist/components/{p-B6hVXdpp.js → p-XHSVTLB0.js} +4 -4
- package/dist/components/{p-B6hVXdpp.js.map → p-XHSVTLB0.js.map} +1 -1
- package/dist/components/{p-C3_yeGdH.js → p-dIi8HYZ5.js} +3 -3
- package/dist/components/{p-C3_yeGdH.js.map → p-dIi8HYZ5.js.map} +1 -1
- package/dist/components/{p-eiHT7SZQ.js → p-kaKbklxN.js} +15 -15
- package/dist/components/{p-eiHT7SZQ.js.map → p-kaKbklxN.js.map} +1 -1
- package/dist/components/{p-BqWxusTA.js → p-ke4RFlpQ.js} +14 -14
- package/dist/components/{p-BqWxusTA.js.map → p-ke4RFlpQ.js.map} +1 -1
- package/dist/components/verdocs-build.js +22 -22
- package/dist/components/verdocs-build.js.map +1 -1
- package/dist/components/verdocs-contact-picker.js +1 -1
- package/dist/components/verdocs-envelope-recipient-link.js +1 -1
- package/dist/components/verdocs-envelope-recipient-summary.js +1 -1
- package/dist/components/verdocs-envelope-sidebar.js +65 -8
- package/dist/components/verdocs-envelope-sidebar.js.map +1 -1
- package/dist/components/verdocs-envelope-update-recipient.d.ts +11 -0
- package/dist/components/verdocs-envelope-update-recipient.js +9 -0
- package/dist/components/verdocs-envelope-update-recipient.js.map +1 -0
- package/dist/components/verdocs-field-attachment.js +1 -1
- package/dist/components/verdocs-field-checkbox.js +1 -1
- package/dist/components/verdocs-field-date.js +1 -1
- package/dist/components/verdocs-field-dropdown.js +1 -1
- package/dist/components/verdocs-field-initial.js +1 -1
- package/dist/components/verdocs-field-payment.js +2 -2
- package/dist/components/verdocs-field-radio.js +1 -1
- package/dist/components/verdocs-field-signature.js +1 -1
- package/dist/components/verdocs-field-textarea.js +1 -1
- package/dist/components/verdocs-field-textbox.js +1 -1
- package/dist/components/verdocs-field-timestamp.js +1 -1
- package/dist/components/verdocs-preview.js +1 -1
- package/dist/components/verdocs-radio-button.js +1 -1
- package/dist/components/verdocs-radio-button.js.map +1 -1
- package/dist/components/verdocs-send.js +1 -1
- package/dist/components/verdocs-sign.js +2 -2
- package/dist/components/verdocs-template-attachments.js +1 -1
- package/dist/components/verdocs-template-build-tabs.js +1 -1
- package/dist/components/verdocs-template-document-page.js +1 -1
- package/dist/components/verdocs-template-field-properties.js +1 -1
- package/dist/components/verdocs-template-fields.js +1 -1
- package/dist/components/verdocs-template-role-properties.js +1 -1
- package/dist/components/verdocs-template-roles.js +1 -1
- package/dist/components/verdocs-template-settings.js +1 -1
- package/dist/components/verdocs-view.js +1 -1
- package/dist/custom-elements.json +21 -0
- package/dist/esm/{Datastore-C_IIZj49.js → Datastore-DmsV595e.js} +8 -7
- package/dist/esm/Datastore-DmsV595e.js.map +1 -0
- package/dist/esm/index-CF7i8guW.js +10 -10
- package/dist/esm/loader.js +1 -1
- package/dist/esm/verdocs-build.entry.js +1 -1
- package/dist/esm/verdocs-build.entry.js.map +1 -1
- package/dist/esm/verdocs-button.verdocs-help-icon.verdocs-text-input.entry.js.map +1 -0
- package/dist/esm/verdocs-button_3.entry.js +173 -0
- package/dist/esm/verdocs-button_3.entry.js.map +1 -0
- package/dist/esm/verdocs-checkbox.verdocs-component-error.verdocs-loader.verdocs-select-input.verdocs-template-field-properties.entry.js.map +1 -0
- package/dist/esm/{verdocs-checkbox_6.entry.js → verdocs-checkbox_5.entry.js} +4 -91
- package/dist/esm/verdocs-checkbox_5.entry.js.map +1 -0
- package/dist/esm/verdocs-contact-picker.entry.js +7 -3
- package/dist/esm/verdocs-contact-picker.entry.js.map +1 -1
- package/dist/esm/verdocs-envelope-recipient-link.verdocs-envelope-update-recipient.entry.js.map +1 -0
- package/dist/esm/{verdocs-envelope-recipient-link.entry.js → verdocs-envelope-recipient-link_2.entry.js} +91 -5
- package/dist/esm/verdocs-envelope-recipient-link_2.entry.js.map +1 -0
- package/dist/esm/verdocs-envelope-recipient-summary.entry.js +1 -1
- package/dist/esm/verdocs-envelope-sidebar.entry.js +52 -2
- package/dist/esm/verdocs-envelope-sidebar.entry.js.map +1 -1
- package/dist/esm/verdocs-field-attachment_13.entry.js +2 -2
- package/dist/esm/verdocs-field-attachment_13.entry.js.map +1 -1
- package/dist/esm/verdocs-field-payment.entry.js +1 -1
- package/dist/esm/verdocs-kba-dialog_3.entry.js +1 -1
- package/dist/esm/verdocs-menu-panel_2.entry.js +1 -1
- package/dist/esm/verdocs-preview.verdocs-send.verdocs-template-attachments.verdocs-template-build-tabs.verdocs-template-fields.verdocs-template-roles.verdocs-template-settings.entry.js.map +1 -1
- package/dist/esm/verdocs-preview_7.entry.js +1 -3
- package/dist/esm/verdocs-preview_7.entry.js.map +1 -1
- package/dist/esm/verdocs-radio-button.entry.js +1 -1
- package/dist/esm/verdocs-radio-button.entry.js.map +1 -1
- package/dist/esm/verdocs-sign.entry.js +1 -1
- package/dist/esm/verdocs-template-document-page_2.entry.js +1 -1
- package/dist/esm/verdocs-web-sdk.js +1 -1
- package/dist/esm-es5/Datastore-DmsV595e.js +2 -0
- package/dist/esm-es5/Datastore-DmsV595e.js.map +1 -0
- package/dist/esm-es5/index-CF7i8guW.js +1 -1
- package/dist/esm-es5/loader.js +1 -1
- package/dist/esm-es5/verdocs-build.entry.js +1 -1
- package/dist/esm-es5/verdocs-build.entry.js.map +1 -1
- package/dist/esm-es5/verdocs-button.verdocs-help-icon.verdocs-text-input.entry.js.map +1 -0
- package/dist/esm-es5/verdocs-button_3.entry.js +2 -0
- package/dist/esm-es5/verdocs-button_3.entry.js.map +1 -0
- package/dist/esm-es5/verdocs-checkbox.verdocs-component-error.verdocs-loader.verdocs-select-input.verdocs-template-field-properties.entry.js.map +1 -0
- package/dist/esm-es5/verdocs-checkbox_5.entry.js +2 -0
- package/dist/esm-es5/verdocs-checkbox_5.entry.js.map +1 -0
- package/dist/esm-es5/verdocs-contact-picker.entry.js +1 -1
- package/dist/esm-es5/verdocs-contact-picker.entry.js.map +1 -1
- package/dist/esm-es5/verdocs-envelope-recipient-link.verdocs-envelope-update-recipient.entry.js.map +1 -0
- package/dist/esm-es5/verdocs-envelope-recipient-link_2.entry.js +2 -0
- package/dist/esm-es5/verdocs-envelope-recipient-link_2.entry.js.map +1 -0
- package/dist/esm-es5/verdocs-envelope-recipient-summary.entry.js +1 -1
- package/dist/esm-es5/verdocs-envelope-sidebar.entry.js +1 -1
- package/dist/esm-es5/verdocs-envelope-sidebar.entry.js.map +1 -1
- package/dist/esm-es5/verdocs-field-attachment_13.entry.js +1 -1
- package/dist/esm-es5/verdocs-field-attachment_13.entry.js.map +1 -1
- package/dist/esm-es5/verdocs-field-payment.entry.js +1 -1
- package/dist/esm-es5/verdocs-kba-dialog_3.entry.js +1 -1
- package/dist/esm-es5/verdocs-menu-panel_2.entry.js +1 -1
- package/dist/esm-es5/verdocs-preview.verdocs-send.verdocs-template-attachments.verdocs-template-build-tabs.verdocs-template-fields.verdocs-template-roles.verdocs-template-settings.entry.js.map +1 -1
- package/dist/esm-es5/verdocs-preview_7.entry.js +2 -2
- package/dist/esm-es5/verdocs-preview_7.entry.js.map +1 -1
- package/dist/esm-es5/verdocs-radio-button.entry.js +1 -1
- package/dist/esm-es5/verdocs-radio-button.entry.js.map +1 -1
- package/dist/esm-es5/verdocs-sign.entry.js +1 -1
- package/dist/esm-es5/verdocs-template-document-page_2.entry.js +1 -1
- package/dist/esm-es5/verdocs-web-sdk.js +1 -1
- package/dist/types/components/embeds/verdocs-build/verdocs-build.d.ts +2 -2
- package/dist/types/components/embeds/verdocs-send/verdocs-send.d.ts +3 -3
- package/dist/types/components/envelopes/verdocs-envelope-sidebar/verdocs-envelope-sidebar.d.ts +3 -1
- package/dist/types/components/envelopes/verdocs-envelope-update-recipient/verdocs-envelope-update-recipient.d.ts +50 -0
- package/dist/types/components.d.ts +85 -8
- package/dist/types/utils/Datastore.d.ts +1 -1
- package/dist/verdocs-web-sdk/{p-a2ba1316.system.entry.js → p-0134d663.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/p-0134d663.system.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/p-1c66bd2c.system.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-1c66bd2c.system.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/p-3aabadbe.entry.js +2 -0
- package/dist/verdocs-web-sdk/{p-0bb8015d.entry.js.map → p-3aabadbe.entry.js.map} +1 -1
- package/dist/verdocs-web-sdk/{p-1653b309.system.entry.js → p-4175122c.system.entry.js} +3 -3
- package/dist/verdocs-web-sdk/p-4175122c.system.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-c8369ea0.entry.js → p-45f59906.entry.js} +2 -2
- package/dist/verdocs-web-sdk/p-48299322.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-48299322.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-4b2b090e.entry.js → p-49522ebb.entry.js} +2 -2
- package/dist/verdocs-web-sdk/p-49522ebb.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/p-50c4a3da.system.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-50c4a3da.system.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-1d0463ad.system.entry.js → p-65a5d2d4.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/p-69c97fa9.system.entry.js +4 -0
- package/dist/verdocs-web-sdk/p-69c97fa9.system.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/p-759b5749.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-759b5749.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-894e2058.entry.js → p-76215a73.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-caf258c9.entry.js → p-791184e5.entry.js} +2 -2
- package/dist/verdocs-web-sdk/p-791184e5.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/p-832e4346.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-832e4346.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-821becae.system.entry.js → p-8c98a765.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/p-9f4c393c.system.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-9f4c393c.system.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/p-BH-YVoIR.system.js.map +1 -0
- package/dist/verdocs-web-sdk/p-BXdHDPn2.system.js.map +1 -0
- package/dist/verdocs-web-sdk/p-BsWaGIkx.system.js.map +1 -0
- package/dist/verdocs-web-sdk/p-C2JOLTNG.system.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-CWs7NRzr.system.js.map → p-CC3tLap5.system.js.map} +1 -1
- package/dist/verdocs-web-sdk/{p-DZurf5no.system.js.map → p-CYHTkSId.system.js.map} +1 -1
- package/dist/verdocs-web-sdk/p-CmnBGerV.system.js +2 -0
- package/dist/verdocs-web-sdk/p-CmnBGerV.system.js.map +1 -0
- package/dist/verdocs-web-sdk/p-CwXSduhy.system.js +1 -1
- package/dist/verdocs-web-sdk/{p-Cz3XayQm.system.js.map → p-CzcrfRov.system.js.map} +1 -1
- package/dist/verdocs-web-sdk/p-Czs72bg4.system.js.map +1 -0
- package/dist/verdocs-web-sdk/p-DAWcoDTu.system.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-DRzyvgiA.system.js.map → p-DM4F2Fmu.system.js.map} +1 -1
- package/dist/verdocs-web-sdk/p-DOuKoKCI.system.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-DKkhksIM.system.js.map → p-DR2NwM3E.system.js.map} +1 -1
- package/dist/verdocs-web-sdk/p-DmsV595e.js +2 -0
- package/dist/verdocs-web-sdk/p-DmsV595e.js.map +1 -0
- package/dist/verdocs-web-sdk/p-DyIimYwQ.system.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-DjtXr8Iv.system.js.map → p-QrafNGv0.system.js.map} +1 -1
- package/dist/verdocs-web-sdk/{p-e5f90a18.system.entry.js → p-a224a4cc.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-6d8c780d.system.entry.js → p-a37e8f84.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-d16c03d8.system.entry.js → p-ac05c34d.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/p-ac60c75d.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-ac60c75d.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-524c1693.system.entry.js → p-bec52dd1.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/p-c16b24c0.system.entry.js +2 -0
- package/dist/verdocs-web-sdk/p-c16b24c0.system.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-5d4a9e54.entry.js → p-d0b7bbc5.entry.js} +3 -3
- package/dist/verdocs-web-sdk/p-d0b7bbc5.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-bb96a9af.entry.js → p-d8b36d95.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-5355587b.entry.js → p-e15b7c92.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-a231248c.system.entry.js → p-e63c903a.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/p-e63c903a.system.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/p-e8713631.entry.js +3 -0
- package/dist/verdocs-web-sdk/p-e8713631.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-3b68bc50.entry.js → p-f28a1014.entry.js} +2 -2
- package/dist/verdocs-web-sdk/p-f28a1014.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-bde78dab.system.entry.js → p-f4a3d054.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/p-f4a3d054.system.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-65f4a435.entry.js → p-fb00149a.entry.js} +2 -2
- package/dist/verdocs-web-sdk/p-fih-g25U.system.js.map +1 -0
- package/dist/verdocs-web-sdk/verdocs-build.entry.esm.js.map +1 -1
- package/dist/verdocs-web-sdk/verdocs-button.verdocs-help-icon.verdocs-text-input.entry.esm.js.map +1 -0
- package/dist/verdocs-web-sdk/verdocs-checkbox.verdocs-component-error.verdocs-loader.verdocs-select-input.verdocs-template-field-properties.entry.esm.js.map +1 -0
- package/dist/verdocs-web-sdk/verdocs-contact-picker.entry.esm.js.map +1 -1
- package/dist/verdocs-web-sdk/verdocs-envelope-recipient-link.verdocs-envelope-update-recipient.entry.esm.js.map +1 -0
- package/dist/verdocs-web-sdk/verdocs-envelope-sidebar.entry.esm.js.map +1 -1
- package/dist/verdocs-web-sdk/verdocs-preview.verdocs-send.verdocs-template-attachments.verdocs-template-build-tabs.verdocs-template-fields.verdocs-template-roles.verdocs-template-settings.entry.esm.js.map +1 -1
- package/dist/verdocs-web-sdk/verdocs-radio-button.entry.esm.js.map +1 -1
- package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
- package/package.json +3 -3
- package/dist/cjs/Datastore-Dn_pL6x4.js.map +0 -1
- package/dist/cjs/verdocs-button.verdocs-help-icon.entry.cjs.js.map +0 -1
- package/dist/cjs/verdocs-button_2.cjs.entry.js +0 -89
- package/dist/cjs/verdocs-button_2.cjs.entry.js.map +0 -1
- package/dist/cjs/verdocs-checkbox.verdocs-component-error.verdocs-loader.verdocs-select-input.verdocs-template-field-properties.verdocs-text-input.entry.cjs.js.map +0 -1
- package/dist/cjs/verdocs-checkbox_6.cjs.entry.js.map +0 -1
- package/dist/cjs/verdocs-envelope-recipient-link.cjs.entry.js.map +0 -1
- package/dist/cjs/verdocs-envelope-recipient-link.entry.cjs.js.map +0 -1
- package/dist/components/p-CDTU_UJD.js.map +0 -1
- package/dist/components/p-CWHHlD3o.js.map +0 -1
- package/dist/components/p-C_IIZj49.js.map +0 -1
- package/dist/components/p-CpHTrnj5.js.map +0 -1
- package/dist/esm/Datastore-C_IIZj49.js.map +0 -1
- package/dist/esm/verdocs-button.verdocs-help-icon.entry.js.map +0 -1
- package/dist/esm/verdocs-button_2.entry.js +0 -86
- package/dist/esm/verdocs-button_2.entry.js.map +0 -1
- package/dist/esm/verdocs-checkbox.verdocs-component-error.verdocs-loader.verdocs-select-input.verdocs-template-field-properties.verdocs-text-input.entry.js.map +0 -1
- package/dist/esm/verdocs-checkbox_6.entry.js.map +0 -1
- package/dist/esm/verdocs-envelope-recipient-link.entry.js.map +0 -1
- package/dist/esm-es5/Datastore-C_IIZj49.js +0 -2
- package/dist/esm-es5/Datastore-C_IIZj49.js.map +0 -1
- package/dist/esm-es5/verdocs-button.verdocs-help-icon.entry.js.map +0 -1
- package/dist/esm-es5/verdocs-button_2.entry.js +0 -2
- package/dist/esm-es5/verdocs-button_2.entry.js.map +0 -1
- package/dist/esm-es5/verdocs-checkbox.verdocs-component-error.verdocs-loader.verdocs-select-input.verdocs-template-field-properties.verdocs-text-input.entry.js.map +0 -1
- package/dist/esm-es5/verdocs-checkbox_6.entry.js +0 -2
- package/dist/esm-es5/verdocs-checkbox_6.entry.js.map +0 -1
- package/dist/esm-es5/verdocs-envelope-recipient-link.entry.js +0 -2
- package/dist/esm-es5/verdocs-envelope-recipient-link.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-03c76a24.system.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-03c76a24.system.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-0bb8015d.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-13c9ac73.entry.js +0 -3
- package/dist/verdocs-web-sdk/p-13c9ac73.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-1653b309.system.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-255c74a9.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-255c74a9.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-2a183b90.system.entry.js +0 -4
- package/dist/verdocs-web-sdk/p-2a183b90.system.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-3b68bc50.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-3fc4da27.system.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-3fc4da27.system.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-4b2b090e.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-5018b5b8.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-5018b5b8.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-5d4a9e54.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-8c9f35ab.system.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-8c9f35ab.system.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-BZkYMpVF.system.js.map +0 -1
- package/dist/verdocs-web-sdk/p-Bh0IfLXk.system.js.map +0 -1
- package/dist/verdocs-web-sdk/p-BhRjT9GK.system.js.map +0 -1
- package/dist/verdocs-web-sdk/p-C4Tt0CYc.system.js.map +0 -1
- package/dist/verdocs-web-sdk/p-CMiFaQiI.system.js +0 -2
- package/dist/verdocs-web-sdk/p-CMiFaQiI.system.js.map +0 -1
- package/dist/verdocs-web-sdk/p-C_IIZj49.js +0 -2
- package/dist/verdocs-web-sdk/p-C_IIZj49.js.map +0 -1
- package/dist/verdocs-web-sdk/p-DG0Ibgqe.system.js.map +0 -1
- package/dist/verdocs-web-sdk/p-Dgk4ByEW.system.js.map +0 -1
- package/dist/verdocs-web-sdk/p-EQbSTcUE.system.js.map +0 -1
- package/dist/verdocs-web-sdk/p-UTpMOeny.system.js.map +0 -1
- package/dist/verdocs-web-sdk/p-a231248c.system.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-a2ba1316.system.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-aaf3cb2c.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-aaf3cb2c.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-bde78dab.system.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-caf258c9.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-d0bc16f9.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-d0bc16f9.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-eb539d8f.system.entry.js +0 -2
- package/dist/verdocs-web-sdk/p-eb539d8f.system.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-x6a7ykMn.system.js.map +0 -1
- package/dist/verdocs-web-sdk/verdocs-button.verdocs-help-icon.entry.esm.js.map +0 -1
- package/dist/verdocs-web-sdk/verdocs-envelope-recipient-link.entry.esm.js.map +0 -1
- /package/dist/verdocs-web-sdk/{p-c8369ea0.entry.js.map → p-45f59906.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-1d0463ad.system.entry.js.map → p-65a5d2d4.system.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-894e2058.entry.js.map → p-76215a73.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-821becae.system.entry.js.map → p-8c98a765.system.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-e5f90a18.system.entry.js.map → p-a224a4cc.system.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-6d8c780d.system.entry.js.map → p-a37e8f84.system.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-d16c03d8.system.entry.js.map → p-ac05c34d.system.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-524c1693.system.entry.js.map → p-bec52dd1.system.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-bb96a9af.entry.js.map → p-d8b36d95.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-5355587b.entry.js.map → p-e15b7c92.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-65f4a435.entry.js.map → p-fb00149a.entry.js.map} +0 -0
@@ -1,3 +1,3 @@
|
|
1
|
-
import{r as e,c as t,h as i,H as o,F as s,g as n}from"./p-CF7i8guW.js";import{VerdocsEndpoint as l,getTemplate as r,integerSequence as a,getOrganizationContacts as d,isValidEmail as c,createEnvelope as h,formatFullName as u,getRGBA as p,createTemplateDocument as f,deleteTemplateDocument as v,updateField as m,createField as g,updateTemplateRole as b,createTemplateRole as x,updateTemplate as w}from"@verdocs/js-sdk";import{S as y}from"./p-C1sRVZWv.js";import{S as E}from"./p-C_IIZj49.js";import{D as k}from"./p-C_Xku1v2.js";import{V as S}from"./p-CyvDgtoV.js";import{D as C,P as q,J as T,a as M,F as I,b as D,T as L}from"./p-7LXbcjVz.js";import{d as H}from"./p-dzBXqXlK.js";import{i as z}from"./p-CGNX5HqF.js";import{g as Z,e as N,f as O,h as _,i as V,j as A}from"./p-fL0BKEnm.js";import{g as R}from"./p-BFTU3MAI.js";import"./p-Dl7Xw8F0.js";const j='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-preview{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;min-height:200px;position:relative;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-preview div,verdocs-preview canvas{-webkit-box-sizing:border-box;box-sizing:border-box}';const U=class{constructor(i){e(this,i);this.sdkError=t(this,"sdkError");this.templateListenerId=null;this.endpoint=l.getDefault();this.templateId=null;this.loading=true;this.template=null}disconnectedCallback(){this.unlistenToTemplate()}async listenToTemplate(){this.unlistenToTemplate();E.subscribe("templates",this.templateId,(()=>r(this.endpoint,this.templateId)),false,(e=>{this.template=e;this.loading=false}))}unlistenToTemplate(){if(this.templateListenerId){E.store.delListener(this.templateListenerId);this.templateListenerId=null}}onTemplateIdChanged(e){console.log("[PREVIEW] Template ID changed",e);this.listenToTemplate()}async componentWillLoad(){var e,t,i;try{this.endpoint.loadSession();if(!this.endpoint.session){console.log("[PREVIEW] Unable to start builder session, must be authenticated");return}if(!this.templateId){console.log(`[PREVIEW] Missing required template ID ${this.templateId}`);return}this.listenToTemplate()}catch(o){console.log("[PREVIEW] Error with preview session",o);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new y(o.message,(t=o.response)===null||t===void 0?void 0:t.status,(i=o.response)===null||i===void 0?void 0:i.data))}}handlePageRendered(e){}render(){var e;if(this.loading){return i(o,null,i("verdocs-loader",null))}return i(o,null,(((e=this.template)===null||e===void 0?void 0:e.documents)||[]).map((e=>{const t=a(1,e.pages);return i(s,null,t.map((t=>{var o;const s=((o=e.page_sizes)===null||o===void 0?void 0:o[t])||{width:612,height:792};return i("verdocs-template-document-page",{templateId:e.template_id,documentId:e.id,pageNumber:t,disabled:true,editable:false,done:false,virtualWidth:s.width,virtualHeight:s.height,onPageRendered:e=>this.handlePageRendered(e),layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]})})))})))}static get watchers(){return{templateId:["onTemplateIdChanged"]}}};U.style=j;const B=e=>((e===null||e===void 0?void 0:e.roles)||[]).map((e=>e.name));const P=(e,t)=>Math.max(B(e).findIndex((e=>e===t)),0);const F='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-send{padding:10px;position:relative;background:#ffffff;-ms-flex-direction:column;flex-direction:column;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-send.sendable{display:-ms-flexbox;display:flex}verdocs-send .recipients{position:relative}verdocs-send .left-line{top:32px;left:20px;z-index:1;width:12px;bottom:30px;position:absolute;background:#ffffff;border-left:3px dotted #9b9b9b}verdocs-send .level{display:-ms-flexbox;display:flex;-webkit-column-gap:10px;-moz-column-gap:10px;column-gap:10px;margin-left:50px;position:relative;-ms-flex-direction:row;flex-direction:row;padding:8px 0 4px 0;border-bottom:1px solid rgba(151, 151, 151, 0.2666666667)}verdocs-send .level .level-icon{top:14px;z-index:2;left:-40px;width:24px;height:24px;position:absolute;background:#ffffff}verdocs-send .level .level-icon svg{fill:rgba(0, 0, 0, 0.537254902)}verdocs-send .level .recipient{height:30px;display:-ms-flexbox;display:flex;-ms-flex:0 0 30px;flex:0 0 30px;color:#000000;cursor:pointer;font-size:14px;-ms-flex-align:center;align-items:center;border-radius:30px;-ms-flex-direction:row;flex-direction:row;background:#dddddd;white-space:nowrap;border:2px solid #dddddd;padding:2px 10px 2px 14px}verdocs-send .level .recipient .icon{width:22px;height:22px;-ms-flex:0 0 22px;flex:0 0 22px;margin:0 0 0 10px}verdocs-send .level .recipient .icon svg{width:22px;height:22px;fill:#333333;outline:none}verdocs-send .level .complete{-ms-flex:1;flex:1;height:30px;display:-ms-flexbox;display:flex;color:#000000;font-size:14px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;padding:3px 10px 3px 2px}verdocs-send .buttons{display:-ms-flexbox;display:flex;margin-top:10px;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-ms-flex-direction:row;flex-direction:row}verdocs-send verdocs-contact-picker{left:0;top:41px;z-index:10;position:absolute;border:1px solid #dddddd;-webkit-box-shadow:0 0 6px 3px rgba(0, 0, 0, 0.1);box-shadow:0 0 6px 3px rgba(0, 0, 0, 0.1)}';const $='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.9959.9959 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"></path></svg>';const Q='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="M2 12C2 6.48 6.48 2 12 2s10 4.48 10 10-4.48 10-10 10S2 17.52 2 12zm10 6c3.31 0 6-2.69 6-6s-2.69-6-6-6-6 2.69-6 6 2.69 6 6 6z"></path></svg>';const W='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"></path></svg>';const G='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="m18 7-1.41-1.41-6.34 6.34 1.41 1.41L18 7zm4.24-1.41L11.66 16.17 7.48 12l-1.41 1.41L11.66 19l12-12-1.42-1.41zM.41 13.41 6 19l1.41-1.41L1.83 12 .41 13.41z"></path></svg>';const Y=class{constructor(i){e(this,i);this.beforeSend=t(this,"beforeSend");this.send=t(this,"send");this.exit=t(this,"exit");this.sdkError=t(this,"sdkError");this.searchContacts=t(this,"searchContacts");this.templateListenerId=null;this.endpoint=k;this.templateId=null;this.environment="";this.containerId=`verdocs-send-${Math.random().toString(36).substring(2,11)}`;this.showPickerForId="";this.sessionContacts=[];this.sending=false;this.rolesCompleted={};this.loading=true;this.template=null}disconnectedCallback(){this.unlistenToTemplate()}async listenToTemplate(){console.log("[SEND] Loading template",this.templateId);this.unlistenToTemplate();E.subscribe("templates",this.templateId,(()=>r(this.endpoint,this.templateId)),true,(e=>{console.log("[SEND] Got new template",e);this.template=e;this.loading=false;this.rolesCompleted={};this.recomputeRolesCompleted()}))}unlistenToTemplate(){if(this.templateListenerId){E.store.delListener(this.templateListenerId);this.templateListenerId=null}}async reset(){this.rolesCompleted={}}onTemplateIdChanged(e){console.log("[SEND] Template ID changed",e);this.listenToTemplate()}async componentWillLoad(){var e,t,i;try{this.endpoint.onSessionChanged(((e,t,i)=>{if(!i){return}const o={id:i.id,first_name:i.first_name,last_name:i.last_name,email:i.email,phone:i.phone};if(i){this.sessionContacts=[o];d(this.endpoint).then((e=>{console.log("[SEND] Got contacts",e);this.sessionContacts=[...e,o]})).catch((e=>{console.log("[SEND] Error getting contacts",e)}))}}));this.endpoint.loadSession();if(!this.endpoint.session){console.log("[SEND] Unable to start Send operation, must be authenticated");return}if(!this.templateId){console.log(`[SEND] Missing required template ID ${this.templateId}`);return}this.listenToTemplate()}catch(o){console.log("[SEND] Error with send session",o);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new y(o.message,(t=o.response)===null||t===void 0?void 0:t.status,(i=o.response)===null||i===void 0?void 0:i.data))}}recomputeRolesCompleted(){var e;this.rolesCompleted={};const t={};(((e=this.template)===null||e===void 0?void 0:e.roles)||[]).forEach((e=>{const i=e.sequence;t[i]||(t[i]=[]);const o=`r-${i}-${t[i].length}`;t[i].push({...e,id:o,role_name:e.name,first_name:e.first_name,last_name:e.last_name});if(e.first_name&&c(e.email)){this.rolesCompleted[o]={...e,id:o,role_name:e.name,first_name:e.first_name,last_name:e.last_name}}}))}getSequenceNumbers(){var e;const t={};(((e=this.template)===null||e===void 0?void 0:e.roles)||[]).forEach((e=>{t[e.sequence]=true}));return Object.keys(t).map((e=>+e)).sort(((e,t)=>e-t))}getRolesAtLevel(e){var t;const i=(((t=this.template)===null||t===void 0?void 0:t.roles)||[]).filter((t=>t.sequence===e)).map(((t,i)=>({...t,id:`r-${e}-${i}`,role_name:t.name,first_name:t.first_name,last_name:t.last_name})));return i}getLevelIcon(e){if(e==="start"){return i("div",{class:"level-icon",innerHTML:Q})}else if(e==="end"){return i("div",{class:"level-icon",innerHTML:G})}else{return i("div",{class:"level-icon",innerHTML:W})}}handleSelectContact(e,t){e.preventDefault();this.rolesCompleted[t.id]={...t,...e.detail};this.showPickerForId=""}handleClickRole(e,t){e.stopPropagation();this.showPickerForId=t.id}handleSend(e){var t;if(this.sending){console.log("[SEND] Skipping duplicate send",e);return}console.log("[SEND] Sending",e);e.preventDefault();e.stopPropagation();this.sending=true;const i={template_id:this.templateId,name:((t=this.template)===null||t===void 0?void 0:t.name)||"New Envelope",environment:this.environment,initial_reminder:0,followup_reminders:0,recipients:Object.values(this.rolesCompleted),fields:[]};const o=this.beforeSend.emit({...i,name:i.name,template:this.template});if(o.defaultPrevented){console.log("[SEND] Send cancelled by parent",i);this.sending=false;return}console.log("[SEND] Creating envelope",i);h(this.endpoint,i).then((e=>{var t;console.log("[SEND] Send envelope",e);this.reset().catch((e=>console.log("Unknown Error",e)));this.sending=false;(t=this.send)===null||t===void 0?void 0:t.emit({...i,name:i.name,envelope_id:e.id,envelope:e})})).catch((e=>{var t,i,o;console.log("[SEND] Send error",e);S(((i=(t=e.response)===null||t===void 0?void 0:t.data)===null||i===void 0?void 0:i.error)||"Error creating envelope, please try again later.");this.sending=false;(o=this.sdkError)===null||o===void 0?void 0:o.emit(e)}))}handleCancel(e){var t;e.stopPropagation();(t=this.exit)===null||t===void 0?void 0:t.emit()}render(){var e;if(this.loading){return i(o,null,i("verdocs-loader",null))}if(!this.endpoint.session){return i(o,{style:{display:"flex"}},i("verdocs-component-error",{message:"You must be authenticated to use this module."}))}const t=this.getSequenceNumbers();const s=Object.values(this.rolesCompleted).filter((e=>c(e.email)&&e.first_name&&e.last_name));const n=s.length>=B(this.template).length;return i(o,{class:{sendable:(e=this.template)===null||e===void 0?void 0:e.is_sendable}},i("div",{class:"recipients"},i("div",{class:"left-line"}),i("div",{class:`level level-start`},this.getLevelIcon("start"),i("div",{class:"complete"},"Send Envelope")),t.map((e=>i("div",{class:`level level-${e}`},this.getLevelIcon("sequence"),this.getRolesAtLevel(e).map((e=>{var t,o,n;const l=!e.email||!e.first_name||!e.last_name;const r=((t=this.rolesCompleted[e.id])===null||t===void 0?void 0:t.first_name)?u(this.rolesCompleted[e.id]):l?e.role_name:u(e);const a=`verdocs-send-recipient-${e.role_name}`;const d=P(this.template,e.role_name);const c=p(d);const h=s.findIndex((t=>t.role_name===e.role_name))>-1;const f={backgroundColor:c,border:h?"2px solid #55bc81":"2px solid #dddddd"};return l?i("div",{class:"recipient","data-ri":d,"data-rn":e.role_name,style:f,onClick:t=>this.handleClickRole(t,e),id:a},r,i("div",{class:"icon",innerHTML:$}),this.showPickerForId===e.id&&i("verdocs-portal",{anchor:a,onClickAway:()=>this.showPickerForId=""},i("verdocs-contact-picker",{onExit:()=>this.showPickerForId="",onNext:t=>this.handleSelectContact(t,e),contactSuggestions:this.sessionContacts,templateRole:(o=this.rolesCompleted[e.id])!==null&&o!==void 0?o:e,onSearchContacts:e=>{var t;return(t=this.searchContacts)===null||t===void 0?void 0:t.emit(e.detail)}}))):i("div",{class:"recipient","data-ri":d,"data-rn":e.role_name,style:f,onClick:t=>this.handleClickRole(t,e),id:a},r,i("div",{class:"icon",innerHTML:$}),this.showPickerForId===e.id&&i("verdocs-portal",{anchor:a,onClickAway:()=>this.showPickerForId=""},i("verdocs-contact-picker",{onExit:()=>this.showPickerForId="",onNext:t=>this.handleSelectContact(t,e),contactSuggestions:this.sessionContacts,templateRole:(n=this.rolesCompleted[e.id])!==null&&n!==void 0?n:e,onSearchContacts:e=>{var t;return(t=this.searchContacts)===null||t===void 0?void 0:t.emit(e.detail)}})))}))))),i("div",{class:`level level-done`},this.getLevelIcon("end"),i("div",{class:"complete"},"Signing Complete"))),i("div",{class:"buttons"},i("verdocs-button",{label:"Cancel",size:"small",variant:"outline",onClick:e=>this.handleCancel(e),disabled:this.sending}),i("verdocs-button",{label:"Send",size:"small",disabled:!n||this.sending,onClick:e=>this.handleSend(e)}),this.sending&&i("verdocs-spinner",null)))}static get watchers(){return{templateId:["onTemplateIdChanged"]}}};Y.style=F;const X='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-attachments{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-template-attachments h5{font-size:16px;font-weight:bold;margin:0 0 10px 0;color:#46497d}verdocs-template-attachments .attachments{margin:0 0 40px 0}verdocs-template-attachments .attachment{display:-ms-flexbox;display:flex;padding:5px 0;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;color:#33364b}verdocs-template-attachments .attachment:hover .trash-icon{display:-ms-flexbox;display:flex}verdocs-template-attachments .attachment:hover .pages{display:none}verdocs-template-attachments svg{width:28px;height:28px;fill:#5c6575;margin:2px 0 0 0}verdocs-template-attachments .file-icon{-ms-flex:0;flex:0}verdocs-template-attachments .pages{width:24px;height:24px;-ms-flex:0 0 24px;flex:0 0 24px;padding-left:4px;position:relative;margin:-10px 0 0 0}verdocs-template-attachments .pages .pages-icon{top:0;left:0;width:24px;height:24px;position:absolute}verdocs-template-attachments .pages .count{top:11px;left:7px;z-index:1;width:18px;font-size:12px;font-weight:500;position:absolute;text-align:center;letter-spacing:-2px}verdocs-template-attachments .filename{-ms-flex:1;flex:1;display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;border-bottom:1px dotted #cccccc}verdocs-template-attachments .trash-icon{-ms-flex:0;flex:0;display:none}verdocs-template-attachments .trash-icon:hover{cursor:pointer}verdocs-template-attachments verdocs-file-chooser{margin:10px 0;border:2px dashed #979797}verdocs-template-attachments .loader-wrapper{background-color:#ffffff;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;position:relative;width:320px;height:320px;text-align:center;border:2px dashed #979797;-ms-flex-pack:end;justify-content:flex-end}verdocs-template-attachments .progress-wrapper{padding:20px}verdocs-template-attachments .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;margin-top:16px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:end;justify-content:flex-end}verdocs-template-attachments .buttons .flex-fill{-ms-flex:1;flex:1}verdocs-template-attachments ::-webkit-input-placeholder{color:#aaaaaa}verdocs-template-attachments ::-moz-placeholder{color:#aaaaaa}verdocs-template-attachments :-ms-input-placeholder{color:#aaaaaa}verdocs-template-attachments ::-ms-input-placeholder{color:#aaaaaa}verdocs-template-attachments ::placeholder{color:#aaaaaa}';const J=class{constructor(i){e(this,i);this.exit=t(this,"exit");this.next=t(this,"next");this.templateUpdated=t(this,"templateUpdated");this.sdkError=t(this,"sdkError");this.templateListenerId=null;this.endpoint=l.getDefault();this.templateId="";this.uploading=false;this.progressLabel="Uploading...";this.progressPercent=0;this.showDeleteError=false;this.confirmDeleteDocument=null;this.loading=true;this.template=null}async componentWillLoad(){var e,t,i;try{this.endpoint.loadSession();if(!this.templateId){console.log(`[ROLES] Missing required template ID ${this.templateId}`);return}if(!this.endpoint.session){console.log("[ROLES] Unable to start builder session, must be authenticated");return}this.listenToTemplate()}catch(o){console.log("[TEMPLATE ATTACHMENTS] Error loading template",o);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new y(o.message,(t=o.response)===null||t===void 0?void 0:t.status,(i=o.response)===null||i===void 0?void 0:i.data))}}disconnectedCallback(){this.unlistenToTemplate()}async listenToTemplate(){this.unlistenToTemplate();E.subscribe("templates",this.templateId,(()=>r(this.endpoint,this.templateId)),false,(e=>{this.template=e;this.loading=false}))}unlistenToTemplate(){if(this.templateListenerId){E.store.delListener(this.templateListenerId);this.templateListenerId=null}}handleCancel(e){e.stopPropagation();this.exit.emit()}handleUploadProgress(e){if(e>=99){this.progressPercent=100;this.progressLabel="Processing..."}else{this.progressPercent=e}}async handleUpload(e){var t,i,o,s;e.stopPropagation();const n=e.detail.file;if(!n){return}console.log("[ATTACHMENTS] Uploading...",n);this.uploading=true;this.progressLabel="Uploading...";try{const e=await f(this.endpoint,this.templateId,n,this.handleUploadProgress.bind(this));console.log("[ATTACHMENTS] Created attachment",e);this.template=await E.getTemplate(this.endpoint,this.templateId,true);console.log("[ATTACHMENTS] Updated template",this.template);(t=this.templateUpdated)===null||t===void 0?void 0:t.emit({endpoint:this.endpoint,template:this.template,event:"attachments"});this.uploading=false;this.progressLabel="";this.progressPercent=0}catch(e){console.log("[ATTACHMENTS] Error creating template",e);(i=this.sdkError)===null||i===void 0?void 0:i.emit(new y(e.message,(o=e.response)===null||o===void 0?void 0:o.status,(s=e.response)===null||s===void 0?void 0:s.data));this.uploading=false}}handleNext(e){var t;e.stopPropagation();this.uploading=false;this.progressLabel="";this.progressPercent=0;(t=this.next)===null||t===void 0?void 0:t.emit({template:this.template})}async confirmDelete(){await v(this.endpoint,this.templateId,this.confirmDeleteDocument.id);this.template=await E.getTemplate(this.endpoint,this.templateId,true);console.log("[ATTACHMENTS] New template",this.template);this.confirmDeleteDocument=null}async handleDelete(e){var t;if((((t=this.template)===null||t===void 0?void 0:t.documents)||[]).length>1){this.confirmDeleteDocument=e}else{this.showDeleteError=true}}getFileIcon(e){switch(e.mime){case"application/pdf":return M;case"image/jpeg":return T;case"image/png":return q;case"application/msword":case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return C}return I}render(){var e,t;if(!this.endpoint.session){return i(o,null,i("verdocs-component-error",{message:"You must be authenticated to use this module."}))}if(this.loading){return i(o,{class:"loading"},i("verdocs-loader",null))}if(!this.endpoint.session||!this.template){return i(o,{class:"empty"})}return i(o,null,i("h5",null,"Existing Attachments"),i("div",{class:"attachments"},(((e=this.template)===null||e===void 0?void 0:e.documents)||[]).map((e=>i("div",{class:"attachment"},i("div",{class:"file-icon",innerHTML:this.getFileIcon(e)}),i("div",{class:"filename",title:e.name},e.name),i("div",{class:"pages"},i("div",{class:"count"},e.pages),i("div",{class:"pages-icon",innerHTML:D})),i("div",{class:"trash-icon",innerHTML:L,onClick:()=>this.handleDelete(e)}))))),i("h5",null,"Attach a New Document"),this.uploading?i("div",{class:"loader-wrapper"},i("verdocs-loader",null),this.progressLabel&&i("div",{class:"progress-wrapper"},i("verdocs-progress-bar",{showPercent:true,percent:this.progressPercent,label:this.progressLabel}))):i("verdocs-file-chooser",{onFileSelected:e=>this.handleUpload(e)}),i("div",{class:"buttons"},i("verdocs-button",{variant:"outline",label:"Cancel",size:"small",onClick:e=>this.handleCancel(e),disabled:this.uploading}),i("verdocs-button",{label:"Next",size:"small",onClick:e=>this.handleNext(e),disabled:!(((t=this.template)===null||t===void 0?void 0:t.documents)||[]).length||this.uploading})),this.showDeleteError&&i("verdocs-ok-dialog",{heading:"Unable to Delete Attachment",message:"Templates must contain at least one attachment.",onNext:()=>this.showDeleteError=false}),this.confirmDeleteDocument&&i("verdocs-ok-dialog",{heading:"Delete this Attachment?",message:"This operation cannot be undone. All fields placed<br />on the deleted attachment will also be removed.",onNext:()=>this.confirmDelete(),showCancel:true,onExit:()=>{this.confirmDeleteDocument=null}}))}};J.style=X;const K='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-build-tabs{-ms-flex:1;flex:1;gap:15px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-template-build-tabs verdocs-button-panel svg{-webkit-transform:scale(0.8);transform:scale(0.8)}verdocs-template-build-tabs verdocs-template-attachments,verdocs-template-build-tabs verdocs-template-roles{margin:20px}verdocs-template-build-tabs verdocs-template-fields{border-top:1px solid #777777}verdocs-template-build-tabs verdocs-template-attachments{padding:20px;background:#ffffff}verdocs-template-build-tabs verdocs-template-fields{width:100%}verdocs-template-build-tabs verdocs-preview{-ms-flex:1;flex:1}.template-details-panel .row{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;gap:8px;margin:10px 0}.template-details-panel label{-ms-flex:0 0 70px;flex:0 0 70px}.template-details-panel .value{-ms-flex:1;flex:1;font-weight:300;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.template-details-panel .icon-button{cursor:pointer;opacity:0.8;-ms-flex:0;flex:0;width:18px;height:18px}.template-details-panel .icon-button svg{stroke:#000000;width:18px;height:18px}.template-details-panel .icon-button:hover{opacity:1}';const ee='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" fill="#5c6575"><path d="M11.925 18q.55 0 .938-.387.387-.388.387-.938 0-.55-.387-.925-.388-.375-.938-.375-.55 0-.925.375t-.375.925q0 .55.375.938.375.387.925.387Zm-.95-3.85h1.95q0-.8.2-1.287.2-.488 1.025-1.288.65-.625 1.025-1.213.375-.587.375-1.437 0-1.425-1.025-2.175Q13.5 6 12.1 6q-1.425 0-2.35.775t-1.275 1.85l1.775.7q.125-.45.55-.975.425-.525 1.275-.525.725 0 1.1.412.375.413.375.888 0 .475-.287.9-.288.425-.713.775-1.075.95-1.325 1.475-.25.525-.25 1.875ZM12 22.2q-2.125 0-3.988-.8-1.862-.8-3.237-2.175Q3.4 17.85 2.6 15.988 1.8 14.125 1.8 12t.8-3.988q.8-1.862 2.175-3.237Q6.15 3.4 8.012 2.6 9.875 1.8 12 1.8t3.988.8q1.862.8 3.237 2.175Q20.6 6.15 21.4 8.012q.8 1.863.8 3.988t-.8 3.988q-.8 1.862-2.175 3.237Q17.85 20.6 15.988 21.4q-1.863.8-3.988.8Zm0-2.275q3.325 0 5.625-2.3t2.3-5.625q0-3.325-2.3-5.625T12 4.075q-3.325 0-5.625 2.3T4.075 12q0 3.325 2.3 5.625t5.625 2.3ZM12 12Z"/></svg>';const te=`<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5"><path stroke-linecap="round" stroke-linejoin="round" d="M15.75 17.25v3.375c0 .621-.504 1.125-1.125 1.125h-9.75a1.125 1.125 0 0 1-1.125-1.125V7.875c0-.621.504-1.125 1.125-1.125H6.75a9.06 9.06 0 0 1 1.5.124m7.5 10.376h3.375c.621 0 1.125-.504 1.125-1.125V11.25c0-4.46-3.243-8.161-7.5-8.876a9.06 9.06 0 0 0-1.5-.124H9.375c-.621 0-1.125.504-1.125 1.125v3.5m7.5 10.375H9.375a1.125 1.125 0 0 1-1.125-1.125v-9.25m12 6.625v-1.875a3.375 3.375 0 0 0-3.375-3.375h-1.5a1.125 1.125 0 0 1-1.125-1.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H9.75" /></svg>`;const ie=["attachments","roles","settings","fields","preview"];const oe=class{constructor(i){e(this,i);this.sdkError=t(this,"sdkError");this.stepChanged=t(this,"stepChanged");this.templateListenerId=null;this.endpoint=l.getDefault();this.templateId=null;this.step="preview";this.loading=true;this.template=null}disconnectedCallback(){this.unlistenToTemplate()}async listenToTemplate(){this.unlistenToTemplate();E.subscribe("templates",this.templateId,(()=>r(this.endpoint,this.templateId)),false,(e=>{this.template=e;this.loading=false}))}unlistenToTemplate(){if(this.templateListenerId){E.store.delListener(this.templateListenerId);this.templateListenerId=null}}onTemplateIdChanged(e){console.log("[BUILD_TABS] Template ID changed",e);this.listenToTemplate()}onStepChanged(e){console.log("[BUILD_TABS] Step changed",e)}async componentWillLoad(){var e,t,i;try{this.endpoint.loadSession();if(!this.endpoint.session){console.log("[BUILD_TABS] Unable to start builder session, must be authenticated");return}if(!this.templateId){this.step="attachments";console.log("[BUILD_TABS] Missing required template ID, forcing view to attachments");return}this.listenToTemplate()}catch(o){console.log("[BUILD_TABS] Error loading template",o);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new y(o.message,(t=o.response)===null||t===void 0?void 0:t.status,(i=o.response)===null||i===void 0?void 0:i.data))}}setStep(e){var t;console.log("[BUILD_TABS] Selected step",e.detail.tab.id);e.stopPropagation();e.preventDefault();this.step=e.detail.tab.id;(t=this.stepChanged)===null||t===void 0?void 0:t.emit(e.detail.tab.id)}copyTemplateId(){navigator.clipboard.writeText(this.templateId).then((()=>{S("Template ID copied",{style:"success",duration:3e3})})).catch((e=>{var t;console.warn("[BUILD_TABS] Error copying to clipboard",e);(t=this.sdkError)===null||t===void 0?void 0:t.emit(e)}))}render(){var e,t,s,n,l,r,a,d,c;if(this.loading){return i(o,null,i("verdocs-loader",null))}if(!this.endpoint.session){return i(o,null,i("verdocs-component-error",{message:"You must be authenticated to use this module."}))}const h=(((e=this.template)===null||e===void 0?void 0:e.documents)||[]).length>0;let u=h&&(((t=this.template)===null||t===void 0?void 0:t.roles)||[]).length>0;const p=u&&(((s=this.template)===null||s===void 0?void 0:s.fields)||[]).length>0;let f=Math.max(ie.indexOf(this.step),0);if(!p&&f>=4){f=3}if(!u&&f>=3){f=1}if(!h&&f>=1){f=0}return i(o,null,i("verdocs-tabs",{onSelectTab:e=>this.setStep(e),selectedTab:f,tabs:[{id:"attachments",disabled:false,label:"Attachment(s)"},{id:"roles",disabled:!h,label:"Roles"},{id:"settings",disabled:!u,label:"Settings"},{id:"fields",disabled:!u,label:"Fields"},{id:"preview",disabled:!p,label:"Preview/Send"}]}),this.templateId&&i("div",{class:"info"},i("verdocs-button-panel",{icon:ee},i("div",{class:"template-details-panel"},i("h6",null,"Template Details"),i("div",{class:"row"},i("label",null,"ID:"),i("div",{class:"value"},this.templateId),i("div",{class:"icon-button",innerHTML:te,onClick:()=>this.copyTemplateId()})),i("div",{class:"row"},i("label",null,"Name:"),i("div",{class:"value"},(n=this.template)===null||n===void 0?void 0:n.name)),i("div",{class:"row"},i("label",null,"Visibility:"),i("div",{class:"value"},((l=this.template)===null||l===void 0?void 0:l.is_public)?"Public":((r=this.template)===null||r===void 0?void 0:r.is_personal)?"Private":"Shared")),i("div",{class:"row"},i("label",null,"Created:"),i("div",{class:"value"},((a=this.template)===null||a===void 0?void 0:a.counter)?H.format(new Date((d=this.template)===null||d===void 0?void 0:d.created_at),"P p"):"")),i("div",{class:"row"},i("label",null,"Used:"),i("div",{class:"value"},(c=this.template)===null||c===void 0?void 0:c.counter," time(s)"))))))}static get watchers(){return{templateId:["onTemplateIdChanged"],step:["onStepChanged"]}}};oe.style=K;const se="@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-fields{font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif;position:relative;display:block;min-height:600px}verdocs-template-fields .page-0{padding:65px 15px 0 15px;-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-fields .page-0 .user-placed-fields{height:100px;position:relative;background:#ffffff;-webkit-box-shadow:0 0 10px 5px rgba(0, 0, 0, 0.0588235294);box-shadow:0 0 10px 5px rgba(0, 0, 0, 0.0588235294)}verdocs-template-fields .page-0 .user-placed-fields .title{top:0;left:0;color:#ffffff;font-size:12px;padding:3px 6px;font-weight:bold;position:absolute;background:#46497d}verdocs-template-fields .pages{display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;min-height:200px;position:relative;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-template-fields .pages div,verdocs-template-fields .pages canvas{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-fields #verdocs-template-fields-toolbar{width:100%;height:50px;display:-ms-flexbox;display:flex;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;font-weight:700;padding:0 20px 0 0;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;color:#f5f5fa;-ms-flex-pack:center;justify-content:center;background:#46497d}verdocs-template-fields #verdocs-template-fields-toolbar>verdocs-select-input{margin:0}verdocs-template-fields #verdocs-template-fields-toolbar svg{width:24px;height:24px}verdocs-template-fields #verdocs-template-fields-toolbar .add-for{margin:0;font-weight:500;color:#f5f5fa}verdocs-template-fields #verdocs-template-fields-toolbar verdocs-select-input{margin:0 20px 0 0}@media all and (max-width: 1000px){verdocs-template-fields #verdocs-template-fields-toolbar{-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;padding:0 10px 0 0}verdocs-template-fields #verdocs-template-fields-toolbar svg{-webkit-transform:scale(0.8);transform:scale(0.8)}verdocs-template-fields #verdocs-template-fields-toolbar .add-for,verdocs-template-fields #verdocs-template-fields-toolbar verdocs-select-input{display:none}}@media all and (max-width: 600px){verdocs-template-fields #verdocs-template-fields-toolbar{-webkit-column-gap:6px;-moz-column-gap:6px;column-gap:6px}verdocs-template-fields #verdocs-template-fields-toolbar svg{-webkit-transform:scale(0.6);transform:scale(0.6)}verdocs-template-fields #verdocs-template-fields-toolbar .separator,verdocs-template-fields #verdocs-template-fields-toolbar .add-for,verdocs-template-fields #verdocs-template-fields-toolbar verdocs-select-input{display:none}}verdocs-template-fields.placing-attachment{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-checkbox{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-date{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath fill='%23000000' d='M7.6 13.925q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375ZM5.3 22.85q-1.325 0-2.238-.912-.912-.913-.912-2.238V6.3q0-1.325.912-2.238.913-.912 2.238-.912H6v-2h2.575v2h6.85v-2H18v2h.7q1.325 0 2.238.912.912.913.912 2.238v13.4q0 1.325-.912 2.238-.913.912-2.238.912Zm0-3.15h13.4V10H5.3v9.7ZM5.3 8h13.4V6.3H5.3Zm0 0V6.3 8Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-dropdown{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24' stroke-width='1.5' stroke='currentColor'%3E%3Cpath stroke='%23000000' stroke-linecap='round' stroke-linejoin='round' d='M3 4.5h14.25M3 9h9.75M3 13.5h9.75m4.5-4.5v12m0 0l-3.75-3.75M17.25 21L21 17.25' /%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-initial{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M6.225 20.775V7h-5V3.225H15V7h-5v13.775Zm9.775 0v-8h-3V9h9.775v3.775h-3v8Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-payment{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-radio{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M12 17q2.075 0 3.538-1.463Q17 14.075 17 12t-1.462-3.538Q14.075 7 12 7 9.925 7 8.463 8.462 7 9.925 7 12q0 2.075 1.463 3.537Q9.925 17 12 17Zm0 5.85q-2.275 0-4.25-.85t-3.438-2.312Q2.85 18.225 2 16.25q-.85-1.975-.85-4.25T2 7.75q.85-1.975 2.312-3.438Q5.775 2.85 7.75 2q1.975-.85 4.25-.85t4.25.85q1.975.85 3.438 2.312Q21.15 5.775 22 7.75q.85 1.975.85 4.25T22 16.25q-.85 1.975-2.312 3.438Q18.225 21.15 16.25 22q-1.975.85-4.25.85Zm0-3.15q3.25 0 5.475-2.225Q19.7 15.25 19.7 12q0-3.25-2.225-5.475Q15.25 4.3 12 4.3q-3.25 0-5.475 2.225Q4.3 8.75 4.3 12q0 3.25 2.225 5.475Q8.75 19.7 12 19.7Zm0-7.7Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-signature{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m9.225 21.225 4.65-4.65h8.45v4.65Zm-5.35-2.2H5.05l8.5-8.5-1.175-1.175-8.5 8.5Zm14.25-9.95L13.8 4.8l1.325-1.325q.625-.65 1.525-.663.9-.012 1.6.663l1.225 1.175q.675.675.663 1.562-.013.888-.663 1.513ZM16.7 10.55 6 21.225H1.675V16.9L12.35 6.225Zm-3.725-.625-.6-.575 1.175 1.175Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-textarea{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M3.225 20.725v-3.15h11.55v3.15Zm0-4.775V12.8h17.55v3.15Zm0-4.75V8.05h17.55v3.15Zm0-4.775v-3.15h17.55v3.15Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-textbox{cursor:url(\"data:image/svg+xml,%3Csvg width='32' height='15' viewBox='0 0 32 15' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cmask id='path-1-inside-1_1401_24' fill='white'%3E%3Cpath d='M0 0H32V15H0V0Z'/%3E%3C/mask%3E%3Cpath d='M0 0H32V15H0V0Z' fill='%234C56CB' fill-opacity='0.1'/%3E%3Cpath d='M0 0V-1H-1V0H0ZM0 15H-1V16H0V15ZM0 1H32V-1H0V1ZM32 14H0V16H32V14ZM1 15V0H-1V15H1Z' fill='%234C56CB' mask='url(%23path-1-inside-1_1401_24)'/%3E%3Cpath d='M3 11.8V8.65H14.15V11.8H3ZM3 6.65V3.5H20.15V6.65H3Z' fill='%234C56CB'/%3E%3Cline x1='31.5' y1='1' x2='31.5' y2='14' stroke='%234C56CB' stroke-opacity='0.32' stroke-dasharray='1 1'/%3E%3C/svg%3E%0A\") 0 14, pointer}verdocs-template-fields.placing-timestamp{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath fill='%23000000' d='M9 1h6v2H9zm10.03 6.39 1.42-1.42c-.43-.51-.9-.99-1.41-1.41l-1.42 1.42C16.07 4.74 14.12 4 12 4c-4.97 0-9 4.03-9 9s4.02 9 9 9 9-4.03 9-9c0-2.12-.74-4.07-1.97-5.61zM13 14h-2V8h2v6z'%3E%3C/path%3E%3C/svg%3E\") 16 16, pointer}";const ne='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M3.425 16.15V13h11.15v3.15Zm0-5.15V7.85h17.15V11Z"/></svg>';const le='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z"/></svg>';const re='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M12 17q2.075 0 3.538-1.463Q17 14.075 17 12t-1.462-3.538Q14.075 7 12 7 9.925 7 8.463 8.462 7 9.925 7 12q0 2.075 1.463 3.537Q9.925 17 12 17Zm0 5.85q-2.275 0-4.25-.85t-3.438-2.312Q2.85 18.225 2 16.25q-.85-1.975-.85-4.25T2 7.75q.85-1.975 2.312-3.438Q5.775 2.85 7.75 2q1.975-.85 4.25-.85t4.25.85q1.975.85 3.438 2.312Q21.15 5.775 22 7.75q.85 1.975.85 4.25T22 16.25q-.85 1.975-2.312 3.438Q18.225 21.15 16.25 22q-1.975.85-4.25.85Zm0-3.15q3.25 0 5.475-2.225Q19.7 15.25 19.7 12q0-3.25-2.225-5.475Q15.25 4.3 12 4.3q-3.25 0-5.475 2.225Q4.3 8.75 4.3 12q0 3.25 2.225 5.475Q8.75 19.7 12 19.7Zm0-7.7Z"/></svg>';const ae='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M7.6 13.925q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375ZM5.3 22.85q-1.325 0-2.238-.912-.912-.913-.912-2.238V6.3q0-1.325.912-2.238.913-.912 2.238-.912H6v-2h2.575v2h6.85v-2H18v2h.7q1.325 0 2.238.912.912.913.912 2.238v13.4q0 1.325-.912 2.238-.913.912-2.238.912Zm0-3.15h13.4V10H5.3v9.7ZM5.3 8h13.4V6.3H5.3Zm0 0V6.3 8Z"/></svg>';const de='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="m9.225 21.225 4.65-4.65h8.45v4.65Zm-5.35-2.2H5.05l8.5-8.5-1.175-1.175-8.5 8.5Zm14.25-9.95L13.8 4.8l1.325-1.325q.625-.65 1.525-.663.9-.012 1.6.663l1.225 1.175q.675.675.663 1.562-.013.888-.663 1.513ZM16.7 10.55 6 21.225H1.675V16.9L12.35 6.225Zm-3.725-.625-.6-.575 1.175 1.175Z"/></svg>';const ce='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M6.225 20.775V7h-5V3.225H15V7h-5v13.775Zm9.775 0v-8h-3V9h9.775v3.775h-3v8Z"/></svg>';const he='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M9 1h6v2H9zm10.03 6.39 1.42-1.42c-.43-.51-.9-.99-1.41-1.41l-1.42 1.42C16.07 4.74 14.12 4 12 4c-4.97 0-9 4.03-9 9s4.02 9 9 9 9-4.03 9-9c0-2.12-.74-4.07-1.97-5.61zM13 14h-2V8h2v6z"></path></svg>';const ue='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" stroke-width="1.5" stroke="currentColor"><path stroke="#ffffff" stroke-linecap="round" stroke-linejoin="round" d="M3 4.5h14.25M3 9h9.75M3 13.5h9.75m4.5-4.5v12m0 0l-3.75-3.75M17.25 21L21 17.25" /></svg>';const pe='<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6"><path stroke-linecap="round" stroke-linejoin="round" d="m18.375 12.739-7.693 7.693a4.5 4.5 0 0 1-6.364-6.364l10.94-10.94A3 3 0 1 1 19.5 7.372L8.552 18.32m.009-.01-.01.01m5.699-9.941-7.81 7.81a1.5 1.5 0 0 0 2.112 2.13" /></svg>';const fe='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.707 14.707"><g><rect x="6.275" y="0" fill="#ffffff7f" width="1" height="15"/></g></svg>';const ve=[{id:"signature",tooltip:"Signature",icon:de,class:"signature"},{id:"initial",tooltip:"Initials",icon:ce,class:"initial"},{id:"sep1",tooltip:"",icon:fe,class:"separator"},{id:"textbox",tooltip:"Text Box",icon:ne,class:"textbox"},{id:"checkbox",tooltip:"Check Box",icon:le,class:"checkbox"},{id:"radio",tooltip:"Radio Button",icon:re,class:"radio"},{id:"dropdown",tooltip:"Dropdown",icon:ue,class:"dropdown"},{id:"sep2",tooltip:"",icon:fe,class:"separator"},{id:"date",tooltip:"Date",icon:ae,class:"date"},{id:"timestamp",tooltip:"Timestamp",icon:he,class:"timestamp"},{id:"attachment",tooltip:"Attachment",icon:pe,class:"attachment"}];const me=class{constructor(i){e(this,i);this.sdkError=t(this,"sdkError");this.templateUpdated=t(this,"templateUpdated");this.fieldsUpdated=t(this,"fieldsUpdated");this.templateListenerId=null;this.endpoint=l.getDefault();this.templateId=null;this.toolbarTargetId=null;this.placing=null;this.showMustSelectRole=false;this.selectedRoleName="";this.loading=true;this.template=null;this.pageHeights={};this.cachedPageInfo={}}onTemplateIdChanged(){this.listenToTemplate()}handleKeyDown(e){if(e.key==="Escape"){this.placing=null}}async componentWillLoad(){var e,t,i;try{this.endpoint.loadSession();if(!this.templateId){console.log(`[FIELDS] Missing required template ID ${this.templateId}`);return}if(!this.endpoint.session){console.log("[FIELDS] Unable to start builder session, must be authenticated");return}this.listenToTemplate()}catch(o){console.log("[FIELDS] Error with fields session",o);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new y(o.message,(t=o.response)===null||t===void 0?void 0:t.status,(i=o.response)===null||i===void 0?void 0:i.data))}}componentDidRender(){z.dynamicDrop(true);const e=this.toolbarTargetId?document.getElementById(this.toolbarTargetId):null;const t=document.getElementById("verdocs-template-fields-toolbar");if(e&&t){console.log("[FIELDS] Moving toolbar");t.remove();e.append(t)}}componentWillUpdate(){var e,t;const i=((e=this.template)===null||e===void 0?void 0:e.roles)||[];if(!this.selectedRoleName||!i.find((e=>e&&e.name===this.selectedRoleName))){this.selectedRoleName=((t=i[0])===null||t===void 0?void 0:t.name)||"";console.log("[FIELDS] Selected new role",this.selectedRoleName)}}disconnectedCallback(){this.unlistenToTemplate()}async listenToTemplate(){this.unlistenToTemplate();E.subscribe("templates",this.templateId,(()=>r(this.endpoint,this.templateId)),false,(e=>{var t,i;this.template=e;this.loading=false;if(!this.selectedRoleName){this.selectedRoleName=((i=(t=e.roles)===null||t===void 0?void 0:t[0])===null||i===void 0?void 0:i.name)||""}}))}unlistenToTemplate(){if(this.templateListenerId){E.store.delListener(this.templateListenerId);this.templateListenerId=null}}attachFieldAttributes(e,t,i){i.addEventListener("settingsChanged",(()=>{var e;(e=this.templateUpdated)===null||e===void 0?void 0:e.emit({endpoint:this.endpoint,template:this.template,event:"added-field"})}));i.addEventListener("deleted",(()=>{var e;i.remove();(e=this.templateUpdated)===null||e===void 0?void 0:e.emit({endpoint:this.endpoint,template:this.template,event:"updated-field"})}));i.setAttribute("templateid",this.templateId);i.setAttribute("fieldname",t.name);i.setAttribute("pageNumber",String(e.pageNumber));i.setAttribute("xScale",String(e.xScale));i.setAttribute("yScale",String(e.yScale));i.setAttribute("name",t.name)}handlePageRendered(e){var t;const i=e.detail;this.cachedPageInfo[i.pageNumber]=i;this.pageHeights[i.pageNumber]=i.naturalHeight;(((t=this.template)===null||t===void 0?void 0:t.fields)||[]).filter((e=>e&&e.page===i.pageNumber)).forEach((e=>{const t=Z(e);const i=document.getElementById(t);if(i){i.setAttribute("fieldname",e.name);i.setAttribute("pagenumber",String(e.page));this.makeDraggable(i)}}))}makeDraggable(e){z(e).draggable({listeners:{move:this.handleMoveField.bind(this),end:this.handleMoveEnd.bind(this)}})}async handleMoveField(e){const t=+(e.target.getAttribute("posX")||0);const i=+(e.target.getAttribute("posY")||0);const o=+(e.target.getAttribute("xScale")||1);const s=+(e.target.getAttribute("yScale")||1);const n=e.dx/o+t;const l=e.dy/s+i;e.target.setAttribute("posX",n);e.target.setAttribute("posy",l);N(e.target,"translate",`${n}px, ${l}px`)}async handleMoveEnd(e){var t,i,o,s,n,l,r,a;const d=e.target.getAttribute("fieldname");const c=(((t=this.template)===null||t===void 0?void 0:t.fields)||[]).find((e=>e.name===d));if(!c){console.log("[FIELDS] Unable to find field",d,e.target);return}const h=e.target.getAttribute("pagenumber");let{naturalWidth:u=612,naturalHeight:p=792,renderedHeight:f=792}=this.cachedPageInfo[h];const v=e.target.getBoundingClientRect();const g=e.target.parentElement;const b=g.getBoundingClientRect();const x=c.width||A(c.type);const w=c.height||V(c.type);const k=Math.max(v.left-b.left,0);let C=Math.max(f-(b.bottom-v.bottom),0);let q=parseInt(h);if(C>f){q=Math.min(q+1,((s=(o=((i=this.template)===null||i===void 0?void 0:i.documents)||[])===null||o===void 0?void 0:o[0])===null||s===void 0?void 0:s.pages)||1);C-=f;f=this.cachedPageInfo[q].renderedHeight;console.log("Next page",{newPageNumber:q,newY:C,renderedHeight:f})}else if(C<0){q=Math.max(q-1,1);f=this.cachedPageInfo[q].renderedHeight;C+=f;console.log("[FIELDS] Next page",{newPageNumber:q,newY:C,renderedHeight:f})}const{x:T,y:M}=this.viewCoordinatesToPageCoordinates(k,C,h,u-x,p-w);try{const t={x:T,y:M,page:q};const i=await m(this.endpoint,this.templateId,d,t);console.log("[FIELDS] Updated",i);const o=JSON.parse(JSON.stringify(this.template));const s=o.fields.findIndex((e=>e.name===d));if(s>-1){o.fields[s]=i}E.updateTemplate(this.templateId,o);e.target.removeAttribute("posX");e.target.removeAttribute("posY");O(e.target);const{xScale:l=1,yScale:r=1}=this.cachedPageInfo[h];_(e.target,i,l,r);(n=this.templateUpdated)===null||n===void 0?void 0:n.emit({endpoint:this.endpoint,template:o,event:"updated-field"})}catch(t){S("Error updating field, please try again later",{style:"error"});console.log("[FIELDS] Error updating field",t);(l=this.sdkError)===null||l===void 0?void 0:l.emit(new y(t.message,(r=t.response)===null||r===void 0?void 0:r.status,(a=t.response)===null||a===void 0?void 0:a.data));e.target.removeAttribute("posX");e.target.removeAttribute("posY");O(e.target)}}generateFieldName(e,t){var i;let o=1;let s;do{s=`${e}P${t}-${o}`;o++}while((((i=this.template)===null||i===void 0?void 0:i.fields)||[]).some((e=>e&&e.name===s)));return s}viewCoordinatesToPageCoordinates(e,t,i,o,s){const{xScale:n=1,yScale:l=1,renderedHeight:r=792}=this.cachedPageInfo[i];const a=Math.floor(Math.min(e/n,o));const d=Math.floor(Math.min(Math.max(r-t,0)/l,s));return{x:a,y:d}}async handleClickPage(e,t){var i;if(this.placing){const o=e.offsetX;const s=e.offsetY;const n=A(this.placing);const l=V(this.placing);const r=this.cachedPageInfo[t];const{naturalWidth:a=612,naturalHeight:d=792}=r;const c=this.viewCoordinatesToPageCoordinates(o,s,t,a-n,d-l);const h=Math.floor(c.x);const u=Math.floor(c.y);const p={name:this.generateFieldName(this.placing,t),role_name:this.selectedRoleName,template_id:this.templateId,document_id:r.documentId,type:this.placing,required:this.placing!=="radio",page:t,validator:null,label:null,default:null,placeholder:null,group:null,settings:{},x:h,y:u,width:n,height:l,multiline:false,readonly:false,options:this.placing==="radio"?[{id:"option-1",label:"Option 1"}]:[]};console.log("[FIELDS] Will save new field",p);const f=await g(this.endpoint,this.templateId,p);console.log("[FIELDS] Saved field",f);const v=JSON.parse(JSON.stringify(this.template));v.fields.push(f);E.updateTemplate(this.templateId,v);(i=this.templateUpdated)===null||i===void 0?void 0:i.emit({endpoint:this.endpoint,template:v,event:"added-field"});this.placing=null}}render(){var e,t,s;if(this.loading){return i(o,null,i("verdocs-loader",null))}if(!this.endpoint.session){return i(o,null,i("verdocs-component-error",{message:"You must be authenticated to use this module."}))}const n=(((e=this.template)===null||e===void 0?void 0:e.roles)||[]).map((e=>({value:e.name,label:e.full_name?`${e.name}: ${e.full_name}`:e.name})));return i(o,{class:this.placing?{[`placing-${this.placing}`]:true}:{},onSubmit:()=>{}},i("div",{id:"verdocs-template-fields-toolbar"},i("div",{class:"add-for"},"Add field:"),i("verdocs-select-input",{value:this.selectedRoleName,options:n,onInput:e=>this.selectedRoleName=e.target.value}),ve.map((e=>i("verdocs-toolbar-icon",{text:e.tooltip,icon:e.icon,class:e.class,onClick:()=>{if(e.tooltip){if(this.selectedRoleName){this.placing=e.id}else{this.showMustSelectRole=true}}}})))),i("div",{class:"pages"},(((t=this.template)===null||t===void 0?void 0:t.documents)||[]).map((e=>{const t=a(1,e.pages);return t.map((t=>{const o=e.page_sizes[t];return i("verdocs-template-document-page",{templateId:this.templateId,documentId:e.id,pageNumber:t,virtualWidth:(o===null||o===void 0?void 0:o.width)||612,virtualHeight:(o===null||o===void 0?void 0:o.height)||792,disabled:true,editable:true,done:false,onClick:e=>this.handleClickPage(e,t),onPageRendered:e=>this.handlePageRendered(e),layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]})}))}))),this.showMustSelectRole&&i("verdocs-ok-dialog",{heading:"Unable to add field",message:(((s=this.template)===null||s===void 0?void 0:s.roles)||[]).length>0?"Please select a role before adding fields.":"Please add at least one role before adding fields.",onNext:()=>this.showMustSelectRole=false}))}static get watchers(){return{templateId:["onTemplateIdChanged"]}}};me.style=se;var ge={exports:{}};
|
2
|
-
/*! Sortable 1.15.6 - MIT | git://github.com/SortableJS/Sortable.git */var be=ge.exports;var xe;function we(){if(xe)return ge.exports;xe=1;(function(e,t){!function(t,i){e.exports=i()}(be,(function(){function e(e,t){var i,o=Object.keys(e);return Object.getOwnPropertySymbols&&(i=Object.getOwnPropertySymbols(e),t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,i)),o}function t(t){for(var i=1;i<arguments.length;i++){var o=null!=arguments[i]?arguments[i]:{};i%2?e(Object(o),true).forEach((function(e){var i,s;i=t,e=o[s=e],s in i?Object.defineProperty(i,s,{value:e,enumerable:true,configurable:true,writable:true}):i[s]=e})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):e(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}))}return t}function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(){return(o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i,o=arguments[t];for(i in o)Object.prototype.hasOwnProperty.call(o,i)&&(e[i]=o[i])}return e}).apply(this,arguments)}function s(e,t){if(null==e)return{};var i,o=function(e,t){if(null==e)return{};for(var i,o={},s=Object.keys(e),n=0;n<s.length;n++)i=s[n],0<=t.indexOf(i)||(o[i]=e[i]);return o}(e,t);if(Object.getOwnPropertySymbols)for(var s=Object.getOwnPropertySymbols(e),n=0;n<s.length;n++)i=s[n],0<=t.indexOf(i)||Object.prototype.propertyIsEnumerable.call(e,i)&&(o[i]=e[i]);return o}function n(e){return function(e){if(Array.isArray(e))return l(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return l(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(i="Object"===i&&e.constructor?e.constructor.name:i)||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?l(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,o=new Array(t);i<t;i++)o[i]=e[i];return o}function r(e){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(e)}var a=r(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),d=r(/Edge/i),c=r(/firefox/i),h=r(/safari/i)&&!r(/chrome/i)&&!r(/android/i),u=r(/iP(ad|od|hone)/i),p=r(/chrome/i)&&r(/android/i),f={capture:false,passive:false};function v(e,t,i){e.addEventListener(t,i,!a&&f)}function m(e,t,i){e.removeEventListener(t,i,!a&&f)}function g(e,t){if(t&&(">"===t[0]&&(t=t.substring(1)),e))try{if(e.matches)return e.matches(t);if(e.msMatchesSelector)return e.msMatchesSelector(t);if(e.webkitMatchesSelector)return e.webkitMatchesSelector(t)}catch(e){return}}function b(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function x(e,t,i,o){if(e){i=i||document;do{if(null!=t&&(">"!==t[0]||e.parentNode===i)&&g(e,t)||o&&e===i)return e}while(e!==i&&(e=b(e)))}return null}var w,y=/\s+/g;function E(e,t,i){var o;e&&t&&(e.classList?e.classList[i?"add":"remove"](t):(o=(" "+e.className+" ").replace(y," ").replace(" "+t+" "," "),e.className=(o+(i?" "+t:"")).replace(y," ")))}function k(e,t,i){var o=e&&e.style;if(o){if(void 0===i)return document.defaultView&&document.defaultView.getComputedStyle?i=document.defaultView.getComputedStyle(e,""):e.currentStyle&&(i=e.currentStyle),void 0===t?i:i[t];o[t=!(t in o||-1!==t.indexOf("webkit"))?"-webkit-"+t:t]=i+("string"==typeof i?"":"px")}}function S(e,t){var i="";if("string"==typeof e)i=e;else do{var o=k(e,"transform")}while(o&&"none"!==o&&(i=o+" "+i),!t&&(e=e.parentNode));var s=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return s&&new s(i)}function C(e,t,i){if(e){var o=e.getElementsByTagName(t),s=0,n=o.length;if(i)for(;s<n;s++)i(o[s],s);return o}return[]}function q(){var e=document.scrollingElement;return e||document.documentElement}function T(e,t,i,o,s){if(e.getBoundingClientRect||e===window){var n,l,r,d,c,h,u=e!==window&&e.parentNode&&e!==q()?(l=(n=e.getBoundingClientRect()).top,r=n.left,d=n.bottom,c=n.right,h=n.height,n.width):(r=l=0,d=window.innerHeight,c=window.innerWidth,h=window.innerHeight,window.innerWidth);if((t||i)&&e!==window&&(s=s||e.parentNode,!a))do{if(s&&s.getBoundingClientRect&&("none"!==k(s,"transform")||i&&"static"!==k(s,"position"))){var p=s.getBoundingClientRect();l-=p.top+parseInt(k(s,"border-top-width")),r-=p.left+parseInt(k(s,"border-left-width")),d=l+n.height,c=r+n.width;break}}while(s=s.parentNode);return o&&e!==window&&(o=(t=S(s||e))&&t.a,e=t&&t.d,t&&(d=(l/=e)+(h/=e),c=(r/=o)+(u/=o))),{top:l,left:r,bottom:d,right:c,width:u,height:h}}}function M(e,t,i){for(var o=z(e,true),s=T(e)[t];o;){var n=T(o)[i];if(!(n<=s))return o;if(o===q())break;o=z(o,false)}return false}function I(e,t,i,o){for(var s=0,n=0,l=e.children;n<l.length;){if("none"!==l[n].style.display&&l[n]!==Re.ghost&&(o||l[n]!==Re.dragged)&&x(l[n],i.draggable,e,false)){if(s===t)return l[n];s++}n++}return null}function D(e,t){for(var i=e.lastElementChild;i&&(i===Re.ghost||"none"===k(i,"display")||t&&!g(i,t));)i=i.previousElementSibling;return i||null}function L(e,t){var i=0;if(!e||!e.parentNode)return-1;for(;e=e.previousElementSibling;)"TEMPLATE"===e.nodeName.toUpperCase()||e===Re.clone||t&&!g(e,t)||i++;return i}function H(e){var t=0,i=0,o=q();if(e)do{var s=S(e),n=s.a,s=s.d}while(t+=e.scrollLeft*n,i+=e.scrollTop*s,e!==o&&(e=e.parentNode));return[t,i]}function z(e,t){if(!e||!e.getBoundingClientRect)return q();var i=e,o=false;do{if(i.clientWidth<i.scrollWidth||i.clientHeight<i.scrollHeight){var s=k(i);if(i.clientWidth<i.scrollWidth&&("auto"==s.overflowX||"scroll"==s.overflowX)||i.clientHeight<i.scrollHeight&&("auto"==s.overflowY||"scroll"==s.overflowY)){if(!i.getBoundingClientRect||i===document.body)return q();if(o||t)return i;o=true}}}while(i=i.parentNode);return q()}function Z(e,t){return Math.round(e.top)===Math.round(t.top)&&Math.round(e.left)===Math.round(t.left)&&Math.round(e.height)===Math.round(t.height)&&Math.round(e.width)===Math.round(t.width)}function N(e,t){return function(){var i;w||(1===(i=arguments).length?e.call(this,i[0]):e.apply(this,i),w=setTimeout((function(){w=void 0}),t))}}function O(e,t,i){e.scrollLeft+=t,e.scrollTop+=i}function _(e){var t=window.Polymer,i=window.jQuery||window.Zepto;return t&&t.dom?t.dom(e).cloneNode(true):i?i(e).clone(true)[0]:e.cloneNode(true)}function V(e,t){k(e,"position","absolute"),k(e,"top",t.top),k(e,"left",t.left),k(e,"width",t.width),k(e,"height",t.height)}function A(e){k(e,"position",""),k(e,"top",""),k(e,"left",""),k(e,"width",""),k(e,"height","")}function R(e,t,i){var o={};return Array.from(e.children).forEach((function(s){var n;x(s,t.draggable,e,false)&&!s.animated&&s!==i&&(n=T(s),o.left=Math.min(null!==(s=o.left)&&void 0!==s?s:1/0,n.left),o.top=Math.min(null!==(s=o.top)&&void 0!==s?s:1/0,n.top),o.right=Math.max(null!==(s=o.right)&&void 0!==s?s:-1/0,n.right),o.bottom=Math.max(null!==(s=o.bottom)&&void 0!==s?s:-1/0,n.bottom))})),o.width=o.right-o.left,o.height=o.bottom-o.top,o.x=o.left,o.y=o.top,o}var j="Sortable"+(new Date).getTime();function U(){var e,i=[];return{captureAnimationState:function(){i=[],this.options.animation&&[].slice.call(this.el.children).forEach((function(e){var o,s;"none"!==k(e,"display")&&e!==Re.ghost&&(i.push({target:e,rect:T(e)}),o=t({},i[i.length-1].rect),!e.thisAnimationDuration||(s=S(e,true))&&(o.top-=s.f,o.left-=s.e),e.fromRect=o)}))},addAnimationState:function(e){i.push(e)},removeAnimationState:function(e){i.splice(function(e,t){for(var i in e)if(e.hasOwnProperty(i))for(var o in t)if(t.hasOwnProperty(o)&&t[o]===e[i][o])return Number(i);return-1}(i,{target:e}),1)},animateAll:function(t){var o=this;if(!this.options.animation)return clearTimeout(e),void("function"==typeof t&&t());var s=false,n=0;i.forEach((function(e){var t=0,i=e.target,l=i.fromRect,r=T(i),a=i.prevFromRect,d=i.prevToRect,c=e.rect,h=S(i,true);h&&(r.top-=h.f,r.left-=h.e),i.toRect=r,i.thisAnimationDuration&&Z(a,r)&&!Z(l,r)&&(c.top-r.top)/(c.left-r.left)==(l.top-r.top)/(l.left-r.left)&&(e=c,h=a,a=d,d=o.options,t=Math.sqrt(Math.pow(h.top-e.top,2)+Math.pow(h.left-e.left,2))/Math.sqrt(Math.pow(h.top-a.top,2)+Math.pow(h.left-a.left,2))*d.animation),Z(r,l)||(i.prevFromRect=l,i.prevToRect=r,t=t||o.options.animation,o.animate(i,c,r,t)),t&&(s=true,n=Math.max(n,t),clearTimeout(i.animationResetTimer),i.animationResetTimer=setTimeout((function(){i.animationTime=0,i.prevFromRect=null,i.fromRect=null,i.prevToRect=null,i.thisAnimationDuration=null}),t),i.thisAnimationDuration=t)})),clearTimeout(e),s?e=setTimeout((function(){"function"==typeof t&&t()}),n):"function"==typeof t&&t(),i=[]},animate:function(e,t,i,o){var s,n;o&&(k(e,"transition",""),k(e,"transform",""),s=(n=S(this.el))&&n.a,n=n&&n.d,s=(t.left-i.left)/(s||1),n=(t.top-i.top)/(n||1),e.animatingX=!!s,e.animatingY=!!n,k(e,"transform","translate3d("+s+"px,"+n+"px,0)"),this.forRepaintDummy=e.offsetWidth,k(e,"transition","transform "+o+"ms"+(this.options.easing?" "+this.options.easing:"")),k(e,"transform","translate3d(0,0,0)"),"number"==typeof e.animated&&clearTimeout(e.animated),e.animated=setTimeout((function(){k(e,"transition",""),k(e,"transform",""),e.animated=false,e.animatingX=false,e.animatingY=false}),o))}}}var B=[],P={initializeByDefault:true},F={mount:function(e){for(var t in P)!P.hasOwnProperty(t)||t in e||(e[t]=P[t]);B.forEach((function(t){if(t.pluginName===e.pluginName)throw"Sortable: Cannot mount plugin ".concat(e.pluginName," more than once")})),B.push(e)},pluginEvent:function(e,i,o){var s=this;this.eventCanceled=false,o.cancel=function(){s.eventCanceled=true};var n=e+"Global";B.forEach((function(s){i[s.pluginName]&&(i[s.pluginName][n]&&i[s.pluginName][n](t({sortable:i},o)),i.options[s.pluginName]&&i[s.pluginName][e]&&i[s.pluginName][e](t({sortable:i},o)))}))},initializePlugins:function(e,t,i,s){for(var n in B.forEach((function(s){var n=s.pluginName;(e.options[n]||s.initializeByDefault)&&((s=new s(e,t,e.options)).sortable=e,s.options=e.options,e[n]=s,o(i,s.defaults))})),e.options){var l;e.options.hasOwnProperty(n)&&(void 0!==(l=this.modifyOption(e,n,e.options[n]))&&(e.options[n]=l))}},getEventProperties:function(e,t){var i={};return B.forEach((function(s){"function"==typeof s.eventProperties&&o(i,s.eventProperties.call(t[s.pluginName],e))})),i},modifyOption:function(e,t,i){var o;return B.forEach((function(s){e[s.pluginName]&&s.optionListeners&&"function"==typeof s.optionListeners[t]&&(o=s.optionListeners[t].call(e[s.pluginName],i))})),o}};function $(e){var i=e.sortable,o=e.rootEl,s=e.name,n=e.targetEl,l=e.cloneEl,r=e.toEl,c=e.fromEl,h=e.oldIndex,u=e.newIndex,p=e.oldDraggableIndex,f=e.newDraggableIndex,v=e.originalEvent,m=e.putSortable,g=e.extraEventProperties;if(i=i||o&&o[j]){var b,x=i.options,e="on"+s.charAt(0).toUpperCase()+s.substr(1);!window.CustomEvent||a||d?(b=document.createEvent("Event")).initEvent(s,true,true):b=new CustomEvent(s,{bubbles:true,cancelable:true}),b.to=r||o,b.from=c||o,b.item=n||o,b.clone=l,b.oldIndex=h,b.newIndex=u,b.oldDraggableIndex=p,b.newDraggableIndex=f,b.originalEvent=v,b.pullMode=m?m.lastPutMode:void 0;var w,y=t(t({},g),F.getEventProperties(s,i));for(w in y)b[w]=y[w];o&&o.dispatchEvent(b),x[e]&&x[e].call(i,b)}}function Q(e,i){var o=(n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{}).evt,n=s(n,W);F.pluginEvent.bind(Re)(e,i,t({dragEl:Y,parentEl:X,ghostEl:J,rootEl:K,nextEl:ee,lastDownEl:te,cloneEl:ie,cloneHidden:oe,dragStarted:me,putSortable:de,activeSortable:Re.active,originalEvent:o,oldIndex:se,oldDraggableIndex:le,newIndex:ne,newDraggableIndex:re,hideGhostForTarget:Oe,unhideGhostForTarget:_e,cloneNowHidden:function(){oe=true},cloneNowShown:function(){oe=false},dispatchSortableEvent:function(e){G({sortable:i,name:e,originalEvent:o})}},n))}var W=["evt"];function G(e){$(t({putSortable:de,cloneEl:ie,targetEl:Y,rootEl:K,oldIndex:se,oldDraggableIndex:le,newIndex:ne,newDraggableIndex:re},e))}var Y,X,J,K,ee,te,ie,oe,se,ne,le,re,ae,de,ce,he,ue,pe,fe,ve,me,ge,be,xe,we,ye=false,Ee=false,ke=[],Se=false,Ce=false,qe=[],Te=false,Me=[],Ie="undefined"!=typeof document,De=u,Le=d||a?"cssFloat":"float",He=Ie&&!p&&!u&&"draggable"in document.createElement("div"),ze=function(){if(Ie){if(a)return false;var e=document.createElement("x");return e.style.cssText="pointer-events:auto","auto"===e.style.pointerEvents}}(),Ze=function(e,t){var i=k(e),o=parseInt(i.width)-parseInt(i.paddingLeft)-parseInt(i.paddingRight)-parseInt(i.borderLeftWidth)-parseInt(i.borderRightWidth),s=I(e,0,t),n=I(e,1,t),l=s&&k(s),r=n&&k(n),a=l&&parseInt(l.marginLeft)+parseInt(l.marginRight)+T(s).width,e=r&&parseInt(r.marginLeft)+parseInt(r.marginRight)+T(n).width;if("flex"===i.display)return"column"===i.flexDirection||"column-reverse"===i.flexDirection?"vertical":"horizontal";if("grid"===i.display)return i.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(s&&l.float&&"none"!==l.float){t="left"===l.float?"left":"right";return!n||"both"!==r.clear&&r.clear!==t?"horizontal":"vertical"}return s&&("block"===l.display||"flex"===l.display||"table"===l.display||"grid"===l.display||o<=a&&"none"===i[Le]||n&&"none"===i[Le]&&o<a+e)?"vertical":"horizontal"},Ne=function(e){function t(e,i){return function(o,s,n,l){var r=o.options.group.name&&s.options.group.name&&o.options.group.name===s.options.group.name;if(null==e&&(i||r))return true;if(null==e||false===e)return false;if(i&&"clone"===e)return e;if("function"==typeof e)return t(e(o,s,n,l),i)(o,s,n,l);s=(i?o:s).options.group.name;return true===e||"string"==typeof e&&e===s||e.join&&-1<e.indexOf(s)}}var o={},s=e.group;s&&"object"==i(s)||(s={name:s}),o.name=s.name,o.checkPull=t(s.pull,true),o.checkPut=t(s.put),o.revertClone=s.revertClone,e.group=o},Oe=function(){!ze&&J&&k(J,"display","none")},_e=function(){!ze&&J&&k(J,"display","")};Ie&&!p&&document.addEventListener("click",(function(e){if(Ee)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),Ee=false}),true);function Ve(e){if(Y){e=e.touches?e.touches[0]:e;var t=(s=e.clientX,n=e.clientY,ke.some((function(e){var t=e[j].options.emptyInsertThreshold;if(t&&!D(e)){var i=T(e),o=s>=i.left-t&&s<=i.right+t,t=n>=i.top-t&&n<=i.bottom+t;return o&&t?l=e:void 0}})),l);if(t){var i,o={};for(i in e)e.hasOwnProperty(i)&&(o[i]=e[i]);o.target=o.rootEl=t,o.preventDefault=void 0,o.stopPropagation=void 0,t[j]._onDragOver(o)}}var s,n,l}function Ae(e){Y&&Y.parentNode[j]._isOutsideThisEl(e.target)}function Re(e,t){if(!e||!e.nodeType||1!==e.nodeType)throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(e));this.el=e,this.options=t=o({},t),e[j]=this;var i,s,n={group:null,sort:true,disabled:false,store:null,handle:null,draggable:/^[uo]l$/i.test(e.nodeName)?">li":">*",swapThreshold:1,invertSwap:false,invertedSwapThreshold:null,removeCloneOnHide:true,direction:function(){return Ze(e,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:true,animation:0,easing:null,setData:function(e,t){e.setData("Text",t.textContent)},dropBubble:false,dragoverBubble:false,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:false,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:false,fallbackClass:"sortable-fallback",fallbackOnBody:false,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:false!==Re.supportPointer&&"PointerEvent"in window&&(!h||u),emptyInsertThreshold:5};for(i in F.initializePlugins(this,e,n),n)i in t||(t[i]=n[i]);for(s in Ne(t),this)"_"===s.charAt(0)&&"function"==typeof this[s]&&(this[s]=this[s].bind(this));this.nativeDraggable=!t.forceFallback&&He,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?v(e,"pointerdown",this._onTapStart):(v(e,"mousedown",this._onTapStart),v(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(v(e,"dragover",this),v(e,"dragenter",this)),ke.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),o(this,U())}function je(e,t,i,o,s,n,l,r){var c,h,u=e[j],p=u.options.onMove;return!window.CustomEvent||a||d?(c=document.createEvent("Event")).initEvent("move",true,true):c=new CustomEvent("move",{bubbles:true,cancelable:true}),c.to=t,c.from=e,c.dragged=i,c.draggedRect=o,c.related=s||t,c.relatedRect=n||T(t),c.willInsertAfter=r,c.originalEvent=l,e.dispatchEvent(c),h=p?p.call(u,c,l):h}function Ue(e){e.draggable=false}function Be(){Te=false}function Pe(e){return setTimeout(e,0)}function Fe(e){return clearTimeout(e)}Re.prototype={constructor:Re,_isOutsideThisEl:function(e){this.el.contains(e)||e===this.el||(ge=null)},_getDirection:function(e,t){return"function"==typeof this.options.direction?this.options.direction.call(this,e,t,Y):this.options.direction},_onTapStart:function(e){if(e.cancelable){var t=this,i=this.el,o=this.options,s=o.preventOnFilter,n=e.type,l=e.touches&&e.touches[0]||e.pointerType&&"touch"===e.pointerType&&e,r=(l||e).target,a=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||r,d=o.filter;if(!function(e){Me.length=0;var t=e.getElementsByTagName("input"),i=t.length;for(;i--;){var o=t[i];o.checked&&Me.push(o)}}(i),!Y&&!(/mousedown|pointerdown/.test(n)&&0!==e.button||o.disabled)&&!a.isContentEditable&&(this.nativeDraggable||!h||!r||"SELECT"!==r.tagName.toUpperCase())&&!((r=x(r,o.draggable,i,false))&&r.animated||te===r)){if(se=L(r),le=L(r,o.draggable),"function"==typeof d){if(d.call(this,e,r,this))return G({sortable:t,rootEl:a,name:"filter",targetEl:r,toEl:i,fromEl:i}),Q("filter",t,{evt:e}),void(s&&e.preventDefault())}else if(d=d&&d.split(",").some((function(o){if(o=x(a,o.trim(),i,false))return G({sortable:t,rootEl:o,name:"filter",targetEl:r,fromEl:i,toEl:i}),Q("filter",t,{evt:e}),true})))return void(s&&e.preventDefault());o.handle&&!x(a,o.handle,i,false)||this._prepareDragStart(e,l,r)}}},_prepareDragStart:function(e,t,i){var o,s=this,n=s.el,l=s.options,r=n.ownerDocument;i&&!Y&&i.parentNode===n&&(o=T(i),K=n,X=(Y=i).parentNode,ee=Y.nextSibling,te=i,ae=l.group,ce={target:Re.dragged=Y,clientX:(t||e).clientX,clientY:(t||e).clientY},fe=ce.clientX-o.left,ve=ce.clientY-o.top,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,Y.style["will-change"]="all",o=function(){Q("delayEnded",s,{evt:e}),Re.eventCanceled?s._onDrop():(s._disableDelayedDragEvents(),!c&&s.nativeDraggable&&(Y.draggable=true),s._triggerDragStart(e,t),G({sortable:s,name:"choose",originalEvent:e}),E(Y,l.chosenClass,true))},l.ignore.split(",").forEach((function(e){C(Y,e.trim(),Ue)})),v(r,"dragover",Ve),v(r,"mousemove",Ve),v(r,"touchmove",Ve),l.supportPointer?(v(r,"pointerup",s._onDrop),this.nativeDraggable||v(r,"pointercancel",s._onDrop)):(v(r,"mouseup",s._onDrop),v(r,"touchend",s._onDrop),v(r,"touchcancel",s._onDrop)),c&&this.nativeDraggable&&(this.options.touchStartThreshold=4,Y.draggable=true),Q("delayStart",this,{evt:e}),!l.delay||l.delayOnTouchOnly&&!t||this.nativeDraggable&&(d||a)?o():Re.eventCanceled?this._onDrop():(l.supportPointer?(v(r,"pointerup",s._disableDelayedDrag),v(r,"pointercancel",s._disableDelayedDrag)):(v(r,"mouseup",s._disableDelayedDrag),v(r,"touchend",s._disableDelayedDrag),v(r,"touchcancel",s._disableDelayedDrag)),v(r,"mousemove",s._delayedDragTouchMoveHandler),v(r,"touchmove",s._delayedDragTouchMoveHandler),l.supportPointer&&v(r,"pointermove",s._delayedDragTouchMoveHandler),s._dragStartTimer=setTimeout(o,l.delay)))},_delayedDragTouchMoveHandler:function(e){e=e.touches?e.touches[0]:e;Math.max(Math.abs(e.clientX-this._lastX),Math.abs(e.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){Y&&Ue(Y),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;m(e,"mouseup",this._disableDelayedDrag),m(e,"touchend",this._disableDelayedDrag),m(e,"touchcancel",this._disableDelayedDrag),m(e,"pointerup",this._disableDelayedDrag),m(e,"pointercancel",this._disableDelayedDrag),m(e,"mousemove",this._delayedDragTouchMoveHandler),m(e,"touchmove",this._delayedDragTouchMoveHandler),m(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,t){t=t||"touch"==e.pointerType&&e,!this.nativeDraggable||t?this.options.supportPointer?v(document,"pointermove",this._onTouchMove):v(document,t?"touchmove":"mousemove",this._onTouchMove):(v(Y,"dragend",this),v(K,"dragstart",this._onDragStart));try{document.selection?Pe((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(e){}},_dragStarted:function(e,t){var i;ye=false,K&&Y?(Q("dragStarted",this,{evt:t}),this.nativeDraggable&&v(document,"dragover",Ae),i=this.options,e||E(Y,i.dragClass,false),E(Y,i.ghostClass,true),Re.active=this,e&&this._appendGhost(),G({sortable:this,name:"start",originalEvent:t})):this._nulling()},_emulateDragOver:function(){if(he){this._lastX=he.clientX,this._lastY=he.clientY,Oe();for(var e=document.elementFromPoint(he.clientX,he.clientY),t=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(he.clientX,he.clientY))!==t;)t=e;if(Y.parentNode[j]._isOutsideThisEl(e),t)do{if(t[j])if(t[j]._onDragOver({clientX:he.clientX,clientY:he.clientY,target:e,rootEl:t})&&!this.options.dragoverBubble)break}while(t=b(e=t));_e()}},_onTouchMove:function(e){if(ce){var t=this.options,i=t.fallbackTolerance,o=t.fallbackOffset,s=e.touches?e.touches[0]:e,n=J&&S(J,true),l=J&&n&&n.a,r=J&&n&&n.d,t=De&&we&&H(we),l=(s.clientX-ce.clientX+o.x)/(l||1)+(t?t[0]-qe[0]:0)/(l||1),r=(s.clientY-ce.clientY+o.y)/(r||1)+(t?t[1]-qe[1]:0)/(r||1);if(!Re.active&&!ye){if(i&&Math.max(Math.abs(s.clientX-this._lastX),Math.abs(s.clientY-this._lastY))<i)return;this._onDragStart(e,true)}J&&(n?(n.e+=l-(ue||0),n.f+=r-(pe||0)):n={a:1,b:0,c:0,d:1,e:l,f:r},n="matrix(".concat(n.a,",").concat(n.b,",").concat(n.c,",").concat(n.d,",").concat(n.e,",").concat(n.f,")"),k(J,"webkitTransform",n),k(J,"mozTransform",n),k(J,"msTransform",n),k(J,"transform",n),ue=l,pe=r,he=s),e.cancelable&&e.preventDefault()}},_appendGhost:function(){if(!J){var e=this.options.fallbackOnBody?document.body:K,t=T(Y,true,De,true,e),i=this.options;if(De){for(we=e;"static"===k(we,"position")&&"none"===k(we,"transform")&&we!==document;)we=we.parentNode;we!==document.body&&we!==document.documentElement?(we===document&&(we=q()),t.top+=we.scrollTop,t.left+=we.scrollLeft):we=q(),qe=H(we)}E(J=Y.cloneNode(true),i.ghostClass,false),E(J,i.fallbackClass,true),E(J,i.dragClass,true),k(J,"transition",""),k(J,"transform",""),k(J,"box-sizing","border-box"),k(J,"margin",0),k(J,"top",t.top),k(J,"left",t.left),k(J,"width",t.width),k(J,"height",t.height),k(J,"opacity","0.8"),k(J,"position",De?"absolute":"fixed"),k(J,"zIndex","100000"),k(J,"pointerEvents","none"),Re.ghost=J,e.appendChild(J),k(J,"transform-origin",fe/parseInt(J.style.width)*100+"% "+ve/parseInt(J.style.height)*100+"%")}},_onDragStart:function(e,t){var i=this,o=e.dataTransfer,s=i.options;Q("dragStart",this,{evt:e}),Re.eventCanceled?this._onDrop():(Q("setupClone",this),Re.eventCanceled||((ie=_(Y)).removeAttribute("id"),ie.draggable=false,ie.style["will-change"]="",this._hideClone(),E(ie,this.options.chosenClass,false),Re.clone=ie),i.cloneId=Pe((function(){Q("clone",i),Re.eventCanceled||(i.options.removeCloneOnHide||K.insertBefore(ie,Y),i._hideClone(),G({sortable:i,name:"clone"}))})),t||E(Y,s.dragClass,true),t?(Ee=true,i._loopId=setInterval(i._emulateDragOver,50)):(m(document,"mouseup",i._onDrop),m(document,"touchend",i._onDrop),m(document,"touchcancel",i._onDrop),o&&(o.effectAllowed="move",s.setData&&s.setData.call(i,o,Y)),v(document,"drop",i),k(Y,"transform","translateZ(0)")),ye=true,i._dragStartId=Pe(i._dragStarted.bind(i,t,e)),v(document,"selectstart",i),me=true,window.getSelection().removeAllRanges(),h&&k(document.body,"user-select","none"))},_onDragOver:function(e){var i,o,s,n,l,r=this.el,a=e.target,d=this.options,c=d.group,h=Re.active,u=ae===c,p=d.sort,f=de||h,v=this,m=false;if(!Te){if(void 0!==e.preventDefault&&e.cancelable&&e.preventDefault(),a=x(a,d.draggable,r,true),V("dragOver"),Re.eventCanceled)return m;if(Y.contains(e.target)||a.animated&&a.animatingX&&a.animatingY||v._ignoreWhileAnimating===a)return U(false);if(Ee=false,h&&!d.disabled&&(u?p||(o=X!==K):de===this||(this.lastPutMode=ae.checkPull(this,h,Y,e))&&c.checkPut(this,h,Y,e))){if(s="vertical"===this._getDirection(e,a),i=T(Y),V("dragOverValid"),Re.eventCanceled)return m;if(o)return X=K,A(),this._hideClone(),V("revert"),Re.eventCanceled||(ee?K.insertBefore(Y,ee):K.appendChild(Y)),U(true);var g=D(r,d.draggable);if(g&&(H=e,c=s,_=T(D((q=this).el,q.options.draggable)),q=R(q.el,q.options,J),!(c?H.clientX>q.right+10||H.clientY>_.bottom&&H.clientX>_.left:H.clientY>q.bottom+10||H.clientX>_.right&&H.clientY>_.top)||g.animated)){if(g&&(n=e,l=s,Z=T(I((z=this).el,0,z.options,true)),z=R(z.el,z.options,J),l?n.clientX<z.left-10||n.clientY<Z.top&&n.clientX<Z.right:n.clientY<z.top-10||n.clientY<Z.bottom&&n.clientX<Z.left)){var b=I(r,0,d,true);if(b===Y)return U(false);if(C=T(a=b),false!==je(K,r,Y,i,a,C,e,false))return A(),r.insertBefore(Y,b),X=r,B(),U(true)}else if(a.parentNode===r){var w,y,S,C=T(a),q=Y.parentNode!==r,H=(H=Y.animated&&Y.toRect||i,_=a.animated&&a.toRect||C,z=(l=s)?H.left:H.top,n=l?H.right:H.bottom,Z=l?H.width:H.height,b=l?_.left:_.top,H=l?_.right:_.bottom,_=l?_.width:_.height,!(z===b||n===H||z+Z/2===b+_/2)),z=s?"top":"left",Z=M(a,"top","top")||M(Y,"top","top"),b=Z?Z.scrollTop:void 0;if(ge!==a&&(y=C[z],Se=false,Ce=!H&&d.invertSwap||q),0!==(w=function(e,t,i,o,s,n,l,r){var a=o?e.clientY:e.clientX,d=o?i.height:i.width,e=o?i.top:i.left,o=o?i.bottom:i.right,i=false;if(!l)if(r&&xe<d*s){if(Se=!Se&&(1===be?e+d*n/2<a:a<o-d*n/2)?true:Se)i=true;else if(1===be?a<e+xe:o-xe<a)return-be}else if(e+d*(1-s)/2<a&&a<o-d*(1-s)/2)return function(e){return L(Y)<L(e)?1:-1}(t);if((i=i||l)&&(a<e+d*n/2||o-d*n/2<a))return e+d/2<a?1:-1;return 0}(e,a,C,s,H?1:d.swapThreshold,null==d.invertedSwapThreshold?d.swapThreshold:d.invertedSwapThreshold,Ce,ge===a)))for(var N=L(Y);(S=X.children[N-=w])&&("none"===k(S,"display")||S===J););if(0===w||S===a)return U(false);be=w;var _=(ge=a).nextElementSibling,q=false,H=je(K,r,Y,i,a,C,e,q=1===w);if(false!==H)return 1!==H&&-1!==H||(q=1===H),Te=true,setTimeout(Be,30),A(),q&&!_?r.appendChild(Y):a.parentNode.insertBefore(Y,q?_:a),Z&&O(Z,0,b-Z.scrollTop),X=Y.parentNode,void 0===y||Ce||(xe=Math.abs(y-T(a)[z])),B(),U(true)}}else{if(g===Y)return U(false);if((a=g&&r===e.target?g:a)&&(C=T(a)),false!==je(K,r,Y,i,a,C,e,!!a))return A(),g&&g.nextSibling?r.insertBefore(Y,g.nextSibling):r.appendChild(Y),X=r,B(),U(true)}if(r.contains(Y))return U(false)}return false}function V(n,l){Q(n,v,t({evt:e,isOwner:u,axis:s?"vertical":"horizontal",revert:o,dragRect:i,targetRect:C,canSort:p,fromSortable:f,target:a,completed:U,onMove:function(t,o){return je(K,r,Y,i,t,T(t),e,o)},changed:B},l))}function A(){V("dragOverAnimationCapture"),v.captureAnimationState(),v!==f&&f.captureAnimationState()}function U(t){return V("dragOverCompleted",{insertion:t}),t&&(u?h._hideClone():h._showClone(v),v!==f&&(E(Y,(de||h).options.ghostClass,false),E(Y,d.ghostClass,true)),de!==v&&v!==Re.active?de=v:v===Re.active&&de&&(de=null),f===v&&(v._ignoreWhileAnimating=a),v.animateAll((function(){V("dragOverAnimationComplete"),v._ignoreWhileAnimating=null})),v!==f&&(f.animateAll(),f._ignoreWhileAnimating=null)),(a===Y&&!Y.animated||a===r&&!a.animated)&&(ge=null),d.dragoverBubble||e.rootEl||a===document||(Y.parentNode[j]._isOutsideThisEl(e.target),t||Ve(e)),!d.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),m=true}function B(){ne=L(Y),re=L(Y,d.draggable),G({sortable:v,name:"change",toEl:r,newIndex:ne,newDraggableIndex:re,originalEvent:e})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){m(document,"mousemove",this._onTouchMove),m(document,"touchmove",this._onTouchMove),m(document,"pointermove",this._onTouchMove),m(document,"dragover",Ve),m(document,"mousemove",Ve),m(document,"touchmove",Ve)},_offUpEvents:function(){var e=this.el.ownerDocument;m(e,"mouseup",this._onDrop),m(e,"touchend",this._onDrop),m(e,"pointerup",this._onDrop),m(e,"pointercancel",this._onDrop),m(e,"touchcancel",this._onDrop),m(document,"selectstart",this)},_onDrop:function(e){var t=this.el,i=this.options;ne=L(Y),re=L(Y,i.draggable),Q("drop",this,{evt:e}),X=Y&&Y.parentNode,ne=L(Y),re=L(Y,i.draggable),Re.eventCanceled||(Se=Ce=ye=false,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),Fe(this.cloneId),Fe(this._dragStartId),this.nativeDraggable&&(m(document,"drop",this),m(t,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),h&&k(document.body,"user-select",""),k(Y,"transform",""),e&&(me&&(e.cancelable&&e.preventDefault(),i.dropBubble||e.stopPropagation()),J&&J.parentNode&&J.parentNode.removeChild(J),(K===X||de&&"clone"!==de.lastPutMode)&&ie&&ie.parentNode&&ie.parentNode.removeChild(ie),Y&&(this.nativeDraggable&&m(Y,"dragend",this),Ue(Y),Y.style["will-change"]="",me&&!ye&&E(Y,(de||this).options.ghostClass,false),E(Y,this.options.chosenClass,false),G({sortable:this,name:"unchoose",toEl:X,newIndex:null,newDraggableIndex:null,originalEvent:e}),K!==X?(0<=ne&&(G({rootEl:X,name:"add",toEl:X,fromEl:K,originalEvent:e}),G({sortable:this,name:"remove",toEl:X,originalEvent:e}),G({rootEl:X,name:"sort",toEl:X,fromEl:K,originalEvent:e}),G({sortable:this,name:"sort",toEl:X,originalEvent:e})),de&&de.save()):ne!==se&&0<=ne&&(G({sortable:this,name:"update",toEl:X,originalEvent:e}),G({sortable:this,name:"sort",toEl:X,originalEvent:e})),Re.active&&(null!=ne&&-1!==ne||(ne=se,re=le),G({sortable:this,name:"end",toEl:X,originalEvent:e}),this.save())))),this._nulling()},_nulling:function(){Q("nulling",this),K=Y=X=J=ee=ie=te=oe=ce=he=me=ne=re=se=le=ge=be=de=ae=Re.dragged=Re.ghost=Re.clone=Re.active=null,Me.forEach((function(e){e.checked=true})),Me.length=ue=pe=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":Y&&(this._onDragOver(e),function(e){e.dataTransfer&&(e.dataTransfer.dropEffect="move");e.cancelable&&e.preventDefault()}(e));break;case"selectstart":e.preventDefault()}},toArray:function(){for(var e,t=[],i=this.el.children,o=0,s=i.length,n=this.options;o<s;o++)x(e=i[o],n.draggable,this.el,false)&&t.push(e.getAttribute(n.dataIdAttr)||function(e){var t=e.tagName+e.className+e.src+e.href+e.textContent,i=t.length,o=0;for(;i--;)o+=t.charCodeAt(i);return o.toString(36)}(e));return t},sort:function(e,t){var i={},o=this.el;this.toArray().forEach((function(e,t){t=o.children[t];x(t,this.options.draggable,o,false)&&(i[e]=t)}),this),t&&this.captureAnimationState(),e.forEach((function(e){i[e]&&(o.removeChild(i[e]),o.appendChild(i[e]))})),t&&this.animateAll()},save:function(){var e=this.options.store;e&&e.set&&e.set(this)},closest:function(e,t){return x(e,t||this.options.draggable,this.el,false)},option:function(e,t){var i=this.options;if(void 0===t)return i[e];var o=F.modifyOption(this,e,t);i[e]=void 0!==o?o:t,"group"===e&&Ne(i)},destroy:function(){Q("destroy",this);var e=this.el;e[j]=null,m(e,"mousedown",this._onTapStart),m(e,"touchstart",this._onTapStart),m(e,"pointerdown",this._onTapStart),this.nativeDraggable&&(m(e,"dragover",this),m(e,"dragenter",this)),Array.prototype.forEach.call(e.querySelectorAll("[draggable]"),(function(e){e.removeAttribute("draggable")})),this._onDrop(),this._disableDelayedDragEvents(),ke.splice(ke.indexOf(this.el),1),this.el=e=null},_hideClone:function(){oe||(Q("hideClone",this),Re.eventCanceled||(k(ie,"display","none"),this.options.removeCloneOnHide&&ie.parentNode&&ie.parentNode.removeChild(ie),oe=true))},_showClone:function(e){"clone"===e.lastPutMode?oe&&(Q("showClone",this),Re.eventCanceled||(Y.parentNode!=K||this.options.group.revertClone?ee?K.insertBefore(ie,ee):K.appendChild(ie):K.insertBefore(ie,Y),this.options.group.revertClone&&this.animate(Y,ie),k(ie,"display",""),oe=false)):this._hideClone()}},Ie&&v(document,"touchmove",(function(e){(Re.active||ye)&&e.cancelable&&e.preventDefault()})),Re.utils={on:v,off:m,css:k,find:C,is:function(e,t){return!!x(e,t,e,false)},extend:function(e,t){if(e&&t)for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);return e},throttle:N,closest:x,toggleClass:E,clone:_,index:L,nextTick:Pe,cancelNextTick:Fe,detectDirection:Ze,getChild:I,expando:j},Re.get=function(e){return e[j]},Re.mount=function(){for(var e=arguments.length,i=new Array(e),o=0;o<e;o++)i[o]=arguments[o];(i=i[0].constructor===Array?i[0]:i).forEach((function(e){if(!e.prototype||!e.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(e));e.utils&&(Re.utils=t(t({},Re.utils),e.utils)),F.mount(e)}))},Re.create=function(e,t){return new Re(e,t)};var $e,Qe,We,Ge,Ye,Xe,Je=[],Ke=!(Re.version="1.15.6");function et(){Je.forEach((function(e){clearInterval(e.pid)})),Je=[]}function tt(){clearInterval(Xe)}var it,ot=N((function(e,t,i,o){if(t.scroll){var s,n=(e.touches?e.touches[0]:e).clientX,l=(e.touches?e.touches[0]:e).clientY,r=t.scrollSensitivity,a=t.scrollSpeed,d=q(),c=false;Qe!==i&&(Qe=i,et(),$e=t.scroll,s=t.scrollFn,true===$e&&($e=z(i,true)));var h=0,u=$e;do{var p=u,f=T(p),v=f.top,m=f.bottom,g=f.left,b=f.right,x=f.width,w=f.height,y=void 0,E=void 0,S=p.scrollWidth,C=p.scrollHeight,M=k(p),I=p.scrollLeft,f=p.scrollTop,E=p===d?(y=x<S&&("auto"===M.overflowX||"scroll"===M.overflowX||"visible"===M.overflowX),w<C&&("auto"===M.overflowY||"scroll"===M.overflowY||"visible"===M.overflowY)):(y=x<S&&("auto"===M.overflowX||"scroll"===M.overflowX),w<C&&("auto"===M.overflowY||"scroll"===M.overflowY)),I=y&&(Math.abs(b-n)<=r&&I+x<S)-(Math.abs(g-n)<=r&&!!I),f=E&&(Math.abs(m-l)<=r&&f+w<C)-(Math.abs(v-l)<=r&&!!f);if(!Je[h])for(var D=0;D<=h;D++)Je[D]||(Je[D]={});Je[h].vx==I&&Je[h].vy==f&&Je[h].el===p||(Je[h].el=p,Je[h].vx=I,Je[h].vy=f,clearInterval(Je[h].pid),0==I&&0==f||(c=true,Je[h].pid=setInterval(function(){o&&0===this.layer&&Re.active._onTouchMove(Ye);var t=Je[this.layer].vy?Je[this.layer].vy*a:0,i=Je[this.layer].vx?Je[this.layer].vx*a:0;"function"==typeof s&&"continue"!==s.call(Re.dragged.parentNode[j],i,t,e,Ye,Je[this.layer].el)||O(Je[this.layer].el,i,t)}.bind({layer:h}),24))),h++}while(t.bubbleScroll&&u!==d&&(u=z(u,false)));Ke=c}}),30),p=function(e){var t=e.originalEvent,i=e.putSortable,o=e.dragEl,s=e.activeSortable,n=e.dispatchSortableEvent,l=e.hideGhostForTarget,e=e.unhideGhostForTarget;t&&(s=i||s,l(),t=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:t,t=document.elementFromPoint(t.clientX,t.clientY),e(),s&&!s.el.contains(t)&&(n("spill"),this.onSpill({dragEl:o,putSortable:i})))};function st(){}function nt(){}st.prototype={startIndex:null,dragStart:function(e){e=e.oldDraggableIndex;this.startIndex=e},onSpill:function(e){var t=e.dragEl,i=e.putSortable;this.sortable.captureAnimationState(),i&&i.captureAnimationState();e=I(this.sortable.el,this.startIndex,this.options);e?this.sortable.el.insertBefore(t,e):this.sortable.el.appendChild(t),this.sortable.animateAll(),i&&i.animateAll()},drop:p},o(st,{pluginName:"revertOnSpill"}),nt.prototype={onSpill:function(e){var t=e.dragEl,e=e.putSortable||this.sortable;e.captureAnimationState(),t.parentNode&&t.parentNode.removeChild(t),e.animateAll()},drop:p},o(nt,{pluginName:"removeOnSpill"});var lt,rt,at,dt,ct,ht=[],ut=[],pt=false,ft=false,vt=false;function mt(e,t){ut.forEach((function(i,o){o=t.children[i.sortableIndex+(e?Number(o):0)];o?t.insertBefore(i,o):t.appendChild(i)}))}function gt(){ht.forEach((function(e){e!==at&&e.parentNode&&e.parentNode.removeChild(e)}))}return Re.mount(new function(){function e(){for(var e in this.defaults={scroll:true,forceAutoScrollFallback:false,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:true},this)"_"===e.charAt(0)&&"function"==typeof this[e]&&(this[e]=this[e].bind(this))}return e.prototype={dragStarted:function(e){e=e.originalEvent;this.sortable.nativeDraggable?v(document,"dragover",this._handleAutoScroll):this.options.supportPointer?v(document,"pointermove",this._handleFallbackAutoScroll):e.touches?v(document,"touchmove",this._handleFallbackAutoScroll):v(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(e){e=e.originalEvent;this.options.dragOverBubble||e.rootEl||this._handleAutoScroll(e)},drop:function(){this.sortable.nativeDraggable?m(document,"dragover",this._handleAutoScroll):(m(document,"pointermove",this._handleFallbackAutoScroll),m(document,"touchmove",this._handleFallbackAutoScroll),m(document,"mousemove",this._handleFallbackAutoScroll)),tt(),et(),clearTimeout(w),w=void 0},nulling:function(){Ye=Qe=$e=Ke=Xe=We=Ge=null,Je.length=0},_handleFallbackAutoScroll:function(e){this._handleAutoScroll(e,true)},_handleAutoScroll:function(e,t){var i,o=this,s=(e.touches?e.touches[0]:e).clientX,n=(e.touches?e.touches[0]:e).clientY,l=document.elementFromPoint(s,n);Ye=e,t||this.options.forceAutoScrollFallback||d||a||h?(ot(e,this.options,l,t),i=z(l,true),!Ke||Xe&&s===We&&n===Ge||(Xe&&tt(),Xe=setInterval((function(){var l=z(document.elementFromPoint(s,n),true);l!==i&&(i=l,et()),ot(e,o.options,l,t)}),10),We=s,Ge=n)):this.options.bubbleScroll&&z(l,true)!==q()?ot(e,this.options,z(l,false),false):et()}},o(e,{pluginName:"scroll",initializeByDefault:true})}),Re.mount(nt,st),Re.mount(new function(){function e(){this.defaults={swapClass:"sortable-swap-highlight"}}return e.prototype={dragStart:function(e){e=e.dragEl;it=e},dragOverValid:function(e){var t=e.completed,i=e.target,o=e.onMove,s=e.activeSortable,n=e.changed,l=e.cancel;s.options.swap&&(e=this.sortable.el,s=this.options,i&&i!==e&&(e=it,it=false!==o(i)?(E(i,s.swapClass,true),i):null,e&&e!==it&&E(e,s.swapClass,false)),n(),t(true),l())},drop:function(e){var t,i,o=e.activeSortable,s=e.putSortable,n=e.dragEl,l=s||this.sortable,r=this.options;it&&E(it,r.swapClass,false),it&&(r.swap||s&&s.options.swap)&&n!==it&&(l.captureAnimationState(),l!==o&&o.captureAnimationState(),i=it,e=(t=n).parentNode,r=i.parentNode,e&&r&&!e.isEqualNode(i)&&!r.isEqualNode(t)&&(s=L(t),n=L(i),e.isEqualNode(r)&&s<n&&n++,e.insertBefore(i,e.children[s]),r.insertBefore(t,r.children[n])),l.animateAll(),l!==o&&o.animateAll())},nulling:function(){it=null}},o(e,{pluginName:"swap",eventProperties:function(){return{swapItem:it}}})}),Re.mount(new function(){function e(e){for(var t in this)"_"===t.charAt(0)&&"function"==typeof this[t]&&(this[t]=this[t].bind(this));e.options.avoidImplicitDeselect||(e.options.supportPointer?v(document,"pointerup",this._deselectMultiDrag):(v(document,"mouseup",this._deselectMultiDrag),v(document,"touchend",this._deselectMultiDrag))),v(document,"keydown",this._checkKeyDown),v(document,"keyup",this._checkKeyUp),this.defaults={selectedClass:"sortable-selected",multiDragKey:null,avoidImplicitDeselect:false,setData:function(t,i){var o="";ht.length&&rt===e?ht.forEach((function(e,t){o+=(t?", ":"")+e.textContent})):o=i.textContent,t.setData("Text",o)}}}return e.prototype={multiDragKeyDown:false,isMultiDrag:false,delayStartGlobal:function(e){e=e.dragEl;at=e},delayEnded:function(){this.isMultiDrag=~ht.indexOf(at)},setupClone:function(e){var t=e.sortable,e=e.cancel;if(this.isMultiDrag){for(var i=0;i<ht.length;i++)ut.push(_(ht[i])),ut[i].sortableIndex=ht[i].sortableIndex,ut[i].draggable=false,ut[i].style["will-change"]="",E(ut[i],this.options.selectedClass,false),ht[i]===at&&E(ut[i],this.options.chosenClass,false);t._hideClone(),e()}},clone:function(e){var t=e.sortable,i=e.rootEl,o=e.dispatchSortableEvent,e=e.cancel;this.isMultiDrag&&(this.options.removeCloneOnHide||ht.length&&rt===t&&(mt(true,i),o("clone"),e()))},showClone:function(e){var t=e.cloneNowShown,i=e.rootEl,e=e.cancel;this.isMultiDrag&&(mt(false,i),ut.forEach((function(e){k(e,"display","")})),t(),ct=false,e())},hideClone:function(e){var t=this,i=e.cloneNowHidden,e=e.cancel;this.isMultiDrag&&(ut.forEach((function(e){k(e,"display","none"),t.options.removeCloneOnHide&&e.parentNode&&e.parentNode.removeChild(e)})),i(),ct=true,e())},dragStartGlobal:function(e){!this.isMultiDrag&&rt&&rt.multiDrag._deselectMultiDrag(),ht.forEach((function(e){e.sortableIndex=L(e)})),ht=ht.sort((function(e,t){return e.sortableIndex-t.sortableIndex})),vt=true},dragStarted:function(e){var t,i=this,e=e.sortable;this.isMultiDrag&&(this.options.sort&&(e.captureAnimationState(),this.options.animation&&(ht.forEach((function(e){e!==at&&k(e,"position","absolute")})),t=T(at,false,true,true),ht.forEach((function(e){e!==at&&V(e,t)})),pt=ft=true)),e.animateAll((function(){pt=ft=false,i.options.animation&&ht.forEach((function(e){A(e)})),i.options.sort&>()})))},dragOver:function(e){var t=e.target,i=e.completed,e=e.cancel;ft&&~ht.indexOf(t)&&(i(false),e())},revert:function(e){var t,i,o=e.fromSortable,s=e.rootEl,n=e.sortable,l=e.dragRect;1<ht.length&&(ht.forEach((function(e){n.addAnimationState({target:e,rect:ft?T(e):l}),A(e),e.fromRect=l,o.removeAnimationState(e)})),ft=false,t=!this.options.removeCloneOnHide,i=s,ht.forEach((function(e,o){o=i.children[e.sortableIndex+(t?Number(o):0)];o?i.insertBefore(e,o):i.appendChild(e)})))},dragOverCompleted:function(e){var t,i=e.sortable,o=e.isOwner,s=e.insertion,n=e.activeSortable,l=e.parentEl,r=e.putSortable,e=this.options;s&&(o&&n._hideClone(),pt=false,e.animation&&1<ht.length&&(ft||!o&&!n.options.sort&&!r)&&(t=T(at,false,true,true),ht.forEach((function(e){e!==at&&(V(e,t),l.appendChild(e))})),ft=true),o||(ft||gt(),1<ht.length?(o=ct,n._showClone(i),n.options.animation&&!ct&&o&&ut.forEach((function(e){n.addAnimationState({target:e,rect:dt}),e.fromRect=dt,e.thisAnimationDuration=null}))):n._showClone(i)))},dragOverAnimationCapture:function(e){var t=e.dragRect,i=e.isOwner,e=e.activeSortable;ht.forEach((function(e){e.thisAnimationDuration=null})),e.options.animation&&!i&&e.multiDrag.isMultiDrag&&(dt=o({},t),t=S(at,true),dt.top-=t.f,dt.left-=t.e)},dragOverAnimationComplete:function(){ft&&(ft=false,gt())},drop:function(e){var t,i,o,s,n,l,r,a=e.originalEvent,d=e.rootEl,c=e.parentEl,h=e.sortable,u=e.dispatchSortableEvent,p=e.oldIndex,e=e.putSortable,f=e||this.sortable;a&&(t=this.options,i=c.children,vt||(t.multiDragKey&&!this.multiDragKeyDown&&this._deselectMultiDrag(),E(at,t.selectedClass,!~ht.indexOf(at)),~ht.indexOf(at)?(ht.splice(ht.indexOf(at),1),lt=null,$({sortable:h,rootEl:d,name:"deselect",targetEl:at,originalEvent:a})):(ht.push(at),$({sortable:h,rootEl:d,name:"select",targetEl:at,originalEvent:a}),a.shiftKey&<&&h.el.contains(lt)?(o=L(lt),s=L(at),~o&&~s&&o!==s&&function(){for(var e,n=o<s?(e=o,s):(e=s,o+1),l=t.filter;e<n;e++)~ht.indexOf(i[e])||x(i[e],t.draggable,c,false)&&(l&&("function"==typeof l?l.call(h,a,i[e],h):l.split(",").some((function(t){return x(i[e],t.trim(),c,false)})))||(E(i[e],t.selectedClass,true),ht.push(i[e]),$({sortable:h,rootEl:d,name:"select",targetEl:i[e],originalEvent:a})))}()):lt=at,rt=f)),vt&&this.isMultiDrag&&(ft=false,(c[j].options.sort||c!==d)&&1<ht.length&&(n=T(at),l=L(at,":not(."+this.options.selectedClass+")"),!pt&&t.animation&&(at.thisAnimationDuration=null),f.captureAnimationState(),pt||(t.animation&&(at.fromRect=n,ht.forEach((function(e){var t;e.thisAnimationDuration=null,e!==at&&(t=ft?T(e):n,e.fromRect=t,f.addAnimationState({target:e,rect:t}))}))),gt(),ht.forEach((function(e){i[l]?c.insertBefore(e,i[l]):c.appendChild(e),l++})),p===L(at)&&(r=false,ht.forEach((function(e){e.sortableIndex!==L(e)&&(r=true)})),r&&(u("update"),u("sort")))),ht.forEach((function(e){A(e)})),f.animateAll()),rt=f),(d===c||e&&"clone"!==e.lastPutMode)&&ut.forEach((function(e){e.parentNode&&e.parentNode.removeChild(e)})))},nullingGlobal:function(){this.isMultiDrag=vt=false,ut.length=0},destroyGlobal:function(){this._deselectMultiDrag(),m(document,"pointerup",this._deselectMultiDrag),m(document,"mouseup",this._deselectMultiDrag),m(document,"touchend",this._deselectMultiDrag),m(document,"keydown",this._checkKeyDown),m(document,"keyup",this._checkKeyUp)},_deselectMultiDrag:function(e){if(!(void 0!==vt&&vt||rt!==this.sortable||e&&x(e.target,this.options.draggable,this.sortable.el,false)||e&&0!==e.button))for(;ht.length;){var t=ht[0];E(t,this.options.selectedClass,false),ht.shift(),$({sortable:this.sortable,rootEl:this.sortable.el,name:"deselect",targetEl:t,originalEvent:e})}},_checkKeyDown:function(e){e.key===this.options.multiDragKey&&(this.multiDragKeyDown=true)},_checkKeyUp:function(e){e.key===this.options.multiDragKey&&(this.multiDragKeyDown=false)}},o(e,{pluginName:"multiDrag",utils:{select:function(e){var t=e.parentNode[j];t&&t.options.multiDrag&&!~ht.indexOf(e)&&(rt&&rt!==t&&(rt.multiDrag._deselectMultiDrag(),rt=t),E(e,t.options.selectedClass,true),ht.push(e))},deselect:function(e){var t=e.parentNode[j],i=ht.indexOf(e);t&&t.options.multiDrag&&~i&&(E(e,t.options.selectedClass,false),ht.splice(i,1))}},eventProperties:function(){var e=this,t=[],i=[];return ht.forEach((function(o){var s;t.push({multiDragElement:o,index:o.sortableIndex}),s=ft&&o!==at?-1:ft?L(o,":not(."+e.options.selectedClass+")"):L(o),i.push({multiDragElement:o,index:s})})),{items:n(ht),clones:[].concat(ut),oldIndicies:t,newIndicies:i}},optionListeners:{multiDragKey:function(e){return"ctrl"===(e=e.toLowerCase())?e="Control":1<e.length&&(e=e.charAt(0).toUpperCase()+e.substr(1)),e}}})}),Re}))})(ge);return ge.exports}var ye=we();var Ee=R(ye);const ke='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-roles{display:block;max-width:600px;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-template-roles .roles{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:10px;margin-top:10px}verdocs-template-roles .roles .sequence{gap:10px;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;font-weight:500;padding:0 0 8px 0;-ms-flex-direction:row;flex-direction:row;border-bottom:1px dotted #e3e3e3}verdocs-template-roles .roles .sequence.add-sequence{color:#777777;line-height:34px}verdocs-template-roles .roles .sequence-label{font-size:18px;line-height:32px}verdocs-template-roles .roles .sequence-roles{gap:10px;display:-ms-flexbox;display:flex;position:relative;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-direction:row;flex-direction:row}verdocs-template-roles .roles .role{height:32px;cursor:move;display:-ms-flexbox;display:flex;max-width:200px;position:relative;border-radius:32px;background-color:#eff7fb;-webkit-box-sizing:border-box;box-sizing:border-box;padding:0 14px 0 34px;border:1px solid #ccc;-ms-flex-direction:column;flex-direction:column}verdocs-template-roles .roles .role .role-name{font-size:14px;overflow:hidden;font-weight:400;line-height:30px;white-space:nowrap;text-overflow:ellipsis}verdocs-template-roles .roles .role .icons{position:absolute;left:1px;top:-3px;cursor:pointer;padding:5px;z-index:10}verdocs-template-roles .roles .role .icons .gear-button{display:none;-webkit-transform:scale(1.1);transform:scale(1.1);margin:4px 0 0 1px}verdocs-template-roles .roles .role .icons .type-icon{opacity:0.6;display:block;-webkit-transform:scale(0.8);transform:scale(0.8)}verdocs-template-roles .roles .role .icons:hover .gear-button{display:block}verdocs-template-roles .roles .role .icons:hover .type-icon{display:none}verdocs-template-roles>form{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;background-color:#ffffff;padding:12px}verdocs-template-roles>form h5{font-size:16px;font-weight:bold;color:#46497d;margin:0 0 10px 0}verdocs-template-roles>form label{display:block;font-size:14px;font-weight:500;margin:0 0 4px 0;color:#5c6575}verdocs-template-roles>form input{border:none;font-size:18px;padding:3px 6px 3px 0;background:transparent;border-bottom:1px solid #33364b}verdocs-template-roles>form input:focus{outline:none}verdocs-template-roles .row.add-sequence{display:none}verdocs-template-roles .add-role{opacity:0.3;padding:0 10px;cursor:pointer;background:none;height:32px;border:1px solid #cccccc;border-radius:32px}verdocs-template-roles .add-role:hover{opacity:1}verdocs-template-roles .add-step{margin:0;padding:0;border:none;opacity:0.5;cursor:pointer;background:none}verdocs-template-roles .add-step:hover{opacity:1}verdocs-template-roles .add-step svg{width:32px;height:32px}verdocs-template-roles.dragging .row.add-sequence{display:-ms-flexbox;display:flex}verdocs-template-roles .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;margin-top:16px;-ms-flex-direction:row;flex-direction:row}verdocs-template-roles .empty{font-size:13px;margin-top:15px;margin-bottom:5px}verdocs-template-roles .empty svg{width:16px;height:16px;stroke:#666666;margin-bottom:2px;display:inline-block}verdocs-template-roles .sequence-roles{display:-ms-flexbox;display:flex;max-width:400px}verdocs-template-roles ::-webkit-input-placeholder{color:#aaaaaa}verdocs-template-roles ::-moz-placeholder{color:#aaaaaa}verdocs-template-roles :-ms-input-placeholder{color:#aaaaaa}verdocs-template-roles ::-ms-input-placeholder{color:#aaaaaa}verdocs-template-roles ::placeholder{color:#aaaaaa}';const Se='<svg xmlns="http://www.w3.org/2000/svg" height="20" width="20" fill="#00000089"><path d="m8.021 17.917-.313-2.5q-.27-.125-.625-.334-.354-.208-.625-.395l-2.312.979-1.979-3.438 1.979-1.5q-.021-.167-.031-.364-.011-.198-.011-.365 0-.146.011-.344.01-.198.031-.385l-1.979-1.5 1.979-3.417 2.312.958q.271-.187.615-.385t.635-.344l.313-2.5h3.958l.313 2.5q.312.167.625.344.312.177.604.385l2.333-.958 1.979 3.417-1.979 1.521q.021.187.021.364V10q0 .146-.01.333-.011.188-.011.396l1.958 1.5-1.979 3.438-2.312-.979q-.292.208-.615.395-.323.188-.614.334l-.313 2.5Zm1.937-5.355q1.063 0 1.813-.75t.75-1.812q0-1.062-.75-1.812t-1.813-.75q-1.041 0-1.802.75-.76.75-.76 1.812t.76 1.812q.761.75 1.802.75Zm0-1.333q-.5 0-.864-.364-.365-.365-.365-.865t.365-.865q.364-.364.864-.364t.865.364q.365.365.365.865t-.365.865q-.365.364-.865.364ZM10.021 10Zm-.854 6.583h1.666l.25-2.187q.605-.167 1.136-.49.531-.323 1.031-.802l2.021.875.854-1.375-1.792-1.354q.105-.333.136-.635.031-.303.031-.615 0-.292-.031-.573-.031-.281-.115-.635l1.792-1.396-.834-1.375-2.062.875q-.438-.438-1.021-.781-.583-.344-1.125-.49l-.271-2.208H9.167l-.271 2.208q-.584.146-1.125.458-.542.313-1.042.792l-2.021-.854-.833 1.375 1.75 1.354q-.083.333-.125.646-.042.312-.042.604t.042.594q.042.302.125.635l-1.75 1.375.833 1.375 2.021-.854q.479.458 1.021.771.542.312 1.146.479Z"/></svg>';const Ce=`<svg xmlns="http://www.w3.org/2000/svg" fill="#ffffff" viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor"><path strokeLinecap="round" strokeLinejoin="round" d="M12 9v6m3-3H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z" /></svg>`;const qe='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path d="m9.225 21.225 4.65-4.65h8.45v4.65Zm-5.35-2.2H5.05l8.5-8.5-1.175-1.175-8.5 8.5Zm14.25-9.95L13.8 4.8l1.325-1.325q.625-.65 1.525-.663.9-.012 1.6.663l1.225 1.175q.675.675.663 1.562-.013.888-.663 1.513ZM16.7 10.55 6 21.225H1.675V16.9L12.35 6.225Zm-3.725-.625-.6-.575 1.175 1.175Z"/></svg>';const Te=`<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill-rule="evenodd" d="M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12zm13.36-1.814a.75.75 0 10-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 00-1.06 1.06l2.25 2.25a.75.75 0 001.14-.094l3.75-5.25z" clip-rule="evenodd" /></svg>`;const Me=`<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path d="M1.5 8.67v8.58a3 3 0 003 3h15a3 3 0 003-3V8.67l-8.928 5.493a3 3 0 01-3.144 0L1.5 8.67z" /><path d="M22.5 6.908V6.75a3 3 0 00-3-3h-15a3 3 0 00-3 3v.158l9.714 5.978a1.5 1.5 0 001.572 0L22.5 6.908z" /></svg>`;const Ie=class{constructor(i){e(this,i);this.next=t(this,"next");this.exit=t(this,"exit");this.sdkError=t(this,"sdkError");this.rolesUpdated=t(this,"rolesUpdated");this.templateListenerId=null;this.endpoint=l.getDefault();this.templateId="";this.showingRoleDialog=null;this.sender=null;this.dragging=false;this.loading=true;this.template=null;this.sortableRefs=[]}disconnectedCallback(){this.unlistenToTemplate();this.cleanupSortables()}async listenToTemplate(){console.log("[ROLES] Loading template",this.templateId);this.unlistenToTemplate();E.subscribe("templates",this.templateId,(()=>r(this.endpoint,this.templateId)),false,(e=>{console.log("[ROLES] Template Updated",e);this.template=e;this.loading=false}))}unlistenToTemplate(){if(this.templateListenerId){E.store.delListener(this.templateListenerId);this.templateListenerId=null}}async componentWillLoad(){var e,t,i;try{this.endpoint.loadSession();if(!this.templateId){console.log(`[ROLES] Missing required template ID ${this.templateId}`);return}if(!this.endpoint.session){console.log("[ROLES] Unable to start builder session, must be authenticated");return}this.listenToTemplate()}catch(o){console.log("[ROLES] Error with preview session",o);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new y(o.message,(t=o.response)===null||t===void 0?void 0:t.status,(i=o.response)===null||i===void 0?void 0:i.data))}}cleanupSortables(){this.sortableRefs.forEach((e=>e.destroy()));this.sortableRefs.length=0}componentDidRender(){this.cleanupSortables();const e=this.getSequenceNumbers();(e||[]).forEach((e=>{const t=document.getElementById(`verdocs-roles-sequence-${e}`);if(t){const e=new Ee(t,{group:"roles",animation:150,dragoverBubble:true,filter:".no-drag",onEnd:this.handleMoveEnd.bind(this),onChoose:()=>this.dragging=true,onUnchoose:()=>this.dragging=false});this.sortableRefs.push(e)}}));const t=document.getElementById(`verdocs-roles-sequence-add-target`);if(t){console.log("[ROLES] Applying sortable to add-sequence slot");const e=new Ee(t,{group:"roles",animation:150,dragoverBubble:true,filter:".no-drag",onEnd:this.handleMoveEnd.bind(this),onChoose:()=>this.dragging=true,onUnchoose:()=>this.dragging=false});this.sortableRefs.push(e)}}handleMoveEnd(e){const t=+e.from.dataset.sequence;const i=+e.to.dataset.sequence;const o=+e.oldIndex+1;const s=+e.newIndex+1;console.log(`Move from ${t}:${o} to ${i}:${s}`,e.item);const n={};const l=this.getSequenceNumbers();l.forEach((e=>{const t=this.getRolesAtSequence(e);n[String(e)]=JSON.parse(JSON.stringify(t))}));n[l[l.length-1]+1]=[];const r=n[t].splice(o-1,1)[0];n[i]||(n[i]=[]);n[i].splice(s-1,0,r);const a=[];Object.entries(n).forEach((([e,t])=>{t.forEach(((t,i)=>{if(!t){return}const o=+i+1;if(t.sequence!==+e||t.order!==o){t.sequence=+e;t.order=o;a.push(b(this.endpoint,this.templateId,t.name,{sequence:+e,order:o}).then((e=>console.log("[ROLES] Updated role",t.name,e))).catch((e=>console.log("[ROLES] Error updating role",e))))}}))}));return Promise.all(a).then((async()=>console.log("[ROLES] Done renumbering"))).catch((e=>console.log("[ROLES] Error updating roles",e)))}handleCancel(){var e;(e=this.exit)===null||e===void 0?void 0:e.emit()}handleSubmit(){var e;(e=this.next)===null||e===void 0?void 0:e.emit()}getSortedRoles(){var e;return(((e=this.template)===null||e===void 0?void 0:e.roles)||[]).sort(((e,t)=>e.sequence===t.sequence?e.order-t.order:e.sequence-t.sequence))}getSequenceNumbers(){const e={};this.getSortedRoles().forEach((t=>{e[t.sequence]=true}));console.log("[ROLES] Sequences",e);return Object.keys(e).map((e=>+e)).sort(((e,t)=>e-t))}getRoleNames(){const e=this.getSortedRoles();return e.map((e=>e.name))}getRolesAtSequence(e){var t;return(((t=this.template)===null||t===void 0?void 0:t.roles)||[]).filter((t=>t&&t.sequence===e))}async renumberTemplateRoles(){var e;const t={};const i=[];const o=this.getSequenceNumbers();(o||[]).forEach((e=>{(t[e]||[]).forEach(((t,o)=>{const s=+o+1;if(t.sequence!==+e||t.order!==s){console.log("[ROLES] Updating role",t.name,"from",t.sequence,t.order,"to",e,s);t.sequence=+e;t.order=s;i.push(b(this.endpoint,this.templateId,t.name,{sequence:+e,order:s}).then((e=>console.log("[ROLES] Updated role",t.name,e))).catch((e=>console.log("[ROLES] Error updating role",e))))}}))}));console.log(`[ROLES] Awaiting ${i.length} renumber requests`);await Promise.all(i).then((async()=>{const e=JSON.parse(JSON.stringify(this.template));e.roles=Object.keys(t).reduce(((e,i)=>e.concat(t[i])),[]);console.log("[ROLES] Done renumbering",e.roles.map((e=>({name:e.name,sequence:e.sequence,order:e.order}))));E.updateTemplate(this.templateId,e)}));(e=this.rolesUpdated)===null||e===void 0?void 0:e.emit({event:"updated",endpoint:this.endpoint,templateId:this.templateId,roles:this.getSortedRoles()})}getNextRoleName(){var e,t;let i="";let o=(((e=this.template)===null||e===void 0?void 0:e.roles)||[]).length;do{o++;i=`Recipient ${o}`}while(!i||(((t=this.template)===null||t===void 0?void 0:t.roles)||[]).some((e=>e&&e.name===i)));return i}callCreateRole(e,t,i){console.log("[ROLES] Will create role",{name:e,sequence:t,order:i});x(this.endpoint,this.templateId,{template_id:this.templateId,name:e,sequence:t,message:"",order:i,full_name:null,first_name:"",last_name:"",email:"",phone:"",type:"signer",delegator:false}).then((async e=>{var t;console.log("[ROLES] Created role",e);console.log("Updating template in data store");await E.getTemplate(this.endpoint,this.templateId,true);(t=this.rolesUpdated)===null||t===void 0?void 0:t.emit({event:"added",endpoint:this.endpoint,templateId:this.templateId,roles:this.getSortedRoles()})})).catch((e=>{console.log("[ROLES] Error creating role",e)}))}handleAddRole(e,t){e.stopPropagation();const i=this.getRolesAtSequence(t).length+1;const o=this.getNextRoleName();this.callCreateRole(o,t,i)}handleAddStep(e,t){e.stopPropagation();const i=1;const o=this.getNextRoleName();this.callCreateRole(o,t,i)}render(){if(!this.endpoint.session){return i(o,null,i("verdocs-component-error",{message:"You must be authenticated to use this module."}))}if(this.loading||!this.template){return i(o,{class:"loading"},i("verdocs-loader",null))}const e=this.getRoleNames();const t=this.getSequenceNumbers();const s=t&&t.length>0?(t[t.length-1]||0)+1:1;console.log("[ROLES] Rendering",{roleNames:e,sequences:t,nextSequence:s});return i(o,{class:{dragging:this.dragging}},i("form",{onSubmit:e=>e.preventDefault(),onClick:e=>e.stopPropagation(),autocomplete:"off"},i("h5",null,"Roles and Workflow"),i("div",{class:"roles"},t.map(((e,t)=>i("div",{class:"sequence"},i("div",{class:"sequence-label no-drag"},t+1,"."),i("div",{class:"sequence-roles",id:`verdocs-roles-sequence-${e}`,"data-sequence":e},this.getRolesAtSequence(e).map((t=>{const o=!t.email||!t.first_name||!t.last_name;return o?i("div",{class:"role","data-rolename":t.name,"data-sequence":e,"data-order":t.order},i("div",{class:"role-name"},t.name),i("div",{class:"icons"},i("div",{class:"gear-button",innerHTML:Se,onClick:()=>this.showingRoleDialog=t.name,"aria-role":"button"}),i("span",{class:"type-icon",innerHTML:t.type==="signer"?qe:t.type==="cc"?Me:Te}))):i("div",{class:"role","data-rolename":t.name,"data-sequence":e,"data-order":t.order},i("div",{class:"role-name"},u(t)),i("div",{class:"icons"},i("div",{class:"gear-button",innerHTML:Se,onClick:()=>this.showingRoleDialog=t.name,"aria-role":"button"}),i("span",{class:"type-icon",innerHTML:t.type==="signer"?qe:t.type==="cc"?Me:Te})))}))),i("button",{class:"add-role no-drag",onClick:t=>this.handleAddRole(t,e)},"+ Add Role")))),i("div",{class:"sequence add-sequence"},i("div",{class:"sequence-label no-drag"},t.length+1,"."),i("div",{class:"sequence-roles",id:`verdocs-roles-sequence-add-target`,"data-sequence":s}),i("button",{class:"add-role no-drag",onClick:e=>this.handleAddRole(e,s)},"+ Add Role"))),e.length<1&&i("div",{class:"empty"},"You must add at least one Role before proceeding.",i("br",null)," Click the ",i("span",{innerHTML:Ce})," Add button above to get started."),i("div",{class:"buttons"},i("div",{class:"flex-fill"}),i("verdocs-button",{variant:"outline",label:"Cancel",size:"small",onClick:()=>this.handleCancel()}),i("verdocs-button",{label:"OK",size:"small",onClick:()=>this.handleSubmit(),disabled:e.length<1}))),this.showingRoleDialog&&i("verdocs-menu-panel",{onClose:()=>this.showingRoleDialog=null},i("verdocs-template-role-properties",{endpoint:this.endpoint,templateId:this.templateId,roleName:this.showingRoleDialog,onClose:()=>{var e;(e=document.getElementById("verdocs-menu-panel-overlay"))===null||e===void 0?void 0:e.remove();this.showingRoleDialog=null},onDelete:async()=>{var e;this.showingRoleDialog=null;await this.renumberTemplateRoles();(e=this.rolesUpdated)===null||e===void 0?void 0:e.emit({event:"deleted",endpoint:this.endpoint,templateId:this.templateId,roles:this.getSortedRoles()})}})))}get el(){return n(this)}};Ie.style=ke;const De='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-settings{display:block;max-width:600px;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-template-settings>form{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;background-color:#ffffff;padding:12px}verdocs-template-settings>form h5{font-size:16px;font-weight:bold;color:#46497d;margin:0 0 10px 0}verdocs-template-settings>form label{display:block;font-size:14px;font-weight:500;margin:0 0 4px 0;color:#5c6575}verdocs-template-settings>form input{border:none;font-size:18px;padding:3px 6px 3px 0;background:transparent;border-bottom:1px solid #33364b}verdocs-template-settings>form input:focus{outline:none}verdocs-template-settings>form .row{margin:20px 0 0 0}verdocs-template-settings .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;margin-top:16px;-ms-flex-direction:row;flex-direction:row}verdocs-template-settings ::-webkit-input-placeholder{color:#aaaaaa}verdocs-template-settings ::-moz-placeholder{color:#aaaaaa}verdocs-template-settings :-ms-input-placeholder{color:#aaaaaa}verdocs-template-settings ::-ms-input-placeholder{color:#aaaaaa}verdocs-template-settings ::placeholder{color:#aaaaaa}';const Le=24*60*60*1e3;const He=class{constructor(i){e(this,i);this.next=t(this,"next");this.exit=t(this,"exit");this.sdkError=t(this,"sdkError");this.templateUpdated=t(this,"templateUpdated");this.templateListenerId=null;this.endpoint=l.getDefault();this.templateId="";this.name=null;this.visibility="private";this.sender="envelope_creator";this.sendReminders=false;this.initialReminder=0;this.followupReminders=0;this.dirty=false;this.loading=true;this.template=null}disconnectedCallback(){this.unlistenToTemplate()}async listenToTemplate(){console.log("[SETTINGS] Loading template",this.templateId);this.unlistenToTemplate();E.subscribe("templates",this.templateId,(()=>r(this.endpoint,this.templateId)),false,(e=>{console.log("[SETTINGS] Template Updated",e);this.template=e;this.name=e.name;this.visibility=e.visibility;this.sender=e.sender;this.sendReminders=e.initial_reminder!==null;this.initialReminder=e.initial_reminder?Math.floor(e.initial_reminder/Le):null;this.followupReminders=e.followup_reminders?Math.floor(e.followup_reminders/Le):null;this.dirty=false;this.loading=false}))}unlistenToTemplate(){if(this.templateListenerId){E.store.delListener(this.templateListenerId);this.templateListenerId=null}}async componentWillLoad(){var e,t,i;try{this.endpoint.loadSession();if(!this.templateId){console.log(`[SETTINGS] Missing required template ID ${this.templateId}`);return}if(!this.endpoint.session){console.log("[SETTINGS] Unable to start builder session, must be authenticated");return}this.listenToTemplate()}catch(o){console.log("[SETTINGS] Error with preview session",o);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new y(o.message,(t=o.response)===null||t===void 0?void 0:t.status,(i=o.response)===null||i===void 0?void 0:i.data))}}handleCancel(){var e;(e=this.exit)===null||e===void 0?void 0:e.emit()}handleSubmit(){w(this.endpoint,this.templateId,{name:this.name,visibility:this.visibility,sender:this.sender,initial_reminder:this.sendReminders?this.initialReminder*Le:null,followup_reminders:this.sendReminders?this.followupReminders*Le:null}).then((e=>{var t,i;console.log("[SETTINGS] Template Updated",e);this.dirty=false;this.name=e.name;this.visibility=e.visibility;this.sender=e.sender;this.sendReminders=e.initial_reminder!==null;this.initialReminder=e.initial_reminder?Math.floor(e.initial_reminder/Le):null;this.followupReminders=e.followup_reminders?Math.floor(e.followup_reminders/Le):null;(t=this.templateUpdated)===null||t===void 0?void 0:t.emit({endpoint:this.endpoint,template:e,event:"update"});(i=this.next)===null||i===void 0?void 0:i.emit()})).catch((e=>{var t,i,o,s,n;console.log("[SETTINGS] Error updating template",e);(t=this.sdkError)===null||t===void 0?void 0:t.emit(new y(e.message,(i=e.response)===null||i===void 0?void 0:i.status,(o=e.response)===null||o===void 0?void 0:o.data));S(((n=(s=e.response)===null||s===void 0?void 0:s.data)===null||n===void 0?void 0:n.error)||"Error updating template, please try again later.")}))}render(){if(!this.endpoint.session){return i(o,null,i("verdocs-component-error",{message:"You must be authenticated to use this module."}))}if(this.loading||!this.template){return i(o,{class:"loading"},i("verdocs-loader",null))}return i(o,null,i("form",{onSubmit:e=>e.preventDefault(),onClick:e=>e.stopPropagation(),autocomplete:"off"},i("h5",null,"Settings"),i("div",{class:"row"},i("verdocs-text-input",{id:"verdocs-field-name",label:"Template Name",value:this.name,autocomplete:"off",placeholder:"Template Name...",onInput:e=>{this.name=e.target.value;this.dirty=true}})),i("div",{class:"row"},i("verdocs-select-input",{label:"Visibility",value:this.visibility,onInput:e=>{this.visibility=e.target.value;this.dirty=true},options:[{value:"private",label:"Private"},{value:"shared",label:"Shared"},{value:"public",label:"Public"}]})),i("div",{class:"row"},i("verdocs-select-input",{label:"Owner for envelopes created from this template",value:this.sender,onInput:e=>{this.sender=e.target.value;this.dirty=true},options:[{value:"envelope_creator",label:"Envelope Creator"},{value:"template_owner",label:"Template Owner"}]})),i("div",{class:"row"},i("label",null,"Send Reminders"),i("verdocs-switch",{checked:this.sendReminders,onCheckedChange:e=>this.sendReminders=e.detail})),this.sendReminders&&i("div",{class:"row"},i("verdocs-text-input",{id:"verdocs-field-name",label:"First Reminder (days)",value:String(this.initialReminder||0),autocomplete:"off",placeholder:"Delay in days...",onInput:e=>{this.initialReminder=+e.target.value;this.dirty=true}})),this.sendReminders&&i("div",{class:"row"},i("verdocs-text-input",{id:"verdocs-field-name",label:"Follow-up Reminders (days)",value:String(this.followupReminders||0),autocomplete:"off",placeholder:"Delay in days...",onInput:e=>{this.followupReminders=+e.target.value;this.dirty=true}})),i("div",{class:"buttons"},i("verdocs-button",{variant:"outline",label:"Cancel",size:"small",onClick:()=>this.handleCancel()}),i("verdocs-button",{label:"Save",size:"small",onClick:()=>this.handleSubmit(),disabled:!this.dirty}))))}get el(){return n(this)}};He.style=De;export{U as verdocs_preview,Y as verdocs_send,J as verdocs_template_attachments,oe as verdocs_template_build_tabs,me as verdocs_template_fields,Ie as verdocs_template_roles,He as verdocs_template_settings};
|
3
|
-
//# sourceMappingURL=p-
|
1
|
+
import{r as e,c as t,h as i,H as o,F as s,g as n}from"./p-CF7i8guW.js";import{VerdocsEndpoint as l,getTemplate as r,integerSequence as a,getOrganizationContacts as d,isValidEmail as c,createEnvelope as h,formatFullName as u,getRGBA as p,createTemplateDocument as f,deleteTemplateDocument as v,updateField as m,createField as g,updateTemplateRole as b,createTemplateRole as x,updateTemplate as w}from"@verdocs/js-sdk";import{S as y}from"./p-C1sRVZWv.js";import{S as E}from"./p-DmsV595e.js";import{D as k}from"./p-C_Xku1v2.js";import{V as S}from"./p-CyvDgtoV.js";import{D as C,P as q,J as T,a as M,F as I,b as D,T as L}from"./p-7LXbcjVz.js";import{d as H}from"./p-dzBXqXlK.js";import{i as z}from"./p-CGNX5HqF.js";import{g as N,e as O,f as Z,h as _,i as V,j as A}from"./p-fL0BKEnm.js";import{g as R}from"./p-BFTU3MAI.js";import"./p-Dl7Xw8F0.js";const U='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-preview{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif;display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;min-height:200px;position:relative;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-preview div,verdocs-preview canvas{-webkit-box-sizing:border-box;box-sizing:border-box}';const j=class{constructor(i){e(this,i);this.sdkError=t(this,"sdkError");this.templateListenerId=null;this.endpoint=l.getDefault();this.templateId=null;this.loading=true;this.template=null}disconnectedCallback(){this.unlistenToTemplate()}async listenToTemplate(){this.unlistenToTemplate();E.subscribe("templates",this.templateId,(()=>r(this.endpoint,this.templateId)),false,(e=>{this.template=e;this.loading=false}))}unlistenToTemplate(){if(this.templateListenerId){E.store.delListener(this.templateListenerId);this.templateListenerId=null}}onTemplateIdChanged(e){console.log("[PREVIEW] Template ID changed",e);this.listenToTemplate()}async componentWillLoad(){var e,t,i;try{this.endpoint.loadSession();if(!this.endpoint.session){console.log("[PREVIEW] Unable to start builder session, must be authenticated");return}if(!this.templateId){console.log(`[PREVIEW] Missing required template ID ${this.templateId}`);return}this.listenToTemplate()}catch(o){console.log("[PREVIEW] Error with preview session",o);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new y(o.message,(t=o.response)===null||t===void 0?void 0:t.status,(i=o.response)===null||i===void 0?void 0:i.data))}}handlePageRendered(e){}render(){var e;if(this.loading){return i(o,null,i("verdocs-loader",null))}return i(o,null,(((e=this.template)===null||e===void 0?void 0:e.documents)||[]).map((e=>{const t=a(1,e.pages);return i(s,null,t.map((t=>{var o;const s=((o=e.page_sizes)===null||o===void 0?void 0:o[t])||{width:612,height:792};return i("verdocs-template-document-page",{templateId:e.template_id,documentId:e.id,pageNumber:t,disabled:true,editable:false,done:false,virtualWidth:s.width,virtualHeight:s.height,onPageRendered:e=>this.handlePageRendered(e),layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]})})))})))}static get watchers(){return{templateId:["onTemplateIdChanged"]}}};j.style=U;const B=e=>((e===null||e===void 0?void 0:e.roles)||[]).map((e=>e.name));const P=(e,t)=>Math.max(B(e).findIndex((e=>e===t)),0);const F='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-send{padding:10px;position:relative;background:#ffffff;-ms-flex-direction:column;flex-direction:column;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-send.sendable{display:-ms-flexbox;display:flex}verdocs-send .recipients{position:relative}verdocs-send .left-line{top:32px;left:20px;z-index:1;width:12px;bottom:30px;position:absolute;background:#ffffff;border-left:3px dotted #9b9b9b}verdocs-send .level{display:-ms-flexbox;display:flex;-webkit-column-gap:10px;-moz-column-gap:10px;column-gap:10px;margin-left:50px;position:relative;-ms-flex-direction:row;flex-direction:row;padding:8px 0 4px 0;border-bottom:1px solid rgba(151, 151, 151, 0.2666666667)}verdocs-send .level .level-icon{top:14px;z-index:2;left:-40px;width:24px;height:24px;position:absolute;background:#ffffff}verdocs-send .level .level-icon svg{fill:rgba(0, 0, 0, 0.537254902)}verdocs-send .level .recipient{height:30px;display:-ms-flexbox;display:flex;-ms-flex:0 0 30px;flex:0 0 30px;color:#000000;cursor:pointer;font-size:14px;-ms-flex-align:center;align-items:center;border-radius:30px;-ms-flex-direction:row;flex-direction:row;background:#dddddd;white-space:nowrap;border:2px solid #dddddd;padding:2px 10px 2px 14px}verdocs-send .level .recipient .icon{width:22px;height:22px;-ms-flex:0 0 22px;flex:0 0 22px;margin:0 0 0 10px}verdocs-send .level .recipient .icon svg{width:22px;height:22px;fill:#333333;outline:none}verdocs-send .level .complete{-ms-flex:1;flex:1;height:30px;display:-ms-flexbox;display:flex;color:#000000;font-size:14px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;padding:3px 10px 3px 2px}verdocs-send .buttons{display:-ms-flexbox;display:flex;margin-top:10px;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-ms-flex-direction:row;flex-direction:row}verdocs-send verdocs-contact-picker{left:0;top:41px;z-index:10;position:absolute;border:1px solid #dddddd;-webkit-box-shadow:0 0 6px 3px rgba(0, 0, 0, 0.1);box-shadow:0 0 6px 3px rgba(0, 0, 0, 0.1)}';const $='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="M3 17.25V21h3.75L17.81 9.94l-3.75-3.75L3 17.25zM20.71 7.04c.39-.39.39-1.02 0-1.41l-2.34-2.34a.9959.9959 0 0 0-1.41 0l-1.83 1.83 3.75 3.75 1.83-1.83z"></path></svg>';const Q='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="M2 12C2 6.48 6.48 2 12 2s10 4.48 10 10-4.48 10-10 10S2 17.52 2 12zm10 6c3.31 0 6-2.69 6-6s-2.69-6-6-6-6 2.69-6 6 2.69 6 6 6z"></path></svg>';const W='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"></path></svg>';const G='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="m18 7-1.41-1.41-6.34 6.34 1.41 1.41L18 7zm4.24-1.41L11.66 16.17 7.48 12l-1.41 1.41L11.66 19l12-12-1.42-1.41zM.41 13.41 6 19l1.41-1.41L1.83 12 .41 13.41z"></path></svg>';const Y=class{constructor(i){e(this,i);this.beforeSend=t(this,"beforeSend");this.send=t(this,"send");this.exit=t(this,"exit");this.sdkError=t(this,"sdkError");this.searchContacts=t(this,"searchContacts");this.templateListenerId=null;this.endpoint=k;this.templateId=null;this.environment="";this.containerId=`verdocs-send-${Math.random().toString(36).substring(2,11)}`;this.showPickerForId="";this.sessionContacts=[];this.sending=false;this.rolesCompleted={};this.loading=true;this.template=null}disconnectedCallback(){this.unlistenToTemplate()}async listenToTemplate(){console.log("[SEND] Loading template",this.templateId);this.unlistenToTemplate();E.subscribe("templates",this.templateId,(()=>r(this.endpoint,this.templateId)),true,(e=>{console.log("[SEND] Got new template",e);this.template=e;this.loading=false;this.rolesCompleted={};this.recomputeRolesCompleted()}))}unlistenToTemplate(){if(this.templateListenerId){E.store.delListener(this.templateListenerId);this.templateListenerId=null}}async reset(){this.rolesCompleted={}}onTemplateIdChanged(e){console.log("[SEND] Template ID changed",e);this.listenToTemplate()}async componentWillLoad(){var e,t,i;try{this.endpoint.onSessionChanged(((e,t,i)=>{if(!i){return}const o={id:i.id,first_name:i.first_name,last_name:i.last_name,email:i.email,phone:i.phone};if(i){this.sessionContacts=[o];d(this.endpoint).then((e=>{console.log("[SEND] Got contacts",e);this.sessionContacts=[...e,o]})).catch((e=>{console.log("[SEND] Error getting contacts",e)}))}}));this.endpoint.loadSession();if(!this.endpoint.session){console.log("[SEND] Unable to start Send operation, must be authenticated");return}if(!this.templateId){console.log(`[SEND] Missing required template ID ${this.templateId}`);return}this.listenToTemplate()}catch(o){console.log("[SEND] Error with send session",o);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new y(o.message,(t=o.response)===null||t===void 0?void 0:t.status,(i=o.response)===null||i===void 0?void 0:i.data))}}recomputeRolesCompleted(){var e;this.rolesCompleted={};const t={};(((e=this.template)===null||e===void 0?void 0:e.roles)||[]).forEach((e=>{const i=e.sequence;t[i]||(t[i]=[]);const o=`r-${i}-${t[i].length}`;t[i].push({...e,id:o,role_name:e.name,first_name:e.first_name,last_name:e.last_name});if(e.first_name&&c(e.email)){this.rolesCompleted[o]={...e,id:o,role_name:e.name,first_name:e.first_name,last_name:e.last_name}}}))}getSequenceNumbers(){var e;const t={};(((e=this.template)===null||e===void 0?void 0:e.roles)||[]).forEach((e=>{t[e.sequence]=true}));return Object.keys(t).map((e=>+e)).sort(((e,t)=>e-t))}getRolesAtLevel(e){var t;const i=(((t=this.template)===null||t===void 0?void 0:t.roles)||[]).filter((t=>t.sequence===e)).map(((t,i)=>({...t,id:`r-${e}-${i}`,role_name:t.name,first_name:t.first_name,last_name:t.last_name})));return i}getLevelIcon(e){if(e==="start"){return i("div",{class:"level-icon",innerHTML:Q})}else if(e==="end"){return i("div",{class:"level-icon",innerHTML:G})}else{return i("div",{class:"level-icon",innerHTML:W})}}handleSelectContact(e,t){e.preventDefault();this.rolesCompleted[t.id]={...t,...e.detail};this.showPickerForId=""}handleClickRole(e,t){e.stopPropagation();this.showPickerForId=t.id}handleSend(e){var t;if(this.sending){console.log("[SEND] Skipping duplicate send",e);return}console.log("[SEND] Sending",e);e.preventDefault();e.stopPropagation();this.sending=true;const i={template_id:this.templateId,name:((t=this.template)===null||t===void 0?void 0:t.name)||"New Envelope",environment:this.environment,initial_reminder:0,followup_reminders:0,recipients:Object.values(this.rolesCompleted)};const o=this.beforeSend.emit({...i,name:i.name,template:this.template});if(o.defaultPrevented){console.log("[SEND] Send cancelled by parent",i);this.sending=false;return}console.log("[SEND] Creating envelope",i);h(this.endpoint,i).then((e=>{var t;console.log("[SEND] Send envelope",e);this.reset().catch((e=>console.log("Unknown Error",e)));this.sending=false;(t=this.send)===null||t===void 0?void 0:t.emit({...i,name:i.name,envelope_id:e.id,envelope:e})})).catch((e=>{var t,i,o;console.log("[SEND] Send error",e);S(((i=(t=e.response)===null||t===void 0?void 0:t.data)===null||i===void 0?void 0:i.error)||"Error creating envelope, please try again later.");this.sending=false;(o=this.sdkError)===null||o===void 0?void 0:o.emit(e)}))}handleCancel(e){var t;e.stopPropagation();(t=this.exit)===null||t===void 0?void 0:t.emit()}render(){var e;if(this.loading){return i(o,null,i("verdocs-loader",null))}if(!this.endpoint.session){return i(o,{style:{display:"flex"}},i("verdocs-component-error",{message:"You must be authenticated to use this module."}))}const t=this.getSequenceNumbers();const s=Object.values(this.rolesCompleted).filter((e=>c(e.email)&&e.first_name&&e.last_name));const n=s.length>=B(this.template).length;return i(o,{class:{sendable:(e=this.template)===null||e===void 0?void 0:e.is_sendable}},i("div",{class:"recipients"},i("div",{class:"left-line"}),i("div",{class:`level level-start`},this.getLevelIcon("start"),i("div",{class:"complete"},"Send Envelope")),t.map((e=>i("div",{class:`level level-${e}`},this.getLevelIcon("sequence"),this.getRolesAtLevel(e).map((e=>{var t,o,n;const l=!e.email||!e.first_name||!e.last_name;const r=((t=this.rolesCompleted[e.id])===null||t===void 0?void 0:t.first_name)?u(this.rolesCompleted[e.id]):l?e.role_name:u(e);const a=`verdocs-send-recipient-${e.role_name}`;const d=P(this.template,e.role_name);const c=p(d);const h=s.findIndex((t=>t.role_name===e.role_name))>-1;const f={backgroundColor:c,border:h?"2px solid #55bc81":"2px solid #dddddd"};return l?i("div",{class:"recipient","data-ri":d,"data-rn":e.role_name,style:f,onClick:t=>this.handleClickRole(t,e),id:a},r,i("div",{class:"icon",innerHTML:$}),this.showPickerForId===e.id&&i("verdocs-portal",{anchor:a,onClickAway:()=>this.showPickerForId=""},i("verdocs-contact-picker",{onExit:()=>this.showPickerForId="",onNext:t=>this.handleSelectContact(t,e),contactSuggestions:this.sessionContacts,templateRole:(o=this.rolesCompleted[e.id])!==null&&o!==void 0?o:e,onSearchContacts:e=>{var t;return(t=this.searchContacts)===null||t===void 0?void 0:t.emit(e.detail)}}))):i("div",{class:"recipient","data-ri":d,"data-rn":e.role_name,style:f,onClick:t=>this.handleClickRole(t,e),id:a},r,i("div",{class:"icon",innerHTML:$}),this.showPickerForId===e.id&&i("verdocs-portal",{anchor:a,onClickAway:()=>this.showPickerForId=""},i("verdocs-contact-picker",{onExit:()=>this.showPickerForId="",onNext:t=>this.handleSelectContact(t,e),contactSuggestions:this.sessionContacts,templateRole:(n=this.rolesCompleted[e.id])!==null&&n!==void 0?n:e,onSearchContacts:e=>{var t;return(t=this.searchContacts)===null||t===void 0?void 0:t.emit(e.detail)}})))}))))),i("div",{class:`level level-done`},this.getLevelIcon("end"),i("div",{class:"complete"},"Signing Complete"))),i("div",{class:"buttons"},i("verdocs-button",{label:"Cancel",size:"small",variant:"outline",onClick:e=>this.handleCancel(e),disabled:this.sending}),i("verdocs-button",{label:"Send",size:"small",disabled:!n||this.sending,onClick:e=>this.handleSend(e)}),this.sending&&i("verdocs-spinner",null)))}static get watchers(){return{templateId:["onTemplateIdChanged"]}}};Y.style=F;const X='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-attachments{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-template-attachments h5{font-size:16px;font-weight:bold;margin:0 0 10px 0;color:#46497d}verdocs-template-attachments .attachments{margin:0 0 40px 0}verdocs-template-attachments .attachment{display:-ms-flexbox;display:flex;padding:5px 0;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;color:#33364b}verdocs-template-attachments .attachment:hover .trash-icon{display:-ms-flexbox;display:flex}verdocs-template-attachments .attachment:hover .pages{display:none}verdocs-template-attachments svg{width:28px;height:28px;fill:#5c6575;margin:2px 0 0 0}verdocs-template-attachments .file-icon{-ms-flex:0;flex:0}verdocs-template-attachments .pages{width:24px;height:24px;-ms-flex:0 0 24px;flex:0 0 24px;padding-left:4px;position:relative;margin:-10px 0 0 0}verdocs-template-attachments .pages .pages-icon{top:0;left:0;width:24px;height:24px;position:absolute}verdocs-template-attachments .pages .count{top:11px;left:7px;z-index:1;width:18px;font-size:12px;font-weight:500;position:absolute;text-align:center;letter-spacing:-2px}verdocs-template-attachments .filename{-ms-flex:1;flex:1;display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;border-bottom:1px dotted #cccccc}verdocs-template-attachments .trash-icon{-ms-flex:0;flex:0;display:none}verdocs-template-attachments .trash-icon:hover{cursor:pointer}verdocs-template-attachments verdocs-file-chooser{margin:10px 0;border:2px dashed #979797}verdocs-template-attachments .loader-wrapper{background-color:#ffffff;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;position:relative;width:320px;height:320px;text-align:center;border:2px dashed #979797;-ms-flex-pack:end;justify-content:flex-end}verdocs-template-attachments .progress-wrapper{padding:20px}verdocs-template-attachments .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;margin-top:16px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:end;justify-content:flex-end}verdocs-template-attachments .buttons .flex-fill{-ms-flex:1;flex:1}verdocs-template-attachments ::-webkit-input-placeholder{color:#aaaaaa}verdocs-template-attachments ::-moz-placeholder{color:#aaaaaa}verdocs-template-attachments :-ms-input-placeholder{color:#aaaaaa}verdocs-template-attachments ::-ms-input-placeholder{color:#aaaaaa}verdocs-template-attachments ::placeholder{color:#aaaaaa}';const J=class{constructor(i){e(this,i);this.exit=t(this,"exit");this.next=t(this,"next");this.templateUpdated=t(this,"templateUpdated");this.sdkError=t(this,"sdkError");this.templateListenerId=null;this.endpoint=l.getDefault();this.templateId="";this.uploading=false;this.progressLabel="Uploading...";this.progressPercent=0;this.showDeleteError=false;this.confirmDeleteDocument=null;this.loading=true;this.template=null}async componentWillLoad(){var e,t,i;try{this.endpoint.loadSession();if(!this.templateId){console.log(`[ROLES] Missing required template ID ${this.templateId}`);return}if(!this.endpoint.session){console.log("[ROLES] Unable to start builder session, must be authenticated");return}this.listenToTemplate()}catch(o){console.log("[TEMPLATE ATTACHMENTS] Error loading template",o);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new y(o.message,(t=o.response)===null||t===void 0?void 0:t.status,(i=o.response)===null||i===void 0?void 0:i.data))}}disconnectedCallback(){this.unlistenToTemplate()}async listenToTemplate(){this.unlistenToTemplate();E.subscribe("templates",this.templateId,(()=>r(this.endpoint,this.templateId)),false,(e=>{this.template=e;this.loading=false}))}unlistenToTemplate(){if(this.templateListenerId){E.store.delListener(this.templateListenerId);this.templateListenerId=null}}handleCancel(e){e.stopPropagation();this.exit.emit()}handleUploadProgress(e){if(e>=99){this.progressPercent=100;this.progressLabel="Processing..."}else{this.progressPercent=e}}async handleUpload(e){var t,i,o,s;e.stopPropagation();const n=e.detail.file;if(!n){return}console.log("[ATTACHMENTS] Uploading...",n);this.uploading=true;this.progressLabel="Uploading...";try{const e=await f(this.endpoint,this.templateId,n,this.handleUploadProgress.bind(this));console.log("[ATTACHMENTS] Created attachment",e);this.template=await E.getTemplate(this.endpoint,this.templateId,true);console.log("[ATTACHMENTS] Updated template",this.template);(t=this.templateUpdated)===null||t===void 0?void 0:t.emit({endpoint:this.endpoint,template:this.template,event:"attachments"});this.uploading=false;this.progressLabel="";this.progressPercent=0}catch(e){console.log("[ATTACHMENTS] Error creating template",e);(i=this.sdkError)===null||i===void 0?void 0:i.emit(new y(e.message,(o=e.response)===null||o===void 0?void 0:o.status,(s=e.response)===null||s===void 0?void 0:s.data));this.uploading=false}}handleNext(e){var t;e.stopPropagation();this.uploading=false;this.progressLabel="";this.progressPercent=0;(t=this.next)===null||t===void 0?void 0:t.emit({template:this.template})}async confirmDelete(){await v(this.endpoint,this.templateId,this.confirmDeleteDocument.id);this.template=await E.getTemplate(this.endpoint,this.templateId,true);console.log("[ATTACHMENTS] New template",this.template);this.confirmDeleteDocument=null}async handleDelete(e){var t;if((((t=this.template)===null||t===void 0?void 0:t.documents)||[]).length>1){this.confirmDeleteDocument=e}else{this.showDeleteError=true}}getFileIcon(e){switch(e.mime){case"application/pdf":return M;case"image/jpeg":return T;case"image/png":return q;case"application/msword":case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return C}return I}render(){var e,t;if(!this.endpoint.session){return i(o,null,i("verdocs-component-error",{message:"You must be authenticated to use this module."}))}if(this.loading){return i(o,{class:"loading"},i("verdocs-loader",null))}if(!this.endpoint.session||!this.template){return i(o,{class:"empty"})}return i(o,null,i("h5",null,"Existing Attachments"),i("div",{class:"attachments"},(((e=this.template)===null||e===void 0?void 0:e.documents)||[]).map((e=>i("div",{class:"attachment"},i("div",{class:"file-icon",innerHTML:this.getFileIcon(e)}),i("div",{class:"filename",title:e.name},e.name),i("div",{class:"pages"},i("div",{class:"count"},e.pages),i("div",{class:"pages-icon",innerHTML:D})),i("div",{class:"trash-icon",innerHTML:L,onClick:()=>this.handleDelete(e)}))))),i("h5",null,"Attach a New Document"),this.uploading?i("div",{class:"loader-wrapper"},i("verdocs-loader",null),this.progressLabel&&i("div",{class:"progress-wrapper"},i("verdocs-progress-bar",{showPercent:true,percent:this.progressPercent,label:this.progressLabel}))):i("verdocs-file-chooser",{onFileSelected:e=>this.handleUpload(e)}),i("div",{class:"buttons"},i("verdocs-button",{variant:"outline",label:"Cancel",size:"small",onClick:e=>this.handleCancel(e),disabled:this.uploading}),i("verdocs-button",{label:"Next",size:"small",onClick:e=>this.handleNext(e),disabled:!(((t=this.template)===null||t===void 0?void 0:t.documents)||[]).length||this.uploading})),this.showDeleteError&&i("verdocs-ok-dialog",{heading:"Unable to Delete Attachment",message:"Templates must contain at least one attachment.",onNext:()=>this.showDeleteError=false}),this.confirmDeleteDocument&&i("verdocs-ok-dialog",{heading:"Delete this Attachment?",message:"This operation cannot be undone. All fields placed<br />on the deleted attachment will also be removed.",onNext:()=>this.confirmDelete(),showCancel:true,onExit:()=>{this.confirmDeleteDocument=null}}))}};J.style=X;const K='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-build-tabs{-ms-flex:1;flex:1;gap:15px;display:-ms-flexbox;display:flex;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-template-build-tabs verdocs-button-panel svg{-webkit-transform:scale(0.8);transform:scale(0.8)}verdocs-template-build-tabs verdocs-template-attachments,verdocs-template-build-tabs verdocs-template-roles{margin:20px}verdocs-template-build-tabs verdocs-template-fields{border-top:1px solid #777777}verdocs-template-build-tabs verdocs-template-attachments{padding:20px;background:#ffffff}verdocs-template-build-tabs verdocs-template-fields{width:100%}verdocs-template-build-tabs verdocs-preview{-ms-flex:1;flex:1}.template-details-panel .row{display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;gap:8px;margin:10px 0}.template-details-panel label{-ms-flex:0 0 70px;flex:0 0 70px}.template-details-panel .value{-ms-flex:1;flex:1;font-weight:300;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.template-details-panel .icon-button{cursor:pointer;opacity:0.8;-ms-flex:0;flex:0;width:18px;height:18px}.template-details-panel .icon-button svg{stroke:#000000;width:18px;height:18px}.template-details-panel .icon-button:hover{opacity:1}';const ee='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" fill="#5c6575"><path d="M11.925 18q.55 0 .938-.387.387-.388.387-.938 0-.55-.387-.925-.388-.375-.938-.375-.55 0-.925.375t-.375.925q0 .55.375.938.375.387.925.387Zm-.95-3.85h1.95q0-.8.2-1.287.2-.488 1.025-1.288.65-.625 1.025-1.213.375-.587.375-1.437 0-1.425-1.025-2.175Q13.5 6 12.1 6q-1.425 0-2.35.775t-1.275 1.85l1.775.7q.125-.45.55-.975.425-.525 1.275-.525.725 0 1.1.412.375.413.375.888 0 .475-.287.9-.288.425-.713.775-1.075.95-1.325 1.475-.25.525-.25 1.875ZM12 22.2q-2.125 0-3.988-.8-1.862-.8-3.237-2.175Q3.4 17.85 2.6 15.988 1.8 14.125 1.8 12t.8-3.988q.8-1.862 2.175-3.237Q6.15 3.4 8.012 2.6 9.875 1.8 12 1.8t3.988.8q1.862.8 3.237 2.175Q20.6 6.15 21.4 8.012q.8 1.863.8 3.988t-.8 3.988q-.8 1.862-2.175 3.237Q17.85 20.6 15.988 21.4q-1.863.8-3.988.8Zm0-2.275q3.325 0 5.625-2.3t2.3-5.625q0-3.325-2.3-5.625T12 4.075q-3.325 0-5.625 2.3T4.075 12q0 3.325 2.3 5.625t5.625 2.3ZM12 12Z"/></svg>';const te=`<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5"><path stroke-linecap="round" stroke-linejoin="round" d="M15.75 17.25v3.375c0 .621-.504 1.125-1.125 1.125h-9.75a1.125 1.125 0 0 1-1.125-1.125V7.875c0-.621.504-1.125 1.125-1.125H6.75a9.06 9.06 0 0 1 1.5.124m7.5 10.376h3.375c.621 0 1.125-.504 1.125-1.125V11.25c0-4.46-3.243-8.161-7.5-8.876a9.06 9.06 0 0 0-1.5-.124H9.375c-.621 0-1.125.504-1.125 1.125v3.5m7.5 10.375H9.375a1.125 1.125 0 0 1-1.125-1.125v-9.25m12 6.625v-1.875a3.375 3.375 0 0 0-3.375-3.375h-1.5a1.125 1.125 0 0 1-1.125-1.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H9.75" /></svg>`;const ie=["attachments","roles","settings","fields","preview"];const oe=class{constructor(i){e(this,i);this.sdkError=t(this,"sdkError");this.stepChanged=t(this,"stepChanged");this.templateListenerId=null;this.endpoint=l.getDefault();this.templateId=null;this.step="preview";this.loading=true;this.template=null}disconnectedCallback(){this.unlistenToTemplate()}async listenToTemplate(){this.unlistenToTemplate();E.subscribe("templates",this.templateId,(()=>r(this.endpoint,this.templateId)),false,(e=>{this.template=e;this.loading=false}))}unlistenToTemplate(){if(this.templateListenerId){E.store.delListener(this.templateListenerId);this.templateListenerId=null}}onTemplateIdChanged(e){console.log("[BUILD_TABS] Template ID changed",e);this.listenToTemplate()}onStepChanged(e){console.log("[BUILD_TABS] Step changed",e)}async componentWillLoad(){var e,t,i;try{this.endpoint.loadSession();if(!this.endpoint.session){console.log("[BUILD_TABS] Unable to start builder session, must be authenticated");return}if(!this.templateId){this.step="attachments";console.log("[BUILD_TABS] Missing required template ID, forcing view to attachments");return}this.listenToTemplate()}catch(o){console.log("[BUILD_TABS] Error loading template",o);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new y(o.message,(t=o.response)===null||t===void 0?void 0:t.status,(i=o.response)===null||i===void 0?void 0:i.data))}}setStep(e){var t;console.log("[BUILD_TABS] Selected step",e.detail.tab.id);e.stopPropagation();e.preventDefault();this.step=e.detail.tab.id;(t=this.stepChanged)===null||t===void 0?void 0:t.emit(e.detail.tab.id)}copyTemplateId(){navigator.clipboard.writeText(this.templateId).then((()=>{S("Template ID copied",{style:"success",duration:3e3})})).catch((e=>{var t;console.warn("[BUILD_TABS] Error copying to clipboard",e);(t=this.sdkError)===null||t===void 0?void 0:t.emit(e)}))}render(){var e,t,s,n,l,r,a,d,c;if(this.loading){return i(o,null,i("verdocs-loader",null))}if(!this.endpoint.session){return i(o,null,i("verdocs-component-error",{message:"You must be authenticated to use this module."}))}const h=(((e=this.template)===null||e===void 0?void 0:e.documents)||[]).length>0;let u=h&&(((t=this.template)===null||t===void 0?void 0:t.roles)||[]).length>0;const p=u&&(((s=this.template)===null||s===void 0?void 0:s.fields)||[]).length>0;let f=Math.max(ie.indexOf(this.step),0);if(!p&&f>=4){f=3}if(!u&&f>=3){f=1}if(!h&&f>=1){f=0}return i(o,null,i("verdocs-tabs",{onSelectTab:e=>this.setStep(e),selectedTab:f,tabs:[{id:"attachments",disabled:false,label:"Attachment(s)"},{id:"roles",disabled:!h,label:"Roles"},{id:"settings",disabled:!u,label:"Settings"},{id:"fields",disabled:!u,label:"Fields"},{id:"preview",disabled:!p,label:"Preview/Send"}]}),this.templateId&&i("div",{class:"info"},i("verdocs-button-panel",{icon:ee},i("div",{class:"template-details-panel"},i("h6",null,"Template Details"),i("div",{class:"row"},i("label",null,"ID:"),i("div",{class:"value"},this.templateId),i("div",{class:"icon-button",innerHTML:te,onClick:()=>this.copyTemplateId()})),i("div",{class:"row"},i("label",null,"Name:"),i("div",{class:"value"},(n=this.template)===null||n===void 0?void 0:n.name)),i("div",{class:"row"},i("label",null,"Visibility:"),i("div",{class:"value"},((l=this.template)===null||l===void 0?void 0:l.is_public)?"Public":((r=this.template)===null||r===void 0?void 0:r.is_personal)?"Private":"Shared")),i("div",{class:"row"},i("label",null,"Created:"),i("div",{class:"value"},((a=this.template)===null||a===void 0?void 0:a.counter)?H.format(new Date((d=this.template)===null||d===void 0?void 0:d.created_at),"P p"):"")),i("div",{class:"row"},i("label",null,"Used:"),i("div",{class:"value"},(c=this.template)===null||c===void 0?void 0:c.counter," time(s)"))))))}static get watchers(){return{templateId:["onTemplateIdChanged"],step:["onStepChanged"]}}};oe.style=K;const se="@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-fields{font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif;position:relative;display:block;min-height:600px}verdocs-template-fields .page-0{padding:65px 15px 0 15px;-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-fields .page-0 .user-placed-fields{height:100px;position:relative;background:#ffffff;-webkit-box-shadow:0 0 10px 5px rgba(0, 0, 0, 0.0588235294);box-shadow:0 0 10px 5px rgba(0, 0, 0, 0.0588235294)}verdocs-template-fields .page-0 .user-placed-fields .title{top:0;left:0;color:#ffffff;font-size:12px;padding:3px 6px;font-weight:bold;position:absolute;background:#46497d}verdocs-template-fields .pages{display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;min-height:200px;position:relative;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-template-fields .pages div,verdocs-template-fields .pages canvas{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-fields #verdocs-template-fields-toolbar{width:100%;height:50px;display:-ms-flexbox;display:flex;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;font-weight:700;padding:0 20px 0 0;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;color:#f5f5fa;-ms-flex-pack:center;justify-content:center;background:#46497d}verdocs-template-fields #verdocs-template-fields-toolbar>verdocs-select-input{margin:0}verdocs-template-fields #verdocs-template-fields-toolbar svg{width:24px;height:24px}verdocs-template-fields #verdocs-template-fields-toolbar .add-for{margin:0;font-weight:500;color:#f5f5fa}verdocs-template-fields #verdocs-template-fields-toolbar verdocs-select-input{margin:0 20px 0 0}@media all and (max-width: 1000px){verdocs-template-fields #verdocs-template-fields-toolbar{-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;padding:0 10px 0 0}verdocs-template-fields #verdocs-template-fields-toolbar svg{-webkit-transform:scale(0.8);transform:scale(0.8)}verdocs-template-fields #verdocs-template-fields-toolbar .add-for,verdocs-template-fields #verdocs-template-fields-toolbar verdocs-select-input{display:none}}@media all and (max-width: 600px){verdocs-template-fields #verdocs-template-fields-toolbar{-webkit-column-gap:6px;-moz-column-gap:6px;column-gap:6px}verdocs-template-fields #verdocs-template-fields-toolbar svg{-webkit-transform:scale(0.6);transform:scale(0.6)}verdocs-template-fields #verdocs-template-fields-toolbar .separator,verdocs-template-fields #verdocs-template-fields-toolbar .add-for,verdocs-template-fields #verdocs-template-fields-toolbar verdocs-select-input{display:none}}verdocs-template-fields.placing-attachment{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-checkbox{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-date{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath fill='%23000000' d='M7.6 13.925q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375ZM5.3 22.85q-1.325 0-2.238-.912-.912-.913-.912-2.238V6.3q0-1.325.912-2.238.913-.912 2.238-.912H6v-2h2.575v2h6.85v-2H18v2h.7q1.325 0 2.238.912.912.913.912 2.238v13.4q0 1.325-.912 2.238-.913.912-2.238.912Zm0-3.15h13.4V10H5.3v9.7ZM5.3 8h13.4V6.3H5.3Zm0 0V6.3 8Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-dropdown{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24' stroke-width='1.5' stroke='currentColor'%3E%3Cpath stroke='%23000000' stroke-linecap='round' stroke-linejoin='round' d='M3 4.5h14.25M3 9h9.75M3 13.5h9.75m4.5-4.5v12m0 0l-3.75-3.75M17.25 21L21 17.25' /%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-initial{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M6.225 20.775V7h-5V3.225H15V7h-5v13.775Zm9.775 0v-8h-3V9h9.775v3.775h-3v8Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-payment{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-radio{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M12 17q2.075 0 3.538-1.463Q17 14.075 17 12t-1.462-3.538Q14.075 7 12 7 9.925 7 8.463 8.462 7 9.925 7 12q0 2.075 1.463 3.537Q9.925 17 12 17Zm0 5.85q-2.275 0-4.25-.85t-3.438-2.312Q2.85 18.225 2 16.25q-.85-1.975-.85-4.25T2 7.75q.85-1.975 2.312-3.438Q5.775 2.85 7.75 2q1.975-.85 4.25-.85t4.25.85q1.975.85 3.438 2.312Q21.15 5.775 22 7.75q.85 1.975.85 4.25T22 16.25q-.85 1.975-2.312 3.438Q18.225 21.15 16.25 22q-1.975.85-4.25.85Zm0-3.15q3.25 0 5.475-2.225Q19.7 15.25 19.7 12q0-3.25-2.225-5.475Q15.25 4.3 12 4.3q-3.25 0-5.475 2.225Q4.3 8.75 4.3 12q0 3.25 2.225 5.475Q8.75 19.7 12 19.7Zm0-7.7Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-signature{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m9.225 21.225 4.65-4.65h8.45v4.65Zm-5.35-2.2H5.05l8.5-8.5-1.175-1.175-8.5 8.5Zm14.25-9.95L13.8 4.8l1.325-1.325q.625-.65 1.525-.663.9-.012 1.6.663l1.225 1.175q.675.675.663 1.562-.013.888-.663 1.513ZM16.7 10.55 6 21.225H1.675V16.9L12.35 6.225Zm-3.725-.625-.6-.575 1.175 1.175Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-textarea{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M3.225 20.725v-3.15h11.55v3.15Zm0-4.775V12.8h17.55v3.15Zm0-4.75V8.05h17.55v3.15Zm0-4.775v-3.15h17.55v3.15Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-textbox{cursor:url(\"data:image/svg+xml,%3Csvg width='32' height='15' viewBox='0 0 32 15' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cmask id='path-1-inside-1_1401_24' fill='white'%3E%3Cpath d='M0 0H32V15H0V0Z'/%3E%3C/mask%3E%3Cpath d='M0 0H32V15H0V0Z' fill='%234C56CB' fill-opacity='0.1'/%3E%3Cpath d='M0 0V-1H-1V0H0ZM0 15H-1V16H0V15ZM0 1H32V-1H0V1ZM32 14H0V16H32V14ZM1 15V0H-1V15H1Z' fill='%234C56CB' mask='url(%23path-1-inside-1_1401_24)'/%3E%3Cpath d='M3 11.8V8.65H14.15V11.8H3ZM3 6.65V3.5H20.15V6.65H3Z' fill='%234C56CB'/%3E%3Cline x1='31.5' y1='1' x2='31.5' y2='14' stroke='%234C56CB' stroke-opacity='0.32' stroke-dasharray='1 1'/%3E%3C/svg%3E%0A\") 0 14, pointer}verdocs-template-fields.placing-timestamp{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath fill='%23000000' d='M9 1h6v2H9zm10.03 6.39 1.42-1.42c-.43-.51-.9-.99-1.41-1.41l-1.42 1.42C16.07 4.74 14.12 4 12 4c-4.97 0-9 4.03-9 9s4.02 9 9 9 9-4.03 9-9c0-2.12-.74-4.07-1.97-5.61zM13 14h-2V8h2v6z'%3E%3C/path%3E%3C/svg%3E\") 16 16, pointer}";const ne='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M3.425 16.15V13h11.15v3.15Zm0-5.15V7.85h17.15V11Z"/></svg>';const le='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z"/></svg>';const re='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M12 17q2.075 0 3.538-1.463Q17 14.075 17 12t-1.462-3.538Q14.075 7 12 7 9.925 7 8.463 8.462 7 9.925 7 12q0 2.075 1.463 3.537Q9.925 17 12 17Zm0 5.85q-2.275 0-4.25-.85t-3.438-2.312Q2.85 18.225 2 16.25q-.85-1.975-.85-4.25T2 7.75q.85-1.975 2.312-3.438Q5.775 2.85 7.75 2q1.975-.85 4.25-.85t4.25.85q1.975.85 3.438 2.312Q21.15 5.775 22 7.75q.85 1.975.85 4.25T22 16.25q-.85 1.975-2.312 3.438Q18.225 21.15 16.25 22q-1.975.85-4.25.85Zm0-3.15q3.25 0 5.475-2.225Q19.7 15.25 19.7 12q0-3.25-2.225-5.475Q15.25 4.3 12 4.3q-3.25 0-5.475 2.225Q4.3 8.75 4.3 12q0 3.25 2.225 5.475Q8.75 19.7 12 19.7Zm0-7.7Z"/></svg>';const ae='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M7.6 13.925q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375ZM5.3 22.85q-1.325 0-2.238-.912-.912-.913-.912-2.238V6.3q0-1.325.912-2.238.913-.912 2.238-.912H6v-2h2.575v2h6.85v-2H18v2h.7q1.325 0 2.238.912.912.913.912 2.238v13.4q0 1.325-.912 2.238-.913.912-2.238.912Zm0-3.15h13.4V10H5.3v9.7ZM5.3 8h13.4V6.3H5.3Zm0 0V6.3 8Z"/></svg>';const de='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="m9.225 21.225 4.65-4.65h8.45v4.65Zm-5.35-2.2H5.05l8.5-8.5-1.175-1.175-8.5 8.5Zm14.25-9.95L13.8 4.8l1.325-1.325q.625-.65 1.525-.663.9-.012 1.6.663l1.225 1.175q.675.675.663 1.562-.013.888-.663 1.513ZM16.7 10.55 6 21.225H1.675V16.9L12.35 6.225Zm-3.725-.625-.6-.575 1.175 1.175Z"/></svg>';const ce='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M6.225 20.775V7h-5V3.225H15V7h-5v13.775Zm9.775 0v-8h-3V9h9.775v3.775h-3v8Z"/></svg>';const he='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill="#ffffff" d="M9 1h6v2H9zm10.03 6.39 1.42-1.42c-.43-.51-.9-.99-1.41-1.41l-1.42 1.42C16.07 4.74 14.12 4 12 4c-4.97 0-9 4.03-9 9s4.02 9 9 9 9-4.03 9-9c0-2.12-.74-4.07-1.97-5.61zM13 14h-2V8h2v6z"></path></svg>';const ue='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24" stroke-width="1.5" stroke="currentColor"><path stroke="#ffffff" stroke-linecap="round" stroke-linejoin="round" d="M3 4.5h14.25M3 9h9.75M3 13.5h9.75m4.5-4.5v12m0 0l-3.75-3.75M17.25 21L21 17.25" /></svg>';const pe='<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6"><path stroke-linecap="round" stroke-linejoin="round" d="m18.375 12.739-7.693 7.693a4.5 4.5 0 0 1-6.364-6.364l10.94-10.94A3 3 0 1 1 19.5 7.372L8.552 18.32m.009-.01-.01.01m5.699-9.941-7.81 7.81a1.5 1.5 0 0 0 2.112 2.13" /></svg>';const fe='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 14.707 14.707"><g><rect x="6.275" y="0" fill="#ffffff7f" width="1" height="15"/></g></svg>';const ve=[{id:"signature",tooltip:"Signature",icon:de,class:"signature"},{id:"initial",tooltip:"Initials",icon:ce,class:"initial"},{id:"sep1",tooltip:"",icon:fe,class:"separator"},{id:"textbox",tooltip:"Text Box",icon:ne,class:"textbox"},{id:"checkbox",tooltip:"Check Box",icon:le,class:"checkbox"},{id:"radio",tooltip:"Radio Button",icon:re,class:"radio"},{id:"dropdown",tooltip:"Dropdown",icon:ue,class:"dropdown"},{id:"sep2",tooltip:"",icon:fe,class:"separator"},{id:"date",tooltip:"Date",icon:ae,class:"date"},{id:"timestamp",tooltip:"Timestamp",icon:he,class:"timestamp"},{id:"attachment",tooltip:"Attachment",icon:pe,class:"attachment"}];const me=class{constructor(i){e(this,i);this.sdkError=t(this,"sdkError");this.templateUpdated=t(this,"templateUpdated");this.fieldsUpdated=t(this,"fieldsUpdated");this.templateListenerId=null;this.endpoint=l.getDefault();this.templateId=null;this.toolbarTargetId=null;this.placing=null;this.showMustSelectRole=false;this.selectedRoleName="";this.loading=true;this.template=null;this.pageHeights={};this.cachedPageInfo={}}onTemplateIdChanged(){this.listenToTemplate()}handleKeyDown(e){if(e.key==="Escape"){this.placing=null}}async componentWillLoad(){var e,t,i;try{this.endpoint.loadSession();if(!this.templateId){console.log(`[FIELDS] Missing required template ID ${this.templateId}`);return}if(!this.endpoint.session){console.log("[FIELDS] Unable to start builder session, must be authenticated");return}this.listenToTemplate()}catch(o){console.log("[FIELDS] Error with fields session",o);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new y(o.message,(t=o.response)===null||t===void 0?void 0:t.status,(i=o.response)===null||i===void 0?void 0:i.data))}}componentDidRender(){z.dynamicDrop(true);const e=this.toolbarTargetId?document.getElementById(this.toolbarTargetId):null;const t=document.getElementById("verdocs-template-fields-toolbar");if(e&&t){console.log("[FIELDS] Moving toolbar");t.remove();e.append(t)}}componentWillUpdate(){var e,t;const i=((e=this.template)===null||e===void 0?void 0:e.roles)||[];if(!this.selectedRoleName||!i.find((e=>e&&e.name===this.selectedRoleName))){this.selectedRoleName=((t=i[0])===null||t===void 0?void 0:t.name)||"";console.log("[FIELDS] Selected new role",this.selectedRoleName)}}disconnectedCallback(){this.unlistenToTemplate()}async listenToTemplate(){this.unlistenToTemplate();E.subscribe("templates",this.templateId,(()=>r(this.endpoint,this.templateId)),false,(e=>{var t,i;this.template=e;this.loading=false;if(!this.selectedRoleName){this.selectedRoleName=((i=(t=e.roles)===null||t===void 0?void 0:t[0])===null||i===void 0?void 0:i.name)||""}}))}unlistenToTemplate(){if(this.templateListenerId){E.store.delListener(this.templateListenerId);this.templateListenerId=null}}attachFieldAttributes(e,t,i){i.addEventListener("settingsChanged",(()=>{var e;(e=this.templateUpdated)===null||e===void 0?void 0:e.emit({endpoint:this.endpoint,template:this.template,event:"added-field"})}));i.addEventListener("deleted",(()=>{var e;i.remove();(e=this.templateUpdated)===null||e===void 0?void 0:e.emit({endpoint:this.endpoint,template:this.template,event:"updated-field"})}));i.setAttribute("templateid",this.templateId);i.setAttribute("fieldname",t.name);i.setAttribute("pageNumber",String(e.pageNumber));i.setAttribute("xScale",String(e.xScale));i.setAttribute("yScale",String(e.yScale));i.setAttribute("name",t.name)}handlePageRendered(e){var t;const i=e.detail;this.cachedPageInfo[i.pageNumber]=i;this.pageHeights[i.pageNumber]=i.naturalHeight;(((t=this.template)===null||t===void 0?void 0:t.fields)||[]).filter((e=>e&&e.page===i.pageNumber)).forEach((e=>{const t=N(e);const i=document.getElementById(t);if(i){i.setAttribute("fieldname",e.name);i.setAttribute("pagenumber",String(e.page));this.makeDraggable(i)}}))}makeDraggable(e){z(e).draggable({listeners:{move:this.handleMoveField.bind(this),end:this.handleMoveEnd.bind(this)}})}async handleMoveField(e){const t=+(e.target.getAttribute("posX")||0);const i=+(e.target.getAttribute("posY")||0);const o=+(e.target.getAttribute("xScale")||1);const s=+(e.target.getAttribute("yScale")||1);const n=e.dx/o+t;const l=e.dy/s+i;e.target.setAttribute("posX",n);e.target.setAttribute("posy",l);O(e.target,"translate",`${n}px, ${l}px`)}async handleMoveEnd(e){var t,i,o,s,n,l,r,a;const d=e.target.getAttribute("fieldname");const c=(((t=this.template)===null||t===void 0?void 0:t.fields)||[]).find((e=>e.name===d));if(!c){console.log("[FIELDS] Unable to find field",d,e.target);return}const h=e.target.getAttribute("pagenumber");let{naturalWidth:u=612,naturalHeight:p=792,renderedHeight:f=792}=this.cachedPageInfo[h];const v=e.target.getBoundingClientRect();const g=e.target.parentElement;const b=g.getBoundingClientRect();const x=c.width||A(c.type);const w=c.height||V(c.type);const k=Math.max(v.left-b.left,0);let C=Math.max(f-(b.bottom-v.bottom),0);let q=parseInt(h);if(C>f){q=Math.min(q+1,((s=(o=((i=this.template)===null||i===void 0?void 0:i.documents)||[])===null||o===void 0?void 0:o[0])===null||s===void 0?void 0:s.pages)||1);C-=f;f=this.cachedPageInfo[q].renderedHeight;console.log("Next page",{newPageNumber:q,newY:C,renderedHeight:f})}else if(C<0){q=Math.max(q-1,1);f=this.cachedPageInfo[q].renderedHeight;C+=f;console.log("[FIELDS] Next page",{newPageNumber:q,newY:C,renderedHeight:f})}const{x:T,y:M}=this.viewCoordinatesToPageCoordinates(k,C,h,u-x,p-w);try{const t={x:T,y:M,page:q};const i=await m(this.endpoint,this.templateId,d,t);console.log("[FIELDS] Updated",i);const o=JSON.parse(JSON.stringify(this.template));const s=o.fields.findIndex((e=>e.name===d));if(s>-1){o.fields[s]=i}E.updateTemplate(this.templateId,o);e.target.removeAttribute("posX");e.target.removeAttribute("posY");Z(e.target);const{xScale:l=1,yScale:r=1}=this.cachedPageInfo[h];_(e.target,i,l,r);(n=this.templateUpdated)===null||n===void 0?void 0:n.emit({endpoint:this.endpoint,template:o,event:"updated-field"})}catch(t){S("Error updating field, please try again later",{style:"error"});console.log("[FIELDS] Error updating field",t);(l=this.sdkError)===null||l===void 0?void 0:l.emit(new y(t.message,(r=t.response)===null||r===void 0?void 0:r.status,(a=t.response)===null||a===void 0?void 0:a.data));e.target.removeAttribute("posX");e.target.removeAttribute("posY");Z(e.target)}}generateFieldName(e,t){var i;let o=1;let s;do{s=`${e}P${t}-${o}`;o++}while((((i=this.template)===null||i===void 0?void 0:i.fields)||[]).some((e=>e&&e.name===s)));return s}viewCoordinatesToPageCoordinates(e,t,i,o,s){const{xScale:n=1,yScale:l=1,renderedHeight:r=792}=this.cachedPageInfo[i];const a=Math.floor(Math.min(e/n,o));const d=Math.floor(Math.min(Math.max(r-t,0)/l,s));return{x:a,y:d}}async handleClickPage(e,t){var i;if(this.placing){const o=e.offsetX;const s=e.offsetY;const n=A(this.placing);const l=V(this.placing);const r=this.cachedPageInfo[t];const{naturalWidth:a=612,naturalHeight:d=792}=r;const c=this.viewCoordinatesToPageCoordinates(o,s,t,a-n,d-l);const h=Math.floor(c.x);const u=Math.floor(c.y);const p={name:this.generateFieldName(this.placing,t),role_name:this.selectedRoleName,template_id:this.templateId,document_id:r.documentId,type:this.placing,required:this.placing!=="radio",page:t,validator:null,label:null,default:null,placeholder:null,group:null,settings:{},x:h,y:u,width:n,height:l,multiline:false,readonly:false,options:this.placing==="radio"?[{id:"option-1",label:"Option 1"}]:[]};console.log("[FIELDS] Will save new field",p);const f=await g(this.endpoint,this.templateId,p);console.log("[FIELDS] Saved field",f);const v=JSON.parse(JSON.stringify(this.template));v.fields.push(f);E.updateTemplate(this.templateId,v);(i=this.templateUpdated)===null||i===void 0?void 0:i.emit({endpoint:this.endpoint,template:v,event:"added-field"});this.placing=null}}render(){var e,t,s;if(this.loading){return i(o,null,i("verdocs-loader",null))}if(!this.endpoint.session){return i(o,null,i("verdocs-component-error",{message:"You must be authenticated to use this module."}))}const n=(((e=this.template)===null||e===void 0?void 0:e.roles)||[]).map((e=>({value:e.name,label:e.full_name?`${e.name}: ${e.full_name}`:e.name})));return i(o,{class:this.placing?{[`placing-${this.placing}`]:true}:{},onSubmit:()=>{}},i("div",{id:"verdocs-template-fields-toolbar"},i("div",{class:"add-for"},"Add field:"),i("verdocs-select-input",{value:this.selectedRoleName,options:n,onInput:e=>this.selectedRoleName=e.target.value}),ve.map((e=>i("verdocs-toolbar-icon",{text:e.tooltip,icon:e.icon,class:e.class,onClick:()=>{if(e.tooltip){if(this.selectedRoleName){this.placing=e.id}else{this.showMustSelectRole=true}}}})))),i("div",{class:"pages"},(((t=this.template)===null||t===void 0?void 0:t.documents)||[]).map((e=>{const t=a(1,e.pages);return t.map((t=>{const o=e.page_sizes[t];return i("verdocs-template-document-page",{templateId:this.templateId,documentId:e.id,pageNumber:t,virtualWidth:(o===null||o===void 0?void 0:o.width)||612,virtualHeight:(o===null||o===void 0?void 0:o.height)||792,disabled:true,editable:true,done:false,onClick:e=>this.handleClickPage(e,t),onPageRendered:e=>this.handlePageRendered(e),layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]})}))}))),this.showMustSelectRole&&i("verdocs-ok-dialog",{heading:"Unable to add field",message:(((s=this.template)===null||s===void 0?void 0:s.roles)||[]).length>0?"Please select a role before adding fields.":"Please add at least one role before adding fields.",onNext:()=>this.showMustSelectRole=false}))}static get watchers(){return{templateId:["onTemplateIdChanged"]}}};me.style=se;var ge={exports:{}};
|
2
|
+
/*! Sortable 1.15.6 - MIT | git://github.com/SortableJS/Sortable.git */var be=ge.exports;var xe;function we(){if(xe)return ge.exports;xe=1;(function(e,t){!function(t,i){e.exports=i()}(be,(function(){function e(e,t){var i,o=Object.keys(e);return Object.getOwnPropertySymbols&&(i=Object.getOwnPropertySymbols(e),t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),o.push.apply(o,i)),o}function t(t){for(var i=1;i<arguments.length;i++){var o=null!=arguments[i]?arguments[i]:{};i%2?e(Object(o),true).forEach((function(e){var i,s;i=t,e=o[s=e],s in i?Object.defineProperty(i,s,{value:e,enumerable:true,configurable:true,writable:true}):i[s]=e})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(o)):e(Object(o)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(o,e))}))}return t}function i(e){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function o(){return(o=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i,o=arguments[t];for(i in o)Object.prototype.hasOwnProperty.call(o,i)&&(e[i]=o[i])}return e}).apply(this,arguments)}function s(e,t){if(null==e)return{};var i,o=function(e,t){if(null==e)return{};for(var i,o={},s=Object.keys(e),n=0;n<s.length;n++)i=s[n],0<=t.indexOf(i)||(o[i]=e[i]);return o}(e,t);if(Object.getOwnPropertySymbols)for(var s=Object.getOwnPropertySymbols(e),n=0;n<s.length;n++)i=s[n],0<=t.indexOf(i)||Object.prototype.propertyIsEnumerable.call(e,i)&&(o[i]=e[i]);return o}function n(e){return function(e){if(Array.isArray(e))return l(e)}(e)||function(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}(e)||function(e,t){if(e){if("string"==typeof e)return l(e,t);var i=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(i="Object"===i&&e.constructor?e.constructor.name:i)||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?l(e,t):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function l(e,t){(null==t||t>e.length)&&(t=e.length);for(var i=0,o=new Array(t);i<t;i++)o[i]=e[i];return o}function r(e){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(e)}var a=r(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),d=r(/Edge/i),c=r(/firefox/i),h=r(/safari/i)&&!r(/chrome/i)&&!r(/android/i),u=r(/iP(ad|od|hone)/i),p=r(/chrome/i)&&r(/android/i),f={capture:false,passive:false};function v(e,t,i){e.addEventListener(t,i,!a&&f)}function m(e,t,i){e.removeEventListener(t,i,!a&&f)}function g(e,t){if(t&&(">"===t[0]&&(t=t.substring(1)),e))try{if(e.matches)return e.matches(t);if(e.msMatchesSelector)return e.msMatchesSelector(t);if(e.webkitMatchesSelector)return e.webkitMatchesSelector(t)}catch(e){return}}function b(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function x(e,t,i,o){if(e){i=i||document;do{if(null!=t&&(">"!==t[0]||e.parentNode===i)&&g(e,t)||o&&e===i)return e}while(e!==i&&(e=b(e)))}return null}var w,y=/\s+/g;function E(e,t,i){var o;e&&t&&(e.classList?e.classList[i?"add":"remove"](t):(o=(" "+e.className+" ").replace(y," ").replace(" "+t+" "," "),e.className=(o+(i?" "+t:"")).replace(y," ")))}function k(e,t,i){var o=e&&e.style;if(o){if(void 0===i)return document.defaultView&&document.defaultView.getComputedStyle?i=document.defaultView.getComputedStyle(e,""):e.currentStyle&&(i=e.currentStyle),void 0===t?i:i[t];o[t=!(t in o||-1!==t.indexOf("webkit"))?"-webkit-"+t:t]=i+("string"==typeof i?"":"px")}}function S(e,t){var i="";if("string"==typeof e)i=e;else do{var o=k(e,"transform")}while(o&&"none"!==o&&(i=o+" "+i),!t&&(e=e.parentNode));var s=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return s&&new s(i)}function C(e,t,i){if(e){var o=e.getElementsByTagName(t),s=0,n=o.length;if(i)for(;s<n;s++)i(o[s],s);return o}return[]}function q(){var e=document.scrollingElement;return e||document.documentElement}function T(e,t,i,o,s){if(e.getBoundingClientRect||e===window){var n,l,r,d,c,h,u=e!==window&&e.parentNode&&e!==q()?(l=(n=e.getBoundingClientRect()).top,r=n.left,d=n.bottom,c=n.right,h=n.height,n.width):(r=l=0,d=window.innerHeight,c=window.innerWidth,h=window.innerHeight,window.innerWidth);if((t||i)&&e!==window&&(s=s||e.parentNode,!a))do{if(s&&s.getBoundingClientRect&&("none"!==k(s,"transform")||i&&"static"!==k(s,"position"))){var p=s.getBoundingClientRect();l-=p.top+parseInt(k(s,"border-top-width")),r-=p.left+parseInt(k(s,"border-left-width")),d=l+n.height,c=r+n.width;break}}while(s=s.parentNode);return o&&e!==window&&(o=(t=S(s||e))&&t.a,e=t&&t.d,t&&(d=(l/=e)+(h/=e),c=(r/=o)+(u/=o))),{top:l,left:r,bottom:d,right:c,width:u,height:h}}}function M(e,t,i){for(var o=z(e,true),s=T(e)[t];o;){var n=T(o)[i];if(!(n<=s))return o;if(o===q())break;o=z(o,false)}return false}function I(e,t,i,o){for(var s=0,n=0,l=e.children;n<l.length;){if("none"!==l[n].style.display&&l[n]!==Re.ghost&&(o||l[n]!==Re.dragged)&&x(l[n],i.draggable,e,false)){if(s===t)return l[n];s++}n++}return null}function D(e,t){for(var i=e.lastElementChild;i&&(i===Re.ghost||"none"===k(i,"display")||t&&!g(i,t));)i=i.previousElementSibling;return i||null}function L(e,t){var i=0;if(!e||!e.parentNode)return-1;for(;e=e.previousElementSibling;)"TEMPLATE"===e.nodeName.toUpperCase()||e===Re.clone||t&&!g(e,t)||i++;return i}function H(e){var t=0,i=0,o=q();if(e)do{var s=S(e),n=s.a,s=s.d}while(t+=e.scrollLeft*n,i+=e.scrollTop*s,e!==o&&(e=e.parentNode));return[t,i]}function z(e,t){if(!e||!e.getBoundingClientRect)return q();var i=e,o=false;do{if(i.clientWidth<i.scrollWidth||i.clientHeight<i.scrollHeight){var s=k(i);if(i.clientWidth<i.scrollWidth&&("auto"==s.overflowX||"scroll"==s.overflowX)||i.clientHeight<i.scrollHeight&&("auto"==s.overflowY||"scroll"==s.overflowY)){if(!i.getBoundingClientRect||i===document.body)return q();if(o||t)return i;o=true}}}while(i=i.parentNode);return q()}function N(e,t){return Math.round(e.top)===Math.round(t.top)&&Math.round(e.left)===Math.round(t.left)&&Math.round(e.height)===Math.round(t.height)&&Math.round(e.width)===Math.round(t.width)}function O(e,t){return function(){var i;w||(1===(i=arguments).length?e.call(this,i[0]):e.apply(this,i),w=setTimeout((function(){w=void 0}),t))}}function Z(e,t,i){e.scrollLeft+=t,e.scrollTop+=i}function _(e){var t=window.Polymer,i=window.jQuery||window.Zepto;return t&&t.dom?t.dom(e).cloneNode(true):i?i(e).clone(true)[0]:e.cloneNode(true)}function V(e,t){k(e,"position","absolute"),k(e,"top",t.top),k(e,"left",t.left),k(e,"width",t.width),k(e,"height",t.height)}function A(e){k(e,"position",""),k(e,"top",""),k(e,"left",""),k(e,"width",""),k(e,"height","")}function R(e,t,i){var o={};return Array.from(e.children).forEach((function(s){var n;x(s,t.draggable,e,false)&&!s.animated&&s!==i&&(n=T(s),o.left=Math.min(null!==(s=o.left)&&void 0!==s?s:1/0,n.left),o.top=Math.min(null!==(s=o.top)&&void 0!==s?s:1/0,n.top),o.right=Math.max(null!==(s=o.right)&&void 0!==s?s:-1/0,n.right),o.bottom=Math.max(null!==(s=o.bottom)&&void 0!==s?s:-1/0,n.bottom))})),o.width=o.right-o.left,o.height=o.bottom-o.top,o.x=o.left,o.y=o.top,o}var U="Sortable"+(new Date).getTime();function j(){var e,i=[];return{captureAnimationState:function(){i=[],this.options.animation&&[].slice.call(this.el.children).forEach((function(e){var o,s;"none"!==k(e,"display")&&e!==Re.ghost&&(i.push({target:e,rect:T(e)}),o=t({},i[i.length-1].rect),!e.thisAnimationDuration||(s=S(e,true))&&(o.top-=s.f,o.left-=s.e),e.fromRect=o)}))},addAnimationState:function(e){i.push(e)},removeAnimationState:function(e){i.splice(function(e,t){for(var i in e)if(e.hasOwnProperty(i))for(var o in t)if(t.hasOwnProperty(o)&&t[o]===e[i][o])return Number(i);return-1}(i,{target:e}),1)},animateAll:function(t){var o=this;if(!this.options.animation)return clearTimeout(e),void("function"==typeof t&&t());var s=false,n=0;i.forEach((function(e){var t=0,i=e.target,l=i.fromRect,r=T(i),a=i.prevFromRect,d=i.prevToRect,c=e.rect,h=S(i,true);h&&(r.top-=h.f,r.left-=h.e),i.toRect=r,i.thisAnimationDuration&&N(a,r)&&!N(l,r)&&(c.top-r.top)/(c.left-r.left)==(l.top-r.top)/(l.left-r.left)&&(e=c,h=a,a=d,d=o.options,t=Math.sqrt(Math.pow(h.top-e.top,2)+Math.pow(h.left-e.left,2))/Math.sqrt(Math.pow(h.top-a.top,2)+Math.pow(h.left-a.left,2))*d.animation),N(r,l)||(i.prevFromRect=l,i.prevToRect=r,t=t||o.options.animation,o.animate(i,c,r,t)),t&&(s=true,n=Math.max(n,t),clearTimeout(i.animationResetTimer),i.animationResetTimer=setTimeout((function(){i.animationTime=0,i.prevFromRect=null,i.fromRect=null,i.prevToRect=null,i.thisAnimationDuration=null}),t),i.thisAnimationDuration=t)})),clearTimeout(e),s?e=setTimeout((function(){"function"==typeof t&&t()}),n):"function"==typeof t&&t(),i=[]},animate:function(e,t,i,o){var s,n;o&&(k(e,"transition",""),k(e,"transform",""),s=(n=S(this.el))&&n.a,n=n&&n.d,s=(t.left-i.left)/(s||1),n=(t.top-i.top)/(n||1),e.animatingX=!!s,e.animatingY=!!n,k(e,"transform","translate3d("+s+"px,"+n+"px,0)"),this.forRepaintDummy=e.offsetWidth,k(e,"transition","transform "+o+"ms"+(this.options.easing?" "+this.options.easing:"")),k(e,"transform","translate3d(0,0,0)"),"number"==typeof e.animated&&clearTimeout(e.animated),e.animated=setTimeout((function(){k(e,"transition",""),k(e,"transform",""),e.animated=false,e.animatingX=false,e.animatingY=false}),o))}}}var B=[],P={initializeByDefault:true},F={mount:function(e){for(var t in P)!P.hasOwnProperty(t)||t in e||(e[t]=P[t]);B.forEach((function(t){if(t.pluginName===e.pluginName)throw"Sortable: Cannot mount plugin ".concat(e.pluginName," more than once")})),B.push(e)},pluginEvent:function(e,i,o){var s=this;this.eventCanceled=false,o.cancel=function(){s.eventCanceled=true};var n=e+"Global";B.forEach((function(s){i[s.pluginName]&&(i[s.pluginName][n]&&i[s.pluginName][n](t({sortable:i},o)),i.options[s.pluginName]&&i[s.pluginName][e]&&i[s.pluginName][e](t({sortable:i},o)))}))},initializePlugins:function(e,t,i,s){for(var n in B.forEach((function(s){var n=s.pluginName;(e.options[n]||s.initializeByDefault)&&((s=new s(e,t,e.options)).sortable=e,s.options=e.options,e[n]=s,o(i,s.defaults))})),e.options){var l;e.options.hasOwnProperty(n)&&(void 0!==(l=this.modifyOption(e,n,e.options[n]))&&(e.options[n]=l))}},getEventProperties:function(e,t){var i={};return B.forEach((function(s){"function"==typeof s.eventProperties&&o(i,s.eventProperties.call(t[s.pluginName],e))})),i},modifyOption:function(e,t,i){var o;return B.forEach((function(s){e[s.pluginName]&&s.optionListeners&&"function"==typeof s.optionListeners[t]&&(o=s.optionListeners[t].call(e[s.pluginName],i))})),o}};function $(e){var i=e.sortable,o=e.rootEl,s=e.name,n=e.targetEl,l=e.cloneEl,r=e.toEl,c=e.fromEl,h=e.oldIndex,u=e.newIndex,p=e.oldDraggableIndex,f=e.newDraggableIndex,v=e.originalEvent,m=e.putSortable,g=e.extraEventProperties;if(i=i||o&&o[U]){var b,x=i.options,e="on"+s.charAt(0).toUpperCase()+s.substr(1);!window.CustomEvent||a||d?(b=document.createEvent("Event")).initEvent(s,true,true):b=new CustomEvent(s,{bubbles:true,cancelable:true}),b.to=r||o,b.from=c||o,b.item=n||o,b.clone=l,b.oldIndex=h,b.newIndex=u,b.oldDraggableIndex=p,b.newDraggableIndex=f,b.originalEvent=v,b.pullMode=m?m.lastPutMode:void 0;var w,y=t(t({},g),F.getEventProperties(s,i));for(w in y)b[w]=y[w];o&&o.dispatchEvent(b),x[e]&&x[e].call(i,b)}}function Q(e,i){var o=(n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{}).evt,n=s(n,W);F.pluginEvent.bind(Re)(e,i,t({dragEl:Y,parentEl:X,ghostEl:J,rootEl:K,nextEl:ee,lastDownEl:te,cloneEl:ie,cloneHidden:oe,dragStarted:me,putSortable:de,activeSortable:Re.active,originalEvent:o,oldIndex:se,oldDraggableIndex:le,newIndex:ne,newDraggableIndex:re,hideGhostForTarget:Ze,unhideGhostForTarget:_e,cloneNowHidden:function(){oe=true},cloneNowShown:function(){oe=false},dispatchSortableEvent:function(e){G({sortable:i,name:e,originalEvent:o})}},n))}var W=["evt"];function G(e){$(t({putSortable:de,cloneEl:ie,targetEl:Y,rootEl:K,oldIndex:se,oldDraggableIndex:le,newIndex:ne,newDraggableIndex:re},e))}var Y,X,J,K,ee,te,ie,oe,se,ne,le,re,ae,de,ce,he,ue,pe,fe,ve,me,ge,be,xe,we,ye=false,Ee=false,ke=[],Se=false,Ce=false,qe=[],Te=false,Me=[],Ie="undefined"!=typeof document,De=u,Le=d||a?"cssFloat":"float",He=Ie&&!p&&!u&&"draggable"in document.createElement("div"),ze=function(){if(Ie){if(a)return false;var e=document.createElement("x");return e.style.cssText="pointer-events:auto","auto"===e.style.pointerEvents}}(),Ne=function(e,t){var i=k(e),o=parseInt(i.width)-parseInt(i.paddingLeft)-parseInt(i.paddingRight)-parseInt(i.borderLeftWidth)-parseInt(i.borderRightWidth),s=I(e,0,t),n=I(e,1,t),l=s&&k(s),r=n&&k(n),a=l&&parseInt(l.marginLeft)+parseInt(l.marginRight)+T(s).width,e=r&&parseInt(r.marginLeft)+parseInt(r.marginRight)+T(n).width;if("flex"===i.display)return"column"===i.flexDirection||"column-reverse"===i.flexDirection?"vertical":"horizontal";if("grid"===i.display)return i.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(s&&l.float&&"none"!==l.float){t="left"===l.float?"left":"right";return!n||"both"!==r.clear&&r.clear!==t?"horizontal":"vertical"}return s&&("block"===l.display||"flex"===l.display||"table"===l.display||"grid"===l.display||o<=a&&"none"===i[Le]||n&&"none"===i[Le]&&o<a+e)?"vertical":"horizontal"},Oe=function(e){function t(e,i){return function(o,s,n,l){var r=o.options.group.name&&s.options.group.name&&o.options.group.name===s.options.group.name;if(null==e&&(i||r))return true;if(null==e||false===e)return false;if(i&&"clone"===e)return e;if("function"==typeof e)return t(e(o,s,n,l),i)(o,s,n,l);s=(i?o:s).options.group.name;return true===e||"string"==typeof e&&e===s||e.join&&-1<e.indexOf(s)}}var o={},s=e.group;s&&"object"==i(s)||(s={name:s}),o.name=s.name,o.checkPull=t(s.pull,true),o.checkPut=t(s.put),o.revertClone=s.revertClone,e.group=o},Ze=function(){!ze&&J&&k(J,"display","none")},_e=function(){!ze&&J&&k(J,"display","")};Ie&&!p&&document.addEventListener("click",(function(e){if(Ee)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),Ee=false}),true);function Ve(e){if(Y){e=e.touches?e.touches[0]:e;var t=(s=e.clientX,n=e.clientY,ke.some((function(e){var t=e[U].options.emptyInsertThreshold;if(t&&!D(e)){var i=T(e),o=s>=i.left-t&&s<=i.right+t,t=n>=i.top-t&&n<=i.bottom+t;return o&&t?l=e:void 0}})),l);if(t){var i,o={};for(i in e)e.hasOwnProperty(i)&&(o[i]=e[i]);o.target=o.rootEl=t,o.preventDefault=void 0,o.stopPropagation=void 0,t[U]._onDragOver(o)}}var s,n,l}function Ae(e){Y&&Y.parentNode[U]._isOutsideThisEl(e.target)}function Re(e,t){if(!e||!e.nodeType||1!==e.nodeType)throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(e));this.el=e,this.options=t=o({},t),e[U]=this;var i,s,n={group:null,sort:true,disabled:false,store:null,handle:null,draggable:/^[uo]l$/i.test(e.nodeName)?">li":">*",swapThreshold:1,invertSwap:false,invertedSwapThreshold:null,removeCloneOnHide:true,direction:function(){return Ne(e,this.options)},ghostClass:"sortable-ghost",chosenClass:"sortable-chosen",dragClass:"sortable-drag",ignore:"a, img",filter:null,preventOnFilter:true,animation:0,easing:null,setData:function(e,t){e.setData("Text",t.textContent)},dropBubble:false,dragoverBubble:false,dataIdAttr:"data-id",delay:0,delayOnTouchOnly:false,touchStartThreshold:(Number.parseInt?Number:window).parseInt(window.devicePixelRatio,10)||1,forceFallback:false,fallbackClass:"sortable-fallback",fallbackOnBody:false,fallbackTolerance:0,fallbackOffset:{x:0,y:0},supportPointer:false!==Re.supportPointer&&"PointerEvent"in window&&(!h||u),emptyInsertThreshold:5};for(i in F.initializePlugins(this,e,n),n)i in t||(t[i]=n[i]);for(s in Oe(t),this)"_"===s.charAt(0)&&"function"==typeof this[s]&&(this[s]=this[s].bind(this));this.nativeDraggable=!t.forceFallback&&He,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?v(e,"pointerdown",this._onTapStart):(v(e,"mousedown",this._onTapStart),v(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(v(e,"dragover",this),v(e,"dragenter",this)),ke.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),o(this,j())}function Ue(e,t,i,o,s,n,l,r){var c,h,u=e[U],p=u.options.onMove;return!window.CustomEvent||a||d?(c=document.createEvent("Event")).initEvent("move",true,true):c=new CustomEvent("move",{bubbles:true,cancelable:true}),c.to=t,c.from=e,c.dragged=i,c.draggedRect=o,c.related=s||t,c.relatedRect=n||T(t),c.willInsertAfter=r,c.originalEvent=l,e.dispatchEvent(c),h=p?p.call(u,c,l):h}function je(e){e.draggable=false}function Be(){Te=false}function Pe(e){return setTimeout(e,0)}function Fe(e){return clearTimeout(e)}Re.prototype={constructor:Re,_isOutsideThisEl:function(e){this.el.contains(e)||e===this.el||(ge=null)},_getDirection:function(e,t){return"function"==typeof this.options.direction?this.options.direction.call(this,e,t,Y):this.options.direction},_onTapStart:function(e){if(e.cancelable){var t=this,i=this.el,o=this.options,s=o.preventOnFilter,n=e.type,l=e.touches&&e.touches[0]||e.pointerType&&"touch"===e.pointerType&&e,r=(l||e).target,a=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||r,d=o.filter;if(!function(e){Me.length=0;var t=e.getElementsByTagName("input"),i=t.length;for(;i--;){var o=t[i];o.checked&&Me.push(o)}}(i),!Y&&!(/mousedown|pointerdown/.test(n)&&0!==e.button||o.disabled)&&!a.isContentEditable&&(this.nativeDraggable||!h||!r||"SELECT"!==r.tagName.toUpperCase())&&!((r=x(r,o.draggable,i,false))&&r.animated||te===r)){if(se=L(r),le=L(r,o.draggable),"function"==typeof d){if(d.call(this,e,r,this))return G({sortable:t,rootEl:a,name:"filter",targetEl:r,toEl:i,fromEl:i}),Q("filter",t,{evt:e}),void(s&&e.preventDefault())}else if(d=d&&d.split(",").some((function(o){if(o=x(a,o.trim(),i,false))return G({sortable:t,rootEl:o,name:"filter",targetEl:r,fromEl:i,toEl:i}),Q("filter",t,{evt:e}),true})))return void(s&&e.preventDefault());o.handle&&!x(a,o.handle,i,false)||this._prepareDragStart(e,l,r)}}},_prepareDragStart:function(e,t,i){var o,s=this,n=s.el,l=s.options,r=n.ownerDocument;i&&!Y&&i.parentNode===n&&(o=T(i),K=n,X=(Y=i).parentNode,ee=Y.nextSibling,te=i,ae=l.group,ce={target:Re.dragged=Y,clientX:(t||e).clientX,clientY:(t||e).clientY},fe=ce.clientX-o.left,ve=ce.clientY-o.top,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,Y.style["will-change"]="all",o=function(){Q("delayEnded",s,{evt:e}),Re.eventCanceled?s._onDrop():(s._disableDelayedDragEvents(),!c&&s.nativeDraggable&&(Y.draggable=true),s._triggerDragStart(e,t),G({sortable:s,name:"choose",originalEvent:e}),E(Y,l.chosenClass,true))},l.ignore.split(",").forEach((function(e){C(Y,e.trim(),je)})),v(r,"dragover",Ve),v(r,"mousemove",Ve),v(r,"touchmove",Ve),l.supportPointer?(v(r,"pointerup",s._onDrop),this.nativeDraggable||v(r,"pointercancel",s._onDrop)):(v(r,"mouseup",s._onDrop),v(r,"touchend",s._onDrop),v(r,"touchcancel",s._onDrop)),c&&this.nativeDraggable&&(this.options.touchStartThreshold=4,Y.draggable=true),Q("delayStart",this,{evt:e}),!l.delay||l.delayOnTouchOnly&&!t||this.nativeDraggable&&(d||a)?o():Re.eventCanceled?this._onDrop():(l.supportPointer?(v(r,"pointerup",s._disableDelayedDrag),v(r,"pointercancel",s._disableDelayedDrag)):(v(r,"mouseup",s._disableDelayedDrag),v(r,"touchend",s._disableDelayedDrag),v(r,"touchcancel",s._disableDelayedDrag)),v(r,"mousemove",s._delayedDragTouchMoveHandler),v(r,"touchmove",s._delayedDragTouchMoveHandler),l.supportPointer&&v(r,"pointermove",s._delayedDragTouchMoveHandler),s._dragStartTimer=setTimeout(o,l.delay)))},_delayedDragTouchMoveHandler:function(e){e=e.touches?e.touches[0]:e;Math.max(Math.abs(e.clientX-this._lastX),Math.abs(e.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))&&this._disableDelayedDrag()},_disableDelayedDrag:function(){Y&&je(Y),clearTimeout(this._dragStartTimer),this._disableDelayedDragEvents()},_disableDelayedDragEvents:function(){var e=this.el.ownerDocument;m(e,"mouseup",this._disableDelayedDrag),m(e,"touchend",this._disableDelayedDrag),m(e,"touchcancel",this._disableDelayedDrag),m(e,"pointerup",this._disableDelayedDrag),m(e,"pointercancel",this._disableDelayedDrag),m(e,"mousemove",this._delayedDragTouchMoveHandler),m(e,"touchmove",this._delayedDragTouchMoveHandler),m(e,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function(e,t){t=t||"touch"==e.pointerType&&e,!this.nativeDraggable||t?this.options.supportPointer?v(document,"pointermove",this._onTouchMove):v(document,t?"touchmove":"mousemove",this._onTouchMove):(v(Y,"dragend",this),v(K,"dragstart",this._onDragStart));try{document.selection?Pe((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(e){}},_dragStarted:function(e,t){var i;ye=false,K&&Y?(Q("dragStarted",this,{evt:t}),this.nativeDraggable&&v(document,"dragover",Ae),i=this.options,e||E(Y,i.dragClass,false),E(Y,i.ghostClass,true),Re.active=this,e&&this._appendGhost(),G({sortable:this,name:"start",originalEvent:t})):this._nulling()},_emulateDragOver:function(){if(he){this._lastX=he.clientX,this._lastY=he.clientY,Ze();for(var e=document.elementFromPoint(he.clientX,he.clientY),t=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(he.clientX,he.clientY))!==t;)t=e;if(Y.parentNode[U]._isOutsideThisEl(e),t)do{if(t[U])if(t[U]._onDragOver({clientX:he.clientX,clientY:he.clientY,target:e,rootEl:t})&&!this.options.dragoverBubble)break}while(t=b(e=t));_e()}},_onTouchMove:function(e){if(ce){var t=this.options,i=t.fallbackTolerance,o=t.fallbackOffset,s=e.touches?e.touches[0]:e,n=J&&S(J,true),l=J&&n&&n.a,r=J&&n&&n.d,t=De&&we&&H(we),l=(s.clientX-ce.clientX+o.x)/(l||1)+(t?t[0]-qe[0]:0)/(l||1),r=(s.clientY-ce.clientY+o.y)/(r||1)+(t?t[1]-qe[1]:0)/(r||1);if(!Re.active&&!ye){if(i&&Math.max(Math.abs(s.clientX-this._lastX),Math.abs(s.clientY-this._lastY))<i)return;this._onDragStart(e,true)}J&&(n?(n.e+=l-(ue||0),n.f+=r-(pe||0)):n={a:1,b:0,c:0,d:1,e:l,f:r},n="matrix(".concat(n.a,",").concat(n.b,",").concat(n.c,",").concat(n.d,",").concat(n.e,",").concat(n.f,")"),k(J,"webkitTransform",n),k(J,"mozTransform",n),k(J,"msTransform",n),k(J,"transform",n),ue=l,pe=r,he=s),e.cancelable&&e.preventDefault()}},_appendGhost:function(){if(!J){var e=this.options.fallbackOnBody?document.body:K,t=T(Y,true,De,true,e),i=this.options;if(De){for(we=e;"static"===k(we,"position")&&"none"===k(we,"transform")&&we!==document;)we=we.parentNode;we!==document.body&&we!==document.documentElement?(we===document&&(we=q()),t.top+=we.scrollTop,t.left+=we.scrollLeft):we=q(),qe=H(we)}E(J=Y.cloneNode(true),i.ghostClass,false),E(J,i.fallbackClass,true),E(J,i.dragClass,true),k(J,"transition",""),k(J,"transform",""),k(J,"box-sizing","border-box"),k(J,"margin",0),k(J,"top",t.top),k(J,"left",t.left),k(J,"width",t.width),k(J,"height",t.height),k(J,"opacity","0.8"),k(J,"position",De?"absolute":"fixed"),k(J,"zIndex","100000"),k(J,"pointerEvents","none"),Re.ghost=J,e.appendChild(J),k(J,"transform-origin",fe/parseInt(J.style.width)*100+"% "+ve/parseInt(J.style.height)*100+"%")}},_onDragStart:function(e,t){var i=this,o=e.dataTransfer,s=i.options;Q("dragStart",this,{evt:e}),Re.eventCanceled?this._onDrop():(Q("setupClone",this),Re.eventCanceled||((ie=_(Y)).removeAttribute("id"),ie.draggable=false,ie.style["will-change"]="",this._hideClone(),E(ie,this.options.chosenClass,false),Re.clone=ie),i.cloneId=Pe((function(){Q("clone",i),Re.eventCanceled||(i.options.removeCloneOnHide||K.insertBefore(ie,Y),i._hideClone(),G({sortable:i,name:"clone"}))})),t||E(Y,s.dragClass,true),t?(Ee=true,i._loopId=setInterval(i._emulateDragOver,50)):(m(document,"mouseup",i._onDrop),m(document,"touchend",i._onDrop),m(document,"touchcancel",i._onDrop),o&&(o.effectAllowed="move",s.setData&&s.setData.call(i,o,Y)),v(document,"drop",i),k(Y,"transform","translateZ(0)")),ye=true,i._dragStartId=Pe(i._dragStarted.bind(i,t,e)),v(document,"selectstart",i),me=true,window.getSelection().removeAllRanges(),h&&k(document.body,"user-select","none"))},_onDragOver:function(e){var i,o,s,n,l,r=this.el,a=e.target,d=this.options,c=d.group,h=Re.active,u=ae===c,p=d.sort,f=de||h,v=this,m=false;if(!Te){if(void 0!==e.preventDefault&&e.cancelable&&e.preventDefault(),a=x(a,d.draggable,r,true),V("dragOver"),Re.eventCanceled)return m;if(Y.contains(e.target)||a.animated&&a.animatingX&&a.animatingY||v._ignoreWhileAnimating===a)return j(false);if(Ee=false,h&&!d.disabled&&(u?p||(o=X!==K):de===this||(this.lastPutMode=ae.checkPull(this,h,Y,e))&&c.checkPut(this,h,Y,e))){if(s="vertical"===this._getDirection(e,a),i=T(Y),V("dragOverValid"),Re.eventCanceled)return m;if(o)return X=K,A(),this._hideClone(),V("revert"),Re.eventCanceled||(ee?K.insertBefore(Y,ee):K.appendChild(Y)),j(true);var g=D(r,d.draggable);if(g&&(H=e,c=s,_=T(D((q=this).el,q.options.draggable)),q=R(q.el,q.options,J),!(c?H.clientX>q.right+10||H.clientY>_.bottom&&H.clientX>_.left:H.clientY>q.bottom+10||H.clientX>_.right&&H.clientY>_.top)||g.animated)){if(g&&(n=e,l=s,N=T(I((z=this).el,0,z.options,true)),z=R(z.el,z.options,J),l?n.clientX<z.left-10||n.clientY<N.top&&n.clientX<N.right:n.clientY<z.top-10||n.clientY<N.bottom&&n.clientX<N.left)){var b=I(r,0,d,true);if(b===Y)return j(false);if(C=T(a=b),false!==Ue(K,r,Y,i,a,C,e,false))return A(),r.insertBefore(Y,b),X=r,B(),j(true)}else if(a.parentNode===r){var w,y,S,C=T(a),q=Y.parentNode!==r,H=(H=Y.animated&&Y.toRect||i,_=a.animated&&a.toRect||C,z=(l=s)?H.left:H.top,n=l?H.right:H.bottom,N=l?H.width:H.height,b=l?_.left:_.top,H=l?_.right:_.bottom,_=l?_.width:_.height,!(z===b||n===H||z+N/2===b+_/2)),z=s?"top":"left",N=M(a,"top","top")||M(Y,"top","top"),b=N?N.scrollTop:void 0;if(ge!==a&&(y=C[z],Se=false,Ce=!H&&d.invertSwap||q),0!==(w=function(e,t,i,o,s,n,l,r){var a=o?e.clientY:e.clientX,d=o?i.height:i.width,e=o?i.top:i.left,o=o?i.bottom:i.right,i=false;if(!l)if(r&&xe<d*s){if(Se=!Se&&(1===be?e+d*n/2<a:a<o-d*n/2)?true:Se)i=true;else if(1===be?a<e+xe:o-xe<a)return-be}else if(e+d*(1-s)/2<a&&a<o-d*(1-s)/2)return function(e){return L(Y)<L(e)?1:-1}(t);if((i=i||l)&&(a<e+d*n/2||o-d*n/2<a))return e+d/2<a?1:-1;return 0}(e,a,C,s,H?1:d.swapThreshold,null==d.invertedSwapThreshold?d.swapThreshold:d.invertedSwapThreshold,Ce,ge===a)))for(var O=L(Y);(S=X.children[O-=w])&&("none"===k(S,"display")||S===J););if(0===w||S===a)return j(false);be=w;var _=(ge=a).nextElementSibling,q=false,H=Ue(K,r,Y,i,a,C,e,q=1===w);if(false!==H)return 1!==H&&-1!==H||(q=1===H),Te=true,setTimeout(Be,30),A(),q&&!_?r.appendChild(Y):a.parentNode.insertBefore(Y,q?_:a),N&&Z(N,0,b-N.scrollTop),X=Y.parentNode,void 0===y||Ce||(xe=Math.abs(y-T(a)[z])),B(),j(true)}}else{if(g===Y)return j(false);if((a=g&&r===e.target?g:a)&&(C=T(a)),false!==Ue(K,r,Y,i,a,C,e,!!a))return A(),g&&g.nextSibling?r.insertBefore(Y,g.nextSibling):r.appendChild(Y),X=r,B(),j(true)}if(r.contains(Y))return j(false)}return false}function V(n,l){Q(n,v,t({evt:e,isOwner:u,axis:s?"vertical":"horizontal",revert:o,dragRect:i,targetRect:C,canSort:p,fromSortable:f,target:a,completed:j,onMove:function(t,o){return Ue(K,r,Y,i,t,T(t),e,o)},changed:B},l))}function A(){V("dragOverAnimationCapture"),v.captureAnimationState(),v!==f&&f.captureAnimationState()}function j(t){return V("dragOverCompleted",{insertion:t}),t&&(u?h._hideClone():h._showClone(v),v!==f&&(E(Y,(de||h).options.ghostClass,false),E(Y,d.ghostClass,true)),de!==v&&v!==Re.active?de=v:v===Re.active&&de&&(de=null),f===v&&(v._ignoreWhileAnimating=a),v.animateAll((function(){V("dragOverAnimationComplete"),v._ignoreWhileAnimating=null})),v!==f&&(f.animateAll(),f._ignoreWhileAnimating=null)),(a===Y&&!Y.animated||a===r&&!a.animated)&&(ge=null),d.dragoverBubble||e.rootEl||a===document||(Y.parentNode[U]._isOutsideThisEl(e.target),t||Ve(e)),!d.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),m=true}function B(){ne=L(Y),re=L(Y,d.draggable),G({sortable:v,name:"change",toEl:r,newIndex:ne,newDraggableIndex:re,originalEvent:e})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){m(document,"mousemove",this._onTouchMove),m(document,"touchmove",this._onTouchMove),m(document,"pointermove",this._onTouchMove),m(document,"dragover",Ve),m(document,"mousemove",Ve),m(document,"touchmove",Ve)},_offUpEvents:function(){var e=this.el.ownerDocument;m(e,"mouseup",this._onDrop),m(e,"touchend",this._onDrop),m(e,"pointerup",this._onDrop),m(e,"pointercancel",this._onDrop),m(e,"touchcancel",this._onDrop),m(document,"selectstart",this)},_onDrop:function(e){var t=this.el,i=this.options;ne=L(Y),re=L(Y,i.draggable),Q("drop",this,{evt:e}),X=Y&&Y.parentNode,ne=L(Y),re=L(Y,i.draggable),Re.eventCanceled||(Se=Ce=ye=false,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),Fe(this.cloneId),Fe(this._dragStartId),this.nativeDraggable&&(m(document,"drop",this),m(t,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),h&&k(document.body,"user-select",""),k(Y,"transform",""),e&&(me&&(e.cancelable&&e.preventDefault(),i.dropBubble||e.stopPropagation()),J&&J.parentNode&&J.parentNode.removeChild(J),(K===X||de&&"clone"!==de.lastPutMode)&&ie&&ie.parentNode&&ie.parentNode.removeChild(ie),Y&&(this.nativeDraggable&&m(Y,"dragend",this),je(Y),Y.style["will-change"]="",me&&!ye&&E(Y,(de||this).options.ghostClass,false),E(Y,this.options.chosenClass,false),G({sortable:this,name:"unchoose",toEl:X,newIndex:null,newDraggableIndex:null,originalEvent:e}),K!==X?(0<=ne&&(G({rootEl:X,name:"add",toEl:X,fromEl:K,originalEvent:e}),G({sortable:this,name:"remove",toEl:X,originalEvent:e}),G({rootEl:X,name:"sort",toEl:X,fromEl:K,originalEvent:e}),G({sortable:this,name:"sort",toEl:X,originalEvent:e})),de&&de.save()):ne!==se&&0<=ne&&(G({sortable:this,name:"update",toEl:X,originalEvent:e}),G({sortable:this,name:"sort",toEl:X,originalEvent:e})),Re.active&&(null!=ne&&-1!==ne||(ne=se,re=le),G({sortable:this,name:"end",toEl:X,originalEvent:e}),this.save())))),this._nulling()},_nulling:function(){Q("nulling",this),K=Y=X=J=ee=ie=te=oe=ce=he=me=ne=re=se=le=ge=be=de=ae=Re.dragged=Re.ghost=Re.clone=Re.active=null,Me.forEach((function(e){e.checked=true})),Me.length=ue=pe=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":Y&&(this._onDragOver(e),function(e){e.dataTransfer&&(e.dataTransfer.dropEffect="move");e.cancelable&&e.preventDefault()}(e));break;case"selectstart":e.preventDefault()}},toArray:function(){for(var e,t=[],i=this.el.children,o=0,s=i.length,n=this.options;o<s;o++)x(e=i[o],n.draggable,this.el,false)&&t.push(e.getAttribute(n.dataIdAttr)||function(e){var t=e.tagName+e.className+e.src+e.href+e.textContent,i=t.length,o=0;for(;i--;)o+=t.charCodeAt(i);return o.toString(36)}(e));return t},sort:function(e,t){var i={},o=this.el;this.toArray().forEach((function(e,t){t=o.children[t];x(t,this.options.draggable,o,false)&&(i[e]=t)}),this),t&&this.captureAnimationState(),e.forEach((function(e){i[e]&&(o.removeChild(i[e]),o.appendChild(i[e]))})),t&&this.animateAll()},save:function(){var e=this.options.store;e&&e.set&&e.set(this)},closest:function(e,t){return x(e,t||this.options.draggable,this.el,false)},option:function(e,t){var i=this.options;if(void 0===t)return i[e];var o=F.modifyOption(this,e,t);i[e]=void 0!==o?o:t,"group"===e&&Oe(i)},destroy:function(){Q("destroy",this);var e=this.el;e[U]=null,m(e,"mousedown",this._onTapStart),m(e,"touchstart",this._onTapStart),m(e,"pointerdown",this._onTapStart),this.nativeDraggable&&(m(e,"dragover",this),m(e,"dragenter",this)),Array.prototype.forEach.call(e.querySelectorAll("[draggable]"),(function(e){e.removeAttribute("draggable")})),this._onDrop(),this._disableDelayedDragEvents(),ke.splice(ke.indexOf(this.el),1),this.el=e=null},_hideClone:function(){oe||(Q("hideClone",this),Re.eventCanceled||(k(ie,"display","none"),this.options.removeCloneOnHide&&ie.parentNode&&ie.parentNode.removeChild(ie),oe=true))},_showClone:function(e){"clone"===e.lastPutMode?oe&&(Q("showClone",this),Re.eventCanceled||(Y.parentNode!=K||this.options.group.revertClone?ee?K.insertBefore(ie,ee):K.appendChild(ie):K.insertBefore(ie,Y),this.options.group.revertClone&&this.animate(Y,ie),k(ie,"display",""),oe=false)):this._hideClone()}},Ie&&v(document,"touchmove",(function(e){(Re.active||ye)&&e.cancelable&&e.preventDefault()})),Re.utils={on:v,off:m,css:k,find:C,is:function(e,t){return!!x(e,t,e,false)},extend:function(e,t){if(e&&t)for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i]);return e},throttle:O,closest:x,toggleClass:E,clone:_,index:L,nextTick:Pe,cancelNextTick:Fe,detectDirection:Ne,getChild:I,expando:U},Re.get=function(e){return e[U]},Re.mount=function(){for(var e=arguments.length,i=new Array(e),o=0;o<e;o++)i[o]=arguments[o];(i=i[0].constructor===Array?i[0]:i).forEach((function(e){if(!e.prototype||!e.prototype.constructor)throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(e));e.utils&&(Re.utils=t(t({},Re.utils),e.utils)),F.mount(e)}))},Re.create=function(e,t){return new Re(e,t)};var $e,Qe,We,Ge,Ye,Xe,Je=[],Ke=!(Re.version="1.15.6");function et(){Je.forEach((function(e){clearInterval(e.pid)})),Je=[]}function tt(){clearInterval(Xe)}var it,ot=O((function(e,t,i,o){if(t.scroll){var s,n=(e.touches?e.touches[0]:e).clientX,l=(e.touches?e.touches[0]:e).clientY,r=t.scrollSensitivity,a=t.scrollSpeed,d=q(),c=false;Qe!==i&&(Qe=i,et(),$e=t.scroll,s=t.scrollFn,true===$e&&($e=z(i,true)));var h=0,u=$e;do{var p=u,f=T(p),v=f.top,m=f.bottom,g=f.left,b=f.right,x=f.width,w=f.height,y=void 0,E=void 0,S=p.scrollWidth,C=p.scrollHeight,M=k(p),I=p.scrollLeft,f=p.scrollTop,E=p===d?(y=x<S&&("auto"===M.overflowX||"scroll"===M.overflowX||"visible"===M.overflowX),w<C&&("auto"===M.overflowY||"scroll"===M.overflowY||"visible"===M.overflowY)):(y=x<S&&("auto"===M.overflowX||"scroll"===M.overflowX),w<C&&("auto"===M.overflowY||"scroll"===M.overflowY)),I=y&&(Math.abs(b-n)<=r&&I+x<S)-(Math.abs(g-n)<=r&&!!I),f=E&&(Math.abs(m-l)<=r&&f+w<C)-(Math.abs(v-l)<=r&&!!f);if(!Je[h])for(var D=0;D<=h;D++)Je[D]||(Je[D]={});Je[h].vx==I&&Je[h].vy==f&&Je[h].el===p||(Je[h].el=p,Je[h].vx=I,Je[h].vy=f,clearInterval(Je[h].pid),0==I&&0==f||(c=true,Je[h].pid=setInterval(function(){o&&0===this.layer&&Re.active._onTouchMove(Ye);var t=Je[this.layer].vy?Je[this.layer].vy*a:0,i=Je[this.layer].vx?Je[this.layer].vx*a:0;"function"==typeof s&&"continue"!==s.call(Re.dragged.parentNode[U],i,t,e,Ye,Je[this.layer].el)||Z(Je[this.layer].el,i,t)}.bind({layer:h}),24))),h++}while(t.bubbleScroll&&u!==d&&(u=z(u,false)));Ke=c}}),30),p=function(e){var t=e.originalEvent,i=e.putSortable,o=e.dragEl,s=e.activeSortable,n=e.dispatchSortableEvent,l=e.hideGhostForTarget,e=e.unhideGhostForTarget;t&&(s=i||s,l(),t=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:t,t=document.elementFromPoint(t.clientX,t.clientY),e(),s&&!s.el.contains(t)&&(n("spill"),this.onSpill({dragEl:o,putSortable:i})))};function st(){}function nt(){}st.prototype={startIndex:null,dragStart:function(e){e=e.oldDraggableIndex;this.startIndex=e},onSpill:function(e){var t=e.dragEl,i=e.putSortable;this.sortable.captureAnimationState(),i&&i.captureAnimationState();e=I(this.sortable.el,this.startIndex,this.options);e?this.sortable.el.insertBefore(t,e):this.sortable.el.appendChild(t),this.sortable.animateAll(),i&&i.animateAll()},drop:p},o(st,{pluginName:"revertOnSpill"}),nt.prototype={onSpill:function(e){var t=e.dragEl,e=e.putSortable||this.sortable;e.captureAnimationState(),t.parentNode&&t.parentNode.removeChild(t),e.animateAll()},drop:p},o(nt,{pluginName:"removeOnSpill"});var lt,rt,at,dt,ct,ht=[],ut=[],pt=false,ft=false,vt=false;function mt(e,t){ut.forEach((function(i,o){o=t.children[i.sortableIndex+(e?Number(o):0)];o?t.insertBefore(i,o):t.appendChild(i)}))}function gt(){ht.forEach((function(e){e!==at&&e.parentNode&&e.parentNode.removeChild(e)}))}return Re.mount(new function(){function e(){for(var e in this.defaults={scroll:true,forceAutoScrollFallback:false,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:true},this)"_"===e.charAt(0)&&"function"==typeof this[e]&&(this[e]=this[e].bind(this))}return e.prototype={dragStarted:function(e){e=e.originalEvent;this.sortable.nativeDraggable?v(document,"dragover",this._handleAutoScroll):this.options.supportPointer?v(document,"pointermove",this._handleFallbackAutoScroll):e.touches?v(document,"touchmove",this._handleFallbackAutoScroll):v(document,"mousemove",this._handleFallbackAutoScroll)},dragOverCompleted:function(e){e=e.originalEvent;this.options.dragOverBubble||e.rootEl||this._handleAutoScroll(e)},drop:function(){this.sortable.nativeDraggable?m(document,"dragover",this._handleAutoScroll):(m(document,"pointermove",this._handleFallbackAutoScroll),m(document,"touchmove",this._handleFallbackAutoScroll),m(document,"mousemove",this._handleFallbackAutoScroll)),tt(),et(),clearTimeout(w),w=void 0},nulling:function(){Ye=Qe=$e=Ke=Xe=We=Ge=null,Je.length=0},_handleFallbackAutoScroll:function(e){this._handleAutoScroll(e,true)},_handleAutoScroll:function(e,t){var i,o=this,s=(e.touches?e.touches[0]:e).clientX,n=(e.touches?e.touches[0]:e).clientY,l=document.elementFromPoint(s,n);Ye=e,t||this.options.forceAutoScrollFallback||d||a||h?(ot(e,this.options,l,t),i=z(l,true),!Ke||Xe&&s===We&&n===Ge||(Xe&&tt(),Xe=setInterval((function(){var l=z(document.elementFromPoint(s,n),true);l!==i&&(i=l,et()),ot(e,o.options,l,t)}),10),We=s,Ge=n)):this.options.bubbleScroll&&z(l,true)!==q()?ot(e,this.options,z(l,false),false):et()}},o(e,{pluginName:"scroll",initializeByDefault:true})}),Re.mount(nt,st),Re.mount(new function(){function e(){this.defaults={swapClass:"sortable-swap-highlight"}}return e.prototype={dragStart:function(e){e=e.dragEl;it=e},dragOverValid:function(e){var t=e.completed,i=e.target,o=e.onMove,s=e.activeSortable,n=e.changed,l=e.cancel;s.options.swap&&(e=this.sortable.el,s=this.options,i&&i!==e&&(e=it,it=false!==o(i)?(E(i,s.swapClass,true),i):null,e&&e!==it&&E(e,s.swapClass,false)),n(),t(true),l())},drop:function(e){var t,i,o=e.activeSortable,s=e.putSortable,n=e.dragEl,l=s||this.sortable,r=this.options;it&&E(it,r.swapClass,false),it&&(r.swap||s&&s.options.swap)&&n!==it&&(l.captureAnimationState(),l!==o&&o.captureAnimationState(),i=it,e=(t=n).parentNode,r=i.parentNode,e&&r&&!e.isEqualNode(i)&&!r.isEqualNode(t)&&(s=L(t),n=L(i),e.isEqualNode(r)&&s<n&&n++,e.insertBefore(i,e.children[s]),r.insertBefore(t,r.children[n])),l.animateAll(),l!==o&&o.animateAll())},nulling:function(){it=null}},o(e,{pluginName:"swap",eventProperties:function(){return{swapItem:it}}})}),Re.mount(new function(){function e(e){for(var t in this)"_"===t.charAt(0)&&"function"==typeof this[t]&&(this[t]=this[t].bind(this));e.options.avoidImplicitDeselect||(e.options.supportPointer?v(document,"pointerup",this._deselectMultiDrag):(v(document,"mouseup",this._deselectMultiDrag),v(document,"touchend",this._deselectMultiDrag))),v(document,"keydown",this._checkKeyDown),v(document,"keyup",this._checkKeyUp),this.defaults={selectedClass:"sortable-selected",multiDragKey:null,avoidImplicitDeselect:false,setData:function(t,i){var o="";ht.length&&rt===e?ht.forEach((function(e,t){o+=(t?", ":"")+e.textContent})):o=i.textContent,t.setData("Text",o)}}}return e.prototype={multiDragKeyDown:false,isMultiDrag:false,delayStartGlobal:function(e){e=e.dragEl;at=e},delayEnded:function(){this.isMultiDrag=~ht.indexOf(at)},setupClone:function(e){var t=e.sortable,e=e.cancel;if(this.isMultiDrag){for(var i=0;i<ht.length;i++)ut.push(_(ht[i])),ut[i].sortableIndex=ht[i].sortableIndex,ut[i].draggable=false,ut[i].style["will-change"]="",E(ut[i],this.options.selectedClass,false),ht[i]===at&&E(ut[i],this.options.chosenClass,false);t._hideClone(),e()}},clone:function(e){var t=e.sortable,i=e.rootEl,o=e.dispatchSortableEvent,e=e.cancel;this.isMultiDrag&&(this.options.removeCloneOnHide||ht.length&&rt===t&&(mt(true,i),o("clone"),e()))},showClone:function(e){var t=e.cloneNowShown,i=e.rootEl,e=e.cancel;this.isMultiDrag&&(mt(false,i),ut.forEach((function(e){k(e,"display","")})),t(),ct=false,e())},hideClone:function(e){var t=this,i=e.cloneNowHidden,e=e.cancel;this.isMultiDrag&&(ut.forEach((function(e){k(e,"display","none"),t.options.removeCloneOnHide&&e.parentNode&&e.parentNode.removeChild(e)})),i(),ct=true,e())},dragStartGlobal:function(e){!this.isMultiDrag&&rt&&rt.multiDrag._deselectMultiDrag(),ht.forEach((function(e){e.sortableIndex=L(e)})),ht=ht.sort((function(e,t){return e.sortableIndex-t.sortableIndex})),vt=true},dragStarted:function(e){var t,i=this,e=e.sortable;this.isMultiDrag&&(this.options.sort&&(e.captureAnimationState(),this.options.animation&&(ht.forEach((function(e){e!==at&&k(e,"position","absolute")})),t=T(at,false,true,true),ht.forEach((function(e){e!==at&&V(e,t)})),pt=ft=true)),e.animateAll((function(){pt=ft=false,i.options.animation&&ht.forEach((function(e){A(e)})),i.options.sort&>()})))},dragOver:function(e){var t=e.target,i=e.completed,e=e.cancel;ft&&~ht.indexOf(t)&&(i(false),e())},revert:function(e){var t,i,o=e.fromSortable,s=e.rootEl,n=e.sortable,l=e.dragRect;1<ht.length&&(ht.forEach((function(e){n.addAnimationState({target:e,rect:ft?T(e):l}),A(e),e.fromRect=l,o.removeAnimationState(e)})),ft=false,t=!this.options.removeCloneOnHide,i=s,ht.forEach((function(e,o){o=i.children[e.sortableIndex+(t?Number(o):0)];o?i.insertBefore(e,o):i.appendChild(e)})))},dragOverCompleted:function(e){var t,i=e.sortable,o=e.isOwner,s=e.insertion,n=e.activeSortable,l=e.parentEl,r=e.putSortable,e=this.options;s&&(o&&n._hideClone(),pt=false,e.animation&&1<ht.length&&(ft||!o&&!n.options.sort&&!r)&&(t=T(at,false,true,true),ht.forEach((function(e){e!==at&&(V(e,t),l.appendChild(e))})),ft=true),o||(ft||gt(),1<ht.length?(o=ct,n._showClone(i),n.options.animation&&!ct&&o&&ut.forEach((function(e){n.addAnimationState({target:e,rect:dt}),e.fromRect=dt,e.thisAnimationDuration=null}))):n._showClone(i)))},dragOverAnimationCapture:function(e){var t=e.dragRect,i=e.isOwner,e=e.activeSortable;ht.forEach((function(e){e.thisAnimationDuration=null})),e.options.animation&&!i&&e.multiDrag.isMultiDrag&&(dt=o({},t),t=S(at,true),dt.top-=t.f,dt.left-=t.e)},dragOverAnimationComplete:function(){ft&&(ft=false,gt())},drop:function(e){var t,i,o,s,n,l,r,a=e.originalEvent,d=e.rootEl,c=e.parentEl,h=e.sortable,u=e.dispatchSortableEvent,p=e.oldIndex,e=e.putSortable,f=e||this.sortable;a&&(t=this.options,i=c.children,vt||(t.multiDragKey&&!this.multiDragKeyDown&&this._deselectMultiDrag(),E(at,t.selectedClass,!~ht.indexOf(at)),~ht.indexOf(at)?(ht.splice(ht.indexOf(at),1),lt=null,$({sortable:h,rootEl:d,name:"deselect",targetEl:at,originalEvent:a})):(ht.push(at),$({sortable:h,rootEl:d,name:"select",targetEl:at,originalEvent:a}),a.shiftKey&<&&h.el.contains(lt)?(o=L(lt),s=L(at),~o&&~s&&o!==s&&function(){for(var e,n=o<s?(e=o,s):(e=s,o+1),l=t.filter;e<n;e++)~ht.indexOf(i[e])||x(i[e],t.draggable,c,false)&&(l&&("function"==typeof l?l.call(h,a,i[e],h):l.split(",").some((function(t){return x(i[e],t.trim(),c,false)})))||(E(i[e],t.selectedClass,true),ht.push(i[e]),$({sortable:h,rootEl:d,name:"select",targetEl:i[e],originalEvent:a})))}()):lt=at,rt=f)),vt&&this.isMultiDrag&&(ft=false,(c[U].options.sort||c!==d)&&1<ht.length&&(n=T(at),l=L(at,":not(."+this.options.selectedClass+")"),!pt&&t.animation&&(at.thisAnimationDuration=null),f.captureAnimationState(),pt||(t.animation&&(at.fromRect=n,ht.forEach((function(e){var t;e.thisAnimationDuration=null,e!==at&&(t=ft?T(e):n,e.fromRect=t,f.addAnimationState({target:e,rect:t}))}))),gt(),ht.forEach((function(e){i[l]?c.insertBefore(e,i[l]):c.appendChild(e),l++})),p===L(at)&&(r=false,ht.forEach((function(e){e.sortableIndex!==L(e)&&(r=true)})),r&&(u("update"),u("sort")))),ht.forEach((function(e){A(e)})),f.animateAll()),rt=f),(d===c||e&&"clone"!==e.lastPutMode)&&ut.forEach((function(e){e.parentNode&&e.parentNode.removeChild(e)})))},nullingGlobal:function(){this.isMultiDrag=vt=false,ut.length=0},destroyGlobal:function(){this._deselectMultiDrag(),m(document,"pointerup",this._deselectMultiDrag),m(document,"mouseup",this._deselectMultiDrag),m(document,"touchend",this._deselectMultiDrag),m(document,"keydown",this._checkKeyDown),m(document,"keyup",this._checkKeyUp)},_deselectMultiDrag:function(e){if(!(void 0!==vt&&vt||rt!==this.sortable||e&&x(e.target,this.options.draggable,this.sortable.el,false)||e&&0!==e.button))for(;ht.length;){var t=ht[0];E(t,this.options.selectedClass,false),ht.shift(),$({sortable:this.sortable,rootEl:this.sortable.el,name:"deselect",targetEl:t,originalEvent:e})}},_checkKeyDown:function(e){e.key===this.options.multiDragKey&&(this.multiDragKeyDown=true)},_checkKeyUp:function(e){e.key===this.options.multiDragKey&&(this.multiDragKeyDown=false)}},o(e,{pluginName:"multiDrag",utils:{select:function(e){var t=e.parentNode[U];t&&t.options.multiDrag&&!~ht.indexOf(e)&&(rt&&rt!==t&&(rt.multiDrag._deselectMultiDrag(),rt=t),E(e,t.options.selectedClass,true),ht.push(e))},deselect:function(e){var t=e.parentNode[U],i=ht.indexOf(e);t&&t.options.multiDrag&&~i&&(E(e,t.options.selectedClass,false),ht.splice(i,1))}},eventProperties:function(){var e=this,t=[],i=[];return ht.forEach((function(o){var s;t.push({multiDragElement:o,index:o.sortableIndex}),s=ft&&o!==at?-1:ft?L(o,":not(."+e.options.selectedClass+")"):L(o),i.push({multiDragElement:o,index:s})})),{items:n(ht),clones:[].concat(ut),oldIndicies:t,newIndicies:i}},optionListeners:{multiDragKey:function(e){return"ctrl"===(e=e.toLowerCase())?e="Control":1<e.length&&(e=e.charAt(0).toUpperCase()+e.substr(1)),e}}})}),Re}))})(ge);return ge.exports}var ye=we();var Ee=R(ye);const ke='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-roles{display:block;max-width:600px;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-template-roles .roles{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;gap:10px;margin-top:10px}verdocs-template-roles .roles .sequence{gap:10px;display:-ms-flexbox;display:flex;-ms-flex-wrap:wrap;flex-wrap:wrap;font-weight:500;padding:0 0 8px 0;-ms-flex-direction:row;flex-direction:row;border-bottom:1px dotted #e3e3e3}verdocs-template-roles .roles .sequence.add-sequence{color:#777777;line-height:34px}verdocs-template-roles .roles .sequence-label{font-size:18px;line-height:32px}verdocs-template-roles .roles .sequence-roles{gap:10px;display:-ms-flexbox;display:flex;position:relative;-ms-flex-wrap:wrap;flex-wrap:wrap;-ms-flex-direction:row;flex-direction:row}verdocs-template-roles .roles .role{height:32px;cursor:move;display:-ms-flexbox;display:flex;max-width:200px;position:relative;border-radius:32px;background-color:#eff7fb;-webkit-box-sizing:border-box;box-sizing:border-box;padding:0 14px 0 34px;border:1px solid #ccc;-ms-flex-direction:column;flex-direction:column}verdocs-template-roles .roles .role .role-name{font-size:14px;overflow:hidden;font-weight:400;line-height:30px;white-space:nowrap;text-overflow:ellipsis}verdocs-template-roles .roles .role .icons{position:absolute;left:1px;top:-3px;cursor:pointer;padding:5px;z-index:10}verdocs-template-roles .roles .role .icons .gear-button{display:none;-webkit-transform:scale(1.1);transform:scale(1.1);margin:4px 0 0 1px}verdocs-template-roles .roles .role .icons .type-icon{opacity:0.6;display:block;-webkit-transform:scale(0.8);transform:scale(0.8)}verdocs-template-roles .roles .role .icons:hover .gear-button{display:block}verdocs-template-roles .roles .role .icons:hover .type-icon{display:none}verdocs-template-roles>form{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;background-color:#ffffff;padding:12px}verdocs-template-roles>form h5{font-size:16px;font-weight:bold;color:#46497d;margin:0 0 10px 0}verdocs-template-roles>form label{display:block;font-size:14px;font-weight:500;margin:0 0 4px 0;color:#5c6575}verdocs-template-roles>form input{border:none;font-size:18px;padding:3px 6px 3px 0;background:transparent;border-bottom:1px solid #33364b}verdocs-template-roles>form input:focus{outline:none}verdocs-template-roles .row.add-sequence{display:none}verdocs-template-roles .add-role{opacity:0.3;padding:0 10px;cursor:pointer;background:none;height:32px;border:1px solid #cccccc;border-radius:32px}verdocs-template-roles .add-role:hover{opacity:1}verdocs-template-roles .add-step{margin:0;padding:0;border:none;opacity:0.5;cursor:pointer;background:none}verdocs-template-roles .add-step:hover{opacity:1}verdocs-template-roles .add-step svg{width:32px;height:32px}verdocs-template-roles.dragging .row.add-sequence{display:-ms-flexbox;display:flex}verdocs-template-roles .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;margin-top:16px;-ms-flex-direction:row;flex-direction:row}verdocs-template-roles .empty{font-size:13px;margin-top:15px;margin-bottom:5px}verdocs-template-roles .empty svg{width:16px;height:16px;stroke:#666666;margin-bottom:2px;display:inline-block}verdocs-template-roles .sequence-roles{display:-ms-flexbox;display:flex;max-width:400px}verdocs-template-roles ::-webkit-input-placeholder{color:#aaaaaa}verdocs-template-roles ::-moz-placeholder{color:#aaaaaa}verdocs-template-roles :-ms-input-placeholder{color:#aaaaaa}verdocs-template-roles ::-ms-input-placeholder{color:#aaaaaa}verdocs-template-roles ::placeholder{color:#aaaaaa}';const Se='<svg xmlns="http://www.w3.org/2000/svg" height="20" width="20" fill="#00000089"><path d="m8.021 17.917-.313-2.5q-.27-.125-.625-.334-.354-.208-.625-.395l-2.312.979-1.979-3.438 1.979-1.5q-.021-.167-.031-.364-.011-.198-.011-.365 0-.146.011-.344.01-.198.031-.385l-1.979-1.5 1.979-3.417 2.312.958q.271-.187.615-.385t.635-.344l.313-2.5h3.958l.313 2.5q.312.167.625.344.312.177.604.385l2.333-.958 1.979 3.417-1.979 1.521q.021.187.021.364V10q0 .146-.01.333-.011.188-.011.396l1.958 1.5-1.979 3.438-2.312-.979q-.292.208-.615.395-.323.188-.614.334l-.313 2.5Zm1.937-5.355q1.063 0 1.813-.75t.75-1.812q0-1.062-.75-1.812t-1.813-.75q-1.041 0-1.802.75-.76.75-.76 1.812t.76 1.812q.761.75 1.802.75Zm0-1.333q-.5 0-.864-.364-.365-.365-.365-.865t.365-.865q.364-.364.864-.364t.865.364q.365.365.365.865t-.365.865q-.365.364-.865.364ZM10.021 10Zm-.854 6.583h1.666l.25-2.187q.605-.167 1.136-.49.531-.323 1.031-.802l2.021.875.854-1.375-1.792-1.354q.105-.333.136-.635.031-.303.031-.615 0-.292-.031-.573-.031-.281-.115-.635l1.792-1.396-.834-1.375-2.062.875q-.438-.438-1.021-.781-.583-.344-1.125-.49l-.271-2.208H9.167l-.271 2.208q-.584.146-1.125.458-.542.313-1.042.792l-2.021-.854-.833 1.375 1.75 1.354q-.083.333-.125.646-.042.312-.042.604t.042.594q.042.302.125.635l-1.75 1.375.833 1.375 2.021-.854q.479.458 1.021.771.542.312 1.146.479Z"/></svg>';const Ce=`<svg xmlns="http://www.w3.org/2000/svg" fill="#ffffff" viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor"><path strokeLinecap="round" strokeLinejoin="round" d="M12 9v6m3-3H9m12 0a9 9 0 11-18 0 9 9 0 0118 0z" /></svg>`;const qe='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path d="m9.225 21.225 4.65-4.65h8.45v4.65Zm-5.35-2.2H5.05l8.5-8.5-1.175-1.175-8.5 8.5Zm14.25-9.95L13.8 4.8l1.325-1.325q.625-.65 1.525-.663.9-.012 1.6.663l1.225 1.175q.675.675.663 1.562-.013.888-.663 1.513ZM16.7 10.55 6 21.225H1.675V16.9L12.35 6.225Zm-3.725-.625-.6-.575 1.175 1.175Z"/></svg>';const Te=`<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path fill-rule="evenodd" d="M2.25 12c0-5.385 4.365-9.75 9.75-9.75s9.75 4.365 9.75 9.75-4.365 9.75-9.75 9.75S2.25 17.385 2.25 12zm13.36-1.814a.75.75 0 10-1.22-.872l-3.236 4.53L9.53 12.22a.75.75 0 00-1.06 1.06l2.25 2.25a.75.75 0 001.14-.094l3.75-5.25z" clip-rule="evenodd" /></svg>`;const Me=`<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path d="M1.5 8.67v8.58a3 3 0 003 3h15a3 3 0 003-3V8.67l-8.928 5.493a3 3 0 01-3.144 0L1.5 8.67z" /><path d="M22.5 6.908V6.75a3 3 0 00-3-3h-15a3 3 0 00-3 3v.158l9.714 5.978a1.5 1.5 0 001.572 0L22.5 6.908z" /></svg>`;const Ie=class{constructor(i){e(this,i);this.next=t(this,"next");this.exit=t(this,"exit");this.sdkError=t(this,"sdkError");this.rolesUpdated=t(this,"rolesUpdated");this.templateListenerId=null;this.endpoint=l.getDefault();this.templateId="";this.showingRoleDialog=null;this.sender=null;this.dragging=false;this.loading=true;this.template=null;this.sortableRefs=[]}disconnectedCallback(){this.unlistenToTemplate();this.cleanupSortables()}async listenToTemplate(){console.log("[ROLES] Loading template",this.templateId);this.unlistenToTemplate();E.subscribe("templates",this.templateId,(()=>r(this.endpoint,this.templateId)),false,(e=>{console.log("[ROLES] Template Updated",e);this.template=e;this.loading=false}))}unlistenToTemplate(){if(this.templateListenerId){E.store.delListener(this.templateListenerId);this.templateListenerId=null}}async componentWillLoad(){var e,t,i;try{this.endpoint.loadSession();if(!this.templateId){console.log(`[ROLES] Missing required template ID ${this.templateId}`);return}if(!this.endpoint.session){console.log("[ROLES] Unable to start builder session, must be authenticated");return}this.listenToTemplate()}catch(o){console.log("[ROLES] Error with preview session",o);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new y(o.message,(t=o.response)===null||t===void 0?void 0:t.status,(i=o.response)===null||i===void 0?void 0:i.data))}}cleanupSortables(){this.sortableRefs.forEach((e=>e.destroy()));this.sortableRefs.length=0}componentDidRender(){this.cleanupSortables();const e=this.getSequenceNumbers();(e||[]).forEach((e=>{const t=document.getElementById(`verdocs-roles-sequence-${e}`);if(t){const e=new Ee(t,{group:"roles",animation:150,dragoverBubble:true,filter:".no-drag",onEnd:this.handleMoveEnd.bind(this),onChoose:()=>this.dragging=true,onUnchoose:()=>this.dragging=false});this.sortableRefs.push(e)}}));const t=document.getElementById(`verdocs-roles-sequence-add-target`);if(t){console.log("[ROLES] Applying sortable to add-sequence slot");const e=new Ee(t,{group:"roles",animation:150,dragoverBubble:true,filter:".no-drag",onEnd:this.handleMoveEnd.bind(this),onChoose:()=>this.dragging=true,onUnchoose:()=>this.dragging=false});this.sortableRefs.push(e)}}handleMoveEnd(e){const t=+e.from.dataset.sequence;const i=+e.to.dataset.sequence;const o=+e.oldIndex+1;const s=+e.newIndex+1;console.log(`Move from ${t}:${o} to ${i}:${s}`,e.item);const n={};const l=this.getSequenceNumbers();l.forEach((e=>{const t=this.getRolesAtSequence(e);n[String(e)]=JSON.parse(JSON.stringify(t))}));n[l[l.length-1]+1]=[];const r=n[t].splice(o-1,1)[0];n[i]||(n[i]=[]);n[i].splice(s-1,0,r);const a=[];Object.entries(n).forEach((([e,t])=>{t.forEach(((t,i)=>{if(!t){return}const o=+i+1;if(t.sequence!==+e||t.order!==o){t.sequence=+e;t.order=o;a.push(b(this.endpoint,this.templateId,t.name,{sequence:+e,order:o}).then((e=>console.log("[ROLES] Updated role",t.name,e))).catch((e=>console.log("[ROLES] Error updating role",e))))}}))}));return Promise.all(a).then((async()=>console.log("[ROLES] Done renumbering"))).catch((e=>console.log("[ROLES] Error updating roles",e)))}handleCancel(){var e;(e=this.exit)===null||e===void 0?void 0:e.emit()}handleSubmit(){var e;(e=this.next)===null||e===void 0?void 0:e.emit()}getSortedRoles(){var e;return(((e=this.template)===null||e===void 0?void 0:e.roles)||[]).sort(((e,t)=>e.sequence===t.sequence?e.order-t.order:e.sequence-t.sequence))}getSequenceNumbers(){const e={};this.getSortedRoles().forEach((t=>{e[t.sequence]=true}));console.log("[ROLES] Sequences",e);return Object.keys(e).map((e=>+e)).sort(((e,t)=>e-t))}getRoleNames(){const e=this.getSortedRoles();return e.map((e=>e.name))}getRolesAtSequence(e){var t;return(((t=this.template)===null||t===void 0?void 0:t.roles)||[]).filter((t=>t&&t.sequence===e))}async renumberTemplateRoles(){var e;const t={};const i=[];const o=this.getSequenceNumbers();(o||[]).forEach((e=>{(t[e]||[]).forEach(((t,o)=>{const s=+o+1;if(t.sequence!==+e||t.order!==s){console.log("[ROLES] Updating role",t.name,"from",t.sequence,t.order,"to",e,s);t.sequence=+e;t.order=s;i.push(b(this.endpoint,this.templateId,t.name,{sequence:+e,order:s}).then((e=>console.log("[ROLES] Updated role",t.name,e))).catch((e=>console.log("[ROLES] Error updating role",e))))}}))}));console.log(`[ROLES] Awaiting ${i.length} renumber requests`);await Promise.all(i).then((async()=>{const e=JSON.parse(JSON.stringify(this.template));e.roles=Object.keys(t).reduce(((e,i)=>e.concat(t[i])),[]);console.log("[ROLES] Done renumbering",e.roles.map((e=>({name:e.name,sequence:e.sequence,order:e.order}))));E.updateTemplate(this.templateId,e)}));(e=this.rolesUpdated)===null||e===void 0?void 0:e.emit({event:"updated",endpoint:this.endpoint,templateId:this.templateId,roles:this.getSortedRoles()})}getNextRoleName(){var e,t;let i="";let o=(((e=this.template)===null||e===void 0?void 0:e.roles)||[]).length;do{o++;i=`Recipient ${o}`}while(!i||(((t=this.template)===null||t===void 0?void 0:t.roles)||[]).some((e=>e&&e.name===i)));return i}callCreateRole(e,t,i){console.log("[ROLES] Will create role",{name:e,sequence:t,order:i});x(this.endpoint,this.templateId,{template_id:this.templateId,name:e,sequence:t,message:"",order:i,full_name:null,first_name:"",last_name:"",email:"",phone:"",type:"signer",delegator:false}).then((async e=>{var t;console.log("[ROLES] Created role",e);console.log("Updating template in data store");await E.getTemplate(this.endpoint,this.templateId,true);(t=this.rolesUpdated)===null||t===void 0?void 0:t.emit({event:"added",endpoint:this.endpoint,templateId:this.templateId,roles:this.getSortedRoles()})})).catch((e=>{console.log("[ROLES] Error creating role",e)}))}handleAddRole(e,t){e.stopPropagation();const i=this.getRolesAtSequence(t).length+1;const o=this.getNextRoleName();this.callCreateRole(o,t,i)}handleAddStep(e,t){e.stopPropagation();const i=1;const o=this.getNextRoleName();this.callCreateRole(o,t,i)}render(){if(!this.endpoint.session){return i(o,null,i("verdocs-component-error",{message:"You must be authenticated to use this module."}))}if(this.loading||!this.template){return i(o,{class:"loading"},i("verdocs-loader",null))}const e=this.getRoleNames();const t=this.getSequenceNumbers();const s=t&&t.length>0?(t[t.length-1]||0)+1:1;console.log("[ROLES] Rendering",{roleNames:e,sequences:t,nextSequence:s});return i(o,{class:{dragging:this.dragging}},i("form",{onSubmit:e=>e.preventDefault(),onClick:e=>e.stopPropagation(),autocomplete:"off"},i("h5",null,"Roles and Workflow"),i("div",{class:"roles"},t.map(((e,t)=>i("div",{class:"sequence"},i("div",{class:"sequence-label no-drag"},t+1,"."),i("div",{class:"sequence-roles",id:`verdocs-roles-sequence-${e}`,"data-sequence":e},this.getRolesAtSequence(e).map((t=>{const o=!t.email||!t.first_name||!t.last_name;return o?i("div",{class:"role","data-rolename":t.name,"data-sequence":e,"data-order":t.order},i("div",{class:"role-name"},t.name),i("div",{class:"icons"},i("div",{class:"gear-button",innerHTML:Se,onClick:()=>this.showingRoleDialog=t.name,"aria-role":"button"}),i("span",{class:"type-icon",innerHTML:t.type==="signer"?qe:t.type==="cc"?Me:Te}))):i("div",{class:"role","data-rolename":t.name,"data-sequence":e,"data-order":t.order},i("div",{class:"role-name"},u(t)),i("div",{class:"icons"},i("div",{class:"gear-button",innerHTML:Se,onClick:()=>this.showingRoleDialog=t.name,"aria-role":"button"}),i("span",{class:"type-icon",innerHTML:t.type==="signer"?qe:t.type==="cc"?Me:Te})))}))),i("button",{class:"add-role no-drag",onClick:t=>this.handleAddRole(t,e)},"+ Add Role")))),i("div",{class:"sequence add-sequence"},i("div",{class:"sequence-label no-drag"},t.length+1,"."),i("div",{class:"sequence-roles",id:`verdocs-roles-sequence-add-target`,"data-sequence":s}),i("button",{class:"add-role no-drag",onClick:e=>this.handleAddRole(e,s)},"+ Add Role"))),e.length<1&&i("div",{class:"empty"},"You must add at least one Role before proceeding.",i("br",null)," Click the ",i("span",{innerHTML:Ce})," Add button above to get started."),i("div",{class:"buttons"},i("div",{class:"flex-fill"}),i("verdocs-button",{variant:"outline",label:"Cancel",size:"small",onClick:()=>this.handleCancel()}),i("verdocs-button",{label:"OK",size:"small",onClick:()=>this.handleSubmit(),disabled:e.length<1}))),this.showingRoleDialog&&i("verdocs-menu-panel",{onClose:()=>this.showingRoleDialog=null},i("verdocs-template-role-properties",{endpoint:this.endpoint,templateId:this.templateId,roleName:this.showingRoleDialog,onClose:()=>{var e;(e=document.getElementById("verdocs-menu-panel-overlay"))===null||e===void 0?void 0:e.remove();this.showingRoleDialog=null},onDelete:async()=>{var e;this.showingRoleDialog=null;await this.renumberTemplateRoles();(e=this.rolesUpdated)===null||e===void 0?void 0:e.emit({event:"deleted",endpoint:this.endpoint,templateId:this.templateId,roles:this.getSortedRoles()})}})))}get el(){return n(this)}};Ie.style=ke;const De='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-settings{display:block;max-width:600px;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-template-settings>form{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;background-color:#ffffff;padding:12px}verdocs-template-settings>form h5{font-size:16px;font-weight:bold;color:#46497d;margin:0 0 10px 0}verdocs-template-settings>form label{display:block;font-size:14px;font-weight:500;margin:0 0 4px 0;color:#5c6575}verdocs-template-settings>form input{border:none;font-size:18px;padding:3px 6px 3px 0;background:transparent;border-bottom:1px solid #33364b}verdocs-template-settings>form input:focus{outline:none}verdocs-template-settings>form .row{margin:20px 0 0 0}verdocs-template-settings .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;margin-top:16px;-ms-flex-direction:row;flex-direction:row}verdocs-template-settings ::-webkit-input-placeholder{color:#aaaaaa}verdocs-template-settings ::-moz-placeholder{color:#aaaaaa}verdocs-template-settings :-ms-input-placeholder{color:#aaaaaa}verdocs-template-settings ::-ms-input-placeholder{color:#aaaaaa}verdocs-template-settings ::placeholder{color:#aaaaaa}';const Le=24*60*60*1e3;const He=class{constructor(i){e(this,i);this.next=t(this,"next");this.exit=t(this,"exit");this.sdkError=t(this,"sdkError");this.templateUpdated=t(this,"templateUpdated");this.templateListenerId=null;this.endpoint=l.getDefault();this.templateId="";this.name=null;this.visibility="private";this.sender="envelope_creator";this.sendReminders=false;this.initialReminder=0;this.followupReminders=0;this.dirty=false;this.loading=true;this.template=null}disconnectedCallback(){this.unlistenToTemplate()}async listenToTemplate(){console.log("[SETTINGS] Loading template",this.templateId);this.unlistenToTemplate();E.subscribe("templates",this.templateId,(()=>r(this.endpoint,this.templateId)),false,(e=>{console.log("[SETTINGS] Template Updated",e);this.template=e;this.name=e.name;this.visibility=e.visibility;this.sender=e.sender;this.sendReminders=e.initial_reminder!==null;this.initialReminder=e.initial_reminder?Math.floor(e.initial_reminder/Le):null;this.followupReminders=e.followup_reminders?Math.floor(e.followup_reminders/Le):null;this.dirty=false;this.loading=false}))}unlistenToTemplate(){if(this.templateListenerId){E.store.delListener(this.templateListenerId);this.templateListenerId=null}}async componentWillLoad(){var e,t,i;try{this.endpoint.loadSession();if(!this.templateId){console.log(`[SETTINGS] Missing required template ID ${this.templateId}`);return}if(!this.endpoint.session){console.log("[SETTINGS] Unable to start builder session, must be authenticated");return}this.listenToTemplate()}catch(o){console.log("[SETTINGS] Error with preview session",o);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new y(o.message,(t=o.response)===null||t===void 0?void 0:t.status,(i=o.response)===null||i===void 0?void 0:i.data))}}handleCancel(){var e;(e=this.exit)===null||e===void 0?void 0:e.emit()}handleSubmit(){w(this.endpoint,this.templateId,{name:this.name,visibility:this.visibility,sender:this.sender,initial_reminder:this.sendReminders?this.initialReminder*Le:null,followup_reminders:this.sendReminders?this.followupReminders*Le:null}).then((e=>{var t,i;console.log("[SETTINGS] Template Updated",e);this.dirty=false;this.name=e.name;this.visibility=e.visibility;this.sender=e.sender;this.sendReminders=e.initial_reminder!==null;this.initialReminder=e.initial_reminder?Math.floor(e.initial_reminder/Le):null;this.followupReminders=e.followup_reminders?Math.floor(e.followup_reminders/Le):null;(t=this.templateUpdated)===null||t===void 0?void 0:t.emit({endpoint:this.endpoint,template:e,event:"update"});(i=this.next)===null||i===void 0?void 0:i.emit()})).catch((e=>{var t,i,o,s,n;console.log("[SETTINGS] Error updating template",e);(t=this.sdkError)===null||t===void 0?void 0:t.emit(new y(e.message,(i=e.response)===null||i===void 0?void 0:i.status,(o=e.response)===null||o===void 0?void 0:o.data));S(((n=(s=e.response)===null||s===void 0?void 0:s.data)===null||n===void 0?void 0:n.error)||"Error updating template, please try again later.")}))}render(){if(!this.endpoint.session){return i(o,null,i("verdocs-component-error",{message:"You must be authenticated to use this module."}))}if(this.loading||!this.template){return i(o,{class:"loading"},i("verdocs-loader",null))}return i(o,null,i("form",{onSubmit:e=>e.preventDefault(),onClick:e=>e.stopPropagation(),autocomplete:"off"},i("h5",null,"Settings"),i("div",{class:"row"},i("verdocs-text-input",{id:"verdocs-field-name",label:"Template Name",value:this.name,autocomplete:"off",placeholder:"Template Name...",onInput:e=>{this.name=e.target.value;this.dirty=true}})),i("div",{class:"row"},i("verdocs-select-input",{label:"Visibility",value:this.visibility,onInput:e=>{this.visibility=e.target.value;this.dirty=true},options:[{value:"private",label:"Private"},{value:"shared",label:"Shared"},{value:"public",label:"Public"}]})),i("div",{class:"row"},i("verdocs-select-input",{label:"Owner for envelopes created from this template",value:this.sender,onInput:e=>{this.sender=e.target.value;this.dirty=true},options:[{value:"envelope_creator",label:"Envelope Creator"},{value:"template_owner",label:"Template Owner"}]})),i("div",{class:"row"},i("label",null,"Send Reminders"),i("verdocs-switch",{checked:this.sendReminders,onCheckedChange:e=>this.sendReminders=e.detail})),this.sendReminders&&i("div",{class:"row"},i("verdocs-text-input",{id:"verdocs-field-name",label:"First Reminder (days)",value:String(this.initialReminder||0),autocomplete:"off",placeholder:"Delay in days...",onInput:e=>{this.initialReminder=+e.target.value;this.dirty=true}})),this.sendReminders&&i("div",{class:"row"},i("verdocs-text-input",{id:"verdocs-field-name",label:"Follow-up Reminders (days)",value:String(this.followupReminders||0),autocomplete:"off",placeholder:"Delay in days...",onInput:e=>{this.followupReminders=+e.target.value;this.dirty=true}})),i("div",{class:"buttons"},i("verdocs-button",{variant:"outline",label:"Cancel",size:"small",onClick:()=>this.handleCancel()}),i("verdocs-button",{label:"Save",size:"small",onClick:()=>this.handleSubmit(),disabled:!this.dirty}))))}get el(){return n(this)}};He.style=De;export{j as verdocs_preview,Y as verdocs_send,J as verdocs_template_attachments,oe as verdocs_template_build_tabs,me as verdocs_template_fields,Ie as verdocs_template_roles,He as verdocs_template_settings};
|
3
|
+
//# sourceMappingURL=p-d0b7bbc5.entry.js.map
|