var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||(e((t={exports:{}}).exports,t),e=null),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;li[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let l=require("obsidian"),u=require("electron");u=c(u);let d=require("path");d=c(d);let f=require("os");f=c(f);var p=c(o(((e,t)=>{var n=function(e){return r(e)&&!i(e)};function r(e){return!!e&&typeof e==`object`}function i(e){var t=Object.prototype.toString.call(e);return t===`[object RegExp]`||t===`[object Date]`||o(e)}var a=typeof Symbol==`function`&&Symbol.for?Symbol.for(`react.element`):60103;function o(e){return e.$$typeof===a}function s(e){return Array.isArray(e)?[]:{}}function c(e,t){return t.clone!==!1&&t.isMergeableObject(e)?g(s(e),e,t):e}function l(e,t,n){return e.concat(t).map(function(e){return c(e,n)})}function u(e,t){if(!t.customMerge)return g;var n=t.customMerge(e);return typeof n==`function`?n:g}function d(e){return Object.getOwnPropertySymbols?Object.getOwnPropertySymbols(e).filter(function(t){return Object.propertyIsEnumerable.call(e,t)}):[]}function f(e){return Object.keys(e).concat(d(e))}function p(e,t){try{return t in e}catch{return!1}}function m(e,t){return p(e,t)&&!(Object.hasOwnProperty.call(e,t)&&Object.propertyIsEnumerable.call(e,t))}function h(e,t,n){var r={};return n.isMergeableObject(e)&&f(e).forEach(function(t){r[t]=c(e[t],n)}),f(t).forEach(function(i){m(e,i)||(p(e,i)&&n.isMergeableObject(t[i])?r[i]=u(i,n)(e[i],t[i],n):r[i]=c(t[i],n))}),r}function g(e,t,r){r=r||{},r.arrayMerge=r.arrayMerge||l,r.isMergeableObject=r.isMergeableObject||n,r.cloneUnlessOtherwiseSpecified=c;var i=Array.isArray(t);return i===Array.isArray(e)?i?r.arrayMerge(e,t,r):h(e,t,r):c(t,r)}g.all=function(e,t){if(!Array.isArray(e))throw Error(`first argument should be an array`);return e.reduce(function(e,n){return g(e,n,t)},{})},t.exports=g}))()),m={i18n:{en:{exportCurrentFile:`Export current file to PDF`,exportCurrentFileWithPrevious:`Export to PDF with previous Settings`,exportDialog:{filenameAsTitle:`Include file name as title`,pageSize:`Page Size`,margin:`Margin`,downscalePercent:`Downscale Percent`,landscape:`Landscape`,displayHeader:`Display Header`,displayFooter:`Display Footer`,openAfterExport:`Open after export`,cssSnippets:`CSS snippets`},settings:{showTitle:`Add file name as title`,displayHeader:`Display headers`,displayFooter:`Display footer`,printBackground:`Print background`,maxLevel:`Max headings level of the outline`,displayMetadata:`PDF metadata`,headerTemplate:`Header Template`,footerTemplate:`Footer Template`,isTimestamp:`Add timestamp`,enabledCss:`Enable select css snippets`,concurrency:`Limit concurrency`,debugMode:`Debug Mode`,version:`Engine Version`}},zh:{exportCurrentFile:`导出当前文件为PDF`,exportCurrentFileWithPrevious:`使用上一次设置导出为PDF`,exportDialog:{filenameAsTitle:`将笔记名作为标题`,pageSize:`纸张尺寸`,margin:`页边距`,downscalePercent:`缩放`,landscape:`横向打印`,displayHeader:`页眉`,displayFooter:`页脚`,openAfterExport:`导出后打开`,cssSnippets:`CSS代码片段`},settings:{showTitle:`将笔记名作为标题`,displayHeader:`显示页眉`,displayFooter:`显示页脚`,printBackground:`打印背景`,maxLevel:`最大标题级别`,displayMetadata:`PDF元数据`,headerTemplate:`页眉模板`,footerTemplate:`页脚模板`,isTimestamp:`文件名添加时间戳`,enabledCss:`启用CSS片段选择`,concurrency:`限制并发数`,debugMode:`调试模式`,version:`引擎版本`}}},get current(){let e=window.localStorage.getItem(`language`)??`en`;return(0,p.default)(this.i18n.en,this.i18n[e]??{})}},h=Array.isArray,g=Array.prototype.indexOf,_=Array.prototype.includes,v=Array.from,y=Object.defineProperty,b=Object.getOwnPropertyDescriptor,x=Object.getOwnPropertyDescriptors,S=Object.prototype,C=Array.prototype,w=Object.getPrototypeOf,T=Object.isExtensible,E=()=>{};function D(e){for(var t=0;t{e=n,t=r}),resolve:e,reject:t}}function k(e){"@babel/helpers - typeof";return k=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},k(e)}function ee(e,t){if(k(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(k(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function A(e){var t=ee(e,`string`);return k(t)==`symbol`?t:t+``}function j(e,t,n){return(t=A(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var te=1024,ne=2048,re=4096,ie=8192,ae=16384,oe=32768,se=1<<25,ce=65536,le=1<<19,ue=1<<20,M=1<<25,N=65536,de=1<<21,fe=1<<22,pe=1<<23,me=Symbol(`$state`),he=Symbol(`legacy props`),ge=Symbol(``),_e=Symbol(`attributes`),ve=Symbol(`class`),P=Symbol(`style`),ye=Symbol(`text`),be=new class extends Error{constructor(...e){super(...e),j(this,`name`,`StaleReactionError`),j(this,`message`,"The reaction that called `getAbortSignal()` was re-run or destroyed")}},xe=!!globalThis.document?.contentType&&globalThis.document.contentType.includes(`xml`);function F(e){throw Error(`https://svelte.dev/e/lifecycle_outside_component`)}function Se(){throw Error(`https://svelte.dev/e/async_derived_orphan`)}function I(e,t,n){throw Error(`https://svelte.dev/e/each_key_duplicate`)}function Ce(e){throw Error(`https://svelte.dev/e/effect_in_teardown`)}function L(){throw Error(`https://svelte.dev/e/effect_in_unowned_derived`)}function R(e){throw Error(`https://svelte.dev/e/effect_orphan`)}function we(){throw Error(`https://svelte.dev/e/effect_update_depth_exceeded`)}function Te(e){throw Error(`https://svelte.dev/e/props_invalid_value`)}function Ee(){throw Error(`https://svelte.dev/e/state_descriptors_fixed`)}function De(){throw Error(`https://svelte.dev/e/state_prototype_fixed`)}function z(){throw Error(`https://svelte.dev/e/state_unsafe_mutation`)}function Oe(){throw Error(`https://svelte.dev/e/svelte_boundary_reset_onerror`)}var ke={},Ae=Symbol(`uninitialized`);function je(){console.warn(`https://svelte.dev/e/derived_inert`)}function Me(e){console.warn(`https://svelte.dev/e/hydration_mismatch`)}function Ne(){console.warn(`https://svelte.dev/e/svelte_boundary_reset_noop`)}var Pe=!1;function Fe(e){Pe=e}var Ie;function Le(e){if(e===null)throw Me(),ke;return Ie=e}function Re(){return Le(hr(Ie))}function ze(e){if(Pe){if(hr(Ie)!==null)throw Me(),ke;Ie=e}}function Be(e=1){if(Pe){for(var t=e,n=Ie;t--;)n=hr(n);Ie=n}}function Ve(e=!0){for(var t=0,n=Ie;;){if(n.nodeType===8){var r=n.data;if(r===`]`){if(t===0)return n;--t}else(r===`[`||r===`[!`||r[0]===`[`&&!isNaN(Number(r.slice(1))))&&(t+=1)}var i=hr(n);e&&n.remove(),n=i}}function He(e){if(!e||e.nodeType!==8)throw Me(),ke;return e.data}function Ue(e){return e===this.v}function We(e,t){return e==e?e!==t||typeof e==`object`&&!!e||typeof e==`function`:t==t}function Ge(e){return!We(e,this.v)}var Ke=[];function qe(e,t=!1,n=!1){return Je(e,new Map,``,Ke,null,n)}function Je(e,t,n,r,i=null,a=!1){if(typeof e==`object`&&e){var o=t.get(e);if(o!==void 0)return o;if(e instanceof Map)return new Map(e);if(e instanceof Set)return new Set(e);if(h(e)){var s=Array(e.length);t.set(e,s),i!==null&&t.set(i,s);for(var c=0;c{t===et&&tt()})}et.push(e)}function rt(e){var t=ni;if(t===null)return $r.f|=pe,e;if(!(t.f&32768)&&!(t.f&4))throw e;it(e,t)}function it(e,t){for(;t!==null;){if(t.f&128){if(!(t.f&32768))throw e;try{t.b.error(e);return}catch(t){e=t}}t=t.parent}throw e}var at=~(ne|re|te);function ot(e,t){e.f=e.f&at|t}function st(e){e.f&512||e.deps===null?ot(e,te):ot(e,re)}function ct(e){if(e!==null)for(let t of e)!(t.f&2)||!(t.f&65536)||(t.f^=N,ct(t.deps))}function lt(e,t,n){e.f&2048?t.add(e):e.f&4096&&n.add(e),ct(e.deps),ot(e,te)}var ut=!1;function dt(e){var t=ut;try{return ut=!1,[e(),ut]}finally{ut=t}}function ft(e){let t=0,n=$n(0),r;return()=>{Dr()&&(H(n),Pr(()=>(t===0&&(r=Ci(()=>e(()=>ar(n)))),t+=1,()=>{nt(()=>{--t,t===0&&(r?.(),r=void 0,ar(n))})})))}}function pt(e,t){if(t.has(e))throw TypeError(`Cannot initialize the same private elements twice on an object`)}function mt(e,t){pt(e,t),t.add(e)}function ht(e,t,n){pt(e,t),t.set(e,n)}function gt(e,t,n){if(typeof e==`function`?e===t:e.has(t))return arguments.length<3?t:n;throw TypeError(`Private element is not present on this object`)}function B(e,t,n){return e.set(gt(e,t),n),n}function V(e,t){return e.get(gt(e,t))}var _t=ce|le;function vt(e,t,n,r){new It(e,t,n,r)}var yt=new WeakMap,bt=new WeakMap,xt=new WeakMap,St=new WeakMap,Ct=new WeakMap,wt=new WeakMap,Tt=new WeakMap,Et=new WeakMap,Dt=new WeakMap,Ot=new WeakMap,kt=new WeakMap,At=new WeakMap,jt=new WeakMap,Mt=new WeakMap,Nt=new WeakMap,Pt=new WeakMap,Ft=new WeakSet,It=class{constructor(e,t,n,r){mt(this,Ft),j(this,`parent`,void 0),j(this,`is_pending`,!1),j(this,`transform_error`,void 0),ht(this,yt,void 0),ht(this,bt,Pe?Ie:null),ht(this,xt,void 0),ht(this,St,void 0),ht(this,Ct,void 0),ht(this,wt,null),ht(this,Tt,null),ht(this,Et,null),ht(this,Dt,null),ht(this,Ot,0),ht(this,kt,0),ht(this,At,!1),ht(this,jt,new Set),ht(this,Mt,new Set),ht(this,Nt,null),ht(this,Pt,ft(()=>(B(Nt,this,$n(V(Ot,this))),()=>{B(Nt,this,null)}))),B(yt,this,e),B(xt,this,t),B(St,this,e=>{var t=ni;t.b=this,t.f|=128,n(e)}),this.parent=ni.b,this.transform_error=r??this.parent?.transform_error??(e=>e),B(Ct,this,Ir(()=>{if(Pe){let e=V(bt,this);Re();let t=e.data===`[!`;if(e.data.startsWith(`[?`)){let t=JSON.parse(e.data.slice(2));gt(Ft,this,Rt).call(this,t)}else t?gt(Ft,this,zt).call(this):gt(Ft,this,Lt).call(this)}else gt(Ft,this,Bt).call(this)},_t)),Pe&&B(yt,this,Ie)}defer_effect(e){lt(e,V(jt,this),V(Mt,this))}is_rendered(){return!this.is_pending&&(!this.parent||this.parent.is_rendered())}has_pending_snippet(){return!!V(xt,this).pending}update_pending_count(e,t){gt(Ft,this,Ut).call(this,e,t),B(Ot,this,V(Ot,this)+e),!(!V(Nt,this)||V(At,this))&&(B(At,this,!0),nt(()=>{B(At,this,!1),V(Nt,this)&&rr(V(Nt,this),V(Ot,this))}))}get_effect_pending(){return V(Pt,this).call(this),H(V(Nt,this))}error(e){if(!V(xt,this).onerror&&!V(xt,this).failed)throw e;cn?.is_fork?(V(wt,this)&&cn.skip_effect(V(wt,this)),V(Tt,this)&&cn.skip_effect(V(Tt,this)),V(Et,this)&&cn.skip_effect(V(Et,this)),cn.oncommit(()=>{gt(Ft,this,Wt).call(this,e)})):gt(Ft,this,Wt).call(this,e)}};function Lt(){try{B(wt,this,Lr(()=>V(St,this).call(this,V(yt,this))))}catch(e){this.error(e)}}function Rt(e){let t=V(xt,this).failed;t&&B(Et,this,Lr(()=>{t(V(yt,this),()=>e,()=>()=>{})}))}function zt(){let e=V(xt,this).pending;e&&(this.is_pending=!0,B(Tt,this,Lr(()=>e(V(yt,this)))),nt(()=>{var e=B(Dt,this,document.createDocumentFragment()),t=pr();e.append(t),B(wt,this,gt(Ft,this,Ht).call(this,()=>Lr(()=>V(St,this).call(this,t)))),V(kt,this)===0&&(V(yt,this).before(e),B(Dt,this,null),Wr(V(Tt,this),()=>{B(Tt,this,null)}),gt(Ft,this,Vt).call(this,cn))}))}function Bt(){try{if(this.is_pending=this.has_pending_snippet(),B(kt,this,0),B(Ot,this,0),B(wt,this,Lr(()=>{V(St,this).call(this,V(yt,this))})),V(kt,this)>0){var e=B(Dt,this,document.createDocumentFragment());Jr(V(wt,this),e);let t=V(xt,this).pending;B(Tt,this,Lr(()=>t(V(yt,this))))}else gt(Ft,this,Vt).call(this,cn)}catch(e){this.error(e)}}function Vt(e){this.is_pending=!1,e.transfer_effects(V(jt,this),V(Mt,this))}function Ht(e){var t=ni,n=$r,r=Ye;ri(V(Ct,this)),ti(V(Ct,this)),Xe(V(Ct,this).ctx);try{return Pn.ensure(),e()}catch(e){return rt(e),null}finally{ri(t),ti(n),Xe(r)}}function Ut(e,t){if(!this.has_pending_snippet()){if(this.parent){var n;gt(Ft,n=this.parent,Ut).call(n,e,t)}return}B(kt,this,V(kt,this)+e),V(kt,this)===0&&(gt(Ft,this,Vt).call(this,t),V(Tt,this)&&Wr(V(Tt,this),()=>{B(Tt,this,null)}),V(Dt,this)&&(V(yt,this).before(V(Dt,this)),B(Dt,this,null)))}function Wt(e){V(wt,this)&&(Vr(V(wt,this)),B(wt,this,null)),V(Tt,this)&&(Vr(V(Tt,this)),B(Tt,this,null)),V(Et,this)&&(Vr(V(Et,this)),B(Et,this,null)),Pe&&(Le(V(bt,this)),Be(),Le(Ve()));var t=V(xt,this).onerror;let n=V(xt,this).failed;var r=!1,i=!1;let a=()=>{if(r){Ne();return}r=!0,i&&Oe(),V(Et,this)!==null&&Wr(V(Et,this),()=>{B(Et,this,null)}),gt(Ft,this,Ht).call(this,()=>{gt(Ft,this,Bt).call(this)})},o=e=>{try{i=!0,t?.(e,a),i=!1}catch(e){it(e,V(Ct,this)&&V(Ct,this).parent)}n&&B(Et,this,gt(Ft,this,Ht).call(this,()=>{try{return Lr(()=>{var t=ni;t.b=this,t.f|=128,n(V(yt,this),()=>e,()=>a)})}catch(e){return it(e,V(Ct,this).parent),null}}))};nt(()=>{var t;try{t=this.transform_error(e)}catch(e){it(e,V(Ct,this)&&V(Ct,this).parent);return}typeof t==`object`&&t&&typeof t.then==`function`?t.then(o,e=>it(e,V(Ct,this)&&V(Ct,this).parent)):o(t)})}function Gt(e,t,n,r){let i=$e()?Yt:$t;var a=e.filter(e=>!e.settled),o=t.map(i);if(n.length===0&&a.length===0){r(o);return}var s=ni,c=Kt(),l=a.length===1?a[0].promise:a.length>1?Promise.all(a.map(e=>e.promise)):null;function u(e){if(!(s.f&16384)){c();try{r([...o,...e])}catch(e){it(e,s)}qt()}}var d=Jt();if(n.length===0){l.then(()=>u([])).finally(d);return}function f(){Promise.all(n.map(e=>Zt(e))).then(u).catch(e=>it(e,s)).finally(d)}l?l.then(()=>{c(),f(),qt()}):f()}function Kt(){var e=ni,t=$r,n=Ye,r=cn;return function(i=!0){ri(e),ti(t),Xe(n),i&&!(e.f&16384)&&(r?.activate(),r?.apply())}}function qt(e=!0){ri(null),ti(null),Xe(null),e&&cn?.deactivate()}function Jt(){var e=ni,t=e.b,n=cn,r=!!t?.is_rendered();return t?.update_pending_count(1,n),n.increment(r,e),()=>{t?.update_pending_count(-1,n),n.decrement(r,e)}}function Yt(e){var t=2|ne;return ni!==null&&(ni.f|=le),{ctx:Ye,deps:null,effects:null,equals:Ue,f:t,fn:e,reactions:null,rv:0,v:Ae,wv:0,parent:ni,ac:null}}var Xt=Symbol(`obsolete`);function Zt(e,t,n){let r=ni;r===null&&Se();var i=void 0,a=$n(Ae),o=!$r,s=new Set;return Nr(()=>{var t=ni,n=O();i=n.promise;try{Promise.resolve(e()).then(n.resolve,e=>{e!==be&&n.reject(e)}).finally(qt)}catch(e){n.reject(e),qt()}var c=cn;if(o){if(t.f&32768)var l=Jt();if(r.b?.is_rendered())c.async_deriveds.get(t)?.reject(Xt);else for(let e of s.values())e.reject(Xt);s.add(n),c.async_deriveds.set(t,n)}let u=(e,t=void 0)=>{l?.(),s.delete(n),t!==Xt&&(c.activate(),t?(a.f|=pe,rr(a,t)):(a.f&8388608&&(a.f^=pe),rr(a,e)),c.deactivate())};n.promise.then(u,e=>u(null,e||`unknown`))}),Or(()=>{for(let e of s)e.reject(Xt)}),new Promise(e=>{function t(n){function r(){n===i?e(a):t(i)}n.then(r,r)}t(i)})}function Qt(e){let t=Yt(e);return ai(t),t}function $t(e){let t=Yt(e);return t.equals=Ge,t}function en(e){var t=e.effects;if(t!==null){e.effects=null;for(var n=0;nthis.schedule(e)){var n=V(An,this).get(e);if(n){V(An,this).delete(e);for(var r of n.d)ot(r,ne),t(r);for(r of n.m)ot(r,re),t(r)}V(jn,this).add(e)}capture(e,t,n=!1){e.v!==Ae&&!this.previous.has(e)&&this.previous.set(e,e.v),e.f&8388608||(this.current.set(e,[t,n]),un?.set(e,t)),this.is_fork||(e.v=t)}activate(){cn=this}deactivate(){cn=null,un=null}flush(){try{pn=!0,cn=this,gt(Nn,this,In).call(this)}finally{gn=0,dn=null,mn=null,hn=null,pn=!1,cn=null,un=null,Zn.clear()}}discard(){for(let e of V(Sn,this))e(this);V(Sn,this).clear();for(let e of this.async_deriveds.values())e.reject(Xt);gt(Nn,this,Vn).call(this),V(Tn,this)?.resolve()}register_created_effect(e){V(Dn,this).push(e)}increment(e,t){if(B(Cn,this,V(Cn,this)+1),e){let e=V(wn,this).get(t)??0;V(wn,this).set(t,e+1)}}decrement(e,t){if(B(Cn,this,V(Cn,this)-1),e){let e=V(wn,this).get(t)??0;e===1?V(wn,this).delete(t):V(wn,this).set(t,e-1)}V(Mn,this)||(B(Mn,this,!0),nt(()=>{B(Mn,this,!1),this.linked&&this.flush()}))}transfer_effects(e,t){for(let t of e)V(On,this).add(t);for(let e of t)V(kn,this).add(e);e.clear(),t.clear()}oncommit(e){V(xn,this).add(e)}ondiscard(e){V(Sn,this).add(e)}settled(){return(V(Tn,this)??B(Tn,this,O())).promise}static ensure(){if(cn===null){let t=cn=new e;!pn&&nt(()=>{V(vn,t)||t.flush()})}return cn}apply(){un=null}schedule(e){if(dn=e,e.b?.is_pending&&e.f&16777228&&!(e.f&32768)){e.b.defer_effect(e);return}for(var t=e;t.parent!==null;){t=t.parent;var n=t.f;if(mn!==null&&t===ni&&($r===null||!($r.f&2)))return;if(n&96){if(!(n&1024))return;t.f^=te}}V(En,this).push(t)}};on=Pn;function Fn(){if(this.is_fork)return!0;for(let n of V(wn,this).keys()){for(var e=n,t=!1;e.parent!==null;){if(V(An,this).has(e)){t=!0;break}e=e.parent}if(!t)return!0}return!1}function In(){B(vn,this,!0),gn++>1e3&&(gt(Nn,this,Vn).call(this),Hn());for(let e of V(On,this))V(kn,this).delete(e),ot(e,ne),this.schedule(e);for(let e of V(kn,this))ot(e,re),this.schedule(e);let e=V(En,this);B(En,this,[]),this.apply();var t=mn=[],n=[],r=hn=[];for(let r of e)try{gt(Nn,this,Ln).call(this,r,t,n)}catch(e){throw Yn(r),gt(Nn,this,Fn).call(this)||this.discard(),e}if(cn=null,r.length>0){var i=on.ensure();for(let e of r)i.schedule(e)}if(mn=null,hn=null,gt(Nn,this,Fn).call(this)){gt(Nn,this,Bn).call(this,n),gt(Nn,this,Bn).call(this,t);for(let[e,t]of V(An,this))Jn(e,t);r.length>0&>(Nn,cn,In).call(cn);return}let a=gt(Nn,this,Rn).call(this);if(a){gt(Nn,this,Bn).call(this,n),gt(Nn,this,Bn).call(this,t),gt(Nn,a,zn).call(a,this);return}V(On,this).clear(),V(kn,this).clear();for(let e of V(xn,this))e(this);V(xn,this).clear(),ln=this,Wn(n),Wn(t),ln=null,V(Tn,this)?.resolve();var o=cn;if(V(Cn,this)===0&&(V(En,this).length===0||o!==null)&>(Nn,this,Vn).call(this),V(En,this).length>0)if(o!==null){let e=o;V(En,e).push(...V(En,this).filter(t=>!V(En,e).includes(t)))}else o=this;o!==null&>(Nn,o,In).call(o)}function Ln(e,t,n){e.f^=te;for(var r=e.first;r!==null;){var i=r.f,a=(i&96)!=0;if(!(a&&i&1024||i&8192||V(An,this).has(r))&&r.fn!==null){a?r.f^=te:i&4?t.push(r):hi(r)&&(i&16&&V(kn,this).add(r),bi(r));var o=r.first;if(o!==null){r=o;continue}}for(;r!==null;){var s=r.next;if(s!==null){r=s;break}r=r.parent}}}function Rn(){for(var e=V(yn,this);e!==null;){if(!e.is_fork){for(let[t,[,n]]of this.current)if(e.current.has(t)&&!n)return e}e=V(yn,e)}return null}function zn(e){for(let[t,n]of e.current)!this.previous.has(t)&&e.previous.has(t)&&this.previous.set(t,e.previous.get(t)),this.current.set(t,n);for(let[t,n]of e.async_deriveds){let e=this.async_deriveds.get(t);e&&n.promise.then(e.resolve).catch(e.reject)}e.async_deriveds.clear(),this.transfer_effects(V(On,e),V(kn,e));let t=e=>{var n=e.reactions;if(n!==null)for(let e of n){var r=e.f;if(r&2)t(e);else{var i=e;r&4194320&&!this.async_deriveds.has(i)&&(V(kn,this).delete(i),ot(i,ne),this.schedule(i))}}};for(let e of this.current.keys())t(e);this.oncommit(()=>e.discard()),gt(Nn,e,Vn).call(e),cn=this,gt(Nn,this,In).call(this)}function Bn(e){for(var t=0;t0)){Zn.clear();for(let e of Un){if(e.f&24576)continue;let t=[e],n=e.parent;for(;n!==null;)Un.has(n)&&(Un.delete(n),t.push(n)),n=n.parent;for(let e=t.length-1;e>=0;e--){let n=t[e];n.f&24576||bi(n)}}Un.clear()}}Un=null}}function Gn(e,t,n,r){if(!n.has(e)&&(n.add(e),e.reactions!==null))for(let i of e.reactions){let e=i.f;e&2?Gn(i,t,n,r):e&4194320&&!(e&2048)&&Kn(i,t,r)&&(ot(i,ne),qn(i))}}function Kn(e,t,n){let r=n.get(e);if(r!==void 0)return r;if(e.deps!==null)for(let r of e.deps){if(_.call(t,r))return!0;if(r.f&2&&Kn(r,t,n))return n.set(r,!0),!0}return n.set(e,!1),!1}function qn(e){cn.schedule(e)}function Jn(e,t){if(!(e.f&32&&e.f&1024)){e.f&2048?t.d.push(e):e.f&4096&&t.m.push(e),ot(e,te);for(var n=e.first;n!==null;)Jn(n,t),n=n.next}}function Yn(e){ot(e,te);for(var t=e.first;t!==null;)Yn(t),t=t.next}var Xn=new Set,Zn=new Map,Qn=!1;function $n(e,t){return{f:0,v:e,reactions:null,equals:Ue,rv:0,wv:0}}function er(e,t){let n=$n(e,t);return ai(n),n}function tr(e,t=!1,n=!0){let r=$n(e);return t||(r.equals=Ge),r}function nr(e,t,n=!1){return $r!==null&&(!ei||$r.f&131072)&&$e()&&$r.f&4325394&&(ii===null||!ii.has(e))&&z(),rr(e,n?sr(t):t,hn)}function rr(e,t,n=null){if(!e.equals(t)){Zn.set(e,Zr?t:e.v);var r=Pn.ensure();if(r.capture(e,t),e.f&2){let t=e;e.f&2048&&tn(t),un===null&&st(t)}e.wv=mi(),or(e,ne,n),$e()&&ni!==null&&ni.f&1024&&!(ni.f&96)&&(ci===null?li([e]):ci.push(e)),!r.is_fork&&Xn.size>0&&!Qn&&ir()}return t}function ir(){Qn=!1;for(let e of Xn){e.f&1024&&ot(e,re);let t;try{t=hi(e)}catch{t=!0}t&&bi(e)}Xn.clear()}function ar(e){nr(e,e.v+1)}function or(e,t,n){var r=e.reactions;if(r!==null)for(var i=$e(),a=r.length,o=0;o{if(fi===o)return e();var t=$r,n=fi;ti(null),pi(o);var r=e();return ti(t),pi(n),r};return r&&n.set(`length`,er(e.length,a)),new Proxy(e,{defineProperty(e,t,r){(!(`value`in r)||r.configurable===!1||r.enumerable===!1||r.writable===!1)&&Ee();var i=n.get(t);return i===void 0?s(()=>{var e=er(r.value,a);return n.set(t,e),e}):nr(i,r.value,!0),!0},deleteProperty(e,t){var r=n.get(t);if(r===void 0){if(t in e){let e=s(()=>er(Ae,a));n.set(t,e),ar(i)}}else nr(r,Ae),ar(i);return!0},get(t,r,i){if(r===me)return e;var o=n.get(r),c=r in t;if(o===void 0&&(!c||b(t,r)?.writable)&&(o=s(()=>er(sr(c?t[r]:Ae),a)),n.set(r,o)),o!==void 0){var l=H(o);return l===Ae?void 0:l}return Reflect.get(t,r,i)},getOwnPropertyDescriptor(e,t){var r=Reflect.getOwnPropertyDescriptor(e,t);if(r&&`value`in r){var i=n.get(t);i&&(r.value=H(i))}else if(r===void 0){var a=n.get(t),o=a?.v;if(a!==void 0&&o!==Ae)return{enumerable:!0,configurable:!0,value:o,writable:!0}}return r},has(e,t){if(t===me)return!0;var r=n.get(t),i=r!==void 0&&r.v!==Ae||Reflect.has(e,t);return(r!==void 0||ni!==null&&(!i||b(e,t)?.writable))&&(r===void 0&&(r=s(()=>er(i?sr(e[t]):Ae,a)),n.set(t,r)),H(r)===Ae)?!1:i},set(e,t,o,c){var l=n.get(t),u=t in e;if(r&&t===`length`)for(var d=o;der(Ae,a)),n.set(d+``,f)):nr(f,Ae)}if(l===void 0)(!u||b(e,t)?.writable)&&(l=s(()=>er(void 0,a)),nr(l,sr(o)),n.set(t,l));else{u=l.v!==Ae;var p=s(()=>sr(o));nr(l,p)}var m=Reflect.getOwnPropertyDescriptor(e,t);if(m?.set&&m.set.call(c,o),!u){if(r&&typeof t==`string`){var h=n.get(`length`),g=Number(t);Number.isInteger(g)&&g>=h.v&&nr(h,g+1)}ar(i)}return!0},ownKeys(e){H(i);var t=Reflect.ownKeys(e).filter(e=>{var t=n.get(e);return t===void 0||t.v!==Ae});for(var[r,a]of n)a.v!==Ae&&!(r in e)&&t.push(r);return t},setPrototypeOf(){De()}})}var cr,lr,ur,dr;function fr(){if(cr===void 0){cr=window,lr=/Firefox/.test(navigator.userAgent);var e=Element.prototype,t=Node.prototype,n=Text.prototype;ur=b(t,`firstChild`).get,dr=b(t,`nextSibling`).get,T(e)&&(e[ve]=void 0,e[_e]=null,e[P]=void 0,e.__e=void 0),T(n)&&(n[ye]=void 0)}}function pr(e=``){return document.createTextNode(e)}function mr(e){return ur.call(e)}function hr(e){return dr.call(e)}function gr(e,t){if(!Pe)return mr(e);var n=mr(Ie);if(n===null)n=Ie.appendChild(pr());else if(t&&n.nodeType!==3){var r=pr();return n?.before(r),Le(r),r}return t&&Sr(n),Le(n),n}function _r(e,t=!1){if(!Pe){var n=mr(e);return n instanceof Comment&&n.data===``?hr(n):n}if(t){if(Ie?.nodeType!==3){var r=pr();return Ie?.before(r),Le(r),r}Sr(Ie)}return Ie}function vr(e,t=1,n=!1){let r=Pe?Ie:e;for(var i;t--;)i=r,r=hr(r);if(!Pe)return r;if(n){if(r?.nodeType!==3){var a=pr();return r===null?i?.after(a):r.before(a),Le(a),a}Sr(r)}return Le(r),r}function yr(e){e.textContent=``}function br(){return!1}function xr(e,t,n){return t==null||t===`http://www.w3.org/1999/xhtml`?n?document.createElement(e,{is:n}):document.createElement(e):n?document.createElementNS(t,e,{is:n}):document.createElementNS(t,e)}function Sr(e){if(e.nodeValue.length<65536)return;let t=e.nextSibling;for(;t!==null&&t.nodeType===3;)t.remove(),e.nodeValue+=t.nodeValue,t=e.nextSibling}function Cr(e){var t=$r,n=ni;ti(null),ri(null);try{return e()}finally{ti(t),ri(n)}}function wr(e){ni===null&&($r===null&&R(e),L()),Zr&&Ce(e)}function Tr(e,t){var n=t.last;n===null?t.last=t.first=e:(n.next=e,e.prev=n,t.last=e)}function Er(e,t){var n=ni;n!==null&&n.f&8192&&(e|=ie);var r={ctx:Ye,deps:null,nodes:null,f:e|ne|512,first:null,fn:t,last:null,next:null,parent:n,b:n&&n.b,prev:null,teardown:null,wv:0,ac:null};cn?.register_created_effect(r);var i=r;if(e&4)mn===null?Pn.ensure().schedule(r):mn.push(r);else if(t!==null){try{bi(r)}catch(e){throw Vr(r),e}i.deps===null&&i.teardown===null&&i.nodes===null&&i.first===i.last&&!(i.f&524288)&&(i=i.first,e&16&&e&65536&&i!==null&&(i.f|=ce))}if(i!==null&&(i.parent=n,n!==null&&Tr(i,n),$r!==null&&$r.f&2&&!(e&64))){var a=$r;(a.effects??(a.effects=[])).push(i)}return r}function Dr(){return $r!==null&&!ei}function Or(e){let t=Er(8,null);return ot(t,te),t.teardown=e,t}function kr(e){wr(`$effect`);var t=ni.f;if(!$r&&t&32&&Ye!==null&&!Ye.i){var n=Ye;(n.e??(n.e=[])).push(e)}else return Ar(e)}function Ar(e){return Er(4|ue,e)}function jr(e){Pn.ensure();let t=Er(64|le,e);return(e={})=>new Promise(n=>{e.outro?Wr(t,()=>{Vr(t),n(void 0)}):(Vr(t),n(void 0))})}function Mr(e){return Er(4,e)}function Nr(e){return Er(fe|le,e)}function Pr(e,t=0){return Er(8|t,e)}function Fr(e,t=[],n=[],r=[]){Gt(r,t,n,t=>{Er(8,()=>{e(...t.map(H))})})}function Ir(e,t=0){return Er(16|t,e)}function Lr(e){return Er(32|le,e)}function Rr(e){var t=e.teardown;if(t!==null){let e=Zr,n=$r;Qr(!0),ti(null);try{t.call(null)}finally{Qr(e),ti(n)}}}function zr(e,t=!1){var n=e.first;for(e.first=e.last=null;n!==null;){let e=n.ac;e!==null&&Cr(()=>{e.abort(be)});var r=n.next;n.f&64?n.parent=null:Vr(n,t),n=r}}function Br(e){for(var t=e.first;t!==null;){var n=t.next;t.f&32||Vr(t),t=n}}function Vr(e,t=!0){var n=!1;(t||e.f&262144)&&e.nodes!==null&&e.nodes.end!==null&&(Hr(e.nodes.start,e.nodes.end),n=!0),e.f|=se,zr(e,t&&!n),yi(e,0);var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)e.stop();Rr(e),e.f^=se,e.f|=ae;var i=e.parent;i!==null&&i.first!==null&&Ur(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes=e.ac=e.b=null}function Hr(e,t){for(;e!==null;){var n=e===t?null:hr(e);e.remove(),e=n}}function Ur(e){var t=e.parent,n=e.prev,r=e.next;n!==null&&(n.next=r),r!==null&&(r.prev=n),t!==null&&(t.first===e&&(t.first=r),t.last===e&&(t.last=n))}function Wr(e,t,n=!0){var r=[];Gr(e,r,!0);var i=()=>{n&&Vr(e),t&&t()},a=r.length;if(a>0){var o=()=>--a||i();for(var s of r)s.out(o)}else i()}function Gr(e,t,n){if(!(e.f&8192)){e.f^=ie;var r=e.nodes&&e.nodes.t;if(r!==null)for(let e of r)(e.is_global||n)&&t.push(e);for(var i=e.first;i!==null;){var a=i.next;if(!(i.f&64)){var o=(i.f&65536)!=0||(i.f&32)!=0&&(e.f&16)!=0;Gr(i,t,o?n:!1)}i=a}}}function Kr(e){qr(e,!0)}function qr(e,t){if(e.f&8192){e.f^=ie,e.f&1024||(ot(e,ne),Pn.ensure().schedule(e));for(var n=e.first;n!==null;){var r=n.next,i=(n.f&65536)!=0||(n.f&32)!=0;qr(n,i?t:!1),n=r}var a=e.nodes&&e.nodes.t;if(a!==null)for(let e of a)(e.is_global||t)&&e.in()}}function Jr(e,t){if(e.nodes)for(var n=e.nodes.start,r=e.nodes.end;n!==null;){var i=n===r?null:hr(n);t.append(n),n=i}}var Yr=null,Xr=!1,Zr=!1;function Qr(e){Zr=e}var $r=null,ei=!1;function ti(e){$r=e}var ni=null;function ri(e){ni=e}var ii=null;function ai(e){$r!==null&&(ii??(ii=new Set)).add(e)}var oi=null,si=0,ci=null;function li(e){ci=e}var ui=1,di=0,fi=di;function pi(e){fi=e}function mi(){return++ui}function hi(e){var t=e.f;if(t&2048)return!0;if(t&2&&(e.f&=~N),t&4096){for(var n=e.deps,r=n.length,i=0;ie.wv)return!0}t&512&&un===null&&ot(e,te)}return!1}function gi(e,t,n=!0){var r=e.reactions;if(r!==null&&!(ii!==null&&ii.has(e)))for(var i=0;i{e.ac.abort(be)}),e.ac=null);try{e.f|=de;var u=e.fn,d=u();e.f|=oe;var f=e.deps,p=cn?.is_fork;if(oi!==null){var m;if(p||yi(e,si),f!==null&&si>0)for(f.length=si+oi.length,m=0;m{throw e});throw f}}finally{e[Oi]=t,delete e.currentTarget,ti(u),ri(d)}}}var Fi=globalThis?.window?.trustedTypes&&globalThis.window.trustedTypes.createPolicy(`svelte-trusted-html`,{createHTML:e=>e});function Ii(e){return Fi?.createHTML(e)??e}function Li(e){var t=xr(`template`);return t.innerHTML=Ii(e.replaceAll(``,``)),t.content}function Ri(e,t){var n=ni;n.nodes===null&&(n.nodes={start:e,end:t,a:null,t:null})}function zi(e,t){var n=(t&1)!=0,r=(t&2)!=0,i,a=!e.startsWith(``);return()=>{if(Pe)return Ri(Ie,null),Ie;i===void 0&&(i=Li(a?e:``+e),n||(i=mr(i)));var t=r||lr?document.importNode(i,!0):i.cloneNode(!0);if(n){var o=mr(t),s=t.lastChild;Ri(o,s)}else Ri(t,t);return t}}function Bi(e,t){if(Pe){var n=ni;(!(n.f&32768)||n.nodes.end===null)&&(n.nodes.end=Ie),Re();return}e!==null&&e.before(t)}function Vi(e,t){var n=t==null?``:typeof t==`object`?`${t}`:t;n!==(e[ye]??(e[ye]=e.nodeValue))&&(e[ye]=n,e.nodeValue=`${n}`)}function Hi(e,t){return Wi(e,t)}var Ui=new Map;function Wi(e,{target:t,anchor:n,props:r={},events:i,context:a,intro:o=!0,transformError:s}){fr();var c=void 0,l=jr(()=>{var o=n??t.appendChild(pr());vt(o,{pending:()=>{}},t=>{Ze({});var n=Ye;if(a&&(n.c=a),i&&(r.$$events=i),Pe&&Ri(t,null),c=e(t,r)||{},Pe&&(ni.nodes.end=Ie,Ie===null||Ie.nodeType!==8||Ie.data!==`]`))throw Me(),ke;Qe()},s);var l=new Set,u=e=>{for(var n=0;n{for(var e of l)for(let n of[t,document]){var r=Ui.get(n),i=r.get(e);--i==0?(n.removeEventListener(e,Pi),r.delete(e),r.size===0&&Ui.delete(n)):r.set(e,i)}Ai.delete(u),o!==n&&o.parentNode?.removeChild(o)}});return Gi.set(c,l),c}var Gi=new WeakMap;function Ki(e,t){let n=Gi.get(e);return n?(Gi.delete(e),n(t)):Promise.resolve()}var qi=new WeakMap,Ji=new WeakMap,Yi=new WeakMap,Xi=new WeakMap,Zi=new WeakMap,Qi=new WeakMap,$i=new WeakMap,ea=class{constructor(e,t=!0){j(this,`anchor`,void 0),ht(this,qi,new Map),ht(this,Ji,new Map),ht(this,Yi,new Map),ht(this,Xi,new Set),ht(this,Zi,!0),ht(this,Qi,e=>{if(V(qi,this).has(e)){var t=V(qi,this).get(e),n=V(Ji,this).get(t);if(n)Kr(n),V(Xi,this).delete(t);else{var r=V(Yi,this).get(t);r&&(Kr(r.effect),V(Ji,this).set(t,r.effect),V(Yi,this).delete(t),r.fragment.lastChild.remove(),this.anchor.before(r.fragment),n=r.effect)}for(let[t,n]of V(qi,this)){if(V(qi,this).delete(t),t===e)break;let r=V(Yi,this).get(n);r&&(Vr(r.effect),V(Yi,this).delete(n))}for(let[e,r]of V(Ji,this)){if(e===t||V(Xi,this).has(e))continue;let i=()=>{if(Array.from(V(qi,this).values()).includes(e)){var t=document.createDocumentFragment();Jr(r,t),t.append(pr()),V(Yi,this).set(e,{effect:r,fragment:t})}else Vr(r);V(Xi,this).delete(e),V(Ji,this).delete(e)};V(Zi,this)||!n?(V(Xi,this).add(e),Wr(r,i,!1)):i()}}}),ht(this,$i,e=>{V(qi,this).delete(e);let t=Array.from(V(qi,this).values());for(let[e,n]of V(Yi,this))t.includes(e)||(Vr(n.effect),V(Yi,this).delete(e))}),this.anchor=e,B(Zi,this,t)}ensure(e,t){var n=cn,r=br();if(t&&!V(Ji,this).has(e)&&!V(Yi,this).has(e))if(r){var i=document.createDocumentFragment(),a=pr();i.append(a),V(Yi,this).set(e,{effect:Lr(()=>t(a)),fragment:i})}else V(Ji,this).set(e,Lr(()=>t(this.anchor)));if(V(qi,this).set(n,e),r){for(let[t,r]of V(Ji,this))t===e?n.unskip_effect(r):n.skip_effect(r);for(let[t,r]of V(Yi,this))t===e?n.unskip_effect(r.effect):n.skip_effect(r.effect);n.oncommit(V(Qi,this)),n.ondiscard(V($i,this))}else Pe&&(this.anchor=Ie),V(Qi,this).call(this,n)}};function ta(e,t,n=!1){var r;Pe&&(r=Ie,Re());var i=new ea(e),a=n?ce:0;function o(e,t){if(Pe){var n=He(r);if(e!==parseInt(n.substring(1))){var a=Ve();Le(a),i.anchor=a,Fe(!1),i.ensure(e,t),Fe(!0);return}}i.ensure(e,t)}Ir(()=>{var e=!1;t((t,n=0)=>{e=!0,o(n,t)}),e||o(-1,null)},a)}function na(e,t){return t}function ra(e,t,n){for(var r=[],i=t.length,a,o=t.length,s=0;s{if(a){if(a.pending.delete(n),a.done.add(n),a.pending.size===0){var t=e.outrogroups;ia(e,v(a.done)),t.delete(a),t.size===0&&(e.outrogroups=null)}}else--o},!1)}if(o===0){var c=r.length===0&&n!==null;if(c){var l=n,u=l.parentNode;yr(u),u.append(l),e.items.clear()}ia(e,t,!c)}else a={pending:new Set(t),done:new Set},(e.outrogroups??(e.outrogroups=new Set)).add(a)}function ia(e,t,n=!0){var r;if(e.pending.size>0){r=new Set;for(let t of e.pending.values())for(let n of t)r.add(e.items.get(n).e)}for(var i=0;i{var e=n();return h(e)?e:e==null?[]:v(e)}),d,f=new Map,p=!0;function m(e){_.effect.f&16384||(_.pending.delete(e),_.fallback=l,ca(_,d,o,t,r),l!==null&&(d.length===0?l.f&33554432?(l.f^=M,ua(l,null,o)):Kr(l):Wr(l,()=>{l=null})))}function g(e){_.pending.delete(e)}var _={effect:Ir(()=>{d=H(u);var e=d.length;let c=!1;Pe&&He(o)===`[!`!=(e===0)&&(o=Ve(),Le(o),Fe(!1),c=!0);for(var h=new Set,_=cn,v=br(),y=0;ya(o)):(l=Lr(()=>a(aa??(aa=pr()))),l.f|=M)),e>h.size&&I(``,``,``),Pe&&e>0&&Le(Ve()),!p)if(f.set(_,h),v){for(let[e,t]of s)h.has(e)||_.skip_effect(t.e);_.oncommit(m),_.ondiscard(g)}else m(_);c&&Fe(!0),H(u)}),flags:t,items:s,pending:f,outrogroups:null,fallback:l};p=!1,Pe&&(o=Ie)}function sa(e){for(;e!==null&&!(e.f&32);)e=e.next;return e}function ca(e,t,n,r,i){var a=(r&8)!=0,o=t.length,s=e.items,c=sa(e.effect.first),l,u=null,d,f=[],p=[],m,h,g,_;if(a)for(_=0;_0){var E=r&4&&o===0?n:null;if(a){for(_=0;_{if(d!==void 0)for(g of d)g.nodes?.a?.apply()})}function la(e,t,n,r,i,a,o,s){var c=o&1?o&16?$n(n):tr(n,!1,!1):null,l=o&2?$n(i):null;return{v:c,i:l,e:Lr(()=>(a(t,c??n,l??i,s),()=>{e.delete(r)}))}}function ua(e,t,n){if(e.nodes)for(var r=e.nodes.start,i=e.nodes.end,a=t&&!(t.f&33554432)?t.nodes.start:n;r!==null;){var o=hr(r);if(a.before(r),r===i)return;r=o}}function da(e,t,n){t===null?e.effect.first=n:t.next=n,n===null?e.effect.last=t:n.prev=t}function fa(e,t){Mr(()=>{var n=e.getRootNode(),r=n.host?n:n.head??n.ownerDocument.head;if(!r.querySelector(`#`+t.hash)){let e=xr(`style`);e.id=t.hash,e.textContent=t.code,r.appendChild(e)}})}function pa(e,t,n){Mr(()=>{var r=Ci(()=>t(e,n?.())||{});if(n&&r?.update){var i=!1,a={};Pr(()=>{var e=n();wi(e),i&&We(a,e)&&(a=e,r.update(e))}),i=!0}if(r?.destroy)return()=>r.destroy()})}var ma=[...` \r\f\xA0\v`];function ha(e,t,n){var r=e==null?``:``+e;if(t&&(r=r?r+` `+t:t),n){for(var i of Object.keys(n))if(n[i])r=r?r+` `+i:i;else if(r.length)for(var a=i.length,o=0;(o=r.indexOf(i,o))>=0;){var s=o+a;(o===0||ma.includes(r[o-1]))&&(s===r.length||ma.includes(r[s]))?r=(o===0?``:r.substring(0,o))+r.substring(s+1):o=s}}return r===``?null:r}function ga(e,t=!1){var n=t?` !important;`:`;`,r=``;for(var i of Object.keys(e)){var a=e[i];a!=null&&a!==``&&(r+=` `+i+`: `+a+n)}return r}function _a(e){return e[0]!==`-`||e[1]!==`-`?e.toLowerCase():e}function va(e,t){if(t){var n=``,r,i;if(Array.isArray(t)?(r=t[0],i=t[1]):r=t,e){e=String(e).replaceAll(/\s*\/\*.*?\*\/\s*/g,``).trim();var a=!1,o=0,s=!1,c=[];r&&c.push(...Object.keys(r).map(_a)),i&&c.push(...Object.keys(i).map(_a));var l=0,u=-1;let t=e.length;for(var d=0;d{var n=V(Aa,this).get(e);n.delete(t),n.size===0&&(V(Aa,this).delete(e),V(ja,this).unobserve(e))}}};ka=Pa;function Fa(){return V(ja,this)??B(ja,this,new ResizeObserver(e=>{for(var t of e){ka.entries.set(t.target,t);for(var n of V(Aa,this).get(t.target)||[])n(t)}}))}j(Pa,`entries`,new WeakMap);function Ia(e,t){return e===t||e?.[me]===t}function La(e={},t,n,r){var i=Ye.r,a=ni;return Mr(()=>{var o,s;return Pr(()=>{o=s,s=r?.()||[],Ci(()=>{Ia(n(...s),e)||(t(e,...s),o&&Ia(n(...o),e)&&t(null,...o))})}),()=>{let r=a;for(;r!==i&&r.parent!==null&&r.parent.f&33554432;)r=r.parent;let o=()=>{s&&Ia(n(...s),e)&&t(null,...s)},c=r.teardown;r.teardown=()=>{o(),c?.()}}}),e}function Ra(e,t,n,r){var i=!0,a=(n&8)!=0,o=(n&16)!=0,s=r,c=!0,l=void 0,u=()=>o&&i?(l??(l=Yt(r)),H(l)):(c&&(c=!1,s=o?Ci(r):r),s);let d;if(a){var f=me in e||he in e;d=b(e,t)?.set??(f&&t in e?n=>e[t]=n:void 0)}var p,m=!1;a?[p,m]=dt(()=>e[t]):p=e[t],p===void 0&&r!==void 0&&(p=u(),d&&(i&&Te(t),d(p)));var h=i?()=>{var n=e[t];return n===void 0?u():(c=!0,n)}:()=>{var n=e[t];return n!==void 0&&(s=void 0),n===void 0?s:n};if(i&&!(n&4))return h;if(d){var g=e.$$legacy;return(function(e,t){return arguments.length>0?((!i||!t||g||m)&&d(t?h():e),e):h()})}var _=!1,v=(n&1?Yt:$t)(()=>(_=!1,h()));a&&H(v);var y=ni;return(function(e,t){if(arguments.length>0){let n=t?H(v):i&&a?sr(e):e;return nr(v,n),_=!0,s!==void 0&&(s=n),e}return Zr&&_||y.f&16384?v.v:H(v)})}function za(e){Ye===null&&F(`onMount`),kr(()=>{let t=Ci(e);if(typeof t==`function`)return t})}function Ba(e){Ye===null&&F(`onDestroy`),za(()=>()=>Ci(e))}var Va=class{constructor(e,t,n){this.children=[],this.key=e,this.title=t,this.level=n,this.children=[]}};function Ha(e=document){let t=e.querySelectorAll(`h1, h2, h3, h4, h5, h6`),n=new Va(``,`Root`,0),r=n;return t.forEach(e=>{if(e.style.display==`none`)return;let t=parseInt(e.tagName.slice(1)),n=e.querySelector(`a.md-print-anchor`),i=/^af:\/\/(.+)$/.exec(n?.href??``);if(!i)return;let a=new Va(i[1],e.innerText,t);for(;r.level>=t;)r=r.parent;r.children.push(a),a.parent=r,r=a}),n}function Ua(e){let t=new Map;return e.querySelectorAll(`h1, h2, h3, h4, h5, h6`).forEach((e,n)=>{let r=document.createElement(`a`),i=`${e.tagName.toLowerCase()}-${n}`;r.href=`af://${i}`,r.className=`md-print-anchor`,e.appendChild(r),e.dataset.heading&&t.set(e.dataset.heading,i);let a=e.textContent?.trim();if(a){t.set(a,i),t.set(encodeURIComponent(a),i),t.set(a.replace(/\s+/g,`-`),i),t.set(a.toLowerCase().replace(/\s+/g,`-`),i);let e=a.replace(/[^\w\s-]/g,``).trim();e&&e!==a&&(t.set(e,i),t.set(e.replace(/\s+/g,`-`),i),t.set(e.toLowerCase().replace(/\s+/g,`-`),i))}e.id&&t.set(e.id,i)}),t}function Wa(e){return new Map(Array.from(e).map(([e,t])=>[e?.toLowerCase(),t]))}function Ga(e,t,n){let r=Wa(t);e.querySelectorAll(`a.internal-link`).forEach((e,i)=>{let[a,o]=e.dataset.href?.split(`#`)??[];if(o?.startsWith(`^`)&&(e.href=e.dataset.href?.toLowerCase()),o?.length>0){if(a?.length>0&&a!=n)return;let i=t.get(o)||r.get(o?.toLowerCase());i&&!o.startsWith(`^`)&&(e.href=`an://${i}`)}}),e.querySelectorAll(`a[href^='#']`).forEach(e=>{let n=e.getAttribute(`href`);if(!n)return;let i=n.substring(1);if(!i||e.classList.contains(`internal-link`)||i.startsWith(`^`))return;let a=[i,decodeURIComponent(i),i.replace(/-/g,` `),decodeURIComponent(i).replace(/-/g,` `),i.toLowerCase(),decodeURIComponent(i).toLowerCase(),i.toLowerCase().replace(/-/g,` `),decodeURIComponent(i).toLowerCase().replace(/-/g,` `)],o=null;for(let e of a)if(o=t.get(e)||r.get(e.toLowerCase()),o)break;o&&(e.href=`an://${o}`)})}var Ka=e=>Math.round(e*.26458333333719),qa=e=>Math.round(e*3.779527559);function Ja(e){if(e instanceof l.TFile)return e.extension==`md`?[e]:[];let t=[];for(let n of e.children)t.push(...Ja(n));return t.sort((e,t)=>e.name.localeCompare(t.name)),t}function Ya(e,t){Array.from(t).forEach(t=>{e.setAttribute(t.name,t.value)})}function Xa(e,t){return e.replace(/\{\{(.*?)\}\}/g,(e,n)=>t[n.trim()])}function Za(e){return!isNaN(parseFloat(e))}function Qa(e,t=0){try{let n=parseInt(String(e));return isNaN(n)?t:n}catch{return t}}function $a(e,t=0){try{let n=parseFloat(String(e));return isNaN(n)?t:n}catch{return t}}function eo(){let e=new Set,t={};try{for(let n of document.styleSheets)try{let r=n.cssRules||n.rules;if(!r)continue;for(let n of r){if(n.type!==CSSRule.STYLE_RULE)continue;let r=n.selectorText;if(r.includes(`.theme-light`)){let t=n.style;for(let n=0;n{let n=t.ownerNode?.id;if(n?.startsWith(`svelte-`))return;let r=t.ownerNode?.href,i=`/* ----------${n?`id:${n}`:r?`href:${r}`:``}---------- */`;e.push(i);try{Array.from(t?.cssRules??[]).forEach(t=>{e.push(t.cssText)})}catch(e){console.error(e)}}),e.push(...ao()),e}var io=` /* ---------- css patch ---------- */ body { overflow: auto !important; } @media print { .print .markdown-preview-view { height: auto !important; } .md-print-anchor, .blockid { white-space: pre !important; border-left: none !important; border-right: none !important; border-top: none !important; border-bottom: none !important; display: inline-block !important; position: absolute !important; width: 1px !important; height: 1px !important; right: 0 !important; outline: 0 !important; background: 0 0 !important; text-decoration: initial !important; text-shadow: initial !important; } } @media print { table { break-inside: auto; } tr { break-inside: avoid; break-after: auto; } } img.__canvas__ { width: 100% !important; height: 100% !important; } `;function ao(){return[io,...oo()]}function oo(){let e=[];return Array.from(document.styleSheets).forEach(t=>{try{let n=t?.cssRules??[];Array.from(n).forEach(t=>{if(t.constructor.name==`CSSMediaRule`&&t.conditionText===`print`){let n=t.cssText.replace(/@media print\s*\{(.+)\}/gms,`$1`);e.push(n)}})}catch(e){console.error(e)}}),e}function so(e){return Array.from({length:e},()=>(16*Math.random()|0).toString(16)).join(``)}function co(e,t){return e.metadataCache.getFileCache(t)?.frontmatter??{}}async function lo({app:e,file:t,config:n,extra:r}){let i=new Date().getTime(),a=e.workspace.getLeaf(!0);await a.openFile(t),a.view;let o=await e.vault.cachedRead(t);o||new l.Notice(`data is empty!`);let s=co(e,t),c=[];for(let[e,t]of Object.entries(s))(e.toLowerCase()==`cssclass`||e.toLowerCase()==`cssclasses`)&&(Array.isArray(t)?c.push(...t):c.push(t));let u=new l.Component;u.load();let d=document.body.createDiv(`print theme-light`),f=d.createDiv({cls:`markdown-preview-view markdown-rendered`+c.join(` `)});f.toggleClass(`rtl`,e.vault.getConfig(`rightToLeft`)),f.toggleClass(`show-properties`,e.vault.getConfig(`propertiesInDocument`)!==`hidden`);let p=r?.title??s?.title??t.basename;f.createEl(`h1`,{text:p},e=>{e.addClass(`__title__`),e.style.display=n?.showTitle?`block`:`none`,e.id=r?.id??``});let m=e.metadataCache.getFileCache(t),h=new Map(Object.entries(m?.blocks??{})),g=(o?.split(` `)??[]).map((e,t)=>{for(let{id:n,position:{start:r,end:i}}of h.values()){let a=`^${n}`;if(e.includes(a)&&t>=r.line&&t<=i.line)return h.delete(n),e.replace(a,` ${a}`)}return e});[...h.values()].forEach(({id:e,position:{start:t,end:n}})=>{let r=t.line;g[r]=`\n\n`+g[r]});let _={children:void 0,appendChild(e){throw this.children=e?.children,Error(`exit`)}},v=[];try{await l.MarkdownRenderer.render(e,g.join(` `),_,t.path,u)}catch{}let y=createFragment();Array.from(_.children).forEach(e=>{y.createDiv({},t=>t.appendChild(e))}),f.appendChild(y),await l.MarkdownRenderer.postProcess(e,{docId:so(16),sourcePath:t.path,frontmatter:{},promises:v,addChild:function(e){return u.addChild(e)},getSectionInfo:function(){return null},containerEl:f,el:f,displayMode:!0}),await Promise.all(v),d.findAll(`a.internal-link`).forEach(e=>{let[n,r]=e.dataset.href?.split(`#`)??[];(!n||n?.length==0||n==t.basename)&&r?.startsWith(`^`)||e.removeAttribute(`href`)});try{await vo(o,f)}catch{console.warn(`wait timeout`)}yo(f);let b=document.implementation.createHTMLDocument(`document`);return b.body.appendChild(d.cloneNode(!0)),d.detach(),u.unload(),d.remove(),b.title=p,a.detach(),console.debug(`md render time:${new Date().getTime()-i}ms`),{doc:b,frontMatter:s,file:t}}async function uo({app:e,file:t,config:n,extra:r}){let i=new Date().getTime(),a=await e.vault.cachedRead(t);a||new l.Notice(`${t} content is empty!`);let o=new l.Component;o.load();let s=document.body.createDiv({cls:`print theme-light`,attr:{id:t.path}}),{viewEl:c,frontMatter:u}=fo({app:e,file:t,extra:r,config:n,printEl:s});return await mo({app:e,markdown:po({app:e,file:t,data:a}),file:t,comp:o,viewEl:c}),console.debug(`md render time:${new Date().getTime()-i}ms`),{doc:s,frontMatter:u,file:t,cleanup:()=>{s.detach(),o.unload(),s.remove()}}}function fo({app:e,file:t,printEl:n,extra:r,config:i}){let a=co(e,t),o=n.createDiv({cls:`markdown-preview-view markdown-rendered`}),s=Co(a);o.addClasses(s),o.toggleClass(`rtl`,e.vault.getConfig(`rightToLeft`)),o.toggleClass(`show-properties`,e.vault.getConfig(`propertiesInDocument`)!==`hidden`);let c=r?.title??a?.title??t.basename;return o.createEl(`h1`,{text:c},e=>{e.addClass(`__title__`),e.style.display=i?.showTitle?`block`:`none`,e.id=r?.id??``}),{viewEl:o,frontMatter:a}}function po({app:e,file:t,data:n}){let r=e.metadataCache.getFileCache(t),i=new Map(Object.entries(r?.blocks??{})),a=(n?.split(` `)??[]).map((e,t)=>{for(let{id:n,position:{start:r,end:a}}of i.values()){let o=`^${n}`;if(e.includes(o)&&t>=r.line&&t<=a.line)return i.delete(n),e.replace(o,` ${o}`)}return e});return[...i.values()].forEach(({id:e,position:{start:t,end:n}})=>{let r=t.line;a[r]=`\n\n`+a[r]}),a.join(` `)}async function mo({app:e,markdown:t,file:n,comp:r,viewEl:i}){let a={children:void 0,appendChild(e){throw this.children=e?.children,Error(`exit`)}},o=[];try{await l.MarkdownRenderer.render(e,t,a,n.path,r)}catch{}let s=createFragment();Array.from(a.children).forEach(e=>{s.createDiv({},t=>t.appendChild(e))}),i.appendChild(s),await l.MarkdownRenderer.postProcess(e,{docId:so(16),sourcePath:n.path,frontmatter:{},promises:o,addChild:function(e){return r.addChild(e)},getSectionInfo:function(){return null},containerEl:i,el:i,displayMode:!0}),await Promise.all(o),i.findAll(`a.internal-link`).forEach(e=>{let[t,r]=e.dataset.href?.split(`#`)??[];(!t||t?.length==0||t==n.basename)&&r?.startsWith(`^`)||e.removeAttribute(`href`)})}function ho(e,t){return Ga(e,Ua(e),t),_o(e),e}function go(e,t){return Ga(e,Ua(e),t),e}function _o(e){Array.from(e.querySelectorAll(`span.markdown-embed`)).reverse().forEach(e=>e.innerHTML=encodeURIComponent(e.innerHTML))}async function vo(e,t){(e.includes("```dataview")||e.includes("```gEvent")||e.includes(`![[`))&&await sleep(2e3);try{await xo(t)}catch{await sleep(1e3)}}function yo(e){for(let t of Array.from(e.querySelectorAll(`canvas`))){let e=t.toDataURL(),n=document.createElement(`img`);n.src=e,Ya(n,t.attributes),n.className=`__canvas__`,t.replaceWith(n)}}function bo(e){return` document.body.innerHTML = decodeURIComponent(\`${encodeURIComponent(e.body.innerHTML)}\`); document.head.innerHTML = decodeURIComponent(\`${encodeURIComponent(document.head.innerHTML)}\`); // Function to recursively decode and replace innerHTML of span.markdown-embed elements function decodeAndReplaceEmbed(element) { // Replace the innerHTML with the decoded content element.innerHTML = decodeURIComponent(element.innerHTML); // Check if the new content contains further span.markdown-embed elements const newEmbeds = element.querySelectorAll("span.markdown-embed"); newEmbeds.forEach(decodeAndReplaceEmbed); } // Start the process with all span.markdown-embed elements in the document document.querySelectorAll("span.markdown-embed").forEach(decodeAndReplaceEmbed); document.body.setAttribute("class", \`${document.body.getAttribute(`class`)}\`) document.body.setAttribute("style", \`${document.body.getAttribute(`style`)}\`) document.body.addClass("theme-light"); document.body.removeClass("theme-dark"); document.title = \`${e.title}\`; `}function xo(e,t=2e3,n=200){return new Promise((r,i)=>{let a,o=new MutationObserver(e=>{clearTimeout(a),a=setTimeout(()=>{o.disconnect(),r(!0)},n)});o.observe(e,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),setTimeout(()=>{o.disconnect(),i(Error(`timeout ${t}ms`))},t)})}async function So(e,t){let n=e.win.electron.ipcRenderer;return new Promise(e=>{n.once(`print-to-pdf`,(t,n)=>{e(n)}),n.send(`print-to-pdf`,t)})}function Co(e){let t=[];for(let[n,r]of Object.entries(e))(n.toLowerCase()==`cssclass`||n.toLowerCase()==`cssclasses`)&&(Array.isArray(r)?t.push(...r):t.push(r));return t}if(typeof window<`u`){var wo,To;((wo=(To=window).__svelte??(To.__svelte={})).v??(wo.v=new Set)).add(`5`)}function Eo(e){e.setAttribute(`style`,`width: 100px;`)}function Do(e){e.setAttribute(`style`,`margin: 0 auto; width: -webkit-fill-available;`)}function Oo(e,t){let n=t.settingEl;for(e.classList.add(...Array.from(n.classList));n.firstChild;)e.appendChild(n.firstChild);n.remove()}var ko=(e,t)=>{let n=new l.Setting(e).setName(t.name);return t.desc&&n.setDesc(t.desc),n.addToggle(e=>{t.tooltip&&e.setTooltip(t.tooltip),e.setValue(t.value).onChange(t.onChange)}),Oo(e,n),{destroy(){e.empty()}}},Ao=(e,t)=>{let n=new l.Setting(e).setName(t.name);return t.desc&&n.setDesc(t.desc),n.addDropdown(e=>{e.addOptions(t.options).setValue(t.value).onChange(t.onChange)}),Oo(e,n),{destroy(){e.empty()}}},jo=(e,t)=>(Oo(e,new l.Setting(e).setName(t.name).addSlider(e=>{e.setLimits(t.limits[0],t.limits[1],t.limits[2]).setValue(t.value).onChange(n=>{t.onChange(n),e.showTooltip()})})),{destroy(){e.empty()}}),Mo=(e,t)=>{let n=new l.Setting(e).setHeading().addButton(e=>{e.setButtonText(t.text).onClick(t.onClick),t.cta&&e.setCta(),Do(e.buttonEl)});return t.hidden&&(e.hidden=!0),Oo(e,n),{destroy(){e.empty()}}},No=(e,t)=>(Oo(e,new l.Setting(e).setName(t.name).addText(e=>{Eo(e.inputEl),e.setPlaceholder(t.input1.placeholder).setValue(t.input1.value);let n=t.input1.isDebounce?(0,l.debounce)(t.input1.onChange,500,!0):t.input1.onChange;e.onChange(n)}).addText(e=>{Eo(e.inputEl),e.setPlaceholder(t.input2.placeholder).setValue(t.input2.value);let n=t.input2.isDebounce?(0,l.debounce)(t.input2.onChange,500,!0):t.input2.onChange;e.onChange(n)})),{destroy(){e.empty()}}),Po=(e,t)=>(t&&(0,l.setIcon)(e,t),{update(t){e.innerHTML=``,(0,l.setIcon)(e,t)}});function Fo(e,t){let n=t=>{e.innerHTML=``;let n=t.cloneNode(!0);n.removeClass(`theme-light`),n.style.display=`block`,e.appendChild(n)};return n(t),{update:n,destroy(){e.innerHTML=``}}}function Io(e,t){let n=t=>{e.innerHTML=``,t&&(t.style.width=`100%`,e.appendChild(t))};return n(t),{update:n}}var Lo=zi(`
`),Ro=zi(`
`,1),zo=zi(`
`);function Bo(e,t){Ze(t,!0);let n=Ra(t,`config`,15),r=Qt(()=>t.plugin.i18n),i=Qt(()=>t.plugin.settings),a=Qt(()=>n().pageSize===`Custom`),o=Qt(()=>n().marginType===`3`),s=Object.fromEntries([`A0`,`A1`,`A2`,`A3`,`A4`,`A5`,`A6`,`Legal`,`Letter`,`Tabloid`,`Ledger`,`Custom`].map(e=>[e,e])),c={0:`None`,1:`Default`,2:`Small`,3:`Custom`},l=Qt(()=>t.modal.cssSnippets()),u=Qt(()=>Object.keys(H(l)).length>0&&H(i).enabledCss),d=Qt(()=>({0:`Not select`,...H(l)}));function f(e){e.key===`Enter`&&t.handleExport()}var p=zo(),m=gr(p);pa(m,(e,t)=>ko?.(e,t),()=>({name:H(r).exportDialog.filenameAsTitle,tooltip:`Include file name as title`,value:n().showTitle,onChange:e=>{n(n().showTitle=e,!0),t.pdfPreview?.toggleTitle(e)}}));var h=vr(m,2);pa(h,(e,t)=>Ao?.(e,t),()=>({name:H(r).exportDialog.pageSize,options:s,value:n().pageSize,onChange:async e=>{n(n().pageSize=e,!0),await t.pdfPreview?.handleChangeSize?.()}}));var g=vr(h,2),_=e=>{var r=Lo();pa(r,(e,t)=>No?.(e,t),()=>({name:`Width/Height`,input1:{placeholder:`width`,value:n().pageWidth??``,isDebounce:!0,onChange:async e=>{n(n().pageWidth=e,!0),await t.pdfPreview?.handleChangeSize?.()}},input2:{placeholder:`height`,value:n().pageHeight??``,onChange:e=>{n(n().pageHeight=e,!0)}}})),Bi(e,r)};ta(g,e=>{H(a)&&e(_)});var v=vr(g,2);pa(v,(e,t)=>Ao?.(e,t),()=>({name:H(r).exportDialog.margin,desc:`The unit is millimeters.`,options:c,value:n().marginType,onChange:e=>{n(n().marginType=e,!0)}}));var y=vr(v,2),b=e=>{var t=Ro(),r=_r(t);pa(r,(e,t)=>No?.(e,t),()=>({name:`Top/Bottom`,input1:{placeholder:`margin top`,value:n().marginTop??``,onChange:e=>{n(n().marginTop=e,!0)}},input2:{placeholder:`margin bottom`,value:n().marginBottom??``,onChange:e=>{n(n().marginBottom=e,!0)}}})),pa(vr(r,2),(e,t)=>No?.(e,t),()=>({name:`Left/Right`,input1:{placeholder:`margin left`,value:n().marginLeft??``,onChange:e=>{n(n().marginLeft=e,!0)}},input2:{placeholder:`margin right`,value:n().marginRight??``,onChange:e=>{n(n().marginRight=e,!0)}}})),Bi(e,t)};ta(y,e=>{H(o)&&e(b)});var x=vr(y,2);pa(x,(e,t)=>jo?.(e,t),()=>({name:H(r).exportDialog.downscalePercent,limits:[0,200,1],value:n().scale,onChange:e=>{n(n().scale=e,!0)}}));var S=vr(x,2);pa(S,(e,t)=>ko?.(e,t),()=>({name:H(r).exportDialog.landscape,tooltip:`landscape`,value:n().landscape,onChange:e=>{n(n().landscape=e,!0)}}));var C=vr(S,2);pa(C,(e,t)=>ko?.(e,t),()=>({name:H(r).exportDialog.displayHeader,tooltip:`Display header`,value:n().displayHeader,onChange:e=>{n(n().displayHeader=e,!0)}}));var w=vr(C,2);pa(w,(e,t)=>ko?.(e,t),()=>({name:H(r).exportDialog.displayFooter,tooltip:`Display footer`,value:n().displayFooter,onChange:e=>{n(n().displayFooter=e,!0)}}));var T=vr(w,2);pa(T,(e,t)=>ko?.(e,t),()=>({name:H(r).exportDialog.openAfterExport,tooltip:`Open the exported file after exporting.`,value:n().open,onChange:e=>{n(n().open=e,!0)}}));var E=vr(T,2),D=e=>{var i=Lo();pa(i,(e,t)=>Ao?.(e,t),()=>({name:H(r).exportDialog.cssSnippets,options:H(d),value:n().cssSnippet??`0`,onChange:async e=>{n(n().cssSnippet=e,!0),await t.pdfPreview?.renderPreview(!1)}})),Bi(e,i)};ta(E,e=>{H(u)&&H(i).version==`1`&&e(D)});var O=vr(E,2);pa(O,(e,t)=>Mo?.(e,t),()=>({text:`Export`,cta:!0,onClick:()=>t.handleExport()}));var k=vr(O,2),ee=e=>{var n=Lo();pa(n,(e,t)=>Mo?.(e,t),()=>({text:`Refresh`,onClick:()=>t.refreshPreview()})),Bi(e,n)};ta(k,e=>{H(i).version==`1`&&e(ee)}),pa(vr(k,2),(e,t)=>Mo?.(e,t),()=>({text:`Debug`,hidden:!H(i)?.debug,onClick:()=>t.pdfPreview?.handleOpenDevTools()})),ze(p),ji(`keyup`,p,f),Bi(e,p),Qe()}Mi([`keyup`]);var Vo=function(e,t){return Vo=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])},Vo(e,t)};function U(e,t){Vo(e,t);function n(){this.constructor=e}e.prototype=t===null?Object.create(t):(n.prototype=t.prototype,new n)}var Ho=function(){return Ho=Object.assign||function(e){for(var t,n=1,r=arguments.length;n0&&a[a.length-1]))&&(o[0]===6||o[0]===2)){n=0;continue}if(o[0]===3&&(!a||o[1]>a[0]&&o[1]>2],t+=qo[(e[r]&3)<<4|e[r+1]>>4],t+=qo[(e[r+1]&15)<<2|e[r+2]>>6],t+=qo[e[r+2]&63];return n%3==2?t=t.substring(0,t.length-1)+`=`:n%3==1&&(t=t.substring(0,t.length-2)+`==`),t},Zo=function(e){var t=e.length*.75,n=e.length,r,i=0,a,o,s,c;e[e.length-1]===`=`&&(t--,e[e.length-2]===`=`&&t--);var l=new Uint8Array(t);for(r=0;r>4,l[i++]=(o&15)<<4|s>>2,l[i++]=(s&3)<<6|c&63;return l},Qo=/^(data)?:?([\w\/\+]+)?;?(charset=[\w-]+|base64)?.*,/i,$o=function(e){var t=e.trim(),n=t.substring(0,100).match(Qo);if(!n)return Zo(t);var r=n[0];return Zo(t.substring(r.length))},es=function(e){return e.charCodeAt(0)},ts=function(e){return e.codePointAt(0)},ns=function(e,t){return os(e.toString(16),t,`0`).toUpperCase()},rs=function(e){return ns(e,2)},is=function(e){return String.fromCharCode(e)},as=function(e){return is(parseInt(e,16))},os=function(e,t,n){for(var r=``,i=0,a=t-e.length;i=55296&&n<=56319&&e.length>i&&(r=e.charCodeAt(i),r>=56320&&r<=57343&&(a=2)),[e.slice(t,t+a),a]},hs=function(e){for(var t=[],n=0,r=e.length;nn&&l(),o+=f,s+=p}}return l(),c},vs=/^D:(\d\d\d\d)(\d\d)?(\d\d)?(\d\d)?(\d\d)?(\d\d)?([+\-Z])?(\d\d)?'?(\d\d)?'?$/,ys=function(e){var t=e.match(vs);if(t){var n=t[1],r=t[2],i=r===void 0?`01`:r,a=t[3],o=a===void 0?`01`:a,s=t[4],c=s===void 0?`00`:s,l=t[5],u=l===void 0?`00`:l,d=t[6],f=d===void 0?`00`:d,p=t[7],m=p===void 0?`Z`:p,h=t[8],g=h===void 0?`00`:h,_=t[9],v=_===void 0?`00`:_,y=m===`Z`?`Z`:``+m+g+`:`+v;return new Date(n+`-`+i+`-`+o+`T`+c+`:`+u+`:`+f+y)}},bs=function(e,t){for(var n=0,r;n=0&&e<=65535},Ls=function(e){return e>=65536&&e<=1114111},Rs=function(e){return Math.floor((e-65536)/1024)+55296},zs=function(e){return(e-65536)%1024+56320},Bs;(function(e){e.BigEndian=`BigEndian`,e.LittleEndian=`LittleEndian`})(Bs||(Bs={}));for(var Vs=`�`.codePointAt(0),Hs=function(e,t){if(t===void 0&&(t=!0),e.length<=1)return String.fromCodePoint(Vs);for(var n=t?Ks(e):Bs.BigEndian,r=t?2:0,i=[];e.length-r>=2;){var a=Gs(e[r++],e[r++],n);if(Us(a))if(e.length-r<2)i.push(Vs);else{var o=Gs(e[r++],e[r++],n);Ws(o)?i.push(a,o):i.push(Vs)}else Ws(a)?(r+=2,i.push(Vs)):i.push(a)}return r=55296&&e<=56319},Ws=function(e){return e>=56320&&e<=57343},Gs=function(e,t,n){if(n===Bs.LittleEndian)return t<<8|e;if(n===Bs.BigEndian)return e<<8|t;throw Error(`Invalid byteOrder: `+n)},Ks=function(e){return qs(e)?Bs.BigEndian:Js(e)?Bs.LittleEndian:Bs.BigEndian},qs=function(e){return e[0]===254&&e[1]===255},Js=function(e){return e[0]===255&&e[1]===254},Ys=function(e){return qs(e)||Js(e)},Xs=function(e){var t=String(e);if(Math.abs(e)<1){var n=parseInt(e.toString().split(`e-`)[1]);if(n){var r=e<0;r&&(e*=-1),e*=10**(n-1),t=`0.`+Array(n).join(`0`)+e.toString().substring(2),r&&(t=`-`+t)}}else{var n=parseInt(e.toString().split(`+`)[1]);n>20&&(n-=20,e/=10**n,t=e.toString()+Array(n+1).join(`0`))}return t},Zs=function(e){return Math.ceil(e.toString(2).length/8)},Qs=function(e){for(var t=new Uint8Array(Zs(e)),n=1;n<=t.length;n++)t[n-1]=e>>(t.length-n)*8;return t},$s=function(e){throw Error(e)},ec=o((e=>{var t=typeof Uint8Array<`u`&&typeof Uint16Array<`u`&&typeof Int32Array<`u`;function n(e,t){return Object.prototype.hasOwnProperty.call(e,t)}e.assign=function(e){for(var t=Array.prototype.slice.call(arguments,1);t.length;){var r=t.shift();if(r){if(typeof r!=`object`)throw TypeError(r+`must be non-object`);for(var i in r)n(r,i)&&(e[i]=r[i])}}return e},e.shrinkBuf=function(e,t){return e.length===t?e:e.subarray?e.subarray(0,t):(e.length=t,e)};var r={arraySet:function(e,t,n,r,i){if(t.subarray&&e.subarray){e.set(t.subarray(n,n+r),i);return}for(var a=0;a{var t=ec(),n=4,r=0,i=1,a=2;function o(e){for(var t=e.length;--t>=0;)e[t]=0}var s=0,c=1,l=2,u=3,d=258,f=29,p=256,m=p+1+f,h=30,g=19,_=2*m+1,v=15,y=16,b=7,x=256,S=16,C=17,w=18,T=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],E=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],D=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],O=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],k=512,ee=Array((m+2)*2);o(ee);var A=Array(h*2);o(A);var j=Array(k);o(j);var te=Array(d-u+1);o(te);var ne=Array(f);o(ne);var re=Array(h);o(re);function ie(e,t,n,r,i){this.static_tree=e,this.extra_bits=t,this.extra_base=n,this.elems=r,this.max_length=i,this.has_stree=e&&e.length}var ae,oe,se;function ce(e,t){this.dyn_tree=e,this.max_code=0,this.stat_desc=t}function le(e){return e<256?j[e]:j[256+(e>>>7)]}function ue(e,t){e.pending_buf[e.pending++]=t&255,e.pending_buf[e.pending++]=t>>>8&255}function M(e,t,n){e.bi_valid>y-n?(e.bi_buf|=t<>y-e.bi_valid,e.bi_valid+=n-y):(e.bi_buf|=t<>>=1,n<<=1;while(--t>0);return n>>>1}function fe(e){e.bi_valid===16?(ue(e,e.bi_buf),e.bi_buf=0,e.bi_valid=0):e.bi_valid>=8&&(e.pending_buf[e.pending++]=e.bi_buf&255,e.bi_buf>>=8,e.bi_valid-=8)}function pe(e,t){var n=t.dyn_tree,r=t.max_code,i=t.stat_desc.static_tree,a=t.stat_desc.has_stree,o=t.stat_desc.extra_bits,s=t.stat_desc.extra_base,c=t.stat_desc.max_length,l,u,d,f,p,m,h=0;for(f=0;f<=v;f++)e.bl_count[f]=0;for(n[e.heap[e.heap_max]*2+1]=0,l=e.heap_max+1;l<_;l++)u=e.heap[l],f=n[n[u*2+1]*2+1]+1,f>c&&(f=c,h++),n[u*2+1]=f,!(u>r)&&(e.bl_count[f]++,p=0,u>=s&&(p=o[u-s]),m=n[u*2],e.opt_len+=m*(f+p),a&&(e.static_len+=m*(i[u*2+1]+p)));if(h!==0){do{for(f=c-1;e.bl_count[f]===0;)f--;e.bl_count[f]--,e.bl_count[f+1]+=2,e.bl_count[c]--,h-=2}while(h>0);for(f=c;f!==0;f--)for(u=e.bl_count[f];u!==0;)d=e.heap[--l],!(d>r)&&(n[d*2+1]!==f&&(e.opt_len+=(f-n[d*2+1])*n[d*2],n[d*2+1]=f),u--)}}function me(e,t,n){var r=Array(v+1),i=0,a,o;for(a=1;a<=v;a++)r[a]=i=i+n[a-1]<<1;for(o=0;o<=t;o++){var s=e[o*2+1];s!==0&&(e[o*2]=de(r[s]++,s))}}function he(){var e,t,n,r,i,a=Array(v+1);for(n=0,r=0;r>=7;r8?ue(e,e.bi_buf):e.bi_valid>0&&(e.pending_buf[e.pending++]=e.bi_buf),e.bi_buf=0,e.bi_valid=0}function ve(e,n,r,i){_e(e),i&&(ue(e,r),ue(e,~r)),t.arraySet(e.pending_buf,e.window,n,r,e.pending),e.pending+=r}function P(e,t,n,r){var i=t*2,a=n*2;return e[i]>1;o>=1;o--)ye(e,n,o);l=a;do o=e.heap[1],e.heap[1]=e.heap[e.heap_len--],ye(e,n,1),s=e.heap[1],e.heap[--e.heap_max]=o,e.heap[--e.heap_max]=s,n[l*2]=n[o*2]+n[s*2],e.depth[l]=(e.depth[o]>=e.depth[s]?e.depth[o]:e.depth[s])+1,n[o*2+1]=n[s*2+1]=l,e.heap[1]=l++,ye(e,n,1);while(e.heap_len>=2);e.heap[--e.heap_max]=e.heap[1],pe(e,t),me(n,c,e.bl_count)}function F(e,t,n){var r,i=-1,a,o=t[1],s=0,c=7,l=4;for(o===0&&(c=138,l=3),t[(n+1)*2+1]=65535,r=0;r<=n;r++)a=o,o=t[(r+1)*2+1],!(++s=3&&e.bl_tree[O[t]*2+1]===0;t--);return e.opt_len+=3*(t+1)+5+5+4,t}function Ce(e,t,n,r){var i;for(M(e,t-257,5),M(e,n-1,5),M(e,r-4,4),i=0;i>>=1)if(t&1&&e.dyn_ltree[n*2]!==0)return r;if(e.dyn_ltree[18]!==0||e.dyn_ltree[20]!==0||e.dyn_ltree[26]!==0)return i;for(n=32;n0?(e.strm.data_type===a&&(e.strm.data_type=L(e)),xe(e,e.l_desc),xe(e,e.d_desc),u=I(e),o=e.opt_len+3+7>>>3,s=e.static_len+3+7>>>3,s<=o&&(o=s)):o=s=r+5,r+4<=o&&t!==-1?Te(e,t,r,i):e.strategy===n||s===o?(M(e,(c<<1)+ +!!i,3),be(e,ee,A)):(M(e,(l<<1)+ +!!i,3),Ce(e,e.l_desc.max_code+1,e.d_desc.max_code+1,u+1),be(e,e.dyn_ltree,e.dyn_dtree)),ge(e),i&&_e(e)}function z(e,t,n){return e.pending_buf[e.d_buf+e.last_lit*2]=t>>>8&255,e.pending_buf[e.d_buf+e.last_lit*2+1]=t&255,e.pending_buf[e.l_buf+e.last_lit]=n&255,e.last_lit++,t===0?e.dyn_ltree[n*2]++:(e.matches++,t--,e.dyn_ltree[(te[n]+p+1)*2]++,e.dyn_dtree[le(t)*2]++),e.last_lit===e.lit_bufsize-1}e._tr_init=we,e._tr_stored_block=Te,e._tr_flush_block=De,e._tr_tally=z,e._tr_align=Ee})),nc=o(((e,t)=>{function n(e,t,n,r){for(var i=e&65535|0,a=e>>>16&65535|0,o=0;n!==0;){o=n>2e3?2e3:n,n-=o;do i=i+t[r++]|0,a=a+i|0;while(--o);i%=65521,a%=65521}return i|a<<16|0}t.exports=n})),rc=o(((e,t)=>{function n(){for(var e,t=[],n=0;n<256;n++){e=n;for(var r=0;r<8;r++)e=e&1?3988292384^e>>>1:e>>>1;t[n]=e}return t}var r=n();function i(e,t,n,i){var a=r,o=i+n;e^=-1;for(var s=i;s>>8^a[(e^t[s])&255];return e^-1}t.exports=i})),ic=o(((e,t)=>{t.exports={2:`need dictionary`,1:`stream end`,0:``,"-1":`file error`,"-2":`stream error`,"-3":`data error`,"-4":`insufficient memory`,"-5":`buffer error`,"-6":`incompatible version`}})),ac=o((e=>{var t=ec(),n=tc(),r=nc(),i=rc(),a=ic(),o=0,s=1,c=3,l=4,u=5,d=0,f=1,p=-2,m=-3,h=-5,g=-1,_=1,v=2,y=3,b=4,x=0,S=2,C=8,w=9,T=15,E=8,D=286,O=30,k=19,ee=2*D+1,A=15,j=3,te=258,ne=te+j+1,re=32,ie=42,ae=69,oe=73,se=91,ce=103,le=113,ue=666,M=1,N=2,de=3,fe=4,pe=3;function me(e,t){return e.msg=a[t],t}function he(e){return(e<<1)-(e>4?9:0)}function ge(e){for(var t=e.length;--t>=0;)e[t]=0}function _e(e){var n=e.state,r=n.pending;r>e.avail_out&&(r=e.avail_out),r!==0&&(t.arraySet(e.output,n.pending_buf,n.pending_out,r,e.next_out),e.next_out+=r,n.pending_out+=r,e.total_out+=r,e.avail_out-=r,n.pending-=r,n.pending===0&&(n.pending_out=0))}function ve(e,t){n._tr_flush_block(e,e.block_start>=0?e.block_start:-1,e.strstart-e.block_start,t),e.block_start=e.strstart,_e(e.strm)}function P(e,t){e.pending_buf[e.pending++]=t}function ye(e,t){e.pending_buf[e.pending++]=t>>>8&255,e.pending_buf[e.pending++]=t&255}function be(e,n,a,o){var s=e.avail_in;return s>o&&(s=o),s===0?0:(e.avail_in-=s,t.arraySet(n,e.input,e.next_in,s,a),e.state.wrap===1?e.adler=r(e.adler,n,s,a):e.state.wrap===2&&(e.adler=i(e.adler,n,s,a)),e.next_in+=s,e.total_in+=s,s)}function xe(e,t){var n=e.max_chain_length,r=e.strstart,i,a,o=e.prev_length,s=e.nice_match,c=e.strstart>e.w_size-ne?e.strstart-(e.w_size-ne):0,l=e.window,u=e.w_mask,d=e.prev,f=e.strstart+te,p=l[r+o-1],m=l[r+o];e.prev_length>=e.good_match&&(n>>=2),s>e.lookahead&&(s=e.lookahead);do{if(i=t,l[i+o]!==m||l[i+o-1]!==p||l[i]!==l[r]||l[++i]!==l[r+1])continue;r+=2,i++;do;while(l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&l[++r]===l[++i]&&ro){if(e.match_start=t,o=a,a>=s)break;p=l[r+o-1],m=l[r+o]}}while((t=d[t&u])>c&&--n!==0);return o<=e.lookahead?o:e.lookahead}function F(e){var n=e.w_size,r,i,a,o,s;do{if(o=e.window_size-e.lookahead-e.strstart,e.strstart>=n+(n-ne)){t.arraySet(e.window,e.window,n,n,0),e.match_start-=n,e.strstart-=n,e.block_start-=n,i=e.hash_size,r=i;do a=e.head[--r],e.head[r]=a>=n?a-n:0;while(--i);i=n,r=i;do a=e.prev[--r],e.prev[r]=a>=n?a-n:0;while(--i);o+=n}if(e.strm.avail_in===0)break;if(i=be(e.strm,e.window,e.strstart+e.lookahead,o),e.lookahead+=i,e.lookahead+e.insert>=j)for(s=e.strstart-e.insert,e.ins_h=e.window[s],e.ins_h=(e.ins_h<e.pending_buf_size-5&&(n=e.pending_buf_size-5);;){if(e.lookahead<=1){if(F(e),e.lookahead===0&&t===o)return M;if(e.lookahead===0)break}e.strstart+=e.lookahead,e.lookahead=0;var r=e.block_start+n;if((e.strstart===0||e.strstart>=r)&&(e.lookahead=e.strstart-r,e.strstart=r,ve(e,!1),e.strm.avail_out===0)||e.strstart-e.block_start>=e.w_size-ne&&(ve(e,!1),e.strm.avail_out===0))return M}return e.insert=0,t===l?(ve(e,!0),e.strm.avail_out===0?de:fe):(e.strstart>e.block_start&&(ve(e,!1),e.strm.avail_out),M)}function I(e,t){for(var r,i;;){if(e.lookahead=j&&(e.ins_h=(e.ins_h<=j)if(i=n._tr_tally(e,e.strstart-e.match_start,e.match_length-j),e.lookahead-=e.match_length,e.match_length<=e.max_lazy_match&&e.lookahead>=j){e.match_length--;do e.strstart++,e.ins_h=(e.ins_h<=j&&(e.ins_h=(e.ins_h<4096)&&(e.match_length=j-1)),e.prev_length>=j&&e.match_length<=e.prev_length){a=e.strstart+e.lookahead-j,i=n._tr_tally(e,e.strstart-1-e.prev_match,e.prev_length-j),e.lookahead-=e.prev_length-1,e.prev_length-=2;do++e.strstart<=a&&(e.ins_h=(e.ins_h<=j&&e.strstart>0&&(a=e.strstart-1,i=c[a],i===c[++a]&&i===c[++a]&&i===c[++a])){s=e.strstart+te;do;while(i===c[++a]&&i===c[++a]&&i===c[++a]&&i===c[++a]&&i===c[++a]&&i===c[++a]&&i===c[++a]&&i===c[++a]&&ae.lookahead&&(e.match_length=e.lookahead)}if(e.match_length>=j?(r=n._tr_tally(e,1,e.match_length-j),e.lookahead-=e.match_length,e.strstart+=e.match_length,e.match_length=0):(r=n._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++),r&&(ve(e,!1),e.strm.avail_out===0))return M}return e.insert=0,t===l?(ve(e,!0),e.strm.avail_out===0?de:fe):e.last_lit&&(ve(e,!1),e.strm.avail_out===0)?M:N}function R(e,t){for(var r;;){if(e.lookahead===0&&(F(e),e.lookahead===0)){if(t===o)return M;break}if(e.match_length=0,r=n._tr_tally(e,0,e.window[e.strstart]),e.lookahead--,e.strstart++,r&&(ve(e,!1),e.strm.avail_out===0))return M}return e.insert=0,t===l?(ve(e,!0),e.strm.avail_out===0?de:fe):e.last_lit&&(ve(e,!1),e.strm.avail_out===0)?M:N}function we(e,t,n,r,i){this.good_length=e,this.max_lazy=t,this.nice_length=n,this.max_chain=r,this.func=i}var Te=[new we(0,0,0,0,Se),new we(4,4,8,4,I),new we(4,5,16,8,I),new we(4,6,32,32,I),new we(4,4,16,16,Ce),new we(8,16,32,32,Ce),new we(8,16,128,128,Ce),new we(8,32,128,256,Ce),new we(32,128,258,1024,Ce),new we(32,258,258,4096,Ce)];function Ee(e){e.window_size=2*e.w_size,ge(e.head),e.max_lazy_match=Te[e.level].max_lazy,e.good_match=Te[e.level].good_length,e.nice_match=Te[e.level].nice_length,e.max_chain_length=Te[e.level].max_chain,e.strstart=0,e.block_start=0,e.lookahead=0,e.insert=0,e.match_length=e.prev_length=j-1,e.match_available=0,e.ins_h=0}function De(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=C,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new t.Buf16(ee*2),this.dyn_dtree=new t.Buf16((2*O+1)*2),this.bl_tree=new t.Buf16((2*k+1)*2),ge(this.dyn_ltree),ge(this.dyn_dtree),ge(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new t.Buf16(A+1),this.heap=new t.Buf16(2*D+1),ge(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new t.Buf16(2*D+1),ge(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function z(e){var t;return!e||!e.state?me(e,p):(e.total_in=e.total_out=0,e.data_type=S,t=e.state,t.pending=0,t.pending_out=0,t.wrap<0&&(t.wrap=-t.wrap),t.status=t.wrap?ie:le,e.adler=t.wrap===2?0:1,t.last_flush=o,n._tr_init(t),d)}function Oe(e){var t=z(e);return t===d&&Ee(e.state),t}function ke(e,t){return!e||!e.state||e.state.wrap!==2?p:(e.state.gzhead=t,d)}function Ae(e,n,r,i,a,o){if(!e)return p;var s=1;if(n===g&&(n=6),i<0?(s=0,i=-i):i>15&&(s=2,i-=16),a<1||a>w||r!==C||i<8||i>15||n<0||n>9||o<0||o>b)return me(e,p);i===8&&(i=9);var c=new De;return e.state=c,c.strm=e,c.wrap=s,c.gzhead=null,c.w_bits=i,c.w_size=1<u||t<0)return e?me(e,p):p;if(a=e.state,!e.output||!e.input&&e.avail_in!==0||a.status===ue&&t!==l)return me(e,e.avail_out===0?h:p);if(a.strm=e,r=a.last_flush,a.last_flush=t,a.status===ie)if(a.wrap===2)e.adler=0,P(a,31),P(a,139),P(a,8),a.gzhead?(P(a,+!!a.gzhead.text+(a.gzhead.hcrc?2:0)+(a.gzhead.extra?4:0)+(a.gzhead.name?8:0)+(a.gzhead.comment?16:0)),P(a,a.gzhead.time&255),P(a,a.gzhead.time>>8&255),P(a,a.gzhead.time>>16&255),P(a,a.gzhead.time>>24&255),P(a,a.level===9?2:a.strategy>=v||a.level<2?4:0),P(a,a.gzhead.os&255),a.gzhead.extra&&a.gzhead.extra.length&&(P(a,a.gzhead.extra.length&255),P(a,a.gzhead.extra.length>>8&255)),a.gzhead.hcrc&&(e.adler=i(e.adler,a.pending_buf,a.pending,0)),a.gzindex=0,a.status=ae):(P(a,0),P(a,0),P(a,0),P(a,0),P(a,0),P(a,a.level===9?2:a.strategy>=v||a.level<2?4:0),P(a,pe),a.status=le);else{var _=C+(a.w_bits-8<<4)<<8,b=-1;b=a.strategy>=v||a.level<2?0:a.level<6?1:a.level===6?2:3,_|=b<<6,a.strstart!==0&&(_|=re),_+=31-_%31,a.status=le,ye(a,_),a.strstart!==0&&(ye(a,e.adler>>>16),ye(a,e.adler&65535)),e.adler=1}if(a.status===ae)if(a.gzhead.extra){for(m=a.pending;a.gzindex<(a.gzhead.extra.length&65535)&&!(a.pending===a.pending_buf_size&&(a.gzhead.hcrc&&a.pending>m&&(e.adler=i(e.adler,a.pending_buf,a.pending-m,m)),_e(e),m=a.pending,a.pending===a.pending_buf_size));)P(a,a.gzhead.extra[a.gzindex]&255),a.gzindex++;a.gzhead.hcrc&&a.pending>m&&(e.adler=i(e.adler,a.pending_buf,a.pending-m,m)),a.gzindex===a.gzhead.extra.length&&(a.gzindex=0,a.status=oe)}else a.status=oe;if(a.status===oe)if(a.gzhead.name){m=a.pending;do{if(a.pending===a.pending_buf_size&&(a.gzhead.hcrc&&a.pending>m&&(e.adler=i(e.adler,a.pending_buf,a.pending-m,m)),_e(e),m=a.pending,a.pending===a.pending_buf_size)){g=1;break}g=a.gzindexm&&(e.adler=i(e.adler,a.pending_buf,a.pending-m,m)),g===0&&(a.gzindex=0,a.status=se)}else a.status=se;if(a.status===se)if(a.gzhead.comment){m=a.pending;do{if(a.pending===a.pending_buf_size&&(a.gzhead.hcrc&&a.pending>m&&(e.adler=i(e.adler,a.pending_buf,a.pending-m,m)),_e(e),m=a.pending,a.pending===a.pending_buf_size)){g=1;break}g=a.gzindexm&&(e.adler=i(e.adler,a.pending_buf,a.pending-m,m)),g===0&&(a.status=ce)}else a.status=ce;if(a.status===ce&&(a.gzhead.hcrc?(a.pending+2>a.pending_buf_size&&_e(e),a.pending+2<=a.pending_buf_size&&(P(a,e.adler&255),P(a,e.adler>>8&255),e.adler=0,a.status=le)):a.status=le),a.pending!==0){if(_e(e),e.avail_out===0)return a.last_flush=-1,d}else if(e.avail_in===0&&he(t)<=he(r)&&t!==l)return me(e,h);if(a.status===ue&&e.avail_in!==0)return me(e,h);if(e.avail_in!==0||a.lookahead!==0||t!==o&&a.status!==ue){var x=a.strategy===v?R(a,t):a.strategy===y?L(a,t):Te[a.level].func(a,t);if((x===de||x===fe)&&(a.status=ue),x===M||x===de)return e.avail_out===0&&(a.last_flush=-1),d;if(x===N&&(t===s?n._tr_align(a):t!==u&&(n._tr_stored_block(a,0,0,!1),t===c&&(ge(a.head),a.lookahead===0&&(a.strstart=0,a.block_start=0,a.insert=0))),_e(e),e.avail_out===0))return a.last_flush=-1,d}return t===l?a.wrap<=0?f:(a.wrap===2?(P(a,e.adler&255),P(a,e.adler>>8&255),P(a,e.adler>>16&255),P(a,e.adler>>24&255),P(a,e.total_in&255),P(a,e.total_in>>8&255),P(a,e.total_in>>16&255),P(a,e.total_in>>24&255)):(ye(a,e.adler>>>16),ye(a,e.adler&65535)),_e(e),a.wrap>0&&(a.wrap=-a.wrap),a.pending===0?f:d):d}function Ne(e){var t;return!e||!e.state?p:(t=e.state.status,t!==ie&&t!==ae&&t!==oe&&t!==se&&t!==ce&&t!==le&&t!==ue?me(e,p):(e.state=null,t===le?me(e,m):d))}function Pe(e,n){var i=n.length,a,o,s,c,l,u,f,m;if(!e||!e.state||(a=e.state,c=a.wrap,c===2||c===1&&a.status!==ie||a.lookahead))return p;for(c===1&&(e.adler=r(e.adler,n,i,0)),a.wrap=0,i>=a.w_size&&(c===0&&(ge(a.head),a.strstart=0,a.block_start=0,a.insert=0),m=new t.Buf8(a.w_size),t.arraySet(m,n,i-a.w_size,a.w_size,0),n=m,i=a.w_size),l=e.avail_in,u=e.next_in,f=e.input,e.avail_in=i,e.next_in=0,e.input=n,F(a);a.lookahead>=j;){o=a.strstart,s=a.lookahead-(j-1);do a.ins_h=(a.ins_h<{var t=ec(),n=!0,r=!0;try{String.fromCharCode.apply(null,[0])}catch{n=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch{r=!1}for(var i=new t.Buf8(256),a=0;a<256;a++)i[a]=a>=252?6:a>=248?5:a>=240?4:a>=224?3:a>=192?2:1;i[254]=i[254]=1,e.string2buf=function(e){var n,r,i,a,o,s=e.length,c=0;for(a=0;a>>6,n[o++]=128|r&63):r<65536?(n[o++]=224|r>>>12,n[o++]=128|r>>>6&63,n[o++]=128|r&63):(n[o++]=240|r>>>18,n[o++]=128|r>>>12&63,n[o++]=128|r>>>6&63,n[o++]=128|r&63);return n};function o(e,i){if(i<65534&&(e.subarray&&r||!e.subarray&&n))return String.fromCharCode.apply(null,t.shrinkBuf(e,i));for(var a=``,o=0;o4){l[r++]=65533,n+=s-1;continue}for(a&=s===2?31:s===3?15:7;s>1&&n1){l[r++]=65533;continue}a<65536?l[r++]=a:(a-=65536,l[r++]=55296|a>>10&1023,l[r++]=56320|a&1023)}return o(l,r)},e.utf8border=function(e,t){var n;for(t=t||e.length,t>e.length&&(t=e.length),n=t-1;n>=0&&(e[n]&192)==128;)n--;return n<0||n===0?t:n+i[e[n]]>t?n:t}})),sc=o(((e,t)=>{function n(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg=``,this.state=null,this.data_type=2,this.adler=0}t.exports=n})),cc=o((e=>{var t=ac(),n=ec(),r=oc(),i=ic(),a=sc(),o=Object.prototype.toString,s=0,c=4,l=0,u=1,d=2,f=-1,p=0,m=8;function h(e){if(!(this instanceof h))return new h(e);this.options=n.assign({level:f,method:m,chunkSize:16384,windowBits:15,memLevel:8,strategy:p,to:``},e||{});var s=this.options;s.raw&&s.windowBits>0?s.windowBits=-s.windowBits:s.gzip&&s.windowBits>0&&s.windowBits<16&&(s.windowBits+=16),this.err=0,this.msg=``,this.ended=!1,this.chunks=[],this.strm=new a,this.strm.avail_out=0;var c=t.deflateInit2(this.strm,s.level,s.method,s.windowBits,s.memLevel,s.strategy);if(c!==l)throw Error(i[c]);if(s.header&&t.deflateSetHeader(this.strm,s.header),s.dictionary){var u=typeof s.dictionary==`string`?r.string2buf(s.dictionary):o.call(s.dictionary)===`[object ArrayBuffer]`?new Uint8Array(s.dictionary):s.dictionary;if(c=t.deflateSetDictionary(this.strm,u),c!==l)throw Error(i[c]);this._dict_set=!0}}h.prototype.push=function(e,i){var a=this.strm,f=this.options.chunkSize,p,m;if(this.ended)return!1;m=i===~~i?i:i===!0?c:s,typeof e==`string`?a.input=r.string2buf(e):o.call(e)===`[object ArrayBuffer]`?a.input=new Uint8Array(e):a.input=e,a.next_in=0,a.avail_in=a.input.length;do{if(a.avail_out===0&&(a.output=new n.Buf8(f),a.next_out=0,a.avail_out=f),p=t.deflate(a,m),p!==u&&p!==l)return this.onEnd(p),this.ended=!0,!1;(a.avail_out===0||a.avail_in===0&&(m===c||m===d))&&(this.options.to===`string`?this.onData(r.buf2binstring(n.shrinkBuf(a.output,a.next_out))):this.onData(n.shrinkBuf(a.output,a.next_out)))}while((a.avail_in>0||a.avail_out===0)&&p!==u);return m===c?(p=t.deflateEnd(this.strm),this.onEnd(p),this.ended=!0,p===l):m===d?(this.onEnd(l),a.avail_out=0,!0):!0},h.prototype.onData=function(e){this.chunks.push(e)},h.prototype.onEnd=function(e){e===l&&(this.options.to===`string`?this.result=this.chunks.join(``):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function g(e,t){var n=new h(t);if(n.push(e,!0),n.err)throw n.msg||i[n.err];return n.result}function _(e,t){return t=t||{},t.raw=!0,g(e,t)}function v(e,t){return t=t||{},t.gzip=!0,g(e,t)}e.Deflate=h,e.deflate=g,e.deflateRaw=_,e.gzip=v})),lc=o(((e,t)=>{t.exports=function(e,t){var n=e.state,r=e.next_in,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,x,S,C,w,T=e.input,E;i=r+(e.avail_in-5),a=e.next_out,E=e.output,o=a-(t-e.avail_out),s=a+(e.avail_out-257),c=n.dmax,l=n.wsize,u=n.whave,d=n.wnext,f=n.window,p=n.hold,m=n.bits,h=n.lencode,g=n.distcode,_=(1<>>24,p>>>=b,m-=b,b=y>>>16&255,b===0)E[a++]=y&65535;else if(b&16){x=y&65535,b&=15,b&&(m>>=b,m-=b),m<15&&(p+=T[r++]<>>24,p>>>=b,m-=b,b=y>>>16&255,b&16){if(S=y&65535,b&=15,mc){e.msg=`invalid distance too far back`,n.mode=30;break top}if(p>>>=b,m-=b,b=a-o,S>b){if(b=S-b,b>u&&n.sane){e.msg=`invalid distance too far back`,n.mode=30;break top}if(C=0,w=f,d===0){if(C+=l-b,b2;)E[a++]=w[C++],E[a++]=w[C++],E[a++]=w[C++],x-=3;x&&(E[a++]=w[C++],x>1&&(E[a++]=w[C++]))}else{C=a-S;do E[a++]=E[C++],E[a++]=E[C++],E[a++]=E[C++],x-=3;while(x>2);x&&(E[a++]=E[C++],x>1&&(E[a++]=E[C++]))}}else if(b&64){e.msg=`invalid distance code`,n.mode=30;break top}else{y=g[(y&65535)+(p&(1<>3,r-=x,m-=x<<3,p&=(1<{var n=ec(),r=15,i=852,a=592,o=0,s=1,c=2,l=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],u=[16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78],d=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0],f=[16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64];t.exports=function(e,t,p,m,h,g,_,v){var y=v.bits,b=0,x=0,S=0,C=0,w=0,T=0,E=0,D=0,O=0,k=0,ee,A,j,te,ne,re=null,ie=0,ae,oe=new n.Buf16(r+1),se=new n.Buf16(r+1),ce=null,le=0,ue,M,N;for(b=0;b<=r;b++)oe[b]=0;for(x=0;x=1&&oe[C]===0;C--);if(w>C&&(w=C),C===0)return h[g++]=20971520,h[g++]=20971520,v.bits=1,0;for(S=1;S0&&(e===o||C!==1))return-1;for(se[1]=0,b=1;bi||e===c&&O>a)return 1;for(;;){ue=b-E,_[x]ae?(M=ce[le+_[x]],N=re[ie+_[x]]):(M=96,N=0),ee=1<>E)+A]=ue<<24|M<<16|N|0;while(A!==0);for(ee=1<>=1;if(ee===0?k=0:(k&=ee-1,k+=ee),x++,--oe[b]===0){if(b===C)break;b=t[p+_[x]]}if(b>w&&(k&te)!==j){for(E===0&&(E=w),ne+=S,T=b-E,D=1<i||e===c&&O>a)return 1;j=k&te,h[j]=w<<24|T<<16|ne-g|0}}return k!==0&&(h[ne+k]=b-E<<24|4194304),v.bits=w,0}})),dc=o((e=>{var t=ec(),n=nc(),r=rc(),i=lc(),a=uc(),o=0,s=1,c=2,l=4,u=5,d=6,f=0,p=1,m=2,h=-2,g=-3,_=-4,v=-5,y=8,b=1,x=2,S=3,C=4,w=5,T=6,E=7,D=8,O=9,k=10,ee=11,A=12,j=13,te=14,ne=15,re=16,ie=17,ae=18,oe=19,se=20,ce=21,le=22,ue=23,M=24,N=25,de=26,fe=27,pe=28,me=29,he=30,ge=31,_e=32,ve=852,P=592,ye=15;function be(e){return(e>>>24&255)+(e>>>8&65280)+((e&65280)<<8)+((e&255)<<24)}function xe(){this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new t.Buf16(320),this.work=new t.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function F(e){var n;return!e||!e.state?h:(n=e.state,e.total_in=e.total_out=n.total=0,e.msg=``,n.wrap&&(e.adler=n.wrap&1),n.mode=b,n.last=0,n.havedict=0,n.dmax=32768,n.head=null,n.hold=0,n.bits=0,n.lencode=n.lendyn=new t.Buf32(ve),n.distcode=n.distdyn=new t.Buf32(P),n.sane=1,n.back=-1,f)}function Se(e){var t;return!e||!e.state?h:(t=e.state,t.wsize=0,t.whave=0,t.wnext=0,F(e))}function I(e,t){var n,r;return!e||!e.state||(r=e.state,t<0?(n=0,t=-t):(n=(t>>4)+1,t<48&&(t&=15)),t&&(t<8||t>15))?h:(r.window!==null&&r.wbits!==t&&(r.window=null),r.wrap=n,r.wbits=t,Se(e))}function Ce(e,t){var n,r;return e?(r=new xe,e.state=r,r.window=null,n=I(e,t),n!==f&&(e.state=null),n):h}function L(e){return Ce(e,ye)}var R=!0,we,Te;function Ee(e){if(R){var n;for(we=new t.Buf32(512),Te=new t.Buf32(32),n=0;n<144;)e.lens[n++]=8;for(;n<256;)e.lens[n++]=9;for(;n<280;)e.lens[n++]=7;for(;n<288;)e.lens[n++]=8;for(a(s,e.lens,0,288,we,0,e.work,{bits:9}),n=0;n<32;)e.lens[n++]=5;a(c,e.lens,0,32,Te,0,e.work,{bits:5}),R=!1}e.lencode=we,e.lenbits=9,e.distcode=Te,e.distbits=5}function De(e,n,r,i){var a,o=e.state;return o.window===null&&(o.wsize=1<=o.wsize?(t.arraySet(o.window,n,r-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):(a=o.wsize-o.wnext,a>i&&(a=i),t.arraySet(o.window,n,r-i,a,o.wnext),i-=a,i?(t.arraySet(o.window,n,r-i,i,0),o.wnext=i,o.whave=o.wsize):(o.wnext+=a,o.wnext===o.wsize&&(o.wnext=0),o.whave>>8&255,P.check=r(P.check,ze,2,0),L=0,R=0,P.mode=x;break}if(P.flags=0,P.head&&(P.head.done=!1),!(P.wrap&1)||(((L&255)<<8)+(L>>8))%31){e.msg=`incorrect header check`,P.mode=he;break}if((L&15)!==y){e.msg=`unknown compression method`,P.mode=he;break}if(L>>>=4,R-=4,Le=(L&15)+8,P.wbits===0)P.wbits=Le;else if(Le>P.wbits){e.msg=`invalid window size`,P.mode=he;break}P.dmax=1<>8&1),P.flags&512&&(ze[0]=L&255,ze[1]=L>>>8&255,P.check=r(P.check,ze,2,0)),L=0,R=0,P.mode=S;case S:for(;R<32;){if(I===0)break inf_leave;I--,L+=ye[F++]<>>8&255,ze[2]=L>>>16&255,ze[3]=L>>>24&255,P.check=r(P.check,ze,4,0)),L=0,R=0,P.mode=C;case C:for(;R<16;){if(I===0)break inf_leave;I--,L+=ye[F++]<>8),P.flags&512&&(ze[0]=L&255,ze[1]=L>>>8&255,P.check=r(P.check,ze,2,0)),L=0,R=0,P.mode=w;case w:if(P.flags&1024){for(;R<16;){if(I===0)break inf_leave;I--,L+=ye[F++]<>>8&255,P.check=r(P.check,ze,2,0)),L=0,R=0}else P.head&&(P.head.extra=null);P.mode=T;case T:if(P.flags&1024&&(z=P.length,z>I&&(z=I),z&&(P.head&&(Le=P.head.extra_len-P.length,P.head.extra||(P.head.extra=Array(P.head.extra_len)),t.arraySet(P.head.extra,ye,F,z,Le)),P.flags&512&&(P.check=r(P.check,ye,z,F)),I-=z,F+=z,P.length-=z),P.length))break inf_leave;P.length=0,P.mode=E;case E:if(P.flags&2048){if(I===0)break inf_leave;z=0;do Le=ye[F+z++],P.head&&Le&&P.length<65536&&(P.head.name+=String.fromCharCode(Le));while(Le&&z>9&1,P.head.done=!0),e.adler=P.check=0,P.mode=A;break;case k:for(;R<32;){if(I===0)break inf_leave;I--,L+=ye[F++]<>>=R&7,R-=R&7,P.mode=fe;break}for(;R<3;){if(I===0)break inf_leave;I--,L+=ye[F++]<>>=1,--R,L&3){case 0:P.mode=te;break;case 1:if(Ee(P),P.mode=se,ve===d){L>>>=2,R-=2;break inf_leave}break;case 2:P.mode=ie;break;case 3:e.msg=`invalid block type`,P.mode=he}L>>>=2,R-=2;break;case te:for(L>>>=R&7,R-=R&7;R<32;){if(I===0)break inf_leave;I--,L+=ye[F++]<>>16^65535)){e.msg=`invalid stored block lengths`,P.mode=he;break}if(P.length=L&65535,L=0,R=0,P.mode=ne,ve===d)break inf_leave;case ne:P.mode=re;case re:if(z=P.length,z){if(z>I&&(z=I),z>Ce&&(z=Ce),z===0)break inf_leave;t.arraySet(xe,ye,F,z,Se),I-=z,F+=z,Ce-=z,Se+=z,P.length-=z;break}P.mode=A;break;case ie:for(;R<14;){if(I===0)break inf_leave;I--,L+=ye[F++]<>>=5,R-=5,P.ndist=(L&31)+1,L>>>=5,R-=5,P.ncode=(L&15)+4,L>>>=4,R-=4,P.nlen>286||P.ndist>30){e.msg=`too many length or distance symbols`,P.mode=he;break}P.have=0,P.mode=ae;case ae:for(;P.have>>=3,R-=3}for(;P.have<19;)P.lens[He[P.have++]]=0;if(P.lencode=P.lendyn,P.lenbits=7,Be={bits:P.lenbits},Re=a(o,P.lens,0,19,P.lencode,0,P.work,Be),P.lenbits=Be.bits,Re){e.msg=`invalid code lengths set`,P.mode=he;break}P.have=0,P.mode=oe;case oe:for(;P.have>>24,Me=Ae>>>16&255,Ne=Ae&65535,!(je<=R);){if(I===0)break inf_leave;I--,L+=ye[F++]<>>=je,R-=je,P.lens[P.have++]=Ne;else{if(Ne===16){for(Ve=je+2;R>>=je,R-=je,P.have===0){e.msg=`invalid bit length repeat`,P.mode=he;break}Le=P.lens[P.have-1],z=3+(L&3),L>>>=2,R-=2}else if(Ne===17){for(Ve=je+3;R>>=je,R-=je,Le=0,z=3+(L&7),L>>>=3,R-=3}else{for(Ve=je+7;R>>=je,R-=je,Le=0,z=11+(L&127),L>>>=7,R-=7}if(P.have+z>P.nlen+P.ndist){e.msg=`invalid bit length repeat`,P.mode=he;break}for(;z--;)P.lens[P.have++]=Le}}if(P.mode===he)break;if(P.lens[256]===0){e.msg=`invalid code -- missing end-of-block`,P.mode=he;break}if(P.lenbits=9,Be={bits:P.lenbits},Re=a(s,P.lens,0,P.nlen,P.lencode,0,P.work,Be),P.lenbits=Be.bits,Re){e.msg=`invalid literal/lengths set`,P.mode=he;break}if(P.distbits=6,P.distcode=P.distdyn,Be={bits:P.distbits},Re=a(c,P.lens,P.nlen,P.ndist,P.distcode,0,P.work,Be),P.distbits=Be.bits,Re){e.msg=`invalid distances set`,P.mode=he;break}if(P.mode=se,ve===d)break inf_leave;case se:P.mode=ce;case ce:if(I>=6&&Ce>=258){e.next_out=Se,e.avail_out=Ce,e.next_in=F,e.avail_in=I,P.hold=L,P.bits=R,i(e,Te),Se=e.next_out,xe=e.output,Ce=e.avail_out,F=e.next_in,ye=e.input,I=e.avail_in,L=P.hold,R=P.bits,P.mode===A&&(P.back=-1);break}for(P.back=0;Ae=P.lencode[L&(1<>>24,Me=Ae>>>16&255,Ne=Ae&65535,!(je<=R);){if(I===0)break inf_leave;I--,L+=ye[F++]<>Pe)],je=Ae>>>24,Me=Ae>>>16&255,Ne=Ae&65535,!(Pe+je<=R);){if(I===0)break inf_leave;I--,L+=ye[F++]<>>=Pe,R-=Pe,P.back+=Pe}if(L>>>=je,R-=je,P.back+=je,P.length=Ne,Me===0){P.mode=de;break}if(Me&32){P.back=-1,P.mode=A;break}if(Me&64){e.msg=`invalid literal/length code`,P.mode=he;break}P.extra=Me&15,P.mode=le;case le:if(P.extra){for(Ve=P.extra;R>>=P.extra,R-=P.extra,P.back+=P.extra}P.was=P.length,P.mode=ue;case ue:for(;Ae=P.distcode[L&(1<>>24,Me=Ae>>>16&255,Ne=Ae&65535,!(je<=R);){if(I===0)break inf_leave;I--,L+=ye[F++]<>Pe)],je=Ae>>>24,Me=Ae>>>16&255,Ne=Ae&65535,!(Pe+je<=R);){if(I===0)break inf_leave;I--,L+=ye[F++]<>>=Pe,R-=Pe,P.back+=Pe}if(L>>>=je,R-=je,P.back+=je,Me&64){e.msg=`invalid distance code`,P.mode=he;break}P.offset=Ne,P.extra=Me&15,P.mode=M;case M:if(P.extra){for(Ve=P.extra;R>>=P.extra,R-=P.extra,P.back+=P.extra}if(P.offset>P.dmax){e.msg=`invalid distance too far back`,P.mode=he;break}P.mode=N;case N:if(Ce===0)break inf_leave;if(z=Te-Ce,P.offset>z){if(z=P.offset-z,z>P.whave&&P.sane){e.msg=`invalid distance too far back`,P.mode=he;break}z>P.wnext?(z-=P.wnext,Oe=P.wsize-z):Oe=P.wnext-z,z>P.length&&(z=P.length),ke=P.window}else ke=xe,Oe=Se-P.offset,z=P.length;z>Ce&&(z=Ce),Ce-=z,P.length-=z;do xe[Se++]=ke[Oe++];while(--z);P.length===0&&(P.mode=ce);break;case de:if(Ce===0)break inf_leave;xe[Se++]=P.length,Ce--,P.mode=ce;break;case fe:if(P.wrap){for(;R<32;){if(I===0)break inf_leave;I--,L|=ye[F++]<{t.exports={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8}})),pc=o(((e,t)=>{function n(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name=``,this.comment=``,this.hcrc=0,this.done=!1}t.exports=n})),mc=o((e=>{var t=dc(),n=ec(),r=oc(),i=fc(),a=ic(),o=sc(),s=pc(),c=Object.prototype.toString;function l(e){if(!(this instanceof l))return new l(e);this.options=n.assign({chunkSize:16384,windowBits:0,to:``},e||{});var u=this.options;u.raw&&u.windowBits>=0&&u.windowBits<16&&(u.windowBits=-u.windowBits,u.windowBits===0&&(u.windowBits=-15)),u.windowBits>=0&&u.windowBits<16&&!(e&&e.windowBits)&&(u.windowBits+=32),u.windowBits>15&&u.windowBits<48&&(u.windowBits&15||(u.windowBits|=15)),this.err=0,this.msg=``,this.ended=!1,this.chunks=[],this.strm=new o,this.strm.avail_out=0;var d=t.inflateInit2(this.strm,u.windowBits);if(d!==i.Z_OK||(this.header=new s,t.inflateGetHeader(this.strm,this.header),u.dictionary&&(typeof u.dictionary==`string`?u.dictionary=r.string2buf(u.dictionary):c.call(u.dictionary)===`[object ArrayBuffer]`&&(u.dictionary=new Uint8Array(u.dictionary)),u.raw&&(d=t.inflateSetDictionary(this.strm,u.dictionary),d!==i.Z_OK))))throw Error(a[d])}l.prototype.push=function(e,a){var o=this.strm,s=this.options.chunkSize,l=this.options.dictionary,u,d,f,p,m,h=!1;if(this.ended)return!1;d=a===~~a?a:a===!0?i.Z_FINISH:i.Z_NO_FLUSH,typeof e==`string`?o.input=r.binstring2buf(e):c.call(e)===`[object ArrayBuffer]`?o.input=new Uint8Array(e):o.input=e,o.next_in=0,o.avail_in=o.input.length;do{if(o.avail_out===0&&(o.output=new n.Buf8(s),o.next_out=0,o.avail_out=s),u=t.inflate(o,i.Z_NO_FLUSH),u===i.Z_NEED_DICT&&l&&(u=t.inflateSetDictionary(this.strm,l)),u===i.Z_BUF_ERROR&&h===!0&&(u=i.Z_OK,h=!1),u!==i.Z_STREAM_END&&u!==i.Z_OK)return this.onEnd(u),this.ended=!0,!1;o.next_out&&(o.avail_out===0||u===i.Z_STREAM_END||o.avail_in===0&&(d===i.Z_FINISH||d===i.Z_SYNC_FLUSH))&&(this.options.to===`string`?(f=r.utf8border(o.output,o.next_out),p=o.next_out-f,m=r.buf2string(o.output,f),o.next_out=p,o.avail_out=s-p,p&&n.arraySet(o.output,o.output,f,p,0),this.onData(m)):this.onData(n.shrinkBuf(o.output,o.next_out))),o.avail_in===0&&o.avail_out===0&&(h=!0)}while((o.avail_in>0||o.avail_out===0)&&u!==i.Z_STREAM_END);return u===i.Z_STREAM_END&&(d=i.Z_FINISH),d===i.Z_FINISH?(u=t.inflateEnd(this.strm),this.onEnd(u),this.ended=!0,u===i.Z_OK):d===i.Z_SYNC_FLUSH?(this.onEnd(i.Z_OK),o.avail_out=0,!0):!0},l.prototype.onData=function(e){this.chunks.push(e)},l.prototype.onEnd=function(e){e===i.Z_OK&&(this.options.to===`string`?this.result=this.chunks.join(``):this.result=n.flattenChunks(this.chunks)),this.chunks=[],this.err=e,this.msg=this.strm.msg};function u(e,t){var n=new l(t);if(n.push(e,!0),n.err)throw n.msg||a[n.err];return n.result}function d(e,t){return t=t||{},t.raw=!0,u(e,t)}e.Inflate=l,e.inflate=u,e.inflateRaw=d,e.ungzip=u})),hc=c(o(((e,t)=>{var n=ec().assign,r=cc(),i=mc(),a=fc(),o={};n(o,r,i,a),t.exports=o}))()),gc=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,_c=new Uint8Array(256),vc=0;vc>4,l[i++]=(o&15)<<4|s>>2,l[i++]=(s&3)<<6|c&63;return l},bc=function(e){for(var t=``,n=0;nr)throw Error(Fc(t)+` must be at least `+n+` and at most `+r+`, but was actually `+e)},qc=function(e,t,n,r){W(e,t,[`number`,`undefined`]),typeof e==`number`&&Kc(e,t,n,r)},Jc=function(e,t,n){if(W(e,t,[`number`]),e%n!==0)throw Error(Fc(t)+` must be a multiple of `+n+`, but was actually `+e)},Yc=function(e,t){if(!Number.isInteger(e))throw Error(Fc(t)+` must be an integer, but was actually `+e)},Xc=function(e,t){if(![1,0].includes(Math.sign(e)))throw Error(Fc(t)+` must be a positive number or 0, but was actually `+e)},Zc=new Uint16Array(256),Qc=0;Qc<256;Qc++)Zc[Qc]=Qc;Zc[22]=es(``),Zc[24]=es(`˘`),Zc[25]=es(`ˇ`),Zc[26]=es(`ˆ`),Zc[27]=es(`˙`),Zc[28]=es(`˝`),Zc[29]=es(`˛`),Zc[30]=es(`˚`),Zc[31]=es(`˜`),Zc[127]=es(`�`),Zc[128]=es(`•`),Zc[129]=es(`†`),Zc[130]=es(`‡`),Zc[131]=es(`…`),Zc[132]=es(`—`),Zc[133]=es(`–`),Zc[134]=es(`ƒ`),Zc[135]=es(`⁄`),Zc[136]=es(`‹`),Zc[137]=es(`›`),Zc[138]=es(`−`),Zc[139]=es(`‰`),Zc[140]=es(`„`),Zc[141]=es(`“`),Zc[142]=es(`”`),Zc[143]=es(`‘`),Zc[144]=es(`’`),Zc[145]=es(`‚`),Zc[146]=es(`™`),Zc[147]=es(`fi`),Zc[148]=es(`fl`),Zc[149]=es(`Ł`),Zc[150]=es(`Œ`),Zc[151]=es(`Š`),Zc[152]=es(`Ÿ`),Zc[153]=es(`Ž`),Zc[154]=es(`ı`),Zc[155]=es(`ł`),Zc[156]=es(`œ`),Zc[157]=es(`š`),Zc[158]=es(`ž`),Zc[159]=es(`�`),Zc[160]=es(`€`),Zc[173]=es(`�`);var $c=function(e){for(var t=Array(e.length),n=0,r=e.length;n=K.ExclamationPoint&&e<=K.Tilde&&!Il[e]},Vl={},Hl=new Map,J=function(e){U(t,e);function t(t,n){var r=this;if(t!==Vl)throw new nl(`PDFName`);r=e.call(this)||this;for(var i=`/`,a=0,o=n.length;a=K.Zero&&s<=K.Nine||s>=K.a&&s<=K.f||s>=K.A&&s<=K.F?(t+=o,(t.length===2||!(c>=`0`&&c<=`9`||c>=`a`&&c<=`f`||c>=`A`&&c<=`F`))&&(r(parseInt(t,16)),t=``)):r(s):s===K.Hash?n=!0:r(s)}return new Uint8Array(e)},t.prototype.decodeText=function(){var e=this.asBytes();return String.fromCharCode.apply(String,Array.from(e))},t.prototype.asString=function(){return this.encodedName},t.prototype.value=function(){return this.encodedName},t.prototype.clone=function(){return this},t.prototype.toString=function(){return this.encodedName},t.prototype.sizeInBytes=function(){return this.encodedName.length},t.prototype.copyBytesInto=function(e,t){return t+=ss(this.encodedName,e,t),this.encodedName.length},t.of=function(e){var n=zl(e),r=Hl.get(n);return r||(r=new t(Vl,n),Hl.set(n,r)),r},t.Length=t.of(`Length`),t.FlateDecode=t.of(`FlateDecode`),t.Resources=t.of(`Resources`),t.Font=t.of(`Font`),t.XObject=t.of(`XObject`),t.ExtGState=t.of(`ExtGState`),t.Contents=t.of(`Contents`),t.Type=t.of(`Type`),t.Parent=t.of(`Parent`),t.MediaBox=t.of(`MediaBox`),t.Page=t.of(`Page`),t.Annots=t.of(`Annots`),t.TrimBox=t.of(`TrimBox`),t.ArtBox=t.of(`ArtBox`),t.BleedBox=t.of(`BleedBox`),t.CropBox=t.of(`CropBox`),t.Rotate=t.of(`Rotate`),t.Title=t.of(`Title`),t.Author=t.of(`Author`),t.Subject=t.of(`Subject`),t.Creator=t.of(`Creator`),t.Keywords=t.of(`Keywords`),t.Producer=t.of(`Producer`),t.CreationDate=t.of(`CreationDate`),t.ModDate=t.of(`ModDate`),t}(Al),Ul=new(function(e){U(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.asNull=function(){return null},t.prototype.clone=function(){return this},t.prototype.toString=function(){return`null`},t.prototype.sizeInBytes=function(){return 4},t.prototype.copyBytesInto=function(e,t){return e[t++]=K.n,e[t++]=K.u,e[t++]=K.l,e[t++]=K.l,4},t}(Al)),Wl=function(e){U(t,e);function t(t,n){var r=e.call(this)||this;return r.dict=t,r.context=n,r}return t.prototype.keys=function(){return Array.from(this.dict.keys())},t.prototype.values=function(){return Array.from(this.dict.values())},t.prototype.entries=function(){return Array.from(this.dict.entries())},t.prototype.set=function(e,t){this.dict.set(e,t)},t.prototype.get=function(e,t){t===void 0&&(t=!1);var n=this.dict.get(e);if(!(n===Ul&&!t))return n},t.prototype.has=function(e){var t=this.dict.get(e);return t!==void 0&&t!==Ul},t.prototype.lookupMaybe=function(e){for(var t,n=[],r=1;r>`,e},t.prototype.sizeInBytes=function(){for(var e=5,t=this.entries(),n=0,r=t.length;nthis.largestObjectNumber&&(this.largestObjectNumber=e.objectNumber)},e.prototype.nextRef=function(){return this.largestObjectNumber+=1,Yl.of(this.largestObjectNumber)},e.prototype.register=function(e){var t=this.nextRef();return this.assign(t,e),t},e.prototype.delete=function(e){return this.indirectObjects.delete(e)},e.prototype.lookupMaybe=function(e){for(var t=[],n=1;n1?(this.subsections.push([e]),this.chunkIdx+=1,this.chunkLength=1):(t.push(e),this.chunkLength+=1)},e.create=function(){return new e({ref:Yl.of(0,65535),offset:0,deleted:!0})},e.createEmpty=function(){return new e},e}(),su=function(){function e(e){this.lastXRefOffset=String(e)}return e.prototype.toString=function(){return`startxref `+this.lastXRefOffset+` %%EOF`},e.prototype.sizeInBytes=function(){return 16+this.lastXRefOffset.length},e.prototype.copyBytesInto=function(e,t){var n=t;return e[t++]=K.s,e[t++]=K.t,e[t++]=K.a,e[t++]=K.r,e[t++]=K.t,e[t++]=K.x,e[t++]=K.r,e[t++]=K.e,e[t++]=K.f,e[t++]=K.Newline,t+=ss(this.lastXRefOffset,e,t),e[t++]=K.Newline,e[t++]=K.Percent,e[t++]=K.Percent,e[t++]=K.E,e[t++]=K.O,e[t++]=K.F,t-n},e.forLastCrossRefSectionOffset=function(t){return new e(t)},e}(),cu=function(){function e(e){this.dict=e}return e.prototype.toString=function(){return`trailer `+this.dict.toString()},e.prototype.sizeInBytes=function(){return 8+this.dict.sizeInBytes()},e.prototype.copyBytesInto=function(e,t){var n=t;return e[t++]=K.t,e[t++]=K.r,e[t++]=K.a,e[t++]=K.i,e[t++]=K.l,e[t++]=K.e,e[t++]=K.r,e[t++]=K.Newline,t+=this.dict.copyBytesInto(e,t),t-n},e.of=function(t){return new e(t)},e}(),lu=function(e){U(t,e);function t(t,n,r){r===void 0&&(r=!0);var i=e.call(this,t.obj({}),r)||this;return i.objects=n,i.offsets=i.computeObjectOffsets(),i.offsetsString=i.computeOffsetsString(),i.dict.set(J.of(`Type`),J.of(`ObjStm`)),i.dict.set(J.of(`N`),q.of(i.objects.length)),i.dict.set(J.of(`First`),q.of(i.offsetsString.length)),i}return t.prototype.getObjectsCount=function(){return this.objects.length},t.prototype.clone=function(e){return t.withContextAndObjects(e||this.dict.context,this.objects.slice(),this.encode)},t.prototype.getContentsString=function(){for(var e=this.offsetsString,t=0,n=this.objects.length;t1&&(e.push(t),e.push(a.ref.objectNumber),t=0),t+=1}return e.push(t),e},i.computeEntryTuples=function(){for(var e=Array(i.entries.length),t=0,n=i.entries.length;tt[0]&&(t[0]=l),u>t[1]&&(t[1]=u),d>t[2]&&(t[2]=d)}return t},i.entries=n||[],i.entryTuplesCache=el.populatedBy(i.computeEntryTuples),i.maxByteWidthsCache=el.populatedBy(i.computeMaxEntryByteWidths),i.indexCache=el.populatedBy(i.computeIndex),t.set(J.of(`Type`),J.of(`XRef`)),i}return t.prototype.addDeletedEntry=function(e,t){var n=fu.Deleted;this.entries.push({type:n,ref:e,nextFreeObjectNumber:t}),this.entryTuplesCache.invalidate(),this.maxByteWidthsCache.invalidate(),this.indexCache.invalidate(),this.contentsCache.invalidate()},t.prototype.addUncompressedEntry=function(e,t){var n=fu.Uncompressed;this.entries.push({type:n,ref:e,offset:t}),this.entryTuplesCache.invalidate(),this.maxByteWidthsCache.invalidate(),this.indexCache.invalidate(),this.contentsCache.invalidate()},t.prototype.addCompressedEntry=function(e,t,n){var r=fu.Compressed;this.entries.push({type:r,ref:e,objectStreamRef:t,index:n}),this.entryTuplesCache.invalidate(),this.maxByteWidthsCache.invalidate(),this.indexCache.invalidate(),this.contentsCache.invalidate()},t.prototype.clone=function(e){var n=this,r=n.dict,i=n.entries,a=n.encode;return t.of(r.clone(e),i.slice(),a)},t.prototype.getContentsString=function(){for(var e=this.entryTuplesCache.access(),t=this.maxByteWidthsCache.access(),n=``,r=0,i=e.length;r=0;f--)n+=(l[f]||0).toString(2);for(var f=t[1]-1;f>=0;f--)n+=(u[f]||0).toString(2);for(var f=t[2]-1;f>=0;f--)n+=(d[f]||0).toString(2)}return n},t.prototype.getUnencodedContents=function(){for(var e=this.entryTuplesCache.access(),t=this.maxByteWidthsCache.access(),n=new Uint8Array(this.getUnencodedContentsSize()),r=0,i=0,a=e.length;i=0;p--)n[r++]=u[p]||0;for(var p=t[1]-1;p>=0;p--)n[r++]=d[p]||0;for(var p=t[2]-1;p>=0;p--)n[r++]=f[p]||0}return n},t.prototype.getUnencodedContentsSize=function(){return ks(this.maxByteWidthsCache.access())*this.entries.length},t.prototype.updateDict=function(){e.prototype.updateDict.call(this);var t=this.maxByteWidthsCache.access(),n=this.indexCache.access(),r=this.dict.context;this.dict.set(J.of(`W`),r.obj(t)),this.dict.set(J.of(`Index`),r.obj(n))},t.create=function(e,n){n===void 0&&(n=!0);var r=new t(e,[],n);return r.addDeletedEntry(Yl.of(0,65535),0),r},t.of=function(e,n,r){return r===void 0&&(r=!0),new t(e,n,r)},t}($l),mu=function(e){U(t,e);function t(t,n,r,i){var a=e.call(this,t,n)||this;return a.encodeStreams=r,a.objectsPerStream=i,a}return t.prototype.computeBufferSize=function(){return Wo(this,void 0,void 0,function(){var e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,c,l,m,d,g,_,v,y;return Go(this,function(b){switch(b.label){case 0:e=this.context.largestObjectNumber+1,t=kl.forVersion(1,7),n=t.sizeInBytes()+2,r=pu.create(this.createTrailerDict(),this.encodeStreams),i=[],a=[],o=[],s=this.context.enumerateIndirectObjects(),c=0,l=s.length,b.label=1;case 1:return c`},t.prototype.sizeInBytes=function(){return this.value.length+2},t.prototype.copyBytesInto=function(e,t){return e[t++]=K.LessThan,t+=ss(this.value,e,t),e[t++]=K.GreaterThan,this.value.length+2},t.of=function(e){return new t(e)},t.fromText=function(e){for(var n=Fs(e),r=``,i=0,a=n.length;i> def /CMapName /Adobe-Identity-UCS def /CMapType 2 def 1 begincodespacerange <0000> endcodespacerange `+e.length+` beginbfchar `+e.map(function(e){var t=e[0],n=e[1];return t+` `+n}).join(` `)+` endbfchar endcmap CMapName currentdict /CMap defineresource pop end end`},vu=function(){for(var e=[],t=0;t`},yu=function(e){return ns(e,4)},bu=function(e){if(Is(e))return yu(e);if(Ls(e)){var t=Rs(e),n=zs(e);return``+yu(t)+yu(n)}var r=`0x`+rs(e)+` is not a valid UTF-8 or UTF-16 codepoint.`;throw Error(r)},xu=function(e){var t=0,n=function(e){t|=1<=K.Zero&&s<=K.Seven?(t+=o,(t.length===3||!(c>=`0`&&c<=`7`))&&(r(parseInt(t,8)),t=``)):r(s):s===K.BackSlash?n=!0:r(s)}return new Uint8Array(e)},t.prototype.decodeText=function(){var e=this.asBytes();return Ys(e)?Hs(e):$c(e)},t.prototype.decodeDate=function(){var e=this.decodeText(),t=ys(e);if(!t)throw new ul(e);return t},t.prototype.asString=function(){return this.value},t.prototype.clone=function(){return t.of(this.value)},t.prototype.toString=function(){return`(`+this.value+`)`},t.prototype.sizeInBytes=function(){return this.value.length+2},t.prototype.copyBytesInto=function(e,t){return e[t++]=K.LeftParen,t+=ss(this.value,e,t),e[t++]=K.RightParen,this.value.length+2},t.of=function(e){return new t(e)},t.fromDate=function(e){var n=os(String(e.getUTCFullYear()),4,`0`),r=os(String(e.getUTCMonth()+1),2,`0`),i=os(String(e.getUTCDate()),2,`0`),a=os(String(e.getUTCHours()),2,`0`),o=os(String(e.getUTCMinutes()),2,`0`),s=os(String(e.getUTCSeconds()),2,`0`);return new t(`D:`+n+r+i+a+o+s+`Z`)},t}(Al),wu=function(){function e(e,t,n,r){var i=this;this.allGlyphsInFontSortedById=function(){for(var e=Array(i.font.characterSet.length),t=0,n=e.length;t>3)]>>7-((p&7)<<0)&1,D=3*E;s[y]=b[D],s[y+1]=b[D+1],s[y+2]=b[D+2],s[y+3]=E>2)]>>6-((p&3)<<1)&3,D=3*E;s[y]=b[D],s[y+1]=b[D+1],s[y+2]=b[D+2],s[y+3]=E>1)]>>4-((p&1)<<2)&15,D=3*E;s[y]=b[D],s[y+1]=b[D+1],s[y+2]=b[D+2],s[y+3]=E>>3)]>>>7-(j&7)&1),te=k==g*255?0:255;c[A+j]=te<<24|k<<16|k<<8|k}else if(u==2)for(var j=0;j>>2)]>>>6-((j&3)<<1)&3),te=k==g*85?0:255;c[A+j]=te<<24|k<<16|k<<8|k}else if(u==4)for(var j=0;j>>1)]>>>4-((j&1)<<2)&15),te=k==g*17?0:255;c[A+j]=te<<24|k<<16|k<<8|k}else if(u==8)for(var j=0;j>>2<<3));i==0;){if(i=g(t,f,1),a=g(t,f+1,2),f+=3,a==0){f&7&&(f+=8-(f&7));var w=(f>>>3)+4,T=t[w-4]|t[w-3]<<8;C&&(n=e.H.W(n,d+T)),n.set(new r(t.buffer,t.byteOffset+w,T),d),f=w+T<<3,d+=T;continue}if(C&&(n=e.H.W(n,d+(1<<17))),a==1&&(p=S.J,m=S.h,l=511,u=31),a==2){o=_(t,f,5)+257,s=_(t,f+5,5)+1,c=_(t,f+10,4)+4,f+=14;for(var E=1,D=0;D<38;D+=2)S.Q[D]=0,S.Q[D+1]=0;for(var D=0;DE&&(E=O)}f+=3*c,y(S.Q,E),b(S.Q,E,S.u),p=S.w,m=S.d,f=v(S.u,(1<>>4;if(!(j>>>8))n[d++]=j;else if(j==256)break;else{var te=d+j-254;if(j>264){var ne=S.q[j-257];te=d+(ne>>>3)+_(t,f,ne&7),f+=ne&7}var re=m[x(t,f)&u];f+=re&15;var ie=re>>>4,ae=S.c[ie],oe=(ae>>>4)+g(t,f,ae&15);for(f+=ae&15;d>>4;if(d<=15)o[l]=d,l++;else{var f=0,p=0;d==16?(p=3+s(i,a,2),a+=2,f=o[l-1]):d==17?(p=3+s(i,a,3),a+=3):d==18&&(p=11+s(i,a,7),a+=7);for(var m=l+p;l>>1;ai&&(i=s),a++}for(;a>1,c=t[o+1],l=s<<4|c,u=n-c,d=t[o]<>>15-n;r[p]=l,d++}},e.H.l=function(t,n){for(var r=e.H.m.r,i=15-n,a=0;a>>i},e.H.M=function(e,t,n){n<<=t&7;var r=t>>>3;e[r]|=n,e[r+1]|=n>>>8},e.H.I=function(e,t,n){n<<=t&7;var r=t>>>3;e[r]|=n,e[r+1]|=n>>>8,e[r+2]|=n>>>16},e.H.e=function(e,t,n){return(e[t>>>3]|e[(t>>>3)+1]<<8)>>>(t&7)&(1<>>3]|e[(t>>>3)+1]<<8|e[(t>>>3)+2]<<16)>>>(t&7)&(1<>>3]|e[(t>>>3)+1]<<8|e[(t>>>3)+2]<<16)>>>(t&7)},e.H.i=function(e,t){return(e[t>>>3]|e[(t>>>3)+1]<<8|e[(t>>>3)+2]<<16|e[(t>>>3)+3]<<24)>>>(t&7)},e.H.m=function(){var e=Uint16Array,t=Uint32Array;return{K:new e(16),j:new e(16),X:[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],S:[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,999,999,999],T:[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0],q:new e(32),p:[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,65535,65535],z:[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0],c:new t(32),J:new e(512),_:[],h:new e(32),$:[],w:new e(32768),C:[],v:[],d:new e(32768),D:[],u:new e(512),Q:[],r:new e(32768),s:new t(286),Y:new t(30),a:new t(19),t:new t(15e3),k:new e(65536),g:new e(32768)}}(),(function(){for(var t=e.H.m,n=32768,r=0;r>>1|(i&1431655765)<<1,i=(i&3435973836)>>>2|(i&858993459)<<2,i=(i&4042322160)>>>4|(i&252645135)<<4,i=(i&4278255360)>>>8|(i&16711935)<<8,t.r[r]=(i>>>16|i<<16)>>>17}function a(e,t,n){for(;t--!=0;)e.push(0,n)}for(var r=0;r<32;r++)t.q[r]=t.S[r]<<3|t.T[r],t.c[r]=t.p[r]<<4|t.z[r];a(t._,144,8),a(t._,112,9),a(t._,24,7),a(t._,8,8),e.H.n(t._,9),e.H.A(t._,9,t.J),e.H.l(t._,9),a(t.$,32,5),e.H.n(t.$,5),e.H.A(t.$,5,t.h),e.H.l(t.$,5),a(t.Q,19,0),a(t.C,286,0),a(t.D,30,0),a(t.v,320,0)})(),e.H.N}(),X.decode._readInterlace=function(e,t){for(var n=t.width,r=t.height,i=X.decode._getBPP(t),a=i>>3,o=Math.ceil(n*i/8),s=new Uint8Array(r*o),c=0,l=[0,0,4,0,2,0,1],u=[0,4,0,2,0,1,0],d=[8,8,8,4,4,2,2],f=[8,8,4,4,2,2,1],p=0;p<7;){for(var m=d[p],h=f[p],g=0,_=0,v=l[p];v>3];T=T>>7-(w&7)&1,s[S*o+(C>>3)]|=T<<7-((C&7)<<0)}if(i==2){var T=e[w>>3];T=T>>6-(w&7)&3,s[S*o+(C>>2)]|=T<<6-((C&3)<<1)}if(i==4){var T=e[w>>3];T=T>>4-(w&7)&15,s[S*o+(C>>1)]|=T<<4-((C&1)<<2)}if(i>=8)for(var E=S*o+C*a,D=0;D>3)+D];w+=i,C+=h}x++,S+=m}g*_!=0&&(c+=_*(1+b)),p+=1}return s},X.decode._getBPP=function(e){return[1,null,3,1,2,null,4][e.ctype]*e.depth},X.decode._filterZero=function(e,t,n,r,i){var a=X.decode._getBPP(t),o=Math.ceil(r*a/8),s=X.decode._paeth;a=Math.ceil(a/8);var c=0,l=1,u=e[n],d=0;if(u>1&&(e[n]=[0,0,1][u-2]),u==3)for(d=a;d>>1)&255;for(var f=0;f>>1);for(;d>>1)}else{for(;d>8&255,e[t+1]=n&255},readUint:function(e,t){return e[t]*(256*256*256)+(e[t+1]<<16|e[t+2]<<8|e[t+3])},writeUint:function(e,t,n){e[t]=n>>24&255,e[t+1]=n>>16&255,e[t+2]=n>>8&255,e[t+3]=n&255},readASCII:function(e,t,n){for(var r=``,i=0;i=0&&s>=0?(d=p*t+m<<2,f=(s+p)*i+o+m<<2):(d=(-s+p)*t-o+m<<2,f=p*i+m<<2),c==0)r[f]=e[d],r[f+1]=e[d+1],r[f+2]=e[d+2],r[f+3]=e[d+3];else if(c==1){var h=e[d+3]*(1/255),g=e[d]*h,_=e[d+1]*h,v=e[d+2]*h,y=r[f+3]*(1/255),b=r[f]*y,x=r[f+1]*y,S=r[f+2]*y,C=1-h,w=h+y*C,T=w==0?0:1/w;r[f+3]=255*w,r[f+0]=(g+b*C)*T,r[f+1]=(_+x*C)*T,r[f+2]=(v+S*C)*T}else if(c==2){var h=e[d+3],g=e[d],_=e[d+1],v=e[d+2],y=r[f+3],b=r[f],x=r[f+1],S=r[f+2];h==y&&g==b&&_==x&&v==S?(r[f]=0,r[f+1]=0,r[f+2]=0,r[f+3]=0):(r[f]=g,r[f+1]=_,r[f+2]=v,r[f+3]=h)}else if(c==3){var h=e[d+3],g=e[d],_=e[d+1],v=e[d+2],y=r[f+3],b=r[f],x=r[f+1],S=r[f+2];if(h==y&&g==b&&_==x&&v==S)continue;if(h<220&&y>20)return!1}return!0},X.encode=function(e,t,n,r,i,a,o){r??(r=0),o??(o=!1);var s=X.encode.compress(e,t,n,r,[!1,!1,!1,0,o]);return X.encode.compressPNG(s,-1),X.encode._main(s,t,n,i,a)},X.encodeLL=function(e,t,n,r,i,a,o,s){for(var c={ctype:0+(r==1?0:2)+(i==0?0:4),depth:a,frames:[]},l=(r+i)*a,u=l*t,d=0;d1,d=!1,f=33+(u?20:0);if(i.sRGB!=null&&(f+=13),i.pHYs!=null&&(f+=21),e.ctype==3){for(var p=e.plte.length,m=0;m>>24!=255&&(d=!0);f+=8+p*3+4+(d?8+p*1+4:0)}for(var h=0;h>>8&255,C=b>>>16&255;_[l+y+0]=x,_[l+y+1]=S,_[l+y+2]=C}if(l+=p*3,o(_,l,a(_,l-p*3-4,p*3+4)),l+=4,d){o(_,l,p),l+=4,c(_,l,`tRNS`),l+=4;for(var m=0;m>>24&255;l+=p,o(_,l,a(_,l-p-4,p+4)),l+=4}}for(var w=0,h=0;h>2,O>>2));for(var p=0;pA&&te==ee[g-A])j[g]=j[g-A];else{var ne=y[te];if(ne==null&&(y[te]=ne=b.length,b.push(te),b.length>=300))break;j[g]=ne}}}var re=b.length;re<=256&&l==0&&(d=re<=2?1:re<=4?2:re<=16?4:8,d=Math.max(d,c));for(var p=0;p>1)]|=le[M+N]<<4-(N&1)*4;else if(d==2)for(var N=0;N>2)]|=le[M+N]<<6-(N&3)*2;else if(d==1)for(var N=0;N>3)]|=le[M+N]<<7-(N&7)*1}ae=ce,u=3,se=1}else if(_==0&&v.length==1){for(var ce=new Uint8Array(A*ie*3),de=A*ie,g=0;gw&&(w=D),ET&&(T=E))}w==-1&&(S=C=w=T=0),i&&((S&1)==1&&S--,(C&1)==1&&C--);var k=(w-S+1)*(T-C+1);kg&&(g=b),x_&&(_=x))}g==-1&&(m=h=g=_=0),o&&((m&1)==1&&m--,(h&1)==1&&h--),a={x:m,y:h,width:g-m+1,height:_-h+1};var w=r[i];w.rect=a,w.blend=1,w.img=new Uint8Array(a.width*a.height*4),r[i-1].dispose==0?(X._copyTile(l,t,n,w.img,a.width,a.height,-a.x,-a.y,0),X.encode._prepareDiff(f,t,n,w.img,a)):X._copyTile(f,t,n,w.img,a.width,a.height,-a.x,-a.y,0)},X.encode._prepareDiff=function(e,t,n,r,i){X._copyTile(e,t,n,r,i.width,i.height,-i.x,-i.y,2)},X.encode._filterZero=function(e,t,n,r,i,a,o){var s=[],c=[0,1,2,3,4];a==-1?(t*r>5e5||n==1)&&(c=[0]):c=[a];var l;o&&(l={level:0});for(var u=o&&UZIP!=null?UZIP:hc.default,d=0;d>1)+256&255;if(a==4)for(var l=i;l>1)&255;for(var l=i;l>1)&255}if(a==4){for(var l=0;l>>1:n>>>=1;e[t]=n}return e})(),update:function(e,t,n,r){for(var i=0;i>>8;return e},crc:function(e,t,n){return X.crc.update(4294967295,e,t,n)^4294967295}},X.quantize=function(e,t){var n=new Uint8Array(e),r=n.slice(0),i=new Uint32Array(r.buffer),a=X.quantize.getKDtree(r,t),o=a[0],s=a[1];X.quantize.planeDst;for(var c=n,l=i,u=c.length,d=new Uint8Array(n.length>>2),f=0;f>2]=_.ind,l[f>>2]=_.est.rgba}return{abuf:r.buffer,inds:d,plte:s}},X.quantize.getKDtree=function(e,t,n){n??(n=1e-4);var r=new Uint32Array(e.buffer),i={i0:0,i1:e.length,bst:null,est:null,tdst:0,left:null,right:null};i.bst=X.quantize.stats(e,i.i0,i.i1),i.est=X.quantize.estats(i.bst);for(var a=[i];a.lengtho&&(o=a[c].est.L,s=c);if(o=u||l.i1<=u){l.est.L=0;continue}var d={i0:l.i0,i1:u,bst:null,est:null,tdst:0,left:null,right:null};d.bst=X.quantize.stats(e,d.i0,d.i1),d.est=X.quantize.estats(d.bst);var f={i0:u,i1:l.i1,bst:null,est:null,tdst:0,left:null,right:null};f.bst={R:[],m:[],N:l.bst.N-d.bst.N};for(var c=0;c<16;c++)f.bst.R[c]=l.bst.R[c]-d.bst.R[c];for(var c=0;c<4;c++)f.bst.m[c]=l.bst.m[c]-d.bst.m[c];f.est=X.quantize.estats(f.bst),l.left=d,l.right=f,a[s]=d,a.push(f)}a.sort(function(e,t){return t.bst.N-e.bst.N});for(var c=0;c0&&(o=e.right,s=e.left);var c=X.quantize.getNearest(o,t,n,r,i);if(c.tdst<=a*a)return c;var l=X.quantize.getNearest(s,t,n,r,i);return l.tdsta;)r-=4;if(n>=r)break;var s=t[n>>2];t[n>>2]=t[r>>2],t[r>>2]=s,n+=4,r-=4}for(;o(e,n,i)>a;)n-=4;return n+4},X.quantize.vecDot=function(e,t,n){return e[t]*n[0]+e[t+1]*n[1]+e[t+2]*n[2]+e[t+3]*n[3]},X.quantize.stats=function(e,t,n){for(var r=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],i=[0,0,0,0],a=n-t>>2,o=t;o>>0}},X.M4={multVec:function(e,t){return[e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3],e[4]*t[0]+e[5]*t[1]+e[6]*t[2]+e[7]*t[3],e[8]*t[0]+e[9]*t[1]+e[10]*t[2]+e[11]*t[3],e[12]*t[0]+e[13]*t[1]+e[14]*t[2]+e[15]*t[3]]},dot:function(e,t){return e[0]*t[0]+e[1]*t[1]+e[2]*t[2]+e[3]*t[3]},sml:function(e,t){return[e*t[0],e*t[1],e*t[2],e*t[3]]}},X.encode.concatRGBA=function(e){for(var t=0,n=0;n1)throw Error(`Animated PNGs are not supported`);var r=Nu(new Uint8Array(n[0])),i=r.rgbChannel,a=r.alphaChannel;this.rgbChannel=i,a.some(function(e){return e<255})&&(this.alphaChannel=a),this.type=Mu(t.ctype),this.width=t.width,this.height=t.height,this.bitsPerComponent=8}return e.load=function(t){return new e(t)},e}(),Iu=function(){function e(e){this.image=e,this.bitsPerComponent=e.bitsPerComponent,this.width=e.width,this.height=e.height,this.colorSpace=`DeviceRGB`}return e.for=function(t){return Wo(this,void 0,void 0,function(){var n;return Go(this,function(r){return n=Fu.load(t),[2,new e(n)]})})},e.prototype.embedIntoContext=function(e,t){return Wo(this,void 0,void 0,function(){var n,r;return Go(this,function(i){return n=this.embedAlphaChannel(e),r=e.flateStream(this.image.rgbChannel,{Type:`XObject`,Subtype:`Image`,BitsPerComponent:this.image.bitsPerComponent,Width:this.image.width,Height:this.image.height,ColorSpace:this.colorSpace,SMask:n}),t?(e.assign(t,r),[2,t]):[2,e.register(r)]})})},e.prototype.embedAlphaChannel=function(e){if(this.image.alphaChannel){var t=e.flateStream(this.image.alphaChannel,{Type:`XObject`,Subtype:`Image`,Height:this.image.height,Width:this.image.width,BitsPerComponent:this.image.bitsPerComponent,ColorSpace:`DeviceGray`,Decode:[0,1]});return e.register(t)}},e}(),Lu=function(){function e(e,t,n){this.bytes=e,this.start=t||0,this.pos=this.start,this.end=t&&n?t+n:this.bytes.length}return Object.defineProperty(e.prototype,"length",{get:function(){return this.end-this.start},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"isEmpty",{get:function(){return this.length===0},enumerable:!1,configurable:!0}),e.prototype.getByte=function(){return this.pos>=this.end?-1:this.bytes[this.pos++]},e.prototype.getUint16=function(){var e=this.getByte(),t=this.getByte();return e===-1||t===-1?-1:(e<<8)+t},e.prototype.getInt32=function(){var e=this.getByte(),t=this.getByte(),n=this.getByte(),r=this.getByte();return(e<<24)+(t<<16)+(n<<8)+r},e.prototype.getBytes=function(e,t){t===void 0&&(t=!1);var n=this.bytes,r=this.pos,i=this.end;if(e){var a=r+e;a>i&&(a=i),this.pos=a;var o=n.subarray(r,a);return t?new Uint8ClampedArray(o):o}else{var o=n.subarray(r,i);return t?new Uint8ClampedArray(o):o}},e.prototype.peekByte=function(){var e=this.getByte();return this.pos--,e},e.prototype.peekBytes=function(e,t){t===void 0&&(t=!1);var n=this.getBytes(e,t);return this.pos-=n.length,n},e.prototype.skip=function(e){e||(e=1),this.pos+=e},e.prototype.reset=function(){this.pos=this.start},e.prototype.moveStart=function(){this.start=this.pos},e.prototype.makeSubStream=function(t,n){return new e(this.bytes,t,n)},e.prototype.decode=function(){return this.bytes},e}(),Ru=new Uint8Array,zu=function(){function e(e){if(this.pos=0,this.bufferLength=0,this.eof=!1,this.buffer=Ru,this.minBufferLength=512,e)for(;this.minBufferLengthi&&(n=i)}else{for(;!this.eof;)this.readBlock();n=this.bufferLength}this.pos=n;var a=this.buffer.subarray(r,n);return t&&!(a instanceof Uint8ClampedArray)?new Uint8ClampedArray(a):a},e.prototype.peekByte=function(){var e=this.getByte();return this.pos--,e},e.prototype.peekBytes=function(e,t){t===void 0&&(t=!1);var n=this.getBytes(e,t);return this.pos-=n.length,n},e.prototype.skip=function(e){e||(e=1),this.pos+=e},e.prototype.reset=function(){this.pos=0},e.prototype.makeSubStream=function(e,t){for(var n=e+t;this.bufferLength<=n&&!this.eof;)this.readBlock();return new Lu(this.buffer,e,t)},e.prototype.decode=function(){for(;!this.eof;)this.readBlock();return this.buffer.subarray(0,this.bufferLength)},e.prototype.readBlock=function(){throw new tl(this.constructor.name,`readBlock`)},e.prototype.ensureBuffer=function(e){var t=this.buffer;if(e<=t.byteLength)return t;for(var n=this.minBufferLength;n=0;--s)o[a+s]=l&255,l>>=8}},t}(zu),Hu=function(e){U(t,e);function t(t,n){var r=e.call(this,n)||this;return r.stream=t,r.firstDigit=-1,n&&(n=.5*n),r}return t.prototype.readBlock=function(){var e=this.stream.getBytes(8e3);if(!e.length){this.eof=!0;return}for(var t=e.length+1>>1,n=this.ensureBuffer(this.bufferLength+t),r=this.bufferLength,i=this.firstDigit,a=0,o=e.length;a=48&&s<=57)c=s&15;else if(s>=65&&s<=70||s>=97&&s<=102)c=(s&15)+9;else if(s===62){this.eof=!0;break}else continue;i<0?i=c:(n[r++]=i<<4|c,i=-1)}i>=0&&this.eof&&(n[r++]=i<<4,i=-1),this.firstDigit=i,this.bufferLength=r},t}(zu),Uu=new Int32Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Wu=new Int32Array([3,4,5,6,7,8,9,10,65547,65549,65551,65553,131091,131095,131099,131103,196643,196651,196659,196667,262211,262227,262243,262259,327811,327843,327875,327907,258,258,258]),Gu=new Int32Array([1,2,3,4,65541,65543,131081,131085,196625,196633,262177,262193,327745,327777,393345,393409,459009,459137,524801,525057,590849,591361,657409,658433,724993,727041,794625,798721,868353,876545]),Ku=[new Int32Array([459008,524368,524304,524568,459024,524400,524336,590016,459016,524384,524320,589984,524288,524416,524352,590048,459012,524376,524312,589968,459028,524408,524344,590032,459020,524392,524328,59e4,524296,524424,524360,590064,459010,524372,524308,524572,459026,524404,524340,590024,459018,524388,524324,589992,524292,524420,524356,590056,459014,524380,524316,589976,459030,524412,524348,590040,459022,524396,524332,590008,524300,524428,524364,590072,459009,524370,524306,524570,459025,524402,524338,590020,459017,524386,524322,589988,524290,524418,524354,590052,459013,524378,524314,589972,459029,524410,524346,590036,459021,524394,524330,590004,524298,524426,524362,590068,459011,524374,524310,524574,459027,524406,524342,590028,459019,524390,524326,589996,524294,524422,524358,590060,459015,524382,524318,589980,459031,524414,524350,590044,459023,524398,524334,590012,524302,524430,524366,590076,459008,524369,524305,524569,459024,524401,524337,590018,459016,524385,524321,589986,524289,524417,524353,590050,459012,524377,524313,589970,459028,524409,524345,590034,459020,524393,524329,590002,524297,524425,524361,590066,459010,524373,524309,524573,459026,524405,524341,590026,459018,524389,524325,589994,524293,524421,524357,590058,459014,524381,524317,589978,459030,524413,524349,590042,459022,524397,524333,590010,524301,524429,524365,590074,459009,524371,524307,524571,459025,524403,524339,590022,459017,524387,524323,589990,524291,524419,524355,590054,459013,524379,524315,589974,459029,524411,524347,590038,459021,524395,524331,590006,524299,524427,524363,590070,459011,524375,524311,524575,459027,524407,524343,590030,459019,524391,524327,589998,524295,524423,524359,590062,459015,524383,524319,589982,459031,524415,524351,590046,459023,524399,524335,590014,524303,524431,524367,590078,459008,524368,524304,524568,459024,524400,524336,590017,459016,524384,524320,589985,524288,524416,524352,590049,459012,524376,524312,589969,459028,524408,524344,590033,459020,524392,524328,590001,524296,524424,524360,590065,459010,524372,524308,524572,459026,524404,524340,590025,459018,524388,524324,589993,524292,524420,524356,590057,459014,524380,524316,589977,459030,524412,524348,590041,459022,524396,524332,590009,524300,524428,524364,590073,459009,524370,524306,524570,459025,524402,524338,590021,459017,524386,524322,589989,524290,524418,524354,590053,459013,524378,524314,589973,459029,524410,524346,590037,459021,524394,524330,590005,524298,524426,524362,590069,459011,524374,524310,524574,459027,524406,524342,590029,459019,524390,524326,589997,524294,524422,524358,590061,459015,524382,524318,589981,459031,524414,524350,590045,459023,524398,524334,590013,524302,524430,524366,590077,459008,524369,524305,524569,459024,524401,524337,590019,459016,524385,524321,589987,524289,524417,524353,590051,459012,524377,524313,589971,459028,524409,524345,590035,459020,524393,524329,590003,524297,524425,524361,590067,459010,524373,524309,524573,459026,524405,524341,590027,459018,524389,524325,589995,524293,524421,524357,590059,459014,524381,524317,589979,459030,524413,524349,590043,459022,524397,524333,590011,524301,524429,524365,590075,459009,524371,524307,524571,459025,524403,524339,590023,459017,524387,524323,589991,524291,524419,524355,590055,459013,524379,524315,589975,459029,524411,524347,590039,459021,524395,524331,590007,524299,524427,524363,590071,459011,524375,524311,524575,459027,524407,524343,590031,459019,524391,524327,589999,524295,524423,524359,590063,459015,524383,524319,589983,459031,524415,524351,590047,459023,524399,524335,590015,524303,524431,524367,590079]),9],qu=[new Int32Array([327680,327696,327688,327704,327684,327700,327692,327708,327682,327698,327690,327706,327686,327702,327694,0,327681,327697,327689,327705,327685,327701,327693,327709,327683,327699,327691,327707,327687,327703,327695,0]),5],Ju=function(e){U(t,e);function t(t,n){var r=e.call(this,n)||this;r.stream=t;var i=t.getByte(),a=t.getByte();if(i===-1||a===-1)throw Error(`Invalid header in flate stream: `+i+`, `+a);if((i&15)!=8)throw Error(`Unknown compression method in flate stream: `+i+`, `+a);if(((i<<8)+a)%31!=0)throw Error(`Bad FCHECK in flate stream: `+i+`, `+a);if(a&32)throw Error(`FDICT bit set in flate stream: `+i+`, `+a);return r.codeSize=0,r.codeBuf=0,r}return t.prototype.readBlock=function(){var e,t,n=this.stream,r=this.getBits(3);if(r&1&&(this.eof=!0),r>>=1,r===0){var i=void 0;if((i=n.getByte())===-1)throw Error(`Bad block header in flate stream`);var a=i;if((i=n.getByte())===-1||(a|=i<<8,(i=n.getByte())===-1))throw Error(`Bad block header in flate stream`);var o=i;if((i=n.getByte())===-1)throw Error(`Bad block header in flate stream`);if(o|=i<<8,o!==(~a&65535)&&(a!==0||o!==0))throw Error(`Bad uncompressed block length in flate stream`);this.codeBuf=0,this.codeSize=0;var s=this.bufferLength;e=this.ensureBuffer(s+a);var c=s+a;if(this.bufferLength=c,a===0)n.peekByte()===-1&&(this.eof=!0);else for(var l=s;l0;)y[g++]=S}u=this.generateHuffmanTable(y.subarray(0,f)),d=this.generateHuffmanTable(y.subarray(f,v))}else throw Error(`Unknown block type in flate stream`);e=this.buffer;for(var T=e?e.length:0,E=this.bufferLength;;){var D=this.getCode(u);if(D<256){E+1>=T&&(e=this.ensureBuffer(E+1),T=e.length),e[E++]=D;continue}if(D===256){this.bufferLength=E;return}D-=257,D=Wu[D];var O=D>>16;O>0&&(O=this.getBits(O)),t=(D&65535)+O,D=this.getCode(d),D=Gu[D],O=D>>16,O>0&&(O=this.getBits(O));var k=(D&65535)+O;E+t>=T&&(e=this.ensureBuffer(E+t),T=e.length);for(var ee=0;ee>e,this.codeSize=n-=e,i},t.prototype.getCode=function(e){for(var t=this.stream,n=e[0],r=e[1],i=this.codeSize,a=this.codeBuf,o;i>16,l=s&65535;if(c<1||i>c,this.codeSize=i-c,l},t.prototype.generateHuffmanTable=function(e){var t=e.length,n=0,r;for(r=0;rn&&(n=e[r]);for(var i=1<>=1;for(r=u;r0;if(!y||y<256)m[0]=y,h=1;else if(y>=258)if(y=0;i--)m[i]=l[a],a=d[a];else m[h++]=m[0];else if(y===256){f=9,c=258,h=0;continue}else{this.eof=!0,delete this.lzwState;break}if(b&&(d[c]=p,u[c]=u[p]+1,l[c]=m[0],c++,f=c+s&c+s-1?f:Math.min(Math.log(c+s)/.6931471805599453+1,12)|0),p=y,g+=h,t>>t&(1<0){var i=this.stream.getBytes(r);t.set(i,n),n+=r}}else{r=257-r;var a=e[1];t=this.ensureBuffer(n+r+1);for(var o=0;ot.size())throw new pl(e,0,t.size());t.remove(e)}else{if(e!==0)throw new pl(e,0,0);this.setKids([])}},t.prototype.normalizedEntries=function(){var e=this.Kids();return e||(e=this.dict.context.obj([this.ref]),this.dict.set(J.of(`Kids`),e)),{Kids:e}},t.fromDict=function(e,n){return new t(e,n)},t}(ld),hd=function(e){U(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.Opt=function(){return this.dict.lookupMaybe(J.of(`Opt`),Cu,Y,jl)},t.prototype.setOpt=function(e){this.dict.set(J.of(`Opt`),this.dict.context.obj(e))},t.prototype.getExportValues=function(){var e=this.Opt();if(e){if(e instanceof Cu||e instanceof Y)return[e];for(var t=[],n=0,r=e.size();nt.size())throw new pl(e,0,t.size());t.remove(e)}},t.prototype.normalizeExportValues=function(){for(var e=this.getExportValues()??[],t=[],n=this.getWidgets(),r=0,i=n.length;r1){if(!this.hasFlag(xd.MultiSelect))throw new hl;this.dict.set(J.of(`V`),this.dict.context.obj(e))}this.updateSelectedIndices(e)},t.prototype.valuesAreValid=function(e){for(var t=this.getOptions(),n=function(n,r){var i=e[n].decodeText();if(!t.find(function(e){return i===(e.display||e.value).decodeText()}))return{value:!1}},r=0,i=e.length;r1){for(var t=Array(e.length),n=this.getOptions(),r=function(r,i){var a=e[r].decodeText();t[r]=n.findIndex(function(e){return a===(e.display||e.value).decodeText()})},i=0,a=e.length;i0){var a=i.lookup(0,Cu,Y),o=i.lookupMaybe(1,Cu,Y);t.push({value:a,display:o||a})}}return t}return[]},t}(md),Cd=function(e){U(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.fromDict=function(e,n){return new t(e,n)},t.create=function(e){var n=e.obj({FT:`Ch`,Ff:xd.Combo,Kids:[]});return new t(n,e.register(n))},t}(Sd),wd=function(e){U(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.addField=function(e){this.normalizedEntries().Kids?.push(e)},t.prototype.normalizedEntries=function(){var e=this.Kids();return e||(e=this.dict.context.obj([]),this.dict.set(J.of(`Kids`),e)),{Kids:e}},t.fromDict=function(e,n){return new t(e,n)},t.create=function(e){var n=e.obj({});return new t(n,e.register(n))},t}(ld),Td=function(e){U(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.fromDict=function(e,n){return new t(e,n)},t}(md),Ed=function(e){U(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.MaxLen=function(){var e=this.dict.lookup(J.of(`MaxLen`));if(e instanceof q)return e},t.prototype.Q=function(){var e=this.dict.lookup(J.of(`Q`));if(e instanceof q)return e},t.prototype.setMaxLength=function(e){this.dict.set(J.of(`MaxLen`),q.of(e))},t.prototype.removeMaxLength=function(){this.dict.delete(J.of(`MaxLen`))},t.prototype.getMaxLength=function(){return this.MaxLen()?.asNumber()},t.prototype.setQuadding=function(e){this.dict.set(J.of(`Q`),q.of(e))},t.prototype.getQuadding=function(){return this.Q()?.asNumber()},t.prototype.setValue=function(e){this.dict.set(J.of(`V`),e)},t.prototype.removeValue=function(){this.dict.delete(J.of(`V`))},t.prototype.getValue=function(){var e=this.V();if(e instanceof Cu||e instanceof Y)return e},t.fromDict=function(e,n){return new t(e,n)},t.create=function(e){var n=e.obj({FT:`Tx`,Kids:[]});return new t(n,e.register(n))},t}(md),Dd=function(e){U(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.fromDict=function(e,n){return new t(e,n)},t.create=function(e){var n=e.obj({FT:`Btn`,Ff:yd.PushButton,Kids:[]});return new t(n,e.register(n))},t}(hd),Od=function(e){U(t,e);function t(){return e!==null&&e.apply(this,arguments)||this}return t.prototype.setValue=function(e){if(!this.getOnValues().includes(e)&&e!==J.of(`Off`))throw new ml;this.dict.set(J.of(`V`),e);for(var t=this.getWidgets(),n=0,r=t.length;ni)throw new dl(n,i);for(var a=n,o=0,s=r.size();oa)return l.insertLeafNode(e,a)||c;a-=l.Count().asNumber()}l instanceof iu&&--a}if(a===0){this.insertLeafKid(r.size(),e);return}throw new fl(n,`insertLeafNode`)},t.prototype.removeLeafNode=function(e,n){n===void 0&&(n=!0);var r=this.Kids(),i=this.Count().asNumber();if(e>=i)throw new dl(e,i);for(var a=e,o=0,s=r.size();oa){l.removeLeafNode(a,n),n&&l.Kids().size()===0&&r.remove(o);return}else a-=l.Count().asNumber();if(l instanceof iu)if(a===0){this.removeKid(o);return}else--a}throw new fl(e,`removeLeafNode`)},t.prototype.ascend=function(e){e(this);var t=this.Parent();t&&t.ascend(e)},t.prototype.traverse=function(e){for(var n=this.Kids(),r=0,i=n.size();r2**53-1)if(this.capNumbers){var r=`Parsed number that is too large for some PDF readers: `+e+`, using Number.MAX_SAFE_INTEGER instead.`;return console.warn(r),2**53-1}else{var r=`Parsed number that is too large for some PDF readers: `+e+`, not capping.`;console.warn(r)}return n},e.prototype.skipWhitespace=function(){for(;!this.bytes.done()&&Fl[this.bytes.peek()];)this.bytes.next()},e.prototype.skipLine=function(){for(;!this.bytes.done();){var e=this.bytes.peek();if(e===qd||e===Jd)return;this.bytes.next()}},e.prototype.skipComment=function(){if(this.bytes.peek()!==K.Percent)return!1;for(;!this.bytes.done();){var e=this.bytes.peek();if(e===qd||e===Jd)return!0;this.bytes.next()}return!0},e.prototype.skipWhitespaceAndComments=function(){for(this.skipWhitespace();this.skipComment();)this.skipWhitespace()},e.prototype.matchKeyword=function(e){for(var t=this.bytes.offset(),n=0,r=e.length;n=this.length},e.prototype.offset=function(){return this.idx},e.prototype.slice=function(e,t){return this.bytes.slice(e,t)},e.prototype.position=function(){return{line:this.line,column:this.column,offset:this.idx}},e.of=function(t){return new e(t)},e.fromPDFRawStream=function(t){return e.of(Qu(t).decode())},e}(),Zd=K.Space,Qd=K.CarriageReturn,$d=K.Newline,ef=[K.s,K.t,K.r,K.e,K.a,K.m],tf=[K.e,K.n,K.d,K.s,K.t,K.r,K.e,K.a,K.m],nf={header:[K.Percent,K.P,K.D,K.F,K.Dash],eof:[K.Percent,K.Percent,K.E,K.O,K.F],obj:[K.o,K.b,K.j],endobj:[K.e,K.n,K.d,K.o,K.b,K.j],xref:[K.x,K.r,K.e,K.f],trailer:[K.t,K.r,K.a,K.i,K.l,K.e,K.r],startxref:[K.s,K.t,K.a,K.r,K.t,K.x,K.r,K.e,K.f],true:[K.t,K.r,K.u,K.e],false:[K.f,K.a,K.l,K.s,K.e],null:[K.n,K.u,K.l,K.l],stream:ef,streamEOF1:Ko(ef,[Zd,Qd,$d]),streamEOF2:Ko(ef,[Qd,$d]),streamEOF3:Ko(ef,[Qd]),streamEOF4:Ko(ef,[$d]),endstream:tf,EOF1endstream:Ko([Qd,$d],tf),EOF2endstream:Ko([Qd],tf),EOF3endstream:Ko([$d],tf)},rf=function(e){U(t,e);function t(t,n,r){r===void 0&&(r=!1);var i=e.call(this,t,r)||this;return i.context=n,i}return t.prototype.parseObject=function(){if(this.skipWhitespaceAndComments(),this.matchKeyword(nf.true))return Nl.True;if(this.matchKeyword(nf.false))return Nl.False;if(this.matchKeyword(nf.null))return Ul;var e=this.bytes.peek();if(e===K.LessThan&&this.bytes.peekAhead(1)===K.LessThan)return this.parseDictOrStream();if(e===K.LessThan)return this.parseHexString();if(e===K.LeftParen)return this.parseString();if(e===K.ForwardSlash)return this.parseName();if(e===K.LeftSquareBracket)return this.parseArray();if(Wd[e])return this.parseNumberOrRef();throw new xl(this.bytes.position(),e)},t.prototype.parseNumberOrRef=function(){var e=this.parseRawNumber();this.skipWhitespaceAndComments();var t=this.bytes.offset();if(Hd[this.bytes.peek()]){var n=this.parseRawNumber();if(this.skipWhitespaceAndComments(),this.bytes.peek()===K.R)return this.bytes.assertNext(K.R),Yl.of(e,n)}return this.bytes.moveTo(t),q.of(e)},t.prototype.parseHexString=function(){var e=``;for(this.bytes.assertNext(K.LessThan);!this.bytes.done()&&this.bytes.peek()!==K.GreaterThan;)e+=is(this.bytes.next());return this.bytes.assertNext(K.GreaterThan),Y.of(e)},t.prototype.parseString=function(){for(var e=0,t=!1,n=``;!this.bytes.done();){var r=this.bytes.next();if(n+=is(r),t||(r===K.LeftParen&&(e+=1),r===K.RightParen&&--e),r===K.BackSlash?t=!t:t&&(t=!1),e===0)return Cu.of(n.substring(1,n.length-1))}throw new wl(this.bytes.position())},t.prototype.parseName=function(){this.bytes.assertNext(K.ForwardSlash);for(var e=``;!this.bytes.done();){var t=this.bytes.peek();if(Fl[t]||Pl[t])break;e+=is(t),this.bytes.next()}return J.of(e)},t.prototype.parseArray=function(){this.bytes.assertNext(K.LeftSquareBracket),this.skipWhitespaceAndComments();for(var e=jl.withContext(this.context);this.bytes.peek()!==K.RightSquareBracket;){var t=this.parseObject();e.push(t),this.skipWhitespaceAndComments()}return this.bytes.assertNext(K.RightSquareBracket),e},t.prototype.parseDict=function(){this.bytes.assertNext(K.LessThan),this.bytes.assertNext(K.LessThan),this.skipWhitespaceAndComments();for(var e=new Map;!this.bytes.done()&&this.bytes.peek()!==K.GreaterThan&&this.bytes.peekAhead(1)!==K.GreaterThan;){var t=this.parseName(),n=this.parseObject();e.set(t,n),this.skipWhitespaceAndComments()}this.skipWhitespaceAndComments(),this.bytes.assertNext(K.GreaterThan),this.bytes.assertNext(K.GreaterThan);var r=e.get(J.of(`Type`));return r===J.of(`Catalog`)?Bd.fromMapWithContext(e,this.context):r===J.of(`Pages`)?Vd.fromMapWithContext(e,this.context):r===J.of(`Page`)?iu.fromMapWithContext(e,this.context):Wl.fromMapWithContext(e,this.context)},t.prototype.parseDictOrStream=function(){var e=this.bytes.position(),t=this.parseDict();if(this.skipWhitespaceAndComments(),!this.matchKeyword(nf.streamEOF1)&&!this.matchKeyword(nf.streamEOF2)&&!this.matchKeyword(nf.streamEOF3)&&!this.matchKeyword(nf.streamEOF4)&&!this.matchKeyword(nf.stream))return t;var n=this.bytes.offset(),r,i=t.get(J.of(`Length`));i instanceof q?(r=n+i.asNumber(),this.bytes.moveTo(r),this.skipWhitespaceAndComments(),this.matchKeyword(nf.endstream)||(this.bytes.moveTo(n),r=this.findEndOfStreamFallback(e))):r=this.findEndOfStreamFallback(e);var a=this.bytes.slice(n,r);return Kl.of(t,a)},t.prototype.findEndOfStreamFallback=function(e){for(var t=1,n=this.bytes.offset();!this.bytes.done()&&(n=this.bytes.offset(),this.matchKeyword(nf.stream)?t+=1:this.matchKeyword(nf.EOF1endstream)||this.matchKeyword(nf.EOF2endstream)||this.matchKeyword(nf.EOF3endstream)||this.matchKeyword(nf.endstream)?--t:this.bytes.next(),t!==0););if(t!==0)throw new Cl(e);return n},t.forBytes=function(e,n,r){return new t(Xd.of(e),n,r)},t.forByteStream=function(e,n,r){return r===void 0&&(r=!1),new t(e,n,r)},t}(Yd),af=function(e){U(t,e);function t(t,n){var r=e.call(this,Xd.fromPDFRawStream(t),t.dict.context)||this,i=t.dict;return r.alreadyParsed=!1,r.shouldWaitForTick=n||(function(){return!1}),r.firstOffset=i.lookup(J.of(`First`),q).asNumber(),r.objectCount=i.lookup(J.of(`N`),q).asNumber(),r}return t.prototype.parseIntoContext=function(){return Wo(this,void 0,void 0,function(){var e,t,n,r,i,a,o,s;return Go(this,function(c){switch(c.label){case 0:if(this.alreadyParsed)throw new al(`PDFObjectStreamParser`,`parseIntoContext`);this.alreadyParsed=!0,e=this.parseOffsetsAndObjectNumbers(),t=0,n=e.length,c.label=1;case 1:return t=K.Space&&t<=K.Tilde&&(this.matchKeyword(nf.xref)||this.matchKeyword(nf.trailer)||this.matchKeyword(nf.startxref)||this.matchIndirectObjectHeader())){this.bytes.moveTo(e);break}this.bytes.next()}},t.prototype.skipBinaryHeaderComment=function(){this.skipWhitespaceAndComments();try{var e=this.bytes.offset();this.parseIndirectObjectHeader(),this.bytes.moveTo(e)}catch{this.bytes.next(),this.skipWhitespaceAndComments()}},t.forBytesWithOptions=function(e,n,r,i){return new t(e,n,r,i)},t}(rf),cf=function(e){return 1<0&&(r[r.length]=+i),n[n.length]={cmd:t,args:r},r=[],i=``,a=!1),t=l;else if([` `,`,`].includes(l)||l===`-`&&i.length>0&&i[i.length-1]!==`e`||l===`.`&&a){if(i.length===0)continue;r.length===o?(n[n.length]={cmd:t,args:r},r=[+i],t===`M`&&(t=`L`),t===`m`&&(t=`l`)):r[r.length]=+i,a=l===`.`,i=[`-`,`.`].includes(l)?l:``}else i+=l,l===`.`&&(a=!0)}return i.length>0&&(r.length===o?(n[n.length]={cmd:t,args:r},r=[+i],t===`M`&&(t=`L`),t===`m`&&(t=`l`)):r[r.length]=+i),n[n.length]={cmd:t,args:r},n},jp=function(e){Q=$=Tp=Ep=Dp=Op=0;for(var t=[],n=0;n1&&(f=Math.sqrt(f),n*=f,r*=f);var p=d/n,m=u/n,h=-u/r,g=d/r,_=p*s+m*c,v=h*s+g*c,y=p*e+m*t,b=h*e+g*t,x=1/((y-_)*(y-_)+(b-v)*(b-v))-.25;x<0&&(x=0);var S=Math.sqrt(x);a===i&&(S=-S);var C=.5*(_+y)-S*(b-v),w=.5*(v+b)+S*(y-_),T=Math.atan2(v-w,_-C),E=Math.atan2(b-w,y-C)-T;E<0&&a===1?E+=2*Math.PI:E>0&&a===0&&(E-=2*Math.PI);for(var D=Math.ceil(Math.abs(E/(Math.PI*.5+.001))),O=[],k=0;ke.length)return i-1;var m=t.heightAtSize(i);if((m+m*.2)*a>Math.abs(n.height))return i-1;i+=1}return i},_m=function(e,t,n,r){for(var i=n.width/r,a=n.height,o=mm,s=hs(e);oi*.75)return o-1}if(t.heightAtSize(o,{descender:!1})>a)return o-1;o+=1}return o},vm=function(e){for(var t=e.length;t>0;t--)if(/\s/.test(e[t]))return t},ym=function(e,t,n,r){for(var i=e.length;i>0;){var a=e.substring(0,i),o=n.encodeText(a),s=n.widthOfTextAtSize(a,r);if(sf&&(f=C+x),m+s>p&&(p=m+s),l.push({text:y,encoded:b,width:x,height:s,x:C,y:m}),_=S?.trim()}return{fontSize:r,lineHeight:c,lines:l,bounds:{x:u,y:d,width:f-u,height:p-d}}},xm=function(e,t){var n=t.fontSize,r=t.font,i=t.bounds,a=t.cellCount,o=ps(ls(e));if(o.length>a)throw new um(o.length,a);(n===void 0||n===0)&&(n=_m(o,r,i,a));for(var s=i.width/a,c=r.heightAtSize(n,{descender:!1}),l=i.y+(i.height/2-c/2),u=[],d=i.x,f=i.y,p=i.x+i.width,m=i.y+i.height,h=0,g=0;hp&&(p=S+x),l+c>m&&(m=l+c),u.push({text:o,encoded:b,width:x,height:c,x:S,y:l}),h+=1,g+=y}return{fontSize:n,cells:u,bounds:{x:d,y:f,width:p-d,height:m-f}}},Sm=function(e,t){var n=t.alignment,r=t.fontSize,i=t.font,a=t.bounds,o=ps(ls(e));(r===void 0||r===0)&&(r=gm([o],i,a));var s=i.encodeText(o),c=i.widthOfTextAtSize(o,r),l=i.heightAtSize(r,{descender:!1}),u=n===pm.Left?a.x:n===pm.Center?a.x+a.width/2-c/2:n===pm.Right?a.x+a.width-c:a.x,d=a.y+(a.height/2-l/2);return{fontSize:r,line:{text:o,encoded:s,width:c,height:l,x:u,y:d},bounds:{x:u,y:d,width:c,height:l}}},Cm=function(e){return`normal`in e?e:{normal:e}},wm=/\/([^\0\t\n\f\r\ ]+)[\0\t\n\f\r\ ]+(\d*\.\d+|\d+)[\0\t\n\f\r\ ]+Tf/,Tm=function(e){var t=bs(e.getDefaultAppearance()??``,wm).match??[],n=Number(t[2]);return isFinite(n)?n:void 0},Em=/(\d*\.\d+|\d+)[\0\t\n\f\r\ ]*(\d*\.\d+|\d+)?[\0\t\n\f\r\ ]*(\d*\.\d+|\d+)?[\0\t\n\f\r\ ]*(\d*\.\d+|\d+)?[\0\t\n\f\r\ ]+(g|rg|k)/,Dm=function(e){var t=bs(e.getDefaultAppearance()??``,Em).match??[],n=t[1],r=t[2],i=t[3],a=t[4],o=t[5];if(o===`g`&&n)return hp(Number(n));if(o===`rg`&&n&&r&&i)return gp(Number(n),Number(r),Number(i));if(o===`k`&&n&&r&&i&&a)return _p(Number(n),Number(r),Number(i),Number(a))},Om=function(e,t,n,r){r===void 0&&(r=0);var i=[xp(t).toString(),ep(n?.name??`dummy__noop`,r).toString()].join(` `);e.setDefaultAppearance(i)},km=function(e,t){var n=Dm(t),r=Dm(e.acroField),i=t.getRectangle(),a=t.getAppearanceCharacteristics(),o=t.getBorderStyle()?.getWidth()??0,s=bf(a?.getRotation()),c=xf(i,s),l=c.width,u=c.height,d=Jp(Ho(Ho({},i),{rotation:s})),f=gp(0,0,0),p=Cp(a?.getBorderColor())??f,m=Cp(a?.getBackgroundColor()),h=Cp(a?.getBackgroundColor(),.8),g=n??r??f;Om(n?t:e.acroField,g);var _={x:0+o/2,y:0+o/2,width:l-o,height:u-o,thickness:1.5,borderWidth:o,borderColor:p,markColor:g};return{normal:{on:Ko(d,Yp(Ho(Ho({},_),{color:m,filled:!0}))),off:Ko(d,Yp(Ho(Ho({},_),{color:m,filled:!1})))},down:{on:Ko(d,Yp(Ho(Ho({},_),{color:h,filled:!0}))),off:Ko(d,Yp(Ho(Ho({},_),{color:h,filled:!1})))}}},Am=function(e,t){var n=Dm(t),r=Dm(e.acroField),i=t.getRectangle(),a=t.getAppearanceCharacteristics(),o=t.getBorderStyle()?.getWidth()??0,s=bf(a?.getRotation()),c=xf(i,s),l=c.width,u=c.height,d=Jp(Ho(Ho({},i),{rotation:s})),f=gp(0,0,0),p=Cp(a?.getBorderColor())??f,m=Cp(a?.getBackgroundColor()),h=Cp(a?.getBackgroundColor(),.8),g=n??r??f;Om(n?t:e.acroField,g);var _={x:l/2,y:u/2,width:l-o,height:u-o,borderWidth:o,borderColor:p,dotColor:g};return{normal:{on:Ko(d,Xp(Ho(Ho({},_),{color:m,filled:!0}))),off:Ko(d,Xp(Ho(Ho({},_),{color:m,filled:!1})))},down:{on:Ko(d,Xp(Ho(Ho({},_),{color:h,filled:!0}))),off:Ko(d,Xp(Ho(Ho({},_),{color:h,filled:!1})))}}},jm=function(e,t,n){var r=Dm(t),i=Dm(e.acroField),a=Tm(t),o=Tm(e.acroField),s=t.getRectangle(),c=t.getAppearanceCharacteristics(),l=t.getBorderStyle(),u=c?.getCaptions(),d=u?.normal??``,f=u?.down??d??``,p=l?.getWidth()??0,m=bf(c?.getRotation()),h=xf(s,m),g=h.width,_=h.height,v=Jp(Ho(Ho({},s),{rotation:m})),y=gp(0,0,0),b=Cp(c?.getBorderColor()),x=Cp(c?.getBackgroundColor()),S=Cp(c?.getBackgroundColor(),.8),C={x:p,y:p,width:g-p*2,height:_-p*2},w=Sm(d,{alignment:pm.Center,fontSize:a??o,font:n,bounds:C}),T=Sm(f,{alignment:pm.Center,fontSize:a??o,font:n,bounds:C}),E=Math.min(w.fontSize,T.fontSize),D=r??i??y;Om(r||a!==void 0?t:e.acroField,D,n,E);var O={x:0+p/2,y:0+p/2,width:g-p,height:_-p,borderWidth:p,borderColor:b,textColor:D,font:n.name,fontSize:E};return{normal:Ko(v,Zp(Ho(Ho({},O),{color:x,textLines:[w.line]}))),down:Ko(v,Zp(Ho(Ho({},O),{color:S,textLines:[T.line]})))}},Mm=function(e,t,n){var r=Dm(t),i=Dm(e.acroField),a=Tm(t),o=Tm(e.acroField),s=t.getRectangle(),c=t.getAppearanceCharacteristics(),l=t.getBorderStyle(),u=e.getText()??``,d=l?.getWidth()??0,f=bf(c?.getRotation()),p=xf(s,f),m=p.width,h=p.height,g=Jp(Ho(Ho({},s),{rotation:f})),_=gp(0,0,0),v=Cp(c?.getBorderColor()),y=Cp(c?.getBackgroundColor()),b,x,S=+!e.isCombed(),C={x:d+S,y:d+S,width:m-(d+S)*2,height:h-(d+S)*2};if(e.isMultiline()){var w=bm(u,{alignment:e.getAlignment(),fontSize:a??o,font:n,bounds:C});b=w.lines,x=w.fontSize}else if(e.isCombed()){var w=xm(u,{fontSize:a??o,font:n,bounds:C,cellCount:e.getMaxLength()??0});b=w.cells,x=w.fontSize}else{var w=Sm(u,{alignment:e.getAlignment(),fontSize:a??o,font:n,bounds:C});b=[w.line],x=w.fontSize}var T=r??i??_;return Om(r||a!==void 0?t:e.acroField,T,n,x),Ko(g,$p({x:0+d/2,y:0+d/2,width:m-d,height:h-d,borderWidth:d??0,borderColor:v,textColor:T,font:n.name,fontSize:x,color:y,textLines:b,padding:S}))},Nm=function(e,t,n){var r=Dm(t),i=Dm(e.acroField),a=Tm(t),o=Tm(e.acroField),s=t.getRectangle(),c=t.getAppearanceCharacteristics(),l=t.getBorderStyle(),u=e.getSelected()[0]??``,d=l?.getWidth()??0,f=bf(c?.getRotation()),p=xf(s,f),m=p.width,h=p.height,g=Jp(Ho(Ho({},s),{rotation:f})),_=gp(0,0,0),v=Cp(c?.getBorderColor()),y=Cp(c?.getBackgroundColor()),b=1,x={x:d+b,y:d+b,width:m-(d+b)*2,height:h-(d+b)*2},S=Sm(u,{alignment:pm.Left,fontSize:a??o,font:n,bounds:x}),C=S.line,w=S.fontSize,T=r??i??_;return Om(r||a!==void 0?t:e.acroField,T,n,w),Ko(g,$p({x:0+d/2,y:0+d/2,width:m-d,height:h-d,borderWidth:d??0,borderColor:v,textColor:T,font:n.name,fontSize:w,color:y,textLines:[C],padding:b}))},Pm=function(e,t,n){var r=Dm(t),i=Dm(e.acroField),a=Tm(t),o=Tm(e.acroField),s=t.getRectangle(),c=t.getAppearanceCharacteristics(),l=t.getBorderStyle()?.getWidth()??0,u=bf(c?.getRotation()),d=xf(s,u),f=d.width,p=d.height,m=Jp(Ho(Ho({},s),{rotation:u})),h=gp(0,0,0),g=Cp(c?.getBorderColor()),_=Cp(c?.getBackgroundColor()),v=e.getOptions(),y=e.getSelected();e.isSorted()&&v.sort();for(var b=``,x=0,S=v.length;x1||n.length===1&&t)&&this.enableMultiselect();for(var i=Array(n.length),a=0,o=n.length;a1||n.length===1&&t)&&this.enableMultiselect();for(var r=Array(n.length),i=0,a=n.length;it)throw new dm(e.length,t,this.getName());this.markAsDirty(),this.disableRichFormatting(),e?this.acroField.setValue(Y.fromText(e)):this.acroField.removeValue()},t.prototype.getAlignment=function(){var e=this.acroField.getQuadding();return e===0?pm.Left:e===1?pm.Center:e===2?pm.Right:pm.Left},t.prototype.setAlignment=function(e){zc(e,`alignment`,pm),this.markAsDirty(),this.acroField.setQuadding(e)},t.prototype.getMaxLength=function(){return this.acroField.getMaxLength()},t.prototype.setMaxLength=function(e){if(qc(e,`maxLength`,0,2**53-1),this.markAsDirty(),e===void 0)this.acroField.removeMaxLength();else{var t=this.getText();if(t&&t.length>e)throw new fm(t.length,e,this.getName());this.acroField.setMaxLength(e)}},t.prototype.removeMaxLength=function(){this.markAsDirty(),this.acroField.removeMaxLength()},t.prototype.setImage=function(e){for(var t=this.getAlignment(),n=t===pm.Center?Rm.Center:t===pm.Right?Rm.Right:Rm.Left,r=this.acroField.getWidgets(),i=0,a=r.length;i{let r=e.node.Annots();if(!r)return;let i=r?.size()??0;for(let e=0;e{let a=r.node.Annots();if(!a)return;let o=a?.size()??0;for(let r=0;r{if(e.level>n)return;let[i,a]=t?.[e.key]??[0,0],o={title:e.title,to:[i,0,a],open:!1,children:[]};if(e.children?.length>0)for(let t of e.children){let e=r(t);e&&o.children.push(e)}return o};return r(e)?.children??[]}var fh=(e,t)=>{for(let n of e){let e=t(n);`children`in n&&e!==!1&&fh(n.children,t)}},ph=e=>{let t=[];return fh(e,e=>void t.push(e)),t},mh=e=>{let t=0;return fh(e,e=>(t+=1,!(`open`in e&&!e.open))),t},hh=async(e,t)=>{let n=e.context.nextRef(),r=new WeakMap;for(let n of ph(t))r.set(n,e.context.nextRef());let i=(()=>{let t=[];return e.catalog.Pages().traverse((e,n)=>{e.get(e.context.obj(`Type`))?.toString()===`/Page`&&t.push(n)}),t})(),a=(t,n)=>{let{length:o}=t;for(let s=0;s0?(a(c.children,l),{First:r.get(c.children[0]),Last:r.get(c.children[c.children.length-1]),Count:mh(c.children)*(c.open?1:-1)}):{};e.context.assign(l,e.context.obj({Title:Y.fromText(c.title),Parent:n,...s>0?{Prev:r.get(t[s-1])}:{},...s0?{First:r.get(t[0]),Last:r.get(t[t.length-1])}:{},Count:o})),e.catalog.set(e.context.obj(`Outlines`),n)};async function gh(e,{headings:t,maxLevel:n,frontMatter:r,displayMetadata:i}){let a=await rh.load(e),o=await lh(a);return uh(a,o),hh(a,dh(t,o,n)),i&&_h(a,r??{}),e=await a.save(),e}function _h(e,{title:t,author:n,keywords:r,subject:i,creator:a,created_at:o,updated_at:s}){t&&e.setTitle(t,{showInWindowTitleBar:!0}),n&&(Array.isArray(n)?e.setAuthor(n.join(`, `)):e.setAuthor(n.toString())),r&&e.setKeywords(typeof r==`string`?[r]:r),i&&e.setSubject(i),e.setCreator(a??`Obsidian`),e.setProducer(`Obsidian`),e.setCreationDate(new Date(o??new Date)),e.setModificationDate(new Date(s??new Date))}function vh(e,t,n){let r={...e};return t&&n.forEach(e=>{let n=t[e];n!=null&&(r[e]=n)}),r}function yh(e,t){e=vh(e,t,[`headerTemplate`,`footerTemplate`]);let n=e.pageSize;e.pageSize==`Custom`&&e.pageWidth&&e.pageHeight&&(n={width:$a(e.pageWidth,210)/25.4,height:$a(e.pageHeight,297)/25.4});let r=e?.scale??100;(r>200||r<10)&&(r=100);let i={landscape:e?.landscape,printBackground:e?.printBackground,generateTaggedPDF:e?.generateTaggedPDF,pageSize:n,scale:r/100,margins:{marginType:`default`},displayHeaderFooter:e.displayHeader||e.displayFooter,headerTemplate:e.displayHeader?Xa(e.headerTemplate,t??{}):``,footerTemplate:e.displayFooter?Xa(e.footerTemplate,t??{}):``};return e.marginType==`0`?i.margins={marginType:`custom`,top:0,bottom:0,left:0,right:0}:e.marginType==`1`?i.margins={marginType:`default`}:e.marginType==`2`?i.margins={marginType:`custom`,top:.1,bottom:.1,left:.1,right:.1}:e.marginType==`3`&&(i.margins={marginType:`custom`,top:$a(e.marginTop,0)/25.4,bottom:$a(e.marginBottom,0)/25.4,left:$a(e.marginLeft,0)/25.4,right:$a(e.marginRight,0)/25.4}),i}async function bh(e,t,n,{doc:r,frontMatter:i}){console.debug(`output pdf:`,e);let a=yh(t,i);try{let o=await n.printToPDF(a);o=await gh(o,{headings:Ha(r),frontMatter:i,displayMetadata:t?.displayMetadata,maxLevel:Qa(t?.maxLevel,6)}),await ch.writeFile(e,o),t.open&&u.default.remote.shell.openPath(e)}catch(e){console.error(e)}}async function xh(e,t){let n=await u.default.remote.dialog.showSaveDialog({title:`Export to PDF`,defaultPath:e+(t?`-`+Date.now():``)+`.pdf`,filters:[{name:`All Files`,extensions:[`*`]},{name:`PDF`,extensions:[`pdf`]}],properties:[`showOverwriteConfirmation`,`createDirectory`]});if(!n.canceled)return n.filePath}async function Sh(e,t){let n=await u.default.remote.dialog.showOpenDialog({title:`Export to PDF`,defaultPath:e,properties:[`openDirectory`]});if(!n.canceled)return n.filePaths[0]}function Ch(e){return e.map(e=>({status:0,filename:e.file.name}))}function wh(e,t){return e[t].status=1,[...e]}var Th={A0:[841,1189],A1:[594,841],A2:[420,594],A3:[297,420],A4:[210,297],A5:[148,210],A6:[105,148],Legal:[216,356],Letter:[216,279],Tabloid:[279,432],Ledger:[432,279]},Eh=class{constructor(e,t){this.config=e,this.onResize=t}calc(e){let{pageSize:t,pageWidth:n}=this.config,r=Th?.[t]?.[0]??$a(n,210);return Math.floor(qa(r)/e.offsetWidth*100)/100}startObserver(e){this.observer=new ResizeObserver(()=>{this.onResize?.()}),this.observer.observe(e)}stopObserver(){this.observer?.disconnect()}},Dh,Oh=class{constructor(e){j(this,`value`,void 0),j(this,`next`,void 0),this.value=e}},kh=new WeakMap,Ah=new WeakMap,jh=new WeakMap;Dh=Symbol.iterator;var Mh=class{constructor(){ht(this,kh,void 0),ht(this,Ah,void 0),ht(this,jh,void 0),this.clear()}enqueue(e){var t;let n=new Oh(e);V(kh,this)?(V(Ah,this).next=n,B(Ah,this,n)):(B(kh,this,n),B(Ah,this,n)),B(jh,this,(t=V(jh,this),t++,t))}dequeue(){var e;let t=V(kh,this);if(t)return B(kh,this,V(kh,this).next),B(jh,this,(e=V(jh,this),e--,e)),t.value}peek(){if(V(kh,this))return V(kh,this).value}clear(){B(kh,this,void 0),B(Ah,this,void 0),B(jh,this,0)}get size(){return V(jh,this)}*[Dh](){let e=V(kh,this);for(;e;)yield e.value,e=e.next}*drain(){for(;V(kh,this);)yield this.dequeue()}};function Nh(e){let t=!1;if(typeof e==`object`&&({concurrency:e,rejectOnClear:t=!1}=e),Ph(e),typeof t!=`boolean`)throw TypeError("Expected `rejectOnClear` to be a boolean");let n=new Mh,r=0,i=()=>{r0&&(r++,n.dequeue().run())},a=()=>{r--,i()},o=async(e,t,n)=>{let r=(async()=>e(...n))();t(r);try{await r}catch{}a()},s=(t,a,s,c)=>{let l={reject:s};new Promise(e=>{l.run=e,n.enqueue(l)}).then(o.bind(void 0,t,a,c)),rnew Promise((n,r)=>{s(e,n,r,t)});return Object.defineProperties(c,{activeCount:{get:()=>r},pendingCount:{get:()=>n.size},clearQueue:{value(){if(!t){n.clear();return}let e=AbortSignal.abort().reason;for(;n.size>0;)n.dequeue().reject(e)}},concurrency:{get:()=>e,set(t){Ph(t),e=t,queueMicrotask(()=>{for(;r0;)i()})}},map:{async value(e,t){let n=Array.from(e,(e,n)=>this(t,e,n));return Promise.all(n)}}}),c}function Ph(e){if(!((Number.isInteger(e)||e===1/0)&&e>0))throw TypeError("Expected `concurrency` to be a number from 1 and up")}var Fh=zi(``),Ih=zi(`
`),Lh=zi(`
Rendering...
`,1),Rh=zi(`
`),zh=zi(`
`,1),Bh=zi(``);function Vh(e,t){Ze(t,!0);let n=require("fs").promises,r=Qt(()=>t.plugin.settings),i=er(!1),a=er(sr([])),o=er(sr([])),s=er(.75),c=er(void 0),u=er(sr([])),d=new Eh(t.config);function f(){H(c)&&nr(s,d.calc(H(c)),!0)}async function p(){await sleep(500),H(o).forEach(async(e,t)=>{let[n,r]=await e.executeJavaScript(`[document.body.offsetWidth, document.body.offsetHeight]`);H(a)[t]={...H(a)[t],printSize:`${n}×${r}px²\n${Ka(n)}×${Ka(r)}mm²`}})}async function m(){await f(),await p()}async function h(e,n,i){let a=Nh(Qa(H(r).concurrency)||5),o=qe(t.config);console.debug(`file list data:`,e,o);let s=e.map((e,t)=>a(async()=>{let n=await lo({...e,config:o});return i?.(t),n})),c=[...n??[],...await Promise.all(s)];return t.modal.file instanceof l.TFile&&await t.modal.app.workspace.getLeaf().openFile(t.modal.file),t.modal.multiplePdf||(c=t.modal.mergeDoc(c)),c.map(({doc:e,...t})=>({...t,doc:ho(e,e.title)}))}async function g(e=!0){if(e){let{data:e,docs:n}=await t.modal.getAllFiles();nr(u,Ch(e),!0),nr(a,await h(e,n,e=>{nr(u,wh(H(u),e),!0)}),!0)}nr(o,[],!0);let n=H(a).map(e=>new Promise(t=>{e.resolve=t}));await Promise.all(n),f(),await p()}function _(e){H(o).forEach((t,n)=>{t.executeJavaScript(` var _title = document.querySelector("h1.__title__"); if (_title) { _title.style.display = "${e?`block`:`none`}"; } `);let r=H(a)[n]?.doc?.querySelector(`h1.__title__`);r&&(r.style.display=e?`block`:`none`)})}async function v(){let e=t.modal.file?.basename??t.modal.file?.name;if(t.modal.multiplePdf){let n=await Sh(e);n&&await Promise.all(H(o).map(async(e,i)=>{await bh(`${n}/${H(a)[i].file.basename}.pdf`,{...H(r),...t.config},e,H(a)[i])}))}else{let n=await xh(e,H(r).isTimestamp);n&&await bh(n,{...H(r),...t.config},H(o)[0],H(a)[0])}}function y(){H(o)?.[-1]?.openDevTools()}function b(e,r){H(o).push(e);let a=async()=>{if(nr(i,!0),ro().forEach(async t=>{await e.insertCSS(t)}),t.config.cssSnippet&&t.config.cssSnippet!=`0`)try{let r=await n.readFile(t.config.cssSnippet,{encoding:`utf8`}),i=r.replaceAll(/@media print\s*{([^}]+)}/g,`$1`);await e.insertCSS(i),await e.insertCSS(r)}catch(e){console.warn(e)}await e.executeJavaScript(bo(r.doc)),ao().forEach(async t=>{await e.insertCSS(t)}),r.resolve&&r.resolve()};return e.addEventListener(`dom-ready`,a),{destroy(){e.removeEventListener(`dom-ready`,a)}}}za(()=>{if(H(c))return d.startObserver(H(c)),g(!0),()=>{d.stopObserver()}});var x={calcPageSize:f,calcWebviewSize:p,handleChangeSize:m,renderPreview:g,toggleTitle:_,handlePrintToPDF:v,handleOpenDevTools:y},S=Bh(),C=gr(S),w=gr(C),T=e=>{var t=Lh();oa(vr(_r(t),2),17,()=>H(u),na,(e,t)=>{var n=Ih(),r=gr(n),i=e=>{var t=Fh();pa(t,(e,t)=>Po?.(e,t),()=>`check`),Bi(e,t)},a=e=>{var t=Fh();pa(t,(e,t)=>Po?.(e,t),()=>`loader`),Bi(e,t)};ta(r,e=>{H(t).status?e(i):e(a,-1)});var o=vr(r);ze(n),Fr(()=>Vi(o,` ${H(t).filename??``}`)),Bi(e,n)}),Bi(e,t)},E=Qt(()=>H(u).length>0&&!H(u).every(e=>e.status));ta(w,e=>{H(E)&&e(T)}),ze(C);var D=vr(C,2);return oa(D,21,()=>H(a),na,(e,n,r)=>{var i=zh(),a=_r(i),o=e=>{var t=Rh(),i=gr(t);ze(t),Fr(()=>Vi(i,`${r+1}-${H(n).doc.title??``}`)),Bi(e,t)};ta(a,e=>{t.modal.multiplePdf&&e(o)});var c=vr(a,2),l=gr(c);let u;var d=gr(l,!0);ze(l);var f=vr(l,2);Ta(f,`nodeintegration`,!0),pa(f,(e,t)=>b?.(e,t),()=>H(n)),ze(c),Fr(()=>{u=xa(l,``,u,{visibility:t.config.pageSize===`Custom`?`visible`:`hidden`}),Vi(d,H(n).printSize??``),xa(f,`--modal-scale: ${H(s)??``};`)}),Bi(e,i)}),ze(D),La(D,e=>nr(c,e),()=>H(c)),ze(S),Bi(e,S),Qe(x)}var Hh=zi(`
`),Uh={hash:`svelte-184lr04`,code:`.toggle-container.svelte-184lr04 {display:flex;gap:0px;text-align:right;justify-content:right;position:absolute;top:0;right:0;z-index:99;}button.svelte-184lr04 {height:24px;width:56px;padding:2px 4px;border:1px solid var(--background-modifier-border);background:var(--background-primary);color:var(--text-normal);cursor:pointer;border-radius:0px;display:flex;justify-content:center;line-height:14px;gap:2px;font-size:12px;}button.svelte-184lr04:hover {background:var(--background-modifier-hover);}button.active.svelte-184lr04 {background:var(--interactive-accent);color:var(--text-on-accent);border-color:var(--interactive-accent);}`};function Wh(e,t){Ze(t,!0),fa(e,Uh);let n=Ra(t,`initialMode`,3,`html`),r=er(sr(Ci(()=>qe(n()))));function i(e){H(r)!==e&&(nr(r,e,!0),t.onChange?.(H(r)))}var a=Hh(),o=gr(a);let s;var c=gr(o);pa(c,(e,t)=>Po?.(e,t),()=>`globe`),xa(vr(c,2),``,{},{"margin-left":`2px`}),ze(o);var l=vr(o,2);let u;var d=gr(l);pa(d,(e,t)=>Po?.(e,t),()=>`notebook`),xa(vr(d,2),``,{},{"margin-left":`2px`}),ze(l),ze(a),Fr(()=>{s=ya(o,1,`svelte-184lr04`,null,s,{active:H(r)===`html`}),u=ya(l,1,`svelte-184lr04`,null,u,{active:H(r)===`pdf`})}),ji(`click`,o,()=>i(`html`)),ji(`click`,l,()=>i(`pdf`)),Bi(e,a),Qe()}Mi([`click`]);var Gh=class{constructor(){this.queue=Promise.resolve()}async run(e){let t=this.queue.then(()=>e());return this.queue=t.catch(()=>{}),t}},Kh=zi(``),qh=zi(`
`),Jh=zi(`
Rendering...
`,1),Yh=zi(`
Rendering
`),Xh=zi(`
`),Zh=zi(` `,1),Qh=zi(`
`),$h=zi(``),eg={hash:`svelte-1czt1i6`,code:`.rendering.svelte-1czt1i6 {position:absolute;display:flex;flex-direction:row;align-items:center;justify-content:center;}`};function tg(e,t){Ze(t,!0),fa(e,eg);let n=require("fs").promises,r=Qt(()=>t.plugin.settings),i=er(!1),a=er(!1),o=er(sr([])),s=er(.75),c=er(void 0),p=er(sr([])),m=sr([]),h=sr([]),g=sr({}),_=qe(t.config),v=Qt(()=>yh({...H(r),...t.config})),y=new Eh(t.config);function b(){H(c)&&nr(s,y.calc(H(c)),!0)}async function x(){await b()}async function S(e,n){let i=Nh(Qa(H(r).concurrency)||5);console.debug(`file list data:`,e);let a=e.map((e,r)=>i(async()=>{let i=await uo({app:t.modal.app,file:e.file,config:t.config});return n?.(r),i})),o=[...await Promise.all(a)];return console.debug(o,t.modal.multiplePdf),!t.modal.multiplePdf&&o.length>1&&(o=t.modal.mergeDocV2(o)),o.map(({doc:e,...t})=>({...t,doc:go(e,e.title)}))}async function C(e=!0){if(e){let{data:e}=await t.modal.getAllFilesV2();nr(o,Ch(e),!0),nr(p,await S(e,e=>{nr(o,wh(H(o),e),!0)}),!0)}b()}async function w(e){nr(p,H(p).map(({doc:t,...n})=>{let r=t?.querySelector(`h1.__title__`);return r&&(r.style.display=e?`block`:`none`),{doc:t,...n}}),!0),H(c)?.querySelectorAll(`h1.__title__`).forEach(t=>{t.style.display=e?`block`:`none`})}function T(e,t){let n=()=>{m[t]={width:e.offsetWidth,height:e.offsetHeight}};n();let r=new ResizeObserver(n);return r.observe(e),{destroy:()=>r.disconnect()}}za(()=>{if(H(c))return y.startObserver(H(c)),C(!0),()=>{y.stopObserver()}}),Ba(()=>{document.querySelectorAll(`.print`).forEach(e=>e.remove())}),kr(()=>{console.debug(`config:`,qe(t.config))});let E=new Gh;async function D({el:e,outputFile:i,title:a,onlyPreview:o=!1}){console.debug(`printOptions:`,H(v));let s={...H(v),filepath:i};if(await E.run(async()=>{document.title=a,await So(e,s)}),o)return;let c=await n.readFile(i);c=await gh(c,{headings:Ha(e),frontMatter:H(p)[0].frontMatter,displayMetadata:H(r)?.displayMetadata,maxLevel:Qa(H(r)?.maxLevel,6)}),await n.writeFile(i,c),t.config.open&&u.remote.shell.openPath(i)}async function O({docs:e,outfiles:t,cb:n,onlyPreview:r}){let i=document.title;e.forEach(({doc:e})=>{e.style.display=`none`});for(let[i,a]of t.entries()){let{doc:t,file:o}=e[i],s=o.basename;t.style.display=`block`,await sleep(200),await D({el:t,outputFile:a,title:s,onlyPreview:r}),t.style.display=`none`,n&&await n(a)}document.title=i}async function k(){let e=t.modal.file?.basename??t.modal.file?.name,n=[];if(t.modal.multiplePdf){let t=await Sh(e);if(!t)return!1;n.push(...H(p).map(e=>`${t}/${e.file.basename}.pdf`))}else{let t=await xh(e,H(r).isTimestamp);if(!t)return!1;n.push(t)}return await O({docs:H(p),outfiles:n}),!0}async function ee(){nr(a,!0);let e=await(0,l.loadPdfJs)(),r=f.tmpdir(),i=0;async function o(t){let r=await n.readFile(t),a=await e.getDocument({data:r}).promise;console.debug(`loading tmp file`,a.numPages);for(let e=1;e<=a.numPages;e++){let t=await a.getPage(e),n=document.createElement(`canvas`),r=n.getContext(`2d`),o=t.getViewport({scale:5});n.height=o.height,n.width=o.width,await t.render({canvasContext:r,viewport:o}).promise,id.join(r,`obsidian-temp-${e.path.replace(/[/\\]/g,`_`)}-${Date.now()}.pdf`));console.debug(`tempFiles`,e),await O({docs:H(p),outfiles:e,cb:o,onlyPreview:!0}),g[s]=e}h.length=i,nr(a,!1),console.debug(`loaded tmp canvas pages:`,i)}function A(){document.win.electron.remote.getCurrentWebContents().openDevTools()}async function j(e){e===`pdf`?(nr(i,!0),await ee(),nr(a,!1)):nr(i,!1)}kr(()=>{let e=qe(t.config),n=[];for(let t of[`pageSize`,`scale`,`landscape`,`marginBottom`,`marginLeft`,`marginRight`,`marginTop`,`marginType`,`displayHeader`,`displayFooter`,`showTitle`]){let r=t;e?.[r]!=_?.[r]&&n.push({key:r,oldValue:_[r],newValue:e[r]})}if(n.length==0||(_=e,!H(i)))return;nr(a,!0);let r=setTimeout(async()=>{await ee(),nr(a,!1)},300);return()=>clearTimeout(r)});var te={calcPageSize:b,handleChangeSize:x,renderPreview:C,toggleTitle:w,exportToPDF:D,printDocs:O,handlePrintToPDF:k,handleOpenDevTools:A},ne=$h(),re=gr(ne),ie=gr(re),ae=e=>{var t=Jh();oa(vr(_r(t),2),17,()=>H(o),na,(e,t)=>{var n=qh(),r=gr(n),i=e=>{var t=Kh();pa(t,(e,t)=>Po?.(e,t),()=>`check`),Bi(e,t)},a=e=>{var t=Kh();pa(t,(e,t)=>Po?.(e,t),()=>`loader`),Bi(e,t)};ta(r,e=>{H(t).status?e(i):e(a,-1)});var o=vr(r);ze(n),Fr(()=>Vi(o,` ${H(t).filename??``}`)),Bi(e,n)}),Bi(e,t)},oe=Qt(()=>H(o).length>0&&!H(o).every(e=>e.status));ta(ie,e=>{H(oe)&&e(ae)}),ze(re);var se=vr(re,2),ce=e=>{var t=Yh();pa(gr(t),(e,t)=>Po?.(e,t),()=>`loader`),Be(2),ze(t),Bi(e,t)};ta(se,e=>{H(a)&&e(ce)});var le=vr(se,2);Wh(le,{initialMode:`html`,onChange:j});var ue=vr(le,2),M=gr(ue),N=gr(M);let de;oa(N,21,()=>H(p),na,(e,n,r)=>{var i=Zh(),a=_r(i);let o;var s=gr(a,!0);ze(a);var c=vr(a,2),l=e=>{var t=Xh(),r=gr(t,!0);ze(t),Fr(()=>Vi(r,H(n).file.name)),Bi(e,t)};ta(c,e=>{t.modal.multiplePdf&&e(l)});var u=vr(c,2);pa(u,(e,t)=>Fo?.(e,t),()=>H(n).doc),pa(u,(e,t)=>T?.(e,t),()=>r),Fr(e=>{o=xa(a,``,o,{visibility:t.config.pageSize===`Custom`?`visible`:`hidden`}),Vi(s,e)},[()=>m[r]?`${m[r].width}×${m[r].height}px\n${Ka(m[r].width)}×${Ka(m[r].height)}mm`:``]),Bi(e,i)}),ze(N);var fe=vr(N,2);let pe;return oa(fe,20,()=>h,e=>e,(e,t)=>{var n=Qh();pa(n,(e,t)=>Io?.(e,t),()=>t),Bi(e,n)}),ze(fe),ze(M),ze(ue),La(ue,e=>nr(c,e),()=>H(c)),ze(ne),Fr(()=>{de=xa(N,`--modal-scale: ${H(s)??``};`,de,{display:H(i)?`none`:`block`}),pe=xa(fe,``,pe,{display:H(i)?`block`:`none`})}),Bi(e,ne),Qe(te)}var ng=zi(`
`);function rg(e,t){Ze(t,!0);let n=Ra(t,`plugin`,7),r=er(sr(Ci(()=>qe(t.modal.defaultConfig)))),i=er(null);async function a(){await H(i)?.renderPreview(!1)}async function o(){await H(i)?.renderPreview(!0)}async function s(){await H(i)?.handleOpenDevTools()}async function c(){if(n().settings.prevConfig=H(r),await n().saveSettings(),H(r).pageSize==`Custom`&&(!Za(H(r).pageWidth??``)||!Za(H(r).pageHeight??``))){alert(`When the page size is Custom, the Width/Height cannot be empty.`);return}await H(i)?.handlePrintToPDF(),t.modal.close()}var l={onCssSnippetChange:a,refreshPreview:o,handleOpenDevTools:s,handleExport:c},u=ng(),d=gr(u),f=e=>{La(Vh(e,{get modal(){return t.modal},get plugin(){return n()},get config(){return H(r)}}),e=>nr(i,e,!0),()=>H(i))},p=e=>{La(tg(e,{get modal(){return t.modal},get plugin(){return n()},get config(){return H(r)}}),e=>nr(i,e,!0),()=>H(i))};return ta(d,e=>{n().settings?.version==`1`?e(f):e(p,-1)}),Bo(vr(d,2),{get modal(){return t.modal},get plugin(){return n()},get pdfPreview(){return H(i)},handleExport:c,refreshPreview:o,get config(){return H(r)},set config(e){nr(r,e,!0)}}),ze(u),Bi(e,u),Qe(l)}require("fs").promises;var ig=class extends l.Modal{constructor(e,t,n){super(e.app),this.plugin=e,this.file=t,this.i18n=m.current,this.multiplePdf=n,this.defaultConfig={pageSize:`A4`,marginType:`1`,showTitle:e.settings.showTitle??!0,open:!0,scale:100,landscape:!1,marginTop:`10`,marginBottom:`10`,marginLeft:`10`,marginRight:`10`,displayHeader:e.settings.displayHeader??!0,displayFooter:e.settings.displayHeader??!0,cssSnippet:`0`,...e.settings.prevConfig??{}}}onOpen(){this.contentEl.empty(),this.containerEl.style.setProperty(`--dialog-width`,`60vw`),this.titleEl.setText(`Export to PDF`);let e=eo();console.debug(`检测到以下衍生变量在亮色主题下未重置,即将进行注入:`,e),to(e),this.component=Hi(rg,{target:this.contentEl,props:{modal:this,plugin:this.plugin}})}onClose(){this.component&&(Ki(this.component),this.component=void 0),this.contentEl.empty(),document.querySelectorAll(`.print`).forEach(e=>e.remove()),no()}getFileCache(e){return this.app.metadataCache.getFileCache(e)}async getAllFiles(){let e=this.plugin.app,t=[],n=[];if(this.file instanceof l.TFolder){let n=Ja(this.file);for(let r of n)t.push({app:e,file:r})}else{let{doc:r,frontMatter:i,file:a}=await lo({app:e,file:this.file,config:this.defaultConfig});if(n.push({doc:r,frontMatter:i,file:a}),i.toc){let n=this.parseToc(r);for(let r of n)t.push({app:e,file:r.file,extra:r})}}return{data:t,docs:n}}async getAllFilesV2(){let e=[];if(this.file instanceof l.TFolder){let t=Ja(this.file);for(let n of t)e.push({file:n})}else{let{frontmatter:t,links:n}=this.getFileCache(this.file)??{};if(e.push({file:this.file,toc:t?.toc}),t?.toc&&n)for(let t of n){let n=this.app.metadataCache.getFirstLinkpathDest(t.link,this.file.path);n instanceof l.TFile&&e.push({file:n})}}return{data:e,multiplePdf:this.multiplePdf}}parseToc(e){return this.getFileCache(this.file)?.links?.map(({link:t,displayText:n})=>{let r=crypto.randomUUID(),i=e.querySelector(`a[data-href="${t}"]`);return i&&(i.href=`#${r}`),{title:n,file:this.app.metadataCache.getFirstLinkpathDest(t,this.file.path),id:r}}).filter(e=>e.file instanceof l.TFile)??[]}mergeDoc(e){let{doc:t,frontMatter:n,file:r}=e[0],i=[];for(let{doc:n}of e){let e=n.querySelector(`.markdown-preview-view`);if(e){let n=t.createElement(`section`);Array.from(e.children).forEach(e=>{n.appendChild(t.importNode(e,!0))}),i.push(n)}}let a=t.querySelector(`.markdown-preview-view`);return a&&(a.innerHTML=``),i.forEach(e=>{a?.appendChild(e)}),[{doc:t,frontMatter:n,file:r,node:a}]}mergeDocV2(e){let t=document.body.createDiv(`print`);for(let{doc:n}of e){let e=n.querySelector(`.markdown-preview-view`);e&&t.appendChild(e),document.body.removeChild(n)}return[{...e[0],doc:t}]}cssSnippets(){let{snippets:e,enabledSnippets:t}=this.app?.customCss??{},n=this.app.vault.adapter.basePath;return Object.fromEntries(e?.filter(e=>!t.has(e)).map(e=>[d.default.join(n,`.obsidian/snippets`,e+`.css`),e]))}};function ag(e,t){for(let n in t)e.setAttribute(n,t[n])}var og=(e,t=175)=>{let n=e.createEl(`a`,{href:`https://www.buymeacoffee.com/l1xnan`}).createEl(`img`);n.src=`https://img.buymeacoffee.com/button-api/?text=Buy me a coffee&emoji=&slug=nathangeorge&button_colour=6a8696&font_colour=ffffff&font_family=Poppins&outline_colour=000000&coffee_colour=FFDD00`,n.alt=`Buy me a coffee`,n.width=t},sg=class extends l.PluginSettingTab{constructor(e,t){super(e,t),this.plugin=t,this.i18n=m.current}display(){let{containerEl:e}=this;e.empty();let t=new DocumentFragment;t.createDiv({text:`Support the continued development of this plugin.`}),new l.Setting(e).setDesc(t),og(e),new l.Setting(e).setName(this.i18n.settings.version).addDropdown(e=>{e.addOptions(Object.fromEntries([`1`,`2`].map(e=>[e,`v${e}`]))).setValue(this.plugin.settings.version).onChange(async e=>{this.plugin.settings.version=e,this.plugin.saveSettings(),s(e)})}),new l.Setting(e).setName(this.i18n.settings.showTitle).addToggle(e=>e.setTooltip(this.i18n.settings.showTitle).setValue(this.plugin.settings.showTitle).onChange(async e=>{this.plugin.settings.showTitle=e,this.plugin.saveSettings()})),new l.Setting(e).setName(this.i18n.settings.displayHeader).addToggle(e=>e.setTooltip(`Display header`).setValue(this.plugin.settings.displayHeader).onChange(async e=>{this.plugin.settings.displayHeader=e,this.plugin.saveSettings()})),new l.Setting(e).setName(this.i18n.settings.displayFooter).addToggle(e=>e.setTooltip(`Display footer`).setValue(this.plugin.settings.displayFooter).onChange(async e=>{this.plugin.settings.displayFooter=e,this.plugin.saveSettings()})),new l.Setting(e).setName(this.i18n.settings.printBackground).setDesc(`Whether to print background graphics`).addToggle(e=>e.setValue(this.plugin.settings.printBackground).onChange(async e=>{this.plugin.settings.printBackground=e,this.plugin.saveSettings()})),new l.Setting(e).setName(`Generate tagged PDF`).setDesc(`Whether or not to generate a tagged (accessible) PDF. Defaults to false. As this property is experimental, the generated PDF may not adhere fully to PDF/UA and WCAG standards.`).addToggle(e=>e.setValue(this.plugin.settings.generateTaggedPDF).onChange(async e=>{this.plugin.settings.generateTaggedPDF=e,this.plugin.saveSettings()})),new l.Setting(e).setName(this.i18n.settings.maxLevel).addDropdown(e=>{e.addOptions(Object.fromEntries([`1`,`2`,`3`,`4`,`5`,`6`].map(e=>[e,`h${e}`]))).setValue(this.plugin.settings.maxLevel).onChange(async e=>{this.plugin.settings.maxLevel=e,this.plugin.saveSettings()})}),new l.Setting(e).setName(this.i18n.settings.displayMetadata).setDesc(`Add frontMatter(title, author, keywords, subject creator, etc) to pdf metadata`).addToggle(e=>e.setValue(this.plugin.settings.displayMetadata).onChange(async e=>{this.plugin.settings.displayMetadata=e,this.plugin.saveSettings()})),new l.Setting(e).setName(`Advanced`).setHeading();let n=new l.Setting(e);n.settingEl.setAttribute(`style`,`display: grid; grid-template-columns: 1fr;`),n.setName(this.i18n.settings.headerTemplate).setDesc(`HTML template for the print header. Should be valid HTML markup with following classes used to inject printing values into them: date (formatted print date), title (document title), url (document location), pageNumber (current page number) and totalPages (total pages in the document). For example, would generate span containing the title.`);let r=new l.TextAreaComponent(n.controlEl);ag(r.inputEl,{style:`margin-top: 12px; width: 100%; height: 6vh;`}),r.setValue(this.plugin.settings.headerTemplate).onChange(async e=>{this.plugin.settings.headerTemplate=e,this.plugin.saveSettings()});let i=new l.Setting(e);i.settingEl.setAttribute(`style`,`display: grid; grid-template-columns: 1fr;`),i.setName(this.i18n.settings.footerTemplate).setDesc(`HTML template for the print footer. Should use the same format as the headerTemplate.`);let a=new l.TextAreaComponent(i.controlEl);ag(a.inputEl,{style:`margin-top: 12px; width: 100%; height: 6vh;`}),a.setValue(this.plugin.settings.footerTemplate).onChange(async e=>{this.plugin.settings.footerTemplate=e,this.plugin.saveSettings()}),new l.Setting(e).setName(this.i18n.settings.isTimestamp).setDesc(`Add timestamp to output file name`).addToggle(e=>{e.setValue(this.plugin.settings.isTimestamp).onChange(async e=>{this.plugin.settings.isTimestamp=e,await this.plugin.saveSettings()})});let o=new l.Setting(e).setName(this.i18n.settings.enabledCss).setDesc(`Select the css snippet that are not enabled`).addToggle(e=>{e.setValue(this.plugin.settings.enabledCss).onChange(async e=>{this.plugin.settings.enabledCss=e,await this.plugin.saveSettings()})}),s=e=>{o.settingEl.hidden=e!==`1`};s(this.plugin.settings.version),new l.Setting(e).setName(this.i18n.settings.concurrency).setDesc(`Limit the number of concurrent renders`).addText(e=>{let t=this.plugin.settings?.concurrency;e.setValue(t?.length>0?t:`5`).onChange(async e=>{this.plugin.settings.concurrency=e,await this.plugin.saveSettings()})}),new l.Setting(e).setName(`Debug`).setHeading(),new l.Setting(e).setName(this.i18n.settings.debugMode).setDesc(`This is useful for troubleshooting.`).addToggle(e=>{e.setValue(this.plugin.settings.debug).onChange(async e=>{this.plugin.settings.debug=e,await this.plugin.saveSettings()})})}},cg=require("fs").promises,lg=process.env.NODE_ENV===`development`,ug={showTitle:!0,maxLevel:`6`,displayHeader:!0,displayFooter:!0,headerTemplate:`
`,footerTemplate:`
/
`,printBackground:!1,generateTaggedPDF:!1,displayMetadata:!1,debug:!1,isTimestamp:!1,enabledCss:!1,concurrency:`5`,version:`2`},dg=class extends l.Plugin{constructor(e,t){super(e,t),this.i18n=m.current}async onload(){await this.loadSettings(),this.registerCommand(),this.registerSetting(),this.registerEvents()}registerCommand(){this.addCommand({id:`export-current-file-to-pdf`,name:this.i18n.exportCurrentFile,checkCallback:e=>{let t=this.app.workspace.getActiveViewOfType(l.MarkdownView)?.file;return t?(e||new ig(this,t).open(),!0):!1}})}registerSetting(){this.addSettingTab(new sg(this.app,this))}registerEvents(){this.registerEvent(this.app.workspace.on(`file-menu`,(e,t)=>{let n=t instanceof l.TFolder?`Export folder to PDF`:`Better Export PDF`;lg&&(n=`${n} (dev)`),e.addItem(e=>{e.setTitle(n).setIcon(`download`).setSection(`action`).onClick(async()=>{new ig(this,t).open()})})})),this.registerEvent(this.app.workspace.on(`file-menu`,(e,t)=>{if(t instanceof l.TFolder){let n=`Export to PDF...`;lg&&(n=`${n} (dev)`),e.addItem(e=>{e.setTitle(n).setIcon(`lucide-folder-down`).setSection(`action`);let r=e.setSubmenu();r.addItem(e=>e.setTitle(`Export each file to PDF`).setIcon(`lucide-file-stack`).onClick(async()=>{new ig(this,t,!0).open()})),r.addItem(e=>e.setTitle(`Generate TOC.md file`).setIcon(`lucide-file-text`).onClick(async()=>{await this.generateToc(t)}))})}}))}async generateToc(e){let t=this.app.vault.adapter.basePath,n=d.default.join(t,e.path,`_TOC_.md`),r=`---\ntoc: true\ntitle: ${e.name}\n---\n`;if(await cg.writeFile(n,r),e instanceof l.TFolder){let t=Ja(e);for(let e of t)e.name!=`_TOC_.md`&&await cg.appendFile(n,`[[${e.path}]]\n`)}}onunload(){}async loadSettings(){this.settings=Object.assign({},ug,await this.loadData())}async saveSettings(){await this.saveData(this.settings)}changeConfig(){let e=this.app.vault?.getConfig(`theme`)===`obsidian`;e&&(document.body.addClass(`theme-light`),document.body.removeClass(`theme-dark`)),document.body.removeClass(`theme-dark`);let t=document.body.createDiv(`print`);t.addEventListener(`click`,function(){t.detach(),e&&(document.body.removeClass(`theme-light`),document.body.addClass(`theme-dark`))});let n=document.body.createDiv(`print`).createDiv(`markdown-preview-view markdown-rendered`);n.toggleClass(`rtl`,this.app.vault.getConfig(`rightToLeft`)),n.toggleClass(`show-frontmatter`,this.app.vault.getConfig(`showFrontmatter`)),n.createEl(`h1`,{text:`xxxxx`})}};module.exports=dg; /* nosourcemap */