@verdocs/web-sdk 5.0.73 → 5.0.74
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/{utils-Bxil_g6M.js → utils-DCB8q98B.js} +6 -2
- package/dist/cjs/utils-DCB8q98B.js.map +1 -0
- package/dist/cjs/verdocs-contact-picker.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-envelope-document-page.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-envelopes-list.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-field-attachment_13.cjs.entry.js +1 -5
- package/dist/cjs/verdocs-field-attachment_13.cjs.entry.js.map +1 -1
- package/dist/cjs/verdocs-kba-dialog_3.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-pagination_2.cjs.entry.js +1 -1
- package/dist/cjs/verdocs-preview_7.cjs.entry.js +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/collection/components/fields/verdocs-field-checkbox/verdocs-field-checkbox.js.map +1 -1
- package/dist/collection/components/fields/verdocs-field-radio/verdocs-field-radio.js.map +1 -1
- package/dist/collection/components/fields/verdocs-field-textbox/verdocs-field-textbox.js +1 -5
- package/dist/collection/components/fields/verdocs-field-textbox/verdocs-field-textbox.js.map +1 -1
- package/dist/collection/utils/utils.js +4 -0
- package/dist/collection/utils/utils.js.map +1 -1
- package/dist/components/{p-Clok0sKa.js → p-BqWxusTA.js} +4 -4
- package/dist/components/{p-Clok0sKa.js.map → p-BqWxusTA.js.map} +1 -1
- package/dist/components/p-CDTU_UJD.js.map +1 -1
- package/dist/components/{p-CG2DS0Ct.js → p-CLHwiJsu.js} +3 -3
- package/dist/components/{p-CG2DS0Ct.js.map → p-CLHwiJsu.js.map} +1 -1
- package/dist/components/{p-B3KdiIa6.js → p-CWHHlD3o.js} +3 -3
- package/dist/components/{p-B3KdiIa6.js.map → p-CWHHlD3o.js.map} +1 -1
- package/dist/components/{p-rafg8cJv.js → p-Cfx8TNcj.js} +4 -4
- package/dist/components/{p-rafg8cJv.js.map → p-Cfx8TNcj.js.map} +1 -1
- package/dist/components/{p-D-4uVyuT.js → p-CpHTrnj5.js} +3 -3
- package/dist/components/{p-D-4uVyuT.js.map → p-CpHTrnj5.js.map} +1 -1
- package/dist/components/{p-DDMPZ6xr.js → p-D38Lnu3J.js} +3 -3
- package/dist/components/{p-DDMPZ6xr.js.map → p-D38Lnu3J.js.map} +1 -1
- package/dist/components/{p-DA5NR945.js → p-De7UWCgq.js} +3 -7
- package/dist/components/p-De7UWCgq.js.map +1 -0
- package/dist/components/{p-rIIybUCF.js → p-DsBOZHKo.js} +6 -2
- package/dist/components/{p-rIIybUCF.js.map → p-DsBOZHKo.js.map} +1 -1
- package/dist/components/{p-DcAnGvC8.js → p-eiHT7SZQ.js} +5 -5
- package/dist/components/{p-DcAnGvC8.js.map → p-eiHT7SZQ.js.map} +1 -1
- package/dist/components/{p-BFgewNxB.js → p-iOb94GB3.js} +4 -4
- package/dist/components/{p-BFgewNxB.js.map → p-iOb94GB3.js.map} +1 -1
- package/dist/components/p-z0ZD30Bi.js.map +1 -1
- package/dist/components/verdocs-build.js +6 -6
- package/dist/components/verdocs-contact-picker.js +1 -1
- package/dist/components/verdocs-envelope-document-page.js +1 -1
- package/dist/components/verdocs-envelopes-list.js +2 -2
- package/dist/components/verdocs-field-textbox.js +1 -1
- package/dist/components/verdocs-preview.js +1 -1
- package/dist/components/verdocs-quick-filter.js +1 -1
- package/dist/components/verdocs-send.js +1 -1
- package/dist/components/verdocs-sign.js +3 -3
- package/dist/components/verdocs-template-document-page.js +1 -1
- package/dist/components/verdocs-template-fields.js +1 -1
- package/dist/components/verdocs-templates-list.js +1 -1
- package/dist/components/verdocs-view.js +1 -1
- package/dist/esm/{utils-CbfXTNEw.js → utils-DmfOx9Ey.js} +6 -2
- package/dist/esm/utils-DmfOx9Ey.js.map +1 -0
- package/dist/esm/verdocs-contact-picker.entry.js +1 -1
- package/dist/esm/verdocs-envelope-document-page.entry.js +1 -1
- package/dist/esm/verdocs-envelopes-list.entry.js +1 -1
- package/dist/esm/verdocs-field-attachment_13.entry.js +1 -5
- package/dist/esm/verdocs-field-attachment_13.entry.js.map +1 -1
- package/dist/esm/verdocs-kba-dialog_3.entry.js +1 -1
- package/dist/esm/verdocs-pagination_2.entry.js +1 -1
- package/dist/esm/verdocs-preview_7.entry.js +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-es5/{utils-CbfXTNEw.js → utils-DmfOx9Ey.js} +2 -2
- package/dist/esm-es5/utils-DmfOx9Ey.js.map +1 -0
- package/dist/esm-es5/verdocs-contact-picker.entry.js +2 -2
- package/dist/esm-es5/verdocs-envelope-document-page.entry.js +1 -1
- package/dist/esm-es5/verdocs-envelopes-list.entry.js +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-kba-dialog_3.entry.js +1 -1
- package/dist/esm-es5/verdocs-pagination_2.entry.js +1 -1
- package/dist/esm-es5/verdocs-preview_7.entry.js +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/verdocs-web-sdk/{p-5af5bd43.entry.js → p-0bb8015d.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-7e91292a.entry.js → p-13c9ac73.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-3bf5dfcb.system.entry.js → p-1653b309.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-8bee83ad.entry.js → p-1718b823.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-3e4a6587.system.entry.js → p-2a183b90.system.entry.js} +3 -3
- package/dist/verdocs-web-sdk/{p-b78fa925.entry.js → p-3b68bc50.entry.js} +2 -2
- package/dist/verdocs-web-sdk/p-3b68bc50.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-ff182af0.entry.js → p-43326217.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-77cb64e8.system.entry.js → p-44de70af.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-04421e78.system.entry.js → p-524c1693.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-7926e0ed.entry.js → p-5d4a9e54.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-5f2740be.entry.js → p-65f4a435.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-ba007f95.system.entry.js → p-68b0e020.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-db22e373.system.entry.js → p-6d8c780d.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-d73e5d98.system.entry.js → p-9f2bde83.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-DwVINdLf.system.js.map → p-BEa6VFpF.system.js.map} +1 -1
- package/dist/verdocs-web-sdk/{p-DFxwv7XE.system.js.map → p-Bh0IfLXk.system.js.map} +1 -1
- package/dist/verdocs-web-sdk/{p-BxWHy8GG.system.js.map → p-BqV2sLyM.system.js.map} +1 -1
- package/dist/verdocs-web-sdk/p-C4Tt0CYc.system.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-8wtUCSj6.system.js.map → p-C99h0Uet.system.js.map} +1 -1
- package/dist/verdocs-web-sdk/{p-CalyeRmL.system.js → p-CD5uiThi.system.js} +3 -3
- package/dist/verdocs-web-sdk/p-CD5uiThi.system.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-Bf0islHu.system.js.map → p-CWs7NRzr.system.js.map} +1 -1
- package/dist/verdocs-web-sdk/p-CwXSduhy.system.js +1 -1
- package/dist/verdocs-web-sdk/{p-CTKsneFq.system.js.map → p-Cz3XayQm.system.js.map} +1 -1
- package/dist/verdocs-web-sdk/{p-CeQPkjRM.system.js.map → p-DRzyvgiA.system.js.map} +1 -1
- package/dist/verdocs-web-sdk/{p-SFqGy6JR.system.js.map → p-EQbSTcUE.system.js.map} +1 -1
- package/dist/verdocs-web-sdk/{p-7c58a33b.system.entry.js → p-a2ba1316.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/p-a2ba1316.system.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-d8a89fb3.entry.js → p-bb96a9af.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-aa3436c1.entry.js → p-d3d531e3.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-b29ae6dd.system.entry.js → p-e5f90a18.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/{p-Bf-kinKl.js → p-fL0BKEnm.js} +2 -2
- package/dist/verdocs-web-sdk/p-fL0BKEnm.js.map +1 -0
- package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
- package/package.json +1 -1
- package/dist/cjs/utils-Bxil_g6M.js.map +0 -1
- package/dist/components/p-DA5NR945.js.map +0 -1
- package/dist/esm/utils-CbfXTNEw.js.map +0 -1
- package/dist/esm-es5/utils-CbfXTNEw.js.map +0 -1
- package/dist/verdocs-web-sdk/p-7c58a33b.system.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-Bf-kinKl.js.map +0 -1
- package/dist/verdocs-web-sdk/p-CalyeRmL.system.js.map +0 -1
- package/dist/verdocs-web-sdk/p-b78fa925.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-vPV-UVh5.system.js.map +0 -1
- /package/dist/verdocs-web-sdk/{p-5af5bd43.entry.js.map → p-0bb8015d.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-7e91292a.entry.js.map → p-13c9ac73.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-3bf5dfcb.system.entry.js.map → p-1653b309.system.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-8bee83ad.entry.js.map → p-1718b823.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-3e4a6587.system.entry.js.map → p-2a183b90.system.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-ff182af0.entry.js.map → p-43326217.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-77cb64e8.system.entry.js.map → p-44de70af.system.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-04421e78.system.entry.js.map → p-524c1693.system.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-7926e0ed.entry.js.map → p-5d4a9e54.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-5f2740be.entry.js.map → p-65f4a435.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-ba007f95.system.entry.js.map → p-68b0e020.system.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-db22e373.system.entry.js.map → p-6d8c780d.system.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-d73e5d98.system.entry.js.map → p-9f2bde83.system.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-d8a89fb3.entry.js.map → p-bb96a9af.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-aa3436c1.entry.js.map → p-d3d531e3.entry.js.map} +0 -0
- /package/dist/verdocs-web-sdk/{p-b29ae6dd.system.entry.js.map → p-e5f90a18.system.entry.js.map} +0 -0
@@ -1,2 +1,2 @@
|
|
1
|
-
var __assign=this&&this.__assign||function(){__assign=Object.assign||function(e){for(var i,r=1,t=arguments.length;r<t;r++){i=arguments[r];for(var o in i)if(Object.prototype.hasOwnProperty.call(i,o))e[o]=i[o]}return e};return __assign.apply(this,arguments)};var __spreadArray=this&&this.__spreadArray||function(e,i,r){if(r||arguments.length===2)for(var t=0,o=i.length,s;t<o;t++){if(s||!(t in i)){if(!s)s=Array.prototype.slice.call(i,0,t);s[t]=i[t]}}return e.concat(s||Array.prototype.slice.call(i))};import{r as registerInstance,c as createEvent,h,H as Host,g as getElement}from"./index-CF7i8guW.js";import{integerSequence}from"@verdocs/js-sdk";import{b as renderedTextWidth}from"./utils-CbfXTNEw.js";import{c as createPopper}from"./popper-BfP9ezJQ.js";import"./_commonjsHelpers-BFTU3MAI.js";import"./index-dzBXqXlK.js";import"./Types-Dl7Xw8F0.js";var verdocsPaginationCss='@-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-pagination{gap:8px;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;font-family:"Inter", "Barlow", sans-serif}verdocs-pagination .page-button{height:38px;display:-ms-flexbox;display:flex;-ms-flex:0 0 38px;flex:0 0 38px;cursor:pointer;font-size:16px;font-weight:600;border-radius:4px;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;color:#33364b;border:1px solid #654dcb}verdocs-pagination .page-button svg{width:18px;height:18px}verdocs-pagination .page-button.selected{cursor:default;color:#ffffff;background:#654dcb}verdocs-pagination .ellipsis{width:38px;height:38px;display:-ms-flexbox;display:flex;-ms-flex:0 0 38px;flex:0 0 38px;line-height:32px;-ms-flex-pack:center;justify-content:center;color:#33364b}';var ChevronDoubleLeft='<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M18.75 19.5l-7.5-7.5 7.5-7.5m-6 15L5.25 12l7.5-7.5" /></svg>';var ChevronDoubleRight='<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M11.25 4.5l7.5 7.5-7.5 7.5m-6-15l7.5 7.5-7.5 7.5" /></svg>';var VISIBLE_PAGES=5;var PageButton=function(e){var i=e.page,r=e.selected,t=e.onClick;var o;if(i==="first"){o=ChevronDoubleLeft}else if(i==="last"){o=ChevronDoubleRight}else{o=String(i+1)}return h("div",{class:"page-button ".concat(i===r?"selected":""),onClick:function(){return t(i)},innerHTML:o})};var VerdocsQuickFilter$1=function(){function e(e){registerInstance(this,e);this.selectPage=createEvent(this,"selectPage");this.selectedPage=0;this.itemCount=1;this.perPage=10}e.prototype.handleSelectPage=function(e){var i;this.selectedPage=e;(i=this.selectPage)===null||i===void 0?void 0:i.emit({selectedPage:e})};e.prototype.render=function(){var e=this;var i=Math.max(0,this.selectedPage-2);var r=this.itemCount>0?Math.ceil(this.itemCount/this.perPage):0;var t=integerSequence(0,Math.ceil(this.itemCount/this.perPage)).slice(i,i+VISIBLE_PAGES);return h(Host,{key:"b914afe290065b1f65b3632a1e205a0138d4ca96"},this.selectedPage>0&&h(PageButton,{key:"06d4c575361cffc6299409c66557208fef8180e9",page:"first",selected:this.selectedPage,onClick:function(){return e.handleSelectPage(0)}}),i>0&&h("div",{key:"14afa9724ff8159c20c372821fff58a98b721bc7",class:"ellipsis"},"..."),t.map((function(i){return h(PageButton,{page:i,selected:e.selectedPage,onClick:function(i){return e.handleSelectPage(+i)}})})),this.selectedPage<r-1&&h("div",{key:"0b22a68cafaf3beda898442422a584cc9da811d9",class:"ellipsis"},"..."),this.selectedPage<r-1&&h(PageButton,{key:"56bfdb75c0a6bb0aab32aa61860051517fcf360b",page:"last",selected:this.selectedPage,onClick:function(){return e.handleSelectPage(r-1)}}))};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();VerdocsQuickFilter$1.style=verdocsPaginationCss;var verdocsQuickFilterCss='@-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-quick-filter{position:relative;font-family:"Inter", "Barlow", sans-serif}verdocs-quick-filter .control{outline:0;height:34px;display:-ms-flexbox;display:flex;cursor:pointer;border-radius:4px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-webkit-box-sizing:border-box;box-sizing:border-box;background:#ffffff;-webkit-transition:all 100ms ease 0s;transition:all 100ms ease 0s;border:1px solid #cccccc}verdocs-quick-filter .title{padding:0 8px;font-size:14px;max-width:100%;overflow:hidden;color:#33364b;white-space:nowrap;-webkit-box-sizing:border-box;box-sizing:border-box;text-overflow:ellipsis}verdocs-quick-filter .title .prefix{display:inline;font-weight:700;margin:0 7px 0 0;color:#4c56cb}verdocs-quick-filter .arrow{width:32px;height:32px;border:none;outline:none;cursor:pointer;-ms-flex-align:center;align-items:center;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-pack:center;justify-content:center;background:#ffffff;-webkit-transition:color 150ms ease 0s;transition:color 150ms ease 0s}verdocs-quick-filter .arrow svg{-webkit-transition:0.3s;transition:0.3s;fill:#cccccc}verdocs-quick-filter .separator{width:1px;display:block;margin-top:8px;margin-bottom:8px;-ms-flex-item-align:stretch;align-self:stretch;-webkit-box-sizing:border-box;box-sizing:border-box;background-color:#cccccc}verdocs-quick-filter .items{display:none;z-index:10000;position:absolute;border-radius:4px;background:#ffffff;-webkit-box-shadow:rgba(0, 0, 0, 0.1) 0 0 0 1px, rgba(0, 0, 0, 0.1) 0 4px 11px;box-shadow:rgba(0, 0, 0, 0.1) 0 0 0 1px, rgba(0, 0, 0, 0.1) 0 4px 11px}verdocs-quick-filter .items[data-show]{display:block}verdocs-quick-filter .option{width:100%;border:none;display:block;font-size:14px;text-align:left;background:none;padding:10px 20px;color:#1e2031}verdocs-quick-filter .option:hover{cursor:pointer;background:rgba(76, 86, 203, 0.2470588235)}verdocs-quick-filter .option[disabled]{color:#aaaaaa}verdocs-quick-filter .option[disabled]:hover{cursor:inherit;background:transparent;color:#aaaaaa}verdocs-quick-filter.open .items{display:block}verdocs-quick-filter.open .arrow svg{-webkit-transform:scaleY(-1);transform:scaleY(-1)}';var DropdownArrow='<svg height="20" width="20" viewBox="0 0 20 20" aria-hidden="true" focusable="false" class="css-8mmkcg"><path d="M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"></path></svg>';var VerdocsQuickFilter=function(){function e(e){registerInstance(this,e);this.optionSelected=createEvent(this,"optionSelected");this.options=[];this.label="Filter";this.value="";this.placeholder="Select...";this.clickListenerSymbol=new AbortController}e.prototype.componentDidLoad=function(){this.popper=createPopper(this.dropdownButton,this.dropdownMenu,{placement:"bottom-start",modifiers:[{name:"offset",options:{offset:[-1,14]}}]});window.addEventListener("click",this.clickListener.bind(this),{signal:this.clickListenerSymbol.signal})};e.prototype.disconnectedCallback=function(){this.clickListenerSymbol.abort()};e.prototype.clickListener=function(e){var i=!(e.target==this.el||this.el.contains(e.target));if(i){this.hide()}};e.prototype.handleSelectOption=function(e,i){e.stopPropagation();this.optionSelected.emit(i);this.value=i.value;this.hide()};e.prototype.showDropdown=function(){var e,i;this.open=true;this.dropdownMenu.setAttribute("data-show","");this.dropdownMenu.removeAttribute("aria-hidden");(e=this.popper)===null||e===void 0?void 0:e.setOptions((function(e){return __assign(__assign({},e),{modifiers:__spreadArray(__spreadArray([],e.modifiers,true),[{name:"eventListeners",enabled:true}],false)})})).catch((function(){}));(i=this.popper)===null||i===void 0?void 0:i.update().catch((function(){}))};e.prototype.handleHideDropdown=function(e){var i,r;if(((i=e===null||e===void 0?void 0:e.target)===null||i===void 0?void 0:i.localName)==="button"&&((r=e===null||e===void 0?void 0:e.target)===null||r===void 0?void 0:r.className)==="arrow"){return}this.hide()};e.prototype.toggleDropdown=function(e){e.stopPropagation();if(this.open){this.hide()}else{this.showDropdown()}};e.prototype.hide=function(){var e;this.open=false;this.dropdownMenu.removeAttribute("data-show");this.dropdownMenu.setAttribute("aria-hidden","true");(e=this.popper)===null||e===void 0?void 0:e.setOptions((function(e){return __assign(__assign({},e),{modifiers:__spreadArray(__spreadArray([],e.modifiers,true),[{name:"eventListeners",enabled:false}],false)})})).catch((function(){}))};e.prototype.render=function(){var e=this;var i,r,t;var o=(i=this.options)===null||i===void 0?void 0:i.find((function(i){return i.value===e.value}));var s=(r=this.options)===null||r===void 0?void 0:r.reduce((function(e,i){return e.label.length>i.label.length?e:i}));var n=renderedTextWidth((s===null||s===void 0?void 0:s.label)||"FILLER","14px Inter, Barlow, sans-serif");var a=renderedTextWidth(this.label,"14px Inter, Barlow, sans-serif");var c="".concat(n+a+40,"px");return h(Host,{key:"2775a9460418249e5830b3acc29bc501dfc0b7e9",class:{open:!!this.open},style:{minWidth:c,display:"inline-block"}},h("div",{key:"a0d32bee5bf3a83860d1ee34b70dd08e14ff6f5a",class:"control",onClick:function(i){return e.toggleDropdown(i)},onBlur:function(i){return e.handleHideDropdown(i)}},h("div",{key:"e28fc8c51bd4913814770bfa3eed9aec685fcdc7",class:"title",ref:function(i){return e.dropdownButton=i}},h("span",{key:"56f45a29290ed821c2260b07e34c76ad6f4b3008",class:"prefix"},this.label,":"),o?o.label:this.placeholder),h("div",{key:"dcc1f197621169c83f7c935bb06f60f992ac3a58",style:{flex:"1"}}),h("div",{key:"059cede12c8b2c1bca6b53f7e1f01b424dd70882",class:"separator"}),h("div",{key:"722b64600dca7b946044a60700b042d61774dabb",class:"arrow",innerHTML:DropdownArrow,"aria-label":"Open Menu"})),h("div",{key:"3988d0fd9076c4bc1bfb9d45d67f9354022a15cd",class:"items","aria-hidden":!this.open,ref:function(i){return e.dropdownMenu=i},style:{minWidth:c}},(t=this.options)===null||t===void 0?void 0:t.map((function(i){return i.label?h("button",{onClick:function(r){return e.handleSelectOption(r,i)},class:"option ".concat(i.value===e.value?"selected":""),disabled:i.disabled},i.label):h("div",{class:"separator"})}))))};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();VerdocsQuickFilter.style=verdocsQuickFilterCss;export{VerdocsQuickFilter$1 as verdocs_pagination,VerdocsQuickFilter as verdocs_quick_filter};
|
1
|
+
var __assign=this&&this.__assign||function(){__assign=Object.assign||function(e){for(var i,r=1,t=arguments.length;r<t;r++){i=arguments[r];for(var o in i)if(Object.prototype.hasOwnProperty.call(i,o))e[o]=i[o]}return e};return __assign.apply(this,arguments)};var __spreadArray=this&&this.__spreadArray||function(e,i,r){if(r||arguments.length===2)for(var t=0,o=i.length,s;t<o;t++){if(s||!(t in i)){if(!s)s=Array.prototype.slice.call(i,0,t);s[t]=i[t]}}return e.concat(s||Array.prototype.slice.call(i))};import{r as registerInstance,c as createEvent,h,H as Host,g as getElement}from"./index-CF7i8guW.js";import{integerSequence}from"@verdocs/js-sdk";import{b as renderedTextWidth}from"./utils-DmfOx9Ey.js";import{c as createPopper}from"./popper-BfP9ezJQ.js";import"./_commonjsHelpers-BFTU3MAI.js";import"./index-dzBXqXlK.js";import"./Types-Dl7Xw8F0.js";var verdocsPaginationCss='@-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-pagination{gap:8px;display:-ms-flexbox;display:flex;-ms-flex-direction:row;flex-direction:row;font-family:"Inter", "Barlow", sans-serif}verdocs-pagination .page-button{height:38px;display:-ms-flexbox;display:flex;-ms-flex:0 0 38px;flex:0 0 38px;cursor:pointer;font-size:16px;font-weight:600;border-radius:4px;-ms-flex-align:center;align-items:center;-ms-flex-pack:center;justify-content:center;color:#33364b;border:1px solid #654dcb}verdocs-pagination .page-button svg{width:18px;height:18px}verdocs-pagination .page-button.selected{cursor:default;color:#ffffff;background:#654dcb}verdocs-pagination .ellipsis{width:38px;height:38px;display:-ms-flexbox;display:flex;-ms-flex:0 0 38px;flex:0 0 38px;line-height:32px;-ms-flex-pack:center;justify-content:center;color:#33364b}';var ChevronDoubleLeft='<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M18.75 19.5l-7.5-7.5 7.5-7.5m-6 15L5.25 12l7.5-7.5" /></svg>';var ChevronDoubleRight='<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" d="M11.25 4.5l7.5 7.5-7.5 7.5m-6-15l7.5 7.5-7.5 7.5" /></svg>';var VISIBLE_PAGES=5;var PageButton=function(e){var i=e.page,r=e.selected,t=e.onClick;var o;if(i==="first"){o=ChevronDoubleLeft}else if(i==="last"){o=ChevronDoubleRight}else{o=String(i+1)}return h("div",{class:"page-button ".concat(i===r?"selected":""),onClick:function(){return t(i)},innerHTML:o})};var VerdocsQuickFilter$1=function(){function e(e){registerInstance(this,e);this.selectPage=createEvent(this,"selectPage");this.selectedPage=0;this.itemCount=1;this.perPage=10}e.prototype.handleSelectPage=function(e){var i;this.selectedPage=e;(i=this.selectPage)===null||i===void 0?void 0:i.emit({selectedPage:e})};e.prototype.render=function(){var e=this;var i=Math.max(0,this.selectedPage-2);var r=this.itemCount>0?Math.ceil(this.itemCount/this.perPage):0;var t=integerSequence(0,Math.ceil(this.itemCount/this.perPage)).slice(i,i+VISIBLE_PAGES);return h(Host,{key:"b914afe290065b1f65b3632a1e205a0138d4ca96"},this.selectedPage>0&&h(PageButton,{key:"06d4c575361cffc6299409c66557208fef8180e9",page:"first",selected:this.selectedPage,onClick:function(){return e.handleSelectPage(0)}}),i>0&&h("div",{key:"14afa9724ff8159c20c372821fff58a98b721bc7",class:"ellipsis"},"..."),t.map((function(i){return h(PageButton,{page:i,selected:e.selectedPage,onClick:function(i){return e.handleSelectPage(+i)}})})),this.selectedPage<r-1&&h("div",{key:"0b22a68cafaf3beda898442422a584cc9da811d9",class:"ellipsis"},"..."),this.selectedPage<r-1&&h(PageButton,{key:"56bfdb75c0a6bb0aab32aa61860051517fcf360b",page:"last",selected:this.selectedPage,onClick:function(){return e.handleSelectPage(r-1)}}))};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();VerdocsQuickFilter$1.style=verdocsPaginationCss;var verdocsQuickFilterCss='@-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-quick-filter{position:relative;font-family:"Inter", "Barlow", sans-serif}verdocs-quick-filter .control{outline:0;height:34px;display:-ms-flexbox;display:flex;cursor:pointer;border-radius:4px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-webkit-box-sizing:border-box;box-sizing:border-box;background:#ffffff;-webkit-transition:all 100ms ease 0s;transition:all 100ms ease 0s;border:1px solid #cccccc}verdocs-quick-filter .title{padding:0 8px;font-size:14px;max-width:100%;overflow:hidden;color:#33364b;white-space:nowrap;-webkit-box-sizing:border-box;box-sizing:border-box;text-overflow:ellipsis}verdocs-quick-filter .title .prefix{display:inline;font-weight:700;margin:0 7px 0 0;color:#4c56cb}verdocs-quick-filter .arrow{width:32px;height:32px;border:none;outline:none;cursor:pointer;-ms-flex-align:center;align-items:center;display:-ms-inline-flexbox;display:inline-flex;-ms-flex-pack:center;justify-content:center;background:#ffffff;-webkit-transition:color 150ms ease 0s;transition:color 150ms ease 0s}verdocs-quick-filter .arrow svg{-webkit-transition:0.3s;transition:0.3s;fill:#cccccc}verdocs-quick-filter .separator{width:1px;display:block;margin-top:8px;margin-bottom:8px;-ms-flex-item-align:stretch;align-self:stretch;-webkit-box-sizing:border-box;box-sizing:border-box;background-color:#cccccc}verdocs-quick-filter .items{display:none;z-index:10000;position:absolute;border-radius:4px;background:#ffffff;-webkit-box-shadow:rgba(0, 0, 0, 0.1) 0 0 0 1px, rgba(0, 0, 0, 0.1) 0 4px 11px;box-shadow:rgba(0, 0, 0, 0.1) 0 0 0 1px, rgba(0, 0, 0, 0.1) 0 4px 11px}verdocs-quick-filter .items[data-show]{display:block}verdocs-quick-filter .option{width:100%;border:none;display:block;font-size:14px;text-align:left;background:none;padding:10px 20px;color:#1e2031}verdocs-quick-filter .option:hover{cursor:pointer;background:rgba(76, 86, 203, 0.2470588235)}verdocs-quick-filter .option[disabled]{color:#aaaaaa}verdocs-quick-filter .option[disabled]:hover{cursor:inherit;background:transparent;color:#aaaaaa}verdocs-quick-filter.open .items{display:block}verdocs-quick-filter.open .arrow svg{-webkit-transform:scaleY(-1);transform:scaleY(-1)}';var DropdownArrow='<svg height="20" width="20" viewBox="0 0 20 20" aria-hidden="true" focusable="false" class="css-8mmkcg"><path d="M4.516 7.548c0.436-0.446 1.043-0.481 1.576 0l3.908 3.747 3.908-3.747c0.533-0.481 1.141-0.446 1.574 0 0.436 0.445 0.408 1.197 0 1.615-0.406 0.418-4.695 4.502-4.695 4.502-0.217 0.223-0.502 0.335-0.787 0.335s-0.57-0.112-0.789-0.335c0 0-4.287-4.084-4.695-4.502s-0.436-1.17 0-1.615z"></path></svg>';var VerdocsQuickFilter=function(){function e(e){registerInstance(this,e);this.optionSelected=createEvent(this,"optionSelected");this.options=[];this.label="Filter";this.value="";this.placeholder="Select...";this.clickListenerSymbol=new AbortController}e.prototype.componentDidLoad=function(){this.popper=createPopper(this.dropdownButton,this.dropdownMenu,{placement:"bottom-start",modifiers:[{name:"offset",options:{offset:[-1,14]}}]});window.addEventListener("click",this.clickListener.bind(this),{signal:this.clickListenerSymbol.signal})};e.prototype.disconnectedCallback=function(){this.clickListenerSymbol.abort()};e.prototype.clickListener=function(e){var i=!(e.target==this.el||this.el.contains(e.target));if(i){this.hide()}};e.prototype.handleSelectOption=function(e,i){e.stopPropagation();this.optionSelected.emit(i);this.value=i.value;this.hide()};e.prototype.showDropdown=function(){var e,i;this.open=true;this.dropdownMenu.setAttribute("data-show","");this.dropdownMenu.removeAttribute("aria-hidden");(e=this.popper)===null||e===void 0?void 0:e.setOptions((function(e){return __assign(__assign({},e),{modifiers:__spreadArray(__spreadArray([],e.modifiers,true),[{name:"eventListeners",enabled:true}],false)})})).catch((function(){}));(i=this.popper)===null||i===void 0?void 0:i.update().catch((function(){}))};e.prototype.handleHideDropdown=function(e){var i,r;if(((i=e===null||e===void 0?void 0:e.target)===null||i===void 0?void 0:i.localName)==="button"&&((r=e===null||e===void 0?void 0:e.target)===null||r===void 0?void 0:r.className)==="arrow"){return}this.hide()};e.prototype.toggleDropdown=function(e){e.stopPropagation();if(this.open){this.hide()}else{this.showDropdown()}};e.prototype.hide=function(){var e;this.open=false;this.dropdownMenu.removeAttribute("data-show");this.dropdownMenu.setAttribute("aria-hidden","true");(e=this.popper)===null||e===void 0?void 0:e.setOptions((function(e){return __assign(__assign({},e),{modifiers:__spreadArray(__spreadArray([],e.modifiers,true),[{name:"eventListeners",enabled:false}],false)})})).catch((function(){}))};e.prototype.render=function(){var e=this;var i,r,t;var o=(i=this.options)===null||i===void 0?void 0:i.find((function(i){return i.value===e.value}));var s=(r=this.options)===null||r===void 0?void 0:r.reduce((function(e,i){return e.label.length>i.label.length?e:i}));var n=renderedTextWidth((s===null||s===void 0?void 0:s.label)||"FILLER","14px Inter, Barlow, sans-serif");var a=renderedTextWidth(this.label,"14px Inter, Barlow, sans-serif");var c="".concat(n+a+40,"px");return h(Host,{key:"2775a9460418249e5830b3acc29bc501dfc0b7e9",class:{open:!!this.open},style:{minWidth:c,display:"inline-block"}},h("div",{key:"a0d32bee5bf3a83860d1ee34b70dd08e14ff6f5a",class:"control",onClick:function(i){return e.toggleDropdown(i)},onBlur:function(i){return e.handleHideDropdown(i)}},h("div",{key:"e28fc8c51bd4913814770bfa3eed9aec685fcdc7",class:"title",ref:function(i){return e.dropdownButton=i}},h("span",{key:"56f45a29290ed821c2260b07e34c76ad6f4b3008",class:"prefix"},this.label,":"),o?o.label:this.placeholder),h("div",{key:"dcc1f197621169c83f7c935bb06f60f992ac3a58",style:{flex:"1"}}),h("div",{key:"059cede12c8b2c1bca6b53f7e1f01b424dd70882",class:"separator"}),h("div",{key:"722b64600dca7b946044a60700b042d61774dabb",class:"arrow",innerHTML:DropdownArrow,"aria-label":"Open Menu"})),h("div",{key:"3988d0fd9076c4bc1bfb9d45d67f9354022a15cd",class:"items","aria-hidden":!this.open,ref:function(i){return e.dropdownMenu=i},style:{minWidth:c}},(t=this.options)===null||t===void 0?void 0:t.map((function(i){return i.label?h("button",{onClick:function(r){return e.handleSelectOption(r,i)},class:"option ".concat(i.value===e.value?"selected":""),disabled:i.disabled},i.label):h("div",{class:"separator"})}))))};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();VerdocsQuickFilter.style=verdocsQuickFilterCss;export{VerdocsQuickFilter$1 as verdocs_pagination,VerdocsQuickFilter as verdocs_quick_filter};
|
2
2
|
//# sourceMappingURL=verdocs-pagination_2.entry.js.map
|
@@ -1,3 +1,3 @@
|
|
1
|
-
var __assign=this&&this.__assign||function(){__assign=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++){t=arguments[n];for(var o in t)if(Object.prototype.hasOwnProperty.call(t,o))e[o]=t[o]}return e};return __assign.apply(this,arguments)};var __awaiter=this&&this.__awaiter||function(e,t,n,i){function o(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,r){function s(e){try{l(i.next(e))}catch(e){r(e)}}function a(e){try{l(i["throw"](e))}catch(e){r(e)}}function l(e){e.done?n(e.value):o(e.value).then(s,a)}l((i=i.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var n={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},i,o,r,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(e){return function(t){return l([e,t])}}function l(a){if(i)throw new TypeError("Generator is already executing.");while(s&&(s=0,a[0]&&(n=0)),n)try{if(i=1,o&&(r=a[0]&2?o["return"]:a[0]?o["throw"]||((r=o["return"])&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;if(o=0,r)a=[a[0]&2,r.value];switch(a[0]){case 0:case 1:r=a;break;case 4:n.label++;return{value:a[1],done:false};case 5:n.label++;o=a[1];a=[0];continue;case 7:a=n.ops.pop();n.trys.pop();continue;default:if(!(r=n.trys,r=r.length>0&&r[r.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!r||a[1]>r[0]&&a[1]<r[3])){n.label=a[1];break}if(a[0]===6&&n.label<r[1]){n.label=r[1];r=a;break}if(r&&n.label<r[2]){n.label=r[2];n.ops.push(a);break}if(r[2])n.ops.pop();n.trys.pop();continue}a=t.call(e,n)}catch(e){a=[6,e];o=0}finally{i=r=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,t,n){if(n||arguments.length===2)for(var i=0,o=t.length,r;i<o;i++){if(r||!(i in t)){if(!r)r=Array.prototype.slice.call(t,0,i);r[i]=t[i]}}return e.concat(r||Array.prototype.slice.call(t))};import{r as registerInstance,c as createEvent,h,H as Host,F as Fragment,g as getElement}from"./index-CF7i8guW.js";import{VerdocsEndpoint,getTemplate,integerSequence,getOrganizationContacts,isValidEmail,createEnvelope,formatFullName,getRGBA,createTemplateDocument,deleteTemplateDocument,updateField,createField,updateTemplateRole,createTemplateRole,updateTemplate}from"@verdocs/js-sdk";import{S as SDKError}from"./errors-C1sRVZWv.js";import{S as Store}from"./Datastore-C_IIZj49.js";import{D as DefaultEndpoint}from"./Environment-C_Xku1v2.js";import{V as VerdocsToast}from"./Toast-CyvDgtoV.js";import{D as DocIcon,P as PngIcon,J as JpgIcon,a as PdfIcon,F as FileIcon,b as PageCountIcon,T as TrashIcon}from"./Icons-7LXbcjVz.js";import{d as dateFnsExports}from"./index-dzBXqXlK.js";import{i as interact}from"./interact.min-BepJAdBZ.js";import{g as getFieldId,e as updateCssTransform,f as removeCssTransform,h as setControlStyles,i as defaultHeight,j as defaultWidth}from"./utils-CbfXTNEw.js";import{g as getDefaultExportFromCjs}from"./_commonjsHelpers-BFTU3MAI.js";import"./Types-Dl7Xw8F0.js";var verdocsPreviewCss='@-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}';var VerdocsPreview=function(){function e(e){registerInstance(this,e);this.sdkError=createEvent(this,"sdkError");this.templateListenerId=null;this.endpoint=VerdocsEndpoint.getDefault();this.templateId=null;this.loading=true;this.template=null}e.prototype.disconnectedCallback=function(){this.unlistenToTemplate()};e.prototype.listenToTemplate=function(){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(t){this.unlistenToTemplate();Store.subscribe("templates",this.templateId,(function(){return getTemplate(e.endpoint,e.templateId)}),false,(function(t){e.template=t;e.loading=false}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){Store.store.delListener(this.templateListenerId);this.templateListenerId=null}};e.prototype.onTemplateIdChanged=function(e){console.log("[PREVIEW] Template ID changed",e);this.listenToTemplate()};e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n;return __generator(this,(function(i){try{this.endpoint.loadSession();if(!this.endpoint.session){console.log("[PREVIEW] Unable to start builder session, must be authenticated");return[2]}if(!this.templateId){console.log("[PREVIEW] Missing required template ID ".concat(this.templateId));return[2]}this.listenToTemplate()}catch(i){console.log("[PREVIEW] Error with preview session",i);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new SDKError(i.message,(t=i.response)===null||t===void 0?void 0:t.status,(n=i.response)===null||n===void 0?void 0:n.data))}return[2]}))}))};e.prototype.handlePageRendered=function(e){};e.prototype.render=function(){var e=this;var t;if(this.loading){return h(Host,null,h("verdocs-loader",null))}return h(Host,null,(((t=this.template)===null||t===void 0?void 0:t.documents)||[]).map((function(t){var n=integerSequence(1,t.pages);return h(Fragment,null,n.map((function(n){var i;var o=((i=t.page_sizes)===null||i===void 0?void 0:i[n])||{width:612,height:792};return h("verdocs-template-document-page",{templateId:t.template_id,documentId:t.id,pageNumber:n,disabled:true,editable:false,done:false,virtualWidth:o.width,virtualHeight:o.height,onPageRendered:function(t){return e.handlePageRendered(t)},layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]})})))})))};Object.defineProperty(e,"watchers",{get:function(){return{templateId:["onTemplateIdChanged"]}},enumerable:false,configurable:true});return e}();VerdocsPreview.style=verdocsPreviewCss;var getRoleNames=function(e){return((e===null||e===void 0?void 0:e.roles)||[]).map((function(e){return e.name}))};var getRoleIndex=function(e,t){return Math.max(getRoleNames(e).findIndex((function(e){return e===t})),0)};var verdocsSendCss='@-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)}';var editIcon='<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>';var startIcon='<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>';var stepIcon='<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>';var doneIcon='<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>';var VerdocsSend=function(){function e(e){registerInstance(this,e);this.beforeSend=createEvent(this,"beforeSend");this.send=createEvent(this,"send");this.exit=createEvent(this,"exit");this.sdkError=createEvent(this,"sdkError");this.searchContacts=createEvent(this,"searchContacts");this.templateListenerId=null;this.endpoint=DefaultEndpoint;this.templateId=null;this.environment="";this.containerId="verdocs-send-".concat(Math.random().toString(36).substring(2,11));this.showPickerForId="";this.sessionContacts=[];this.sending=false;this.rolesCompleted={};this.loading=true;this.template=null}e.prototype.disconnectedCallback=function(){this.unlistenToTemplate()};e.prototype.listenToTemplate=function(){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(t){console.log("[SEND] Loading template",this.templateId);this.unlistenToTemplate();Store.subscribe("templates",this.templateId,(function(){return getTemplate(e.endpoint,e.templateId)}),true,(function(t){console.log("[SEND] Got new template",t);e.template=t;e.loading=false;e.rolesCompleted={};e.recomputeRolesCompleted()}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){Store.store.delListener(this.templateListenerId);this.templateListenerId=null}};e.prototype.reset=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.rolesCompleted={};return[2]}))}))};e.prototype.onTemplateIdChanged=function(e){console.log("[SEND] Template ID changed",e);this.listenToTemplate()};e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n;var i=this;return __generator(this,(function(o){try{this.endpoint.onSessionChanged((function(e,t,n){if(!n){return}var o={id:n.id,first_name:n.first_name,last_name:n.last_name,email:n.email,phone:n.phone};if(n){i.sessionContacts=[o];getOrganizationContacts(i.endpoint).then((function(e){console.log("[SEND] Got contacts",e);i.sessionContacts=__spreadArray(__spreadArray([],e,true),[o],false)})).catch((function(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[2]}if(!this.templateId){console.log("[SEND] Missing required template ID ".concat(this.templateId));return[2]}this.listenToTemplate()}catch(i){console.log("[SEND] Error with send session",i);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new SDKError(i.message,(t=i.response)===null||t===void 0?void 0:t.status,(n=i.response)===null||n===void 0?void 0:n.data))}return[2]}))}))};e.prototype.recomputeRolesCompleted=function(){var e=this;var t;this.rolesCompleted={};var n={};(((t=this.template)===null||t===void 0?void 0:t.roles)||[]).forEach((function(t){var i=t.sequence;n[i]||(n[i]=[]);var o="r-".concat(i,"-").concat(n[i].length);n[i].push(__assign(__assign({},t),{id:o,role_name:t.name,first_name:t.first_name,last_name:t.last_name}));if(t.first_name&&isValidEmail(t.email)){e.rolesCompleted[o]=__assign(__assign({},t),{id:o,role_name:t.name,first_name:t.first_name,last_name:t.last_name})}}))};e.prototype.getSequenceNumbers=function(){var e;var t={};(((e=this.template)===null||e===void 0?void 0:e.roles)||[]).forEach((function(e){t[e.sequence]=true}));return Object.keys(t).map((function(e){return+e})).sort((function(e,t){return e-t}))};e.prototype.getRolesAtLevel=function(e){var t;var n=(((t=this.template)===null||t===void 0?void 0:t.roles)||[]).filter((function(t){return t.sequence===e})).map((function(t,n){return __assign(__assign({},t),{id:"r-".concat(e,"-").concat(n),role_name:t.name,first_name:t.first_name,last_name:t.last_name})}));return n};e.prototype.getLevelIcon=function(e){if(e==="start"){return h("div",{class:"level-icon",innerHTML:startIcon})}else if(e==="end"){return h("div",{class:"level-icon",innerHTML:doneIcon})}else{return h("div",{class:"level-icon",innerHTML:stepIcon})}};e.prototype.handleSelectContact=function(e,t){e.preventDefault();this.rolesCompleted[t.id]=__assign(__assign({},t),e.detail);this.showPickerForId=""};e.prototype.handleClickRole=function(e,t){e.stopPropagation();this.showPickerForId=t.id};e.prototype.handleSend=function(e){var t=this;var n;if(this.sending){console.log("[SEND] Skipping duplicate send",e);return}console.log("[SEND] Sending",e);e.preventDefault();e.stopPropagation();this.sending=true;var i={template_id:this.templateId,name:((n=this.template)===null||n===void 0?void 0:n.name)||"New Envelope",environment:this.environment,initial_reminder:0,followup_reminders:0,recipients:Object.values(this.rolesCompleted),fields:[]};var o=this.beforeSend.emit(__assign(__assign({},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);createEnvelope(this.endpoint,i).then((function(e){var n;console.log("[SEND] Send envelope",e);t.reset().catch((function(e){return console.log("Unknown Error",e)}));t.sending=false;(n=t.send)===null||n===void 0?void 0:n.emit(__assign(__assign({},i),{name:i.name,envelope_id:e.id,envelope:e}))})).catch((function(e){var n,i,o;console.log("[SEND] Send error",e);VerdocsToast(((i=(n=e.response)===null||n===void 0?void 0:n.data)===null||i===void 0?void 0:i.error)||"Error creating envelope, please try again later.");t.sending=false;(o=t.sdkError)===null||o===void 0?void 0:o.emit(e)}))};e.prototype.handleCancel=function(e){var t;e.stopPropagation();(t=this.exit)===null||t===void 0?void 0:t.emit()};e.prototype.render=function(){var e=this;var t;if(this.loading){return h(Host,null,h("verdocs-loader",null))}if(!this.endpoint.session){return h(Host,{style:{display:"flex"}},h("verdocs-component-error",{message:"You must be authenticated to use this module."}))}var n=this.getSequenceNumbers();var i=Object.values(this.rolesCompleted).filter((function(e){return isValidEmail(e.email)&&e.first_name&&e.last_name}));var o=i.length>=getRoleNames(this.template).length;return h(Host,{class:{sendable:(t=this.template)===null||t===void 0?void 0:t.is_sendable}},h("div",{class:"recipients"},h("div",{class:"left-line"}),h("div",{class:"level level-start"},this.getLevelIcon("start"),h("div",{class:"complete"},"Send Envelope")),n.map((function(t){return h("div",{class:"level level-".concat(t)},e.getLevelIcon("sequence"),e.getRolesAtLevel(t).map((function(t){var n,o,r;var s=!t.email||!t.first_name||!t.last_name;var a=((n=e.rolesCompleted[t.id])===null||n===void 0?void 0:n.first_name)?formatFullName(e.rolesCompleted[t.id]):s?t.role_name:formatFullName(t);var l="verdocs-send-recipient-".concat(t.role_name);var c=getRoleIndex(e.template,t.role_name);var u=getRGBA(c);var d=i.findIndex((function(e){return e.role_name===t.role_name}))>-1;var f={backgroundColor:u,border:d?"2px solid #55bc81":"2px solid #dddddd"};return s?h("div",{class:"recipient","data-ri":c,"data-rn":t.role_name,style:f,onClick:function(n){return e.handleClickRole(n,t)},id:l},a,h("div",{class:"icon",innerHTML:editIcon}),e.showPickerForId===t.id&&h("verdocs-portal",{anchor:l,onClickAway:function(){return e.showPickerForId=""}},h("verdocs-contact-picker",{onExit:function(){return e.showPickerForId=""},onNext:function(n){return e.handleSelectContact(n,t)},contactSuggestions:e.sessionContacts,templateRole:(o=e.rolesCompleted[t.id])!==null&&o!==void 0?o:t,onSearchContacts:function(t){var n;return(n=e.searchContacts)===null||n===void 0?void 0:n.emit(t.detail)}}))):h("div",{class:"recipient","data-ri":c,"data-rn":t.role_name,style:f,onClick:function(n){return e.handleClickRole(n,t)},id:l},a,h("div",{class:"icon",innerHTML:editIcon}),e.showPickerForId===t.id&&h("verdocs-portal",{anchor:l,onClickAway:function(){return e.showPickerForId=""}},h("verdocs-contact-picker",{onExit:function(){return e.showPickerForId=""},onNext:function(n){return e.handleSelectContact(n,t)},contactSuggestions:e.sessionContacts,templateRole:(r=e.rolesCompleted[t.id])!==null&&r!==void 0?r:t,onSearchContacts:function(t){var n;return(n=e.searchContacts)===null||n===void 0?void 0:n.emit(t.detail)}})))})))})),h("div",{class:"level level-done"},this.getLevelIcon("end"),h("div",{class:"complete"},"Signing Complete"))),h("div",{class:"buttons"},h("verdocs-button",{label:"Cancel",size:"small",variant:"outline",onClick:function(t){return e.handleCancel(t)},disabled:this.sending}),h("verdocs-button",{label:"Send",size:"small",disabled:!o||this.sending,onClick:function(t){return e.handleSend(t)}}),this.sending&&h("verdocs-spinner",null)))};Object.defineProperty(e,"watchers",{get:function(){return{templateId:["onTemplateIdChanged"]}},enumerable:false,configurable:true});return e}();VerdocsSend.style=verdocsSendCss;var verdocsTemplateAttachmentsCss='@-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}';var VerdocsTemplateAttachments=function(){function e(e){registerInstance(this,e);this.exit=createEvent(this,"exit");this.next=createEvent(this,"next");this.templateUpdated=createEvent(this,"templateUpdated");this.sdkError=createEvent(this,"sdkError");this.templateListenerId=null;this.endpoint=VerdocsEndpoint.getDefault();this.templateId="";this.uploading=false;this.progressLabel="Uploading...";this.progressPercent=0;this.showDeleteError=false;this.confirmDeleteDocument=null;this.loading=true;this.template=null}e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n;return __generator(this,(function(i){try{this.endpoint.loadSession();if(!this.templateId){console.log("[ROLES] Missing required template ID ".concat(this.templateId));return[2]}if(!this.endpoint.session){console.log("[ROLES] Unable to start builder session, must be authenticated");return[2]}this.listenToTemplate()}catch(i){console.log("[TEMPLATE ATTACHMENTS] Error loading template",i);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new SDKError(i.message,(t=i.response)===null||t===void 0?void 0:t.status,(n=i.response)===null||n===void 0?void 0:n.data))}return[2]}))}))};e.prototype.disconnectedCallback=function(){this.unlistenToTemplate()};e.prototype.listenToTemplate=function(){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(t){this.unlistenToTemplate();Store.subscribe("templates",this.templateId,(function(){return getTemplate(e.endpoint,e.templateId)}),false,(function(t){e.template=t;e.loading=false}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){Store.store.delListener(this.templateListenerId);this.templateListenerId=null}};e.prototype.handleCancel=function(e){e.stopPropagation();this.exit.emit()};e.prototype.handleUploadProgress=function(e){if(e>=99){this.progressPercent=100;this.progressLabel="Processing..."}else{this.progressPercent=e}};e.prototype.handleUpload=function(e){return __awaiter(this,void 0,void 0,(function(){var t,n,i,o,r,s,a,l;return __generator(this,(function(c){switch(c.label){case 0:e.stopPropagation();r=e.detail.file;if(!r){return[2]}console.log("[ATTACHMENTS] Uploading...",r);this.uploading=true;this.progressLabel="Uploading...";c.label=1;case 1:c.trys.push([1,4,,5]);return[4,createTemplateDocument(this.endpoint,this.templateId,r,this.handleUploadProgress.bind(this))];case 2:s=c.sent();console.log("[ATTACHMENTS] Created attachment",s);a=this;return[4,Store.getTemplate(this.endpoint,this.templateId,true)];case 3:a.template=c.sent();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;return[3,5];case 4:l=c.sent();console.log("[ATTACHMENTS] Error creating template",l);(n=this.sdkError)===null||n===void 0?void 0:n.emit(new SDKError(l.message,(i=l.response)===null||i===void 0?void 0:i.status,(o=l.response)===null||o===void 0?void 0:o.data));this.uploading=false;return[3,5];case 5:return[2]}}))}))};e.prototype.handleNext=function(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})};e.prototype.confirmDelete=function(){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:return[4,deleteTemplateDocument(this.endpoint,this.templateId,this.confirmDeleteDocument.id)];case 1:t.sent();e=this;return[4,Store.getTemplate(this.endpoint,this.templateId,true)];case 2:e.template=t.sent();console.log("[ATTACHMENTS] New template",this.template);this.confirmDeleteDocument=null;return[2]}}))}))};e.prototype.handleDelete=function(e){return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(n){if((((t=this.template)===null||t===void 0?void 0:t.documents)||[]).length>1){this.confirmDeleteDocument=e}else{this.showDeleteError=true}return[2]}))}))};e.prototype.getFileIcon=function(e){switch(e.mime){case"application/pdf":return PdfIcon;case"image/jpeg":return JpgIcon;case"image/png":return PngIcon;case"application/msword":case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return DocIcon}return FileIcon};e.prototype.render=function(){var e=this;var t,n;if(!this.endpoint.session){return h(Host,null,h("verdocs-component-error",{message:"You must be authenticated to use this module."}))}if(this.loading){return h(Host,{class:"loading"},h("verdocs-loader",null))}if(!this.endpoint.session||!this.template){return h(Host,{class:"empty"})}return h(Host,null,h("h5",null,"Existing Attachments"),h("div",{class:"attachments"},(((t=this.template)===null||t===void 0?void 0:t.documents)||[]).map((function(t){return h("div",{class:"attachment"},h("div",{class:"file-icon",innerHTML:e.getFileIcon(t)}),h("div",{class:"filename",title:t.name},t.name),h("div",{class:"pages"},h("div",{class:"count"},t.pages),h("div",{class:"pages-icon",innerHTML:PageCountIcon})),h("div",{class:"trash-icon",innerHTML:TrashIcon,onClick:function(){return e.handleDelete(t)}}))}))),h("h5",null,"Attach a New Document"),this.uploading?h("div",{class:"loader-wrapper"},h("verdocs-loader",null),this.progressLabel&&h("div",{class:"progress-wrapper"},h("verdocs-progress-bar",{showPercent:true,percent:this.progressPercent,label:this.progressLabel}))):h("verdocs-file-chooser",{onFileSelected:function(t){return e.handleUpload(t)}}),h("div",{class:"buttons"},h("verdocs-button",{variant:"outline",label:"Cancel",size:"small",onClick:function(t){return e.handleCancel(t)},disabled:this.uploading}),h("verdocs-button",{label:"Next",size:"small",onClick:function(t){return e.handleNext(t)},disabled:!(((n=this.template)===null||n===void 0?void 0:n.documents)||[]).length||this.uploading})),this.showDeleteError&&h("verdocs-ok-dialog",{heading:"Unable to Delete Attachment",message:"Templates must contain at least one attachment.",onNext:function(){return e.showDeleteError=false}}),this.confirmDeleteDocument&&h("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:function(){return e.confirmDelete()},showCancel:true,onExit:function(){e.confirmDeleteDocument=null}}))};return e}();VerdocsTemplateAttachments.style=verdocsTemplateAttachmentsCss;var verdocsTemplateBuildTabsCss='@-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}';var HelpIcon='<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>';var CopyIcon='<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>';var STEPS=["attachments","roles","settings","fields","preview"];var VerdocsTemplateBuildTabs=function(){function e(e){registerInstance(this,e);this.sdkError=createEvent(this,"sdkError");this.stepChanged=createEvent(this,"stepChanged");this.templateListenerId=null;this.endpoint=VerdocsEndpoint.getDefault();this.templateId=null;this.step="preview";this.loading=true;this.template=null}e.prototype.disconnectedCallback=function(){this.unlistenToTemplate()};e.prototype.listenToTemplate=function(){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(t){this.unlistenToTemplate();Store.subscribe("templates",this.templateId,(function(){return getTemplate(e.endpoint,e.templateId)}),false,(function(t){e.template=t;e.loading=false}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){Store.store.delListener(this.templateListenerId);this.templateListenerId=null}};e.prototype.onTemplateIdChanged=function(e){console.log("[BUILD_TABS] Template ID changed",e);this.listenToTemplate()};e.prototype.onStepChanged=function(e){console.log("[BUILD_TABS] Step changed",e)};e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n;return __generator(this,(function(i){try{this.endpoint.loadSession();if(!this.endpoint.session){console.log("[BUILD_TABS] Unable to start builder session, must be authenticated");return[2]}if(!this.templateId){this.step="attachments";console.log("[BUILD_TABS] Missing required template ID, forcing view to attachments");return[2]}this.listenToTemplate()}catch(i){console.log("[BUILD_TABS] Error loading template",i);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new SDKError(i.message,(t=i.response)===null||t===void 0?void 0:t.status,(n=i.response)===null||n===void 0?void 0:n.data))}return[2]}))}))};e.prototype.setStep=function(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)};e.prototype.copyTemplateId=function(){var e=this;navigator.clipboard.writeText(this.templateId).then((function(){VerdocsToast("Template ID copied",{style:"success",duration:3e3})})).catch((function(t){var n;console.warn("[BUILD_TABS] Error copying to clipboard",t);(n=e.sdkError)===null||n===void 0?void 0:n.emit(t)}))};e.prototype.render=function(){var e=this;var t,n,i,o,r,s,a,l,c;if(this.loading){return h(Host,null,h("verdocs-loader",null))}if(!this.endpoint.session){return h(Host,null,h("verdocs-component-error",{message:"You must be authenticated to use this module."}))}var u=(((t=this.template)===null||t===void 0?void 0:t.documents)||[]).length>0;var d=u&&(((n=this.template)===null||n===void 0?void 0:n.roles)||[]).length>0;var f=d&&(((i=this.template)===null||i===void 0?void 0:i.fields)||[]).length>0;var v=Math.max(STEPS.indexOf(this.step),0);if(!f&&v>=4){v=3}if(!d&&v>=3){v=1}if(!u&&v>=1){v=0}return h(Host,null,h("verdocs-tabs",{onSelectTab:function(t){return e.setStep(t)},selectedTab:v,tabs:[{id:"attachments",disabled:false,label:"Attachment(s)"},{id:"roles",disabled:!u,label:"Roles"},{id:"settings",disabled:!d,label:"Settings"},{id:"fields",disabled:!d,label:"Fields"},{id:"preview",disabled:!f,label:"Preview/Send"}]}),this.templateId&&h("div",{class:"info"},h("verdocs-button-panel",{icon:HelpIcon},h("div",{class:"template-details-panel"},h("h6",null,"Template Details"),h("div",{class:"row"},h("label",null,"ID:"),h("div",{class:"value"},this.templateId),h("div",{class:"icon-button",innerHTML:CopyIcon,onClick:function(){return e.copyTemplateId()}})),h("div",{class:"row"},h("label",null,"Name:"),h("div",{class:"value"},(o=this.template)===null||o===void 0?void 0:o.name)),h("div",{class:"row"},h("label",null,"Visibility:"),h("div",{class:"value"},((r=this.template)===null||r===void 0?void 0:r.is_public)?"Public":((s=this.template)===null||s===void 0?void 0:s.is_personal)?"Private":"Shared")),h("div",{class:"row"},h("label",null,"Created:"),h("div",{class:"value"},((a=this.template)===null||a===void 0?void 0:a.counter)?dateFnsExports.format(new Date((l=this.template)===null||l===void 0?void 0:l.created_at),"P p"):"")),h("div",{class:"row"},h("label",null,"Used:"),h("div",{class:"value"},(c=this.template)===null||c===void 0?void 0:c.counter," time(s)"))))))};Object.defineProperty(e,"watchers",{get:function(){return{templateId:["onTemplateIdChanged"],step:["onStepChanged"]}},enumerable:false,configurable:true});return e}();VerdocsTemplateBuildTabs.style=verdocsTemplateBuildTabsCss;var verdocsTemplateFieldsCss="@-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}";var iconTextbox='<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>';var iconCheck='<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>';var iconRadio='<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>';var iconDatepicker='<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>';var iconSignature='<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>';var iconInitial='<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>';var iconTimestamp='<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>';var iconDropdown='<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>';var iconAttachment='<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>';var separator='<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>';var menuOptions=[{id:"signature",tooltip:"Signature",icon:iconSignature,class:"signature"},{id:"initial",tooltip:"Initials",icon:iconInitial,class:"initial"},{id:"sep1",tooltip:"",icon:separator,class:"separator"},{id:"textbox",tooltip:"Text Box",icon:iconTextbox,class:"textbox"},{id:"checkbox",tooltip:"Check Box",icon:iconCheck,class:"checkbox"},{id:"radio",tooltip:"Radio Button",icon:iconRadio,class:"radio"},{id:"dropdown",tooltip:"Dropdown",icon:iconDropdown,class:"dropdown"},{id:"sep2",tooltip:"",icon:separator,class:"separator"},{id:"date",tooltip:"Date",icon:iconDatepicker,class:"date"},{id:"timestamp",tooltip:"Timestamp",icon:iconTimestamp,class:"timestamp"},{id:"attachment",tooltip:"Attachment",icon:iconAttachment,class:"attachment"}];var VerdocsTemplateFields=function(){function e(e){registerInstance(this,e);this.sdkError=createEvent(this,"sdkError");this.templateUpdated=createEvent(this,"templateUpdated");this.fieldsUpdated=createEvent(this,"fieldsUpdated");this.templateListenerId=null;this.endpoint=VerdocsEndpoint.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={}}e.prototype.onTemplateIdChanged=function(){this.listenToTemplate()};e.prototype.handleKeyDown=function(e){if(e.key==="Escape"){this.placing=null}};e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n;return __generator(this,(function(i){try{this.endpoint.loadSession();if(!this.templateId){console.log("[FIELDS] Missing required template ID ".concat(this.templateId));return[2]}if(!this.endpoint.session){console.log("[FIELDS] Unable to start builder session, must be authenticated");return[2]}this.listenToTemplate()}catch(i){console.log("[FIELDS] Error with fields session",i);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new SDKError(i.message,(t=i.response)===null||t===void 0?void 0:t.status,(n=i.response)===null||n===void 0?void 0:n.data))}return[2]}))}))};e.prototype.componentDidRender=function(){interact.dynamicDrop(true);var e=this.toolbarTargetId?document.getElementById(this.toolbarTargetId):null;var t=document.getElementById("verdocs-template-fields-toolbar");if(e&&t){console.log("[FIELDS] Moving toolbar");t.remove();e.append(t)}};e.prototype.componentWillUpdate=function(){var e=this;var t,n;var i=((t=this.template)===null||t===void 0?void 0:t.roles)||[];if(!this.selectedRoleName||!i.find((function(t){return t&&t.name===e.selectedRoleName}))){this.selectedRoleName=((n=i[0])===null||n===void 0?void 0:n.name)||"";console.log("[FIELDS] Selected new role",this.selectedRoleName)}};e.prototype.disconnectedCallback=function(){this.unlistenToTemplate()};e.prototype.listenToTemplate=function(){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(t){this.unlistenToTemplate();Store.subscribe("templates",this.templateId,(function(){return getTemplate(e.endpoint,e.templateId)}),false,(function(t){var n,i;e.template=t;e.loading=false;if(!e.selectedRoleName){e.selectedRoleName=((i=(n=t.roles)===null||n===void 0?void 0:n[0])===null||i===void 0?void 0:i.name)||""}}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){Store.store.delListener(this.templateListenerId);this.templateListenerId=null}};e.prototype.attachFieldAttributes=function(e,t,n){var i=this;n.addEventListener("settingsChanged",(function(){var e;(e=i.templateUpdated)===null||e===void 0?void 0:e.emit({endpoint:i.endpoint,template:i.template,event:"added-field"})}));n.addEventListener("deleted",(function(){var e;n.remove();(e=i.templateUpdated)===null||e===void 0?void 0:e.emit({endpoint:i.endpoint,template:i.template,event:"updated-field"})}));n.setAttribute("templateid",this.templateId);n.setAttribute("fieldname",t.name);n.setAttribute("pageNumber",String(e.pageNumber));n.setAttribute("xScale",String(e.xScale));n.setAttribute("yScale",String(e.yScale));n.setAttribute("name",t.name)};e.prototype.handlePageRendered=function(e){var t=this;var n;var i=e.detail;this.cachedPageInfo[i.pageNumber]=i;this.pageHeights[i.pageNumber]=i.naturalHeight;(((n=this.template)===null||n===void 0?void 0:n.fields)||[]).filter((function(e){return e&&e.page===i.pageNumber})).forEach((function(e){var n=getFieldId(e);var i=document.getElementById(n);if(i){i.setAttribute("fieldname",e.name);i.setAttribute("pagenumber",String(e.page));t.makeDraggable(i)}}))};e.prototype.makeDraggable=function(e){interact(e).draggable({listeners:{move:this.handleMoveField.bind(this),end:this.handleMoveEnd.bind(this)}})};e.prototype.handleMoveField=function(e){return __awaiter(this,void 0,void 0,(function(){var t,n,i,o,r,s;return __generator(this,(function(a){t=+(e.target.getAttribute("posX")||0);n=+(e.target.getAttribute("posY")||0);i=+(e.target.getAttribute("xScale")||1);o=+(e.target.getAttribute("yScale")||1);r=e.dx/i+t;s=e.dy/o+n;e.target.setAttribute("posX",r);e.target.setAttribute("posy",s);updateCssTransform(e.target,"translate","".concat(r,"px, ").concat(s,"px"));return[2]}))}))};e.prototype.handleMoveEnd=function(e){return __awaiter(this,void 0,void 0,(function(){var t,n,i,o,r,s,a,l,c,u,d,h,f,v,p,m,g,b,x,w,E,y,S,_,k,T,C,I,q,M,D,H,V,O,L,z,A,Z,N;return __generator(this,(function(R){switch(R.label){case 0:c=e.target.getAttribute("fieldname");u=(((t=this.template)===null||t===void 0?void 0:t.fields)||[]).find((function(e){return e.name===c}));if(!u){console.log("[FIELDS] Unable to find field",c,e.target);return[2]}d=e.target.getAttribute("pagenumber");h=this.cachedPageInfo[d],f=h.naturalWidth,v=f===void 0?612:f,p=h.naturalHeight,m=p===void 0?792:p,g=h.renderedHeight,b=g===void 0?792:g;x=e.target.getBoundingClientRect();w=e.target.parentElement;E=w.getBoundingClientRect();y=u.width||defaultWidth(u.type);S=u.height||defaultHeight(u.type);_=Math.max(x.left-E.left,0);k=Math.max(b-(E.bottom-x.bottom),0);T=parseInt(d);if(k>b){T=Math.min(T+1,((o=(i=((n=this.template)===null||n===void 0?void 0:n.documents)||[])===null||i===void 0?void 0:i[0])===null||o===void 0?void 0:o.pages)||1);k-=b;b=this.cachedPageInfo[T].renderedHeight;console.log("Next page",{newPageNumber:T,newY:k,renderedHeight:b})}else if(k<0){T=Math.max(T-1,1);b=this.cachedPageInfo[T].renderedHeight;k+=b;console.log("[FIELDS] Next page",{newPageNumber:T,newY:k,renderedHeight:b})}C=this.viewCoordinatesToPageCoordinates(_,k,d,v-y,m-S),I=C.x,q=C.y;R.label=1;case 1:R.trys.push([1,3,,4]);M={x:I,y:q,page:T};return[4,updateField(this.endpoint,this.templateId,c,M)];case 2:D=R.sent();console.log("[FIELDS] Updated",D);H=JSON.parse(JSON.stringify(this.template));V=H.fields.findIndex((function(e){return e.name===c}));if(V>-1){H.fields[V]=D}Store.updateTemplate(this.templateId,H);e.target.removeAttribute("posX");e.target.removeAttribute("posY");removeCssTransform(e.target);O=this.cachedPageInfo[d],L=O.xScale,z=L===void 0?1:L,A=O.yScale,Z=A===void 0?1:A;setControlStyles(e.target,D,z,Z);(r=this.templateUpdated)===null||r===void 0?void 0:r.emit({endpoint:this.endpoint,template:H,event:"updated-field"});return[3,4];case 3:N=R.sent();VerdocsToast("Error updating field, please try again later",{style:"error"});console.log("[FIELDS] Error updating field",N);(s=this.sdkError)===null||s===void 0?void 0:s.emit(new SDKError(N.message,(a=N.response)===null||a===void 0?void 0:a.status,(l=N.response)===null||l===void 0?void 0:l.data));e.target.removeAttribute("posX");e.target.removeAttribute("posY");removeCssTransform(e.target);return[3,4];case 4:return[2]}}))}))};e.prototype.generateFieldName=function(e,t){var n;var i=1;var o;do{o="".concat(e,"P").concat(t,"-").concat(i);i++}while((((n=this.template)===null||n===void 0?void 0:n.fields)||[]).some((function(e){return e&&e.name===o})));return o};e.prototype.viewCoordinatesToPageCoordinates=function(e,t,n,i,o){var r=this.cachedPageInfo[n],s=r.xScale,a=s===void 0?1:s,l=r.yScale,c=l===void 0?1:l,u=r.renderedHeight,d=u===void 0?792:u;var h=Math.floor(Math.min(e/a,i));var f=Math.floor(Math.min(Math.max(d-t,0)/c,o));return{x:h,y:f}};e.prototype.handleClickPage=function(e,t){return __awaiter(this,void 0,void 0,(function(){var n,i,o,r,s,a,l,c,u,d,h,f,v,p,m,g;return __generator(this,(function(b){switch(b.label){case 0:if(!this.placing)return[3,2];i=e.offsetX;o=e.offsetY;r=defaultWidth(this.placing);s=defaultHeight(this.placing);a=this.cachedPageInfo[t];l=a.naturalWidth,c=l===void 0?612:l,u=a.naturalHeight,d=u===void 0?792:u;h=this.viewCoordinatesToPageCoordinates(i,o,t,c-r,d-s);f=Math.floor(h.x);v=Math.floor(h.y);p={name:this.generateFieldName(this.placing,t),role_name:this.selectedRoleName,template_id:this.templateId,document_id:a.documentId,type:this.placing,required:this.placing!=="radio",page:t,validator:null,label:null,default:null,placeholder:null,group:null,settings:{},x:f,y:v,width:r,height:s,multiline:false,readonly:false,options:this.placing==="radio"?[{id:"option-1",label:"Option 1"}]:[]};console.log("[FIELDS] Will save new field",p);return[4,createField(this.endpoint,this.templateId,p)];case 1:m=b.sent();console.log("[FIELDS] Saved field",m);g=JSON.parse(JSON.stringify(this.template));g.fields.push(m);Store.updateTemplate(this.templateId,g);(n=this.templateUpdated)===null||n===void 0?void 0:n.emit({endpoint:this.endpoint,template:g,event:"added-field"});this.placing=null;b.label=2;case 2:return[2]}}))}))};e.prototype.render=function(){var e;var t=this;var n,i,o;if(this.loading){return h(Host,null,h("verdocs-loader",null))}if(!this.endpoint.session){return h(Host,null,h("verdocs-component-error",{message:"You must be authenticated to use this module."}))}var r=(((n=this.template)===null||n===void 0?void 0:n.roles)||[]).map((function(e){return{value:e.name,label:e.full_name?"".concat(e.name,": ").concat(e.full_name):e.name}}));return h(Host,{class:this.placing?(e={},e["placing-".concat(this.placing)]=true,e):{},onSubmit:function(){}},h("div",{id:"verdocs-template-fields-toolbar"},h("div",{class:"add-for"},"Add field:"),h("verdocs-select-input",{value:this.selectedRoleName,options:r,onInput:function(e){return t.selectedRoleName=e.target.value}}),menuOptions.map((function(e){return h("verdocs-toolbar-icon",{text:e.tooltip,icon:e.icon,class:e.class,onClick:function(){if(e.tooltip){if(t.selectedRoleName){t.placing=e.id}else{t.showMustSelectRole=true}}}})}))),h("div",{class:"pages"},(((i=this.template)===null||i===void 0?void 0:i.documents)||[]).map((function(e){var n=integerSequence(1,e.pages);return n.map((function(n){var i=e.page_sizes[n];return h("verdocs-template-document-page",{templateId:t.templateId,documentId:e.id,pageNumber:n,virtualWidth:(i===null||i===void 0?void 0:i.width)||612,virtualHeight:(i===null||i===void 0?void 0:i.height)||792,disabled:true,editable:true,done:false,onClick:function(e){return t.handleClickPage(e,n)},onPageRendered:function(e){return t.handlePageRendered(e)},layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]})}))}))),this.showMustSelectRole&&h("verdocs-ok-dialog",{heading:"Unable to add field",message:(((o=this.template)===null||o===void 0?void 0:o.roles)||[]).length>0?"Please select a role before adding fields.":"Please add at least one role before adding fields.",onNext:function(){return t.showMustSelectRole=false}}))};Object.defineProperty(e,"watchers",{get:function(){return{templateId:["onTemplateIdChanged"]}},enumerable:false,configurable:true});return e}();VerdocsTemplateFields.style=verdocsTemplateFieldsCss;var Sortable_min$1={exports:{}};
|
1
|
+
var __assign=this&&this.__assign||function(){__assign=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++){t=arguments[n];for(var o in t)if(Object.prototype.hasOwnProperty.call(t,o))e[o]=t[o]}return e};return __assign.apply(this,arguments)};var __awaiter=this&&this.__awaiter||function(e,t,n,i){function o(e){return e instanceof n?e:new n((function(t){t(e)}))}return new(n||(n=Promise))((function(n,r){function s(e){try{l(i.next(e))}catch(e){r(e)}}function a(e){try{l(i["throw"](e))}catch(e){r(e)}}function l(e){e.done?n(e.value):o(e.value).then(s,a)}l((i=i.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var n={label:0,sent:function(){if(r[0]&1)throw r[1];return r[1]},trys:[],ops:[]},i,o,r,s;return s={next:a(0),throw:a(1),return:a(2)},typeof Symbol==="function"&&(s[Symbol.iterator]=function(){return this}),s;function a(e){return function(t){return l([e,t])}}function l(a){if(i)throw new TypeError("Generator is already executing.");while(s&&(s=0,a[0]&&(n=0)),n)try{if(i=1,o&&(r=a[0]&2?o["return"]:a[0]?o["throw"]||((r=o["return"])&&r.call(o),0):o.next)&&!(r=r.call(o,a[1])).done)return r;if(o=0,r)a=[a[0]&2,r.value];switch(a[0]){case 0:case 1:r=a;break;case 4:n.label++;return{value:a[1],done:false};case 5:n.label++;o=a[1];a=[0];continue;case 7:a=n.ops.pop();n.trys.pop();continue;default:if(!(r=n.trys,r=r.length>0&&r[r.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!r||a[1]>r[0]&&a[1]<r[3])){n.label=a[1];break}if(a[0]===6&&n.label<r[1]){n.label=r[1];r=a;break}if(r&&n.label<r[2]){n.label=r[2];n.ops.push(a);break}if(r[2])n.ops.pop();n.trys.pop();continue}a=t.call(e,n)}catch(e){a=[6,e];o=0}finally{i=r=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,t,n){if(n||arguments.length===2)for(var i=0,o=t.length,r;i<o;i++){if(r||!(i in t)){if(!r)r=Array.prototype.slice.call(t,0,i);r[i]=t[i]}}return e.concat(r||Array.prototype.slice.call(t))};import{r as registerInstance,c as createEvent,h,H as Host,F as Fragment,g as getElement}from"./index-CF7i8guW.js";import{VerdocsEndpoint,getTemplate,integerSequence,getOrganizationContacts,isValidEmail,createEnvelope,formatFullName,getRGBA,createTemplateDocument,deleteTemplateDocument,updateField,createField,updateTemplateRole,createTemplateRole,updateTemplate}from"@verdocs/js-sdk";import{S as SDKError}from"./errors-C1sRVZWv.js";import{S as Store}from"./Datastore-C_IIZj49.js";import{D as DefaultEndpoint}from"./Environment-C_Xku1v2.js";import{V as VerdocsToast}from"./Toast-CyvDgtoV.js";import{D as DocIcon,P as PngIcon,J as JpgIcon,a as PdfIcon,F as FileIcon,b as PageCountIcon,T as TrashIcon}from"./Icons-7LXbcjVz.js";import{d as dateFnsExports}from"./index-dzBXqXlK.js";import{i as interact}from"./interact.min-BepJAdBZ.js";import{g as getFieldId,e as updateCssTransform,f as removeCssTransform,h as setControlStyles,i as defaultHeight,j as defaultWidth}from"./utils-DmfOx9Ey.js";import{g as getDefaultExportFromCjs}from"./_commonjsHelpers-BFTU3MAI.js";import"./Types-Dl7Xw8F0.js";var verdocsPreviewCss='@-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}';var VerdocsPreview=function(){function e(e){registerInstance(this,e);this.sdkError=createEvent(this,"sdkError");this.templateListenerId=null;this.endpoint=VerdocsEndpoint.getDefault();this.templateId=null;this.loading=true;this.template=null}e.prototype.disconnectedCallback=function(){this.unlistenToTemplate()};e.prototype.listenToTemplate=function(){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(t){this.unlistenToTemplate();Store.subscribe("templates",this.templateId,(function(){return getTemplate(e.endpoint,e.templateId)}),false,(function(t){e.template=t;e.loading=false}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){Store.store.delListener(this.templateListenerId);this.templateListenerId=null}};e.prototype.onTemplateIdChanged=function(e){console.log("[PREVIEW] Template ID changed",e);this.listenToTemplate()};e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n;return __generator(this,(function(i){try{this.endpoint.loadSession();if(!this.endpoint.session){console.log("[PREVIEW] Unable to start builder session, must be authenticated");return[2]}if(!this.templateId){console.log("[PREVIEW] Missing required template ID ".concat(this.templateId));return[2]}this.listenToTemplate()}catch(i){console.log("[PREVIEW] Error with preview session",i);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new SDKError(i.message,(t=i.response)===null||t===void 0?void 0:t.status,(n=i.response)===null||n===void 0?void 0:n.data))}return[2]}))}))};e.prototype.handlePageRendered=function(e){};e.prototype.render=function(){var e=this;var t;if(this.loading){return h(Host,null,h("verdocs-loader",null))}return h(Host,null,(((t=this.template)===null||t===void 0?void 0:t.documents)||[]).map((function(t){var n=integerSequence(1,t.pages);return h(Fragment,null,n.map((function(n){var i;var o=((i=t.page_sizes)===null||i===void 0?void 0:i[n])||{width:612,height:792};return h("verdocs-template-document-page",{templateId:t.template_id,documentId:t.id,pageNumber:n,disabled:true,editable:false,done:false,virtualWidth:o.width,virtualHeight:o.height,onPageRendered:function(t){return e.handlePageRendered(t)},layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]})})))})))};Object.defineProperty(e,"watchers",{get:function(){return{templateId:["onTemplateIdChanged"]}},enumerable:false,configurable:true});return e}();VerdocsPreview.style=verdocsPreviewCss;var getRoleNames=function(e){return((e===null||e===void 0?void 0:e.roles)||[]).map((function(e){return e.name}))};var getRoleIndex=function(e,t){return Math.max(getRoleNames(e).findIndex((function(e){return e===t})),0)};var verdocsSendCss='@-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)}';var editIcon='<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>';var startIcon='<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>';var stepIcon='<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>';var doneIcon='<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>';var VerdocsSend=function(){function e(e){registerInstance(this,e);this.beforeSend=createEvent(this,"beforeSend");this.send=createEvent(this,"send");this.exit=createEvent(this,"exit");this.sdkError=createEvent(this,"sdkError");this.searchContacts=createEvent(this,"searchContacts");this.templateListenerId=null;this.endpoint=DefaultEndpoint;this.templateId=null;this.environment="";this.containerId="verdocs-send-".concat(Math.random().toString(36).substring(2,11));this.showPickerForId="";this.sessionContacts=[];this.sending=false;this.rolesCompleted={};this.loading=true;this.template=null}e.prototype.disconnectedCallback=function(){this.unlistenToTemplate()};e.prototype.listenToTemplate=function(){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(t){console.log("[SEND] Loading template",this.templateId);this.unlistenToTemplate();Store.subscribe("templates",this.templateId,(function(){return getTemplate(e.endpoint,e.templateId)}),true,(function(t){console.log("[SEND] Got new template",t);e.template=t;e.loading=false;e.rolesCompleted={};e.recomputeRolesCompleted()}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){Store.store.delListener(this.templateListenerId);this.templateListenerId=null}};e.prototype.reset=function(){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(e){this.rolesCompleted={};return[2]}))}))};e.prototype.onTemplateIdChanged=function(e){console.log("[SEND] Template ID changed",e);this.listenToTemplate()};e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n;var i=this;return __generator(this,(function(o){try{this.endpoint.onSessionChanged((function(e,t,n){if(!n){return}var o={id:n.id,first_name:n.first_name,last_name:n.last_name,email:n.email,phone:n.phone};if(n){i.sessionContacts=[o];getOrganizationContacts(i.endpoint).then((function(e){console.log("[SEND] Got contacts",e);i.sessionContacts=__spreadArray(__spreadArray([],e,true),[o],false)})).catch((function(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[2]}if(!this.templateId){console.log("[SEND] Missing required template ID ".concat(this.templateId));return[2]}this.listenToTemplate()}catch(i){console.log("[SEND] Error with send session",i);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new SDKError(i.message,(t=i.response)===null||t===void 0?void 0:t.status,(n=i.response)===null||n===void 0?void 0:n.data))}return[2]}))}))};e.prototype.recomputeRolesCompleted=function(){var e=this;var t;this.rolesCompleted={};var n={};(((t=this.template)===null||t===void 0?void 0:t.roles)||[]).forEach((function(t){var i=t.sequence;n[i]||(n[i]=[]);var o="r-".concat(i,"-").concat(n[i].length);n[i].push(__assign(__assign({},t),{id:o,role_name:t.name,first_name:t.first_name,last_name:t.last_name}));if(t.first_name&&isValidEmail(t.email)){e.rolesCompleted[o]=__assign(__assign({},t),{id:o,role_name:t.name,first_name:t.first_name,last_name:t.last_name})}}))};e.prototype.getSequenceNumbers=function(){var e;var t={};(((e=this.template)===null||e===void 0?void 0:e.roles)||[]).forEach((function(e){t[e.sequence]=true}));return Object.keys(t).map((function(e){return+e})).sort((function(e,t){return e-t}))};e.prototype.getRolesAtLevel=function(e){var t;var n=(((t=this.template)===null||t===void 0?void 0:t.roles)||[]).filter((function(t){return t.sequence===e})).map((function(t,n){return __assign(__assign({},t),{id:"r-".concat(e,"-").concat(n),role_name:t.name,first_name:t.first_name,last_name:t.last_name})}));return n};e.prototype.getLevelIcon=function(e){if(e==="start"){return h("div",{class:"level-icon",innerHTML:startIcon})}else if(e==="end"){return h("div",{class:"level-icon",innerHTML:doneIcon})}else{return h("div",{class:"level-icon",innerHTML:stepIcon})}};e.prototype.handleSelectContact=function(e,t){e.preventDefault();this.rolesCompleted[t.id]=__assign(__assign({},t),e.detail);this.showPickerForId=""};e.prototype.handleClickRole=function(e,t){e.stopPropagation();this.showPickerForId=t.id};e.prototype.handleSend=function(e){var t=this;var n;if(this.sending){console.log("[SEND] Skipping duplicate send",e);return}console.log("[SEND] Sending",e);e.preventDefault();e.stopPropagation();this.sending=true;var i={template_id:this.templateId,name:((n=this.template)===null||n===void 0?void 0:n.name)||"New Envelope",environment:this.environment,initial_reminder:0,followup_reminders:0,recipients:Object.values(this.rolesCompleted),fields:[]};var o=this.beforeSend.emit(__assign(__assign({},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);createEnvelope(this.endpoint,i).then((function(e){var n;console.log("[SEND] Send envelope",e);t.reset().catch((function(e){return console.log("Unknown Error",e)}));t.sending=false;(n=t.send)===null||n===void 0?void 0:n.emit(__assign(__assign({},i),{name:i.name,envelope_id:e.id,envelope:e}))})).catch((function(e){var n,i,o;console.log("[SEND] Send error",e);VerdocsToast(((i=(n=e.response)===null||n===void 0?void 0:n.data)===null||i===void 0?void 0:i.error)||"Error creating envelope, please try again later.");t.sending=false;(o=t.sdkError)===null||o===void 0?void 0:o.emit(e)}))};e.prototype.handleCancel=function(e){var t;e.stopPropagation();(t=this.exit)===null||t===void 0?void 0:t.emit()};e.prototype.render=function(){var e=this;var t;if(this.loading){return h(Host,null,h("verdocs-loader",null))}if(!this.endpoint.session){return h(Host,{style:{display:"flex"}},h("verdocs-component-error",{message:"You must be authenticated to use this module."}))}var n=this.getSequenceNumbers();var i=Object.values(this.rolesCompleted).filter((function(e){return isValidEmail(e.email)&&e.first_name&&e.last_name}));var o=i.length>=getRoleNames(this.template).length;return h(Host,{class:{sendable:(t=this.template)===null||t===void 0?void 0:t.is_sendable}},h("div",{class:"recipients"},h("div",{class:"left-line"}),h("div",{class:"level level-start"},this.getLevelIcon("start"),h("div",{class:"complete"},"Send Envelope")),n.map((function(t){return h("div",{class:"level level-".concat(t)},e.getLevelIcon("sequence"),e.getRolesAtLevel(t).map((function(t){var n,o,r;var s=!t.email||!t.first_name||!t.last_name;var a=((n=e.rolesCompleted[t.id])===null||n===void 0?void 0:n.first_name)?formatFullName(e.rolesCompleted[t.id]):s?t.role_name:formatFullName(t);var l="verdocs-send-recipient-".concat(t.role_name);var c=getRoleIndex(e.template,t.role_name);var u=getRGBA(c);var d=i.findIndex((function(e){return e.role_name===t.role_name}))>-1;var f={backgroundColor:u,border:d?"2px solid #55bc81":"2px solid #dddddd"};return s?h("div",{class:"recipient","data-ri":c,"data-rn":t.role_name,style:f,onClick:function(n){return e.handleClickRole(n,t)},id:l},a,h("div",{class:"icon",innerHTML:editIcon}),e.showPickerForId===t.id&&h("verdocs-portal",{anchor:l,onClickAway:function(){return e.showPickerForId=""}},h("verdocs-contact-picker",{onExit:function(){return e.showPickerForId=""},onNext:function(n){return e.handleSelectContact(n,t)},contactSuggestions:e.sessionContacts,templateRole:(o=e.rolesCompleted[t.id])!==null&&o!==void 0?o:t,onSearchContacts:function(t){var n;return(n=e.searchContacts)===null||n===void 0?void 0:n.emit(t.detail)}}))):h("div",{class:"recipient","data-ri":c,"data-rn":t.role_name,style:f,onClick:function(n){return e.handleClickRole(n,t)},id:l},a,h("div",{class:"icon",innerHTML:editIcon}),e.showPickerForId===t.id&&h("verdocs-portal",{anchor:l,onClickAway:function(){return e.showPickerForId=""}},h("verdocs-contact-picker",{onExit:function(){return e.showPickerForId=""},onNext:function(n){return e.handleSelectContact(n,t)},contactSuggestions:e.sessionContacts,templateRole:(r=e.rolesCompleted[t.id])!==null&&r!==void 0?r:t,onSearchContacts:function(t){var n;return(n=e.searchContacts)===null||n===void 0?void 0:n.emit(t.detail)}})))})))})),h("div",{class:"level level-done"},this.getLevelIcon("end"),h("div",{class:"complete"},"Signing Complete"))),h("div",{class:"buttons"},h("verdocs-button",{label:"Cancel",size:"small",variant:"outline",onClick:function(t){return e.handleCancel(t)},disabled:this.sending}),h("verdocs-button",{label:"Send",size:"small",disabled:!o||this.sending,onClick:function(t){return e.handleSend(t)}}),this.sending&&h("verdocs-spinner",null)))};Object.defineProperty(e,"watchers",{get:function(){return{templateId:["onTemplateIdChanged"]}},enumerable:false,configurable:true});return e}();VerdocsSend.style=verdocsSendCss;var verdocsTemplateAttachmentsCss='@-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}';var VerdocsTemplateAttachments=function(){function e(e){registerInstance(this,e);this.exit=createEvent(this,"exit");this.next=createEvent(this,"next");this.templateUpdated=createEvent(this,"templateUpdated");this.sdkError=createEvent(this,"sdkError");this.templateListenerId=null;this.endpoint=VerdocsEndpoint.getDefault();this.templateId="";this.uploading=false;this.progressLabel="Uploading...";this.progressPercent=0;this.showDeleteError=false;this.confirmDeleteDocument=null;this.loading=true;this.template=null}e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n;return __generator(this,(function(i){try{this.endpoint.loadSession();if(!this.templateId){console.log("[ROLES] Missing required template ID ".concat(this.templateId));return[2]}if(!this.endpoint.session){console.log("[ROLES] Unable to start builder session, must be authenticated");return[2]}this.listenToTemplate()}catch(i){console.log("[TEMPLATE ATTACHMENTS] Error loading template",i);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new SDKError(i.message,(t=i.response)===null||t===void 0?void 0:t.status,(n=i.response)===null||n===void 0?void 0:n.data))}return[2]}))}))};e.prototype.disconnectedCallback=function(){this.unlistenToTemplate()};e.prototype.listenToTemplate=function(){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(t){this.unlistenToTemplate();Store.subscribe("templates",this.templateId,(function(){return getTemplate(e.endpoint,e.templateId)}),false,(function(t){e.template=t;e.loading=false}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){Store.store.delListener(this.templateListenerId);this.templateListenerId=null}};e.prototype.handleCancel=function(e){e.stopPropagation();this.exit.emit()};e.prototype.handleUploadProgress=function(e){if(e>=99){this.progressPercent=100;this.progressLabel="Processing..."}else{this.progressPercent=e}};e.prototype.handleUpload=function(e){return __awaiter(this,void 0,void 0,(function(){var t,n,i,o,r,s,a,l;return __generator(this,(function(c){switch(c.label){case 0:e.stopPropagation();r=e.detail.file;if(!r){return[2]}console.log("[ATTACHMENTS] Uploading...",r);this.uploading=true;this.progressLabel="Uploading...";c.label=1;case 1:c.trys.push([1,4,,5]);return[4,createTemplateDocument(this.endpoint,this.templateId,r,this.handleUploadProgress.bind(this))];case 2:s=c.sent();console.log("[ATTACHMENTS] Created attachment",s);a=this;return[4,Store.getTemplate(this.endpoint,this.templateId,true)];case 3:a.template=c.sent();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;return[3,5];case 4:l=c.sent();console.log("[ATTACHMENTS] Error creating template",l);(n=this.sdkError)===null||n===void 0?void 0:n.emit(new SDKError(l.message,(i=l.response)===null||i===void 0?void 0:i.status,(o=l.response)===null||o===void 0?void 0:o.data));this.uploading=false;return[3,5];case 5:return[2]}}))}))};e.prototype.handleNext=function(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})};e.prototype.confirmDelete=function(){return __awaiter(this,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:return[4,deleteTemplateDocument(this.endpoint,this.templateId,this.confirmDeleteDocument.id)];case 1:t.sent();e=this;return[4,Store.getTemplate(this.endpoint,this.templateId,true)];case 2:e.template=t.sent();console.log("[ATTACHMENTS] New template",this.template);this.confirmDeleteDocument=null;return[2]}}))}))};e.prototype.handleDelete=function(e){return __awaiter(this,void 0,void 0,(function(){var t;return __generator(this,(function(n){if((((t=this.template)===null||t===void 0?void 0:t.documents)||[]).length>1){this.confirmDeleteDocument=e}else{this.showDeleteError=true}return[2]}))}))};e.prototype.getFileIcon=function(e){switch(e.mime){case"application/pdf":return PdfIcon;case"image/jpeg":return JpgIcon;case"image/png":return PngIcon;case"application/msword":case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return DocIcon}return FileIcon};e.prototype.render=function(){var e=this;var t,n;if(!this.endpoint.session){return h(Host,null,h("verdocs-component-error",{message:"You must be authenticated to use this module."}))}if(this.loading){return h(Host,{class:"loading"},h("verdocs-loader",null))}if(!this.endpoint.session||!this.template){return h(Host,{class:"empty"})}return h(Host,null,h("h5",null,"Existing Attachments"),h("div",{class:"attachments"},(((t=this.template)===null||t===void 0?void 0:t.documents)||[]).map((function(t){return h("div",{class:"attachment"},h("div",{class:"file-icon",innerHTML:e.getFileIcon(t)}),h("div",{class:"filename",title:t.name},t.name),h("div",{class:"pages"},h("div",{class:"count"},t.pages),h("div",{class:"pages-icon",innerHTML:PageCountIcon})),h("div",{class:"trash-icon",innerHTML:TrashIcon,onClick:function(){return e.handleDelete(t)}}))}))),h("h5",null,"Attach a New Document"),this.uploading?h("div",{class:"loader-wrapper"},h("verdocs-loader",null),this.progressLabel&&h("div",{class:"progress-wrapper"},h("verdocs-progress-bar",{showPercent:true,percent:this.progressPercent,label:this.progressLabel}))):h("verdocs-file-chooser",{onFileSelected:function(t){return e.handleUpload(t)}}),h("div",{class:"buttons"},h("verdocs-button",{variant:"outline",label:"Cancel",size:"small",onClick:function(t){return e.handleCancel(t)},disabled:this.uploading}),h("verdocs-button",{label:"Next",size:"small",onClick:function(t){return e.handleNext(t)},disabled:!(((n=this.template)===null||n===void 0?void 0:n.documents)||[]).length||this.uploading})),this.showDeleteError&&h("verdocs-ok-dialog",{heading:"Unable to Delete Attachment",message:"Templates must contain at least one attachment.",onNext:function(){return e.showDeleteError=false}}),this.confirmDeleteDocument&&h("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:function(){return e.confirmDelete()},showCancel:true,onExit:function(){e.confirmDeleteDocument=null}}))};return e}();VerdocsTemplateAttachments.style=verdocsTemplateAttachmentsCss;var verdocsTemplateBuildTabsCss='@-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}';var HelpIcon='<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>';var CopyIcon='<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>';var STEPS=["attachments","roles","settings","fields","preview"];var VerdocsTemplateBuildTabs=function(){function e(e){registerInstance(this,e);this.sdkError=createEvent(this,"sdkError");this.stepChanged=createEvent(this,"stepChanged");this.templateListenerId=null;this.endpoint=VerdocsEndpoint.getDefault();this.templateId=null;this.step="preview";this.loading=true;this.template=null}e.prototype.disconnectedCallback=function(){this.unlistenToTemplate()};e.prototype.listenToTemplate=function(){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(t){this.unlistenToTemplate();Store.subscribe("templates",this.templateId,(function(){return getTemplate(e.endpoint,e.templateId)}),false,(function(t){e.template=t;e.loading=false}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){Store.store.delListener(this.templateListenerId);this.templateListenerId=null}};e.prototype.onTemplateIdChanged=function(e){console.log("[BUILD_TABS] Template ID changed",e);this.listenToTemplate()};e.prototype.onStepChanged=function(e){console.log("[BUILD_TABS] Step changed",e)};e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n;return __generator(this,(function(i){try{this.endpoint.loadSession();if(!this.endpoint.session){console.log("[BUILD_TABS] Unable to start builder session, must be authenticated");return[2]}if(!this.templateId){this.step="attachments";console.log("[BUILD_TABS] Missing required template ID, forcing view to attachments");return[2]}this.listenToTemplate()}catch(i){console.log("[BUILD_TABS] Error loading template",i);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new SDKError(i.message,(t=i.response)===null||t===void 0?void 0:t.status,(n=i.response)===null||n===void 0?void 0:n.data))}return[2]}))}))};e.prototype.setStep=function(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)};e.prototype.copyTemplateId=function(){var e=this;navigator.clipboard.writeText(this.templateId).then((function(){VerdocsToast("Template ID copied",{style:"success",duration:3e3})})).catch((function(t){var n;console.warn("[BUILD_TABS] Error copying to clipboard",t);(n=e.sdkError)===null||n===void 0?void 0:n.emit(t)}))};e.prototype.render=function(){var e=this;var t,n,i,o,r,s,a,l,c;if(this.loading){return h(Host,null,h("verdocs-loader",null))}if(!this.endpoint.session){return h(Host,null,h("verdocs-component-error",{message:"You must be authenticated to use this module."}))}var u=(((t=this.template)===null||t===void 0?void 0:t.documents)||[]).length>0;var d=u&&(((n=this.template)===null||n===void 0?void 0:n.roles)||[]).length>0;var f=d&&(((i=this.template)===null||i===void 0?void 0:i.fields)||[]).length>0;var v=Math.max(STEPS.indexOf(this.step),0);if(!f&&v>=4){v=3}if(!d&&v>=3){v=1}if(!u&&v>=1){v=0}return h(Host,null,h("verdocs-tabs",{onSelectTab:function(t){return e.setStep(t)},selectedTab:v,tabs:[{id:"attachments",disabled:false,label:"Attachment(s)"},{id:"roles",disabled:!u,label:"Roles"},{id:"settings",disabled:!d,label:"Settings"},{id:"fields",disabled:!d,label:"Fields"},{id:"preview",disabled:!f,label:"Preview/Send"}]}),this.templateId&&h("div",{class:"info"},h("verdocs-button-panel",{icon:HelpIcon},h("div",{class:"template-details-panel"},h("h6",null,"Template Details"),h("div",{class:"row"},h("label",null,"ID:"),h("div",{class:"value"},this.templateId),h("div",{class:"icon-button",innerHTML:CopyIcon,onClick:function(){return e.copyTemplateId()}})),h("div",{class:"row"},h("label",null,"Name:"),h("div",{class:"value"},(o=this.template)===null||o===void 0?void 0:o.name)),h("div",{class:"row"},h("label",null,"Visibility:"),h("div",{class:"value"},((r=this.template)===null||r===void 0?void 0:r.is_public)?"Public":((s=this.template)===null||s===void 0?void 0:s.is_personal)?"Private":"Shared")),h("div",{class:"row"},h("label",null,"Created:"),h("div",{class:"value"},((a=this.template)===null||a===void 0?void 0:a.counter)?dateFnsExports.format(new Date((l=this.template)===null||l===void 0?void 0:l.created_at),"P p"):"")),h("div",{class:"row"},h("label",null,"Used:"),h("div",{class:"value"},(c=this.template)===null||c===void 0?void 0:c.counter," time(s)"))))))};Object.defineProperty(e,"watchers",{get:function(){return{templateId:["onTemplateIdChanged"],step:["onStepChanged"]}},enumerable:false,configurable:true});return e}();VerdocsTemplateBuildTabs.style=verdocsTemplateBuildTabsCss;var verdocsTemplateFieldsCss="@-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}";var iconTextbox='<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>';var iconCheck='<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>';var iconRadio='<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>';var iconDatepicker='<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>';var iconSignature='<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>';var iconInitial='<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>';var iconTimestamp='<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>';var iconDropdown='<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>';var iconAttachment='<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>';var separator='<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>';var menuOptions=[{id:"signature",tooltip:"Signature",icon:iconSignature,class:"signature"},{id:"initial",tooltip:"Initials",icon:iconInitial,class:"initial"},{id:"sep1",tooltip:"",icon:separator,class:"separator"},{id:"textbox",tooltip:"Text Box",icon:iconTextbox,class:"textbox"},{id:"checkbox",tooltip:"Check Box",icon:iconCheck,class:"checkbox"},{id:"radio",tooltip:"Radio Button",icon:iconRadio,class:"radio"},{id:"dropdown",tooltip:"Dropdown",icon:iconDropdown,class:"dropdown"},{id:"sep2",tooltip:"",icon:separator,class:"separator"},{id:"date",tooltip:"Date",icon:iconDatepicker,class:"date"},{id:"timestamp",tooltip:"Timestamp",icon:iconTimestamp,class:"timestamp"},{id:"attachment",tooltip:"Attachment",icon:iconAttachment,class:"attachment"}];var VerdocsTemplateFields=function(){function e(e){registerInstance(this,e);this.sdkError=createEvent(this,"sdkError");this.templateUpdated=createEvent(this,"templateUpdated");this.fieldsUpdated=createEvent(this,"fieldsUpdated");this.templateListenerId=null;this.endpoint=VerdocsEndpoint.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={}}e.prototype.onTemplateIdChanged=function(){this.listenToTemplate()};e.prototype.handleKeyDown=function(e){if(e.key==="Escape"){this.placing=null}};e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n;return __generator(this,(function(i){try{this.endpoint.loadSession();if(!this.templateId){console.log("[FIELDS] Missing required template ID ".concat(this.templateId));return[2]}if(!this.endpoint.session){console.log("[FIELDS] Unable to start builder session, must be authenticated");return[2]}this.listenToTemplate()}catch(i){console.log("[FIELDS] Error with fields session",i);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new SDKError(i.message,(t=i.response)===null||t===void 0?void 0:t.status,(n=i.response)===null||n===void 0?void 0:n.data))}return[2]}))}))};e.prototype.componentDidRender=function(){interact.dynamicDrop(true);var e=this.toolbarTargetId?document.getElementById(this.toolbarTargetId):null;var t=document.getElementById("verdocs-template-fields-toolbar");if(e&&t){console.log("[FIELDS] Moving toolbar");t.remove();e.append(t)}};e.prototype.componentWillUpdate=function(){var e=this;var t,n;var i=((t=this.template)===null||t===void 0?void 0:t.roles)||[];if(!this.selectedRoleName||!i.find((function(t){return t&&t.name===e.selectedRoleName}))){this.selectedRoleName=((n=i[0])===null||n===void 0?void 0:n.name)||"";console.log("[FIELDS] Selected new role",this.selectedRoleName)}};e.prototype.disconnectedCallback=function(){this.unlistenToTemplate()};e.prototype.listenToTemplate=function(){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(t){this.unlistenToTemplate();Store.subscribe("templates",this.templateId,(function(){return getTemplate(e.endpoint,e.templateId)}),false,(function(t){var n,i;e.template=t;e.loading=false;if(!e.selectedRoleName){e.selectedRoleName=((i=(n=t.roles)===null||n===void 0?void 0:n[0])===null||i===void 0?void 0:i.name)||""}}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){Store.store.delListener(this.templateListenerId);this.templateListenerId=null}};e.prototype.attachFieldAttributes=function(e,t,n){var i=this;n.addEventListener("settingsChanged",(function(){var e;(e=i.templateUpdated)===null||e===void 0?void 0:e.emit({endpoint:i.endpoint,template:i.template,event:"added-field"})}));n.addEventListener("deleted",(function(){var e;n.remove();(e=i.templateUpdated)===null||e===void 0?void 0:e.emit({endpoint:i.endpoint,template:i.template,event:"updated-field"})}));n.setAttribute("templateid",this.templateId);n.setAttribute("fieldname",t.name);n.setAttribute("pageNumber",String(e.pageNumber));n.setAttribute("xScale",String(e.xScale));n.setAttribute("yScale",String(e.yScale));n.setAttribute("name",t.name)};e.prototype.handlePageRendered=function(e){var t=this;var n;var i=e.detail;this.cachedPageInfo[i.pageNumber]=i;this.pageHeights[i.pageNumber]=i.naturalHeight;(((n=this.template)===null||n===void 0?void 0:n.fields)||[]).filter((function(e){return e&&e.page===i.pageNumber})).forEach((function(e){var n=getFieldId(e);var i=document.getElementById(n);if(i){i.setAttribute("fieldname",e.name);i.setAttribute("pagenumber",String(e.page));t.makeDraggable(i)}}))};e.prototype.makeDraggable=function(e){interact(e).draggable({listeners:{move:this.handleMoveField.bind(this),end:this.handleMoveEnd.bind(this)}})};e.prototype.handleMoveField=function(e){return __awaiter(this,void 0,void 0,(function(){var t,n,i,o,r,s;return __generator(this,(function(a){t=+(e.target.getAttribute("posX")||0);n=+(e.target.getAttribute("posY")||0);i=+(e.target.getAttribute("xScale")||1);o=+(e.target.getAttribute("yScale")||1);r=e.dx/i+t;s=e.dy/o+n;e.target.setAttribute("posX",r);e.target.setAttribute("posy",s);updateCssTransform(e.target,"translate","".concat(r,"px, ").concat(s,"px"));return[2]}))}))};e.prototype.handleMoveEnd=function(e){return __awaiter(this,void 0,void 0,(function(){var t,n,i,o,r,s,a,l,c,u,d,h,f,v,p,m,g,b,x,w,E,y,S,_,k,T,C,I,q,M,D,H,V,O,L,z,A,Z,N;return __generator(this,(function(R){switch(R.label){case 0:c=e.target.getAttribute("fieldname");u=(((t=this.template)===null||t===void 0?void 0:t.fields)||[]).find((function(e){return e.name===c}));if(!u){console.log("[FIELDS] Unable to find field",c,e.target);return[2]}d=e.target.getAttribute("pagenumber");h=this.cachedPageInfo[d],f=h.naturalWidth,v=f===void 0?612:f,p=h.naturalHeight,m=p===void 0?792:p,g=h.renderedHeight,b=g===void 0?792:g;x=e.target.getBoundingClientRect();w=e.target.parentElement;E=w.getBoundingClientRect();y=u.width||defaultWidth(u.type);S=u.height||defaultHeight(u.type);_=Math.max(x.left-E.left,0);k=Math.max(b-(E.bottom-x.bottom),0);T=parseInt(d);if(k>b){T=Math.min(T+1,((o=(i=((n=this.template)===null||n===void 0?void 0:n.documents)||[])===null||i===void 0?void 0:i[0])===null||o===void 0?void 0:o.pages)||1);k-=b;b=this.cachedPageInfo[T].renderedHeight;console.log("Next page",{newPageNumber:T,newY:k,renderedHeight:b})}else if(k<0){T=Math.max(T-1,1);b=this.cachedPageInfo[T].renderedHeight;k+=b;console.log("[FIELDS] Next page",{newPageNumber:T,newY:k,renderedHeight:b})}C=this.viewCoordinatesToPageCoordinates(_,k,d,v-y,m-S),I=C.x,q=C.y;R.label=1;case 1:R.trys.push([1,3,,4]);M={x:I,y:q,page:T};return[4,updateField(this.endpoint,this.templateId,c,M)];case 2:D=R.sent();console.log("[FIELDS] Updated",D);H=JSON.parse(JSON.stringify(this.template));V=H.fields.findIndex((function(e){return e.name===c}));if(V>-1){H.fields[V]=D}Store.updateTemplate(this.templateId,H);e.target.removeAttribute("posX");e.target.removeAttribute("posY");removeCssTransform(e.target);O=this.cachedPageInfo[d],L=O.xScale,z=L===void 0?1:L,A=O.yScale,Z=A===void 0?1:A;setControlStyles(e.target,D,z,Z);(r=this.templateUpdated)===null||r===void 0?void 0:r.emit({endpoint:this.endpoint,template:H,event:"updated-field"});return[3,4];case 3:N=R.sent();VerdocsToast("Error updating field, please try again later",{style:"error"});console.log("[FIELDS] Error updating field",N);(s=this.sdkError)===null||s===void 0?void 0:s.emit(new SDKError(N.message,(a=N.response)===null||a===void 0?void 0:a.status,(l=N.response)===null||l===void 0?void 0:l.data));e.target.removeAttribute("posX");e.target.removeAttribute("posY");removeCssTransform(e.target);return[3,4];case 4:return[2]}}))}))};e.prototype.generateFieldName=function(e,t){var n;var i=1;var o;do{o="".concat(e,"P").concat(t,"-").concat(i);i++}while((((n=this.template)===null||n===void 0?void 0:n.fields)||[]).some((function(e){return e&&e.name===o})));return o};e.prototype.viewCoordinatesToPageCoordinates=function(e,t,n,i,o){var r=this.cachedPageInfo[n],s=r.xScale,a=s===void 0?1:s,l=r.yScale,c=l===void 0?1:l,u=r.renderedHeight,d=u===void 0?792:u;var h=Math.floor(Math.min(e/a,i));var f=Math.floor(Math.min(Math.max(d-t,0)/c,o));return{x:h,y:f}};e.prototype.handleClickPage=function(e,t){return __awaiter(this,void 0,void 0,(function(){var n,i,o,r,s,a,l,c,u,d,h,f,v,p,m,g;return __generator(this,(function(b){switch(b.label){case 0:if(!this.placing)return[3,2];i=e.offsetX;o=e.offsetY;r=defaultWidth(this.placing);s=defaultHeight(this.placing);a=this.cachedPageInfo[t];l=a.naturalWidth,c=l===void 0?612:l,u=a.naturalHeight,d=u===void 0?792:u;h=this.viewCoordinatesToPageCoordinates(i,o,t,c-r,d-s);f=Math.floor(h.x);v=Math.floor(h.y);p={name:this.generateFieldName(this.placing,t),role_name:this.selectedRoleName,template_id:this.templateId,document_id:a.documentId,type:this.placing,required:this.placing!=="radio",page:t,validator:null,label:null,default:null,placeholder:null,group:null,settings:{},x:f,y:v,width:r,height:s,multiline:false,readonly:false,options:this.placing==="radio"?[{id:"option-1",label:"Option 1"}]:[]};console.log("[FIELDS] Will save new field",p);return[4,createField(this.endpoint,this.templateId,p)];case 1:m=b.sent();console.log("[FIELDS] Saved field",m);g=JSON.parse(JSON.stringify(this.template));g.fields.push(m);Store.updateTemplate(this.templateId,g);(n=this.templateUpdated)===null||n===void 0?void 0:n.emit({endpoint:this.endpoint,template:g,event:"added-field"});this.placing=null;b.label=2;case 2:return[2]}}))}))};e.prototype.render=function(){var e;var t=this;var n,i,o;if(this.loading){return h(Host,null,h("verdocs-loader",null))}if(!this.endpoint.session){return h(Host,null,h("verdocs-component-error",{message:"You must be authenticated to use this module."}))}var r=(((n=this.template)===null||n===void 0?void 0:n.roles)||[]).map((function(e){return{value:e.name,label:e.full_name?"".concat(e.name,": ").concat(e.full_name):e.name}}));return h(Host,{class:this.placing?(e={},e["placing-".concat(this.placing)]=true,e):{},onSubmit:function(){}},h("div",{id:"verdocs-template-fields-toolbar"},h("div",{class:"add-for"},"Add field:"),h("verdocs-select-input",{value:this.selectedRoleName,options:r,onInput:function(e){return t.selectedRoleName=e.target.value}}),menuOptions.map((function(e){return h("verdocs-toolbar-icon",{text:e.tooltip,icon:e.icon,class:e.class,onClick:function(){if(e.tooltip){if(t.selectedRoleName){t.placing=e.id}else{t.showMustSelectRole=true}}}})}))),h("div",{class:"pages"},(((i=this.template)===null||i===void 0?void 0:i.documents)||[]).map((function(e){var n=integerSequence(1,e.pages);return n.map((function(n){var i=e.page_sizes[n];return h("verdocs-template-document-page",{templateId:t.templateId,documentId:e.id,pageNumber:n,virtualWidth:(i===null||i===void 0?void 0:i.width)||612,virtualHeight:(i===null||i===void 0?void 0:i.height)||792,disabled:true,editable:true,done:false,onClick:function(e){return t.handleClickPage(e,n)},onPageRendered:function(e){return t.handlePageRendered(e)},layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]})}))}))),this.showMustSelectRole&&h("verdocs-ok-dialog",{heading:"Unable to add field",message:(((o=this.template)===null||o===void 0?void 0:o.roles)||[]).length>0?"Please select a role before adding fields.":"Please add at least one role before adding fields.",onNext:function(){return t.showMustSelectRole=false}}))};Object.defineProperty(e,"watchers",{get:function(){return{templateId:["onTemplateIdChanged"]}},enumerable:false,configurable:true});return e}();VerdocsTemplateFields.style=verdocsTemplateFieldsCss;var Sortable_min$1={exports:{}};
|
2
2
|
/*! Sortable 1.15.6 - MIT | git://github.com/SortableJS/Sortable.git */var Sortable_min=Sortable_min$1.exports;var hasRequiredSortable_min;function requireSortable_min(){if(hasRequiredSortable_min)return Sortable_min$1.exports;hasRequiredSortable_min=1;(function(e,t){!function(t,n){e.exports=n()}(Sortable_min,(function(){function e(e,t){var n,i=Object.keys(e);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(e),t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),i.push.apply(i,n)),i}function t(t){for(var n=1;n<arguments.length;n++){var i=null!=arguments[n]?arguments[n]:{};n%2?e(Object(i),true).forEach((function(e){var n,o;n=t,e=i[o=e],o in n?Object.defineProperty(n,o,{value:e,enumerable:true,configurable:true,writable:true}):n[o]=e})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):e(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}function n(e){return(n="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 i(){return(i=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var n,i=arguments[t];for(n in i)Object.prototype.hasOwnProperty.call(i,n)&&(e[n]=i[n])}return e}).apply(this,arguments)}function o(e,t){if(null==e)return{};var n,i=function(e,t){if(null==e)return{};for(var n,i={},o=Object.keys(e),r=0;r<o.length;r++)n=o[r],0<=t.indexOf(n)||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols)for(var o=Object.getOwnPropertySymbols(e),r=0;r<o.length;r++)n=o[r],0<=t.indexOf(n)||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n]);return i}function r(e){return function(e){if(Array.isArray(e))return s(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 s(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Map"===(n="Object"===n&&e.constructor?e.constructor.name:n)||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(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 s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}function a(e){if("undefined"!=typeof window&&window.navigator)return!!navigator.userAgent.match(e)}var l=a(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i),c=a(/Edge/i),u=a(/firefox/i),d=a(/safari/i)&&!a(/chrome/i)&&!a(/android/i),h=a(/iP(ad|od|hone)/i),f=a(/chrome/i)&&a(/android/i),v={capture:false,passive:false};function p(e,t,n){e.addEventListener(t,n,!l&&v)}function m(e,t,n){e.removeEventListener(t,n,!l&&v)}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,n,i){if(e){n=n||document;do{if(null!=t&&(">"!==t[0]||e.parentNode===n)&&g(e,t)||i&&e===n)return e}while(e!==n&&(e=b(e)))}return null}var w,E=/\s+/g;function y(e,t,n){var i;e&&t&&(e.classList?e.classList[n?"add":"remove"](t):(i=(" "+e.className+" ").replace(E," ").replace(" "+t+" "," "),e.className=(i+(n?" "+t:"")).replace(E," ")))}function S(e,t,n){var i=e&&e.style;if(i){if(void 0===n)return document.defaultView&&document.defaultView.getComputedStyle?n=document.defaultView.getComputedStyle(e,""):e.currentStyle&&(n=e.currentStyle),void 0===t?n:n[t];i[t=!(t in i||-1!==t.indexOf("webkit"))?"-webkit-"+t:t]=n+("string"==typeof n?"":"px")}}function _(e,t){var n="";if("string"==typeof e)n=e;else do{var i=S(e,"transform")}while(i&&"none"!==i&&(n=i+" "+n),!t&&(e=e.parentNode));var o=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return o&&new o(n)}function k(e,t,n){if(e){var i=e.getElementsByTagName(t),o=0,r=i.length;if(n)for(;o<r;o++)n(i[o],o);return i}return[]}function T(){var e=document.scrollingElement;return e||document.documentElement}function C(e,t,n,i,o){if(e.getBoundingClientRect||e===window){var r,s,a,c,u,d,h=e!==window&&e.parentNode&&e!==T()?(s=(r=e.getBoundingClientRect()).top,a=r.left,c=r.bottom,u=r.right,d=r.height,r.width):(a=s=0,c=window.innerHeight,u=window.innerWidth,d=window.innerHeight,window.innerWidth);if((t||n)&&e!==window&&(o=o||e.parentNode,!l))do{if(o&&o.getBoundingClientRect&&("none"!==S(o,"transform")||n&&"static"!==S(o,"position"))){var f=o.getBoundingClientRect();s-=f.top+parseInt(S(o,"border-top-width")),a-=f.left+parseInt(S(o,"border-left-width")),c=s+r.height,u=a+r.width;break}}while(o=o.parentNode);return i&&e!==window&&(i=(t=_(o||e))&&t.a,e=t&&t.d,t&&(c=(s/=e)+(d/=e),u=(a/=i)+(h/=i))),{top:s,left:a,bottom:c,right:u,width:h,height:d}}}function I(e,t,n){for(var i=V(e,true),o=C(e)[t];i;){var r=C(i)[n];if(!(r<=o))return i;if(i===T())break;i=V(i,false)}return false}function q(e,t,n,i){for(var o=0,r=0,s=e.children;r<s.length;){if("none"!==s[r].style.display&&s[r]!==Re.ghost&&(i||s[r]!==Re.dragged)&&x(s[r],n.draggable,e,false)){if(o===t)return s[r];o++}r++}return null}function M(e,t){for(var n=e.lastElementChild;n&&(n===Re.ghost||"none"===S(n,"display")||t&&!g(n,t));)n=n.previousElementSibling;return n||null}function D(e,t){var n=0;if(!e||!e.parentNode)return-1;for(;e=e.previousElementSibling;)"TEMPLATE"===e.nodeName.toUpperCase()||e===Re.clone||t&&!g(e,t)||n++;return n}function H(e){var t=0,n=0,i=T();if(e)do{var o=_(e),r=o.a,o=o.d}while(t+=e.scrollLeft*r,n+=e.scrollTop*o,e!==i&&(e=e.parentNode));return[t,n]}function V(e,t){if(!e||!e.getBoundingClientRect)return T();var n=e,i=false;do{if(n.clientWidth<n.scrollWidth||n.clientHeight<n.scrollHeight){var o=S(n);if(n.clientWidth<n.scrollWidth&&("auto"==o.overflowX||"scroll"==o.overflowX)||n.clientHeight<n.scrollHeight&&("auto"==o.overflowY||"scroll"==o.overflowY)){if(!n.getBoundingClientRect||n===document.body)return T();if(i||t)return n;i=true}}}while(n=n.parentNode);return T()}function O(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 L(e,t){return function(){var n;w||(1===(n=arguments).length?e.call(this,n[0]):e.apply(this,n),w=setTimeout((function(){w=void 0}),t))}}function z(e,t,n){e.scrollLeft+=t,e.scrollTop+=n}function A(e){var t=window.Polymer,n=window.jQuery||window.Zepto;return t&&t.dom?t.dom(e).cloneNode(true):n?n(e).clone(true)[0]:e.cloneNode(true)}function Z(e,t){S(e,"position","absolute"),S(e,"top",t.top),S(e,"left",t.left),S(e,"width",t.width),S(e,"height",t.height)}function N(e){S(e,"position",""),S(e,"top",""),S(e,"left",""),S(e,"width",""),S(e,"height","")}function R(e,t,n){var i={};return Array.from(e.children).forEach((function(o){var r;x(o,t.draggable,e,false)&&!o.animated&&o!==n&&(r=C(o),i.left=Math.min(null!==(o=i.left)&&void 0!==o?o:1/0,r.left),i.top=Math.min(null!==(o=i.top)&&void 0!==o?o:1/0,r.top),i.right=Math.max(null!==(o=i.right)&&void 0!==o?o:-1/0,r.right),i.bottom=Math.max(null!==(o=i.bottom)&&void 0!==o?o:-1/0,r.bottom))})),i.width=i.right-i.left,i.height=i.bottom-i.top,i.x=i.left,i.y=i.top,i}var j="Sortable"+(new Date).getTime();function P(){var e,n=[];return{captureAnimationState:function(){n=[],this.options.animation&&[].slice.call(this.el.children).forEach((function(e){var i,o;"none"!==S(e,"display")&&e!==Re.ghost&&(n.push({target:e,rect:C(e)}),i=t({},n[n.length-1].rect),!e.thisAnimationDuration||(o=_(e,true))&&(i.top-=o.f,i.left-=o.e),e.fromRect=i)}))},addAnimationState:function(e){n.push(e)},removeAnimationState:function(e){n.splice(function(e,t){for(var n in e)if(e.hasOwnProperty(n))for(var i in t)if(t.hasOwnProperty(i)&&t[i]===e[n][i])return Number(n);return-1}(n,{target:e}),1)},animateAll:function(t){var i=this;if(!this.options.animation)return clearTimeout(e),void("function"==typeof t&&t());var o=false,r=0;n.forEach((function(e){var t=0,n=e.target,s=n.fromRect,a=C(n),l=n.prevFromRect,c=n.prevToRect,u=e.rect,d=_(n,true);d&&(a.top-=d.f,a.left-=d.e),n.toRect=a,n.thisAnimationDuration&&O(l,a)&&!O(s,a)&&(u.top-a.top)/(u.left-a.left)==(s.top-a.top)/(s.left-a.left)&&(e=u,d=l,l=c,c=i.options,t=Math.sqrt(Math.pow(d.top-e.top,2)+Math.pow(d.left-e.left,2))/Math.sqrt(Math.pow(d.top-l.top,2)+Math.pow(d.left-l.left,2))*c.animation),O(a,s)||(n.prevFromRect=s,n.prevToRect=a,t=t||i.options.animation,i.animate(n,u,a,t)),t&&(o=true,r=Math.max(r,t),clearTimeout(n.animationResetTimer),n.animationResetTimer=setTimeout((function(){n.animationTime=0,n.prevFromRect=null,n.fromRect=null,n.prevToRect=null,n.thisAnimationDuration=null}),t),n.thisAnimationDuration=t)})),clearTimeout(e),o?e=setTimeout((function(){"function"==typeof t&&t()}),r):"function"==typeof t&&t(),n=[]},animate:function(e,t,n,i){var o,r;i&&(S(e,"transition",""),S(e,"transform",""),o=(r=_(this.el))&&r.a,r=r&&r.d,o=(t.left-n.left)/(o||1),r=(t.top-n.top)/(r||1),e.animatingX=!!o,e.animatingY=!!r,S(e,"transform","translate3d("+o+"px,"+r+"px,0)"),this.forRepaintDummy=e.offsetWidth,S(e,"transition","transform "+i+"ms"+(this.options.easing?" "+this.options.easing:"")),S(e,"transform","translate3d(0,0,0)"),"number"==typeof e.animated&&clearTimeout(e.animated),e.animated=setTimeout((function(){S(e,"transition",""),S(e,"transform",""),e.animated=false,e.animatingX=false,e.animatingY=false}),i))}}}var F=[],U={initializeByDefault:true},B={mount:function(e){for(var t in U)!U.hasOwnProperty(t)||t in e||(e[t]=U[t]);F.forEach((function(t){if(t.pluginName===e.pluginName)throw"Sortable: Cannot mount plugin ".concat(e.pluginName," more than once")})),F.push(e)},pluginEvent:function(e,n,i){var o=this;this.eventCanceled=false,i.cancel=function(){o.eventCanceled=true};var r=e+"Global";F.forEach((function(o){n[o.pluginName]&&(n[o.pluginName][r]&&n[o.pluginName][r](t({sortable:n},i)),n.options[o.pluginName]&&n[o.pluginName][e]&&n[o.pluginName][e](t({sortable:n},i)))}))},initializePlugins:function(e,t,n,o){for(var r in F.forEach((function(o){var r=o.pluginName;(e.options[r]||o.initializeByDefault)&&((o=new o(e,t,e.options)).sortable=e,o.options=e.options,e[r]=o,i(n,o.defaults))})),e.options){var s;e.options.hasOwnProperty(r)&&(void 0!==(s=this.modifyOption(e,r,e.options[r]))&&(e.options[r]=s))}},getEventProperties:function(e,t){var n={};return F.forEach((function(o){"function"==typeof o.eventProperties&&i(n,o.eventProperties.call(t[o.pluginName],e))})),n},modifyOption:function(e,t,n){var i;return F.forEach((function(o){e[o.pluginName]&&o.optionListeners&&"function"==typeof o.optionListeners[t]&&(i=o.optionListeners[t].call(e[o.pluginName],n))})),i}};function Q(e){var n=e.sortable,i=e.rootEl,o=e.name,r=e.targetEl,s=e.cloneEl,a=e.toEl,u=e.fromEl,d=e.oldIndex,h=e.newIndex,f=e.oldDraggableIndex,v=e.newDraggableIndex,p=e.originalEvent,m=e.putSortable,g=e.extraEventProperties;if(n=n||i&&i[j]){var b,x=n.options,e="on"+o.charAt(0).toUpperCase()+o.substr(1);!window.CustomEvent||l||c?(b=document.createEvent("Event")).initEvent(o,true,true):b=new CustomEvent(o,{bubbles:true,cancelable:true}),b.to=a||i,b.from=u||i,b.item=r||i,b.clone=s,b.oldIndex=d,b.newIndex=h,b.oldDraggableIndex=f,b.newDraggableIndex=v,b.originalEvent=p,b.pullMode=m?m.lastPutMode:void 0;var w,E=t(t({},g),B.getEventProperties(o,n));for(w in E)b[w]=E[w];i&&i.dispatchEvent(b),x[e]&&x[e].call(n,b)}}function Y(e,n){var i=(r=2<arguments.length&&void 0!==arguments[2]?arguments[2]:{}).evt,r=o(r,G);B.pluginEvent.bind(Re)(e,n,t({dragEl:W,parentEl:J,ghostEl:X,rootEl:$,nextEl:ee,lastDownEl:te,cloneEl:ne,cloneHidden:ie,dragStarted:me,putSortable:ce,activeSortable:Re.active,originalEvent:i,oldIndex:oe,oldDraggableIndex:se,newIndex:re,newDraggableIndex:ae,hideGhostForTarget:ze,unhideGhostForTarget:Ae,cloneNowHidden:function(){ie=true},cloneNowShown:function(){ie=false},dispatchSortableEvent:function(e){K({sortable:n,name:e,originalEvent:i})}},r))}var G=["evt"];function K(e){Q(t({putSortable:ce,cloneEl:ne,targetEl:W,rootEl:$,oldIndex:oe,oldDraggableIndex:se,newIndex:re,newDraggableIndex:ae},e))}var W,J,X,$,ee,te,ne,ie,oe,re,se,ae,le,ce,ue,de,he,fe,ve,pe,me,ge,be,xe,we,Ee=false,ye=false,Se=[],_e=false,ke=false,Te=[],Ce=false,Ie=[],qe="undefined"!=typeof document,Me=h,De=c||l?"cssFloat":"float",He=qe&&!f&&!h&&"draggable"in document.createElement("div"),Ve=function(){if(qe){if(l)return false;var e=document.createElement("x");return e.style.cssText="pointer-events:auto","auto"===e.style.pointerEvents}}(),Oe=function(e,t){var n=S(e),i=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),o=q(e,0,t),r=q(e,1,t),s=o&&S(o),a=r&&S(r),l=s&&parseInt(s.marginLeft)+parseInt(s.marginRight)+C(o).width,e=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+C(r).width;if("flex"===n.display)return"column"===n.flexDirection||"column-reverse"===n.flexDirection?"vertical":"horizontal";if("grid"===n.display)return n.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal";if(o&&s.float&&"none"!==s.float){t="left"===s.float?"left":"right";return!r||"both"!==a.clear&&a.clear!==t?"horizontal":"vertical"}return o&&("block"===s.display||"flex"===s.display||"table"===s.display||"grid"===s.display||i<=l&&"none"===n[De]||r&&"none"===n[De]&&i<l+e)?"vertical":"horizontal"},Le=function(e){function t(e,n){return function(i,o,r,s){var a=i.options.group.name&&o.options.group.name&&i.options.group.name===o.options.group.name;if(null==e&&(n||a))return true;if(null==e||false===e)return false;if(n&&"clone"===e)return e;if("function"==typeof e)return t(e(i,o,r,s),n)(i,o,r,s);o=(n?i:o).options.group.name;return true===e||"string"==typeof e&&e===o||e.join&&-1<e.indexOf(o)}}var i={},o=e.group;o&&"object"==n(o)||(o={name:o}),i.name=o.name,i.checkPull=t(o.pull,true),i.checkPut=t(o.put),i.revertClone=o.revertClone,e.group=i},ze=function(){!Ve&&X&&S(X,"display","none")},Ae=function(){!Ve&&X&&S(X,"display","")};qe&&!f&&document.addEventListener("click",(function(e){if(ye)return e.preventDefault(),e.stopPropagation&&e.stopPropagation(),e.stopImmediatePropagation&&e.stopImmediatePropagation(),ye=false}),true);function Ze(e){if(W){e=e.touches?e.touches[0]:e;var t=(o=e.clientX,r=e.clientY,Se.some((function(e){var t=e[j].options.emptyInsertThreshold;if(t&&!M(e)){var n=C(e),i=o>=n.left-t&&o<=n.right+t,t=r>=n.top-t&&r<=n.bottom+t;return i&&t?s=e:void 0}})),s);if(t){var n,i={};for(n in e)e.hasOwnProperty(n)&&(i[n]=e[n]);i.target=i.rootEl=t,i.preventDefault=void 0,i.stopPropagation=void 0,t[j]._onDragOver(i)}}var o,r,s}function Ne(e){W&&W.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=i({},t),e[j]=this;var n,o,r={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 Oe(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&&(!d||h),emptyInsertThreshold:5};for(n in B.initializePlugins(this,e,r),r)n in t||(t[n]=r[n]);for(o in Le(t),this)"_"===o.charAt(0)&&"function"==typeof this[o]&&(this[o]=this[o].bind(this));this.nativeDraggable=!t.forceFallback&&He,this.nativeDraggable&&(this.options.touchStartThreshold=1),t.supportPointer?p(e,"pointerdown",this._onTapStart):(p(e,"mousedown",this._onTapStart),p(e,"touchstart",this._onTapStart)),this.nativeDraggable&&(p(e,"dragover",this),p(e,"dragenter",this)),Se.push(this.el),t.store&&t.store.get&&this.sort(t.store.get(this)||[]),i(this,P())}function je(e,t,n,i,o,r,s,a){var u,d,h=e[j],f=h.options.onMove;return!window.CustomEvent||l||c?(u=document.createEvent("Event")).initEvent("move",true,true):u=new CustomEvent("move",{bubbles:true,cancelable:true}),u.to=t,u.from=e,u.dragged=n,u.draggedRect=i,u.related=o||t,u.relatedRect=r||C(t),u.willInsertAfter=a,u.originalEvent=s,e.dispatchEvent(u),d=f?f.call(h,u,s):d}function Pe(e){e.draggable=false}function Fe(){Ce=false}function Ue(e){return setTimeout(e,0)}function Be(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,W):this.options.direction},_onTapStart:function(e){if(e.cancelable){var t=this,n=this.el,i=this.options,o=i.preventOnFilter,r=e.type,s=e.touches&&e.touches[0]||e.pointerType&&"touch"===e.pointerType&&e,a=(s||e).target,l=e.target.shadowRoot&&(e.path&&e.path[0]||e.composedPath&&e.composedPath()[0])||a,c=i.filter;if(!function(e){Ie.length=0;var t=e.getElementsByTagName("input"),n=t.length;for(;n--;){var i=t[n];i.checked&&Ie.push(i)}}(n),!W&&!(/mousedown|pointerdown/.test(r)&&0!==e.button||i.disabled)&&!l.isContentEditable&&(this.nativeDraggable||!d||!a||"SELECT"!==a.tagName.toUpperCase())&&!((a=x(a,i.draggable,n,false))&&a.animated||te===a)){if(oe=D(a),se=D(a,i.draggable),"function"==typeof c){if(c.call(this,e,a,this))return K({sortable:t,rootEl:l,name:"filter",targetEl:a,toEl:n,fromEl:n}),Y("filter",t,{evt:e}),void(o&&e.preventDefault())}else if(c=c&&c.split(",").some((function(i){if(i=x(l,i.trim(),n,false))return K({sortable:t,rootEl:i,name:"filter",targetEl:a,fromEl:n,toEl:n}),Y("filter",t,{evt:e}),true})))return void(o&&e.preventDefault());i.handle&&!x(l,i.handle,n,false)||this._prepareDragStart(e,s,a)}}},_prepareDragStart:function(e,t,n){var i,o=this,r=o.el,s=o.options,a=r.ownerDocument;n&&!W&&n.parentNode===r&&(i=C(n),$=r,J=(W=n).parentNode,ee=W.nextSibling,te=n,le=s.group,ue={target:Re.dragged=W,clientX:(t||e).clientX,clientY:(t||e).clientY},ve=ue.clientX-i.left,pe=ue.clientY-i.top,this._lastX=(t||e).clientX,this._lastY=(t||e).clientY,W.style["will-change"]="all",i=function(){Y("delayEnded",o,{evt:e}),Re.eventCanceled?o._onDrop():(o._disableDelayedDragEvents(),!u&&o.nativeDraggable&&(W.draggable=true),o._triggerDragStart(e,t),K({sortable:o,name:"choose",originalEvent:e}),y(W,s.chosenClass,true))},s.ignore.split(",").forEach((function(e){k(W,e.trim(),Pe)})),p(a,"dragover",Ze),p(a,"mousemove",Ze),p(a,"touchmove",Ze),s.supportPointer?(p(a,"pointerup",o._onDrop),this.nativeDraggable||p(a,"pointercancel",o._onDrop)):(p(a,"mouseup",o._onDrop),p(a,"touchend",o._onDrop),p(a,"touchcancel",o._onDrop)),u&&this.nativeDraggable&&(this.options.touchStartThreshold=4,W.draggable=true),Y("delayStart",this,{evt:e}),!s.delay||s.delayOnTouchOnly&&!t||this.nativeDraggable&&(c||l)?i():Re.eventCanceled?this._onDrop():(s.supportPointer?(p(a,"pointerup",o._disableDelayedDrag),p(a,"pointercancel",o._disableDelayedDrag)):(p(a,"mouseup",o._disableDelayedDrag),p(a,"touchend",o._disableDelayedDrag),p(a,"touchcancel",o._disableDelayedDrag)),p(a,"mousemove",o._delayedDragTouchMoveHandler),p(a,"touchmove",o._delayedDragTouchMoveHandler),s.supportPointer&&p(a,"pointermove",o._delayedDragTouchMoveHandler),o._dragStartTimer=setTimeout(i,s.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(){W&&Pe(W),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?p(document,"pointermove",this._onTouchMove):p(document,t?"touchmove":"mousemove",this._onTouchMove):(p(W,"dragend",this),p($,"dragstart",this._onDragStart));try{document.selection?Ue((function(){document.selection.empty()})):window.getSelection().removeAllRanges()}catch(e){}},_dragStarted:function(e,t){var n;Ee=false,$&&W?(Y("dragStarted",this,{evt:t}),this.nativeDraggable&&p(document,"dragover",Ne),n=this.options,e||y(W,n.dragClass,false),y(W,n.ghostClass,true),Re.active=this,e&&this._appendGhost(),K({sortable:this,name:"start",originalEvent:t})):this._nulling()},_emulateDragOver:function(){if(de){this._lastX=de.clientX,this._lastY=de.clientY,ze();for(var e=document.elementFromPoint(de.clientX,de.clientY),t=e;e&&e.shadowRoot&&(e=e.shadowRoot.elementFromPoint(de.clientX,de.clientY))!==t;)t=e;if(W.parentNode[j]._isOutsideThisEl(e),t)do{if(t[j])if(t[j]._onDragOver({clientX:de.clientX,clientY:de.clientY,target:e,rootEl:t})&&!this.options.dragoverBubble)break}while(t=b(e=t));Ae()}},_onTouchMove:function(e){if(ue){var t=this.options,n=t.fallbackTolerance,i=t.fallbackOffset,o=e.touches?e.touches[0]:e,r=X&&_(X,true),s=X&&r&&r.a,a=X&&r&&r.d,t=Me&&we&&H(we),s=(o.clientX-ue.clientX+i.x)/(s||1)+(t?t[0]-Te[0]:0)/(s||1),a=(o.clientY-ue.clientY+i.y)/(a||1)+(t?t[1]-Te[1]:0)/(a||1);if(!Re.active&&!Ee){if(n&&Math.max(Math.abs(o.clientX-this._lastX),Math.abs(o.clientY-this._lastY))<n)return;this._onDragStart(e,true)}X&&(r?(r.e+=s-(he||0),r.f+=a-(fe||0)):r={a:1,b:0,c:0,d:1,e:s,f:a},r="matrix(".concat(r.a,",").concat(r.b,",").concat(r.c,",").concat(r.d,",").concat(r.e,",").concat(r.f,")"),S(X,"webkitTransform",r),S(X,"mozTransform",r),S(X,"msTransform",r),S(X,"transform",r),he=s,fe=a,de=o),e.cancelable&&e.preventDefault()}},_appendGhost:function(){if(!X){var e=this.options.fallbackOnBody?document.body:$,t=C(W,true,Me,true,e),n=this.options;if(Me){for(we=e;"static"===S(we,"position")&&"none"===S(we,"transform")&&we!==document;)we=we.parentNode;we!==document.body&&we!==document.documentElement?(we===document&&(we=T()),t.top+=we.scrollTop,t.left+=we.scrollLeft):we=T(),Te=H(we)}y(X=W.cloneNode(true),n.ghostClass,false),y(X,n.fallbackClass,true),y(X,n.dragClass,true),S(X,"transition",""),S(X,"transform",""),S(X,"box-sizing","border-box"),S(X,"margin",0),S(X,"top",t.top),S(X,"left",t.left),S(X,"width",t.width),S(X,"height",t.height),S(X,"opacity","0.8"),S(X,"position",Me?"absolute":"fixed"),S(X,"zIndex","100000"),S(X,"pointerEvents","none"),Re.ghost=X,e.appendChild(X),S(X,"transform-origin",ve/parseInt(X.style.width)*100+"% "+pe/parseInt(X.style.height)*100+"%")}},_onDragStart:function(e,t){var n=this,i=e.dataTransfer,o=n.options;Y("dragStart",this,{evt:e}),Re.eventCanceled?this._onDrop():(Y("setupClone",this),Re.eventCanceled||((ne=A(W)).removeAttribute("id"),ne.draggable=false,ne.style["will-change"]="",this._hideClone(),y(ne,this.options.chosenClass,false),Re.clone=ne),n.cloneId=Ue((function(){Y("clone",n),Re.eventCanceled||(n.options.removeCloneOnHide||$.insertBefore(ne,W),n._hideClone(),K({sortable:n,name:"clone"}))})),t||y(W,o.dragClass,true),t?(ye=true,n._loopId=setInterval(n._emulateDragOver,50)):(m(document,"mouseup",n._onDrop),m(document,"touchend",n._onDrop),m(document,"touchcancel",n._onDrop),i&&(i.effectAllowed="move",o.setData&&o.setData.call(n,i,W)),p(document,"drop",n),S(W,"transform","translateZ(0)")),Ee=true,n._dragStartId=Ue(n._dragStarted.bind(n,t,e)),p(document,"selectstart",n),me=true,window.getSelection().removeAllRanges(),d&&S(document.body,"user-select","none"))},_onDragOver:function(e){var n,i,o,r,s,a=this.el,l=e.target,c=this.options,u=c.group,d=Re.active,h=le===u,f=c.sort,v=ce||d,p=this,m=false;if(!Ce){if(void 0!==e.preventDefault&&e.cancelable&&e.preventDefault(),l=x(l,c.draggable,a,true),Z("dragOver"),Re.eventCanceled)return m;if(W.contains(e.target)||l.animated&&l.animatingX&&l.animatingY||p._ignoreWhileAnimating===l)return P(false);if(ye=false,d&&!c.disabled&&(h?f||(i=J!==$):ce===this||(this.lastPutMode=le.checkPull(this,d,W,e))&&u.checkPut(this,d,W,e))){if(o="vertical"===this._getDirection(e,l),n=C(W),Z("dragOverValid"),Re.eventCanceled)return m;if(i)return J=$,N(),this._hideClone(),Z("revert"),Re.eventCanceled||(ee?$.insertBefore(W,ee):$.appendChild(W)),P(true);var g=M(a,c.draggable);if(g&&(H=e,u=o,A=C(M((T=this).el,T.options.draggable)),T=R(T.el,T.options,X),!(u?H.clientX>T.right+10||H.clientY>A.bottom&&H.clientX>A.left:H.clientY>T.bottom+10||H.clientX>A.right&&H.clientY>A.top)||g.animated)){if(g&&(r=e,s=o,O=C(q((V=this).el,0,V.options,true)),V=R(V.el,V.options,X),s?r.clientX<V.left-10||r.clientY<O.top&&r.clientX<O.right:r.clientY<V.top-10||r.clientY<O.bottom&&r.clientX<O.left)){var b=q(a,0,c,true);if(b===W)return P(false);if(k=C(l=b),false!==je($,a,W,n,l,k,e,false))return N(),a.insertBefore(W,b),J=a,F(),P(true)}else if(l.parentNode===a){var w,E,_,k=C(l),T=W.parentNode!==a,H=(H=W.animated&&W.toRect||n,A=l.animated&&l.toRect||k,V=(s=o)?H.left:H.top,r=s?H.right:H.bottom,O=s?H.width:H.height,b=s?A.left:A.top,H=s?A.right:A.bottom,A=s?A.width:A.height,!(V===b||r===H||V+O/2===b+A/2)),V=o?"top":"left",O=I(l,"top","top")||I(W,"top","top"),b=O?O.scrollTop:void 0;if(ge!==l&&(E=k[V],_e=false,ke=!H&&c.invertSwap||T),0!==(w=function(e,t,n,i,o,r,s,a){var l=i?e.clientY:e.clientX,c=i?n.height:n.width,e=i?n.top:n.left,i=i?n.bottom:n.right,n=false;if(!s)if(a&&xe<c*o){if(_e=!_e&&(1===be?e+c*r/2<l:l<i-c*r/2)?true:_e)n=true;else if(1===be?l<e+xe:i-xe<l)return-be}else if(e+c*(1-o)/2<l&&l<i-c*(1-o)/2)return function(e){return D(W)<D(e)?1:-1}(t);if((n=n||s)&&(l<e+c*r/2||i-c*r/2<l))return e+c/2<l?1:-1;return 0}(e,l,k,o,H?1:c.swapThreshold,null==c.invertedSwapThreshold?c.swapThreshold:c.invertedSwapThreshold,ke,ge===l)))for(var L=D(W);(_=J.children[L-=w])&&("none"===S(_,"display")||_===X););if(0===w||_===l)return P(false);be=w;var A=(ge=l).nextElementSibling,T=false,H=je($,a,W,n,l,k,e,T=1===w);if(false!==H)return 1!==H&&-1!==H||(T=1===H),Ce=true,setTimeout(Fe,30),N(),T&&!A?a.appendChild(W):l.parentNode.insertBefore(W,T?A:l),O&&z(O,0,b-O.scrollTop),J=W.parentNode,void 0===E||ke||(xe=Math.abs(E-C(l)[V])),F(),P(true)}}else{if(g===W)return P(false);if((l=g&&a===e.target?g:l)&&(k=C(l)),false!==je($,a,W,n,l,k,e,!!l))return N(),g&&g.nextSibling?a.insertBefore(W,g.nextSibling):a.appendChild(W),J=a,F(),P(true)}if(a.contains(W))return P(false)}return false}function Z(r,s){Y(r,p,t({evt:e,isOwner:h,axis:o?"vertical":"horizontal",revert:i,dragRect:n,targetRect:k,canSort:f,fromSortable:v,target:l,completed:P,onMove:function(t,i){return je($,a,W,n,t,C(t),e,i)},changed:F},s))}function N(){Z("dragOverAnimationCapture"),p.captureAnimationState(),p!==v&&v.captureAnimationState()}function P(t){return Z("dragOverCompleted",{insertion:t}),t&&(h?d._hideClone():d._showClone(p),p!==v&&(y(W,(ce||d).options.ghostClass,false),y(W,c.ghostClass,true)),ce!==p&&p!==Re.active?ce=p:p===Re.active&&ce&&(ce=null),v===p&&(p._ignoreWhileAnimating=l),p.animateAll((function(){Z("dragOverAnimationComplete"),p._ignoreWhileAnimating=null})),p!==v&&(v.animateAll(),v._ignoreWhileAnimating=null)),(l===W&&!W.animated||l===a&&!l.animated)&&(ge=null),c.dragoverBubble||e.rootEl||l===document||(W.parentNode[j]._isOutsideThisEl(e.target),t||Ze(e)),!c.dragoverBubble&&e.stopPropagation&&e.stopPropagation(),m=true}function F(){re=D(W),ae=D(W,c.draggable),K({sortable:p,name:"change",toEl:a,newIndex:re,newDraggableIndex:ae,originalEvent:e})}},_ignoreWhileAnimating:null,_offMoveEvents:function(){m(document,"mousemove",this._onTouchMove),m(document,"touchmove",this._onTouchMove),m(document,"pointermove",this._onTouchMove),m(document,"dragover",Ze),m(document,"mousemove",Ze),m(document,"touchmove",Ze)},_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,n=this.options;re=D(W),ae=D(W,n.draggable),Y("drop",this,{evt:e}),J=W&&W.parentNode,re=D(W),ae=D(W,n.draggable),Re.eventCanceled||(_e=ke=Ee=false,clearInterval(this._loopId),clearTimeout(this._dragStartTimer),Be(this.cloneId),Be(this._dragStartId),this.nativeDraggable&&(m(document,"drop",this),m(t,"dragstart",this._onDragStart)),this._offMoveEvents(),this._offUpEvents(),d&&S(document.body,"user-select",""),S(W,"transform",""),e&&(me&&(e.cancelable&&e.preventDefault(),n.dropBubble||e.stopPropagation()),X&&X.parentNode&&X.parentNode.removeChild(X),($===J||ce&&"clone"!==ce.lastPutMode)&&ne&&ne.parentNode&&ne.parentNode.removeChild(ne),W&&(this.nativeDraggable&&m(W,"dragend",this),Pe(W),W.style["will-change"]="",me&&!Ee&&y(W,(ce||this).options.ghostClass,false),y(W,this.options.chosenClass,false),K({sortable:this,name:"unchoose",toEl:J,newIndex:null,newDraggableIndex:null,originalEvent:e}),$!==J?(0<=re&&(K({rootEl:J,name:"add",toEl:J,fromEl:$,originalEvent:e}),K({sortable:this,name:"remove",toEl:J,originalEvent:e}),K({rootEl:J,name:"sort",toEl:J,fromEl:$,originalEvent:e}),K({sortable:this,name:"sort",toEl:J,originalEvent:e})),ce&&ce.save()):re!==oe&&0<=re&&(K({sortable:this,name:"update",toEl:J,originalEvent:e}),K({sortable:this,name:"sort",toEl:J,originalEvent:e})),Re.active&&(null!=re&&-1!==re||(re=oe,ae=se),K({sortable:this,name:"end",toEl:J,originalEvent:e}),this.save())))),this._nulling()},_nulling:function(){Y("nulling",this),$=W=J=X=ee=ne=te=ie=ue=de=me=re=ae=oe=se=ge=be=ce=le=Re.dragged=Re.ghost=Re.clone=Re.active=null,Ie.forEach((function(e){e.checked=true})),Ie.length=he=fe=0},handleEvent:function(e){switch(e.type){case"drop":case"dragend":this._onDrop(e);break;case"dragenter":case"dragover":W&&(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=[],n=this.el.children,i=0,o=n.length,r=this.options;i<o;i++)x(e=n[i],r.draggable,this.el,false)&&t.push(e.getAttribute(r.dataIdAttr)||function(e){var t=e.tagName+e.className+e.src+e.href+e.textContent,n=t.length,i=0;for(;n--;)i+=t.charCodeAt(n);return i.toString(36)}(e));return t},sort:function(e,t){var n={},i=this.el;this.toArray().forEach((function(e,t){t=i.children[t];x(t,this.options.draggable,i,false)&&(n[e]=t)}),this),t&&this.captureAnimationState(),e.forEach((function(e){n[e]&&(i.removeChild(n[e]),i.appendChild(n[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 n=this.options;if(void 0===t)return n[e];var i=B.modifyOption(this,e,t);n[e]=void 0!==i?i:t,"group"===e&&Le(n)},destroy:function(){Y("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(),Se.splice(Se.indexOf(this.el),1),this.el=e=null},_hideClone:function(){ie||(Y("hideClone",this),Re.eventCanceled||(S(ne,"display","none"),this.options.removeCloneOnHide&&ne.parentNode&&ne.parentNode.removeChild(ne),ie=true))},_showClone:function(e){"clone"===e.lastPutMode?ie&&(Y("showClone",this),Re.eventCanceled||(W.parentNode!=$||this.options.group.revertClone?ee?$.insertBefore(ne,ee):$.appendChild(ne):$.insertBefore(ne,W),this.options.group.revertClone&&this.animate(W,ne),S(ne,"display",""),ie=false)):this._hideClone()}},qe&&p(document,"touchmove",(function(e){(Re.active||Ee)&&e.cancelable&&e.preventDefault()})),Re.utils={on:p,off:m,css:S,find:k,is:function(e,t){return!!x(e,t,e,false)},extend:function(e,t){if(e&&t)for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);return e},throttle:L,closest:x,toggleClass:y,clone:A,index:D,nextTick:Ue,cancelNextTick:Be,detectDirection:Oe,getChild:q,expando:j},Re.get=function(e){return e[j]},Re.mount=function(){for(var e=arguments.length,n=new Array(e),i=0;i<e;i++)n[i]=arguments[i];(n=n[0].constructor===Array?n[0]:n).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)),B.mount(e)}))},Re.create=function(e,t){return new Re(e,t)};var Qe,Ye,Ge,Ke,We,Je,Xe=[],$e=!(Re.version="1.15.6");function et(){Xe.forEach((function(e){clearInterval(e.pid)})),Xe=[]}function tt(){clearInterval(Je)}var nt,it=L((function(e,t,n,i){if(t.scroll){var o,r=(e.touches?e.touches[0]:e).clientX,s=(e.touches?e.touches[0]:e).clientY,a=t.scrollSensitivity,l=t.scrollSpeed,c=T(),u=false;Ye!==n&&(Ye=n,et(),Qe=t.scroll,o=t.scrollFn,true===Qe&&(Qe=V(n,true)));var d=0,h=Qe;do{var f=h,v=C(f),p=v.top,m=v.bottom,g=v.left,b=v.right,x=v.width,w=v.height,E=void 0,y=void 0,_=f.scrollWidth,k=f.scrollHeight,I=S(f),q=f.scrollLeft,v=f.scrollTop,y=f===c?(E=x<_&&("auto"===I.overflowX||"scroll"===I.overflowX||"visible"===I.overflowX),w<k&&("auto"===I.overflowY||"scroll"===I.overflowY||"visible"===I.overflowY)):(E=x<_&&("auto"===I.overflowX||"scroll"===I.overflowX),w<k&&("auto"===I.overflowY||"scroll"===I.overflowY)),q=E&&(Math.abs(b-r)<=a&&q+x<_)-(Math.abs(g-r)<=a&&!!q),v=y&&(Math.abs(m-s)<=a&&v+w<k)-(Math.abs(p-s)<=a&&!!v);if(!Xe[d])for(var M=0;M<=d;M++)Xe[M]||(Xe[M]={});Xe[d].vx==q&&Xe[d].vy==v&&Xe[d].el===f||(Xe[d].el=f,Xe[d].vx=q,Xe[d].vy=v,clearInterval(Xe[d].pid),0==q&&0==v||(u=true,Xe[d].pid=setInterval(function(){i&&0===this.layer&&Re.active._onTouchMove(We);var t=Xe[this.layer].vy?Xe[this.layer].vy*l:0,n=Xe[this.layer].vx?Xe[this.layer].vx*l:0;"function"==typeof o&&"continue"!==o.call(Re.dragged.parentNode[j],n,t,e,We,Xe[this.layer].el)||z(Xe[this.layer].el,n,t)}.bind({layer:d}),24))),d++}while(t.bubbleScroll&&h!==c&&(h=V(h,false)));$e=u}}),30),f=function(e){var t=e.originalEvent,n=e.putSortable,i=e.dragEl,o=e.activeSortable,r=e.dispatchSortableEvent,s=e.hideGhostForTarget,e=e.unhideGhostForTarget;t&&(o=n||o,s(),t=t.changedTouches&&t.changedTouches.length?t.changedTouches[0]:t,t=document.elementFromPoint(t.clientX,t.clientY),e(),o&&!o.el.contains(t)&&(r("spill"),this.onSpill({dragEl:i,putSortable:n})))};function ot(){}function rt(){}ot.prototype={startIndex:null,dragStart:function(e){e=e.oldDraggableIndex;this.startIndex=e},onSpill:function(e){var t=e.dragEl,n=e.putSortable;this.sortable.captureAnimationState(),n&&n.captureAnimationState();e=q(this.sortable.el,this.startIndex,this.options);e?this.sortable.el.insertBefore(t,e):this.sortable.el.appendChild(t),this.sortable.animateAll(),n&&n.animateAll()},drop:f},i(ot,{pluginName:"revertOnSpill"}),rt.prototype={onSpill:function(e){var t=e.dragEl,e=e.putSortable||this.sortable;e.captureAnimationState(),t.parentNode&&t.parentNode.removeChild(t),e.animateAll()},drop:f},i(rt,{pluginName:"removeOnSpill"});var st,at,lt,ct,ut,dt=[],ht=[],ft=false,vt=false,pt=false;function mt(e,t){ht.forEach((function(n,i){i=t.children[n.sortableIndex+(e?Number(i):0)];i?t.insertBefore(n,i):t.appendChild(n)}))}function gt(){dt.forEach((function(e){e!==lt&&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?p(document,"dragover",this._handleAutoScroll):this.options.supportPointer?p(document,"pointermove",this._handleFallbackAutoScroll):e.touches?p(document,"touchmove",this._handleFallbackAutoScroll):p(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(){We=Ye=Qe=$e=Je=Ge=Ke=null,Xe.length=0},_handleFallbackAutoScroll:function(e){this._handleAutoScroll(e,true)},_handleAutoScroll:function(e,t){var n,i=this,o=(e.touches?e.touches[0]:e).clientX,r=(e.touches?e.touches[0]:e).clientY,s=document.elementFromPoint(o,r);We=e,t||this.options.forceAutoScrollFallback||c||l||d?(it(e,this.options,s,t),n=V(s,true),!$e||Je&&o===Ge&&r===Ke||(Je&&tt(),Je=setInterval((function(){var s=V(document.elementFromPoint(o,r),true);s!==n&&(n=s,et()),it(e,i.options,s,t)}),10),Ge=o,Ke=r)):this.options.bubbleScroll&&V(s,true)!==T()?it(e,this.options,V(s,false),false):et()}},i(e,{pluginName:"scroll",initializeByDefault:true})}),Re.mount(rt,ot),Re.mount(new function(){function e(){this.defaults={swapClass:"sortable-swap-highlight"}}return e.prototype={dragStart:function(e){e=e.dragEl;nt=e},dragOverValid:function(e){var t=e.completed,n=e.target,i=e.onMove,o=e.activeSortable,r=e.changed,s=e.cancel;o.options.swap&&(e=this.sortable.el,o=this.options,n&&n!==e&&(e=nt,nt=false!==i(n)?(y(n,o.swapClass,true),n):null,e&&e!==nt&&y(e,o.swapClass,false)),r(),t(true),s())},drop:function(e){var t,n,i=e.activeSortable,o=e.putSortable,r=e.dragEl,s=o||this.sortable,a=this.options;nt&&y(nt,a.swapClass,false),nt&&(a.swap||o&&o.options.swap)&&r!==nt&&(s.captureAnimationState(),s!==i&&i.captureAnimationState(),n=nt,e=(t=r).parentNode,a=n.parentNode,e&&a&&!e.isEqualNode(n)&&!a.isEqualNode(t)&&(o=D(t),r=D(n),e.isEqualNode(a)&&o<r&&r++,e.insertBefore(n,e.children[o]),a.insertBefore(t,a.children[r])),s.animateAll(),s!==i&&i.animateAll())},nulling:function(){nt=null}},i(e,{pluginName:"swap",eventProperties:function(){return{swapItem:nt}}})}),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?p(document,"pointerup",this._deselectMultiDrag):(p(document,"mouseup",this._deselectMultiDrag),p(document,"touchend",this._deselectMultiDrag))),p(document,"keydown",this._checkKeyDown),p(document,"keyup",this._checkKeyUp),this.defaults={selectedClass:"sortable-selected",multiDragKey:null,avoidImplicitDeselect:false,setData:function(t,n){var i="";dt.length&&at===e?dt.forEach((function(e,t){i+=(t?", ":"")+e.textContent})):i=n.textContent,t.setData("Text",i)}}}return e.prototype={multiDragKeyDown:false,isMultiDrag:false,delayStartGlobal:function(e){e=e.dragEl;lt=e},delayEnded:function(){this.isMultiDrag=~dt.indexOf(lt)},setupClone:function(e){var t=e.sortable,e=e.cancel;if(this.isMultiDrag){for(var n=0;n<dt.length;n++)ht.push(A(dt[n])),ht[n].sortableIndex=dt[n].sortableIndex,ht[n].draggable=false,ht[n].style["will-change"]="",y(ht[n],this.options.selectedClass,false),dt[n]===lt&&y(ht[n],this.options.chosenClass,false);t._hideClone(),e()}},clone:function(e){var t=e.sortable,n=e.rootEl,i=e.dispatchSortableEvent,e=e.cancel;this.isMultiDrag&&(this.options.removeCloneOnHide||dt.length&&at===t&&(mt(true,n),i("clone"),e()))},showClone:function(e){var t=e.cloneNowShown,n=e.rootEl,e=e.cancel;this.isMultiDrag&&(mt(false,n),ht.forEach((function(e){S(e,"display","")})),t(),ut=false,e())},hideClone:function(e){var t=this,n=e.cloneNowHidden,e=e.cancel;this.isMultiDrag&&(ht.forEach((function(e){S(e,"display","none"),t.options.removeCloneOnHide&&e.parentNode&&e.parentNode.removeChild(e)})),n(),ut=true,e())},dragStartGlobal:function(e){!this.isMultiDrag&&at&&at.multiDrag._deselectMultiDrag(),dt.forEach((function(e){e.sortableIndex=D(e)})),dt=dt.sort((function(e,t){return e.sortableIndex-t.sortableIndex})),pt=true},dragStarted:function(e){var t,n=this,e=e.sortable;this.isMultiDrag&&(this.options.sort&&(e.captureAnimationState(),this.options.animation&&(dt.forEach((function(e){e!==lt&&S(e,"position","absolute")})),t=C(lt,false,true,true),dt.forEach((function(e){e!==lt&&Z(e,t)})),ft=vt=true)),e.animateAll((function(){ft=vt=false,n.options.animation&&dt.forEach((function(e){N(e)})),n.options.sort&>()})))},dragOver:function(e){var t=e.target,n=e.completed,e=e.cancel;vt&&~dt.indexOf(t)&&(n(false),e())},revert:function(e){var t,n,i=e.fromSortable,o=e.rootEl,r=e.sortable,s=e.dragRect;1<dt.length&&(dt.forEach((function(e){r.addAnimationState({target:e,rect:vt?C(e):s}),N(e),e.fromRect=s,i.removeAnimationState(e)})),vt=false,t=!this.options.removeCloneOnHide,n=o,dt.forEach((function(e,i){i=n.children[e.sortableIndex+(t?Number(i):0)];i?n.insertBefore(e,i):n.appendChild(e)})))},dragOverCompleted:function(e){var t,n=e.sortable,i=e.isOwner,o=e.insertion,r=e.activeSortable,s=e.parentEl,a=e.putSortable,e=this.options;o&&(i&&r._hideClone(),ft=false,e.animation&&1<dt.length&&(vt||!i&&!r.options.sort&&!a)&&(t=C(lt,false,true,true),dt.forEach((function(e){e!==lt&&(Z(e,t),s.appendChild(e))})),vt=true),i||(vt||gt(),1<dt.length?(i=ut,r._showClone(n),r.options.animation&&!ut&&i&&ht.forEach((function(e){r.addAnimationState({target:e,rect:ct}),e.fromRect=ct,e.thisAnimationDuration=null}))):r._showClone(n)))},dragOverAnimationCapture:function(e){var t=e.dragRect,n=e.isOwner,e=e.activeSortable;dt.forEach((function(e){e.thisAnimationDuration=null})),e.options.animation&&!n&&e.multiDrag.isMultiDrag&&(ct=i({},t),t=_(lt,true),ct.top-=t.f,ct.left-=t.e)},dragOverAnimationComplete:function(){vt&&(vt=false,gt())},drop:function(e){var t,n,i,o,r,s,a,l=e.originalEvent,c=e.rootEl,u=e.parentEl,d=e.sortable,h=e.dispatchSortableEvent,f=e.oldIndex,e=e.putSortable,v=e||this.sortable;l&&(t=this.options,n=u.children,pt||(t.multiDragKey&&!this.multiDragKeyDown&&this._deselectMultiDrag(),y(lt,t.selectedClass,!~dt.indexOf(lt)),~dt.indexOf(lt)?(dt.splice(dt.indexOf(lt),1),st=null,Q({sortable:d,rootEl:c,name:"deselect",targetEl:lt,originalEvent:l})):(dt.push(lt),Q({sortable:d,rootEl:c,name:"select",targetEl:lt,originalEvent:l}),l.shiftKey&&st&&d.el.contains(st)?(i=D(st),o=D(lt),~i&&~o&&i!==o&&function(){for(var e,r=i<o?(e=i,o):(e=o,i+1),s=t.filter;e<r;e++)~dt.indexOf(n[e])||x(n[e],t.draggable,u,false)&&(s&&("function"==typeof s?s.call(d,l,n[e],d):s.split(",").some((function(t){return x(n[e],t.trim(),u,false)})))||(y(n[e],t.selectedClass,true),dt.push(n[e]),Q({sortable:d,rootEl:c,name:"select",targetEl:n[e],originalEvent:l})))}()):st=lt,at=v)),pt&&this.isMultiDrag&&(vt=false,(u[j].options.sort||u!==c)&&1<dt.length&&(r=C(lt),s=D(lt,":not(."+this.options.selectedClass+")"),!ft&&t.animation&&(lt.thisAnimationDuration=null),v.captureAnimationState(),ft||(t.animation&&(lt.fromRect=r,dt.forEach((function(e){var t;e.thisAnimationDuration=null,e!==lt&&(t=vt?C(e):r,e.fromRect=t,v.addAnimationState({target:e,rect:t}))}))),gt(),dt.forEach((function(e){n[s]?u.insertBefore(e,n[s]):u.appendChild(e),s++})),f===D(lt)&&(a=false,dt.forEach((function(e){e.sortableIndex!==D(e)&&(a=true)})),a&&(h("update"),h("sort")))),dt.forEach((function(e){N(e)})),v.animateAll()),at=v),(c===u||e&&"clone"!==e.lastPutMode)&&ht.forEach((function(e){e.parentNode&&e.parentNode.removeChild(e)})))},nullingGlobal:function(){this.isMultiDrag=pt=false,ht.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!==pt&&pt||at!==this.sortable||e&&x(e.target,this.options.draggable,this.sortable.el,false)||e&&0!==e.button))for(;dt.length;){var t=dt[0];y(t,this.options.selectedClass,false),dt.shift(),Q({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)}},i(e,{pluginName:"multiDrag",utils:{select:function(e){var t=e.parentNode[j];t&&t.options.multiDrag&&!~dt.indexOf(e)&&(at&&at!==t&&(at.multiDrag._deselectMultiDrag(),at=t),y(e,t.options.selectedClass,true),dt.push(e))},deselect:function(e){var t=e.parentNode[j],n=dt.indexOf(e);t&&t.options.multiDrag&&~n&&(y(e,t.options.selectedClass,false),dt.splice(n,1))}},eventProperties:function(){var e=this,t=[],n=[];return dt.forEach((function(i){var o;t.push({multiDragElement:i,index:i.sortableIndex}),o=vt&&i!==lt?-1:vt?D(i,":not(."+e.options.selectedClass+")"):D(i),n.push({multiDragElement:i,index:o})})),{items:r(dt),clones:[].concat(ht),oldIndicies:t,newIndicies:n}},optionListeners:{multiDragKey:function(e){return"ctrl"===(e=e.toLowerCase())?e="Control":1<e.length&&(e=e.charAt(0).toUpperCase()+e.substr(1)),e}}})}),Re}))})(Sortable_min$1);return Sortable_min$1.exports}var Sortable_minExports=requireSortable_min();var Sortable=getDefaultExportFromCjs(Sortable_minExports);var verdocsTemplateRolesCss='@-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}';var settingsIcon='<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>';var plusIcon='<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>';var iconSigner='<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>';var iconApprover='<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>';var iconCC='<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>';var VerdocsTemplateRoles=function(){function e(e){registerInstance(this,e);this.next=createEvent(this,"next");this.exit=createEvent(this,"exit");this.sdkError=createEvent(this,"sdkError");this.rolesUpdated=createEvent(this,"rolesUpdated");this.templateListenerId=null;this.endpoint=VerdocsEndpoint.getDefault();this.templateId="";this.showingRoleDialog=null;this.sender=null;this.dragging=false;this.loading=true;this.template=null;this.sortableRefs=[]}e.prototype.disconnectedCallback=function(){this.unlistenToTemplate();this.cleanupSortables()};e.prototype.listenToTemplate=function(){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(t){console.log("[ROLES] Loading template",this.templateId);this.unlistenToTemplate();Store.subscribe("templates",this.templateId,(function(){return getTemplate(e.endpoint,e.templateId)}),false,(function(t){console.log("[ROLES] Template Updated",t);e.template=t;e.loading=false}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){Store.store.delListener(this.templateListenerId);this.templateListenerId=null}};e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n;return __generator(this,(function(i){try{this.endpoint.loadSession();if(!this.templateId){console.log("[ROLES] Missing required template ID ".concat(this.templateId));return[2]}if(!this.endpoint.session){console.log("[ROLES] Unable to start builder session, must be authenticated");return[2]}this.listenToTemplate()}catch(i){console.log("[ROLES] Error with preview session",i);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new SDKError(i.message,(t=i.response)===null||t===void 0?void 0:t.status,(n=i.response)===null||n===void 0?void 0:n.data))}return[2]}))}))};e.prototype.cleanupSortables=function(){this.sortableRefs.forEach((function(e){return e.destroy()}));this.sortableRefs.length=0};e.prototype.componentDidRender=function(){var e=this;this.cleanupSortables();var t=this.getSequenceNumbers();(t||[]).forEach((function(t){var n=document.getElementById("verdocs-roles-sequence-".concat(t));if(n){var i=new Sortable(n,{group:"roles",animation:150,dragoverBubble:true,filter:".no-drag",onEnd:e.handleMoveEnd.bind(e),onChoose:function(){return e.dragging=true},onUnchoose:function(){return e.dragging=false}});e.sortableRefs.push(i)}}));var n=document.getElementById("verdocs-roles-sequence-add-target");if(n){console.log("[ROLES] Applying sortable to add-sequence slot");var i=new Sortable(n,{group:"roles",animation:150,dragoverBubble:true,filter:".no-drag",onEnd:this.handleMoveEnd.bind(this),onChoose:function(){return e.dragging=true},onUnchoose:function(){return e.dragging=false}});this.sortableRefs.push(i)}};e.prototype.handleMoveEnd=function(e){var t=this;var n=+e.from.dataset.sequence;var i=+e.to.dataset.sequence;var o=+e.oldIndex+1;var r=+e.newIndex+1;console.log("Move from ".concat(n,":").concat(o," to ").concat(i,":").concat(r),e.item);var s={};var a=this.getSequenceNumbers();a.forEach((function(e){var n=t.getRolesAtSequence(e);s[String(e)]=JSON.parse(JSON.stringify(n))}));s[a[a.length-1]+1]=[];var l=s[n].splice(o-1,1)[0];s[i]||(s[i]=[]);s[i].splice(r-1,0,l);var c=[];Object.entries(s).forEach((function(e){var n=e[0],i=e[1];i.forEach((function(e,i){if(!e){return}var o=+i+1;if(e.sequence!==+n||e.order!==o){e.sequence=+n;e.order=o;c.push(updateTemplateRole(t.endpoint,t.templateId,e.name,{sequence:+n,order:o}).then((function(t){return console.log("[ROLES] Updated role",e.name,t)})).catch((function(e){return console.log("[ROLES] Error updating role",e)})))}}))}));return Promise.all(c).then((function(){return __awaiter(t,void 0,void 0,(function(){return __generator(this,(function(e){return[2,console.log("[ROLES] Done renumbering")]}))}))})).catch((function(e){return console.log("[ROLES] Error updating roles",e)}))};e.prototype.handleCancel=function(){var e;(e=this.exit)===null||e===void 0?void 0:e.emit()};e.prototype.handleSubmit=function(){var e;(e=this.next)===null||e===void 0?void 0:e.emit()};e.prototype.getSortedRoles=function(){var e;return(((e=this.template)===null||e===void 0?void 0:e.roles)||[]).sort((function(e,t){return e.sequence===t.sequence?e.order-t.order:e.sequence-t.sequence}))};e.prototype.getSequenceNumbers=function(){var e={};this.getSortedRoles().forEach((function(t){e[t.sequence]=true}));console.log("[ROLES] Sequences",e);return Object.keys(e).map((function(e){return+e})).sort((function(e,t){return e-t}))};e.prototype.getRoleNames=function(){var e=this.getSortedRoles();return e.map((function(e){return e.name}))};e.prototype.getRolesAtSequence=function(e){var t;return(((t=this.template)===null||t===void 0?void 0:t.roles)||[]).filter((function(t){return t&&t.sequence===e}))};e.prototype.renumberTemplateRoles=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n,i;var o=this;return __generator(this,(function(r){switch(r.label){case 0:t={};n=[];i=this.getSequenceNumbers();(i||[]).forEach((function(e){(t[e]||[]).forEach((function(t,i){var r=+i+1;if(t.sequence!==+e||t.order!==r){console.log("[ROLES] Updating role",t.name,"from",t.sequence,t.order,"to",e,r);t.sequence=+e;t.order=r;n.push(updateTemplateRole(o.endpoint,o.templateId,t.name,{sequence:+e,order:r}).then((function(e){return console.log("[ROLES] Updated role",t.name,e)})).catch((function(e){return console.log("[ROLES] Error updating role",e)})))}}))}));console.log("[ROLES] Awaiting ".concat(n.length," renumber requests"));return[4,Promise.all(n).then((function(){return __awaiter(o,void 0,void 0,(function(){var e;return __generator(this,(function(n){e=JSON.parse(JSON.stringify(this.template));e.roles=Object.keys(t).reduce((function(e,n){return e.concat(t[n])}),[]);console.log("[ROLES] Done renumbering",e.roles.map((function(e){return{name:e.name,sequence:e.sequence,order:e.order}})));Store.updateTemplate(this.templateId,e);return[2]}))}))}))];case 1:r.sent();(e=this.rolesUpdated)===null||e===void 0?void 0:e.emit({event:"updated",endpoint:this.endpoint,templateId:this.templateId,roles:this.getSortedRoles()});return[2]}}))}))};e.prototype.getNextRoleName=function(){var e,t;var n="";var i=(((e=this.template)===null||e===void 0?void 0:e.roles)||[]).length;do{i++;n="Recipient ".concat(i)}while(!n||(((t=this.template)===null||t===void 0?void 0:t.roles)||[]).some((function(e){return e&&e.name===n})));return n};e.prototype.callCreateRole=function(e,t,n){var i=this;console.log("[ROLES] Will create role",{name:e,sequence:t,order:n});createTemplateRole(this.endpoint,this.templateId,{template_id:this.templateId,name:e,sequence:t,message:"",order:n,full_name:null,first_name:"",last_name:"",email:"",phone:"",type:"signer",delegator:false}).then((function(e){return __awaiter(i,void 0,void 0,(function(){var t;return __generator(this,(function(n){switch(n.label){case 0:console.log("[ROLES] Created role",e);console.log("Updating template in data store");return[4,Store.getTemplate(this.endpoint,this.templateId,true)];case 1:n.sent();(t=this.rolesUpdated)===null||t===void 0?void 0:t.emit({event:"added",endpoint:this.endpoint,templateId:this.templateId,roles:this.getSortedRoles()});return[2]}}))}))})).catch((function(e){console.log("[ROLES] Error creating role",e)}))};e.prototype.handleAddRole=function(e,t){e.stopPropagation();var n=this.getRolesAtSequence(t).length+1;var i=this.getNextRoleName();this.callCreateRole(i,t,n)};e.prototype.handleAddStep=function(e,t){e.stopPropagation();var n=1;var i=this.getNextRoleName();this.callCreateRole(i,t,n)};e.prototype.render=function(){var e=this;if(!this.endpoint.session){return h(Host,null,h("verdocs-component-error",{message:"You must be authenticated to use this module."}))}if(this.loading||!this.template){return h(Host,{class:"loading"},h("verdocs-loader",null))}var t=this.getRoleNames();var n=this.getSequenceNumbers();var i=n&&n.length>0?(n[n.length-1]||0)+1:1;console.log("[ROLES] Rendering",{roleNames:t,sequences:n,nextSequence:i});return h(Host,{class:{dragging:this.dragging}},h("form",{onSubmit:function(e){return e.preventDefault()},onClick:function(e){return e.stopPropagation()},autocomplete:"off"},h("h5",null,"Roles and Workflow"),h("div",{class:"roles"},n.map((function(t,n){return h("div",{class:"sequence"},h("div",{class:"sequence-label no-drag"},n+1,"."),h("div",{class:"sequence-roles",id:"verdocs-roles-sequence-".concat(t),"data-sequence":t},e.getRolesAtSequence(t).map((function(n){var i=!n.email||!n.first_name||!n.last_name;return i?h("div",{class:"role","data-rolename":n.name,"data-sequence":t,"data-order":n.order},h("div",{class:"role-name"},n.name),h("div",{class:"icons"},h("div",{class:"gear-button",innerHTML:settingsIcon,onClick:function(){return e.showingRoleDialog=n.name},"aria-role":"button"}),h("span",{class:"type-icon",innerHTML:n.type==="signer"?iconSigner:n.type==="cc"?iconCC:iconApprover}))):h("div",{class:"role","data-rolename":n.name,"data-sequence":t,"data-order":n.order},h("div",{class:"role-name"},formatFullName(n)),h("div",{class:"icons"},h("div",{class:"gear-button",innerHTML:settingsIcon,onClick:function(){return e.showingRoleDialog=n.name},"aria-role":"button"}),h("span",{class:"type-icon",innerHTML:n.type==="signer"?iconSigner:n.type==="cc"?iconCC:iconApprover})))}))),h("button",{class:"add-role no-drag",onClick:function(n){return e.handleAddRole(n,t)}},"+ Add Role"))})),h("div",{class:"sequence add-sequence"},h("div",{class:"sequence-label no-drag"},n.length+1,"."),h("div",{class:"sequence-roles",id:"verdocs-roles-sequence-add-target","data-sequence":i}),h("button",{class:"add-role no-drag",onClick:function(t){return e.handleAddRole(t,i)}},"+ Add Role"))),t.length<1&&h("div",{class:"empty"},"You must add at least one Role before proceeding.",h("br",null)," Click the ",h("span",{innerHTML:plusIcon})," Add button above to get started."),h("div",{class:"buttons"},h("div",{class:"flex-fill"}),h("verdocs-button",{variant:"outline",label:"Cancel",size:"small",onClick:function(){return e.handleCancel()}}),h("verdocs-button",{label:"OK",size:"small",onClick:function(){return e.handleSubmit()},disabled:t.length<1}))),this.showingRoleDialog&&h("verdocs-menu-panel",{onClose:function(){return e.showingRoleDialog=null}},h("verdocs-template-role-properties",{endpoint:this.endpoint,templateId:this.templateId,roleName:this.showingRoleDialog,onClose:function(){var t;(t=document.getElementById("verdocs-menu-panel-overlay"))===null||t===void 0?void 0:t.remove();e.showingRoleDialog=null},onDelete:function(){return __awaiter(e,void 0,void 0,(function(){var e;return __generator(this,(function(t){switch(t.label){case 0:this.showingRoleDialog=null;return[4,this.renumberTemplateRoles()];case 1:t.sent();(e=this.rolesUpdated)===null||e===void 0?void 0:e.emit({event:"deleted",endpoint:this.endpoint,templateId:this.templateId,roles:this.getSortedRoles()});return[2]}}))}))}})))};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();VerdocsTemplateRoles.style=verdocsTemplateRolesCss;var verdocsTemplateSettingsCss='@-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}';var MS_PER_DAY=24*60*60*1e3;var VerdocsTemplateSettings=function(){function e(e){registerInstance(this,e);this.next=createEvent(this,"next");this.exit=createEvent(this,"exit");this.sdkError=createEvent(this,"sdkError");this.templateUpdated=createEvent(this,"templateUpdated");this.templateListenerId=null;this.endpoint=VerdocsEndpoint.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}e.prototype.disconnectedCallback=function(){this.unlistenToTemplate()};e.prototype.listenToTemplate=function(){return __awaiter(this,void 0,void 0,(function(){var e=this;return __generator(this,(function(t){console.log("[SETTINGS] Loading template",this.templateId);this.unlistenToTemplate();Store.subscribe("templates",this.templateId,(function(){return getTemplate(e.endpoint,e.templateId)}),false,(function(t){console.log("[SETTINGS] Template Updated",t);e.template=t;e.name=t.name;e.visibility=t.visibility;e.sender=t.sender;e.sendReminders=t.initial_reminder!==null;e.initialReminder=t.initial_reminder?Math.floor(t.initial_reminder/MS_PER_DAY):null;e.followupReminders=t.followup_reminders?Math.floor(t.followup_reminders/MS_PER_DAY):null;e.dirty=false;e.loading=false}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){Store.store.delListener(this.templateListenerId);this.templateListenerId=null}};e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,n;return __generator(this,(function(i){try{this.endpoint.loadSession();if(!this.templateId){console.log("[SETTINGS] Missing required template ID ".concat(this.templateId));return[2]}if(!this.endpoint.session){console.log("[SETTINGS] Unable to start builder session, must be authenticated");return[2]}this.listenToTemplate()}catch(i){console.log("[SETTINGS] Error with preview session",i);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new SDKError(i.message,(t=i.response)===null||t===void 0?void 0:t.status,(n=i.response)===null||n===void 0?void 0:n.data))}return[2]}))}))};e.prototype.handleCancel=function(){var e;(e=this.exit)===null||e===void 0?void 0:e.emit()};e.prototype.handleSubmit=function(){var e=this;updateTemplate(this.endpoint,this.templateId,{name:this.name,visibility:this.visibility,sender:this.sender,initial_reminder:this.sendReminders?this.initialReminder*MS_PER_DAY:null,followup_reminders:this.sendReminders?this.followupReminders*MS_PER_DAY:null}).then((function(t){var n,i;console.log("[SETTINGS] Template Updated",t);e.dirty=false;e.name=t.name;e.visibility=t.visibility;e.sender=t.sender;e.sendReminders=t.initial_reminder!==null;e.initialReminder=t.initial_reminder?Math.floor(t.initial_reminder/MS_PER_DAY):null;e.followupReminders=t.followup_reminders?Math.floor(t.followup_reminders/MS_PER_DAY):null;(n=e.templateUpdated)===null||n===void 0?void 0:n.emit({endpoint:e.endpoint,template:t,event:"update"});(i=e.next)===null||i===void 0?void 0:i.emit()})).catch((function(t){var n,i,o,r,s;console.log("[SETTINGS] Error updating template",t);(n=e.sdkError)===null||n===void 0?void 0:n.emit(new SDKError(t.message,(i=t.response)===null||i===void 0?void 0:i.status,(o=t.response)===null||o===void 0?void 0:o.data));VerdocsToast(((s=(r=t.response)===null||r===void 0?void 0:r.data)===null||s===void 0?void 0:s.error)||"Error updating template, please try again later.")}))};e.prototype.render=function(){var e=this;if(!this.endpoint.session){return h(Host,null,h("verdocs-component-error",{message:"You must be authenticated to use this module."}))}if(this.loading||!this.template){return h(Host,{class:"loading"},h("verdocs-loader",null))}return h(Host,null,h("form",{onSubmit:function(e){return e.preventDefault()},onClick:function(e){return e.stopPropagation()},autocomplete:"off"},h("h5",null,"Settings"),h("div",{class:"row"},h("verdocs-text-input",{id:"verdocs-field-name",label:"Template Name",value:this.name,autocomplete:"off",placeholder:"Template Name...",onInput:function(t){e.name=t.target.value;e.dirty=true}})),h("div",{class:"row"},h("verdocs-select-input",{label:"Visibility",value:this.visibility,onInput:function(t){e.visibility=t.target.value;e.dirty=true},options:[{value:"private",label:"Private"},{value:"shared",label:"Shared"},{value:"public",label:"Public"}]})),h("div",{class:"row"},h("verdocs-select-input",{label:"Owner for envelopes created from this template",value:this.sender,onInput:function(t){e.sender=t.target.value;e.dirty=true},options:[{value:"envelope_creator",label:"Envelope Creator"},{value:"template_owner",label:"Template Owner"}]})),h("div",{class:"row"},h("label",null,"Send Reminders"),h("verdocs-switch",{checked:this.sendReminders,onCheckedChange:function(t){return e.sendReminders=t.detail}})),this.sendReminders&&h("div",{class:"row"},h("verdocs-text-input",{id:"verdocs-field-name",label:"First Reminder (days)",value:String(this.initialReminder||0),autocomplete:"off",placeholder:"Delay in days...",onInput:function(t){e.initialReminder=+t.target.value;e.dirty=true}})),this.sendReminders&&h("div",{class:"row"},h("verdocs-text-input",{id:"verdocs-field-name",label:"Follow-up Reminders (days)",value:String(this.followupReminders||0),autocomplete:"off",placeholder:"Delay in days...",onInput:function(t){e.followupReminders=+t.target.value;e.dirty=true}})),h("div",{class:"buttons"},h("verdocs-button",{variant:"outline",label:"Cancel",size:"small",onClick:function(){return e.handleCancel()}}),h("verdocs-button",{label:"Save",size:"small",onClick:function(){return e.handleSubmit()},disabled:!this.dirty}))))};Object.defineProperty(e.prototype,"el",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();VerdocsTemplateSettings.style=verdocsTemplateSettingsCss;export{VerdocsPreview as verdocs_preview,VerdocsSend as verdocs_send,VerdocsTemplateAttachments as verdocs_template_attachments,VerdocsTemplateBuildTabs as verdocs_template_build_tabs,VerdocsTemplateFields as verdocs_template_fields,VerdocsTemplateRoles as verdocs_template_roles,VerdocsTemplateSettings as verdocs_template_settings};
|
3
3
|
//# sourceMappingURL=verdocs-preview_7.entry.js.map
|