PageSourceSearch

https://www.trybased.com/static/js/6540.5c073b8f.chunk.js

js trybased.com collected 2026-10-02 01:48:07 UTC 15,834 bytes, 2 lines download raw bytes

1"use strict";(self.webpackChunkknowledge_base_saas=self.webpackChunkknowledge_base_saas||[]).push([[6540],{6540(t,e,n){n.d(e,{generatePdfFromDocument:()=>u});var o=n(5544),r=n(65239),i=n.n(r),a=n(6396),l=n(21949);function s(t){if(!t)return"";try{const e=new Date(t);return Number.isNaN(e.getTime())?t:e.toLocaleString(void 0,{dateStyle:"medium",timeStyle:"short"})}catch(e){return t}}function c(t){if(!t||"string"!==typeof t)return t;const e=t.match(/^(\d{4})-(\d{2})-(\d{2})$/);if(e){const t=(0,o.A)(e,4),n=t[1],r=t[2],i=t[3];return"".concat(r,"/").concat(i,"/").concat(n)}return t}function d(t,e){t&&e&&"object"===typeof e&&t.querySelectorAll("[data-form-block]").forEach(t=>{const n=t.getAttribute("data-form-id"),o=t.getAttribute("data-form-title")||"Form";let r=[];try{r=JSON.parse(t.getAttribute("data-form-fields")||"[]")}catch(s){r=[]}const i=e[n]||{};t.innerHTML="",t.style.cssText="margin:1rem 0;padding:1.25rem;border:1px solid #e2e8f0;border-radius:10px;background:#f8fafc";const a=document.createElement("div");a.style.cssText="display:flex;align-items:center;gap:0.5rem;margin-bottom:0.75rem",a.innerHTML='\n      <span style="display:inline-flex;width:24px;height:24px;background:#dcfce7;border-radius:50%;align-items:center;justify-content:center;">\n        <svg width="14" height="14" fill="none" stroke="#16a34a" stroke-width="2.5" stroke-linecap="round" stroke-linejoin="round"><polyline points="20 6 9 17 4 12"/></svg>\n      </span>\n      <strong style="font-size:1rem;color:#1e293b;">'.concat(m(o),'</strong>
1\n      <span style="font-size:0.75rem;color:#64748b;margin-left:auto;">Submitted</span>'),t.appendChild(a);const l=document.createElement("div");l.style.cssText="display:flex;flex-direction:column;gap:0.5rem",r.forEach(t=>{const e=i[t.id],n=document.createElement("div");n.style.cssText="font-size:0.875rem";const o=document.createElement("div");o.style.cssText="font-weight:600;color:#475569;font-size:0.75rem;margin-bottom:0.15rem",o.textContent=t.label||t.type;const r=document.createElement("div");r.style.cssText="color:#1e293b";let a=function(t){return t&&"object"===typeof t&&t.fileName?t.fileName:Array.isArray(t)?t.join(", ")||"\u2014":null!=t&&String(t).trim()?String(t):"\u2014"}(e);"date"===t.type&&"string"===typeof e&&(a=c(e)),r.textContent=a,n.appendChild(o),n.appendChild(r),l.appendChild(n)}),t.appendChild(l)})}const p=[".pdf-export-header",".pdf-export-prose > *",".pdf-export-prose li",".pdf-export-prose p",".pdf-export-prose h1",".pdf-export-prose h2",".pdf-export-prose h3",".pdf-export-prose h4",".pdf-export-prose h5",".pdf-export-prose h6",".pdf-export-prose blockquote",".pdf-export-prose pre",".pdf-export-prose table",".pdf-export-prose tr",".pdf-export-prose [data-field-id]",".pdf-export-prose [data-signature-block-id]",".pdf-export-prose [data-form-block]",".pdf-export-prose span",".pdf-export-prose div"].join(", ");async function u(t){let e=t.title,n=t.fileName,o=t.editorHtml,r=t.textContent,u=t.fieldValues,y=void 0===u?{}:u,h=t.signatures,b=void 0===h?{}:h,x=t.signatureMeta,v=void 0===x?{}:x,C=t.submittedFormAnswers,A=void 0===C?null:C,k=t.paymentButtonUrl,S=void 0===k?null:k,E=t.paymentComplete,w=void 0!==E&&E,L=t.paidLinkIds,I=void 0===L?null:L,M=t.paymentAmountCents,T=void 0===M?null:M,P=t.paymentCompletedAt,N=void 0===P?null:P,q=t.organizationLogoUrl,H=void 0===q?null:q,j=t.organizationName,z=void 0===j?null:j;const W=(t=>{const e=String(t||"document").trim().replace(/[\\/:*?"<>|]+/g,"-").replace(/\s+/g," ").slice(0,180);return e.length?e:"document"})(e||n||"document"),R="".concat(W,".pdf"),U="string"===typeof o&&o.trim().length>0?o:"string"===typeof r&&r.trim().length>0?'<pre style="white-space:pre-wrap;font-family:ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial">'.concat(m(r),"</pre>"):'<p style="font-family:ui-sans-serif,system-ui,-apple-system,Segoe UI,Roboto,Helvetica,Arial;color:#6b7280">No content available.</p>',B=function(t,e){if(!t||"string"!==typeof t)return"";const n=[];n.push('<img src="'.concat(m(t),'" alt="Organization logo" crossorigin="anonymous" style="max-height:56px;max-width:200px;display:block;object-fit:contain;flex-shrink:0" />')),e&&"string"===typeof e&&n.push('<div style="font-size:18px;color:#374151;font-weight:500;margin-left:16px;line-height:1;padding-top:8px">'.concat(m(e),"</div>"));const o='<div style="display:flex;align-items:flex-start">'.concat(n.join(""),"</div>");return"".concat(o).concat('<div style="margin-top:20px;padding-bottom:12px;border-bottom:1px solid #e5e7eb"></div>')}(H,z),D=B?'<div class="pdf-export-header" style="margin-bottom:12px">'.concat(B,'</div><div class="prose max-w-none pdf-export-prose">').concat(U,"</div>"):'<div class="prose max-w-none pdf-export-prose">'.concat(U,"</div>"),F=document.createElement("div");F.style.position="fixed",F.style.left="-10000px",F.style.top="0",F.style.width="794px",F.style.background="white",F.style.color="#111827",F.style.padding="0 0 24px 0",F.style.boxSizing="border-box",F.style.zIndex="-1",F.innerHTML='<div class="pdf-export-wrapper">'.concat(D,"</div>");const O=F.querySelector(".pdf-export-prose");if(O&&(!function(t){const e=t.querySelectorAll("h1, h2, h3, h4, h5, h6, p");let n=null;const o=[];e.forEach(t=>{const e=t.tagName.toLowerCase();if(/^h[1-6]$/.test(e))n=f(t.textContent);else if("p"===e&&n){const e=f(t.textContent).match(/^#{1,6}\s+(.+)$/);if(e){const r=f(e[1]);if(r===n||g(r)===g(n))return o.push(t),void(n=null)}n=null}}),o.forEach(t=>t.remove())}(O),O.querySelectorAll("[data-field-id]").forEach(t=>{const e=t.getAttribute("data-field-id"),n=t.getAttribute("data-field-type");if(null!=e&&null!=y[e]&&""!==y[e]){let o=y[e];"date"===n&&o&&(o=c(o)),t.textContent=String(o)}else{const e=n?"(".concat(n.toUpperCase(),")"):"(FIELD)";t.textContent=e}t.style.background="transparent",t.style.backgroundColor="transparent",t.style.borderBottom="none",t.style.color="inherit";const o=t.querySelector(".fillable-field-placeholder-content");o&&(o.style.background="transparent",o.style.backgroundColor="transparent",o.style.borderBottom="none",o.style.color="inherit")}
1),O.querySelectorAll("[data-signature-block-id]").forEach(t=>{const e=t.getAttribute("data-signature-block-id");if(null==e)return;const n=b[e],o=v[e];if(n||o){if(t.innerHTML="",n&&"string"===typeof n)if(n.startsWith("data:")){const e=document.createElement("img");e.src=n,e.alt="Signature",e.style.maxHeight="60px",e.style.maxWidth="200px",t.appendChild(e)}else{const e=document.createElement("span");e.textContent=n,t.appendChild(e)}else{const e=document.createElement("span");e.textContent="Signed",e.style.color="#6b7280",e.style.fontStyle="italic",t.appendChild(e)}if(o&&(o.signedAt||o.signatureId)){const e=document.createElement("div");e.style.fontSize="11px",e.style.color="#6b7280",e.style.marginTop="4px";const n=[];o.signedAt&&n.push("Signed on ".concat(s(o.signedAt))),o.signatureId&&n.push("ID: ".concat(o.signatureId)),e.textContent=n.join(" \xb7 "),t.appendChild(e)}}else{const e=t.getAttribute("data-default-signature")||"";if(e){if(t.innerHTML="",e.startsWith("data:")){const n=document.createElement("img");n.src=e,n.alt="Signature",n.style.maxHeight="60px",n.style.maxWidth="200px",t.appendChild(n)}else{const n=document.createElement("span");n.textContent=e,t.appendChild(n)}const n=t.getAttribute("data-default-signer-name")||"",o=t.getAttribute("data-default-signed-at")||"";if(n||o){const e=document.createElement("div");e.style.fontSize="11px",e.style.color="#6b7280",e.style.marginTop="4px";const r=[];n&&r.push(n),o&&r.push("Signed on ".concat(s(o))),e.textContent=r.join(" \xb7 "),t.appendChild(e)}}}t.style.border="none",t.style.background="transparent",t.style.backgroundColor="transparent";const r=t.querySelector(".signature-block");r&&(r.style.border="none",r.style.background="transparent",r.style.backgroundColor="transparent")})),O&&A&&d(O,A),O&&(w||S||Array.isArray(I)&&I.length)&&(0,l.Vl)(O,{paymentComplete:w,paidLinkIds:I,paymentAmountCents:T,paymentButtonUrl:S}),O&&w&&N){const t=document.createElement("p");t.style.cssText="font-size:12px;color:#16a34a;font-weight:600;margin:0 0 1rem 0;",t.textContent="Payment received on ".concat((0,l.bF)(N)),O.insertBefore(t,O.firstChild)}O&&O.querySelectorAll("ol, ul").forEach(t=>{const e="OL"===t.tagName,n=e?parseInt(t.getAttribute("start")||"1",10):1;t.querySelectorAll(":scope > li").forEach((t,o)=>{t.style.listStyle="none",t.style.display="block",t.style.marginBottom="0.75em",t.style.paddingLeft="1.5em",t.style.textIndent="-1.5em";const r=t.getAttribute("value"),i=r?parseInt(r,10):n+o,a=document.createElement("span");a.style.display="inline",a.style.marginRight="0.5em",a.style.fontWeight="normal",a.textContent=e?"".concat(i,"."):"\u2022";const l=t.firstElementChild;l?(l.style.display="inline",l.style.margin="0",l.style.padding="0",t.insertBefore(a,l)):t.firstChild&&t.insertBefore(a,t.firstChild);Array.from(t.children).forEach((t,e)=>{e>1&&(t.style.display="block",t.style.marginTop="0.5em",t.style.textIndent="0")})}),t.style.listStyle="none",t.style.paddingLeft="0",t.style.marginLeft="0"}),document.body.appendChild(F),await function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:5e3;const n=t.querySelectorAll('img[src^="http"]');return n.length?Promise.race([Promise.all(Array.from(n).map(t=>new Promise((e,n)=>{if(t.complete&&t.naturalHeight)return e();t.onload=()=>e(),t.onerror=()=>e()}))),new Promise(t=>setTimeout(t,e))]):Promise.resolve()}(F);try{const t=await i()(F,{scale:2,useCORS:!0,backgroundColor:"#ffffff",logging:!1,windowWidth:F.scrollWidth}),e=F.getBoundingClientRect(),n=F.scrollHeight,o=F.scrollWidth||794,r=2,l=t.width,s=(t.height,F.querySelectorAll(p)),c=[],d=new Set,u=8;s.forEach(t=>{if(d.has(t))return;d.add(t);const n=t.getBoundingClientRect(),o=n.top-e.top,r=n.bottom-e.top;r>0&&r>o&&c.push({top:o,bottom:r+u})});const m=[];c.sort((t,e)=>t.top-e.top||t.bottom-e.bottom).forEach(t=>{m.some(e=>Math.abs(e.top-t.top)<2&&Math.abs(e.bottom-t.bottom)<2)||m.push(t)});const f=new a.uE({orientation:"p",unit:"pt",format:"a4"}),g=f.internal.pageSize.getWidth(),y=f.internal.pageSize.getHeight(),h=g-54-54,b=h/o,x=function(t,e,n,o,r){const i=t.map(t=>{let n=t.top,o=t.bottom;return{top:n*e,bottom:o*e}}
1).filter(t=>t.bottom>0).sort((t,e)=>t.top-e.top),a=[0];if(r<=0)return a;let l=0,s=0;const c=36,d=20;for(;l<r;){const t=0===s?n:o,e=l+t,p=i.filter(t=>{let n=t.top,o=t.bottom;return n<e&&o>e}),u=i.filter(t=>{let n=t.top,o=t.bottom;return n>=l&&n<e&&o<=e&&e-o<d&&n>l+c}),m=p.filter(t=>{let n=t.top;return n>=l&&n<e}),f=p.filter(t=>t.top<l),g=[...m];if(u.forEach(t=>{g.some(e=>Math.abs(e.top-t.top)<2)||g.push(t)}),g.length>0){const n=g.reduce((t,e)=>e.top<t.top?e:t),i=n.bottom-n.top;if(i>t){const t=Math.min(e,r);if(t<=l)break;a.push(t),l=t}else{const t=Math.max(0,n.top-5);if(t-l<c&&t>l)if(i<=o){const e=Math.max(l+1,t);a.push(Math.min(e,r)),l=e}else{const t=Math.min(e,r);if(t<=l)break;a.push(t),l=t}else{const e=Math.max(l+c,t);a.push(Math.min(e,r)),l=e}}}else if(f.length>0){const t=Math.min(e,r);if(t<=l)break;a.push(t),l=t}else{const t=i.filter(t=>{let n=t.bottom;return n>l&&n<=e}),n=t.length>0?Math.max(...t.map(t=>t.bottom)):e,o=Math.min(n,r);if(o<=l)break;a.push(o),l=o}s++}const p=[a[0]];for(let m=1;m<a.length;m++){a[m]-p[p.length-1]>=c?p.push(a[m]):p[p.length-1]=a[m]}const u=r-p[p.length-1];u>c?p.push(r):u>0&&p.length>1&&(p[p.length-1]=r);return p}(m,b,y-90-54,y-54-54,n*b);for(let i=0;i<x.length-1;i++){const e=x[i],n=x[i+1],o=0===i?90:54,a=e/b*r,s=n/b*r,c=Math.floor(a),d=Math.max(1,Math.ceil(s)-c),p=document.createElement("canvas");p.width=l,p.height=d;p.getContext("2d").drawImage(t,0,c,l,d,0,0,l,d);const u=p.toDataURL("image/png");i>0&&f.addPage();const m=d/r*b;f.addImage(u,"PNG",54,o,h,m,void 0,"FAST")}if(x.length<2){const e=t.toDataURL("image/png"),n=f.getImageProperties(e),o=n.height*h/n.width;f.addImage(e,"PNG",54,90,h,o,void 0,"FAST")}const v=f.output("blob");return{blob:v,url:URL.createObjectURL(v),filename:R}}finally{document.body.removeChild(F)}}function m(t){return String(t).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&#039;")}function f(t){return String(t||"").replace(/\s+/g," ").trim()}function g(t){return f(String(t||"").replace(/\*\*/g,""))}},21949(t,e,n){n.d(e,{Vl:()=>c,_b:()=>s,bF:()=>d});var o=n(89379),r=n(81452);function i(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(null!=t&&t>=50)return(0,r.yP)(t).replace(/^Pay\s*/i,"Paid ");const n=String(e||"").trim();return n?n.replace(/^Pay\s*/i,"Paid "):"Paid"}const a={background:"rgba(34, 197, 94, 0.15)",border:"1px solid rgba(34, 197, 94, 0.4)",color:"rgb(22, 163, 74)",fontWeight:"500",cursor:"default"},l={background:"rgba(59, 130, 246, 0.15)",border:"1px solid rgba(59, 130, 246, 0.4)",color:"rgb(37, 99, 235)",fontWeight:"500",cursor:"pointer"};function s(t,e){let n=e.paymentComplete,r=void 0!==n&&n,s=e.paidLinkIds,c=void 0===s?null:s,d=e.paymentAmountCents,p=void 0===d?null:d,u=e.onPaymentClick,m=void 0===u?null:u;if(!t)return()=>{};const f=c instanceof Set?c:Array.isArray(c)?new Set(c):null,g=[];return t.querySelectorAll("[data-payment-button]").forEach(t=>{const e=t.getAttribute("data-payment-link-id")||null,n=t.getAttribute("data-payment-amount-cents"),s=null!=n&&""!==n?Number(n):null;if(!!r||f&&e&&f.has(e)){const e=t.getAttribute("data-payment-label")||t.textContent||"",n=i(null!==s&&void 0!==s?s:p,e);return t.textContent=n,t.setAttribute("data-payment-label",n),t.setAttribute("data-payment-paid","true"),Object.assign(t.style,(0,o.A)({display:"inline-flex",alignItems:"center",justifyContent:"center",padding:"2px 8px",borderRadius:"4px",lineHeight:"1",verticalAlign:"middle"},a)),t.removeAttribute("role"),void t.removeAttribute("tabindex")}if(t.removeAttribute("data-payment-paid"),Object.assign(t.style,(0,o.A)({display:"inline-flex",alignItems:"center",justifyContent:"center",padding:"2px 8px",borderRadius:"4px",lineHeight:"1",verticalAlign:"middle"},l)),t.setAttribute("role","button"),t.hasAttribute("tabindex")||t.setAttribute("tabindex","0"),"function"===typeof m){if("true"===t.dataset.paymentClickWired)return;t.dataset.paymentClickWired="true";const n=n=>{n.preventDefault(),n.stopPropagation();const o=t.getAttribute("data-payment-amount-cents"),r=null!=o&&""!==o?Number(o):null;m({paymentLinkId:e,amountCents:r})};t.addEventListener("click",n),g.push({el:t,handler:n})}}),()=>{g.forEach(t=>{let e=t.el,n=t.handler;e.removeEventListener("click",n),delete e.dataset.paymentClickWired})}}function c(t,e){let n=e.paymentComplete,o=void 0!==n&&n,r=e.paidLinkIds,a=void 0===r?null:r,l=e.paymentAmountCents,s=void 0===l?null:l,c=e.paymentButtonUrl,d=void 0===c?null:c;if(!t||"function"!==typeof t.querySelectorAll)return;
1const p=a instanceof Set?a:Array.isArray(a)?new Set(a):null;t.querySelectorAll("[data-payment-button]").forEach(t=>{const e=t.getAttribute("data-payment-link-id")||null,n=t.getAttribute("data-payment-amount-cents"),r=null!=n&&""!==n?Number(n):null;if(!!o||p&&e&&p.has(e)){const e=t.getAttribute("data-payment-label")||t.textContent||"",n=i(null!==r&&void 0!==r?r:s,e);return t.textContent=n,t.style.color="rgb(22, 163, 74)",t.style.fontWeight="600",void(t.style.textDecoration="none")}if(d&&"string"===typeof d){const n=t.getAttribute("data-payment-label")||t.textContent||"Click to Pay",o=e?"".concat(d).concat(d.includes("?")?"&":"?","paymentLinkId=").concat(encodeURIComponent(e)):d,r=document.createElement("a");r.href=o,r.textContent=n,r.style.color="rgb(37, 99, 235)",r.style.textDecoration="underline",t.innerHTML="",t.appendChild(r)}})}function d(t){if(!t)return"";try{const e=new Date(t);return Number.isNaN(e.getTime())?t:e.toLocaleString(void 0,{dateStyle:"long",timeStyle:"short"})}catch(e){return t}}}}]);
2//# sourceMappingURL=6540.5c073b8f.chunk.js.map

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.