PageSourceSearch

https://live.onlinecheckwriter.com/chunk-ESE4XDLZ.js

js onlinecheckwriter.com collected 2026-09-24 10:28:07 UTC 123,037 bytes, 5 lines download raw bytes

1import{a as Bt}from"./chunk-7X7QQYWM.js";import{a as Ot}from"./chunk-OQC4FLYL.js";import{a as Wt}from"./chunk-AGIVA6CF.js";import"./chunk-54PJY22Z.js";import{Ea as zt,Ha as At,I as kt,Oa as Lt,ba as Rt,ca as Dt,l as It,m as Mt,sa as Nt,w as Vt}from"./chunk-R35UZKA5.js";import{d as lt}from"./chunk-JVCDKIRW.js";import{f as Je,h as Ze}from"./chunk-W5AW4RNE.js";import"./chunk-P7TPNQXK.js";import{e as rt}from"./chunk-EHZDUKHY.js";import"./chunk-WJNF6B7D.js";import{a as Q}from"./chunk-DBDCXSIX.js";import{a as Ke}from"./chunk-UXBKBV52.js";import"./chunk-7F5QZ2WZ.js";import"./chunk-NTW5O2WI.js";import{M as wt,N as Ft,O as Pt,P as Tt,Q as Et}from"./chunk-CMAA65ZX.js";import{$b as pt,Qb as ct,Sc as gt,Sd as _t,V as dt,Ve as Te,Yc as ht,b as j,d as st,fc as ut,fe as xt,ge as Ct,ie as me,kf as St,nf as bt,qe as yt,rd as ft,re as vt,uc as Pe,wc as mt}from"./chunk-5EI2LJU6.js";import{Ia as ee,Ja as te,Ka as et,La as tt}from"./chunk-O3SHBMLD.js";import{A as we,B as Fe,E as at,K as ue,b as ve,c as Se,h as ce,o as pe,q as be,x as it,y as nt,z as ot}from"./chunk-JGAQJZZ3.js";import"./chunk-EC66NZTI.js";import{g as Qe}from"./chunk-OU7XOOXQ.js";import{$c as ne,Ba as Y,Cc as le,Dc as se,Ec as de,Jb as ie,Jc as u,Kc as q,L as Oe,Lc as D,Ma as f,Mc as Ye,N as U,Na as _,Sb as M,Sc as z,Tc as A,U as Me,Ua as Be,Uc as L,Vb as qe,Vd as ye,Wb as m,Wc as G,Xa as $e,Xb as $,Xc as O,Ya as Ve,Yb as ke,Yc as Ge,Zc as H,bd as je,cc as E,dc as He,f as We,fc as ae,gc as re,hc as a,ic as l,jc as b,me as K,nc as R,pb as fe,qc as S,sc as p,ub as oe,va as N,vc as Ue,wb as s,yd as Xe}from"./chunk-6OTMHPV4.js";import{a as W,b as Ee,j as Ie}from"./chunk-3EYC4JTX.js";var Zt=["signPad"],qt=()=>({style:"bordered",name:"main"}),Kt=()=>({style:"filled",name:"main"}),Re=(r,y)=>({"text-common-green-color":r,"text-secondary-text-color":y}),De=(r,y)=>({"bg-common-green-color":r,"bg-secondary-background-color":y}),Ne=(r,y)=>({"text-white":r,"text-secondary-text-color":y}),ge=(r,y,e,t)=>({"bg-common-secondary-green-color":r,"border-common-green-color":y,"bg-main-background-color":e,"border-input-border-color":t}),ei=()=>({style:"filled-blue",name:"action"});function ti(r,y){r&1&&b(0,"div",14)}function ii(r,y){r&1&&b(0,"div",14)}function ni(r,y){r&1&&b(0,"div",14)}function oi(r,y){r&1&&(a(0,"span",21),u(1,"* This signature is required to proceed."),l())}function ai(r,y){if(r&1&&b(0,"fa-icon",24),r&2){let e=p(3);m("icon",e.faCheck)}}function ri(r,y){r&1&&b(0,"div",28)}function li(r,y){if(r&1&&b(0,"fa-icon",24),r&2){let e=p(3);m("icon",e.faCheck)}}function si(r,y){r&1&&b(0,"div",28)}function di(r,y){if(r&1&&b(0,"fa-icon",24),r&2){let e=p(3);m("icon",e.faCheck)}}function ci(r,y){r&1&&b(0,"div",28)}function pi(r,y){r&1&&(a(0,"span",21),u(1,"* This initial is required to proceed."),l())}function ui(r,y){r&1&&(a(0,"span",27),u(1,"A"),l())}function mi(r,y){r&1&&b(0,"div",28)}function gi(r,y){r&1&&(a(0,"span",27),u(1,"A"),l())}function hi(r,y){r&1&&b(0,"div",28)}function fi(r,y){r&1&&(a(0,"span",27),u(1,"A"),l())}function _i(r,y){r&1&&b(0,"div",28)}function xi(r,y){if(r&1){let e=R();a(0,"div",15)(1,"div",18)(2,"h4",19),u(3,"Signature"),l(),a(4,"app-common-input-field",20),L("ngModelChange",function(i){f(e);let n=p(2);return A(n.signatureText,i)||(n.signatureText=i),_(i)}),S("ngModelChange",function(){f(e);let i=p(2);return _(i.onSignatureTextChange())})("inputFocusOutEvent",function(){f(e);let i=p(2);return _(i.onSignatureTextBlur())}),l(),M(5,oi,2,0,"span",21),a(6,"div",22)(7,"button",23),S("click",function(){f(e);let i=p(2);return _(i.selectSignatureStyle("cursive"))}),M(8,ai,1,1,"fa-icon",24)(9,ri,1,0),a(10,"span",25),u(11),l()(),a(12,"button",23),S("click",function(){f(e);let i=p(2);return _(i.selectSignatureStyle("standard"))}),M(13,li,1,1,"fa-icon",24)(14,si,1,0),a(15,"span",25),u(16),l()(),a(17,"button",23),S("click",function(){f(e);let i=p(2);return _(i.selectSignatureStyle("bold"))}),M(18,di,1,1,"fa-icon",24)(19,ci,1,0),a(20,"span",25),u(21),l()()()(),a(22,"div",18)(23,"h4",19),u(24,"Initial"),l(),a(25,"app-common-input-field",26),L("ngModelChange",function(i){f(e);let n=p(2);return A(n.initialText,i)||(n.initialText=i),_(i)}),S("ngModelChange",function(){f(e);let i=p(2);return _(i.onInitialTextChange())})("inputFocusOutEvent",function(){f(e);let i=p(2);return _(i.onInitialTextBlur())}),l(),M(26,pi,2,0,"span",21),a(27,"div",22)(28,"button",23),S("click",function(){f(e);let i=p(2);return _(i.selectInitialStyle("cursive"))}),M(29,ui,2,0,"span",27)(30,mi,1,0),a(31,"span",25),u(32),l()(),a(33,"button",23),S("click",function(){f(e);let i=p(2);return _(i.selectInitialStyle("standard"))}),M(34,gi,2,0,"span",27)(35,hi,1,0),a(36,"span",25),u(37),l()(),a(38,"button",23),S("click",function(){f(e);let i=p(2);return _(i.selectInitialStyle("bold"))}),M(39,fi,2,0,"span",27)(40,_i,1,0),a(41,"span",25),u(42),l()()()()()}if(r&2){let e=p(2);s(4),z("ngModel",e.signatureText),m("maxlength",100),s(),E(5,e.signatureError?5:-1),s(2),m("ngClass",ne(48,ge,e.selectedSignatureStyle==="cursive",e.selectedSignatureStyle==="cursive",e.selectedSignatureStyle!=="cursive",e.selectedSignatureStyle!=="cursive")),s(),E(8,e.selectedSignatureStyle==="cursive"?8:9),s(2),$("font-family",e.getSignatureFontFamily("cursive"))("font-weight",e.getSignatureFontWeight("cursive")),s(),D(" ",e.signatureText||"Signature"," "),s(),m("ngClass",ne(53,ge,e.
1selectedSignatureStyle==="standard",e.selectedSignatureStyle==="standard",e.selectedSignatureStyle!=="standard",e.selectedSignatureStyle!=="standard")),s(),E(13,e.selectedSignatureStyle==="standard"?13:14),s(2),$("font-family",e.getSignatureFontFamily("standard"))("font-weight",e.getSignatureFontWeight("standard")),s(),D(" ",e.signatureText||"Signature"," "),s(),m("ngClass",ne(58,ge,e.selectedSignatureStyle==="bold",e.selectedSignatureStyle==="bold",e.selectedSignatureStyle!=="bold",e.selectedSignatureStyle!=="bold")),s(),E(18,e.selectedSignatureStyle==="bold"?18:19),s(2),$("font-family",e.getSignatureFontFamily("bold"))("font-weight",e.getSignatureFontWeight("bold")),s(),D(" ",e.signatureText||"Signature"," "),s(4),z("ngModel",e.initialText),m("maxlength",10),s(),E(26,e.initialError?26:-1),s(2),m("ngClass",ne(63,ge,e.selectedInitialStyle==="cursive",e.selectedInitialStyle==="cursive",e.selectedInitialStyle!=="cursive",e.selectedInitialStyle!=="cursive")),s(),E(29,e.selectedInitialStyle==="cursive"?29:30),s(2),$("font-family",e.getSignatureFontFamily("cursive"))("font-weight",e.getSignatureFontWeight("cursive")),s(),D(" ",e.initialText||"A"," "),s(),m("ngClass",ne(68,ge,e.selectedInitialStyle==="standard",e.selectedInitialStyle==="standard",e.selectedInitialStyle!=="standard",e.selectedInitialStyle!=="standard")),s(),E(34,e.selectedInitialStyle==="standard"?34:35),s(2),$("font-family",e.getSignatureFontFamily("standard"))("font-weight",e.getSignatureFontWeight("standard")),s(),D(" ",e.initialText||"A"," "),s(),m("ngClass",ne(73,ge,e.selectedInitialStyle==="bold",e.selectedInitialStyle==="bold",e.selectedInitialStyle!=="bold",e.selectedInitialStyle!=="bold")),s(),E(39,e.selectedInitialStyle==="bold"?39:40),s(2),$("font-family",e.getSignatureFontFamily("bold"))("font-weight",e.getSignatureFontWeight("bold")),s(),D(" ",e.initialText||"A"," ")}}function Ci(r,y){if(r&1){let e=R();a(0,"div",29),b(1,"img",30),l(),a(2,"div",31)(3,"button",32),S("click",function(){f(e);let i=p(3);return _(i.openSignaturePanel())}),u(4),l(),a(5,"button",33),S("click",function(){f(e);let i=p(3);return _(i.clearSignature())}),b(6,"fa-icon",34),a(7,"span"),u(8,"Clear"),l()()()}if(r&2){let e=p(3);s(),m("src",e.signatureDataUrl.startsWith("data:")?e.signatureDataUrl:"data:image/png;base64,"+e.signatureDataUrl,fe)("alt",e.fieldType==="signature"?"Signature":"Initial"),s(3),D(" Change ",e.fieldType==="signature"?"Signature":"Initial"," "),s(2),m("icon",e.faTrashCan)}}function yi(r,y){if(r&1&&(a(0,"div",37)(1,"span",39),u(2),l()()),r&2){let e=p(4);s(2),q(e.fieldType==="signature"?"Sign Here":"Initial Here")}}function vi(r,y){if(r&1){let e=R();a(0,"div",16)(1,"div",35),b(2,"canvas",36,0),M(4,yi,3,1,"div",37),l(),a(5,"div",31)(6,"button",33),S("click",function(){f(e);let i=p(3);return _(i.clearSignature())}),b(7,"fa-icon",34),a(8,"span"),u(9,"Clear"),l()(),a(10,"button",38),S("click",function(){f(e);let i=p(3);return _(i.saveSignature())}),u(11),l()()()}if(r&2){let e=p(3);s(2),$("height",200,"px"),s(2),E(4,e.signaturePad!=null&&e.signaturePad.isEmpty()?4:-1),s(3),m("icon",e.faTrashCan),s(3),m("disabled",e.signaturePad==null?null:e.signaturePad.isEmpty()),s(),D(" Save ",e.fieldType==="signature"?"Signature":"Initial"," ")}}function Si(r,y){if(r&1){let e=R();a(0,"div",40)(1,"div",41)(2,"p",42),u(3),l(),a(4,"p",43),u(5),l(),a(6,"div",44)(7,"app-common-button-v35",45),S("clickEvent",function(){f(e);let i=p(3);return _(i.openSignaturePanel())}),l()()()()}if(r&2){let e=p(3);s(3),D("Create Your ",e.fieldType==="signature"?"Signature":"Initial",""),s(2),D("Draw ",e.fieldType==="signature"?"your signature":"your initial"," or upload an image"),s(2),m("type",O(4,ei))("text","Draw "+(e.fieldType==="signature"?"Signature":"Initial"))}}function bi(r,y){if(r&1&&(a(0,"div",16),M(1,Ci,9,4)(2,vi,12,6)(3,Si,8,5),l()),r&2){let e=p(2);s(),E(1,e.signatureDataUrl&&!e.showSignaturePad?1:e.showSignaturePad?2:3)}}function wi(r,y){if(r&1){let e=R();a(0,"div",29),b(1,"img",30),l(),a(2,"div",31)(3,"button",32),S("click",function(){f(e);let i=p(3);return _(i.triggerFileInput())}),u(4),l(),a(5,"button",33),S("click",function(){f(e);let i=p(3);return _(i.clearSignature())}),b(6,"fa-icon",34),a(7,"span"),u(8,"Clear"),l()()()}if(r&2){let e=p(3);
1s(),m("src",e.signatureDataUrl.startsWith("data:")?e.signatureDataUrl:"data:image/png;base64,"+e.signatureDataUrl,fe)("alt",e.fieldType==="signature"?"Signature":"Initial"),s(3),D(" Change ",e.fieldType==="signature"?"Signature":"Initial"," "),s(2),m("icon",e.faTrashCan)}}function Fi(r,y){if(r&1){let e=R();a(0,"div",40)(1,"div",41)(2,"p",42),u(3),l(),a(4,"p",43),u(5,"Upload an image file (PNG, JPG, JPEG, or GIF)"),l(),a(6,"input",46),S("change",function(i){f(e);let n=p(3);return _(n.onFileSelected(i))}),l(),a(7,"div",47)(8,"app-common-button-v35",48),S("clickEvent",function(){f(e);let i=p(3);return _(i.triggerFileInput())}),l()()()()}if(r&2){let e=p(3);s(3),D("Upload Your ",e.fieldType==="signature"?"Signature":"Initial",""),s(5),m("type",O(2,qt))}}function Pi(r,y){if(r&1&&(a(0,"div",16),M(1,wi,9,4)(2,Fi,9,3),l()),r&2){let e=p(2);s(),E(1,e.signatureDataUrl&&!e.showSignaturePad?1:2)}}function Ti(r,y){r&1&&(a(0,"span",21),u(1,"* This acknowledgment is required to proceed."),l())}function Ei(r,y){if(r&1){let e=R();a(0,"div",17)(1,"div",49)(2,"input",50),L("ngModelChange",function(i){f(e);let n=p(2);return A(n.acknowledgmentChecked,i)||(n.acknowledgmentChecked=i),_(i)}),S("ngModelChange",function(){f(e);let i=p(2);return _(i.onAcknowledmentChange())}),l(),a(3,"label",51),u(4," I acknowledge that my signature and initial along with other profile information will be automatically filled in all the remaining applicable fields across the document(s). "),l()(),M(5,Ti,2,0,"span",21),l()}if(r&2){let e=p(2);s(2),z("ngModel",e.acknowledgmentChecked),s(3),E(5,e.acknowledgmentError?5:-1)}}function Ii(r,y){if(r&1){let e=R();a(0,"div",9)(1,"button",10),S("click",function(){f(e);let i=p();return _(i.setActiveTab("TYPE"))}),a(2,"div",11),b(3,"fa-icon",12),l(),a(4,"span",13),u(5,"TYPE"),l(),M(6,ti,1,0,"div",14),l(),a(7,"button",10),S("click",function(){f(e);let i=p();return _(i.setActiveTab("DRAW"))}),a(8,"div",11),b(9,"fa-icon",12),l(),a(10,"span",13),u(11,"DRAW"),l(),M(12,ii,1,0,"div",14),l(),a(13,"button",10),S("click",function(){f(e);let i=p();return _(i.setActiveTab("UPLOAD"))}),a(14,"div",11),b(15,"fa-icon",12),l(),a(16,"span",13),u(17,"UPLOAD"),l(),M(18,ni,1,0,"div",14),l()(),M(19,xi,43,78,"div",15)(20,bi,4,1,"div",16)(21,Pi,3,1,"div",16)(22,Ei,6,2,"div",17)}if(r&2){let e=p();s(),m("ngClass",H(19,Re,e.activeTab==="TYPE",e.activeTab!=="TYPE")),s(),m("ngClass",H(22,De,e.activeTab==="TYPE",e.activeTab!=="TYPE")),s(),m("icon",e.faFont)("ngClass",H(25,Ne,e.activeTab==="TYPE",e.activeTab!=="TYPE")),s(3),E(6,e.activeTab==="TYPE"?6:-1),s(),m("ngClass",H(28,Re,e.activeTab==="DRAW",e.activeTab!=="DRAW")),s(),m("ngClass",H(31,De,e.activeTab==="DRAW",e.activeTab!=="DRAW")),s(),m("icon",e.faPen)("ngClass",H(34,Ne,e.activeTab==="DRAW",e.activeTab!=="DRAW")),s(3),E(12,e.activeTab==="DRAW"?12:-1),s(),m("ngClass",H(37,Re,e.activeTab==="UPLOAD",e.activeTab!=="UPLOAD")),s(),m("ngClass",H(40,De,e.activeTab==="UPLOAD",e.activeTab!=="UPLOAD")),s(),m("icon",e.faUpload)("ngClass",H(43,Ne,e.activeTab==="UPLOAD",e.activeTab!=="UPLOAD")),s(3),E(18,e.activeTab==="UPLOAD"?18:-1),s(),E(19,e.activeTab==="TYPE"?19:-1),s(),E(20,e.activeTab==="DRAW"?20:-1),s(),E(21,e.activeTab==="UPLOAD"?21:-1),s(),E(22,e.activeTab==="TYPE"?22:-1)}}function Mi(r,y){if(r&1){let e=R();a(0,"div",16)(1,"app-common-input-field",52),L("ngModelChange",function(i){f(e);let n=p();return A(n.textValue,i)||(n.textValue=i),_(i)}),l()()}if(r&2){let e=p();s(),m("placeholder",e.getPlaceholder()),z("ngModel",e.textValue),m("type",e.getInputType())("maxlength",100)("isFieldRequired",!0)}}var ze=(()=>{class r{constructor(){this.dialogRef=N(ee),this.data=N(te),this.field=this.data.field,this.fieldType=this.data.fieldType,this.faXmark=me,this.faTrashCan=st,this.faFont=_t,this.faPen=ut,this.faUpload=ft,this.faCheck=Te,this.activeTab="TYPE",this.signatureDataUrl="",this.textValue="",this.signatureText="",this.initialText="",this.selectedSignatureStyle="cursive",this.selectedInitialStyle="cursive",this.acknowledgmentChecked=!1,this.acknowledgmentError=!1,this.initialError=!1,this.signatureError=!1,this.signaturePad=null,this.showSignaturePad=!1,this.isDrawing=!1}ngOnInit(){if(this.isImageField()&&(this.activeTab="TYPE"),this.fieldType==="initial"&&this.data.prefilledInitials&&(this.initialText=this.data.prefilledInitials),this.fieldType==="signature"&&this.signatureText){this.selectInitialStyle(this.selectedSignatureStyle),this.get
1SignatureFontFamily(this.selectedSignatureStyle),this.getSignatureFontWeight(this.selectedSignatureStyle);let e=this.extractInitials(this.signatureText);e&&!this.initialText&&(this.initialText=e,this.selectedInitialStyle=this.selectedSignatureStyle)}}ngAfterViewInit(){this.showSignaturePad&&this.signPad&&setTimeout(()=>{this.initSignaturePad()},100)}initSignaturePad(){this.signPad?.nativeElement&&(this.signaturePad=new Ot(this.signPad.nativeElement,{backgroundColor:"rgb(255, 255, 255)",penColor:"rgb(0, 0, 0)"}),this.resizeCanvas())}resizeCanvas(){if(!this.signPad?.nativeElement||!this.signaturePad)return;let e=this.signPad.nativeElement,t=e.getBoundingClientRect(),i=window.devicePixelRatio||1;e.width=t.width*i,e.height=t.height*i,e.style.width=t.width+"px",e.style.height=t.height+"px";let n=e.getContext("2d");n&&n.scale(i,i),this.signaturePad.clear()}openSignaturePanel(){this.signaturePad&&(this.signaturePad=null),this.showSignaturePad=!0,setTimeout(()=>{!this.signaturePad&&this.signPad?.nativeElement&&this.initSignaturePad()},100)}clearSignature(){this.signaturePad&&(this.signaturePad.clear(),this.signaturePad=null),this.signatureDataUrl="",this.showSignaturePad=!1}saveSignature(){if(!this.signaturePad||this.signaturePad.isEmpty())return;let e=this.signaturePad.toDataURL("image/png");this.signatureDataUrl=e.split(",")[1]||e,this.showSignaturePad=!1}onFileSelected(e){let t=e.target;if(t.files&&t.files[0]){let i=t.files[0];if(!i.type.match(/^image\/(png|jpg|jpeg|gif)$/)){alert("Please select a valid image file (PNG, JPG, JPEG, or GIF)");return}if(i.size>5*1024*1024){alert("File size must be less than 5MB");return}let n=new FileReader;n.onload=o=>{if(o.target?.result){let c=o.target.result;this.signatureDataUrl=c.split(",")[1]||c,this.showSignaturePad=!1}},n.readAsDataURL(i)}}triggerFileInput(){document.getElementById("signature-file-input")?.click()}isImageField(){return this.fieldType==="signature"||this.fieldType==="initial"}isTextField(){return!this.isImageField()}getFieldLabel(){return{signature:"Sign Here",initial:"Initial Here",name:"Enter Full Name",sign_date:"Enter Sign Date",company:"Enter Company Name",title:"Enter Job Title",date:"Enter Date",text:"Enter Text",email:"Enter Email",checkbox:"Enter Checkbox",radio:"Enter Radio",attachment:"Enter Attachment"}[this.fieldType]||"Enter Value"}getPlaceholder(){return{signature:"Sign Here",initial:"Initial Here",name:"Enter your full name",sign_date:"MM/DD/YYYY",company:"Enter company name",title:"Enter job title",date:"MM/DD/YYYY",text:"Enter text",email:"Enter email address",checkbox:"Enter checkbox",radio:"Enter radio",attachment:"Enter attachment"}[this.fieldType]||"Enter value"}getInputType(){return this.fieldType==="email"?"email":this.fieldType==="date"||this.fieldType==="sign_date"?"date":"text"}save(){if(this.isImageField()){if(this.activeTab==="TYPE"){if(this.fieldType==="signature"&&!this.signatureText.trim()){this.signatureError=!0;return}if(this.signatureError=!1,this.fieldType==="initial"&&!this.initialText.trim()){this.initialError=!0;return}if(this.initialError=!1,!this.acknowledgmentChecked){this.acknowledgmentError=!0;return}if(this.acknowledgmentError=!1,this.fieldType==="signature"&&this.signatureText.trim()){let t=this.generateTextSignature(),i=this.initialText||this.extractInitials(this.signatureText);this.dialogRef.close({fieldId:this.field.id,value:t,type:this.fieldType,extractedInitials:i,selectedSignatureStyle:this.selectedSignatureStyle})}else if(this.fieldType==="initial"&&this.initialText.trim()){let t=this.generateTextInitial();this.dialogRef.close({fieldId:this.field.id,value:t,type:this.fieldType,selectedInitialStyle:this.selectedInitialStyle})}return}if(this.activeTab==="DRAW"&&this.signaturePad&&!this.signaturePad.isEmpty()&&!this.signatureDataUrl&&this.saveSignature(),!this.signatureDataUrl)return;let e=this.signatureDataUrl;e.includes(",")&&(e=e.split(",")[1]),this.dialogRef.close({fieldId:this.field.id,value:e,type:this.fieldType,selectedSignatureStyle:this.selectedSignatureStyle})}else{if(!this.textValue.trim())return;this.dialogRef.close({fieldId:this.field.id,value:this.textValue.trim(),type:this.fieldType,selectedInitialStyle:this.selectedInitialStyle})}}cancel(){this.dialogRef.close(null)}get canSave(){return this.isImageField()?this.activeTab==="TYPE"?!!(this.signatureText.trim()||this.initialText.trim())&&this.acknowledgmentChecked:this.activeTab==="DRAW"?!!this.signatureDataUrl||!!this.signaturePad&&!this.signaturePad.isEmpty():!!this.signatureDataUrl:!!this.textValue.trim()}setActiveTab(e){this.activeTab=e,e==="DRAW"?!this.showSignaturePad&&!this.signatureDataUrl&&setTimeout(()=>{this.openSignaturePanel()},100):e==="UPLOAD"?this.showSignaturePad=!1:e==="TYPE"&&(this.showSignaturePad=!1)}selectSignatureStyle(e){this.selectedSignatureStyle=e,this.fieldType==="signature"&&this.signatureText.trim()&&this.initialText.trim()&&this.extractInitials(this.signatureText)===this.initialText&&(this.selectedInitialStyle=e)}selectInitialStyle(e){this.selectedInitialStyle=e}getSignatureFontFamily(e){switch(e){case"cursive":return"Dancing Script, cursive";case"bold":return"Arial, sans-serif";default:return"Arial, sans-serif"}}getSignatureFontWeight(e){return e==="bold"?"bold":"normal"}generateTextSignature(){let e=document.createElement("canvas"),t=e.getContext("2d");if(!t)return"";let i=this.getSignatureFontFamily(this.selectedSignatureStyle),n=this.getSignatureFontWeight(this.selectedSignatureStyle),o=48;t.font=`${n} ${o}px ${i}`;let c=this.signatureText||"",d=t.measureText(c);
1return e.width=d.width+40,e.height=o+40,t.font=`${n} ${o}px ${i}`,t.fillStyle="#000000",t.fillText(c,20,o+10),e.toDataURL("image/png").split(",")[1]||e.toDataURL("image/png")}generateTextInitial(){let e=document.createElement("canvas"),t=e.getContext("2d");if(!t)return"";let i=this.getSignatureFontFamily(this.selectedInitialStyle),n=this.getSignatureFontWeight(this.selectedInitialStyle),o=48;t.font=`${n} ${o}px ${i}`;let c=this.initialText||"",d=t.measureText(c);return e.width=d.width+40,e.height=o+40,t.font=`${n} ${o}px ${i}`,t.fillStyle="#000000",t.fillText(c,20,o+10),e.toDataURL("image/png").split(",")[1]||e.toDataURL("image/png")}extractInitials(e){if(!e||!e.trim())return"";let t=e.trim().split(/\s+/).filter(o=>o.length>0);if(t.length===0)return"";if(t.length===1)return t[0].charAt(0).toUpperCase();let i=t[0].charAt(0).toUpperCase(),n=t[t.length-1].charAt(0).toUpperCase();return i+n}onAcknowledmentChange(){this.acknowledgmentChecked?this.acknowledgmentError=!1:(this.signatureText.trim()||this.initialText.trim())&&(this.acknowledgmentError=!0)}onSignatureTextChange(){if(this.fieldType==="signature"&&this.signatureText.trim()){this.signatureError=!1;let e=this.extractInitials(this.signatureText);e&&(this.initialText=e)}else this.fieldType==="signature"&&!this.signatureText.trim()&&(this.initialText="")}onInitialTextChange(){this.selectInitialStyle(this.selectedSignatureStyle),this.getSignatureFontFamily(this.selectedSignatureStyle),this.getSignatureFontWeight(this.selectedSignatureStyle),this.fieldType==="initial"&&this.initialText.trim()&&(this.initialError=!1)}onInitialTextBlur(){this.fieldType==="initial"&&!this.initialText.trim()?this.initialError=!0:this.initialError=!1}onSignatureTextBlur(){this.fieldType==="signature"&&!this.signatureText.trim()?this.signatureError=!0:this.signatureError=!1}static{this.\u0275fac=function(t){return new(t||r)}}static{this.\u0275cmp=Y({type:r,selectors:[["app-field-input-modal"]],viewQuery:function(t,i){if(t&1&&le(Zt,5),t&2){let n;se(n=de())&&(i.signPad=n.first)}},standalone:!0,features:[G],decls:11,vars:7,consts:[["signPad",""],[1,"flex","flex-col","gap-4","bg-main-background-color","min-w-[600px]","max-w-[700px]"],[1,"flex","items-center","justify-between"],[1,"text-lg","font-semibold","text-main-text-color"],[1,"text-secondary-text-color","hover:text-main-text-color","transition-colors","p-1",3,"click"],[1,"text-sm",3,"icon"],[1,"flex","gap-3","justify-end","pt-4","border-t","border-input-border-color"],["text","Cancel",3,"clickEvent","type"],["text","Ok","customClasses","!h-[38px] !bg-common-green-color hover:!bg-common-tertiary-green-color !w-[46px] ",3,"clickEvent","type"],[1,"flex","gap-4","border-b","border-input-border-color"],[1,"flex","items-center","gap-2","pb-3","px-2","transition-colors","relative",3,"click","ngClass"],[1,"w-6","h-6","rounded-full","flex","items-center","justify-center",3,"ngClass"],[1,"text-xs",3,"icon","ngClass"],[1,"text-sm","font-medium"],[1,"absolute","bottom-0","left-0","right-0","h-0.5","bg-common-green-color"],[1,"flex","gap-6"],[1,"flex","flex-col","gap-3"],[1,"flex","flex-col","gap-1","pt-2"],[1,"flex-1","flex","flex-col","gap-3"],[1,"text-base","font-semibold","text-main-text-color"],["placeholder","Enter signature","type","text",3,"ngModelChange","inputFocusOutEvent","ngModel","maxlength"],[1,"required","text-xs"],[1,"flex","flex-col","gap-2"],[1,"flex","items-center","gap-2","p-3","rounded-lg","border-2","transition-colors",3,"click","ngClass"],[1,"text-common-green-color","text-sm",3,"icon"],[1,"flex-1","text-left"],["placeholder","Enter initial","type","text",3,"ngModelChange","inputFocusOutEvent","ngModel","maxlength"],[1,"text-common-green-color","text-sm","font-bold"],[1,"w-4"],[1,"border-2","border-input-border-color","rounded-lg","bg-secondary-background-color","p-4","relative"],[1,"w-full","h-auto","max-h-[200px]","object-contain",3,"src","alt"],[1,"flex","gap-2"],[1,"text-sm","text-secondary-text-color","hover:text-main-text-color","transition-colors",3,"click"],[1,"text-sm","text-common-red-color","hover:opacity-80","transition-colors","flex","items-center","gap-1",3,"click"],[1,"text-xs",3,"icon"],[1,"border-2","border-input-border-color","rounded-lg","bg-main-background-color","p-4","relative"],[1,"w-full",2,"touch-action","none","cursor","crosshair"],[1,"absolute","
1inset-0","flex","items-center","justify-center","pointer-events-none"],[1,"text-sm","text-common-blue-color","hover:opacity-80","transition-colors","disabled:opacity-40","disabled:cursor-not-allowed",3,"click","disabled"],[1,"text-secondary-text-color","text-sm"],[1,"border-2","border-dashed","border-input-border-color","rounded-lg","bg-secondary-background-color","p-8","min-h-[250px]","flex","items-center","justify-center"],[1,"text-center","max-w-sm"],[1,"text-main-text-color","text-base","font-medium","mb-2"],[1,"text-secondary-text-color","text-sm","mb-4"],[1,"flex","flex-row","gap-2","justify-center"],["customClasses","!h-[38px] !min-h-[38px]",3,"clickEvent","type","text"],["type","file","id","signature-file-input","accept","image/png,image/jpeg,image/jpg,image/gif",1,"hidden",3,"change"],[1,"flex","justify-center"],["text","Upload Image",3,"clickEvent","type"],[1,"flex","items-start","gap-2"],["type","checkbox","id","acknowledgment-checkbox",1,"mt-1","w-4","h-4","rounded","text-common-green-color",3,"ngModelChange","ngModel"],["for","acknowledgment-checkbox",1,"text-sm","cursor-pointer"],[3,"ngModelChange","placeholder","ngModel","type","maxlength","isFieldRequired"]],template:function(t,i){t&1&&(a(0,"div",1)(1,"div",2)(2,"h3",3),u(3),l(),a(4,"button",4),S("click",function(){return i.cancel()}),b(5,"fa-icon",5),l()(),M(6,Ii,23,46)(7,Mi,2,5),a(8,"div",6)(9,"app-common-button-v35",7),S("clickEvent",function(){return i.cancel()}),l(),a(10,"app-common-button-v35",8),S("clickEvent",function(){return i.save()}),l()()()),t&2&&(s(3),D(" ",i.getFieldLabel()," "),s(2),m("icon",i.faXmark),s(),E(6,i.isImageField()?6:7),s(3),m("type",O(5,qt)),s(),m("type",O(6,Kt)))},dependencies:[K,ye,ue,ve,ce,at,pe,Q,Wt,j],styles:["canvas[_ngcontent-%COMP%]{display:block;touch-action:none}"]})}}return r})();var Vi=()=>["fas","xmark"],ki=()=>({style:"bordered",name:"main"}),Ri=()=>({style:"modal",name:"main"});function Di(r,y){if(r&1&&(a(0,"div",12)(1,"div",16),u(2),l(),a(3,"div",17),u(4),l()()),r&2){let e=y.$implicit;s(2),q(e.recipientEmail),s(2),q(e.fieldCount)}}var Ht=(()=>{class r{constructor(){this.dialogRef=N(ee),this.data=N(te)}get recipients(){return this.data.recipients||[]}onCancel(){this.dialogRef.close(!1)}onConfirm(){this.dialogRef.close(!0)}static{this.\u0275fac=function(t){return new(t||r)}}static{this.\u0275cmp=Y({type:r,selectors:[["app-confirm-sign-modal"]],standalone:!0,features:[G],decls:23,vars:6,consts:[[1,"px-[6px]","pb-[6px]"],[1,"flex","justify-between","pb-6"],[1,"mt-18","w-full","text-base","text-main-text-color","align-middle","flex","items-center"],[1,"pl-1","font-inter","font-semibold","text-base","pb-0.5"],[3,"click"],[1,"text-secondary-text-color","cursor-pointer",3,"icon"],[1,"text-sm","text-secondary-text-color","mb-5"],[1,"border","border-input-border-color","rounded-md","overflow-hidden"],[1,"flex","bg-secondary-background-color","border-b","border-input-border-color"],[1,"flex-1","px-4","py-3","text-sm","font-semibold","text-main-text-color"],[1,"w-24","px-4","py-3","text-sm","font-semibold","text-main-text-color","text-center"],[1,"bg-main-background-color"],[1,"flex","border-b","border-input-border-color","last:border-b-0"],[1,"flex","justify-end","gap-3","pt-8"],["text","Cancel",3,"click","type"],["text","Confirm",3,"click","type"],[1,"flex-1","px-4","py-3","text-sm","text-main-text-color","break-words"],[1,"w-24","px-4","py-3","text-sm","text-main-text-color","text-center","font-medium"]],template:function(t,i){t&1&&(a(0,"div",0)(1,"div",1)(2,"div")(3,"span",2)(4,"span",3),u(5,"Confirm details"),l()()(),a(6,"div",4),S("click",function(){return i.onCancel()}),b(7,"fa-icon",5),l()(),a(8,"div")(9,"p",6),u(10," Please verify the number of fields added for each recipient and confirm "),l(),a(11,"div",7)(12,"div",8)(13,"div",9),u(14,"Recipient"),l(),a(15,"div",10),u(16,"Fields"),l()(),a(17,"div",11),ae(18,Di,5,2,"div",12,He),l()()(),a(20,"div",13)(21,"app-common-button-v35",14),S("click",function(){return i.onCancel()}),l(),a(22,"app-common-button-v35",15),S("click",function(){return i.onConfirm()}),l()()()),t&2&&(s(7),m("icon",O(3,Vi)),s(11),re(i.recipients),s(3),m("type",O(4,ki)),s(),m("type",O(5,Ri)))},dependencies:[K,j,Q]})}}return r})();var Ut=(()=>
1{class r{constructor(){this.x=0,this.y=0,this.fieldId="",this.menuAction=new Ve,this.closeMenu=new Ve,this.elementRef=N($e),this.faTrash=Pe,this.faCopy=xt}onDocumentClick(e){this.elementRef.nativeElement.contains(e.target)||this.closeMenu.emit()}onDocumentContextMenu(e){this.elementRef.nativeElement.contains(e.target)||this.closeMenu.emit()}onEscape(){this.closeMenu.emit()}onDelete(){this.menuAction.emit({action:"delete",fieldId:this.fieldId}),this.closeMenu.emit()}onPlaceOnOtherPages(){this.menuAction.emit({action:"placeOnOtherPages",fieldId:this.fieldId}),this.closeMenu.emit()}static{this.\u0275fac=function(t){return new(t||r)}}static{this.\u0275cmp=Y({type:r,selectors:[["app-field-context-menu"]],hostBindings:function(t,i){t&1&&S("click",function(o){return i.onDocumentClick(o)},!1,oe)("contextmenu",function(o){return i.onDocumentContextMenu(o)},!1,oe)("keydown.escape",function(){return i.onEscape()},!1,oe)},inputs:{x:"x",y:"y",fieldId:"fieldId"},outputs:{menuAction:"menuAction",closeMenu:"closeMenu"},standalone:!0,features:[G],decls:10,vars:8,consts:[[1,"context-menu","bg-main-background-color","border","border-input-border-color","rounded-lg","shadow-lg","py-1","min-w-[200px]","z-[1000]"],[1,"w-full","px-4","py-2","text-left","text-sm","text-main-text-color","hover:bg-secondary-background-color","flex","items-center","gap-3","transition-colors",3,"click"],[1,"text-secondary-text-color","text-xs","w-4",3,"icon"],[1,"border-t","border-input-border-color","my-1"],[1,"w-full","px-4","py-2","text-left","text-sm","text-common-red-color","hover:bg-secondary-background-color","flex","items-center","gap-3","transition-colors",3,"click"],[1,"text-xs","w-4",3,"icon"]],template:function(t,i){t&1&&(a(0,"div",0)(1,"button",1),S("click",function(){return i.onPlaceOnOtherPages()}),b(2,"fa-icon",2),a(3,"span"),u(4,"Place field(s) on other pages"),l()(),b(5,"div",3),a(6,"button",4),S("click",function(){return i.onDelete()}),b(7,"fa-icon",5),a(8,"span"),u(9,"Delete"),l()()()),t&2&&($("position","fixed")("left",i.x,"px")("top",i.y,"px"),s(2),m("icon",i.faCopy),s(5),m("icon",i.faTrash))},dependencies:[K,j],styles:[".context-menu[_ngcontent-%COMP%]{animation:_ngcontent-%COMP%_fadeIn .1s ease-out}@keyframes _ngcontent-%COMP%_fadeIn{0%{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}"]})}}return r})();var Ni=()=>({style:"bordered",name:"main"}),zi=()=>({style:"modal",name:"main"}),Yt=(()=>{class r{constructor(){this.dialogRef=N(ee),this.data=N(te),this.faXmark=me,this.pageRange="all",this.fromPage=1,this.toPage=this.data?.totalPages||1}isValid(){return this.pageRange==="all"?!0:this.fromPage>=1&&this.toPage<=this.data.totalPages&&this.fromPage<=this.toPage}onCancel(){this.dialogRef.close(null)}onConfirm(){if(!this.isValid())return;let e={pageRange:this.pageRange,fromPage:this.pageRange==="all"?1:this.fromPage,toPage:this.pageRange==="all"?this.data.totalPages:this.toPage};this.dialogRef.close(e)}static{this.\u0275fac=function(t){return new(t||r)}}static{this.\u0275cmp=Y({type:r,selectors:[["app-place-field-modal"]],standalone:!0,features:[G],decls:36,vars:16,consts:[[1,"px-[6px]","pb-[6px]"],[1,"flex","justify-between","pb-6"],[1,"mt-18","w-full","text-base","text-main-text-color","align-middle","flex","items-center"],[1,"pl-1","font-inter","font-semibold","text-base","pb-0.5"],[1,"cursor-pointer",3,"click"],[1,"text-secondary-text-color",3,"icon"],[1,"text-sm","text-main-text-color","mb-5"],[1,"mb-4"],[1,"text-sm","font-semibold","text-main-text-color","mb-3"],[1,"flex","flex-col","gap-3",3,"ngModelChange","ngModel"],["value","all","color","primary"],[1,"text-sm","text-main-text-color"],[1,"flex","items-center","gap-2"],["value","custom","color","primary"],["type","number",1,"w-14","px-2","py-1","border","border-input-border-color","rounded","text-sm","text-main-text-color","bg-main-background-color","text-center",3,"ngModelChange","focus","ngModel","min","max","disabled"],[1,"text-sm","text-secondary-text-color"],[1,"bg-secondary-background-color","border","border-input-border-color","rounded-md","p-3","mt-4"],[1,"text-xs","text-secondary-text-color"],[1,"font-semibold"],[1,"flex","justify-end","gap-3","pt-8"],["text","Cancel",3,"click","type"],["text","Ok",3,"click","type","disabled"]],template:function(t,i){t&1&&(a(0,"div",0)(1,"div",1)(2,"div")(3,"span",2)(4,"span",3),u(5,"Place field(s) on other pages"),l()()(),a(6,"div",4),S("click",function(){return i.onCancel()}),b(7,"fa-icon",5),l()(),a(8,"div")(9,"p",6),u(10," Place the selected field(s) in the exact same position on other pages in: "),l(),a(11,"div",7)(12,"p",8),u(13,"Page range"),l(),a(14,"mat-radio-group",9),L("ngModelChange",function(o){return A(i.pageRange,o)||(i.pageRange=o),o}),a(15,"mat-radio-button",10)(16,"span",11),u(17,"All pages"),l()(),a(18,"div",12)(19,"mat-radio-button",13)(20,"span",11),u(21,"From"),l()(),a(22,"input",14),L("ngModelChange",function(o){return A(i.fromPage,o)||(i.fromPage=o),o}),S("focus",function(){return i.pageRange="custom"}),l(),a(23,"span",11),u(24,"To"),l(),a(25,"input",14),L("ngModelChange",function(o){return A(i.toPage,o)||(i.toPage=o),o}),S("focus",function(){return i.pageRange="custom"}),l(),a(26,"span",15),u(27),l()()()(),a(28,"div",16)(29,"p",17)(30,"span",18),u(31,"Note:"),l(),u(32," Field(s) cannot be placed in the pages with different dimensions "),l()()(),a(33,"div",19)(34,"app-common-button-v35",20),S("click",function(){return i.onCancel()}),l(),a(35,"app-common-button-v35",21),S("click",function(){return i.onConfirm()}),l()()()),t&2&&(s(7),m("icon",i.faXmark),s(7),z("ngModel",i.pageRange),s(8),z("ngModel",i.fromPage),m("min",1)("max",i.data.totalPages)("disabled",i.pageRange!=="custom"),s(3),z("ngModel",i.toPage),m("min",1)("max",i.data.totalPages)("disabled",i.pageRange!=="custom"),s(2),D("out of ",i.data.totalPages," pages."),s(7),m("type",O(14,Ni)),s(),m("type",O(15,zi
1))("disabled",!i.isValid()))},dependencies:[K,ue,Se,be,ce,Fe,we,pe,j,Q,Pt,wt,Ft],styles:["[_nghost-%COMP%]     .mat-mdc-radio-button .mdc-radio__outer-circle{border-color:var(--secondary-text-color)}[_nghost-%COMP%]     .mat-mdc-radio-button.mat-mdc-radio-checked .mdc-radio__outer-circle{border-color:var(--common-green-color)}[_nghost-%COMP%]     .mat-mdc-radio-button.mat-mdc-radio-checked .mdc-radio__inner-circle{background-color:var(--common-green-color);border-color:var(--common-green-color)}input[_ngcontent-%COMP%]:disabled{opacity:.5;cursor:not-allowed}"]})}}return r})();var Ai=()=>["fas","xmark"],Li=()=>({style:"bordered",name:"action"}),Wi=()=>({style:"filled-green",name:"action"}),Gt=(()=>{class r{constructor(){this.dialogRef=N(ee),this.data=N(te),this.email=ie(""),this.username=ie("")}ngOnInit(){this.email.set(this.data.email),this.username.set(this.data.username)}onAgree(){this.dialogRef.close(!0)}static{this.\u0275fac=function(t){return new(t||r)}}static{this.\u0275cmp=Y({type:r,selectors:[["app-sign-agreement-modal"]],standalone:!0,features:[G],decls:42,vars:12,consts:[[1,"px-[6px]","pb-[6px]","font-roboto"],[1,"flex","justify-between","items-center","mb-6"],[1,"text-lg","font-medium","text-main-text-color"],[1,"cursor-pointer",3,"mat-dialog-close"],[1,"text-gray-400","hover:text-gray-600","text-xl",3,"icon"],[1,"bg-secondary-background-color","p-4","rounded-lg"],[1,"space-y-2"],[1,"text-base","font-semibold","text-main-text-color"],[1,"text-xs","text-main-text-color","leading-relaxed"],[1,"mt-3","space-y-2"],[1,"text-base","font-semibold","text-main-text-color","mb-2"],[1,"flex","justify-end","gap-3","pt-8"],["text","Close","width","125px",3,"type","mat-dialog-close"],["text","Agree & Continue","width","150px",3,"clickEvent","type"]],template:function(t,i){t&1&&(a(0,"div",0)(1,"div",1)(2,"h2",2),u(3,"Terms and conditions"),l(),a(4,"div",3),b(5,"fa-icon",4),l()(),a(6,"div")(7,"div",5)(8,"div",6)(9,"h3",7),u(10,"ELECTRONIC RECORD AND SIGNATURE DISCLOSURE"),l(),a(11,"p",8),u(12," Please read the following information carefully. By clicking the 'I agree' button, you agree that you have reviewed the following terms and conditions and consent to transact business electronically using the Zil Sign electronic signature system. If you do not agree to these terms, do not click the 'I agree' button. "),l()(),a(13,"div",9)(14,"div")(15,"h4",10),u(16,"Electronic documents"),l(),a(17,"p",8),u(18,' Please note that Zil Money Corporation / OCW ("we," "us," or "Company") will send all documents electronically to the email address you have provided during the course of the business relationship unless you notify us otherwise using the procedure explained herein. Once you sign a document electronically, we will send a PDF version of the document to you. '),l()(),a(19,"div")(20,"h4",10),u(21,"Request for paper copies"),l(),a(22,"p",8),u(23),l()(),a(24,"div")(25,"h4",10),u(26,"Withdrawing your consent"),l(),a(27,"p",8),u(28),l()(),a(29,"div")(30,"h4",10),u(31),l(),a(32,"p",8),u(33),l()(),a(34,"div")(35,"h4",10),u(36,"System requirements"),l(),a(37,"p",8),u(38," Zil Sign is compatible with recent versions of popular browsers such as Chrome, Firefox, Safari, and Internet Explorer. It is also available on iOS and Android devices. "),l()()()()(),a(39,"div",11),b(40,"app-common-button-v35",12),a(41,"app-common-button-v35",13),S("clickEvent",function(){return i.onAgree()}),l()()()),t&2&&(s(4),m("mat-dialog-close",!1),s(),m("icon",O(9,Ai)),s(18),D(" You have the right to request paper copies of the documents sent to you electronically. You also have the ability to download and print documents sent to you electronically. If you wish to receive paper copies of documents we have sent electronically, please send an email to ",i.email(),". We will charge $0 per page for sending paper copies. "),s(5),D(" At any time during the course of our business relationship, you have the right to withdraw your consent to receive documents electronically. To withdraw your consent, you can decline to sign a document sent to you and send an email to ",i.email()," informing us that you wish to receive documents only in paper format. Upon your request, we will stop sending documents via the Zil Sign electronic signature system. "),s(3),D("To advise ",i.username()," of your new email address"),s(2),D(" If you need to change the email address used to receive notices and disclosures from us, please write to ",i.email(),". "),s(7),m("type",O(10,Li))("mat-dialog-close",!1),s(),m("type",O(11,Wi)))},dependencies:[j,Q,tt]})}}return r})();var Oi=["pdfContainer"],Bi=["pdfOverlay"],$i=["pdfPagesContainer"],qi=(r,y)=>y.pageNumber,jt=(r,y)=>y.id,Hi=r=>({"border-2 border-common-blue-color bg-common-blue-color bg-opacity-10":r}),Ui=(r,y)=>({"pointer-events-none":r,"pointer-events-auto":y}),Xt=()=>({style:"filled-green",name:"action"}),Yi=(r,y)=>({"border-2 border-common-blue-color bg-common-secondary-blue-color":r,"border border-input-border-color bg-main-background-color":y}),Gi=()=>["signature","initial","sign_date","checkbox","radio","attachment"],ji=()=>({style:"filled-red",name:"action"}),Xi=(r,y,e,t,i,n)=>({"cursor-pointer":r,"cursor-not-allowed opacity-60":y,"border-common-secondary-blue-color bg-common-secondary-blue-color":e,"border-common-secondary-green-color bg-common-secondary-green-color":t,"border-gray-300 bg-gray-50":i,"ring-2 ring-offset-2 shadow-lg":n});function Qi(r,y){if(r&1){let e=R();a(0,"button",30),S("click",function(){f(e);let i=p();return _(i.goBack())}),b(1,"fa-icon",31),l()}if(r&2){let e=p();s(),m("icon",e.faArrowLeft)}}function Ji(r,y){if(r&1){let e=R();a(0,"app-common-button-v35",32),S("clickEvent",function(){f(e);let i=p();return _(i.send())}),l()}if(r&2){let e=p();m("type",O(2,Xt))("loading",e.loadingSubmit)}}function Zi(r,y){if(r&1){let e=R();a(0,"app-common-button-v35",33),S("clickEvent",function(){f(e);let i=p();return _(i.canSubmit()?i.submitAllFields():i.openSignAgreementModal())}),l()}if(r&2){let e=p();Ue("text",e.canSubmit()?"Submit":"Agree & Continue"),m("type",O(4,Xt))("loading",e.loadingSubmit)("disabled",e.pdfError)}}function Ki(r,y){if(r&1&&b(0,"img",40),r&2){let e=p().$implicit;m("src",e.thumbnail,fe)("alt","Page "+e.pageNumber)}}function en(r,y){if(r&1&&(a(0,"span",42),u(1),l()),r&2){let e=p().$implicit;s(),q(e.pageNumber)}}function tn(r,y){if(r&1&&(a(0,"div",41)(1,"span",43),u(2),l()()),r&2){let e=p().$implicit;s(2),q(e.pageNumber)}}function nn(r,y){if(r&1){let e=R();a(0,"div",38),S("click",function(){let i=f(e).$implicit,n=p(2);return _(n.goToPage(i.pageNumber))})("keyup.enter",function(){let i=f(e).$implicit,n=p(2);return _(n.goToPage(i.pageNumber))})("keyup.space",function(){let i=f(e).$implicit,n=p(2);return _(n.goToPage(i.pageNumber))}),a(1,"div",39),M(2,Ki,1,2,"img",40)(3,en,2,1),l(),M(4,tn,3,1,"div",41),l()}if(r&2){let e=y.$implicit,t=p(2);m("ngClass",H(3,Yi,t.currentPage===e.pageNumber,t.currentPage!==e.pageNumber)),s(2),E(2,e.thumbnail?2:3),s(2),E(4,t.currentPage===e.pageNumber?4:-1)}}function on(r,y){if(r&1&&(a(0,"div",22)(1,"div",34)(2,"p",35),u(3," Pages "),l(),a(4,"div",36),ae(5,nn,5,6,"div",37,qi),l()()()),r&2){let e=p();
1s(5),re(e.pdfPages)}}function an(r,y){r&1&&(a(0,"div",25)(1,"div",44)(2,"p",45),u(3,"Loading PDF..."),l()()())}function rn(r,y){if(r&1&&(a(0,"div",25)(1,"div",46)(2,"p",47),u(3),l()()()),r&2){let e=p();s(3),q(e.pdfError)}}function ln(r,y){r&1&&(a(0,"span",51),u(1,"Saved \u2713"),l())}function sn(r,y){if(r&1&&(a(0,"option",57),u(1),l()),r&2){let e=y.$implicit;m("ngValue",e.id),s(),q(e.email||e.name)}}function dn(r,y){if(r&1){let e=R();a(0,"div",54)(1,"label",55),u(2,"Default value"),l(),a(3,"input",64),L("ngModelChange",function(i){f(e);let n=p(3);return A(n.selectedField.defaultValue,i)||(n.selectedField.defaultValue=i),_(i)}),S("ngModelChange",function(){f(e);let i=p(3);return _(i.onFieldSettingChange())}),l()()}if(r&2){let e=p(3);s(3),z("ngModel",e.selectedField.defaultValue)}}function cn(r,y){if(r&1){let e=R();a(0,"div",54)(1,"label",55),u(2,"Group name"),l(),a(3,"input",67),L("ngModelChange",function(i){f(e);let n=p(3);return A(n.selectedField.groupName,i)||(n.selectedField.groupName=i),_(i)}),S("ngModelChange",function(){f(e);let i=p(3);return _(i.onFieldSettingChange())}),l(),a(4,"span",42),u(5,"Radio fields sharing the same group name are mutually exclusive."),l()()}if(r&2){let e=p(3);s(3),z("ngModel",e.selectedField.groupName)}}function pn(r,y){if(r&1&&(a(0,"span",73),u(1),l()),r&2){let e=p(5);s(),q(e.getCheckboxGroupValidationError())}}function un(r,y){if(r&1){let e=R();a(0,"div",69)(1,"div",70)(2,"label",55),u(3,"Min required"),l(),a(4,"input",71),L("ngModelChange",function(i){f(e);let n=p(4);return A(n.selectedField.minRequired,i)||(n.selectedField.minRequired=i),_(i)}),S("ngModelChange",function(){f(e);let i=p(4);return _(i.onFieldSettingChange())}),l()(),a(5,"div",70)(6,"label",55),u(7,"Max allowed"),l(),a(8,"input",72),L("ngModelChange",function(i){f(e);let n=p(4);return A(n.selectedField.maxRequired,i)||(n.selectedField.maxRequired=i),_(i)}),S("ngModelChange",function(){f(e);let i=p(4);return _(i.onFieldSettingChange())}),l()()(),M(9,pn,2,1,"span",73)}if(r&2){let e=p(4);s(4),z("ngModel",e.selectedField.minRequired),m("max",e.getCheckboxGroupSize()),s(4),z("ngModel",e.selectedField.maxRequired),m("max",e.getCheckboxGroupSize()),s(),E(9,e.getCheckboxGroupValidationError()?9:-1)}}function mn(r,y){r&1&&(a(0,"span",42),u(1,"Add more checkboxes to this group to enable min/max validation."),l())}function gn(r,y){if(r&1){let e=R();a(0,"div",58)(1,"div",54)(2,"label",55),u(3,"Group name"),l(),a(4,"input",68),L("ngModelChange",function(i){f(e);let n=p(3);return A(n.selectedField.groupName,i)||(n.selectedField.groupName=i),_(i)}),S("ngModelChange",function(){f(e);let i=p(3);return _(i.onFieldSettingChange())}),l(),a(5,"span",42),u(6,"Checkboxes sharing the same group name are validated together."),l()(),M(7,un,10,5)(8,mn,2,0),l()}if(r&2){let e=p(3);s(4),z("ngModel",e.selectedField.groupName),s(3),E(7,e.selectedField.groupName&&e.getCheckboxGroupSize()>1?7:e.selectedField.groupName?8:-1)}}function hn(r,y){if(r&1){let e=R();a(0,"div",54)(1,"label",55),u(2,"Max file size (MB)"),l(),a(3,"input",74),L("ngModelChange",function(i){f(e);let n=p(3);return A(n.selectedField.maxFileSizeMB,i)||(n.selectedField.maxFileSizeMB=i),_(i)}),S("ngModelChange",function(){f(e);let i=p(3);return _(i.onFieldSettingChange())}),l()()}if(r&2){let e=p(3);s(3),z("ngModel",e.selectedField.maxFileSizeMB)}}function fn(r,y){if(r&1){let e=R();a(0,"div",54)(1,"label",55),u(2,"Character limit"),l(),a(3,"input",75),L("ngModelChange",function(i){f(e);let n=p(3);return A(n.selectedField.characterLimit,i)||(n.selectedField.characterLimit=i),_(i)}),S("ngModelChange",function(){f(e);let i=p(3);return _(i.onFieldSettingChange())}),l()()}if(r&2){let e=p(3);s(3),z("ngModel",e.selectedField.characterLimit)}}function _n(r,y){if(r&1){let e=R();a(0,"div",54)(1,"label",55),u(2,"Validation"),l(),a(3,"select",56),L("ngModelChange",function(i){f(e);let n=p(3);return A(n.selectedField.validation,i)||(n.selectedField.validation=i),_(i)}),S("ngModelChange",function(){f(e);let i=p(3);return _(i.onFieldSettingChange())}),a(4,"option",76),u(5,"None"),l(),a(6,"option",77),u(7,"Numeric"),l(),a(8,"option",78),u(9,"Alphabet"),l()()()}if(r&2){let e=p(3);s(3),z("ngModel",e.selectedField.validation)}}function xn(r,y){if(r&1){let e=R();a(0,"div",48)(1,"div",49)(2,"h3",50),u(3),l(),M(4,ln,2,0,"span",51),a(5,"button",52),S("click",function(){f(e);let i=p(2);return _(i.onFieldSettingsClose())}),b(6,"fa-icon",31),l()(),a(7,"div",53)(8,"div",54)(9,"label",55),u(10,"Recipient"),l(),a(11,"select",56),L("ngModelChange",function(i){f(e);let n=p(2);return A(n.selectedField.recipientId,i)||(n.selectedField.recipientId=i),_(i)}),S("ngModelChange",function(){f(e);let i=p(2);return _(i.onFieldSettingChange())}),ae(12,sn,2,2,"option",57,jt),l()(),a(14,"div",58)(15,"div",59)(16,"input",60),L("ngModelChange",function(i){f(e);let n=p(2);return A(n.selectedField.required,i)||(n.selectedField.required=i),_(i)}),S("ngModelChange",function(){f(e);let i=p(2);return _(i.onFieldSettingChange())}),l(),a(17,"span",61),u(18,"Required"),l()(),a(19,"div",62)(20,"input",63),L("ngModelChange",function(i){f(e);let n=p(2);return A(n.selectedField.fixedWidth,i)||(n.selectedField.fixedWidth=i),_(i)}),S("ngModelChange",function(){f(e);let i=p(2);return _(i.onFieldSettingChange())}
1),l(),a(21,"span",61),u(22,"Fixed width"),l()(),a(23,"div",62)(24,"input",63),L("ngModelChange",function(i){f(e);let n=p(2);return A(n.selectedField.fixedHeight,i)||(n.selectedField.fixedHeight=i),_(i)}),S("ngModelChange",function(){f(e);let i=p(2);return _(i.onFieldSettingChange())}),l(),a(25,"span",61),u(26,"Fixed height"),l()()(),M(27,dn,4,1,"div",54),a(28,"div",54)(29,"label",55),u(30,"Field name"),l(),a(31,"input",64),L("ngModelChange",function(i){f(e);let n=p(2);return A(n.selectedField.fieldName,i)||(n.selectedField.fieldName=i),_(i)}),S("ngModelChange",function(){f(e);let i=p(2);return _(i.onFieldSettingChange())}),l()(),M(32,cn,6,1,"div",54)(33,gn,9,2,"div",58)(34,hn,4,1,"div",54)(35,fn,4,1,"div",54)(36,_n,10,1,"div",54),l(),a(37,"div",65)(38,"app-common-button-v35",66),S("clickEvent",function(){f(e);let i=p(2);return _(i.removeField(i.selectedField.id))}),l()()()}if(r&2){let e=p(2);s(3),q(e.getSettingsPanelTitle()),s(),E(4,e.fieldSettingsSaved?4:-1),s(2),m("icon",e.faXmark),s(5),z("ngModel",e.selectedField.recipientId),s(),re(e.getAssignableRecipients()),s(3),ke("opacity-40",e.selectedField.type==="checkbox"&&e.selectedField.groupName&&(e.selectedField.minRequired||e.selectedField.maxRequired)),m("title",e.selectedField.type==="checkbox"&&e.selectedField.groupName&&(e.selectedField.minRequired||e.selectedField.maxRequired)?"Required is controlled by Min/Max for grouped checkboxes":""),s(),z("ngModel",e.selectedField.required),m("disabled",e.selectedField.type==="checkbox"&&e.selectedField.groupName&&(e.selectedField.minRequired||e.selectedField.maxRequired)),s(4),z("ngModel",e.selectedField.fixedWidth),s(4),z("ngModel",e.selectedField.fixedHeight),s(3),E(27,O(19,Gi).includes(e.selectedField.type)?-1:27),s(4),z("ngModel",e.selectedField.fieldName),s(),E(32,e.selectedField.type==="radio"?32:-1),s(),E(33,e.selectedField.type==="checkbox"?33:-1),s(),E(34,e.selectedField.type==="attachment"?34:-1),s(),E(35,e.isTextTypeField()&&e.selectedField.type!=="email"?35:-1),s(),E(36,e.isTextTypeField()&&e.selectedField.type!=="email"?36:-1),s(2),m("type",O(20,ji))}}function Cn(r,y){if(r&1&&(a(0,"span",98),u(1," Active "),l()),r&2){let e=p().$implicit,t=p(3);$("background-color",t.getRecipientColor(e.id))}}function yn(r,y){r&1&&(a(0,"span",97),u(1," Receives Copy "),l())}function vn(r,y){if(r&1&&(a(0,"span",42),u(1),l()),r&2){let e=p().$implicit;s(),D(" ",e.email," ")}}function Sn(r,y){if(r&1&&(a(0,"span",42),u(1),l()),r&2){let e=p(2).$implicit,t=p(3);s(),D(" ",t.getFieldsForRecipient(e.id).length," field(s) ")}}function bn(r,y){r&1&&(a(0,"span",99),u(1," No fields needed "),l())}function wn(r,y){if(r&1&&M(0,Sn,2,1,"span",42)(1,bn,2,0),r&2){let e=p().$implicit,t=p(3);E(0,t.canAssignFields(e)?0:1)}}function Fn(r,y){if(r&1){let e=R();a(0,"div",92),S("click",function(){let i=f(e).$implicit,n=p(3);return _(!n.isSignerMode&&n.canAssignFields(i)?n.onRecipientSelect(i.id):null)})("keyup.enter",function(){let i=f(e).$implicit,n=p(3);return _(!n.isSignerMode&&n.canAssignFields(i)?n.onRecipientSelect(i.id):null)})("keyup.space",function(){let i=f(e).$implicit,n=p(3);return _(!n.isSignerMode&&n.canAssignFields(i)?n.onRecipientSelect(i.id):null)}),a(1,"div",93)(2,"div",94),u(3),l(),a(4,"div",95)(5,"div",87)(6,"span",90),u(7),l(),M(8,Cn,2,2,"span",96)(9,yn,2,0,"span",97),l(),M(10,vn,2,1,"span",42)(11,wn,2,1),l()()()}if(r&2){let e=y.$implicit,t=p(3);$("border-color",t.selectedRecipientId===e.id?t.getRecipientColor(e.id):void 0)("background-color",t.selectedRecipientId===e.id?t.getRecipientColorRgba(e.id,.15):void 0),m("ngClass",je(19,Xi,!t.isSignerMode&&t.canAssignFields(e),!t.isSignerMode&&!t.canAssignFields(e),e.role==="owner"&&t.selectedRecipientId!==e.id,t.selectedRecipientId!==e.id&&t.canAssignFields(e),!t.canAssignFields(e),t.selectedRecipientId===e.id)),qe("role",!t.isSignerMode&&t.canAssignFields(e)?"button":null)("tabindex",t.isSignerMode||!t.canAssignFields(e)?-1:0),s(2),$("background-color",t.getRecipientColor(e.id))("transform",t.selectedRecipientId===e.id?"scale(1.1)":"scale(1)"),s(),D(" ",t.getRecipientIcon(e)," "),s(3),ke("font-bold",t.selectedRecipientId===e.id),s(),D(" ",t.getRecipientDisplayName(e)," "),s(),E(8,t.selectedRecipientId===e.id?8:-1),s(),E(9,e.role==="receives_copy"?9:-1),s(),E(10,e.email?10:-1),s(),E(11,t.isSignerMode?-1:11)}}function Pn(r,y){if(r&1){let e=R();a(0,"div",79)(1,"div",80)(2,"div",81)(3,"p",82),u(4," Recipients "),l()(),a(5,"div",36),ae(6,Fn,12,26,"div",83,jt),l()(),a(8,"div")(9,"div",81)(10,"p",50),u(11," Fields "),l(),b(12,"fa-icon",84),l(),a(13,"div",85)(14,"div",86),S("dragstart",function(i){f(e);let n=p(2);return _(n.onDragStart(i,"signature"))})("dragend",function(i){f(e);let n=p(2);return _(n.onDragEnd(i))}),a(15,"div",87)(16,"div",88),b(17,"fa-icon",89),l(),a(18,"span",90),u(19,"Signature"),l()(),b(20,"fa-icon",91),l(),a(21,"div",86),S("dragstart",function(i){f(e);let n=p(2);return _(n.onDragStart(i,"initial"))})("dragend",function(i){f(e);let n=p(2);return _(n.onDragEnd(i))}),a(22,"div",87)(23,"div",88),b(24,"fa-icon",89),l(),a(25,"span",90),u(26,"Initials"),l()(),b(27,"fa-icon",91),l(),a(28,"div",86),S("dragstart",function(i){f(e);let n=p(2);return _(n.onDragStart(i,"name"))})("dragend",function(i){f(e);let n=p(2);return _(n.onDragEnd(i))}),a(29,"div",87)(30,"div",88),b(31,"fa-icon",89),l(),a(32,"span",90),u(33,"Full Name"),l()(),b(34,"fa-icon",91),l(),a(35,"div",86),S("dragstart",function(i){f(e);let n=p(2);return _(n.onDragStart(i,"sign_date"))})("dragend",function(i){f(e);let n=p(2);return _(n.onDragEnd(i))}),a(36,"div",87)(37,"div",88),b(38,"fa-icon",89),l(),a(39,"span",90),u(40,"Sign Date"),l()(),b(41,"fa-icon",91),l(),a(42,"div",86),S("dragstart",function(i){f(e);let n=p(2);return _(n.onDragStart(i,"company"))})("dragend",function(i){f(e);let n=p(2);return _(n.onDragEnd(i))}),a(43,"div",87)(44,"div",88),b(45,"fa-icon",89),l(),a(46,"span",90),u(47,"Company"),l()(),b(48,"fa-icon",91),l(),a(49,"div",86),S("dragstart",function(i){f(e);let n=p(2);return _(n.onDragStart(i,"title"))})("dragend",function(i){f(e);let n=p(2);return _(n.onDragEnd(i))}),a(50,"div",87)(51,"div",88),b(52,"fa-icon",89),l(),a(53,"span",90),u(54,"Job Title"),l()(),b(55,"fa-icon",91),l(),a(56,"div",86),S("dragstart",function(i){f(e);let n=p(2);return _(n.onDragStart(i,"date"))})("dragend",function(i){f(e);let n=p(2);return _(n.onDragEnd(i))}),a(57,"div",87)(58,"div",88),b(59,"fa-icon",89),l(),a(60,"span",90),u(61,"Date"),l()(),b(62,"fa-icon",91),l(),a(63,"div",86),S("dragstart",function(i){f(e);let n=p(2);return _(n.onDragStart(i,"text"))})("dragend",function(i){f(e);let n=p(2);return _(n.onDragEnd(i))}),a(64,"div",87)(65,"div",88),b(66,"fa-icon",89),l(),a(67,"span",90),u(68,"Text"),l()(),b(69,"fa-icon",91),l(),a(70,"div",86),S("dragstart",function(i){f(e);let n=p(2);return _(n.onDragStart(i,"email"))})("dragend",function(i){f(e);let n=p(2);return _(n.onDragEnd(i))}),a(71,"div",87)(72,"div",88),b(73,"fa-icon",89),l(),a(74,"span",90),u(75,"Email"),l()(),b(76,"fa-icon",91),l(),a(77,"div",86),S("dragstart",function(i){f(e);let n=p(2);return _(n.onDragStart(i,"checkbox"))})("dragend",function(i){f(e);let n=p(2);return _(n.onDragEnd(i))}),a(78,"div",87)(79,"div",88),b(80,"fa-icon",89),l(),a(81,"span",90),u(82,"Checkbox"),l()(),b(83,"fa-icon",91),l(),a(84,"div",86),S("dragstart",function(i){f(e);let n=p(2);return _(n.onDragStart(i,"radio"))})("dragend",function(i){f(e);let n=p(2);return _(n.onDragEnd(i))}),a(85,"div",87)(86,"div",88),b(87,"fa-icon",89),l(),a(88,"span",90),u(89,"Radio"),l()(),b(90,"fa-icon",91),l(),a(91,"div",86),S("dragstart",function(i){f(e);let n=p(2);return _(n.onDragStart(i,"attachment"))})("dragend",function(i){f(e);let n=p(2);return _(n.onDragEnd(i))}),a(92,"div",87)(93,"div",88),b(94,"fa-icon",89),l(),a(95,"span",90),u(96,"Attachment"),l()(),b(97,"fa-icon",91),l()()()()}if(r&2){let e=p(2);s(6),re(e.recipients),s(6),m("icon",e.faCircleQuestion)("matTooltip",`Drag and drop field to the document. 
2Double-click to edit field properties.`)("matTooltipClass","text-base font-medium")("matTooltipPosition","left")("matTooltipShowDelay",300),s(5),m("icon",e.faSignature),s(3),m("icon",e.faPlus),s(4),m("icon",e.faSignature),s(3),m("icon",e.faPlus),s(4),m("icon",e.faUser),s(3),m("icon",e.faPlus),s(4),m("icon",e.faCalendar),s(3),m("icon",e.faPlus),s(4),m("icon",e.faBuilding),s(3),m("icon",e.faPlus),s(4),m("icon",e.faBriefcase),s(3),m("icon",e.faPlus),s(4),m("icon",e.faCalendar),s(3),m("icon",e.faPlus),s(4),m("icon",e.faFont),s(3),m("icon",e.faPlus),s(4),m("icon",e.faEnvelope),s(3),m("icon",e.faPlus),s(4),m("icon",e.faSquareCheck),s(3),m("icon",e.faPlus),s(4),m("icon",e.faCircleDot),s(3),m("icon",e.faPlus),s(4),m("icon",e.faPaperclip),s(3),m("icon",e.faPlus)}}function Tn(r,y){if(r&1&&(a(0,"div",28),M(1,xn,39,21,"div",48)(2,Pn,98,29),l()),r&2){let e=p();s(),E(1,e.selectedField?1:2)}}function En(r,y){if(r&1){let e=R();a(0,"app-field-context-menu",100),S("menuAction",function(i){f(e);let n=p();return _(n.onContextMenuAction(i))})("closeMenu",function(){f(e);let i=p();return _(i.onCloseContextMenu())}),l()}if(r&2){let e=p();m("x",e.contextMenuX)("y",e.contextMenuY)("fieldId",e.contextMenuFieldId)}}var Go=(()=>{class r{constructor(){this.sanitizer=N(Qe),this.router=N(Ze),this.route=N(Je),this.cdr=N(Xe),this.zilSignService=N(Bt),this.alertService=N(lt),this.dialog=N(et),this.localStorageService=N(rt),this.destroyRef=N(Be),this.loadingSubmit=!1,this.documentId="",this.documentName="",this.signerToken="",this.isSignerMode=!1,this.fieldSettingsSaved=!1,this.fieldValues=new Map,this.storedInitials=null,this.storedSignatureStyle="cursive",this.email=ie(""),this.username=ie(""),this.canSubmit=ie(!1),this.faArrowLeft=mt,this.faArrowRight=ct,this.faChevronLeft=yt,this.faChevronRight=vt,this.faPlus=Ct,this.faCheck=Te,this.faEllipsisVertical=ht,this.faXmark=me,this.faMagnifyingGlassPlus=St,this.faMagnifyingGlassMinus=bt,this.faGripVertical=gt,this.faPenToSquare=dt,this.faSignature=kt,this.faTrash=Pe,this.faCircleQuestion=pt,this.pdfUrl="",this.currentPage=1,this.totalPages=0,this.zoomLevel=100,this.zoom=1.5,this.pdfPages=[],this.pdfDoc=null,this.pdfLoading=!0,this.pdfError="",this.recipients=[],this.currentRecipientId=null,this.signatureFields=[],this.failingGroupNames=new Set,this.draggedFieldType=null,this.draggingField=null,this.draggingFieldElement=null,this.hasDragged=!1,this.dragOffsetX=0,this.dragOffsetY=0,this.selectedRecipientId=null,this.selectedField=null,this.showFieldInspector=!1,this.resizingField=null,this.resizeHandle=null,this.resizeStartX=0,this.resizeStartY=0,this.resizeStartWidth=0,this.resizeStartHeight=0,this.resizeStartLeft=0,this.resizeStartTop=0,this.faBuilding=zt,this.faEnvelope=Rt,this.faBriefcase=Lt,this.faUser=Vt,this.faFont=Nt,this.faCalendar=At,this.faSquareCheck=It,this.faCircleDot=Mt,this.faPaperclip=Dt,this.isDragOver=!1,this.snapToGrid=!0,this.snapDistance=10,this.showGrid=!1,this.showContextMenu=!1,this.contextMenuX=0,this.contextMenuY=0,this.contextMenuFieldId="",this.addMoreTarget=null,this.fieldSettingsChanged$=new We,this.editingGroupName=null,this.recipientColors=["#3B82F6","#10B981","#F59E0B","#EF4444","#8B5CF6","#EC4899","#06B6D4","#84CC16","#F97316","#6366F1"]}isPrefillField(e){return!e.recipientId||e.recipientId===0||e.recipientId===-1}isRecipientField(e){return!!e.recipientId&&e.recipientId>0}canAssignFields(e){return e.role!=="receives_copy"}ngOnInit(){if(this.signerToken=this.route.snapshot.params.token||this.route.snapshot.queryParams.token||"",this.isSignerMode=!!this.signerToken,this.email.set(this.localStorageService.getItem("email")||""),this.username.set(this.localStorageService.getItem("username")||""),this.isSignerMode)this.loadDocumentByToken();else{if(this.documentId=this.route.snapshot.params.id,!this.documentId){this.pdfError="Document ID is required",this.pdfLoading=!1;return}this.loadDocumentDetails()}this.fieldSettingsChanged$.pipe(Oe(600),Ke(this.destroyRef)).subscribe(()=>this.onFieldSettingsAutoSave())}ngAfterViewInit(){this.setupPdfDropZone(),this.setupFieldDragging(),typeof window<"u"&&(this.windowResizeHandler=()=>{this.cdr.detectChanges()},window.addEventListener("resize",this.windowResizeHandler))}loadDocumentDetails(){this.zilSignService.getDocumentDetails(this.documentId).pipe(U(1)).subscribe({next:e=>{if(e.success&&e.data){this.documentName=e.data.name,this.pdfUrl=e.data.pdfUrl;let t={id:-1,name:"Prefill by you",email:"",role:"owner"};this.recipients=[t,...e.data.recipients||[]],this.signatureFields=e.data.fields||[],this.signatureFields.forEach(i=>
2{i.id&&(i.value?(this.fieldValues.set(i.id,i.value),i.type==="attachment"&&i.filename&&this.fieldValues.set(i.id+"-filename",i.filename)):i.defaultValue&&this.fieldValues.set(i.id,i.defaultValue))}),this.urlSafe=this.sanitizer.bypassSecurityTrustResourceUrl(this.pdfUrl),this.autoSelectRecipient(),setTimeout(()=>{this.renderPDF()},0)}else this.pdfError="Failed to load document details",this.pdfLoading=!1,this.cdr.detectChanges()},error:e=>{this.pdfError=e?.error?.message||"Failed to load document",this.pdfLoading=!1,this.cdr.detectChanges()}})}loadDocumentByToken(){this.zilSignService.getDocumentByTokenOutside(this.signerToken).pipe(U(1)).subscribe({next:e=>{if(e.success&&e.data?.status!=="signed"){let t=e.data;if(t.already_signed){this.router.navigate(["/outside/zil-sign/success"],{queryParams:{token:this.signerToken,documentId:t.id}});return}if(this.documentId=t.id,this.documentName=t.name,this.pdfUrl=t.pdfUrl,this.isSignerMode)this.recipients=t.recipients||[];else{let n={id:-1,name:"Prefill by you",email:"",role:"owner"};this.recipients=[n,...t.recipients||[]]}this.currentRecipientId=t.currentRecipientId||(t.fields?.find(n=>n.recipientId!=null)?.recipientId??null),this.signatureFields=t.fields||[],this.signatureFields.forEach(n=>{n.id&&(n.value?(this.fieldValues.set(n.id,n.value),n.type==="attachment"&&n.filename&&this.fieldValues.set(n.id+"-filename",n.filename)):n.defaultValue&&this.fieldValues.set(n.id,n.defaultValue))}),this.urlSafe=this.sanitizer.bypassSecurityTrustResourceUrl(this.pdfUrl),this.isSignerMode||this.autoSelectRecipient(),setTimeout(()=>{this.renderPDF()},0)}else this.pdfError=e.data?.errorMsg||"Failed to load document",this.pdfLoading=!1,this.cdr.detectChanges()},error:e=>{this.pdfError=e?.error?.message||"Invalid or expired signing link",this.pdfLoading=!1,this.cdr.detectChanges()}})}renderPDF(){return Ie(this,null,function*(){try{this.pdfLoading=!0,this.pdfError="";let e=this.pdfPagesContainer?.nativeElement;if(!e){this.pdfLoading=!1;return}e.innerHTML="",this.pdfPages=[],typeof pdfjsLib<"u"&&pdfjsLib.GlobalWorkerOptions&&(pdfjsLib.GlobalWorkerOptions.workerSrc="assets/pdfjs/pdf.worker.min.js");let t=yield this.zilSignService.fetchPdfData(this.pdfUrl),n=yield pdfjsLib.getDocument({data:t}).promise;this.pdfDoc=n,this.totalPages=n.numPages,this.isSignerMode&&this.currentRecipientId&&(this.signatureFields=this.signatureFields.filter(d=>{let x=!d.recipientId,v=d.value&&d.value.trim()!=="";return d.recipientId===this.currentRecipientId?!0:x&&v?d.type==="attachment":x&&!v}));let o=0,c=this.zoom;for(let d=1;d<=n.numPages;d++){let x=yield n.getPage(d),v=x.getViewport({scale:c}),F=document.createElement("canvas"),P=F.getContext("2d");if(!P)continue;F.height=v.height,F.width=v.width,F.style.display="block",F.style.marginBottom="20px",F.style.boxShadow="0 2px 8px rgba(0,0,0,0.1)",F.style.background="white";let g=document.createElement("div");g.style.position="relative",g.style.display="block",g.style.marginBottom="20px",g.appendChild(F);let C=document.createElement("div");C.style.position="absolute",C.style.top="0",C.style.left="0",C.style.width=`${v.width}px`,C.style.height=`${v.height}px`,C.style.pointerEvents="none",C.style.zIndex="100",g.appendChild(C),e.appendChild(g);let h={canvasContext:P,viewport:v};yield x.render(h).promise;let w=yield this.generateThumbnail(x),V=v.width/c,T=v.height/c,I=c;this.pdfPages.push({pageNumber:d,canvas:F,overlay:C,offsetY:o,width:v.width,height:v.height,thumbnail:w,pdfWidth:V,pdfHeight:T,viewportScale:I}),o+=v.height+20}this.pdfLoading=!1,this.cdr.detectChanges(),setTimeout(()=>{this.renderFieldsIntoOverlays()},100)}catch(e){this.pdfError=e.message||"Failed to render PDF",this.pdfLoading=!1,this.cdr.detectChanges()}})}goToPage(e){e>=1&&e<=this.totalPages&&(this.currentPage=e,this.scrollToPage(e))}previousPage(){this.currentPage>1&&(this.currentPage--,this.scrollToPage(this.currentPage))}nextPage(){this.currentPage<this.totalPages&&(this.currentPage++,this.scrollToPage(this.currentPage))}scrollToPage(e){let t=this.pdfPages.find(n=>n.pageNumber===e);if(!t)return;let i=this.pdfContainer?.nativeElement;i&&(i.scrollTo({top:t.offsetY-20,behavior:"smooth"}),this.currentPage=e)}zoomIn(){this.zoomLevel=Math.min(this.zoomLevel+10,200),this.zoom=this.zoomLevel/100,this.renderPDF()}zoomOut(){this.zoomLevel=Math.max(this.zoomLevel-10,50),this.zoom=this.zoomLevel/100,this.renderPDF()}onDragStart(e,t){this.draggedFieldType=t,e.dataTransfer&&(e.dataTransfer.effectAllowed="copy",e.dataTransfer.setData("text/plain",t))}getFieldTypeLabel(e){return{signature:"Signature",initial:"Initial",name:"Full Name",sign_date:"Sign Date",company:"Company",title:"Job Title",date:"Date",text:"Text",email:"Email",checkbox:"Checkbox",radio:"Radio",attachment:"Attachment"}[e]||e}getFieldTypeIcon(e){return{signature:"fas fa-pen-to-square",initial:"fas fa-signature",name:"fas fa-user",sign_date:"fas fa-calendar",company:"fas fa-building",title:"fas fa-briefcase",date:"fas fa-calendar",text:"fas fa-font",email:"fas fa-envelope",checkbox:"far fa-square-check",radio:"far fa-circle-dot",attachment:"far fa-paperclip"}[e]||"fas fa-square"}onDragEnd(e){this.draggedFieldType=null}setupPdfDropZone(){let e=this.pdfOverlay?.nativeElement,t=this.pdfContainer?.nativeElement;if(!e||!t)return;let i=c=>{c.preventDefault(),c.stopPropagation(),this.draggedFieldType&&(this.isDragOver=!0,this.cdr.detectChanges())},n=c=>{c.preventDefault(),c.stopPropagation();let d=t.getBoundingClientRect(),x=c.clientX,v=c.clientY;(x<d.left||x>d.right||v<d.top||v>d.bottom)&&(this.isDragOver=!1,this.cdr.detectChanges())},o=c=>{if(c.preventDefault(),c.stopPropagation(),this.isDragOver=!1,this.draggedFieldType){let d=this.screenToPdfPoints(c.clientX,c.clientY);d&&this.addSignatureField(d.x,d.y,this.draggedFieldType,d.pageNumber),this.draggedFieldType=null,this.cdr.detectChanges()}};e.addEventListener("dragover",i),e.addEventListener("dragleave",n),e.addEventListener("drop",o),t.addEventListener("dragover",i),t.addEventListener("dragleave",n),t.addEventListener("drop",o)}setupFieldDragging(){let e=this.pdfContainer?.nativeElement;if(!e)return;let t=n=>{if(this.draggingField&&this.draggingFieldElement){n.preventDefault(),this.hasDragged=!0;let o=this.screenToPdfPoints(n.clientX,n.clientY);if(o){let c=this.draggingField.pageNumber,d=Math.max(0,o.x-this.dragOffsetX),x=Math.max(0,o.y-this.dragOffsetY);
2if(this.snapToGrid){let P=this.pdfPages.find(C=>C.pageNumber===o.pageNumber),g=P?this.snapDistance/P.viewportScale:this.snapDistance;d=Math.round(d/g)*g,x=Math.round(x/g)*g}if(o.pageNumber===this.draggingField.pageNumber)this.draggingField.x=d,this.draggingField.y=x;else{this.draggingField.pageNumber=o.pageNumber,this.draggingField.x=d,this.draggingField.y=x;let P=this.pdfPages.find(C=>C.pageNumber===o.pageNumber),g=this.pdfPages.find(C=>C.pageNumber===c);P?.overlay&&g?.overlay&&this.draggingFieldElement&&(g.overlay.removeChild(this.draggingFieldElement),P.overlay.appendChild(this.draggingFieldElement))}let v=this.pdfPointsToScreen(this.draggingField);this.draggingFieldElement&&(this.draggingFieldElement.style.left=`${v.x}px`,this.draggingFieldElement.style.top=`${v.y}px`);let F=this.pdfPages.find(P=>P.pageNumber===o.pageNumber);if(F){let P=F.offsetY+v.y,g=e.getBoundingClientRect(),C=e.scrollTop,h=C,w=C+g.height;P<h+50?e.scrollTo({top:P-50,behavior:"smooth"}):P+v.height>w-50&&e.scrollTo({top:P+v.height-g.height+50,behavior:"smooth"})}}}},i=()=>{if(this.draggingField){if(this.hasDragged){let n=this.signatureFields.findIndex(o=>o.id===this.draggingField?.id);n!==-1&&this.draggingField&&(this.signatureFields[n]=W({},this.draggingField),this.selectedField?.id===this.draggingField.id&&(this.selectedField=W({},this.signatureFields[n]))),this.saveFieldPosition(this.draggingField),setTimeout(()=>{this.hasDragged=!1,this.renderFieldsIntoOverlays()},100)}else this.hasDragged=!1;this.draggingField=null,this.draggingFieldElement=null,this.cdr.detectChanges()}};document.addEventListener("mousemove",t),document.addEventListener("mouseup",i)}onFieldMouseDown(e,t){e.preventDefault(),e.stopPropagation(),this.hasDragged=!1,this.draggingField=W({},t),this.cdr.markForCheck(),this.cdr.detectChanges()}getFieldAbsoluteX(e){return this.pdfPointsToScreen(e).x}getFieldAbsoluteY(e){return this.pdfPointsToScreen(e).y}getFieldsForPage(e){let t=this.signatureFields.filter(i=>i.pageNumber===e);return this.isSignerMode&&this.currentRecipientId&&(t=t.filter(i=>{let n=!i.recipientId,o=i.value&&i.value.trim()!=="";return i.recipientId===this.currentRecipientId?!0:n&&!o})),t}getMaxPdfWidth(){if(typeof window>"u"||this.pdfPages.length===0)return this.pdfPages[0]?.width||800;let e=this.pdfPages[0].width,t=window.innerWidth,i=t;this.isSignerMode||(t<640?i-=250:t<768?i-=280:(t<1024,i-=t*.2)),t>=1024&&(i-=200);let n=t<768?16:t<1024?24:40;return i-=n,Math.min(e,i-20)}createInlineInput(e,t){let i=document.createElement("input");return i.type=this.getInputType(e.type),i.value=t,i.style.width="100%",i.style.height="100%",i.style.boxSizing="border-box",i.style.border="none",i.style.outline="none",i.style.background="transparent",i.style.fontSize="12px",i.style.padding="4px",i.style.textAlign="center",i.style.color="var(--main-text-color)",i.placeholder=this.getFieldPlaceholder(e.type),i.id=`field-input-${e.id}`,e.characterLimit&&(i.maxLength=e.characterLimit),e.type==="email"&&(i.pattern="[a-z0-9._%+-]+@[a-z0-9.-]+.[a-z]{2,}$"),e.validation==="numeric"?i.addEventListener("keydown",n=>{!["Backspace","Delete","ArrowLeft","ArrowRight","Tab","Home","End",".","-"].includes(n.key)&&!/^\d$/.test(n.key)&&n.preventDefault()}):e.validation==="alphabet"&&i.addEventListener("keydown",n=>{!["Backspace","Delete","ArrowLeft","ArrowRight","Tab","Home","End"," "].includes(n.key)&&!/^[a-zA-Z]$/.test(n.key)&&n.preventDefault()}),i.addEventListener("input",n=>{let o=n.target;this.fieldValues.set(e.id||"",o.value)}),i.addEventListener("blur",n=>{let o=n.target,c=o.value.trim();if(c){if(this.fieldValues.set(e.id||"",c),e.type==="name"){let d=this.extractInitials(c);d&&(this.storedInitials=d,this.autoPopulateInitialsFields())}}else this.fieldValues.delete(e.id||"");if(e.type==="email"&&c&&!this.isValidEmail(c)){this.alertService.failedAlert({content:"Please enter a valid email address",title:"Invalid Email"});return}this.isSignerMode&&!c&&e.type!=="signature"&&e.type!=="initial"&&setTimeout(()=>{let d=o.closest('div[style*="position: absolute"]');if(d&&!this.fieldValues.get(e.id||"")){let x=this.createFieldPlaceholder(e);d.innerHTML="",d.appendChild(x),d.style.cursor="pointer",this.cdr.detectChanges()}},100)}),i.addEventListener("click",n=>{n.stopPropagation()}),i.addEventListener("mousedown",n=>{n.stopPropagation()}),i}createInlineInputForPrefill(e,t){let i=document.createElement("input");i.type=this.getInputType(e.type),i.value=t,i.style.width="100%",i.style.height="100%",i.style.boxSizing="border-box",i.style.border="none",i.style.outline="none",i.style.background="transparent",i.style.fontSize="12px",i.style.padding="4px",i.style.textAlign="center",i.style.color="var(--main-text-color)",i.placeholder=this.getFieldPlaceholder(e.type),i.id=`field-input-${e.id}`,e.characterLimit&&(i.maxLength=e.characterLimit);let n=t;return e.type==="email"&&(i.pattern="[a-z0-9._%+-]+@[a-z0-9.-]+.[a-z]{2,}$"),i.addEventListener("input",o=>{let c=o.target;this.fieldValues.set(e.id||"",c.value)}),i.addEventListener("blur",o=>{let d=o.target.value.trim();if(e.type==="email"&&d&&!this.isValidEmail(d)){this.alertService.failedAlert({content:"Please enter a valid email address",title:"Invalid Email"});return}if(d!==n)if(d){if(e.type==="name"){let x=this.extractInitials(d);x&&(this.storedInitials=x,this.autoPopulateInitialsFields())}this.saveFieldValue(e.id||"",d)}else this.fieldValues.delete(e.id||""),this.renderFieldsIntoOverlays(),this.cdr.detectChanges()}),i.addEventListener("click",o=>
2{o.stopPropagation()}),i.addEventListener("mousedown",o=>{o.stopPropagation()}),i}createFieldPlaceholder(e){let t=document.createElement("div");t.style.display="flex",t.style.flexDirection="row",t.style.alignItems="center",t.style.gap="4px",t.style.pointerEvents="none",t.style.width="100%",t.style.height="100%",t.style.justifyContent="flex-start",t.style.paddingLeft="8px";let i=document.createElement("i");i.className=this.getFieldTypeIcon(e.type),i.style.fontSize="12px",i.style.color=e.recipientId?this.getRecipientColor(e.recipientId):"var(--main-text-color)";let n=document.createElement("span"),o=e.recipientId?this.recipients.find(F=>F.id===e.recipientId)?.name:null,c=e.label||this.getFieldTypeLabel(e.type),d=this.fieldValues.get(e.id||""),x=this.isSignerMode&&!!e.required&&(!d||d.trim()===""),v=x?" (Required)":"";return n.textContent=o?`${c}${v}`:`${c}${v}`,n.style.fontSize="10px",n.style.fontWeight="500",n.style.color=x?"var(--common-red-color)":"var(--main-text-color)",n.style.textAlign="left",n.style.whiteSpace="normal",n.style.wordBreak="break-word",n.style.display="inline-block",n.style.maxWidth="100%",n.style.overflow="hidden",n.style.textOverflow="ellipsis",n.style.whiteSpace="nowrap",t.appendChild(i),t.appendChild(n),t}getInputType(e){switch(e){case"email":return"email";case"date":case"sign_date":return"date";case"text":case"name":case"company":case"title":default:return"text"}}getFieldPlaceholder(e){return{signature:"Sign Here",initial:"Initial Here",name:"Enter your full name",sign_date:"MM/DD/YYYY",company:"Enter company name",title:"Enter job title",date:"MM/DD/YYYY",text:"Enter text",email:"Enter email address",checkbox:"Enter checkbox",radio:"Enter radio",attachment:"Enter attachment"}[e]||"Enter value"}isValidEmail(e){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(e)}getCurrentSignDate(){return new Date().toISOString().split("T")[0]}extractInitials(e){if(!e||!e.trim())return"";let t=e.trim().split(/\s+/).filter(o=>o.length>0);if(t.length===0)return"";if(t.length===1)return t[0].charAt(0).toUpperCase();let i=t[0].charAt(0).toUpperCase(),n=t[t.length-1].charAt(0).toUpperCase();return i+n}getSignatureFontFamily(e){switch(e){case"cursive":return"Dancing Script, cursive";case"bold":return"Arial, sans-serif";default:return"Arial, sans-serif"}}getSignatureFontWeight(e){return e==="bold"?"bold":"normal"}generateInitialsImage(e,t){if(!e||!e.trim())return"";let i=document.createElement("canvas"),n=i.getContext("2d");if(!n)return"";let o=t||this.storedSignatureStyle,c=this.getSignatureFontFamily(o),d=this.getSignatureFontWeight(o),x=48;n.font=`${d} ${x}px ${c}`;let v=e.trim(),F=n.measureText(v);return i.width=F.width+40,i.height=x+40,n.font=`${d} ${x}px ${c}`,n.fillStyle="#000000",n.fillText(v,20,x+10),i.toDataURL("image/png").split(",")[1]||i.toDataURL("image/png")}autoPopulateInitialsFields(){if(!this.storedInitials)return;let e=!1;this.signatureFields.forEach(t=>{if(t.type==="initial"){let i=this.fieldValues.get(t.id||"");if(!i||i.trim()===""){let n=this.generateInitialsImage(this.storedInitials||"");n&&(this.fieldValues.set(t.id||"",n),this.isSignerMode||this.zilSignService.saveFieldValue(this.documentId,t.id||"",t.type,n,null).pipe(U(1)).subscribe({next:o=>{o.success&&(t.value=n)},error:()=>{this.fieldValues.delete(t.id||"")}}),e=!0)}}}),e&&(this.renderFieldsIntoOverlays(),this.cdr.detectChanges())}renderFieldsIntoOverlays(){this.pdfPages.forEach(t=>{t.overlay&&(t.overlay.innerHTML="")}),this.getVisibleFields().forEach(t=>{let i=this.pdfPages.find(h=>h.pageNumber===t.pageNumber);if(!i||!i.overlay)return;let n=this.pdfPointsToScreen(t),o=document.createElement("div");if(o.style.position="absolute",o.style.left=`${n.x}px`,o.style.top=`${n.y}px`,o.style.width=`${n.width}px`,o.style.height=`${n.height}px`,o.style.pointerEvents="auto",o.style.zIndex=this.draggingField?.id===t.id?"102":"101",o.style.cursor=this.isSignerMode?"pointer":"move",o.style.display="flex",o.style.alignItems="center",o.style.justifyContent="center",o.style.borderRadius="4px",this.draggingField?.id!==t.id?o.style.transition="box-shadow 0.2s, opacity 0.2s":o.style.transition="none",o.style.userSelect="none",this.isSignerMode&&this.isPrefillField(t)&&t.type==="attachment"&&!!this.fieldValues.get(t.id||""))o.style.border="none",o.style.backgroundColor="transparent",o.style.boxShadow="none",o.style.cursor="pointer",o.style.pointerEvents="auto";else{o.style.boxShadow="0 2px 8px rgba(0,0,0,0.15)";let h,w,V=1;this.isRecipientField(t)?(h=this.getRecipientBorderColorRgba(t.recipientId,.9),w=this.getRecipientColorRgba(t.recipientId,.3),V=1):(h="border-secondary-text-color",w="bg-secondary-background-color",V=.9),o.style.border=`2px solid ${h}`,o.style.backgroundColor=w,!this.isSignerMode&&this.isPrefillField(t)&&!this.fieldValues.has(t.id||"")?o.style.borderStyle="dashed":o.style.borderStyle="solid",o.style.opacity=V.toString(),this.draggingField?.id===t.id&&(o.style.outline="2px s
2olid rgba(59, 130, 246, 0.8)",o.style.outlineOffset="2px");let T=(t.type==="checkbox"||t.type==="radio")&&!!t.groupName&&t.groupName===this.selectedField?.groupName&&this.selectedField?.id!==t.id;if(!this.isSignerMode&&(this.selectedField?.id===t.id||T)&&(o.style.outline="2px solid rgba(239, 68, 68, 0.9)",o.style.outlineOffset="2px"),this.isSignerMode&&t.type==="checkbox"&&t.groupName&&this.failingGroupNames.has(t.groupName)){o.style.outline="2px solid rgba(249, 115, 22, 0.9)",o.style.outlineOffset="2px";let I=this.signatureFields.filter(k=>k.type==="checkbox"&&k.groupName===t.groupName&&k.pageNumber===t.pageNumber);if(I.length>0&&I.reduce((k,Z)=>Z.y+Z.height>k.y+k.height?Z:k).id===t.id){let k=document.createElement("div");k.style.position="absolute",k.style.top="100%",k.style.left="0",k.style.marginTop="4px",k.style.fontSize="10px",k.style.fontWeight="600",k.style.color="#fff",k.style.backgroundColor="rgba(249, 115, 22, 0.95)",k.style.padding="2px 6px",k.style.borderRadius="4px",k.style.whiteSpace="nowrap",k.style.pointerEvents="none",k.style.zIndex="200",k.style.lineHeight="1.4";let Z=I.find(he=>he.minRequired!==void 0||he.maxRequired!==void 0),X=Z?.minRequired,B=Z?.maxRequired;X!==void 0&&X>0&&B!==void 0&&B>0&&B!==X?k.textContent=`Select min ${X} and max ${B} options`:X!==void 0&&X>0?k.textContent=`Select at least ${X} option${X>1?"s":""}`:B!==void 0&&B>0?k.textContent=`Select at most ${B} option${B>
21?"s":""}`:k.textContent="Selection required",o.style.overflow="visible",o.appendChild(k)}}}let d=t.recipientId?this.recipients.find(h=>h.id===t.recipientId)?.name:null,x=t.label||this.getFieldTypeLabel(t.type),v=this.fieldValues.get(t.id||"");if(this.isSignerMode&&t.type==="sign_date"&&(!v||v.trim()==="")&&(v=this.getCurrentSignDate(),this.fieldValues.set(t.id||"",v)),t.type==="initial"&&(!v||v.trim()==="")&&this.storedInitials){let h=this.generateInitialsImage(this.storedInitials);h&&(v=h,this.fieldValues.set(t.id||"",v))}let F=!t.recipientId,P=v&&v.trim()!=="",g=F&&P,C=this.getClickToFillText(t,x);if(o.title=this.isSignerMode?g?`${x} (Prefilled - Read Only)`:C:`${x} field${d?` - ${d}`:""} - Page ${t.pageNumber}`,t.type==="checkbox"||t.type==="radio"||t.type==="attachment")this.buildInteractiveFieldContent(t,o,v);else if(this.isSignerMode){let h=v,w=!h||h.trim()==="",T=!t.recipientId&&!w;if(t.type==="signature"||t.type==="initial")if(h){let I=document.createElement("img");I.src=this.getSignatureImageUrl(t.id||""),I.style.width="100%",I.style.height="100%",I.style.objectFit="contain",I.style.borderRadius="4px",o.appendChild(I),T&&(o.style.cursor="default")}else{let I=this.createFieldPlaceholder(t);o.appendChild(I)}else if(w){let I=this.createFieldPlaceholder(t);o.appendChild(I)}else if(T){let I=document.createElement("div");I.textContent=h||"",I.style.width="100%",I.style.height="100%",I.style.display="flex",I.style.alignItems="center",I.style.justifyContent="center",I.style.fontSize="12px",I.style.fontWeight="500",I.style.color="var(--main-text-color)",I.style.padding="4px",I.style.textAlign="center",I.style.userSelect="none",o.appendChild(I),o.style.cursor="default"}else{let I=this.createInlineInput(t,h||"");o.appendChild(I),o.style.cursor="text"}}else{let h=this.fieldValues.get(t.id||""),w=this.isPrefillField(t),V=h&&h.trim()!=="";if(w&&V)if(t.type==="signature"||t.type==="initial"){let T=document.createElement("img");T.src=this.getSignatureImageUrl(t.id||""),T.style.width="100%",T.style.height="100%",T.style.objectFit="contain",T.style.borderRadius="4px",T.style.pointerEvents="none",o.appendChild(T)}else{let T=document.createElement("div");T.textContent=h,T.style.width="100%",T.style.height="100%",T.style.display="flex",T.style.alignItems="center",T.style.justifyContent="center",T.style.fontSize="12px",T.style.fontWeight="500",T.style.color="var(--main-text-color)",T.style.padding="4px",T.style.textAlign="center",T.style.pointerEvents="none",o.appendChild(T)}else{let T=this.createFieldPlaceholder(t);o.appendChild(T)}}if(!this.isSignerMode){let h=document.createElement("button");h.style.position="absolute",h.style.top="-26px",h.style.right="-10px",h.style.width="20px",h.style.height="20px",h.style.backgroundColor="rgba(239, 68, 68, 1)",h.style.borderRadius="50%",h.style.display="flex",h.style.alignItems="center",h.style.justifyContent="center",h.style.border="none",h.style.cursor="pointer",h.style.zIndex="30",h.style.boxShadow="0 2px 4px rgba(0,0,0,0.2)",h.title="Delete field";let w=document.createElement("i");w.className="fas fa-xmark",w.style.fontSize="10px",w.style.color="white",h.appendChild(w),h.addEventListener("click",V=>{V.stopPropagation(),this.removeField(t.id||"")}),h.addEventListener("mousedown",V=>{V.stopPropagation()}),o.appendChild(h),this.addResizeHandles(o,t)}if(o.addEventListener("mousedown",h=>{if(!this.isSignerMode&&!this.resizingField){let w=h.target;if(w.style.cursor&&w.style.cursor.includes("resize"))return;h.preventDefault(),h.stopPropagation(),this.hasDragged=!1,this.draggingField=W({},t),this.draggingFieldElement=o,o.style.transition="none";let V=this.screenToPdfPoints(h.clientX,h.clientY);V?(this.dragOffsetX=V.x-t.x,this.dragOffsetY=V.y-t.y):(this.dragOffsetX=0,this.dragOffsetY=0),this.cdr.markForCheck(),this.cdr.detectChanges()}}),o.addEventListener("click",h=>{if(this.isSignerMode){let w=this.fieldValues.get(t.id||"");if(!t.recipientId&&w&&w.trim()!==""){t.type==="attachment"&&w&&window.open(w,"_blank"),h.stopPropagation();return}if(t.type==="checkbox"||t.type==="radio"||t.type==="attachment"){h.stopPropagation();return}if(t.type==="signature"||t.type==="initial")this.onFieldClick(h,t.id||"");else{let I=document.getElementById(`field-input-${t.id}`);if(I)I.focus();else{let J=this.createInlineInput(t,w||"");o.innerHTML="",o.appendChild(J),o.style.cursor="text",setTimeout(()=>
2J.focus(),0)}}}else if(h.stopPropagation(),!this.hasDragged&&t.id){if(this.isRecipientField(t)){this.selectedField=W({},t),this.selectedField.fieldName||(this.selectedField.fieldName=this.getFieldTypeLabel(t.type)),this.editingGroupName=t.groupName??null,(t.type==="checkbox"||t.type==="radio")&&this.openAddMorePopover(t),this.renderFieldsIntoOverlays(),this.cdr.detectChanges();return}if(this.isPrefillField(t))if(t.type==="signature"||t.type==="initial")this.openFieldInputModalForPrefill(t.id);else{if(t.type==="checkbox"||t.type==="radio"){this.openAddMorePopover(t);return}if(t.type==="attachment")return;let w=document.getElementById(`field-input-${t.id}`);if(w)w.focus();else{let V=this.fieldValues.get(t.id||"")||"",T=this.createInlineInputForPrefill(t,V),I=o.querySelector("button"),J=Array.from(o.querySelectorAll('div[style*="resize"]'));o.innerHTML="",o.appendChild(T),I&&o.appendChild(I),J.forEach(k=>o.appendChild(k)),o.style.cursor="text",setTimeout(()=>T.focus(),0)}}}}),o.addEventListener("contextmenu",h=>{this.onFieldContextMenu(h,t)}),i.overlay.appendChild(o),!this.isSignerMode&&this.addMoreTarget?.field.id===t.id&&(t.type==="checkbox"||t.type==="radio")){let h=document.createElement("button");h.setAttribute("data-add-more-btn","true"),h.style.position="absolute",h.style.left=`${n.x+n.width/2-12}px`,h.style.top=`${n.y+n.height+4}px`,h.style.width="24px",h.style.height="24px",h.style.borderRadius="50%",h.style.backgroundColor="#10B981",h.style.color="white",h.style.border="none",h.style.cursor="pointer",h.style.display="flex",h.style.alignItems="center",h.style.justifyContent="center",h.style.zIndex="200",h.style.boxShadow="0 2px 4px rgba(0,0,0,0.3)",h.style.pointerEvents="auto",h.innerHTML='<span style="font-size:16px;line-height:1;pointer-events:none">+</span>',h.title=`Add another ${t.type}`,h.addEventListener("click",w=>{w.stopPropagation(),this.addSignatureField(Number(t.x)+Number(t.width)/2,Number(t.y)+Number(t.height)+5,t.type,t.pageNumber,t.groupName),this.addMoreTarget=null,this.renderFieldsIntoOverlays()}),i.overlay.appendChild(h)}}),this.pdfPages.forEach(t=>{t.overlay&&(t.overlay.style.pointerEvents=this.isSignerMode||this.isDragOver||this.draggingField!==null||this.resizingField!==null?"auto":"none")})}screenToPdfPoints(e,t){let i=this.pdfPagesContainer?.nativeElement;if(!i)return null;let n=i.getBoundingClientRect(),o=t-n.top,c=null;for(let g=this.pdfPages.length-1;g>=0;g--){let C=this.pdfPages[g];if(o>=C.offsetY&&o<=C.offsetY+C.height){c=C;break}}if(!c||!c.overlay)return null;let d=c.overlay.getBoundingClientRect(),x=e-d.left,v=t-d.top,F=x/c.viewportScale,P=v/c.viewportScale;return{x:Math.max(0,Math.min(F,c.pdfWidth)),y:Math.max(0,Math.min(P,c.pdfHeight)),pageNumber:c.pageNumber}}pdfPointsToScreen(e){let t=this.pdfPages.find(i=>i.pageNumber===e.pageNumber);return t?{x:e.x*t.viewportScale,y:e.y*t.viewportScale,width:e.width*t.viewportScale,height:e.height*t.viewportScale}:{x:e.x*this.zoom,y:e.y*this.zoom,width:e.width*this.zoom,height:e.height*this.zoom}}getSettingsPanelTitle(){return this.selectedField?{signature:"Signature",initial:"Initials",name:"Full Name",sign_date:"Sign Date",company:"Company",title:"Job Title",date:"Date",text:"Textfield",email:"Email",checkbox:"Checkbox",radio:"Radio",attachment:"Attachment"}[this.selectedField.type]||"Field Settings":""}isTextTypeField(){return this.selectedField?["text","name","email","company","title"].includes(this.selectedField.type):!1}getCheckboxGroupSize(){return this.selectedField?.groupName?this.signatureFields.filter(e=>e.type==="checkbox"&&e.groupName===this.selectedField.groupName).length:1}getCheckboxGroupValidationError(){let e=this.getCheckboxGroupSize(),t=this.selectedField?.minRequired,i=this.selectedField?.maxRequired;return t!==void 0&&t>0&&i!==void 0&&i>0&&i<t?"Max value must be greater than min value":t!=null&&t>0&&t>e?`Group has only ${e} checkbox${e!==1?"es":""}. Add more to set min ${t} validation.`:i!=null&&i>0&&i>e?`Group has only ${e} checkbox${e!==1?"es":""}. Add more to set max ${i} validation.`:""}onFieldSettingChange(){this.fieldSettingsChanged$.next(),this.cdr.detectChanges()}onFieldSettingsAutoSave(){if(!this.selectedField?.id||this.getCheckboxGroupValidationError())return;let e=W({},this.selectedField),t=this.signatureFields.findIndex(d=>d.id===e.id);t!==-1&&(this.signatureFields[t]=e),e.type==="checkbox"&&e.groupName&&(e.minRequired||e.maxRequired)&&e.required&&(e.required=!1,t!==-1&&(this.signatureFields[t]=e));let i=e.type==="checkbox"||e.type==="radio",n=this.editingGroupName,o=e.groupName?.trim()||null;if(i&&(n||o)){let d=n&&n!==o?n:o;this.signatureFields.filter(x=>
2x.groupName===d&&x.id!==e.id).forEach(x=>{n&&n!==o&&(x.groupName=o??void 0),e.type==="radio"&&(x.required=e.required),x.recipientId=e.recipientId,x.label=e.label,x.fieldName=e.fieldName,x.fixedWidth=e.fixedWidth,x.fixedHeight=e.fixedHeight,e.type==="checkbox"&&(x.minRequired=e.minRequired,x.maxRequired=e.maxRequired,(e.minRequired||e.maxRequired)&&(x.required=!1)),this.saveFieldPosition(x)})}this.editingGroupName=o;let c=["text","name","company","title","email","date"];e.id&&c.includes(e.type)&&e.defaultValue&&this.fieldValues.set(e.id,e.defaultValue),this.saveFieldPosition(e,!0),this.renderFieldsIntoOverlays()}getAssignableRecipients(){return this.recipients.filter(e=>e.role!=="receives_copy"&&e.id>0)}onFieldSettingsClose(){this.selectedField=null,this.editingGroupName=null,this.renderFieldsIntoOverlays(),this.cdr.detectChanges()}onFieldSettingsDelete(){this.selectedField?.id&&(this.removeField(this.selectedField.id),this.selectedField=null,this.editingGroupName=null,this.cdr.detectChanges())}onFieldClick(e,t){if(this.isSignerMode){e.stopPropagation();let i=this.signatureFields.find(n=>n.id===t);i&&(i.type==="signature"||i.type==="initial")&&this.openFieldInputModal(t)}else this.hasDragged||this.removeField(t)}getSignatureImageUrl(e){let t=this.fieldValues.get(e);return t?t.startsWith("data:")?t:`data:image/png;base64,${t}`:""}openFieldInputModal(e){let t=this.signatureFields.find(o=>o.id===e);if(!t)return;let i=W({field:t,fieldType:t.type},t.type==="initial"&&this.storedInitials?{prefilledInitials:this.storedInitials}:{});this.dialog.open(ze,{width:"700px",maxWidth:"90vw",data:i,disableClose:!0}).afterClosed().subscribe(o=>{if(o){if(this.fieldValues.set(o.fieldId,o.value),o.type==="signature"&&o.selectedSignatureStyle&&(this.storedSignatureStyle=o.selectedSignatureStyle),o.type==="signature"&&o.extractedInitials&&(this.storedInitials=o.extractedInitials,this.autoPopulateInitialsFields()),o.type==="name"&&o.value.trim()){let c=this.extractInitials(o.value);c&&(this.storedInitials=c,this.autoPopulateInitialsFields())}this.cdr.detectChanges(),this.renderFieldsIntoOverlays()}})}openFieldInputModalForPrefill(e){let t=this.signatureFields.find(o=>o.id===e);if(!t)return;let i=W({field:t,fieldType:t.type},t.type==="initial"&&this.storedInitials?{prefilledInitials:this.storedInitials}:{});this.dialog.open(ze,{width:"700px",maxWidth:"90vw",data:i,disableClose:!0}).afterClosed().subscribe(o=>{if(o){if(o.type==="signature"&&o.selectedSignatureStyle&&(this.storedSignatureStyle=o.selectedSignatureStyle),o.type==="signature"&&o.extractedInitials&&(this.storedInitials=o.extractedInitials,this.autoPopulateInitialsFields()),o.type==="name"&&o.value.trim()){let c=this.extractInitials(o.value);c&&(this.storedInitials=c,this.autoPopulateInitialsFields())}this.saveFieldValue(o.fieldId,o.value)}})}saveFieldValue(e,t,i){let n=this.signatureFields.find(o=>o.id===e);if(n){if(this.fieldValues.set(e,t),i&&this.fieldValues.set(e+"-filename",i),n.type==="name"&&t.trim()){let o=this.extractInitials(t);o&&(this.storedInitials=o,this.autoPopulateInitialsFields())}this.zilSignService.saveFieldValue(this.documentId,e,n.type,t,null,i).pipe(U(1)).subscribe({next:o=>{o.success&&(this.renderFieldsIntoOverlays(),this.cdr.detectChanges())},error:()=>{this.fieldValues.delete(e),i&&this.fieldValues.delete(e+"-filename")}})}}submitAllFields(){if(!this.signerToken||!this.documentId)return;let e=this.signatureFields.filter(g=>g.recipientId===this.currentRecipientId);if(e.length===0){this.alertService.failedAlert({content:"No fields assigned to this recipient",title:"Validation Error"});return}e.forEach(g=>{if(g.type==="sign_date"){let C=this.fieldValues.get(g.id||"");if(!C||C.trim()===""){let h=new Date().toISOString().split("T")[0];this.fieldValues.set(g.id||"",h)}}});let t=[],i=new Map;e.filter(g=>g.type==="checkbox"&&!!g.groupName).forEach(g=>{let C=g.groupName;i.has(C)||i.set(C,[]),i.get(C).push(g)});let n=[...i.entries()].sort(([,g],[,C])=>{let h=[...g].sort((V,T)=>V.pageNumber-T.pageNumber||V.y-T.y)[0],w=[...C].sort((V,T)=>V.pageNumber-T.pageNumber||V.y-T.y)[0];return h.pageNumber-w.pageNumber||h.y-w.y});this.failingGroupNames.clear();let o=null;if(n.forEach(([g,C],h)=>{let w=C.find(B=>B.minRequired!==void 0||B.maxRequired!==void 0);if(!w)return;let V=w.minRequired,T=w.maxRequired,I=V!==void 0&&V>0,J=T!==void 0&&T>0;if(!I&&!J)return;
2let k=C.filter(B=>this.fieldValues.get(B.id||"")==="true").length,Z=I&&k<V,X=J&&k>T;if(Z||X){this.failingGroupNames.add(g);let B=w.fieldName?.trim()||w.label?.trim()||`Checkbox group ${h+1}`,he=[...C].sort((Ae,Le)=>Ae.pageNumber-Le.pageNumber||Ae.y-Le.y)[0],Qt=`Page ${he.pageNumber}`,Jt=C.length,xe,Ce;I&&J&&V!==T?(xe=`between ${V} and ${T}`,Ce=V):X?(xe=`at most ${T}`,Ce=T):(xe=`at least ${V}`,Ce=V),t.push(`\u2022 "${B}" (${Qt}): Select ${xe} option${Ce>1?"s":""} \u2014 ${k} of ${Jt} selected`),o||(o=he)}}),t.length>0){let g=t.length===1?"Please fix the following before submitting:":`Please fix the following ${t.length} groups before submitting:`;this.alertService.failedAlert({content:`${g}
3
4${t.join(`
5`)}`,title:"Selection Required"}),this.renderFieldsIntoOverlays(),o&&this.scrollToPage(o.pageNumber);return}let c=new Set,d=new Map;e.filter(g=>g.type==="radio"&&g.required&&!!g.groupName).forEach(g=>{let C=g.groupName;d.has(C)||d.set(C,[]),d.get(C).push(g)}),d.forEach((g,C)=>{g.some(w=>this.fieldValues.get(w.id||"")==="true")&&c.add(C)});let x=new Set,v=e.filter(g=>{if(g.type==="sign_date"||!g.required)return!1;if(g.type==="radio"&&g.groupName)return c.has(g.groupName)||x.has(g.groupName)?!1:(x.add(g.groupName),!0);let C=this.fieldValues.get(g.id||"");return g.type==="checkbox"||g.type==="radio"?C!=="true":!C||C.trim()===""});if(v.length>0){let g=v.map(C=>C.type==="radio"&&C.groupName?`"${C.fieldName?.trim()||C.label?.trim()||"Radio group"}" (Page ${C.pageNumber}): select one option`:`${this.getFieldTypeLabel(C.type)} (Page ${C.pageNumber})`).join(", ");this.alertService.failedAlert({content:`Please fill all required fields: ${g}`,title:"Validation Error"}),this.scrollToPage(v[0].pageNumber);return}let F=e.map(g=>{let C=this.fieldValues.get(g.id||""),h={fieldId:g.id||"",value:C||"",type:g.type};if(g.type==="attachment"){let w=this.fieldValues.get((g.id||"")+"-filename");w&&(h.filename=w)}return h}),P=e.find(g=>{if(g.type!=="attachment"||!g.maxFileSizeMB)return!1;let C=this.fieldValues.get(g.id||"")||"";return Math.ceil((C.split(",")[1]?.length??C.length)*3/4)>g.maxFileSizeMB*1024*1024});if(P){let g=this.fieldValues.get((P.id||"")+"-filename")||"attachment";this.alertService.failedAlert({title:"Attachment Too Large",content:`"${g}" exceeds the ${P.maxFileSizeMB} MB limit \u2014 please upload a smaller file`});return}this.loadingSubmit=!0,this.zilSignService.submitFieldValuesOutside(this.documentId,this.signerToken,F).pipe(U(1),Me(()=>{this.loadingSubmit=!1})).subscribe({next:g=>{g.success?this.router.navigate(["/outside/zil-sign/success"],{queryParams:{token:this.signerToken,documentId:this.documentId}}):this.alertService.failedAlert({content:"Failed to submit signature",title:"Error"})}})}selectField(e){this.selectedField=e,this.selectedField.fieldName||(this.selectedField.fieldName=this.getFieldTypeLabel(e.type)),this.editingGroupName=e.groupName??null,this.showFieldInspector=!0,this.cdr.detectChanges()}closeFieldInspector(){this.showFieldInspector=!1,this.selectedField=null,this.editingGroupName=null,this.cdr.detectChanges()}updateFieldFromInspector(e){if(!this.selectedField?.id)return;let t=this.signatureFields.findIndex(i=>i.id===this.selectedField?.id);t!==-1&&(this.signatureFields[t]=W(W({},this.signatureFields[t]),e),this.selectedField=W(W({},this.selectedField),e),this.saveFieldPosition(this.signatureFields[t]),this.renderFieldsIntoOverlays(),this.cdr.detectChanges())}addSignatureField(e,t,i,n,o){!this.selectedRecipientId&&!this.isSignerMode&&this.autoSelectRecipient();let c=105,d=25;(i==="checkbox"||i==="radio")&&(c=20,d=20);let x=this.selectedRecipientId===-1?null:this.selectedRecipientId||void 0,v=o?this.signatureFields.find(g=>g.type===i&&g.groupName===o):void 0,F=v?{required:v.required,minRequired:v.minRequired,maxRequired:v.maxRequired,fixedWidth:v.fixedWidth,fixedHeight:v.fixedHeight}:{},P=W(W({type:i,x:Math.max(0,e-c/2),y:Math.max(0,t-d/2),width:c,height:d,pageNumber:n,recipientId:x},o?{groupName:o}:{}),F);this.zilSignService.createField(this.documentId,W({documentId:this.documentId},P)).pipe(U(1)).subscribe({next:g=>
5{if(g.success&&g.data){let C=W({id:g.data.id},P);i==="radio"&&!C.groupName&&C.id?(C.groupName=`radio-group-${C.id}`,this.saveFieldPosition(C)):i==="checkbox"&&!C.groupName&&C.id?(C.groupName=`checkbox-group-${C.id}`,this.saveFieldPosition(C)):v&&C.id&&this.saveFieldPosition(C),this.signatureFields=[...this.signatureFields,C],this.currentPage=n,i==="initial"&&this.storedInitials&&this.autoPopulateInitialsFields(),this.cdr.detectChanges(),this.renderFieldsIntoOverlays()}}})}removeField(e){e&&(this.signatureFields=this.signatureFields.filter(t=>t.id!==e),this.selectedField?.id===e&&(this.selectedField=null,this.editingGroupName=null),this.cdr.detectChanges(),this.renderFieldsIntoOverlays(),this.zilSignService.deleteField(this.documentId,e).pipe(U(1)).subscribe({next:()=>{}}))}onFieldContextMenu(e,t){this.isSignerMode||(e.preventDefault(),e.stopPropagation(),this.contextMenuX=e.clientX,this.contextMenuY=e.clientY,this.contextMenuFieldId=t.id||"",this.showContextMenu=!0,this.cdr.detectChanges())}onCloseContextMenu(){this.showContextMenu=!1,this.contextMenuFieldId="",this.cdr.detectChanges()}openAddMorePopover(e){let t=e;if(e.groupName){let i=this.signatureFields.filter(n=>(n.type==="checkbox"||n.type==="radio")&&n.groupName===e.groupName&&n.pageNumber===e.pageNumber);i.length>0&&(t=i.reduce((n,o)=>Number(o.y)+Number(o.height)>Number(n.y)+Number(n.height)?o:n))}this.addMoreTarget={field:t},this.renderFieldsIntoOverlays(),this.cdr.detectChanges()}onDocumentClick(e){if(!this.addMoreTarget)return;e.target.closest("[data-add-more-btn]")||(this.addMoreTarget=null,this.renderFieldsIntoOverlays(),this.cdr.detectChanges())}onContextMenuAction(e){switch(e.action){case"delete":this.removeField(e.fieldId);break;case"placeOnOtherPages":this.openPlaceFieldModal(e.fieldId);break;default:break}}openPlaceFieldModal(e){let t=this.signatureFields.find(n=>n.id===e);if(!t)return;this.dialog.open(Yt,{width:"500px",maxWidth:"90vw",data:{fieldId:e,currentPage:t.pageNumber,totalPages:this.totalPages},disableClose:!1}).afterClosed().subscribe(n=>{n&&this.placeFieldOnPages(t,n.fromPage,n.toPage)})}placeFieldOnPages(e,t,i){let n=[];for(let x=t;x<=i;x++)x!==e.pageNumber&&n.push(x);if(n.length===0){this.alertService.failedAlert({content:"No additional pages to place the field on",title:"Info"});return}let o=[],c=0,d=!1;n.forEach(x=>{let v={documentId:this.documentId,type:e.type,x:e.x,y:e.y,width:e.width,height:e.height,pageNumber:x,recipientId:e.recipientId===-1?void 0:e.recipientId,applyToAllPages:!1};this.zilSignService.createField(this.documentId,v).pipe(U(1)).subscribe({next:F=>{if(F.success&&F.data){let P=W({id:F.data.id},v);o.push(P),c++,c===n.length&&!d&&(this.signatureFields=[...this.signatureFields,...o],this.cdr.detectChanges(),this.renderFieldsIntoOverlays(),this.alertService.successAlert({content:`Field placed on ${o.length} page(s) successfully`,title:"Success"}))}else d=!0,this.alertService.failedAlert({content:"Failed to place fields on other pages",title:"Error"})},error:()=>{d=!0}})})}addResizeHandles(e,t){let i=t.fixedWidth,n=t.fixedHeight;[{position:"nw",cursor:"nw-resize",top:"-4px",left:"-4px",needsW:!0,needsH:!0},{position:"n",cursor:"n-resize",top:"-4px",left:"50%",transform:"translateX(-50%)",needsW:!1,needsH:!0},{position:"ne",cursor:"ne-resize",top:"-4px",right:"-4px",needsW:!0,needsH:!0},{position:"e",cursor:"e-resize",top:"50%",right:"-4px",transform:"translateY(-50%)",needsW:!0,needsH:!1},{position:"se",cursor:"se-resize",bottom:"-4px",right:"-4px",needsW:!0,needsH:!0},{position:"s",cursor:"s-resize",bottom:"-4px",left:"50%",transform:"translateX(-50%)",needsW:!1,needsH:!0},{position:"sw",cursor:"sw-resize",bottom:"-4px",left:"-4px",needsW:!0,needsH:!0},{position:"w",cursor:"w-resize",top:"50%",left:"-4px",transform:"translateY(-50%)",needsW:!0,needsH:!1}].filter(c=>!(i&&c.needsW)&&!(n&&c.needsH)).forEach(c=>{let d=document.createElement("div");d.style.position="absolute",d.style.width="8px",d.style.height="8px",d.style.backgroundColor="rgba(59, 130, 246, 0.8)",d.style.border="1px solid white",d.style.borderRadius="2px",d.style.cursor=c.cursor,d.style.zIndex="25",d.style.pointerEvents="auto",d.style.boxShadow="0 1px 3px rgba(0,0,0,0.3)",c.top&&(d.style.top=c.top),c.bottom&&(d.style.bottom=c.bottom),c.left&&(d.style.left=c.left),c.right&&(d.style.right=c.right),c.transform&&(d.style.transform=c.transform),d.addEventListener("mousedown",x=>{x.preventDefault(),x.stopPropagation(),this.onResizeStart(x,t,c.position,e)}),d.addEventListener("click",x=>{x.stopPropagation()}),e.appendChild(d)})}onResizeStart(e,t,i,n){let o=t.width!=null&&!Number.isNaN(Number(t.width))?Number(t.width):150,c=t.height!=null&&!Number.isNaN(Number(t.height))?Number(t.height):50;this.resizingField=Ee(W({},t),{width:o,height:c}),this.resizeHandle=i,this.resizeStartX=e.clientX,this.resizeStartY=e.clientY,this.resizeStartWidth=o,this.resizeStartHeight=c,this.resizeStartLeft=Number(t.x)||0,this.resizeStartTop=Number(t.y)||0;let d=v=>{this.onResize(v,n)},x=()=>{this.onResizeEnd(),document.removeEventListener("mousemove",d),document.removeEventListener("mouseup",x)};document.addEventListener("mousemove",d),document.addEventListener("mouseup",x)}onResize(e,t){if(!this.resizingField||!this.resizeHandle)return;let i=this.pdfPages.find(C=>C.pageNumber===this.resizingField?.pageNumber);if(!i)return;let n=(e.clientX-this.resizeStartX)/i.viewportScale,o=(e.clientY-this.resizeStartY)/i.viewportScale,c=this.resizeStartWidth,d=this.resizeStartHeight,x=this.resizeStartLeft,v=this.resizeStartTop,F=this.resizingField?.type==="checkbox"||this.resizingField?.type==="radio",P=F?10:30,g=F?10:20;switch(this.resizeHandle){case"nw":c=Math.max(P,this.resizeStartWidth-n),d=Math.max(g,this.resizeStartHeight-o),x=this.resizeStartLeft+(this.resizeStartWidth-c),v=this.resizeStartTop+(this.resizeStartHeight-d);break;case"n":d=Math.max(g,this.resizeStartHeight-o),v=this.resizeStartTop+(this.resizeStartHeight-d);break;case"ne":c=Math.max(P,this.resizeStartWidth+n),d=Math.max(g,this.resizeStartHeight-o),v=this.resizeStartTop+(this.resizeStartHeight-d);break;case"e":c=Math.max(P,this.resizeStartWidth+n);break;case"se":c=Math.max(P,this.resizeStartWidth+n),d=Math.max(g,this.resizeStartHeight+o);break;case"s":d=Math.max(g,this.resizeStartHeight+o);break;case"sw":c=Math.max(P,this.resizeStartWidth-n),d=Math.max(g,this.resizeStartHeight+o),x=this.resizeStartLeft+(this.resizeStartWidth-c);break;case"w":c=Math.max(P,this.resizeStartWidth-n),x=this.resizeStartLeft+(this.resizeStartWidth-c);break}if(this.resizingField){this.resizingField.fixedWidth&&(c=this.resizeStartWidth,x=this.resizeStartLeft),this.resizingField.fixedHeight&&(d=this.resizeStartHeight,v=this.resizeStartTop),this.resizingField.width=c!=null&&!isNaN(c)?c:this.resizeStartWidth,this.resizingField.height=d!=null&&!isNaN(d)?d:this.resizeStartHeight,this.resizingField.x=x!=null&&!isNaN(x)?x:this.resizeStartLeft,this.resizingField.y=v!=null&&!isNaN(v)?v:this.resizeStartTop;let C=this.pdfPointsToScreen(this.resizingField);t.style.width=`${C.width}px`,t.style.height=`${C.height}px`,t.style.left=`${C.x}px`,t.style.top=`${C.y}px`}}onResizeEnd(){if(!this.resizingField||!this.resizeHandle)return;let e=this.resizingField.width!=null&&!isNaN(this.resizingField.width)?this.resizingField.width:this.resizeStartWidth,t=this.resizingField.height!=null&&!isNaN(this.resizingField.height)?this.resizingField.height:this.resizeStartHeight,i=this.resizingField.x!=null&&!isNaN(this.resizingField.x)?this.resizingField.x:this.resizeStartLeft,n=this.resizingField.y!=null&&!isNaN(this.resizingField.y)?this.resizingField.y:this.resizeStartTop,o=Ee(W({},this.resizingField),{width:e,height:t,x:i,y:n}),c=this.signatureFields.findIndex(d=>d.id===o.id);c!==-1&&(this.signatureFields[c]=o,this.saveFieldPosition(o),this.selectedField?.id===o.id&&(this.selectedField=W({},o)),this.renderFieldsIntoOverlays(),this.cdr.detectChanges()),this.resizingField=null,this.resizeHandle=null}saveFieldPosition(e,t=!1){if(!e.id)return;let i={documentId:this.documentId,type:e.type,x:e.x!=null&&!isNaN(e.x)?e.x:0,y:e.y!=null&&!isNaN(e.y)?e.y:0,width:e.width!=null&&!isNaN(e.width)?e.width:150,height:e.height!=null&&!isNaN(e.height)?e.height:50,pageNumber:e.pageNumber,recipientId:e.recipientId,applyToAllPages:!0,fieldName:e.fieldName,groupName:e.groupName,defaultValue:e.defaultValue,validation:e.validation,characterLimit:e.characterLimit,maxFileSizeMB:e.maxFileSizeMB,dataLabel:e.dataLabel,fixedWidth:e.fixedWidth,fixedHeight:e.fixedHeight,required:e.required,minRequired:e.minRequired,maxRequired:e.maxRequired};this.zilSignService.updateField(this.documentId,e.id,i).pipe(U(1)).subscribe({next:()=>{t&&(this.fieldSettingsSaved=!0,setTimeout(()=>{this.fieldSettingsSaved=!1,this.cdr.detectChanges()},2e3),this.cdr.detectChanges())}})}goBack(){this.isSignerMode||this.router.navigate(["manage/business-tools/zil-sign"])}preview(){}send(){let e=this.recipients.filter(c=>c.id!==-1&&this.canAssignFields(c));if(e.length===0){this.alertService.failedAlert({content:"Please add at least one signer recipient",title:"Validation Error"});return}if(this.signatureFields.filter(c=>c.recipientId&&c.recipientId!==-1).length===0&&this.signatureFields.length===0){this.alertService.failedAlert({content:"Please add at least one signature field",title:"Validation Error"});return}let i=e.map(c=>{let d=this.signatureFields.filter(x=>x.recipientId===c.id).length;return{recipientName:c.name,recipientEmail:c.email,fieldCount:d}}),n=i.filter(c=>c.fieldCount===0);if(n.length>0){let c=n.map(d=>d.recipientEmail).join(", ");this.alertService.failedAlert({content:`The following recipients have no fields assigned: ${c}. Please add at least one field for each recipient.`,title:"Error"});return}this.dialog.open(Ht,{width:"600px",maxWidth:"90vw",data:{recipients:i},disableClose:!1}).afterClosed().subscribe(c=>{c&&this.sendDocument()})}sendDocument(){this.loadingSubmit=!0;let e=this.recipients.filter(t=>t.id!==-1);this.zilSignService.sendDocument(this.documentId,e,this.signatureFields).pipe(U(1),Me(()=>{this.loadingSubmit=!1})).subscribe({next:t=>{t.success?(this.alertService.successAlert({content:t.data?.message||"Document sent successfully",title:"Success"}),this.goBack()):this.alertService.failedAlert({content:"Failed to send document",title:"Error"})}})}getRecipientDisplayName(e){return e.name||""}getRecipientIcon(e){return e.id===-1?"P":String(e.name[0]||"")}getRecipientColor(e){if(!e)return"#6B7280";let t=this.recipients.findIndex(i=>i.id===e);return t===-1?"#6B7280":this.recipientColors[t%this.recipientColors.length]}getRecipientColorRgba(e,t=.3){let n=this.getRecipientColor(e).replace("#",""),o=parseInt(n.substring(0,2),16),c=parseInt(n.substring(2,4),16),d=parseInt(n.substring(4,6),16);return`rgba(${o}, ${c}, ${d}, ${t})`}getRecipientBorderColorRgba(e,t=.5){let n=this.getRecipientColor(e).replace("#",""),o=parseInt(n.substring(0,2),16),c=parseInt(n.substring(2,4),16),d=parseInt(n.substring(4,6),16);return`rgba(${o}, ${c}, ${d}, ${t})`}getVisibleFields(){return this.isSignerMode&&this.currentRecipientId?this.signatureFields.filter(e=>{let t=!e.recipientId,i=e.value&&e.value.trim()!=="";return e.recipientId===this.currentRecipientId?!0:t&&i?e.type==="attachment":t&&!i}):this.signatureFields}getFieldsForRecipient(e){return e===-1?this.signatureFields.filter(t=>this.isPrefillField(t)):this.signatureFields.filter(t=>t.recipientId===e)}onRecipientSelect(e){let t=this.recipients.find(i=>i.id===e);t&&!this.canAssignFields(t)||this.selectedRecipientId!==e&&(this.selectedRecipientId=e,this.renderFieldsIntoOverlays(),this.cdr.detectChanges())}autoSelectRecipient(){if(!this.isSignerMode&&!this.selectedRecipientId){let e=this.recipients.filter(t=>t.role==="signer");e.length===1?this.selectedRecipientId=e[0].id:e.length>0&&(this.selectedRecipientId=e[0].id)}}getSelectedRecipientName(){return this.selectedRecipientId&&this.recipients.find(t=>
5t.id===this.selectedRecipientId)?.name||""}generateThumbnail(e){return Ie(this,null,function*(){try{let t=e.getViewport({scale:.15}),i=document.createElement("canvas"),n=i.getContext("2d");return n?(i.width=t.width,i.height=t.height,yield e.render({canvasContext:n,viewport:t}).promise,i.toDataURL("image/png")):""}catch{return""}})}openSignAgreementModal(){this.dialog.open(Gt,{width:"700px",maxWidth:"90vw",disableClose:!0,data:{documentId:this.documentId,email:this.email(),username:this.username()}}).afterClosed().subscribe(t=>{t&&this.canSubmit.set(!0)})}buildInteractiveFieldContent(e,t,i){e.type==="checkbox"?this.buildCheckboxContent(e,t,i):e.type==="radio"?this.buildRadioContent(e,t,i):e.type==="attachment"&&this.buildAttachmentContent(e,t,i)}buildCheckboxContent(e,t,i){let n=e.recipientId?this.getRecipientColor(e.recipientId):"#10B981",o=this.isSignerMode||this.isPrefillField(e),c=document.createElement("input");c.type="checkbox",c.checked=i==="true",c.style.width="55%",c.style.height="55%",c.style.accentColor=n,c.style.cursor=o?"pointer":"move",o?(c.addEventListener("change",d=>{d.stopPropagation();let x=d.target.checked;if(x&&e.maxRequired&&e.groupName&&this.signatureFields.filter(P=>P.type==="checkbox"&&P.groupName===e.groupName&&P.id!==e.id&&this.fieldValues.get(P.id||"")==="true").length>=e.maxRequired){d.target.checked=!1;return}let v=x?"true":"false";this.isPrefillField(e)?this.saveFieldValue(e.id||"",v):(this.fieldValues.set(e.id||"",v),this.isSignerMode&&e.groupName&&(this.failingGroupNames.delete(e.groupName),setTimeout(()=>this.renderFieldsIntoOverlays(),0)))}),c.addEventListener("mousedown",d=>d.stopPropagation()),c.addEventListener("click",d=>d.stopPropagation())):c.style.pointerEvents="none",t.appendChild(c)}buildRadioContent(e,t,i){let n=e.recipientId?this.getRecipientColor(e.recipientId):"#10B981",o=e.groupName||`page-${e.pageNumber}-recipient-${e.recipientId??"none"}`,c=this.isSignerMode||this.isPrefillField(e),d=document.createElement("input");d.type="radio",d.name=o,d.checked=i==="true",d.style.width="55%",d.style.height="55%",d.style.accentColor=n,d.style.cursor=c?"pointer":"move",c?(d.addEventListener("change",x=>{if(x.stopPropagation(),x.target.checked){let v=this.isPrefillField(e);this.signatureFields.forEach(F=>{F.type==="radio"&&F.id!==e.id&&(F.groupName||`page-${F.pageNumber}-recipient-${F.recipientId??"none"}`)===o&&(this.fieldValues.set(F.id||"","false"),v&&F.id&&this.zilSignService.saveFieldValue(this.documentId,F.id,F.type,"false",null).pipe(U(1)).subscribe())}),v?this.saveFieldValue(e.id||"","true"):this.fieldValues.set(e.id||"","true")}}),d.addEventListener("mousedown",x=>x.stopPropagation()),d.addEventListener("click",x=>x.stopPropagation())):d.style.pointerEvents="none",t.appendChild(d)}buildAttachmentContent(e,t,i){let n=e.recipientId?this.getRecipientColor(e.recipientId):"#6B7280";if(this.isSignerMode||this.isPrefillField(e)){let o=!!i,c=this.fieldValues.get((e.id||"")+"-filename")||"Attachment";if(this.isSignerMode&&this.isPrefillField(e)&&o)return;let d=document.createElement("label");d.htmlFor=`attachment-input-${e.id}`,d.style.display="flex",d.style.alignItems="center",d.style.justifyContent="center",d.style.cursor="pointer",d.style.width="100%",d.style.height="100%",d.style.gap="2px";let x=document.createElement("i");x.className="far fa-paperclip",x.style.fontSize="12px",x.style.color=o?"#10B981":n,x.style.flexShrink="0";let v=document.createElement("span");v.style.fontSize="10px",v.style.overflow="hidden",v.style.textOverflow="ellipsis",v.style.whiteSpace="nowrap",o?(v.textContent=c,v.style.color="var(--main-text-color)"):(v.textContent="Upload file",v.style.color="var(--secondary-text-color)",d.style.flexDirection="row"),d.addEventListener("mousedown",P=>{this.isSignerMode&&P.stopPropagation()}),d.addEventListener("click",P=>{P.stopPropagation(),this.hasDragged&&P.preventDefault()});let F=document.createElement("input");F.type="file",F.id=`attachment-input-${e.id}`,F.style.display="none",F.addEventListener("change",P=>{P.stopPropagation();let g=P.target.files?.[0];if(g){if(e.maxFileSizeMB&&g.size>e.maxFileSizeMB*1024*1024){if(F.value="",!t.querySelector(".attachment-size-error")){let w=document.createElement("span");w.className="attachment-size-error",w.style.cssText="position:absolute;bottom:2px;left:0;right:0;display:block;width:100%;padding:3px 6px 0;box-sizing:border-box;text-align:center;line-height:1.2;font-size:9px;color:var(--common-red-color);pointer-events:none;",w.textContent=`Max ${e.maxFileSizeMB} MB allowed`,t.appendChild(w)}return}let C=new FileReader;C.onload=()=>{let h=C.result;this.isPrefillField(e)?this.saveFieldValue(e.id||"",h,g.name):(this.fieldValues.set(e.id||"",h),this.fieldValues.set((e.id||"")+"-filename",g.name)),this.renderFieldsIntoOverlays()},C.readAsDataURL(g)}}),d.appendChild(x),d.appendChild(v),d.appendChild(F),t.appendChild(d)}else t.appendChild(this.createFieldPlaceholder(e))}getClickToFillText(e,t){return e.type==="checkbox"||e.type==="radio"?`Click to select ${t}${e.recipientId?` (${e.recipientId})`:""}`:e.type==="attachment"?`Click to upload ${t}${e.recipientId?` (${e.recipientId})`:""}`:`Click to fill ${t}${e.recipientId?` (${e.recipientId})`:""}`}ngOnDestroy(){typeof window<"u"&&this.windowResizeHandler&&window.removeEventListener("resize",this.windowResizeHandler),this.fieldSettingsChanged$.complete()}static{this.\u0275fac=function(t){return new(t||r)}}static{this.\u0275cmp=Y({type:r,selectors:[["app-sign-pdf-viewer"]],viewQuery:function(t,i){if(t&1&&(le(Oi,5),le(Bi,5),le($i,5)),t&2){let n;se(n=de())&&(i.pdfContainer=n.first),se(n=de())&&(i.pdfOverlay=n.first),se(n=de())&&(i.pdfPagesContainer=n.first)}},hostBindings:function(t,i){t&1&&S("click",function(o){return i.onDocumentClick(o)},!1,oe)},standalone:!0,features:[G],decls:40,vars:29,consts:[["pdfContainer",""],["pdfPagesContainer",""],["pdfOverlay",""],[1,"flex","flex-col","h-screen","bg-main-background-color","overflow-hidden"],[1,"flex","flex-col","md:flex-row","items-start","md:items-center","justify-between","px-4","md:px-6","py-3","bg-main-background-color","border-b","border-input-border-color","gap-3"],[1,"flex","items-center","gap-3","flex-1","min-w-0"],[1,"text-secondary-text-color","hover:text-main-text-color","transition-colors","flex-shrink-0"],[1,"flex","items-center","gap-2","text-xs","md:text-sm","text-secondary-text-color","min-w-0"],[1,"hidden","sm:inline"],[1,"text-xs","hidden","sm:inline",3,"icon"],[1,"text-main-text-color","truncate"],[1,"flex","items-center","gap-2","md:gap-4","flex-shrink-0"],[1,"p-1","text-secondary-text-color","hover:text-main-text-color","disabled:opacity-40","disabled:cursor-not-allowed","transition-colors",3,"click","disabled"],[1,"text-xs","md:text-sm",3,"icon"],[1,"text-xs","md:text-sm","text-main-text-color","font-medium","whitespace-nowrap"],[1,"h-6","w-px","bg-input-border-color","mx-1","md:mx-2"],[1,"p-1","text-secondary-text-color","hover:text-main-text-color","transition-colors",3,"click"],[1,"text-xs",3,"icon"],[1,"text-xs","text-secondary-text-color","whitespace-nowrap"],[1,"flex","items-center","gap-2","flex-shrink-0"],["text","Send",3,"type","loading"],[1,"flex","flex-1","overflow-hidden"],[1,"hidden","2xl:block","w-[200px]","bg-main-background-color","border-r","border-input-border-color","overflow-y-auto","flex-shrink-0"],[1,"flex-1","flex","flex-col","overflow-hidden","bg-secondary-background-color","min-w-0"],[1,"flex-1","relative","overflow-auto","transition-all","bg-secondary-background-color","p-2","md:p-3","lg:p-5","flex","justify-center",3,"ngClass"],[1,"flex","items-center","justify-center","h-full"],[1,"relative","min-h-full","w-full"],[1,"absolute","
5inset-0","z-[50]",3,"ngClass"],[1,"w-full","sm:w-[250px]","md:w-[280px]","lg:w-[20%]","bg-main-background-color","border-l","border-input-border-color","flex-shrink-0","flex","flex-col"],[3,"x","y","fieldId"],[1,"text-secondary-text-color","hover:text-main-text-color","transition-colors","flex-shrink-0",3,"click"],[1,"text-sm",3,"icon"],["text","Send",3,"clickEvent","type","loading"],[3,"clickEvent","type","text","loading","disabled"],[1,"p-3"],[1,"text-xs","font-semibold","text-main-text-color","mb-2","uppercase"],[1,"flex","flex-col","gap-2"],["role","button","tabindex","0",1,"relative","cursor-pointer","rounded","p-1","transition-all","hover:bg-secondary-background-color","hover:shadow-sm",3,"ngClass"],["role","button","tabindex","0",1,"relative","cursor-pointer","rounded","p-1","transition-all","hover:bg-secondary-background-color","hover:shadow-sm",3,"click","keyup.enter","keyup.space","ngClass"],[1,"aspect-[3/4]","bg-secondary-background-color","rounded","overflow-hidden","flex","items-center","justify-center","relative"],[1,"w-full","h-full","object-contain",3,"src","alt"],[1,"absolute","-top-1","-left-1","w-5","h-5","bg-common-blue-color","rounded-full","flex","items-center","justify-center","shadow-md"],[1,"text-xs","text-secondary-text-color"],[1,"text-xs","text-main-text-color","font-semibold"],[1,"text-center"],[1,"text-secondary-text-color"],[1,"text-center","p-4","bg-common-secondary-red-color","bg-opacity-10","border","border-common-red-color","rounded"],[1,"text-main-text-color"],[1,"flex","flex-col","h-full"],[1,"flex","items-center","justify-between","px-4","py-3","border-b","border-input-border-color","flex-shrink-0"],[1,"text-sm","font-semibold","text-main-text-color"],[1,"text-xs","text-common-green-color","font-medium"],[1,"text-secondary-text-color","hover:text-main-text-color","transition-colors","p-1","rounded",3,"click"],[1,"flex-1","overflow-y-auto","p-4","flex","flex-col","gap-4"],[1,"flex","flex-col","gap-1"],[1,"text-xs","font-medium","text-secondary-text-color"],[1,"w-full","px-3","py-2","text-sm","border","border-input-border-color","rounded","bg-secondary-background-color","text-main-text-color","focus:outline-none","focus:border-common-blue-color",3,"ngModelChange","ngModel"],[3,"ngValue"],[1,"flex","flex-col","gap-3"],[1,"flex","items-center","gap-2","select-none",3,"title"],["type","checkbox",1,"w-4","h-4","accent-common-green-color","rounded","cursor-pointer",3,"ngModelChange","ngModel","disabled"],[1,"text-sm","text-main-text-color"],[1,"flex","items-center","gap-2","select-none"],["type","checkbox",1,"w-4","h-4","accent-common-green-color","rounded","cursor-pointer",3,"ngModelChange","ngModel"],["type","text",1,"w-full","px-3","py-2","text-sm","border","border-input-border-color","rounded","bg-secondary-background-color","text-main-text-color","focus:outline-none","focus:border-common-blue-color",3,"ngModelChange","ngModel"],[1,"flex","items-center","justify-between","px-4","py-3","border-t","border-input-border-color","flex-shrink-0"],["text","Delete",3,"clickEvent","type"],["type","text","placeholder","e.g. gender, yes_no",1,"w-full","px-3","py-2","text-sm","border","border-input-border-color","rounded","bg-secondary-background-color","text-main-text-color","focus:outline-none","focus:border-common-blue-color",3,"ngModelChange","ngModel"],["type","text","placeholder","e.g. payment_method",1,"w-full","px-3","py-2","text-sm","border","border-input-border-color","rounded","bg-secondary-background-color","text-main-text-color","focus:outline-none","focus:border-common-blue-color",3,"ngModelChange","ngModel"],[1,"flex","gap-2"],[1,"flex","flex-col","gap-1","flex-1"],["type","number","min","0","placeholder","0",1,"w-full","px-3","py-2","text-sm","border","border-input-border-color","rounded","bg-secondary-background-color","text-main-text-color","focus:outline-none","focus:border-common-blue-color",3,"ngModelChange","ngModel","max"],["type","number","min","0","placeholder","\u221E",1,"w-full","px-3","py-2","text-sm","border","border-input-border-color","rounded","bg-secondary-background-color","text-main-text-color","focus:outline-none","focus:border-common-blue-color",3,"ngModelChange","ngModel","max"],[1,"text-xs","font-medium","text-common-red-color"],["type","number","min","1","placeholder","No limit",1,"w-full","px-3","py-2","text-sm","border","border-input-border-color","rounded","bg-secondary-background-color","text-main-text-color","focus:outline-none","focus:border-common-blue-color",3,"ngModelChange","ngModel"],["type","number","min","1",1,"w-full","px-3","py-2","text-sm","border","border-input-border-color","rounded","bg-secondary-background-color","text-main-text-color","focus:outline-none","focus:border-common-blue-color",3,"ngModelChange","ngModel"],["value","none"],["value","numeric"],["value","alphabet"],[1,"p-2","md:p-4","overflow-y-auto","flex-1"],[1,"mb-4","md:mb-6"],[1,"flex","items-center","justify-between","mb-2","md:mb-3"],[1,"text-sm","md:text-base","font-semibold","text-main-text-color"],[1,"flex","items-center","justify-between","px-3","py-2","rounded-lg","border-2","transition-all",3,"ngClass","border-color","background-color"],[1,"text-common-blue-color","text-base","flex-shrink-0",3,"icon","matTooltip","matTooltipClass","matTooltipPosition","matTooltipShowDelay"],[1,"grid","grid-cols-2","gap-2"],["draggable","true",1,"flex","flex-row","items-center","justify-between","p-2","border","border-input-border-color","bg-secondary-background-color","rounded-lg","cursor-move","transition-all","hover:bg-main-background-color","gap-2",3,"dragstart","dragend"],[1,"flex","items-center","gap-2"],[1,"w-6","h-6","rounded","flex","items-center","justify-center","bg-common-green-color","flex-shrink-0"],[1,"text-white","text-xs",3,"icon"],[1,"text-sm","font-medium","text-main-text-color"],[1,"text-secondary-text-color","text-xs","flex-shrink-0",3,"icon"],[1,"flex","items-center","justify-between","px-3","py-2","rounded-lg","border-2","transition-all",3,"click","keyup.enter","keyup.space","ngClass"],[1,"flex","items-center","gap-2","flex-1"],[1,"w-8","h-8","rounded-full","flex","items-center","justify-center","text-sm","font-semibold","text-white","transition-all","shadow-md"],[1,"flex","flex-col","flex-1","min-w-0"],[1,"text-xs","px-2","py-0.5","rounded-full","text-white","hidden","xl:block",3,"background-color"],[1,"text-xs","px-2","py-0.5","rounded-full","bg-gray-500","text-white"],[1,"text-xs","px-2","py-0.5","rounded-full","text-white","hidden","xl:block"],[1,"text-xs","text-gray-500","italic"],[3,"menuAction","closeMenu","x","y","fieldId"]],template:function(t,i){if(t&1){let n=R();a(0,"div",3)(1,"div",4)(2,"div",5),M(3,Qi,2,1,"button",6),a(4,"div",7)(5,"span",8),u(6,"Documents"),l(),b(7,"fa-icon",9),a(8,"span",10),u(9),l()()(),a(10,"div",11)(11,"button",12),S("click",function(){return f(n),_(i.previousPage())}),b(12,"fa-icon",13),l(),a(13,"span",14),u(14),l(),a(15,"button",12),S("click",function(){return f(n),_(i.nextPage())}),b(16,"fa-icon",13),l(),b(17,"div",15),a(18,"button",16),S("click",function(){return f(n),_(i.zoomOut())}
5),b(19,"fa-icon",17),l(),a(20,"span",18),u(21),l(),a(22,"button",16),S("click",function(){return f(n),_(i.zoomIn())}),b(23,"fa-icon",17),l()(),a(24,"div",19),M(25,Ji,1,3,"app-common-button-v35",20)(26,Zi,1,5),l()(),a(27,"div",21),M(28,on,7,0,"div",22),a(29,"div",23)(30,"div",24,0),M(32,an,4,0,"div",25)(33,rn,4,1,"div",25),b(34,"div",26,1)(36,"div",27,2),l()(),M(38,Tn,3,1,"div",28),l(),M(39,En,1,3,"app-field-context-menu",29),l()}t&2&&(s(3),E(3,i.isSignerMode?-1:3),s(4),m("icon",i.faChevronRight),s(2),q(i.documentName||"Loading..."),s(2),m("disabled",i.currentPage===1),s(),m("icon",i.faChevronLeft),s(2),Ye("Page ",i.currentPage," of ",i.totalPages,""),s(),m("disabled",i.currentPage===i.totalPages),s(),m("icon",i.faChevronRight),s(3),m("icon",i.faMagnifyingGlassMinus),s(2),D("",i.zoomLevel,"%"),s(2),m("icon",i.faMagnifyingGlassPlus),s(2),E(25,i.isSignerMode?26:25),s(3),E(28,i.pdfPages.length>0?28:-1),s(2),m("ngClass",Ge(24,Hi,i.isDragOver)),s(2),E(32,i.pdfLoading?32:-1),s(),E(33,i.pdfError&&!i.pdfLoading?33:-1),s(),$("display",i.pdfLoading||i.pdfError?"none":"block")("max-width",i.pdfPages.length>0?i.getMaxPdfWidth():"auto","px"),s(2),m("ngClass",H(26,Ui,!i.isDragOver&&i.draggingField===null,i.isDragOver||i.draggingField!==null)),s(2),E(38,i.isSignerMode?-1:38),s(),E(39,i.showContextMenu?39:-1))},dependencies:[j,Q,ye,ue,nt,ot,Se,be,ve,it,ce,Fe,we,pe,Ut,Et,Tt]})}}return r})();export{Go as SignPdfViewerComponent};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.