@verdocs/web-sdk 1.10.8 → 1.10.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (78) hide show
  1. package/dist/cjs/{Templates-a75b133d.js → Templates-2f2ea153.js} +2 -2
  2. package/dist/cjs/verdocs-build.cjs.entry.js +1 -1
  3. package/dist/cjs/verdocs-button-panel_3.cjs.entry.js +1 -1
  4. package/dist/cjs/verdocs-preview.cjs.entry.js +1 -1
  5. package/dist/cjs/verdocs-send.cjs.entry.js +1 -1
  6. package/dist/cjs/verdocs-template-attachments.cjs.entry.js +1 -1
  7. package/dist/cjs/verdocs-template-create_2.cjs.entry.js +3 -3
  8. package/dist/cjs/verdocs-template-name.cjs.entry.js +1 -1
  9. package/dist/cjs/verdocs-template-recipients.cjs.entry.js +3 -3
  10. package/dist/cjs/verdocs-template-reminders.cjs.entry.js +1 -1
  11. package/dist/cjs/verdocs-template-role-properties_2.cjs.entry.js +1 -1
  12. package/dist/cjs/verdocs-template-visibility.cjs.entry.js +1 -1
  13. package/dist/collection/components/templates/verdocs-template-create/verdocs-template-create.css +0 -1
  14. package/dist/collection/components/templates/verdocs-template-fields/verdocs-template-fields.js +1 -1
  15. package/dist/collection/components/templates/verdocs-template-recipients/verdocs-template-recipients.js +2 -2
  16. package/dist/collection/utils/Templates.js +2 -2
  17. package/dist/components/Templates.js +2 -2
  18. package/dist/components/verdocs-template-create2.js +1 -1
  19. package/dist/components/verdocs-template-fields2.js +1 -1
  20. package/dist/components/verdocs-template-recipients.js +2 -2
  21. package/dist/docs.json +1 -1
  22. package/dist/esm/{Templates-7595bdbf.js → Templates-a7530314.js} +2 -2
  23. package/dist/esm/verdocs-build.entry.js +1 -1
  24. package/dist/esm/verdocs-button-panel_3.entry.js +1 -1
  25. package/dist/esm/verdocs-preview.entry.js +1 -1
  26. package/dist/esm/verdocs-send.entry.js +1 -1
  27. package/dist/esm/verdocs-template-attachments.entry.js +1 -1
  28. package/dist/esm/verdocs-template-create_2.entry.js +3 -3
  29. package/dist/esm/verdocs-template-name.entry.js +1 -1
  30. package/dist/esm/verdocs-template-recipients.entry.js +3 -3
  31. package/dist/esm/verdocs-template-reminders.entry.js +1 -1
  32. package/dist/esm/verdocs-template-role-properties_2.entry.js +1 -1
  33. package/dist/esm/verdocs-template-visibility.entry.js +1 -1
  34. package/dist/esm-es5/{Templates-7595bdbf.js → Templates-a7530314.js} +1 -1
  35. package/dist/esm-es5/verdocs-build.entry.js +1 -1
  36. package/dist/esm-es5/verdocs-button-panel_3.entry.js +1 -1
  37. package/dist/esm-es5/verdocs-preview.entry.js +1 -1
  38. package/dist/esm-es5/verdocs-send.entry.js +1 -1
  39. package/dist/esm-es5/verdocs-template-attachments.entry.js +1 -1
  40. package/dist/esm-es5/verdocs-template-create_2.entry.js +1 -1
  41. package/dist/esm-es5/verdocs-template-name.entry.js +1 -1
  42. package/dist/esm-es5/verdocs-template-recipients.entry.js +1 -1
  43. package/dist/esm-es5/verdocs-template-reminders.entry.js +1 -1
  44. package/dist/esm-es5/verdocs-template-role-properties_2.entry.js +1 -1
  45. package/dist/esm-es5/verdocs-template-visibility.entry.js +1 -1
  46. package/dist/types/utils/Templates.d.ts +1 -1
  47. package/dist/verdocs-web-sdk/{p-3a04acf4.system.entry.js → p-00307be5.system.entry.js} +1 -1
  48. package/dist/verdocs-web-sdk/{p-f2ae6ed5.entry.js → p-011eedf8.entry.js} +1 -1
  49. package/dist/verdocs-web-sdk/p-0214eab8.entry.js +1 -0
  50. package/dist/verdocs-web-sdk/{p-a802a598.entry.js → p-07dfda29.entry.js} +1 -1
  51. package/dist/verdocs-web-sdk/{p-51a99eed.system.entry.js → p-08270eb7.system.entry.js} +1 -1
  52. package/dist/verdocs-web-sdk/{p-584e4fca.entry.js → p-0fc8ae0a.entry.js} +1 -1
  53. package/dist/verdocs-web-sdk/{p-d95b1215.system.entry.js → p-1e710eb7.system.entry.js} +1 -1
  54. package/dist/verdocs-web-sdk/{p-7067adce.system.js → p-45a4da16.system.js} +1 -1
  55. package/dist/verdocs-web-sdk/{p-c9216df9.system.entry.js → p-46cfb904.system.entry.js} +1 -1
  56. package/dist/verdocs-web-sdk/{p-01117b44.entry.js → p-5a4b4373.entry.js} +1 -1
  57. package/dist/verdocs-web-sdk/{p-7bc5fc1e.system.entry.js → p-6790f267.system.entry.js} +1 -1
  58. package/dist/verdocs-web-sdk/p-7a05d4ac.system.entry.js +1 -0
  59. package/dist/verdocs-web-sdk/{p-50892057.system.entry.js → p-9576a08f.system.entry.js} +1 -1
  60. package/dist/verdocs-web-sdk/{p-6cb274e3.entry.js → p-ac3a9c3c.entry.js} +1 -1
  61. package/dist/verdocs-web-sdk/p-ad6cc9f4.js +1 -0
  62. package/dist/verdocs-web-sdk/{p-26bfe095.entry.js → p-af65650c.entry.js} +1 -1
  63. package/dist/verdocs-web-sdk/{p-a7c75902.entry.js → p-b537b400.entry.js} +1 -1
  64. package/dist/verdocs-web-sdk/p-c16b6ca4.system.js +1 -1
  65. package/dist/verdocs-web-sdk/{p-7417cdc7.entry.js → p-c9eb3771.entry.js} +1 -1
  66. package/dist/verdocs-web-sdk/{p-9f52748a.system.entry.js → p-cdff8cba.system.entry.js} +1 -1
  67. package/dist/verdocs-web-sdk/{p-0e1f1b27.entry.js → p-d06946ca.entry.js} +1 -1
  68. package/dist/verdocs-web-sdk/{p-6c2d3b0f.system.entry.js → p-d88f7d5e.system.entry.js} +1 -1
  69. package/dist/verdocs-web-sdk/{p-34efc869.system.entry.js → p-e91b174d.system.entry.js} +1 -1
  70. package/dist/verdocs-web-sdk/{p-efa9bfa2.system.entry.js → p-f4f44d6f.system.entry.js} +1 -1
  71. package/dist/verdocs-web-sdk/p-ff2816cf.entry.js +1 -0
  72. package/dist/verdocs-web-sdk/verdocs-web-sdk.esm.js +1 -1
  73. package/package.json +1 -1
  74. package/dist/custom-elements.json +0 -1361
  75. package/dist/verdocs-web-sdk/p-53198827.entry.js +0 -1
  76. package/dist/verdocs-web-sdk/p-59c4e444.entry.js +0 -1
  77. package/dist/verdocs-web-sdk/p-d1393a1a.js +0 -1
  78. package/dist/verdocs-web-sdk/p-e82bebc9.system.entry.js +0 -1
@@ -1 +0,0 @@
1
- import{r as e,c as t,h as i,F as o,H as s,a as r}from"./p-ff1278ed.js";import{i as a}from"./p-4f12a8a7.js";import{u as l,c as n}from"./p-ffe60abd.js";import{V as p,T as d}from"./p-2d4712ea.js";import{g as c}from"./p-6de76553.js";import{s as m}from"./p-3cb8a7f4.js";import{l as f}from"./p-d1393a1a.js";import{a as h}from"./p-d6e07c20.js";import{S as x}from"./p-7a1b2643.js";import"./p-21603661.js";import"./p-5ea05a1d.js";import"./p-7291906c.js";import"./p-b28ef4bb.js";import"./p-880b619d.js";import"./p-aa124212.js";const v={[d.EVERYONE]:"Everyone",[d.EVERYONE_AS_CREATOR]:"Everyone as Me",[d.ORGANIZATION_MEMBER]:"Organization member",[d.ORGANIZATION_MEMBER_AS_CREATOR]:"Organization Member as Me",[d.CREATOR]:"Me"},g='<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>',u='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" fill="#00000089"><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>',b='<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>',w=class{constructor(i){e(this,i),this.next=t(this,"next",7),this.cancel=t(this,"cancel",7),this.sdkError=t(this,"sdkError",7),this.sequences=[],this.endpoint=p.getDefault(),this.templateId="",this.showingRoleDialog=null,this.showingSenderDialog=!1,this.sender=null,this.forceRerender=1}async componentWillLoad(){var e,t,i,o,s,r;try{if(this.endpoint.loadSession(),!this.templateId)return void console.log(`[RECIPIENTS] Missing required template ID ${this.templateId}`);if(!this.endpoint.session)return void console.log("[RECIPIENTS] Unable to start builder session, must be authenticated");try{console.log(`[RECIPIENTS] Loading template ${this.templateId}`,this.endpoint.session),await f(this.endpoint,this.templateId)}catch(o){console.log("[RECIPIENTS] Error loading template",o),null===(e=this.sdkError)||void 0===e||e.emit(new x(o.message,null===(t=o.response)||void 0===t?void 0:t.status,null===(i=o.response)||void 0===i?void 0:i.data))}this.sortTemplateRoles(),this.renumberTemplateRoles()}catch(e){console.log("[FIELDS] Error with preview session",e),null===(o=this.sdkError)||void 0===o||o.emit(new x(e.message,null===(s=e.response)||void 0===s?void 0:s.status,null===(r=e.response)||void 0===r?void 0:r.data))}}componentDidRender(){a.dynamicDrop(!0),a(".recipient").draggable({listeners:{start:function(e){e.target.classList.add("dragging"),this.el.classList.add("dragging")}.bind(this),move:function(e){const t=+(e.target.getAttribute("posX")||0),i=+(e.target.getAttribute("posY")||0),o=e.dx+t,s=e.dy+i;e.target.setAttribute("posX",o),e.target.setAttribute("posy",s),e.target.style.transform=`translate(${o+100}px, ${s-40}px)`}.bind(this),end:function(e){e.target.classList.remove("dragging"),this.el.classList.remove("dragging"),e.target.setAttribute("posX",0),e.target.setAttribute("posy",0),e.target.style.transform="translate(0px, 0px)"}.bind(this)}}),a(".dropzone").dropzone({overlap:.05,ondrop:function(e){e.target.classList.remove("active");const t=e.relatedTarget.dataset.rolename,i=+e.target.dataset.sequence,o=+e.target.dataset.order,s=m.template.roles.find((e=>e.name===t));s&&(s.sequence=i,s.order=o,this.sortTemplateRoles(),this.renumberTemplateRoles(),this.forceRerender++,Promise.all(m.template.roles.map((e=>l(this.endpoint,this.templateId,e.name,{sequence:e.sequence,order:e.order})))).then((()=>console.log("[RECIPIENTS] Updated roles"))).catch((e=>console.log("[RECIPIENTS] Role updates failed",e))))}.bind(this),ondropactivate:e=>{e.target.classList.add("visible")},ondropdeactivate:e=>{e.target.classList.remove("visible")},ondragenter:e=>{e.target.classList.add("active")},ondragleave:e=>{e.target.classList.remove("active")}})}handleCancel(e){var t;e.stopPropagation(),null===(t=this.cancel)||void 0===t||t.emit()}handleSubmit(e){var t;e.stopPropagation(),null===(t=this.next)||void 0===t||t.emit()}sortTemplateRoles(){m.template.roles.sort(((e,t)=>e.sequence===t.sequence?e.order-t.order:e.sequence-t.sequence))}extractSequenceNumbers(){this.sequences=[],m.template.roles.forEach((e=>{this.sequences.includes(e.sequence)||this.sequences.push(e.sequence)}))}renumberTemplateRoles(){this.extractSequenceNumbers();const e=[];this.sequences.sort(((e,t)=>e-t)),this.sequences.forEach(((t,i)=>{m.template.roles.filter((e=>e.sequence===t)).forEach(((t,o)=>{e.includes(t.name)||(t.sequence=i+1,t.order=o+1,e.push(t.name))}))})),this.extractSequenceNumbers()}handleAddRole(e,t){e.stopPropagation();const i=m.template.roles.filter((e=>e.sequence===t)).length+1;let o="",s=m.template.roles.length;do{s++,o=`Recipient ${s}`}while(!o||m.template.roles.some((e=>e.name===o)));console.log("Will create",o,t,i),n(this.endpoint,this.templateId,{template_id:this.templateId,name:o,full_name:"",email:"",phone:"",sequence:t,order:i,type:"signer",delegator:!1}).then((e=>{console.log("Created role",e),m.template.roles.push(e),this.renumberTemplateRoles(),this.forceRerender++})).catch((e=>{console.log("Error creating role",e)}))}render(){const e=m.template.roles.map((e=>e.name));return i(s,null,i("form",{onSubmit:e=>e.preventDefault(),onClick:e=>e.stopPropagation(),autocomplete:"off","data-r":this.forceRerender},i("h5",null,"Recipients"),i("div",{class:"participants"},i("div",{class:"left-line"}),i("div",{class:"row"},i("div",{class:"icon",innerHTML:'<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" fill="#00000089"><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>'}),i("div",{class:"row-recipients"},i("div",{class:"sender"},i("span",{class:"label"},"Sender:")," ",v[m.template.sender]," ",i("div",{class:"settings-button",innerHTML:g,onClick:()=>this.showingSenderDialog=!0,"aria-role":"button"})))),i("div",{class:"row add-sequence","data-sequence":0},i("div",{class:"icon",innerHTML:b}),i("div",{class:"row-recipients"},i("div",{class:"dropzone","data-sequence":0,"data-order":1},"Add Step"))),this.sequences.map((t=>i(o,null,i("div",{class:"row"},i("div",{class:"icon",innerHTML:u}),i("div",{class:"row-recipients"},i("div",{class:"dropzone","data-order":.5,"data-sequence":t}),m.template.roles.filter((e=>e.sequence===t)).map((s=>i(o,null,i("div",{class:"recipient",style:{backgroundColor:c(h(e,s.name))},"data-rolename":s.name},i("span",{class:"type-icon",innerHTML:"signer"===s.type?'<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>':"cc"===s.type?'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><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>':'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor"><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>'}),s.name," ",i("div",{class:"settings-button",innerHTML:g,onClick:()=>this.showingRoleDialog=s.name,"aria-role":"button"})),i("div",{class:"dropzone","data-order":s.order+.5,"data-sequence":t})))),i("button",{class:"add-role",innerHTML:b,onClick:e=>this.handleAddRole(e,t)}))),i("div",{class:"row add-sequence","data-sequence":t},i("div",{class:"row-recipients"},i("div",{class:"icon",innerHTML:b}),i("div",{class:"dropzone","data-sequence":t+1,"data-order":1},"Add Step")))))),this.sequences.length<1&&i(o,null,i("div",{class:"row"},i("div",{class:"icon",innerHTML:u}),i("div",{class:"row-recipients"},i("button",{class:"add-role",innerHTML:b,onClick:e=>this.handleAddRole(e,1)})))),i("div",{class:"row"},i("div",{class:"icon",innerHTML:'<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24" fill="#00000089"><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>'}),i("div",{class:"row-recipients"},i("div",{class:"complete"},"Document Complete")))),e.length<1&&i("div",{class:"empty"},"You must add at least one Role before proceeding.",i("br",null)," Click the ",i("span",{innerHTML:b})," Add button above to get started."),i("div",{class:"buttons"},i("div",{class:"flex-fill"}),i("verdocs-button",{variant:"outline",label:"Cancel",size:"small",onClick:e=>this.handleCancel(e)}),i("verdocs-button",{label:"OK",size:"small",onClick:e=>this.handleSubmit(e),disabled:e.length<1}))),this.showingRoleDialog&&i("verdocs-template-role-properties",{endpoint:this.endpoint,templateId:this.templateId,roleName:this.showingRoleDialog,onClose:()=>{this.showingRoleDialog=null,this.forceRerender++},onDelete:e=>{console.log("deleted",e.detail),this.renumberTemplateRoles(),this.showingRoleDialog=null,this.forceRerender++}}),this.showingSenderDialog&&i("verdocs-template-sender",{endpoint:this.endpoint,templateId:this.templateId,onClose:()=>this.showingSenderDialog=!1}))}get el(){return r(this)}};w.style='verdocs-template-recipients{display:block;min-width:400px;font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-template-recipients>form{display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;background-color:#ffffff;padding:12px}verdocs-template-recipients>form h5{font-size:16px;font-weight:bold;color:#4c56cb;margin:0 0 10px 0}verdocs-template-recipients>form .participants{position:relative}verdocs-template-recipients>form .left-line{top:32px;left:11px;z-index:1;width:12px;bottom:30px;position:absolute;background:#ffffff;border-left:3px dotted #9b9b9b}verdocs-template-recipients>form .row{display:-ms-flexbox;display:flex;-webkit-column-gap:0;-moz-column-gap:0;column-gap:0;margin-left:40px;position:relative;-ms-flex-direction:row;flex-direction:row;padding:6px 0 4px 0}verdocs-template-recipients>form .row .row-recipients{-ms-flex:1;flex:1;display:-ms-flexbox;display:flex;-webkit-column-gap:10px;-moz-column-gap:10px;column-gap:10px;-ms-flex-direction:row;flex-direction:row}verdocs-template-recipients>form .row .icon{top:14px;z-index:2;left:-40px;width:24px;height:24px;position:absolute;background:#ffffff}verdocs-template-recipients>form .row .sender{height:30px;display:-ms-flexbox;display:flex;font-size:14px;padding:0 5px 0 15px;line-height:30px;-ms-flex-direction:row;flex-direction:row;border-radius:30px;border:1px solid #c6c9cc;background-color:#f5f5fa}verdocs-template-recipients>form .row .complete{height:30px;display:-ms-flexbox;display:flex;font-size:14px;padding:0 15px;line-height:30px;-ms-flex-direction:row;flex-direction:row;border-radius:30px;background-color:#f5f5fa;border:1px solid #aeb4bf}verdocs-template-recipients>form .row .label{font-weight:bold;margin-right:6px;color:#33364b}verdocs-template-recipients>form .row .settings-button{margin:4px 0 0 9px;cursor:pointer}verdocs-template-recipients>form .row .recipient{height:30px;display:-ms-flexbox;display:flex;font-size:14px;line-height:30px;border-radius:30px;-ms-flex-direction:row;flex-direction:row;padding:0 5px 0 6px;white-space:nowrap;border:1px solid #aeb4bf}verdocs-template-recipients>form .row .recipient .type-icon{width:24px;height:24px;-webkit-transform:scale(0.8);transform:scale(0.8);opacity:0.6;margin:4px 12px 0 0}verdocs-template-recipients>form .row .recipient.dragging{position:absolute}verdocs-template-recipients>form .row .recipient.dragging+.dropzone{display:none !important}verdocs-template-recipients>form .row .dropzone{width:14px;height:30px;display:none}verdocs-template-recipients>form .row .dropzone svg{fill:#cccccc}verdocs-template-recipients>form .row .dropzone.visible{margin:0 7px;display:-ms-flexbox;display:flex;-ms-flex:0 0 14px;flex:0 0 14px}verdocs-template-recipients>form .row .dropzone.active{-ms-flex:0 0 120px;flex:0 0 120px;border-radius:30px;background:#654dcb7f;border:1px dashed #654dcb}verdocs-template-recipients>form label{display:block;font-size:14px;font-weight:500;margin:0 0 4px 0;color:#5c6575}verdocs-template-recipients>form input{border:none;font-size:18px;padding:3px 6px 3px 0;background:transparent;border-bottom:1px solid #33364b}verdocs-template-recipients>form input:focus{outline:none}verdocs-template-recipients .row.add-sequence{display:none}verdocs-template-recipients .add-role{margin:0;padding:0;border:none;opacity:0.5;cursor:pointer;background:none}verdocs-template-recipients .add-role:hover{opacity:1}verdocs-template-recipients .add-role svg{width:32px;height:32px}verdocs-template-recipients.dragging .add-role{display:none}verdocs-template-recipients.dragging form .row .recipient+.dropzone{display:-ms-flexbox;display:flex}verdocs-template-recipients.dragging .row.add-sequence{display:-ms-flexbox;display:flex}verdocs-template-recipients.dragging .row.add-sequence .dropzone{opacity:0.5;-ms-flex:0 0 120px;flex:0 0 120px;border-radius:30px;-ms-flex-align:center;align-items:center;background:#654dcb7f;-ms-flex-pack:center;justify-content:center;border:1px dashed #654dcb}verdocs-template-recipients.dragging .row.add-sequence .dropzone.active{opacity:1}verdocs-template-recipients .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-recipients .empty{font-size:13px;margin-top:15px;margin-bottom:5px}verdocs-template-recipients .empty svg{width:20px;height:20px;stroke:#666666;margin-bottom:-5px}verdocs-template-recipients ::-webkit-input-placeholder{color:#aaaaaa}verdocs-template-recipients ::-moz-placeholder{color:#aaaaaa}verdocs-template-recipients :-ms-input-placeholder{color:#aaaaaa}verdocs-template-recipients ::-ms-input-placeholder{color:#aaaaaa}verdocs-template-recipients ::placeholder{color:#aaaaaa}';export{w as verdocs_template_recipients}
@@ -1 +0,0 @@
1
- import{r as e,c as t,h as i,H as s}from"./p-ff1278ed.js";import{c as a,g as o}from"./p-b28ef4bb.js";import{V as l}from"./p-2d4712ea.js";import{S as r}from"./p-7a1b2643.js";import{i as n}from"./p-4f12a8a7.js";import{u as d,c as h}from"./p-feb442b1.js";import{a as p,r as c,c as m,d as g,e as v}from"./p-d6e07c20.js";import{s as u}from"./p-3cb8a7f4.js";import{l as x}from"./p-d1393a1a.js";import"./p-21603661.js";import"./p-880b619d.js";import"./p-aa124212.js";import"./p-5ea05a1d.js";import"./p-7291906c.js";const w=class{constructor(i){e(this,i),this.cancel=t(this,"cancel",7),this.next=t(this,"next",7),this.sdkError=t(this,"sdkError",7),this.endpoint=l.getDefault(),this.file=void 0,this.creating=!1}componentWillLoad(){this.endpoint.setTimeout(3e4),this.endpoint.loadSession()}handleFileChanged(e){var t;console.log("files",e.target.files),this.file=(null===(t=e.target.files)||void 0===t?void 0:t[0])||null,console.log("Selected file",this.file)}handleUpload(e){e.stopPropagation(),document.getElementById("verdocs-template-create-file").click()}handleCancel(e){var t;e.stopPropagation(),null===(t=this.cancel)||void 0===t||t.emit()}async handleSubmit(e){var t,i,s,l,n,d,h,p;if(e.stopPropagation(),this.file)try{const e=await a(this.endpoint,{name:this.file.name});console.log("created template",e);const i=await(n=this.endpoint,d=e.id,h=this.file,p=new FormData,p.append("document",h,h.name),n.api.post("/templates/".concat(d,"/documents"),p,{timeout:1e4,onUploadProgress:function(){}}).then((function(e){return e.data})));console.log("created document",i);const s=await o(this.endpoint,e.id);console.log("[CREATE] Created template",s),null===(t=this.next)||void 0===t||t.emit(s)}catch(e){console.log("[TEMPLATE-CREATE] Error creating template",e),null===(i=this.sdkError)||void 0===i||i.emit(new r(e.message,null===(s=e.response)||void 0===s?void 0:s.status,null===(l=e.response)||void 0===l?void 0:l.data))}}render(){return this.endpoint.session?i("form",{onSubmit:e=>e.preventDefault(),onClick:e=>e.stopPropagation(),autocomplete:"off"},i("input",{type:"file",id:"verdocs-template-create-file",multiple:!0,accept:"application/pdf",style:{display:"none"},onChange:e=>this.handleFileChanged(e)}),i("div",{class:"upload-box"},i("div",null,i("span",{innerHTML:'<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24"><path d="M6 2c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6H6zm7 7V3.5L18.5 9H13z"></path></svg>'})),i("div",{style:{marginTop:"20px",fontSize:"20px",fontWeight:"bold"}},this.file?this.file.name:"Drag a file here"),i("div",{style:{marginTop:"20px",marginBottom:"20px",fontSize:"16px",height:"20px"}},this.file?" ":"Or, if you prefer..."),i("verdocs-button",{label:this.file?"Select a different file":"Select a file from your computer",size:"small",onClick:e=>this.handleUpload(e)})),i("div",{class:"buttons"},i("verdocs-button",{variant:"outline",label:"Cancel",size:"small",onClick:e=>this.handleCancel(e)}),i("verdocs-button",{label:"Next",size:"small",onClick:e=>this.handleSubmit(e),disabled:!this.file}))):i(s,null,i("verdocs-component-error",{message:"You must be authenticated to use this module."}))}};w.style='verdocs-template-create{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-template-create form{background-color:#ffffff;padding:12px;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;width:340px}verdocs-template-create form .upload-box{max-width:320px;text-align:center;padding:44px 18px 66px;border:2px dashed #979797;color:rgba(0, 0, 0, 0.54)}verdocs-template-create form .upload-box svg{width:64px;fill:#5c6575}verdocs-template-create .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-create .buttons .flex-fill{-ms-flex:1;flex:1}verdocs-template-create ::-webkit-input-placeholder{color:#aaaaaa}verdocs-template-create ::-moz-placeholder{color:#aaaaaa}verdocs-template-create :-ms-input-placeholder{color:#aaaaaa}verdocs-template-create ::-ms-input-placeholder{color:#aaaaaa}verdocs-template-create ::placeholder{color:#aaaaaa}';const f=[{id:"attachment",tooltip:"Attachment",icon:"A"},{id:"checkbox",tooltip:"Check Box",icon:'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path 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>'},{id:"date",tooltip:"Date",icon:'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path 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>'},{id:"dropdown",tooltip:"Dropdown",icon:"O"},{id:"initial",tooltip:"Initials",icon:'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path d="M6.225 20.775V7h-5V3.225H15V7h-5v13.775Zm9.775 0v-8h-3V9h9.775v3.775h-3v8Z"/></svg>'},{id:"payment",tooltip:"Payment",icon:"P"},{id:"radio",tooltip:"Radio Button",icon:'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path 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>'},{id:"signature",tooltip:"Signature",icon:'<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>'},{id:"textarea",tooltip:"Text Area",icon:'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path 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"/></svg>'},{id:"textbox",tooltip:"Text Box",icon:'<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path d="M3.425 16.15V13h11.15v3.15Zm0-5.15V7.85h17.15V11Z"/></svg>'},{id:"timestamp",tooltip:"Timestamp",icon:"X"}],b=class{constructor(i){e(this,i),this.next=t(this,"next",7),this.cancel=t(this,"cancel",7),this.sdkError=t(this,"sdkError",7),this.pageHeights={},this.cachedPageInfo={},this.endpoint=l.getDefault(),this.templateId=null,this.placing=null,this.selectedRoleName=""}async componentWillLoad(){var e,t,i,s,a,o;try{if(this.endpoint.loadSession(),!this.templateId)return void console.log(`[FIELDS] Missing required template ID ${this.templateId}`);if(!this.endpoint.session)return void console.log("[BUILD] Unable to start builder session, must be authenticated");try{console.log(`[FIELDS] Loading template ${this.templateId}`,this.endpoint.session),await x(this.endpoint,this.templateId),this.selectedRoleName=u.roleNames[0],console.log("Starting with role",this.selectedRoleName)}catch(s){console.log("[FIELDS] Error loading template",s),null===(e=this.sdkError)||void 0===e||e.emit(new r(s.message,null===(t=s.response)||void 0===t?void 0:t.status,null===(i=s.response)||void 0===i?void 0:i.data))}}catch(e){console.log("[FIELDS] Error with preview session",e),null===(s=this.sdkError)||void 0===s||s.emit(new r(e.message,null===(a=e.response)||void 0===a?void 0:a.status,null===(o=e.response)||void 0===o?void 0:o.data))}}componentDidRender(){n.dynamicDrop(!0)}async handleFieldChange(e,t,i){console.log("[FIELDS] handleFieldChange",e,t,i)}attachFieldAttributes(e,t,i,s){s.addEventListener("input",(e=>this.handleFieldChange(t,e))),s.addEventListener("settingsChanged",(()=>{s.setAttribute("roleindex",p(u.roleNames,t.role_name))})),s.setAttribute("roleindex",i),s.setAttribute("pageNumber",e.pageNumber),s.setAttribute("xScale",e.xScale),s.setAttribute("yScale",e.yScale),s.setAttribute("name",t.name)}handlePageRendered(e){const t=e.detail;console.log("[FIELDS] Page rendered",t),this.cachedPageInfo[t.pageNumber]=t,this.pageHeights[t.pageNumber]=t.naturalHeight;const i=u.fields.filter((e=>e.page_sequence===t.pageNumber));console.log("[FIELDS] Fields on page",i),i.forEach((e=>{const i=p(u.roleNames,e.role_name),s=c(e,t,i,{disabled:!0,editable:!0,draggable:!0});s&&(Array.isArray(s)?s.map((s=>this.attachFieldAttributes(t,e,i,s))):this.attachFieldAttributes(t,e,i,s),n(s).draggable({listeners:{start(e){console.log("[FIELDS] Drag started",e.type,e.target)},move(e){const t=+(e.target.getAttribute("posX")||0),i=+(e.target.getAttribute("posY")||0),s=+(e.target.getAttribute("xScale")||1),a=+(e.target.getAttribute("yScale")||1),o=e.dx/s+t,l=e.dy/a+i;e.target.setAttribute("posX",o),e.target.setAttribute("posy",l),m(e.target,"translate",`${o}px, ${l}px`)},end:this.handleMoveField.bind(this)}}))}))}async handleMoveField(e){const t=e.target.getAttribute("pageNumber"),{naturalWidth:i=612,naturalHeight:s=792,renderedHeight:a=792}=this.cachedPageInfo[t];console.log("[FIELDS] Drag ended",t,e.target);const o=e.target.getBoundingClientRect(),l=e.target.parentElement.getBoundingClientRect(),r=Math.max(o.left-l.left,0),n=Math.max(a-(l.bottom-o.bottom),0),{x:h,y:p}=this.viewCoordinatesToPageCoordinates(r,n,t,i-e.rect.width,s-e.rect.height),c=e.target.getAttribute("name"),m=u.fields.find((e=>e.name===c));m&&(m.setting.x=h,m.setting.y=p,await d(this.endpoint,this.templateId,c,m),this.handlePageRendered({detail:this.cachedPageInfo[t]}))}generateFieldName(e,t){var i;const s=null===(i=u.template.pages)||void 0===i?void 0:i[t-1];return`${e}P${t}-${((null==s?void 0:s.fields)||[]).length}`}viewCoordinatesToPageCoordinates(e,t,i,s,a){const{xScale:o=1,yScale:l=1,renderedHeight:r=792}=this.cachedPageInfo[i];return{x:Math.floor(Math.min(e/o,s)),y:Math.floor(Math.min(Math.max(r-t,0)/l,a))}}async handleClickPage(e,t){if(this.placing){const i=t.sequence,s=e.offsetX,a=e.offsetY,o=g(this.placing),l=v(this.placing),{naturalWidth:r=612,naturalHeight:n=792}=this.cachedPageInfo[i],{x:d,y:p}=this.viewCoordinatesToPageCoordinates(s,a,i,r-o,n-l),c={name:this.generateFieldName(this.placing,i),role_name:this.selectedRoleName,template_id:this.templateId,type:this.placing,required:!0,page_sequence:i,validator:null,setting:{x:d,y:p}};switch(c.type){case"attachment":case"payment":c.setting={x:d,y:p};break;case"initial":case"signature":c.setting={x:d,y:p,result:""};break;case"checkbox_group":c.setting={x:d,y:p,minimum_checked:0,maximum_checked:1e3};break;case"date":c.setting={x:d,y:p,width:o,height:l,result:""};break;case"dropdown":c.setting={x:d,y:p,width:o,height:l,value:"",placeholder:"Select a value"};break;case"radio_button_group":c.setting={x:d,y:p};break;case"textbox":c.setting={x:d,y:p,width:o,height:l,result:"",leading:0,alignment:0,upperCase:!1};break;case"timestamp":c.setting={x:d,y:p,width:o,height:l}}const m=await h(this.endpoint,this.templateId,c);console.log("Saved field",m),u.fields.push(m),this.placing=null,this.handlePageRendered({detail:this.cachedPageInfo[i]})}}render(){if(console.log("rendering",u.updateCount),!this.endpoint.session)return i(s,null,i("verdocs-component-error",{message:"You must be authenticated to use this module."}));if(u.loading||!u.template)return i(s,null,i("verdocs-loader",null));const e=[...u.template.pages];return e.sort(((e,t)=>e.sequence-t.sequence)),i(s,{class:this.placing?{[`placing-${this.placing}`]:!0}:{},"data-updated":u.updateCount,onSubmit:()=>{console.log("onSubmit")}},i("div",{class:"pages"},e.map((e=>i("verdocs-document-page",{pageImageUri:e.display_uri,virtualWidth:612,virtualHeight:792,onClick:t=>this.handleClickPage(t,e),pageNumber:e.sequence,onPageRendered:e=>this.handlePageRendered(e),layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]})))),i("verdocs-floating-menu",{options:f,onOptionSelected:e=>{this.placing=e.detail.id}}))}};b.style="verdocs-template-fields{font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif;position:relative}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 #0000000f;box-shadow:0 0 10px 5px #0000000f}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.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 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-dropdown{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-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 xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M3.425 16.15V13h11.15v3.15Zm0-5.15V7.85h17.15V11Z'/%3E%3C/svg%3E\") 16 16, 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 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}";export{w as verdocs_template_create,b as verdocs_template_fields}
@@ -1 +0,0 @@
1
- import{g as e}from"./p-b28ef4bb.js";import{s as r}from"./p-3cb8a7f4.js";const o=[],t=async(t,s)=>{if(!s)throw console.log("[TEMPLATES] Missing required template ID"),new Error("Missing required template ID");if(r.loading)return new Promise(((e,r)=>{o.push({resolve:e,reject:r})}));if(s===r.templateId)return r.template;r.loading=!0,r.template=null;try{console.log(`[TEMPLATES] Loading template ${s}`);const n=await e(t,s,!0);return n?(r.loading=!1,r.template=n,r.templateId=s,o.forEach((e=>e.resolve(!0))),o.length=0,!0):void console.log("[TEMPLATES] Unable to load template")}catch(e){throw console.log("[TEMPLATES] Error loading template",e),r.loading=!1,o.forEach((r=>r.reject(e))),o.length=0,e}};export{t as l}
@@ -1 +0,0 @@
1
- var __awaiter=this&&this.__awaiter||function(e,t,i,a){function n(e){return e instanceof i?e:new i((function(t){t(e)}))}return new(i||(i=Promise))((function(i,o){function r(e){try{l(a.next(e))}catch(e){o(e)}}function s(e){try{l(a["throw"](e))}catch(e){o(e)}}function l(e){e.done?i(e.value):n(e.value).then(r,s)}l((a=a.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:[]},a,n,o,r;return r={next:s(0),throw:s(1),return:s(2)},typeof Symbol==="function"&&(r[Symbol.iterator]=function(){return this}),r;function s(e){return function(t){return l([e,t])}}function l(r){if(a)throw new TypeError("Generator is already executing.");while(i)try{if(a=1,n&&(o=r[0]&2?n["return"]:r[0]?n["throw"]||((o=n["return"])&&o.call(n),0):n.next)&&!(o=o.call(n,r[1])).done)return o;if(n=0,o)r=[r[0]&2,o.value];switch(r[0]){case 0:case 1:o=r;break;case 4:i.label++;return{value:r[1],done:false};case 5:i.label++;n=r[1];r=[0];continue;case 7:r=i.ops.pop();i.trys.pop();continue;default:if(!(o=i.trys,o=o.length>0&&o[o.length-1])&&(r[0]===6||r[0]===2)){i=0;continue}if(r[0]===3&&(!o||r[1]>o[0]&&r[1]<o[3])){i.label=r[1];break}if(r[0]===6&&i.label<o[1]){i.label=o[1];o=r;break}if(o&&i.label<o[2]){i.label=o[2];i.ops.push(r);break}if(o[2])i.ops.pop();i.trys.pop();continue}r=t.call(e,i)}catch(e){r=[6,e];n=0}finally{a=o=0}if(r[0]&5)throw r[1];return{value:r[0]?r[1]:void 0,done:true}}};var __spreadArray=this&&this.__spreadArray||function(e,t,i){if(i||arguments.length===2)for(var a=0,n=t.length,o;a<n;a++){if(o||!(a in t)){if(!o)o=Array.prototype.slice.call(t,0,a);o[a]=t[a]}}return e.concat(o||Array.prototype.slice.call(t))};System.register(["./p-97329951.system.js","./p-69912cbf.system.js","./p-261dcea1.system.js","./p-187b20b7.system.js","./p-d122cadd.system.js","./p-b1288daf.system.js","./p-e090d5e1.system.js","./p-5b62f239.system.js","./p-7067adce.system.js","./p-af2c2f79.system.js","./p-e0cfad01.system.js","./p-327858f0.system.js","./p-0f6da8c7.system.js","./p-d50523fd.system.js"],(function(e){"use strict";var t,i,a,n,o,r,s,l,d,c,p,h,u,g,m,v,f,x;return{setters:[function(e){t=e.r;i=e.c;a=e.h;n=e.H},function(e){o=e.c;r=e.g},function(e){s=e.V},function(e){l=e.S},function(e){d=e.i},function(e){c=e.u;p=e.c},function(e){h=e.a;u=e.r;g=e.c;m=e.d;v=e.e},function(e){f=e.s},function(e){x=e.l},function(){},function(){},function(){},function(){},function(){}],execute:function(){var w=function(e,t,i,a){var n=new FormData;n.append("document",i,i.name);return e.api.post("/templates/".concat(t,"/documents"),n,{timeout:1e4,onUploadProgress:function(e){var t=e.total||1;var i=e.loaded||0;a===null||a===void 0?void 0:a(Math.floor(i*100/(t||1)),i,t||1)}}).then((function(e){return e.data}))};var b='verdocs-template-create{font-family:"Inter", -apple-system, "Segoe UI", "Roboto", "Helvetica Neue", sans-serif}verdocs-template-create form{background-color:#ffffff;padding:12px;display:-ms-flexbox;display:flex;-ms-flex-direction:column;flex-direction:column;width:340px}verdocs-template-create form .upload-box{max-width:320px;text-align:center;padding:44px 18px 66px;border:2px dashed #979797;color:rgba(0, 0, 0, 0.54)}verdocs-template-create form .upload-box svg{width:64px;fill:#5c6575}verdocs-template-create .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-create .buttons .flex-fill{-ms-flex:1;flex:1}verdocs-template-create ::-webkit-input-placeholder{color:#aaaaaa}verdocs-template-create ::-moz-placeholder{color:#aaaaaa}verdocs-template-create :-ms-input-placeholder{color:#aaaaaa}verdocs-template-create ::-ms-input-placeholder{color:#aaaaaa}verdocs-template-create ::placeholder{color:#aaaaaa}';var y=" ";var q='<svg focusable="false" aria-hidden="true" viewBox="0 0 24 24"><path d="M6 2c-1.1 0-1.99.9-1.99 2L4 20c0 1.1.89 2 1.99 2H18c1.1 0 2-.9 2-2V8l-6-6H6zm7 7V3.5L18.5 9H13z"></path></svg>';var Z=e("verdocs_template_create",function(){function e(e){t(this,e);this.cancel=i(this,"cancel",7);this.next=i(this,"next",7);this.sdkError=i(this,"sdkError",7);this.endpoint=s.getDefault();this.file=undefined;this.creating=false}e.prototype.componentWillLoad=function(){this.endpoint.setTimeout(3e4);this.endpoint.loadSession()};e.prototype.handleFileChanged=function(e){var t;console.log("files",e.target.files);this.file=((t=e.target.files)===null||t===void 0?void 0:t[0])||null;console.log("Selected file",this.file)};e.prototype.handleUpload=function(e){e.stopPropagation();var t=document.getElementById("verdocs-template-create-file");t.click()};e.prototype.handleCancel=function(e){var t;e.stopPropagation();(t=this.cancel)===null||t===void 0?void 0:t.emit()};e.prototype.handleSubmit=function(e){return __awaiter(this,void 0,void 0,(function(){var t,i,a,n,s,d,c,p;return __generator(this,(function(h){switch(h.label){case 0:e.stopPropagation();if(!this.file){return[2]}h.label=1;case 1:h.trys.push([1,5,,6]);return[4,o(this.endpoint,{name:this.file.name})];case 2:s=h.sent();console.log("created template",s);return[4,w(this.endpoint,s.id,this.file)];case 3:d=h.sent();console.log("created document",d);return[4,r(this.endpoint,s.id)];case 4:c=h.sent();console.log("[CREATE] Created template",c);(t=this.next)===null||t===void 0?void 0:t.emit(c);return[3,6];case 5:p=h.sent();console.log("[TEMPLATE-CREATE] Error creating template",p);(i=this.sdkError)===null||i===void 0?void 0:i.emit(new l(p.message,(a=p.response)===null||a===void 0?void 0:a.status,(n=p.response)===null||n===void 0?void 0:n.data));return[3,6];case 6:return[2]}}))}))};e.prototype.render=function(){var e=this;if(!this.endpoint.session){return a(n,null,a("verdocs-component-error",{message:"You must be authenticated to use this module."}))}return a("form",{onSubmit:function(e){return e.preventDefault()},onClick:function(e){return e.stopPropagation()},autocomplete:"off"},a("input",{type:"file",id:"verdocs-template-create-file",multiple:true,accept:"application/pdf",style:{display:"none"},onChange:function(t){return e.handleFileChanged(t)}}),a("div",{class:"upload-box"},a("div",null,a("span",{innerHTML:q})),a("div",{style:{marginTop:"20px",fontSize:"20px",fontWeight:"bold"}},this.file?this.file.name:"Drag a file here"),a("div",{style:{marginTop:"20px",marginBottom:"20px",fontSize:"16px",height:"20px"}},this.file?y:"Or, if you prefer..."),a("verdocs-button",{label:this.file?"Select a different file":"Select a file from your computer",size:"small",onClick:function(t){return e.handleUpload(t)}})),a("div",{class:"buttons"},a("verdocs-button",{variant:"outline",label:"Cancel",size:"small",onClick:function(t){return e.handleCancel(t)}}),a("verdocs-button",{label:"Next",size:"small",onClick:function(t){return e.handleSubmit(t)},disabled:!this.file})))};return e}());Z.style=b;var C="verdocs-template-fields{font-family:\"Inter\", -apple-system, \"Segoe UI\", \"Roboto\", \"Helvetica Neue\", sans-serif;position:relative}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 #0000000f;box-shadow:0 0 10px 5px #0000000f}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.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 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-dropdown{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-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 xmlns='http://www.w3.org/2000/svg' height='24' width='24'%3E%3Cpath d='M3.425 16.15V13h11.15v3.15Zm0-5.15V7.85h17.15V11Z'/%3E%3C/svg%3E\") 16 16, 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 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}";var E='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path d="M3.425 16.15V13h11.15v3.15Zm0-5.15V7.85h17.15V11Z"/></svg>';var _='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path 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"/></svg>';var k='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path 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 V='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path 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 S='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path 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 L='<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 I='<svg xmlns="http://www.w3.org/2000/svg" height="24" width="24"><path d="M6.225 20.775V7h-5V3.225H15V7h-5v13.775Zm9.775 0v-8h-3V9h9.775v3.775h-3v8Z"/></svg>';var H=[{id:"attachment",tooltip:"Attachment",icon:"A"},{id:"checkbox",tooltip:"Check Box",icon:k},{id:"date",tooltip:"Date",icon:S},{id:"dropdown",tooltip:"Dropdown",icon:"O"},{id:"initial",tooltip:"Initials",icon:I},{id:"payment",tooltip:"Payment",icon:"P"},{id:"radio",tooltip:"Radio Button",icon:V},{id:"signature",tooltip:"Signature",icon:L},{id:"textarea",tooltip:"Text Area",icon:_},{id:"textbox",tooltip:"Text Box",icon:E},{id:"timestamp",tooltip:"Timestamp",icon:"X"}];var A=e("verdocs_template_fields",function(){function e(e){t(this,e);this.next=i(this,"next",7);this.cancel=i(this,"cancel",7);this.sdkError=i(this,"sdkError",7);this.pageHeights={};this.cachedPageInfo={};this.endpoint=s.getDefault();this.templateId=null;this.placing=null;this.selectedRoleName=""}e.prototype.componentWillLoad=function(){return __awaiter(this,void 0,void 0,(function(){var e,t,i,a,n,o,r,s;return __generator(this,(function(d){switch(d.label){case 0:d.trys.push([0,5,,6]);this.endpoint.loadSession();if(!this.templateId){console.log("[FIELDS] Missing required template ID ".concat(this.templateId));return[2]}if(!this.endpoint.session){console.log("[BUILD] Unable to start builder session, must be authenticated");return[2]}d.label=1;case 1:d.trys.push([1,3,,4]);console.log("[FIELDS] Loading template ".concat(this.templateId),this.endpoint.session);return[4,x(this.endpoint,this.templateId)];case 2:d.sent();this.selectedRoleName=f.roleNames[0];console.log("Starting with role",this.selectedRoleName);return[3,4];case 3:r=d.sent();console.log("[FIELDS] Error loading template",r);(e=this.sdkError)===null||e===void 0?void 0:e.emit(new l(r.message,(t=r.response)===null||t===void 0?void 0:t.status,(i=r.response)===null||i===void 0?void 0:i.data));return[3,4];case 4:return[3,6];case 5:s=d.sent();console.log("[FIELDS] Error with preview session",s);(a=this.sdkError)===null||a===void 0?void 0:a.emit(new l(s.message,(n=s.response)===null||n===void 0?void 0:n.status,(o=s.response)===null||o===void 0?void 0:o.data));return[3,6];case 6:return[2]}}))}))};e.prototype.componentDidRender=function(){d.dynamicDrop(true)};e.prototype.handleFieldChange=function(e,t,i){return __awaiter(this,void 0,void 0,(function(){return __generator(this,(function(a){console.log("[FIELDS] handleFieldChange",e,t,i);return[2]}))}))};e.prototype.attachFieldAttributes=function(e,t,i,a){var n=this;a.addEventListener("input",(function(e){return n.handleFieldChange(t,e)}));a.addEventListener("settingsChanged",(function(){a.setAttribute("roleindex",h(f.roleNames,t.role_name))}));a.setAttribute("roleindex",i);a.setAttribute("pageNumber",e.pageNumber);a.setAttribute("xScale",e.xScale);a.setAttribute("yScale",e.yScale);a.setAttribute("name",t.name)};e.prototype.handlePageRendered=function(e){var t=this;var i=e.detail;console.log("[FIELDS] Page rendered",i);this.cachedPageInfo[i.pageNumber]=i;this.pageHeights[i.pageNumber]=i.naturalHeight;var a=f.fields.filter((function(e){return e.page_sequence===i.pageNumber}));console.log("[FIELDS] Fields on page",a);a.forEach((function(e){var a=h(f.roleNames,e.role_name);var n=u(e,i,a,{disabled:true,editable:true,draggable:true});if(!n){return}if(Array.isArray(n)){n.map((function(n){return t.attachFieldAttributes(i,e,a,n)}))}else{t.attachFieldAttributes(i,e,a,n)}d(n).draggable({listeners:{start:function(e){console.log("[FIELDS] Drag started",e.type,e.target)},move:function(e){var t=+(e.target.getAttribute("posX")||0);var i=+(e.target.getAttribute("posY")||0);var a=+(e.target.getAttribute("xScale")||1);var n=+(e.target.getAttribute("yScale")||1);var o=e.dx/a+t;var r=e.dy/n+i;e.target.setAttribute("posX",o);e.target.setAttribute("posy",r);g(e.target,"translate","".concat(o,"px, ").concat(r,"px"))},end:t.handleMoveField.bind(t)}})}))};e.prototype.handleMoveField=function(e){return __awaiter(this,void 0,void 0,(function(){var t,i,a,n,o,r,s,l,d,p,h,u,g,m,v,x,w,b;return __generator(this,(function(y){switch(y.label){case 0:t=e.target.getAttribute("pageNumber");i=this.cachedPageInfo[t],a=i.naturalWidth,n=a===void 0?612:a,o=i.naturalHeight,r=o===void 0?792:o,s=i.renderedHeight,l=s===void 0?792:s;console.log("[FIELDS] Drag ended",t,e.target);d=e.target.getBoundingClientRect();p=e.target.parentElement;h=p.getBoundingClientRect();u=Math.max(d.left-h.left,0);g=Math.max(l-(h.bottom-d.bottom),0);m=this.viewCoordinatesToPageCoordinates(u,g,t,n-e.rect.width,r-e.rect.height),v=m.x,x=m.y;w=e.target.getAttribute("name");b=f.fields.find((function(e){return e.name===w}));if(!b)return[3,2];b.setting.x=v;b.setting.y=x;return[4,c(this.endpoint,this.templateId,w,b)];case 1:y.sent();this.handlePageRendered({detail:this.cachedPageInfo[t]});y.label=2;case 2:return[2]}}))}))};e.prototype.generateFieldName=function(e,t){var i;var a=(i=f.template.pages)===null||i===void 0?void 0:i[t-1];var n=(a===null||a===void 0?void 0:a.fields)||[];return"".concat(e,"P").concat(t,"-").concat(n.length)};e.prototype.viewCoordinatesToPageCoordinates=function(e,t,i,a,n){var o=this.cachedPageInfo[i],r=o.xScale,s=r===void 0?1:r,l=o.yScale,d=l===void 0?1:l,c=o.renderedHeight,p=c===void 0?792:c;var h=Math.floor(Math.min(e/s,a));var u=Math.floor(Math.min(Math.max(p-t,0)/d,n));return{x:h,y:u}};e.prototype.handleClickPage=function(e,t){return __awaiter(this,void 0,void 0,(function(){var i,a,n,o,r,s,l,d,c,h,u,g,x,w,b;return __generator(this,(function(y){switch(y.label){case 0:if(!this.placing)return[3,2];i=t.sequence;a=e.offsetX;n=e.offsetY;o=m(this.placing);r=v(this.placing);s=this.cachedPageInfo[i],l=s.naturalWidth,d=l===void 0?612:l,c=s.naturalHeight,h=c===void 0?792:c;u=this.viewCoordinatesToPageCoordinates(a,n,i,d-o,h-r),g=u.x,x=u.y;w={name:this.generateFieldName(this.placing,i),role_name:this.selectedRoleName,template_id:this.templateId,type:this.placing,required:true,page_sequence:i,validator:null,setting:{x:g,y:x}};switch(w.type){case"attachment":case"payment":w.setting={x:g,y:x};break;case"initial":case"signature":w.setting={x:g,y:x,result:""};break;case"checkbox_group":w.setting={x:g,y:x,minimum_checked:0,maximum_checked:1e3};break;case"date":w.setting={x:g,y:x,width:o,height:r,result:""};break;case"dropdown":w.setting={x:g,y:x,width:o,height:r,value:"",placeholder:"Select a value"};break;case"radio_button_group":w.setting={x:g,y:x};break;case"textbox":w.setting={x:g,y:x,width:o,height:r,result:"",leading:0,alignment:0,upperCase:false};break;case"timestamp":w.setting={x:g,y:x,width:o,height:r};break}return[4,p(this.endpoint,this.templateId,w)];case 1:b=y.sent();console.log("Saved field",b);f.fields.push(b);this.placing=null;this.handlePageRendered({detail:this.cachedPageInfo[i]});y.label=2;case 2:return[2]}}))}))};e.prototype.render=function(){var e;var t=this;console.log("rendering",f.updateCount);if(!this.endpoint.session){return a(n,null,a("verdocs-component-error",{message:"You must be authenticated to use this module."}))}if(f.loading||!f.template){return a(n,null,a("verdocs-loader",null))}var i=__spreadArray([],f.template.pages,true);i.sort((function(e,t){return e.sequence-t.sequence}));return a(n,{class:this.placing?(e={},e["placing-".concat(this.placing)]=true,e):{},"data-updated":f.updateCount,onSubmit:function(){console.log("onSubmit")}},a("div",{class:"pages"},i.map((function(e){return a("verdocs-document-page",{pageImageUri:e.display_uri,virtualWidth:612,virtualHeight:792,onClick:function(i){return t.handleClickPage(i,e)},pageNumber:e.sequence,onPageRendered:function(e){return t.handlePageRendered(e)},layers:[{name:"page",type:"canvas"},{name:"controls",type:"div"}]})}))),a("verdocs-floating-menu",{options:H,onOptionSelected:function(e){t.placing=e.detail.id}}))};return e}());A.style=C}}}));