import{D as e,M as t}from"./package-Bop5TfAT.js";import{t as n}from"./jszip.min-CoyCHGS6.js";var r=e=>{let t=e.split(` `),n=[],r=0;for(;r5?5:e},l=function(e){s=e>1?e:1,s=s>o?o:s},u=function(){return s},d=function(e){return a(e,s*25.4)},f=function(e){if(e.indexOf(`g`)===-1){let t=[];for(let n of e.split(` `))t.push(parseFloat(n));return t}else{let t=e.split(` `),n=!1,r=!1,i=0,a=[];for(let e of t)if(e===`g`)n=!0;else{if(!e||e.trim().length==0)continue;if(n)i=parseInt(e),r=!0,n=!1;else if(r){for(let t=0;t0&&(e=f(i[`@_DeltaX`])),i[`@_DeltaY`]&&i[`@_DeltaY`].length>0&&(a=f(i[`@_DeltaY`]));let o=i[`#text`];if(o){o+=``,o=v(o),o=o.replace(/ /g,` `);for(let i=0;i0&&e.length>0&&(t+=e[i-1]),i>0&&a.length>0&&(n+=a[i-1]);let s=o.substring(i,i+1),c=r.filter(e=>e.y==d(n));if(c&&c.length)c[0].text+=s;else{let e={x:d(t),y:d(n),text:s};r.push(e)}}}}return r},m=function(e){return e&&e.indexOf(`/`)===0&&(e=e.replace(`/`,``)),e},h=function(e){return!e&&typeof e!=`string`?``:e.substring(e.lastIndexOf(`.`)+1)},g=/&\w+;|&#(\d+);/g,_={"<":`<`,">":`>`,"&":`&`," ":` `,""":`"`,"©":``,"'":`'`},v=function(e){return e??=this.toString(),typeof e==`string`?e.replace(g,function(e,t){var n=_[e];return n??=isNaN(t)?e:String.fromCharCode(t==160?32:t),n}):e},y={楷体:`楷体, KaiTi, Kai, simkai`,kaiti:`楷体, KaiTi, Kai, simkai`,Kai:`楷体, KaiTi, Kai`,simsun:`SimSun, simsun, Songti SC`,宋体:`SimSun, simsun, Songti SC`,黑体:`SimHei, STHeiti, simhei`,仿宋:`FangSong, STFangsong, simfang`,小标宋体:`sSun`,方正小标宋_gbk:`sSun`,仿宋_gb2312:`FangSong, STFangsong, simfang`,楷体_gb2312:`楷体, KaiTi, Kai, simkai`,couriernew:`Courier New`,"courier new":`Courier New`},b=function(e){y[e.toLowerCase()]&&(e=y[e.toLowerCase()]);for(let t of Object.keys(y))if(e.toLowerCase().indexOf(t.toLowerCase())!=-1)return y[t];return e},x=function(e){if(e){let t=e.split(` `);return{x:parseFloat(t[0]),y:parseFloat(t[1]),w:parseFloat(t[2]),h:parseFloat(t[3])}}else return null},S=function(e){return e.split(` `)},C=function(e){if(e){if(e.indexOf(`#`)!==-1)return e=e.replace(/#/g,``),e=e.replace(/ /g,``),e=`#`+e.toString(),e;let t=e.split(` `);return`rgb(${t[0]}, ${t[1]}, ${t[2]})`}else return`rgb(0, 0, 0)`},w=function(e){return{x:d(e.x),y:d(e.y),w:d(e.w),h:d(e.h)}},T=function(e,t,n){let r=n[Object.keys(n)[0]].json[`ofd:Area`],i;if(r){let e=r[`ofd:PhysicalBox`];if(e)i=e;else{let e=r[`ofd:ApplicationBox`];if(e)i=e;else{let e=r[`ofd:ContentBox`];e&&(i=e)}}}else{let e=t[`ofd:CommonData`][`ofd:PageArea`],n=e[`ofd:PhysicalBox`];if(n)i=n;else{let t=e[`ofd:ApplicationBox`];if(t)i=t;else{let t=e[`ofd:ContentBox`];t&&(i=t)}}}let a=i.split(` `),o=((e-10)/parseFloat(a[2])).toFixed(1);return c(o),l(o),i=x(i),i=w(i),i},E=function(e,t){let n=t[Object.keys(t)[0]].json[`ofd:Area`],r;if(n){let e=n[`ofd:PhysicalBox`];if(e)r=e;else{let e=n[`ofd:ApplicationBox`];if(e)r=e;else{let e=n[`ofd:ContentBox`];e&&(r=e)}}}else{let t=e[`ofd:CommonData`][`ofd:PageArea`],n=t[`ofd:PhysicalBox`];if(n)r=n;else{let e=t[`ofd:ApplicationBox`];if(e)r=e;else{let e=t[`ofd:ContentBox`];e&&(r=e)}}}return r=x(r),r=w(r),r},D=function(e,t,n,r,i,a){let o=[],s=e[t[`@_TemplateID`]].json[`ofd:Content`][`ofd:Layer`];o=o.concat(s);for(let e of o)e&&j(n,r,i,a,e,!1)},O=function(e,t,n,r,i,a){let o=Object.keys(t)[0],s=t[o].json[`ofd:Template`];Array.isArray(s)?s.forEach(t=>{t&&D(n,t,e,r,i,a)}):s&&D(n,s,e,r,i,a);let c=t[o]?.json?.[`ofd:Content`]?.[`ofd:Layer`],l=[];l=l.concat(c);for(let t of l)t&&j(e,r,i,a,t,!1);if(t[o].stamp){for(let n of t[o].stamp)if(n.type===`ofd`)A(e,n.obj.pages,n.obj.tpls,!0,n.stamp.stampAnnot,n.obj.fontResObj,n.obj.drawParamResObj,n.obj.multiMediaResObj,n.stamp.sealObj.SES_Signature,n.stamp.signedInfo);else if(n.type===`png`){let t=w(n.obj.boundary),r=Array.isArray(n.stamp.stampAnnot)?n.stamp.stampAnnot[0].pfIndex:n.stamp.stampAnnot.pfIndex,i=P(e.style.width,e.style.height,n.obj.img,t,n.obj.clip,!0,n.stamp.sealObj.SES_Signature,n.stamp.signedInfo,r);e.appendChild(i)}}if(t[o].annotation)for(let n of t[o].annotation)k(e,n,r,i,a)},k=function(e,t,n,r,i){let a=document.createElement(`div`);a.setAttribute(`style`,`overflow: hidden;z-index:${t.pfIndex};position:relative;`);let o=t.appearance?.[`@_Boundary`];if(o){let e=w(x(o));a.setAttribute(`style`,`overflow: hidden;z-index:${t.pfIndex};position:absolute; left: ${e.x}px; top: ${e.y}px; width: ${e.w}px; height: ${e.h}px`)}let s=t.appearance;j(a,n,r,i,s,!1),e.appendChild(a)},A=function(e,t,n,r,i,a,o,s,c,l){for(let u of t){let t=Object.keys(u)[0],d={x:0,y:0,w:0,h:0};r&&i&&(d=i.boundary);let f=w(d),p=document.createElement(`div`);p.setAttribute(`name`,`seal_img_div`),p.setAttribute(`style`,`cursor: pointer; position:relative; left: ${f.x}px; top: ${f.y}px; width: ${f.w}px; height: ${f.h}px`),p.setAttribute(`data-ses-signature`,`${JSON.stringify(c)}`),p.setAttribute(`data-signed-info`,`${JSON.stringify(l)}`);let m=u[t].json[`ofd:Template`];if(m){let e=n[m[`@_TemplateID`]].json[`ofd:Content`][`ofd:Layer`],t=[];t=t.concat(e);for(let e of t)e&&j(p,a,o,s,e,r)}let h=u[t].json[`ofd:Content`][`ofd:Layer`],g=[];g=g.concat(h);for(let e of g)e&&j(p,a,o,s,e,r);e.appendChild(p)}},j=function(e,t,n,r,i,a){let o=null,s=null,c=d(.353),l=i?.[`@_DrawParam`];l&&Object.keys(n).length>0&&n[l]&&(n[l].relative&&(l=n[l].relative,n[l].FillColor&&(o=C(n[l].FillColor)),n[l].StrokeColor&&(s=C(n[l].StrokeColor)),n[l].LineWidth&&(c=d(n[l].LineWidth))),n[l].FillColor&&(o=C(n[l].FillColor)),n[l].StrokeColor&&(s=C(n[l].StrokeColor)),n[l].LineWidth&&(c=d(n[l].LineWidth)));let u=i?.[`ofd:ImageObject`],f=[];f=f.concat(u);for(let t of f)if(t){let n=M(e.style.width,e.style.height,r,t);e.appendChild(n)}let p=i?.[`ofd:PathObject`],m=[];m=m.concat(p);for(let t of m)if(t){let r=I(n,t,o,s,c,a);e.appendChild(r)}let h=i?.[`ofd:TextObject`],g=[];g=g.concat(h);for(let n of g)if(n){let r=F(t,n,o,s);e.appendChild(r)}},M=function(e,t,n,r){let i=x(r[`@_Boundary`]);i=w(i);let a=r[`@_ResourceID`];if(n[a].format===`gbig2`){let e=n[a].img,t=n[a].width,o=n[a].height;return N(e,t,o,i,r.pfIndex)}else return P(e,t,n[a].img,i,!1,!1,null,null,r.pfIndex)},N=function(e,t,n,r,i){let a=new Uint8ClampedArray(4*t*n);for(var o=0;od?d:r.w,m=r.h>f?f:r.h,h=``;return i&&(i=w(i),h=`clip: rect(${i.y}px, ${i.w+i.x}px, ${i.h+i.y}px, ${i.x}px)`),l.setAttribute(`style`,`cursor: pointer; overflow: hidden; position: absolute; left: ${h?r.x:r.x<0?0:r.x}px; top: ${h?r.y:r.y<0?0:r.y}px; width: ${p}px; height: ${m}px; ${h};z-index: ${c}`),l},F=function(e,t,n,r){let i=1,a=x(t[`@_Boundary`]);a=w(a);let o=t[`@_CTM`],s=t[`@_HScale`],c=t[`@_Font`],l=t[`@_Weight`],u=d(parseFloat(t[`@_Size`])),f=[];f=f.concat(t[`ofd:TextCode`]);let m=p(f),h=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);h.setAttribute(`version`,`1.1`);let g=t[`ofd:FillColor`];if(g){n=C(g[`@_Value`]);let e=g[`@_Alpha`];e&&(i=e>1?e/255:e)}for(let t of m)if(t&&!isNaN(t.x)){let a=document.createElementNS(`http://www.w3.org/2000/svg`,`text`);if(a.setAttribute(`x`,t.x),a.setAttribute(`y`,t.y),a.innerHTML=t.text,o){let e=S(o);a.setAttribute(`transform`,`matrix(${e[0]} ${e[1]} ${e[2]} ${e[3]} ${d(e[4])} ${d(e[5])})`)}s&&a.setAttribute(`transform`,`matrix(${s}, 0, 0, 1, ${(1-s)*t.x}, 0)`),a.setAttribute(`fill`,r),a.setAttribute(`fill`,n),a.setAttribute(`fill-opacity`,i),a.setAttribute(`style`,`font-weight: ${l};font-size:${u}px;font-family: ${b(e[c])};`),h.appendChild(a)}let _=a.w,v=a.h,y=a.x,T=a.y;return h.setAttribute(`style`,`overflow:visible;position:absolute;width:${_}px;height:${v}px;left:${y}px;top:${T}px;z-index:${t.pfIndex}`),h},I=function(e,t,n,a,o,s){let c=x(t[`@_Boundary`]);c=w(c);let l=t[`@_LineWidth`],u=t[`ofd:AbbreviatedData`],f=i(r(u)),p=t[`@_CTM`],m=document.createElementNS(`http://www.w3.org/2000/svg`,`svg`);m.setAttribute(`version`,`1.1`);let h=document.createElementNS(`http://www.w3.org/2000/svg`,`path`);l&&(o=d(l));let g=t[`@_DrawParam`];if(g&&(l=e[g].LineWidth,l&&(o=d(l))),p){let e=S(p);h.setAttribute(`transform`,`matrix(${e[0]} ${e[1]} ${e[2]} ${e[3]} ${d(e[4])} ${d(e[5])})`)}let _=``,v=t[`ofd:StrokeColor`];v&&(a=C(v[`@_Value`]));let y=`fill: none;`,b=t[`ofd:FillColor`];b&&(n=C(b[`@_Value`])),o>0&&!a&&(a=n,a||=`rgb(0, 0, 0)`),_=`stroke:${a};stroke-width:${o}px;`,t[`@_Stroke`]==`false`&&(_=``),t[`@_Fill`]!=`false`&&(y=`fill:${s?`none`:n||`none`};`),h.setAttribute(`style`,`${_};${y}`);let T=``;for(let e of f)e.type===`M`?T+=`M${e.x} ${e.y} `:e.type===`L`?T+=`L${e.x} ${e.y} `:e.type===`B`?T+=`C${e.x1} ${e.y1} ${e.x2} ${e.y2} ${e.x3} ${e.y3} `:e.type===`C`&&(T+=`Z`);h.setAttribute(`d`,T),m.appendChild(h);let E=s?c.w:Math.ceil(c.w),D=s?c.h:Math.ceil(c.h),O=c.x,k=c.y;return m.setAttribute(`style`,`overflow:visible;position:absolute;width:${E}px;height:${D}px;left:${O}px;top:${k}px;z-index:${t.pfIndex}`),m};Array.prototype.pipeline=async function(e){if(this===null||this===void 0)throw TypeError(`Array.prototype.pipeline called on null or undefined`);if(typeof e!=`function`)throw TypeError(e+` is not a function`);var t,n,r=this.length>>>0;for(t=0;r>t;++t)n=await e(n,this[t],t,this);return n};var L=function(...e){return e.pipeline((e,t)=>t.call(this,e))},R=e((e=>{var t=`[:A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*`,n=RegExp(`^[:A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD][:A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*$`);e.isExist=function(e){return e!==void 0},e.isEmptyObject=function(e){return Object.keys(e).length===0},e.merge=function(e,t,n){if(t){let r=Object.keys(t),i=r.length;for(let a=0;a{var t=R(),n=function(e,r){let i={};if((!e.child||t.isEmptyObject(e.child))&&(!e.attrsMap||t.isEmptyObject(e.attrsMap)))return t.isExist(e.val)?e.val:``;t.isExist(e.val)&&(typeof e.val==`string`&&(e.val===``||e.val===r.cdataPositionChar)||(r.arrayMode===`strict`?i[r.textNodeName]=[e.val]:i[r.textNodeName]=e.val)),t.merge(i,e.attrsMap,r.arrayMode);let a=Object.keys(e.child);for(let t=0;t1)for(var s in i[o]=[],e.child[o])global.xmlParseFlag=global.xmlParseFlag+1,i[o].push(n(e.child[o][s],r));else if(r.arrayMode===!0){global.xmlParseFlag=global.xmlParseFlag+1;let t=n(e.child[o][0],r);typeof t==`object`?i[o]=[t]:i[o]=t}else r.arrayMode===`strict`?(global.xmlParseFlag=global.xmlParseFlag+1,i[o]=[n(e.child[o][0],r)]):(global.xmlParseFlag=global.xmlParseFlag+1,i[o]=n(e.child[o][0],r))}return i};e.convertToJson=n})),B=e(((e,t)=>{t.exports=function(e,t,n){this.tagname=e,this.parent=t,this.child={},this.attrsMap={},this.val=n,this.addChild=function(e){Array.isArray(this.child[e.tagname])?this.child[e.tagname].push(e):this.child[e.tagname]=[e]}}})),V=e((e=>{var t=R(),n=R().buildOptions,r=B();`<((!\\[CDATA\\[([\\s\\S]*?)(]]>))|((NAME:)?(NAME))([^>]*)>|((\\/)(NAME)\\s*>))([^<]*)`.replace(/NAME/g,t.nameRegexp),!Number.parseInt&&window.parseInt&&(Number.parseInt=window.parseInt),!Number.parseFloat&&window.parseFloat&&(Number.parseFloat=window.parseFloat);var i={attributeNamePrefix:`@_`,attrNodeName:!1,textNodeName:`#text`,ignoreAttributes:!0,ignoreNameSpace:!1,allowBooleanAttributes:!1,parseNodeValue:!0,parseAttributeValue:!1,arrayMode:!1,trimValues:!0,cdataTagName:!1,cdataPositionChar:`\\c`,tagValueProcessor:function(e,t){return e},attrValueProcessor:function(e,t){return e},stopNodes:[]};e.defaultOptions=i;var a=[`attributeNamePrefix`,`attrNodeName`,`textNodeName`,`ignoreAttributes`,`ignoreNameSpace`,`allowBooleanAttributes`,`parseNodeValue`,`parseAttributeValue`,`arrayMode`,`trimValues`,`cdataTagName`,`cdataPositionChar`,`tagValueProcessor`,`attrValueProcessor`,`parseTrueNumberOnly`,`stopNodes`];e.props=a;function o(e,t,n){return t&&=(n.trimValues&&(t=t.trim()),t=n.tagValueProcessor(t,e),c(t,n.parseNodeValue,n.parseTrueNumberOnly)),t}function s(e,t){if(t.ignoreNameSpace){let t=e.split(`:`),n=e.charAt(0)===`/`?`/`:``;if(t[0]===`xmlns`)return``;t.length===2&&(e=n+t[1])}return e}function c(e,n,r){if(n&&typeof e==`string`){let t;return e.trim()===``||isNaN(e)?t=e===`true`?!0:e===`false`?!1:e:(e.indexOf(`0x`)===-1?e.indexOf(`.`)===-1?t=Number.parseInt(e,10):(t=Number.parseFloat(e),e=e.replace(/\.?0+$/,``)):t=Number.parseInt(e,16),r&&(t=String(t)===e?t:e)),t}else if(t.isExist(e))return e;else return``}var l=RegExp(`([^\\s=]+)\\s*(=\\s*(['"])(.*?)\\3)?`,`g`);function u(e,n){if(!n.ignoreAttributes&&typeof e==`string`){e=e.replace(/\r?\n/g,` `);let r=t.getAllMatches(e,l),i=r.length,a={};for(let e=0;e`,n,`Closing Tag is not closed.`),i=e.substring(n+2,r).trim();if(s.ignoreNameSpace){let e=i.indexOf(`:`);e!==-1&&(i=i.substr(e+1))}l&&(l.val?l.val=t.getValue(l.val)+``+o(i,d,s):l.val=o(i,d,s)),s.stopNodes.length&&s.stopNodes.includes(l.tagname)&&(l.child=[],l.attrsMap??={},l.val=e.substr(l.startIndex+1,n-l.startIndex-1)),l=l.parent,d=``,n=r}else if(e[n+1]===`?`)n=p(e,`?>`,n,`Pi Tag is not closed.`);else if(e.substr(n+1,3)===`!--`)n=p(e,`-->`,n,`Comment is not closed.`);else if(e.substr(n+1,2)===`!D`){let t=p(e,`>`,n,`DOCTYPE is not closed.`);n=e.substring(n,t).indexOf(`[`)>=0?e.indexOf(`]>`,n)+1:t}else if(e.substr(n+1,2)===`![`){let i=p(e,`]]>`,n,`CDATA is not closed.`)-2,a=e.substring(n+9,i);if(d&&=(l.val=t.getValue(l.val)+``+o(l.tagname,d,s),``),s.cdataTagName){let e=new r(s.cdataTagName,l,a);l.addChild(e),l.val=t.getValue(l.val)+s.cdataPositionChar,a&&(e.val=a)}else l.val=(l.val||``)+(a||``);n=i+2}else{let i=f(e,n+1),a=i.data,c=i.index,p=a.indexOf(` `),m=a;if(p!==-1&&(m=a.substr(0,p).replace(/\s\s*$/,``),a=a.substr(p+1)),s.ignoreNameSpace){let e=m.indexOf(`:`);e!==-1&&(m=m.substr(e+1))}if(l&&d&&l.tagname!==`!xml`&&(l.val=t.getValue(l.val)+``+o(l.tagname,d,s)),a.length>0&&a.lastIndexOf(`/`)===a.length-1){m[m.length-1]===`/`?(m=m.substr(0,m.length-1),a=m):a=a.substr(0,a.length-1);let e=new r(m,l,``);m!==a&&(e.attrsMap=u(a,s)),l.addChild(e)}else{let e=new r(m,l);s.stopNodes.length&&s.stopNodes.includes(e.tagname)&&(e.startIndex=c),m!==a&&(e.attrsMap=u(a,s)),l.addChild(e),l=e}d=``,n=c}else d+=e[n];return c};function f(e,t){let n,r=``;for(let i=t;i`)return{data:r,index:i};else t===` `&&(t=` `);r+=t}}function p(e,t,n,r){let i=e.indexOf(t,n);if(i===-1)throw Error(r);return i+t.length-1}e.getTraversalObj=d})),H=e((e=>{var t=R(),n={allowBooleanAttributes:!1},r=[`allowBooleanAttributes`];e.validate=function(e,o){o=t.buildOptions(o,n,r);let s=[],l=!1,d=!1;e[0]===``&&(e=e.substr(1));for(let t=0;t`&&e[t]!==` `&&e[t]!==` `&&e[t]!==` `&&e[t]!==`\r`;t++)r+=e[t];if(r=r.trim(),r[r.length-1]===`/`&&(r=r.substring(0,r.length-1),t--),!h(r)){let n;return n=r.trim().length===0?`There is an unnecessary space between tag name and backward slash '0)return p(`InvalidTag`,`Closing tag '`+r+`' can't have attributes or invalid starting.`,g(e,t));{let n=s.pop();if(r!==n)return p(`InvalidTag`,`Closing tag '`+n+`' is expected inplace of '`+r+`'.`,g(e,t));s.length==0&&(d=!0)}}else{let n=u(m,o);if(n!==!0)return p(n.err.code,n.err.msg,g(e,t-m.length+n.err.line));if(d===!0)return p(`InvalidXml`,`Multiple possible root nodes found.`,g(e,t));s.push(r),l=!0}for(t++;t0?p(`InvalidXml`,`Invalid '`+JSON.stringify(s,null,4).replace(/\r?\n/g,``)+`' found.`,1):!0:p(`InvalidXml`,`Start tag expected.`,1)};function i(e,t){for(var n=t;t5&&r===`xml`)return p(`InvalidXml`,`XML declaration allowed only at the start of the document.`,g(e,t));if(e[t]==`?`&&e[t+1]==`>`){t++;break}else continue}return t}function a(e,t){if(e.length>t+5&&e[t+1]===`-`&&e[t+2]===`-`){for(t+=3;t`){t+=2;break}}else if(e.length>t+8&&e[t+1]===`D`&&e[t+2]===`O`&&e[t+3]===`C`&&e[t+4]===`T`&&e[t+5]===`Y`&&e[t+6]===`P`&&e[t+7]===`E`){let n=1;for(t+=8;t`&&(n--,n===0))break}else if(e.length>t+9&&e[t+1]===`[`&&e[t+2]===`C`&&e[t+3]===`D`&&e[t+4]===`A`&&e[t+5]===`T`&&e[t+6]===`A`&&e[t+7]===`[`){for(t+=8;t`){t+=2;break}}return t}var o=`"`,s=`'`;function c(e,t){let n=``,r=``,i=!1;for(;t`&&r===``){i=!0;break}n+=e[t]}return r===``?{value:n,index:t,tagClosed:i}:!1}var l=RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,`g`);function u(e,n){let r=t.getAllMatches(e,l),i={};for(let t=0;t{var t=function(e){return String.fromCharCode(e)},n={nilChar:t(176),missingChar:t(201),nilPremitive:t(175),missingPremitive:t(200),emptyChar:t(178),emptyValue:t(177),boundryChar:t(179),objStart:t(198),arrStart:t(204),arrayEnd:t(185)},r=[n.nilChar,n.nilPremitive,n.missingChar,n.missingPremitive,n.boundryChar,n.emptyChar,n.emptyValue,n.arrayEnd,n.objStart,n.arrStart],i=function(e,t,r){if(typeof t==`string`)return e&&e[0]&&e[0].val!==void 0?a(e[0].val,t):a(e,t);{let s=c(e);if(s===!0){let s=``;if(Array.isArray(t)){s+=n.arrStart;let c=t[0],l=e.length;if(typeof c==`string`)for(let t=0;t{var t=R(),n=R().buildOptions,r=V(),i=function(e,t){return t=n(t,r.defaultOptions,r.props),t.indentBy=t.indentBy||``,a(e,t,0)},a=function(e,n,r){let i=`{`,s=Object.keys(e.child);for(let t=0;t1){for(var l in i+=`"`+c+`" : [ `,e.child[c])i+=a(e.child[c][l],n)+` , `;i=i.substr(0,i.length-1)+` ] `}else i+=`"`+c+`" : `+a(e.child[c][0],n)+` ,`}return t.merge(i,e.attrsMap),t.isEmptyObject(i)?t.isExist(e.val)?e.val:``:(t.isExist(e.val)&&(typeof e.val==`string`&&(e.val===``||e.val===n.cdataPositionChar)||(i+=`"`+n.textNodeName+`" : `+o(e.val))),i[i.length-1]===`,`&&(i=i.substr(0,i.length-2)),i+`}`)};function o(e){return e===!0||e===!1||!isNaN(e)?e:`"`+e+`"`}e.convertToJsonString=i})),G=e(((e,t)=>{var n=R().buildOptions,r={attributeNamePrefix:`@_`,attrNodeName:!1,textNodeName:`#text`,ignoreAttributes:!0,cdataTagName:!1,cdataPositionChar:`\\c`,format:!1,indentBy:` `,supressEmptyNode:!1,tagValueProcessor:function(e){return e},attrValueProcessor:function(e){return e}},i=[`attributeNamePrefix`,`attrNodeName`,`textNodeName`,`ignoreAttributes`,`cdataTagName`,`cdataPositionChar`,`format`,`indentBy`,`supressEmptyNode`,`tagValueProcessor`,`attrValueProcessor`];function a(e){this.options=n(e,r,i),this.options.ignoreAttributes||this.options.attrNodeName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=p),this.options.cdataTagName?this.isCDATA=m:this.isCDATA=function(){return!1},this.replaceCDATAstr=o,this.replaceCDATAarr=s,this.options.format?(this.indentate=f,this.tagEndChar=`> `,this.newLine=` `):(this.indentate=function(){return``},this.tagEndChar=`>`,this.newLine=``),this.options.supressEmptyNode?(this.buildTextNode=d,this.buildObjNode=l):(this.buildTextNode=u,this.buildObjNode=c),this.buildTextValNode=u,this.buildObjectNode=c}a.prototype.parse=function(e){return this.j2x(e,0).val},a.prototype.j2x=function(e,t){let n=``,r=``,i=Object.keys(e),a=i.length;for(let o=0;o`);return e+this.newLine}function c(e,t,n,r){return n&&!e.includes(`<`)?this.indentate(r)+`<`+t+n+`>`+e+``+this.options.tagValueProcessor(e)+`{var t=z(),n=V(),r=V(),i=R().buildOptions,a=H();e.parse=function(e,o,s){if(s){s===!0&&(s={});let t=a.validate(e,s);if(t!==!0)throw Error(t.err.msg)}o=i(o,r.defaultOptions,r.props);let c=n.getTraversalObj(e,o);return t.convertToJson(c,o)},e.convertTonimn=U().convert2nimn,e.getTraversalObj=n.getTraversalObj,e.convertToJson=t.convertToJson,e.convertToJsonString=W().convertToJsonString,e.validate=a.validate,e.j2xParser=G(),e.parseToNimn=function(t,n,r){return e.convertTonimn(e.getTraversalObj(t,r),n,r)}})),q=t(n(),1),ee=t(K(),1);globalThis._pdfjsCompatibilityChecked||(globalThis._pdfjsCompatibilityChecked=!0);var te={ERRORS:0,WARNINGS:1,INFOS:5},ne=te.WARNINGS;function J(e){ne>=te.INFOS&&console.log(`Info: ${e}`)}function re(e){throw Error(e)}function ie(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!1}),n}var ae=(function(){function e(t){this.constructor===e&&re(`Cannot initialize BaseException.`),this.message=t,this.name=this.constructor.name}return e.prototype=Error(),e.constructor=e,e})();(function(){let e=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=`;return function(t,n,r=!1){if(!r&&URL.createObjectURL){let e=new Blob([t],{type:n});return URL.createObjectURL(e)}let i=`data:${n};base64,`;for(let n=0,r=t.length;n>2,l=(a&3)<<4|o>>4,u=n+1>6:64,d=n+2>24}function X(e,t){return e[t]<<8|e[t+1]}function Z(e,t){return(e[t]<<24|e[t+1]<<16|e[t+2]<<8|e[t+3])>>>0}var se=[{qe:22017,nmps:1,nlps:1,switchFlag:1},{qe:13313,nmps:2,nlps:6,switchFlag:0},{qe:6145,nmps:3,nlps:9,switchFlag:0},{qe:2753,nmps:4,nlps:12,switchFlag:0},{qe:1313,nmps:5,nlps:29,switchFlag:0},{qe:545,nmps:38,nlps:33,switchFlag:0},{qe:22017,nmps:7,nlps:6,switchFlag:1},{qe:21505,nmps:8,nlps:14,switchFlag:0},{qe:18433,nmps:9,nlps:14,switchFlag:0},{qe:14337,nmps:10,nlps:14,switchFlag:0},{qe:12289,nmps:11,nlps:17,switchFlag:0},{qe:9217,nmps:12,nlps:18,switchFlag:0},{qe:7169,nmps:13,nlps:20,switchFlag:0},{qe:5633,nmps:29,nlps:21,switchFlag:0},{qe:22017,nmps:15,nlps:14,switchFlag:1},{qe:21505,nmps:16,nlps:14,switchFlag:0},{qe:20737,nmps:17,nlps:15,switchFlag:0},{qe:18433,nmps:18,nlps:16,switchFlag:0},{qe:14337,nmps:19,nlps:17,switchFlag:0},{qe:13313,nmps:20,nlps:18,switchFlag:0},{qe:12289,nmps:21,nlps:19,switchFlag:0},{qe:10241,nmps:22,nlps:19,switchFlag:0},{qe:9217,nmps:23,nlps:20,switchFlag:0},{qe:8705,nmps:24,nlps:21,switchFlag:0},{qe:7169,nmps:25,nlps:22,switchFlag:0},{qe:6145,nmps:26,nlps:23,switchFlag:0},{qe:5633,nmps:27,nlps:24,switchFlag:0},{qe:5121,nmps:28,nlps:25,switchFlag:0},{qe:4609,nmps:29,nlps:26,switchFlag:0},{qe:4353,nmps:30,nlps:27,switchFlag:0},{qe:2753,nmps:31,nlps:28,switchFlag:0},{qe:2497,nmps:32,nlps:29,switchFlag:0},{qe:2209,nmps:33,nlps:30,switchFlag:0},{qe:1313,nmps:34,nlps:31,switchFlag:0},{qe:1089,nmps:35,nlps:32,switchFlag:0},{qe:673,nmps:36,nlps:33,switchFlag:0},{qe:545,nmps:37,nlps:34,switchFlag:0},{qe:321,nmps:38,nlps:35,switchFlag:0},{qe:273,nmps:39,nlps:36,switchFlag:0},{qe:133,nmps:40,nlps:37,switchFlag:0},{qe:73,nmps:41,nlps:38,switchFlag:0},{qe:37,nmps:42,nlps:39,switchFlag:0},{qe:21,nmps:43,nlps:40,switchFlag:0},{qe:9,nmps:44,nlps:41,switchFlag:0},{qe:5,nmps:45,nlps:42,switchFlag:0},{qe:1,nmps:45,nlps:43,switchFlag:0},{qe:22017,nmps:46,nlps:46,switchFlag:0}],ce=class{constructor(e,t,n){this.data=e,this.bp=t,this.dataEnd=n,this.chigh=e[t],this.clow=0,this.byteIn(),this.chigh=this.chigh<<7&65535|this.clow>>9&127,this.clow=this.clow<<7&65535,this.ct-=7,this.a=32768}byteIn(){let e=this.data,t=this.bp;e[t]===255?e[t+1]>143?(this.clow+=65280,this.ct=8):(t++,this.clow+=e[t]<<9,this.ct=7,this.bp=t):(t++,this.clow+=t65535&&(this.chigh+=this.clow>>16,this.clow&=65535)}readBit(e,t){let n=e[t]>>1,r=e[t]&1,i=se[n],a=i.qe,o,s=this.a-a;if(this.chigh>15&1,this.clow=this.clow<<1&65535,this.ct--;while(!(s&32768));return this.a=s,e[t]=n<<1|r,o}},le=(function(){let e=[[-1,-1],[-1,-1],[7,8],[7,7],[6,6],[6,6],[6,5],[6,5],[4,0],[4,0],[4,0],[4,0],[4,0],[4,0],[4,0],[4,0],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[3,3],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2],[1,2]],t=[[-1,-1],[12,-2],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[11,1792],[11,1792],[12,1984],[12,2048],[12,2112],[12,2176],[12,2240],[12,2304],[11,1856],[11,1856],[11,1920],[11,1920],[12,2368],[12,2432],[12,2496],[12,2560]],n=[[-1,-1],[-1,-1],[-1,-1],[-1,-1],[8,29],[8,29],[8,30],[8,30],[8,45],[8,45],[8,46],[8,46],[7,22],[7,22],[7,22],[7,22],[7,23],[7,23],[7,23],[7,23],[8,47],[8,47],[8,48],[8,48],[6,13],[6,13],[6,13],[6,13],[6,13],[6,13],[6,13],[6,13],[7,20],[7,20],[7,20],[7,20],[8,33],[8,33],[8,34],[8,34],[8,35],[8,35],[8,36],[8,36],[8,37],[8,37],[8,38],[8,38],[7,19],[7,19],[7,19],[7,19],[8,31],[8,31],[8,32],[8,32],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,1],[6,12],[6,12],[6,12],[6,12],[6,12],[6,12],[6,12],[6,12],[8,53],[8,53],[8,54],[8,54],[7,26],[7,26],[7,26],[7,26],[8,39],[8,39],[8,40],[8,40],[8,41],[8,41],[8,42],[8,42],[8,43],[8,43],[8,44],[8,44],[7,21],[7,21],[7,21],[7,21],[7,28],[7,28],[7,28],[7,28],[8,61],[8,61],[8,62],[8,62],[8,63],[8,63],[8,0],[8,0],[8,320],[8,320],[8,384],[8,384],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,10],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[5,11],[7,27],[7,27],[7,27],[7,27],[8,59],[8,59],[8,60],[8,60],[9,1472],[9,1536],[9,1600],[9,1728],[7,18],[7,18],[7,18],[7,18],[7,24],[7,24],[7,24],[7,24],[8,49],[8,49],[8,50],[8,50],[8,51],[8,51],[8,52],[8,52],[7,25],[7,25],[7,25],[7,25],[8,55],[8,55],[8,56],[8,56],[8,57],[8,57],[8,58],[8,58],[6,192],[6,192],[6,192],[6,192],[6,192],[6,192],[6,192],[6,192],[6,1664],[6,1664],[6,1664],[6,1664],[6,1664],[6,1664],[6,1664],[6,1664],[8,448],[8,448],[8,512],[8,512],[9,704],[9,768],[8,640],[8,640],[8,576],[8,576],[9,832],[9,896],[9,960],[9,1024],[9,1088],[9,1152],[9,1216],[9,1280],[9,1344],[9,1408],[7,256],[7,256],[7,256],[7,256],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,2],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[4,3],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,128],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,8],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[5,9],[6,16],[6,16],[6,16],[6,16],[6,16],[6,16],[6,16],[6,16],[6,17],[6,17],[6,17],[6,17],[6,17],[6,17],[6,17],[6,17],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,4],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[4,5],[6,14],[6,14],[6,14],[6,14],[6,14],[6,14],[6,14],[6,14],[6,15],[6,15],[6,15],[6,15],[6,15],[6,15],[6,15],[6,15],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[5,64],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,6],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7],[4,7]],r=[[-1,-1],[-1,-1],[12,-2],[12,-2],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[-1,-1],[11,1792],[11,1792],[11,1792],[11,1792],[12,1984],[12,1984],[12,2048],[12,2048],[12,2112],[12,2112],[12,2176],[12,2176],[12,2240],[12,2240],[12,2304],[12,2304],[11,1856],[11,1856],[11,1856],[11,1856],[11,1920],[11,1920],[11,1920],[11,1920],[12,2368],[12,2368],[12,2432],[12,2432],[12,2496],[12,2496],[12,2560],[12,2560],[10,18],[10,18],[10,18],[10,18],[10,18],[10,18],[10,18],[10,18],[12,52],[12,52],[13,640],[13,704],[13,768],[13,832],[12,55],[12,55],[12,56],[12,56],[13,1280],[13,1344],[13,1408],[13,1472],[12,59],[12,59],[12,60],[12,60],[13,1536],[13,1600],[11,24],[11,24],[11,24],[11,24],[11,25],[11,25],[11,25],[11,25],[13,1664],[13,1728],[12,320],[12,320],[12,384],[12,384],[12,448],[12,448],[13,512],[13,576],[12,53],[12,53],[12,54],[12,54],[13,896],[13,960],[13,1024],[13,1088],[13,1152],[13,1216],[10,64],[10,64],[10,64],[10,64],[10,64],[10,64],[10,64],[10,64]],i=[[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[8,13],[11,23],[11,23],[12,50],[12,51],[12,44],[12,45],[12,46],[12,47],[12,57],[12,58],[12,61],[12,256],[10,16],[10,16],[10,16],[10,16],[10,17],[10,17],[10,17],[10,17],[12,48],[12,49],[12,62],[12,63],[12,30],[12,31],[12,32],[12,33],[12,40],[12,41],[11,22],[11,22],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[8,14],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,10],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[7,11],[9,15],[9,15],[9,15],[9,15],[9,15],[9,15],[9,15],[9,15],[12,128],[12,192],[12,26],[12,27],[12,28],[12,29],[11,19],[11,19],[11,20],[11,20],[12,34],[12,35],[12,36],[12,37],[12,38],[12,39],[11,21],[11,21],[12,42],[12,43],[10,0],[10,0],[10,0],[10,0],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12],[7,12]],a=[[-1,-1],[-1,-1],[-1,-1],[-1,-1],[6,9],[6,8],[5,7],[5,7],[4,6],[4,6],[4,6],[4,6],[4,5],[4,5],[4,5],[4,5],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,1],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[3,4],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,3],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2],[2,2]];function o(e,t={}){if(!e||typeof e.next!=`function`)throw Error(`CCITTFaxDecoder - invalid "source" parameter.`);this.source=e,this.eof=!1,this.encoding=t.K||0,this.eoline=t.EndOfLine||!1,this.byteAlign=t.EncodedByteAlign||!1,this.columns=t.Columns||1728,this.rows=t.Rows||0;let n=t.EndOfBlock;n??=!0,this.eoblock=n,this.black=t.BlackIs1||!1,this.codingLine=new Uint32Array(this.columns+1),this.refLine=new Uint32Array(this.columns+2),this.codingLine[0]=this.columns,this.codingPos=0,this.row=0,this.nextLine2D=this.encoding<0,this.inputBits=0,this.inputBuf=0,this.outputBits=0,this.rowsDone=!1;let r;for(;(r=this._lookBits(12))===0;)this._eatBits(1);r===1&&this._eatBits(12),this.encoding>0&&(this.nextLine2D=!this._lookBits(1),this._eatBits(1))}return o.prototype={readNextChar(){if(this.eof)return-1;let e=this.refLine,t=this.codingLine,n=this.columns,r,i,a,o;if(this.outputBits===0){if(this.rowsDone&&(this.eof=!0),this.eof)return-1;this.err=!1;let a,s,c;if(this.nextLine2D){for(o=0;t[o]=64);do s+=c=this._getWhiteCode();while(c>=64)}else{do a+=c=this._getWhiteCode();while(c>=64);do s+=c=this._getBlackCode();while(c>=64)}for(this._addPixels(t[this.codingPos]+a,i),t[this.codingPos]0?--r:++r;e[r]<=t[this.codingPos]&&e[r]0?--r:++r;e[r]<=t[this.codingPos]&&e[r]0?--r:++r;e[r]<=t[this.codingPos]&&e[r]=64);else do a+=c=this._getWhiteCode();while(c>=64);this._addPixels(t[this.codingPos]+a,i),i^=1}let l=!1;if(this.byteAlign&&(this.inputBits&=-8),!this.eoblock&&this.row===this.rows-1)this.rowsDone=!0;else{if(a=this._lookBits(12),this.eoline)for(;a!==-1&&a!==1;)this._eatBits(1),a=this._lookBits(12);else for(;a===0;)this._eatBits(1),a=this._lookBits(12);a===1?(this._eatBits(12),l=!0):a===-1&&(this.eof=!0)}if(!this.eof&&this.encoding>0&&!this.rowsDone&&(this.nextLine2D=!this._lookBits(1),this._eatBits(1)),this.eoblock&&l&&this.byteAlign){if(a=this._lookBits(12),a===1){if(this._eatBits(12),this.encoding>0&&(this._lookBits(1),this._eatBits(1)),this.encoding>=0)for(o=0;o<4;++o)a=this._lookBits(12),a!==1&&J(`bad rtc code: `+a),this._eatBits(12),this.encoding>0&&(this._lookBits(1),this._eatBits(1));this.eof=!0}}else if(this.err&&this.eoline){for(;;){if(a=this._lookBits(13),a===-1)return this.eof=!0,-1;if(a>>1==1)break;this._eatBits(1)}this._eatBits(12),this.encoding>0&&(this._eatBits(1),this.nextLine2D=!(a&1))}t[0]>0?this.outputBits=t[this.codingPos=0]:this.outputBits=t[this.codingPos=1],this.row++}let s;if(this.outputBits>=8)s=this.codingPos&1?0:255,this.outputBits-=8,this.outputBits===0&&t[this.codingPos]a?(s<<=a,this.codingPos&1||(s|=255>>8-a),this.outputBits-=a,a=0):(s<<=this.outputBits,this.codingPos&1||(s|=255>>8-this.outputBits),a-=this.outputBits,this.outputBits=0,t[this.codingPos]0&&(s<<=a,a=0));while(a)}return this.black&&(s^=255),s},_addPixels(e,t){let n=this.codingLine,r=this.codingPos;e>n[r]&&(e>this.columns&&(J(`row is wrong length`),this.err=!0,e=this.columns),r&1^t&&++r,n[r]=e),this.codingPos=r},_addPixelsNeg(e,t){let n=this.codingLine,r=this.codingPos;if(e>n[r])e>this.columns&&(J(`row is wrong length`),this.err=!0,e=this.columns),r&1^t&&++r,n[r]=e;else if(e0&&e=i){let t=n[e-i];if(t[0]===r)return this._eatBits(r),[!0,t[1],!0]}}return[!1,0,!1]},_getTwoDimCode(){let t=0,n;if(this.eoblock){if(t=this._lookBits(7),n=e[t],n&&n[0]>0)return this._eatBits(n[0]),n[1]}else{let t=this._findTableCode(1,7,e);if(t[0]&&t[2])return t[1]}return J(`Bad two dim code`),-1},_getWhiteCode(){let e=0,r;if(this.eoblock){if(e=this._lookBits(12),e===-1)return 1;if(r=e>>5?n[e>>3]:t[e],r[0]>0)return this._eatBits(r[0]),r[1]}else{let e=this._findTableCode(1,9,n);if(e[0]||(e=this._findTableCode(11,12,t),e[0]))return e[1]}return J(`bad white code`),this._eatBits(1),1},_getBlackCode(){let e,t;if(this.eoblock){if(e=this._lookBits(13),e===-1)return 1;if(t=e>>7?!(e>>9)&&e>>7?i[(e>>1)-64]:a[e>>7]:r[e],t[0]>0)return this._eatBits(t[0]),t[1]}else{let e=this._findTableCode(2,6,a);if(e[0]||(e=this._findTableCode(7,12,i,64),e[0])||(e=this._findTableCode(10,13,r),e[0]))return e[1]}return J(`bad black code`),this._eatBits(1),1},_lookBits(e){let t;for(;this.inputBits>16-e;this.inputBuf=this.inputBuf<<8|t,this.inputBits+=8}return this.inputBuf>>this.inputBits-e&65535>>16-e},_eatBits(e){(this.inputBits-=e)<0&&(this.inputBits=0)}},o})(),Q=class extends ae{constructor(e){super(`JBIG2 error: ${e}`)}},ue=(function(){function e(){}e.prototype={getContexts(e){return e in this?this[e]:this[e]=new Int8Array(65536)}};function t(e,t,n){this.data=e,this.start=t,this.end=n}t.prototype={get decoder(){var e=new ce(this.data,this.start,this.end);return ie(this,`decoder`,e)},get contextCache(){var t=new e;return ie(this,`contextCache`,t)}};function n(e,t,n){var r=e.getContexts(t),i=1;function a(e){for(var t=0,a=0;a>>0}var o=a(1),s=a(1)?a(1)?a(1)?a(1)?a(1)?a(32)+4436:a(12)+340:a(8)+84:a(6)+20:a(4)+4:a(2);return o===0?s:s>0?-s:null}function r(e,t,n){for(var r=e.getContexts(`IAID`),i=1,a=0;a=D&&R=O)for(V=V<<1&_,S=0;S=0&&B=0&&(H=N[z][B],H&&(V|=H<=e?N<<=1:N=N<<1|C[j][M];for(h=0;h<_;h++)j=D+y[h]-a,M=A+v[h]-i,j<0||j>=x||M<0||M>=b?N<<=1:N=N<<1|r[j][M];k[A]=w.readBit(T,N)}}return C}function f(e,t,i,a,o,s,c,l,f,m,h,g){if(e&&t)throw new Q(`symbol refinement with Huffman is not supported`);var _=[],v=0,y=oe(i.length+a),b=h.decoder,x=h.contextCache;let S,C;for(e&&(S=A(1),C=[],y=Math.max(y,1));_.length1)E=p(e,t,a,v,0,D,1,i.concat(_),y,0,0,1,0,s,f,m,h,0,g);else{var O=r(x,b,y),k=n(x,`IARDX`,b),j=n(x,`IARDY`,b),M=O1&&(a=e?x.readBits(b):n(D,`IAIT`,E));var N=c*O+a,P=e?g.symbolIDTable.decode(x):r(D,E,u),F=t&&(e?x.readBit():n(D,`IARI`,E)),I=l[P],L=I[0].length,R=I.length;if(F){var z=n(D,`IARDW`,E),B=n(D,`IARDH`,E),V=n(D,`IARDX`,E),H=n(D,`IARDY`,E);L+=z,R+=B,I=d(L,R,_,I,(z>>1)+V,(B>>1)+H,!1,v,y)}var U=N-(m&1?0:R-1),W=M-(m&2?L-1:0),G,K,q;if(f){for(G=0;G=0;_--)O=e?I(D,c,l,!0):u(!1,c,l,n,!1,null,T,h),E[_]=O;let k,A,M,N,P,F,L,R,z;for(k=0;k=0;v--)M=E[v][k][A]^M,N|=M<>8,L=f+k*p-A*m>>8,F>=0&&F+S<=r&&L>=0&&L+C<=i)for(_=0;_=i))for(z=g[t],R=P[_],v=0;v=0&&e>5&7,l=[s&31],u=t+6;if(s===7){c=Z(e,u-1)&536870911,u+=3;var d=c+7>>3;for(l[0]=e[u++];--d>0;)l.push(e[u++])}else if(s===5||s===6)throw new Q(`invalid referred-to flags`);n.retainBits=l;let f=4;n.number<=256?f=1:n.number<=65536&&(f=2);var p=[],m,h;for(m=0;m>>24&255,x[3]=g.height>>16&255,x[4]=g.height>>8&255,x[5]=g.height&255,m=u,h=e.length;m>2&3,u.huffmanDWSelector=d>>4&3,u.bitmapSizeSelector=d>>6&1,u.aggregationInstancesSelector=d>>7&1,u.bitmapCodingContextUsed=!!(d&256),u.bitmapCodingContextRetained=!!(d&512),u.template=d>>10&3,u.refinementTemplate=d>>12&1,i+=2,!u.huffman){for(l=u.template===0?4:1,s=[],c=0;c>2&3,f.stripSize=1<>4&3,f.transposed=!!(p&64),f.combinationOperator=p>>7&3,f.defaultPixelValue=p>>9&1,f.dsOffset=p<<17>>27,f.refinementTemplate=p>>15&1,f.huffman){var m=X(r,i);i+=2,f.huffmanFS=m&3,f.huffmanDS=m>>2&3,f.huffmanDT=m>>4&3,f.huffmanRefinementDW=m>>6&3,f.huffmanRefinementDH=m>>8&3,f.huffmanRefinementDX=m>>10&3,f.huffmanRefinementDY=m>>12&3,f.huffmanRefinementSizeSelector=!!(m&16384)}if(f.refinement&&!f.refinementTemplate){for(s=[],c=0;c<2;c++)s.push({x:Y(r,i),y:Y(r,i+1)}),i+=2;f.refinementAt=s}f.numberOfSymbolInstances=Z(r,i),i+=4,o=[f,n.referredTo,r,i,a];break;case 16:let e={},t=r[i++];e.mmr=!!(t&1),e.template=t>>1&3,e.patternWidth=r[i++],e.patternHeight=r[i++],e.maxPatternIndex=Z(r,i),i+=4,o=[e,n.number,r,i,a];break;case 22:case 23:let x={};x.info=v(r,i),i+=y;let S=r[i++];x.mmr=!!(S&1),x.template=S>>1&3,x.enableSkip=!!(S&8),x.combinationOperator=S>>4&7,x.defaultPixelValue=S>>7&1,x.gridWidth=Z(r,i),i+=4,x.gridHeight=Z(r,i),i+=4,x.gridOffsetX=Z(r,i)&4294967295,i+=4,x.gridOffsetY=Z(r,i)&4294967295,i+=4,x.gridVectorX=X(r,i),i+=2,x.gridVectorY=X(r,i),i+=2,o=[x,n.referredTo,r,i,a];break;case 38:case 39:var h={};h.info=v(r,i),i+=y;var g=r[i++];if(h.mmr=!!(g&1),h.template=g>>1&3,h.prediction=!!(g&8),!h.mmr){for(l=h.template===0?4:1,s=[],c=0;c>2&1,_.combinationOperator=b>>3&3,_.requiresBuffer=!!(b&32),_.combinationOperatorOverride=!!(b&64),o=[_];break;case 49:break;case 50:break;case 51:break;case 53:o=[n.number,r,i,a];break;case 62:break;default:throw new Q(`segment type ${n.typeName}(${n.type}) is not implemented`)}var x=`on`+n.typeName;x in t&&t[x].apply(t,o)}function x(e,t){for(var n=0,r=e.length;n>=1}return{imgData:u,width:s,height:c}}function w(){}w.prototype={onPageInformation:function(e){this.currentPageInfo=e;var t=e.width+7>>3,n=new Uint8ClampedArray(t*e.height);if(e.defaultPixelValue)for(var r=0,i=n.length;r>3,o=n.combinationOperatorOverride?e.combinationOperator:n.combinationOperator,s=this.buffer,c=128>>(e.x&7),l=e.y*a+(e.x>>3),u,d,f,p;switch(o){case 0:for(u=0;u>=1,f||(f=128,p++);l+=a}break;case 2:for(u=0;u>=1,f||(f=128,p++);l+=a}break;default:throw new Q(`operator ${o} is not supported`)}},onImmediateGenericRegion:function(e,n,r,i){var a=e.info,o=new t(n,r,i),s=u(e.mmr,a.width,a.height,e.template,e.prediction,null,e.at,o);this.drawBitmap(a,s)},onImmediateLosslessGenericRegion:function(){this.onImmediateGenericRegion.apply(this,arguments)},onSymbolDictionary:function(e,n,r,i,a,o){let s,c;e.huffman&&(s=P(e,r,this.customTables),c=new j(i,a,o));var l=this.symbols;l||(this.symbols=l={});for(var u=[],d=0,p=r.length;d>t&1;if(t<=0)this.children[n]=new E(e);else{let r=this.children[n];r||(this.children[n]=r=new E(null)),r.buildTree(e,t-1)}},decodeNode(e){if(this.isLeaf){if(this.isOOB)return null;let t=e.readBits(this.rangeLength);return this.rangeLow+(this.isLowerRange?-t:t)}let t=this.children[e.readBit()];if(!t)throw new Q(`invalid Huffman data`);return t.decodeNode(e)}};function D(e,t){t||this.assignPrefixCodes(e),this.rootNode=new E(null);for(let t=0,n=e.length;t0&&this.rootNode.buildTree(n,n.prefixLength-1)}}D.prototype={decode(e){return this.rootNode.decodeNode(e)},assignPrefixCodes(e){let t=e.length,n=0;for(let r=0;r>1&7)+1,c=(r>>4&7)+1,l=[],u,d,f=i;do u=o.readBits(s),d=o.readBits(c),l.push(new T([f,u,d,0])),f+=1<=this.end)throw new Q(`end of data while reading bit`);this.currentByte=this.data[this.position++],this.shift=7}let e=this.currentByte>>this.shift&1;return this.shift--,e},readBits(e){let t=0,n;for(n=e-1;n>=0;n--)t|=this.readBit()<=this.end?-1:this.data[this.position++]}};function M(e,t,n){let r=0;for(let i=0,a=t.length;i=32){let n,r,o;switch(t){case 32:if(e===0)throw new Q(`no previous value in symbol ID table`);r=i.readBits(2)+3,n=a[e-1].prefixLength;break;case 33:r=i.readBits(3)+3,n=0;break;case 34:r=i.readBits(7)+11,n=0;break;default:throw new Q(`invalid code length in symbol ID table`)}for(o=0;o>n&1,n--}if(r&&!s)for(let e=0;e<5&&i.readNextChar()!==-1;e++);return a}function L(){}return L.prototype={parseChunks(e){return S(e)},parse(e){let{imgData:t,width:n,height:r}=C(e);return this.width=n,this.height=r,t}},L})(),de=()=>{globalThis.global||(globalThis.global=globalThis),globalThis.xmlParseFlag=0},fe=function(e){return new Promise((t,n)=>{q.default.loadAsync(e).then(function(e){t(e)},function(e){n(e)})})},pe=async function(e){let t=(await $(e,`OFD.xml`)).json[`ofd:OFD`][`ofd:DocBody`],n=[];return n=n.concat(t),[e,n]},me=async function([e,t]){let n=[];for(let r of t)if(r){let t=await he(e,r);t=await ge(t),t=await ve(t),t=await ye(t),t=await be(t),t=await xe(t),n.push(t)}return n},he=async function(e,t){let n=t[`ofd:DocRoot`];n=m(n);let r=n.split(`/`)[0],i=t[`ofd:Signatures`],a=await Ee(e,i,r),o={};for(let e of a)if(e.sealObj&&Object.keys(e.sealObj).length>0){if(e.sealObj.type===`ofd`){let t=await De(e);for(let n of t)e.stampAnnot.boundary=x(e.stampAnnot[`@_Boundary`]),e.stampAnnot.pageRef=e.stampAnnot[`@_PageRef`],o[e.stampAnnot[`@_PageRef`]]||(o[e.stampAnnot[`@_PageRef`]]=[]),o[e.stampAnnot[`@_PageRef`]].push({type:`ofd`,obj:n,stamp:e})}else if(e.sealObj.type===`png`){let t=`data:image/png;base64,`+btoa(String.fromCharCode.apply(null,e.sealObj.ofdArray)),n=[];n=n.concat(e.stampAnnot);for(let r of n)if(r){let n={img:t,pageId:r[`@_PageRef`],boundary:x(r[`@_Boundary`]),clip:x(r[`@_Clip`])};o[r[`@_PageRef`]]||(o[r[`@_PageRef`]]=[]),o[r[`@_PageRef`]].push({type:`png`,obj:n,stamp:e})}}}return[e,r,n,o]},ge=async function([e,t,n,r]){let i=(await $(e,n)).json[`ofd:Document`],a=i[`ofd:Annotations`],o=[],s;return a&&(a.indexOf(`/`)!==-1&&(s=a.substring(0,a.indexOf(`/`))),a.indexOf(t)===-1&&(a=`${t}/${a}`),e.files[a]&&(a=await $(e,a),o=o.concat(a.json[`ofd:Annotations`][`ofd:Page`]))),[e,t,i,r,await _e(s,o,t,e)]},_e=async function(e,t,n,r){let i={};for(let a of t){if(!a)continue;let t=a[`@_PageID`],o=a[`ofd:FileLoc`];if(o=m(o),e&&o.indexOf(e)===-1&&(o=`${e}/${o}`),o.indexOf(n)===-1&&(o=`${n}/${o}`),r.files[o]){let e=await $(r,o),n=[];n=n.concat(e.json[`ofd:PageAnnot`][`ofd:Annot`]),i[t]||(i[t]=[]);for(let e of n){if(!e)continue;let n=e[`@_Type`],r=e[`@_Visible`]?e[`@_Visible`]:!0,a={type:n,appearance:e[`ofd:Appearance`],visible:r};i[t].push(a)}}}return i},ve=async function([e,t,n,r,i]){let a=n[`ofd:CommonData`][`ofd:DocumentRes`],o={},s={},c={};if(a&&(a.indexOf(t)==-1&&(a=`${t}/${a}`),e.files[a])){let n=(await $(e,a)).json[`ofd:Res`];o=await Se(n),s=await Ce(n),c=await we(e,n,t)}return[e,t,n,r,i,o,s,c]},ye=async function([e,t,n,r,i,a,o,s]){let c=n[`ofd:CommonData`][`ofd:PublicRes`];if(c&&(c.indexOf(t)==-1&&(c=`${t}/${c}`),e.files[c])){let n=(await $(e,c)).json[`ofd:Res`],r=await Se(n);a=Object.assign(a,r);let i=await Ce(n);o=Object.assign(o,i);let l=await we(e,n,t);s=Object.assign(s,l)}return[e,t,n,r,i,a,o,s]},be=async function([e,t,n,r,i,a,o,s]){let c=n[`ofd:CommonData`][`ofd:TemplatePage`],l=[];l=l.concat(c);let u={};for(let n of l)if(n){let r=await Te(e,n,t);u[Object.keys(r)[0]]=r[Object.keys(r)[0]]}return[e,t,n,r,i,u,a,o,s]},xe=async function([e,t,n,r,i,a,o,s,c]){let l=n[`ofd:Pages`][`ofd:Page`],u=[];u=u.concat(l);let d=[];for(let n of u)if(n){let a=await Te(e,n,t),o=Object.keys(a)[0],s=r[o];s&&(a[o].stamp=s);let c=i[o];c&&(a[o].annotation=c),d.push(a)}return{doc:t,document:n,pages:d,tpls:a,stampAnnot:r,fontResObj:o,drawParamResObj:s,multiMediaResObj:c}},Se=async function(e){let t=e[`ofd:Fonts`],n={};if(t){let e=[];e=e.concat(t[`ofd:Font`]);for(let t of e)t&&(t[`@_FamilyName`]?n[t[`@_ID`]]=t[`@_FamilyName`]:n[t[`@_ID`]]=t[`@_FontName`])}return n},Ce=async function(e){let t=e[`ofd:DrawParams`],n={};if(t){let e=[];e=e.concat(t[`ofd:DrawParam`]);for(let t of e)t&&(n[t[`@_ID`]]={LineWidth:t[`@_LineWidth`],FillColor:t[`ofd:FillColor`]?t[`ofd:FillColor`][`@_Value`]:``,StrokeColor:t[`ofd:StrokeColor`]?t[`ofd:StrokeColor`][`@_Value`]:``,relative:t[`@_Relative`]})}return n},we=async function(e,t,n){let r=t[`ofd:MultiMedias`],i={};if(r){let a=[];a=a.concat(r[`ofd:MultiMedia`]);for(let r of a)if(r){let a=r[`ofd:MediaFile`];if(t[`@_BaseLoc`]&&a.indexOf(t[`@_BaseLoc`])===-1&&(a=`${t[`@_BaseLoc`]}/${a}`),a.indexOf(n)===-1&&(a=`${n}/${a}`),r[`@_Type`].toLowerCase()===`image`){let t=r[`@_Format`],n=h(a);if(t&&(t.toLowerCase()===`gbig2`||t.toLowerCase()===`jb2`)||n&&(n.toLowerCase()===`jb2`||n.toLowerCase()===`gbig2`)){let t=await Oe(e,a);i[r[`@_ID`]]=t}else{let t=await ke(e,a);i[r[`@_ID`]]={img:t,format:`png`}}}else i[r[`@_ID`]]=a}}return i},Te=async function(e,t,n){let r=t[`@_BaseLoc`];r.indexOf(n)==-1&&(r=`${n}/${r}`);let i=await $(e,r),a={};return a[t[`@_ID`]]={json:i.json[`ofd:Page`],xml:i.xml},a},Ee=async function(e,t,n){return[]},De=function(){return Promise.resolve([])},$=async function(e,t){return new Promise((n,r)=>{e.files[t].async(`string`).then(function(e){de(),n({xml:e,json:ee.parse(e,{attributeNamePrefix:`@_`,ignoreAttributes:!1,parseNodeValue:!1,trimValues:!1})})},function(e){r(e)})})},Oe=async function(e,t){return new Promise((n,r)=>{e.files[t].async(`uint8array`).then(function(e){let t=new ue;n({img:t.parse(e),width:t.width,height:t.height,format:`gbig2`})},function(e){r(e)})})},ke=async function(e,t){return new Promise((n,r)=>{e.files[t].async(`base64`).then(function(e){n(`data:image/png;base64,`+e)},function(e){r(e)})})},Ae=function(e){e.ofd instanceof File||e.ofd instanceof Blob||e.ofd instanceof ArrayBuffer?je(e):e.fail?.(Error(`OFD 预览只接收 File、Blob 或 ArrayBuffer 数据`))},je=function(e){L.call(this,async()=>await fe(e.ofd),pe,me).then(t=>{e.success&&e.success(t)}).catch(t=>{console.log(t),e.fail&&e.fail(t)})},Me=function(e,t){let n=[];if(!t)return n;for(let r of t.pages){let i=T(e,t.document,r),a=Object.keys(r)[0],o=document.createElement(`div`);o.id=a,o.setAttribute(`style`,`margin-bottom: 20px;position: relative;width:${i.w}px;height:${i.h}px;background: white;`),O(o,r,t.tpls,t.fontResObj,t.drawParamResObj,t.multiMediaResObj),n.push(o)}return n},Ne=function(e){let t=[];if(!e)return t;for(let n of e.pages){let r=E(e.document,n),i=Object.keys(n)[0],a=document.createElement(`div`);a.id=i,a.setAttribute(`style`,`margin-bottom: 20px;position: relative;width:${r.w}px;height:${r.h}px;background: white;`),O(a,n,e.tpls,e.fontResObj,e.drawParamResObj,e.multiMediaResObj),t.push(a)}return t},Pe=function(e){return e?.arr,!1},Fe=function(e){l(e)},Ie=function(){return u()};export{T as calPageBox,E as calPageBoxScale,Pe as digestCheck,Ie as getPageScale,Ae as parseOfdDocument,Me as renderOfd,Ne as renderOfdByScale,O as renderPage,Fe as setPageScale};