1try{!function(){var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="d8fbfd34-2d8f-438d-afb8-6f0968d26799",e._sentryDebugIdIdentifier="sentry-dbid-d8fbfd34-2d8f-438d-afb8-6f0968d26799")}()}catch(e){}"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7214],{6239:function(e,t,a){a.d(t,{Z:function(){return T}});var s=a(52322),n=a(1973),l=a(82781),r=a(26472),i=a(3508),o=a(59417),d=a(99603),u=a(13980),c=a.n(u),p=a(2784),g=a(54691),m=a(60141),y=a(79735);a(10849),a(14229);var f=a(21938),h=a(10661),x=a(47023),E=a(95254);let b=e=>{let{currentPage:t,signerRoles:a,onAddField:n,selectedRole:r,onRoleChange:u}=e,{addSignerRole:c,removeSignerRole:g}=(0,i.D)(),[m,y]=(0,p.useState)(""),[f,h]=(0,p.useState)(!1);(0,p.useEffect)(()=>{r&&!a.includes(r)&&u(a[0]||null)},[r,a,u]);let b=(0,p.useCallback)(()=>{let e=m.trim().toLowerCase();e&&!a.includes(e)&&(c(e),u(e),y(""),h(!1))},[m,a,c,u]),_=(0,p.useCallback)(e=>{a.includes(e)||(c(e),u(e))},[a,c,u]),S=(0,p.useCallback)(e=>{g(e),r===e&&u(a.filter(t=>t!==e)[0]||null)},[r,a,g,u]),v=(0,p.useCallback)(e=>{r&&n(e,r)},[r,n]),T=l.vL.filter(e=>!a.includes(e.value));return(0,s.jsxs)("div",{className:"h-full flex flex-col",children:[(0,s.jsxs)("div",{className:"px-4 py-3 border-b bg-gray-50",children:[(0,s.jsx)("h3",{className:"font-medium text-gray-900",children:"Add Fields"}),(0,s.jsx)("p",{className:"text-xs text-gray-500 mt-0.5",children:"Select a role, then click a field type to add"})]}),(0,s.jsxs)("div",{className:"px-4 py-3 border-b",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,s.jsx)("h4",{className:"text-sm font-medium text-gray-700",children:"Signer Roles"}),(0,s.jsx)("button",{className:"text-xs text-blue-600 hover:text-blue-700",onClick:()=>h(!f),type:"button",children:(0,s.jsx)(d.G,{className:"mr-1",icon:f?o.mTx:o.ptq,size:"xs"})})]}),!!f&&(0,s.jsxs)("div",{className:"mb-3",children:[(0,s.jsxs)("div",{className:"flex mb-2 items-center",children:[(0,s.jsx)("div",{children:(0,s.jsx)(E.o,{className:"flex-grow",name:"new_role",onChange:e=>y(e.target.value),onKeyDown:e=>"Enter"===e.key&&b(),placeholder:"Role name...",size:"sm",value:m})}),(0,s.jsx)("div",{className:"ml-1",children:(0,s.jsx)(x.Z,{design:"primary",disabled:!m.trim(),onClick:b,children:(0,s.jsx)(d.G,{icon:o.r8p,size:"xs"})})})]}),T.length>0&&(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"text-xs text-gray-500 mb-1",children:"Quick add:"}),(0,s.jsx)("div",{className:"flex flex-wrap gap-1",children:T.map(e=>(0,s.jsx)("button",{className:"text-xs px-2 py-0.5 bg-gray-200 hover:bg-gray-300 rounded capitalize",onClick:()=>_(e.value),type:"button",children:e.label},e.value))})]})]}),0===a.length?(0,s.jsx)("p",{className:"text-sm text-gray-500 text-center py-4",children:"Add at least one signer role to continue"}):(0,s.jsx)("div",{className:"space-y-1",children:a.map(e=>{let t=(0,l.h6)(a,e),n=r===e;return(0,s.jsxs)("div",{className:"flex items-center justify-between p-2 group rounded-lg cursor-pointer transition-colors ".concat(n?"bg-gray-100 ring-1 ring-gray-300":"hover:bg-gray-50"),onClick:()=>u(e),children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("div",{className:"w-3 h-3 rounded-full",style:{backgroundColor:t}}),(0,s.jsx)("span",{className:"text-sm font-medium capitalize",children:e})]}),(0,s.jsx)("button",{className:"p-1 text-gray-700 hover:text-red-500 opacity-0 group-hover:opacity-100",onClick:t=>{t.stopPropagation(),S(e)},title:"Remove role",type:"button",children:(0,s.jsx)(d.G,{icon:o.NBC,size:"xs"})})]},e)})})]}),(0,s.jsxs)("div",{className:"flex-1 px-4 py-3 overflow-y-auto",children:[(0,s.jsx)("h4",{className:"text-sm font-medium text-gray-700 mb-2",children:"Field Types"}),!r&&(0,s.jsxs)("div",{className:"text-center py-8 text-gray-500",children:[(0,s.jsx)(d.G,{className:"text-3xl mb-2 text-gray-300",icon:o.Ps7}),(0,s.jsx)("p",{className:"text-sm",children:"Select a signer role above to add fields"})]}),!!r&&(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsxs)("p",{className:"text-xs text-gray-500 mb-2",children:["Adding fields for:"," ",(0,s.jsx)("span",{className:"font-medium capitalize",style:{color:(0,l.h6)(a,r)},children:r})]}),l.Z9.map(e=>(0,s.jsxs)("button",{className:"w-full flex items-center gap-3 p-3 rounded-lg border border-gray-200 hover:border-gray-300 hover:bg-gray-50 transition-colors text-left",onClick:()=>v(e.value),type:"button",children:[(0,s.jsx)("div",{className:"w-8 h-8 rounded-lg flex items-center justify-center flex-shrink-0",style:{backgroundColor:"".concat(e.color,"20")},children:(0,s.jsx)(d.G,{icon:e.icon,style:{color:e.color}})}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("p",{className:"font-medium text-gray-900",children:e.label}),(0,s.jsx)("p",{className:"text-xs text-gray-500",children:{signature:"Full signature capture",initial:"Quick initials field",text:"Free text input",date:"Date picker field",checkbox:"Yes/No checkbox"}[e.value]||""})]}),(0,s.jsx)(d.G,{className:"text-gray-400",icon:o.r8p,size:"sm"})]},e.value))]})]}),(0,s.jsxs)("div",{className:"px-4 py-2 border-t bg-gray-50 text-center text-xs text-gray-500",children:["Fields will be added to page ",t]})]})};b.propTypes={currentPage:c().number.isRequired,signerRoles:c().arrayOf(c().string).isRequired,onAddField:c().func.isRequired,selectedRole:c().string,onRoleChange:c().func.isRequired},g.default.GlobalWorkerOptions.workerSrc=new a.U(a(11877)).toString();let _={cMapUrl:"https://unpkg.com/[email protected]/cmaps/",cMapPacked:!0,standardFontDataUrl:"https://unpkg.com/[email protected]/standard_fonts/"},S=(0,p.memo)(function(){return(0,s.jsx)("div",{className:"absolute inset-0 flex items-center justify-center",children:(0,s.jsx)(n.Z,{isLoading:!0,message:"Loading PDF..."})})}),v=e=>{let{pageInfo:t}=e,a=(0,p.useRef)(null),n=(0,p.useRef)(null),{signatureFields:u,selectedFieldId:c,signerRoles:g,addField:x,updateField:E,removeField:v,selectField:T}=(0,i.D)(),[R,D]=(0,p.useState)(null),[F,C]=(0,p.useState)(1),[N,L]=(0,p.useState)(1),[I,w]=(0,p.useState)(r.L8),[j,k]=(0,p.useState)(0),[P,O]=(0,p.useState)(!1),[A,M]=(0,p.useState)(null);(0,p.useEffect)(()=>{let e=a.current;if(!e)return;let t=()=>{let t=e.getBoundingClientRect();k(e=>e===t.width?e:t.width)};t();let s=new ResizeObserver(t);return s.observe(e),()=>s.disconnect()},[]),(0,p.useEffect)(()=>{g.length>0&&!A&&M(g[0])},[g,A]),(0,p.useEffect)(()=>{A&&!g.includes(A)&&M(g[0]||null)},[A,g]);let G=(0,p.useCallback)(e=>{let{numPages:t}=e;D(t),C(1)},[]),Z=(0,p.useCallback)(e=>{O(!0);let t=e.getViewport({scale:1});w({width:t.width,height:t.height})},[]),{renderedWidth:q,renderedHeight:V}=(0,p.useMemo)(()=>{let e=Math.min(j-300,700)*N,t=e/I.width*I.height;return{renderedWidth:e,renderedHeight:t}},[j,N,I.width,I.height]),U=(0,p.useCallback)(()=>{C(e=>Math.max(1,e-1)),T(null)},[T]),z=(0,p.useCallback)(()=>{C(e=>Math.min(R||1,e+1)),T(null)},[R,T]),K=(0,p.useCallback)(()=>{L(e=>Math.min(2,e+.1))},[]),Q=(0,p.useCallback)(()=>{L(e=>Math.max(.5,e-.1))},[]),B=(0,p.useCallback)((e,t)=>{x((0,l.G7)(e,t,F,{x:100,y:100}))},[F,x]),H=(0,p.useCallback)(e=>{M(e)},[]),W=(0,p.useCallback)((e,t,a)=>{let s=(0,r.BP)(t,a,q,V,I);E(e,{x_position:Math.max(0,s.x),y_position:Math.max(0,s.y)})},[q,V,I,E]),X=(0,p.useCallback)((e,t,a)=>{let s=(0,r.j0)(t,a,q,V,I);E(e,{width:Math.max(20,s.width),height:Math.max(20,s.height)})},[q,V,I,E]),J=(0,p.useMemo)(()=>u.filter(e=>e.page_number===F),[u,F]),Y=(0,p.useMemo)(()=>u.find(e=>e.id===c),[u,c]),$=(0,p.useCallback)(()=>T(null),[T]),ee=(0,p.useCallback)(()=>{Y&&(v(Y.id),T(null))},[Y,v,T]),et=(0,p.useCallback)(e=>{Y&&E(Y.id,e)},[Y,E]),ea=(0,p.useCallback)(e=>({onClick:()=>T(e),onDelete:()=>v(e),onMove:(t,a)=>W(e,t,a),onResize:(t,a)=>X(e,t,a)}),[T,v,W,X]),es=(0,p.useMemo)(()=>J.map(e=>{let t=(0,r.jt)(e.x_position,e.y_position,q,V,I),a=(0,r.Ld)(e.width,e.height,q,V,I),s=(0,l.h6)(g,e.signer_role);return{field:e,screenPos:t,screenSize:a,color:s,isSelected:e.id===c}}),[J,q,V,I,g,c]);return(0,s.jsxs)("div",{className:"flex h-[80vh]",ref:a,children:[(0,s.jsxs)("div",{className:"flex-1 flex flex-col bg-gray-100 overflow-hidden",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between px-4 py-2 bg-white border-b",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("button",{className:"p-1.5 text-gray-600 hover:bg-gray-100 rounded disabled:opacity-50",disabled:F<=1,onClick:U,type:"button",children:(0,s.jsx)(d.G,{icon:o.A35})}),(0,s.jsxs)("span",{className:"text-sm text-gray-600 min-w-[80px] text-center",children:["Page ",F," of ",R||"?"]}),(0,s.jsx)("button",{className:"p-1.5 text-gray-600 hover:bg-gray-100 rounded disabled:opacity-50",disabled:F>=(R||1),onClick:z,type:"button",children:(0,s.jsx)(d.G,{icon:o._tD})})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("button",{className:"p-1.5 text-gray-600 hover:bg-gray-100 rounded disabled:opacity-50",disabled:N<=.5,onClick:Q,type:"button",children:(0,s.jsx)(d.G,{icon:o.vsP})}),(0,s.jsxs)("span",{className:"text-sm text-gray-600 min-w-[60px] text-center",children:[Math.round(100*N),"%"]}),(0,s.jsx)("button",{className:"p-1.5 text-gray-600 hover:bg-gray-100 rounded disabled:opacity-50",disabled:N>=2,onClick:K,type:"button",children:(0,s.jsx)(d.G,{icon:o.N7g})})]})]}),(0,s.jsx)("div",{className:"flex-1 overflow-auto p-4",children:(0,s.jsxs)("div",{className:"relative mx-auto bg-white shadow-lg",ref:n,style:{width:q,height:V},children:[(0,s.jsx)(m.Z,{file:null==t?void 0:t.pdf_url,loading:(0,s.jsx)(S,{}),onLoadSuccess:G,options:_,children:(0,s.jsx)(y.Z,{devicePixelRatio:window.devicePixelRatio||2,loading:"",onLoadSuccess:Z,pageNumber:F,renderAnnotationLayer:!1,renderTextLayer:!1,width:q})}),!!P&&es.map(e=>{let{field:t,screenPos:a,screenSize:n,color:l,isSelected:r}=e,i=ea(t.id);return(0,s.jsx)(h.Z,{color:l,field:t,height:n.height,isSelected:r,onClick:i.onClick,onDelete:i.onDelete,onMove:i.onMove,onResize:i.onResize,width:n.width,x:a.x,y:a.y},t.id)})]})})]}),(0,s.jsxs)("div",{className:"w-72 border-l bg-white overflow-y-auto",children:[!!Y&&(0,s.jsx)(f.Z,{field:Y,onClose:$,onDelete:ee,onUpdate:et,signerRoles:g}),!Y&&(0,s.jsx)(b,{currentPage:F,onAddField:B,onRoleChange:H,selectedRole:A,signerRoles:g})]})]})};v.propTypes={pageInfo:c().shape({pdf_url:c().string,page_count:c().number})};var T=(0,p.memo)(v)},22319:function(e,t,a){a.d(t,{Au:function(){return g},J5:function(){return E},MN:function(){return y},et:function(){return p},iy:function(){return h},mB:function(){return f},pf:function(){return x},r3:function(){return b},tk:function(){return m}});var s=a(59820),n=a(78298),l=a(14010),r=a(87686),i=a(60418),o=a(47477),d=a(82036),u=a(84475);let c=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";return"".concat(d.JW,"tenant/").concat((0,o.d_)(),"/").concat(e)},p=function(){let{category:e,status:t,enabled:a=!0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(0,s.a)({queryKey:["signatureTemplates",e,t],placeholderData:n.Wk,queryFn:async()=>{var a;let s=new URLSearchParams;e&&s.append("category",e),t&&s.append("status",t);let n=s.toString();return(null===(a=(await i.Z.get(c(n?"signature-templates?".concat(n):"signature-templates"),{headers:(0,u.g0)({realm:"hr"})})).data)||void 0===a?void 0:a.data)||[]},enabled:a&&(0,o.Xu)()})},g=e=>{let{templateId:t,enabled:a=!0}=e;return(0,s.a)({queryKey:["signatureTemplate",t],queryFn:async()=>{var e;return null===(e=(await i.Z.get(c("signature-templates/".concat(t)),{headers:(0,u.g0)({realm:"hr"})})).data)||void 0===e?void 0:e.data},enabled:!!t&&a&&(0,o.Xu)()})},m=function(){let{enabled:e=!0}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return(0,s.a)({queryKey:["signatureTemplateCategories"],queryFn:async()=>{var e;return(null===(e=(await i.Z.get(c("signature-templates/categories"),{headers:(0,u.g0)({realm:"hr"})})).data)||void 0===e?void 0:e.data)||[]},enabled:e&&(0,o.Xu)()})},y=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=(0,l.NL)();return(0,r.D)({mutationFn:async e=>(await i.Z.post(c("signature-templates"),e,{headers:(0,u.g0)({realm:"hr"})})).data,onSuccess:(a,s)=>{t.invalidateQueries({queryKey:["signatureTemplates"]}),e.onSuccess&&e.onSuccess(a,s)},...e})},f=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=(0,l.NL)();return(0,r.D)({mutationFn:async e=>{let{templateId:t,data:a}=e;return(await i.Z.put(c("signature-templates/".concat(t)),a,{headers:(0,u.g0)({realm:"hr"})})).data},onSuccess:(a,s)=>{t.setQueryData(["signatureTemplate",s.templateId],a.data),t.invalidateQueries({queryKey:["signatureTemplates"]}),e.onSuccess&&e.onSuccess(a,s)},...e})},h=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=(0,l.NL)();return(0,r.D)({mutationFn:async e=>{let{templateId:t}=e;return(await i.Z.delete(c("signature-templates/".concat(t)),{headers:(0,u.g0)({realm:"hr"})})).data},onSuccess:(a,s)=>{t.removeQueries(["signatureTemplate",s.templateId]),t.invalidateQueries({queryKey:["signatureTemplates"]}),e.onSuccess&&e.onSuccess(a,s)},...e})},x=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=(0,l.NL)();return(0,r.D)({mutationFn:async e=>{let{templateId:t}=e;return(await i.Z.post(c("signature-templates/".concat(t,"/duplicate")),{},{headers:(0,u.g0)({realm:"hr"})})).data},onSuccess:(a,s)=>{t.invalidateQueries({queryKey:["signatureTemplates"]}),e.onSuccess&&e.onSuccess(a,s)},...e})},E=e=>{let{templateId:t,enabled:a=!0}=e;return(0,s.a)({queryKey:["templatePageInfo",t],queryFn:async()=>{var e;return null===(e=(await i.Z.get(c("signature-templates/".concat(t,"/page-info")),{headers:(0,u.g0)({realm:"hr"})})).data)||void 0===e?void 0:e.data},enabled:!!t&&a&&(0,o.Xu)(),staleTime:15e5})},b=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=(0,l.NL)();return(0,r.D)({mutationFn:async e=>{let{templateId:t,fields:a}=e;return(await i.Z.put(c("signature-templates/".concat(t,"/fields")),{signature_fields:a},{headers:{...(0,u.g0)({realm:"hr"}),"Content-Type":"application/json"}})).data},onSuccess:(a,s)=>{t.setQueryData(["signatureTemplate",s.templateId],e=>{var t;return e?{...e,signature_fields:(null===(t=a.data)||void 0===t?void 0:t.signature_fields)||s.fields}:a.data}),t.invalidateQueries({queryKey:["signatureTemplates"]}),t.invalidateQueries({queryKey:["templatePageInfo",s.templateId]}),e.onSuccess&&e.onSuccess(a,s)},...e})}},3508:function(e,t,a){a.d(t,{D:function(){return m},Gq:function(){return g}});var s=a(52322),n=a(13980),l=a.n(n),r=a(2784),i=a(82781);let o=[{id:"basic-info",label:"Basic Info",description:"Template name and category"},{id:"upload-pdf",label:"Upload PDF",description:"Upload your document"},{id:"position-fields",label:"Position Fields",description:"Add signature fields"},{id:"review",label:"Review",description:"Review and activate"}],d={currentStep:0,name:"",description:"",category:"",templateId:null,pdfFile:null,pdfInfo:null,signatureFields:[],selectedFieldId:null,
1signerRoles:[],status:"draft",errors:{},isDirty:!1,isCreating:!1,isSaving:!1},u={SET_STEP:"SET_STEP",NEXT_STEP:"NEXT_STEP",PREV_STEP:"PREV_STEP",SET_BASIC_INFO:"SET_BASIC_INFO",SET_TEMPLATE_ID:"SET_TEMPLATE_ID",SET_PDF_FILE:"SET_PDF_FILE",SET_PDF_INFO:"SET_PDF_INFO",ADD_FIELD:"ADD_FIELD",UPDATE_FIELD:"UPDATE_FIELD",REMOVE_FIELD:"REMOVE_FIELD",SELECT_FIELD:"SELECT_FIELD",SET_FIELDS:"SET_FIELDS",SET_STATUS:"SET_STATUS",SET_ERRORS:"SET_ERRORS",CLEAR_ERROR:"CLEAR_ERROR",SET_LOADING:"SET_LOADING",RESET:"RESET",LOAD_TEMPLATE:"LOAD_TEMPLATE",ADD_SIGNER_ROLE:"ADD_SIGNER_ROLE",REMOVE_SIGNER_ROLE:"REMOVE_SIGNER_ROLE"};function c(e,t){switch(t.type){case u.SET_STEP:return{...e,currentStep:t.payload};case u.NEXT_STEP:return{...e,currentStep:Math.min(e.currentStep+1,o.length-1)};case u.PREV_STEP:return{...e,currentStep:Math.max(e.currentStep-1,0)};case u.SET_BASIC_INFO:return{...e,...t.payload,isDirty:!0,errors:{...e.errors,name:null,category:null}};case u.SET_TEMPLATE_ID:return{...e,templateId:t.payload};case u.SET_PDF_FILE:return{...e,pdfFile:t.payload,isDirty:!0,errors:{...e.errors,pdfFile:null}};case u.SET_PDF_INFO:return{...e,pdfInfo:t.payload};case u.ADD_FIELD:{let a=[...e.signatureFields,t.payload];return{...e,signatureFields:a,signerRoles:(0,i.HP)(a),selectedFieldId:t.payload.id,isDirty:!0}}case u.UPDATE_FIELD:{let a=e.signatureFields.map(e=>e.id===t.payload.id?{...e,...t.payload.updates}:e);return{...e,signatureFields:a,signerRoles:(0,i.HP)(a),isDirty:!0}}case u.REMOVE_FIELD:{let a=e.signatureFields.filter(e=>e.id!==t.payload);return{...e,signatureFields:a,signerRoles:(0,i.HP)(a),selectedFieldId:e.selectedFieldId===t.payload?null:e.selectedFieldId,isDirty:!0}}case u.SELECT_FIELD:return{...e,selectedFieldId:t.payload};case u.SET_FIELDS:{let a=t.payload||[];return{...e,signatureFields:a,signerRoles:(0,i.HP)(a),isDirty:!1}}case u.SET_STATUS:return{...e,status:t.payload};case u.SET_ERRORS:return{...e,errors:t.payload};case u.CLEAR_ERROR:return{...e,errors:{...e.errors,[t.payload]:null}};case u.SET_LOADING:return{...e,...t.payload};case u.RESET:return{...d};case u.LOAD_TEMPLATE:return{...e,templateId:t.payload.stid||t.payload.id,name:t.payload.name||"",description:t.payload.description||"",category:t.payload.category||"",status:t.payload.status||"draft",signatureFields:t.payload.signature_fields||[],signerRoles:(0,i.HP)(t.payload.signature_fields||[]),isDirty:!1};case u.ADD_SIGNER_ROLE:{let a=t.payload;if(e.signerRoles.includes(a))return e;return{...e,signerRoles:[...e.signerRoles,a],isDirty:!0}}case u.REMOVE_SIGNER_ROLE:{let a=t.payload;return{...e,signerRoles:e.signerRoles.filter(e=>e!==a),signatureFields:e.signatureFields.filter(e=>e.signer_role!==a),isDirty:!0}}default:return e}}let p=(0,r.createContext)(null),g=e=>{let{children:t,initialTemplate:a=null}=e,[n,l]=(0,r.useReducer)(c,a?{...d,templateId:a.stid||a.id,name:a.name||"",description:a.description||"",category:a.category||"",status:a.status||"draft",signatureFields:a.signature_fields||[],signerRoles:(0,i.HP)(a.signature_fields||[]),pdfInfo:a.has_pdf?{page_count:a.page_count}:null}:d),g=(0,r.useCallback)(e=>{l({type:u.SET_STEP,payload:e})},[]),m=(0,r.useCallback)(()=>{l({type:u.NEXT_STEP})},[]),y=(0,r.useCallback)(()=>{l({type:u.PREV_STEP})},[]),f=(0,r.useCallback)(e=>{l({type:u.SET_BASIC_INFO,payload:e})},[]),h=(0,r.useCallback)(e=>{l({type:u.SET_TEMPLATE_ID,payload:e})},[]),x=(0,r.useCallback)(e=>{l({type:u.SET_PDF_FILE,payload:e})},[]),E=(0,r.useCallback)(e=>{l({type:u.SET_PDF_INFO,payload:e})},[]),b=(0,r.useCallback)(e=>{l({type:u.ADD_FIELD,payload:e})},[]),_=(0,r.useCallback)((e,t)=>{l({type:u.UPDATE_FIELD,payload:{id:e,updates:t}})},[]),S=(0,r.useCallback)(e=>{l({type:u.REMOVE_FIELD,payload:e})},[]),v=(0,r.useCallback)(e=>{l({type:u.SELECT_FIELD,payload:e})},[]),T=(0,r.useCallback)(e=>{l({type:u.SET_FIELDS,payload:e})},[]),R=(0,r.useCallback)(e=>{l({type:u.ADD_SIGNER_ROLE,payload:e})},[]),D=(0,r.useCallback)(e=>{l({type:u.REMOVE_SIGNER_ROLE,payload:e})},[]),F=(0,r.useCallback)(e=>{l({type:u.SET_STATUS,payload:e})},[]),C=(0,r.useCallback)(e=>{l({type:u.SET_ERRORS,payload:e})},[]),N=(0,r.useCallback)(e=>{l({type:u.CLEAR_ERROR,payload:e})},[]),L=(0,r.useCallback)(e=>{l({type:u.SET_LOADING,payload:e})},[]),I=(0,r.useCallback)(()=>{l({type:u.RESET})},[]),w=(0,r.useCallback)(e=>{l({type:u.LOAD_TEMPLATE,payload:e})},[]),j=(0,r.useCallback)(e=>{let t={};switch(e){case 0:n.name.trim()||(t.name="Template name is required");break;case 1:n.pdfFile||n.pdfInfo||(t.pdfFile="Please upload a PDF document");break;case 2:break;case 3:0===n.signatureFields.length?t.fields="At least one signature field is required":n.signatureFields.some(e=>"signature"===e.field_type)||(t.fields="At least one signature field is required")}return l({type:u.SET_ERRORS,payload:t}),0===Object.keys(t).length},[n.name,n.pdfFile,n.pdfInfo,n.signatureFields]),k=(0,r.useCallback)(e=>{switch(e){case 0:return!!n.name.trim();case 1:return!!(n.pdfFile||n.pdfInfo);case 2:return n.signatureFields.length>0;case 3:return n.signatureFields.some(e=>"signature"===e.field_type);default:return!1}},[n.name,n.pdfFile,n.pdfInfo,n.signatureFields]),P=(0,r.useMemo)(()=>n.selectedFieldId?n.signatureFields.find(e=>e.id===n.selectedFieldId):null,[n.selectedFieldId,n.signatureFields]),O=(0,r.useMemo)(()=>({...n,selectedField:P,steps:o,currentStepConfig:o[n.currentStep],isFirstStep:0===n.currentStep,isLastStep:n.currentStep===o.length-1,goToStep:g,nextStep:m,prevStep:y,setBasicInfo:f,setTemplateId:h,setPdfFile:x,setPdfInfo:E,addField:b,updateField:_,removeField:S,selectField:v,setFields:T,addSignerRole:R,removeSignerRole:D,setStatus:F,setErrors:C,clearError:N,setLoading:L,validateStep:j,isStepComplete:k,reset:I,loadTemplate:w}),[n,P,g,m,y,f,h,x,E,b,_,S,v,T,R,D,F,C,N,L,j,k,I,w]);return(0,s.jsx)(p.Provider,{value:O,children:t})};function m(){let e=(0,r.useContext)(p);if(!e)throw Error("useTemplateWizard must be used within a TemplateWizardProvider");return e}g.propTypes={children:l().node.isRequired,initialTemplate:l().shape({id:l().oneOfType([l().str
1ing,l().number]),stid:l().string,name:l().string,description:l().string,category:l().string,status:l().string,signature_fields:l().array})}},67780:function(e,t,a){a.d(t,{Z:function(){return m}});var s=a(7896),n=a(2784),l=a(26202),r=a(88137),i=a(33028),o=a(85942),d=a(59740),u=a(407),c=["allowCreateWhileLoading","createOptionPosition","formatCreateLabel","isValidNewOption","getNewOptionData","onCreateOption","options","onChange"],p=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1?arguments[1]:void 0,a=arguments.length>2?arguments[2]:void 0,s=String(e).toLowerCase(),n=String(a.getOptionValue(t)).toLowerCase(),l=String(a.getOptionLabel(t)).toLowerCase();return n===s||l===s},g={formatCreateLabel:function(e){return'Create "'.concat(e,'"')},isValidNewOption:function(e,t,a,s){return!(!e||t.some(function(t){return p(e,t,s)})||a.some(function(t){return p(e,t,s)}))},getNewOptionData:function(e,t){return{label:t,value:e,__isNew__:!0}}};a(28316),a(84337);var m=(0,n.forwardRef)(function(e,t){var a,p,m,y,f,h,x,E,b,_,S,v,T,R,D,F,C,N,L,I,w,j,k,P,O,A,M,G,Z=(m=void 0!==(p=(a=(0,r.u)(e)).allowCreateWhileLoading)&&p,f=void 0===(y=a.createOptionPosition)?"last":y,x=void 0===(h=a.formatCreateLabel)?g.formatCreateLabel:h,b=void 0===(E=a.isValidNewOption)?g.isValidNewOption:E,S=void 0===(_=a.getNewOptionData)?g.getNewOptionData:_,v=a.onCreateOption,R=void 0===(T=a.options)?[]:T,D=a.onChange,N=void 0===(C=(F=(0,d.Z)(a,c)).getOptionValue)?l.g:C,I=void 0===(L=F.getOptionLabel)?l.b:L,w=F.inputValue,j=F.isLoading,k=F.isMulti,P=F.value,O=F.name,A=(0,n.useMemo)(function(){return b(w,(0,u.H)(P),R,{getOptionValue:N,getOptionLabel:I})?S(w,x(w)):void 0},[x,S,I,N,w,b,R,P]),M=(0,n.useMemo)(function(){return(m||!j)&&A?"first"===f?[A].concat((0,o.Z)(R)):[].concat((0,o.Z)(R),[A]):R},[m,f,j,A,R]),G=(0,n.useCallback)(function(e,t){if("select-option"!==t.action)return D(e,t);var a=Array.isArray(e)?e:[e];if(a[a.length-1]===A){if(v)v(w);else{var s=S(w,w);D((0,u.D)(k,[].concat((0,o.Z)((0,u.H)(P)),[s]),s),{action:"create-option",name:O,option:s})}return}D(e,t)},[S,w,k,O,A,v,D,P]),(0,i.Z)((0,i.Z)({},F),{},{options:M,onChange:G}));return n.createElement(l.S,(0,s.Z)({ref:t},Z))})},11877:function(e,t,a){e.exports=a.p+"static/media/pdf.worker.min.69996b1d.js"}}]);
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.