@verdocs/web-sdk 5.0.30 → 5.0.31
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/cjs/verdocs-preview_6.cjs.entry.js +6 -2
- package/dist/cjs/verdocs-preview_6.cjs.entry.js.map +1 -1
- package/dist/collection/components/embeds/verdocs-send/verdocs-send.js +6 -2
- package/dist/collection/components/embeds/verdocs-send/verdocs-send.js.map +1 -1
- package/dist/components/{p-c4368d04.js → p-87d3651e.js} +7 -3
- package/dist/components/p-87d3651e.js.map +1 -0
- package/dist/components/verdocs-build.js +1 -1
- package/dist/components/verdocs-send.js +1 -1
- package/dist/esm/verdocs-preview_6.entry.js +6 -2
- package/dist/esm/verdocs-preview_6.entry.js.map +1 -1
- package/dist/esm-es5/verdocs-preview_6.entry.js +1 -1
- package/dist/esm-es5/verdocs-preview_6.entry.js.map +1 -1
- package/dist/verdocs-web-sdk/{p-022110a8.system.entry.js → p-33064db4.system.entry.js} +2 -2
- package/dist/verdocs-web-sdk/p-33064db4.system.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/{p-e5470d18.entry.js → p-9e04b9f0.entry.js} +2 -2
- package/dist/verdocs-web-sdk/p-9e04b9f0.entry.js.map +1 -0
- package/dist/verdocs-web-sdk/p-e2b70dfb.system.js +1 -1
- package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
- package/package.json +1 -1
- package/dist/components/p-c4368d04.js.map +0 -1
- package/dist/verdocs-web-sdk/p-022110a8.system.entry.js.map +0 -1
- package/dist/verdocs-web-sdk/p-e5470d18.entry.js.map +0 -1
@@ -1,8 +1,8 @@
|
|
1
|
-
var __assign=this&&this.__assign||function(){__assign=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++){t=arguments[i];for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r))e[r]=t[r]}return e};return __assign.apply(this,arguments)};var __awaiter=this&&this.__awaiter||function(e,t,i,n){function r(e){return e instanceof i?e:new i((function(t){t(e)}))}return new(i||(i=Promise))((function(i,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n["throw"](e))}catch(e){o(e)}}function l(e){e.done?i(e.value):r(e.value).then(s,a)}l((n=n.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var i={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,r,o,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(n)throw new TypeError("Generator is already executing.");while(s&&(s=0,a[0]&&(i=0)),i)try{if(n=1,r&&(o=a[0]&2?r["return"]:a[0]?r["throw"]||((o=r["return"])&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;if(r=0,o)a=[a[0]&2,o.value];switch(a[0]){case 0:case 1:o=a;break;case 4:i.label++;return{value:a[1],done:false};case 5:i.label++;r=a[1];a=[0];continue;case 7:a=i.ops.pop();i.trys.pop();continue;default:if(!(o=i.trys,o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(a[0]===6&&i.label<o[1]){i.label=o[1];o=a;break}if(o&&i.label<o[2]){i.label=o[2];i.ops.push(a);break}if(o[2])i.ops.pop();i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e];r=0}finally{n=o=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,i){if(i||arguments.length===2)for(var n=0,r=t.length,o;n<r;n++){if(o||!(n in t)){if(!o)o=Array.prototype.slice.call(t,0,n);o[n]=t[n]}}return e.concat(o||Array.prototype.slice.call(t))};System.register(["./p-9186f42e.system.js","@verdocs/js-sdk","./p-c8a15cb7.system.js","./p-52c3e8b0.system.js","./p-9b26e4e0.system.js","./p-cd546dbe.system.js","./p-2c5350ec.system.js","./p-70751089.system.js","./p-f29eb00a.system.js","./p-21b1acec.system.js","./p-d738b5db.system.js"],(function(e){"use strict";var t,i,n,r,o,s,a,l,c,u,d,f,h,v,p,m,g,b,x,w,y,_,E,k,S,q,M,C,I,T,L,Z,O,H,z,D,V,N;return{setters:[function(e){t=e.r;i=e.c;n=e.h;r=e.H;o=e.F;s=e.g},function(e){a=e.VerdocsEndpoint;l=e.getTemplate;c=e.integerSequence;u=e.getOrganizationContacts;d=e.isValidEmail;f=e.createEnvelope;h=e.formatFullName;v=e.getRGBA;p=e.createTemplateDocument;m=e.deleteTemplateDocument;g=e.updateField;b=e.createField;x=e.updateTemplateRole;w=e.createTemplateRole},function(e){y=e.S},function(e){_=e.S},function(e){E=e.V},function(e){k=e.D;S=e.P;q=e.J;M=e.a;C=e.F;I=e.b;T=e.T},function(e){L=e.f},function(e){Z=e.i},function(e){O=e.b;H=e.c;z=e.d;D=e.g;V=e.e;N=e.f},function(){},function(){}],execute:function(){var A='@-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 j=A;var R=e("verdocs_preview",function(){function e(e){t(this,e);this.sdkError=i(this,"sdkError",7);this.templateListenerId=null;this.endpoint=a.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();_.subscribe("templates",this.templateId,(function(){return l(e.endpoint,e.templateId)}),false,(function(t){e.template=t;e.loading=false}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){_.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,i;return __generator(this,(function(n){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(n){console.log("[PREVIEW] Error with preview session",n);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new y(n.message,(t=n.response)===null||t===void 0?void 0:t.status,(i=n.response)===null||i===void 0?void 0:i.data))}return[2]}))}))};e.prototype.handlePageRendered=function(e){};e.prototype.render=function(){var e=this;var t;if(this.loading){return n(r,null,n("verdocs-loader",null))}return n(r,null,(((t=this.template)===null||t===void 0?void 0:t.documents)||[]).map((function(t){var i=c(1,t.pages);return n(o,null,i.map((function(i){var r;var o=((r=t.page_sizes)===null||r===void 0?void 0:r[i])||{width:612,height:792};return n("verdocs-template-document-page",{templateId:t.template_id,documentId:t.id,pageNumber:i,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}());R.style=j;var U=function(e){return((e===null||e===void 0?void 0:e.roles)||[]).map((function(e){return e.name}))};var B=function(e,t){return Math.max(U(e).findIndex((function(e){return e===t})),0)};var P='@-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 Q=P;var F='<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 Y='<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 W='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"></path></svg>';var J='<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 G=e("verdocs_send",function(){function e(e){t(this,e);this.beforeSend=i(this,"beforeSend",7);this.send=i(this,"send",7);this.exit=i(this,"exit",7);this.sdkError=i(this,"sdkError",7);this.searchContacts=i(this,"searchContacts",7);this.templateListenerId=null;this.endpoint=a.getDefault();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();_.subscribe("templates",this.templateId,(function(){return l(e.endpoint,e.templateId)}),false,(function(t){e.template=t;e.loading=false;e.rolesCompleted={};e.recomputeRolesCompleted()}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){_.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,i;var n=this;return __generator(this,(function(r){try{this.endpoint.onSessionChanged((function(e,t,i){if(!i){return}var r={id:i.id,first_name:i.first_name,last_name:i.last_name,email:i.email,phone:i.phone};if(i){n.sessionContacts=[r];u(n.endpoint).then((function(e){console.log("[SEND] Got contacts",e);n.sessionContacts=__spreadArray(__spreadArray([],e,true),[r],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(n){console.log("[SEND] Error with send session",n);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new y(n.message,(t=n.response)===null||t===void 0?void 0:t.status,(i=n.response)===null||i===void 0?void 0:i.data))}return[2]}))}))};e.prototype.recomputeRolesCompleted=function(){var e=this;var t;this.rolesCompleted={};var i={};(((t=this.template)===null||t===void 0?void 0:t.roles)||[]).forEach((function(t){var n=t.sequence-1;i[n]||(i[n]=[]);var r="r-".concat(n,"-").concat(i[n].length);i[n].push(__assign(__assign({},t),{id:r,role_name:t.name,first_name:t.first_name,last_name:t.last_name}));if(t.first_name&&d(t.email)){e.rolesCompleted[r]=__assign(__assign({},t),{id:r,role_name:t.name,first_name:t.first_name,last_name:t.last_name})}}))};e.prototype.getLevels=function(){var e;var t={};(((e=this.template)===null||e===void 0?void 0:e.roles)||[]).forEach((function(e){t[e.sequence]=true}));console.log("[SEND] Sequences",t);return Object.keys(t).map((function(e){return+e})).sort((function(e,t){return e-t}))};e.prototype.getRolesAtLevel=function(e){var t;var i=(((t=this.template)===null||t===void 0?void 0:t.roles)||[]).filter((function(t){return t.sequence-1===e})).map((function(t,i){return __assign(__assign({},t),{id:"r-".concat(e,"-").concat(i),role_name:t.name,first_name:t.first_name,last_name:t.last_name})}));return i};e.prototype.getLevelIcon=function(e){var t=this.getLevels();if(e<0){return n("div",{class:"level-icon",innerHTML:Y})}else if(e>=t.length){return n("div",{class:"level-icon",innerHTML:J})}else{return n("div",{class:"level-icon",innerHTML:W})}};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 i;if(this.sending){console.log("[SEND] Skipping duplicate send",e);return}console.log("[SEND] Sending",e);e.preventDefault();e.stopPropagation();this.sending=true;var n={template_id:this.templateId,name:((i=this.template)===null||i===void 0?void 0:i.name)||"New Envelope",environment:this.environment,initial_reminder:0,followup_reminders:0,recipients:Object.values(this.rolesCompleted),fields:[]};var r=this.beforeSend.emit(__assign(__assign({},n),{name:n.name}));if(r.defaultPrevented){console.log("[SEND] Send cancelled by parent",n);this.sending=false;return}console.log("[SEND] Creating envelope",n);f(this.endpoint,n).then((function(e){var i;console.log("[SEND] Send envelope",e);t.reset().catch((function(e){return console.log("Unknown Error",e)}));t.sending=false;(i=t.send)===null||i===void 0?void 0:i.emit(__assign(__assign({},n),{name:n.name,envelope_id:e.id,envelope:e}))})).catch((function(e){var i,n,r;console.log("[SEND] Send error",e);E(((n=(i=e.response)===null||i===void 0?void 0:i.data)===null||n===void 0?void 0:n.error)||"Error creating envelope, please try again later.");t.sending=false;(r=t.sdkError)===null||r===void 0?void 0:r.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 n(r,null,n("verdocs-loader",null))}if(!this.endpoint.session){return n(r,{style:{display:"flex"}},n("verdocs-component-error",{message:"You must be authenticated to use this module."}))}var i=this.getLevels();var o=Object.values(this.rolesCompleted).filter((function(e){return d(e.email)&&e.first_name&&e.last_name}));var s=o.length>=U(this.template).length;return n(r,{class:{sendable:(t=this.template)===null||t===void 0?void 0:t.is_sendable}},n("div",{class:"recipients"},n("div",{class:"left-line"}),n("div",{class:"level level-start"},this.getLevelIcon(-1),n("div",{class:"complete"},"Send Envelope")),i.map((function(t){return n("div",{class:"level level-".concat(t)},e.getLevelIcon(t),e.getRolesAtLevel(t).map((function(t){var i,r,s;var a=!t.email||!t.first_name||!t.last_name;var l=((i=e.rolesCompleted[t.id])===null||i===void 0?void 0:i.first_name)?h(e.rolesCompleted[t.id]):a?t.role_name:h(t);var c="verdocs-send-recipient-".concat(t.role_name);var u=B(e.template,t.role_name);var d=v(u);var f=o.findIndex((function(e){return e.role_name===t.role_name}))>-1;var p={backgroundColor:d,border:f?"2px solid #55bc81":"2px solid #dddddd"};return a?n("div",{class:"recipient","data-ri":u,"data-rn":t.role_name,style:p,onClick:function(i){return e.handleClickRole(i,t)},id:c},l,n("div",{class:"icon",innerHTML:F}),e.showPickerForId===t.id&&n("verdocs-portal",{anchor:c,onClickAway:function(){return e.showPickerForId=""}},n("verdocs-contact-picker",{onExit:function(){return e.showPickerForId=""},onNext:function(i){return e.handleSelectContact(i,t)},contactSuggestions:e.sessionContacts,templateRole:(r=e.rolesCompleted[t.id])!==null&&r!==void 0?r:t,onSearchContacts:function(t){var i;return(i=e.searchContacts)===null||i===void 0?void 0:i.emit(t.detail)}}))):n("div",{class:"recipient","data-ri":u,"data-rn":t.role_name,style:p,onClick:function(i){return e.handleClickRole(i,t)},id:c},l,n("div",{class:"icon",innerHTML:F}),e.showPickerForId===t.id&&n("verdocs-portal",{anchor:c,onClickAway:function(){return e.showPickerForId=""}},n("verdocs-contact-picker",{onExit:function(){return e.showPickerForId=""},onNext:function(i){return e.handleSelectContact(i,t)},contactSuggestions:e.sessionContacts,templateRole:(s=e.rolesCompleted[t.id])!==null&&s!==void 0?s:t,onSearchContacts:function(t){var i;return(i=e.searchContacts)===null||i===void 0?void 0:i.emit(t.detail)}})))})))})),n("div",{class:"level level-done"},this.getLevelIcon(i.length),n("div",{class:"complete"},"Signing Complete"))),n("div",{class:"buttons"},n("verdocs-button",{label:"Cancel",size:"small",variant:"outline",onClick:function(t){return e.handleCancel(t)},disabled:this.sending}),n("verdocs-button",{label:"Send",size:"small",disabled:!s||this.sending,onClick:function(t){return e.handleSend(t)}}),this.sending&&n("verdocs-spinner",null)))};Object.defineProperty(e,"watchers",{get:function(){return{templateId:["onTemplateIdChanged"]}},enumerable:false,configurable:true});return e}());G.style=Q;var X='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-attachments{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-template-attachments h5{font-size:16px;font-weight:bold;margin:0 0 10px 0;color:#46497d}verdocs-template-attachments .attachments{margin:0 0 40px 0}verdocs-template-attachments .attachment{display:-ms-flexbox;display:flex;padding:5px 0;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;color:#33364b}verdocs-template-attachments .attachment:hover .trash-icon{display:-ms-flexbox;display:flex}verdocs-template-attachments .attachment:hover .pages{display:none}verdocs-template-attachments svg{width:28px;height:28px;fill:#5c6575;margin:2px 0 0 0}verdocs-template-attachments .file-icon{-ms-flex:0;flex:0}verdocs-template-attachments .pages{width:24px;height:24px;-ms-flex:0 0 24px;flex:0 0 24px;padding-left:4px;position:relative;margin:-10px 0 0 0}verdocs-template-attachments .pages .pages-icon{top:0;left:0;width:24px;height:24px;position:absolute}verdocs-template-attachments .pages .count{top:11px;left:7px;z-index:1;width:18px;font-size:12px;font-weight:500;position:absolute;text-align:center;letter-spacing:-2px}verdocs-template-attachments .filename{-ms-flex:1;flex:1;display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;border-bottom:1px dotted #cccccc}verdocs-template-attachments .trash-icon{-ms-flex:0;flex:0;display:none}verdocs-template-attachments .trash-icon:hover{cursor:pointer}verdocs-template-attachments verdocs-file-chooser{margin:10px 0;border:2px dashed #979797}verdocs-template-attachments .loader-wrapper{background-color:#ffffff;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;position:relative;width:320px;height:320px;text-align:center;border:2px dashed #979797;-ms-flex-pack:end;justify-content:flex-end}verdocs-template-attachments .progress-wrapper{padding:20px}verdocs-template-attachments .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;margin-top:16px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:end;justify-content:flex-end}verdocs-template-attachments .buttons .flex-fill{-ms-flex:1;flex:1}verdocs-template-attachments ::-webkit-input-placeholder{color:#aaaaaa}verdocs-template-attachments ::-moz-placeholder{color:#aaaaaa}verdocs-template-attachments :-ms-input-placeholder{color:#aaaaaa}verdocs-template-attachments ::-ms-input-placeholder{color:#aaaaaa}verdocs-template-attachments ::placeholder{color:#aaaaaa}';var K=X;var $=e("verdocs_template_attachments",function(){function e(e){t(this,e);this.exit=i(this,"exit",7);this.next=i(this,"next",7);this.templateUpdated=i(this,"templateUpdated",7);this.sdkError=i(this,"sdkError",7);this.templateListenerId=null;this.endpoint=a.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,i;return __generator(this,(function(n){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(n){console.log("[TEMPLATE ATTACHMENTS] Error loading template",n);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new y(n.message,(t=n.response)===null||t===void 0?void 0:t.status,(i=n.response)===null||i===void 0?void 0:i.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();_.subscribe("templates",this.templateId,(function(){return l(e.endpoint,e.templateId)}),false,(function(t){e.template=t;e.loading=false}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){_.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,i,n,r,o,s,a,l;return __generator(this,(function(c){switch(c.label){case 0:e.stopPropagation();o=e.detail.file;if(!o){return[2]}console.log("[ATTACHMENTS] Uploading...",o);this.uploading=true;this.progressLabel="Uploading...";c.label=1;case 1:c.trys.push([1,4,,5]);return[4,p(this.endpoint,this.templateId,o,this.handleUploadProgress.bind(this))];case 2:s=c.sent();console.log("[ATTACHMENTS] Created attachment",s);a=this;return[4,_.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);(i=this.sdkError)===null||i===void 0?void 0:i.emit(new y(l.message,(n=l.response)===null||n===void 0?void 0:n.status,(r=l.response)===null||r===void 0?void 0:r.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,m(this.endpoint,this.templateId,this.confirmDeleteDocument.id)];case 1:t.sent();e=this;return[4,_.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(i){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 M;case"image/jpeg":return q;case"image/png":return S;case"application/msword":case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return k}return C};e.prototype.render=function(){var e=this;var t,i;if(!this.endpoint.session){return n(r,null,n("verdocs-component-error",{message:"You must be authenticated to use this module."}))}if(this.loading){return n(r,{class:"loading"},n("verdocs-loader",null))}if(!this.endpoint.session||!this.template){return n(r,{class:"empty"})}return n(r,null,n("h5",null,"Existing Attachments"),n("div",{class:"attachments"},(((t=this.template)===null||t===void 0?void 0:t.documents)||[]).map((function(t){return n("div",{class:"attachment"},n("div",{class:"file-icon",innerHTML:e.getFileIcon(t)}),n("div",{class:"filename",title:t.name},t.name),n("div",{class:"pages"},n("div",{class:"count"},t.pages),n("div",{class:"pages-icon",innerHTML:I})),n("div",{class:"trash-icon",innerHTML:T,onClick:function(){return e.handleDelete(t)}}))}))),n("h5",null,"Attach a New Document"),this.uploading?n("div",{class:"loader-wrapper"},n("verdocs-loader",null),this.progressLabel&&n("div",{class:"progress-wrapper"},n("verdocs-progress-bar",{showPercent:true,percent:this.progressPercent,label:this.progressLabel}))):n("verdocs-file-chooser",{onFileSelected:function(t){return e.handleUpload(t)}}),n("div",{class:"buttons"},n("verdocs-button",{variant:"outline",label:"Cancel",size:"small",onClick:function(t){return e.handleCancel(t)},disabled:this.uploading}),n("verdocs-button",{label:"Next",size:"small",onClick:function(t){return e.handleNext(t)},disabled:!(((i=this.template)===null||i===void 0?void 0:i.documents)||[]).length||this.uploading})),this.showDeleteError&&n("verdocs-ok-dialog",{heading:"Unable to Delete Attachment",message:"Templates must contain at least one attachment.",onNext:function(){return e.showDeleteError=false}}),this.confirmDeleteDocument&&n("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}());$.style=K;var ee='@-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 te=ee;var ie='<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 ne='<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 re=["attachments","roles","settings","fields","preview"];var oe=e("verdocs_template_build_tabs",function(){function e(e){t(this,e);this.sdkError=i(this,"sdkError",7);this.stepChanged=i(this,"stepChanged",7);this.templateListenerId=null;this.endpoint=a.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();_.subscribe("templates",this.templateId,(function(){return l(e.endpoint,e.templateId)}),false,(function(t){e.template=t;e.loading=false}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){_.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,i;return __generator(this,(function(n){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(n){console.log("[BUILD_TABS] Error loading template",n);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new y(n.message,(t=n.response)===null||t===void 0?void 0:t.status,(i=n.response)===null||i===void 0?void 0:i.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(){E("Template ID copied",{style:"success",duration:3e3})})).catch((function(t){var i;console.warn("[BUILD_TABS] Error copying to clipboard",t);(i=e.sdkError)===null||i===void 0?void 0:i.emit(t)}))};e.prototype.render=function(){var e=this;var t,i,o,s,a,l,c,u,d;if(this.loading){return n(r,null,n("verdocs-loader",null))}if(!this.endpoint.session){return n(r,null,n("verdocs-component-error",{message:"You must be authenticated to use this module."}))}var f=(((t=this.template)===null||t===void 0?void 0:t.documents)||[]).length>0;var h=f&&(((i=this.template)===null||i===void 0?void 0:i.roles)||[]).length>0;var v=h&&(((o=this.template)===null||o===void 0?void 0:o.fields)||[]).length>0;var p=Math.max(re.indexOf(this.step),0);if(!v&&p>=4){p=3}if(!h&&p>=3){p=1}if(!f&&p>=1){p=0}return n(r,null,n("verdocs-tabs",{onSelectTab:function(t){return e.setStep(t)},selectedTab:p,tabs:[{id:"attachments",disabled:false,label:"Attachment(s)"},{id:"roles",disabled:!f,label:"Roles"},{id:"settings",disabled:!h,label:"Settings"},{id:"fields",disabled:!h,label:"Fields"},{id:"preview",disabled:!v,label:"Preview/Send"}]}),this.templateId&&n("div",{class:"info"},n("verdocs-button-panel",{icon:ie},n("div",{class:"template-details-panel"},n("h6",null,"Template Details"),n("div",{class:"row"},n("label",null,"ID:"),n("div",{class:"value"},this.templateId),n("div",{class:"icon-button",innerHTML:ne,onClick:function(){return e.copyTemplateId()}})),n("div",{class:"row"},n("label",null,"Name:"),n("div",{class:"value"},(s=this.template)===null||s===void 0?void 0:s.name)),n("div",{class:"row"},n("label",null,"Visibility:"),n("div",{class:"value"},((a=this.template)===null||a===void 0?void 0:a.is_public)?"Public":((l=this.template)===null||l===void 0?void 0:l.is_personal)?"Private":"Shared")),n("div",{class:"row"},n("label",null,"Created:"),n("div",{class:"value"},((c=this.template)===null||c===void 0?void 0:c.counter)?L(new Date((u=this.template)===null||u===void 0?void 0:u.created_at),"P p"):"")),n("div",{class:"row"},n("label",null,"Used:"),n("div",{class:"value"},(d=this.template)===null||d===void 0?void 0:d.counter," time(s)"))))))};Object.defineProperty(e,"watchers",{get:function(){return{templateId:["onTemplateIdChanged"],step:["onStepChanged"]}},enumerable:false,configurable:true});return e}());oe.style=te;var se="@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-fields{font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif;position:relative;display:block;min-height:600px}verdocs-template-fields .page-0{padding:65px 15px 0 15px;-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-fields .page-0 .user-placed-fields{height:100px;position:relative;background:#ffffff;-webkit-box-shadow:0 0 10px 5px rgba(0, 0, 0, 0.0588235294);box-shadow:0 0 10px 5px rgba(0, 0, 0, 0.0588235294)}verdocs-template-fields .page-0 .user-placed-fields .title{top:0;left:0;color:#ffffff;font-size:12px;padding:3px 6px;font-weight:bold;position:absolute;background:#46497d}verdocs-template-fields .pages{display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;min-height:200px;position:relative;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-template-fields .pages div,verdocs-template-fields .pages canvas{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-fields #verdocs-template-fields-toolbar{width:100%;height:50px;display:-ms-flexbox;display:flex;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;font-weight:700;padding:0 20px 0 0;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;color:#f5f5fa;-ms-flex-pack:center;justify-content:center;background:#46497d}verdocs-template-fields #verdocs-template-fields-toolbar>verdocs-select-input{margin:0}verdocs-template-fields #verdocs-template-fields-toolbar svg{width:24px;height:24px}verdocs-template-fields #verdocs-template-fields-toolbar .add-for{margin:0;font-weight:500;color:#f5f5fa}verdocs-template-fields #verdocs-template-fields-toolbar verdocs-select-input{margin:0 20px 0 0}@media all and (max-width: 1000px){verdocs-template-fields #verdocs-template-fields-toolbar{-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;padding:0 10px 0 0}verdocs-template-fields #verdocs-template-fields-toolbar svg{-webkit-transform:scale(0.8);transform:scale(0.8)}verdocs-template-fields #verdocs-template-fields-toolbar .add-for,verdocs-template-fields #verdocs-template-fields-toolbar verdocs-select-input{display:none}}@media all and (max-width: 600px){verdocs-template-fields #verdocs-template-fields-toolbar{-webkit-column-gap:6px;-moz-column-gap:6px;column-gap:6px}verdocs-template-fields #verdocs-template-fields-toolbar svg{-webkit-transform:scale(0.6);transform:scale(0.6)}verdocs-template-fields #verdocs-template-fields-toolbar .separator,verdocs-template-fields #verdocs-template-fields-toolbar .add-for,verdocs-template-fields #verdocs-template-fields-toolbar verdocs-select-input{display:none}}verdocs-template-fields.placing-attachment{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-checkbox{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-date{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath fill='%23000000' d='M7.6 13.925q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375ZM5.3 22.85q-1.325 0-2.238-.912-.912-.913-.912-2.238V6.3q0-1.325.912-2.238.913-.912 2.238-.912H6v-2h2.575v2h6.85v-2H18v2h.7q1.325 0 2.238.912.912.913.912 2.238v13.4q0 1.325-.912 2.238-.913.912-2.238.912Zm0-3.15h13.4V10H5.3v9.7ZM5.3 8h13.4V6.3H5.3Zm0 0V6.3 8Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-dropdown{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24' stroke-width='1.5' stroke='currentColor'%3E%3Cpath stroke='%23000000' stroke-linecap='round' stroke-linejoin='round' d='M3 4.5h14.25M3 9h9.75M3 13.5h9.75m4.5-4.5v12m0 0l-3.75-3.75M17.25 21L21 17.25' /%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-initial{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M6.225 20.775V7h-5V3.225H15V7h-5v13.775Zm9.775 0v-8h-3V9h9.775v3.775h-3v8Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-payment{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-radio{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M12 17q2.075 0 3.538-1.463Q17 14.075 17 12t-1.462-3.538Q14.075 7 12 7 9.925 7 8.463 8.462 7 9.925 7 12q0 2.075 1.463 3.537Q9.925 17 12 17Zm0 5.85q-2.275 0-4.25-.85t-3.438-2.312Q2.85 18.225 2 16.25q-.85-1.975-.85-4.25T2 7.75q.85-1.975 2.312-3.438Q5.775 2.85 7.75 2q1.975-.85 4.25-.85t4.25.85q1.975.85 3.438 2.312Q21.15 5.775 22 7.75q.85 1.975.85 4.25T22 16.25q-.85 1.975-2.312 3.438Q18.225 21.15 16.25 22q-1.975.85-4.25.85Zm0-3.15q3.25 0 5.475-2.225Q19.7 15.25 19.7 12q0-3.25-2.225-5.475Q15.25 4.3 12 4.3q-3.25 0-5.475 2.225Q4.3 8.75 4.3 12q0 3.25 2.225 5.475Q8.75 19.7 12 19.7Zm0-7.7Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-signature{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m9.225 21.225 4.65-4.65h8.45v4.65Zm-5.35-2.2H5.05l8.5-8.5-1.175-1.175-8.5 8.5Zm14.25-9.95L13.8 4.8l1.325-1.325q.625-.65 1.525-.663.9-.012 1.6.663l1.225 1.175q.675.675.663 1.562-.013.888-.663 1.513ZM16.7 10.55 6 21.225H1.675V16.9L12.35 6.225Zm-3.725-.625-.6-.575 1.175 1.175Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-textarea{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M3.225 20.725v-3.15h11.55v3.15Zm0-4.775V12.8h17.55v3.15Zm0-4.75V8.05h17.55v3.15Zm0-4.775v-3.15h17.55v3.15Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-textbox{cursor:url(\"data:image/svg+xml,%3Csvg width='32' height='15' viewBox='0 0 32 15' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cmask id='path-1-inside-1_1401_24' fill='white'%3E%3Cpath d='M0 0H32V15H0V0Z'/%3E%3C/mask%3E%3Cpath d='M0 0H32V15H0V0Z' fill='%234C56CB' fill-opacity='0.1'/%3E%3Cpath d='M0 0V-1H-1V0H0ZM0 15H-1V16H0V15ZM0 1H32V-1H0V1ZM32 14H0V16H32V14ZM1 15V0H-1V15H1Z' fill='%234C56CB' mask='url(%23path-1-inside-1_1401_24)'/%3E%3Cpath d='M3 11.8V8.65H14.15V11.8H3ZM3 6.65V3.5H20.15V6.65H3Z' fill='%234C56CB'/%3E%3Cline x1='31.5' y1='1' x2='31.5' y2='14' stroke='%234C56CB' stroke-opacity='0.32' stroke-dasharray='1 1'/%3E%3C/svg%3E%0A\") 0 14, pointer}verdocs-template-fields.placing-timestamp{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath fill='%23000000' d='M9 1h6v2H9zm10.03 6.39 1.42-1.42c-.43-.51-.9-.99-1.41-1.41l-1.42 1.42C16.07 4.74 14.12 4 12 4c-4.97 0-9 4.03-9 9s4.02 9 9 9 9-4.03 9-9c0-2.12-.74-4.07-1.97-5.61zM13 14h-2V8h2v6z'%3E%3C/path%3E%3C/svg%3E\") 16 16, pointer}";var ae=se;var le='<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 ce='<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 ue='<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 de='<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 fe='<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 he='<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 ve='<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 pe='<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 me='<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 ge='<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 be=[{id:"signature",tooltip:"Signature",icon:fe,class:"signature"},{id:"initial",tooltip:"Initials",icon:he,class:"initial"},{id:"sep1",tooltip:"",icon:ge,class:"separator"},{id:"textbox",tooltip:"Text Box",icon:le,class:"textbox"},{id:"checkbox",tooltip:"Check Box",icon:ce,class:"checkbox"},{id:"radio",tooltip:"Radio Button",icon:ue,class:"radio"},{id:"dropdown",tooltip:"Dropdown",icon:pe,class:"dropdown"},{id:"sep2",tooltip:"",icon:ge,class:"separator"},{id:"date",tooltip:"Date",icon:de,class:"date"},{id:"timestamp",tooltip:"Timestamp",icon:ve,class:"timestamp"},{id:"attachment",tooltip:"Attachment",icon:me,class:"attachment"}];var xe=e("verdocs_template_fields",function(){function e(e){t(this,e);this.sdkError=i(this,"sdkError",7);this.templateUpdated=i(this,"templateUpdated",7);this.fieldsUpdated=i(this,"fieldsUpdated",7);this.templateListenerId=null;this.pageHeights={};this.cachedPageInfo={};this.endpoint=a.getDefault();this.templateId=null;this.toolbarTargetId=null;this.placing=null;this.showMustSelectRole=false;this.selectedRoleName="";this.loading=true;this.template=null}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,i;return __generator(this,(function(n){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(n){console.log("[FIELDS] Error with fields session",n);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new y(n.message,(t=n.response)===null||t===void 0?void 0:t.status,(i=n.response)===null||i===void 0?void 0:i.data))}return[2]}))}))};e.prototype.componentDidRender=function(){Z.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,i;var n=((t=this.template)===null||t===void 0?void 0:t.roles)||[];if(!this.selectedRoleName||!n.find((function(t){return t&&t.name===e.selectedRoleName}))){this.selectedRoleName=((i=n[0])===null||i===void 0?void 0:i.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();_.subscribe("templates",this.templateId,(function(){return l(e.endpoint,e.templateId)}),false,(function(t){var i,n;e.template=t;e.loading=false;if(!e.selectedRoleName){e.selectedRoleName=((n=(i=t.roles)===null||i===void 0?void 0:i[0])===null||n===void 0?void 0:n.name)||""}}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){_.store.delListener(this.templateListenerId);this.templateListenerId=null}};e.prototype.attachFieldAttributes=function(e,t,i){var n=this;i.addEventListener("settingsChanged",(function(){var e;(e=n.templateUpdated)===null||e===void 0?void 0:e.emit({endpoint:n.endpoint,template:n.template,event:"added-field"})}));i.addEventListener("deleted",(function(){var e;i.remove();(e=n.templateUpdated)===null||e===void 0?void 0:e.emit({endpoint:n.endpoint,template:n.template,event:"updated-field"})}));i.setAttribute("templateid",this.templateId);i.setAttribute("fieldname",t.name);i.setAttribute("pageNumber",String(e.pageNumber));i.setAttribute("xScale",String(e.xScale));i.setAttribute("yScale",String(e.yScale));i.setAttribute("name",t.name)};e.prototype.handlePageRendered=function(e){var t=this;var i;var n=e.detail;this.cachedPageInfo[n.pageNumber]=n;this.pageHeights[n.pageNumber]=n.naturalHeight;(((i=this.template)===null||i===void 0?void 0:i.fields)||[]).filter((function(e){return e&&e.page===n.pageNumber})).forEach((function(e){var i=D(e);var n=document.getElementById(i);if(n){n.setAttribute("fieldname",e.name);n.setAttribute("pagenumber",String(e.page));t.makeDraggable(n)}}))};e.prototype.makeDraggable=function(e){Z(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,i,n,r,o,s;return __generator(this,(function(a){t=+(e.target.getAttribute("posX")||0);i=+(e.target.getAttribute("posY")||0);n=+(e.target.getAttribute("xScale")||1);r=+(e.target.getAttribute("yScale")||1);o=e.dx/n+t;s=e.dy/r+i;e.target.setAttribute("posX",o);e.target.setAttribute("posy",s);O(e.target,"translate","".concat(o,"px, ").concat(s,"px"));return[2]}))}))};e.prototype.handleMoveEnd=function(e){return __awaiter(this,void 0,void 0,(function(){var t,i,n,r,o,s,a,l,c,u,d,f,h,v,p,m,b,x,w,k,S,q,M,C,I,T,L,Z,O,D,A,j,R,U,B,P,Q,F,Y;return __generator(this,(function(W){switch(W.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");f=this.cachedPageInfo[d],h=f.naturalWidth,v=h===void 0?612:h,p=f.naturalHeight,m=p===void 0?792:p,b=f.renderedHeight,x=b===void 0?792:b;w=e.target.getBoundingClientRect();k=e.target.parentElement;S=k.getBoundingClientRect();q=u.width||V(u.type);M=u.height||N(u.type);C=Math.max(w.left-S.left,0);I=Math.max(x-(S.bottom-w.bottom),0);T=parseInt(d);if(I>x){T=Math.min(T+1,((r=(n=((i=this.template)===null||i===void 0?void 0:i.documents)||[])===null||n===void 0?void 0:n[0])===null||r===void 0?void 0:r.pages)||1);I-=x;x=this.cachedPageInfo[T].renderedHeight;console.log("Next page",{newPageNumber:T,newY:I,renderedHeight:x})}else if(I<0){T=Math.max(T-1,1);x=this.cachedPageInfo[T].renderedHeight;I+=x;console.log("[FIELDS] Next page",{newPageNumber:T,newY:I,renderedHeight:x})}L=this.viewCoordinatesToPageCoordinates(C,I,d,v-q,m-M),Z=L.x,O=L.y;W.label=1;case 1:W.trys.push([1,3,,4]);D={x:Z,y:O,page:T};return[4,g(this.endpoint,this.templateId,c,D)];case 2:A=W.sent();console.log("[FIELDS] Updated",A);j=JSON.parse(JSON.stringify(this.template));R=j.fields.findIndex((function(e){return e.name===c}));if(R>-1){j.fields[R]=A}_.updateTemplate(this.templateId,j);e.target.removeAttribute("posX");e.target.removeAttribute("posY");H(e.target);U=this.cachedPageInfo[d],B=U.xScale,P=B===void 0?1:B,Q=U.yScale,F=Q===void 0?1:Q;z(e.target,A,P,F);(o=this.templateUpdated)===null||o===void 0?void 0:o.emit({endpoint:this.endpoint,template:j,event:"updated-field"});return[3,4];case 3:Y=W.sent();E("Error updating field, please try again later",{style:"error"});console.log("[FIELDS] Error updating field",Y);(s=this.sdkError)===null||s===void 0?void 0:s.emit(new y(Y.message,(a=Y.response)===null||a===void 0?void 0:a.status,(l=Y.response)===null||l===void 0?void 0:l.data));e.target.removeAttribute("posX");e.target.removeAttribute("posY");H(e.target);return[3,4];case 4:return[2]}}))}))};e.prototype.generateFieldName=function(e,t){var i;var n=1;var r;do{r="".concat(e,"P").concat(t,"-").concat(n);n++}while((((i=this.template)===null||i===void 0?void 0:i.fields)||[]).some((function(e){return e&&e.name===r})));return r};e.prototype.viewCoordinatesToPageCoordinates=function(e,t,i,n,r){var o=this.cachedPageInfo[i],s=o.xScale,a=s===void 0?1:s,l=o.yScale,c=l===void 0?1:l,u=o.renderedHeight,d=u===void 0?792:u;var f=Math.floor(Math.min(e/a,n));var h=Math.floor(Math.min(Math.max(d-t,0)/c,r));return{x:f,y:h}};e.prototype.handleClickPage=function(e,t){return __awaiter(this,void 0,void 0,(function(){var i,n,r,o,s,a,l,c,u,d,f,h,v,p,m,g;return __generator(this,(function(x){switch(x.label){case 0:if(!this.placing)return[3,2];n=e.offsetX;r=e.offsetY;o=V(this.placing);s=N(this.placing);a=this.cachedPageInfo[t];l=a.naturalWidth,c=l===void 0?612:l,u=a.naturalHeight,d=u===void 0?792:u;f=this.viewCoordinatesToPageCoordinates(n,r,t,c-o,d-s);h=Math.floor(f.x);v=Math.floor(f.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:h,y:v,width:o,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,b(this.endpoint,this.templateId,p)];case 1:m=x.sent();console.log("[FIELDS] Saved field",m);g=JSON.parse(JSON.stringify(this.template));g.fields.push(m);_.updateTemplate(this.templateId,g);(i=this.templateUpdated)===null||i===void 0?void 0:i.emit({endpoint:this.endpoint,template:g,event:"added-field"});this.placing=null;x.label=2;case 2:return[2]}}))}))};e.prototype.render=function(){var e;var t=this;var i,o,s;if(this.loading){return n(r,null,n("verdocs-loader",null))}if(!this.endpoint.session){return n(r,null,n("verdocs-component-error",{message:"You must be authenticated to use this module."}))}var a=(((i=this.template)===null||i===void 0?void 0:i.roles)||[]).map((function(e){return{value:e.name,label:e.full_name?"".concat(e.name,": ").concat(e.full_name):e.name}}));return n(r,{class:this.placing?(e={},e["placing-".concat(this.placing)]=true,e):{},onSubmit:function(){}},n("div",{id:"verdocs-template-fields-toolbar"},n("div",{class:"add-for"},"Add field:"),n("verdocs-select-input",{value:this.selectedRoleName,options:a,onInput:function(e){return t.selectedRoleName=e.target.value}}),be.map((function(e){return n("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}}}})}))),n("div",{class:"pages"},(((o=this.template)===null||o===void 0?void 0:o.documents)||[]).map((function(e){var i=c(1,e.pages);return i.map((function(i){var r=e.page_sizes[i];return n("verdocs-template-document-page",{templateId:t.templateId,documentId:e.id,pageNumber:i,virtualWidth:(r===null||r===void 0?void 0:r.width)||612,virtualHeight:(r===null||r===void 0?void 0:r.height)||792,disabled:true,editable:true,done:false,onClick:function(e){return t.handleClickPage(e,i)},onPageRendered:function(e){return t.handlePageRendered(e)},layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]})}))}))),this.showMustSelectRole&&n("verdocs-ok-dialog",{heading:"Unable to add field",message:(((s=this.template)===null||s===void 0?void 0:s.roles)||[]).length>0?"Please select a role before adding fields.":"Please add at least one role before adding fields.",onNext:function(){return t.showMustSelectRole=false}}))};Object.defineProperty(e,"watchers",{get:function(){return{templateId:["onTemplateIdChanged"]}},enumerable:false,configurable:true});return e}());xe.style=ae;
|
1
|
+
var __assign=this&&this.__assign||function(){__assign=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++){t=arguments[i];for(var r in t)if(Object.prototype.hasOwnProperty.call(t,r))e[r]=t[r]}return e};return __assign.apply(this,arguments)};var __awaiter=this&&this.__awaiter||function(e,t,i,n){function r(e){return e instanceof i?e:new i((function(t){t(e)}))}return new(i||(i=Promise))((function(i,o){function s(e){try{l(n.next(e))}catch(e){o(e)}}function a(e){try{l(n["throw"](e))}catch(e){o(e)}}function l(e){e.done?i(e.value):r(e.value).then(s,a)}l((n=n.apply(e,t||[])).next())}))};var __generator=this&&this.__generator||function(e,t){var i={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},n,r,o,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(n)throw new TypeError("Generator is already executing.");while(s&&(s=0,a[0]&&(i=0)),i)try{if(n=1,r&&(o=a[0]&2?r["return"]:a[0]?r["throw"]||((o=r["return"])&&o.call(r),0):r.next)&&!(o=o.call(r,a[1])).done)return o;if(r=0,o)a=[a[0]&2,o.value];switch(a[0]){case 0:case 1:o=a;break;case 4:i.label++;return{value:a[1],done:false};case 5:i.label++;r=a[1];a=[0];continue;case 7:a=i.ops.pop();i.trys.pop();continue;default:if(!(o=i.trys,o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){i=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){i.label=a[1];break}if(a[0]===6&&i.label<o[1]){i.label=o[1];o=a;break}if(o&&i.label<o[2]){i.label=o[2];i.ops.push(a);break}if(o[2])i.ops.pop();i.trys.pop();continue}a=t.call(e,i)}catch(e){a=[6,e];r=0}finally{n=o=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,i){if(i||arguments.length===2)for(var n=0,r=t.length,o;n<r;n++){if(o||!(n in t)){if(!o)o=Array.prototype.slice.call(t,0,n);o[n]=t[n]}}return e.concat(o||Array.prototype.slice.call(t))};System.register(["./p-9186f42e.system.js","@verdocs/js-sdk","./p-c8a15cb7.system.js","./p-52c3e8b0.system.js","./p-9b26e4e0.system.js","./p-cd546dbe.system.js","./p-2c5350ec.system.js","./p-70751089.system.js","./p-f29eb00a.system.js","./p-21b1acec.system.js","./p-d738b5db.system.js"],(function(e){"use strict";var t,i,n,r,o,s,a,l,c,u,d,f,h,v,p,m,g,b,x,w,y,_,E,k,S,q,M,C,I,T,L,Z,O,H,z,D,V,N;return{setters:[function(e){t=e.r;i=e.c;n=e.h;r=e.H;o=e.F;s=e.g},function(e){a=e.VerdocsEndpoint;l=e.getTemplate;c=e.integerSequence;u=e.getOrganizationContacts;d=e.isValidEmail;f=e.createEnvelope;h=e.formatFullName;v=e.getRGBA;p=e.createTemplateDocument;m=e.deleteTemplateDocument;g=e.updateField;b=e.createField;x=e.updateTemplateRole;w=e.createTemplateRole},function(e){y=e.S},function(e){_=e.S},function(e){E=e.V},function(e){k=e.D;S=e.P;q=e.J;M=e.a;C=e.F;I=e.b;T=e.T},function(e){L=e.f},function(e){Z=e.i},function(e){O=e.b;H=e.c;z=e.d;D=e.g;V=e.e;N=e.f},function(){},function(){}],execute:function(){var A='@-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 j=A;var R=e("verdocs_preview",function(){function e(e){t(this,e);this.sdkError=i(this,"sdkError",7);this.templateListenerId=null;this.endpoint=a.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();_.subscribe("templates",this.templateId,(function(){return l(e.endpoint,e.templateId)}),false,(function(t){e.template=t;e.loading=false}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){_.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,i;return __generator(this,(function(n){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(n){console.log("[PREVIEW] Error with preview session",n);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new y(n.message,(t=n.response)===null||t===void 0?void 0:t.status,(i=n.response)===null||i===void 0?void 0:i.data))}return[2]}))}))};e.prototype.handlePageRendered=function(e){};e.prototype.render=function(){var e=this;var t;if(this.loading){return n(r,null,n("verdocs-loader",null))}return n(r,null,(((t=this.template)===null||t===void 0?void 0:t.documents)||[]).map((function(t){var i=c(1,t.pages);return n(o,null,i.map((function(i){var r;var o=((r=t.page_sizes)===null||r===void 0?void 0:r[i])||{width:612,height:792};return n("verdocs-template-document-page",{templateId:t.template_id,documentId:t.id,pageNumber:i,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}());R.style=j;var U=function(e){return((e===null||e===void 0?void 0:e.roles)||[]).map((function(e){return e.name}))};var B=function(e,t){return Math.max(U(e).findIndex((function(e){return e===t})),0)};var P='@-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 Q=P;var F='<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 Y='<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 W='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" tabindex="-1"><path d="M12 2C8.13 2 5 5.13 5 9c0 5.25 7 13 7 13s7-7.75 7-13c0-3.87-3.13-7-7-7zm0 9.5c-1.38 0-2.5-1.12-2.5-2.5s1.12-2.5 2.5-2.5 2.5 1.12 2.5 2.5-1.12 2.5-2.5 2.5z"></path></svg>';var J='<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 G=e("verdocs_send",function(){function e(e){t(this,e);this.beforeSend=i(this,"beforeSend",7);this.send=i(this,"send",7);this.exit=i(this,"exit",7);this.sdkError=i(this,"sdkError",7);this.searchContacts=i(this,"searchContacts",7);this.templateListenerId=null;this.endpoint=a.getDefault();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();_.subscribe("templates",this.templateId,(function(){return l(e.endpoint,e.templateId)}),false,(function(t){e.template=t;e.loading=false;e.rolesCompleted={};e.recomputeRolesCompleted()}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){_.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,i;var n=this;return __generator(this,(function(r){try{this.endpoint.onSessionChanged((function(e,t,i){if(!i){return}var r={id:i.id,first_name:i.first_name,last_name:i.last_name,email:i.email,phone:i.phone};if(i){n.sessionContacts=[r];u(n.endpoint).then((function(e){console.log("[SEND] Got contacts",e);n.sessionContacts=__spreadArray(__spreadArray([],e,true),[r],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(n){console.log("[SEND] Error with send session",n);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new y(n.message,(t=n.response)===null||t===void 0?void 0:t.status,(i=n.response)===null||i===void 0?void 0:i.data))}return[2]}))}))};e.prototype.recomputeRolesCompleted=function(){var e=this;var t;this.rolesCompleted={};var i={};(((t=this.template)===null||t===void 0?void 0:t.roles)||[]).forEach((function(t){var n=t.sequence-1;i[n]||(i[n]=[]);var r="r-".concat(n,"-").concat(i[n].length);i[n].push(__assign(__assign({},t),{id:r,role_name:t.name,first_name:t.first_name,last_name:t.last_name}));if(t.first_name&&d(t.email)){e.rolesCompleted[r]=__assign(__assign({},t),{id:r,role_name:t.name,first_name:t.first_name,last_name:t.last_name})}}))};e.prototype.getLevels=function(){var e;var t={};(((e=this.template)===null||e===void 0?void 0:e.roles)||[]).forEach((function(e){t[e.sequence]=true}));console.log("[SEND] Sequences",t);return Object.keys(t).map((function(e){return+e-1})).sort((function(e,t){return e-t}))};e.prototype.getRolesAtLevel=function(e){var t;var i=(((t=this.template)===null||t===void 0?void 0:t.roles)||[]).filter((function(t){return t.sequence-1===e})).map((function(t,i){return __assign(__assign({},t),{id:"r-".concat(e,"-").concat(i),role_name:t.name,first_name:t.first_name,last_name:t.last_name})}));return i};e.prototype.getLevelIcon=function(e){var t=this.getLevels();if(e<0){return n("div",{class:"level-icon",innerHTML:Y})}else if(e>=t.length){return n("div",{class:"level-icon",innerHTML:J})}else{return n("div",{class:"level-icon",innerHTML:W})}};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 i;if(this.sending){console.log("[SEND] Skipping duplicate send",e);return}console.log("[SEND] Sending",e);e.preventDefault();e.stopPropagation();this.sending=true;var n={template_id:this.templateId,name:((i=this.template)===null||i===void 0?void 0:i.name)||"New Envelope",environment:this.environment,initial_reminder:0,followup_reminders:0,recipients:Object.values(this.rolesCompleted),fields:[]};var r=this.beforeSend.emit(__assign(__assign({},n),{name:n.name}));if(r.defaultPrevented){console.log("[SEND] Send cancelled by parent",n);this.sending=false;return}console.log("[SEND] Creating envelope",n);f(this.endpoint,n).then((function(e){var i;console.log("[SEND] Send envelope",e);t.reset().catch((function(e){return console.log("Unknown Error",e)}));t.sending=false;(i=t.send)===null||i===void 0?void 0:i.emit(__assign(__assign({},n),{name:n.name,envelope_id:e.id,envelope:e}))})).catch((function(e){var i,n,r;console.log("[SEND] Send error",e);E(((n=(i=e.response)===null||i===void 0?void 0:i.data)===null||n===void 0?void 0:n.error)||"Error creating envelope, please try again later.");t.sending=false;(r=t.sdkError)===null||r===void 0?void 0:r.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 n(r,null,n("verdocs-loader",null))}if(!this.endpoint.session){return n(r,{style:{display:"flex"}},n("verdocs-component-error",{message:"You must be authenticated to use this module."}))}var i=this.getLevels();console.log("[SEND] Rendering levels",i);var o=Object.values(this.rolesCompleted).filter((function(e){return d(e.email)&&e.first_name&&e.last_name}));var s=o.length>=U(this.template).length;return n(r,{class:{sendable:(t=this.template)===null||t===void 0?void 0:t.is_sendable}},n("div",{class:"recipients"},n("div",{class:"left-line"}),n("div",{class:"level level-start"},this.getLevelIcon(-1),n("div",{class:"complete"},"Send Envelope")),i.map((function(t){return n("div",{class:"level level-".concat(t)},e.getLevelIcon(t),(function(){console.log("Rendering level",t,e.getRolesAtLevel(t));return""}),e.getRolesAtLevel(t).map((function(t){var i,r,s;var a=!t.email||!t.first_name||!t.last_name;var l=((i=e.rolesCompleted[t.id])===null||i===void 0?void 0:i.first_name)?h(e.rolesCompleted[t.id]):a?t.role_name:h(t);var c="verdocs-send-recipient-".concat(t.role_name);var u=B(e.template,t.role_name);var d=v(u);var f=o.findIndex((function(e){return e.role_name===t.role_name}))>-1;var p={backgroundColor:d,border:f?"2px solid #55bc81":"2px solid #dddddd"};return a?n("div",{class:"recipient","data-ri":u,"data-rn":t.role_name,style:p,onClick:function(i){return e.handleClickRole(i,t)},id:c},l,n("div",{class:"icon",innerHTML:F}),e.showPickerForId===t.id&&n("verdocs-portal",{anchor:c,onClickAway:function(){return e.showPickerForId=""}},n("verdocs-contact-picker",{onExit:function(){return e.showPickerForId=""},onNext:function(i){return e.handleSelectContact(i,t)},contactSuggestions:e.sessionContacts,templateRole:(r=e.rolesCompleted[t.id])!==null&&r!==void 0?r:t,onSearchContacts:function(t){var i;return(i=e.searchContacts)===null||i===void 0?void 0:i.emit(t.detail)}}))):n("div",{class:"recipient","data-ri":u,"data-rn":t.role_name,style:p,onClick:function(i){return e.handleClickRole(i,t)},id:c},l,n("div",{class:"icon",innerHTML:F}),e.showPickerForId===t.id&&n("verdocs-portal",{anchor:c,onClickAway:function(){return e.showPickerForId=""}},n("verdocs-contact-picker",{onExit:function(){return e.showPickerForId=""},onNext:function(i){return e.handleSelectContact(i,t)},contactSuggestions:e.sessionContacts,templateRole:(s=e.rolesCompleted[t.id])!==null&&s!==void 0?s:t,onSearchContacts:function(t){var i;return(i=e.searchContacts)===null||i===void 0?void 0:i.emit(t.detail)}})))})))})),n("div",{class:"level level-done"},this.getLevelIcon(i.length),n("div",{class:"complete"},"Signing Complete"))),n("div",{class:"buttons"},n("verdocs-button",{label:"Cancel",size:"small",variant:"outline",onClick:function(t){return e.handleCancel(t)},disabled:this.sending}),n("verdocs-button",{label:"Send",size:"small",disabled:!s||this.sending,onClick:function(t){return e.handleSend(t)}}),this.sending&&n("verdocs-spinner",null)))};Object.defineProperty(e,"watchers",{get:function(){return{templateId:["onTemplateIdChanged"]}},enumerable:false,configurable:true});return e}());G.style=Q;var X='@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-attachments{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-template-attachments h5{font-size:16px;font-weight:bold;margin:0 0 10px 0;color:#46497d}verdocs-template-attachments .attachments{margin:0 0 40px 0}verdocs-template-attachments .attachment{display:-ms-flexbox;display:flex;padding:5px 0;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;color:#33364b}verdocs-template-attachments .attachment:hover .trash-icon{display:-ms-flexbox;display:flex}verdocs-template-attachments .attachment:hover .pages{display:none}verdocs-template-attachments svg{width:28px;height:28px;fill:#5c6575;margin:2px 0 0 0}verdocs-template-attachments .file-icon{-ms-flex:0;flex:0}verdocs-template-attachments .pages{width:24px;height:24px;-ms-flex:0 0 24px;flex:0 0 24px;padding-left:4px;position:relative;margin:-10px 0 0 0}verdocs-template-attachments .pages .pages-icon{top:0;left:0;width:24px;height:24px;position:absolute}verdocs-template-attachments .pages .count{top:11px;left:7px;z-index:1;width:18px;font-size:12px;font-weight:500;position:absolute;text-align:center;letter-spacing:-2px}verdocs-template-attachments .filename{-ms-flex:1;flex:1;display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis;border-bottom:1px dotted #cccccc}verdocs-template-attachments .trash-icon{-ms-flex:0;flex:0;display:none}verdocs-template-attachments .trash-icon:hover{cursor:pointer}verdocs-template-attachments verdocs-file-chooser{margin:10px 0;border:2px dashed #979797}verdocs-template-attachments .loader-wrapper{background-color:#ffffff;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;-webkit-box-sizing:border-box;box-sizing:border-box;position:relative;width:320px;height:320px;text-align:center;border:2px dashed #979797;-ms-flex-pack:end;justify-content:flex-end}verdocs-template-attachments .progress-wrapper{padding:20px}verdocs-template-attachments .buttons{display:-ms-flexbox;display:flex;-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;margin-top:16px;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;-ms-flex-pack:end;justify-content:flex-end}verdocs-template-attachments .buttons .flex-fill{-ms-flex:1;flex:1}verdocs-template-attachments ::-webkit-input-placeholder{color:#aaaaaa}verdocs-template-attachments ::-moz-placeholder{color:#aaaaaa}verdocs-template-attachments :-ms-input-placeholder{color:#aaaaaa}verdocs-template-attachments ::-ms-input-placeholder{color:#aaaaaa}verdocs-template-attachments ::placeholder{color:#aaaaaa}';var K=X;var $=e("verdocs_template_attachments",function(){function e(e){t(this,e);this.exit=i(this,"exit",7);this.next=i(this,"next",7);this.templateUpdated=i(this,"templateUpdated",7);this.sdkError=i(this,"sdkError",7);this.templateListenerId=null;this.endpoint=a.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,i;return __generator(this,(function(n){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(n){console.log("[TEMPLATE ATTACHMENTS] Error loading template",n);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new y(n.message,(t=n.response)===null||t===void 0?void 0:t.status,(i=n.response)===null||i===void 0?void 0:i.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();_.subscribe("templates",this.templateId,(function(){return l(e.endpoint,e.templateId)}),false,(function(t){e.template=t;e.loading=false}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){_.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,i,n,r,o,s,a,l;return __generator(this,(function(c){switch(c.label){case 0:e.stopPropagation();o=e.detail.file;if(!o){return[2]}console.log("[ATTACHMENTS] Uploading...",o);this.uploading=true;this.progressLabel="Uploading...";c.label=1;case 1:c.trys.push([1,4,,5]);return[4,p(this.endpoint,this.templateId,o,this.handleUploadProgress.bind(this))];case 2:s=c.sent();console.log("[ATTACHMENTS] Created attachment",s);a=this;return[4,_.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);(i=this.sdkError)===null||i===void 0?void 0:i.emit(new y(l.message,(n=l.response)===null||n===void 0?void 0:n.status,(r=l.response)===null||r===void 0?void 0:r.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,m(this.endpoint,this.templateId,this.confirmDeleteDocument.id)];case 1:t.sent();e=this;return[4,_.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(i){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 M;case"image/jpeg":return q;case"image/png":return S;case"application/msword":case"application/vnd.openxmlformats-officedocument.wordprocessingml.document":return k}return C};e.prototype.render=function(){var e=this;var t,i;if(!this.endpoint.session){return n(r,null,n("verdocs-component-error",{message:"You must be authenticated to use this module."}))}if(this.loading){return n(r,{class:"loading"},n("verdocs-loader",null))}if(!this.endpoint.session||!this.template){return n(r,{class:"empty"})}return n(r,null,n("h5",null,"Existing Attachments"),n("div",{class:"attachments"},(((t=this.template)===null||t===void 0?void 0:t.documents)||[]).map((function(t){return n("div",{class:"attachment"},n("div",{class:"file-icon",innerHTML:e.getFileIcon(t)}),n("div",{class:"filename",title:t.name},t.name),n("div",{class:"pages"},n("div",{class:"count"},t.pages),n("div",{class:"pages-icon",innerHTML:I})),n("div",{class:"trash-icon",innerHTML:T,onClick:function(){return e.handleDelete(t)}}))}))),n("h5",null,"Attach a New Document"),this.uploading?n("div",{class:"loader-wrapper"},n("verdocs-loader",null),this.progressLabel&&n("div",{class:"progress-wrapper"},n("verdocs-progress-bar",{showPercent:true,percent:this.progressPercent,label:this.progressLabel}))):n("verdocs-file-chooser",{onFileSelected:function(t){return e.handleUpload(t)}}),n("div",{class:"buttons"},n("verdocs-button",{variant:"outline",label:"Cancel",size:"small",onClick:function(t){return e.handleCancel(t)},disabled:this.uploading}),n("verdocs-button",{label:"Next",size:"small",onClick:function(t){return e.handleNext(t)},disabled:!(((i=this.template)===null||i===void 0?void 0:i.documents)||[]).length||this.uploading})),this.showDeleteError&&n("verdocs-ok-dialog",{heading:"Unable to Delete Attachment",message:"Templates must contain at least one attachment.",onNext:function(){return e.showDeleteError=false}}),this.confirmDeleteDocument&&n("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}());$.style=K;var ee='@-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 te=ee;var ie='<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 ne='<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 re=["attachments","roles","settings","fields","preview"];var oe=e("verdocs_template_build_tabs",function(){function e(e){t(this,e);this.sdkError=i(this,"sdkError",7);this.stepChanged=i(this,"stepChanged",7);this.templateListenerId=null;this.endpoint=a.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();_.subscribe("templates",this.templateId,(function(){return l(e.endpoint,e.templateId)}),false,(function(t){e.template=t;e.loading=false}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){_.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,i;return __generator(this,(function(n){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(n){console.log("[BUILD_TABS] Error loading template",n);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new y(n.message,(t=n.response)===null||t===void 0?void 0:t.status,(i=n.response)===null||i===void 0?void 0:i.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(){E("Template ID copied",{style:"success",duration:3e3})})).catch((function(t){var i;console.warn("[BUILD_TABS] Error copying to clipboard",t);(i=e.sdkError)===null||i===void 0?void 0:i.emit(t)}))};e.prototype.render=function(){var e=this;var t,i,o,s,a,l,c,u,d;if(this.loading){return n(r,null,n("verdocs-loader",null))}if(!this.endpoint.session){return n(r,null,n("verdocs-component-error",{message:"You must be authenticated to use this module."}))}var f=(((t=this.template)===null||t===void 0?void 0:t.documents)||[]).length>0;var h=f&&(((i=this.template)===null||i===void 0?void 0:i.roles)||[]).length>0;var v=h&&(((o=this.template)===null||o===void 0?void 0:o.fields)||[]).length>0;var p=Math.max(re.indexOf(this.step),0);if(!v&&p>=4){p=3}if(!h&&p>=3){p=1}if(!f&&p>=1){p=0}return n(r,null,n("verdocs-tabs",{onSelectTab:function(t){return e.setStep(t)},selectedTab:p,tabs:[{id:"attachments",disabled:false,label:"Attachment(s)"},{id:"roles",disabled:!f,label:"Roles"},{id:"settings",disabled:!h,label:"Settings"},{id:"fields",disabled:!h,label:"Fields"},{id:"preview",disabled:!v,label:"Preview/Send"}]}),this.templateId&&n("div",{class:"info"},n("verdocs-button-panel",{icon:ie},n("div",{class:"template-details-panel"},n("h6",null,"Template Details"),n("div",{class:"row"},n("label",null,"ID:"),n("div",{class:"value"},this.templateId),n("div",{class:"icon-button",innerHTML:ne,onClick:function(){return e.copyTemplateId()}})),n("div",{class:"row"},n("label",null,"Name:"),n("div",{class:"value"},(s=this.template)===null||s===void 0?void 0:s.name)),n("div",{class:"row"},n("label",null,"Visibility:"),n("div",{class:"value"},((a=this.template)===null||a===void 0?void 0:a.is_public)?"Public":((l=this.template)===null||l===void 0?void 0:l.is_personal)?"Private":"Shared")),n("div",{class:"row"},n("label",null,"Created:"),n("div",{class:"value"},((c=this.template)===null||c===void 0?void 0:c.counter)?L(new Date((u=this.template)===null||u===void 0?void 0:u.created_at),"P p"):"")),n("div",{class:"row"},n("label",null,"Used:"),n("div",{class:"value"},(d=this.template)===null||d===void 0?void 0:d.counter," time(s)"))))))};Object.defineProperty(e,"watchers",{get:function(){return{templateId:["onTemplateIdChanged"],step:["onStepChanged"]}},enumerable:false,configurable:true});return e}());oe.style=te;var se="@-webkit-keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}@keyframes verdocs-field-pulse{0%{background-color:rgba(0, 0, 0, 0.35)}50%{background-color:rgba(0, 0, 0, 0)}100%{background-color:rgba(0, 0, 0, 0.35)}}verdocs-template-fields{font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif;position:relative;display:block;min-height:600px}verdocs-template-fields .page-0{padding:65px 15px 0 15px;-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-fields .page-0 .user-placed-fields{height:100px;position:relative;background:#ffffff;-webkit-box-shadow:0 0 10px 5px rgba(0, 0, 0, 0.0588235294);box-shadow:0 0 10px 5px rgba(0, 0, 0, 0.0588235294)}verdocs-template-fields .page-0 .user-placed-fields .title{top:0;left:0;color:#ffffff;font-size:12px;padding:3px 6px;font-weight:bold;position:absolute;background:#46497d}verdocs-template-fields .pages{display:-ms-flexbox;display:flex;padding:15px;row-gap:15px;min-height:200px;position:relative;-ms-flex-align:center;align-items:center;-webkit-box-sizing:border-box;box-sizing:border-box;-ms-flex-direction:column;flex-direction:column}verdocs-template-fields .pages div,verdocs-template-fields .pages canvas{-webkit-box-sizing:border-box;box-sizing:border-box}verdocs-template-fields #verdocs-template-fields-toolbar{width:100%;height:50px;display:-ms-flexbox;display:flex;-webkit-column-gap:15px;-moz-column-gap:15px;column-gap:15px;font-weight:700;padding:0 20px 0 0;-ms-flex-align:center;align-items:center;-ms-flex-direction:row;flex-direction:row;color:#f5f5fa;-ms-flex-pack:center;justify-content:center;background:#46497d}verdocs-template-fields #verdocs-template-fields-toolbar>verdocs-select-input{margin:0}verdocs-template-fields #verdocs-template-fields-toolbar svg{width:24px;height:24px}verdocs-template-fields #verdocs-template-fields-toolbar .add-for{margin:0;font-weight:500;color:#f5f5fa}verdocs-template-fields #verdocs-template-fields-toolbar verdocs-select-input{margin:0 20px 0 0}@media all and (max-width: 1000px){verdocs-template-fields #verdocs-template-fields-toolbar{-webkit-column-gap:8px;-moz-column-gap:8px;column-gap:8px;padding:0 10px 0 0}verdocs-template-fields #verdocs-template-fields-toolbar svg{-webkit-transform:scale(0.8);transform:scale(0.8)}verdocs-template-fields #verdocs-template-fields-toolbar .add-for,verdocs-template-fields #verdocs-template-fields-toolbar verdocs-select-input{display:none}}@media all and (max-width: 600px){verdocs-template-fields #verdocs-template-fields-toolbar{-webkit-column-gap:6px;-moz-column-gap:6px;column-gap:6px}verdocs-template-fields #verdocs-template-fields-toolbar svg{-webkit-transform:scale(0.6);transform:scale(0.6)}verdocs-template-fields #verdocs-template-fields-toolbar .separator,verdocs-template-fields #verdocs-template-fields-toolbar .add-for,verdocs-template-fields #verdocs-template-fields-toolbar verdocs-select-input{display:none}}verdocs-template-fields.placing-attachment{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-checkbox{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-date{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath fill='%23000000' d='M7.6 13.925q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375Zm4.4 0q-.55 0-.925-.375t-.375-.925q0-.55.375-.937.375-.388.925-.388t.925.388q.375.387.375.937t-.375.925q-.375.375-.925.375ZM5.3 22.85q-1.325 0-2.238-.912-.912-.913-.912-2.238V6.3q0-1.325.912-2.238.913-.912 2.238-.912H6v-2h2.575v2h6.85v-2H18v2h.7q1.325 0 2.238.912.912.913.912 2.238v13.4q0 1.325-.912 2.238-.913.912-2.238.912Zm0-3.15h13.4V10H5.3v9.7ZM5.3 8h13.4V6.3H5.3Zm0 0V6.3 8Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-dropdown{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24' stroke-width='1.5' stroke='currentColor'%3E%3Cpath stroke='%23000000' stroke-linecap='round' stroke-linejoin='round' d='M3 4.5h14.25M3 9h9.75M3 13.5h9.75m4.5-4.5v12m0 0l-3.75-3.75M17.25 21L21 17.25' /%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-initial{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M6.225 20.775V7h-5V3.225H15V7h-5v13.775Zm9.775 0v-8h-3V9h9.775v3.775h-3v8Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-payment{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m10.55 16.55 7.275-7.275L16.05 7.5l-5.5 5.45-2.675-2.65L6.1 12.075Zm-5.375 4.925q-1.125 0-1.887-.763-.763-.762-.763-1.887V5.175q0-1.125.763-1.888.762-.762 1.887-.762h13.65q1.125 0 1.888.762.762.763.762 1.888v13.65q0 1.125-.762 1.887-.763.763-1.888.763Zm0-2.65h13.65V5.175H5.175v13.65Zm0-13.65v13.65-13.65Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-radio{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M12 17q2.075 0 3.538-1.463Q17 14.075 17 12t-1.462-3.538Q14.075 7 12 7 9.925 7 8.463 8.462 7 9.925 7 12q0 2.075 1.463 3.537Q9.925 17 12 17Zm0 5.85q-2.275 0-4.25-.85t-3.438-2.312Q2.85 18.225 2 16.25q-.85-1.975-.85-4.25T2 7.75q.85-1.975 2.312-3.438Q5.775 2.85 7.75 2q1.975-.85 4.25-.85t4.25.85q1.975.85 3.438 2.312Q21.15 5.775 22 7.75q.85 1.975.85 4.25T22 16.25q-.85 1.975-2.312 3.438Q18.225 21.15 16.25 22q-1.975.85-4.25.85Zm0-3.15q3.25 0 5.475-2.225Q19.7 15.25 19.7 12q0-3.25-2.225-5.475Q15.25 4.3 12 4.3q-3.25 0-5.475 2.225Q4.3 8.75 4.3 12q0 3.25 2.225 5.475Q8.75 19.7 12 19.7Zm0-7.7Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-signature{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='m9.225 21.225 4.65-4.65h8.45v4.65Zm-5.35-2.2H5.05l8.5-8.5-1.175-1.175-8.5 8.5Zm14.25-9.95L13.8 4.8l1.325-1.325q.625-.65 1.525-.663.9-.012 1.6.663l1.225 1.175q.675.675.663 1.562-.013.888-.663 1.513ZM16.7 10.55 6 21.225H1.675V16.9L12.35 6.225Zm-3.725-.625-.6-.575 1.175 1.175Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-textarea{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M3.225 20.725v-3.15h11.55v3.15Zm0-4.775V12.8h17.55v3.15Zm0-4.75V8.05h17.55v3.15Zm0-4.775v-3.15h17.55v3.15Z'/%3E%3C/svg%3E\") 16 16, pointer}verdocs-template-fields.placing-textbox{cursor:url(\"data:image/svg+xml,%3Csvg width='32' height='15' viewBox='0 0 32 15' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cmask id='path-1-inside-1_1401_24' fill='white'%3E%3Cpath d='M0 0H32V15H0V0Z'/%3E%3C/mask%3E%3Cpath d='M0 0H32V15H0V0Z' fill='%234C56CB' fill-opacity='0.1'/%3E%3Cpath d='M0 0V-1H-1V0H0ZM0 15H-1V16H0V15ZM0 1H32V-1H0V1ZM32 14H0V16H32V14ZM1 15V0H-1V15H1Z' fill='%234C56CB' mask='url(%23path-1-inside-1_1401_24)'/%3E%3Cpath d='M3 11.8V8.65H14.15V11.8H3ZM3 6.65V3.5H20.15V6.65H3Z' fill='%234C56CB'/%3E%3Cline x1='31.5' y1='1' x2='31.5' y2='14' stroke='%234C56CB' stroke-opacity='0.32' stroke-dasharray='1 1'/%3E%3C/svg%3E%0A\") 0 14, pointer}verdocs-template-fields.placing-timestamp{cursor:url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath fill='%23000000' d='M9 1h6v2H9zm10.03 6.39 1.42-1.42c-.43-.51-.9-.99-1.41-1.41l-1.42 1.42C16.07 4.74 14.12 4 12 4c-4.97 0-9 4.03-9 9s4.02 9 9 9 9-4.03 9-9c0-2.12-.74-4.07-1.97-5.61zM13 14h-2V8h2v6z'%3E%3C/path%3E%3C/svg%3E\") 16 16, pointer}";var ae=se;var le='<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 ce='<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 ue='<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 de='<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 fe='<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 he='<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 ve='<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 pe='<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 me='<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 ge='<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 be=[{id:"signature",tooltip:"Signature",icon:fe,class:"signature"},{id:"initial",tooltip:"Initials",icon:he,class:"initial"},{id:"sep1",tooltip:"",icon:ge,class:"separator"},{id:"textbox",tooltip:"Text Box",icon:le,class:"textbox"},{id:"checkbox",tooltip:"Check Box",icon:ce,class:"checkbox"},{id:"radio",tooltip:"Radio Button",icon:ue,class:"radio"},{id:"dropdown",tooltip:"Dropdown",icon:pe,class:"dropdown"},{id:"sep2",tooltip:"",icon:ge,class:"separator"},{id:"date",tooltip:"Date",icon:de,class:"date"},{id:"timestamp",tooltip:"Timestamp",icon:ve,class:"timestamp"},{id:"attachment",tooltip:"Attachment",icon:me,class:"attachment"}];var xe=e("verdocs_template_fields",function(){function e(e){t(this,e);this.sdkError=i(this,"sdkError",7);this.templateUpdated=i(this,"templateUpdated",7);this.fieldsUpdated=i(this,"fieldsUpdated",7);this.templateListenerId=null;this.pageHeights={};this.cachedPageInfo={};this.endpoint=a.getDefault();this.templateId=null;this.toolbarTargetId=null;this.placing=null;this.showMustSelectRole=false;this.selectedRoleName="";this.loading=true;this.template=null}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,i;return __generator(this,(function(n){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(n){console.log("[FIELDS] Error with fields session",n);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new y(n.message,(t=n.response)===null||t===void 0?void 0:t.status,(i=n.response)===null||i===void 0?void 0:i.data))}return[2]}))}))};e.prototype.componentDidRender=function(){Z.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,i;var n=((t=this.template)===null||t===void 0?void 0:t.roles)||[];if(!this.selectedRoleName||!n.find((function(t){return t&&t.name===e.selectedRoleName}))){this.selectedRoleName=((i=n[0])===null||i===void 0?void 0:i.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();_.subscribe("templates",this.templateId,(function(){return l(e.endpoint,e.templateId)}),false,(function(t){var i,n;e.template=t;e.loading=false;if(!e.selectedRoleName){e.selectedRoleName=((n=(i=t.roles)===null||i===void 0?void 0:i[0])===null||n===void 0?void 0:n.name)||""}}));return[2]}))}))};e.prototype.unlistenToTemplate=function(){if(this.templateListenerId){_.store.delListener(this.templateListenerId);this.templateListenerId=null}};e.prototype.attachFieldAttributes=function(e,t,i){var n=this;i.addEventListener("settingsChanged",(function(){var e;(e=n.templateUpdated)===null||e===void 0?void 0:e.emit({endpoint:n.endpoint,template:n.template,event:"added-field"})}));i.addEventListener("deleted",(function(){var e;i.remove();(e=n.templateUpdated)===null||e===void 0?void 0:e.emit({endpoint:n.endpoint,template:n.template,event:"updated-field"})}));i.setAttribute("templateid",this.templateId);i.setAttribute("fieldname",t.name);i.setAttribute("pageNumber",String(e.pageNumber));i.setAttribute("xScale",String(e.xScale));i.setAttribute("yScale",String(e.yScale));i.setAttribute("name",t.name)};e.prototype.handlePageRendered=function(e){var t=this;var i;var n=e.detail;this.cachedPageInfo[n.pageNumber]=n;this.pageHeights[n.pageNumber]=n.naturalHeight;(((i=this.template)===null||i===void 0?void 0:i.fields)||[]).filter((function(e){return e&&e.page===n.pageNumber})).forEach((function(e){var i=D(e);var n=document.getElementById(i);if(n){n.setAttribute("fieldname",e.name);n.setAttribute("pagenumber",String(e.page));t.makeDraggable(n)}}))};e.prototype.makeDraggable=function(e){Z(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,i,n,r,o,s;return __generator(this,(function(a){t=+(e.target.getAttribute("posX")||0);i=+(e.target.getAttribute("posY")||0);n=+(e.target.getAttribute("xScale")||1);r=+(e.target.getAttribute("yScale")||1);o=e.dx/n+t;s=e.dy/r+i;e.target.setAttribute("posX",o);e.target.setAttribute("posy",s);O(e.target,"translate","".concat(o,"px, ").concat(s,"px"));return[2]}))}))};e.prototype.handleMoveEnd=function(e){return __awaiter(this,void 0,void 0,(function(){var t,i,n,r,o,s,a,l,c,u,d,f,h,v,p,m,b,x,w,k,S,q,M,C,I,T,L,Z,O,D,A,j,R,U,B,P,Q,F,Y;return __generator(this,(function(W){switch(W.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");f=this.cachedPageInfo[d],h=f.naturalWidth,v=h===void 0?612:h,p=f.naturalHeight,m=p===void 0?792:p,b=f.renderedHeight,x=b===void 0?792:b;w=e.target.getBoundingClientRect();k=e.target.parentElement;S=k.getBoundingClientRect();q=u.width||V(u.type);M=u.height||N(u.type);C=Math.max(w.left-S.left,0);I=Math.max(x-(S.bottom-w.bottom),0);T=parseInt(d);if(I>x){T=Math.min(T+1,((r=(n=((i=this.template)===null||i===void 0?void 0:i.documents)||[])===null||n===void 0?void 0:n[0])===null||r===void 0?void 0:r.pages)||1);I-=x;x=this.cachedPageInfo[T].renderedHeight;console.log("Next page",{newPageNumber:T,newY:I,renderedHeight:x})}else if(I<0){T=Math.max(T-1,1);x=this.cachedPageInfo[T].renderedHeight;I+=x;console.log("[FIELDS] Next page",{newPageNumber:T,newY:I,renderedHeight:x})}L=this.viewCoordinatesToPageCoordinates(C,I,d,v-q,m-M),Z=L.x,O=L.y;W.label=1;case 1:W.trys.push([1,3,,4]);D={x:Z,y:O,page:T};return[4,g(this.endpoint,this.templateId,c,D)];case 2:A=W.sent();console.log("[FIELDS] Updated",A);j=JSON.parse(JSON.stringify(this.template));R=j.fields.findIndex((function(e){return e.name===c}));if(R>-1){j.fields[R]=A}_.updateTemplate(this.templateId,j);e.target.removeAttribute("posX");e.target.removeAttribute("posY");H(e.target);U=this.cachedPageInfo[d],B=U.xScale,P=B===void 0?1:B,Q=U.yScale,F=Q===void 0?1:Q;z(e.target,A,P,F);(o=this.templateUpdated)===null||o===void 0?void 0:o.emit({endpoint:this.endpoint,template:j,event:"updated-field"});return[3,4];case 3:Y=W.sent();E("Error updating field, please try again later",{style:"error"});console.log("[FIELDS] Error updating field",Y);(s=this.sdkError)===null||s===void 0?void 0:s.emit(new y(Y.message,(a=Y.response)===null||a===void 0?void 0:a.status,(l=Y.response)===null||l===void 0?void 0:l.data));e.target.removeAttribute("posX");e.target.removeAttribute("posY");H(e.target);return[3,4];case 4:return[2]}}))}))};e.prototype.generateFieldName=function(e,t){var i;var n=1;var r;do{r="".concat(e,"P").concat(t,"-").concat(n);n++}while((((i=this.template)===null||i===void 0?void 0:i.fields)||[]).some((function(e){return e&&e.name===r})));return r};e.prototype.viewCoordinatesToPageCoordinates=function(e,t,i,n,r){var o=this.cachedPageInfo[i],s=o.xScale,a=s===void 0?1:s,l=o.yScale,c=l===void 0?1:l,u=o.renderedHeight,d=u===void 0?792:u;var f=Math.floor(Math.min(e/a,n));var h=Math.floor(Math.min(Math.max(d-t,0)/c,r));return{x:f,y:h}};e.prototype.handleClickPage=function(e,t){return __awaiter(this,void 0,void 0,(function(){var i,n,r,o,s,a,l,c,u,d,f,h,v,p,m,g;return __generator(this,(function(x){switch(x.label){case 0:if(!this.placing)return[3,2];n=e.offsetX;r=e.offsetY;o=V(this.placing);s=N(this.placing);a=this.cachedPageInfo[t];l=a.naturalWidth,c=l===void 0?612:l,u=a.naturalHeight,d=u===void 0?792:u;f=this.viewCoordinatesToPageCoordinates(n,r,t,c-o,d-s);h=Math.floor(f.x);v=Math.floor(f.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:h,y:v,width:o,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,b(this.endpoint,this.templateId,p)];case 1:m=x.sent();console.log("[FIELDS] Saved field",m);g=JSON.parse(JSON.stringify(this.template));g.fields.push(m);_.updateTemplate(this.templateId,g);(i=this.templateUpdated)===null||i===void 0?void 0:i.emit({endpoint:this.endpoint,template:g,event:"added-field"});this.placing=null;x.label=2;case 2:return[2]}}))}))};e.prototype.render=function(){var e;var t=this;var i,o,s;if(this.loading){return n(r,null,n("verdocs-loader",null))}if(!this.endpoint.session){return n(r,null,n("verdocs-component-error",{message:"You must be authenticated to use this module."}))}var a=(((i=this.template)===null||i===void 0?void 0:i.roles)||[]).map((function(e){return{value:e.name,label:e.full_name?"".concat(e.name,": ").concat(e.full_name):e.name}}));return n(r,{class:this.placing?(e={},e["placing-".concat(this.placing)]=true,e):{},onSubmit:function(){}},n("div",{id:"verdocs-template-fields-toolbar"},n("div",{class:"add-for"},"Add field:"),n("verdocs-select-input",{value:this.selectedRoleName,options:a,onInput:function(e){return t.selectedRoleName=e.target.value}}),be.map((function(e){return n("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}}}})}))),n("div",{class:"pages"},(((o=this.template)===null||o===void 0?void 0:o.documents)||[]).map((function(e){var i=c(1,e.pages);return i.map((function(i){var r=e.page_sizes[i];return n("verdocs-template-document-page",{templateId:t.templateId,documentId:e.id,pageNumber:i,virtualWidth:(r===null||r===void 0?void 0:r.width)||612,virtualHeight:(r===null||r===void 0?void 0:r.height)||792,disabled:true,editable:true,done:false,onClick:function(e){return t.handleClickPage(e,i)},onPageRendered:function(e){return t.handlePageRendered(e)},layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]})}))}))),this.showMustSelectRole&&n("verdocs-ok-dialog",{heading:"Unable to add field",message:(((s=this.template)===null||s===void 0?void 0:s.roles)||[]).length>0?"Please select a role before adding fields.":"Please add at least one role before adding fields.",onNext:function(){return t.showMustSelectRole=false}}))};Object.defineProperty(e,"watchers",{get:function(){return{templateId:["onTemplateIdChanged"]}},enumerable:false,configurable:true});return e}());xe.style=ae;
|
2
2
|
/**!
|
3
3
|
* Sortable 1.15.6
|
4
4
|
* @author RubaXa <trash@rubaxa.org>
|
5
5
|
* @author owenm <owen23355@gmail.com>
|
6
6
|
* @license MIT
|
7
7
|
*/function we(e,t){var i=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);if(t){n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))}i.push.apply(i,n)}return i}function ye(e){for(var t=1;t<arguments.length;t++){var i=arguments[t]!=null?arguments[t]:{};if(t%2){we(Object(i),true).forEach((function(t){Ee(e,t,i[t])}))}else if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(i))}else{we(Object(i)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(i,t))}))}}return e}function _e(e){"@babel/helpers - typeof";if(typeof Symbol==="function"&&typeof Symbol.iterator==="symbol"){_e=function(e){return typeof e}}else{_e=function(e){return e&&typeof Symbol==="function"&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e}}return _e(e)}function Ee(e,t,i){if(t in e){Object.defineProperty(e,t,{value:i,enumerable:true,configurable:true,writable:true})}else{e[t]=i}return e}function ke(){ke=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var i=arguments[t];for(var n in i){if(Object.prototype.hasOwnProperty.call(i,n)){e[n]=i[n]}}}return e};return ke.apply(this,arguments)}function Se(e,t){if(e==null)return{};var i={};var n=Object.keys(e);var r,o;for(o=0;o<n.length;o++){r=n[o];if(t.indexOf(r)>=0)continue;i[r]=e[r]}return i}function qe(e,t){if(e==null)return{};var i=Se(e,t);var n,r;if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(r=0;r<o.length;r++){n=o[r];if(t.indexOf(n)>=0)continue;if(!Object.prototype.propertyIsEnumerable.call(e,n))continue;i[n]=e[n]}}return i}var Me="1.15.6";function Ce(e){if(typeof window!=="undefined"&&window.navigator){return!!navigator.userAgent.match(e)}}var Ie=Ce(/(?:Trident.*rv[ :]?11\.|msie|iemobile|Windows Phone)/i);var Te=Ce(/Edge/i);var Le=Ce(/firefox/i);var Ze=Ce(/safari/i)&&!Ce(/chrome/i)&&!Ce(/android/i);var Oe=Ce(/iP(ad|od|hone)/i);var He=Ce(/chrome/i)&&Ce(/android/i);var ze={capture:false,passive:false};function De(e,t,i){e.addEventListener(t,i,!Ie&&ze)}function Ve(e,t,i){e.removeEventListener(t,i,!Ie&&ze)}function Ne(e,t){if(!t)return;t[0]===">"&&(t=t.substring(1));if(e){try{if(e.matches){return e.matches(t)}else if(e.msMatchesSelector){return e.msMatchesSelector(t)}else if(e.webkitMatchesSelector){return e.webkitMatchesSelector(t)}}catch(e){return false}}return false}function Ae(e){return e.host&&e!==document&&e.host.nodeType?e.host:e.parentNode}function je(e,t,i,n){if(e){i=i||document;do{if(t!=null&&(t[0]===">"?e.parentNode===i&&Ne(e,t):Ne(e,t))||n&&e===i){return e}if(e===i)break}while(e=Ae(e))}return null}var Re=/\s+/g;function Ue(e,t,i){if(e&&t){if(e.classList){e.classList[i?"add":"remove"](t)}else{var n=(" "+e.className+" ").replace(Re," ").replace(" "+t+" "," ");e.className=(n+(i?" "+t:"")).replace(Re," ")}}}function Be(e,t,i){var n=e&&e.style;if(n){if(i===void 0){if(document.defaultView&&document.defaultView.getComputedStyle){i=document.defaultView.getComputedStyle(e,"")}else if(e.currentStyle){i=e.currentStyle}return t===void 0?i:i[t]}else{if(!(t in n)&&t.indexOf("webkit")===-1){t="-webkit-"+t}n[t]=i+(typeof i==="string"?"":"px")}}}function Pe(e,t){var i="";if(typeof e==="string"){i=e}else{do{var n=Be(e,"transform");if(n&&n!=="none"){i=n+" "+i}}while(!t&&(e=e.parentNode))}var r=window.DOMMatrix||window.WebKitCSSMatrix||window.CSSMatrix||window.MSCSSMatrix;return r&&new r(i)}function Qe(e,t,i){if(e){var n=e.getElementsByTagName(t),r=0,o=n.length;if(i){for(;r<o;r++){i(n[r],r)}}return n}return[]}function Fe(){var e=document.scrollingElement;if(e){return e}else{return document.documentElement}}function Ye(e,t,i,n,r){if(!e.getBoundingClientRect&&e!==window)return;var o,s,a,l,c,u,d;if(e!==window&&e.parentNode&&e!==Fe()){o=e.getBoundingClientRect();s=o.top;a=o.left;l=o.bottom;c=o.right;u=o.height;d=o.width}else{s=0;a=0;l=window.innerHeight;c=window.innerWidth;u=window.innerHeight;d=window.innerWidth}if((t||i)&&e!==window){r=r||e.parentNode;if(!Ie){do{if(r&&r.getBoundingClientRect&&(Be(r,"transform")!=="none"||i&&Be(r,"position")!=="static")){var f=r.getBoundingClientRect();s-=f.top+parseInt(Be(r,"border-top-width"));a-=f.left+parseInt(Be(r,"border-left-width"));l=s+o.height;c=a+o.width;break}}while(r=r.parentNode)}}if(n&&e!==window){var h=Pe(r||e),v=h&&h.a,p=h&&h.d;if(h){s/=p;a/=v;d/=v;u/=p;l=s+u;c=a+d}}return{top:s,left:a,bottom:l,right:c,width:d,height:u}}function We(e,t,i){var n=et(e,true),r=Ye(e)[t];while(n){var o=Ye(n)[i],s=void 0;if(i==="top"||i==="left"){s=r>=o}else{s=r<=o}if(!s)return n;if(n===Fe())break;n=et(n,false)}return false}function Je(e,t,i,n){var r=0,o=0,s=e.children;while(o<s.length){if(s[o].style.display!=="none"&&s[o]!==fi.ghost&&(n||s[o]!==fi.dragged)&&je(s[o],i.draggable,e,false)){if(r===t){return s[o]}r++}o++}return null}function Ge(e,t){var i=e.lastElementChild;while(i&&(i===fi.ghost||Be(i,"display")==="none"||t&&!Ne(i,t))){i=i.previousElementSibling}return i||null}function Xe(e,t){var i=0;if(!e||!e.parentNode){return-1}while(e=e.previousElementSibling){if(e.nodeName.toUpperCase()!=="TEMPLATE"&&e!==fi.clone&&(!t||Ne(e,t))){i++}}return i}function Ke(e){var t=0,i=0,n=Fe();if(e){do{var r=Pe(e),o=r.a,s=r.d;t+=e.scrollLeft*o;i+=e.scrollTop*s}while(e!==n&&(e=e.parentNode))}return[t,i]}function $e(e,t){for(var i in e){if(!e.hasOwnProperty(i))continue;for(var n in t){if(t.hasOwnProperty(n)&&t[n]===e[i][n])return Number(i)}}return-1}function et(e,t){if(!e||!e.getBoundingClientRect)return Fe();var i=e;var n=false;do{if(i.clientWidth<i.scrollWidth||i.clientHeight<i.scrollHeight){var r=Be(i);if(i.clientWidth<i.scrollWidth&&(r.overflowX=="auto"||r.overflowX=="scroll")||i.clientHeight<i.scrollHeight&&(r.overflowY=="auto"||r.overflowY=="scroll")){if(!i.getBoundingClientRect||i===document.body)return Fe();if(n||t)return i;n=true}}}while(i=i.parentNode);return Fe()}function tt(e,t){if(e&&t){for(var i in t){if(t.hasOwnProperty(i)){e[i]=t[i]}}}return e}function it(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)}var nt;function rt(e,t){return function(){if(!nt){var i=arguments,n=this;if(i.length===1){e.call(n,i[0])}else{e.apply(n,i)}nt=setTimeout((function(){nt=void 0}),t)}}}function ot(){clearTimeout(nt);nt=void 0}function st(e,t,i){e.scrollLeft+=t;e.scrollTop+=i}function at(e){var t=window.Polymer;var i=window.jQuery||window.Zepto;if(t&&t.dom){return t.dom(e).cloneNode(true)}else if(i){return i(e).clone(true)[0]}else{return e.cloneNode(true)}}function lt(e,t,i){var n={};Array.from(e.children).forEach((function(r){var o,s,a,l;if(!je(r,t.draggable,e,false)||r.animated||r===i)return;var c=Ye(r);n.left=Math.min((o=n.left)!==null&&o!==void 0?o:Infinity,c.left);n.top=Math.min((s=n.top)!==null&&s!==void 0?s:Infinity,c.top);n.right=Math.max((a=n.right)!==null&&a!==void 0?a:-Infinity,c.right);n.bottom=Math.max((l=n.bottom)!==null&&l!==void 0?l:-Infinity,c.bottom)}));n.width=n.right-n.left;n.height=n.bottom-n.top;n.x=n.left;n.y=n.top;return n}var ct="Sortable"+(new Date).getTime();function ut(){var e=[],t;return{captureAnimationState:function t(){e=[];if(!this.options.animation)return;var i=[].slice.call(this.el.children);i.forEach((function(t){if(Be(t,"display")==="none"||t===fi.ghost)return;e.push({target:t,rect:Ye(t)});var i=ye({},e[e.length-1].rect);if(t.thisAnimationDuration){var n=Pe(t,true);if(n){i.top-=n.f;i.left-=n.e}}t.fromRect=i}))},addAnimationState:function t(i){e.push(i)},removeAnimationState:function t(i){e.splice($e(e,{target:i}),1)},animateAll:function i(n){var r=this;if(!this.options.animation){clearTimeout(t);if(typeof n==="function")n();return}var o=false,s=0;e.forEach((function(e){var t=0,i=e.target,n=i.fromRect,a=Ye(i),l=i.prevFromRect,c=i.prevToRect,u=e.rect,d=Pe(i,true);if(d){a.top-=d.f;a.left-=d.e}i.toRect=a;if(i.thisAnimationDuration){if(it(l,a)&&!it(n,a)&&(u.top-a.top)/(u.left-a.left)===(n.top-a.top)/(n.left-a.left)){t=ft(u,l,c,r.options)}}if(!it(a,n)){i.prevFromRect=n;i.prevToRect=a;if(!t){t=r.options.animation}r.animate(i,u,a,t)}if(t){o=true;s=Math.max(s,t);clearTimeout(i.animationResetTimer);i.animationResetTimer=setTimeout((function(){i.animationTime=0;i.prevFromRect=null;i.fromRect=null;i.prevToRect=null;i.thisAnimationDuration=null}),t);i.thisAnimationDuration=t}}));clearTimeout(t);if(!o){if(typeof n==="function")n()}else{t=setTimeout((function(){if(typeof n==="function")n()}),s)}e=[]},animate:function e(t,i,n,r){if(r){Be(t,"transition","");Be(t,"transform","");var o=Pe(this.el),s=o&&o.a,a=o&&o.d,l=(i.left-n.left)/(s||1),c=(i.top-n.top)/(a||1);t.animatingX=!!l;t.animatingY=!!c;Be(t,"transform","translate3d("+l+"px,"+c+"px,0)");this.forRepaintDummy=dt(t);Be(t,"transition","transform "+r+"ms"+(this.options.easing?" "+this.options.easing:""));Be(t,"transform","translate3d(0,0,0)");typeof t.animated==="number"&&clearTimeout(t.animated);t.animated=setTimeout((function(){Be(t,"transition","");Be(t,"transform","");t.animated=false;t.animatingX=false;t.animatingY=false}),r)}}}}function dt(e){return e.offsetWidth}function ft(e,t,i,n){return Math.sqrt(Math.pow(t.top-e.top,2)+Math.pow(t.left-e.left,2))/Math.sqrt(Math.pow(t.top-i.top,2)+Math.pow(t.left-i.left,2))*n.animation}var ht=[];var vt={initializeByDefault:true};var pt={mount:function e(t){for(var i in vt){if(vt.hasOwnProperty(i)&&!(i in t)){t[i]=vt[i]}}ht.forEach((function(e){if(e.pluginName===t.pluginName){throw"Sortable: Cannot mount plugin ".concat(t.pluginName," more than once")}}));ht.push(t)},pluginEvent:function e(t,i,n){var r=this;this.eventCanceled=false;n.cancel=function(){r.eventCanceled=true};var o=t+"Global";ht.forEach((function(e){if(!i[e.pluginName])return;if(i[e.pluginName][o]){i[e.pluginName][o](ye({sortable:i},n))}if(i.options[e.pluginName]&&i[e.pluginName][t]){i[e.pluginName][t](ye({sortable:i},n))}}))},initializePlugins:function e(t,i,n,r){ht.forEach((function(e){var r=e.pluginName;if(!t.options[r]&&!e.initializeByDefault)return;var o=new e(t,i,t.options);o.sortable=t;o.options=t.options;t[r]=o;ke(n,o.defaults)}));for(var o in t.options){if(!t.options.hasOwnProperty(o))continue;var s=this.modifyOption(t,o,t.options[o]);if(typeof s!=="undefined"){t.options[o]=s}}},getEventProperties:function e(t,i){var n={};ht.forEach((function(e){if(typeof e.eventProperties!=="function")return;ke(n,e.eventProperties.call(i[e.pluginName],t))}));return n},modifyOption:function e(t,i,n){var r;ht.forEach((function(e){if(!t[e.pluginName])return;if(e.optionListeners&&typeof e.optionListeners[i]==="function"){r=e.optionListeners[i].call(t[e.pluginName],n)}}));return r}};function mt(e){var t=e.sortable,i=e.rootEl,n=e.name,r=e.targetEl,o=e.cloneEl,s=e.toEl,a=e.fromEl,l=e.oldIndex,c=e.newIndex,u=e.oldDraggableIndex,d=e.newDraggableIndex,f=e.originalEvent,h=e.putSortable,v=e.extraEventProperties;t=t||i&&i[ct];if(!t)return;var p,m=t.options,g="on"+n.charAt(0).toUpperCase()+n.substr(1);if(window.CustomEvent&&!Ie&&!Te){p=new CustomEvent(n,{bubbles:true,cancelable:true})}else{p=document.createEvent("Event");p.initEvent(n,true,true)}p.to=s||i;p.from=a||i;p.item=r||i;p.clone=o;p.oldIndex=l;p.newIndex=c;p.oldDraggableIndex=u;p.newDraggableIndex=d;p.originalEvent=f;p.pullMode=h?h.lastPutMode:undefined;var b=ye(ye({},v),pt.getEventProperties(n,t));for(var x in b){p[x]=b[x]}if(i){i.dispatchEvent(p)}if(m[g]){m[g].call(t,p)}}var gt=["evt"];var bt=function e(t,i){var n=arguments.length>2&&arguments[2]!==undefined?arguments[2]:{},r=n.evt,o=qe(n,gt);pt.pluginEvent.bind(fi)(t,i,ye({dragEl:wt,parentEl:yt,ghostEl:_t,rootEl:Et,nextEl:kt,lastDownEl:St,cloneEl:qt,cloneHidden:Mt,dragStarted:Bt,putSortable:Ot,activeSortable:fi.active,originalEvent:r,oldIndex:Ct,oldDraggableIndex:Tt,newIndex:It,newDraggableIndex:Lt,hideGhostForTarget:li,unhideGhostForTarget:ci,cloneNowHidden:function e(){Mt=true},cloneNowShown:function e(){Mt=false},dispatchSortableEvent:function e(t){xt({sortable:i,name:t,originalEvent:r})}},o))};function xt(e){mt(ye({putSortable:Ot,cloneEl:qt,targetEl:wt,rootEl:Et,oldIndex:Ct,oldDraggableIndex:Tt,newIndex:It,newDraggableIndex:Lt},e))}var wt,yt,_t,Et,kt,St,qt,Mt,Ct,It,Tt,Lt,Zt,Ot,Ht=false,zt=false,Dt=[],Vt,Nt,At,jt,Rt,Ut,Bt,Pt,Qt,Ft=false,Yt=false,Wt,Jt,Gt=[],Xt=false,Kt=[];var $t=typeof document!=="undefined",ei=Oe,ti=Te||Ie?"cssFloat":"float",ii=$t&&!He&&!Oe&&"draggable"in document.createElement("div"),ni=function(){if(!$t)return;if(Ie){return false}var e=document.createElement("x");e.style.cssText="pointer-events:auto";return e.style.pointerEvents==="auto"}(),ri=function e(t,i){var n=Be(t),r=parseInt(n.width)-parseInt(n.paddingLeft)-parseInt(n.paddingRight)-parseInt(n.borderLeftWidth)-parseInt(n.borderRightWidth),o=Je(t,0,i),s=Je(t,1,i),a=o&&Be(o),l=s&&Be(s),c=a&&parseInt(a.marginLeft)+parseInt(a.marginRight)+Ye(o).width,u=l&&parseInt(l.marginLeft)+parseInt(l.marginRight)+Ye(s).width;if(n.display==="flex"){return n.flexDirection==="column"||n.flexDirection==="column-reverse"?"vertical":"horizontal"}if(n.display==="grid"){return n.gridTemplateColumns.split(" ").length<=1?"vertical":"horizontal"}if(o&&a["float"]&&a["float"]!=="none"){var d=a["float"]==="left"?"left":"right";return s&&(l.clear==="both"||l.clear===d)?"vertical":"horizontal"}return o&&(a.display==="block"||a.display==="flex"||a.display==="table"||a.display==="grid"||c>=r&&n[ti]==="none"||s&&n[ti]==="none"&&c+u>r)?"vertical":"horizontal"},oi=function e(t,i,n){var r=n?t.left:t.top,o=n?t.right:t.bottom,s=n?t.width:t.height,a=n?i.left:i.top,l=n?i.right:i.bottom,c=n?i.width:i.height;return r===a||o===l||r+s/2===a+c/2},si=function e(t,i){var n;Dt.some((function(e){var r=e[ct].options.emptyInsertThreshold;if(!r||Ge(e))return;var o=Ye(e),s=t>=o.left-r&&t<=o.right+r,a=i>=o.top-r&&i<=o.bottom+r;if(s&&a){return n=e}}));return n},ai=function e(t){function i(e,t){return function(n,r,o,s){var a=n.options.group.name&&r.options.group.name&&n.options.group.name===r.options.group.name;if(e==null&&(t||a)){return true}else if(e==null||e===false){return false}else if(t&&e==="clone"){return e}else if(typeof e==="function"){return i(e(n,r,o,s),t)(n,r,o,s)}else{var l=(t?n:r).options.group.name;return e===true||typeof e==="string"&&e===l||e.join&&e.indexOf(l)>-1}}}var n={};var r=t.group;if(!r||_e(r)!="object"){r={name:r}}n.name=r.name;n.checkPull=i(r.pull,true);n.checkPut=i(r.put);n.revertClone=r.revertClone;t.group=n},li=function e(){if(!ni&&_t){Be(_t,"display","none")}},ci=function e(){if(!ni&&_t){Be(_t,"display","")}};if($t&&!He){document.addEventListener("click",(function(e){if(zt){e.preventDefault();e.stopPropagation&&e.stopPropagation();e.stopImmediatePropagation&&e.stopImmediatePropagation();zt=false;return false}}),true)}var ui=function e(t){if(wt){t=t.touches?t.touches[0]:t;var i=si(t.clientX,t.clientY);if(i){var n={};for(var r in t){if(t.hasOwnProperty(r)){n[r]=t[r]}}n.target=n.rootEl=i;n.preventDefault=void 0;n.stopPropagation=void 0;i[ct]._onDragOver(n)}}};var di=function e(t){if(wt){wt.parentNode[ct]._isOutsideThisEl(t.target)}};function fi(e,t){if(!(e&&e.nodeType&&e.nodeType===1)){throw"Sortable: `el` must be an HTMLElement, not ".concat({}.toString.call(e))}this.el=e;this.options=t=ke({},t);e[ct]=this;var i={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 t(){return ri(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,i){t.setData("Text",i.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:fi.supportPointer!==false&&"PointerEvent"in window&&(!Ze||Oe),emptyInsertThreshold:5};pt.initializePlugins(this,e,i);for(var n in i){!(n in t)&&(t[n]=i[n])}ai(t);for(var r in this){if(r.charAt(0)==="_"&&typeof this[r]==="function"){this[r]=this[r].bind(this)}}this.nativeDraggable=t.forceFallback?false:ii;if(this.nativeDraggable){this.options.touchStartThreshold=1}if(t.supportPointer){De(e,"pointerdown",this._onTapStart)}else{De(e,"mousedown",this._onTapStart);De(e,"touchstart",this._onTapStart)}if(this.nativeDraggable){De(e,"dragover",this);De(e,"dragenter",this)}Dt.push(this.el);t.store&&t.store.get&&this.sort(t.store.get(this)||[]);ke(this,ut())}fi.prototype={constructor:fi,_isOutsideThisEl:function e(t){if(!this.el.contains(t)&&t!==this.el){Pt=null}},_getDirection:function e(t,i){return typeof this.options.direction==="function"?this.options.direction.call(this,t,i,wt):this.options.direction},_onTapStart:function e(t){if(!t.cancelable)return;var i=this,n=this.el,r=this.options,o=r.preventOnFilter,s=t.type,a=t.touches&&t.touches[0]||t.pointerType&&t.pointerType==="touch"&&t,l=(a||t).target,c=t.target.shadowRoot&&(t.path&&t.path[0]||t.composedPath&&t.composedPath()[0])||l,u=r.filter;_i(n);if(wt){return}if(/mousedown|pointerdown/.test(s)&&t.button!==0||r.disabled){return}if(c.isContentEditable){return}if(!this.nativeDraggable&&Ze&&l&&l.tagName.toUpperCase()==="SELECT"){return}l=je(l,r.draggable,n,false);if(l&&l.animated){return}if(St===l){return}Ct=Xe(l);Tt=Xe(l,r.draggable);if(typeof u==="function"){if(u.call(this,t,l,this)){xt({sortable:i,rootEl:c,name:"filter",targetEl:l,toEl:n,fromEl:n});bt("filter",i,{evt:t});o&&t.preventDefault();return}}else if(u){u=u.split(",").some((function(e){e=je(c,e.trim(),n,false);if(e){xt({sortable:i,rootEl:e,name:"filter",targetEl:l,fromEl:n,toEl:n});bt("filter",i,{evt:t});return true}}));if(u){o&&t.preventDefault();return}}if(r.handle&&!je(c,r.handle,n,false)){return}this._prepareDragStart(t,a,l)},_prepareDragStart:function e(t,i,n){var r=this,o=r.el,s=r.options,a=o.ownerDocument,l;if(n&&!wt&&n.parentNode===o){var c=Ye(n);Et=o;wt=n;yt=wt.parentNode;kt=wt.nextSibling;St=n;Zt=s.group;fi.dragged=wt;Vt={target:wt,clientX:(i||t).clientX,clientY:(i||t).clientY};Rt=Vt.clientX-c.left;Ut=Vt.clientY-c.top;this._lastX=(i||t).clientX;this._lastY=(i||t).clientY;wt.style["will-change"]="all";l=function e(){bt("delayEnded",r,{evt:t});if(fi.eventCanceled){r._onDrop();return}r._disableDelayedDragEvents();if(!Le&&r.nativeDraggable){wt.draggable=true}r._triggerDragStart(t,i);xt({sortable:r,name:"choose",originalEvent:t});Ue(wt,s.chosenClass,true)};s.ignore.split(",").forEach((function(e){Qe(wt,e.trim(),pi)}));De(a,"dragover",ui);De(a,"mousemove",ui);De(a,"touchmove",ui);if(s.supportPointer){De(a,"pointerup",r._onDrop);!this.nativeDraggable&&De(a,"pointercancel",r._onDrop)}else{De(a,"mouseup",r._onDrop);De(a,"touchend",r._onDrop);De(a,"touchcancel",r._onDrop)}if(Le&&this.nativeDraggable){this.options.touchStartThreshold=4;wt.draggable=true}bt("delayStart",this,{evt:t});if(s.delay&&(!s.delayOnTouchOnly||i)&&(!this.nativeDraggable||!(Te||Ie))){if(fi.eventCanceled){this._onDrop();return}if(s.supportPointer){De(a,"pointerup",r._disableDelayedDrag);De(a,"pointercancel",r._disableDelayedDrag)}else{De(a,"mouseup",r._disableDelayedDrag);De(a,"touchend",r._disableDelayedDrag);De(a,"touchcancel",r._disableDelayedDrag)}De(a,"mousemove",r._delayedDragTouchMoveHandler);De(a,"touchmove",r._delayedDragTouchMoveHandler);s.supportPointer&&De(a,"pointermove",r._delayedDragTouchMoveHandler);r._dragStartTimer=setTimeout(l,s.delay)}else{l()}}},_delayedDragTouchMoveHandler:function e(t){var i=t.touches?t.touches[0]:t;if(Math.max(Math.abs(i.clientX-this._lastX),Math.abs(i.clientY-this._lastY))>=Math.floor(this.options.touchStartThreshold/(this.nativeDraggable&&window.devicePixelRatio||1))){this._disableDelayedDrag()}},_disableDelayedDrag:function e(){wt&&pi(wt);clearTimeout(this._dragStartTimer);this._disableDelayedDragEvents()},_disableDelayedDragEvents:function e(){var t=this.el.ownerDocument;Ve(t,"mouseup",this._disableDelayedDrag);Ve(t,"touchend",this._disableDelayedDrag);Ve(t,"touchcancel",this._disableDelayedDrag);Ve(t,"pointerup",this._disableDelayedDrag);Ve(t,"pointercancel",this._disableDelayedDrag);Ve(t,"mousemove",this._delayedDragTouchMoveHandler);Ve(t,"touchmove",this._delayedDragTouchMoveHandler);Ve(t,"pointermove",this._delayedDragTouchMoveHandler)},_triggerDragStart:function e(t,i){i=i||t.pointerType=="touch"&&t;if(!this.nativeDraggable||i){if(this.options.supportPointer){De(document,"pointermove",this._onTouchMove)}else if(i){De(document,"touchmove",this._onTouchMove)}else{De(document,"mousemove",this._onTouchMove)}}else{De(wt,"dragend",this);De(Et,"dragstart",this._onDragStart)}try{if(document.selection){Ei((function(){document.selection.empty()}))}else{window.getSelection().removeAllRanges()}}catch(e){}},_dragStarted:function e(t,i){Ht=false;if(Et&&wt){bt("dragStarted",this,{evt:i});if(this.nativeDraggable){De(document,"dragover",di)}var n=this.options;!t&&Ue(wt,n.dragClass,false);Ue(wt,n.ghostClass,true);fi.active=this;t&&this._appendGhost();xt({sortable:this,name:"start",originalEvent:i})}else{this._nulling()}},_emulateDragOver:function e(){if(Nt){this._lastX=Nt.clientX;this._lastY=Nt.clientY;li();var t=document.elementFromPoint(Nt.clientX,Nt.clientY);var i=t;while(t&&t.shadowRoot){t=t.shadowRoot.elementFromPoint(Nt.clientX,Nt.clientY);if(t===i)break;i=t}wt.parentNode[ct]._isOutsideThisEl(t);if(i){do{if(i[ct]){var n=void 0;n=i[ct]._onDragOver({clientX:Nt.clientX,clientY:Nt.clientY,target:t,rootEl:i});if(n&&!this.options.dragoverBubble){break}}t=i}while(i=Ae(i))}ci()}},_onTouchMove:function e(t){if(Vt){var i=this.options,n=i.fallbackTolerance,r=i.fallbackOffset,o=t.touches?t.touches[0]:t,s=_t&&Pe(_t,true),a=_t&&s&&s.a,l=_t&&s&&s.d,c=ei&&Jt&&Ke(Jt),u=(o.clientX-Vt.clientX+r.x)/(a||1)+(c?c[0]-Gt[0]:0)/(a||1),d=(o.clientY-Vt.clientY+r.y)/(l||1)+(c?c[1]-Gt[1]:0)/(l||1);if(!fi.active&&!Ht){if(n&&Math.max(Math.abs(o.clientX-this._lastX),Math.abs(o.clientY-this._lastY))<n){return}this._onDragStart(t,true)}if(_t){if(s){s.e+=u-(At||0);s.f+=d-(jt||0)}else{s={a:1,b:0,c:0,d:1,e:u,f:d}}var f="matrix(".concat(s.a,",").concat(s.b,",").concat(s.c,",").concat(s.d,",").concat(s.e,",").concat(s.f,")");Be(_t,"webkitTransform",f);Be(_t,"mozTransform",f);Be(_t,"msTransform",f);Be(_t,"transform",f);At=u;jt=d;Nt=o}t.cancelable&&t.preventDefault()}},_appendGhost:function e(){if(!_t){var t=this.options.fallbackOnBody?document.body:Et,i=Ye(wt,true,ei,true,t),n=this.options;if(ei){Jt=t;while(Be(Jt,"position")==="static"&&Be(Jt,"transform")==="none"&&Jt!==document){Jt=Jt.parentNode}if(Jt!==document.body&&Jt!==document.documentElement){if(Jt===document)Jt=Fe();i.top+=Jt.scrollTop;i.left+=Jt.scrollLeft}else{Jt=Fe()}Gt=Ke(Jt)}_t=wt.cloneNode(true);Ue(_t,n.ghostClass,false);Ue(_t,n.fallbackClass,true);Ue(_t,n.dragClass,true);Be(_t,"transition","");Be(_t,"transform","");Be(_t,"box-sizing","border-box");Be(_t,"margin",0);Be(_t,"top",i.top);Be(_t,"left",i.left);Be(_t,"width",i.width);Be(_t,"height",i.height);Be(_t,"opacity","0.8");Be(_t,"position",ei?"absolute":"fixed");Be(_t,"zIndex","100000");Be(_t,"pointerEvents","none");fi.ghost=_t;t.appendChild(_t);Be(_t,"transform-origin",Rt/parseInt(_t.style.width)*100+"% "+Ut/parseInt(_t.style.height)*100+"%")}},_onDragStart:function e(t,i){var n=this;var r=t.dataTransfer;var o=n.options;bt("dragStart",this,{evt:t});if(fi.eventCanceled){this._onDrop();return}bt("setupClone",this);if(!fi.eventCanceled){qt=at(wt);qt.removeAttribute("id");qt.draggable=false;qt.style["will-change"]="";this._hideClone();Ue(qt,this.options.chosenClass,false);fi.clone=qt}n.cloneId=Ei((function(){bt("clone",n);if(fi.eventCanceled)return;if(!n.options.removeCloneOnHide){Et.insertBefore(qt,wt)}n._hideClone();xt({sortable:n,name:"clone"})}));!i&&Ue(wt,o.dragClass,true);if(i){zt=true;n._loopId=setInterval(n._emulateDragOver,50)}else{Ve(document,"mouseup",n._onDrop);Ve(document,"touchend",n._onDrop);Ve(document,"touchcancel",n._onDrop);if(r){r.effectAllowed="move";o.setData&&o.setData.call(n,r,wt)}De(document,"drop",n);Be(wt,"transform","translateZ(0)")}Ht=true;n._dragStartId=Ei(n._dragStarted.bind(n,i,t));De(document,"selectstart",n);Bt=true;window.getSelection().removeAllRanges();if(Ze){Be(document.body,"user-select","none")}},_onDragOver:function e(t){var i=this.el,n=t.target,r,o,s,a=this.options,l=a.group,c=fi.active,u=Zt===l,d=a.sort,f=Ot||c,h,v=this,p=false;if(Xt)return;function m(e,a){bt(e,v,ye({evt:t,isOwner:u,axis:h?"vertical":"horizontal",revert:s,dragRect:r,targetRect:o,canSort:d,fromSortable:f,target:n,completed:b,onMove:function e(n,o){return vi(Et,i,wt,r,n,Ye(n),t,o)},changed:x},a))}function g(){m("dragOverAnimationCapture");v.captureAnimationState();if(v!==f){f.captureAnimationState()}}function b(e){m("dragOverCompleted",{insertion:e});if(e){if(u){c._hideClone()}else{c._showClone(v)}if(v!==f){Ue(wt,Ot?Ot.options.ghostClass:c.options.ghostClass,false);Ue(wt,a.ghostClass,true)}if(Ot!==v&&v!==fi.active){Ot=v}else if(v===fi.active&&Ot){Ot=null}if(f===v){v._ignoreWhileAnimating=n}v.animateAll((function(){m("dragOverAnimationComplete");v._ignoreWhileAnimating=null}));if(v!==f){f.animateAll();f._ignoreWhileAnimating=null}}if(n===wt&&!wt.animated||n===i&&!n.animated){Pt=null}if(!a.dragoverBubble&&!t.rootEl&&n!==document){wt.parentNode[ct]._isOutsideThisEl(t.target);!e&&ui(t)}!a.dragoverBubble&&t.stopPropagation&&t.stopPropagation();return p=true}function x(){It=Xe(wt);Lt=Xe(wt,a.draggable);xt({sortable:v,name:"change",toEl:i,newIndex:It,newDraggableIndex:Lt,originalEvent:t})}if(t.preventDefault!==void 0){t.cancelable&&t.preventDefault()}n=je(n,a.draggable,i,true);m("dragOver");if(fi.eventCanceled)return p;if(wt.contains(t.target)||n.animated&&n.animatingX&&n.animatingY||v._ignoreWhileAnimating===n){return b(false)}zt=false;if(c&&!a.disabled&&(u?d||(s=yt!==Et):Ot===this||(this.lastPutMode=Zt.checkPull(this,c,wt,t))&&l.checkPut(this,c,wt,t))){h=this._getDirection(t,n)==="vertical";r=Ye(wt);m("dragOverValid");if(fi.eventCanceled)return p;if(s){yt=Et;g();this._hideClone();m("revert");if(!fi.eventCanceled){if(kt){Et.insertBefore(wt,kt)}else{Et.appendChild(wt)}}return b(true)}var w=Ge(i,a.draggable);if(!w||bi(t,h,this)&&!w.animated){if(w===wt){return b(false)}if(w&&i===t.target){n=w}if(n){o=Ye(n)}if(vi(Et,i,wt,r,n,o,t,!!n)!==false){g();if(w&&w.nextSibling){i.insertBefore(wt,w.nextSibling)}else{i.appendChild(wt)}yt=i;x();return b(true)}}else if(w&&gi(t,h,this)){var y=Je(i,0,a,true);if(y===wt){return b(false)}n=y;o=Ye(n);if(vi(Et,i,wt,r,n,o,t,false)!==false){g();i.insertBefore(wt,y);yt=i;x();return b(true)}}else if(n.parentNode===i){o=Ye(n);var _=0,E,k=wt.parentNode!==i,S=!oi(wt.animated&&wt.toRect||r,n.animated&&n.toRect||o,h),q=h?"top":"left",M=We(n,"top","top")||We(wt,"top","top"),C=M?M.scrollTop:void 0;if(Pt!==n){E=o[q];Ft=false;Yt=!S&&a.invertSwap||k}_=xi(t,n,o,h,S?1:a.swapThreshold,a.invertedSwapThreshold==null?a.swapThreshold:a.invertedSwapThreshold,Yt,Pt===n);var I;if(_!==0){var T=Xe(wt);do{T-=_;I=yt.children[T]}while(I&&(Be(I,"display")==="none"||I===_t))}if(_===0||I===n){return b(false)}Pt=n;Qt=_;var L=n.nextElementSibling,Z=false;Z=_===1;var O=vi(Et,i,wt,r,n,o,t,Z);if(O!==false){if(O===1||O===-1){Z=O===1}Xt=true;setTimeout(mi,30);g();if(Z&&!L){i.appendChild(wt)}else{n.parentNode.insertBefore(wt,Z?L:n)}if(M){st(M,0,C-M.scrollTop)}yt=wt.parentNode;if(E!==undefined&&!Yt){Wt=Math.abs(E-Ye(n)[q])}x();return b(true)}}if(i.contains(wt)){return b(false)}}return false},_ignoreWhileAnimating:null,_offMoveEvents:function e(){Ve(document,"mousemove",this._onTouchMove);Ve(document,"touchmove",this._onTouchMove);Ve(document,"pointermove",this._onTouchMove);Ve(document,"dragover",ui);Ve(document,"mousemove",ui);Ve(document,"touchmove",ui)},_offUpEvents:function e(){var t=this.el.ownerDocument;Ve(t,"mouseup",this._onDrop);Ve(t,"touchend",this._onDrop);Ve(t,"pointerup",this._onDrop);Ve(t,"pointercancel",this._onDrop);Ve(t,"touchcancel",this._onDrop);Ve(document,"selectstart",this)},_onDrop:function e(t){var i=this.el,n=this.options;It=Xe(wt);Lt=Xe(wt,n.draggable);bt("drop",this,{evt:t});yt=wt&&wt.parentNode;It=Xe(wt);Lt=Xe(wt,n.draggable);if(fi.eventCanceled){this._nulling();return}Ht=false;Yt=false;Ft=false;clearInterval(this._loopId);clearTimeout(this._dragStartTimer);ki(this.cloneId);ki(this._dragStartId);if(this.nativeDraggable){Ve(document,"drop",this);Ve(i,"dragstart",this._onDragStart)}this._offMoveEvents();this._offUpEvents();if(Ze){Be(document.body,"user-select","")}Be(wt,"transform","");if(t){if(Bt){t.cancelable&&t.preventDefault();!n.dropBubble&&t.stopPropagation()}_t&&_t.parentNode&&_t.parentNode.removeChild(_t);if(Et===yt||Ot&&Ot.lastPutMode!=="clone"){qt&&qt.parentNode&&qt.parentNode.removeChild(qt)}if(wt){if(this.nativeDraggable){Ve(wt,"dragend",this)}pi(wt);wt.style["will-change"]="";if(Bt&&!Ht){Ue(wt,Ot?Ot.options.ghostClass:this.options.ghostClass,false)}Ue(wt,this.options.chosenClass,false);xt({sortable:this,name:"unchoose",toEl:yt,newIndex:null,newDraggableIndex:null,originalEvent:t});if(Et!==yt){if(It>=0){xt({rootEl:yt,name:"add",toEl:yt,fromEl:Et,originalEvent:t});xt({sortable:this,name:"remove",toEl:yt,originalEvent:t});xt({rootEl:yt,name:"sort",toEl:yt,fromEl:Et,originalEvent:t});xt({sortable:this,name:"sort",toEl:yt,originalEvent:t})}Ot&&Ot.save()}else{if(It!==Ct){if(It>=0){xt({sortable:this,name:"update",toEl:yt,originalEvent:t});xt({sortable:this,name:"sort",toEl:yt,originalEvent:t})}}}if(fi.active){if(It==null||It===-1){It=Ct;Lt=Tt}xt({sortable:this,name:"end",toEl:yt,originalEvent:t});this.save()}}}this._nulling()},_nulling:function e(){bt("nulling",this);Et=wt=yt=_t=kt=qt=St=Mt=Vt=Nt=Bt=It=Lt=Ct=Tt=Pt=Qt=Ot=Zt=fi.dragged=fi.ghost=fi.clone=fi.active=null;Kt.forEach((function(e){e.checked=true}));Kt.length=At=jt=0},handleEvent:function e(t){switch(t.type){case"drop":case"dragend":this._onDrop(t);break;case"dragenter":case"dragover":if(wt){this._onDragOver(t);hi(t)}break;case"selectstart":t.preventDefault();break}},toArray:function e(){var t=[],i,n=this.el.children,r=0,o=n.length,s=this.options;for(;r<o;r++){i=n[r];if(je(i,s.draggable,this.el,false)){t.push(i.getAttribute(s.dataIdAttr)||yi(i))}}return t},sort:function e(t,i){var n={},r=this.el;this.toArray().forEach((function(e,t){var i=r.children[t];if(je(i,this.options.draggable,r,false)){n[e]=i}}),this);i&&this.captureAnimationState();t.forEach((function(e){if(n[e]){r.removeChild(n[e]);r.appendChild(n[e])}}));i&&this.animateAll()},save:function e(){var t=this.options.store;t&&t.set&&t.set(this)},closest:function e(t,i){return je(t,i||this.options.draggable,this.el,false)},option:function e(t,i){var n=this.options;if(i===void 0){return n[t]}else{var r=pt.modifyOption(this,t,i);if(typeof r!=="undefined"){n[t]=r}else{n[t]=i}if(t==="group"){ai(n)}}},destroy:function e(){bt("destroy",this);var t=this.el;t[ct]=null;Ve(t,"mousedown",this._onTapStart);Ve(t,"touchstart",this._onTapStart);Ve(t,"pointerdown",this._onTapStart);if(this.nativeDraggable){Ve(t,"dragover",this);Ve(t,"dragenter",this)}Array.prototype.forEach.call(t.querySelectorAll("[draggable]"),(function(e){e.removeAttribute("draggable")}));this._onDrop();this._disableDelayedDragEvents();Dt.splice(Dt.indexOf(this.el),1);this.el=t=null},_hideClone:function e(){if(!Mt){bt("hideClone",this);if(fi.eventCanceled)return;Be(qt,"display","none");if(this.options.removeCloneOnHide&&qt.parentNode){qt.parentNode.removeChild(qt)}Mt=true}},_showClone:function e(t){if(t.lastPutMode!=="clone"){this._hideClone();return}if(Mt){bt("showClone",this);if(fi.eventCanceled)return;if(wt.parentNode==Et&&!this.options.group.revertClone){Et.insertBefore(qt,wt)}else if(kt){Et.insertBefore(qt,kt)}else{Et.appendChild(qt)}if(this.options.group.revertClone){this.animate(wt,qt)}Be(qt,"display","");Mt=false}}};function hi(e){if(e.dataTransfer){e.dataTransfer.dropEffect="move"}e.cancelable&&e.preventDefault()}function vi(e,t,i,n,r,o,s,a){var l,c=e[ct],u=c.options.onMove,d;if(window.CustomEvent&&!Ie&&!Te){l=new CustomEvent("move",{bubbles:true,cancelable:true})}else{l=document.createEvent("Event");l.initEvent("move",true,true)}l.to=t;l.from=e;l.dragged=i;l.draggedRect=n;l.related=r||t;l.relatedRect=o||Ye(t);l.willInsertAfter=a;l.originalEvent=s;e.dispatchEvent(l);if(u){d=u.call(c,l,s)}return d}function pi(e){e.draggable=false}function mi(){Xt=false}function gi(e,t,i){var n=Ye(Je(i.el,0,i.options,true));var r=lt(i.el,i.options,_t);var o=10;return t?e.clientX<r.left-o||e.clientY<n.top&&e.clientX<n.right:e.clientY<r.top-o||e.clientY<n.bottom&&e.clientX<n.left}function bi(e,t,i){var n=Ye(Ge(i.el,i.options.draggable));var r=lt(i.el,i.options,_t);var o=10;return t?e.clientX>r.right+o||e.clientY>n.bottom&&e.clientX>n.left:e.clientY>r.bottom+o||e.clientX>n.right&&e.clientY>n.top}function xi(e,t,i,n,r,o,s,a){var l=n?e.clientY:e.clientX,c=n?i.height:i.width,u=n?i.top:i.left,d=n?i.bottom:i.right,f=false;if(!s){if(a&&Wt<c*r){if(!Ft&&(Qt===1?l>u+c*o/2:l<d-c*o/2)){Ft=true}if(!Ft){if(Qt===1?l<u+Wt:l>d-Wt){return-Qt}}else{f=true}}else{if(l>u+c*(1-r)/2&&l<d-c*(1-r)/2){return wi(t)}}}f=f||s;if(f){if(l<u+c*o/2||l>d-c*o/2){return l>u+c/2?1:-1}}return 0}function wi(e){if(Xe(wt)<Xe(e)){return 1}else{return-1}}function yi(e){var t=e.tagName+e.className+e.src+e.href+e.textContent,i=t.length,n=0;while(i--){n+=t.charCodeAt(i)}return n.toString(36)}function _i(e){Kt.length=0;var t=e.getElementsByTagName("input");var i=t.length;while(i--){var n=t[i];n.checked&&Kt.push(n)}}function Ei(e){return setTimeout(e,0)}function ki(e){return clearTimeout(e)}if($t){De(document,"touchmove",(function(e){if((fi.active||Ht)&&e.cancelable){e.preventDefault()}}))}fi.utils={on:De,off:Ve,css:Be,find:Qe,is:function e(t,i){return!!je(t,i,t,false)},extend:tt,throttle:rt,closest:je,toggleClass:Ue,clone:at,index:Xe,nextTick:Ei,cancelNextTick:ki,detectDirection:ri,getChild:Je,expando:ct};fi.get=function(e){return e[ct]};fi.mount=function(){for(var e=arguments.length,t=new Array(e),i=0;i<e;i++){t[i]=arguments[i]}if(t[0].constructor===Array)t=t[0];t.forEach((function(e){if(!e.prototype||!e.prototype.constructor){throw"Sortable: Mounted plugin must be a constructor function, not ".concat({}.toString.call(e))}if(e.utils)fi.utils=ye(ye({},fi.utils),e.utils);pt.mount(e)}))};fi.create=function(e,t){return new fi(e,t)};fi.version=Me;var Si=[],qi,Mi,Ci=false,Ii,Ti,Li,Zi;function Oi(){function e(){this.defaults={scroll:true,forceAutoScrollFallback:false,scrollSensitivity:30,scrollSpeed:10,bubbleScroll:true};for(var e in this){if(e.charAt(0)==="_"&&typeof this[e]==="function"){this[e]=this[e].bind(this)}}}e.prototype={dragStarted:function e(t){var i=t.originalEvent;if(this.sortable.nativeDraggable){De(document,"dragover",this._handleAutoScroll)}else{if(this.options.supportPointer){De(document,"pointermove",this._handleFallbackAutoScroll)}else if(i.touches){De(document,"touchmove",this._handleFallbackAutoScroll)}else{De(document,"mousemove",this._handleFallbackAutoScroll)}}},dragOverCompleted:function e(t){var i=t.originalEvent;if(!this.options.dragOverBubble&&!i.rootEl){this._handleAutoScroll(i)}},drop:function e(){if(this.sortable.nativeDraggable){Ve(document,"dragover",this._handleAutoScroll)}else{Ve(document,"pointermove",this._handleFallbackAutoScroll);Ve(document,"touchmove",this._handleFallbackAutoScroll);Ve(document,"mousemove",this._handleFallbackAutoScroll)}zi();Hi();ot()},nulling:function e(){Li=Mi=qi=Ci=Zi=Ii=Ti=null;Si.length=0},_handleFallbackAutoScroll:function e(t){this._handleAutoScroll(t,true)},_handleAutoScroll:function e(t,i){var n=this;var r=(t.touches?t.touches[0]:t).clientX,o=(t.touches?t.touches[0]:t).clientY,s=document.elementFromPoint(r,o);Li=t;if(i||this.options.forceAutoScrollFallback||Te||Ie||Ze){Di(t,this.options,s,i);var a=et(s,true);if(Ci&&(!Zi||r!==Ii||o!==Ti)){Zi&&zi();Zi=setInterval((function(){var e=et(document.elementFromPoint(r,o),true);if(e!==a){a=e;Hi()}Di(t,n.options,e,i)}),10);Ii=r;Ti=o}}else{if(!this.options.bubbleScroll||et(s,true)===Fe()){Hi();return}Di(t,this.options,et(s,false),false)}}};return ke(e,{pluginName:"scroll",initializeByDefault:true})}function Hi(){Si.forEach((function(e){clearInterval(e.pid)}));Si=[]}function zi(){clearInterval(Zi)}var Di=rt((function(e,t,i,n){if(!t.scroll)return;var r=(e.touches?e.touches[0]:e).clientX,o=(e.touches?e.touches[0]:e).clientY,s=t.scrollSensitivity,a=t.scrollSpeed,l=Fe();var c=false,u;if(Mi!==i){Mi=i;Hi();qi=t.scroll;u=t.scrollFn;if(qi===true){qi=et(i,true)}}var d=0;var f=qi;do{var h=f,v=Ye(h),p=v.top,m=v.bottom,g=v.left,b=v.right,x=v.width,w=v.height,y=void 0,_=void 0,E=h.scrollWidth,k=h.scrollHeight,S=Be(h),q=h.scrollLeft,M=h.scrollTop;if(h===l){y=x<E&&(S.overflowX==="auto"||S.overflowX==="scroll"||S.overflowX==="visible");_=w<k&&(S.overflowY==="auto"||S.overflowY==="scroll"||S.overflowY==="visible")}else{y=x<E&&(S.overflowX==="auto"||S.overflowX==="scroll");_=w<k&&(S.overflowY==="auto"||S.overflowY==="scroll")}var C=y&&(Math.abs(b-r)<=s&&q+x<E)-(Math.abs(g-r)<=s&&!!q);var I=_&&(Math.abs(m-o)<=s&&M+w<k)-(Math.abs(p-o)<=s&&!!M);if(!Si[d]){for(var T=0;T<=d;T++){if(!Si[T]){Si[T]={}}}}if(Si[d].vx!=C||Si[d].vy!=I||Si[d].el!==h){Si[d].el=h;Si[d].vx=C;Si[d].vy=I;clearInterval(Si[d].pid);if(C!=0||I!=0){c=true;Si[d].pid=setInterval(function(){if(n&&this.layer===0){fi.active._onTouchMove(Li)}var t=Si[this.layer].vy?Si[this.layer].vy*a:0;var i=Si[this.layer].vx?Si[this.layer].vx*a:0;if(typeof u==="function"){if(u.call(fi.dragged.parentNode[ct],i,t,e,Li,Si[this.layer].el)!=="continue"){return}}st(Si[this.layer].el,i,t)}.bind({layer:d}),24)}}d++}while(t.bubbleScroll&&f!==l&&(f=et(f,false)));Ci=c}),30);var Vi=function e(t){var i=t.originalEvent,n=t.putSortable,r=t.dragEl,o=t.activeSortable,s=t.dispatchSortableEvent,a=t.hideGhostForTarget,l=t.unhideGhostForTarget;if(!i)return;var c=n||o;a();var u=i.changedTouches&&i.changedTouches.length?i.changedTouches[0]:i;var d=document.elementFromPoint(u.clientX,u.clientY);l();if(c&&!c.el.contains(d)){s("spill");this.onSpill({dragEl:r,putSortable:n})}};function Ni(){}Ni.prototype={startIndex:null,dragStart:function e(t){var i=t.oldDraggableIndex;this.startIndex=i},onSpill:function e(t){var i=t.dragEl,n=t.putSortable;this.sortable.captureAnimationState();if(n){n.captureAnimationState()}var r=Je(this.sortable.el,this.startIndex,this.options);if(r){this.sortable.el.insertBefore(i,r)}else{this.sortable.el.appendChild(i)}this.sortable.animateAll();if(n){n.animateAll()}},drop:Vi};ke(Ni,{pluginName:"revertOnSpill"});function Ai(){}Ai.prototype={onSpill:function e(t){var i=t.dragEl,n=t.putSortable;var r=n||this.sortable;r.captureAnimationState();i.parentNode&&i.parentNode.removeChild(i);r.animateAll()},drop:Vi};ke(Ai,{pluginName:"removeOnSpill"});fi.mount(new Oi);fi.mount(Ai,Ni);var ji='@-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 Ri=ji;var Ui='<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 Bi='<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 Pi='<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 Qi='<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 Fi='<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 Yi=e("verdocs_template_roles",function(){function e(e){t(this,e);this.next=i(this,"next",7);this.exit=i(this,"exit",7);this.sdkError=i(this,"sdkError",7);this.rolesUpdated=i(this,"rolesUpdated",7);this.templateListenerId=null;this.sortableRefs=[];this.endpoint=a.getDefault();this.templateId="";this.showingRoleDialog=null;this.sender=null;this.dragging=false;this.loading=true;this.template=null}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();_.subscribe("templates",this.templateId,(function(){return l(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.delListener(this.templateListenerId);this.templateListenerId=null}};e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,i;return __generator(this,(function(n){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(n){console.log("[ROLES] Error with preview session",n);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new y(n.message,(t=n.response)===null||t===void 0?void 0:t.status,(i=n.response)===null||i===void 0?void 0:i.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 i=document.getElementById("verdocs-roles-sequence-".concat(t));if(i){var n=new fi(i,{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(n)}}));var i=document.getElementById("verdocs-roles-sequence-add-target");if(i){console.log("[ROLES] Applying sortable to add-sequence slot");var n=new fi(i,{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(n)}};e.prototype.handleMoveEnd=function(e){var t=this;var i=+e.from.dataset.sequence;var n=+e.to.dataset.sequence;var r=+e.oldIndex+1;var o=+e.newIndex+1;console.log("Move from ".concat(i,":").concat(r," to ").concat(n,":").concat(o),e.item);var s={};var a=this.getSequenceNumbers();a.forEach((function(e){var i=t.getRolesAtSequence(e);s[String(e)]=JSON.parse(JSON.stringify(i))}));s[a[a.length-1]+1]=[];var l=s[i].splice(r-1,1)[0];s[n]||(s[n]=[]);s[n].splice(o-1,0,l);var c=[];Object.entries(s).forEach((function(e){var i=e[0],n=e[1];n.forEach((function(e,n){if(!e){return}var r=+n+1;if(e.sequence!==+i||e.order!==r){e.sequence=+i;e.order=r;c.push(x(t.endpoint,t.templateId,e.name,{sequence:+i,order:r}).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,i,n;var r=this;return __generator(this,(function(o){switch(o.label){case 0:t={};i=[];n=this.getSequenceNumbers();(n||[]).forEach((function(e){(t[e]||[]).forEach((function(t,n){var o=+n+1;if(t.sequence!==+e||t.order!==o){console.log("[ROLES] Updating role",t.name,"from",t.sequence,t.order,"to",e,o);t.sequence=+e;t.order=o;i.push(x(r.endpoint,r.templateId,t.name,{sequence:+e,order:o}).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(i.length," renumber requests"));return[4,Promise.all(i).then((function(){return __awaiter(r,void 0,void 0,(function(){var e;return __generator(this,(function(i){e=JSON.parse(JSON.stringify(this.template));e.roles=Object.keys(t).reduce((function(e,i){return e.concat(t[i])}),[]);console.log("[ROLES] Done renumbering",e.roles.map((function(e){return{name:e.name,sequence:e.sequence,order:e.order}})));_.updateTemplate(this.templateId,e);return[2]}))}))}))];case 1:o.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 i="";var n=(((e=this.template)===null||e===void 0?void 0:e.roles)||[]).length;do{n++;i="Recipient ".concat(n)}while(!i||(((t=this.template)===null||t===void 0?void 0:t.roles)||[]).some((function(e){return e&&e.name===i})));return i};e.prototype.callCreateRole=function(e,t,i){var n=this;console.log("[ROLES] Will create role",{name:e,sequence:t,order:i});w(this.endpoint,this.templateId,{template_id:this.templateId,name:e,sequence:t,message:"",order:i,full_name:null,first_name:"",last_name:"",email:"",phone:"",type:"signer",delegator:false,kba_method:null}).then((function(e){return __awaiter(n,void 0,void 0,(function(){var t;return __generator(this,(function(i){switch(i.label){case 0:console.log("[ROLES] Created role",e);console.log("Updating template in data store");return[4,_.getTemplate(this.endpoint,this.templateId,true)];case 1:i.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 i=this.getRolesAtSequence(t).length+1;var n=this.getNextRoleName();this.callCreateRole(n,t,i)};e.prototype.handleAddStep=function(e,t){e.stopPropagation();var i=1;var n=this.getNextRoleName();this.callCreateRole(n,t,i)};e.prototype.render=function(){var e=this;if(!this.endpoint.session){return n(r,null,n("verdocs-component-error",{message:"You must be authenticated to use this module."}))}if(this.loading||!this.template){return n(r,{class:"loading"},n("verdocs-loader",null))}var t=this.getRoleNames();var i=this.getSequenceNumbers();var o=i&&i.length>0?(i[i.length-1]||0)+1:1;console.log("[ROLES] Rendering",{roleNames:t,sequences:i,nextSequence:o});return n(r,{class:{dragging:this.dragging}},n("form",{onSubmit:function(e){return e.preventDefault()},onClick:function(e){return e.stopPropagation()},autocomplete:"off"},n("h5",null,"Roles and Workflow"),n("div",{class:"roles"},i.map((function(t,i){return n("div",{class:"sequence"},n("div",{class:"sequence-label no-drag"},i+1,"."),n("div",{class:"sequence-roles",id:"verdocs-roles-sequence-".concat(t),"data-sequence":t},e.getRolesAtSequence(t).map((function(i){var r=!i.email||!i.first_name||!i.last_name;return r?n("div",{class:"role","data-rolename":i.name,"data-sequence":t,"data-order":i.order},n("div",{class:"role-name"},i.name),n("div",{class:"icons"},n("div",{class:"gear-button",innerHTML:Ui,onClick:function(){return e.showingRoleDialog=i.name},"aria-role":"button"}),n("span",{class:"type-icon",innerHTML:i.type==="signer"?Pi:i.type==="cc"?Fi:Qi}))):n("div",{class:"role","data-rolename":i.name,"data-sequence":t,"data-order":i.order},n("div",{class:"role-name"},h(i)),n("div",{class:"icons"},n("div",{class:"gear-button",innerHTML:Ui,onClick:function(){return e.showingRoleDialog=i.name},"aria-role":"button"}),n("span",{class:"type-icon",innerHTML:i.type==="signer"?Pi:i.type==="cc"?Fi:Qi})))}))),n("button",{class:"add-role no-drag",onClick:function(i){return e.handleAddRole(i,t)}},"+ Add Role"))})),n("div",{class:"sequence add-sequence"},n("div",{class:"sequence-label no-drag"},i.length+1,"."),n("div",{class:"sequence-roles",id:"verdocs-roles-sequence-add-target","data-sequence":o}),n("button",{class:"add-role no-drag",onClick:function(t){return e.handleAddRole(t,o)}},"+ Add Role"))),t.length<1&&n("div",{class:"empty"},"You must add at least one Role before proceeding.",n("br",null)," Click the ",n("span",{innerHTML:Bi})," Add button above to get started."),n("div",{class:"buttons"},n("div",{class:"flex-fill"}),n("verdocs-button",{variant:"outline",label:"Cancel",size:"small",onClick:function(){return e.handleCancel()}}),n("verdocs-button",{label:"OK",size:"small",onClick:function(){return e.handleSubmit()},disabled:t.length<1}))),this.showingRoleDialog&&n("verdocs-menu-panel",{onClose:function(){return e.showingRoleDialog=null}},n("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 s(this)},enumerable:false,configurable:true});return e}());Yi.style=Ri}}}));
|
8
|
-
//# sourceMappingURL=p-
|
8
|
+
//# sourceMappingURL=p-33064db4.system.entry.js.map
|