@formfeed/engine 0.3.16 → 0.3.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.cjs CHANGED
@@ -52,6 +52,7 @@ __export(index_exports, {
52
52
  EINVOICE_PROFILE_NAMES: () => EINVOICE_PROFILE_NAMES,
53
53
  EINVOICE_SPEC_VERSIONS: () => EINVOICE_SPEC_VERSIONS,
54
54
  EINVOICE_XML_NAME: () => EINVOICE_XML_NAME,
55
+ EN16931_TERMS: () => EN16931_TERMS,
55
56
  EPC_MAX_BYTES: () => EPC_MAX_BYTES,
56
57
  EngineSyntaxError: () => EngineSyntaxError,
57
58
  INVOICE_DATA_KEY: () => INVOICE_DATA_KEY,
@@ -80,6 +81,7 @@ __export(index_exports, {
80
81
  builtinHelpers: () => builtinHelpers,
81
82
  canvasDocument: () => canvasDocument,
82
83
  capMessages: () => capMessages,
84
+ carriesTerm: () => carriesTerm,
83
85
  chartInitScript: () => chartInitScript,
84
86
  chartMarkup: () => chartMarkup,
85
87
  chartPayload: () => chartPayload,
@@ -521,11 +523,11 @@ var codeHelpers = [
521
523
  aliases: ["epc_qr", "girocode"],
522
524
  doc: {
523
525
  signature: "epcQr({ name, iban, bic?, amount?, reference?, text? }, { size })",
524
- description: "SEPA credit transfer QR code (EPC069-12 / GiroCode) that banking apps scan to prefill a payment. Give the image an `alt`, and print the bank details as text as well: the code is a picture.",
526
+ description: "SEPA credit transfer QR code (EPC069-12 / GiroCode) that banking apps scan to prefill a payment. Put an invoice number into `text` (the remittance line); `reference` is only for a structured creditor reference (RF\u2026). Give the image an `alt`, and print the bank details as text as well: the code is a picture.",
525
527
  examples: {
526
- jinja2: '<img src="{{ epcQr({ name: company.name, iban: company.iban, amount: invoice.total, reference: invoice.number }) }}" alt="QR code to pay invoice {{ invoice.number }}">',
527
- liquid: '<img src="{{ company.iban | epcQr: name: company.name, amount: invoice.total, reference: invoice.number }}" alt="QR code to pay invoice {{ invoice.number }}">',
528
- handlebars: '<img src="{{epcQr name=company.name iban=company.iban amount=invoice.total reference=invoice.number}}" alt="QR code to pay invoice {{invoice.number}}">'
528
+ jinja2: '<img src="{{ epcQr({ name: company.name, iban: company.iban, amount: invoice.total, text: invoice.number }) }}" alt="QR code to pay invoice {{ invoice.number }}">',
529
+ liquid: '<img src="{{ company.iban | epcQr: name: company.name, amount: invoice.total, text: invoice.number }}" alt="QR code to pay invoice {{ invoice.number }}">',
530
+ handlebars: '<img src="{{epcQr name=company.name iban=company.iban amount=invoice.total text=invoice.number}}" alt="QR code to pay invoice {{invoice.number}}">'
529
531
  },
530
532
  category: "code"
531
533
  },
@@ -5696,6 +5698,7 @@ var textEditRuntime = '"use strict";(()=>{var O=`\nhtml.ff-edit-mode [data-ff-ed
5696
5698
  var fitRuntime = '"use strict";(()=>{function a(t,e,n){if(e===t)return t.scrollHeight<=t.clientHeight+.5&&t.scrollWidth<=t.clientWidth+.5;let o=n.getComputedStyle(t),i=t.clientHeight-(parseFloat(o.paddingTop)||0)-(parseFloat(o.paddingBottom)||0);return e.scrollHeight<=i+.5&&e.scrollWidth<=e.clientWidth+.5}function m(t,e){let n=t.firstElementChild??t;n.style.fontSize="";let o=parseFloat(e.getComputedStyle(n).fontSize)||16,i=Math.min(o,parseFloat(t.getAttribute("data-ff-fit-min")??"")||o/2);if(a(t,n,e))return o;let l=i,s=o;for(let d=0;d<14;d++){let r=(l+s)/2;n.style.fontSize=`${r}px`,a(t,n,e)?l=r:s=r}let f=Math.floor(l*100)/100;return n.style.fontSize=`${f}px`,f}function c(t){let e=()=>{for(let o of Array.from(t.document.querySelectorAll(\'[data-ff-fit="shrink"]\')))m(o,t);t.document.documentElement.setAttribute("data-ff-fit","done")};t.formfeedFit=e;let n=t.document.fonts;n?n.ready.then(e):t.addEventListener("load",e)}c(window);})();';
5697
5699
  var stageRuntime = '"use strict";(()=>{var W=`\nhtml.ff-edit-mode [data-ff-edit] { cursor: text; }\nhtml.ff-edit-mode [data-ff-edit]:hover { outline: 1px dashed rgba(37,99,235,.85); outline-offset: 2px; }\nhtml.ff-edit-mode [data-ff-edit="t"]:hover { outline-color: rgba(147,51,234,.9); }\n.ff-editing { outline: 2px solid #2563eb !important; outline-offset: 2px; cursor: text; }\n.ff-editing .ff-chip { background: rgba(37,99,235,.14) !important; box-shadow: inset 0 0 0 1px rgba(37,99,235,.45) !important; border-radius: 3px !important; padding: 0 1px !important; cursor: default; }\n.ff-edit-badge { position: absolute; z-index: 2147483647; font: 500 11px/1.4 system-ui, sans-serif !important; color: #fff !important; background: #2563eb !important; padding: 1px 6px !important; border-radius: 4px !important; pointer-events: none; white-space: nowrap; }\n`;function H(a,l={}){let f=l.clicks!==!1,p=l.live===!0,n=a.document,o=null,d=null,u=e=>{try{a.parent.postMessage(e,"*")}catch{}},m=f?n.querySelector(\'meta[name="formfeed:document"]\')?.getAttribute("content")??null:null,s=!1;a.addEventListener("blur",()=>{s=!0}),a.addEventListener("focus",()=>{s=!1});let g=n.createElement("style");g.setAttribute("data-formfeed","edit"),g.setAttribute("data-pagedjs-ignore",""),g.textContent=W,(n.head??n.documentElement).appendChild(g),f&&n.documentElement.classList.add("ff-edit-mode");let x=e=>(e&&typeof e.closest=="function"?e:null)?.closest("[data-ff-edit]")??null;n.addEventListener("click",e=>{if(!f)return;if(o&&!o.done&&o.element.contains(e.target)){e.stopImmediatePropagation();return}let t=x(e.target);t&&(e.preventDefault(),e.stopImmediatePropagation(),v(t,{x:e.clientX,y:e.clientY}))},!0);function v(e,t){o&&!o.done&&L();let r=e.getAttribute("data-ff-src")??"",i=e.getBoundingClientRect(),b=Array.from(n.querySelectorAll(`[data-ff-src="${r.replace(/"/g,"")}"]`));d={src:r,element:e,point:t},u({type:"formfeed:edit-request",src:r,doc:m,edit:e.getAttribute("data-ff-edit"),text:e.textContent??"",elements:e.childElementCount,count:b.length,index:Math.max(0,b.indexOf(e)),split:e.hasAttribute("data-split-from")||e.hasAttribute("data-split-to"),rect:{left:i.left,top:i.top,width:i.width,height:i.height}})}n.addEventListener("keydown",e=>{if(!f||o&&!o.done||!(e.ctrlKey||e.metaKey)||e.altKey)return;let t=e.key.toLowerCase();(t==="z"||t==="y")&&(e.preventDefault(),u({type:t==="y"||e.shiftKey?"formfeed:redo":"formfeed:undo"}))}),a.addEventListener("message",e=>{if(e.source!==a.parent)return;let t=e.data;!t||typeof t.type!="string"||(t.type==="formfeed:edit-begin"?B(t):t.type==="formfeed:edit-refuse"||t.type==="formfeed:edit-end"?(d=null,o&&!o.done&&S(!1)):t.type==="formfeed:edit-open"&&E(t))});function E(e){if(!f||typeof e.src!="string"||o&&!o.done)return;let t=Array.from(n.querySelectorAll(`[data-ff-src="${e.src.replace(/"/g,"")}"][data-ff-edit]`)),r=Number.isInteger(e.index)?Number(e.index):0,i=t[r]??t[0];i&&v(i,null)}if(f){let e=()=>u({type:"formfeed:edit-ready",doc:m}),t=a;t.PagedConfig?t.formfeedEditReady=e:n.readyState==="loading"?n.addEventListener("DOMContentLoaded",e):e()}function B(e){o&&!o.done&&S(!1);let t=e.layer?n.querySelector(`[data-ff-layer="${String(e.layer).replace(/"/g,"")}"] > .ff-text`):d&&d.src===e.src?d.element:n.querySelector(`[data-ff-src="${String(e.src).replace(/"/g,"")}"]`),r=e.at,i=e.layer?r&&Number.isFinite(r.x)&&Number.isFinite(r.y)?{x:Number(r.x),y:Number(r.y)}:null:d&&d.src===e.src?d.point:null;d=null;let b=s&&!n.hasFocus();if(!t||!Array.isArray(e.items)||b){u({type:"formfeed:edit-cancel",token:String(e.token)});return}let y=Array.from(t.childNodes),k=n.createDocumentFragment();for(let c of e.items)if(c.kind==="text")k.appendChild(n.createTextNode(String(c.text)));else if(c.kind==="break")k.appendChild(n.createElement("br"));else if(c.kind==="chip"){let h=n.createElement("span");h.className="ff-chip",h.setAttribute("data-ff-chip",String(c.index)),h.setAttribute("contenteditable","false"),c.title&&(h.title=String(c.title)),h.textContent=String(c.text),k.appendChild(h)}for(let c of y)t.removeChild(c);t.appendChild(k),t.contentEditable="true",t.classList.add("ff-editing"),t.setAttribute("role","textbox"),e.label&&t.setAttribute("aria-label",String(e.label)),t.spellcheck=!0,o={token:String(e.token),element:t,saved:y,allowBreaks:e.allowBreaks===!0,badge:e.note?I(t,String(e.note)):null,done:!1},t.addEventListener("keydown",T),t.addEventListener("beforeinput",N),t.addEventListener("paste",w),t.addEventListener("drop",R),t.addEventListener("focusout",F),p&&t.addEventListener("input",C),t.focus(),e.select==="all"?q(t):K(t,i),u({type:"formfeed:edit-started",token:o.token}),typeof e.insert=="string"&&e.insert&&A(e.insert.replace(/\\r\\n?|\\n/g," "))}function A(e){if(typeof n.execCommand=="function"&&n.execCommand("insertText",!1,e))return;let t=a.getSelection(),r=t&&t.rangeCount?t.getRangeAt(0):null;r&&(r.deleteContents(),r.insertNode(n.createTextNode(e)),r.collapse(!1),p&&C())}function C(){o&&!o.done&&u({type:"formfeed:edit-input",token:o.token,items:D(o.element)})}function I(e,t){let r=n.createElement("div");r.className="ff-edit-badge",r.textContent=t;let i=e.getBoundingClientRect();return r.style.left=`${i.left+a.scrollX}px`,r.style.top=`${Math.max(0,i.top+a.scrollY-22)}px`,n.body.appendChild(r),r}function q(e){let t=a.getSelection();if(!t)return;let r=n.createRange();r.selectNodeContents(e),t.removeAllRanges(),t.addRange(r)}function K(e,t){let r=a.getSelection();if(!r)return;let i=null,b=n;if(t){if(b.caretRangeFromPoint)i=b.caretRangeFromPoint(t.x,t.y);else if(b.caretPositionFromPoint){let y=b.caretPositionFromPoint(t.x,t.y);y&&(i=n.createRange(),i.setStart(y.offsetNode,y.offset))}}if(!i||!e.contains(i.startContainer))i=n.createRange(),i.selectNodeContents(e),i.collapse(!1);else if(t){let y=i.startContainer,c=(y.nodeType===1?y:y.parentElement)?.closest("[data-ff-chip]")??null;if(c&&c!==e&&e.contains(c)){let h=c.getBoundingClientRect();i=n.createRange(),t.x<h.left+h.width/2?i.setStartBefore(c):i.setStartAfter(c),i.collapse(!0)}}r.removeAllRanges(),r.addRange(i)}function T(e){let t=e.key;t==="Escape"?(e.preventDefault(),S(!0)):t==="Enter"&&!e.shiftKey?(e.preventDefault(),L()):t==="Enter"?(e.preventDefault(),o?.allowBreaks&&$()):t==="Tab"?(e.preventDefault(),L()):(e.ctrlKey||e.metaKey)&&["b","i","u"].includes(t.toLowerCase())&&(e.preventDefault(),p&&o&&!e.altKey&&u({type:"formfeed:edit-style",token:o.token,key:t.toLowerCase()}))}function N(e){let t=e.inputType??"";(t.startsWith("format")||t==="insertFromDrop"||t==="insertParagraph"||t==="insertLineBreak")&&e.preventDefault()}function w(e){e.preventDefault(),A((e.clipboardData?.getData("text/plain")??"").replace(/\\r\\n?|\\n/g," "))}function R(e){e.preventDefault()}function F(){a.setTimeout(()=>{o&&!o.done&&(!n.hasFocus()||!o.element.contains(n.activeElement))&&L()},0)}function $(){let e=a.getSelection();if(!e||!e.rangeCount)return;let t=e.getRangeAt(0);t.deleteContents();let r=n.createElement("br");t.insertNode(r),r.nextSibling||r.parentNode?.appendChild(n.createElement("br"));let i=n.createRange();i.setStartAfter(r),i.collapse(!0),e.removeAllRanges(),e.addRange(i)}function M(e){e.done=!0;let t=e.element;t.removeEventListener("keydown",T),t.removeEventListener("beforeinput",N),t.removeEventListener("paste",w),t.removeEventListener("drop",R),t.removeEventListener("focusout",F),t.removeEventListener("input",C),t.removeAttribute("contenteditable"),t.removeAttribute("role"),t.removeAttribute("aria-label"),t.classList.remove("ff-editing"),e.badge?.remove(),o===e&&(o=null)}function L(){let e=o;if(!e||e.done)return;let t=D(e.element);M(e),u({type:"formfeed:edit-commit",token:e.token,items:t})}function S(e){let t=o;if(!t||t.done)return;let r=t.element;for(;r.firstChild;)r.removeChild(r.firstChild);for(let i of t.saved)r.appendChild(i);M(t),e&&u({type:"formfeed:edit-cancel",token:t.token})}}function D(a){let l=[],f=n=>{let o=l[l.length-1];o?.kind==="text"?o.text+=n:n&&l.push({kind:"text",text:n})},p=n=>{for(let o of Array.from(n.childNodes))if(o.nodeType===3)f(o.data);else if(o.nodeType===1){let d=o,u=d.getAttribute("data-ff-chip");u!==null?l.push({kind:"chip",index:Number(u)}):d.tagName==="BR"?l.push({kind:"break"}):((d.tagName==="DIV"||d.tagName==="P")&&l.length&&l.push({kind:"break"}),p(d))}};for(p(a);l[l.length-1]?.kind==="break";)l.pop();return l}function O(a,l){return Array.from(a.querySelectorAll("[data-ff-layer]")).map(f=>{let p=f.querySelector(":scope > .ff-text"),n=!1;if(p&&f.style.height!=="auto"){let o=l.getComputedStyle(f),d=f.clientHeight-(parseFloat(o.paddingTop)||0)-(parseFloat(o.paddingBottom)||0);n=o.overflow==="hidden"&&(p.scrollHeight>d+1||p.scrollWidth>p.clientWidth+1)}return{id:f.getAttribute("data-ff-layer")??"",width:f.offsetWidth,height:f.offsetHeight,overflow:n}})}function P(a){let l=a.document,f=m=>{try{a.parent.postMessage(m,"*")}catch{}},p=m=>typeof m=="string"?l.querySelector(`[data-ff-layer="${m.replace(/"/g,"")}"]`):null,n=()=>{for(let m of Array.from(l.querySelectorAll("[data-ff-layer]")))for(let s of["left","top","width","height","transform"])m.style.removeProperty(s)},o=()=>{a.formfeedFit?.(),f({type:"formfeed:ready",layers:O(l,a)})};a.addEventListener("message",m=>{if(m.source!==a.parent)return;let s=m.data;if(!(!s||typeof s.type!="string")){if(s.type==="formfeed:layer-style"){let g=p(s.id);if(!g)return;let x=(v,E)=>{typeof E=="number"&&Number.isFinite(E)&&g.style.setProperty(v,`${E}px`)};x("left",s.left),x("top",s.top),x("width",s.width),x("height",s.height),typeof s.rotation=="number"&&Number.isFinite(s.rotation)&&g.style.setProperty("transform",s.rotation?`rotate(${s.rotation}deg)`:"none")}else if(s.type==="formfeed:layer-style-clear")n();else if(s.type==="formfeed:css"&&typeof s.css=="string"){let g=l.querySelector(\'style[data-formfeed="template"]\');g&&(g.textContent=s.css),n(),o()}}}),H(a,{clicks:!1,live:!0});let d=l.fonts,u=()=>d?void d.ready.then(o):o();l.readyState==="complete"?u():a.addEventListener("load",u)}P(window);})();';
5698
5700
  var auditRuntime = '"use strict";(()=>{var I={"document-title":"error","image-alt":"error","figure-name":"error","heading-order":"error","table-rows":"error","table-cell-empty":"error","masked-text":"error","filtered-text":"warning","document-language":"warning","table-headers":"warning","link-name":"warning","generated-text":"warning","fixed-text":"warning","running-text":"warning"};var S=120;var O=".formfeed-chrome, .ff-running-header, .ff-running-footer",_=".pageNumber, .totalPages, .date, .title, .url, .ff-page-no, .ff-page-total",k=new Set(["script","style","template","noscript","head"]),j=2e4,q=10,B=new Set(["page","pages","of","seite","seiten","von","p","s"]),u=t=>(t??"").replace(/\\s+/g," ").trim(),D=t=>t.replace(/\\s+/g,"").toLowerCase(),$=t=>/[\\p{L}\\p{N}]/u.test(t),Y=/^data-(ref|id|split-(from|to|original)|(previous-|next-)?break-(before|after|inside)|(align-)?last-split-element|nth-of-type|counter-.+|page(-number)?|undisplayed|after-page|following|has-notes|children|item-num)$/;function X(t){let n=t.cloneNode(!1);n.removeAttribute("data-ff-src"),n.removeAttribute("data-ff-edit");let i=t.closest(".pagedjs_page")!==null;for(let s of Array.from(n.attributes))i&&Y.test(s.name)?n.removeAttribute(s.name):s.value.length>48&&n.setAttribute(s.name,`${s.value.slice(0,40)}\\u2026`);let o=n.outerHTML.replace(new RegExp(`</${t.tagName}>$`,"i"),"");return o.length>S?`${o.slice(0,S-1)}\\u2026`:o}function F(t,n={}){let i=t.document,o=i.body,s=[],d=new Set,a=n.findings!==!1,c=(e,r,l={})=>{if(!a)return;let m=r?.closest("[data-ff-src]")?.getAttribute("data-ff-src")??null,h=r?X(r):"",g=`${e}|${m??h}|${JSON.stringify(l)}`;d.has(g)||(d.add(g),s.push({code:e,severity:I[e],src:m,snippet:h,args:l}))},f=new WeakMap,A=e=>{let r=f.get(e);if(r!==void 0)return r;let l=t.getComputedStyle(e),m=l.display==="none"||l.visibility==="hidden"||l.visibility==="collapse"||e.parentElement!==null&&e.parentElement!==i.documentElement&&A(e.parentElement);return f.set(e,m),m},p=e=>e.closest(\'[aria-hidden="true"]\')!==null,E=e=>/^(presentation|none)$/.test(e.getAttribute("role")??""),H=e=>e.closest(O)!==null,y=e=>$(e.textContent??""),x=e=>{let r=u(e.getAttribute("aria-label"));return r||u((e.getAttribute("aria-labelledby")??"").split(/\\s+/).filter(Boolean).map(l=>e.ownerDocument.getElementById(l)?.textContent??"").join(" "))},P=e=>x(e)||u(e.textContent)||u(Array.from(e.querySelectorAll("img[alt]")).map(r=>r.getAttribute("alt")).join(" "))||u(e.getAttribute("title")),T=e=>{let r=e.getAttribute("href")??"";return{href:r.startsWith("#")?r:e.href??r,name:P(e)}};u(i.title)||c("document-title",null),!u(i.documentElement.getAttribute("lang"))&&!n.locale&&c("document-language",null);let M=n.pages??(n.pageHeight&&n.pageHeight>0?Math.ceil(i.documentElement.scrollHeight/n.pageHeight):1),C=[],v=[],R={"masked-text":[],"filtered-text":[],"fixed-text":[]},w=(e,r)=>{R[e].some(l=>l.contains(r))||(R[e].push(r),c(e,r))},V=a&&ne(i),G=o?Array.from(o.querySelectorAll("*")).slice(0,j):[];for(let e of G){let r=e.tagName.toLowerCase();if(k.has(r)||H(e)||A(e))continue;if(r==="a"&&e.hasAttribute("href")){let g=T(e);C.push(g),!g.name&&!p(e)&&c("link-name",e)}if(!a)continue;let l=t.getComputedStyle(e),m=l.getPropertyValue("mask-image")||l.getPropertyValue("-webkit-mask-image");if(m&&m!=="none"&&y(e)&&w("masked-text",e),l.filter&&l.filter!=="none"&&y(e)&&w("filtered-text",e),l.position==="fixed"&&M>1&&y(e)&&w("fixed-text",e),V)for(let g of["::before","::after"]){let U=re(t.getComputedStyle(e,g).content);U&&c("generated-text",e,{text:U})}if(p(e))continue;r==="img"&&!E(e)?e.hasAttribute("alt")||x(e)||u(e.getAttribute("title"))||c("image-alt",e):(r==="canvas"||e.getAttribute("role")==="img"&&r!=="img")&&(x(e)||u(e.getAttribute("title"))||u(e.querySelector(":scope > title")?.textContent)||c("figure-name",e,{tag:r}));let h=/^h[1-6]$/.test(r)?Number(r[1]):e.getAttribute("role")==="heading"?Number(e.getAttribute("aria-level"))||2:0;h&&v.push({element:e,level:h}),r==="table"&&!E(e)&&Q(e,c)}let b=0;for(let{element:e,level:r}of v)(b===0?r!==1:r>b+1)&&c("heading-order",e,{level:r,previous:b}),b=r;let N=[],W=a&&o?D(J(o)):"",L=0;for(let e of["header","footer"])for(let r of z(i,e,n[e])){for(let l of Array.from(r.querySelectorAll("a[href]")))N.push(T(l));if(a)for(let{text:l,element:m}of K(r)){if(L>=q||W.includes(D(l)))continue;let h=s.length;c("running-text",m,{text:l.slice(0,80),part:e}),s.length>h&&L++}}return{findings:s,links:C,templateLinks:N}}function z(t,n,i){if(i!==void 0){if(!i.trim())return[];let o=new DOMParser().parseFromString(`<!doctype html><body>${i}</body>`,"text/html");return o.body?[o.body]:[]}return Array.from(t.querySelectorAll(`.ff-running-${n}, .formfeed-chrome[data-ff-chrome="${n}"]`))}function J(t){let n=[],i=o=>{if(o.nodeType===3){n.push(o.nodeValue??"");return}if(o.nodeType!==1)return;let s=o;if(!(k.has(s.tagName.toLowerCase())||s.matches(O)))for(let d of Array.from(o.childNodes))i(d)};return i(t),n.join(" ")}function K(t){let n=[],i=o=>{let s=o.tagName.toLowerCase();if(k.has(s)||o.matches(_))return;let d=Array.from(o.children).some(a=>a.matches(_));for(let a of Array.from(o.childNodes))if(a.nodeType===1)i(a);else if(a.nodeType===3&&!d)for(let c of(a.nodeValue??"").split(/\\s*[\xB7\u2022|]\\s*|\\s{2,}|\\n/)){let f=u(c);(f.toLowerCase().match(/[\\p{L}\\p{N}]+/gu)??[]).some(p=>!B.has(p))&&n.push({text:f,element:o})}};return i(t),n}function Q(t,n){let i=Array.from(t.rows);if(!(t.querySelector(\'th, [role="columnheader"], [role="rowheader"]\')!==null)){i.length>=2&&n("table-headers",t);return}let s=te(i),d=s.find(c=>c!==s[0]);d!==void 0&&n("table-rows",t,{first:s[0]??0,other:d});let a=i.flatMap(c=>Array.from(c.cells).filter(f=>f.tagName==="TD"&&ee(f)));a[0]&&n("table-cell-empty",a[0],{count:a.length})}var Z=\'img[alt]:not([alt=""]), svg, canvas, input, select, textarea, button, meter, progress\';function ee(t){return!/[^ \\t\\n\\r\\f]/.test(t.textContent??"")&&t.querySelector(Z)===null}function te(t){let n=[];return t.map(i=>{let o=[],s=0,d=()=>{for(;(n[s]??0)>0;)o[s]=n[s]-1,s++};for(let a of Array.from(i.cells)){d();let c=Math.max(1,a.rowSpan||1)-1;for(let f=Math.max(1,a.colSpan||1);f>0;f--)o[s++]=c}d();for(let a=s;a<n.length;a++)(n[a]??0)>0&&(o[a]=n[a]-1,s=a+1);return n=o,s})}function ne(t){let n=i=>{for(let o of Array.from(i??[])){let s=o;if(s.selectorText&&/::?(before|after)/.test(s.selectorText)&&s.style?.content||o.cssRules&&n(o.cssRules))return!0}return!1};for(let i of Array.from(t.styleSheets))try{if(n(i.cssRules))return!0}catch{return!0}return!1}function re(t){if(!t||t==="none"||t==="normal")return"";let n=(t.match(/"(?:[^"\\\\]|\\\\.)*"/g)??[]).map(o=>o.slice(1,-1).replace(/\\\\(.)/g,"$1"));if(/\\bcounters?\\(/.test(t))return u(t).slice(0,80);let i=u(n.join(""));return $(i)?i.slice(0,80):""}window.formfeedAudit=t=>F(window,t);})();';
5701
+ var pagedPrintRuntime = '"use strict";(()=>{var N=t=>!!t&&t.nodeType===1,y=t=>N(t)?t:t?.parentElement??null;function b(t,o){for(let e=t.firstElementChild;e;e=e.nextElementSibling)if(e.nodeName===o)return e;return null}var T=t=>Array.from(t.querySelectorAll(":scope > tbody > tr, :scope > tr"));function v(t,o){for(let e=t.parentElement;e&&!e.classList.contains("pagedjs_page_content");e=e.parentElement)if(o.getComputedStyle(e).display.startsWith("inline"))return!0;return!1}function O(t,o){for(let e=t;e&&e!==o;e=e.parentElement)for(let r=e.previousSibling;r;r=r.previousSibling)if(N(r)||(r.textContent??"").trim())return!0;return!1}function P(t){let o=t.cloneNode(!0);for(let e of[o,...Array.from(o.querySelectorAll("[id]"))])e.id&&(e.setAttribute("data-id",e.id),e.removeAttribute("id"));return o.setAttribute("data-ff-repeated",""),o}function k(t,o){for(let e of Array.from(t.querySelectorAll("table > tfoot"))){let r=e.nextElementSibling;for(;r&&r.nodeName!=="TBODY"&&r.nodeName!=="TR";)r=r.nextElementSibling;r&&o.getComputedStyle(e).display==="table-footer-group"&&e.parentNode?.appendChild(e)}}function H(t,o,e){let r=y(t),n=r?.closest("table");if(!r||!n||!n.hasAttribute("data-split-from")||n.hasAttribute("data-ff-head")||(n.setAttribute("data-ff-head",""),b(n,"THEAD")))return;let a=y(o)?.closest("table"),f=a&&b(a,"THEAD");if(!a||!f||v(n,e))return;let l=P(f),d=n.firstChild;for(;d&&(d.nodeName==="CAPTION"||d.nodeName==="COLGROUP");)d=d.nextSibling;if(n.insertBefore(l,d),e.getComputedStyle(l).display!=="table-header-group"){l.remove();return}for(let s=a.firstElementChild;s;s=s.nextElementSibling)s.nodeName==="COLGROUP"&&n.insertBefore(s.cloneNode(!0),l);let i=r.closest("tr"),u=i?.parentElement;i&&u&&u.parentElement===n&&u.nodeName!=="THEAD"&&(i.style.breakInside="auto",i.removeAttribute("data-break-inside"))}function w(t,o,e,r,n){let a=t.startContainer,f=N(a)?a.childNodes[t.startOffset]??a:a,l=y(f);if(!l)return;let d=l.nodeName==="TBODY"?l.querySelector("tr"):l.closest("tr"),i=d?.closest("table"),u=d?.parentElement;if(!d||!i||!u||u.nodeName==="THEAD"||u.nodeName==="TFOOT"||v(i,n))return;let s=T(i),h=s.indexOf(d);if(h<0)return;let m=h,E=0;if(h>0&&(f===d||f===u)){let p=r.querySelector(`[data-ref="${i.getAttribute("data-ref")??""}"]`),g=p&&b(p,"TFOOT");if(g){let c=g.cloneNode(!0);i.appendChild(c),n.getComputedStyle(c).display==="table-footer-group"&&(E=c.getBoundingClientRect().height),c.remove()}let C=Math.round(e),S=c=>!c||Math.floor(c.getBoundingClientRect().bottom)+E<=C;for(;m>0&&!S(s[m-1]);)m--}if(m===0){if(i.hasAttribute("data-split-from")||!b(i,"THEAD"))return;let p=i.previousElementSibling,g=i.getAttribute("data-previous-break-after")==="avoid"&&p?p:i;return O(g,o)?(t.setStartBefore(g),t):void 0}let A=s[m];return m<h&&A&&t.setStartBefore(A),E&&i.setAttribute("data-ff-foot",""),t}function R(t,o){let e=t.querySelector("table[data-ff-foot]");if(!e)return;e.removeAttribute("data-ff-foot");let r=o.querySelector(`[data-ref="${e.getAttribute("data-ref")??""}"]`),n=r&&b(r,"TFOOT");n&&e.appendChild(P(n))}function B(t){let o=t.querySelector(".pagedjs_pagebox");if(!o)return;let e=Array.from(o.children).filter(n=>!(n.getAttribute("class")??"").includes("pagedjs_")&&!n.hasAttribute("data-ff-fixed"));if(!e.length)return;let r=o.ownerDocument.createElement("div");r.setAttribute("data-ff-fixed",""),r.setAttribute("style","grid-column: center; grid-row: page; position: relative; pointer-events: none;");for(let n of e)"style"in n&&(n.style.pointerEvents="auto"),r.appendChild(n);o.appendChild(r)}function x(t){t.formfeedMoveTableFeet=()=>k(t.document,t);let o=t.Paged;if(!o?.Handler)return;class e extends o.Handler{renderNode(n,a){H(n,a,t)}onOverflow(n,a,f){return n?w(n,a,f.bottom,this.chunker.source,t):void 0}afterOverflowRemoved(n,a){R(a,this.chunker.source)}afterPageLayout(n){B(n)}}o.registerHandlers(e)}x(window);})();';
5699
5702
 
5700
5703
  // packages/engine/src/lib/assemble.ts
5701
5704
  var DEFAULT_CHROME_PADDING = "0 10mm";
@@ -5715,7 +5718,12 @@ function defaultSettings() {
5715
5718
  scale: 1,
5716
5719
  preferCssPageSize: false,
5717
5720
  pageRanges: "",
5718
- waitFor: { networkIdle: true, selector: null, timeoutMs: 5e3, delayMs: 0 },
5721
+ waitFor: {
5722
+ networkIdle: "auto",
5723
+ selector: null,
5724
+ timeoutMs: 5e3,
5725
+ delayMs: 0
5726
+ },
5719
5727
  pdf: { tagged: false, outline: false, metadata: { title: "", author: "" } },
5720
5728
  image: {
5721
5729
  width: 1200,
@@ -5790,12 +5798,12 @@ function fontFaceCss(fonts, referencedIn) {
5790
5798
  }).join("\n");
5791
5799
  }
5792
5800
  function chartInitScript() {
5793
- return `<script>window.formfeedDrawCharts=function(){if(typeof Chart==='undefined')return;var all=Chart.instances||{};for(var k in all){if(all[k]&&all[k].canvas&&!all[k].canvas.isConnected){try{all[k].destroy();}catch(e){}}}var cs=document.querySelectorAll('canvas[data-ff-chart]');for(var i=0;i<cs.length;i++){var c=cs[i];try{if(Chart.getChart(c))continue;var s=JSON.parse(c.getAttribute('data-ff-chart')||'{}');new Chart(c.getContext('2d'),s);c.setAttribute('data-ff-chart-ready','1');}catch(e){console.error('formfeed chart',e);}}};if(!window.PagedConfig){window.formfeedDrawCharts();}</script>`;
5801
+ return `<script data-formfeed="charts">window.formfeedDrawCharts=function(){if(typeof Chart==='undefined')return;var all=Chart.instances||{};for(var k in all){if(all[k]&&all[k].canvas&&!all[k].canvas.isConnected){try{all[k].destroy();}catch(e){}}}var cs=document.querySelectorAll('canvas[data-ff-chart]');for(var i=0;i<cs.length;i++){var c=cs[i];try{if(Chart.getChart(c))continue;var s=JSON.parse(c.getAttribute('data-ff-chart')||'{}');new Chart(c.getContext('2d'),s);c.setAttribute('data-ff-chart-ready','1');}catch(e){console.error('formfeed chart',e);}}};if(!window.PagedConfig){window.formfeedDrawCharts();}</script>`;
5794
5802
  }
5795
5803
  function chartScripts(html, vendor) {
5796
5804
  if (!vendor?.chartJs || !html.includes("data-ff-chart"))
5797
5805
  return { head: "", body: "" };
5798
- const lib = "inline" in vendor.chartJs ? `<script>${vendor.chartJs.inline}</script>` : `<script src="${escapeHtml(vendor.chartJs.src)}"></script>`;
5806
+ const lib = "inline" in vendor.chartJs ? `<script data-formfeed="chartjs">${vendor.chartJs.inline}</script>` : `<script data-formfeed="chartjs" src="${escapeHtml(vendor.chartJs.src)}"></script>`;
5799
5807
  return {
5800
5808
  head: `${lib}
5801
5809
  `,
@@ -5824,11 +5832,11 @@ ${brandFontFamilies(input.brand)}`
5824
5832
  const brandStyle = brand ? `<style data-formfeed="brand">${brand}</style>
5825
5833
  ` : "";
5826
5834
  const tailwind = settings.tailwind ? input.extraCss ? `<style data-formfeed="tailwind">${input.extraCss}</style>
5827
- ` : input.vendor?.tailwind ? `<script src="${escapeHtml(input.vendor.tailwind.src)}"></script>
5835
+ ` : input.vendor?.tailwind ? `<script data-formfeed="tailwind" src="${escapeHtml(input.vendor.tailwind.src)}"></script>
5828
5836
  ` : "" : input.extraCss ? `<style data-formfeed="extra">${input.extraCss}</style>
5829
5837
  ` : "";
5830
5838
  const charts = chartScripts(input.html, input.vendor);
5831
- const fit = input.html.includes("data-ff-fit") ? `<script>${fitRuntime.replace(/<\/script/gi, "<\\/script")}</script>
5839
+ const fit = input.html.includes("data-ff-fit") ? `<script data-formfeed="fit">${fitRuntime.replace(/<\/script/gi, "<\\/script")}</script>
5832
5840
  ` : "";
5833
5841
  return `<!doctype html>
5834
5842
  <html lang="${escapeHtml(locale.split("_")[0] ?? locale)}">
@@ -6146,14 +6154,15 @@ html { background: #e5e7eb; }
6146
6154
  `;
6147
6155
  const selectorGuard = `<script>(function(){var q=DocumentFragment.prototype.querySelectorAll;DocumentFragment.prototype.querySelectorAll=function(s){try{return q.call(this,s);}catch(e){console.warn('formfeed paged preview: skipped a selector Paged.js could not use:',s);return q.call(this,':not(*)');}};})();</script>`;
6148
6156
  const boxSizingGuard = `<script>(function(){var rule='.pagedjs_pagebox *';var o=new MutationObserver(function(ms){ms.forEach(function(m){m.addedNodes.forEach(function(n){if(n.nodeName==='STYLE'&&n.textContent&&n.textContent.indexOf(rule)>=0){n.textContent=n.textContent.split(rule).join('.pagedjs_pagebox [class*="pagedjs_"]');o.disconnect();}});});});o.observe(document.documentElement,{childList:true,subtree:true});})();</script>`;
6149
- const config = `<script>window.PagedConfig = { auto: true, after: function (flow) { try { if (window.formfeedDrawCharts) window.formfeedDrawCharts(); } catch (e) {} try { if (window.formfeedFit) window.formfeedFit(); } catch (e) {} try { parent.postMessage({ type: 'formfeed:pages', pages: flow.total }, '*'); } catch (e) {} if (window.formfeedCheckOverflow) window.formfeedCheckOverflow(); if (window.formfeedRunAudit) window.formfeedRunAudit(flow.total); try { if (window.formfeedEditReady) window.formfeedEditReady(); } catch (e) {} } };</script>`;
6157
+ const tables = `<script data-formfeed="paged-print">${pagedPrintRuntime.replace(/<\/script/gi, "<\\/script")}</script>`;
6158
+ const config = `<script>window.PagedConfig = { auto: true, before: function () { try { if (window.formfeedMoveTableFeet) window.formfeedMoveTableFeet(); } catch (e) {} }, after: function (flow) { try { if (window.formfeedDrawCharts) window.formfeedDrawCharts(); } catch (e) {} try { if (window.formfeedFit) window.formfeedFit(); } catch (e) {} try { parent.postMessage({ type: 'formfeed:pages', pages: flow.total }, '*'); } catch (e) {} if (window.formfeedCheckOverflow) window.formfeedCheckOverflow(); if (window.formfeedRunAudit) window.formfeedRunAudit(flow.total); try { if (window.formfeedEditReady) window.formfeedEditReady(); } catch (e) {} } };</script>`;
6150
6159
  const script = `<script src="${options.pagedScriptUrl}"></script>`;
6151
6160
  const header = headerHtml ? `<div class="ff-running-header">${pageNumberSpans(headerHtml, '<span class="ff-page-no"></span>', '<span class="ff-page-total"></span>')}</div>` : "";
6152
6161
  const footer = footerHtml ? `<div class="ff-running-footer">${pageNumberSpans(footerHtml, '<span class="ff-page-no"></span>', '<span class="ff-page-total"></span>')}</div>` : "";
6153
6162
  return intoBody(
6154
6163
  intoHead(
6155
6164
  draft.document,
6156
- `${documentMeta(options)}<style data-formfeed="paged">${runningCss}</style>${selectorGuard}${boxSizingGuard}${overflowScript("paged")}${options.audit ? auditScript("paged") : ""}${config}${script}${options.editing ? textEditScript : ""}${inspectScript}${pageNavScript}${zoomGestureScript}`
6165
+ `${documentMeta(options)}<style data-formfeed="paged">${runningCss}</style>${selectorGuard}${boxSizingGuard}${overflowScript("paged")}${options.audit ? auditScript("paged") : ""}${config}${script}${tables}${options.editing ? textEditScript : ""}${inspectScript}${pageNavScript}${zoomGestureScript}`
6157
6166
  ),
6158
6167
  `${header}${footer}`
6159
6168
  );
@@ -8776,15 +8785,24 @@ var FRENCH_FRAMEWORKS = /* @__PURE__ */ new Set([
8776
8785
  "B2",
8777
8786
  "S2",
8778
8787
  "M2",
8788
+ "S3",
8779
8789
  "B4",
8780
8790
  "S4",
8781
8791
  "M4",
8782
8792
  "S5",
8783
8793
  "S6",
8784
8794
  "B7",
8785
- "S7"
8795
+ "S7",
8796
+ "B8",
8797
+ "S8",
8798
+ "M8"
8786
8799
  ]);
8787
8800
  var FRENCH_OPERATION = { goods: "B1", services: "S1", mixed: "M1" };
8801
+ var FRENCH_NOTES = [
8802
+ ["PMT", "the fixed compensation of \u20AC40 for recovery costs"],
8803
+ ["PMD", "the penalties for late payment"],
8804
+ ["AAB", "the discount for early payment, or that none is given"]
8805
+ ];
8788
8806
  var CREDIT_TRANSFER = /* @__PURE__ */ new Set(["30", "58"]);
8789
8807
  function checkInvoice(data, options = {}) {
8790
8808
  const problems = [];
@@ -8842,7 +8860,7 @@ function checkInvoice(data, options = {}) {
8842
8860
  }
8843
8861
  const invoice = normalise(parsed.data, add2, options);
8844
8862
  if (problems.length > 0) return { ok: false, invoice: null, problems };
8845
- rules(invoice, add2);
8863
+ rules(invoice, add2, options);
8846
8864
  return problems.length > 0 ? { ok: false, invoice: null, problems } : { ok: true, invoice, problems: [] };
8847
8865
  }
8848
8866
  function pathText(path) {
@@ -9272,7 +9290,7 @@ function defined(value) {
9272
9290
  var cents = (text4) => text4 === void 0 ? 0n : toUnits(text4, 2);
9273
9291
  var money = (value) => fromUnits(value, 2);
9274
9292
  var rateKey = (tax) => `${tax.category}|${tax.rate ?? ""}`;
9275
- function rules(invoice, add2) {
9293
+ function rules(invoice, add2, options) {
9276
9294
  const { totals: totals2 } = invoice;
9277
9295
  const sum = (path, stated, expected, rule2, formula) => {
9278
9296
  if (stated !== expected)
@@ -9679,6 +9697,13 @@ function rules(invoice, add2) {
9679
9697
  { rule: "BR-CO-25" }
9680
9698
  );
9681
9699
  if (invoice.seller.address.country === "FR" && invoice.buyer.address.country === "FR") {
9700
+ if (options.profile === "basic")
9701
+ add2(
9702
+ "fr_profile",
9703
+ "",
9704
+ "_invoice is an invoice between French businesses, which France's e-invoicing reform does not accept in the profile basic (AFNOR XP Z12-012 takes EN 16931 and EXTENDED-CTC-FR); use en16931",
9705
+ { args: { profile: "basic" } }
9706
+ );
9682
9707
  const digits = (id) => (id?.value ?? "").replace(/\s/g, "");
9683
9708
  if (!/^\d{9}$/.test(digits(invoice.seller.legal_registration)))
9684
9709
  add2(
@@ -9720,6 +9745,29 @@ function rules(invoice, add2) {
9720
9745
  "seller.vat_on_debits",
9721
9746
  "_invoice.seller.vat_on_debits is missing: an invoice between French businesses says whether the seller pays VAT on invoicing (true) or on payment (false)"
9722
9747
  );
9748
+ const subjects = new Set(invoice.notes.map((note2) => note2.subject_code));
9749
+ for (const [code, what] of FRENCH_NOTES)
9750
+ if (!subjects.has(code))
9751
+ add2(
9752
+ "fr_note",
9753
+ "notes",
9754
+ `_invoice.notes has no note with the subject_code ${code}: an invoice between French businesses states ${what} as a note (BT-21, BT-22)`,
9755
+ { rule: "BR-FR-05", args: { subject_code: code } }
9756
+ );
9757
+ if (!invoice.seller.electronic_address)
9758
+ add2(
9759
+ "fr_electronic_address",
9760
+ "seller.electronic_address",
9761
+ "_invoice.seller.electronic_address is missing: an invoice between French businesses names the seller's electronic address (BT-34)",
9762
+ { rule: "BR-FR-13", args: { term: "BT-34" } }
9763
+ );
9764
+ if (!invoice.buyer.electronic_address)
9765
+ add2(
9766
+ "fr_electronic_address",
9767
+ "buyer.electronic_address",
9768
+ "_invoice.buyer.electronic_address is missing: an invoice between French businesses names the buyer's electronic address (BT-49)",
9769
+ { rule: "BR-FR-12", args: { term: "BT-49" } }
9770
+ );
9723
9771
  }
9724
9772
  }
9725
9773
 
@@ -10015,6 +10063,595 @@ ${children}${indent}</${element.name}>
10015
10063
  `;
10016
10064
  }
10017
10065
 
10066
+ // packages/engine/src/lib/einvoice/coverage.ts
10067
+ var EN16931_TERMS = [
10068
+ { term: "BT-1", name: "Invoice number", fields: ["number"] },
10069
+ { term: "BT-2", name: "Invoice issue date", fields: ["issue_date"] },
10070
+ { term: "BT-3", name: "Invoice type code", fields: ["type_code"] },
10071
+ { term: "BT-5", name: "Invoice currency code", fields: ["currency"] },
10072
+ {
10073
+ term: "BT-6",
10074
+ name: "VAT accounting currency code",
10075
+ fields: ["accounting_currency"]
10076
+ },
10077
+ { term: "BT-7", name: "Value added tax point date", fields: [] },
10078
+ {
10079
+ term: "BT-8",
10080
+ name: "Value added tax point date code",
10081
+ fields: ["seller.vat_on_debits"]
10082
+ },
10083
+ { term: "BT-9", name: "Payment due date", fields: ["payment.due_date"] },
10084
+ { term: "BT-10", name: "Buyer reference", fields: ["buyer_reference"] },
10085
+ { term: "BT-11", name: "Project reference", fields: [] },
10086
+ { term: "BT-12", name: "Contract reference", fields: ["contract_reference"] },
10087
+ {
10088
+ term: "BT-13",
10089
+ name: "Purchase order reference",
10090
+ fields: ["order_reference"]
10091
+ },
10092
+ { term: "BT-14", name: "Sales order reference", fields: [] },
10093
+ { term: "BT-15", name: "Receiving advice reference", fields: [] },
10094
+ { term: "BT-16", name: "Despatch advice reference", fields: [] },
10095
+ { term: "BT-17", name: "Tender or lot reference", fields: [] },
10096
+ { term: "BT-18", name: "Invoiced object identifier", fields: [] },
10097
+ { term: "BT-19", name: "Buyer accounting reference", fields: [] },
10098
+ { term: "BT-20", name: "Payment terms", fields: ["payment.terms"] },
10099
+ {
10100
+ term: "BT-21",
10101
+ name: "Invoice note subject code",
10102
+ fields: ["notes[].subject_code"]
10103
+ },
10104
+ { term: "BT-22", name: "Invoice note", fields: ["note", "notes[].text"] },
10105
+ {
10106
+ term: "BT-23",
10107
+ name: "Business process type",
10108
+ fields: ["operation", "operation_code"]
10109
+ },
10110
+ {
10111
+ term: "BT-24",
10112
+ name: "Specification identifier",
10113
+ fields: [],
10114
+ option: "profile"
10115
+ },
10116
+ {
10117
+ term: "BT-25",
10118
+ name: "Preceding Invoice reference",
10119
+ fields: ["preceding_invoices[].number"]
10120
+ },
10121
+ {
10122
+ term: "BT-26",
10123
+ name: "Preceding Invoice issue date",
10124
+ fields: ["preceding_invoices[].issue_date"]
10125
+ },
10126
+ { term: "BT-27", name: "Seller name", fields: ["seller.name"] },
10127
+ {
10128
+ term: "BT-28",
10129
+ name: "Seller trading name",
10130
+ fields: ["seller.trading_name"]
10131
+ },
10132
+ { term: "BT-29", name: "Seller identifier", fields: ["seller.id"] },
10133
+ {
10134
+ term: "BT-30",
10135
+ name: "Seller legal registration identifier",
10136
+ fields: ["seller.legal_registration"]
10137
+ },
10138
+ { term: "BT-31", name: "Seller VAT identifier", fields: ["seller.vat_id"] },
10139
+ {
10140
+ term: "BT-32",
10141
+ name: "Seller tax registration identifier",
10142
+ fields: ["seller.tax_number"]
10143
+ },
10144
+ {
10145
+ term: "BT-33",
10146
+ name: "Seller additional legal information",
10147
+ fields: ["seller.legal_info"],
10148
+ en16931Only: true
10149
+ },
10150
+ {
10151
+ term: "BT-34",
10152
+ name: "Seller electronic address",
10153
+ fields: ["seller.electronic_address"]
10154
+ },
10155
+ {
10156
+ term: "BT-35",
10157
+ name: "Seller address line 1",
10158
+ fields: ["seller.address.street"]
10159
+ },
10160
+ {
10161
+ term: "BT-36",
10162
+ name: "Seller address line 2",
10163
+ fields: ["seller.address.street2"]
10164
+ },
10165
+ { term: "BT-37", name: "Seller city", fields: ["seller.address.city"] },
10166
+ {
10167
+ term: "BT-38",
10168
+ name: "Seller post code",
10169
+ fields: ["seller.address.postcode"]
10170
+ },
10171
+ {
10172
+ term: "BT-39",
10173
+ name: "Seller country subdivision",
10174
+ fields: ["seller.address.subdivision"]
10175
+ },
10176
+ {
10177
+ term: "BT-40",
10178
+ name: "Seller country code",
10179
+ fields: ["seller.address.country"]
10180
+ },
10181
+ {
10182
+ term: "BT-41",
10183
+ name: "Seller contact point",
10184
+ fields: ["seller.contact.name"],
10185
+ en16931Only: true
10186
+ },
10187
+ {
10188
+ term: "BT-42",
10189
+ name: "Seller contact telephone number",
10190
+ fields: ["seller.contact.phone"],
10191
+ en16931Only: true
10192
+ },
10193
+ {
10194
+ term: "BT-43",
10195
+ name: "Seller contact email address",
10196
+ fields: ["seller.contact.email"],
10197
+ en16931Only: true
10198
+ },
10199
+ { term: "BT-44", name: "Buyer name", fields: ["buyer.name"] },
10200
+ { term: "BT-45", name: "Buyer trading name", fields: ["buyer.trading_name"] },
10201
+ { term: "BT-46", name: "Buyer identifier", fields: ["buyer.id"] },
10202
+ {
10203
+ term: "BT-47",
10204
+ name: "Buyer legal registration identifier",
10205
+ fields: ["buyer.legal_registration", "buyer.siren"]
10206
+ },
10207
+ { term: "BT-48", name: "Buyer VAT identifier", fields: ["buyer.vat_id"] },
10208
+ {
10209
+ term: "BT-49",
10210
+ name: "Buyer electronic address",
10211
+ fields: ["buyer.electronic_address"]
10212
+ },
10213
+ {
10214
+ term: "BT-50",
10215
+ name: "Buyer address line 1",
10216
+ fields: ["buyer.address.street"]
10217
+ },
10218
+ {
10219
+ term: "BT-51",
10220
+ name: "Buyer address line 2",
10221
+ fields: ["buyer.address.street2"]
10222
+ },
10223
+ { term: "BT-52", name: "Buyer city", fields: ["buyer.address.city"] },
10224
+ {
10225
+ term: "BT-53",
10226
+ name: "Buyer post code",
10227
+ fields: ["buyer.address.postcode"]
10228
+ },
10229
+ {
10230
+ term: "BT-54",
10231
+ name: "Buyer country subdivision",
10232
+ fields: ["buyer.address.subdivision"]
10233
+ },
10234
+ {
10235
+ term: "BT-55",
10236
+ name: "Buyer country code",
10237
+ fields: ["buyer.address.country"]
10238
+ },
10239
+ {
10240
+ term: "BT-56",
10241
+ name: "Buyer contact point",
10242
+ fields: ["buyer.contact.name"],
10243
+ en16931Only: true
10244
+ },
10245
+ {
10246
+ term: "BT-57",
10247
+ name: "Buyer contact telephone number",
10248
+ fields: ["buyer.contact.phone"],
10249
+ en16931Only: true
10250
+ },
10251
+ {
10252
+ term: "BT-58",
10253
+ name: "Buyer contact email address",
10254
+ fields: ["buyer.contact.email"],
10255
+ en16931Only: true
10256
+ },
10257
+ { term: "BT-59", name: "Payee name", fields: [] },
10258
+ { term: "BT-60", name: "Payee identifier", fields: [] },
10259
+ { term: "BT-61", name: "Payee legal registration identifier", fields: [] },
10260
+ { term: "BT-62", name: "Seller tax representative name", fields: [] },
10261
+ {
10262
+ term: "BT-63",
10263
+ name: "Seller tax representative VAT identifier",
10264
+ fields: []
10265
+ },
10266
+ { term: "BT-64", name: "Tax representative address line 1", fields: [] },
10267
+ { term: "BT-65", name: "Tax representative address line 2", fields: [] },
10268
+ { term: "BT-66", name: "Tax representative city", fields: [] },
10269
+ { term: "BT-67", name: "Tax representative post code", fields: [] },
10270
+ { term: "BT-68", name: "Tax representative country subdivision", fields: [] },
10271
+ { term: "BT-69", name: "Tax representative country code", fields: [] },
10272
+ { term: "BT-70", name: "Deliver to party name", fields: ["delivery.name"] },
10273
+ { term: "BT-71", name: "Deliver to location identifier", fields: [] },
10274
+ { term: "BT-72", name: "Actual delivery date", fields: ["delivery.date"] },
10275
+ {
10276
+ term: "BT-73",
10277
+ name: "Invoicing period start date",
10278
+ fields: ["period.start"]
10279
+ },
10280
+ { term: "BT-74", name: "Invoicing period end date", fields: ["period.end"] },
10281
+ {
10282
+ term: "BT-75",
10283
+ name: "Deliver to address line 1",
10284
+ fields: ["delivery.address.street"]
10285
+ },
10286
+ {
10287
+ term: "BT-76",
10288
+ name: "Deliver to address line 2",
10289
+ fields: ["delivery.address.street2"]
10290
+ },
10291
+ { term: "BT-77", name: "Deliver to city", fields: ["delivery.address.city"] },
10292
+ {
10293
+ term: "BT-78",
10294
+ name: "Deliver to post code",
10295
+ fields: ["delivery.address.postcode"]
10296
+ },
10297
+ {
10298
+ term: "BT-79",
10299
+ name: "Deliver to country subdivision",
10300
+ fields: ["delivery.address.subdivision"]
10301
+ },
10302
+ {
10303
+ term: "BT-80",
10304
+ name: "Deliver to country code",
10305
+ fields: ["delivery.address.country"]
10306
+ },
10307
+ {
10308
+ term: "BT-81",
10309
+ name: "Payment means type code",
10310
+ fields: ["payment.means_code"]
10311
+ },
10312
+ { term: "BT-82", name: "Payment means text", fields: [] },
10313
+ {
10314
+ term: "BT-83",
10315
+ name: "Remittance information",
10316
+ fields: ["payment.reference"]
10317
+ },
10318
+ {
10319
+ term: "BT-84",
10320
+ name: "Payment account identifier",
10321
+ fields: ["payment.iban"]
10322
+ },
10323
+ {
10324
+ term: "BT-85",
10325
+ name: "Payment account name",
10326
+ fields: ["payment.account_name"],
10327
+ en16931Only: true
10328
+ },
10329
+ {
10330
+ term: "BT-86",
10331
+ name: "Payment service provider identifier",
10332
+ fields: ["payment.bic"],
10333
+ en16931Only: true
10334
+ },
10335
+ { term: "BT-87", name: "Payment card primary account number", fields: [] },
10336
+ { term: "BT-88", name: "Payment card holder name", fields: [] },
10337
+ {
10338
+ term: "BT-89",
10339
+ name: "Mandate reference identifier",
10340
+ fields: ["payment.mandate_id"]
10341
+ },
10342
+ {
10343
+ term: "BT-90",
10344
+ name: "Bank assigned creditor identifier",
10345
+ fields: ["payment.creditor_id"]
10346
+ },
10347
+ {
10348
+ term: "BT-91",
10349
+ name: "Debited account identifier",
10350
+ fields: ["payment.debited_iban"]
10351
+ },
10352
+ {
10353
+ term: "BT-92",
10354
+ name: "Document level allowance amount",
10355
+ fields: ["allowances[].amount"]
10356
+ },
10357
+ {
10358
+ term: "BT-93",
10359
+ name: "Document level allowance base amount",
10360
+ fields: ["allowances[].base_amount"]
10361
+ },
10362
+ {
10363
+ term: "BT-94",
10364
+ name: "Document level allowance percentage",
10365
+ fields: ["allowances[].percent"]
10366
+ },
10367
+ {
10368
+ term: "BT-95",
10369
+ name: "Document level allowance VAT category code",
10370
+ fields: ["allowances[].tax.category"]
10371
+ },
10372
+ {
10373
+ term: "BT-96",
10374
+ name: "Document level allowance VAT rate",
10375
+ fields: ["allowances[].tax.rate"]
10376
+ },
10377
+ {
10378
+ term: "BT-97",
10379
+ name: "Document level allowance reason",
10380
+ fields: ["allowances[].reason"]
10381
+ },
10382
+ {
10383
+ term: "BT-98",
10384
+ name: "Document level allowance reason code",
10385
+ fields: ["allowances[].reason_code"]
10386
+ },
10387
+ {
10388
+ term: "BT-99",
10389
+ name: "Document level charge amount",
10390
+ fields: ["charges[].amount"]
10391
+ },
10392
+ {
10393
+ term: "BT-100",
10394
+ name: "Document level charge base amount",
10395
+ fields: ["charges[].base_amount"]
10396
+ },
10397
+ {
10398
+ term: "BT-101",
10399
+ name: "Document level charge percentage",
10400
+ fields: ["charges[].percent"]
10401
+ },
10402
+ {
10403
+ term: "BT-102",
10404
+ name: "Document level charge VAT category code",
10405
+ fields: ["charges[].tax.category"]
10406
+ },
10407
+ {
10408
+ term: "BT-103",
10409
+ name: "Document level charge VAT rate",
10410
+ fields: ["charges[].tax.rate"]
10411
+ },
10412
+ {
10413
+ term: "BT-104",
10414
+ name: "Document level charge reason",
10415
+ fields: ["charges[].reason"]
10416
+ },
10417
+ {
10418
+ term: "BT-105",
10419
+ name: "Document level charge reason code",
10420
+ fields: ["charges[].reason_code"]
10421
+ },
10422
+ {
10423
+ term: "BT-106",
10424
+ name: "Sum of Invoice line net amount",
10425
+ fields: ["totals.line_net"]
10426
+ },
10427
+ {
10428
+ term: "BT-107",
10429
+ name: "Sum of allowances on document level",
10430
+ fields: ["totals.allowances"]
10431
+ },
10432
+ {
10433
+ term: "BT-108",
10434
+ name: "Sum of charges on document level",
10435
+ fields: ["totals.charges"]
10436
+ },
10437
+ {
10438
+ term: "BT-109",
10439
+ name: "Invoice total amount without VAT",
10440
+ fields: ["totals.tax_basis"]
10441
+ },
10442
+ {
10443
+ term: "BT-110",
10444
+ name: "Invoice total VAT amount",
10445
+ fields: ["totals.tax_total"]
10446
+ },
10447
+ {
10448
+ term: "BT-111",
10449
+ name: "Invoice total VAT amount in accounting currency",
10450
+ fields: ["totals.tax_total_accounting"]
10451
+ },
10452
+ {
10453
+ term: "BT-112",
10454
+ name: "Invoice total amount with VAT",
10455
+ fields: ["totals.grand"]
10456
+ },
10457
+ { term: "BT-113", name: "Paid amount", fields: ["totals.prepaid"] },
10458
+ {
10459
+ term: "BT-114",
10460
+ name: "Rounding amount",
10461
+ fields: ["totals.rounding"],
10462
+ en16931Only: true
10463
+ },
10464
+ { term: "BT-115", name: "Amount due for payment", fields: ["totals.due"] },
10465
+ {
10466
+ term: "BT-116",
10467
+ name: "VAT category taxable amount",
10468
+ fields: ["tax.breakdown[].basis"]
10469
+ },
10470
+ {
10471
+ term: "BT-117",
10472
+ name: "VAT category tax amount",
10473
+ fields: ["tax.breakdown[].amount"]
10474
+ },
10475
+ {
10476
+ term: "BT-118",
10477
+ name: "VAT category code",
10478
+ fields: ["tax.breakdown[].category"]
10479
+ },
10480
+ {
10481
+ term: "BT-119",
10482
+ name: "VAT category rate",
10483
+ fields: ["tax.breakdown[].rate"]
10484
+ },
10485
+ {
10486
+ term: "BT-120",
10487
+ name: "VAT exemption reason text",
10488
+ fields: ["tax.breakdown[].exemption_reason"]
10489
+ },
10490
+ {
10491
+ term: "BT-121",
10492
+ name: "VAT exemption reason code",
10493
+ fields: ["tax.breakdown[].exemption_reason_code"]
10494
+ },
10495
+ { term: "BT-122", name: "Supporting document reference", fields: [] },
10496
+ { term: "BT-123", name: "Supporting document description", fields: [] },
10497
+ { term: "BT-124", name: "External document location", fields: [] },
10498
+ { term: "BT-125", name: "Attached document", fields: [] },
10499
+ { term: "BT-126", name: "Invoice line identifier", fields: ["lines[].id"] },
10500
+ { term: "BT-127", name: "Invoice line note", fields: ["lines[].note"] },
10501
+ { term: "BT-128", name: "Invoice line object identifier", fields: [] },
10502
+ { term: "BT-129", name: "Invoiced quantity", fields: ["lines[].quantity"] },
10503
+ {
10504
+ term: "BT-130",
10505
+ name: "Invoiced quantity unit of measure code",
10506
+ fields: ["lines[].unit_code"]
10507
+ },
10508
+ {
10509
+ term: "BT-131",
10510
+ name: "Invoice line net amount",
10511
+ fields: ["lines[].net_amount"]
10512
+ },
10513
+ {
10514
+ term: "BT-132",
10515
+ name: "Referenced purchase order line reference",
10516
+ fields: ["lines[].order_line_reference"],
10517
+ en16931Only: true
10518
+ },
10519
+ {
10520
+ term: "BT-133",
10521
+ name: "Invoice line Buyer accounting reference",
10522
+ fields: ["lines[].buyer_accounting_reference"],
10523
+ en16931Only: true
10524
+ },
10525
+ {
10526
+ term: "BT-134",
10527
+ name: "Invoice line period start date",
10528
+ fields: ["lines[].period.start"]
10529
+ },
10530
+ {
10531
+ term: "BT-135",
10532
+ name: "Invoice line period end date",
10533
+ fields: ["lines[].period.end"]
10534
+ },
10535
+ {
10536
+ term: "BT-136",
10537
+ name: "Invoice line allowance amount",
10538
+ fields: ["lines[].allowances[].amount"]
10539
+ },
10540
+ {
10541
+ term: "BT-137",
10542
+ name: "Invoice line allowance base amount",
10543
+ fields: ["lines[].allowances[].base_amount"]
10544
+ },
10545
+ {
10546
+ term: "BT-138",
10547
+ name: "Invoice line allowance percentage",
10548
+ fields: ["lines[].allowances[].percent"]
10549
+ },
10550
+ {
10551
+ term: "BT-139",
10552
+ name: "Invoice line allowance reason",
10553
+ fields: ["lines[].allowances[].reason"]
10554
+ },
10555
+ {
10556
+ term: "BT-140",
10557
+ name: "Invoice line allowance reason code",
10558
+ fields: ["lines[].allowances[].reason_code"]
10559
+ },
10560
+ {
10561
+ term: "BT-141",
10562
+ name: "Invoice line charge amount",
10563
+ fields: ["lines[].charges[].amount"]
10564
+ },
10565
+ {
10566
+ term: "BT-142",
10567
+ name: "Invoice line charge base amount",
10568
+ fields: ["lines[].charges[].base_amount"]
10569
+ },
10570
+ {
10571
+ term: "BT-143",
10572
+ name: "Invoice line charge percentage",
10573
+ fields: ["lines[].charges[].percent"]
10574
+ },
10575
+ {
10576
+ term: "BT-144",
10577
+ name: "Invoice line charge reason",
10578
+ fields: ["lines[].charges[].reason"]
10579
+ },
10580
+ {
10581
+ term: "BT-145",
10582
+ name: "Invoice line charge reason code",
10583
+ fields: ["lines[].charges[].reason_code"]
10584
+ },
10585
+ { term: "BT-146", name: "Item net price", fields: ["lines[].net_price"] },
10586
+ { term: "BT-147", name: "Item price discount", fields: [] },
10587
+ { term: "BT-148", name: "Item gross price", fields: [] },
10588
+ {
10589
+ term: "BT-149",
10590
+ name: "Item price base quantity",
10591
+ fields: ["lines[].price_base_quantity"]
10592
+ },
10593
+ {
10594
+ term: "BT-150",
10595
+ name: "Item price base quantity unit of measure",
10596
+ fields: ["lines[].unit_code"]
10597
+ },
10598
+ {
10599
+ term: "BT-151",
10600
+ name: "Invoiced item VAT category code",
10601
+ fields: ["lines[].tax.category"]
10602
+ },
10603
+ {
10604
+ term: "BT-152",
10605
+ name: "Invoiced item VAT rate",
10606
+ fields: ["lines[].tax.rate"]
10607
+ },
10608
+ { term: "BT-153", name: "Item name", fields: ["lines[].name"] },
10609
+ {
10610
+ term: "BT-154",
10611
+ name: "Item description",
10612
+ fields: ["lines[].description"],
10613
+ en16931Only: true
10614
+ },
10615
+ {
10616
+ term: "BT-155",
10617
+ name: "Item Sellers identifier",
10618
+ fields: ["lines[].seller_item_id"],
10619
+ en16931Only: true
10620
+ },
10621
+ {
10622
+ term: "BT-156",
10623
+ name: "Item Buyers identifier",
10624
+ fields: ["lines[].buyer_item_id"],
10625
+ en16931Only: true
10626
+ },
10627
+ {
10628
+ term: "BT-157",
10629
+ name: "Item standard identifier",
10630
+ fields: ["lines[].standard_item_id"]
10631
+ },
10632
+ { term: "BT-158", name: "Item classification identifier", fields: [] },
10633
+ { term: "BT-159", name: "Item country of origin", fields: [] },
10634
+ { term: "BT-160", name: "Item attribute name", fields: [] },
10635
+ { term: "BT-161", name: "Item attribute value", fields: [] },
10636
+ {
10637
+ term: "BT-162",
10638
+ name: "Seller address line 3",
10639
+ fields: ["seller.address.street3"]
10640
+ },
10641
+ {
10642
+ term: "BT-163",
10643
+ name: "Buyer address line 3",
10644
+ fields: ["buyer.address.street3"]
10645
+ },
10646
+ { term: "BT-164", name: "Tax representative address line 3", fields: [] },
10647
+ {
10648
+ term: "BT-165",
10649
+ name: "Deliver to address line 3",
10650
+ fields: ["delivery.address.street3"]
10651
+ }
10652
+ ];
10653
+ var carriesTerm = (term) => term.fields.length > 0 || term.option !== void 0;
10654
+
10018
10655
  // packages/engine/src/lib/einvoice/display.ts
10019
10656
  var DISPLAY_TERMS = {
10020
10657
  "BT-1": "invoice number",
@@ -10288,7 +10925,12 @@ function einvoiceResult(options, specVersion, validation, display) {
10288
10925
  valid: validation.valid,
10289
10926
  schematron: validation.schematron,
10290
10927
  pdfa: validation.pdfa,
10291
- ...capMessages(validation.messages)
10928
+ ...capMessages(validation.messages),
10929
+ // what judged which bytes: the report a business keeps as its proof names both
10930
+ ...validation.id ? { id: validation.id } : {},
10931
+ ...validation.versions ? { versions: validation.versions } : {},
10932
+ ...validation.xml_sha256 ? { xml_sha256: validation.xml_sha256 } : {},
10933
+ ...validation.pdf_sha256 !== void 0 ? { pdf_sha256: validation.pdf_sha256 } : {}
10292
10934
  } : null,
10293
10935
  display: display ? { checked: display.checked, missing: display.missing } : null
10294
10936
  };