/* THIS IS A GENERATED/BUNDLED FILE BY ESBUILD if you want to view the source, please visit the github repository of this plugin */ var T1=Object.create;var Na=Object.defineProperty;var A1=Object.getOwnPropertyDescriptor;var I1=Object.getOwnPropertyNames;var B1=Object.getPrototypeOf,O1=Object.prototype.hasOwnProperty;var wm=n=>{throw TypeError(n)};var L1=(n,e,t)=>e in n?Na(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var _=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),vf=(n,e)=>{for(var t in e)Na(n,t,{get:e[t],enumerable:!0})},Fm=(n,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of I1(e))!O1.call(n,r)&&r!==t&&Na(n,r,{get:()=>e[r],enumerable:!(i=A1(e,r))||i.enumerable});return n};var Wi=(n,e,t)=>(t=n!=null?T1(B1(n)):{},Fm(e||!n||!n.__esModule?Na(t,"default",{value:n,enumerable:!0}):t,n)),M1=n=>Fm(Na({},"__esModule",{value:!0}),n);var wf=(n,e,t)=>L1(n,typeof e!="symbol"?e+"":e,t),Dm=(n,e,t)=>e.has(n)||wm("Cannot "+t);var qe=(n,e,t)=>(Dm(n,e,"read from private field"),t?t.call(n):e.get(n)),mn=(n,e,t)=>e.has(n)?wm("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(n):e.set(n,t),Lt=(n,e,t,i)=>(Dm(n,e,"write to private field"),i?i.call(n,t):e.set(n,t),t);var Ff=(n,e,t,i)=>({set _(r){Lt(n,e,r,t)},get _(){return qe(n,e,i)}});var bn=_(St=>{"use strict";var W1=typeof Uint8Array!="undefined"&&typeof Uint16Array!="undefined"&&typeof Int32Array!="undefined";function K1(n,e){return Object.prototype.hasOwnProperty.call(n,e)}St.assign=function(n){for(var e=Array.prototype.slice.call(arguments,1);e.length;){var t=e.shift();if(t){if(typeof t!="object")throw new TypeError(t+"must be non-object");for(var i in t)K1(t,i)&&(n[i]=t[i])}}return n};St.shrinkBuf=function(n,e){return n.length===e?n:n.subarray?n.subarray(0,e):(n.length=e,n)};var G1={arraySet:function(n,e,t,i,r){if(e.subarray&&n.subarray){n.set(e.subarray(t,t+i),r);return}for(var o=0;o{"use strict";var Z1=bn(),Y1=4,Im=0,Bm=1,_1=2;function ms(n){for(var e=n.length;--e>=0;)n[e]=0}var J1=0,Vm=1,Q1=2,$1=3,eF=258,Yf=29,Ya=256,Ka=Ya+1+Yf,gs=30,_f=19,Hm=2*Ka+1,eo=15,jf=16,tF=7,Jf=256,zm=16,Um=17,qm=18,Xf=[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],xd=[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],iF=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7],jm=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],nF=512,yn=new Array((Ka+2)*2);ms(yn);var Wa=new Array(gs*2);ms(Wa);var Ga=new Array(nF);ms(Ga);var Xa=new Array(eF-$1+1);ms(Xa);var Qf=new Array(Yf);ms(Qf);var bd=new Array(gs);ms(bd);function Wf(n,e,t,i,r){this.static_tree=n,this.extra_bits=e,this.extra_base=t,this.elems=i,this.max_length=r,this.has_stree=n&&n.length}var Wm,Km,Gm;function Kf(n,e){this.dyn_tree=n,this.max_code=0,this.stat_desc=e}function Xm(n){return n<256?Ga[n]:Ga[256+(n>>>7)]}function Za(n,e){n.pending_buf[n.pending++]=e&255,n.pending_buf[n.pending++]=e>>>8&255}function Rt(n,e,t){n.bi_valid>jf-t?(n.bi_buf|=e<>jf-n.bi_valid,n.bi_valid+=t-jf):(n.bi_buf|=e<>>=1,t<<=1;while(--e>0);return t>>>1}function rF(n){n.bi_valid===16?(Za(n,n.bi_buf),n.bi_buf=0,n.bi_valid=0):n.bi_valid>=8&&(n.pending_buf[n.pending++]=n.bi_buf&255,n.bi_buf>>=8,n.bi_valid-=8)}function oF(n,e){var t=e.dyn_tree,i=e.max_code,r=e.stat_desc.static_tree,o=e.stat_desc.has_stree,s=e.stat_desc.extra_bits,a=e.stat_desc.extra_base,c=e.stat_desc.max_length,l,d,h,u,p,f,m=0;for(u=0;u<=eo;u++)n.bl_count[u]=0;for(t[n.heap[n.heap_max]*2+1]=0,l=n.heap_max+1;lc&&(u=c,m++),t[d*2+1]=u,!(d>i)&&(n.bl_count[u]++,p=0,d>=a&&(p=s[d-a]),f=t[d*2],n.opt_len+=f*(u+p),o&&(n.static_len+=f*(r[d*2+1]+p)));if(m!==0){do{for(u=c-1;n.bl_count[u]===0;)u--;n.bl_count[u]--,n.bl_count[u+1]+=2,n.bl_count[c]--,m-=2}while(m>0);for(u=c;u!==0;u--)for(d=n.bl_count[u];d!==0;)h=n.heap[--l],!(h>i)&&(t[h*2+1]!==u&&(n.opt_len+=(u-t[h*2+1])*t[h*2],t[h*2+1]=u),d--)}}function Ym(n,e,t){var i=new Array(eo+1),r=0,o,s;for(o=1;o<=eo;o++)i[o]=r=r+t[o-1]<<1;for(s=0;s<=e;s++){var a=n[s*2+1];a!==0&&(n[s*2]=Zm(i[a]++,a))}}function sF(){var n,e,t,i,r,o=new Array(eo+1);for(t=0,i=0;i>=7;i8?Za(n,n.bi_buf):n.bi_valid>0&&(n.pending_buf[n.pending++]=n.bi_buf),n.bi_buf=0,n.bi_valid=0}function aF(n,e,t,i){Jm(n),i&&(Za(n,t),Za(n,~t)),Z1.arraySet(n.pending_buf,n.window,e,t,n.pending),n.pending+=t}function Om(n,e,t,i){var r=e*2,o=t*2;return n[r]>1;s>=1;s--)Gf(n,t,s);l=o;do s=n.heap[1],n.heap[1]=n.heap[n.heap_len--],Gf(n,t,1),a=n.heap[1],n.heap[--n.heap_max]=s,n.heap[--n.heap_max]=a,t[l*2]=t[s*2]+t[a*2],n.depth[l]=(n.depth[s]>=n.depth[a]?n.depth[s]:n.depth[a])+1,t[s*2+1]=t[a*2+1]=l,n.heap[1]=l++,Gf(n,t,1);while(n.heap_len>=2);n.heap[--n.heap_max]=n.heap[1],oF(n,e),Ym(t,c,n.bl_count)}function Mm(n,e,t){var i,r=-1,o,s=e[1],a=0,c=7,l=4;for(s===0&&(c=138,l=3),e[(t+1)*2+1]=65535,i=0;i<=t;i++)o=s,s=e[(i+1)*2+1],!(++a=3&&n.bl_tree[jm[e]*2+1]===0;e--);return n.opt_len+=3*(e+1)+5+5+4,e}function cF(n,e,t,i){var r;for(Rt(n,e-257,5),Rt(n,t-1,5),Rt(n,i-4,4),r=0;r>>=1)if(e&1&&n.dyn_ltree[t*2]!==0)return Im;if(n.dyn_ltree[18]!==0||n.dyn_ltree[20]!==0||n.dyn_ltree[26]!==0)return Bm;for(t=32;t0?(n.strm.data_type===_1&&(n.strm.data_type=dF(n)),Zf(n,n.l_desc),Zf(n,n.d_desc),s=lF(n),r=n.opt_len+3+7>>>3,o=n.static_len+3+7>>>3,o<=r&&(r=o)):r=o=t+5,t+4<=r&&e!==-1?Qm(n,e,t,i):n.strategy===Y1||o===r?(Rt(n,(Vm<<1)+(i?1:0),3),Lm(n,yn,Wa)):(Rt(n,(Q1<<1)+(i?1:0),3),cF(n,n.l_desc.max_code+1,n.d_desc.max_code+1,s+1),Lm(n,n.dyn_ltree,n.dyn_dtree)),_m(n),i&&Jm(n)}function pF(n,e,t){return n.pending_buf[n.d_buf+n.last_lit*2]=e>>>8&255,n.pending_buf[n.d_buf+n.last_lit*2+1]=e&255,n.pending_buf[n.l_buf+n.last_lit]=t&255,n.last_lit++,e===0?n.dyn_ltree[t*2]++:(n.matches++,e--,n.dyn_ltree[(Xa[t]+Ya+1)*2]++,n.dyn_dtree[Xm(e)*2]++),n.last_lit===n.lit_bufsize-1}xs._tr_init=hF;xs._tr_stored_block=Qm;xs._tr_flush_block=fF;xs._tr_tally=pF;xs._tr_align=uF});var $f=_((ZC,ex)=>{"use strict";function gF(n,e,t,i){for(var r=n&65535|0,o=n>>>16&65535|0,s=0;t!==0;){s=t>2e3?2e3:t,t-=s;do r=r+e[i++]|0,o=o+r|0;while(--s);r%=65521,o%=65521}return r|o<<16|0}ex.exports=gF});var e0=_((YC,tx)=>{"use strict";function mF(){for(var n,e=[],t=0;t<256;t++){n=t;for(var i=0;i<8;i++)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n}return e}var xF=mF();function bF(n,e,t,i){var r=xF,o=i+t;n^=-1;for(var s=i;s>>8^r[(n^e[s])&255];return n^-1}tx.exports=bF});var yd=_((_C,ix)=>{"use strict";ix.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"}});var hx=_(_i=>{"use strict";var Et=bn(),oi=$m(),sx=$f(),ar=e0(),yF=yd(),ro=0,vF=1,wF=3,ur=4,nx=5,Yi=0,rx=1,si=-2,FF=-3,t0=-5,DF=-1,PF=1,vd=2,kF=3,CF=4,SF=0,EF=2,Pd=8,TF=9,AF=15,IF=8,BF=29,OF=256,n0=OF+1+BF,LF=30,MF=19,NF=2*n0+1,RF=15,be=3,dr=258,Ii=dr+be+1,VF=32,kd=42,r0=69,wd=73,Fd=91,Dd=103,to=113,Ja=666,rt=1,Qa=2,io=3,vs=4,HF=3;function hr(n,e){return n.msg=yF[e],e}function ox(n){return(n<<1)-(n>4?9:0)}function cr(n){for(var e=n.length;--e>=0;)n[e]=0}function lr(n){var e=n.state,t=e.pending;t>n.avail_out&&(t=n.avail_out),t!==0&&(Et.arraySet(n.output,e.pending_buf,e.pending_out,t,n.next_out),n.next_out+=t,e.pending_out+=t,n.total_out+=t,n.avail_out-=t,e.pending-=t,e.pending===0&&(e.pending_out=0))}function mt(n,e){oi._tr_flush_block(n,n.block_start>=0?n.block_start:-1,n.strstart-n.block_start,e),n.block_start=n.strstart,lr(n.strm)}function Ce(n,e){n.pending_buf[n.pending++]=e}function _a(n,e){n.pending_buf[n.pending++]=e>>>8&255,n.pending_buf[n.pending++]=e&255}function zF(n,e,t,i){var r=n.avail_in;return r>i&&(r=i),r===0?0:(n.avail_in-=r,Et.arraySet(e,n.input,n.next_in,r,t),n.state.wrap===1?n.adler=sx(n.adler,e,r,t):n.state.wrap===2&&(n.adler=ar(n.adler,e,r,t)),n.next_in+=r,n.total_in+=r,r)}function ax(n,e){var t=n.max_chain_length,i=n.strstart,r,o,s=n.prev_length,a=n.nice_match,c=n.strstart>n.w_size-Ii?n.strstart-(n.w_size-Ii):0,l=n.window,d=n.w_mask,h=n.prev,u=n.strstart+dr,p=l[i+s-1],f=l[i+s];n.prev_length>=n.good_match&&(t>>=2),a>n.lookahead&&(a=n.lookahead);do if(r=e,!(l[r+s]!==f||l[r+s-1]!==p||l[r]!==l[i]||l[++r]!==l[i+1])){i+=2,r++;do;while(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]===l[++r]&&is){if(n.match_start=e,s=o,o>=a)break;p=l[i+s-1],f=l[i+s]}}while((e=h[e&d])>c&&--t!==0);return s<=n.lookahead?s:n.lookahead}function no(n){var e=n.w_size,t,i,r,o,s;do{if(o=n.window_size-n.lookahead-n.strstart,n.strstart>=e+(e-Ii)){Et.arraySet(n.window,n.window,e,e,0),n.match_start-=e,n.strstart-=e,n.block_start-=e,i=n.hash_size,t=i;do r=n.head[--t],n.head[t]=r>=e?r-e:0;while(--i);i=e,t=i;do r=n.prev[--t],n.prev[t]=r>=e?r-e:0;while(--i);o+=e}if(n.strm.avail_in===0)break;if(i=zF(n.strm,n.window,n.strstart+n.lookahead,o),n.lookahead+=i,n.lookahead+n.insert>=be)for(s=n.strstart-n.insert,n.ins_h=n.window[s],n.ins_h=(n.ins_h<n.pending_buf_size-5&&(t=n.pending_buf_size-5);;){if(n.lookahead<=1){if(no(n),n.lookahead===0&&e===ro)return rt;if(n.lookahead===0)break}n.strstart+=n.lookahead,n.lookahead=0;var i=n.block_start+t;if((n.strstart===0||n.strstart>=i)&&(n.lookahead=n.strstart-i,n.strstart=i,mt(n,!1),n.strm.avail_out===0)||n.strstart-n.block_start>=n.w_size-Ii&&(mt(n,!1),n.strm.avail_out===0))return rt}return n.insert=0,e===ur?(mt(n,!0),n.strm.avail_out===0?io:vs):(n.strstart>n.block_start&&(mt(n,!1),n.strm.avail_out===0),rt)}function i0(n,e){for(var t,i;;){if(n.lookahead=be&&(n.ins_h=(n.ins_h<=be)if(i=oi._tr_tally(n,n.strstart-n.match_start,n.match_length-be),n.lookahead-=n.match_length,n.match_length<=n.max_lazy_match&&n.lookahead>=be){n.match_length--;do n.strstart++,n.ins_h=(n.ins_h<=be&&(n.ins_h=(n.ins_h<4096)&&(n.match_length=be-1)),n.prev_length>=be&&n.match_length<=n.prev_length){r=n.strstart+n.lookahead-be,i=oi._tr_tally(n,n.strstart-1-n.prev_match,n.prev_length-be),n.lookahead-=n.prev_length-1,n.prev_length-=2;do++n.strstart<=r&&(n.ins_h=(n.ins_h<=be&&n.strstart>0&&(r=n.strstart-1,i=s[r],i===s[++r]&&i===s[++r]&&i===s[++r])){o=n.strstart+dr;do;while(i===s[++r]&&i===s[++r]&&i===s[++r]&&i===s[++r]&&i===s[++r]&&i===s[++r]&&i===s[++r]&&i===s[++r]&&rn.lookahead&&(n.match_length=n.lookahead)}if(n.match_length>=be?(t=oi._tr_tally(n,1,n.match_length-be),n.lookahead-=n.match_length,n.strstart+=n.match_length,n.match_length=0):(t=oi._tr_tally(n,0,n.window[n.strstart]),n.lookahead--,n.strstart++),t&&(mt(n,!1),n.strm.avail_out===0))return rt}return n.insert=0,e===ur?(mt(n,!0),n.strm.avail_out===0?io:vs):n.last_lit&&(mt(n,!1),n.strm.avail_out===0)?rt:Qa}function jF(n,e){for(var t;;){if(n.lookahead===0&&(no(n),n.lookahead===0)){if(e===ro)return rt;break}if(n.match_length=0,t=oi._tr_tally(n,0,n.window[n.strstart]),n.lookahead--,n.strstart++,t&&(mt(n,!1),n.strm.avail_out===0))return rt}return n.insert=0,e===ur?(mt(n,!0),n.strm.avail_out===0?io:vs):n.last_lit&&(mt(n,!1),n.strm.avail_out===0)?rt:Qa}function Zi(n,e,t,i,r){this.good_length=n,this.max_lazy=e,this.nice_length=t,this.max_chain=i,this.func=r}var ys;ys=[new Zi(0,0,0,0,UF),new Zi(4,4,8,4,i0),new Zi(4,5,16,8,i0),new Zi(4,6,32,32,i0),new Zi(4,4,16,16,bs),new Zi(8,16,32,32,bs),new Zi(8,16,128,128,bs),new Zi(8,32,128,256,bs),new Zi(32,128,258,1024,bs),new Zi(32,258,258,4096,bs)];function WF(n){n.window_size=2*n.w_size,cr(n.head),n.max_lazy_match=ys[n.level].max_lazy,n.good_match=ys[n.level].good_length,n.nice_match=ys[n.level].nice_length,n.max_chain_length=ys[n.level].max_chain,n.strstart=0,n.block_start=0,n.lookahead=0,n.insert=0,n.match_length=n.prev_length=be-1,n.match_available=0,n.ins_h=0}function KF(){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=Pd,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 Et.Buf16(NF*2),this.dyn_dtree=new Et.Buf16((2*LF+1)*2),this.bl_tree=new Et.Buf16((2*MF+1)*2),cr(this.dyn_ltree),cr(this.dyn_dtree),cr(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Et.Buf16(RF+1),this.heap=new Et.Buf16(2*n0+1),cr(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Et.Buf16(2*n0+1),cr(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 lx(n){var e;return!n||!n.state?hr(n,si):(n.total_in=n.total_out=0,n.data_type=EF,e=n.state,e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap?kd:to,n.adler=e.wrap===2?0:1,e.last_flush=ro,oi._tr_init(e),Yi)}function cx(n){var e=lx(n);return e===Yi&&WF(n.state),e}function GF(n,e){return!n||!n.state||n.state.wrap!==2?si:(n.state.gzhead=e,Yi)}function dx(n,e,t,i,r,o){if(!n)return si;var s=1;if(e===DF&&(e=6),i<0?(s=0,i=-i):i>15&&(s=2,i-=16),r<1||r>TF||t!==Pd||i<8||i>15||e<0||e>9||o<0||o>CF)return hr(n,si);i===8&&(i=9);var a=new KF;return n.state=a,a.strm=n,a.wrap=s,a.gzhead=null,a.w_bits=i,a.w_size=1<nx||e<0)return n?hr(n,si):si;if(i=n.state,!n.output||!n.input&&n.avail_in!==0||i.status===Ja&&e!==ur)return hr(n,n.avail_out===0?t0:si);if(i.strm=n,t=i.last_flush,i.last_flush=e,i.status===kd)if(i.wrap===2)n.adler=0,Ce(i,31),Ce(i,139),Ce(i,8),i.gzhead?(Ce(i,(i.gzhead.text?1:0)+(i.gzhead.hcrc?2:0)+(i.gzhead.extra?4:0)+(i.gzhead.name?8:0)+(i.gzhead.comment?16:0)),Ce(i,i.gzhead.time&255),Ce(i,i.gzhead.time>>8&255),Ce(i,i.gzhead.time>>16&255),Ce(i,i.gzhead.time>>24&255),Ce(i,i.level===9?2:i.strategy>=vd||i.level<2?4:0),Ce(i,i.gzhead.os&255),i.gzhead.extra&&i.gzhead.extra.length&&(Ce(i,i.gzhead.extra.length&255),Ce(i,i.gzhead.extra.length>>8&255)),i.gzhead.hcrc&&(n.adler=ar(n.adler,i.pending_buf,i.pending,0)),i.gzindex=0,i.status=r0):(Ce(i,0),Ce(i,0),Ce(i,0),Ce(i,0),Ce(i,0),Ce(i,i.level===9?2:i.strategy>=vd||i.level<2?4:0),Ce(i,HF),i.status=to);else{var s=Pd+(i.w_bits-8<<4)<<8,a=-1;i.strategy>=vd||i.level<2?a=0:i.level<6?a=1:i.level===6?a=2:a=3,s|=a<<6,i.strstart!==0&&(s|=VF),s+=31-s%31,i.status=to,_a(i,s),i.strstart!==0&&(_a(i,n.adler>>>16),_a(i,n.adler&65535)),n.adler=1}if(i.status===r0)if(i.gzhead.extra){for(r=i.pending;i.gzindex<(i.gzhead.extra.length&65535)&&!(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>r&&(n.adler=ar(n.adler,i.pending_buf,i.pending-r,r)),lr(n),r=i.pending,i.pending===i.pending_buf_size));)Ce(i,i.gzhead.extra[i.gzindex]&255),i.gzindex++;i.gzhead.hcrc&&i.pending>r&&(n.adler=ar(n.adler,i.pending_buf,i.pending-r,r)),i.gzindex===i.gzhead.extra.length&&(i.gzindex=0,i.status=wd)}else i.status=wd;if(i.status===wd)if(i.gzhead.name){r=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>r&&(n.adler=ar(n.adler,i.pending_buf,i.pending-r,r)),lr(n),r=i.pending,i.pending===i.pending_buf_size)){o=1;break}i.gzindexr&&(n.adler=ar(n.adler,i.pending_buf,i.pending-r,r)),o===0&&(i.gzindex=0,i.status=Fd)}else i.status=Fd;if(i.status===Fd)if(i.gzhead.comment){r=i.pending;do{if(i.pending===i.pending_buf_size&&(i.gzhead.hcrc&&i.pending>r&&(n.adler=ar(n.adler,i.pending_buf,i.pending-r,r)),lr(n),r=i.pending,i.pending===i.pending_buf_size)){o=1;break}i.gzindexr&&(n.adler=ar(n.adler,i.pending_buf,i.pending-r,r)),o===0&&(i.status=Dd)}else i.status=Dd;if(i.status===Dd&&(i.gzhead.hcrc?(i.pending+2>i.pending_buf_size&&lr(n),i.pending+2<=i.pending_buf_size&&(Ce(i,n.adler&255),Ce(i,n.adler>>8&255),n.adler=0,i.status=to)):i.status=to),i.pending!==0){if(lr(n),n.avail_out===0)return i.last_flush=-1,Yi}else if(n.avail_in===0&&ox(e)<=ox(t)&&e!==ur)return hr(n,t0);if(i.status===Ja&&n.avail_in!==0)return hr(n,t0);if(n.avail_in!==0||i.lookahead!==0||e!==ro&&i.status!==Ja){var c=i.strategy===vd?jF(i,e):i.strategy===kF?qF(i,e):ys[i.level].func(i,e);if((c===io||c===vs)&&(i.status=Ja),c===rt||c===io)return n.avail_out===0&&(i.last_flush=-1),Yi;if(c===Qa&&(e===vF?oi._tr_align(i):e!==nx&&(oi._tr_stored_block(i,0,0,!1),e===wF&&(cr(i.head),i.lookahead===0&&(i.strstart=0,i.block_start=0,i.insert=0))),lr(n),n.avail_out===0))return i.last_flush=-1,Yi}return e!==ur?Yi:i.wrap<=0?rx:(i.wrap===2?(Ce(i,n.adler&255),Ce(i,n.adler>>8&255),Ce(i,n.adler>>16&255),Ce(i,n.adler>>24&255),Ce(i,n.total_in&255),Ce(i,n.total_in>>8&255),Ce(i,n.total_in>>16&255),Ce(i,n.total_in>>24&255)):(_a(i,n.adler>>>16),_a(i,n.adler&65535)),lr(n),i.wrap>0&&(i.wrap=-i.wrap),i.pending!==0?Yi:rx)}function YF(n){var e;return!n||!n.state?si:(e=n.state.status,e!==kd&&e!==r0&&e!==wd&&e!==Fd&&e!==Dd&&e!==to&&e!==Ja?hr(n,si):(n.state=null,e===to?hr(n,FF):Yi))}function _F(n,e){var t=e.length,i,r,o,s,a,c,l,d;if(!n||!n.state||(i=n.state,s=i.wrap,s===2||s===1&&i.status!==kd||i.lookahead))return si;for(s===1&&(n.adler=sx(n.adler,e,t,0)),i.wrap=0,t>=i.w_size&&(s===0&&(cr(i.head),i.strstart=0,i.block_start=0,i.insert=0),d=new Et.Buf8(i.w_size),Et.arraySet(d,e,t-i.w_size,i.w_size,0),e=d,t=i.w_size),a=n.avail_in,c=n.next_in,l=n.input,n.avail_in=t,n.next_in=0,n.input=e,no(i);i.lookahead>=be;){r=i.strstart,o=i.lookahead-(be-1);do i.ins_h=(i.ins_h<{"use strict";var Cd=bn(),ux=!0,fx=!0;try{String.fromCharCode.apply(null,[0])}catch(n){ux=!1}try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(n){fx=!1}var $a=new Cd.Buf8(256);for(vn=0;vn<256;vn++)$a[vn]=vn>=252?6:vn>=248?5:vn>=240?4:vn>=224?3:vn>=192?2:1;var vn;$a[254]=$a[254]=1;ws.string2buf=function(n){var e,t,i,r,o,s=n.length,a=0;for(r=0;r>>6,e[o++]=128|t&63):t<65536?(e[o++]=224|t>>>12,e[o++]=128|t>>>6&63,e[o++]=128|t&63):(e[o++]=240|t>>>18,e[o++]=128|t>>>12&63,e[o++]=128|t>>>6&63,e[o++]=128|t&63);return e};function px(n,e){if(e<65534&&(n.subarray&&fx||!n.subarray&&ux))return String.fromCharCode.apply(null,Cd.shrinkBuf(n,e));for(var t="",i=0;i4){a[i++]=65533,t+=o-1;continue}for(r&=o===2?31:o===3?15:7;o>1&&t1){a[i++]=65533;continue}r<65536?a[i++]=r:(r-=65536,a[i++]=55296|r>>10&1023,a[i++]=56320|r&1023)}return px(a,i)};ws.utf8border=function(n,e){var t;for(e=e||n.length,e>n.length&&(e=n.length),t=e-1;t>=0&&(n[t]&192)===128;)t--;return t<0||t===0?e:t+$a[n[t]]>e?t:e}});var s0=_(($C,gx)=>{"use strict";function JF(){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}gx.exports=JF});var yx=_(il=>{"use strict";var el=hx(),tl=bn(),l0=o0(),c0=yd(),QF=s0(),bx=Object.prototype.toString,$F=0,a0=4,Fs=0,mx=1,xx=2,eD=-1,tD=0,iD=8;function oo(n){if(!(this instanceof oo))return new oo(n);this.options=tl.assign({level:eD,method:iD,chunkSize:16384,windowBits:15,memLevel:8,strategy:tD,to:""},n||{});var e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new QF,this.strm.avail_out=0;var t=el.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(t!==Fs)throw new Error(c0[t]);if(e.header&&el.deflateSetHeader(this.strm,e.header),e.dictionary){var i;if(typeof e.dictionary=="string"?i=l0.string2buf(e.dictionary):bx.call(e.dictionary)==="[object ArrayBuffer]"?i=new Uint8Array(e.dictionary):i=e.dictionary,t=el.deflateSetDictionary(this.strm,i),t!==Fs)throw new Error(c0[t]);this._dict_set=!0}}oo.prototype.push=function(n,e){var t=this.strm,i=this.options.chunkSize,r,o;if(this.ended)return!1;o=e===~~e?e:e===!0?a0:$F,typeof n=="string"?t.input=l0.string2buf(n):bx.call(n)==="[object ArrayBuffer]"?t.input=new Uint8Array(n):t.input=n,t.next_in=0,t.avail_in=t.input.length;do{if(t.avail_out===0&&(t.output=new tl.Buf8(i),t.next_out=0,t.avail_out=i),r=el.deflate(t,o),r!==mx&&r!==Fs)return this.onEnd(r),this.ended=!0,!1;(t.avail_out===0||t.avail_in===0&&(o===a0||o===xx))&&(this.options.to==="string"?this.onData(l0.buf2binstring(tl.shrinkBuf(t.output,t.next_out))):this.onData(tl.shrinkBuf(t.output,t.next_out)))}while((t.avail_in>0||t.avail_out===0)&&r!==mx);return o===a0?(r=el.deflateEnd(this.strm),this.onEnd(r),this.ended=!0,r===Fs):(o===xx&&(this.onEnd(Fs),t.avail_out=0),!0)};oo.prototype.onData=function(n){this.chunks.push(n)};oo.prototype.onEnd=function(n){n===Fs&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=tl.flattenChunks(this.chunks)),this.chunks=[],this.err=n,this.msg=this.strm.msg};function d0(n,e){var t=new oo(e);if(t.push(n,!0),t.err)throw t.msg||c0[t.err];return t.result}function nD(n,e){return e=e||{},e.raw=!0,d0(n,e)}function rD(n,e){return e=e||{},e.gzip=!0,d0(n,e)}il.Deflate=oo;il.deflate=d0;il.deflateRaw=nD;il.gzip=rD});var wx=_((t2,vx)=>{"use strict";var Sd=30,oD=12;vx.exports=function(e,t){var i,r,o,s,a,c,l,d,h,u,p,f,m,x,g,b,w,y,F,D,C,k,E,B,S;i=e.state,r=e.next_in,B=e.input,o=r+(e.avail_in-5),s=e.next_out,S=e.output,a=s-(t-e.avail_out),c=s+(e.avail_out-257),l=i.dmax,d=i.wsize,h=i.whave,u=i.wnext,p=i.window,f=i.hold,m=i.bits,x=i.lencode,g=i.distcode,b=(1<>>24,f>>>=F,m-=F,F=y>>>16&255,F===0)S[s++]=y&65535;else if(F&16){D=y&65535,F&=15,F&&(m>>=F,m-=F),m<15&&(f+=B[r++]<>>24,f>>>=F,m-=F,F=y>>>16&255,F&16){if(C=y&65535,F&=15,ml){e.msg="invalid distance too far back",i.mode=Sd;break e}if(f>>>=F,m-=F,F=s-a,C>F){if(F=C-F,F>h&&i.sane){e.msg="invalid distance too far back",i.mode=Sd;break e}if(k=0,E=p,u===0){if(k+=d-F,F2;)S[s++]=E[k++],S[s++]=E[k++],S[s++]=E[k++],D-=3;D&&(S[s++]=E[k++],D>1&&(S[s++]=E[k++]))}else{k=s-C;do S[s++]=S[k++],S[s++]=S[k++],S[s++]=S[k++],D-=3;while(D>2);D&&(S[s++]=S[k++],D>1&&(S[s++]=S[k++]))}}else if((F&64)===0){y=g[(y&65535)+(f&(1<>3,r-=D,m-=D<<3,f&=(1<{"use strict";var Fx=bn(),Ds=15,Dx=852,Px=592,kx=0,h0=1,Cx=2,sD=[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],aD=[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],lD=[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],cD=[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];Sx.exports=function(e,t,i,r,o,s,a,c){var l=c.bits,d=0,h=0,u=0,p=0,f=0,m=0,x=0,g=0,b=0,w=0,y,F,D,C,k,E=null,B=0,S,I=new Fx.Buf16(Ds+1),O=new Fx.Buf16(Ds+1),A=null,N=0,q,V,X;for(d=0;d<=Ds;d++)I[d]=0;for(h=0;h=1&&I[p]===0;p--);if(f>p&&(f=p),p===0)return o[s++]=1<<24|64<<16|0,o[s++]=1<<24|64<<16|0,c.bits=1,0;for(u=1;u0&&(e===kx||p!==1))return-1;for(O[1]=0,d=1;dDx||e===Cx&&b>Px)return 1;for(;;){q=d-x,a[h]S?(V=A[N+a[h]],X=E[B+a[h]]):(V=96,X=0),y=1<>x)+F]=q<<24|V<<16|X|0;while(F!==0);for(y=1<>=1;if(y!==0?(w&=y-1,w+=y):w=0,h++,--I[d]===0){if(d===p)break;d=t[i+a[h]]}if(d>f&&(w&C)!==D){for(x===0&&(x=f),k+=u,m=d-x,g=1<Dx||e===Cx&&b>Px)return 1;D=w&C,o[D]=f<<24|m<<16|k-s|0}}return w!==0&&(o[k+w]=d-x<<24|64<<16|0),c.bits=f,0}});var cb=_(Bi=>{"use strict";var Wt=bn(),x0=$f(),Ji=e0(),dD=wx(),nl=Ex(),hD=0,eb=1,tb=2,Tx=4,uD=5,Ed=6,so=0,fD=1,pD=2,ai=-2,ib=-3,b0=-4,gD=-5,Ax=8,nb=1,Ix=2,Bx=3,Ox=4,Lx=5,Mx=6,Nx=7,Rx=8,Vx=9,Hx=10,Id=11,wn=12,u0=13,zx=14,f0=15,Ux=16,qx=17,jx=18,Wx=19,Td=20,Ad=21,Kx=22,Gx=23,Xx=24,Zx=25,Yx=26,p0=27,_x=28,Jx=29,Ve=30,y0=31,mD=32,xD=852,bD=592,yD=15,vD=yD;function Qx(n){return(n>>>24&255)+(n>>>8&65280)+((n&65280)<<8)+((n&255)<<24)}function wD(){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 Wt.Buf16(320),this.work=new Wt.Buf16(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}function rb(n){var e;return!n||!n.state?ai:(e=n.state,n.total_in=n.total_out=e.total=0,n.msg="",e.wrap&&(n.adler=e.wrap&1),e.mode=nb,e.last=0,e.havedict=0,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Wt.Buf32(xD),e.distcode=e.distdyn=new Wt.Buf32(bD),e.sane=1,e.back=-1,so)}function ob(n){var e;return!n||!n.state?ai:(e=n.state,e.wsize=0,e.whave=0,e.wnext=0,rb(n))}function sb(n,e){var t,i;return!n||!n.state||(i=n.state,e<0?(t=0,e=-e):(t=(e>>4)+1,e<48&&(e&=15)),e&&(e<8||e>15))?ai:(i.window!==null&&i.wbits!==e&&(i.window=null),i.wrap=t,i.wbits=e,ob(n))}function ab(n,e){var t,i;return n?(i=new wD,n.state=i,i.window=null,t=sb(n,e),t!==so&&(n.state=null),t):ai}function FD(n){return ab(n,vD)}var $x=!0,g0,m0;function DD(n){if($x){var e;for(g0=new Wt.Buf32(512),m0=new Wt.Buf32(32),e=0;e<144;)n.lens[e++]=8;for(;e<256;)n.lens[e++]=9;for(;e<280;)n.lens[e++]=7;for(;e<288;)n.lens[e++]=8;for(nl(eb,n.lens,0,288,g0,0,n.work,{bits:9}),e=0;e<32;)n.lens[e++]=5;nl(tb,n.lens,0,32,m0,0,n.work,{bits:5}),$x=!1}n.lencode=g0,n.lenbits=9,n.distcode=m0,n.distbits=5}function lb(n,e,t,i){var r,o=n.state;return o.window===null&&(o.wsize=1<=o.wsize?(Wt.arraySet(o.window,e,t-o.wsize,o.wsize,0),o.wnext=0,o.whave=o.wsize):(r=o.wsize-o.wnext,r>i&&(r=i),Wt.arraySet(o.window,e,t-i,r,o.wnext),i-=r,i?(Wt.arraySet(o.window,e,t-i,i,0),o.wnext=i,o.whave=o.wsize):(o.wnext+=r,o.wnext===o.wsize&&(o.wnext=0),o.whave>>8&255,t.check=Ji(t.check,E,2,0),l=0,d=0,t.mode=Ix;break}if(t.flags=0,t.head&&(t.head.done=!1),!(t.wrap&1)||(((l&255)<<8)+(l>>8))%31){n.msg="incorrect header check",t.mode=Ve;break}if((l&15)!==Ax){n.msg="unknown compression method",t.mode=Ve;break}if(l>>>=4,d-=4,C=(l&15)+8,t.wbits===0)t.wbits=C;else if(C>t.wbits){n.msg="invalid window size",t.mode=Ve;break}t.dmax=1<>8&1),t.flags&512&&(E[0]=l&255,E[1]=l>>>8&255,t.check=Ji(t.check,E,2,0)),l=0,d=0,t.mode=Bx;case Bx:for(;d<32;){if(a===0)break e;a--,l+=i[o++]<>>8&255,E[2]=l>>>16&255,E[3]=l>>>24&255,t.check=Ji(t.check,E,4,0)),l=0,d=0,t.mode=Ox;case Ox:for(;d<16;){if(a===0)break e;a--,l+=i[o++]<>8),t.flags&512&&(E[0]=l&255,E[1]=l>>>8&255,t.check=Ji(t.check,E,2,0)),l=0,d=0,t.mode=Lx;case Lx:if(t.flags&1024){for(;d<16;){if(a===0)break e;a--,l+=i[o++]<>>8&255,t.check=Ji(t.check,E,2,0)),l=0,d=0}else t.head&&(t.head.extra=null);t.mode=Mx;case Mx:if(t.flags&1024&&(p=t.length,p>a&&(p=a),p&&(t.head&&(C=t.head.extra_len-t.length,t.head.extra||(t.head.extra=new Array(t.head.extra_len)),Wt.arraySet(t.head.extra,i,o,p,C)),t.flags&512&&(t.check=Ji(t.check,i,p,o)),a-=p,o+=p,t.length-=p),t.length))break e;t.length=0,t.mode=Nx;case Nx:if(t.flags&2048){if(a===0)break e;p=0;do C=i[o+p++],t.head&&C&&t.length<65536&&(t.head.name+=String.fromCharCode(C));while(C&&p>9&1,t.head.done=!0),n.adler=t.check=0,t.mode=wn;break;case Hx:for(;d<32;){if(a===0)break e;a--,l+=i[o++]<>>=d&7,d-=d&7,t.mode=p0;break}for(;d<3;){if(a===0)break e;a--,l+=i[o++]<>>=1,d-=1,l&3){case 0:t.mode=zx;break;case 1:if(DD(t),t.mode=Td,e===Ed){l>>>=2,d-=2;break e}break;case 2:t.mode=qx;break;case 3:n.msg="invalid block type",t.mode=Ve}l>>>=2,d-=2;break;case zx:for(l>>>=d&7,d-=d&7;d<32;){if(a===0)break e;a--,l+=i[o++]<>>16^65535)){n.msg="invalid stored block lengths",t.mode=Ve;break}if(t.length=l&65535,l=0,d=0,t.mode=f0,e===Ed)break e;case f0:t.mode=Ux;case Ux:if(p=t.length,p){if(p>a&&(p=a),p>c&&(p=c),p===0)break e;Wt.arraySet(r,i,o,p,s),a-=p,o+=p,c-=p,s+=p,t.length-=p;break}t.mode=wn;break;case qx:for(;d<14;){if(a===0)break e;a--,l+=i[o++]<>>=5,d-=5,t.ndist=(l&31)+1,l>>>=5,d-=5,t.ncode=(l&15)+4,l>>>=4,d-=4,t.nlen>286||t.ndist>30){n.msg="too many length or distance symbols",t.mode=Ve;break}t.have=0,t.mode=jx;case jx:for(;t.have>>=3,d-=3}for(;t.have<19;)t.lens[I[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,B={bits:t.lenbits},k=nl(hD,t.lens,0,19,t.lencode,0,t.work,B),t.lenbits=B.bits,k){n.msg="invalid code lengths set",t.mode=Ve;break}t.have=0,t.mode=Wx;case Wx:for(;t.have>>24,b=x>>>16&255,w=x&65535,!(g<=d);){if(a===0)break e;a--,l+=i[o++]<>>=g,d-=g,t.lens[t.have++]=w;else{if(w===16){for(S=g+2;d>>=g,d-=g,t.have===0){n.msg="invalid bit length repeat",t.mode=Ve;break}C=t.lens[t.have-1],p=3+(l&3),l>>>=2,d-=2}else if(w===17){for(S=g+3;d>>=g,d-=g,C=0,p=3+(l&7),l>>>=3,d-=3}else{for(S=g+7;d>>=g,d-=g,C=0,p=11+(l&127),l>>>=7,d-=7}if(t.have+p>t.nlen+t.ndist){n.msg="invalid bit length repeat",t.mode=Ve;break}for(;p--;)t.lens[t.have++]=C}}if(t.mode===Ve)break;if(t.lens[256]===0){n.msg="invalid code -- missing end-of-block",t.mode=Ve;break}if(t.lenbits=9,B={bits:t.lenbits},k=nl(eb,t.lens,0,t.nlen,t.lencode,0,t.work,B),t.lenbits=B.bits,k){n.msg="invalid literal/lengths set",t.mode=Ve;break}if(t.distbits=6,t.distcode=t.distdyn,B={bits:t.distbits},k=nl(tb,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,B),t.distbits=B.bits,k){n.msg="invalid distances set",t.mode=Ve;break}if(t.mode=Td,e===Ed)break e;case Td:t.mode=Ad;case Ad:if(a>=6&&c>=258){n.next_out=s,n.avail_out=c,n.next_in=o,n.avail_in=a,t.hold=l,t.bits=d,dD(n,u),s=n.next_out,r=n.output,c=n.avail_out,o=n.next_in,i=n.input,a=n.avail_in,l=t.hold,d=t.bits,t.mode===wn&&(t.back=-1);break}for(t.back=0;x=t.lencode[l&(1<>>24,b=x>>>16&255,w=x&65535,!(g<=d);){if(a===0)break e;a--,l+=i[o++]<>y)],g=x>>>24,b=x>>>16&255,w=x&65535,!(y+g<=d);){if(a===0)break e;a--,l+=i[o++]<>>=y,d-=y,t.back+=y}if(l>>>=g,d-=g,t.back+=g,t.length=w,b===0){t.mode=Yx;break}if(b&32){t.back=-1,t.mode=wn;break}if(b&64){n.msg="invalid literal/length code",t.mode=Ve;break}t.extra=b&15,t.mode=Kx;case Kx:if(t.extra){for(S=t.extra;d>>=t.extra,d-=t.extra,t.back+=t.extra}t.was=t.length,t.mode=Gx;case Gx:for(;x=t.distcode[l&(1<>>24,b=x>>>16&255,w=x&65535,!(g<=d);){if(a===0)break e;a--,l+=i[o++]<>y)],g=x>>>24,b=x>>>16&255,w=x&65535,!(y+g<=d);){if(a===0)break e;a--,l+=i[o++]<>>=y,d-=y,t.back+=y}if(l>>>=g,d-=g,t.back+=g,b&64){n.msg="invalid distance code",t.mode=Ve;break}t.offset=w,t.extra=b&15,t.mode=Xx;case Xx:if(t.extra){for(S=t.extra;d>>=t.extra,d-=t.extra,t.back+=t.extra}if(t.offset>t.dmax){n.msg="invalid distance too far back",t.mode=Ve;break}t.mode=Zx;case Zx:if(c===0)break e;if(p=u-c,t.offset>p){if(p=t.offset-p,p>t.whave&&t.sane){n.msg="invalid distance too far back",t.mode=Ve;break}p>t.wnext?(p-=t.wnext,f=t.wsize-p):f=t.wnext-p,p>t.length&&(p=t.length),m=t.window}else m=r,f=s-t.offset,p=t.length;p>c&&(p=c),c-=p,t.length-=p;do r[s++]=m[f++];while(--p);t.length===0&&(t.mode=Ad);break;case Yx:if(c===0)break e;r[s++]=t.length,c--,t.mode=Ad;break;case p0:if(t.wrap){for(;d<32;){if(a===0)break e;a--,l|=i[o++]<{"use strict";db.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}});var ub=_((o2,hb)=>{"use strict";function ED(){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}hb.exports=ED});var pb=_(ol=>{"use strict";var Ps=cb(),rl=bn(),Bd=o0(),Xe=v0(),w0=yd(),TD=s0(),AD=ub(),fb=Object.prototype.toString;function ao(n){if(!(this instanceof ao))return new ao(n);this.options=rl.assign({chunkSize:16384,windowBits:0,to:""},n||{});var e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,e.windowBits===0&&(e.windowBits=-15)),e.windowBits>=0&&e.windowBits<16&&!(n&&n.windowBits)&&(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&(e.windowBits&15)===0&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new TD,this.strm.avail_out=0;var t=Ps.inflateInit2(this.strm,e.windowBits);if(t!==Xe.Z_OK)throw new Error(w0[t]);if(this.header=new AD,Ps.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=Bd.string2buf(e.dictionary):fb.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(t=Ps.inflateSetDictionary(this.strm,e.dictionary),t!==Xe.Z_OK)))throw new Error(w0[t])}ao.prototype.push=function(n,e){var t=this.strm,i=this.options.chunkSize,r=this.options.dictionary,o,s,a,c,l,d=!1;if(this.ended)return!1;s=e===~~e?e:e===!0?Xe.Z_FINISH:Xe.Z_NO_FLUSH,typeof n=="string"?t.input=Bd.binstring2buf(n):fb.call(n)==="[object ArrayBuffer]"?t.input=new Uint8Array(n):t.input=n,t.next_in=0,t.avail_in=t.input.length;do{if(t.avail_out===0&&(t.output=new rl.Buf8(i),t.next_out=0,t.avail_out=i),o=Ps.inflate(t,Xe.Z_NO_FLUSH),o===Xe.Z_NEED_DICT&&r&&(o=Ps.inflateSetDictionary(this.strm,r)),o===Xe.Z_BUF_ERROR&&d===!0&&(o=Xe.Z_OK,d=!1),o!==Xe.Z_STREAM_END&&o!==Xe.Z_OK)return this.onEnd(o),this.ended=!0,!1;t.next_out&&(t.avail_out===0||o===Xe.Z_STREAM_END||t.avail_in===0&&(s===Xe.Z_FINISH||s===Xe.Z_SYNC_FLUSH))&&(this.options.to==="string"?(a=Bd.utf8border(t.output,t.next_out),c=t.next_out-a,l=Bd.buf2string(t.output,a),t.next_out=c,t.avail_out=i-c,c&&rl.arraySet(t.output,t.output,a,c,0),this.onData(l)):this.onData(rl.shrinkBuf(t.output,t.next_out))),t.avail_in===0&&t.avail_out===0&&(d=!0)}while((t.avail_in>0||t.avail_out===0)&&o!==Xe.Z_STREAM_END);return o===Xe.Z_STREAM_END&&(s=Xe.Z_FINISH),s===Xe.Z_FINISH?(o=Ps.inflateEnd(this.strm),this.onEnd(o),this.ended=!0,o===Xe.Z_OK):(s===Xe.Z_SYNC_FLUSH&&(this.onEnd(Xe.Z_OK),t.avail_out=0),!0)};ao.prototype.onData=function(n){this.chunks.push(n)};ao.prototype.onEnd=function(n){n===Xe.Z_OK&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=rl.flattenChunks(this.chunks)),this.chunks=[],this.err=n,this.msg=this.strm.msg};function F0(n,e){var t=new ao(e);if(t.push(n,!0),t.err)throw t.msg||w0[t.err];return t.result}function ID(n,e){return e=e||{},e.raw=!0,F0(n,e)}ol.Inflate=ao;ol.inflate=F0;ol.inflateRaw=ID;ol.ungzip=F0});var sl=_((a2,mb)=>{"use strict";var BD=bn().assign,OD=yx(),LD=pb(),MD=v0(),gb={};BD(gb,OD,LD,MD);mb.exports=gb});var xe=_((Jd,py)=>{(function(n,e){typeof Jd=="object"?py.exports=Jd=e():typeof define=="function"&&define.amd?define([],e):n.CryptoJS=e()})(Jd,function(){var n=n||(function(e,t){var i;if(typeof window!="undefined"&&window.crypto&&(i=window.crypto),typeof self!="undefined"&&self.crypto&&(i=self.crypto),typeof globalThis!="undefined"&&globalThis.crypto&&(i=globalThis.crypto),!i&&typeof window!="undefined"&&window.msCrypto&&(i=window.msCrypto),!i&&typeof global!="undefined"&&global.crypto&&(i=global.crypto),!i&&typeof require=="function")try{i=require("crypto")}catch(g){}var r=function(){if(i){if(typeof i.getRandomValues=="function")try{return i.getRandomValues(new Uint32Array(1))[0]}catch(g){}if(typeof i.randomBytes=="function")try{return i.randomBytes(4).readInt32LE()}catch(g){}}throw new Error("Native crypto module could not be used to get secure random number.")},o=Object.create||(function(){function g(){}return function(b){var w;return g.prototype=b,w=new g,g.prototype=null,w}})(),s={},a=s.lib={},c=a.Base=(function(){return{extend:function(g){var b=o(this);return g&&b.mixIn(g),(!b.hasOwnProperty("init")||this.init===b.init)&&(b.init=function(){b.$super.init.apply(this,arguments)}),b.init.prototype=b,b.$super=this,b},create:function(){var g=this.extend();return g.init.apply(g,arguments),g},init:function(){},mixIn:function(g){for(var b in g)g.hasOwnProperty(b)&&(this[b]=g[b]);g.hasOwnProperty("toString")&&(this.toString=g.toString)},clone:function(){return this.init.prototype.extend(this)}}})(),l=a.WordArray=c.extend({init:function(g,b){g=this.words=g||[],b!=t?this.sigBytes=b:this.sigBytes=g.length*4},toString:function(g){return(g||h).stringify(this)},concat:function(g){var b=this.words,w=g.words,y=this.sigBytes,F=g.sigBytes;if(this.clamp(),y%4)for(var D=0;D>>2]>>>24-D%4*8&255;b[y+D>>>2]|=C<<24-(y+D)%4*8}else for(var k=0;k>>2]=w[k>>>2];return this.sigBytes+=F,this},clamp:function(){var g=this.words,b=this.sigBytes;g[b>>>2]&=4294967295<<32-b%4*8,g.length=e.ceil(b/4)},clone:function(){var g=c.clone.call(this);return g.words=this.words.slice(0),g},random:function(g){for(var b=[],w=0;w>>2]>>>24-F%4*8&255;y.push((D>>>4).toString(16)),y.push((D&15).toString(16))}return y.join("")},parse:function(g){for(var b=g.length,w=[],y=0;y>>3]|=parseInt(g.substr(y,2),16)<<24-y%8*4;return new l.init(w,b/2)}},u=d.Latin1={stringify:function(g){for(var b=g.words,w=g.sigBytes,y=[],F=0;F>>2]>>>24-F%4*8&255;y.push(String.fromCharCode(D))}return y.join("")},parse:function(g){for(var b=g.length,w=[],y=0;y>>2]|=(g.charCodeAt(y)&255)<<24-y%4*8;return new l.init(w,b)}},p=d.Utf8={stringify:function(g){try{return decodeURIComponent(escape(u.stringify(g)))}catch(b){throw new Error("Malformed UTF-8 data")}},parse:function(g){return u.parse(unescape(encodeURIComponent(g)))}},f=a.BufferedBlockAlgorithm=c.extend({reset:function(){this._data=new l.init,this._nDataBytes=0},_append:function(g){typeof g=="string"&&(g=p.parse(g)),this._data.concat(g),this._nDataBytes+=g.sigBytes},_process:function(g){var b,w=this._data,y=w.words,F=w.sigBytes,D=this.blockSize,C=D*4,k=F/C;g?k=e.ceil(k):k=e.max((k|0)-this._minBufferSize,0);var E=k*D,B=e.min(E*4,F);if(E){for(var S=0;S{(function(n,e){typeof Qd=="object"?gy.exports=Qd=e(xe()):typeof define=="function"&&define.amd?define(["./core"],e):e(n.CryptoJS)})(Qd,function(n){return(function(e){var t=n,i=t.lib,r=i.Base,o=i.WordArray,s=t.x64={},a=s.Word=r.extend({init:function(l,d){this.high=l,this.low=d}}),c=s.WordArray=r.extend({init:function(l,d){l=this.words=l||[],d!=e?this.sigBytes=d:this.sigBytes=l.length*8},toX32:function(){for(var l=this.words,d=l.length,h=[],u=0;u{(function(n,e){typeof $d=="object"?my.exports=$d=e(xe()):typeof define=="function"&&define.amd?define(["./core"],e):e(n.CryptoJS)})($d,function(n){return(function(){if(typeof ArrayBuffer=="function"){var e=n,t=e.lib,i=t.WordArray,r=i.init,o=i.init=function(s){if(s instanceof ArrayBuffer&&(s=new Uint8Array(s)),(s instanceof Int8Array||typeof Uint8ClampedArray!="undefined"&&s instanceof Uint8ClampedArray||s instanceof Int16Array||s instanceof Uint16Array||s instanceof Int32Array||s instanceof Uint32Array||s instanceof Float32Array||s instanceof Float64Array)&&(s=new Uint8Array(s.buffer,s.byteOffset,s.byteLength)),s instanceof Uint8Array){for(var a=s.byteLength,c=[],l=0;l>>2]|=s[l]<<24-l%4*8;r.call(this,c,a)}else r.apply(this,arguments)};o.prototype=i}})(),n.lib.WordArray})});var yy=_((eh,by)=>{(function(n,e){typeof eh=="object"?by.exports=eh=e(xe()):typeof define=="function"&&define.amd?define(["./core"],e):e(n.CryptoJS)})(eh,function(n){return(function(){var e=n,t=e.lib,i=t.WordArray,r=e.enc,o=r.Utf16=r.Utf16BE={stringify:function(a){for(var c=a.words,l=a.sigBytes,d=[],h=0;h>>2]>>>16-h%4*8&65535;d.push(String.fromCharCode(u))}return d.join("")},parse:function(a){for(var c=a.length,l=[],d=0;d>>1]|=a.charCodeAt(d)<<16-d%2*16;return i.create(l,c*2)}};r.Utf16LE={stringify:function(a){for(var c=a.words,l=a.sigBytes,d=[],h=0;h>>2]>>>16-h%4*8&65535);d.push(String.fromCharCode(u))}return d.join("")},parse:function(a){for(var c=a.length,l=[],d=0;d>>1]|=s(a.charCodeAt(d)<<16-d%2*16);return i.create(l,c*2)}};function s(a){return a<<8&4278255360|a>>>8&16711935}})(),n.enc.Utf16})});var Cr=_((th,vy)=>{(function(n,e){typeof th=="object"?vy.exports=th=e(xe()):typeof define=="function"&&define.amd?define(["./core"],e):e(n.CryptoJS)})(th,function(n){return(function(){var e=n,t=e.lib,i=t.WordArray,r=e.enc,o=r.Base64={stringify:function(a){var c=a.words,l=a.sigBytes,d=this._map;a.clamp();for(var h=[],u=0;u>>2]>>>24-u%4*8&255,f=c[u+1>>>2]>>>24-(u+1)%4*8&255,m=c[u+2>>>2]>>>24-(u+2)%4*8&255,x=p<<16|f<<8|m,g=0;g<4&&u+g*.75>>6*(3-g)&63));var b=d.charAt(64);if(b)for(;h.length%4;)h.push(b);return h.join("")},parse:function(a){var c=a.length,l=this._map,d=this._reverseMap;if(!d){d=this._reverseMap=[];for(var h=0;h>>6-u%4*2,m=p|f;d[h>>>2]|=m<<24-h%4*8,h++}return i.create(d,h)}})(),n.enc.Base64})});var Fy=_((ih,wy)=>{(function(n,e){typeof ih=="object"?wy.exports=ih=e(xe()):typeof define=="function"&&define.amd?define(["./core"],e):e(n.CryptoJS)})(ih,function(n){return(function(){var e=n,t=e.lib,i=t.WordArray,r=e.enc,o=r.Base64url={stringify:function(a,c){c===void 0&&(c=!0);var l=a.words,d=a.sigBytes,h=c?this._safe_map:this._map;a.clamp();for(var u=[],p=0;p>>2]>>>24-p%4*8&255,m=l[p+1>>>2]>>>24-(p+1)%4*8&255,x=l[p+2>>>2]>>>24-(p+2)%4*8&255,g=f<<16|m<<8|x,b=0;b<4&&p+b*.75>>6*(3-b)&63));var w=h.charAt(64);if(w)for(;u.length%4;)u.push(w);return u.join("")},parse:function(a,c){c===void 0&&(c=!0);var l=a.length,d=c?this._safe_map:this._map,h=this._reverseMap;if(!h){h=this._reverseMap=[];for(var u=0;u>>6-u%4*2,m=p|f;d[h>>>2]|=m<<24-h%4*8,h++}return i.create(d,h)}})(),n.enc.Base64url})});var Sr=_((nh,Dy)=>{(function(n,e){typeof nh=="object"?Dy.exports=nh=e(xe()):typeof define=="function"&&define.amd?define(["./core"],e):e(n.CryptoJS)})(nh,function(n){return(function(e){var t=n,i=t.lib,r=i.WordArray,o=i.Hasher,s=t.algo,a=[];(function(){for(var p=0;p<64;p++)a[p]=e.abs(e.sin(p+1))*4294967296|0})();var c=s.MD5=o.extend({_doReset:function(){this._hash=new r.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(p,f){for(var m=0;m<16;m++){var x=f+m,g=p[x];p[x]=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360}var b=this._hash.words,w=p[f+0],y=p[f+1],F=p[f+2],D=p[f+3],C=p[f+4],k=p[f+5],E=p[f+6],B=p[f+7],S=p[f+8],I=p[f+9],O=p[f+10],A=p[f+11],N=p[f+12],q=p[f+13],V=p[f+14],X=p[f+15],L=b[0],U=b[1],R=b[2],M=b[3];L=l(L,U,R,M,w,7,a[0]),M=l(M,L,U,R,y,12,a[1]),R=l(R,M,L,U,F,17,a[2]),U=l(U,R,M,L,D,22,a[3]),L=l(L,U,R,M,C,7,a[4]),M=l(M,L,U,R,k,12,a[5]),R=l(R,M,L,U,E,17,a[6]),U=l(U,R,M,L,B,22,a[7]),L=l(L,U,R,M,S,7,a[8]),M=l(M,L,U,R,I,12,a[9]),R=l(R,M,L,U,O,17,a[10]),U=l(U,R,M,L,A,22,a[11]),L=l(L,U,R,M,N,7,a[12]),M=l(M,L,U,R,q,12,a[13]),R=l(R,M,L,U,V,17,a[14]),U=l(U,R,M,L,X,22,a[15]),L=d(L,U,R,M,y,5,a[16]),M=d(M,L,U,R,E,9,a[17]),R=d(R,M,L,U,A,14,a[18]),U=d(U,R,M,L,w,20,a[19]),L=d(L,U,R,M,k,5,a[20]),M=d(M,L,U,R,O,9,a[21]),R=d(R,M,L,U,X,14,a[22]),U=d(U,R,M,L,C,20,a[23]),L=d(L,U,R,M,I,5,a[24]),M=d(M,L,U,R,V,9,a[25]),R=d(R,M,L,U,D,14,a[26]),U=d(U,R,M,L,S,20,a[27]),L=d(L,U,R,M,q,5,a[28]),M=d(M,L,U,R,F,9,a[29]),R=d(R,M,L,U,B,14,a[30]),U=d(U,R,M,L,N,20,a[31]),L=h(L,U,R,M,k,4,a[32]),M=h(M,L,U,R,S,11,a[33]),R=h(R,M,L,U,A,16,a[34]),U=h(U,R,M,L,V,23,a[35]),L=h(L,U,R,M,y,4,a[36]),M=h(M,L,U,R,C,11,a[37]),R=h(R,M,L,U,B,16,a[38]),U=h(U,R,M,L,O,23,a[39]),L=h(L,U,R,M,q,4,a[40]),M=h(M,L,U,R,w,11,a[41]),R=h(R,M,L,U,D,16,a[42]),U=h(U,R,M,L,E,23,a[43]),L=h(L,U,R,M,I,4,a[44]),M=h(M,L,U,R,N,11,a[45]),R=h(R,M,L,U,X,16,a[46]),U=h(U,R,M,L,F,23,a[47]),L=u(L,U,R,M,w,6,a[48]),M=u(M,L,U,R,B,10,a[49]),R=u(R,M,L,U,V,15,a[50]),U=u(U,R,M,L,k,21,a[51]),L=u(L,U,R,M,N,6,a[52]),M=u(M,L,U,R,D,10,a[53]),R=u(R,M,L,U,O,15,a[54]),U=u(U,R,M,L,y,21,a[55]),L=u(L,U,R,M,S,6,a[56]),M=u(M,L,U,R,X,10,a[57]),R=u(R,M,L,U,E,15,a[58]),U=u(U,R,M,L,q,21,a[59]),L=u(L,U,R,M,C,6,a[60]),M=u(M,L,U,R,A,10,a[61]),R=u(R,M,L,U,F,15,a[62]),U=u(U,R,M,L,I,21,a[63]),b[0]=b[0]+L|0,b[1]=b[1]+U|0,b[2]=b[2]+R|0,b[3]=b[3]+M|0},_doFinalize:function(){var p=this._data,f=p.words,m=this._nDataBytes*8,x=p.sigBytes*8;f[x>>>5]|=128<<24-x%32;var g=e.floor(m/4294967296),b=m;f[(x+64>>>9<<4)+15]=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360,f[(x+64>>>9<<4)+14]=(b<<8|b>>>24)&16711935|(b<<24|b>>>8)&4278255360,p.sigBytes=(f.length+1)*4,this._process();for(var w=this._hash,y=w.words,F=0;F<4;F++){var D=y[F];y[F]=(D<<8|D>>>24)&16711935|(D<<24|D>>>8)&4278255360}return w},clone:function(){var p=o.clone.call(this);return p._hash=this._hash.clone(),p}});function l(p,f,m,x,g,b,w){var y=p+(f&m|~f&x)+g+w;return(y<>>32-b)+f}function d(p,f,m,x,g,b,w){var y=p+(f&x|m&~x)+g+w;return(y<>>32-b)+f}function h(p,f,m,x,g,b,w){var y=p+(f^m^x)+g+w;return(y<>>32-b)+f}function u(p,f,m,x,g,b,w){var y=p+(m^(f|~x))+g+w;return(y<>>32-b)+f}t.MD5=o._createHelper(c),t.HmacMD5=o._createHmacHelper(c)})(Math),n.MD5})});var tp=_((rh,Py)=>{(function(n,e){typeof rh=="object"?Py.exports=rh=e(xe()):typeof define=="function"&&define.amd?define(["./core"],e):e(n.CryptoJS)})(rh,function(n){return(function(){var e=n,t=e.lib,i=t.WordArray,r=t.Hasher,o=e.algo,s=[],a=o.SHA1=r.extend({_doReset:function(){this._hash=new i.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(c,l){for(var d=this._hash.words,h=d[0],u=d[1],p=d[2],f=d[3],m=d[4],x=0;x<80;x++){if(x<16)s[x]=c[l+x]|0;else{var g=s[x-3]^s[x-8]^s[x-14]^s[x-16];s[x]=g<<1|g>>>31}var b=(h<<5|h>>>27)+m+s[x];x<20?b+=(u&p|~u&f)+1518500249:x<40?b+=(u^p^f)+1859775393:x<60?b+=(u&p|u&f|p&f)-1894007588:b+=(u^p^f)-899497514,m=f,f=p,p=u<<30|u>>>2,u=h,h=b}d[0]=d[0]+h|0,d[1]=d[1]+u|0,d[2]=d[2]+p|0,d[3]=d[3]+f|0,d[4]=d[4]+m|0},_doFinalize:function(){var c=this._data,l=c.words,d=this._nDataBytes*8,h=c.sigBytes*8;return l[h>>>5]|=128<<24-h%32,l[(h+64>>>9<<4)+14]=Math.floor(d/4294967296),l[(h+64>>>9<<4)+15]=d,c.sigBytes=l.length*4,this._process(),this._hash},clone:function(){var c=r.clone.call(this);return c._hash=this._hash.clone(),c}});e.SHA1=r._createHelper(a),e.HmacSHA1=r._createHmacHelper(a)})(),n.SHA1})});var sh=_((oh,ky)=>{(function(n,e){typeof oh=="object"?ky.exports=oh=e(xe()):typeof define=="function"&&define.amd?define(["./core"],e):e(n.CryptoJS)})(oh,function(n){return(function(e){var t=n,i=t.lib,r=i.WordArray,o=i.Hasher,s=t.algo,a=[],c=[];(function(){function h(m){for(var x=e.sqrt(m),g=2;g<=x;g++)if(!(m%g))return!1;return!0}function u(m){return(m-(m|0))*4294967296|0}for(var p=2,f=0;f<64;)h(p)&&(f<8&&(a[f]=u(e.pow(p,1/2))),c[f]=u(e.pow(p,1/3)),f++),p++})();var l=[],d=s.SHA256=o.extend({_doReset:function(){this._hash=new r.init(a.slice(0))},_doProcessBlock:function(h,u){for(var p=this._hash.words,f=p[0],m=p[1],x=p[2],g=p[3],b=p[4],w=p[5],y=p[6],F=p[7],D=0;D<64;D++){if(D<16)l[D]=h[u+D]|0;else{var C=l[D-15],k=(C<<25|C>>>7)^(C<<14|C>>>18)^C>>>3,E=l[D-2],B=(E<<15|E>>>17)^(E<<13|E>>>19)^E>>>10;l[D]=k+l[D-7]+B+l[D-16]}var S=b&w^~b&y,I=f&m^f&x^m&x,O=(f<<30|f>>>2)^(f<<19|f>>>13)^(f<<10|f>>>22),A=(b<<26|b>>>6)^(b<<21|b>>>11)^(b<<7|b>>>25),N=F+A+S+c[D]+l[D],q=O+I;F=y,y=w,w=b,b=g+N|0,g=x,x=m,m=f,f=N+q|0}p[0]=p[0]+f|0,p[1]=p[1]+m|0,p[2]=p[2]+x|0,p[3]=p[3]+g|0,p[4]=p[4]+b|0,p[5]=p[5]+w|0,p[6]=p[6]+y|0,p[7]=p[7]+F|0},_doFinalize:function(){var h=this._data,u=h.words,p=this._nDataBytes*8,f=h.sigBytes*8;return u[f>>>5]|=128<<24-f%32,u[(f+64>>>9<<4)+14]=e.floor(p/4294967296),u[(f+64>>>9<<4)+15]=p,h.sigBytes=u.length*4,this._process(),this._hash},clone:function(){var h=o.clone.call(this);return h._hash=this._hash.clone(),h}});t.SHA256=o._createHelper(d),t.HmacSHA256=o._createHmacHelper(d)})(Math),n.SHA256})});var Sy=_((ah,Cy)=>{(function(n,e,t){typeof ah=="object"?Cy.exports=ah=e(xe(),sh()):typeof define=="function"&&define.amd?define(["./core","./sha256"],e):e(n.CryptoJS)})(ah,function(n){return(function(){var e=n,t=e.lib,i=t.WordArray,r=e.algo,o=r.SHA256,s=r.SHA224=o.extend({_doReset:function(){this._hash=new i.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var a=o._doFinalize.call(this);return a.sigBytes-=4,a}});e.SHA224=o._createHelper(s),e.HmacSHA224=o._createHmacHelper(s)})(),n.SHA224})});var ip=_((lh,Ey)=>{(function(n,e,t){typeof lh=="object"?Ey.exports=lh=e(xe(),ac()):typeof define=="function"&&define.amd?define(["./core","./x64-core"],e):e(n.CryptoJS)})(lh,function(n){return(function(){var e=n,t=e.lib,i=t.Hasher,r=e.x64,o=r.Word,s=r.WordArray,a=e.algo;function c(){return o.create.apply(o,arguments)}var l=[c(1116352408,3609767458),c(1899447441,602891725),c(3049323471,3964484399),c(3921009573,2173295548),c(961987163,4081628472),c(1508970993,3053834265),c(2453635748,2937671579),c(2870763221,3664609560),c(3624381080,2734883394),c(310598401,1164996542),c(607225278,1323610764),c(1426881987,3590304994),c(1925078388,4068182383),c(2162078206,991336113),c(2614888103,633803317),c(3248222580,3479774868),c(3835390401,2666613458),c(4022224774,944711139),c(264347078,2341262773),c(604807628,2007800933),c(770255983,1495990901),c(1249150122,1856431235),c(1555081692,3175218132),c(1996064986,2198950837),c(2554220882,3999719339),c(2821834349,766784016),c(2952996808,2566594879),c(3210313671,3203337956),c(3336571891,1034457026),c(3584528711,2466948901),c(113926993,3758326383),c(338241895,168717936),c(666307205,1188179964),c(773529912,1546045734),c(1294757372,1522805485),c(1396182291,2643833823),c(1695183700,2343527390),c(1986661051,1014477480),c(2177026350,1206759142),c(2456956037,344077627),c(2730485921,1290863460),c(2820302411,3158454273),c(3259730800,3505952657),c(3345764771,106217008),c(3516065817,3606008344),c(3600352804,1432725776),c(4094571909,1467031594),c(275423344,851169720),c(430227734,3100823752),c(506948616,1363258195),c(659060556,3750685593),c(883997877,3785050280),c(958139571,3318307427),c(1322822218,3812723403),c(1537002063,2003034995),c(1747873779,3602036899),c(1955562222,1575990012),c(2024104815,1125592928),c(2227730452,2716904306),c(2361852424,442776044),c(2428436474,593698344),c(2756734187,3733110249),c(3204031479,2999351573),c(3329325298,3815920427),c(3391569614,3928383900),c(3515267271,566280711),c(3940187606,3454069534),c(4118630271,4000239992),c(116418474,1914138554),c(174292421,2731055270),c(289380356,3203993006),c(460393269,320620315),c(685471733,587496836),c(852142971,1086792851),c(1017036298,365543100),c(1126000580,2618297676),c(1288033470,3409855158),c(1501505948,4234509866),c(1607167915,987167468),c(1816402316,1246189591)],d=[];(function(){for(var u=0;u<80;u++)d[u]=c()})();var h=a.SHA512=i.extend({_doReset:function(){this._hash=new s.init([new o.init(1779033703,4089235720),new o.init(3144134277,2227873595),new o.init(1013904242,4271175723),new o.init(2773480762,1595750129),new o.init(1359893119,2917565137),new o.init(2600822924,725511199),new o.init(528734635,4215389547),new o.init(1541459225,327033209)])},_doProcessBlock:function(u,p){for(var f=this._hash.words,m=f[0],x=f[1],g=f[2],b=f[3],w=f[4],y=f[5],F=f[6],D=f[7],C=m.high,k=m.low,E=x.high,B=x.low,S=g.high,I=g.low,O=b.high,A=b.low,N=w.high,q=w.low,V=y.high,X=y.low,L=F.high,U=F.low,R=D.high,M=D.low,re=C,se=k,Te=E,he=B,dt=S,qt=I,ji=O,Ot=A,Fe=N,Ct=q,$n=V,Ia=X,dd=L,Ba=U,yf=R,Oa=M,Ti=0;Ti<80;Ti++){var ri,er,hd=d[Ti];if(Ti<16)er=hd.high=u[p+Ti*2]|0,ri=hd.low=u[p+Ti*2+1]|0;else{var cm=d[Ti-15],ls=cm.high,La=cm.low,m1=(ls>>>1|La<<31)^(ls>>>8|La<<24)^ls>>>7,dm=(La>>>1|ls<<31)^(La>>>8|ls<<24)^(La>>>7|ls<<25),hm=d[Ti-2],cs=hm.high,Ma=hm.low,x1=(cs>>>19|Ma<<13)^(cs<<3|Ma>>>29)^cs>>>6,um=(Ma>>>19|cs<<13)^(Ma<<3|cs>>>29)^(Ma>>>6|cs<<26),fm=d[Ti-7],b1=fm.high,y1=fm.low,pm=d[Ti-16],v1=pm.high,gm=pm.low;ri=dm+y1,er=m1+b1+(ri>>>0>>0?1:0),ri=ri+um,er=er+x1+(ri>>>0>>0?1:0),ri=ri+gm,er=er+v1+(ri>>>0>>0?1:0),hd.high=er,hd.low=ri}var w1=Fe&$n^~Fe&dd,mm=Ct&Ia^~Ct&Ba,F1=re&Te^re&dt^Te&dt,D1=se&he^se&qt^he&qt,P1=(re>>>28|se<<4)^(re<<30|se>>>2)^(re<<25|se>>>7),xm=(se>>>28|re<<4)^(se<<30|re>>>2)^(se<<25|re>>>7),k1=(Fe>>>14|Ct<<18)^(Fe>>>18|Ct<<14)^(Fe<<23|Ct>>>9),C1=(Ct>>>14|Fe<<18)^(Ct>>>18|Fe<<14)^(Ct<<23|Fe>>>9),bm=l[Ti],S1=bm.high,ym=bm.low,jt=Oa+C1,tr=yf+k1+(jt>>>0>>0?1:0),jt=jt+mm,tr=tr+w1+(jt>>>0>>0?1:0),jt=jt+ym,tr=tr+S1+(jt>>>0>>0?1:0),jt=jt+ri,tr=tr+er+(jt>>>0>>0?1:0),vm=xm+D1,E1=P1+F1+(vm>>>0>>0?1:0);yf=dd,Oa=Ba,dd=$n,Ba=Ia,$n=Fe,Ia=Ct,Ct=Ot+jt|0,Fe=ji+tr+(Ct>>>0>>0?1:0)|0,ji=dt,Ot=qt,dt=Te,qt=he,Te=re,he=se,se=jt+vm|0,re=tr+E1+(se>>>0>>0?1:0)|0}k=m.low=k+se,m.high=C+re+(k>>>0>>0?1:0),B=x.low=B+he,x.high=E+Te+(B>>>0>>0?1:0),I=g.low=I+qt,g.high=S+dt+(I>>>0>>0?1:0),A=b.low=A+Ot,b.high=O+ji+(A>>>0>>0?1:0),q=w.low=q+Ct,w.high=N+Fe+(q>>>0>>0?1:0),X=y.low=X+Ia,y.high=V+$n+(X>>>0>>0?1:0),U=F.low=U+Ba,F.high=L+dd+(U>>>0>>0?1:0),M=D.low=M+Oa,D.high=R+yf+(M>>>0>>0?1:0)},_doFinalize:function(){var u=this._data,p=u.words,f=this._nDataBytes*8,m=u.sigBytes*8;p[m>>>5]|=128<<24-m%32,p[(m+128>>>10<<5)+30]=Math.floor(f/4294967296),p[(m+128>>>10<<5)+31]=f,u.sigBytes=p.length*4,this._process();var x=this._hash.toX32();return x},clone:function(){var u=i.clone.call(this);return u._hash=this._hash.clone(),u},blockSize:1024/32});e.SHA512=i._createHelper(h),e.HmacSHA512=i._createHmacHelper(h)})(),n.SHA512})});var Ay=_((ch,Ty)=>{(function(n,e,t){typeof ch=="object"?Ty.exports=ch=e(xe(),ac(),ip()):typeof define=="function"&&define.amd?define(["./core","./x64-core","./sha512"],e):e(n.CryptoJS)})(ch,function(n){return(function(){var e=n,t=e.x64,i=t.Word,r=t.WordArray,o=e.algo,s=o.SHA512,a=o.SHA384=s.extend({_doReset:function(){this._hash=new r.init([new i.init(3418070365,3238371032),new i.init(1654270250,914150663),new i.init(2438529370,812702999),new i.init(355462360,4144912697),new i.init(1731405415,4290775857),new i.init(2394180231,1750603025),new i.init(3675008525,1694076839),new i.init(1203062813,3204075428)])},_doFinalize:function(){var c=s._doFinalize.call(this);return c.sigBytes-=16,c}});e.SHA384=s._createHelper(a),e.HmacSHA384=s._createHmacHelper(a)})(),n.SHA384})});var By=_((dh,Iy)=>{(function(n,e,t){typeof dh=="object"?Iy.exports=dh=e(xe(),ac()):typeof define=="function"&&define.amd?define(["./core","./x64-core"],e):e(n.CryptoJS)})(dh,function(n){return(function(e){var t=n,i=t.lib,r=i.WordArray,o=i.Hasher,s=t.x64,a=s.Word,c=t.algo,l=[],d=[],h=[];(function(){for(var f=1,m=0,x=0;x<24;x++){l[f+5*m]=(x+1)*(x+2)/2%64;var g=m%5,b=(2*f+3*m)%5;f=g,m=b}for(var f=0;f<5;f++)for(var m=0;m<5;m++)d[f+5*m]=m+(2*f+3*m)%5*5;for(var w=1,y=0;y<24;y++){for(var F=0,D=0,C=0;C<7;C++){if(w&1){var k=(1<>>24)&16711935|(w<<24|w>>>8)&4278255360,y=(y<<8|y>>>24)&16711935|(y<<24|y>>>8)&4278255360;var F=x[b];F.high^=y,F.low^=w}for(var D=0;D<24;D++){for(var C=0;C<5;C++){for(var k=0,E=0,B=0;B<5;B++){var F=x[C+5*B];k^=F.high,E^=F.low}var S=u[C];S.high=k,S.low=E}for(var C=0;C<5;C++)for(var I=u[(C+4)%5],O=u[(C+1)%5],A=O.high,N=O.low,k=I.high^(A<<1|N>>>31),E=I.low^(N<<1|A>>>31),B=0;B<5;B++){var F=x[C+5*B];F.high^=k,F.low^=E}for(var q=1;q<25;q++){var k,E,F=x[q],V=F.high,X=F.low,L=l[q];L<32?(k=V<>>32-L,E=X<>>32-L):(k=X<>>64-L,E=V<>>64-L);var U=u[d[q]];U.high=k,U.low=E}var R=u[0],M=x[0];R.high=M.high,R.low=M.low;for(var C=0;C<5;C++)for(var B=0;B<5;B++){var q=C+5*B,F=x[q],re=u[q],se=u[(C+1)%5+5*B],Te=u[(C+2)%5+5*B];F.high=re.high^~se.high&Te.high,F.low=re.low^~se.low&Te.low}var F=x[0],he=h[D];F.high^=he.high,F.low^=he.low}},_doFinalize:function(){var f=this._data,m=f.words,x=this._nDataBytes*8,g=f.sigBytes*8,b=this.blockSize*32;m[g>>>5]|=1<<24-g%32,m[(e.ceil((g+1)/b)*b>>>5)-1]|=128,f.sigBytes=m.length*4,this._process();for(var w=this._state,y=this.cfg.outputLength/8,F=y/8,D=[],C=0;C>>24)&16711935|(E<<24|E>>>8)&4278255360,B=(B<<8|B>>>24)&16711935|(B<<24|B>>>8)&4278255360,D.push(B),D.push(E)}return new r.init(D,y)},clone:function(){for(var f=o.clone.call(this),m=f._state=this._state.slice(0),x=0;x<25;x++)m[x]=m[x].clone();return f}});t.SHA3=o._createHelper(p),t.HmacSHA3=o._createHmacHelper(p)})(Math),n.SHA3})});var Ly=_((hh,Oy)=>{(function(n,e){typeof hh=="object"?Oy.exports=hh=e(xe()):typeof define=="function"&&define.amd?define(["./core"],e):e(n.CryptoJS)})(hh,function(n){return(function(e){var t=n,i=t.lib,r=i.WordArray,o=i.Hasher,s=t.algo,a=r.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),c=r.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),l=r.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),d=r.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),h=r.create([0,1518500249,1859775393,2400959708,2840853838]),u=r.create([1352829926,1548603684,1836072691,2053994217,0]),p=s.RIPEMD160=o.extend({_doReset:function(){this._hash=r.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(y,F){for(var D=0;D<16;D++){var C=F+D,k=y[C];y[C]=(k<<8|k>>>24)&16711935|(k<<24|k>>>8)&4278255360}var E=this._hash.words,B=h.words,S=u.words,I=a.words,O=c.words,A=l.words,N=d.words,q,V,X,L,U,R,M,re,se,Te;R=q=E[0],M=V=E[1],re=X=E[2],se=L=E[3],Te=U=E[4];for(var he,D=0;D<80;D+=1)he=q+y[F+I[D]]|0,D<16?he+=f(V,X,L)+B[0]:D<32?he+=m(V,X,L)+B[1]:D<48?he+=x(V,X,L)+B[2]:D<64?he+=g(V,X,L)+B[3]:he+=b(V,X,L)+B[4],he=he|0,he=w(he,A[D]),he=he+U|0,q=U,U=L,L=w(X,10),X=V,V=he,he=R+y[F+O[D]]|0,D<16?he+=b(M,re,se)+S[0]:D<32?he+=g(M,re,se)+S[1]:D<48?he+=x(M,re,se)+S[2]:D<64?he+=m(M,re,se)+S[3]:he+=f(M,re,se)+S[4],he=he|0,he=w(he,N[D]),he=he+Te|0,R=Te,Te=se,se=w(re,10),re=M,M=he;he=E[1]+X+se|0,E[1]=E[2]+L+Te|0,E[2]=E[3]+U+R|0,E[3]=E[4]+q+M|0,E[4]=E[0]+V+re|0,E[0]=he},_doFinalize:function(){var y=this._data,F=y.words,D=this._nDataBytes*8,C=y.sigBytes*8;F[C>>>5]|=128<<24-C%32,F[(C+64>>>9<<4)+14]=(D<<8|D>>>24)&16711935|(D<<24|D>>>8)&4278255360,y.sigBytes=(F.length+1)*4,this._process();for(var k=this._hash,E=k.words,B=0;B<5;B++){var S=E[B];E[B]=(S<<8|S>>>24)&16711935|(S<<24|S>>>8)&4278255360}return k},clone:function(){var y=o.clone.call(this);return y._hash=this._hash.clone(),y}});function f(y,F,D){return y^F^D}function m(y,F,D){return y&F|~y&D}function x(y,F,D){return(y|~F)^D}function g(y,F,D){return y&D|F&~D}function b(y,F,D){return y^(F|~D)}function w(y,F){return y<>>32-F}t.RIPEMD160=o._createHelper(p),t.HmacRIPEMD160=o._createHmacHelper(p)})(Math),n.RIPEMD160})});var fh=_((uh,My)=>{(function(n,e){typeof uh=="object"?My.exports=uh=e(xe()):typeof define=="function"&&define.amd?define(["./core"],e):e(n.CryptoJS)})(uh,function(n){(function(){var e=n,t=e.lib,i=t.Base,r=e.enc,o=r.Utf8,s=e.algo,a=s.HMAC=i.extend({init:function(c,l){c=this._hasher=new c.init,typeof l=="string"&&(l=o.parse(l));var d=c.blockSize,h=d*4;l.sigBytes>h&&(l=c.finalize(l)),l.clamp();for(var u=this._oKey=l.clone(),p=this._iKey=l.clone(),f=u.words,m=p.words,x=0;x{(function(n,e,t){typeof ph=="object"?Ny.exports=ph=e(xe(),sh(),fh()):typeof define=="function"&&define.amd?define(["./core","./sha256","./hmac"],e):e(n.CryptoJS)})(ph,function(n){return(function(){var e=n,t=e.lib,i=t.Base,r=t.WordArray,o=e.algo,s=o.SHA256,a=o.HMAC,c=o.PBKDF2=i.extend({cfg:i.extend({keySize:128/32,hasher:s,iterations:25e4}),init:function(l){this.cfg=this.cfg.extend(l)},compute:function(l,d){for(var h=this.cfg,u=a.create(h.hasher,l),p=r.create(),f=r.create([1]),m=p.words,x=f.words,g=h.keySize,b=h.iterations;m.length{(function(n,e,t){typeof gh=="object"?Vy.exports=gh=e(xe(),tp(),fh()):typeof define=="function"&&define.amd?define(["./core","./sha1","./hmac"],e):e(n.CryptoJS)})(gh,function(n){return(function(){var e=n,t=e.lib,i=t.Base,r=t.WordArray,o=e.algo,s=o.MD5,a=o.EvpKDF=i.extend({cfg:i.extend({keySize:128/32,hasher:s,iterations:1}),init:function(c){this.cfg=this.cfg.extend(c)},compute:function(c,l){for(var d,h=this.cfg,u=h.hasher.create(),p=r.create(),f=p.words,m=h.keySize,x=h.iterations;f.length{(function(n,e,t){typeof mh=="object"?Hy.exports=mh=e(xe(),Mn()):typeof define=="function"&&define.amd?define(["./core","./evpkdf"],e):e(n.CryptoJS)})(mh,function(n){n.lib.Cipher||(function(e){var t=n,i=t.lib,r=i.Base,o=i.WordArray,s=i.BufferedBlockAlgorithm,a=t.enc,c=a.Utf8,l=a.Base64,d=t.algo,h=d.EvpKDF,u=i.Cipher=s.extend({cfg:r.extend(),createEncryptor:function(S,I){return this.create(this._ENC_XFORM_MODE,S,I)},createDecryptor:function(S,I){return this.create(this._DEC_XFORM_MODE,S,I)},init:function(S,I,O){this.cfg=this.cfg.extend(O),this._xformMode=S,this._key=I,this.reset()},reset:function(){s.reset.call(this),this._doReset()},process:function(S){return this._append(S),this._process()},finalize:function(S){S&&this._append(S);var I=this._doFinalize();return I},keySize:128/32,ivSize:128/32,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:(function(){function S(I){return typeof I=="string"?B:C}return function(I){return{encrypt:function(O,A,N){return S(A).encrypt(I,O,A,N)},decrypt:function(O,A,N){return S(A).decrypt(I,O,A,N)}}}})()}),p=i.StreamCipher=u.extend({_doFinalize:function(){var S=this._process(!0);return S},blockSize:1}),f=t.mode={},m=i.BlockCipherMode=r.extend({createEncryptor:function(S,I){return this.Encryptor.create(S,I)},createDecryptor:function(S,I){return this.Decryptor.create(S,I)},init:function(S,I){this._cipher=S,this._iv=I}}),x=f.CBC=(function(){var S=m.extend();S.Encryptor=S.extend({processBlock:function(O,A){var N=this._cipher,q=N.blockSize;I.call(this,O,A,q),N.encryptBlock(O,A),this._prevBlock=O.slice(A,A+q)}}),S.Decryptor=S.extend({processBlock:function(O,A){var N=this._cipher,q=N.blockSize,V=O.slice(A,A+q);N.decryptBlock(O,A),I.call(this,O,A,q),this._prevBlock=V}});function I(O,A,N){var q,V=this._iv;V?(q=V,this._iv=e):q=this._prevBlock;for(var X=0;X>>2]&255;S.sigBytes-=I}},w=i.BlockCipher=u.extend({cfg:u.cfg.extend({mode:x,padding:b}),reset:function(){var S;u.reset.call(this);var I=this.cfg,O=I.iv,A=I.mode;this._xformMode==this._ENC_XFORM_MODE?S=A.createEncryptor:(S=A.createDecryptor,this._minBufferSize=1),this._mode&&this._mode.__creator==S?this._mode.init(this,O&&O.words):(this._mode=S.call(A,this,O&&O.words),this._mode.__creator=S)},_doProcessBlock:function(S,I){this._mode.processBlock(S,I)},_doFinalize:function(){var S,I=this.cfg.padding;return this._xformMode==this._ENC_XFORM_MODE?(I.pad(this._data,this.blockSize),S=this._process(!0)):(S=this._process(!0),I.unpad(S)),S},blockSize:128/32}),y=i.CipherParams=r.extend({init:function(S){this.mixIn(S)},toString:function(S){return(S||this.formatter).stringify(this)}}),F=t.format={},D=F.OpenSSL={stringify:function(S){var I,O=S.ciphertext,A=S.salt;return A?I=o.create([1398893684,1701076831]).concat(A).concat(O):I=O,I.toString(l)},parse:function(S){var I,O=l.parse(S),A=O.words;return A[0]==1398893684&&A[1]==1701076831&&(I=o.create(A.slice(2,4)),A.splice(0,4),O.sigBytes-=16),y.create({ciphertext:O,salt:I})}},C=i.SerializableCipher=r.extend({cfg:r.extend({format:D}),encrypt:function(S,I,O,A){A=this.cfg.extend(A);var N=S.createEncryptor(O,A),q=N.finalize(I),V=N.cfg;return y.create({ciphertext:q,key:O,iv:V.iv,algorithm:S,mode:V.mode,padding:V.padding,blockSize:S.blockSize,formatter:A.format})},decrypt:function(S,I,O,A){A=this.cfg.extend(A),I=this._parse(I,A.format);var N=S.createDecryptor(O,A).finalize(I.ciphertext);return N},_parse:function(S,I){return typeof S=="string"?I.parse(S,this):S}}),k=t.kdf={},E=k.OpenSSL={execute:function(S,I,O,A,N){if(A||(A=o.random(64/8)),N)var q=h.create({keySize:I+O,hasher:N}).compute(S,A);else var q=h.create({keySize:I+O}).compute(S,A);var V=o.create(q.words.slice(I),O*4);return q.sigBytes=I*4,y.create({key:q,iv:V,salt:A})}},B=i.PasswordBasedCipher=C.extend({cfg:C.cfg.extend({kdf:E}),encrypt:function(S,I,O,A){A=this.cfg.extend(A);var N=A.kdf.execute(O,S.keySize,S.ivSize,A.salt,A.hasher);A.iv=N.iv;var q=C.encrypt.call(this,S,I,N.key,A);return q.mixIn(N),q},decrypt:function(S,I,O,A){A=this.cfg.extend(A),I=this._parse(I,A.format);var N=A.kdf.execute(O,S.keySize,S.ivSize,I.salt,A.hasher);A.iv=N.iv;var q=C.decrypt.call(this,S,I,N.key,A);return q}})})()})});var Uy=_((xh,zy)=>{(function(n,e,t){typeof xh=="object"?zy.exports=xh=e(xe(),ot()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(n.CryptoJS)})(xh,function(n){return n.mode.CFB=(function(){var e=n.lib.BlockCipherMode.extend();e.Encryptor=e.extend({processBlock:function(i,r){var o=this._cipher,s=o.blockSize;t.call(this,i,r,s,o),this._prevBlock=i.slice(r,r+s)}}),e.Decryptor=e.extend({processBlock:function(i,r){var o=this._cipher,s=o.blockSize,a=i.slice(r,r+s);t.call(this,i,r,s,o),this._prevBlock=a}});function t(i,r,o,s){var a,c=this._iv;c?(a=c.slice(0),this._iv=void 0):a=this._prevBlock,s.encryptBlock(a,0);for(var l=0;l{(function(n,e,t){typeof bh=="object"?qy.exports=bh=e(xe(),ot()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(n.CryptoJS)})(bh,function(n){return n.mode.CTR=(function(){var e=n.lib.BlockCipherMode.extend(),t=e.Encryptor=e.extend({processBlock:function(i,r){var o=this._cipher,s=o.blockSize,a=this._iv,c=this._counter;a&&(c=this._counter=a.slice(0),this._iv=void 0);var l=c.slice(0);o.encryptBlock(l,0),c[s-1]=c[s-1]+1|0;for(var d=0;d{(function(n,e,t){typeof yh=="object"?Wy.exports=yh=e(xe(),ot()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(n.CryptoJS)})(yh,function(n){return n.mode.CTRGladman=(function(){var e=n.lib.BlockCipherMode.extend();function t(o){if((o>>24&255)===255){var s=o>>16&255,a=o>>8&255,c=o&255;s===255?(s=0,a===255?(a=0,c===255?c=0:++c):++a):++s,o=0,o+=s<<16,o+=a<<8,o+=c}else o+=1<<24;return o}function i(o){return(o[0]=t(o[0]))===0&&(o[1]=t(o[1])),o}var r=e.Encryptor=e.extend({processBlock:function(o,s){var a=this._cipher,c=a.blockSize,l=this._iv,d=this._counter;l&&(d=this._counter=l.slice(0),this._iv=void 0),i(d);var h=d.slice(0);a.encryptBlock(h,0);for(var u=0;u{(function(n,e,t){typeof vh=="object"?Gy.exports=vh=e(xe(),ot()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(n.CryptoJS)})(vh,function(n){return n.mode.OFB=(function(){var e=n.lib.BlockCipherMode.extend(),t=e.Encryptor=e.extend({processBlock:function(i,r){var o=this._cipher,s=o.blockSize,a=this._iv,c=this._keystream;a&&(c=this._keystream=a.slice(0),this._iv=void 0),o.encryptBlock(c,0);for(var l=0;l{(function(n,e,t){typeof wh=="object"?Zy.exports=wh=e(xe(),ot()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(n.CryptoJS)})(wh,function(n){return n.mode.ECB=(function(){var e=n.lib.BlockCipherMode.extend();return e.Encryptor=e.extend({processBlock:function(t,i){this._cipher.encryptBlock(t,i)}}),e.Decryptor=e.extend({processBlock:function(t,i){this._cipher.decryptBlock(t,i)}}),e})(),n.mode.ECB})});var Jy=_((Fh,_y)=>{(function(n,e,t){typeof Fh=="object"?_y.exports=Fh=e(xe(),ot()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(n.CryptoJS)})(Fh,function(n){return n.pad.AnsiX923={pad:function(e,t){var i=e.sigBytes,r=t*4,o=r-i%r,s=i+o-1;e.clamp(),e.words[s>>>2]|=o<<24-s%4*8,e.sigBytes+=o},unpad:function(e){var t=e.words[e.sigBytes-1>>>2]&255;e.sigBytes-=t}},n.pad.Ansix923})});var $y=_((Dh,Qy)=>{(function(n,e,t){typeof Dh=="object"?Qy.exports=Dh=e(xe(),ot()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(n.CryptoJS)})(Dh,function(n){return n.pad.Iso10126={pad:function(e,t){var i=t*4,r=i-e.sigBytes%i;e.concat(n.lib.WordArray.random(r-1)).concat(n.lib.WordArray.create([r<<24],1))},unpad:function(e){var t=e.words[e.sigBytes-1>>>2]&255;e.sigBytes-=t}},n.pad.Iso10126})});var tv=_((Ph,ev)=>{(function(n,e,t){typeof Ph=="object"?ev.exports=Ph=e(xe(),ot()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(n.CryptoJS)})(Ph,function(n){return n.pad.Iso97971={pad:function(e,t){e.concat(n.lib.WordArray.create([2147483648],1)),n.pad.ZeroPadding.pad(e,t)},unpad:function(e){n.pad.ZeroPadding.unpad(e),e.sigBytes--}},n.pad.Iso97971})});var nv=_((kh,iv)=>{(function(n,e,t){typeof kh=="object"?iv.exports=kh=e(xe(),ot()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(n.CryptoJS)})(kh,function(n){return n.pad.ZeroPadding={pad:function(e,t){var i=t*4;e.clamp(),e.sigBytes+=i-(e.sigBytes%i||i)},unpad:function(e){for(var t=e.words,i=e.sigBytes-1,i=e.sigBytes-1;i>=0;i--)if(t[i>>>2]>>>24-i%4*8&255){e.sigBytes=i+1;break}}},n.pad.ZeroPadding})});var ov=_((Ch,rv)=>{(function(n,e,t){typeof Ch=="object"?rv.exports=Ch=e(xe(),ot()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(n.CryptoJS)})(Ch,function(n){return n.pad.NoPadding={pad:function(){},unpad:function(){}},n.pad.NoPadding})});var av=_((Sh,sv)=>{(function(n,e,t){typeof Sh=="object"?sv.exports=Sh=e(xe(),ot()):typeof define=="function"&&define.amd?define(["./core","./cipher-core"],e):e(n.CryptoJS)})(Sh,function(n){return(function(e){var t=n,i=t.lib,r=i.CipherParams,o=t.enc,s=o.Hex,a=t.format,c=a.Hex={stringify:function(l){return l.ciphertext.toString(s)},parse:function(l){var d=s.parse(l);return r.create({ciphertext:d})}}})(),n.format.Hex})});var cv=_((Eh,lv)=>{(function(n,e,t){typeof Eh=="object"?lv.exports=Eh=e(xe(),Cr(),Sr(),Mn(),ot()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(n.CryptoJS)})(Eh,function(n){return(function(){var e=n,t=e.lib,i=t.BlockCipher,r=e.algo,o=[],s=[],a=[],c=[],l=[],d=[],h=[],u=[],p=[],f=[];(function(){for(var g=[],b=0;b<256;b++)b<128?g[b]=b<<1:g[b]=b<<1^283;for(var w=0,y=0,b=0;b<256;b++){var F=y^y<<1^y<<2^y<<3^y<<4;F=F>>>8^F&255^99,o[w]=F,s[F]=w;var D=g[w],C=g[D],k=g[C],E=g[F]*257^F*16843008;a[w]=E<<24|E>>>8,c[w]=E<<16|E>>>16,l[w]=E<<8|E>>>24,d[w]=E;var E=k*16843009^C*65537^D*257^w*16843008;h[F]=E<<24|E>>>8,u[F]=E<<16|E>>>16,p[F]=E<<8|E>>>24,f[F]=E,w?(w=D^g[g[g[k^D]]],y^=g[g[y]]):w=y=1}})();var m=[0,1,2,4,8,16,32,64,128,27,54],x=r.AES=i.extend({_doReset:function(){var g;if(!(this._nRounds&&this._keyPriorReset===this._key)){for(var b=this._keyPriorReset=this._key,w=b.words,y=b.sigBytes/4,F=this._nRounds=y+6,D=(F+1)*4,C=this._keySchedule=[],k=0;k6&&k%y==4&&(g=o[g>>>24]<<24|o[g>>>16&255]<<16|o[g>>>8&255]<<8|o[g&255]):(g=g<<8|g>>>24,g=o[g>>>24]<<24|o[g>>>16&255]<<16|o[g>>>8&255]<<8|o[g&255],g^=m[k/y|0]<<24),C[k]=C[k-y]^g);for(var E=this._invKeySchedule=[],B=0;B>>24]]^u[o[g>>>16&255]]^p[o[g>>>8&255]]^f[o[g&255]]}}},encryptBlock:function(g,b){this._doCryptBlock(g,b,this._keySchedule,a,c,l,d,o)},decryptBlock:function(g,b){var w=g[b+1];g[b+1]=g[b+3],g[b+3]=w,this._doCryptBlock(g,b,this._invKeySchedule,h,u,p,f,s);var w=g[b+1];g[b+1]=g[b+3],g[b+3]=w},_doCryptBlock:function(g,b,w,y,F,D,C,k){for(var E=this._nRounds,B=g[b]^w[0],S=g[b+1]^w[1],I=g[b+2]^w[2],O=g[b+3]^w[3],A=4,N=1;N>>24]^F[S>>>16&255]^D[I>>>8&255]^C[O&255]^w[A++],V=y[S>>>24]^F[I>>>16&255]^D[O>>>8&255]^C[B&255]^w[A++],X=y[I>>>24]^F[O>>>16&255]^D[B>>>8&255]^C[S&255]^w[A++],L=y[O>>>24]^F[B>>>16&255]^D[S>>>8&255]^C[I&255]^w[A++];B=q,S=V,I=X,O=L}var q=(k[B>>>24]<<24|k[S>>>16&255]<<16|k[I>>>8&255]<<8|k[O&255])^w[A++],V=(k[S>>>24]<<24|k[I>>>16&255]<<16|k[O>>>8&255]<<8|k[B&255])^w[A++],X=(k[I>>>24]<<24|k[O>>>16&255]<<16|k[B>>>8&255]<<8|k[S&255])^w[A++],L=(k[O>>>24]<<24|k[B>>>16&255]<<16|k[S>>>8&255]<<8|k[I&255])^w[A++];g[b]=q,g[b+1]=V,g[b+2]=X,g[b+3]=L},keySize:256/32});e.AES=i._createHelper(x)})(),n.AES})});var hv=_((Th,dv)=>{(function(n,e,t){typeof Th=="object"?dv.exports=Th=e(xe(),Cr(),Sr(),Mn(),ot()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(n.CryptoJS)})(Th,function(n){return(function(){var e=n,t=e.lib,i=t.WordArray,r=t.BlockCipher,o=e.algo,s=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],a=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],c=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],l=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],d=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],h=o.DES=r.extend({_doReset:function(){for(var m=this._key,x=m.words,g=[],b=0;b<56;b++){var w=s[b]-1;g[b]=x[w>>>5]>>>31-w%32&1}for(var y=this._subKeys=[],F=0;F<16;F++){for(var D=y[F]=[],C=c[F],b=0;b<24;b++)D[b/6|0]|=g[(a[b]-1+C)%28]<<31-b%6,D[4+(b/6|0)]|=g[28+(a[b+24]-1+C)%28]<<31-b%6;D[0]=D[0]<<1|D[0]>>>31;for(var b=1;b<7;b++)D[b]=D[b]>>>(b-1)*4+3;D[7]=D[7]<<5|D[7]>>>27}for(var k=this._invSubKeys=[],b=0;b<16;b++)k[b]=y[15-b]},encryptBlock:function(m,x){this._doCryptBlock(m,x,this._subKeys)},decryptBlock:function(m,x){this._doCryptBlock(m,x,this._invSubKeys)},_doCryptBlock:function(m,x,g){this._lBlock=m[x],this._rBlock=m[x+1],u.call(this,4,252645135),u.call(this,16,65535),p.call(this,2,858993459),p.call(this,8,16711935),u.call(this,1,1431655765);for(var b=0;b<16;b++){for(var w=g[b],y=this._lBlock,F=this._rBlock,D=0,C=0;C<8;C++)D|=l[C][((F^w[C])&d[C])>>>0];this._lBlock=F,this._rBlock=y^D}var k=this._lBlock;this._lBlock=this._rBlock,this._rBlock=k,u.call(this,1,1431655765),p.call(this,8,16711935),p.call(this,2,858993459),u.call(this,16,65535),u.call(this,4,252645135),m[x]=this._lBlock,m[x+1]=this._rBlock},keySize:64/32,ivSize:64/32,blockSize:64/32});function u(m,x){var g=(this._lBlock>>>m^this._rBlock)&x;this._rBlock^=g,this._lBlock^=g<>>m^this._lBlock)&x;this._lBlock^=g,this._rBlock^=g<192.");var g=x.slice(0,2),b=x.length<4?x.slice(0,2):x.slice(2,4),w=x.length<6?x.slice(0,2):x.slice(4,6);this._des1=h.createEncryptor(i.create(g)),this._des2=h.createEncryptor(i.create(b)),this._des3=h.createEncryptor(i.create(w))},encryptBlock:function(m,x){this._des1.encryptBlock(m,x),this._des2.decryptBlock(m,x),this._des3.encryptBlock(m,x)},decryptBlock:function(m,x){this._des3.decryptBlock(m,x),this._des2.encryptBlock(m,x),this._des1.decryptBlock(m,x)},keySize:192/32,ivSize:64/32,blockSize:64/32});e.TripleDES=r._createHelper(f)})(),n.TripleDES})});var fv=_((Ah,uv)=>{(function(n,e,t){typeof Ah=="object"?uv.exports=Ah=e(xe(),Cr(),Sr(),Mn(),ot()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(n.CryptoJS)})(Ah,function(n){return(function(){var e=n,t=e.lib,i=t.StreamCipher,r=e.algo,o=r.RC4=i.extend({_doReset:function(){for(var c=this._key,l=c.words,d=c.sigBytes,h=this._S=[],u=0;u<256;u++)h[u]=u;for(var u=0,p=0;u<256;u++){var f=u%d,m=l[f>>>2]>>>24-f%4*8&255;p=(p+h[u]+m)%256;var x=h[u];h[u]=h[p],h[p]=x}this._i=this._j=0},_doProcessBlock:function(c,l){c[l]^=s.call(this)},keySize:256/32,ivSize:0});function s(){for(var c=this._S,l=this._i,d=this._j,h=0,u=0;u<4;u++){l=(l+1)%256,d=(d+c[l])%256;var p=c[l];c[l]=c[d],c[d]=p,h|=c[(c[l]+c[d])%256]<<24-u*8}return this._i=l,this._j=d,h}e.RC4=i._createHelper(o);var a=r.RC4Drop=o.extend({cfg:o.cfg.extend({drop:192}),_doReset:function(){o._doReset.call(this);for(var c=this.cfg.drop;c>0;c--)s.call(this)}});e.RC4Drop=i._createHelper(a)})(),n.RC4})});var gv=_((Ih,pv)=>{(function(n,e,t){typeof Ih=="object"?pv.exports=Ih=e(xe(),Cr(),Sr(),Mn(),ot()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(n.CryptoJS)})(Ih,function(n){return(function(){var e=n,t=e.lib,i=t.StreamCipher,r=e.algo,o=[],s=[],a=[],c=r.Rabbit=i.extend({_doReset:function(){for(var d=this._key.words,h=this.cfg.iv,u=0;u<4;u++)d[u]=(d[u]<<8|d[u]>>>24)&16711935|(d[u]<<24|d[u]>>>8)&4278255360;var p=this._X=[d[0],d[3]<<16|d[2]>>>16,d[1],d[0]<<16|d[3]>>>16,d[2],d[1]<<16|d[0]>>>16,d[3],d[2]<<16|d[1]>>>16],f=this._C=[d[2]<<16|d[2]>>>16,d[0]&4294901760|d[1]&65535,d[3]<<16|d[3]>>>16,d[1]&4294901760|d[2]&65535,d[0]<<16|d[0]>>>16,d[2]&4294901760|d[3]&65535,d[1]<<16|d[1]>>>16,d[3]&4294901760|d[0]&65535];this._b=0;for(var u=0;u<4;u++)l.call(this);for(var u=0;u<8;u++)f[u]^=p[u+4&7];if(h){var m=h.words,x=m[0],g=m[1],b=(x<<8|x>>>24)&16711935|(x<<24|x>>>8)&4278255360,w=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360,y=b>>>16|w&4294901760,F=w<<16|b&65535;f[0]^=b,f[1]^=y,f[2]^=w,f[3]^=F,f[4]^=b,f[5]^=y,f[6]^=w,f[7]^=F;for(var u=0;u<4;u++)l.call(this)}},_doProcessBlock:function(d,h){var u=this._X;l.call(this),o[0]=u[0]^u[5]>>>16^u[3]<<16,o[1]=u[2]^u[7]>>>16^u[5]<<16,o[2]=u[4]^u[1]>>>16^u[7]<<16,o[3]=u[6]^u[3]>>>16^u[1]<<16;for(var p=0;p<4;p++)o[p]=(o[p]<<8|o[p]>>>24)&16711935|(o[p]<<24|o[p]>>>8)&4278255360,d[h+p]^=o[p]},blockSize:128/32,ivSize:64/32});function l(){for(var d=this._X,h=this._C,u=0;u<8;u++)s[u]=h[u];h[0]=h[0]+1295307597+this._b|0,h[1]=h[1]+3545052371+(h[0]>>>0>>0?1:0)|0,h[2]=h[2]+886263092+(h[1]>>>0>>0?1:0)|0,h[3]=h[3]+1295307597+(h[2]>>>0>>0?1:0)|0,h[4]=h[4]+3545052371+(h[3]>>>0>>0?1:0)|0,h[5]=h[5]+886263092+(h[4]>>>0>>0?1:0)|0,h[6]=h[6]+1295307597+(h[5]>>>0>>0?1:0)|0,h[7]=h[7]+3545052371+(h[6]>>>0>>0?1:0)|0,this._b=h[7]>>>0>>0?1:0;for(var u=0;u<8;u++){var p=d[u]+h[u],f=p&65535,m=p>>>16,x=((f*f>>>17)+f*m>>>15)+m*m,g=((p&4294901760)*p|0)+((p&65535)*p|0);a[u]=x^g}d[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,d[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,d[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,d[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,d[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,d[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,d[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,d[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}e.Rabbit=i._createHelper(c)})(),n.Rabbit})});var xv=_((Bh,mv)=>{(function(n,e,t){typeof Bh=="object"?mv.exports=Bh=e(xe(),Cr(),Sr(),Mn(),ot()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(n.CryptoJS)})(Bh,function(n){return(function(){var e=n,t=e.lib,i=t.StreamCipher,r=e.algo,o=[],s=[],a=[],c=r.RabbitLegacy=i.extend({_doReset:function(){var d=this._key.words,h=this.cfg.iv,u=this._X=[d[0],d[3]<<16|d[2]>>>16,d[1],d[0]<<16|d[3]>>>16,d[2],d[1]<<16|d[0]>>>16,d[3],d[2]<<16|d[1]>>>16],p=this._C=[d[2]<<16|d[2]>>>16,d[0]&4294901760|d[1]&65535,d[3]<<16|d[3]>>>16,d[1]&4294901760|d[2]&65535,d[0]<<16|d[0]>>>16,d[2]&4294901760|d[3]&65535,d[1]<<16|d[1]>>>16,d[3]&4294901760|d[0]&65535];this._b=0;for(var f=0;f<4;f++)l.call(this);for(var f=0;f<8;f++)p[f]^=u[f+4&7];if(h){var m=h.words,x=m[0],g=m[1],b=(x<<8|x>>>24)&16711935|(x<<24|x>>>8)&4278255360,w=(g<<8|g>>>24)&16711935|(g<<24|g>>>8)&4278255360,y=b>>>16|w&4294901760,F=w<<16|b&65535;p[0]^=b,p[1]^=y,p[2]^=w,p[3]^=F,p[4]^=b,p[5]^=y,p[6]^=w,p[7]^=F;for(var f=0;f<4;f++)l.call(this)}},_doProcessBlock:function(d,h){var u=this._X;l.call(this),o[0]=u[0]^u[5]>>>16^u[3]<<16,o[1]=u[2]^u[7]>>>16^u[5]<<16,o[2]=u[4]^u[1]>>>16^u[7]<<16,o[3]=u[6]^u[3]>>>16^u[1]<<16;for(var p=0;p<4;p++)o[p]=(o[p]<<8|o[p]>>>24)&16711935|(o[p]<<24|o[p]>>>8)&4278255360,d[h+p]^=o[p]},blockSize:128/32,ivSize:64/32});function l(){for(var d=this._X,h=this._C,u=0;u<8;u++)s[u]=h[u];h[0]=h[0]+1295307597+this._b|0,h[1]=h[1]+3545052371+(h[0]>>>0>>0?1:0)|0,h[2]=h[2]+886263092+(h[1]>>>0>>0?1:0)|0,h[3]=h[3]+1295307597+(h[2]>>>0>>0?1:0)|0,h[4]=h[4]+3545052371+(h[3]>>>0>>0?1:0)|0,h[5]=h[5]+886263092+(h[4]>>>0>>0?1:0)|0,h[6]=h[6]+1295307597+(h[5]>>>0>>0?1:0)|0,h[7]=h[7]+3545052371+(h[6]>>>0>>0?1:0)|0,this._b=h[7]>>>0>>0?1:0;for(var u=0;u<8;u++){var p=d[u]+h[u],f=p&65535,m=p>>>16,x=((f*f>>>17)+f*m>>>15)+m*m,g=((p&4294901760)*p|0)+((p&65535)*p|0);a[u]=x^g}d[0]=a[0]+(a[7]<<16|a[7]>>>16)+(a[6]<<16|a[6]>>>16)|0,d[1]=a[1]+(a[0]<<8|a[0]>>>24)+a[7]|0,d[2]=a[2]+(a[1]<<16|a[1]>>>16)+(a[0]<<16|a[0]>>>16)|0,d[3]=a[3]+(a[2]<<8|a[2]>>>24)+a[1]|0,d[4]=a[4]+(a[3]<<16|a[3]>>>16)+(a[2]<<16|a[2]>>>16)|0,d[5]=a[5]+(a[4]<<8|a[4]>>>24)+a[3]|0,d[6]=a[6]+(a[5]<<16|a[5]>>>16)+(a[4]<<16|a[4]>>>16)|0,d[7]=a[7]+(a[6]<<8|a[6]>>>24)+a[5]|0}e.RabbitLegacy=i._createHelper(c)})(),n.RabbitLegacy})});var yv=_((Oh,bv)=>{(function(n,e,t){typeof Oh=="object"?bv.exports=Oh=e(xe(),Cr(),Sr(),Mn(),ot()):typeof define=="function"&&define.amd?define(["./core","./enc-base64","./md5","./evpkdf","./cipher-core"],e):e(n.CryptoJS)})(Oh,function(n){return(function(){var e=n,t=e.lib,i=t.BlockCipher,r=e.algo;let o=16,s=[608135816,2242054355,320440878,57701188,2752067618,698298832,137296536,3964562569,1160258022,953160567,3193202383,887688300,3232508343,3380367581,1065670069,3041331479,2450970073,2306472731],a=[[3509652390,2564797868,805139163,3491422135,3101798381,1780907670,3128725573,4046225305,614570311,3012652279,134345442,2240740374,1667834072,1901547113,2757295779,4103290238,227898511,1921955416,1904987480,2182433518,2069144605,3260701109,2620446009,720527379,3318853667,677414384,3393288472,3101374703,2390351024,1614419982,1822297739,2954791486,3608508353,3174124327,2024746970,1432378464,3864339955,2857741204,1464375394,1676153920,1439316330,715854006,3033291828,289532110,2706671279,2087905683,3018724369,1668267050,732546397,1947742710,3462151702,2609353502,2950085171,1814351708,2050118529,680887927,999245976,1800124847,3300911131,1713906067,1641548236,4213287313,1216130144,1575780402,4018429277,3917837745,3693486850,3949271944,596196993,3549867205,258830323,2213823033,772490370,2760122372,1774776394,2652871518,566650946,4142492826,1728879713,2882767088,1783734482,3629395816,2517608232,2874225571,1861159788,326777828,3124490320,2130389656,2716951837,967770486,1724537150,2185432712,2364442137,1164943284,2105845187,998989502,3765401048,2244026483,1075463327,1455516326,1322494562,910128902,469688178,1117454909,936433444,3490320968,3675253459,1240580251,122909385,2157517691,634681816,4142456567,3825094682,3061402683,2540495037,79693498,3249098678,1084186820,1583128258,426386531,1761308591,1047286709,322548459,995290223,1845252383,2603652396,3431023940,2942221577,3202600964,3727903485,1712269319,422464435,3234572375,1170764815,3523960633,3117677531,1434042557,442511882,3600875718,1076654713,1738483198,4213154764,2393238008,3677496056,1014306527,4251020053,793779912,2902807211,842905082,4246964064,1395751752,1040244610,2656851899,3396308128,445077038,3742853595,3577915638,679411651,2892444358,2354009459,1767581616,3150600392,3791627101,3102740896,284835224,4246832056,1258075500,768725851,2589189241,3069724005,3532540348,1274779536,3789419226,2764799539,1660621633,3471099624,4011903706,913787905,3497959166,737222580,2514213453,2928710040,3937242737,1804850592,3499020752,2949064160,2386320175,2390070455,2415321851,4061277028,2290661394,2416832540,1336762016,1754252060,3520065937,3014181293,791618072,3188594551,3933548030,2332172193,3852520463,3043980520,413987798,3465142937,3030929376,4245938359,2093235073,3534596313,375366246,2157278981,2479649556,555357303,3870105701,2008414854,3344188149,4221384143,3956125452,2067696032,3594591187,2921233993,2428461,544322398,577241275,1471733935,610547355,4027169054,1432588573,1507829418,2025931657,3646575487,545086370,48609733,2200306550,1653985193,298326376,1316178497,3007786442,2064951626,458293330,2589141269,3591329599,3164325604,727753846,2179363840,146436021,1461446943,4069977195,705550613,3059967265,3887724982,4281599278,3313849956,1404054877,2845806497,146425753,1854211946],[1266315497,3048417604,3681880366,3289982499,290971e4,1235738493,2632868024,2414719590,3970600049,1771706367,1449415276,3266420449,422970021,1963543593,2690192192,3826793022,1062508698,1531092325,1804592342,2583117782,2714934279,4024971509,1294809318,4028980673,1289560198,2221992742,1669523910,35572830,157838143,1052438473,1016535060,1802137761,1753167236,1386275462,3080475397,2857371447,1040679964,2145300060,2390574316,1461121720,2956646967,4031777805,4028374788,33600511,2920084762,1018524850,629373528,3691585981,3515945977,2091462646,2486323059,586499841,988145025,935516892,3367335476,2599673255,2839830854,265290510,3972581182,2759138881,3795373465,1005194799,847297441,406762289,1314163512,1332590856,1866599683,4127851711,750260880,613907577,1450815602,3165620655,3734664991,3650291728,3012275730,3704569646,1427272223,778793252,1343938022,2676280711,2052605720,1946737175,3164576444,3914038668,3967478842,3682934266,1661551462,3294938066,4011595847,840292616,3712170807,616741398,312560963,711312465,1351876610,322626781,1910503582,271666773,2175563734,1594956187,70604529,3617834859,1007753275,1495573769,4069517037,2549218298,2663038764,504708206,2263041392,3941167025,2249088522,1514023603,1998579484,1312622330,694541497,2582060303,2151582166,1382467621,776784248,2618340202,3323268794,2497899128,2784771155,503983604,4076293799,907881277,423175695,432175456,1378068232,4145222326,3954048622,3938656102,3820766613,2793130115,2977904593,26017576,3274890735,3194772133,1700274565,1756076034,4006520079,3677328699,720338349,1533947780,354530856,688349552,3973924725,1637815568,332179504,3949051286,53804574,2852348879,3044236432,1282449977,3583942155,3416972820,4006381244,1617046695,2628476075,3002303598,1686838959,431878346,2686675385,1700445008,1080580658,1009431731,832498133,3223435511,2605976345,2271191193,2516031870,1648197032,4164389018,2548247927,300782431,375919233,238389289,3353747414,2531188641,2019080857,1475708069,455242339,2609103871,448939670,3451063019,1395535956,2413381860,1841049896,1491858159,885456874,4264095073,4001119347,1565136089,3898914787,1108368660,540939232,1173283510,2745871338,3681308437,4207628240,3343053890,4016749493,1699691293,1103962373,3625875870,2256883143,3830138730,1031889488,3479347698,1535977030,4236805024,3251091107,2132092099,1774941330,1199868427,1452454533,157007616,2904115357,342012276,595725824,1480756522,206960106,497939518,591360097,863170706,2375253569,3596610801,1814182875,2094937945,3421402208,1082520231,3463918190,2785509508,435703966,3908032597,1641649973,2842273706,3305899714,1510255612,2148256476,2655287854,3276092548,4258621189,236887753,3681803219,274041037,1734335097,3815195456,3317970021,1899903192,1026095262,4050517792,356393447,2410691914,3873677099,3682840055],[3913112168,2491498743,4132185628,2489919796,1091903735,1979897079,3170134830,3567386728,3557303409,857797738,1136121015,1342202287,507115054,2535736646,337727348,3213592640,1301675037,2528481711,1895095763,1721773893,3216771564,62756741,2142006736,835421444,2531993523,1442658625,3659876326,2882144922,676362277,1392781812,170690266,3921047035,1759253602,3611846912,1745797284,664899054,1329594018,3901205900,3045908486,2062866102,2865634940,3543621612,3464012697,1080764994,553557557,3656615353,3996768171,991055499,499776247,1265440854,648242737,3940784050,980351604,3713745714,1749149687,3396870395,4211799374,3640570775,1161844396,3125318951,1431517754,545492359,4268468663,3499529547,1437099964,2702547544,3433638243,2581715763,2787789398,1060185593,1593081372,2418618748,4260947970,69676912,2159744348,86519011,2512459080,3838209314,1220612927,3339683548,133810670,1090789135,1078426020,1569222167,845107691,3583754449,4072456591,1091646820,628848692,1613405280,3757631651,526609435,236106946,48312990,2942717905,3402727701,1797494240,859738849,992217954,4005476642,2243076622,3870952857,3732016268,765654824,3490871365,2511836413,1685915746,3888969200,1414112111,2273134842,3281911079,4080962846,172450625,2569994100,980381355,4109958455,2819808352,2716589560,2568741196,3681446669,3329971472,1835478071,660984891,3704678404,4045999559,3422617507,3040415634,1762651403,1719377915,3470491036,2693910283,3642056355,3138596744,1364962596,2073328063,1983633131,926494387,3423689081,2150032023,4096667949,1749200295,3328846651,309677260,2016342300,1779581495,3079819751,111262694,1274766160,443224088,298511866,1025883608,3806446537,1145181785,168956806,3641502830,3584813610,1689216846,3666258015,3200248200,1692713982,2646376535,4042768518,1618508792,1610833997,3523052358,4130873264,2001055236,3610705100,2202168115,4028541809,2961195399,1006657119,2006996926,3186142756,1430667929,3210227297,1314452623,4074634658,4101304120,2273951170,1399257539,3367210612,3027628629,1190975929,2062231137,2333990788,2221543033,2438960610,1181637006,548689776,2362791313,3372408396,3104550113,3145860560,296247880,1970579870,3078560182,3769228297,1714227617,3291629107,3898220290,166772364,1251581989,493813264,448347421,195405023,2709975567,677966185,3703036547,1463355134,2715995803,1338867538,1343315457,2802222074,2684532164,233230375,2599980071,2000651841,3277868038,1638401717,4028070440,3237316320,6314154,819756386,300326615,590932579,1405279636,3267499572,3150704214,2428286686,3959192993,3461946742,1862657033,1266418056,963775037,2089974820,2263052895,1917689273,448879540,3550394620,3981727096,150775221,3627908307,1303187396,508620638,2975983352,2726630617,1817252668,1876281319,1457606340,908771278,3720792119,3617206836,2455994898,1729034894,1080033504],[976866871,3556439503,2881648439,1522871579,1555064734,1336096578,3548522304,2579274686,3574697629,3205460757,3593280638,3338716283,3079412587,564236357,2993598910,1781952180,1464380207,3163844217,3332601554,1699332808,1393555694,1183702653,3581086237,1288719814,691649499,2847557200,2895455976,3193889540,2717570544,1781354906,1676643554,2592534050,3230253752,1126444790,2770207658,2633158820,2210423226,2615765581,2414155088,3127139286,673620729,2805611233,1269405062,4015350505,3341807571,4149409754,1057255273,2012875353,2162469141,2276492801,2601117357,993977747,3918593370,2654263191,753973209,36408145,2530585658,25011837,3520020182,2088578344,530523599,2918365339,1524020338,1518925132,3760827505,3759777254,1202760957,3985898139,3906192525,674977740,4174734889,2031300136,2019492241,3983892565,4153806404,3822280332,352677332,2297720250,60907813,90501309,3286998549,1016092578,2535922412,2839152426,457141659,509813237,4120667899,652014361,1966332200,2975202805,55981186,2327461051,676427537,3255491064,2882294119,3433927263,1307055953,942726286,933058658,2468411793,3933900994,4215176142,1361170020,2001714738,2830558078,3274259782,1222529897,1679025792,2729314320,3714953764,1770335741,151462246,3013232138,1682292957,1483529935,471910574,1539241949,458788160,3436315007,1807016891,3718408830,978976581,1043663428,3165965781,1927990952,4200891579,2372276910,3208408903,3533431907,1412390302,2931980059,4132332400,1947078029,3881505623,4168226417,2941484381,1077988104,1320477388,886195818,18198404,3786409e3,2509781533,112762804,3463356488,1866414978,891333506,18488651,661792760,1628790961,3885187036,3141171499,876946877,2693282273,1372485963,791857591,2686433993,3759982718,3167212022,3472953795,2716379847,445679433,3561995674,3504004811,3574258232,54117162,3331405415,2381918588,3769707343,4154350007,1140177722,4074052095,668550556,3214352940,367459370,261225585,2610173221,4209349473,3468074219,3265815641,314222801,3066103646,3808782860,282218597,3406013506,3773591054,379116347,1285071038,846784868,2669647154,3771962079,3550491691,2305946142,453669953,1268987020,3317592352,3279303384,3744833421,2610507566,3859509063,266596637,3847019092,517658769,3462560207,3443424879,370717030,4247526661,2224018117,4143653529,4112773975,2788324899,2477274417,1456262402,2901442914,1517677493,1846949527,2295493580,3734397586,2176403920,1280348187,1908823572,3871786941,846861322,1172426758,3287448474,3383383037,1655181056,3139813346,901632758,1897031941,2986607138,3066810236,3447102507,1393639104,373351379,950779232,625454576,3124240540,4148612726,2007998917,544563296,2244738638,2330496472,2058025392,1291430526,424198748,50039436,29584100,3605783033,2429876329,2791104160,1057563949,3255363231,3075367218,3463963227,1469046755,985887462]];var c={pbox:[],sbox:[]};function l(f,m){let x=m>>24&255,g=m>>16&255,b=m>>8&255,w=m&255,y=f.sbox[0][x]+f.sbox[1][g];return y=y^f.sbox[2][b],y=y+f.sbox[3][w],y}function d(f,m,x){let g=m,b=x,w;for(let y=0;y1;--y)g=g^f.pbox[y],b=l(f,g)^b,w=g,g=b,b=w;return w=g,g=b,b=w,b=b^f.pbox[1],g=g^f.pbox[0],{left:g,right:b}}function u(f,m,x){for(let F=0;F<4;F++){f.sbox[F]=[];for(let D=0;D<256;D++)f.sbox[F][D]=a[F][D]}let g=0;for(let F=0;F=x&&(g=0);let b=0,w=0,y=0;for(let F=0;F{(function(n,e,t){typeof Lh=="object"?vv.exports=Lh=e(xe(),ac(),xy(),yy(),Cr(),Fy(),Sr(),tp(),sh(),Sy(),ip(),Ay(),By(),Ly(),fh(),Ry(),Mn(),ot(),Uy(),jy(),Ky(),Xy(),Yy(),Jy(),$y(),tv(),nv(),ov(),av(),cv(),hv(),fv(),gv(),xv(),yv()):typeof define=="function"&&define.amd?define(["./core","./x64-core","./lib-typedarrays","./enc-utf16","./enc-base64","./enc-base64url","./md5","./sha1","./sha256","./sha224","./sha512","./sha384","./sha3","./ripemd160","./hmac","./pbkdf2","./evpkdf","./cipher-core","./mode-cfb","./mode-ctr","./mode-ctr-gladman","./mode-ofb","./mode-ecb","./pad-ansix923","./pad-iso10126","./pad-iso97971","./pad-zeropadding","./pad-nopadding","./format-hex","./aes","./tripledes","./rc4","./rabbit","./rabbit-legacy","./blowfish"],e):n.CryptoJS=e(n.CryptoJS)})(Lh,function(n){return n})});var bp=_((B6,Sv)=>{"use strict";Sv.exports={aliceblue:[240,248,255],antiquewhite:[250,235,215],aqua:[0,255,255],aquamarine:[127,255,212],azure:[240,255,255],beige:[245,245,220],bisque:[255,228,196],black:[0,0,0],blanchedalmond:[255,235,205],blue:[0,0,255],blueviolet:[138,43,226],brown:[165,42,42],burlywood:[222,184,135],cadetblue:[95,158,160],chartreuse:[127,255,0],chocolate:[210,105,30],coral:[255,127,80],cornflowerblue:[100,149,237],cornsilk:[255,248,220],crimson:[220,20,60],cyan:[0,255,255],darkblue:[0,0,139],darkcyan:[0,139,139],darkgoldenrod:[184,134,11],darkgray:[169,169,169],darkgreen:[0,100,0],darkgrey:[169,169,169],darkkhaki:[189,183,107],darkmagenta:[139,0,139],darkolivegreen:[85,107,47],darkorange:[255,140,0],darkorchid:[153,50,204],darkred:[139,0,0],darksalmon:[233,150,122],darkseagreen:[143,188,143],darkslateblue:[72,61,139],darkslategray:[47,79,79],darkslategrey:[47,79,79],darkturquoise:[0,206,209],darkviolet:[148,0,211],deeppink:[255,20,147],deepskyblue:[0,191,255],dimgray:[105,105,105],dimgrey:[105,105,105],dodgerblue:[30,144,255],firebrick:[178,34,34],floralwhite:[255,250,240],forestgreen:[34,139,34],fuchsia:[255,0,255],gainsboro:[220,220,220],ghostwhite:[248,248,255],gold:[255,215,0],goldenrod:[218,165,32],gray:[128,128,128],green:[0,128,0],greenyellow:[173,255,47],grey:[128,128,128],honeydew:[240,255,240],hotpink:[255,105,180],indianred:[205,92,92],indigo:[75,0,130],ivory:[255,255,240],khaki:[240,230,140],lavender:[230,230,250],lavenderblush:[255,240,245],lawngreen:[124,252,0],lemonchiffon:[255,250,205],lightblue:[173,216,230],lightcoral:[240,128,128],lightcyan:[224,255,255],lightgoldenrodyellow:[250,250,210],lightgray:[211,211,211],lightgreen:[144,238,144],lightgrey:[211,211,211],lightpink:[255,182,193],lightsalmon:[255,160,122],lightseagreen:[32,178,170],lightskyblue:[135,206,250],lightslategray:[119,136,153],lightslategrey:[119,136,153],lightsteelblue:[176,196,222],lightyellow:[255,255,224],lime:[0,255,0],limegreen:[50,205,50],linen:[250,240,230],magenta:[255,0,255],maroon:[128,0,0],mediumaquamarine:[102,205,170],mediumblue:[0,0,205],mediumorchid:[186,85,211],mediumpurple:[147,112,219],mediumseagreen:[60,179,113],mediumslateblue:[123,104,238],mediumspringgreen:[0,250,154],mediumturquoise:[72,209,204],mediumvioletred:[199,21,133],midnightblue:[25,25,112],mintcream:[245,255,250],mistyrose:[255,228,225],moccasin:[255,228,181],navajowhite:[255,222,173],navy:[0,0,128],oldlace:[253,245,230],olive:[128,128,0],olivedrab:[107,142,35],orange:[255,165,0],orangered:[255,69,0],orchid:[218,112,214],palegoldenrod:[238,232,170],palegreen:[152,251,152],paleturquoise:[175,238,238],palevioletred:[219,112,147],papayawhip:[255,239,213],peachpuff:[255,218,185],peru:[205,133,63],pink:[255,192,203],plum:[221,160,221],powderblue:[176,224,230],purple:[128,0,128],rebeccapurple:[102,51,153],red:[255,0,0],rosybrown:[188,143,143],royalblue:[65,105,225],saddlebrown:[139,69,19],salmon:[250,128,114],sandybrown:[244,164,96],seagreen:[46,139,87],seashell:[255,245,238],sienna:[160,82,45],silver:[192,192,192],skyblue:[135,206,235],slateblue:[106,90,205],slategray:[112,128,144],slategrey:[112,128,144],snow:[255,250,250],springgreen:[0,255,127],steelblue:[70,130,180],tan:[210,180,140],teal:[0,128,128],thistle:[216,191,216],tomato:[255,99,71],turquoise:[64,224,208],violet:[238,130,238],wheat:[245,222,179],white:[255,255,255],whitesmoke:[245,245,245],yellow:[255,255,0],yellowgreen:[154,205,50]}});var Tv=_((O6,Ev)=>{Ev.exports=function(e){return!e||typeof e=="string"?!1:e instanceof Array||Array.isArray(e)||e.length>=0&&(e.splice instanceof Function||Object.getOwnPropertyDescriptor(e,e.length-1)&&e.constructor.name!=="String")}});var Bv=_((L6,Iv)=>{"use strict";var ZP=Tv(),YP=Array.prototype.concat,_P=Array.prototype.slice,Av=Iv.exports=function(e){for(var t=[],i=0,r=e.length;i{var xc=bp(),bc=Bv(),Ov=Object.hasOwnProperty,Lv=Object.create(null);for(Wh in xc)Ov.call(xc,Wh)&&(Lv[xc[Wh]]=Wh);var Wh,Gt=Mv.exports={to:{},get:{}};Gt.get=function(n){var e=n.substring(0,3).toLowerCase(),t,i;switch(e){case"hsl":t=Gt.get.hsl(n),i="hsl";break;case"hwb":t=Gt.get.hwb(n),i="hwb";break;default:t=Gt.get.rgb(n),i="rgb";break}return t?{model:i,value:t}:null};Gt.get.rgb=function(n){if(!n)return null;var e=/^#([a-f0-9]{3,4})$/i,t=/^#([a-f0-9]{6})([a-f0-9]{2})?$/i,i=/^rgba?\(\s*([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)(?=[\s,])\s*(?:,\s*)?([+-]?\d+)\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,r=/^rgba?\(\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*,?\s*([+-]?[\d\.]+)\%\s*(?:[,|\/]\s*([+-]?[\d\.]+)(%?)\s*)?\)$/,o=/^(\w+)$/,s=[0,0,0,1],a,c,l;if(a=n.match(t)){for(l=a[2],a=a[1],c=0;c<3;c++){var d=c*2;s[c]=parseInt(a.slice(d,d+2),16)}l&&(s[3]=parseInt(l,16)/255)}else if(a=n.match(e)){for(a=a[1],l=a[3],c=0;c<3;c++)s[c]=parseInt(a[c]+a[c],16);l&&(s[3]=parseInt(l+l,16)/255)}else if(a=n.match(i)){for(c=0;c<3;c++)s[c]=parseInt(a[c+1],0);a[4]&&(a[5]?s[3]=parseFloat(a[4])*.01:s[3]=parseFloat(a[4]))}else if(a=n.match(r)){for(c=0;c<3;c++)s[c]=Math.round(parseFloat(a[c+1])*2.55);a[4]&&(a[5]?s[3]=parseFloat(a[4])*.01:s[3]=parseFloat(a[4]))}else return(a=n.match(o))?a[1]==="transparent"?[0,0,0,0]:Ov.call(xc,a[1])?(s=xc[a[1]],s[3]=1,s):null:null;for(c=0;c<3;c++)s[c]=Ir(s[c],0,255);return s[3]=Ir(s[3],0,1),s};Gt.get.hsl=function(n){if(!n)return null;var e=/^hsla?\(\s*([+-]?(?:\d{0,3}\.)?\d+)(?:deg)?\s*,?\s*([+-]?[\d\.]+)%\s*,?\s*([+-]?[\d\.]+)%\s*(?:[,|\/]\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,t=n.match(e);if(t){var i=parseFloat(t[4]),r=(parseFloat(t[1])%360+360)%360,o=Ir(parseFloat(t[2]),0,100),s=Ir(parseFloat(t[3]),0,100),a=Ir(isNaN(i)?1:i,0,1);return[r,o,s,a]}return null};Gt.get.hwb=function(n){if(!n)return null;var e=/^hwb\(\s*([+-]?\d{0,3}(?:\.\d+)?)(?:deg)?\s*,\s*([+-]?[\d\.]+)%\s*,\s*([+-]?[\d\.]+)%\s*(?:,\s*([+-]?(?=\.\d|\d)(?:0|[1-9]\d*)?(?:\.\d*)?(?:[eE][+-]?\d+)?)\s*)?\)$/,t=n.match(e);if(t){var i=parseFloat(t[4]),r=(parseFloat(t[1])%360+360)%360,o=Ir(parseFloat(t[2]),0,100),s=Ir(parseFloat(t[3]),0,100),a=Ir(isNaN(i)?1:i,0,1);return[r,o,s,a]}return null};Gt.to.hex=function(){var n=bc(arguments);return"#"+Kh(n[0])+Kh(n[1])+Kh(n[2])+(n[3]<1?Kh(Math.round(n[3]*255)):"")};Gt.to.rgb=function(){var n=bc(arguments);return n.length<4||n[3]===1?"rgb("+Math.round(n[0])+", "+Math.round(n[1])+", "+Math.round(n[2])+")":"rgba("+Math.round(n[0])+", "+Math.round(n[1])+", "+Math.round(n[2])+", "+n[3]+")"};Gt.to.rgb.percent=function(){var n=bc(arguments),e=Math.round(n[0]/255*100),t=Math.round(n[1]/255*100),i=Math.round(n[2]/255*100);return n.length<4||n[3]===1?"rgb("+e+"%, "+t+"%, "+i+"%)":"rgba("+e+"%, "+t+"%, "+i+"%, "+n[3]+")"};Gt.to.hsl=function(){var n=bc(arguments);return n.length<4||n[3]===1?"hsl("+n[0]+", "+n[1]+"%, "+n[2]+"%)":"hsla("+n[0]+", "+n[1]+"%, "+n[2]+"%, "+n[3]+")"};Gt.to.hwb=function(){var n=bc(arguments),e="";return n.length>=4&&n[3]!==1&&(e=", "+n[3]),"hwb("+n[0]+", "+n[1]+"%, "+n[2]+"%"+e+")"};Gt.to.keyword=function(n){return Lv[n.slice(0,3)]};function Ir(n,e,t){return Math.min(Math.max(e,n),t)}function Kh(n){var e=Math.round(n).toString(16).toUpperCase();return e.length<2?"0"+e:e}});var yp=_((N6,Vv)=>{var yc=bp(),Rv={};for(let n of Object.keys(yc))Rv[yc[n]]=n;var ee={rgb:{channels:3,labels:"rgb"},hsl:{channels:3,labels:"hsl"},hsv:{channels:3,labels:"hsv"},hwb:{channels:3,labels:"hwb"},cmyk:{channels:4,labels:"cmyk"},xyz:{channels:3,labels:"xyz"},lab:{channels:3,labels:"lab"},lch:{channels:3,labels:"lch"},hex:{channels:1,labels:["hex"]},keyword:{channels:1,labels:["keyword"]},ansi16:{channels:1,labels:["ansi16"]},ansi256:{channels:1,labels:["ansi256"]},hcg:{channels:3,labels:["h","c","g"]},apple:{channels:3,labels:["r16","g16","b16"]},gray:{channels:1,labels:["gray"]}};Vv.exports=ee;for(let n of Object.keys(ee)){if(!("channels"in ee[n]))throw new Error("missing channels property: "+n);if(!("labels"in ee[n]))throw new Error("missing channel labels property: "+n);if(ee[n].labels.length!==ee[n].channels)throw new Error("channel and label counts mismatch: "+n);let{channels:e,labels:t}=ee[n];delete ee[n].channels,delete ee[n].labels,Object.defineProperty(ee[n],"channels",{value:e}),Object.defineProperty(ee[n],"labels",{value:t})}ee.rgb.hsl=function(n){let e=n[0]/255,t=n[1]/255,i=n[2]/255,r=Math.min(e,t,i),o=Math.max(e,t,i),s=o-r,a,c;o===r?a=0:e===o?a=(t-i)/s:t===o?a=2+(i-e)/s:i===o&&(a=4+(e-t)/s),a=Math.min(a*60,360),a<0&&(a+=360);let l=(r+o)/2;return o===r?c=0:l<=.5?c=s/(o+r):c=s/(2-o-r),[a,c*100,l*100]};ee.rgb.hsv=function(n){let e,t,i,r,o,s=n[0]/255,a=n[1]/255,c=n[2]/255,l=Math.max(s,a,c),d=l-Math.min(s,a,c),h=function(u){return(l-u)/6/d+1/2};return d===0?(r=0,o=0):(o=d/l,e=h(s),t=h(a),i=h(c),s===l?r=i-t:a===l?r=1/3+e-i:c===l&&(r=2/3+t-e),r<0?r+=1:r>1&&(r-=1)),[r*360,o*100,l*100]};ee.rgb.hwb=function(n){let e=n[0],t=n[1],i=n[2],r=ee.rgb.hsl(n)[0],o=1/255*Math.min(e,Math.min(t,i));return i=1-1/255*Math.max(e,Math.max(t,i)),[r,o*100,i*100]};ee.rgb.cmyk=function(n){let e=n[0]/255,t=n[1]/255,i=n[2]/255,r=Math.min(1-e,1-t,1-i),o=(1-e-r)/(1-r)||0,s=(1-t-r)/(1-r)||0,a=(1-i-r)/(1-r)||0;return[o*100,s*100,a*100,r*100]};function JP(n,e){return(n[0]-e[0])**2+(n[1]-e[1])**2+(n[2]-e[2])**2}ee.rgb.keyword=function(n){let e=Rv[n];if(e)return e;let t=1/0,i;for(let r of Object.keys(yc)){let o=yc[r],s=JP(n,o);s.04045?((e+.055)/1.055)**2.4:e/12.92,t=t>.04045?((t+.055)/1.055)**2.4:t/12.92,i=i>.04045?((i+.055)/1.055)**2.4:i/12.92;let r=e*.4124+t*.3576+i*.1805,o=e*.2126+t*.7152+i*.0722,s=e*.0193+t*.1192+i*.9505;return[r*100,o*100,s*100]};ee.rgb.lab=function(n){let e=ee.rgb.xyz(n),t=e[0],i=e[1],r=e[2];t/=95.047,i/=100,r/=108.883,t=t>.008856?t**(1/3):7.787*t+16/116,i=i>.008856?i**(1/3):7.787*i+16/116,r=r>.008856?r**(1/3):7.787*r+16/116;let o=116*i-16,s=500*(t-i),a=200*(i-r);return[o,s,a]};ee.hsl.rgb=function(n){let e=n[0]/360,t=n[1]/100,i=n[2]/100,r,o,s;if(t===0)return s=i*255,[s,s,s];i<.5?r=i*(1+t):r=i+t-i*t;let a=2*i-r,c=[0,0,0];for(let l=0;l<3;l++)o=e+1/3*-(l-1),o<0&&o++,o>1&&o--,6*o<1?s=a+(r-a)*6*o:2*o<1?s=r:3*o<2?s=a+(r-a)*(2/3-o)*6:s=a,c[l]=s*255;return c};ee.hsl.hsv=function(n){let e=n[0],t=n[1]/100,i=n[2]/100,r=t,o=Math.max(i,.01);i*=2,t*=i<=1?i:2-i,r*=o<=1?o:2-o;let s=(i+t)/2,a=i===0?2*r/(o+r):2*t/(i+t);return[e,a*100,s*100]};ee.hsv.rgb=function(n){let e=n[0]/60,t=n[1]/100,i=n[2]/100,r=Math.floor(e)%6,o=e-Math.floor(e),s=255*i*(1-t),a=255*i*(1-t*o),c=255*i*(1-t*(1-o));switch(i*=255,r){case 0:return[i,c,s];case 1:return[a,i,s];case 2:return[s,i,c];case 3:return[s,a,i];case 4:return[c,s,i];case 5:return[i,s,a]}};ee.hsv.hsl=function(n){let e=n[0],t=n[1]/100,i=n[2]/100,r=Math.max(i,.01),o,s;s=(2-t)*i;let a=(2-t)*r;return o=t*r,o/=a<=1?a:2-a,o=o||0,s/=2,[e,o*100,s*100]};ee.hwb.rgb=function(n){let e=n[0]/360,t=n[1]/100,i=n[2]/100,r=t+i,o;r>1&&(t/=r,i/=r);let s=Math.floor(6*e),a=1-i;o=6*e-s,(s&1)!==0&&(o=1-o);let c=t+o*(a-t),l,d,h;switch(s){default:case 6:case 0:l=a,d=c,h=t;break;case 1:l=c,d=a,h=t;break;case 2:l=t,d=a,h=c;break;case 3:l=t,d=c,h=a;break;case 4:l=c,d=t,h=a;break;case 5:l=a,d=t,h=c;break}return[l*255,d*255,h*255]};ee.cmyk.rgb=function(n){let e=n[0]/100,t=n[1]/100,i=n[2]/100,r=n[3]/100,o=1-Math.min(1,e*(1-r)+r),s=1-Math.min(1,t*(1-r)+r),a=1-Math.min(1,i*(1-r)+r);return[o*255,s*255,a*255]};ee.xyz.rgb=function(n){let e=n[0]/100,t=n[1]/100,i=n[2]/100,r,o,s;return r=e*3.2406+t*-1.5372+i*-.4986,o=e*-.9689+t*1.8758+i*.0415,s=e*.0557+t*-.204+i*1.057,r=r>.0031308?1.055*r**(1/2.4)-.055:r*12.92,o=o>.0031308?1.055*o**(1/2.4)-.055:o*12.92,s=s>.0031308?1.055*s**(1/2.4)-.055:s*12.92,r=Math.min(Math.max(0,r),1),o=Math.min(Math.max(0,o),1),s=Math.min(Math.max(0,s),1),[r*255,o*255,s*255]};ee.xyz.lab=function(n){let e=n[0],t=n[1],i=n[2];e/=95.047,t/=100,i/=108.883,e=e>.008856?e**(1/3):7.787*e+16/116,t=t>.008856?t**(1/3):7.787*t+16/116,i=i>.008856?i**(1/3):7.787*i+16/116;let r=116*t-16,o=500*(e-t),s=200*(t-i);return[r,o,s]};ee.lab.xyz=function(n){let e=n[0],t=n[1],i=n[2],r,o,s;o=(e+16)/116,r=t/500+o,s=o-i/200;let a=o**3,c=r**3,l=s**3;return o=a>.008856?a:(o-16/116)/7.787,r=c>.008856?c:(r-16/116)/7.787,s=l>.008856?l:(s-16/116)/7.787,r*=95.047,o*=100,s*=108.883,[r,o,s]};ee.lab.lch=function(n){let e=n[0],t=n[1],i=n[2],r;r=Math.atan2(i,t)*360/2/Math.PI,r<0&&(r+=360);let s=Math.sqrt(t*t+i*i);return[e,s,r]};ee.lch.lab=function(n){let e=n[0],t=n[1],r=n[2]/360*2*Math.PI,o=t*Math.cos(r),s=t*Math.sin(r);return[e,o,s]};ee.rgb.ansi16=function(n,e=null){let[t,i,r]=n,o=e===null?ee.rgb.hsv(n)[2]:e;if(o=Math.round(o/50),o===0)return 30;let s=30+(Math.round(r/255)<<2|Math.round(i/255)<<1|Math.round(t/255));return o===2&&(s+=60),s};ee.hsv.ansi16=function(n){return ee.rgb.ansi16(ee.hsv.rgb(n),n[2])};ee.rgb.ansi256=function(n){let e=n[0],t=n[1],i=n[2];return e===t&&t===i?e<8?16:e>248?231:Math.round((e-8)/247*24)+232:16+36*Math.round(e/255*5)+6*Math.round(t/255*5)+Math.round(i/255*5)};ee.ansi16.rgb=function(n){let e=n%10;if(e===0||e===7)return n>50&&(e+=3.5),e=e/10.5*255,[e,e,e];let t=(~~(n>50)+1)*.5,i=(e&1)*t*255,r=(e>>1&1)*t*255,o=(e>>2&1)*t*255;return[i,r,o]};ee.ansi256.rgb=function(n){if(n>=232){let o=(n-232)*10+8;return[o,o,o]}n-=16;let e,t=Math.floor(n/36)/5*255,i=Math.floor((e=n%36)/6)/5*255,r=e%6/5*255;return[t,i,r]};ee.rgb.hex=function(n){let t=(((Math.round(n[0])&255)<<16)+((Math.round(n[1])&255)<<8)+(Math.round(n[2])&255)).toString(16).toUpperCase();return"000000".substring(t.length)+t};ee.hex.rgb=function(n){let e=n.toString(16).match(/[a-f0-9]{6}|[a-f0-9]{3}/i);if(!e)return[0,0,0];let t=e[0];e[0].length===3&&(t=t.split("").map(a=>a+a).join(""));let i=parseInt(t,16),r=i>>16&255,o=i>>8&255,s=i&255;return[r,o,s]};ee.rgb.hcg=function(n){let e=n[0]/255,t=n[1]/255,i=n[2]/255,r=Math.max(Math.max(e,t),i),o=Math.min(Math.min(e,t),i),s=r-o,a,c;return s<1?a=o/(1-s):a=0,s<=0?c=0:r===e?c=(t-i)/s%6:r===t?c=2+(i-e)/s:c=4+(e-t)/s,c/=6,c%=1,[c*360,s*100,a*100]};ee.hsl.hcg=function(n){let e=n[1]/100,t=n[2]/100,i=t<.5?2*e*t:2*e*(1-t),r=0;return i<1&&(r=(t-.5*i)/(1-i)),[n[0],i*100,r*100]};ee.hsv.hcg=function(n){let e=n[1]/100,t=n[2]/100,i=e*t,r=0;return i<1&&(r=(t-i)/(1-i)),[n[0],i*100,r*100]};ee.hcg.rgb=function(n){let e=n[0]/360,t=n[1]/100,i=n[2]/100;if(t===0)return[i*255,i*255,i*255];let r=[0,0,0],o=e%1*6,s=o%1,a=1-s,c=0;switch(Math.floor(o)){case 0:r[0]=1,r[1]=s,r[2]=0;break;case 1:r[0]=a,r[1]=1,r[2]=0;break;case 2:r[0]=0,r[1]=1,r[2]=s;break;case 3:r[0]=0,r[1]=a,r[2]=1;break;case 4:r[0]=s,r[1]=0,r[2]=1;break;default:r[0]=1,r[1]=0,r[2]=a}return c=(1-t)*i,[(t*r[0]+c)*255,(t*r[1]+c)*255,(t*r[2]+c)*255]};ee.hcg.hsv=function(n){let e=n[1]/100,t=n[2]/100,i=e+t*(1-e),r=0;return i>0&&(r=e/i),[n[0],r*100,i*100]};ee.hcg.hsl=function(n){let e=n[1]/100,i=n[2]/100*(1-e)+.5*e,r=0;return i>0&&i<.5?r=e/(2*i):i>=.5&&i<1&&(r=e/(2*(1-i))),[n[0],r*100,i*100]};ee.hcg.hwb=function(n){let e=n[1]/100,t=n[2]/100,i=e+t*(1-e);return[n[0],(i-e)*100,(1-i)*100]};ee.hwb.hcg=function(n){let e=n[1]/100,i=1-n[2]/100,r=i-e,o=0;return r<1&&(o=(i-r)/(1-r)),[n[0],r*100,o*100]};ee.apple.rgb=function(n){return[n[0]/65535*255,n[1]/65535*255,n[2]/65535*255]};ee.rgb.apple=function(n){return[n[0]/255*65535,n[1]/255*65535,n[2]/255*65535]};ee.gray.rgb=function(n){return[n[0]/100*255,n[0]/100*255,n[0]/100*255]};ee.gray.hsl=function(n){return[0,0,n[0]]};ee.gray.hsv=ee.gray.hsl;ee.gray.hwb=function(n){return[0,100,n[0]]};ee.gray.cmyk=function(n){return[0,0,0,n[0]]};ee.gray.lab=function(n){return[n[0],0,0]};ee.gray.hex=function(n){let e=Math.round(n[0]/100*255)&255,i=((e<<16)+(e<<8)+e).toString(16).toUpperCase();return"000000".substring(i.length)+i};ee.rgb.gray=function(n){return[(n[0]+n[1]+n[2])/3/255*100]}});var zv=_((R6,Hv)=>{var Gh=yp();function QP(){let n={},e=Object.keys(Gh);for(let t=e.length,i=0;i{var vp=yp(),ik=zv(),Qs={},nk=Object.keys(vp);function rk(n){let e=function(...t){let i=t[0];return i==null?i:(i.length>1&&(t=i),n(t))};return"conversion"in n&&(e.conversion=n.conversion),e}function ok(n){let e=function(...t){let i=t[0];if(i==null)return i;i.length>1&&(t=i);let r=n(t);if(typeof r=="object")for(let o=r.length,s=0;s{Qs[n]={},Object.defineProperty(Qs[n],"channels",{value:vp[n].channels}),Object.defineProperty(Qs[n],"labels",{value:vp[n].labels});let e=ik(n);Object.keys(e).forEach(i=>{let r=e[i];Qs[n][i]=ok(r),Qs[n][i].raw=rk(r)})});Uv.exports=Qs});var Kv=_((H6,Wv)=>{var $s=Nv(),Xt=qv(),jv=["keyword","gray","hex"],wp={};for(let n of Object.keys(Xt))wp[[...Xt[n].labels].sort().join("")]=n;var Xh={};function ft(n,e){if(!(this instanceof ft))return new ft(n,e);if(e&&e in jv&&(e=null),e&&!(e in Xt))throw new Error("Unknown model: "+e);let t,i;if(n==null)this.model="rgb",this.color=[0,0,0],this.valpha=1;else if(n instanceof ft)this.model=n.model,this.color=[...n.color],this.valpha=n.valpha;else if(typeof n=="string"){let r=$s.get(n);if(r===null)throw new Error("Unable to parse color from string: "+n);this.model=r.model,i=Xt[this.model].channels,this.color=r.value.slice(0,i),this.valpha=typeof r.value[i]=="number"?r.value[i]:1}else if(n.length>0){this.model=e||"rgb",i=Xt[this.model].channels;let r=Array.prototype.slice.call(n,0,i);this.color=Fp(r,i),this.valpha=typeof n[i]=="number"?n[i]:1}else if(typeof n=="number")this.model="rgb",this.color=[n>>16&255,n>>8&255,n&255],this.valpha=1;else{this.valpha=1;let r=Object.keys(n);"alpha"in n&&(r.splice(r.indexOf("alpha"),1),this.valpha=typeof n.alpha=="number"?n.alpha:0);let o=r.sort().join("");if(!(o in wp))throw new Error("Unable to parse color from object: "+JSON.stringify(n));this.model=wp[o];let{labels:s}=Xt[this.model],a=[];for(t=0;t(n%360+360)%360),saturationl:je("hsl",1,st(100)),lightness:je("hsl",2,st(100)),saturationv:je("hsv",1,st(100)),value:je("hsv",2,st(100)),chroma:je("hcg",1,st(100)),gray:je("hcg",2,st(100)),white:je("hwb",1,st(100)),wblack:je("hwb",2,st(100)),cyan:je("cmyk",0,st(100)),magenta:je("cmyk",1,st(100)),yellow:je("cmyk",2,st(100)),black:je("cmyk",3,st(100)),x:je("xyz",0,st(95.047)),y:je("xyz",1,st(100)),z:je("xyz",2,st(108.833)),l:je("lab",0,st(100)),a:je("lab",1),b:je("lab",2),keyword(n){return n!==void 0?new ft(n):Xt[this.model].keyword(this.color)},hex(n){return n!==void 0?new ft(n):$s.to.hex(this.rgb().round().color)},hexa(n){if(n!==void 0)return new ft(n);let e=this.rgb().round().color,t=Math.round(this.valpha*255).toString(16).toUpperCase();return t.length===1&&(t="0"+t),$s.to.hex(e)+t},rgbNumber(){let n=this.rgb().color;return(n[0]&255)<<16|(n[1]&255)<<8|n[2]&255},luminosity(){let n=this.rgb().color,e=[];for(let[t,i]of n.entries()){let r=i/255;e[t]=r<=.04045?r/12.92:((r+.055)/1.055)**2.4}return .2126*e[0]+.7152*e[1]+.0722*e[2]},contrast(n){let e=this.luminosity(),t=n.luminosity();return e>t?(e+.05)/(t+.05):(t+.05)/(e+.05)},level(n){let e=this.contrast(n);return e>=7?"AAA":e>=4.5?"AA":""},isDark(){let n=this.rgb().color;return(n[0]*2126+n[1]*7152+n[2]*722)/1e4<128},isLight(){return!this.isDark()},negate(){let n=this.rgb();for(let e=0;e<3;e++)n.color[e]=255-n.color[e];return n},lighten(n){let e=this.hsl();return e.color[2]+=e.color[2]*n,e},darken(n){let e=this.hsl();return e.color[2]-=e.color[2]*n,e},saturate(n){let e=this.hsl();return e.color[1]+=e.color[1]*n,e},desaturate(n){let e=this.hsl();return e.color[1]-=e.color[1]*n,e},whiten(n){let e=this.hwb();return e.color[1]+=e.color[1]*n,e},blacken(n){let e=this.hwb();return e.color[2]+=e.color[2]*n,e},grayscale(){let n=this.rgb().color,e=n[0]*.3+n[1]*.59+n[2]*.11;return ft.rgb(e,e,e)},fade(n){return this.alpha(this.valpha-this.valpha*n)},opaquer(n){return this.alpha(this.valpha+this.valpha*n)},rotate(n){let e=this.hsl(),t=e.color[0];return t=(t+n)%360,t=t<0?360+t:t,e.color[0]=t,e},mix(n,e){if(!n||!n.rgb)throw new Error('Argument to "mix" was not a Color instance, but rather an instance of '+typeof n);let t=n.rgb(),i=this.rgb(),r=e===void 0?.5:e,o=2*r-1,s=t.alpha()-i.alpha(),a=((o*s===-1?o:(o+s)/(1+o*s))+1)/2,c=1-a;return ft.rgb(a*t.red()+c*i.red(),a*t.green()+c*i.green(),a*t.blue()+c*i.blue(),t.alpha()*r+i.alpha()*(1-r))}};for(let n of Object.keys(Xt)){if(jv.includes(n))continue;let{channels:e}=Xt[n];ft.prototype[n]=function(...t){return this.model===n?new ft(this):t.length>0?new ft(t,n):new ft([...lk(Xt[this.model][n].raw(this.color)),this.valpha],n)},ft[n]=function(...t){let i=t[0];return typeof i=="number"&&(i=Fp(t,e)),new ft(i,n)}}function sk(n,e){return Number(n.toFixed(e))}function ak(n){return function(e){return sk(e,n)}}function je(n,e,t){n=Array.isArray(n)?n:[n];for(let i of n)(Xh[i]||(Xh[i]=[]))[e]=t;return n=n[0],function(i){let r;return i!==void 0?(t&&(i=t(i)),r=this[n](),r.color[e]=i,r):(r=this[n]().color[e],t&&(r=t(r)),r)}}function st(n){return function(e){return Math.max(0,Math.min(n,e))}}function lk(n){return Array.isArray(n)?n:[n]}function Fp(n,e){for(let t=0;t{"use strict";Object.defineProperty(Jh,"__esModule",{value:!0});Jh.bodyRegExps={xml:/&(?:#\d+|#[xX][\da-fA-F]+|[0-9a-zA-Z]+);?/g,html4:/∉|&(?:nbsp|iexcl|cent|pound|curren|yen|brvbar|sect|uml|copy|ordf|laquo|not|shy|reg|macr|deg|plusmn|sup2|sup3|acute|micro|para|middot|cedil|sup1|ordm|raquo|frac14|frac12|frac34|iquest|Agrave|Aacute|Acirc|Atilde|Auml|Aring|AElig|Ccedil|Egrave|Eacute|Ecirc|Euml|Igrave|Iacute|Icirc|Iuml|ETH|Ntilde|Ograve|Oacute|Ocirc|Otilde|Ouml|times|Oslash|Ugrave|Uacute|Ucirc|Uuml|Yacute|THORN|szlig|agrave|aacute|acirc|atilde|auml|aring|aelig|ccedil|egrave|eacute|ecirc|euml|igrave|iacute|icirc|iuml|eth|ntilde|ograve|oacute|ocirc|otilde|ouml|divide|oslash|ugrave|uacute|ucirc|uuml|yacute|thorn|yuml|quot|amp|lt|gt|#\d+|#[xX][\da-fA-F]+|[0-9a-zA-Z]+);?/g,html5:/·|℗|⋇|⪧|⩺|⋗|⦕|⩼|⪆|⥸|⋗|⋛|⪌|≷|≳|⪦|⩹|⋖|⋋|⋉|⥶|⩻|⦖|◃|⊴|◂|∉|⋹̸|⋵̸|∉|⋷|⋶|∌|∌|⋾|⋽|∥|⊠|⨱|⨰|&(?:AElig|AMP|Aacute|Acirc|Agrave|Aring|Atilde|Auml|COPY|Ccedil|ETH|Eacute|Ecirc|Egrave|Euml|GT|Iacute|Icirc|Igrave|Iuml|LT|Ntilde|Oacute|Ocirc|Ograve|Oslash|Otilde|Ouml|QUOT|REG|THORN|Uacute|Ucirc|Ugrave|Uuml|Yacute|aacute|acirc|acute|aelig|agrave|amp|aring|atilde|auml|brvbar|ccedil|cedil|cent|copy|curren|deg|divide|eacute|ecirc|egrave|eth|euml|frac12|frac14|frac34|gt|iacute|icirc|iexcl|igrave|iquest|iuml|laquo|lt|macr|micro|middot|nbsp|not|ntilde|oacute|ocirc|ograve|ordf|ordm|oslash|otilde|ouml|para|plusmn|pound|quot|raquo|reg|sect|shy|sup1|sup2|sup3|szlig|thorn|times|uacute|ucirc|ugrave|uml|uuml|yacute|yen|yuml|#\d+|#[xX][\da-fA-F]+|[0-9a-zA-Z]+);?/g};Jh.namedReferences={xml:{entities:{"<":"<",">":">",""":'"',"'":"'","&":"&"},characters:{"<":"<",">":">",'"':""","'":"'","&":"&"}},html4:{entities:{"'":"'"," ":"\xA0"," ":"\xA0","¡":"\xA1","¡":"\xA1","¢":"\xA2","¢":"\xA2","£":"\xA3","£":"\xA3","¤":"\xA4","¤":"\xA4","¥":"\xA5","¥":"\xA5","¦":"\xA6","¦":"\xA6","§":"\xA7","§":"\xA7","¨":"\xA8","¨":"\xA8","©":"\xA9","©":"\xA9","ª":"\xAA","ª":"\xAA","«":"\xAB","«":"\xAB","¬":"\xAC","¬":"\xAC","­":"\xAD","­":"\xAD","®":"\xAE","®":"\xAE","¯":"\xAF","¯":"\xAF","°":"\xB0","°":"\xB0","±":"\xB1","±":"\xB1","²":"\xB2","²":"\xB2","³":"\xB3","³":"\xB3","´":"\xB4","´":"\xB4","µ":"\xB5","µ":"\xB5","¶":"\xB6","¶":"\xB6","·":"\xB7","·":"\xB7","¸":"\xB8","¸":"\xB8","¹":"\xB9","¹":"\xB9","º":"\xBA","º":"\xBA","»":"\xBB","»":"\xBB","¼":"\xBC","¼":"\xBC","½":"\xBD","½":"\xBD","¾":"\xBE","¾":"\xBE","¿":"\xBF","¿":"\xBF","À":"\xC0","À":"\xC0","Á":"\xC1","Á":"\xC1","Â":"\xC2","Â":"\xC2","Ã":"\xC3","Ã":"\xC3","Ä":"\xC4","Ä":"\xC4","Å":"\xC5","Å":"\xC5","Æ":"\xC6","Æ":"\xC6","Ç":"\xC7","Ç":"\xC7","È":"\xC8","È":"\xC8","É":"\xC9","É":"\xC9","Ê":"\xCA","Ê":"\xCA","Ë":"\xCB","Ë":"\xCB","Ì":"\xCC","Ì":"\xCC","Í":"\xCD","Í":"\xCD","Î":"\xCE","Î":"\xCE","Ï":"\xCF","Ï":"\xCF","Ð":"\xD0","Ð":"\xD0","Ñ":"\xD1","Ñ":"\xD1","Ò":"\xD2","Ò":"\xD2","Ó":"\xD3","Ó":"\xD3","Ô":"\xD4","Ô":"\xD4","Õ":"\xD5","Õ":"\xD5","Ö":"\xD6","Ö":"\xD6","×":"\xD7","×":"\xD7","Ø":"\xD8","Ø":"\xD8","Ù":"\xD9","Ù":"\xD9","Ú":"\xDA","Ú":"\xDA","Û":"\xDB","Û":"\xDB","Ü":"\xDC","Ü":"\xDC","Ý":"\xDD","Ý":"\xDD","Þ":"\xDE","Þ":"\xDE","ß":"\xDF","ß":"\xDF","à":"\xE0","à":"\xE0","á":"\xE1","á":"\xE1","â":"\xE2","â":"\xE2","ã":"\xE3","ã":"\xE3","ä":"\xE4","ä":"\xE4","å":"\xE5","å":"\xE5","æ":"\xE6","æ":"\xE6","ç":"\xE7","ç":"\xE7","è":"\xE8","è":"\xE8","é":"\xE9","é":"\xE9","ê":"\xEA","ê":"\xEA","ë":"\xEB","ë":"\xEB","ì":"\xEC","ì":"\xEC","í":"\xED","í":"\xED","î":"\xEE","î":"\xEE","ï":"\xEF","ï":"\xEF","ð":"\xF0","ð":"\xF0","ñ":"\xF1","ñ":"\xF1","ò":"\xF2","ò":"\xF2","ó":"\xF3","ó":"\xF3","ô":"\xF4","ô":"\xF4","õ":"\xF5","õ":"\xF5","ö":"\xF6","ö":"\xF6","÷":"\xF7","÷":"\xF7","ø":"\xF8","ø":"\xF8","ù":"\xF9","ù":"\xF9","ú":"\xFA","ú":"\xFA","û":"\xFB","û":"\xFB","ü":"\xFC","ü":"\xFC","ý":"\xFD","ý":"\xFD","þ":"\xFE","þ":"\xFE","ÿ":"\xFF","ÿ":"\xFF",""":'"',""":'"',"&":"&","&":"&","<":"<","<":"<",">":">",">":">","Œ":"\u0152","œ":"\u0153","Š":"\u0160","š":"\u0161","Ÿ":"\u0178","ˆ":"\u02C6","˜":"\u02DC"," ":"\u2002"," ":"\u2003"," ":"\u2009","‌":"\u200C","‍":"\u200D","‎":"\u200E","‏":"\u200F","–":"\u2013","—":"\u2014","‘":"\u2018","’":"\u2019","‚":"\u201A","“":"\u201C","”":"\u201D","„":"\u201E","†":"\u2020","‡":"\u2021","‰":"\u2030","‹":"\u2039","›":"\u203A","€":"\u20AC","ƒ":"\u0192","Α":"\u0391","Β":"\u0392","Γ":"\u0393","Δ":"\u0394","Ε":"\u0395","Ζ":"\u0396","Η":"\u0397","Θ":"\u0398","Ι":"\u0399","Κ":"\u039A","Λ":"\u039B","Μ":"\u039C","Ν":"\u039D","Ξ":"\u039E","Ο":"\u039F","Π":"\u03A0","Ρ":"\u03A1","Σ":"\u03A3","Τ":"\u03A4","Υ":"\u03A5","Φ":"\u03A6","Χ":"\u03A7","Ψ":"\u03A8","Ω":"\u03A9","α":"\u03B1","β":"\u03B2","γ":"\u03B3","δ":"\u03B4","ε":"\u03B5","ζ":"\u03B6","η":"\u03B7","θ":"\u03B8","ι":"\u03B9","κ":"\u03BA","λ":"\u03BB","μ":"\u03BC","ν":"\u03BD","ξ":"\u03BE","ο":"\u03BF","π":"\u03C0","ρ":"\u03C1","ς":"\u03C2","σ":"\u03C3","τ":"\u03C4","υ":"\u03C5","φ":"\u03C6","χ":"\u03C7","ψ":"\u03C8","ω":"\u03C9","ϑ":"\u03D1","ϒ":"\u03D2","ϖ":"\u03D6","•":"\u2022","…":"\u2026","′":"\u2032","″":"\u2033","‾":"\u203E","⁄":"\u2044","℘":"\u2118","ℑ":"\u2111","ℜ":"\u211C","™":"\u2122","ℵ":"\u2135","←":"\u2190","↑":"\u2191","→":"\u2192","↓":"\u2193","↔":"\u2194","↵":"\u21B5","⇐":"\u21D0","⇑":"\u21D1","⇒":"\u21D2","⇓":"\u21D3","⇔":"\u21D4","∀":"\u2200","∂":"\u2202","∃":"\u2203","∅":"\u2205","∇":"\u2207","∈":"\u2208","∉":"\u2209","∋":"\u220B","∏":"\u220F","∑":"\u2211","−":"\u2212","∗":"\u2217","√":"\u221A","∝":"\u221D","∞":"\u221E","∠":"\u2220","∧":"\u2227","∨":"\u2228","∩":"\u2229","∪":"\u222A","∫":"\u222B","∴":"\u2234","∼":"\u223C","≅":"\u2245","≈":"\u2248","≠":"\u2260","≡":"\u2261","≤":"\u2264","≥":"\u2265","⊂":"\u2282","⊃":"\u2283","⊄":"\u2284","⊆":"\u2286","⊇":"\u2287","⊕":"\u2295","⊗":"\u2297","⊥":"\u22A5","⋅":"\u22C5","⌈":"\u2308","⌉":"\u2309","⌊":"\u230A","⌋":"\u230B","⟨":"\u2329","⟩":"\u232A","◊":"\u25CA","♠":"\u2660","♣":"\u2663","♥":"\u2665","♦":"\u2666"},characters:{"'":"'","\xA0":" ","\xA1":"¡","\xA2":"¢","\xA3":"£","\xA4":"¤","\xA5":"¥","\xA6":"¦","\xA7":"§","\xA8":"¨","\xA9":"©",\u00AA:"ª","\xAB":"«","\xAC":"¬","\xAD":"­","\xAE":"®","\xAF":"¯","\xB0":"°","\xB1":"±","\xB2":"²","\xB3":"³","\xB4":"´",\u00B5:"µ","\xB6":"¶","\xB7":"·","\xB8":"¸","\xB9":"¹",\u00BA:"º","\xBB":"»","\xBC":"¼","\xBD":"½","\xBE":"¾","\xBF":"¿",\u00C0:"À",\u00C1:"Á",\u00C2:"Â",\u00C3:"Ã",\u00C4:"Ä",\u00C5:"Å",\u00C6:"Æ",\u00C7:"Ç",\u00C8:"È",\u00C9:"É",\u00CA:"Ê",\u00CB:"Ë",\u00CC:"Ì",\u00CD:"Í",\u00CE:"Î",\u00CF:"Ï",\u00D0:"Ð",\u00D1:"Ñ",\u00D2:"Ò",\u00D3:"Ó",\u00D4:"Ô",\u00D5:"Õ",\u00D6:"Ö","\xD7":"×",\u00D8:"Ø",\u00D9:"Ù",\u00DA:"Ú",\u00DB:"Û",\u00DC:"Ü",\u00DD:"Ý",\u00DE:"Þ",\u00DF:"ß",\u00E0:"à",\u00E1:"á",\u00E2:"â",\u00E3:"ã",\u00E4:"ä",\u00E5:"å",\u00E6:"æ",\u00E7:"ç",\u00E8:"è",\u00E9:"é",\u00EA:"ê",\u00EB:"ë",\u00EC:"ì",\u00ED:"í",\u00EE:"î",\u00EF:"ï",\u00F0:"ð",\u00F1:"ñ",\u00F2:"ò",\u00F3:"ó",\u00F4:"ô",\u00F5:"õ",\u00F6:"ö","\xF7":"÷",\u00F8:"ø",\u00F9:"ù",\u00FA:"ú",\u00FB:"û",\u00FC:"ü",\u00FD:"ý",\u00FE:"þ",\u00FF:"ÿ",'"':""","&":"&","<":"<",">":">",\u0152:"Œ",\u0153:"œ",\u0160:"Š",\u0161:"š",\u0178:"Ÿ","\u02C6":"ˆ","\u02DC":"˜","\u2002":" ","\u2003":" ","\u2009":" ","\u200C":"‌","\u200D":"‍","\u200E":"‎","\u200F":"‏","\u2013":"–","\u2014":"—","\u2018":"‘","\u2019":"’","\u201A":"‚","\u201C":"“","\u201D":"”","\u201E":"„","\u2020":"†","\u2021":"‡","\u2030":"‰","\u2039":"‹","\u203A":"›","\u20AC":"€",\u0192:"ƒ",\u0391:"Α",\u0392:"Β",\u0393:"Γ",\u0394:"Δ",\u0395:"Ε",\u0396:"Ζ",\u0397:"Η",\u0398:"Θ",\u0399:"Ι",\u039A:"Κ",\u039B:"Λ",\u039C:"Μ",\u039D:"Ν",\u039E:"Ξ",\u039F:"Ο",\u03A0:"Π",\u03A1:"Ρ",\u03A3:"Σ",\u03A4:"Τ",\u03A5:"Υ",\u03A6:"Φ",\u03A7:"Χ",\u03A8:"Ψ",\u03A9:"Ω",\u03B1:"α",\u03B2:"β",\u03B3:"γ",\u03B4:"δ",\u03B5:"ε",\u03B6:"ζ",\u03B7:"η",\u03B8:"θ",\u03B9:"ι",\u03BA:"κ",\u03BB:"λ",\u03BC:"μ",\u03BD:"ν",\u03BE:"ξ",\u03BF:"ο",\u03C0:"π",\u03C1:"ρ",\u03C2:"ς",\u03C3:"σ",\u03C4:"τ",\u03C5:"υ",\u03C6:"φ",\u03C7:"χ",\u03C8:"ψ",\u03C9:"ω",\u03D1:"ϑ",\u03D2:"ϒ",\u03D6:"ϖ","\u2022":"•","\u2026":"…","\u2032":"′","\u2033":"″","\u203E":"‾","\u2044":"⁄","\u2118":"℘",\u2111:"ℑ",\u211C:"ℜ","\u2122":"™",\u2135:"ℵ","\u2190":"←","\u2191":"↑","\u2192":"→","\u2193":"↓","\u2194":"↔","\u21B5":"↵","\u21D0":"⇐","\u21D1":"⇑","\u21D2":"⇒","\u21D3":"⇓","\u21D4":"⇔","\u2200":"∀","\u2202":"∂","\u2203":"∃","\u2205":"∅","\u2207":"∇","\u2208":"∈","\u2209":"∉","\u220B":"∋","\u220F":"∏","\u2211":"∑","\u2212":"−","\u2217":"∗","\u221A":"√","\u221D":"∝","\u221E":"∞","\u2220":"∠","\u2227":"∧","\u2228":"∨","\u2229":"∩","\u222A":"∪","\u222B":"∫","\u2234":"∴","\u223C":"∼","\u2245":"≅","\u2248":"≈","\u2260":"≠","\u2261":"≡","\u2264":"≤","\u2265":"≥","\u2282":"⊂","\u2283":"⊃","\u2284":"⊄","\u2286":"⊆","\u2287":"⊇","\u2295":"⊕","\u2297":"⊗","\u22A5":"⊥","\u22C5":"⋅","\u2308":"⌈","\u2309":"⌉","\u230A":"⌊","\u230B":"⌋","\u2329":"⟨","\u232A":"⟩","\u25CA":"◊","\u2660":"♠","\u2663":"♣","\u2665":"♥","\u2666":"♦"}},html5:{entities:{"Æ":"\xC6","Æ":"\xC6","&":"&","&":"&","Á":"\xC1","Á":"\xC1","Ă":"\u0102","Â":"\xC2","Â":"\xC2","А":"\u0410","𝔄":"\u{1D504}","À":"\xC0","À":"\xC0","Α":"\u0391","Ā":"\u0100","⩓":"\u2A53","Ą":"\u0104","𝔸":"\u{1D538}","⁡":"\u2061","Å":"\xC5","Å":"\xC5","𝒜":"\u{1D49C}","≔":"\u2254","Ã":"\xC3","Ã":"\xC3","Ä":"\xC4","Ä":"\xC4","∖":"\u2216","⫧":"\u2AE7","⌆":"\u2306","Б":"\u0411","∵":"\u2235","ℬ":"\u212C","Β":"\u0392","𝔅":"\u{1D505}","𝔹":"\u{1D539}","˘":"\u02D8","ℬ":"\u212C","≎":"\u224E","Ч":"\u0427","©":"\xA9","©":"\xA9","Ć":"\u0106","⋒":"\u22D2","ⅅ":"\u2145","ℭ":"\u212D","Č":"\u010C","Ç":"\xC7","Ç":"\xC7","Ĉ":"\u0108","∰":"\u2230","Ċ":"\u010A","¸":"\xB8","·":"\xB7","ℭ":"\u212D","Χ":"\u03A7","⊙":"\u2299","⊖":"\u2296","⊕":"\u2295","⊗":"\u2297","∲":"\u2232","”":"\u201D","’":"\u2019","∷":"\u2237","⩴":"\u2A74","≡":"\u2261","∯":"\u222F","∮":"\u222E","ℂ":"\u2102","∐":"\u2210","∳":"\u2233","⨯":"\u2A2F","𝒞":"\u{1D49E}","⋓":"\u22D3","≍":"\u224D","ⅅ":"\u2145","⤑":"\u2911","Ђ":"\u0402","Ѕ":"\u0405","Џ":"\u040F","‡":"\u2021","↡":"\u21A1","⫤":"\u2AE4","Ď":"\u010E","Д":"\u0414","∇":"\u2207","Δ":"\u0394","𝔇":"\u{1D507}","´":"\xB4","˙":"\u02D9","˝":"\u02DD","`":"`","˜":"\u02DC","⋄":"\u22C4","ⅆ":"\u2146","𝔻":"\u{1D53B}","¨":"\xA8","⃜":"\u20DC","≐":"\u2250","∯":"\u222F","¨":"\xA8","⇓":"\u21D3","⇐":"\u21D0","⇔":"\u21D4","⫤":"\u2AE4","⟸":"\u27F8","⟺":"\u27FA","⟹":"\u27F9","⇒":"\u21D2","⊨":"\u22A8","⇑":"\u21D1","⇕":"\u21D5","∥":"\u2225","↓":"\u2193","⤓":"\u2913","⇵":"\u21F5","̑":"\u0311","⥐":"\u2950","⥞":"\u295E","↽":"\u21BD","⥖":"\u2956","⥟":"\u295F","⇁":"\u21C1","⥗":"\u2957","⊤":"\u22A4","↧":"\u21A7","⇓":"\u21D3","𝒟":"\u{1D49F}","Đ":"\u0110","Ŋ":"\u014A","Ð":"\xD0","Ð":"\xD0","É":"\xC9","É":"\xC9","Ě":"\u011A","Ê":"\xCA","Ê":"\xCA","Э":"\u042D","Ė":"\u0116","𝔈":"\u{1D508}","È":"\xC8","È":"\xC8","∈":"\u2208","Ē":"\u0112","◻":"\u25FB","▫":"\u25AB","Ę":"\u0118","𝔼":"\u{1D53C}","Ε":"\u0395","⩵":"\u2A75","≂":"\u2242","⇌":"\u21CC","ℰ":"\u2130","⩳":"\u2A73","Η":"\u0397","Ë":"\xCB","Ë":"\xCB","∃":"\u2203","ⅇ":"\u2147","Ф":"\u0424","𝔉":"\u{1D509}","◼":"\u25FC","▪":"\u25AA","𝔽":"\u{1D53D}","∀":"\u2200","ℱ":"\u2131","ℱ":"\u2131","Ѓ":"\u0403",">":">",">":">","Γ":"\u0393","Ϝ":"\u03DC","Ğ":"\u011E","Ģ":"\u0122","Ĝ":"\u011C","Г":"\u0413","Ġ":"\u0120","𝔊":"\u{1D50A}","⋙":"\u22D9","𝔾":"\u{1D53E}","≥":"\u2265","⋛":"\u22DB","≧":"\u2267","⪢":"\u2AA2","≷":"\u2277","⩾":"\u2A7E","≳":"\u2273","𝒢":"\u{1D4A2}","≫":"\u226B","Ъ":"\u042A","ˇ":"\u02C7","^":"^","Ĥ":"\u0124","ℌ":"\u210C","ℋ":"\u210B","ℍ":"\u210D","─":"\u2500","ℋ":"\u210B","Ħ":"\u0126","≎":"\u224E","≏":"\u224F","Е":"\u0415","IJ":"\u0132","Ё":"\u0401","Í":"\xCD","Í":"\xCD","Î":"\xCE","Î":"\xCE","И":"\u0418","İ":"\u0130","ℑ":"\u2111","Ì":"\xCC","Ì":"\xCC","ℑ":"\u2111","Ī":"\u012A","ⅈ":"\u2148","⇒":"\u21D2","∬":"\u222C","∫":"\u222B","⋂":"\u22C2","⁣":"\u2063","⁢":"\u2062","Į":"\u012E","𝕀":"\u{1D540}","Ι":"\u0399","ℐ":"\u2110","Ĩ":"\u0128","І":"\u0406","Ï":"\xCF","Ï":"\xCF","Ĵ":"\u0134","Й":"\u0419","𝔍":"\u{1D50D}","𝕁":"\u{1D541}","𝒥":"\u{1D4A5}","Ј":"\u0408","Є":"\u0404","Х":"\u0425","Ќ":"\u040C","Κ":"\u039A","Ķ":"\u0136","К":"\u041A","𝔎":"\u{1D50E}","𝕂":"\u{1D542}","𝒦":"\u{1D4A6}","Љ":"\u0409","<":"<","<":"<","Ĺ":"\u0139","Λ":"\u039B","⟪":"\u27EA","ℒ":"\u2112","↞":"\u219E","Ľ":"\u013D","Ļ":"\u013B","Л":"\u041B","⟨":"\u27E8","←":"\u2190","⇤":"\u21E4","⇆":"\u21C6","⌈":"\u2308","⟦":"\u27E6","⥡":"\u2961","⇃":"\u21C3","⥙":"\u2959","⌊":"\u230A","↔":"\u2194","⥎":"\u294E","⊣":"\u22A3","↤":"\u21A4","⥚":"\u295A","⊲":"\u22B2","⧏":"\u29CF","⊴":"\u22B4","⥑":"\u2951","⥠":"\u2960","↿":"\u21BF","⥘":"\u2958","↼":"\u21BC","⥒":"\u2952","⇐":"\u21D0","⇔":"\u21D4","⋚":"\u22DA","≦":"\u2266","≶":"\u2276","⪡":"\u2AA1","⩽":"\u2A7D","≲":"\u2272","𝔏":"\u{1D50F}","⋘":"\u22D8","⇚":"\u21DA","Ŀ":"\u013F","⟵":"\u27F5","⟷":"\u27F7","⟶":"\u27F6","⟸":"\u27F8","⟺":"\u27FA","⟹":"\u27F9","𝕃":"\u{1D543}","↙":"\u2199","↘":"\u2198","ℒ":"\u2112","↰":"\u21B0","Ł":"\u0141","≪":"\u226A","⤅":"\u2905","М":"\u041C"," ":"\u205F","ℳ":"\u2133","𝔐":"\u{1D510}","∓":"\u2213","𝕄":"\u{1D544}","ℳ":"\u2133","Μ":"\u039C","Њ":"\u040A","Ń":"\u0143","Ň":"\u0147","Ņ":"\u0145","Н":"\u041D","​":"\u200B","​":"\u200B","​":"\u200B","​":"\u200B","≫":"\u226B","≪":"\u226A"," ":` `,"𝔑":"\u{1D511}","⁠":"\u2060"," ":"\xA0","ℕ":"\u2115","⫬":"\u2AEC","≢":"\u2262","≭":"\u226D","∦":"\u2226","∉":"\u2209","≠":"\u2260","≂̸":"\u2242\u0338","∄":"\u2204","≯":"\u226F","≱":"\u2271","≧̸":"\u2267\u0338","≫̸":"\u226B\u0338","≹":"\u2279","⩾̸":"\u2A7E\u0338","≵":"\u2275","≎̸":"\u224E\u0338","≏̸":"\u224F\u0338","⋪":"\u22EA","⧏̸":"\u29CF\u0338","⋬":"\u22EC","≮":"\u226E","≰":"\u2270","≸":"\u2278","≪̸":"\u226A\u0338","⩽̸":"\u2A7D\u0338","≴":"\u2274","⪢̸":"\u2AA2\u0338","⪡̸":"\u2AA1\u0338","⊀":"\u2280","⪯̸":"\u2AAF\u0338","⋠":"\u22E0","∌":"\u220C","⋫":"\u22EB","⧐̸":"\u29D0\u0338","⋭":"\u22ED","⊏̸":"\u228F\u0338","⋢":"\u22E2","⊐̸":"\u2290\u0338","⋣":"\u22E3","⊂⃒":"\u2282\u20D2","⊈":"\u2288","⊁":"\u2281","⪰̸":"\u2AB0\u0338","⋡":"\u22E1","≿̸":"\u227F\u0338","⊃⃒":"\u2283\u20D2","⊉":"\u2289","≁":"\u2241","≄":"\u2244","≇":"\u2247","≉":"\u2249","∤":"\u2224","𝒩":"\u{1D4A9}","Ñ":"\xD1","Ñ":"\xD1","Ν":"\u039D","Œ":"\u0152","Ó":"\xD3","Ó":"\xD3","Ô":"\xD4","Ô":"\xD4","О":"\u041E","Ő":"\u0150","𝔒":"\u{1D512}","Ò":"\xD2","Ò":"\xD2","Ō":"\u014C","Ω":"\u03A9","Ο":"\u039F","𝕆":"\u{1D546}","“":"\u201C","‘":"\u2018","⩔":"\u2A54","𝒪":"\u{1D4AA}","Ø":"\xD8","Ø":"\xD8","Õ":"\xD5","Õ":"\xD5","⨷":"\u2A37","Ö":"\xD6","Ö":"\xD6","‾":"\u203E","⏞":"\u23DE","⎴":"\u23B4","⏜":"\u23DC","∂":"\u2202","П":"\u041F","𝔓":"\u{1D513}","Φ":"\u03A6","Π":"\u03A0","±":"\xB1","ℌ":"\u210C","ℙ":"\u2119","⪻":"\u2ABB","≺":"\u227A","⪯":"\u2AAF","≼":"\u227C","≾":"\u227E","″":"\u2033","∏":"\u220F","∷":"\u2237","∝":"\u221D","𝒫":"\u{1D4AB}","Ψ":"\u03A8",""":'"',""":'"',"𝔔":"\u{1D514}","ℚ":"\u211A","𝒬":"\u{1D4AC}","⤐":"\u2910","®":"\xAE","®":"\xAE","Ŕ":"\u0154","⟫":"\u27EB","↠":"\u21A0","⤖":"\u2916","Ř":"\u0158","Ŗ":"\u0156","Р":"\u0420","ℜ":"\u211C","∋":"\u220B","⇋":"\u21CB","⥯":"\u296F","ℜ":"\u211C","Ρ":"\u03A1","⟩":"\u27E9","→":"\u2192","⇥":"\u21E5","⇄":"\u21C4","⌉":"\u2309","⟧":"\u27E7","⥝":"\u295D","⇂":"\u21C2","⥕":"\u2955","⌋":"\u230B","⊢":"\u22A2","↦":"\u21A6","⥛":"\u295B","⊳":"\u22B3","⧐":"\u29D0","⊵":"\u22B5","⥏":"\u294F","⥜":"\u295C","↾":"\u21BE","⥔":"\u2954","⇀":"\u21C0","⥓":"\u2953","⇒":"\u21D2","ℝ":"\u211D","⥰":"\u2970","⇛":"\u21DB","ℛ":"\u211B","↱":"\u21B1","⧴":"\u29F4","Щ":"\u0429","Ш":"\u0428","Ь":"\u042C","Ś":"\u015A","⪼":"\u2ABC","Š":"\u0160","Ş":"\u015E","Ŝ":"\u015C","С":"\u0421","𝔖":"\u{1D516}","↓":"\u2193","←":"\u2190","→":"\u2192","↑":"\u2191","Σ":"\u03A3","∘":"\u2218","𝕊":"\u{1D54A}","√":"\u221A","□":"\u25A1","⊓":"\u2293","⊏":"\u228F","⊑":"\u2291","⊐":"\u2290","⊒":"\u2292","⊔":"\u2294","𝒮":"\u{1D4AE}","⋆":"\u22C6","⋐":"\u22D0","⋐":"\u22D0","⊆":"\u2286","≻":"\u227B","⪰":"\u2AB0","≽":"\u227D","≿":"\u227F","∋":"\u220B","∑":"\u2211","⋑":"\u22D1","⊃":"\u2283","⊇":"\u2287","⋑":"\u22D1","Þ":"\xDE","Þ":"\xDE","™":"\u2122","Ћ":"\u040B","Ц":"\u0426"," ":" ","Τ":"\u03A4","Ť":"\u0164","Ţ":"\u0162","Т":"\u0422","𝔗":"\u{1D517}","∴":"\u2234","Θ":"\u0398","  ":"\u205F\u200A"," ":"\u2009","∼":"\u223C","≃":"\u2243","≅":"\u2245","≈":"\u2248","𝕋":"\u{1D54B}","⃛":"\u20DB","𝒯":"\u{1D4AF}","Ŧ":"\u0166","Ú":"\xDA","Ú":"\xDA","↟":"\u219F","⥉":"\u2949","Ў":"\u040E","Ŭ":"\u016C","Û":"\xDB","Û":"\xDB","У":"\u0423","Ű":"\u0170","𝔘":"\u{1D518}","Ù":"\xD9","Ù":"\xD9","Ū":"\u016A","_":"_","⏟":"\u23DF","⎵":"\u23B5","⏝":"\u23DD","⋃":"\u22C3","⊎":"\u228E","Ų":"\u0172","𝕌":"\u{1D54C}","↑":"\u2191","⤒":"\u2912","⇅":"\u21C5","↕":"\u2195","⥮":"\u296E","⊥":"\u22A5","↥":"\u21A5","⇑":"\u21D1","⇕":"\u21D5","↖":"\u2196","↗":"\u2197","ϒ":"\u03D2","Υ":"\u03A5","Ů":"\u016E","𝒰":"\u{1D4B0}","Ũ":"\u0168","Ü":"\xDC","Ü":"\xDC","⊫":"\u22AB","⫫":"\u2AEB","В":"\u0412","⊩":"\u22A9","⫦":"\u2AE6","⋁":"\u22C1","‖":"\u2016","‖":"\u2016","∣":"\u2223","|":"|","❘":"\u2758","≀":"\u2240"," ":"\u200A","𝔙":"\u{1D519}","𝕍":"\u{1D54D}","𝒱":"\u{1D4B1}","⊪":"\u22AA","Ŵ":"\u0174","⋀":"\u22C0","𝔚":"\u{1D51A}","𝕎":"\u{1D54E}","𝒲":"\u{1D4B2}","𝔛":"\u{1D51B}","Ξ":"\u039E","𝕏":"\u{1D54F}","𝒳":"\u{1D4B3}","Я":"\u042F","Ї":"\u0407","Ю":"\u042E","Ý":"\xDD","Ý":"\xDD","Ŷ":"\u0176","Ы":"\u042B","𝔜":"\u{1D51C}","𝕐":"\u{1D550}","𝒴":"\u{1D4B4}","Ÿ":"\u0178","Ж":"\u0416","Ź":"\u0179","Ž":"\u017D","З":"\u0417","Ż":"\u017B","​":"\u200B","Ζ":"\u0396","ℨ":"\u2128","ℤ":"\u2124","𝒵":"\u{1D4B5}","á":"\xE1","á":"\xE1","ă":"\u0103","∾":"\u223E","∾̳":"\u223E\u0333","∿":"\u223F","â":"\xE2","â":"\xE2","´":"\xB4","´":"\xB4","а":"\u0430","æ":"\xE6","æ":"\xE6","⁡":"\u2061","𝔞":"\u{1D51E}","à":"\xE0","à":"\xE0","ℵ":"\u2135","ℵ":"\u2135","α":"\u03B1","ā":"\u0101","⨿":"\u2A3F","&":"&","&":"&","∧":"\u2227","⩕":"\u2A55","⩜":"\u2A5C","⩘":"\u2A58","⩚":"\u2A5A","∠":"\u2220","⦤":"\u29A4","∠":"\u2220","∡":"\u2221","⦨":"\u29A8","⦩":"\u29A9","⦪":"\u29AA","⦫":"\u29AB","⦬":"\u29AC","⦭":"\u29AD","⦮":"\u29AE","⦯":"\u29AF","∟":"\u221F","⊾":"\u22BE","⦝":"\u299D","∢":"\u2222","Å":"\xC5","⍼":"\u237C","ą":"\u0105","𝕒":"\u{1D552}","≈":"\u2248","⩰":"\u2A70","⩯":"\u2A6F","≊":"\u224A","≋":"\u224B","'":"'","≈":"\u2248","≊":"\u224A","å":"\xE5","å":"\xE5","𝒶":"\u{1D4B6}","*":"*","≈":"\u2248","≍":"\u224D","ã":"\xE3","ã":"\xE3","ä":"\xE4","ä":"\xE4","∳":"\u2233","⨑":"\u2A11","⫭":"\u2AED","≌":"\u224C","϶":"\u03F6","‵":"\u2035","∽":"\u223D","⋍":"\u22CD","⊽":"\u22BD","⌅":"\u2305","⌅":"\u2305","⎵":"\u23B5","⎶":"\u23B6","≌":"\u224C","б":"\u0431","„":"\u201E","∵":"\u2235","∵":"\u2235","⦰":"\u29B0","϶":"\u03F6","ℬ":"\u212C","β":"\u03B2","ℶ":"\u2136","≬":"\u226C","𝔟":"\u{1D51F}","⋂":"\u22C2","◯":"\u25EF","⋃":"\u22C3","⨀":"\u2A00","⨁":"\u2A01","⨂":"\u2A02","⨆":"\u2A06","★":"\u2605","▽":"\u25BD","△":"\u25B3","⨄":"\u2A04","⋁":"\u22C1","⋀":"\u22C0","⤍":"\u290D","⧫":"\u29EB","▪":"\u25AA","▴":"\u25B4","▾":"\u25BE","◂":"\u25C2","▸":"\u25B8","␣":"\u2423","▒":"\u2592","░":"\u2591","▓":"\u2593","█":"\u2588","=⃥":"=\u20E5","≡⃥":"\u2261\u20E5","⌐":"\u2310","𝕓":"\u{1D553}","⊥":"\u22A5","⊥":"\u22A5","⋈":"\u22C8","╗":"\u2557","╔":"\u2554","╖":"\u2556","╓":"\u2553","═":"\u2550","╦":"\u2566","╩":"\u2569","╤":"\u2564","╧":"\u2567","╝":"\u255D","╚":"\u255A","╜":"\u255C","╙":"\u2559","║":"\u2551","╬":"\u256C","╣":"\u2563","╠":"\u2560","╫":"\u256B","╢":"\u2562","╟":"\u255F","⧉":"\u29C9","╕":"\u2555","╒":"\u2552","┐":"\u2510","┌":"\u250C","─":"\u2500","╥":"\u2565","╨":"\u2568","┬":"\u252C","┴":"\u2534","⊟":"\u229F","⊞":"\u229E","⊠":"\u22A0","╛":"\u255B","╘":"\u2558","┘":"\u2518","└":"\u2514","│":"\u2502","╪":"\u256A","╡":"\u2561","╞":"\u255E","┼":"\u253C","┤":"\u2524","├":"\u251C","‵":"\u2035","˘":"\u02D8","¦":"\xA6","¦":"\xA6","𝒷":"\u{1D4B7}","⁏":"\u204F","∽":"\u223D","⋍":"\u22CD","\":"\\","⧅":"\u29C5","⟈":"\u27C8","•":"\u2022","•":"\u2022","≎":"\u224E","⪮":"\u2AAE","≏":"\u224F","≏":"\u224F","ć":"\u0107","∩":"\u2229","⩄":"\u2A44","⩉":"\u2A49","⩋":"\u2A4B","⩇":"\u2A47","⩀":"\u2A40","∩︀":"\u2229\uFE00","⁁":"\u2041","ˇ":"\u02C7","⩍":"\u2A4D","č":"\u010D","ç":"\xE7","ç":"\xE7","ĉ":"\u0109","⩌":"\u2A4C","⩐":"\u2A50","ċ":"\u010B","¸":"\xB8","¸":"\xB8","⦲":"\u29B2","¢":"\xA2","¢":"\xA2","·":"\xB7","𝔠":"\u{1D520}","ч":"\u0447","✓":"\u2713","✓":"\u2713","χ":"\u03C7","○":"\u25CB","⧃":"\u29C3","ˆ":"\u02C6","≗":"\u2257","↺":"\u21BA","↻":"\u21BB","®":"\xAE","Ⓢ":"\u24C8","⊛":"\u229B","⊚":"\u229A","⊝":"\u229D","≗":"\u2257","⨐":"\u2A10","⫯":"\u2AEF","⧂":"\u29C2","♣":"\u2663","♣":"\u2663",":":":","≔":"\u2254","≔":"\u2254",",":",","@":"@","∁":"\u2201","∘":"\u2218","∁":"\u2201","ℂ":"\u2102","≅":"\u2245","⩭":"\u2A6D","∮":"\u222E","𝕔":"\u{1D554}","∐":"\u2210","©":"\xA9","©":"\xA9","℗":"\u2117","↵":"\u21B5","✗":"\u2717","𝒸":"\u{1D4B8}","⫏":"\u2ACF","⫑":"\u2AD1","⫐":"\u2AD0","⫒":"\u2AD2","⋯":"\u22EF","⤸":"\u2938","⤵":"\u2935","⋞":"\u22DE","⋟":"\u22DF","↶":"\u21B6","⤽":"\u293D","∪":"\u222A","⩈":"\u2A48","⩆":"\u2A46","⩊":"\u2A4A","⊍":"\u228D","⩅":"\u2A45","∪︀":"\u222A\uFE00","↷":"\u21B7","⤼":"\u293C","⋞":"\u22DE","⋟":"\u22DF","⋎":"\u22CE","⋏":"\u22CF","¤":"\xA4","¤":"\xA4","↶":"\u21B6","↷":"\u21B7","⋎":"\u22CE","⋏":"\u22CF","∲":"\u2232","∱":"\u2231","⌭":"\u232D","⇓":"\u21D3","⥥":"\u2965","†":"\u2020","ℸ":"\u2138","↓":"\u2193","‐":"\u2010","⊣":"\u22A3","⤏":"\u290F","˝":"\u02DD","ď":"\u010F","д":"\u0434","ⅆ":"\u2146","‡":"\u2021","⇊":"\u21CA","⩷":"\u2A77","°":"\xB0","°":"\xB0","δ":"\u03B4","⦱":"\u29B1","⥿":"\u297F","𝔡":"\u{1D521}","⇃":"\u21C3","⇂":"\u21C2","⋄":"\u22C4","⋄":"\u22C4","♦":"\u2666","♦":"\u2666","¨":"\xA8","ϝ":"\u03DD","⋲":"\u22F2","÷":"\xF7","÷":"\xF7","÷":"\xF7","⋇":"\u22C7","⋇":"\u22C7","ђ":"\u0452","⌞":"\u231E","⌍":"\u230D","$":"$","𝕕":"\u{1D555}","˙":"\u02D9","≐":"\u2250","≑":"\u2251","∸":"\u2238","∔":"\u2214","⊡":"\u22A1","⌆":"\u2306","↓":"\u2193","⇊":"\u21CA","⇃":"\u21C3","⇂":"\u21C2","⤐":"\u2910","⌟":"\u231F","⌌":"\u230C","𝒹":"\u{1D4B9}","ѕ":"\u0455","⧶":"\u29F6","đ":"\u0111","⋱":"\u22F1","▿":"\u25BF","▾":"\u25BE","⇵":"\u21F5","⥯":"\u296F","⦦":"\u29A6","џ":"\u045F","⟿":"\u27FF","⩷":"\u2A77","≑":"\u2251","é":"\xE9","é":"\xE9","⩮":"\u2A6E","ě":"\u011B","≖":"\u2256","ê":"\xEA","ê":"\xEA","≕":"\u2255","э":"\u044D","ė":"\u0117","ⅇ":"\u2147","≒":"\u2252","𝔢":"\u{1D522}","⪚":"\u2A9A","è":"\xE8","è":"\xE8","⪖":"\u2A96","⪘":"\u2A98","⪙":"\u2A99","⏧":"\u23E7","ℓ":"\u2113","⪕":"\u2A95","⪗":"\u2A97","ē":"\u0113","∅":"\u2205","∅":"\u2205","∅":"\u2205"," ":"\u2004"," ":"\u2005"," ":"\u2003","ŋ":"\u014B"," ":"\u2002","ę":"\u0119","𝕖":"\u{1D556}","⋕":"\u22D5","⧣":"\u29E3","⩱":"\u2A71","ε":"\u03B5","ε":"\u03B5","ϵ":"\u03F5","≖":"\u2256","≕":"\u2255","≂":"\u2242","⪖":"\u2A96","⪕":"\u2A95","=":"=","≟":"\u225F","≡":"\u2261","⩸":"\u2A78","⧥":"\u29E5","≓":"\u2253","⥱":"\u2971","ℯ":"\u212F","≐":"\u2250","≂":"\u2242","η":"\u03B7","ð":"\xF0","ð":"\xF0","ë":"\xEB","ë":"\xEB","€":"\u20AC","!":"!","∃":"\u2203","ℰ":"\u2130","ⅇ":"\u2147","≒":"\u2252","ф":"\u0444","♀":"\u2640","ffi":"\uFB03","ff":"\uFB00","ffl":"\uFB04","𝔣":"\u{1D523}","fi":"\uFB01","fj":"fj","♭":"\u266D","fl":"\uFB02","▱":"\u25B1","ƒ":"\u0192","𝕗":"\u{1D557}","∀":"\u2200","⋔":"\u22D4","⫙":"\u2AD9","⨍":"\u2A0D","½":"\xBD","½":"\xBD","⅓":"\u2153","¼":"\xBC","¼":"\xBC","⅕":"\u2155","⅙":"\u2159","⅛":"\u215B","⅔":"\u2154","⅖":"\u2156","¾":"\xBE","¾":"\xBE","⅗":"\u2157","⅜":"\u215C","⅘":"\u2158","⅚":"\u215A","⅝":"\u215D","⅞":"\u215E","⁄":"\u2044","⌢":"\u2322","𝒻":"\u{1D4BB}","≧":"\u2267","⪌":"\u2A8C","ǵ":"\u01F5","γ":"\u03B3","ϝ":"\u03DD","⪆":"\u2A86","ğ":"\u011F","ĝ":"\u011D","г":"\u0433","ġ":"\u0121","≥":"\u2265","⋛":"\u22DB","≥":"\u2265","≧":"\u2267","⩾":"\u2A7E","⩾":"\u2A7E","⪩":"\u2AA9","⪀":"\u2A80","⪂":"\u2A82","⪄":"\u2A84","⋛︀":"\u22DB\uFE00","⪔":"\u2A94","𝔤":"\u{1D524}","≫":"\u226B","⋙":"\u22D9","ℷ":"\u2137","ѓ":"\u0453","≷":"\u2277","⪒":"\u2A92","⪥":"\u2AA5","⪤":"\u2AA4","≩":"\u2269","⪊":"\u2A8A","⪊":"\u2A8A","⪈":"\u2A88","⪈":"\u2A88","≩":"\u2269","⋧":"\u22E7","𝕘":"\u{1D558}","`":"`","ℊ":"\u210A","≳":"\u2273","⪎":"\u2A8E","⪐":"\u2A90",">":">",">":">","⪧":"\u2AA7","⩺":"\u2A7A","⋗":"\u22D7","⦕":"\u2995","⩼":"\u2A7C","⪆":"\u2A86","⥸":"\u2978","⋗":"\u22D7","⋛":"\u22DB","⪌":"\u2A8C","≷":"\u2277","≳":"\u2273","≩︀":"\u2269\uFE00","≩︀":"\u2269\uFE00","⇔":"\u21D4"," ":"\u200A","½":"\xBD","ℋ":"\u210B","ъ":"\u044A","↔":"\u2194","⥈":"\u2948","↭":"\u21AD","ℏ":"\u210F","ĥ":"\u0125","♥":"\u2665","♥":"\u2665","…":"\u2026","⊹":"\u22B9","𝔥":"\u{1D525}","⤥":"\u2925","⤦":"\u2926","⇿":"\u21FF","∻":"\u223B","↩":"\u21A9","↪":"\u21AA","𝕙":"\u{1D559}","―":"\u2015","𝒽":"\u{1D4BD}","ℏ":"\u210F","ħ":"\u0127","⁃":"\u2043","‐":"\u2010","í":"\xED","í":"\xED","⁣":"\u2063","î":"\xEE","î":"\xEE","и":"\u0438","е":"\u0435","¡":"\xA1","¡":"\xA1","⇔":"\u21D4","𝔦":"\u{1D526}","ì":"\xEC","ì":"\xEC","ⅈ":"\u2148","⨌":"\u2A0C","∭":"\u222D","⧜":"\u29DC","℩":"\u2129","ij":"\u0133","ī":"\u012B","ℑ":"\u2111","ℐ":"\u2110","ℑ":"\u2111","ı":"\u0131","⊷":"\u22B7","Ƶ":"\u01B5","∈":"\u2208","℅":"\u2105","∞":"\u221E","⧝":"\u29DD","ı":"\u0131","∫":"\u222B","⊺":"\u22BA","ℤ":"\u2124","⊺":"\u22BA","⨗":"\u2A17","⨼":"\u2A3C","ё":"\u0451","į":"\u012F","𝕚":"\u{1D55A}","ι":"\u03B9","⨼":"\u2A3C","¿":"\xBF","¿":"\xBF","𝒾":"\u{1D4BE}","∈":"\u2208","⋹":"\u22F9","⋵":"\u22F5","⋴":"\u22F4","⋳":"\u22F3","∈":"\u2208","⁢":"\u2062","ĩ":"\u0129","і":"\u0456","ï":"\xEF","ï":"\xEF","ĵ":"\u0135","й":"\u0439","𝔧":"\u{1D527}","ȷ":"\u0237","𝕛":"\u{1D55B}","𝒿":"\u{1D4BF}","ј":"\u0458","є":"\u0454","κ":"\u03BA","ϰ":"\u03F0","ķ":"\u0137","к":"\u043A","𝔨":"\u{1D528}","ĸ":"\u0138","х":"\u0445","ќ":"\u045C","𝕜":"\u{1D55C}","𝓀":"\u{1D4C0}","⇚":"\u21DA","⇐":"\u21D0","⤛":"\u291B","⤎":"\u290E","≦":"\u2266","⪋":"\u2A8B","⥢":"\u2962","ĺ":"\u013A","⦴":"\u29B4","ℒ":"\u2112","λ":"\u03BB","⟨":"\u27E8","⦑":"\u2991","⟨":"\u27E8","⪅":"\u2A85","«":"\xAB","«":"\xAB","←":"\u2190","⇤":"\u21E4","⤟":"\u291F","⤝":"\u291D","↩":"\u21A9","↫":"\u21AB","⤹":"\u2939","⥳":"\u2973","↢":"\u21A2","⪫":"\u2AAB","⤙":"\u2919","⪭":"\u2AAD","⪭︀":"\u2AAD\uFE00","⤌":"\u290C","❲":"\u2772","{":"{","[":"[","⦋":"\u298B","⦏":"\u298F","⦍":"\u298D","ľ":"\u013E","ļ":"\u013C","⌈":"\u2308","{":"{","л":"\u043B","⤶":"\u2936","“":"\u201C","„":"\u201E","⥧":"\u2967","⥋":"\u294B","↲":"\u21B2","≤":"\u2264","←":"\u2190","↢":"\u21A2","↽":"\u21BD","↼":"\u21BC","⇇":"\u21C7","↔":"\u2194","⇆":"\u21C6","⇋":"\u21CB","↭":"\u21AD","⋋":"\u22CB","⋚":"\u22DA","≤":"\u2264","≦":"\u2266","⩽":"\u2A7D","⩽":"\u2A7D","⪨":"\u2AA8","⩿":"\u2A7F","⪁":"\u2A81","⪃":"\u2A83","⋚︀":"\u22DA\uFE00","⪓":"\u2A93","⪅":"\u2A85","⋖":"\u22D6","⋚":"\u22DA","⪋":"\u2A8B","≶":"\u2276","≲":"\u2272","⥼":"\u297C","⌊":"\u230A","𝔩":"\u{1D529}","≶":"\u2276","⪑":"\u2A91","↽":"\u21BD","↼":"\u21BC","⥪":"\u296A","▄":"\u2584","љ":"\u0459","≪":"\u226A","⇇":"\u21C7","⌞":"\u231E","⥫":"\u296B","◺":"\u25FA","ŀ":"\u0140","⎰":"\u23B0","⎰":"\u23B0","≨":"\u2268","⪉":"\u2A89","⪉":"\u2A89","⪇":"\u2A87","⪇":"\u2A87","≨":"\u2268","⋦":"\u22E6","⟬":"\u27EC","⇽":"\u21FD","⟦":"\u27E6","⟵":"\u27F5","⟷":"\u27F7","⟼":"\u27FC","⟶":"\u27F6","↫":"\u21AB","↬":"\u21AC","⦅":"\u2985","𝕝":"\u{1D55D}","⨭":"\u2A2D","⨴":"\u2A34","∗":"\u2217","_":"_","◊":"\u25CA","◊":"\u25CA","⧫":"\u29EB","(":"(","⦓":"\u2993","⇆":"\u21C6","⌟":"\u231F","⇋":"\u21CB","⥭":"\u296D","‎":"\u200E","⊿":"\u22BF","‹":"\u2039","𝓁":"\u{1D4C1}","↰":"\u21B0","≲":"\u2272","⪍":"\u2A8D","⪏":"\u2A8F","[":"[","‘":"\u2018","‚":"\u201A","ł":"\u0142","<":"<","<":"<","⪦":"\u2AA6","⩹":"\u2A79","⋖":"\u22D6","⋋":"\u22CB","⋉":"\u22C9","⥶":"\u2976","⩻":"\u2A7B","⦖":"\u2996","◃":"\u25C3","⊴":"\u22B4","◂":"\u25C2","⥊":"\u294A","⥦":"\u2966","≨︀":"\u2268\uFE00","≨︀":"\u2268\uFE00","∺":"\u223A","¯":"\xAF","¯":"\xAF","♂":"\u2642","✠":"\u2720","✠":"\u2720","↦":"\u21A6","↦":"\u21A6","↧":"\u21A7","↤":"\u21A4","↥":"\u21A5","▮":"\u25AE","⨩":"\u2A29","м":"\u043C","—":"\u2014","∡":"\u2221","𝔪":"\u{1D52A}","℧":"\u2127","µ":"\xB5","µ":"\xB5","∣":"\u2223","*":"*","⫰":"\u2AF0","·":"\xB7","·":"\xB7","−":"\u2212","⊟":"\u229F","∸":"\u2238","⨪":"\u2A2A","⫛":"\u2ADB","…":"\u2026","∓":"\u2213","⊧":"\u22A7","𝕞":"\u{1D55E}","∓":"\u2213","𝓂":"\u{1D4C2}","∾":"\u223E","μ":"\u03BC","⊸":"\u22B8","⊸":"\u22B8","⋙̸":"\u22D9\u0338","≫⃒":"\u226B\u20D2","≫̸":"\u226B\u0338","⇍":"\u21CD","⇎":"\u21CE","⋘̸":"\u22D8\u0338","≪⃒":"\u226A\u20D2","≪̸":"\u226A\u0338","⇏":"\u21CF","⊯":"\u22AF","⊮":"\u22AE","∇":"\u2207","ń":"\u0144","∠⃒":"\u2220\u20D2","≉":"\u2249","⩰̸":"\u2A70\u0338","≋̸":"\u224B\u0338","ʼn":"\u0149","≉":"\u2249","♮":"\u266E","♮":"\u266E","ℕ":"\u2115"," ":"\xA0"," ":"\xA0","≎̸":"\u224E\u0338","≏̸":"\u224F\u0338","⩃":"\u2A43","ň":"\u0148","ņ":"\u0146","≇":"\u2247","⩭̸":"\u2A6D\u0338","⩂":"\u2A42","н":"\u043D","–":"\u2013","≠":"\u2260","⇗":"\u21D7","⤤":"\u2924","↗":"\u2197","↗":"\u2197","≐̸":"\u2250\u0338","≢":"\u2262","⤨":"\u2928","≂̸":"\u2242\u0338","∄":"\u2204","∄":"\u2204","𝔫":"\u{1D52B}","≧̸":"\u2267\u0338","≱":"\u2271","≱":"\u2271","≧̸":"\u2267\u0338","⩾̸":"\u2A7E\u0338","⩾̸":"\u2A7E\u0338","≵":"\u2275","≯":"\u226F","≯":"\u226F","⇎":"\u21CE","↮":"\u21AE","⫲":"\u2AF2","∋":"\u220B","⋼":"\u22FC","⋺":"\u22FA","∋":"\u220B","њ":"\u045A","⇍":"\u21CD","≦̸":"\u2266\u0338","↚":"\u219A","‥":"\u2025","≰":"\u2270","↚":"\u219A","↮":"\u21AE","≰":"\u2270","≦̸":"\u2266\u0338","⩽̸":"\u2A7D\u0338","⩽̸":"\u2A7D\u0338","≮":"\u226E","≴":"\u2274","≮":"\u226E","⋪":"\u22EA","⋬":"\u22EC","∤":"\u2224","𝕟":"\u{1D55F}","¬":"\xAC","¬":"\xAC","∉":"\u2209","⋹̸":"\u22F9\u0338","⋵̸":"\u22F5\u0338","∉":"\u2209","⋷":"\u22F7","⋶":"\u22F6","∌":"\u220C","∌":"\u220C","⋾":"\u22FE","⋽":"\u22FD","∦":"\u2226","∦":"\u2226","⫽⃥":"\u2AFD\u20E5","∂̸":"\u2202\u0338","⨔":"\u2A14","⊀":"\u2280","⋠":"\u22E0","⪯̸":"\u2AAF\u0338","⊀":"\u2280","⪯̸":"\u2AAF\u0338","⇏":"\u21CF","↛":"\u219B","⤳̸":"\u2933\u0338","↝̸":"\u219D\u0338","↛":"\u219B","⋫":"\u22EB","⋭":"\u22ED","⊁":"\u2281","⋡":"\u22E1","⪰̸":"\u2AB0\u0338","𝓃":"\u{1D4C3}","∤":"\u2224","∦":"\u2226","≁":"\u2241","≄":"\u2244","≄":"\u2244","∤":"\u2224","∦":"\u2226","⋢":"\u22E2","⋣":"\u22E3","⊄":"\u2284","⫅̸":"\u2AC5\u0338","⊈":"\u2288","⊂⃒":"\u2282\u20D2","⊈":"\u2288","⫅̸":"\u2AC5\u0338","⊁":"\u2281","⪰̸":"\u2AB0\u0338","⊅":"\u2285","⫆̸":"\u2AC6\u0338","⊉":"\u2289","⊃⃒":"\u2283\u20D2","⊉":"\u2289","⫆̸":"\u2AC6\u0338","≹":"\u2279","ñ":"\xF1","ñ":"\xF1","≸":"\u2278","⋪":"\u22EA","⋬":"\u22EC","⋫":"\u22EB","⋭":"\u22ED","ν":"\u03BD","#":"#","№":"\u2116"," ":"\u2007","⊭":"\u22AD","⤄":"\u2904","≍⃒":"\u224D\u20D2","⊬":"\u22AC","≥⃒":"\u2265\u20D2",">⃒":">\u20D2","⧞":"\u29DE","⤂":"\u2902","≤⃒":"\u2264\u20D2","<⃒":"<\u20D2","⊴⃒":"\u22B4\u20D2","⤃":"\u2903","⊵⃒":"\u22B5\u20D2","∼⃒":"\u223C\u20D2","⇖":"\u21D6","⤣":"\u2923","↖":"\u2196","↖":"\u2196","⤧":"\u2927","Ⓢ":"\u24C8","ó":"\xF3","ó":"\xF3","⊛":"\u229B","⊚":"\u229A","ô":"\xF4","ô":"\xF4","о":"\u043E","⊝":"\u229D","ő":"\u0151","⨸":"\u2A38","⊙":"\u2299","⦼":"\u29BC","œ":"\u0153","⦿":"\u29BF","𝔬":"\u{1D52C}","˛":"\u02DB","ò":"\xF2","ò":"\xF2","⧁":"\u29C1","⦵":"\u29B5","Ω":"\u03A9","∮":"\u222E","↺":"\u21BA","⦾":"\u29BE","⦻":"\u29BB","‾":"\u203E","⧀":"\u29C0","ō":"\u014D","ω":"\u03C9","ο":"\u03BF","⦶":"\u29B6","⊖":"\u2296","𝕠":"\u{1D560}","⦷":"\u29B7","⦹":"\u29B9","⊕":"\u2295","∨":"\u2228","↻":"\u21BB","⩝":"\u2A5D","ℴ":"\u2134","ℴ":"\u2134","ª":"\xAA","ª":"\xAA","º":"\xBA","º":"\xBA","⊶":"\u22B6","⩖":"\u2A56","⩗":"\u2A57","⩛":"\u2A5B","ℴ":"\u2134","ø":"\xF8","ø":"\xF8","⊘":"\u2298","õ":"\xF5","õ":"\xF5","⊗":"\u2297","⨶":"\u2A36","ö":"\xF6","ö":"\xF6","⌽":"\u233D","∥":"\u2225","¶":"\xB6","¶":"\xB6","∥":"\u2225","⫳":"\u2AF3","⫽":"\u2AFD","∂":"\u2202","п":"\u043F","%":"%",".":".","‰":"\u2030","⊥":"\u22A5","‱":"\u2031","𝔭":"\u{1D52D}","φ":"\u03C6","ϕ":"\u03D5","ℳ":"\u2133","☎":"\u260E","π":"\u03C0","⋔":"\u22D4","ϖ":"\u03D6","ℏ":"\u210F","ℎ":"\u210E","ℏ":"\u210F","+":"+","⨣":"\u2A23","⊞":"\u229E","⨢":"\u2A22","∔":"\u2214","⨥":"\u2A25","⩲":"\u2A72","±":"\xB1","±":"\xB1","⨦":"\u2A26","⨧":"\u2A27","±":"\xB1","⨕":"\u2A15","𝕡":"\u{1D561}","£":"\xA3","£":"\xA3","≺":"\u227A","⪳":"\u2AB3","⪷":"\u2AB7","≼":"\u227C","⪯":"\u2AAF","≺":"\u227A","⪷":"\u2AB7","≼":"\u227C","⪯":"\u2AAF","⪹":"\u2AB9","⪵":"\u2AB5","⋨":"\u22E8","≾":"\u227E","′":"\u2032","ℙ":"\u2119","⪵":"\u2AB5","⪹":"\u2AB9","⋨":"\u22E8","∏":"\u220F","⌮":"\u232E","⌒":"\u2312","⌓":"\u2313","∝":"\u221D","∝":"\u221D","≾":"\u227E","⊰":"\u22B0","𝓅":"\u{1D4C5}","ψ":"\u03C8"," ":"\u2008","𝔮":"\u{1D52E}","⨌":"\u2A0C","𝕢":"\u{1D562}","⁗":"\u2057","𝓆":"\u{1D4C6}","ℍ":"\u210D","⨖":"\u2A16","?":"?","≟":"\u225F",""":'"',""":'"',"⇛":"\u21DB","⇒":"\u21D2","⤜":"\u291C","⤏":"\u290F","⥤":"\u2964","∽̱":"\u223D\u0331","ŕ":"\u0155","√":"\u221A","⦳":"\u29B3","⟩":"\u27E9","⦒":"\u2992","⦥":"\u29A5","⟩":"\u27E9","»":"\xBB","»":"\xBB","→":"\u2192","⥵":"\u2975","⇥":"\u21E5","⤠":"\u2920","⤳":"\u2933","⤞":"\u291E","↪":"\u21AA","↬":"\u21AC","⥅":"\u2945","⥴":"\u2974","↣":"\u21A3","↝":"\u219D","⤚":"\u291A","∶":"\u2236","ℚ":"\u211A","⤍":"\u290D","❳":"\u2773","}":"}","]":"]","⦌":"\u298C","⦎":"\u298E","⦐":"\u2990","ř":"\u0159","ŗ":"\u0157","⌉":"\u2309","}":"}","р":"\u0440","⤷":"\u2937","⥩":"\u2969","”":"\u201D","”":"\u201D","↳":"\u21B3","ℜ":"\u211C","ℛ":"\u211B","ℜ":"\u211C","ℝ":"\u211D","▭":"\u25AD","®":"\xAE","®":"\xAE","⥽":"\u297D","⌋":"\u230B","𝔯":"\u{1D52F}","⇁":"\u21C1","⇀":"\u21C0","⥬":"\u296C","ρ":"\u03C1","ϱ":"\u03F1","→":"\u2192","↣":"\u21A3","⇁":"\u21C1","⇀":"\u21C0","⇄":"\u21C4","⇌":"\u21CC","⇉":"\u21C9","↝":"\u219D","⋌":"\u22CC","˚":"\u02DA","≓":"\u2253","⇄":"\u21C4","⇌":"\u21CC","‏":"\u200F","⎱":"\u23B1","⎱":"\u23B1","⫮":"\u2AEE","⟭":"\u27ED","⇾":"\u21FE","⟧":"\u27E7","⦆":"\u2986","𝕣":"\u{1D563}","⨮":"\u2A2E","⨵":"\u2A35",")":")","⦔":"\u2994","⨒":"\u2A12","⇉":"\u21C9","›":"\u203A","𝓇":"\u{1D4C7}","↱":"\u21B1","]":"]","’":"\u2019","’":"\u2019","⋌":"\u22CC","⋊":"\u22CA","▹":"\u25B9","⊵":"\u22B5","▸":"\u25B8","⧎":"\u29CE","⥨":"\u2968","℞":"\u211E","ś":"\u015B","‚":"\u201A","≻":"\u227B","⪴":"\u2AB4","⪸":"\u2AB8","š":"\u0161","≽":"\u227D","⪰":"\u2AB0","ş":"\u015F","ŝ":"\u015D","⪶":"\u2AB6","⪺":"\u2ABA","⋩":"\u22E9","⨓":"\u2A13","≿":"\u227F","с":"\u0441","⋅":"\u22C5","⊡":"\u22A1","⩦":"\u2A66","⇘":"\u21D8","⤥":"\u2925","↘":"\u2198","↘":"\u2198","§":"\xA7","§":"\xA7",";":";","⤩":"\u2929","∖":"\u2216","∖":"\u2216","✶":"\u2736","𝔰":"\u{1D530}","⌢":"\u2322","♯":"\u266F","щ":"\u0449","ш":"\u0448","∣":"\u2223","∥":"\u2225","­":"\xAD","­":"\xAD","σ":"\u03C3","ς":"\u03C2","ς":"\u03C2","∼":"\u223C","⩪":"\u2A6A","≃":"\u2243","≃":"\u2243","⪞":"\u2A9E","⪠":"\u2AA0","⪝":"\u2A9D","⪟":"\u2A9F","≆":"\u2246","⨤":"\u2A24","⥲":"\u2972","←":"\u2190","∖":"\u2216","⨳":"\u2A33","⧤":"\u29E4","∣":"\u2223","⌣":"\u2323","⪪":"\u2AAA","⪬":"\u2AAC","⪬︀":"\u2AAC\uFE00","ь":"\u044C","/":"/","⧄":"\u29C4","⌿":"\u233F","𝕤":"\u{1D564}","♠":"\u2660","♠":"\u2660","∥":"\u2225","⊓":"\u2293","⊓︀":"\u2293\uFE00","⊔":"\u2294","⊔︀":"\u2294\uFE00","⊏":"\u228F","⊑":"\u2291","⊏":"\u228F","⊑":"\u2291","⊐":"\u2290","⊒":"\u2292","⊐":"\u2290","⊒":"\u2292","□":"\u25A1","□":"\u25A1","▪":"\u25AA","▪":"\u25AA","→":"\u2192","𝓈":"\u{1D4C8}","∖":"\u2216","⌣":"\u2323","⋆":"\u22C6","☆":"\u2606","★":"\u2605","ϵ":"\u03F5","ϕ":"\u03D5","¯":"\xAF","⊂":"\u2282","⫅":"\u2AC5","⪽":"\u2ABD","⊆":"\u2286","⫃":"\u2AC3","⫁":"\u2AC1","⫋":"\u2ACB","⊊":"\u228A","⪿":"\u2ABF","⥹":"\u2979","⊂":"\u2282","⊆":"\u2286","⫅":"\u2AC5","⊊":"\u228A","⫋":"\u2ACB","⫇":"\u2AC7","⫕":"\u2AD5","⫓":"\u2AD3","≻":"\u227B","⪸":"\u2AB8","≽":"\u227D","⪰":"\u2AB0","⪺":"\u2ABA","⪶":"\u2AB6","⋩":"\u22E9","≿":"\u227F","∑":"\u2211","♪":"\u266A","¹":"\xB9","¹":"\xB9","²":"\xB2","²":"\xB2","³":"\xB3","³":"\xB3","⊃":"\u2283","⫆":"\u2AC6","⪾":"\u2ABE","⫘":"\u2AD8","⊇":"\u2287","⫄":"\u2AC4","⟉":"\u27C9","⫗":"\u2AD7","⥻":"\u297B","⫂":"\u2AC2","⫌":"\u2ACC","⊋":"\u228B","⫀":"\u2AC0","⊃":"\u2283","⊇":"\u2287","⫆":"\u2AC6","⊋":"\u228B","⫌":"\u2ACC","⫈":"\u2AC8","⫔":"\u2AD4","⫖":"\u2AD6","⇙":"\u21D9","⤦":"\u2926","↙":"\u2199","↙":"\u2199","⤪":"\u292A","ß":"\xDF","ß":"\xDF","⌖":"\u2316","τ":"\u03C4","⎴":"\u23B4","ť":"\u0165","ţ":"\u0163","т":"\u0442","⃛":"\u20DB","⌕":"\u2315","𝔱":"\u{1D531}","∴":"\u2234","∴":"\u2234","θ":"\u03B8","ϑ":"\u03D1","ϑ":"\u03D1","≈":"\u2248","∼":"\u223C"," ":"\u2009","≈":"\u2248","∼":"\u223C","þ":"\xFE","þ":"\xFE","˜":"\u02DC","×":"\xD7","×":"\xD7","⊠":"\u22A0","⨱":"\u2A31","⨰":"\u2A30","∭":"\u222D","⤨":"\u2928","⊤":"\u22A4","⌶":"\u2336","⫱":"\u2AF1","𝕥":"\u{1D565}","⫚":"\u2ADA","⤩":"\u2929","‴":"\u2034","™":"\u2122","▵":"\u25B5","▿":"\u25BF","◃":"\u25C3","⊴":"\u22B4","≜":"\u225C","▹":"\u25B9","⊵":"\u22B5","◬":"\u25EC","≜":"\u225C","⨺":"\u2A3A","⨹":"\u2A39","⧍":"\u29CD","⨻":"\u2A3B","⏢":"\u23E2","𝓉":"\u{1D4C9}","ц":"\u0446","ћ":"\u045B","ŧ":"\u0167","≬":"\u226C","↞":"\u219E","↠":"\u21A0","⇑":"\u21D1","⥣":"\u2963","ú":"\xFA","ú":"\xFA","↑":"\u2191","ў":"\u045E","ŭ":"\u016D","û":"\xFB","û":"\xFB","у":"\u0443","⇅":"\u21C5","ű":"\u0171","⥮":"\u296E","⥾":"\u297E","𝔲":"\u{1D532}","ù":"\xF9","ù":"\xF9","↿":"\u21BF","↾":"\u21BE","▀":"\u2580","⌜":"\u231C","⌜":"\u231C","⌏":"\u230F","◸":"\u25F8","ū":"\u016B","¨":"\xA8","¨":"\xA8","ų":"\u0173","𝕦":"\u{1D566}","↑":"\u2191","↕":"\u2195","↿":"\u21BF","↾":"\u21BE","⊎":"\u228E","υ":"\u03C5","ϒ":"\u03D2","υ":"\u03C5","⇈":"\u21C8","⌝":"\u231D","⌝":"\u231D","⌎":"\u230E","ů":"\u016F","◹":"\u25F9","𝓊":"\u{1D4CA}","⋰":"\u22F0","ũ":"\u0169","▵":"\u25B5","▴":"\u25B4","⇈":"\u21C8","ü":"\xFC","ü":"\xFC","⦧":"\u29A7","⇕":"\u21D5","⫨":"\u2AE8","⫩":"\u2AE9","⊨":"\u22A8","⦜":"\u299C","ϵ":"\u03F5","ϰ":"\u03F0","∅":"\u2205","ϕ":"\u03D5","ϖ":"\u03D6","∝":"\u221D","↕":"\u2195","ϱ":"\u03F1","ς":"\u03C2","⊊︀":"\u228A\uFE00","⫋︀":"\u2ACB\uFE00","⊋︀":"\u228B\uFE00","⫌︀":"\u2ACC\uFE00","ϑ":"\u03D1","⊲":"\u22B2","⊳":"\u22B3","в":"\u0432","⊢":"\u22A2","∨":"\u2228","⊻":"\u22BB","≚":"\u225A","⋮":"\u22EE","|":"|","|":"|","𝔳":"\u{1D533}","⊲":"\u22B2","⊂⃒":"\u2282\u20D2","⊃⃒":"\u2283\u20D2","𝕧":"\u{1D567}","∝":"\u221D","⊳":"\u22B3","𝓋":"\u{1D4CB}","⫋︀":"\u2ACB\uFE00","⊊︀":"\u228A\uFE00","⫌︀":"\u2ACC\uFE00","⊋︀":"\u228B\uFE00","⦚":"\u299A","ŵ":"\u0175","⩟":"\u2A5F","∧":"\u2227","≙":"\u2259","℘":"\u2118","𝔴":"\u{1D534}","𝕨":"\u{1D568}","℘":"\u2118","≀":"\u2240","≀":"\u2240","𝓌":"\u{1D4CC}","⋂":"\u22C2","◯":"\u25EF","⋃":"\u22C3","▽":"\u25BD","𝔵":"\u{1D535}","⟺":"\u27FA","⟷":"\u27F7","ξ":"\u03BE","⟸":"\u27F8","⟵":"\u27F5","⟼":"\u27FC","⋻":"\u22FB","⨀":"\u2A00","𝕩":"\u{1D569}","⨁":"\u2A01","⨂":"\u2A02","⟹":"\u27F9","⟶":"\u27F6","𝓍":"\u{1D4CD}","⨆":"\u2A06","⨄":"\u2A04","△":"\u25B3","⋁":"\u22C1","⋀":"\u22C0","ý":"\xFD","ý":"\xFD","я":"\u044F","ŷ":"\u0177","ы":"\u044B","¥":"\xA5","¥":"\xA5","𝔶":"\u{1D536}","ї":"\u0457","𝕪":"\u{1D56A}","𝓎":"\u{1D4CE}","ю":"\u044E","ÿ":"\xFF","ÿ":"\xFF","ź":"\u017A","ž":"\u017E","з":"\u0437","ż":"\u017C","ℨ":"\u2128","ζ":"\u03B6","𝔷":"\u{1D537}","ж":"\u0436","⇝":"\u21DD","𝕫":"\u{1D56B}","𝓏":"\u{1D4CF}","‍":"\u200D","‌":"\u200C"},characters:{\u00C6:"Æ","&":"&",\u00C1:"Á",\u0102:"Ă",\u00C2:"Â",\u0410:"А","\u{1D504}":"𝔄",\u00C0:"À",\u0391:"Α",\u0100:"Ā","\u2A53":"⩓",\u0104:"Ą","\u{1D538}":"𝔸","\u2061":"⁡",\u00C5:"Å","\u{1D49C}":"𝒜","\u2254":"≔",\u00C3:"Ã",\u00C4:"Ä","\u2216":"∖","\u2AE7":"⫧","\u2306":"⌆",\u0411:"Б","\u2235":"∵",\u212C:"ℬ",\u0392:"Β","\u{1D505}":"𝔅","\u{1D539}":"𝔹","\u02D8":"˘","\u224E":"≎",\u0427:"Ч","\xA9":"©",\u0106:"Ć","\u22D2":"⋒","\u2145":"ⅅ",\u212D:"ℭ",\u010C:"Č",\u00C7:"Ç",\u0108:"Ĉ","\u2230":"∰",\u010A:"Ċ","\xB8":"¸","\xB7":"·",\u03A7:"Χ","\u2299":"⊙","\u2296":"⊖","\u2295":"⊕","\u2297":"⊗","\u2232":"∲","\u201D":"”","\u2019":"’","\u2237":"∷","\u2A74":"⩴","\u2261":"≡","\u222F":"∯","\u222E":"∮",\u2102:"ℂ","\u2210":"∐","\u2233":"∳","\u2A2F":"⨯","\u{1D49E}":"𝒞","\u22D3":"⋓","\u224D":"≍","\u2911":"⤑",\u0402:"Ђ",\u0405:"Ѕ",\u040F:"Џ","\u2021":"‡","\u21A1":"↡","\u2AE4":"⫤",\u010E:"Ď",\u0414:"Д","\u2207":"∇",\u0394:"Δ","\u{1D507}":"𝔇","\xB4":"´","\u02D9":"˙","\u02DD":"˝","`":"`","\u02DC":"˜","\u22C4":"⋄","\u2146":"ⅆ","\u{1D53B}":"𝔻","\xA8":"¨","\u20DC":"⃜","\u2250":"≐","\u21D3":"⇓","\u21D0":"⇐","\u21D4":"⇔","\u27F8":"⟸","\u27FA":"⟺","\u27F9":"⟹","\u21D2":"⇒","\u22A8":"⊨","\u21D1":"⇑","\u21D5":"⇕","\u2225":"∥","\u2193":"↓","\u2913":"⤓","\u21F5":"⇵","\u0311":"̑","\u2950":"⥐","\u295E":"⥞","\u21BD":"↽","\u2956":"⥖","\u295F":"⥟","\u21C1":"⇁","\u2957":"⥗","\u22A4":"⊤","\u21A7":"↧","\u{1D49F}":"𝒟",\u0110:"Đ",\u014A:"Ŋ",\u00D0:"Ð",\u00C9:"É",\u011A:"Ě",\u00CA:"Ê",\u042D:"Э",\u0116:"Ė","\u{1D508}":"𝔈",\u00C8:"È","\u2208":"∈",\u0112:"Ē","\u25FB":"◻","\u25AB":"▫",\u0118:"Ę","\u{1D53C}":"𝔼",\u0395:"Ε","\u2A75":"⩵","\u2242":"≂","\u21CC":"⇌",\u2130:"ℰ","\u2A73":"⩳",\u0397:"Η",\u00CB:"Ë","\u2203":"∃","\u2147":"ⅇ",\u0424:"Ф","\u{1D509}":"𝔉","\u25FC":"◼","\u25AA":"▪","\u{1D53D}":"𝔽","\u2200":"∀",\u2131:"ℱ",\u0403:"Ѓ",">":">",\u0393:"Γ",\u03DC:"Ϝ",\u011E:"Ğ",\u0122:"Ģ",\u011C:"Ĝ",\u0413:"Г",\u0120:"Ġ","\u{1D50A}":"𝔊","\u22D9":"⋙","\u{1D53E}":"𝔾","\u2265":"≥","\u22DB":"⋛","\u2267":"≧","\u2AA2":"⪢","\u2277":"≷","\u2A7E":"⩾","\u2273":"≳","\u{1D4A2}":"𝒢","\u226B":"≫",\u042A:"Ъ","\u02C7":"ˇ","^":"^",\u0124:"Ĥ",\u210C:"ℌ",\u210B:"ℋ",\u210D:"ℍ","\u2500":"─",\u0126:"Ħ","\u224F":"≏",\u0415:"Е",\u0132:"IJ",\u0401:"Ё",\u00CD:"Í",\u00CE:"Î",\u0418:"И",\u0130:"İ",\u2111:"ℑ",\u00CC:"Ì",\u012A:"Ī","\u2148":"ⅈ","\u222C":"∬","\u222B":"∫","\u22C2":"⋂","\u2063":"⁣","\u2062":"⁢",\u012E:"Į","\u{1D540}":"𝕀",\u0399:"Ι",\u2110:"ℐ",\u0128:"Ĩ",\u0406:"І",\u00CF:"Ï",\u0134:"Ĵ",\u0419:"Й","\u{1D50D}":"𝔍","\u{1D541}":"𝕁","\u{1D4A5}":"𝒥",\u0408:"Ј",\u0404:"Є",\u0425:"Х",\u040C:"Ќ",\u039A:"Κ",\u0136:"Ķ",\u041A:"К","\u{1D50E}":"𝔎","\u{1D542}":"𝕂","\u{1D4A6}":"𝒦",\u0409:"Љ","<":"<",\u0139:"Ĺ",\u039B:"Λ","\u27EA":"⟪",\u2112:"ℒ","\u219E":"↞",\u013D:"Ľ",\u013B:"Ļ",\u041B:"Л","\u27E8":"⟨","\u2190":"←","\u21E4":"⇤","\u21C6":"⇆","\u2308":"⌈","\u27E6":"⟦","\u2961":"⥡","\u21C3":"⇃","\u2959":"⥙","\u230A":"⌊","\u2194":"↔","\u294E":"⥎","\u22A3":"⊣","\u21A4":"↤","\u295A":"⥚","\u22B2":"⊲","\u29CF":"⧏","\u22B4":"⊴","\u2951":"⥑","\u2960":"⥠","\u21BF":"↿","\u2958":"⥘","\u21BC":"↼","\u2952":"⥒","\u22DA":"⋚","\u2266":"≦","\u2276":"≶","\u2AA1":"⪡","\u2A7D":"⩽","\u2272":"≲","\u{1D50F}":"𝔏","\u22D8":"⋘","\u21DA":"⇚",\u013F:"Ŀ","\u27F5":"⟵","\u27F7":"⟷","\u27F6":"⟶","\u{1D543}":"𝕃","\u2199":"↙","\u2198":"↘","\u21B0":"↰",\u0141:"Ł","\u226A":"≪","\u2905":"⤅",\u041C:"М","\u205F":" ",\u2133:"ℳ","\u{1D510}":"𝔐","\u2213":"∓","\u{1D544}":"𝕄",\u039C:"Μ",\u040A:"Њ",\u0143:"Ń",\u0147:"Ň",\u0145:"Ņ",\u041D:"Н","\u200B":"​","\n":" ","\u{1D511}":"𝔑","\u2060":"⁠","\xA0":" ",\u2115:"ℕ","\u2AEC":"⫬","\u2262":"≢","\u226D":"≭","\u2226":"∦","\u2209":"∉","\u2260":"≠","\u2242\u0338":"≂̸","\u2204":"∄","\u226F":"≯","\u2271":"≱","\u2267\u0338":"≧̸","\u226B\u0338":"≫̸","\u2279":"≹","\u2A7E\u0338":"⩾̸","\u2275":"≵","\u224E\u0338":"≎̸","\u224F\u0338":"≏̸","\u22EA":"⋪","\u29CF\u0338":"⧏̸","\u22EC":"⋬","\u226E":"≮","\u2270":"≰","\u2278":"≸","\u226A\u0338":"≪̸","\u2A7D\u0338":"⩽̸","\u2274":"≴","\u2AA2\u0338":"⪢̸","\u2AA1\u0338":"⪡̸","\u2280":"⊀","\u2AAF\u0338":"⪯̸","\u22E0":"⋠","\u220C":"∌","\u22EB":"⋫","\u29D0\u0338":"⧐̸","\u22ED":"⋭","\u228F\u0338":"⊏̸","\u22E2":"⋢","\u2290\u0338":"⊐̸","\u22E3":"⋣","\u2282\u20D2":"⊂⃒","\u2288":"⊈","\u2281":"⊁","\u2AB0\u0338":"⪰̸","\u22E1":"⋡","\u227F\u0338":"≿̸","\u2283\u20D2":"⊃⃒","\u2289":"⊉","\u2241":"≁","\u2244":"≄","\u2247":"≇","\u2249":"≉","\u2224":"∤","\u{1D4A9}":"𝒩",\u00D1:"Ñ",\u039D:"Ν",\u0152:"Œ",\u00D3:"Ó",\u00D4:"Ô",\u041E:"О",\u0150:"Ő","\u{1D512}":"𝔒",\u00D2:"Ò",\u014C:"Ō",\u03A9:"Ω",\u039F:"Ο","\u{1D546}":"𝕆","\u201C":"“","\u2018":"‘","\u2A54":"⩔","\u{1D4AA}":"𝒪",\u00D8:"Ø",\u00D5:"Õ","\u2A37":"⨷",\u00D6:"Ö","\u203E":"‾","\u23DE":"⏞","\u23B4":"⎴","\u23DC":"⏜","\u2202":"∂",\u041F:"П","\u{1D513}":"𝔓",\u03A6:"Φ",\u03A0:"Π","\xB1":"±",\u2119:"ℙ","\u2ABB":"⪻","\u227A":"≺","\u2AAF":"⪯","\u227C":"≼","\u227E":"≾","\u2033":"″","\u220F":"∏","\u221D":"∝","\u{1D4AB}":"𝒫",\u03A8:"Ψ",'"':""","\u{1D514}":"𝔔",\u211A:"ℚ","\u{1D4AC}":"𝒬","\u2910":"⤐","\xAE":"®",\u0154:"Ŕ","\u27EB":"⟫","\u21A0":"↠","\u2916":"⤖",\u0158:"Ř",\u0156:"Ŗ",\u0420:"Р",\u211C:"ℜ","\u220B":"∋","\u21CB":"⇋","\u296F":"⥯",\u03A1:"Ρ","\u27E9":"⟩","\u2192":"→","\u21E5":"⇥","\u21C4":"⇄","\u2309":"⌉","\u27E7":"⟧","\u295D":"⥝","\u21C2":"⇂","\u2955":"⥕","\u230B":"⌋","\u22A2":"⊢","\u21A6":"↦","\u295B":"⥛","\u22B3":"⊳","\u29D0":"⧐","\u22B5":"⊵","\u294F":"⥏","\u295C":"⥜","\u21BE":"↾","\u2954":"⥔","\u21C0":"⇀","\u2953":"⥓",\u211D:"ℝ","\u2970":"⥰","\u21DB":"⇛",\u211B:"ℛ","\u21B1":"↱","\u29F4":"⧴",\u0429:"Щ",\u0428:"Ш",\u042C:"Ь",\u015A:"Ś","\u2ABC":"⪼",\u0160:"Š",\u015E:"Ş",\u015C:"Ŝ",\u0421:"С","\u{1D516}":"𝔖","\u2191":"↑",\u03A3:"Σ","\u2218":"∘","\u{1D54A}":"𝕊","\u221A":"√","\u25A1":"□","\u2293":"⊓","\u228F":"⊏","\u2291":"⊑","\u2290":"⊐","\u2292":"⊒","\u2294":"⊔","\u{1D4AE}":"𝒮","\u22C6":"⋆","\u22D0":"⋐","\u2286":"⊆","\u227B":"≻","\u2AB0":"⪰","\u227D":"≽","\u227F":"≿","\u2211":"∑","\u22D1":"⋑","\u2283":"⊃","\u2287":"⊇",\u00DE:"Þ","\u2122":"™",\u040B:"Ћ",\u0426:"Ц"," ":" ",\u03A4:"Τ",\u0164:"Ť",\u0162:"Ţ",\u0422:"Т","\u{1D517}":"𝔗","\u2234":"∴",\u0398:"Θ","\u205F\u200A":"  ","\u2009":" ","\u223C":"∼","\u2243":"≃","\u2245":"≅","\u2248":"≈","\u{1D54B}":"𝕋","\u20DB":"⃛","\u{1D4AF}":"𝒯",\u0166:"Ŧ",\u00DA:"Ú","\u219F":"↟","\u2949":"⥉",\u040E:"Ў",\u016C:"Ŭ",\u00DB:"Û",\u0423:"У",\u0170:"Ű","\u{1D518}":"𝔘",\u00D9:"Ù",\u016A:"Ū",_:"_","\u23DF":"⏟","\u23B5":"⎵","\u23DD":"⏝","\u22C3":"⋃","\u228E":"⊎",\u0172:"Ų","\u{1D54C}":"𝕌","\u2912":"⤒","\u21C5":"⇅","\u2195":"↕","\u296E":"⥮","\u22A5":"⊥","\u21A5":"↥","\u2196":"↖","\u2197":"↗",\u03D2:"ϒ",\u03A5:"Υ",\u016E:"Ů","\u{1D4B0}":"𝒰",\u0168:"Ũ",\u00DC:"Ü","\u22AB":"⊫","\u2AEB":"⫫",\u0412:"В","\u22A9":"⊩","\u2AE6":"⫦","\u22C1":"⋁","\u2016":"‖","\u2223":"∣","|":"|","\u2758":"❘","\u2240":"≀","\u200A":" ","\u{1D519}":"𝔙","\u{1D54D}":"𝕍","\u{1D4B1}":"𝒱","\u22AA":"⊪",\u0174:"Ŵ","\u22C0":"⋀","\u{1D51A}":"𝔚","\u{1D54E}":"𝕎","\u{1D4B2}":"𝒲","\u{1D51B}":"𝔛",\u039E:"Ξ","\u{1D54F}":"𝕏","\u{1D4B3}":"𝒳",\u042F:"Я",\u0407:"Ї",\u042E:"Ю",\u00DD:"Ý",\u0176:"Ŷ",\u042B:"Ы","\u{1D51C}":"𝔜","\u{1D550}":"𝕐","\u{1D4B4}":"𝒴",\u0178:"Ÿ",\u0416:"Ж",\u0179:"Ź",\u017D:"Ž",\u0417:"З",\u017B:"Ż",\u0396:"Ζ",\u2128:"ℨ",\u2124:"ℤ","\u{1D4B5}":"𝒵",\u00E1:"á",\u0103:"ă","\u223E":"∾","\u223E\u0333":"∾̳","\u223F":"∿",\u00E2:"â",\u0430:"а",\u00E6:"æ","\u{1D51E}":"𝔞",\u00E0:"à",\u2135:"ℵ",\u03B1:"α",\u0101:"ā","\u2A3F":"⨿","\u2227":"∧","\u2A55":"⩕","\u2A5C":"⩜","\u2A58":"⩘","\u2A5A":"⩚","\u2220":"∠","\u29A4":"⦤","\u2221":"∡","\u29A8":"⦨","\u29A9":"⦩","\u29AA":"⦪","\u29AB":"⦫","\u29AC":"⦬","\u29AD":"⦭","\u29AE":"⦮","\u29AF":"⦯","\u221F":"∟","\u22BE":"⊾","\u299D":"⦝","\u2222":"∢","\u237C":"⍼",\u0105:"ą","\u{1D552}":"𝕒","\u2A70":"⩰","\u2A6F":"⩯","\u224A":"≊","\u224B":"≋","'":"'",\u00E5:"å","\u{1D4B6}":"𝒶","*":"*",\u00E3:"ã",\u00E4:"ä","\u2A11":"⨑","\u2AED":"⫭","\u224C":"≌","\u03F6":"϶","\u2035":"‵","\u223D":"∽","\u22CD":"⋍","\u22BD":"⊽","\u2305":"⌅","\u23B6":"⎶",\u0431:"б","\u201E":"„","\u29B0":"⦰",\u03B2:"β",\u2136:"ℶ","\u226C":"≬","\u{1D51F}":"𝔟","\u25EF":"◯","\u2A00":"⨀","\u2A01":"⨁","\u2A02":"⨂","\u2A06":"⨆","\u2605":"★","\u25BD":"▽","\u25B3":"△","\u2A04":"⨄","\u290D":"⤍","\u29EB":"⧫","\u25B4":"▴","\u25BE":"▾","\u25C2":"◂","\u25B8":"▸","\u2423":"␣","\u2592":"▒","\u2591":"░","\u2593":"▓","\u2588":"█","=\u20E5":"=⃥","\u2261\u20E5":"≡⃥","\u2310":"⌐","\u{1D553}":"𝕓","\u22C8":"⋈","\u2557":"╗","\u2554":"╔","\u2556":"╖","\u2553":"╓","\u2550":"═","\u2566":"╦","\u2569":"╩","\u2564":"╤","\u2567":"╧","\u255D":"╝","\u255A":"╚","\u255C":"╜","\u2559":"╙","\u2551":"║","\u256C":"╬","\u2563":"╣","\u2560":"╠","\u256B":"╫","\u2562":"╢","\u255F":"╟","\u29C9":"⧉","\u2555":"╕","\u2552":"╒","\u2510":"┐","\u250C":"┌","\u2565":"╥","\u2568":"╨","\u252C":"┬","\u2534":"┴","\u229F":"⊟","\u229E":"⊞","\u22A0":"⊠","\u255B":"╛","\u2558":"╘","\u2518":"┘","\u2514":"└","\u2502":"│","\u256A":"╪","\u2561":"╡","\u255E":"╞","\u253C":"┼","\u2524":"┤","\u251C":"├","\xA6":"¦","\u{1D4B7}":"𝒷","\u204F":"⁏","\\":"\","\u29C5":"⧅","\u27C8":"⟈","\u2022":"•","\u2AAE":"⪮",\u0107:"ć","\u2229":"∩","\u2A44":"⩄","\u2A49":"⩉","\u2A4B":"⩋","\u2A47":"⩇","\u2A40":"⩀","\u2229\uFE00":"∩︀","\u2041":"⁁","\u2A4D":"⩍",\u010D:"č",\u00E7:"ç",\u0109:"ĉ","\u2A4C":"⩌","\u2A50":"⩐",\u010B:"ċ","\u29B2":"⦲","\xA2":"¢","\u{1D520}":"𝔠",\u0447:"ч","\u2713":"✓",\u03C7:"χ","\u25CB":"○","\u29C3":"⧃","\u02C6":"ˆ","\u2257":"≗","\u21BA":"↺","\u21BB":"↻","\u24C8":"Ⓢ","\u229B":"⊛","\u229A":"⊚","\u229D":"⊝","\u2A10":"⨐","\u2AEF":"⫯","\u29C2":"⧂","\u2663":"♣",":":":",",":",","@":"@","\u2201":"∁","\u2A6D":"⩭","\u{1D554}":"𝕔","\u2117":"℗","\u21B5":"↵","\u2717":"✗","\u{1D4B8}":"𝒸","\u2ACF":"⫏","\u2AD1":"⫑","\u2AD0":"⫐","\u2AD2":"⫒","\u22EF":"⋯","\u2938":"⤸","\u2935":"⤵","\u22DE":"⋞","\u22DF":"⋟","\u21B6":"↶","\u293D":"⤽","\u222A":"∪","\u2A48":"⩈","\u2A46":"⩆","\u2A4A":"⩊","\u228D":"⊍","\u2A45":"⩅","\u222A\uFE00":"∪︀","\u21B7":"↷","\u293C":"⤼","\u22CE":"⋎","\u22CF":"⋏","\xA4":"¤","\u2231":"∱","\u232D":"⌭","\u2965":"⥥","\u2020":"†",\u2138:"ℸ","\u2010":"‐","\u290F":"⤏",\u010F:"ď",\u0434:"д","\u21CA":"⇊","\u2A77":"⩷","\xB0":"°",\u03B4:"δ","\u29B1":"⦱","\u297F":"⥿","\u{1D521}":"𝔡","\u2666":"♦",\u03DD:"ϝ","\u22F2":"⋲","\xF7":"÷","\u22C7":"⋇",\u0452:"ђ","\u231E":"⌞","\u230D":"⌍",$:"$","\u{1D555}":"𝕕","\u2251":"≑","\u2238":"∸","\u2214":"∔","\u22A1":"⊡","\u231F":"⌟","\u230C":"⌌","\u{1D4B9}":"𝒹",\u0455:"ѕ","\u29F6":"⧶",\u0111:"đ","\u22F1":"⋱","\u25BF":"▿","\u29A6":"⦦",\u045F:"џ","\u27FF":"⟿",\u00E9:"é","\u2A6E":"⩮",\u011B:"ě","\u2256":"≖",\u00EA:"ê","\u2255":"≕",\u044D:"э",\u0117:"ė","\u2252":"≒","\u{1D522}":"𝔢","\u2A9A":"⪚",\u00E8:"è","\u2A96":"⪖","\u2A98":"⪘","\u2A99":"⪙","\u23E7":"⏧",\u2113:"ℓ","\u2A95":"⪕","\u2A97":"⪗",\u0113:"ē","\u2205":"∅","\u2004":" ","\u2005":" ","\u2003":" ",\u014B:"ŋ","\u2002":" ",\u0119:"ę","\u{1D556}":"𝕖","\u22D5":"⋕","\u29E3":"⧣","\u2A71":"⩱",\u03B5:"ε","\u03F5":"ϵ","=":"=","\u225F":"≟","\u2A78":"⩸","\u29E5":"⧥","\u2253":"≓","\u2971":"⥱",\u212F:"ℯ",\u03B7:"η",\u00F0:"ð",\u00EB:"ë","\u20AC":"€","!":"!",\u0444:"ф","\u2640":"♀",\uFB03:"ffi",\uFB00:"ff",\uFB04:"ffl","\u{1D523}":"𝔣",\uFB01:"fi",fj:"fj","\u266D":"♭",\uFB02:"fl","\u25B1":"▱",\u0192:"ƒ","\u{1D557}":"𝕗","\u22D4":"⋔","\u2AD9":"⫙","\u2A0D":"⨍","\xBD":"½","\u2153":"⅓","\xBC":"¼","\u2155":"⅕","\u2159":"⅙","\u215B":"⅛","\u2154":"⅔","\u2156":"⅖","\xBE":"¾","\u2157":"⅗","\u215C":"⅜","\u2158":"⅘","\u215A":"⅚","\u215D":"⅝","\u215E":"⅞","\u2044":"⁄","\u2322":"⌢","\u{1D4BB}":"𝒻","\u2A8C":"⪌",\u01F5:"ǵ",\u03B3:"γ","\u2A86":"⪆",\u011F:"ğ",\u011D:"ĝ",\u0433:"г",\u0121:"ġ","\u2AA9":"⪩","\u2A80":"⪀","\u2A82":"⪂","\u2A84":"⪄","\u22DB\uFE00":"⋛︀","\u2A94":"⪔","\u{1D524}":"𝔤",\u2137:"ℷ",\u0453:"ѓ","\u2A92":"⪒","\u2AA5":"⪥","\u2AA4":"⪤","\u2269":"≩","\u2A8A":"⪊","\u2A88":"⪈","\u22E7":"⋧","\u{1D558}":"𝕘",\u210A:"ℊ","\u2A8E":"⪎","\u2A90":"⪐","\u2AA7":"⪧","\u2A7A":"⩺","\u22D7":"⋗","\u2995":"⦕","\u2A7C":"⩼","\u2978":"⥸","\u2269\uFE00":"≩︀",\u044A:"ъ","\u2948":"⥈","\u21AD":"↭",\u210F:"ℏ",\u0125:"ĥ","\u2665":"♥","\u2026":"…","\u22B9":"⊹","\u{1D525}":"𝔥","\u2925":"⤥","\u2926":"⤦","\u21FF":"⇿","\u223B":"∻","\u21A9":"↩","\u21AA":"↪","\u{1D559}":"𝕙","\u2015":"―","\u{1D4BD}":"𝒽",\u0127:"ħ","\u2043":"⁃",\u00ED:"í",\u00EE:"î",\u0438:"и",\u0435:"е","\xA1":"¡","\u{1D526}":"𝔦",\u00EC:"ì","\u2A0C":"⨌","\u222D":"∭","\u29DC":"⧜","\u2129":"℩",\u0133:"ij",\u012B:"ī",\u0131:"ı","\u22B7":"⊷",\u01B5:"Ƶ","\u2105":"℅","\u221E":"∞","\u29DD":"⧝","\u22BA":"⊺","\u2A17":"⨗","\u2A3C":"⨼",\u0451:"ё",\u012F:"į","\u{1D55A}":"𝕚",\u03B9:"ι","\xBF":"¿","\u{1D4BE}":"𝒾","\u22F9":"⋹","\u22F5":"⋵","\u22F4":"⋴","\u22F3":"⋳",\u0129:"ĩ",\u0456:"і",\u00EF:"ï",\u0135:"ĵ",\u0439:"й","\u{1D527}":"𝔧","\u0237":"ȷ","\u{1D55B}":"𝕛","\u{1D4BF}":"𝒿",\u0458:"ј",\u0454:"є",\u03BA:"κ",\u03F0:"ϰ",\u0137:"ķ",\u043A:"к","\u{1D528}":"𝔨",\u0138:"ĸ",\u0445:"х",\u045C:"ќ","\u{1D55C}":"𝕜","\u{1D4C0}":"𝓀","\u291B":"⤛","\u290E":"⤎","\u2A8B":"⪋","\u2962":"⥢",\u013A:"ĺ","\u29B4":"⦴",\u03BB:"λ","\u2991":"⦑","\u2A85":"⪅","\xAB":"«","\u291F":"⤟","\u291D":"⤝","\u21AB":"↫","\u2939":"⤹","\u2973":"⥳","\u21A2":"↢","\u2AAB":"⪫","\u2919":"⤙","\u2AAD":"⪭","\u2AAD\uFE00":"⪭︀","\u290C":"⤌","\u2772":"❲","{":"{","[":"[","\u298B":"⦋","\u298F":"⦏","\u298D":"⦍",\u013E:"ľ",\u013C:"ļ",\u043B:"л","\u2936":"⤶","\u2967":"⥧","\u294B":"⥋","\u21B2":"↲","\u2264":"≤","\u21C7":"⇇","\u22CB":"⋋","\u2AA8":"⪨","\u2A7F":"⩿","\u2A81":"⪁","\u2A83":"⪃","\u22DA\uFE00":"⋚︀","\u2A93":"⪓","\u22D6":"⋖","\u297C":"⥼","\u{1D529}":"𝔩","\u2A91":"⪑","\u296A":"⥪","\u2584":"▄",\u0459:"љ","\u296B":"⥫","\u25FA":"◺",\u0140:"ŀ","\u23B0":"⎰","\u2268":"≨","\u2A89":"⪉","\u2A87":"⪇","\u22E6":"⋦","\u27EC":"⟬","\u21FD":"⇽","\u27FC":"⟼","\u21AC":"↬","\u2985":"⦅","\u{1D55D}":"𝕝","\u2A2D":"⨭","\u2A34":"⨴","\u2217":"∗","\u25CA":"◊","(":"(","\u2993":"⦓","\u296D":"⥭","\u200E":"‎","\u22BF":"⊿","\u2039":"‹","\u{1D4C1}":"𝓁","\u2A8D":"⪍","\u2A8F":"⪏","\u201A":"‚",\u0142:"ł","\u2AA6":"⪦","\u2A79":"⩹","\u22C9":"⋉","\u2976":"⥶","\u2A7B":"⩻","\u2996":"⦖","\u25C3":"◃","\u294A":"⥊","\u2966":"⥦","\u2268\uFE00":"≨︀","\u223A":"∺","\xAF":"¯","\u2642":"♂","\u2720":"✠","\u25AE":"▮","\u2A29":"⨩",\u043C:"м","\u2014":"—","\u{1D52A}":"𝔪","\u2127":"℧",\u00B5:"µ","\u2AF0":"⫰","\u2212":"−","\u2A2A":"⨪","\u2ADB":"⫛","\u22A7":"⊧","\u{1D55E}":"𝕞","\u{1D4C2}":"𝓂",\u03BC:"μ","\u22B8":"⊸","\u22D9\u0338":"⋙̸","\u226B\u20D2":"≫⃒","\u21CD":"⇍","\u21CE":"⇎","\u22D8\u0338":"⋘̸","\u226A\u20D2":"≪⃒","\u21CF":"⇏","\u22AF":"⊯","\u22AE":"⊮",\u0144:"ń","\u2220\u20D2":"∠⃒","\u2A70\u0338":"⩰̸","\u224B\u0338":"≋̸",\u0149:"ʼn","\u266E":"♮","\u2A43":"⩃",\u0148:"ň",\u0146:"ņ","\u2A6D\u0338":"⩭̸","\u2A42":"⩂",\u043D:"н","\u2013":"–","\u21D7":"⇗","\u2924":"⤤","\u2250\u0338":"≐̸","\u2928":"⤨","\u{1D52B}":"𝔫","\u21AE":"↮","\u2AF2":"⫲","\u22FC":"⋼","\u22FA":"⋺",\u045A:"њ","\u2266\u0338":"≦̸","\u219A":"↚","\u2025":"‥","\u{1D55F}":"𝕟","\xAC":"¬","\u22F9\u0338":"⋹̸","\u22F5\u0338":"⋵̸","\u22F7":"⋷","\u22F6":"⋶","\u22FE":"⋾","\u22FD":"⋽","\u2AFD\u20E5":"⫽⃥","\u2202\u0338":"∂̸","\u2A14":"⨔","\u219B":"↛","\u2933\u0338":"⤳̸","\u219D\u0338":"↝̸","\u{1D4C3}":"𝓃","\u2284":"⊄","\u2AC5\u0338":"⫅̸","\u2285":"⊅","\u2AC6\u0338":"⫆̸",\u00F1:"ñ",\u03BD:"ν","#":"#","\u2116":"№","\u2007":" ","\u22AD":"⊭","\u2904":"⤄","\u224D\u20D2":"≍⃒","\u22AC":"⊬","\u2265\u20D2":"≥⃒",">\u20D2":">⃒","\u29DE":"⧞","\u2902":"⤂","\u2264\u20D2":"≤⃒","<\u20D2":"<⃒","\u22B4\u20D2":"⊴⃒","\u2903":"⤃","\u22B5\u20D2":"⊵⃒","\u223C\u20D2":"∼⃒","\u21D6":"⇖","\u2923":"⤣","\u2927":"⤧",\u00F3:"ó",\u00F4:"ô",\u043E:"о",\u0151:"ő","\u2A38":"⨸","\u29BC":"⦼",\u0153:"œ","\u29BF":"⦿","\u{1D52C}":"𝔬","\u02DB":"˛",\u00F2:"ò","\u29C1":"⧁","\u29B5":"⦵","\u29BE":"⦾","\u29BB":"⦻","\u29C0":"⧀",\u014D:"ō",\u03C9:"ω",\u03BF:"ο","\u29B6":"⦶","\u{1D560}":"𝕠","\u29B7":"⦷","\u29B9":"⦹","\u2228":"∨","\u2A5D":"⩝",\u2134:"ℴ",\u00AA:"ª",\u00BA:"º","\u22B6":"⊶","\u2A56":"⩖","\u2A57":"⩗","\u2A5B":"⩛",\u00F8:"ø","\u2298":"⊘",\u00F5:"õ","\u2A36":"⨶",\u00F6:"ö","\u233D":"⌽","\xB6":"¶","\u2AF3":"⫳","\u2AFD":"⫽",\u043F:"п","%":"%",".":".","\u2030":"‰","\u2031":"‱","\u{1D52D}":"𝔭",\u03C6:"φ",\u03D5:"ϕ","\u260E":"☎",\u03C0:"π",\u03D6:"ϖ",\u210E:"ℎ","+":"+","\u2A23":"⨣","\u2A22":"⨢","\u2A25":"⨥","\u2A72":"⩲","\u2A26":"⨦","\u2A27":"⨧","\u2A15":"⨕","\u{1D561}":"𝕡","\xA3":"£","\u2AB3":"⪳","\u2AB7":"⪷","\u2AB9":"⪹","\u2AB5":"⪵","\u22E8":"⋨","\u2032":"′","\u232E":"⌮","\u2312":"⌒","\u2313":"⌓","\u22B0":"⊰","\u{1D4C5}":"𝓅",\u03C8:"ψ","\u2008":" ","\u{1D52E}":"𝔮","\u{1D562}":"𝕢","\u2057":"⁗","\u{1D4C6}":"𝓆","\u2A16":"⨖","?":"?","\u291C":"⤜","\u2964":"⥤","\u223D\u0331":"∽̱",\u0155:"ŕ","\u29B3":"⦳","\u2992":"⦒","\u29A5":"⦥","\xBB":"»","\u2975":"⥵","\u2920":"⤠","\u2933":"⤳","\u291E":"⤞","\u2945":"⥅","\u2974":"⥴","\u21A3":"↣","\u219D":"↝","\u291A":"⤚","\u2236":"∶","\u2773":"❳","}":"}","]":"]","\u298C":"⦌","\u298E":"⦎","\u2990":"⦐",\u0159:"ř",\u0157:"ŗ",\u0440:"р","\u2937":"⤷","\u2969":"⥩","\u21B3":"↳","\u25AD":"▭","\u297D":"⥽","\u{1D52F}":"𝔯","\u296C":"⥬",\u03C1:"ρ",\u03F1:"ϱ","\u21C9":"⇉","\u22CC":"⋌","\u02DA":"˚","\u200F":"‏","\u23B1":"⎱","\u2AEE":"⫮","\u27ED":"⟭","\u21FE":"⇾","\u2986":"⦆","\u{1D563}":"𝕣","\u2A2E":"⨮","\u2A35":"⨵",")":")","\u2994":"⦔","\u2A12":"⨒","\u203A":"›","\u{1D4C7}":"𝓇","\u22CA":"⋊","\u25B9":"▹","\u29CE":"⧎","\u2968":"⥨","\u211E":"℞",\u015B:"ś","\u2AB4":"⪴","\u2AB8":"⪸",\u0161:"š",\u015F:"ş",\u015D:"ŝ","\u2AB6":"⪶","\u2ABA":"⪺","\u22E9":"⋩","\u2A13":"⨓",\u0441:"с","\u22C5":"⋅","\u2A66":"⩦","\u21D8":"⇘","\xA7":"§",";":";","\u2929":"⤩","\u2736":"✶","\u{1D530}":"𝔰","\u266F":"♯",\u0449:"щ",\u0448:"ш","\xAD":"­",\u03C3:"σ",\u03C2:"ς","\u2A6A":"⩪","\u2A9E":"⪞","\u2AA0":"⪠","\u2A9D":"⪝","\u2A9F":"⪟","\u2246":"≆","\u2A24":"⨤","\u2972":"⥲","\u2A33":"⨳","\u29E4":"⧤","\u2323":"⌣","\u2AAA":"⪪","\u2AAC":"⪬","\u2AAC\uFE00":"⪬︀",\u044C:"ь","/":"/","\u29C4":"⧄","\u233F":"⌿","\u{1D564}":"𝕤","\u2660":"♠","\u2293\uFE00":"⊓︀","\u2294\uFE00":"⊔︀","\u{1D4C8}":"𝓈","\u2606":"☆","\u2282":"⊂","\u2AC5":"⫅","\u2ABD":"⪽","\u2AC3":"⫃","\u2AC1":"⫁","\u2ACB":"⫋","\u228A":"⊊","\u2ABF":"⪿","\u2979":"⥹","\u2AC7":"⫇","\u2AD5":"⫕","\u2AD3":"⫓","\u266A":"♪","\xB9":"¹","\xB2":"²","\xB3":"³","\u2AC6":"⫆","\u2ABE":"⪾","\u2AD8":"⫘","\u2AC4":"⫄","\u27C9":"⟉","\u2AD7":"⫗","\u297B":"⥻","\u2AC2":"⫂","\u2ACC":"⫌","\u228B":"⊋","\u2AC0":"⫀","\u2AC8":"⫈","\u2AD4":"⫔","\u2AD6":"⫖","\u21D9":"⇙","\u292A":"⤪",\u00DF:"ß","\u2316":"⌖",\u03C4:"τ",\u0165:"ť",\u0163:"ţ",\u0442:"т","\u2315":"⌕","\u{1D531}":"𝔱",\u03B8:"θ",\u03D1:"ϑ",\u00FE:"þ","\xD7":"×","\u2A31":"⨱","\u2A30":"⨰","\u2336":"⌶","\u2AF1":"⫱","\u{1D565}":"𝕥","\u2ADA":"⫚","\u2034":"‴","\u25B5":"▵","\u225C":"≜","\u25EC":"◬","\u2A3A":"⨺","\u2A39":"⨹","\u29CD":"⧍","\u2A3B":"⨻","\u23E2":"⏢","\u{1D4C9}":"𝓉",\u0446:"ц",\u045B:"ћ",\u0167:"ŧ","\u2963":"⥣",\u00FA:"ú",\u045E:"ў",\u016D:"ŭ",\u00FB:"û",\u0443:"у",\u0171:"ű","\u297E":"⥾","\u{1D532}":"𝔲",\u00F9:"ù","\u2580":"▀","\u231C":"⌜","\u230F":"⌏","\u25F8":"◸",\u016B:"ū",\u0173:"ų","\u{1D566}":"𝕦",\u03C5:"υ","\u21C8":"⇈","\u231D":"⌝","\u230E":"⌎",\u016F:"ů","\u25F9":"◹","\u{1D4CA}":"𝓊","\u22F0":"⋰",\u0169:"ũ",\u00FC:"ü","\u29A7":"⦧","\u2AE8":"⫨","\u2AE9":"⫩","\u299C":"⦜","\u228A\uFE00":"⊊︀","\u2ACB\uFE00":"⫋︀","\u228B\uFE00":"⊋︀","\u2ACC\uFE00":"⫌︀",\u0432:"в","\u22BB":"⊻","\u225A":"≚","\u22EE":"⋮","\u{1D533}":"𝔳","\u{1D567}":"𝕧","\u{1D4CB}":"𝓋","\u299A":"⦚",\u0175:"ŵ","\u2A5F":"⩟","\u2259":"≙","\u2118":"℘","\u{1D534}":"𝔴","\u{1D568}":"𝕨","\u{1D4CC}":"𝓌","\u{1D535}":"𝔵",\u03BE:"ξ","\u22FB":"⋻","\u{1D569}":"𝕩","\u{1D4CD}":"𝓍",\u00FD:"ý",\u044F:"я",\u0177:"ŷ",\u044B:"ы","\xA5":"¥","\u{1D536}":"𝔶",\u0457:"ї","\u{1D56A}":"𝕪","\u{1D4CE}":"𝓎",\u044E:"ю",\u00FF:"ÿ",\u017A:"ź",\u017E:"ž",\u0437:"з",\u017C:"ż",\u03B6:"ζ","\u{1D537}":"𝔷",\u0436:"ж","\u21DD":"⇝","\u{1D56B}":"𝕫","\u{1D4CF}":"𝓏","\u200D":"‍","\u200C":"‌"}}}});var Qv=_(Pp=>{"use strict";Object.defineProperty(Pp,"__esModule",{value:!0});Pp.numericUnicodeMap={0:65533,128:8364,130:8218,131:402,132:8222,133:8230,134:8224,135:8225,136:710,137:8240,138:352,139:8249,140:338,142:381,145:8216,146:8217,147:8220,148:8221,149:8226,150:8211,151:8212,152:732,153:8482,154:353,155:8250,156:339,158:382,159:376}});var $v=_(ea=>{"use strict";Object.defineProperty(ea,"__esModule",{value:!0});ea.fromCodePoint=String.fromCodePoint||function(n){return String.fromCharCode(Math.floor((n-65536)/1024)+55296,(n-65536)%1024+56320)};ea.getCodePoint=String.prototype.codePointAt?function(n,e){return n.codePointAt(e)}:function(n,e){return(n.charCodeAt(e)-55296)*1024+n.charCodeAt(e+1)-56320+65536};ea.highSurrogateFrom=55296;ea.highSurrogateTo=56319});var ow=_(jo=>{"use strict";var ta=jo&&jo.__assign||function(){return ta=Object.assign||function(n){for(var e,t=1,i=arguments.length;t'"&]/g,nonAscii:/[<>'"&\u0080-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/g,nonAsciiPrintable:/[<>'"&\x01-\x08\x11-\x15\x17-\x1F\x7f-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/g,nonAsciiPrintableOnly:/[\x01-\x08\x11-\x15\x17-\x1F\x7f-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/g,extensive:/[\x01-\x0c\x0e-\x1f\x21-\x2c\x2e-\x2f\x3a-\x40\x5b-\x60\x7b-\x7d\x7f-\uD7FF\uE000-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/g},gk={mode:"specialChars",level:"all",numeric:"decimal"};function mk(n,e){var t=e===void 0?gk:e,i=t.mode,r=i===void 0?"specialChars":i,o=t.numeric,s=o===void 0?"decimal":o,a=t.level,c=a===void 0?"all":a;if(!n)return"";var l=pk[r],d=Sp[c].characters,h=s==="hexadecimal";return iw(n,l,(function(u){var p=d[u];if(!p){var f=u.length>1?tw.getCodePoint(u,0):u.charCodeAt(0);p=(h?"&#x"+f.toString(16):"&#"+f)+";"}return p}))}jo.encode=mk;var xk={scope:"body",level:"all"},kp=/&(?:#\d+|#[xX][\da-fA-F]+|[0-9a-zA-Z]+);/g,Cp=/&(?:#\d+|#[xX][\da-fA-F]+|[0-9a-zA-Z]+)[;=]?/g,ew={xml:{strict:kp,attribute:Cp,body:Fc.bodyRegExps.xml},html4:{strict:kp,attribute:Cp,body:Fc.bodyRegExps.html4},html5:{strict:kp,attribute:Cp,body:Fc.bodyRegExps.html5}},bk=ta(ta({},ew),{all:ew.html5}),nw=String.fromCharCode,yk=nw(65533),vk={level:"all"};function rw(n,e,t,i){var r=n,o=n[n.length-1];if(t&&o==="=")r=n;else if(i&&o!==";")r=n;else{var s=e[n];if(s)r=s;else if(n[0]==="&"&&n[1]==="#"){var a=n[2],c=a=="x"||a=="X"?parseInt(n.substr(3),16):parseInt(n.substr(2));r=c>=1114111?yk:c>65535?tw.fromCodePoint(c):nw(fk.numericUnicodeMap[c]||c)}}return r}function wk(n,e){var t=(e===void 0?vk:e).level,i=t===void 0?"all":t;return n?rw(n,Sp[i].entities,!1,!1):""}jo.decodeEntity=wk;function Fk(n,e){var t=e===void 0?xk:e,i=t.level,r=i===void 0?"all":i,o=t.scope,s=o===void 0?r==="xml"?"strict":"body":o;if(!n)return"";var a=bk[r][s],c=Sp[r].entities,l=s==="attribute",d=s==="strict";return iw(n,a,(function(h){return rw(h,c,l,d)}))}jo.decode=Fk});var Ap=_(pt=>{"use strict";Object.defineProperty(pt,"__esModule",{value:!0});pt.isBlock=pt.parse=pt.Matcher=pt.HTMLElement=pt.CommentNode=pt.TextNode=pt.AbstractNode=pt.NodeType=void 0;var ia=ow(),Ri=!1,At;(function(n){n[n.ELEMENT_NODE=1]="ELEMENT_NODE",n[n.TEXT_NODE=3]="TEXT_NODE",n[n.COMMENT_NODE=8]="COMMENT_NODE"})(At||(pt.NodeType=At={}));var Go=class{constructor(){this.childNodes=[]}get text(){return(0,ia.decode)(this.rawText)}remove(){return this.parentNode&&this.parentNode.removeChild(this),this}};pt.AbstractNode=Go;var Ko=class extends Go{constructor(e){super(),this.nodeType=At.TEXT_NODE,this.value=e}get rawText(){return this.value}get isWhitespace(){return/^(\s| )*$/.test(this.rawText)}toString(){return this.rawText}};pt.TextNode=Ko;var $h=class extends Go{constructor(e){super(),this.nodeType=At.COMMENT_NODE,this.value=e}get rawText(){return this.value}toString(){return``}};pt.CommentNode=$h;var Dk={div:!0,p:!0,li:!0,td:!0,section:!0,br:!0};function na(n){return n[n.length-1]}var ra=class n extends Go{constructor(e,t="",i=null){super(),this.tagName=e,this.rawAttrs=t,this.classNames=[],this.nodeType=At.ELEMENT_NODE,this.rawAttrs=t,this.parentNode=i,this.childNodes=[];let r={};for(let o;o=Pk.exec(t);)r[o[2]]=o[4]||o[5]||o[6];r.id&&(this.id=r.id),r.class&&(this.classNames=r.class.split(/\s+/))}removeChild(e){this.childNodes=this.childNodes.filter(t=>t!==e),e instanceof n&&(e.parentNode=null)}exchangeChild(e,t){let i=this.childNodes.findIndex(r=>r===e);i>=0&&(this.childNodes[i]=t,e instanceof n&&(e.parentNode=null))}get rawText(){let e="";for(let t=0;t0&&t.push(e=[]),r.childNodes.forEach(i),e.length>0&&t.push(e=[])):r.childNodes.forEach(i);else if(r.nodeType===At.TEXT_NODE)if(r.isWhitespace)e.prependWhitespace=!0;else{let o=r.text;e.prependWhitespace&&(o=" "+o,e.prependWhitespace=!1),e.push(o)}}return i(this),t.map(function(r){return r.join("").trim().replace(/\s{2,}/g," ")}).join(` `).replace(/\s+$/,"")}get children(){return this.childNodes.filter(e=>e instanceof n)}toString(){let e=this.tagName;if(e){let t=/^(img|br|hr|area|base|input|doctype|link|meta)$/i.test(e),i=this.rawAttrs?" "+this.rawAttrs:"";return t?`<${e}${i} />`:`<${e}${i}>${this.innerHTML}`}else return this.innerHTML}get innerHTML(){return this.childNodes.map(e=>e.toString()).join("")}set innerHTML(e){let t=Tp(e);this.childNodes.forEach(i=>i.remove()),t.childNodes.forEach(i=>this.appendChild(i))}set_content(e){if(e instanceof Go)e=[e];else if(typeof e=="string"){let t=Tp(e);e=t.childNodes.length?t.childNodes:[new Ko(e)]}this.childNodes=e}get outerHTML(){return this.toString()}trimRight(e){for(let t=0;t-1&&(i.value=i.rawText.substr(0,r),this.childNodes.length=t+1)}}return this}get structure(){let e=[],t=0;function i(o){e.push(" ".repeat(t)+o)}function r(o){let s=o.id?"#"+o.id:"",a=o.classNames.length?"."+o.classNames.join("."):"";i(o.tagName+s+a),t++;for(let c=0;cthis.querySelectorAll(a.trim())).flat());return Array.from(s)}else return this.querySelectorAll(new Wo(e));let t=e,i=new Set,r=[];for(this.childNodes.forEach(o=>r.push(o));r.length>0;){let o=r.shift();o.nodeType===At.ELEMENT_NODE&&(t.advance(o)&&t.matched&&(i.add(o),t.rewind()),o.childNodes.forEach(s=>{r.push(s)}))}return Array.from(i)}querySelector(e){let t;e instanceof Wo?(t=e,t.reset()):t=new Wo(e);let i=[];for(let r=0;rr+(i[r]===""?"":'="'+(0,ia.encode)(i[r])+'"')).join(" ")}removeAttribute(e){this.setAttribute(e,void 0)}setAttributes(e){e.id?this.id=e.id:e.class&&(this.classNames=e.class.split(/\s+/)),this.attributes&&(Object.keys(this.attributes).forEach(t=>delete this.attributes[t]),Object.keys(e).forEach(t=>this.attributes[t]=e[t]+"")),this.rawAttributes&&(Object.keys(this.rawAttributes).forEach(t=>delete this.rawAttributes[t]),Object.keys(e).forEach(t=>this.rawAttributes[t]=(0,ia.encode)(e[t]+""))),this.rawAttrs=Object.keys(e).map(t=>t+(e[t]===""?"":'="'+(0,ia.encode)(e[t]+"")+'"')).join(" ")}};pt.HTMLElement=ra;var Qh={},Ep={f145:function(n,e,t,i,r){"use strict";if(e=e||"",t=t||[],i=i||"",r=r||"",n.id!=e.substr(1))return!1;for(let o=t,s=0;s{if(Qh[t])return Qh[t];let i=t.split("."),r=i[0],o=i.slice(1).sort(),s='"use strict";',a="f",c="",l="";if(r&&r!="*"){let h;if(r[0]=="#")s+="if (el.id != "+JSON.stringify(r.substr(1))+") return false;",a+="1";else if(h=r.match(/^\[\s*(\S+)\s*(=|!=)\s*((((["'])([^\6]*)\6))|(\S*?))\]\s*/)){c=h[1];let u=h[2];if(u!=="="&&u!=="!=")throw new Error("Selector not supported, Expect [key${op}value].op must be =,!=");u==="="&&(u="=="),l=h[7]||h[8],s+=`let attrs = el.attributes;for (let key in attrs){const val = attrs[key]; if (key == "${c}" && val == "${l}"){return true;}} return false;`,a+="2"}else s+="if (el.tagName != "+JSON.stringify(r)+") return false;",a+="3"}o.length>0&&(s+="for (let cls = "+JSON.stringify(o)+", i = 0; i < cls.length; i++) if (el.classNames.indexOf(cls[i]) === -1) return false;",a+="4"),s+="return true;",a+="5";let d={func:Ep[a],tagName:r||"",classes:o||"",attr_key:c||"",value:l||""};return s=s||"",Qh[t]=d})}advance(e){return this.nextMatch)-->|<(\/?)([a-z][-.:0-9_a-z]*)((\s+[a-z][-.:0-9_a-z]*(\s*=\s*("[^"]*"|'([^']*')|([^\s\/>]+)))?)*)\s*(\/?)>/ig,Pk=/(^|\s)(id|class)\s*=\s*("([^"]+)"|'([^']+)'|(\S+))/ig,kk=/([a-z][-.:0-9_a-z]*)(\s*=\s*("([^"]*)"|'([^']*)'|(\S+)))?/ig,Ck={area:!0,base:!0,br:!0,col:!0,hr:!0,img:!0,input:!0,link:!0,meta:!0,source:!0},sw={li:{li:!0},p:{p:!0,div:!0},b:{div:!0},td:{td:!0,th:!0},th:{td:!0,th:!0},h1:{h1:!0},h2:{h2:!0},h3:{h3:!0},h4:{h4:!0},h5:{h5:!0},h6:{h6:!0}},aw={li:{ul:!0,ol:!0},a:{div:!0},b:{div:!0},i:{div:!0},p:{div:!0},td:{tr:!0,table:!0},th:{tr:!0,table:!0}},Sk={script:!0,noscript:!0,style:!0,pre:!0};function Tp(n,e){let t=new ra(null),i=t,r=[t],o=0;e=e||{};let s;for(;s=Rn.exec(n);){if(Ri&&console.log("match",s[0]),o+s[0].length",c=n.indexOf(a,Rn.lastIndex);if(e[s[2]]){let l;c==-1?l=n.substr(Rn.lastIndex):l=n.substring(Rn.lastIndex,c),l.length>0&&(Ri&&console.log("add text node as child of",s[2]),i.appendChild(new Ko(l)))}c==-1?o=Rn.lastIndex=n.length+1:(o=Rn.lastIndex=c+a.length,s[1]="true")}if(s[1]||s[9]||Ck[s[2]])for(;;)if(i.tagName==s[2]){Ri&&console.log("met the end of",s[2]),r.pop(),i=na(r);break}else{if(aw[i.tagName]&&aw[i.tagName][s[2]]){Ri&&console.log("closing",i.tagName,"due to meeting",s[2]),r.pop(),i=na(r);continue}break}}for(o1;){let a=r.pop(),c=na(r);a.parentNode&&a.parentNode instanceof ra&&a.parentNode.parentNode&&(a.parentNode===c&&a.tagName===c.tagName?(Ri&&console.log(a.tagName,"is probably supposed to close",c.tagName),c.removeChild(a),a.childNodes.forEach(l=>{c.parentNode.appendChild(l)}),r.pop()):(Ri&&console.log("no close tag found for",a.tagName,". Removing"),c.removeChild(a),a.childNodes.forEach(l=>{c.appendChild(l)})))}return t}pt.parse=Tp;var Ek=["html","body","address","article","aside","blockquote","canvas","dd","div","dl","dt","fieldset","figcaption","figure","footer","form","header","hr","li","main","nav","noscript","ol","p","pre","section","tfoot","table","tbody","ul","video","th","td","tr","h1","h2","h3","h4","h5","h6"];function Tk(n){return n.nodeType===At.ELEMENT_NODE&&n.tagName&&Ek.includes(n.tagName.toLowerCase())}pt.isBlock=Tk});var LC={};vf(LC,{default:()=>bf});module.exports=M1(LC);var we=require("obsidian");var Qp={};vf(Qp,{AFRelationship:()=>Hs,AcroButtonFlags:()=>yt,AcroChoiceFlags:()=>me,AcroFieldFlags:()=>Kt,AcroTextFlags:()=>Ne,AnnotationFlags:()=>Ro,AppearanceCharacteristics:()=>Ms,BlendMode:()=>Re,Cache:()=>ht,CharCodes:()=>P,ColorTypes:()=>Tt,CombedTextLayoutError:()=>Oc,CorruptPageTreeError:()=>Es,CustomFontEmbedder:()=>Dr,CustomFontSubsetEmbedder:()=>Wd,Duplex:()=>Vs,EncryptedPDFError:()=>Xo,ExceededMaxLengthError:()=>Lc,FieldAlreadyExistsError:()=>la,FieldExistsAsNonTerminalError:()=>Hp,FileEmbedder:()=>Kd,FillRule:()=>sn,FontkitNotRegisteredError:()=>Sc,ForeignPageError:()=>Ec,ImageAlignment:()=>vi,IndexOutOfBoundsError:()=>kn,InvalidAcroFieldValueError:()=>Cn,InvalidFieldNamePartError:()=>Ic,InvalidMaxLengthError:()=>Mc,InvalidPDFDateStringError:()=>co,InvalidTargetIndexError:()=>Ss,JpegEmbedder:()=>Us,LineCapStyle:()=>fi,LineJoinStyle:()=>Vo,MethodNotImplementedError:()=>Ze,MissingCatalogError:()=>S0,MissingDAEntryError:()=>vl,MissingKeywordError:()=>Tl,MissingOnValueCheckError:()=>Vp,MissingPDFHeaderError:()=>El,MissingPageContentsEmbeddingError:()=>gl,MissingTfOperatorError:()=>wl,MultiSelectValueError:()=>yl,NextByteAssertionError:()=>Fl,NoSuchFieldError:()=>Ac,NonFullScreenPageMode:()=>So,NumberParsingError:()=>Ts,PDFAcroButton:()=>mr,PDFAcroCheckBox:()=>En,PDFAcroChoice:()=>Ns,PDFAcroComboBox:()=>Tn,PDFAcroField:()=>Ls,PDFAcroForm:()=>br,PDFAcroListBox:()=>Ln,PDFAcroNonTerminal:()=>An,PDFAcroPushButton:()=>Bn,PDFAcroRadioButton:()=>On,PDFAcroSignature:()=>xr,PDFAcroTerminal:()=>zt,PDFAcroText:()=>In,PDFAnnotation:()=>Vd,PDFArray:()=>Z,PDFArrayIsNotRectangleError:()=>bl,PDFBool:()=>Li,PDFButton:()=>ki,PDFCatalog:()=>yr,PDFCheckBox:()=>_t,PDFContentStream:()=>en,PDFContext:()=>po,PDFCrossRefSection:()=>mo,PDFCrossRefStream:()=>Ud,PDFDict:()=>W,PDFDocument:()=>We,PDFDropdown:()=>Fi,PDFEmbeddedPage:()=>Hi,PDFField:()=>at,PDFFlateStream:()=>fr,PDFFont:()=>Me,PDFForm:()=>Hn,PDFHeader:()=>$i,PDFHexString:()=>K,PDFImage:()=>yi,PDFInvalidObject:()=>Os,PDFInvalidObjectParsingError:()=>Pl,PDFJavaScript:()=>zn,PDFName:()=>v,PDFNull:()=>He,PDFNumber:()=>G,PDFObject:()=>Se,PDFObjectCopier:()=>Hl,PDFObjectParser:()=>Ks,PDFObjectParsingError:()=>Dl,PDFObjectStream:()=>Is,PDFObjectStreamParser:()=>Yd,PDFOperator:()=>le,PDFOperatorNames:()=>ce,PDFOptionList:()=>Di,PDFPage:()=>Oe,PDFPageEmbedder:()=>Ws,PDFPageLeaf:()=>et,PDFPageTree:()=>vr,PDFParser:()=>sc,PDFParsingError:()=>Oi,PDFRadioGroup:()=>Jt,PDFRawStream:()=>Mi,PDFRef:()=>Y,PDFSecurity:()=>Nh,PDFSignature:()=>zi,PDFStream:()=>Ee,PDFStreamParsingError:()=>kl,PDFStreamWriter:()=>qd,PDFString:()=>J,PDFSvg:()=>pi,PDFTextField:()=>Pi,PDFTrailer:()=>gr,PDFTrailerDict:()=>Nd,PDFWidgetAnnotation:()=>bo,PDFWriter:()=>Bs,PDFXRefStreamParser:()=>_d,PageEmbeddingMismatchedContextError:()=>xl,PageSizes:()=>Yo,ParseSpeeds:()=>Nc,PngEmbedder:()=>js,PrintScaling:()=>To,PrivateConstructorError:()=>Dn,ReadingDirection:()=>Eo,RemovePageFromEmptyDocumentError:()=>Tc,ReparseError:()=>Pn,RichTextFieldReadError:()=>Bc,RotationTypes:()=>Nn,StalledParserError:()=>Sl,StandardFontEmbedder:()=>Fr,StandardFontValues:()=>Rb,StandardFonts:()=>Zo,TextAlignment:()=>Ue,TextRenderingMode:()=>sp,UnbalancedParenthesisError:()=>Cl,UnexpectedFieldTypeError:()=>Vi,UnexpectedObjectTypeError:()=>Qi,UnrecognizedStreamTypeError:()=>ml,UnsupportedEncodingError:()=>pl,ViewerPreferences:()=>_l,addRandomSuffix:()=>R1,adjustDimsForRotation:()=>on,appendBezierCurve:()=>zo,appendQuadraticCurve:()=>Ys,arrayAsString:()=>xn,asNumber:()=>de,asPDFName:()=>Gs,asPDFNumber:()=>$,assertEachIs:()=>dl,assertInteger:()=>C0,assertIs:()=>T,assertIsOneOf:()=>li,assertIsOneOfOrUndefined:()=>xt,assertIsSubset:()=>k0,assertMultiple:()=>hl,assertOrUndefined:()=>H,assertPositive:()=>Fn,assertRange:()=>bt,assertRangeOrUndefined:()=>Vt,backtick:()=>$e,beginMarkedContent:()=>qh,beginText:()=>gc,breakTextIntoLines:()=>Tf,byAscendingId:()=>Bf,byteArrayToHexString:()=>Vf,bytesFor:()=>or,canBeConvertedToUint8Array:()=>Rf,charAtIndex:()=>pd,charFromCode:()=>Mt,charFromHexCode:()=>Cf,charSplit:()=>Ef,cleanText:()=>ir,clip:()=>cc,clipEvenOdd:()=>RP,closePath:()=>Ar,cmyk:()=>Yh,colorString:()=>Dp,colorToComponents:()=>_h,componentsToColor:()=>vt,concatTransformationMatrix:()=>an,copyStringIntoBuffer:()=>Ae,createPDFAcroField:()=>Hd,createPDFAcroFields:()=>Rs,createTypeErrorMsg:()=>jb,createValueErrorMsg:()=>zb,decodeFromBase64:()=>Df,decodeFromBase64DataUri:()=>kf,decodePDFRawStream:()=>Pr,defaultButtonAppearanceProvider:()=>jp,defaultCheckBoxAppearanceProvider:()=>Up,defaultDropdownAppearanceProvider:()=>Kp,defaultOptionListAppearanceProvider:()=>Gp,defaultRadioGroupAppearanceProvider:()=>qp,defaultTextFieldAppearanceProvider:()=>Wp,degrees:()=>te,degreesToRadians:()=>hi,drawButton:()=>nu,drawCheckBox:()=>sa,drawCheckMark:()=>hw,drawEllipse:()=>Pc,drawImage:()=>kc,drawLine:()=>Np,drawLinesOfText:()=>Lp,drawObject:()=>Js,drawOptionList:()=>Rp,drawPage:()=>Mp,drawRadioButton:()=>aa,drawRectangle:()=>Or,drawSvgPath:()=>Cc,drawText:()=>zk,drawTextField:()=>ou,drawTextLines:()=>ru,encodeToBase64:()=>Pf,endMarkedContent:()=>jh,endPath:()=>fc,endText:()=>mc,error:()=>sr,escapeRegExp:()=>Pm,escapedNewlineChars:()=>km,fill:()=>ap,fillAndStroke:()=>cp,fillEvenOdd:()=>lp,findLastMatch:()=>us,getType:()=>Ub,grayscale:()=>Zh,hasSurrogates:()=>Uf,hasUtf16BOM:()=>ja,highSurrogate:()=>gd,isArrayEqual:()=>fs,isNewlineChar:()=>Sf,isStandardFont:()=>Ld,isType:()=>qb,isWithinBMP:()=>zf,last:()=>Qr,layoutCombedText:()=>zp,layoutMultilineText:()=>su,layoutSinglelineText:()=>ca,lineSplit:()=>Va,lineTo:()=>Je,lowSurrogate:()=>md,mergeIntoTypedArray:()=>Af,mergeLines:()=>fd,mergeUint8Arrays:()=>If,moveText:()=>qP,moveTo:()=>Ni,newlineChars:()=>V1,nextLine:()=>dp,normalizeAppearance:()=>Yt,numberToString:()=>qf,padStart:()=>Nt,parseDate:()=>Ha,pdfDocEncodingDecode:()=>ul,pluckIndices:()=>Nf,popGraphicsState:()=>_e,pushGraphicsState:()=>Ye,radians:()=>NP,radiansToDegrees:()=>Pv,range:()=>Mf,rectangle:()=>kv,rectanglesAreEqual:()=>Cs,reduceRotation:()=>ui,restoreDashPattern:()=>HP,reverseArray:()=>nr,rgb:()=>pe,rotateAndSkewTextDegreesAndTranslate:()=>XP,rotateAndSkewTextRadiansAndTranslate:()=>_s,rotateDegrees:()=>Zs,rotateInPlace:()=>mi,rotateRadians:()=>Xs,rotateRectangle:()=>op,scale:()=>Er,setCharacterSpacing:()=>jP,setCharacterSqueeze:()=>KP,setDashPattern:()=>hc,setFillingCmykColor:()=>mp,setFillingColor:()=>ln,setFillingGrayscaleColor:()=>up,setFillingRgbColor:()=>pp,setFontAndSize:()=>Uo,setGraphicsState:()=>Tr,setLineCap:()=>zh,setLineHeight:()=>hp,setLineJoin:()=>zP,setLineWidth:()=>Ho,setStrokingCmykColor:()=>xp,setStrokingColor:()=>qo,setStrokingGrayscaleColor:()=>fp,setStrokingRgbColor:()=>gp,setTextMatrix:()=>Cv,setTextRenderingMode:()=>Uh,setTextRise:()=>GP,setWordSpacing:()=>WP,showText:()=>pc,singleQuote:()=>Hb,sizeInBytes:()=>ps,skewDegrees:()=>VP,skewRadians:()=>dc,sortedUniq:()=>Of,square:()=>UP,stringAsByteArray:()=>hs,stroke:()=>uc,sum:()=>Lf,toCharCode:()=>ae,toCodePoint:()=>ud,toDegrees:()=>rn,toHexString:()=>Gi,toHexStringOfMinLength:()=>Ki,toRadians:()=>ut,toUint8Array:()=>$r,translate:()=>Ut,typedArrayFor:()=>za,utf16Decode:()=>qa,utf16Encode:()=>Hf,utf8Encode:()=>U1,values:()=>ks,waitForTick:()=>Ai});var ds="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",Ra=new Uint8Array(256);for(let n=0;n{let e="",t=n.length;for(let i=0;i>2],e+=ds[(n[i]&3)<<4|n[i+1]>>4],e+=ds[(n[i+1]&15)<<2|n[i+2]>>6],e+=ds[n[i+2]&63];return t%3===2?e=e.substring(0,e.length-1)+"=":t%3===1&&(e=e.substring(0,e.length-2)+"=="),e},Df=n=>{let e=n.length*.75,t=n.length,i,r=0,o,s,a,c;n[n.length-1]==="="&&(e--,n[n.length-2]==="="&&e--);let l=new Uint8Array(e);for(i=0;i>4,l[r++]=(s&15)<<4|a>>2,l[r++]=(a&3)<<6|c&63;return l},N1=/^(data)?:?([\w/+]+)?;?(charset=[\w-]+|base64)?.*,/i,kf=n=>{let e=n.trim(),i=e.substring(0,100).match(N1);if(!i)return Df(e);let[r]=i,o=e.substring(r.length);return Df(o)};var ae=n=>n.charCodeAt(0),ud=n=>n.codePointAt(0),Ki=(n,e)=>Nt(n.toString(16),e,"0").toUpperCase(),Gi=n=>Ki(n,2),Mt=n=>String.fromCharCode(n),Cf=n=>Mt(parseInt(n,16)),Nt=(n,e,t)=>{let i="";for(let r=0,o=e-n.length;r{let e=new Uint8Array(n.length);return Ae(n,e,0),e},Ae=(n,e,t)=>{let i=n.length;for(let r=0;r`${n}-${Math.floor(Math.random()*Math.pow(10,e))}`,Pm=n=>n.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),ir=n=>n.replace(/\t|\u0085|\u2028|\u2029/g," ").replace(/[\b\v]/g,""),km=["\\n","\\f","\\r","\\u000B"],V1=[` `,"\f","\r","\v"],Sf=n=>/^[\n\f\r\u000B]$/.test(n),Va=n=>n.split(/[\n\f\r\u000B]/),fd=n=>n.replace(/[\n\f\r\u000B]/g," "),pd=(n,e)=>{let t=n.charCodeAt(e),i,r=e+1,o=1;return t>=55296&&t<=56319&&n.length>r&&(i=n.charCodeAt(r),i>=56320&&i<=57343&&(o=2)),[n.slice(e,e+o),o]},Ef=n=>{let e=[];for(let t=0,i=n.length;t{let e=km.join("|"),t=["$"];for(let r=0,o=n.length;r{let r=H1(e),o=ir(n).match(r),s="",a=0,c=[],l=()=>{s!==""&&c.push(s),s="",a=0};for(let d=0,h=o.length;dt&&l(),s+=u,a+=p}}return l(),c},z1=/^D:(\d\d\d\d)(\d\d)?(\d\d)?(\d\d)?(\d\d)?(\d\d)?([+\-Z])?(\d\d)?'?(\d\d)?'?$/,Ha=n=>{let e=n.match(z1);if(!e)return;let[,t,i="01",r="01",o="00",s="00",a="00",c="Z",l="00",d="00"]=e,h=c==="Z"?"Z":`${c}${l}:${d}`;return new Date(`${t}-${i}-${r}T${o}:${s}:${a}${h}`)},us=(n,e)=>{var t;let i=0,r;for(;in[n.length-1],za=n=>{if(n instanceof Uint8Array)return n;let e=n.length,t=new Uint8Array(e);for(let i=0;i{let e=n.length,t=[];for(let s=0;s{let e=0;for(let r=0,o=n.length;r{let e="";for(let t=0,i=n.length;tn.id-e.id,Of=(n,e)=>{let t=[];for(let i=0,r=n.length;i{if(n.length!==e.length)return!1;for(let t=0,i=n.length;t{let e=n.length;for(let t=0,i=Math.floor(e/2);t{let e=0;for(let t=0,i=n.length;t{let t=new Array(e-n);for(let i=0,r=t.length;i{let t=new Array(e.length);for(let i=0,r=e.length;in instanceof Uint8Array||n instanceof ArrayBuffer||typeof n=="string",$r=n=>{if(typeof n=="string")return kf(n);if(n instanceof ArrayBuffer)return new Uint8Array(n);if(n instanceof Uint8Array)return n;throw new TypeError("`input` must be one of `string | ArrayBuffer | Uint8Array`")},Cm=[];for(let n=0;n<=255;++n)Cm[n]=n.toString(16).padStart(2,"0");var Vf=n=>{let e=new Array(n.length);for(let t=0;tnew Promise(n=>{setTimeout(()=>n(),0)});var U1=(n,e=!0)=>{let t=[];e&&t.push(239,187,191);for(let i=0,r=n.length;i>6&31|192,a=o&63|128;t.push(s,a),i+=1}else if(o<65536){let s=o>>12&15|224,a=o>>6&63|128,c=o&63|128;t.push(s,a,c),i+=1}else if(o<1114112){let s=o>>18&7|240,a=o>>12&63|128,c=o>>6&63|128,l=o>>0&63|128;t.push(s,a,c,l),i+=2}else throw new Error(`Invalid code point: 0x${Gi(o)}`)}return new Uint8Array(t)},Hf=(n,e=!0)=>{let t=[];e&&t.push(65279);for(let i=0,r=n.length;in>=0&&n<=65535,Uf=n=>n>=65536&&n<=1114111,gd=n=>Math.floor((n-65536)/1024)+55296,md=n=>(n-65536)%1024+56320,rr;(function(n){n.BigEndian="BigEndian",n.LittleEndian="LittleEndian"})(rr||(rr={}));var Ua="\uFFFD".codePointAt(0),qa=(n,e=!0)=>{if(n.length<=1)return String.fromCodePoint(Ua);let t=e?j1(n):rr.BigEndian,i=e?2:0,r=[];for(;n.length-i>=2;){let o=Em(n[i++],n[i++],t);if(q1(o))if(n.length-i<2)r.push(Ua);else{let s=Em(n[i++],n[i++],t);Sm(s)?r.push(o,s):r.push(Ua)}else Sm(o)?(i+=2,r.push(Ua)):r.push(o)}return in>=55296&&n<=56319,Sm=n=>n>=56320&&n<=57343,Em=(n,e,t)=>{if(t===rr.LittleEndian)return e<<8|n;if(t===rr.BigEndian)return n<<8|e;throw new Error(`Invalid byteOrder: ${t}`)},j1=n=>Tm(n)?rr.BigEndian:Am(n)?rr.LittleEndian:rr.BigEndian,Tm=n=>n[0]===254&&n[1]===255,Am=n=>n[0]===255&&n[1]===254,ja=n=>Tm(n)||Am(n);var qf=n=>{let e=String(n);if(Math.abs(n)<1){let t=parseInt(n.toString().split("e-")[1]);if(t){let i=n<0;i&&(n*=-1),n*=Math.pow(10,t-1),e="0."+new Array(t).join("0")+n.toString().substring(2),i&&(e="-"+e)}}else{let t=parseInt(n.toString().split("+")[1]);t>20&&(t-=20,n/=Math.pow(10,t),e=n.toString()+new Array(t+1).join("0"))}return e},ps=n=>Math.ceil(n.toString(2).length/8),or=n=>{let e=new Uint8Array(ps(n));for(let t=1;t<=e.length;t++)e[t-1]=n>>(e.length-t)*8;return e};var sr=n=>{throw new Error(n)};var bb=Wi(sl()),xb="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",ll=new Uint8Array(256);for(al=0;al>4,l[r++]=(s&15)<<4|a>>2,l[r++]=(a&3)<<6|c&63;return l},RD=function(n){for(var e="",t=0;tObject.keys(n).map(e=>n[e]),Rb=ks(lo),Ld=n=>Rb.includes(n),Cs=(n,e)=>n.x===e.x&&n.y===e.y&&n.width===e.width&&n.height===e.height;var $e=n=>`\`${n}\``,Hb=n=>`'${n}'`,Vb=n=>{let e=typeof n;return e==="string"?Hb(n):e==="undefined"?$e(n):n},zb=(n,e,t)=>{let i=new Array(t.length);for(let o=0,s=t.length;o{Array.isArray(t)||(t=ks(t));for(let i=0,r=t.length;i{Array.isArray(t)||(t=ks(t)),li(n,e,t.concat(void 0))},k0=(n,e,t)=>{Array.isArray(t)||(t=ks(t));for(let i=0,r=n.length;in===null?"null":n===void 0?"undefined":typeof n=="string"?"string":isNaN(n)?"NaN":typeof n=="number"?"number":typeof n=="boolean"?"boolean":typeof n=="symbol"?"symbol":typeof n=="bigint"?"bigint":n.constructor&&n.constructor.name?n.constructor.name:n.name?n.name:n.constructor?String(n.constructor):String(n),qb=(n,e)=>e==="null"?n===null:e==="undefined"?n===void 0:e==="string"?typeof n=="string":e==="number"?typeof n=="number"&&!isNaN(n):e==="boolean"?typeof n=="boolean":e==="symbol"?typeof n=="symbol":e==="bigint"?typeof n=="bigint":e===Date?n instanceof Date:e===Array?n instanceof Array:e===Uint8Array?n instanceof Uint8Array:e===ArrayBuffer?n instanceof ArrayBuffer:e===Function?n instanceof Function:n instanceof e[0],jb=(n,e,t)=>{let i=new Array(t.length);for(let o=0,s=t.length;o{for(let i=0,r=t.length;i{T(n,e,t.concat("undefined"))},dl=(n,e,t)=>{for(let i=0,r=n.length;i{if(T(n,e,["number"]),T(t,"min",["number"]),T(i,"max",["number"]),i=Math.max(t,i),ni)throw new Error(`${$e(e)} must be at least ${t} and at most ${i}, but was actually ${n}`)},Vt=(n,e,t,i)=>{T(n,e,["number","undefined"]),typeof n=="number"&&bt(n,e,t,i)},hl=(n,e,t)=>{if(T(n,e,["number"]),n%t!==0)throw new Error(`${$e(e)} must be a multiple of ${t}, but was actually ${n}`)},C0=(n,e)=>{if(!Number.isInteger(n))throw new Error(`${$e(e)} must be an integer, but was actually ${n}`)},Fn=(n,e)=>{if(![1,0].includes(Math.sign(n)))throw new Error(`${$e(e)} must be a positive number or 0, but was actually ${n}`)};var ue=new Uint16Array(256);for(let n=0;n<256;n++)ue[n]=n;ue[22]=ae("");ue[24]=ae("\u02D8");ue[25]=ae("\u02C7");ue[26]=ae("\u02C6");ue[27]=ae("\u02D9");ue[28]=ae("\u02DD");ue[29]=ae("\u02DB");ue[30]=ae("\u02DA");ue[31]=ae("\u02DC");ue[127]=ae("\uFFFD");ue[128]=ae("\u2022");ue[129]=ae("\u2020");ue[130]=ae("\u2021");ue[131]=ae("\u2026");ue[132]=ae("\u2014");ue[133]=ae("\u2013");ue[134]=ae("\u0192");ue[135]=ae("\u2044");ue[136]=ae("\u2039");ue[137]=ae("\u203A");ue[138]=ae("\u2212");ue[139]=ae("\u2030");ue[140]=ae("\u201E");ue[141]=ae("\u201C");ue[142]=ae("\u201D");ue[143]=ae("\u2018");ue[144]=ae("\u2019");ue[145]=ae("\u201A");ue[146]=ae("\u2122");ue[147]=ae("\uFB01");ue[148]=ae("\uFB02");ue[149]=ae("\u0141");ue[150]=ae("\u0152");ue[151]=ae("\u0160");ue[152]=ae("\u0178");ue[153]=ae("\u017D");ue[154]=ae("\u0131");ue[155]=ae("\u0142");ue[156]=ae("\u0153");ue[157]=ae("\u0161");ue[158]=ae("\u017E");ue[159]=ae("\uFFFD");ue[160]=ae("\u20AC");ue[173]=ae("\uFFFD");var ul=n=>{let e=new Array(n.length);for(let t=0,i=n.length;tnew fl(n);var ht=fl;var Ze=class extends Error{constructor(e,t){let i=`Method ${e}.${t}() not implemented`;super(i)}},Dn=class extends Error{constructor(e){let t=`Cannot construct ${e} - it has a private constructor`;super(t)}},Qi=class extends Error{constructor(e,t){let i=s=>{var a,c;return(a=s==null?void 0:s.name)!==null&&a!==void 0?a:(c=s==null?void 0:s.constructor)===null||c===void 0?void 0:c.name},o=`Expected instance of ${(Array.isArray(e)?e.map(i):[i(e)]).join(" or ")}, but got instance of ${t&&i(t)}`;super(o)}},pl=class extends Error{constructor(e){let t=`${e} stream encoding not supported`;super(t)}},Pn=class extends Error{constructor(e,t){let i=`Cannot call ${e}.${t}() more than once`;super(i)}},S0=class extends Error{constructor(e){let t=`Missing catalog (ref=${e})`;super(t)}},gl=class extends Error{constructor(){super("Can't embed page with missing Contents")}},ml=class extends Error{constructor(e){var t,i,r;let s=`Unrecognized stream type: ${(r=(i=(t=e==null?void 0:e.contructor)===null||t===void 0?void 0:t.name)!==null&&i!==void 0?i:e==null?void 0:e.name)!==null&&r!==void 0?r:e}`;super(s)}},xl=class extends Error{constructor(){super("Found mismatched contexts while embedding pages. All pages in the array passed to `PDFDocument.embedPages()` must be from the same document.")}},bl=class extends Error{constructor(e){let t=`Attempted to convert PDFArray with ${e} elements to rectangle, but must have exactly 4 elements.`;super(t)}},co=class extends Error{constructor(e){let t=`Attempted to convert "${e}" to a date, but it does not match the PDF date string format.`;super(t)}},Ss=class extends Error{constructor(e,t){let i=`Invalid targetIndex specified: targetIndex=${e} must be less than Count=${t}`;super(i)}},Es=class extends Error{constructor(e,t){let i=`Failed to ${t} at targetIndex=${e} due to corrupt page tree: It is likely that one or more 'Count' entries are invalid`;super(i)}},kn=class extends Error{constructor(e,t,i){let r=`index should be at least ${t} and at most ${i}, but was actually ${e}`;super(r)}},Cn=class extends Error{constructor(){super("Attempted to set invalid field value")}},yl=class extends Error{constructor(){super("Attempted to select multiple values for single-select field")}},vl=class extends Error{constructor(e){let t=`No /DA (default appearance) entry found for field: ${e}`;super(t)}},wl=class extends Error{constructor(e){let t=`No Tf operator found for DA of field: ${e}`;super(t)}},Ts=class extends Error{constructor(e,t){let i=`Failed to parse number (line:${e.line} col:${e.column} offset=${e.offset}): "${t}"`;super(i)}},Oi=class extends Error{constructor(e,t){let i=`Failed to parse PDF document (line:${e.line} col:${e.column} offset=${e.offset}): ${t}`;super(i)}},Fl=class extends Oi{constructor(e,t,i){let r=`Expected next byte to be ${t} but it was actually ${i}`;super(e,r)}},Dl=class extends Oi{constructor(e,t){let i=`Failed to parse PDF object starting with the following byte: ${t}`;super(e,i)}},Pl=class extends Oi{constructor(e){super(e,"Failed to parse invalid PDF object")}},kl=class extends Oi{constructor(e){super(e,"Failed to parse PDF stream")}},Cl=class extends Oi{constructor(e){super(e,"Failed to parse PDF literal string due to unbalanced parenthesis")}},Sl=class extends Oi{constructor(e){super(e,"Parser stalled")}},El=class extends Oi{constructor(e){super(e,"No PDF header found")}},Tl=class extends Oi{constructor(e,t){let i=`Did not find expected keyword '${xn(t)}'`;super(e,i)}};var E0;(function(n){n[n.Null=0]="Null",n[n.Backspace=8]="Backspace",n[n.Tab=9]="Tab",n[n.Newline=10]="Newline",n[n.FormFeed=12]="FormFeed",n[n.CarriageReturn=13]="CarriageReturn",n[n.Space=32]="Space",n[n.ExclamationPoint=33]="ExclamationPoint",n[n.Hash=35]="Hash",n[n.Percent=37]="Percent",n[n.LeftParen=40]="LeftParen",n[n.RightParen=41]="RightParen",n[n.Plus=43]="Plus",n[n.Minus=45]="Minus",n[n.Dash=45]="Dash",n[n.Period=46]="Period",n[n.ForwardSlash=47]="ForwardSlash",n[n.Zero=48]="Zero",n[n.One=49]="One",n[n.Two=50]="Two",n[n.Three=51]="Three",n[n.Four=52]="Four",n[n.Five=53]="Five",n[n.Six=54]="Six",n[n.Seven=55]="Seven",n[n.Eight=56]="Eight",n[n.Nine=57]="Nine",n[n.LessThan=60]="LessThan",n[n.GreaterThan=62]="GreaterThan",n[n.A=65]="A",n[n.D=68]="D",n[n.E=69]="E",n[n.F=70]="F",n[n.O=79]="O",n[n.P=80]="P",n[n.R=82]="R",n[n.LeftSquareBracket=91]="LeftSquareBracket",n[n.BackSlash=92]="BackSlash",n[n.RightSquareBracket=93]="RightSquareBracket",n[n.a=97]="a",n[n.b=98]="b",n[n.d=100]="d",n[n.e=101]="e",n[n.f=102]="f",n[n.i=105]="i",n[n.j=106]="j",n[n.l=108]="l",n[n.m=109]="m",n[n.n=110]="n",n[n.o=111]="o",n[n.r=114]="r",n[n.s=115]="s",n[n.t=116]="t",n[n.u=117]="u",n[n.x=120]="x",n[n.LeftCurly=123]="LeftCurly",n[n.RightCurly=125]="RightCurly",n[n.Tilde=126]="Tilde"})(E0||(E0={}));var P=E0;var Yb=Wi(sl(),1);var Al=class{constructor(e,t){this.major=String(e),this.minor=String(t)}getVersionString(){return`${this.major}.${this.minor}`}toString(){let e=Mt(129);return`%PDF-${this.major}.${this.minor} %${e}${e}${e}${e}`}sizeInBytes(){return 12+this.major.length+this.minor.length}copyBytesInto(e,t){let i=t;return e[t++]=P.Percent,e[t++]=P.P,e[t++]=P.D,e[t++]=P.F,e[t++]=P.Dash,t+=Ae(this.major,e,t),e[t++]=P.Period,t+=Ae(this.minor,e,t),e[t++]=P.Newline,e[t++]=P.Percent,e[t++]=129,e[t++]=129,e[t++]=129,e[t++]=129,t-i}};Al.forVersion=(n,e)=>new Al(n,e);var $i=Al;var T0=class{clone(e){throw new Ze(this.constructor.name,"clone")}toString(){throw new Ze(this.constructor.name,"toString")}sizeInBytes(){throw new Ze(this.constructor.name,"sizeInBytes")}copyBytesInto(e,t){throw new Ze(this.constructor.name,"copyBytesInto")}},Se=T0;var Il=class n extends Se{constructor(e){super(),this.numberValue=e,this.stringValue=qf(e)}asNumber(){return this.numberValue}value(){return this.numberValue}clone(){return n.of(this.numberValue)}toString(){return this.stringValue}sizeInBytes(){return this.stringValue.length}copyBytesInto(e,t){return Ae(this.stringValue,e,t),this.stringValue.length}};Il.of=n=>new Il(n);var G=Il;var Bl=class n extends Se{constructor(e){super(),this.array=[],this.context=e}size(){return this.array.length}push(e){this.array.push(e)}insert(e,t){this.array.splice(e,0,t)}indexOf(e){let t=this.array.indexOf(e);return t===-1?void 0:t}remove(e){this.array.splice(e,1)}set(e,t){this.array[e]=t}get(e){return this.array[e]}lookupMaybe(e,...t){return this.context.lookupMaybe(this.get(e),...t)}lookup(e,...t){return this.context.lookup(this.get(e),...t)}asRectangle(){if(this.size()!==4)throw new bl(this.size());let e=this.lookup(0,G).asNumber(),t=this.lookup(1,G).asNumber(),i=this.lookup(2,G).asNumber(),r=this.lookup(3,G).asNumber(),o=Math.min(e,i),s=Math.min(t,r),a=Math.abs(e-i),c=Math.abs(t-r);return{x:o,y:s,width:a,height:c}}asArray(){return this.array.slice()}clone(e){let t=n.withContext(e||this.context);for(let i=0,r=this.size();inew Bl(n);var Z=Bl;var A0={},ho=class extends Se{constructor(e,t){if(e!==A0)throw new Dn("PDFBool");super(),this.value=t}asBoolean(){return this.value}clone(){return this}toString(){return String(this.value)}sizeInBytes(){return this.value?4:5}copyBytesInto(e,t){return this.value?(e[t++]=P.t,e[t++]=P.r,e[t++]=P.u,e[t++]=P.e,4):(e[t++]=P.f,e[t++]=P.a,e[t++]=P.l,e[t++]=P.s,e[t++]=P.e,5)}};ho.True=new ho(A0,!0);ho.False=new ho(A0,!1);var Li=ho;var Ht=new Uint8Array(256);Ht[P.LeftParen]=1;Ht[P.RightParen]=1;Ht[P.LessThan]=1;Ht[P.GreaterThan]=1;Ht[P.LeftSquareBracket]=1;Ht[P.RightSquareBracket]=1;Ht[P.LeftCurly]=1;Ht[P.RightCurly]=1;Ht[P.ForwardSlash]=1;Ht[P.Percent]=1;var ci=new Uint8Array(256);ci[P.Null]=1;ci[P.Tab]=1;ci[P.Newline]=1;ci[P.FormFeed]=1;ci[P.CarriageReturn]=1;ci[P.Space]=1;var Md=new Uint8Array(256);for(let n=0,e=256;nn.replace(/#([\dABCDEF]{2})/g,(e,t)=>Cf(t)),iP=n=>n>=P.ExclamationPoint&&n<=P.Tilde&&!Md[n],Kb={},Wb=new Map,oe=class extends Se{constructor(e,t){if(e!==Kb)throw new Dn("PDFName");super();let i="/";for(let r=0,o=t.length;r{o!==void 0&&e.push(o),i=!1};for(let o=1,s=this.encodedName.length;o=P.Zero&&c<=P.Nine||c>=P.a&&c<=P.f||c>=P.A&&c<=P.F?(t+=a,(t.length===2||!(l>="0"&&l<="9"||l>="a"&&l<="f"||l>="A"&&l<="F"))&&(r(parseInt(t,16)),t="")):r(c):c===P.Hash?i=!0:r(c)}return new Uint8Array(e)}decodeText(){let e=this.asBytes();return String.fromCharCode(...Array.from(e))}asString(){return this.encodedName}value(){return this.encodedName}clone(){return this}toString(){return this.encodedName}sizeInBytes(){return this.encodedName.length}copyBytesInto(e,t){return Ae(this.encodedName,e,t),this.encodedName.length}};oe.of=n=>{let e=tP(n),t=Wb.get(e);return t||(t=new oe(Kb,e),Wb.set(e,t)),t};oe.Length=oe.of("Length");oe.FlateDecode=oe.of("FlateDecode");oe.Resources=oe.of("Resources");oe.Font=oe.of("Font");oe.XObject=oe.of("XObject");oe.ExtGState=oe.of("ExtGState");oe.Contents=oe.of("Contents");oe.Type=oe.of("Type");oe.Parent=oe.of("Parent");oe.MediaBox=oe.of("MediaBox");oe.Page=oe.of("Page");oe.Annots=oe.of("Annots");oe.TrimBox=oe.of("TrimBox");oe.ArtBox=oe.of("ArtBox");oe.BleedBox=oe.of("BleedBox");oe.CropBox=oe.of("CropBox");oe.Rotate=oe.of("Rotate");oe.Title=oe.of("Title");oe.Author=oe.of("Author");oe.Subject=oe.of("Subject");oe.Creator=oe.of("Creator");oe.Keywords=oe.of("Keywords");oe.Producer=oe.of("Producer");oe.CreationDate=oe.of("CreationDate");oe.ModDate=oe.of("ModDate");var v=oe;var I0=class extends Se{asNull(){return null}clone(){return this}toString(){return"null"}sizeInBytes(){return 4}copyBytesInto(e,t){return e[t++]=P.n,e[t++]=P.u,e[t++]=P.l,e[t++]=P.l,4}},He=new I0;var uo=class n extends Se{constructor(e,t){super(),this.suppressEncryption=!1,this.dict=e,this.context=t}keys(){return Array.from(this.dict.keys())}values(){return Array.from(this.dict.values())}entries(){return Array.from(this.dict.entries())}set(e,t){this.dict.set(e,t)}get(e,t=!1){let i=this.dict.get(e);if(!(i===He&&!t))return i}has(e){let t=this.dict.get(e);return t!==void 0&&t!==He}lookupMaybe(e,...t){let i=t.includes(He),r=this.context.lookupMaybe(this.get(e,i),...t);if(!(r===He&&!i))return r}lookup(e,...t){let i=t.includes(He),r=this.context.lookup(this.get(e,i),...t);if(!(r===He&&!i))return r}delete(e){return this.dict.delete(e)}asMap(){return new Map(this.dict)}uniqueKey(e=""){let t=this.keys(),i=v.of(this.context.addRandomSuffix(e,10));for(;t.includes(i);)i=v.of(this.context.addRandomSuffix(e,10));return i}clone(e){let t=n.withContext(e||this.context),i=this.entries();for(let r=0,o=i.length;rnew uo(new Map,n);uo.fromMapWithContext=(n,e)=>new uo(n,e);var W=uo;var Sn=class n extends Se{constructor(e){super(),this.value=e}asBytes(){let e=this.value+(this.value.length%2===1?"0":""),t=e.length,i=new Uint8Array(e.length/2),r=0,o=0;for(;r`}sizeInBytes(){return this.value.length+2}copyBytesInto(e,t){return e[t++]=P.LessThan,t+=Ae(this.value,e,t),e[t++]=P.GreaterThan,this.value.length+2}};Sn.of=n=>new Sn(n);Sn.fromText=n=>{let e=Hf(n),t="";for(let i=0,r=e.length;iSn.of(Vf(n));var K=Sn;var B0=class extends Se{constructor(e){super(),this.dict=e}clone(e){throw new Ze(this.constructor.name,"clone")}getContentsString(){throw new Ze(this.constructor.name,"getContentsString")}getContents(){throw new Ze(this.constructor.name,"getContents")}getContentsSize(){throw new Ze(this.constructor.name,"getContentsSize")}updateContents(e){throw new Ze(this.constructor.name,"updateContents")}updateDict(){let e=this.getContentsSize();this.dict.set(v.Length,G.of(e))}sizeInBytes(){return this.updateDict(),this.dict.sizeInBytes()+this.getContentsSize()+18}toString(){this.updateDict();let e=this.dict.toString();return e+=` stream `,e+=this.getContentsString(),e+=` endstream`,e}copyBytesInto(e,t){this.updateDict();let i=t;t+=this.dict.copyBytesInto(e,t),e[t++]=P.Newline,e[t++]=P.s,e[t++]=P.t,e[t++]=P.r,e[t++]=P.e,e[t++]=P.a,e[t++]=P.m,e[t++]=P.Newline;let r=this.getContents();for(let o=0,s=r.length;onew Ol(n,e,t);var Mi=Ol;var Xb={},Gb=new Map,Ll=class extends Se{constructor(e,t,i){if(e!==Xb)throw new Dn("PDFRef");super(),this.objectNumber=t,this.generationNumber=i,this.tag=`${t} ${i} R`}clone(){return this}toString(){return this.tag}sizeInBytes(){return this.tag.length}copyBytesInto(e,t){return Ae(this.tag,e,t),this.tag.length}};Ll.of=(n,e=0)=>{let t=`${n} ${e} R`,i=Gb.get(t);return i||(i=new Ll(Xb,n,e),Gb.set(t,i)),i};var Y=Ll;var fo=class n extends Se{constructor(e){super(),this.value=e}asBytes(){let e=[],t="",i=!1,r=o=>{o!==void 0&&e.push(o),i=!1};for(let o=0,s=this.value.length;o=P.Zero&&c<=P.Seven?(t+=a,(t.length===3||!(l>="0"&&l<="7"))&&(r(parseInt(t,8)),t="")):r(c):c===P.BackSlash?i=!0:r(c)}return new Uint8Array(e)}decodeText(){let e=this.asBytes();return ja(e)?qa(e):ul(e)}decodeDate(){let e=this.decodeText(),t=Ha(e);if(!t)throw new co(e);return t}asString(){return this.value}clone(){return n.of(this.value)}toString(){return`(${this.value})`}sizeInBytes(){return this.value.length+2}copyBytesInto(e,t){return e[t++]=P.LeftParen,t+=Ae(this.value,e,t),e[t++]=P.RightParen,this.value.length+2}};fo.of=n=>new fo(n);fo.fromDate=n=>{let e=Nt(String(n.getUTCFullYear()),4,"0"),t=Nt(String(n.getUTCMonth()+1),2,"0"),i=Nt(String(n.getUTCDate()),2,"0"),r=Nt(String(n.getUTCHours()),2,"0"),o=Nt(String(n.getUTCMinutes()),2,"0"),s=Nt(String(n.getUTCSeconds()),2,"0");return new fo(`D:${e}${t}${i}${r}${o}${s}Z`)};var J=fo;var Ml=class n{constructor(e,t){this.name=e,this.args=t||[]}clone(e){let t=new Array(this.args.length);for(let i=0,r=t.length;inew Ml(n,e);var le=Ml;var O0;(function(n){n.NonStrokingColor="sc",n.NonStrokingColorN="scn",n.NonStrokingColorRgb="rg",n.NonStrokingColorGray="g",n.NonStrokingColorCmyk="k",n.NonStrokingColorspace="cs",n.StrokingColor="SC",n.StrokingColorN="SCN",n.StrokingColorRgb="RG",n.StrokingColorGray="G",n.StrokingColorCmyk="K",n.StrokingColorspace="CS",n.BeginMarkedContentSequence="BDC",n.BeginMarkedContent="BMC",n.EndMarkedContent="EMC",n.MarkedContentPointWithProps="DP",n.MarkedContentPoint="MP",n.DrawObject="Do",n.ConcatTransformationMatrix="cm",n.PopGraphicsState="Q",n.PushGraphicsState="q",n.SetFlatness="i",n.SetGraphicsStateParams="gs",n.SetLineCapStyle="J",n.SetLineDashPattern="d",n.SetLineJoinStyle="j",n.SetLineMiterLimit="M",n.SetLineWidth="w",n.SetTextMatrix="Tm",n.SetRenderingIntent="ri",n.AppendRectangle="re",n.BeginInlineImage="BI",n.BeginInlineImageData="ID",n.EndInlineImage="EI",n.ClipEvenOdd="W*",n.ClipNonZero="W",n.CloseAndStroke="s",n.CloseFillEvenOddAndStroke="b*",n.CloseFillNonZeroAndStroke="b",n.ClosePath="h",n.AppendBezierCurve="c",n.CurveToReplicateFinalPoint="y",n.CurveToReplicateInitialPoint="v",n.EndPath="n",n.FillEvenOddAndStroke="B*",n.FillEvenOdd="f*",n.FillNonZeroAndStroke="B",n.FillNonZero="f",n.LegacyFillNonZero="F",n.LineTo="l",n.MoveTo="m",n.ShadingFill="sh",n.StrokePath="S",n.BeginText="BT",n.EndText="ET",n.MoveText="Td",n.MoveTextSetLeading="TD",n.NextLine="T*",n.SetCharacterSpacing="Tc",n.SetFontAndSize="Tf",n.SetTextHorizontalScaling="Tz",n.SetTextLineHeight="TL",n.SetTextRenderingMode="Tr",n.SetTextRise="Ts",n.SetWordSpacing="Tw",n.ShowText="Tj",n.ShowTextAdjusted="TJ",n.ShowTextLine="'",n.ShowTextLineAndSpace='"',n.Type3D0="d0",n.Type3D1="d1",n.BeginCompatibilitySection="BX",n.EndCompatibilitySection="EX"})(O0||(O0={}));var ce=O0;var Zb=Wi(sl(),1);var L0=class extends Ee{constructor(e,t){super(e),this.computeContents=()=>{let i=this.getUnencodedContents();return this.encode?Zb.default.deflate(i):i},this.encode=t,t&&e.set(v.of("Filter"),v.of("FlateDecode")),this.contentsCache=ht.populatedBy(this.computeContents)}getContents(){return this.contentsCache.access()}getContentsSize(){return this.contentsCache.access().length}getUnencodedContents(){throw new Ze(this.constructor.name,"getUnencodedContents")}updateContents(e){this.contentsCache=ht.populatedBy(()=>e)}},fr=L0;var Nl=class n extends fr{constructor(e,t,i=!0){super(e,i),this.operators=t}push(...e){this.operators.push(...e)}clone(e){let t=new Array(this.operators.length);for(let o=0,s=this.operators.length;onew Nl(n,e,t);var en=Nl;var As=class{constructor(e){this.seed=e}nextInt(){let e=Math.sin(this.seed++)*1e4;return e-Math.floor(e)}};As.withSeed=n=>new As(n);var nP=([n],[e])=>n.objectNumber-e.objectNumber,Rl=class{constructor(){this.isDecrypted=!0,this.largestObjectNumber=0,this.header=$i.forVersion(1,7),this.trailerInfo={},this.indirectObjects=new Map,this.rng=As.withSeed(1)}assign(e,t){this.indirectObjects.set(e,t),e.objectNumber>this.largestObjectNumber&&(this.largestObjectNumber=e.objectNumber)}nextRef(){return this.largestObjectNumber+=1,Y.of(this.largestObjectNumber)}register(e){let t=this.nextRef();return this.assign(t,e),t}delete(e){return this.indirectObjects.delete(e)}lookupMaybe(e,...t){let i=t.includes(He),r=e instanceof Y?this.indirectObjects.get(e):e;if(!(!r||r===He&&!i)){for(let o=0,s=t.length;othis.getLiteral(c,s)):a}else{if(e instanceof Li)return e.asBoolean();if(e instanceof W){let a={},c=e.entries();for(let l=0,d=c.length;lnew Rl;var po=Rl;var pr=class n extends W{constructor(e,t,i=!0){super(e,t),this.normalized=!1,this.autoNormalizeCTM=i}clone(e){let t=n.fromMapWithContext(new Map,e||this.context,this.autoNormalizeCTM),i=this.entries();for(let r=0,o=i.length;r{t||(t=i.get(e))}),t}setParent(e){this.set(v.Parent,e)}addContentStream(e){let t=this.normalizedEntries().Contents||this.context.obj([]);this.set(v.Contents,t),t.push(e)}wrapContentStreams(e,t){let i=this.Contents();return i instanceof Z?(i.insert(0,e),i.push(t),!0):!1}addAnnot(e){let{Annots:t}=this.normalizedEntries();t.push(e)}removeAnnot(e){let{Annots:t}=this.normalizedEntries(),i=t.indexOf(e);i!==void 0&&t.remove(i)}setFontDictionary(e,t){let{Font:i}=this.normalizedEntries();i.set(e,t)}newFontDictionaryKey(e){let{Font:t}=this.normalizedEntries();return t.uniqueKey(e)}newFontDictionary(e,t){let i=this.newFontDictionaryKey(e);return this.setFontDictionary(i,t),i}setXObject(e,t){let{XObject:i}=this.normalizedEntries();i.set(e,t)}newXObjectKey(e){let{XObject:t}=this.normalizedEntries();return t.uniqueKey(e)}newXObject(e,t){let i=this.newXObjectKey(e);return this.setXObject(i,t),i}setExtGState(e,t){let{ExtGState:i}=this.normalizedEntries();i.set(e,t)}newExtGStateKey(e){let{ExtGState:t}=this.normalizedEntries();return t.uniqueKey(e)}newExtGState(e,t){let i=this.newExtGStateKey(e);return this.setExtGState(i,t),i}ascend(e){e(this);let t=this.Parent();t&&t.ascend(e)}normalize(){if(this.normalized)return;let{context:e}=this,t=this.get(v.Contents);this.context.lookup(t)instanceof Ee&&this.set(v.Contents,e.obj([t])),this.autoNormalizeCTM&&this.wrapContentStreams(this.context.getPushGraphicsStateContentStream(),this.context.getPopGraphicsStateContentStream());let r=this.getInheritableAttribute(v.Resources),o=e.lookupMaybe(r,W)||e.obj({});this.set(v.Resources,o);let s=o.lookupMaybe(v.Font,W)||e.obj({});o.set(v.Font,s);let a=o.lookupMaybe(v.XObject,W)||e.obj({});o.set(v.XObject,a);let c=o.lookupMaybe(v.ExtGState,W)||e.obj({});o.set(v.ExtGState,c);let l=this.Annots()||e.obj([]);this.set(v.Annots,l),this.normalized=!0}normalizedEntries(){this.normalize();let e=this.Annots(),t=this.Resources(),i=this.Contents();return{Annots:e,Resources:t,Contents:i,Font:t.lookup(v.Font,W),XObject:t.lookup(v.XObject,W),ExtGState:t.lookup(v.ExtGState,W)}}};pr.InheritableEntries=["Resources","MediaBox","CropBox","Rotate"];pr.withContextAndParent=(n,e)=>{let t=new Map;return t.set(v.Type,v.Page),t.set(v.Parent,e),t.set(v.Resources,n.obj({})),t.set(v.MediaBox,n.obj([0,0,612,792])),new pr(t,n,!1)};pr.fromMapWithContext=(n,e,t=!0)=>new pr(n,e,t);var et=pr;var Vl=class{constructor(e,t){this.traversedObjects=new Map,this.copy=i=>i instanceof et?this.copyPDFPage(i):i instanceof W?this.copyPDFDict(i):i instanceof Z?this.copyPDFArray(i):i instanceof Ee?this.copyPDFStream(i):i instanceof Y?this.copyPDFIndirectObject(i):i.clone(),this.copyPDFPage=i=>{let r=i.clone(),{InheritableEntries:o}=et;for(let s=0,a=o.length;s{if(this.traversedObjects.has(i))return this.traversedObjects.get(i);let r=i.clone(this.dest);this.traversedObjects.set(i,r);let o=i.entries();for(let s=0,a=o.length;s{if(this.traversedObjects.has(i))return this.traversedObjects.get(i);let r=i.clone(this.dest);this.traversedObjects.set(i,r);for(let o=0,s=i.size();o{if(this.traversedObjects.has(i))return this.traversedObjects.get(i);let r=i.clone(this.dest);this.traversedObjects.set(i,r);let o=i.dict.entries();for(let s=0,a=o.length;s{if(!this.traversedObjects.has(i)){let o=this.dest.nextRef();this.traversedObjects.set(i,o);let s=this.src.lookup(i);if(s){let a=this.copy(s);this.dest.assign(o,a)}}return this.traversedObjects.get(i)},this.src=e,this.dest=t}};Vl.for=(n,e)=>new Vl(n,e);var Hl=Vl;function _b(n,e){var t={};for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&e.indexOf(i)<0&&(t[i]=n[i]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var r=0,i=Object.getOwnPropertySymbols(n);r1?(this.subsections.push([e]),this.chunkIdx+=1,this.chunkLength=1):(t.push(e),this.chunkLength+=1)}};go.create=()=>new go({ref:Y.of(0,65535),offset:0,deleted:!0});go.createEmpty=()=>new go;var mo=go;var zl=class{constructor(e){this.lastXRefOffset=String(e)}toString(){return`startxref ${this.lastXRefOffset} %%EOF`}sizeInBytes(){return 16+this.lastXRefOffset.length}copyBytesInto(e,t){let i=t;return e[t++]=P.s,e[t++]=P.t,e[t++]=P.a,e[t++]=P.r,e[t++]=P.t,e[t++]=P.x,e[t++]=P.r,e[t++]=P.e,e[t++]=P.f,e[t++]=P.Newline,t+=Ae(this.lastXRefOffset,e,t),e[t++]=P.Newline,e[t++]=P.Percent,e[t++]=P.Percent,e[t++]=P.E,e[t++]=P.O,e[t++]=P.F,t-i}};zl.forLastCrossRefSectionOffset=n=>new zl(n);var gr=zl;var Ul=class{constructor(e){this.dict=e}toString(){return`trailer ${this.dict.toString()}`}sizeInBytes(){return 8+this.dict.sizeInBytes()}copyBytesInto(e,t){let i=t;return e[t++]=P.t,e[t++]=P.r,e[t++]=P.a,e[t++]=P.i,e[t++]=P.l,e[t++]=P.e,e[t++]=P.r,e[t++]=P.Newline,t+=this.dict.copyBytesInto(e,t),t-i}};Ul.of=n=>new Ul(n);var Nd=Ul;var ql=class n extends fr{constructor(e,t,i=!0){super(e.obj({}),i),this.objects=t,this.offsets=this.computeObjectOffsets(),this.offsetsString=this.computeOffsetsString(),this.dict.set(v.of("Type"),v.of("ObjStm")),this.dict.set(v.of("N"),G.of(this.objects.length)),this.dict.set(v.of("First"),G.of(this.offsetsString.length))}getObjectsCount(){return this.objects.length}clone(e){return n.withContextAndObjects(e||this.dict.context,this.objects.slice(),this.encode)}getContentsString(){let e=this.offsetsString;for(let t=0,i=this.objects.length;tnew ql(n,e,t);var Is=ql;var jl=class{constructor(e,t){this.parsedObjects=0,this.shouldWaitForTick=i=>(this.parsedObjects+=i,this.parsedObjects%this.objectsPerTick===0),this.context=e,this.objectsPerTick=t}serializeToBuffer(){return Q(this,void 0,void 0,function*(){let{size:e,header:t,indirectObjects:i,xref:r,trailerDict:o,trailer:s}=yield this.computeBufferSize(),a=0,c=new Uint8Array(e);a+=t.copyBytesInto(c,a),c[a++]=P.Newline,c[a++]=P.Newline;for(let l=0,d=i.length;lnew jl(n,e);var Bs=jl;var Wl=class n extends Se{constructor(e){super(),this.data=e}clone(){return n.of(this.data.slice())}toString(){return`PDFInvalidObject(${this.data.length} bytes)`}sizeInBytes(){return this.data.length}copyBytesInto(e,t){let i=this.data.length;for(let r=0;rnew Wl(n);var Os=Wl;var rP=/\/([^\0\t\n\f\r ]+)[\0\t\n\f\r ]*(\d*\.\d+|\d+)?[\0\t\n\f\r ]+Tf/,M0=class n{constructor(e,t){this.dict=e,this.ref=t}T(){return this.dict.lookupMaybe(v.of("T"),J,K)}Ff(){let e=this.getInheritableAttribute(v.of("Ff"));return this.dict.context.lookupMaybe(e,G)}V(){let e=this.getInheritableAttribute(v.of("V"));return this.dict.context.lookup(e)}Kids(){return this.dict.lookupMaybe(v.of("Kids"),Z)}DA(){let e=this.dict.lookup(v.of("DA"));if(e instanceof J||e instanceof K)return e}setKids(e){this.dict.set(v.of("Kids"),this.dict.context.obj(e))}getParent(){let e=this.dict.get(v.of("Parent"));if(e instanceof Y){let t=this.dict.lookup(v.of("Parent"),W);return new n(t,e)}}setParent(e){e?this.dict.set(v.of("Parent"),e):this.dict.delete(v.of("Parent"))}getFullyQualifiedName(){let e=this.getParent();return e?`${e.getFullyQualifiedName()}.${this.getPartialName()}`:this.getPartialName()}getPartialName(){var e;return(e=this.T())===null||e===void 0?void 0:e.decodeText()}setPartialName(e){e?this.dict.set(v.of("T"),K.fromText(e)):this.dict.delete(v.of("T"))}setDefaultAppearance(e){this.dict.set(v.of("DA"),J.of(e))}getDefaultAppearance(){let e=this.DA();return e instanceof K?e.decodeText():e==null?void 0:e.asString()}setFontSize(e){var t;let i=(t=this.getFullyQualifiedName())!==null&&t!==void 0?t:"",r=this.getDefaultAppearance();if(!r)throw new vl(i);let o=us(r,rP);if(!o.match)throw new wl(i);let s=r.slice(0,o.pos-o.match[0].length),a=o.pos<=r.length?r.slice(o.pos):"",c=o.match[1],l=`${s} /${c} ${e} Tf ${a}`;this.setDefaultAppearance(l)}getFlags(){var e,t;return(t=(e=this.Ff())===null||e===void 0?void 0:e.asNumber())!==null&&t!==void 0?t:0}setFlags(e){this.dict.set(v.of("Ff"),G.of(e))}hasFlag(e){return(this.getFlags()&e)!==0}setFlag(e){let t=this.getFlags();this.setFlags(t|e)}clearFlag(e){let t=this.getFlags();this.setFlags(t&~e)}setFlagTo(e,t){t?this.setFlag(e):this.clearFlag(e)}getInheritableAttribute(e){let t;return this.ascend(i=>{t||(t=i.dict.get(e))}),t}ascend(e){e(this);let t=this.getParent();t&&t.ascend(e)}},Ls=M0;var Kl=class{constructor(e){this.dict=e}W(){let e=this.dict.lookup(v.of("W"));if(e instanceof G)return e}getWidth(){var e,t;return(t=(e=this.W())===null||e===void 0?void 0:e.asNumber())!==null&&t!==void 0?t:1}setWidth(e){let t=this.dict.context.obj(e);this.dict.set(v.of("W"),t)}};Kl.fromDict=n=>new Kl(n);var Rd=Kl;var Gl=class{constructor(e){this.dict=e}Rect(){return this.dict.lookup(v.of("Rect"),Z)}AP(){return this.dict.lookupMaybe(v.of("AP"),W)}F(){let e=this.dict.lookup(v.of("F"));return this.dict.context.lookupMaybe(e,G)}getRectangle(){var e;let t=this.Rect();return(e=t==null?void 0:t.asRectangle())!==null&&e!==void 0?e:{x:0,y:0,width:0,height:0}}setRectangle(e){let{x:t,y:i,width:r,height:o}=e,s=this.dict.context.obj([t,i,t+r,i+o]);this.dict.set(v.of("Rect"),s)}getAppearanceState(){let e=this.dict.lookup(v.of("AS"));if(e instanceof v)return e}setAppearanceState(e){this.dict.set(v.of("AS"),e)}setAppearances(e){this.dict.set(v.of("AP"),e)}ensureAP(){let e=this.AP();return e||(e=this.dict.context.obj({}),this.dict.set(v.of("AP"),e)),e}getNormalAppearance(){let t=this.ensureAP().get(v.of("N"));if(t instanceof Y||t instanceof W)return t;throw new Error(`Unexpected N type: ${t==null?void 0:t.constructor.name}`)}setNormalAppearance(e){this.ensureAP().set(v.of("N"),e)}setRolloverAppearance(e){this.ensureAP().set(v.of("R"),e)}setDownAppearance(e){this.ensureAP().set(v.of("D"),e)}removeRolloverAppearance(){let e=this.AP();e==null||e.delete(v.of("R"))}removeDownAppearance(){let e=this.AP();e==null||e.delete(v.of("D"))}getAppearances(){let e=this.AP();if(!e)return;let t=e.lookup(v.of("N"),W,Ee),i=e.lookupMaybe(v.of("R"),W,Ee),r=e.lookupMaybe(v.of("D"),W,Ee);return{normal:t,rollover:i,down:r}}getFlags(){var e,t;return(t=(e=this.F())===null||e===void 0?void 0:e.asNumber())!==null&&t!==void 0?t:0}setFlags(e){this.dict.set(v.of("F"),G.of(e))}hasFlag(e){return(this.getFlags()&e)!==0}setFlag(e){let t=this.getFlags();this.setFlags(t|e)}clearFlag(e){let t=this.getFlags();this.setFlags(t&~e)}setFlagTo(e,t){t?this.setFlag(e):this.clearFlag(e)}};Gl.fromDict=n=>new Gl(n);var Vd=Gl;var Xl=class{constructor(e){this.dict=e}R(){let e=this.dict.lookup(v.of("R"));if(e instanceof G)return e}BC(){let e=this.dict.lookup(v.of("BC"));if(e instanceof Z)return e}BG(){let e=this.dict.lookup(v.of("BG"));if(e instanceof Z)return e}CA(){let e=this.dict.lookup(v.of("CA"));if(e instanceof K||e instanceof J)return e}RC(){let e=this.dict.lookup(v.of("RC"));if(e instanceof K||e instanceof J)return e}AC(){let e=this.dict.lookup(v.of("AC"));if(e instanceof K||e instanceof J)return e}getRotation(){var e;return(e=this.R())===null||e===void 0?void 0:e.asNumber()}getBorderColor(){let e=this.BC();if(!e)return;let t=[];for(let i=0,r=e==null?void 0:e.size();inew Xl(n);var Ms=Xl;var xo=class extends Vd{MK(){let e=this.dict.lookup(v.of("MK"));if(e instanceof W)return e}BS(){let e=this.dict.lookup(v.of("BS"));if(e instanceof W)return e}DA(){let e=this.dict.lookup(v.of("DA"));if(e instanceof J||e instanceof K)return e}P(){let e=this.dict.get(v.of("P"));if(e instanceof Y)return e}setP(e){this.dict.set(v.of("P"),e)}setDefaultAppearance(e){this.dict.set(v.of("DA"),J.of(e))}getDefaultAppearance(){let e=this.DA();return e instanceof K?e.decodeText():e==null?void 0:e.asString()}getAppearanceCharacteristics(){let e=this.MK();if(e)return Ms.fromDict(e)}getOrCreateAppearanceCharacteristics(){let e=this.MK();if(e)return Ms.fromDict(e);let t=Ms.fromDict(this.dict.context.obj({}));return this.dict.set(v.of("MK"),t.dict),t}getBorderStyle(){let e=this.BS();if(e)return Rd.fromDict(e)}getOrCreateBorderStyle(){let e=this.BS();if(e)return Rd.fromDict(e);let t=Rd.fromDict(this.dict.context.obj({}));return this.dict.set(v.of("BS"),t.dict),t}getOnValue(){var e;let t=(e=this.getAppearances())===null||e===void 0?void 0:e.normal;if(t instanceof W){let i=t.keys();for(let r=0,o=i.length;rnew xo(n);xo.create=(n,e)=>{let t=n.obj({Type:"Annot",Subtype:"Widget",Rect:[0,0,0,0],Parent:e});return new xo(t)};var bo=xo;var Zl=class extends Ls{FT(){let e=this.getInheritableAttribute(v.of("FT"));return this.dict.context.lookup(e,v)}getWidgets(){let e=this.Kids();if(!e)return[bo.fromDict(this.dict)];let t=new Array(e.size());for(let i=0,r=e.size();it.size())throw new kn(e,0,t.size());t.remove(e)}else{if(e!==0)throw new kn(e,0,0);this.setKids([])}}normalizedEntries(){let e=this.Kids();return e||(e=this.dict.context.obj([this.ref]),this.dict.set(v.of("Kids"),e)),{Kids:e}}};Zl.fromDict=(n,e)=>new Zl(n,e);var zt=Zl;var N0=class extends zt{Opt(){return this.dict.lookupMaybe(v.of("Opt"),J,K,Z)}setOpt(e){this.dict.set(v.of("Opt"),this.dict.context.obj(e))}getExportValues(){let e=this.Opt();if(!e)return;if(e instanceof J||e instanceof K)return[e];let t=[];for(let i=0,r=e.size();it.size())throw new kn(e,0,t.size());t.remove(e)}}normalizeExportValues(){var e,t,i,r;let o=(e=this.getExportValues())!==null&&e!==void 0?e:[],s=[],a=this.getWidgets();for(let c=0,l=a.length;cnew yo(n,e);yo.create=n=>{let e=n.obj({FT:"Btn",Kids:[]}),t=n.register(e);return new yo(e,t)};var En=yo;var tt=n=>1<1){if(!this.hasFlag(me.MultiSelect))throw new yl;this.dict.set(v.of("V"),this.dict.context.obj(e))}this.updateSelectedIndices(e)}valuesAreValid(e){let t=this.getOptions();for(let i=0,r=e.length;io===(s.display||s.value).decodeText()))return!1}return!0}updateSelectedIndices(e){if(e.length>1){let t=new Array(e.length),i=this.getOptions();for(let r=0,o=e.length;rs===(a.display||a.value).decodeText())}this.dict.set(v.of("I"),this.dict.context.obj(t.sort()))}else this.dict.delete(v.of("I"))}getValues(){let e=this.V();if(e instanceof J||e instanceof K)return[e];if(e instanceof Z){let t=[];for(let i=0,r=e.size();i0){let s=o.lookup(0,J,K),a=o.lookupMaybe(1,J,K);t.push({value:s,display:a||s})}}return t}return[]}},Ns=R0;var vo=class extends Ns{};vo.fromDict=(n,e)=>new vo(n,e);vo.create=n=>{let e=n.obj({FT:"Ch",Ff:me.Combo,Kids:[]}),t=n.register(e);return new vo(e,t)};var Tn=vo;var wo=class extends Ls{addField(e){let{Kids:t}=this.normalizedEntries();t==null||t.push(e)}normalizedEntries(){let e=this.Kids();return e||(e=this.dict.context.obj([]),this.dict.set(v.of("Kids"),e)),{Kids:e}}};wo.fromDict=(n,e)=>new wo(n,e);wo.create=n=>{let e=n.obj({}),t=n.register(e);return new wo(e,t)};var An=wo;var Yl=class extends zt{};Yl.fromDict=(n,e)=>new Yl(n,e);var xr=Yl;var Fo=class extends zt{MaxLen(){let e=this.dict.lookup(v.of("MaxLen"));if(e instanceof G)return e}Q(){let e=this.dict.lookup(v.of("Q"));if(e instanceof G)return e}setMaxLength(e){this.dict.set(v.of("MaxLen"),G.of(e))}removeMaxLength(){this.dict.delete(v.of("MaxLen"))}getMaxLength(){var e;return(e=this.MaxLen())===null||e===void 0?void 0:e.asNumber()}setQuadding(e){this.dict.set(v.of("Q"),G.of(e))}getQuadding(){var e;return(e=this.Q())===null||e===void 0?void 0:e.asNumber()}setValue(e){this.dict.set(v.of("V"),e)}removeValue(){this.dict.delete(v.of("V"))}getValue(){let e=this.V();if(e instanceof J||e instanceof K)return e}};Fo.fromDict=(n,e)=>new Fo(n,e);Fo.create=n=>{let e=n.obj({FT:"Tx",Kids:[]}),t=n.register(e);return new Fo(e,t)};var In=Fo;var Do=class extends mr{};Do.fromDict=(n,e)=>new Do(n,e);Do.create=n=>{let e=n.obj({FT:"Btn",Ff:yt.PushButton,Kids:[]}),t=n.register(e);return new Do(e,t)};var Bn=Do;var Po=class extends mr{setValue(e){if(!this.getOnValues().includes(e)&&e!==v.of("Off"))throw new Cn;this.dict.set(v.of("V"),e);let i=this.getWidgets();for(let r=0,o=i.length;rnew Po(n,e);Po.create=n=>{let e=n.obj({FT:"Btn",Ff:yt.Radio,Kids:[]}),t=n.register(e);return new Po(e,t)};var On=Po;var ko=class extends Ns{};ko.fromDict=(n,e)=>new ko(n,e);ko.create=n=>{let e=n.obj({FT:"Ch",Kids:[]}),t=n.register(e);return new ko(e,t)};var Ln=ko;var Rs=n=>{if(!n)return[];let e=[];for(let t=0,i=n.size();toP(n)?An.fromDict(n,e):sP(n,e),oP=n=>{let e=n.lookup(v.of("Kids"));if(e instanceof Z)for(let t=0,i=e.size();t{let t=H0(n,v.of("FT")),i=n.context.lookup(t,v);return i===v.of("Btn")?aP(n,e):i===v.of("Ch")?lP(n,e):i===v.of("Tx")?In.fromDict(n,e):i===v.of("Sig")?xr.fromDict(n,e):zt.fromDict(n,e)},aP=(n,e)=>{var t;let i=H0(n,v.of("Ff")),r=n.context.lookupMaybe(i,G),o=(t=r==null?void 0:r.asNumber())!==null&&t!==void 0?t:0;return V0(o,yt.PushButton)?Bn.fromDict(n,e):V0(o,yt.Radio)?On.fromDict(n,e):En.fromDict(n,e)},lP=(n,e)=>{var t;let i=H0(n,v.of("Ff")),r=n.context.lookupMaybe(i,G),o=(t=r==null?void 0:r.asNumber())!==null&&t!==void 0?t:0;return V0(o,me.Combo)?Tn.fromDict(n,e):Ln.fromDict(n,e)},V0=(n,e)=>(n&e)!==0,H0=(n,e)=>{let t;return Jb(n,i=>{t||(t=i.get(e))}),t},Jb=(n,e)=>{e(n);let t=n.lookupMaybe(v.of("Parent"),W);t&&Jb(t,e)};var Co=class{constructor(e){this.dict=e}Fields(){let e=this.dict.lookup(v.of("Fields"));if(e instanceof Z)return e}getFields(){let{Fields:e}=this.normalizedEntries(),t=new Array(e.size());for(let i=0,r=e.size();i{if(i)for(let r=0,o=i.length;rnew Co(n);Co.create=n=>{let e=n.obj({Fields:[]});return new Co(e)};var br=Co;var zd=(n,e)=>{if(n!==void 0)return e[n]},So;(function(n){n.UseNone="UseNone",n.UseOutlines="UseOutlines",n.UseThumbs="UseThumbs",n.UseOC="UseOC"})(So||(So={}));var Eo;(function(n){n.L2R="L2R",n.R2L="R2L"})(Eo||(Eo={}));var To;(function(n){n.None="None",n.AppDefault="AppDefault"})(To||(To={}));var Vs;(function(n){n.Simplex="Simplex",n.DuplexFlipShortEdge="DuplexFlipShortEdge",n.DuplexFlipLongEdge="DuplexFlipLongEdge"})(Vs||(Vs={}));var Ao=class{constructor(e){this.dict=e}lookupBool(e){let t=this.dict.lookup(v.of(e));if(t instanceof Li)return t}lookupName(e){let t=this.dict.lookup(v.of(e));if(t instanceof v)return t}HideToolbar(){return this.lookupBool("HideToolbar")}HideMenubar(){return this.lookupBool("HideMenubar")}HideWindowUI(){return this.lookupBool("HideWindowUI")}FitWindow(){return this.lookupBool("FitWindow")}CenterWindow(){return this.lookupBool("CenterWindow")}DisplayDocTitle(){return this.lookupBool("DisplayDocTitle")}NonFullScreenPageMode(){return this.lookupName("NonFullScreenPageMode")}Direction(){return this.lookupName("Direction")}PrintScaling(){return this.lookupName("PrintScaling")}Duplex(){return this.lookupName("Duplex")}PickTrayByPDFSize(){return this.lookupBool("PickTrayByPDFSize")}PrintPageRange(){let e=this.dict.lookup(v.of("PrintPageRange"));if(e instanceof Z)return e}NumCopies(){let e=this.dict.lookup(v.of("NumCopies"));if(e instanceof G)return e}getHideToolbar(){var e,t;return(t=(e=this.HideToolbar())===null||e===void 0?void 0:e.asBoolean())!==null&&t!==void 0?t:!1}getHideMenubar(){var e,t;return(t=(e=this.HideMenubar())===null||e===void 0?void 0:e.asBoolean())!==null&&t!==void 0?t:!1}getHideWindowUI(){var e,t;return(t=(e=this.HideWindowUI())===null||e===void 0?void 0:e.asBoolean())!==null&&t!==void 0?t:!1}getFitWindow(){var e,t;return(t=(e=this.FitWindow())===null||e===void 0?void 0:e.asBoolean())!==null&&t!==void 0?t:!1}getCenterWindow(){var e,t;return(t=(e=this.CenterWindow())===null||e===void 0?void 0:e.asBoolean())!==null&&t!==void 0?t:!1}getDisplayDocTitle(){var e,t;return(t=(e=this.DisplayDocTitle())===null||e===void 0?void 0:e.asBoolean())!==null&&t!==void 0?t:!1}getNonFullScreenPageMode(){var e,t;let i=(e=this.NonFullScreenPageMode())===null||e===void 0?void 0:e.decodeText();return(t=zd(i,So))!==null&&t!==void 0?t:So.UseNone}getReadingDirection(){var e,t;let i=(e=this.Direction())===null||e===void 0?void 0:e.decodeText();return(t=zd(i,Eo))!==null&&t!==void 0?t:Eo.L2R}getPrintScaling(){var e,t;let i=(e=this.PrintScaling())===null||e===void 0?void 0:e.decodeText();return(t=zd(i,To))!==null&&t!==void 0?t:To.AppDefault}getDuplex(){var e;let t=(e=this.Duplex())===null||e===void 0?void 0:e.decodeText();return zd(t,Vs)}getPickTrayByPDFSize(){var e;return(e=this.PickTrayByPDFSize())===null||e===void 0?void 0:e.asBoolean()}getPrintPageRange(){let e=this.PrintPageRange();if(!e)return[];let t=[];for(let i=0;inew Ao(n);Ao.create=n=>{let e=n.obj({});return new Ao(e)};var _l=Ao;var Io=class extends W{Pages(){return this.lookup(v.of("Pages"),W)}AcroForm(){return this.lookupMaybe(v.of("AcroForm"),W)}getAcroForm(){let e=this.AcroForm();if(e)return br.fromDict(e)}getOrCreateAcroForm(){let e=this.getAcroForm();if(!e){e=br.create(this.context);let t=this.context.register(e.dict);this.set(v.of("AcroForm"),t)}return e}ViewerPreferences(){return this.lookupMaybe(v.of("ViewerPreferences"),W)}getViewerPreferences(){let e=this.ViewerPreferences();if(e)return _l.fromDict(e)}getOrCreateViewerPreferences(){let e=this.getViewerPreferences();if(!e){e=_l.create(this.context);let t=this.context.register(e.dict);this.set(v.of("ViewerPreferences"),t)}return e}insertLeafNode(e,t){let i=this.get(v.of("Pages"));return this.Pages().insertLeafNode(e,t)||i}removeLeafNode(e){this.Pages().removeLeafNode(e)}};Io.withContextAndPages=(n,e)=>{let t=new Map;return t.set(v.of("Type"),v.of("Catalog")),t.set(v.of("Pages"),e),new Io(t,n)};Io.fromMapWithContext=(n,e)=>new Io(n,e);var yr=Io;var Bo=class n extends W{Parent(){return this.lookup(v.of("Parent"))}Kids(){return this.lookup(v.of("Kids"),Z)}Count(){return this.lookup(v.of("Count"),G)}pushTreeNode(e){this.Kids().push(e)}pushLeafNode(e){let t=this.Kids();this.insertLeafKid(t.size(),e)}insertLeafNode(e,t){let i=this.Kids(),r=this.Count().asNumber();if(t>r)throw new Ss(t,r);let o=t;for(let s=0,a=i.size();so)return l.insertLeafNode(e,o)||c;o-=l.Count().asNumber()}l instanceof et&&(o-=1)}if(o===0){this.insertLeafKid(i.size(),e);return}throw new Es(t,"insertLeafNode")}removeLeafNode(e,t=!0){let i=this.Kids(),r=this.Count().asNumber();if(e>=r)throw new Ss(e,r);let o=e;for(let s=0,a=i.size();so){l.removeLeafNode(o,t),t&&l.Kids().size()===0&&i.remove(s);return}else o-=l.Count().asNumber();if(l instanceof et)if(o===0){this.removeKid(s);return}else o-=1}throw new Es(e,"removeLeafNode")}ascend(e){e(this);let t=this.Parent();t&&t.ascend(e)}traverse(e){let t=this.Kids();for(let i=0,r=t.size();i{let o=r.Count().asNumber()+1;r.set(v.of("Count"),G.of(o))}),i.insert(e,t)}removeKid(e){let t=this.Kids();t.lookup(e)instanceof et&&this.ascend(r=>{let o=r.Count().asNumber()-1;r.set(v.of("Count"),G.of(o))}),t.remove(e)}};Bo.withContext=(n,e)=>{let t=new Map;return t.set(v.of("Type"),v.of("Pages")),t.set(v.of("Kids"),n.obj([])),t.set(v.of("Count"),n.obj(0)),e&&t.set(v.of("Parent"),e),new Bo(t,n)};Bo.fromMapWithContext=(n,e)=>new Bo(n,e);var vr=Bo;var wr;(function(n){n[n.Deleted=0]="Deleted",n[n.Uncompressed=1]="Uncompressed",n[n.Compressed=2]="Compressed"})(wr||(wr={}));var Oo=class n extends fr{constructor(e,t,i=!0){super(e,i),this.computeIndex=()=>{let r=[],o=0;for(let s=0,a=this.entries.length;s1&&(r.push(o),r.push(c.ref.objectNumber),o=0),o+=1}return r.push(o),r},this.computeEntryTuples=()=>{let r=new Array(this.entries.length);for(let o=0,s=this.entries.length;o{let r=this.entryTuplesCache.access(),o=[0,0,0];for(let s=0,a=r.length;so[0]&&(o[0]=h),u>o[1]&&(o[1]=u),p>o[2]&&(o[2]=p)}return o},this.entries=t||[],this.entryTuplesCache=ht.populatedBy(this.computeEntryTuples),this.maxByteWidthsCache=ht.populatedBy(this.computeMaxEntryByteWidths),this.indexCache=ht.populatedBy(this.computeIndex),e.set(v.of("Type"),v.of("XRef"))}addDeletedEntry(e,t){let i=wr.Deleted;this.entries.push({type:i,ref:e,nextFreeObjectNumber:t}),this.entryTuplesCache.invalidate(),this.maxByteWidthsCache.invalidate(),this.indexCache.invalidate(),this.contentsCache.invalidate()}addUncompressedEntry(e,t){let i=wr.Uncompressed;this.entries.push({type:i,ref:e,offset:t}),this.entryTuplesCache.invalidate(),this.maxByteWidthsCache.invalidate(),this.indexCache.invalidate(),this.contentsCache.invalidate()}addCompressedEntry(e,t,i){let r=wr.Compressed;this.entries.push({type:r,ref:e,objectStreamRef:t,index:i}),this.entryTuplesCache.invalidate(),this.maxByteWidthsCache.invalidate(),this.indexCache.invalidate(),this.contentsCache.invalidate()}clone(e){let{dict:t,entries:i,encode:r}=this;return n.of(t.clone(e),i.slice(),r)}getContentsString(){let e=this.entryTuplesCache.access(),t=this.maxByteWidthsCache.access(),i="";for(let r=0,o=e.length;r=0;u--)i+=(l[u]||0).toString(2);for(let u=t[1]-1;u>=0;u--)i+=(d[u]||0).toString(2);for(let u=t[2]-1;u>=0;u--)i+=(h[u]||0).toString(2)}return i}getUnencodedContents(){let e=this.entryTuplesCache.access(),t=this.maxByteWidthsCache.access(),i=new Uint8Array(this.getUnencodedContentsSize()),r=0;for(let o=0,s=e.length;o=0;p--)i[r++]=d[p]||0;for(let p=t[1]-1;p>=0;p--)i[r++]=h[p]||0;for(let p=t[2]-1;p>=0;p--)i[r++]=u[p]||0}return i}getUnencodedContentsSize(){let e=this.maxByteWidthsCache.access();return Lf(e)*this.entries.length}updateDict(){super.updateDict();let e=this.maxByteWidthsCache.access(),t=this.indexCache.access(),{context:i}=this.dict;this.dict.set(v.of("W"),i.obj(e)),this.dict.set(v.of("Index"),i.obj(t))}};Oo.create=(n,e=!0)=>{let t=new Oo(n,[],e);return t.addDeletedEntry(Y.of(0,65535),0),t};Oo.of=(n,e,t=!0)=>new Oo(n,e,t);var Ud=Oo;var Jl=class extends Bs{constructor(e,t,i,r){super(e,t),this.encodeStreams=i,this.objectsPerStream=r}computeBufferSize(){return Q(this,void 0,void 0,function*(){let e=this.context.largestObjectNumber+1,t=$i.forVersion(1,7),i=t.sizeInBytes()+2,r=Ud.create(this.createTrailerDict(),this.encodeStreams),o=[],s=[],a=[],c=this.context.security,l=this.context.enumerateIndirectObjects();for(let p=0,f=l.length;pnew Jl(n,e,t,i);var qd=Jl;var Ql=class{constructor(e,t){this.encoding=e===lo.ZapfDingbats?cl.ZapfDingbats:e===lo.Symbol?cl.Symbol:cl.WinAnsi,this.font=Mb.load(e),this.fontName=this.font.FontName,this.customName=t}encodeText(e){let t=this.encodeTextAsGlyphs(e),i=new Array(t.length);for(let r=0,o=t.length;rnew Ql(n,e);var Fr=Ql;var $b=(n,e)=>{let t=new Array(n.length);for(let i=0,r=n.length;i`/CIDInit /ProcSet findresource begin 12 dict begin begincmap /CIDSystemInfo << /Registry (Adobe) /Ordering (UCS) /Supplement 0 >> def /CMapName /Adobe-Identity-UCS def /CMapType 2 def 1 begincodespacerange <0000> endcodespacerange ${n.length} beginbfchar ${n.map(([e,t])=>`${e} ${t}`).join(` `)} endbfchar endcmap CMapName currentdict /CMap defineresource pop end end`,Qb=(...n)=>`<${n.join("")}>`,jd=n=>Ki(n,4),dP=n=>{if(zf(n))return jd(n);if(Uf(n)){let i=gd(n),r=md(n);return`${jd(i)}${jd(r)}`}let t=`0x${Gi(n)} is not a valid UTF-8 or UTF-16 codepoint.`;throw new Error(t)};var hP=n=>{let e=0,t=i=>{e|=1<{let e=n["OS/2"]?n["OS/2"].sFamilyClass:0;return hP({fixedPitch:n.post.isFixedPitch,serif:1<=e&&e<=7,symbolic:!0,script:e===10,italic:n.head.macStyle.italic})};var z0=class n{static for(e,t,i,r){return Q(this,void 0,void 0,function*(){let o=yield e.create(t);return new n(o,t,i,r)})}constructor(e,t,i,r){this.allGlyphsInFontSortedById=()=>{let o=new Array(this.font.characterSet.length);for(let s=0,a=o.length;ss.id)},this.font=e,this.scale=1e3/this.font.unitsPerEm,this.fontData=t,this.fontName=this.font.postscriptName||"Font",this.customName=i,this.fontFeatures=r,this.baseFontName="",this.glyphCache=ht.populatedBy(this.allGlyphsInFontSortedById)}encodeText(e){let{glyphs:t}=this.font.layout(e,this.fontFeatures),i=new Array(t.length);for(let r=0,o=t.length;rthis.glyphs),this.glyphIdMap=new Map}encodeText(e){let{glyphs:t}=this.font.layout(e,this.fontFeatures),i=new Array(t.length);for(let r=0,o=t.length;r{let i=[];this.subset.encodeStream().on("data",r=>i.push(r)).on("end",()=>e(If(i))).on("error",r=>t(r))})}},Wd=U0;var Hs;(function(n){n.Source="Source",n.Data="Data",n.Alternative="Alternative",n.Supplement="Supplement",n.EncryptedPayload="EncryptedPayload",n.FormData="EncryptedPayload",n.Schema="Schema",n.Unspecified="Unspecified"})(Hs||(Hs={}));var q0=class n{static for(e,t,i={}){return new n(e,t,i)}constructor(e,t,i={}){this.fileData=e,this.fileName=t,this.options=i}embedIntoContext(e,t){return Q(this,void 0,void 0,function*(){let{mimeType:i,description:r,creationDate:o,modificationDate:s,afRelationship:a}=this.options,c=e.flateStream(this.fileData,{Type:"EmbeddedFile",Subtype:i!=null?i:void 0,Params:{Size:this.fileData.length,CreationDate:o?J.fromDate(o):void 0,ModDate:s?J.fromDate(s):void 0}}),l=e.register(c),d=e.obj({Type:"Filespec",F:J.of(this.fileName),UF:K.fromText(this.fileName),EF:{F:l},Desc:r?K.fromText(r):void 0,AFRelationship:a!=null?a:void 0});return t?(e.assign(t,d),t):e.register(d)})}getFileData(){return this.fileData}},Kd=q0;var ty=[65472,65473,65474,65475,65477,65478,65479,65480,65481,65482,65483,65484,65485,65486,65487],zs;(function(n){n.DeviceGray="DeviceGray",n.DeviceRGB="DeviceRGB",n.DeviceCMYK="DeviceCMYK"})(zs||(zs={}));var uP={1:zs.DeviceGray,3:zs.DeviceRGB,4:zs.DeviceCMYK},j0=class n{static for(e){return Q(this,void 0,void 0,function*(){let t=new DataView(e.buffer,e.byteOffset,e.byteLength);if(t.getUint16(0)!==65496)throw new Error("SOI not found in JPEG");let r=2,o;for(;r>3)]>>7-((f&7)<<0)&1,I=3*S;a[y]=F[I],a[y+1]=F[I+1],a[y+2]=F[I+2],a[y+3]=S>2)]>>6-((f&3)<<1)&3,I=3*S;a[y]=F[I],a[y+1]=F[I+1],a[y+2]=F[I+2],a[y+3]=S>1)]>>4-((f&1)<<2)&15,I=3*S;a[y]=F[I],a[y+1]=F[I+1],a[y+2]=F[I+2],a[y+3]=S>>3)]>>>7-(V&7)&1),X=A==g*255?0:255;c[q+V]=X<<24|A<<16|A<<8|A}else if(d==2)for(var V=0;V>>2)]>>>6-((V&3)<<1)&3),X=A==g*85?0:255;c[q+V]=X<<24|A<<16|A<<8|A}else if(d==4)for(var V=0;V>>1)]>>>4-((V&1)<<2)&15),X=A==g*17?0:255;c[q+V]=X<<24|A<<16|A<<8|A}else if(d==8)for(var V=0;V>>2<<3));r==0;){if(r=x(e,u,1),o=x(e,u+1,2),u+=3,o==0){(u&7)!=0&&(u+=8-(u&7));var k=(u>>>3)+4,E=e[k-4]|e[k-3]<<8;C&&(t=n.H.W(t,h+E)),t.set(new i(e.buffer,e.byteOffset+k,E),h),u=k+E<<3,h+=E;continue}if(C&&(t=n.H.W(t,h+(1<<17))),o==1&&(p=D.J,f=D.h,l=511,d=31),o==2){s=g(e,u,5)+257,a=g(e,u+5,5)+1,c=g(e,u+10,4)+4,u+=14;for(var B=u,S=1,I=0;I<38;I+=2)D.Q[I]=0,D.Q[I+1]=0;for(var I=0;IS&&(S=O)}u+=3*c,w(D.Q,S),y(D.Q,S,D.u),p=D.w,f=D.d,u=b(D.u,(1<>>4;if(!(V>>>8))t[h++]=V;else{if(V==256)break;var X=h+V-254;if(V>264){var L=D.q[V-257];X=h+(L>>>3)+g(e,u,L&7),u+=L&7}var U=f[F(e,u)&d];u+=U&15;var R=U>>>4,M=D.c[R],re=(M>>>4)+x(e,u,M&15);for(u+=M&15;h>>4;if(h<=15)s[l]=h,l++;else{var u=0,p=0;h==16?(p=3+a(r,o,2),o+=2,u=s[l-1]):h==17?(p=3+a(r,o,3),o+=3):h==18&&(p=11+a(r,o,7),o+=7);for(var f=l+p;l>>1;so&&(o=c),s++}for(;s>1,l=e[a+1],d=c<<4|l,h=t-l,u=e[a]<>>15-t;i[f]=d,u++}},n.H.l=function(e,t){for(var i=n.H.m.r,r=15-t,o=0;o>>r}},n.H.M=function(e,t,i){i=i<<(t&7);var r=t>>>3;e[r]|=i,e[r+1]|=i>>>8},n.H.I=function(e,t,i){i=i<<(t&7);var r=t>>>3;e[r]|=i,e[r+1]|=i>>>8,e[r+2]|=i>>>16},n.H.e=function(e,t,i){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)},n.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)},n.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 e=n.H.m,t=32768,i=0;i>>1|(r&1431655765)<<1,r=(r&3435973836)>>>2|(r&858993459)<<2,r=(r&4042322160)>>>4|(r&252645135)<<4,r=(r&4278255360)>>>8|(r&16711935)<<8,e.r[i]=(r>>>16|r<<16)>>>17}function o(s,a,c){for(;a--!=0;)s.push(0,c)}for(var i=0;i<32;i++)e.q[i]=e.S[i]<<3|e.T[i],e.c[i]=e.p[i]<<4|e.z[i];o(e._,144,8),o(e._,112,9),o(e._,24,7),o(e._,8,8),n.H.n(e._,9),n.H.A(e._,9,e.J),n.H.l(e._,9),o(e.$,32,5),n.H.n(e.$,5),n.H.A(e.$,5,e.h),n.H.l(e.$,5),o(e.Q,19,0),o(e.C,286,0),o(e.D,30,0),o(e.v,320,0)})(),n.H.N})();j.decode._readInterlace=function(n,e){for(var t=e.width,i=e.height,r=j.decode._getBPP(e),o=r>>3,s=Math.ceil(t*r/8),a=new Uint8Array(i*s),c=0,l=[0,0,4,0,2,0,1],d=[0,4,0,2,0,1,0],h=[8,8,8,4,4,2,2],u=[8,8,4,4,2,2,1],p=0;p<7;){for(var f=h[p],m=u[p],x=0,g=0,b=l[p];b>3];E=E>>7-(k&7)&1,a[D*s+(C>>3)]|=E<<7-((C&7)<<0)}if(r==2){var E=n[k>>3];E=E>>6-(k&7)&3,a[D*s+(C>>2)]|=E<<6-((C&3)<<1)}if(r==4){var E=n[k>>3];E=E>>4-(k&7)&15,a[D*s+(C>>1)]|=E<<4-((C&1)<<2)}if(r>=8)for(var B=D*s+C*o,S=0;S>3)+S];k+=r,C+=m}F++,D+=f}x*g!=0&&(c+=g*(1+y)),p=p+1}return a};j.decode._getBPP=function(n){var e=[1,null,3,1,2,null,4][n.ctype];return e*n.depth};j.decode._filterZero=function(n,e,t,i,r){var o=j.decode._getBPP(e),s=Math.ceil(i*o/8),a=j.decode._paeth;o=Math.ceil(o/8);var c=0,l=1,d=n[t],h=0;if(d>1&&(n[t]=[0,0,1][d-2]),d==3)for(h=o;h>>1)&255;for(var u=0;u>>1);for(;h>>1)}else{for(;h>8&255,n[e+1]=t&255},readUint:function(n,e){return n[e]*(256*256*256)+(n[e+1]<<16|n[e+2]<<8|n[e+3])},writeUint:function(n,e,t){n[e]=t>>24&255,n[e+1]=t>>16&255,n[e+2]=t>>8&255,n[e+3]=t&255},readASCII:function(n,e,t){for(var i="",r=0;r=0&&a>=0?(h=p*e+f<<2,u=(a+p)*r+s+f<<2):(h=(-a+p)*e-s+f<<2,u=p*r+f<<2),c==0)i[u]=n[h],i[u+1]=n[h+1],i[u+2]=n[h+2],i[u+3]=n[h+3];else if(c==1){var m=n[h+3]*.00392156862745098,x=n[h]*m,g=n[h+1]*m,b=n[h+2]*m,w=i[u+3]*(1/255),y=i[u]*w,F=i[u+1]*w,D=i[u+2]*w,C=1-m,k=m+w*C,E=k==0?0:1/k;i[u+3]=255*k,i[u+0]=(x+y*C)*E,i[u+1]=(g+F*C)*E,i[u+2]=(b+D*C)*E}else if(c==2){var m=n[h+3],x=n[h],g=n[h+1],b=n[h+2],w=i[u+3],y=i[u],F=i[u+1],D=i[u+2];m==w&&x==y&&g==F&&b==D?(i[u]=0,i[u+1]=0,i[u+2]=0,i[u+3]=0):(i[u]=x,i[u+1]=g,i[u+2]=b,i[u+3]=m)}else if(c==3){var m=n[h+3],x=n[h],g=n[h+1],b=n[h+2],w=i[u+3],y=i[u],F=i[u+1],D=i[u+2];if(m==w&&x==y&&g==F&&b==D)continue;if(m<220&&w>20)return!1}return!0};j.encode=function(n,e,t,i,r,o,s){i==null&&(i=0),s==null&&(s=!1);var a=j.encode.compress(n,e,t,i,[!1,!1,!1,0,s]);return j.encode.compressPNG(a,-1),j.encode._main(a,e,t,r,o)};j.encodeLL=function(n,e,t,i,r,o,s,a){for(var c={ctype:0+(i==1?0:2)+(r==0?0:4),depth:o,frames:[]},l=Date.now(),d=(i+r)*o,h=d*e,u=0;u1,h=!1,u=33+(d?20:0);if(r.sRGB!=null&&(u+=13),r.pHYs!=null&&(u+=21),n.ctype==3){for(var p=n.plte.length,f=0;f>>24!=255&&(h=!0);u+=8+p*3+4+(h?8+p*1+4:0)}for(var m=0;m>>8&255,C=y>>>16&255;g[l+w+0]=F,g[l+w+1]=D,g[l+w+2]=C}if(l+=p*3,s(g,l,o(g,l-p*3-4,p*3+4)),l+=4,h){s(g,l,p),l+=4,c(g,l,"tRNS"),l+=4;for(var f=0;f>>24&255;l+=p,s(g,l,o(g,l-p-4,p+4)),l+=4}}for(var k=0,m=0;m>2,I>>2));for(var p=0;pN&&V==A[x-N])q[x]=q[x-N];else{var X=w[V];if(X==null&&(w[V]=X=y.length,y.push(V),y.length>=300))break;q[x]=X}}}var L=y.length;L<=256&&l==!1&&(L<=2?h=1:L<=4?h=2:L<=16?h=4:h=8,h=Math.max(h,c));for(var p=0;p>1)]|=qt[Ot+Fe]<<4-(Fe&1)*4;else if(h==2)for(var Fe=0;Fe>2)]|=qt[Ot+Fe]<<6-(Fe&3)*2;else if(h==1)for(var Fe=0;Fe>3)]|=qt[Ot+Fe]<<7-(Fe&7)*1}re=dt,d=3,he=1}else if(g==!1&&b.length==1){for(var dt=new Uint8Array(N*M*3),Ct=N*M,x=0;xC&&(C=B),Ek&&(k=E))}C==-1&&(F=D=C=k=0),r&&((F&1)==1&&F--,(D&1)==1&&D--);var I=(C-F+1)*(k-D+1);Ix&&(x=y),Fg&&(g=F))}x==-1&&(f=m=x=g=0),s&&((f&1)==1&&f--,(m&1)==1&&m--),o={x:f,y:m,width:x-f+1,height:g-m+1};var k=i[r];k.rect=o,k.blend=1,k.img=new Uint8Array(o.width*o.height*4),i[r-1].dispose==0?(j._copyTile(l,e,t,k.img,o.width,o.height,-o.x,-o.y,0),j.encode._prepareDiff(u,e,t,k.img,o)):j._copyTile(u,e,t,k.img,o.width,o.height,-o.x,-o.y,0)};j.encode._prepareDiff=function(n,e,t,i,r){j._copyTile(n,e,t,i,r.width,r.height,-r.x,-r.y,2)};j.encode._filterZero=function(n,e,t,i,r,o,s){var a=[],c=[0,1,2,3,4];o!=-1?c=[o]:(e*i>5e5||t==1)&&(c=[0]);var l;s&&(l={level:0});for(var d=s&&UZIP!=null?UZIP:iy.default,h=0;h>1)+256&255;if(o==4)for(var l=r;l>1)&255;for(var l=r;l>1)&255}if(o==4){for(var l=0;l>>1:t=t>>>1;n[e]=t}return n})(),update:function(n,e,t,i){for(var r=0;r>>8;return n},crc:function(n,e,t){return j.crc.update(4294967295,n,e,t)^4294967295}};j.quantize=function(n,e){for(var t=new Uint8Array(n),i=t.slice(0),r=new Uint32Array(i.buffer),o=j.quantize.getKDtree(i,e),s=o[0],a=o[1],c=j.quantize.planeDst,l=t,d=r,h=l.length,u=new Uint8Array(t.length>>2),p=0;p>2]=b.ind,d[p>>2]=b.est.rgba}return{abuf:i.buffer,inds:u,plte:a}};j.quantize.getKDtree=function(n,e,t){t==null&&(t=1e-4);var i=new Uint32Array(n.buffer),r={i0:0,i1:n.length,bst:null,est:null,tdst:0,left:null,right:null};r.bst=j.quantize.stats(n,r.i0,r.i1),r.est=j.quantize.estats(r.bst);for(var o=[r];o.lengths&&(s=o[c].est.L,a=c);if(s=d||l.i1<=d;if(h){l.est.L=0;continue}var u={i0:l.i0,i1:d,bst:null,est:null,tdst:0,left:null,right:null};u.bst=j.quantize.stats(n,u.i0,u.i1),u.est=j.quantize.estats(u.bst);var p={i0:d,i1:l.i1,bst:null,est:null,tdst:0,left:null,right:null};p.bst={R:[],m:[],N:l.bst.N-u.bst.N};for(var c=0;c<16;c++)p.bst.R[c]=l.bst.R[c]-u.bst.R[c];for(var c=0;c<4;c++)p.bst.m[c]=l.bst.m[c]-u.bst.m[c];p.est=j.quantize.estats(p.bst),l.left=u,l.right=p,o[a]=u,o.push(p)}o.sort(function(f,m){return m.bst.N-f.bst.N});for(var c=0;c0&&(s=n.right,a=n.left);var c=j.quantize.getNearest(s,e,t,i,r);if(c.tdst<=o*o)return c;var l=j.quantize.getNearest(a,e,t,i,r);return l.tdsto;)i-=4;if(t>=i)break;var c=e[t>>2];e[t>>2]=e[i>>2],e[i>>2]=c,t+=4,i-=4}for(;s(n,t,r)>o;)t-=4;return t+4};j.quantize.vecDot=function(n,e,t){return n[e]*t[0]+n[e+1]*t[1]+n[e+2]*t[2]+n[e+3]*t[3]};j.quantize.stats=function(n,e,t){for(var i=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],r=[0,0,0,0],o=t-e>>2,s=e;s>>0}};j.M4={multVec:function(n,e){return[n[0]*e[0]+n[1]*e[1]+n[2]*e[2]+n[3]*e[3],n[4]*e[0]+n[5]*e[1]+n[6]*e[2]+n[7]*e[3],n[8]*e[0]+n[9]*e[1]+n[10]*e[2]+n[11]*e[3],n[12]*e[0]+n[13]*e[1]+n[14]*e[2]+n[15]*e[3]]},dot:function(n,e){return n[0]*e[0]+n[1]*e[1]+n[2]*e[2]+n[3]*e[3]},sml:function(n,e){return[n*e[0],n*e[1],n*e[2],n*e[3]]}};j.encode.concatRGBA=function(n){for(var e=0,t=0;t{if(n===0)return Lo.Greyscale;if(n===2)return Lo.Truecolour;if(n===3)return Lo.IndexedColour;if(n===4)return Lo.GreyscaleWithAlpha;if(n===6)return Lo.TruecolourWithAlpha;throw new Error(`Unknown color type: ${n}`)},pP=n=>{let e=Math.floor(n.length/4),t=new Uint8Array(e*3),i=new Uint8Array(e*1),r=0,o=0,s=0;for(;r1)throw new Error("Animated PNGs are not supported");let r=new Uint8Array(i[0]),{rgbChannel:o,alphaChannel:s}=pP(r);this.rgbChannel=o,s.some(c=>c<255)&&(this.alphaChannel=s),this.type=fP(t.ctype),this.width=t.width,this.height=t.height,this.bitsPerComponent=8}};qs.load=n=>new qs(n);var K0=class n{static for(e){return Q(this,void 0,void 0,function*(){let t=qs.load(e);return new n(t)})}constructor(e){this.image=e,this.bitsPerComponent=e.bitsPerComponent,this.width=e.width,this.height=e.height,this.colorSpace="DeviceRGB"}embedIntoContext(e,t){return Q(this,void 0,void 0,function*(){let i=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:i});return t?(e.assign(t,r),t):e.register(r)})}embedAlphaChannel(e){if(!this.image.alphaChannel)return;let 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)}},js=K0;var G0=class n{constructor(e,t,i){this.bytes=e,this.start=t||0,this.pos=this.start,this.end=t&&i?t+i:this.bytes.length}get length(){return this.end-this.start}get isEmpty(){return this.length===0}getByte(){return this.pos>=this.end?-1:this.bytes[this.pos++]}getUint16(){let e=this.getByte(),t=this.getByte();return e===-1||t===-1?-1:(e<<8)+t}getInt32(){let e=this.getByte(),t=this.getByte(),i=this.getByte(),r=this.getByte();return(e<<24)+(t<<16)+(i<<8)+r}getBytes(e,t=!1){let i=this.bytes,r=this.pos,o=this.end;if(e){let s=r+e;s>o&&(s=o),this.pos=s;let a=i.subarray(r,s);return t?new Uint8ClampedArray(a):a}else{let s=i.subarray(r,o);return t?new Uint8ClampedArray(s):s}}peekByte(){let e=this.getByte();return this.pos--,e}peekBytes(e,t=!1){let i=this.getBytes(e,t);return this.pos-=i.length,i}skip(e){e||(e=1),this.pos+=e}reset(){this.pos=this.start}moveStart(){this.start=this.pos}makeSubStream(e,t){return new n(this.bytes,e,t)}decode(){return this.bytes}},Gd=G0;var gP=new Uint8Array(0),X0=class{constructor(e){if(this.pos=0,this.bufferLength=0,this.eof=!1,this.buffer=gP,this.minBufferLength=512,e)for(;this.minBufferLengths&&(i=s)}else{for(;!this.eof;)this.readBlock();i=this.bufferLength}this.pos=i;let o=this.buffer.subarray(r,i);return t&&!(o instanceof Uint8ClampedArray)?new Uint8ClampedArray(o):o}peekByte(){let e=this.getByte();return this.pos--,e}peekBytes(e,t=!1){let i=this.getBytes(e,t);return this.pos-=i.length,i}skip(e){e||(e=1),this.pos+=e}reset(){this.pos=0}makeSubStream(e,t){let i=e+t;for(;this.bufferLength<=i&&!this.eof;)this.readBlock();return new Gd(this.buffer,e,t)}decode(){for(;!this.eof;)this.readBlock();return this.buffer.subarray(0,this.bufferLength)}readBlock(){throw new Ze(this.constructor.name,"readBlock")}ensureBuffer(e){let t=this.buffer;if(e<=t.byteLength)return t;let i=this.minBufferLength;for(;in===32||n===9||n===13||n===10,Z0=class extends di{constructor(e,t){super(t),this.stream=e,this.input=new Uint8Array(5),t&&(t=.8*t)}readBlock(){let r=this.stream,o=r.getByte();for(;ny(o);)o=r.getByte();if(o===-1||o===126){this.eof=!0;return}let s=this.bufferLength,a,c;if(o===122){for(a=this.ensureBuffer(s+4),c=0;c<4;++c)a[s+c]=0;this.bufferLength+=4}else{let l=this.input;for(l[0]=o,c=1;c<5;++c){for(o=r.getByte();ny(o);)o=r.getByte();if(l[c]=o,o===-1||o===126)break}if(a=this.ensureBuffer(s+c-1),this.bufferLength+=c-1,c<5){for(;c<5;++c)l[c]=117;this.eof=!0}let d=0;for(c=0;c<5;++c)d=d*85+(l[c]-33);for(c=3;c>=0;--c)a[s+c]=d&255,d>>=8}}},ry=Z0;var Y0=class extends di{constructor(e,t){super(t),this.stream=e,this.firstDigit=-1,t&&(t=.5*t)}readBlock(){let t=this.stream.getBytes(8e3);if(!t.length){this.eof=!0;return}let i=t.length+1>>1,r=this.ensureBuffer(this.bufferLength+i),o=this.bufferLength,s=this.firstDigit;for(let a=0,c=t.length;a=48&&l<=57)d=l&15;else if(l>=65&&l<=70||l>=97&&l<=102)d=(l&15)+9;else if(l===62){this.eof=!0;break}else continue;s<0?s=d:(r[o++]=s<<4|d,s=-1)}s>=0&&this.eof&&(r[o++]=s<<4,s=-1),this.firstDigit=s,this.bufferLength=o}},oy=Y0;var sy=new Int32Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),mP=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]),xP=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]),bP=[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],yP=[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],_0=class extends di{constructor(e,t){super(t),this.stream=e;let i=e.getByte(),r=e.getByte();if(i===-1||r===-1)throw new Error(`Invalid header in flate stream: ${i}, ${r}`);if((i&15)!==8)throw new Error(`Unknown compression method in flate stream: ${i}, ${r}`);if(((i<<8)+r)%31!==0)throw new Error(`Bad FCHECK in flate stream: ${i}, ${r}`);if(r&32)throw new Error(`FDICT bit set in flate stream: ${i}, ${r}`);this.codeSize=0,this.codeBuf=0}readBlock(){let e,t,i=this.stream,r=this.getBits(3);if(r&1&&(this.eof=!0),r>>=1,r===0){let l;if((l=i.getByte())===-1)throw new Error("Bad block header in flate stream");let d=l;if((l=i.getByte())===-1)throw new Error("Bad block header in flate stream");if(d|=l<<8,(l=i.getByte())===-1)throw new Error("Bad block header in flate stream");let h=l;if((l=i.getByte())===-1)throw new Error("Bad block header in flate stream");if(h|=l<<8,h!==(~d&65535)&&(d!==0||h!==0))throw new Error("Bad uncompressed block length in flate stream");this.codeBuf=0,this.codeSize=0;let u=this.bufferLength;e=this.ensureBuffer(u+d);let p=u+d;if(this.bufferLength=p,d===0)i.peekByte()===-1&&(this.eof=!0);else for(let f=u;f0;)x[p++]=w}o=this.generateHuffmanTable(x.subarray(0,l)),s=this.generateHuffmanTable(x.subarray(l,m))}else throw new Error("Unknown block type in flate stream");e=this.buffer;let a=e?e.length:0,c=this.bufferLength;for(;;){let l=this.getCode(o);if(l<256){c+1>=a&&(e=this.ensureBuffer(c+1),a=e.length),e[c++]=l;continue}if(l===256){this.bufferLength=c;return}l-=257,l=mP[l];let d=l>>16;d>0&&(d=this.getBits(d)),t=(l&65535)+d,l=this.getCode(s),l=xP[l],d=l>>16,d>0&&(d=this.getBits(d));let h=(l&65535)+d;c+t>=a&&(e=this.ensureBuffer(c+t),a=e.length);for(let u=0;u>e,this.codeSize=i-=e,o}getCode(e){let t=this.stream,i=e[0],r=e[1],o=this.codeSize,s=this.codeBuf,a;for(;o>16,d=c&65535;if(l<1||o>l,this.codeSize=o-l,d}generateHuffmanTable(e){let t=e.length,i=0,r;for(r=0;ri&&(i=e[r]);let o=1<>=1;for(r=h;r0;if(!y||y<256)m[0]=y,x=1;else if(y>=258)if(y=0;o--)m[o]=d[s],s=u[s];else m[x++]=m[0];else if(y===256){p=9,l=258,x=0;continue}else{this.eof=!0,delete this.lzwState;break}if(F&&(u[l]=f,h[l]=h[f]+1,d[l]=m[0],l++,p=l+c&l+c-1?p:Math.min(Math.log(l+c)/.6931471805599453+1,12)|0),f=y,g+=x,t>>t&(1<0){let o=this.stream.getBytes(r);t.set(o,i),i+=r}}else{r=257-r;let o=e[1];t=this.ensureBuffer(i+r+1);for(let s=0;s{if(e===v.of("FlateDecode"))return new ay(n);if(e===v.of("LZWDecode")){let i=1;if(t instanceof W){let r=t.lookup(v.of("EarlyChange"));r instanceof G&&(i=r.asNumber())}return new ly(n,void 0,i)}if(e===v.of("ASCII85Decode"))return new ry(n);if(e===v.of("ASCIIHexDecode"))return new oy(n);if(e===v.of("RunLengthDecode"))return new cy(n);throw new pl(e.asString())},Pr=({dict:n,contents:e,transform:t})=>{let i=new Gd(e);t&&(i=t.createStream(i,e.length));let r=n.lookup(v.of("Filter")),o=n.lookup(v.of("DecodeParms"));if(r instanceof v)i=dy(i,r,o);else if(r instanceof Z)for(let s=0,a=r.size();s{let e=n.MediaBox(),t=e.lookup(0,G).asNumber(),i=e.lookup(1,G).asNumber(),r=e.lookup(2,G).asNumber(),o=e.lookup(3,G).asNumber();return{left:Math.min(t,r),bottom:Math.min(i,o),right:Math.max(t,r),top:Math.max(i,o)}},wP=n=>[1,0,0,1,-n.left,-n.bottom],$0=class n{static for(e,t,i){return Q(this,void 0,void 0,function*(){return new n(e,t,i)})}constructor(e,t,i){this.page=e;let r=t!=null?t:vP(e);this.width=r.right-r.left,this.height=r.top-r.bottom,this.boundingBox=r,this.transformationMatrix=i!=null?i:wP(r)}embedIntoContext(e,t){return Q(this,void 0,void 0,function*(){let{Contents:i,Resources:r}=this.page.normalizedEntries();if(!i)throw new gl;let o=this.decodeContents(i),{left:s,bottom:a,right:c,top:l}=this.boundingBox,d=e.flateStream(o,{Type:"XObject",Subtype:"Form",FormType:1,BBox:[s,a,c,l],Matrix:this.transformationMatrix,Resources:r});return t?(e.assign(t,d),t):e.register(d)})}decodeContents(e){let t=Uint8Array.of(P.Newline),i=[];for(let r=0,o=e.size();rNumber.MAX_SAFE_INTEGER)if(this.capNumbers){let i=`Parsed number that is too large for some PDF readers: ${e}, using Number.MAX_SAFE_INTEGER instead.`;return console.warn(i),Number.MAX_SAFE_INTEGER}else{let i=`Parsed number that is too large for some PDF readers: ${e}, not capping.`;console.warn(i)}return t}skipWhitespace(){for(;!this.bytes.done()&&ci[this.bytes.peek()];)this.bytes.next()}skipLine(){for(;!this.bytes.done();){let e=this.bytes.peek();if(e===hy||e===uy)return;this.bytes.next()}}skipComment(){if(this.bytes.peek()!==P.Percent)return!1;for(;!this.bytes.done();){let e=this.bytes.peek();if(e===hy||e===uy)return!0;this.bytes.next()}return!0}skipWhitespaceAndComments(){for(this.skipWhitespace();this.skipComment();)this.skipWhitespace()}matchKeyword(e){let t=this.bytes.offset();for(let i=0,r=e.length;i=this.length}offset(){return this.idx}slice(e,t){return this.bytes.slice(e,t)}position(){return{line:this.line,column:this.column,offset:this.idx}}};Mo.of=n=>new Mo(n);Mo.fromPDFRawStream=n=>Mo.of(Pr(n).decode());var kr=Mo;var{Space:FP,CarriageReturn:ec,Newline:tc}=P,ic=[P.s,P.t,P.r,P.e,P.a,P.m],Zd=[P.e,P.n,P.d,P.s,P.t,P.r,P.e,P.a,P.m],Ie={header:[P.Percent,P.P,P.D,P.F,P.Dash],eof:[P.Percent,P.Percent,P.E,P.O,P.F],obj:[P.o,P.b,P.j],endobj:[P.e,P.n,P.d,P.o,P.b,P.j],xref:[P.x,P.r,P.e,P.f],trailer:[P.t,P.r,P.a,P.i,P.l,P.e,P.r],startxref:[P.s,P.t,P.a,P.r,P.t,P.x,P.r,P.e,P.f],true:[P.t,P.r,P.u,P.e],false:[P.f,P.a,P.l,P.s,P.e],null:[P.n,P.u,P.l,P.l],stream:ic,streamEOF1:[...ic,FP,ec,tc],streamEOF2:[...ic,ec,tc],streamEOF3:[...ic,ec],streamEOF4:[...ic,tc],endstream:Zd,EOF1endstream:[ec,tc,...Zd],EOF2endstream:[ec,...Zd],EOF3endstream:[tc,...Zd]};var No=class extends fy{constructor(e,t,i=!1,r){super(e,i),this.context=t,this.cryptoFactory=r}parseObject(e){if(this.skipWhitespaceAndComments(),this.matchKeyword(Ie.true))return Li.True;if(this.matchKeyword(Ie.false))return Li.False;if(this.matchKeyword(Ie.null))return He;let t=this.bytes.peek();if(t===P.LessThan&&this.bytes.peekAhead(1)===P.LessThan)return this.parseDictOrStream(e);if(t===P.LessThan)return this.parseHexString(e);if(t===P.LeftParen)return this.parseString(e);if(t===P.ForwardSlash)return this.parseName();if(t===P.LeftSquareBracket)return this.parseArray(e);if($l[t])return this.parseNumberOrRef();throw new Dl(this.bytes.position(),t)}parseNumberOrRef(){let e=this.parseRawNumber();this.skipWhitespaceAndComments();let t=this.bytes.offset();if(it[this.bytes.peek()]){let i=this.parseRawNumber();if(this.skipWhitespaceAndComments(),this.bytes.peek()===P.R)return this.bytes.assertNext(P.R),Y.of(e,i)}return this.bytes.moveTo(t),G.of(e)}parseHexString(e){let t="";for(this.bytes.assertNext(P.LessThan);!this.bytes.done()&&this.bytes.peek()!==P.GreaterThan;)t+=Mt(this.bytes.next());return this.bytes.assertNext(P.GreaterThan),this.cryptoFactory&&e&&(t=this.cryptoFactory.createCipherTransform(e.objectNumber,e.generationNumber).decryptBytes(K.of(t).asBytes()).reduce((o,s)=>o+s.toString(16).padStart(2,"0"),"")),K.of(t)}parseString(e){let t=0,i=!1,r="";for(;!this.bytes.done();){let o=this.bytes.next();if(r+=Mt(o),i||(o===P.LeftParen&&(t+=1),o===P.RightParen&&(t-=1)),o===P.BackSlash?i=!i:i&&(i=!1),t===0){let s=r.substring(1,r.length-1);return this.cryptoFactory&&e&&(s=this.cryptoFactory.createCipherTransform(e.objectNumber,e.generationNumber).decryptString(s)),J.of(s)}}throw new Cl(this.bytes.position())}parseName(){this.bytes.assertNext(P.ForwardSlash);let e="";for(;!this.bytes.done();){let t=this.bytes.peek();if(ci[t]||Ht[t])break;e+=Mt(t),this.bytes.next()}return v.of(e)}parseArray(e){this.bytes.assertNext(P.LeftSquareBracket),this.skipWhitespaceAndComments();let t=Z.withContext(this.context);for(;this.bytes.peek()!==P.RightSquareBracket;){let i=this.parseObject(e);t.push(i),this.skipWhitespaceAndComments()}return this.bytes.assertNext(P.RightSquareBracket),t}parseDict(e){this.bytes.assertNext(P.LessThan),this.bytes.assertNext(P.LessThan),this.skipWhitespaceAndComments();let t=new Map;for(;!this.bytes.done()&&this.bytes.peek()!==P.GreaterThan&&this.bytes.peekAhead(1)!==P.GreaterThan;){let r=this.parseName(),o=this.parseObject(e);t.set(r,o),this.skipWhitespaceAndComments()}this.skipWhitespaceAndComments(),this.bytes.assertNext(P.GreaterThan),this.bytes.assertNext(P.GreaterThan);let i=t.get(v.of("Type"));return i===v.of("Catalog")?yr.fromMapWithContext(t,this.context):i===v.of("Pages")?vr.fromMapWithContext(t,this.context):i===v.of("Page")?et.fromMapWithContext(t,this.context):W.fromMapWithContext(t,this.context)}parseDictOrStream(e){let t=this.bytes.position(),i=this.parseDict(e);if(this.skipWhitespaceAndComments(),!this.matchKeyword(Ie.streamEOF1)&&!this.matchKeyword(Ie.streamEOF2)&&!this.matchKeyword(Ie.streamEOF3)&&!this.matchKeyword(Ie.streamEOF4)&&!this.matchKeyword(Ie.stream))return i;let r=this.bytes.offset(),o,s=i.get(v.of("Length"));s instanceof G?(o=r+s.asNumber(),this.bytes.moveTo(o),this.skipWhitespaceAndComments(),this.matchKeyword(Ie.endstream)||(this.bytes.moveTo(r),o=this.findEndOfStreamFallback(t))):o=this.findEndOfStreamFallback(t);let a=this.bytes.slice(r,o);return this.cryptoFactory&&e&&(a=this.cryptoFactory.createCipherTransform(e.objectNumber,e.generationNumber).decryptBytes(a)),Mi.of(i,a)}findEndOfStreamFallback(e){let t=1,i=this.bytes.offset();for(;!this.bytes.done()&&(i=this.bytes.offset(),this.matchKeyword(Ie.stream)?t+=1:this.matchKeyword(Ie.EOF1endstream)||this.matchKeyword(Ie.EOF2endstream)||this.matchKeyword(Ie.EOF3endstream)||this.matchKeyword(Ie.endstream)?t-=1:this.bytes.next(),t!==0););if(t!==0)throw new kl(e);return i}};No.forBytes=(n,e,t)=>new No(kr.of(n),e,t);No.forByteStream=(n,e,t=!1)=>new No(n,e,t);var Ks=No;var nc=class extends Ks{constructor(e,t){super(kr.fromPDFRawStream(e),e.dict.context);let{dict:i}=e;this.alreadyParsed=!1,this.shouldWaitForTick=t||(()=>!1),this.firstOffset=i.lookup(v.of("First"),G).asNumber(),this.objectCount=i.lookup(v.of("N"),G).asNumber()}parseIntoContext(){return Q(this,void 0,void 0,function*(){if(this.alreadyParsed)throw new Pn("PDFObjectStreamParser","parseIntoContext");this.alreadyParsed=!0;let e=this.parseOffsetsAndObjectNumbers();for(let t=0,i=e.length;tnew nc(n,e);var Yd=nc;var rc=class{constructor(e){this.alreadyParsed=!1,this.dict=e.dict,this.bytes=kr.fromPDFRawStream(e),this.context=this.dict.context;let t=this.dict.lookup(v.of("Size"),G),i=this.dict.lookup(v.of("Index"));if(i instanceof Z){this.subsections=[];for(let o=0,s=i.size();onew rc(n);var _d=rc;var oc=class extends Ks{constructor(e,t=1/0,i=!1,r=!1,o=!1,s){super(kr.of(e),po.create(),o,s),this.alreadyParsed=!1,this.parsedObjects=0,this.shouldWaitForTick=()=>(this.parsedObjects+=1,this.parsedObjects%this.objectsPerTick===0),this.objectsPerTick=t,this.throwOnInvalidObject=i,this.warnOnInvalidObjects=r,this.context.isDecrypted=!!(s!=null&&s.encryptionKey)}parseDocument(){return Q(this,void 0,void 0,function*(){if(this.alreadyParsed)throw new Pn("PDFParser","parseDocument");this.alreadyParsed=!0,this.context.header=this.parseHeader();let e;for(;!this.bytes.done();){yield this.parseDocumentSection();let t=this.bytes.offset();if(t===e)throw new Sl(this.bytes.position());e=t}return this.maybeRecoverRoot(),this.context.lookup(Y.of(0))&&(console.warn("Removing parsed object: 0 0 R"),this.context.delete(Y.of(0))),this.context})}maybeRecoverRoot(){let e=i=>i instanceof W&&i.lookup(v.of("Type"))===v.of("Catalog"),t=this.context.lookup(this.context.trailerInfo.Root);if(!e(t)){let i=this.context.enumerateIndirectObjects();for(let r=0,o=i.length;r=P.Space&&t<=P.Tilde&&(this.matchKeyword(Ie.xref)||this.matchKeyword(Ie.trailer)||this.matchKeyword(Ie.startxref)||this.matchIndirectObjectHeader())){this.bytes.moveTo(e);break}this.bytes.next()}}skipBinaryHeaderComment(){this.skipWhitespaceAndComments();try{let e=this.bytes.offset();this.parseIndirectObjectHeader(),this.bytes.moveTo(e)}catch(e){this.bytes.next(),this.skipWhitespaceAndComments()}}};oc.forBytesWithOptions=(n,e,t,i,r,o)=>new oc(n,e,t,i,r,o);var sc=oc;var fe=Wi(wv(),1),rp=class n{static create(e,t){return new n(e,t)}constructor(e,t){if(!t.ownerPassword&&!t.userPassword)throw new Error("Either an owner password or a user password must be specified.");this.context=e,this.initialize(t)}initialize(e){this.id=DP();let t;switch(this.context.header.getVersionString()){case"1.4":case"1.5":t=2;break;case"1.6":case"1.7":t=4;break;case"1.7ext3":t=5;break;default:t=1;break}switch(t){case 1:case 2:case 4:this.encryption=this.initializeV1V2V4(t,e);break;case 5:this.encryption=this.initializeV5(e);break}}initializeV1V2V4(e,t){let i={Filter:"Standard"},r,o;switch(e){case 1:r=2,this.keyBits=40,o=PP(t.permissions);break;case 2:r=3,this.keyBits=128,o=np(t.permissions);break;case 4:r=4,this.keyBits=128,o=np(t.permissions);break;default:throw new Error(`Unsupported algorithm '${e}'.`)}let s=Mh(t.userPassword),a=t.ownerPassword?Mh(t.ownerPassword):s,c=SP(r,this.keyBits,s,a);this.encryptionKey=EP(r,this.keyBits,this.id,s,c,o);let l;return r===2?l=kP(this.encryptionKey):l=CP(this.id,this.encryptionKey),i.V=e,e>=2&&(i.Length=this.keyBits),e===4&&(i.CF={StdCF:{AuthEvent:"DocOpen",CFM:"AESV2",Length:this.keyBits/8}},i.StmF="StdCF",i.StrF="StdCF"),i.R=r,i.O=tn(c),i.U=tn(l),i.P=o,i}initializeV5(e){let t={Filter:"Standard"};this.keyBits=256,this.encryptionKey=OP(lc);let i=Fv(e.userPassword),r=TP(i,lc),o=fe.default.lib.WordArray.create(r.words.slice(10,12),8),s=AP(i,o,this.encryptionKey),a=e.ownerPassword?Fv(e.ownerPassword):i,c=IP(a,r,lc),l=fe.default.lib.WordArray.create(c.words.slice(10,12),8),d=BP(a,l,r,this.encryptionKey),h=np(e.permissions),u=LP(h,this.encryptionKey,lc);return t.V=5,t.Length=this.keyBits,t.CF={StdCF:{AuthEvent:"DocOpen",CFM:"AESV3",Length:this.keyBits/8}},t.StmF="StdCF",t.StrF="StdCF",t.R=5,t.O=tn(c),t.OE=tn(d),t.U=tn(r),t.UE=tn(s),t.P=h,t.Perms=tn(u),t}getEncryptFn(e,t){let i=this.encryption.V,r,o;if(i<5){if(r=this.encryptionKey.clone().concat(fe.default.lib.WordArray.create([(e&255)<<24|(e&65280)<<8|e>>8&65280|t&255,(t&65280)<<16],5)),i===1||i===2)return o=fe.default.MD5(r),o.sigBytes=Math.min(16,this.keyBits/8+5),c=>tn(fe.default.RC4.encrypt(fe.default.lib.WordArray.create(c),o).ciphertext);i===4&&(o=fe.default.MD5(r.concat(fe.default.lib.WordArray.create([1933667412],4))))}else if(i===5)o=this.encryptionKey;else throw new Error(`Unsupported algorithm '${i}'.`);let s=lc(16),a={mode:fe.default.mode.CBC,padding:fe.default.pad.Pkcs7,iv:s};return c=>tn(s.clone().concat(fe.default.AES.encrypt(fe.default.lib.WordArray.create(c),o,a).ciphertext))}encrypt(){let e=this.context.obj([this.id,this.id]);this.context.trailerInfo.ID=e;let t=this.context.obj(this.encryption);return this.context.trailerInfo.Encrypt=this.context.register(t),this}},DP=()=>tn(fe.default.MD5(Date.now().toString())),lc=n=>fe.default.lib.WordArray.random(n),PP=(n={})=>{let e=-64;return n.printing&&(e|=4),n.modifying&&(e|=8),n.copying&&(e|=16),n.annotating&&(e|=32),e},np=(n={})=>{let e=-3904;return(n.printing==="lowResolution"||n.printing)&&(e|=4),n.printing==="highResolution"&&(e|=2052),n.modifying&&(e|=8),n.copying&&(e|=16),n.annotating&&(e|=32),n.fillingForms&&(e|=256),n.contentAccessibility&&(e|=512),n.documentAssembly&&(e|=1024),e},kP=n=>fe.default.RC4.encrypt(Mh(),n).ciphertext,CP=(n,e)=>{let t=e.clone(),i=fe.default.MD5(Mh().concat(fe.default.lib.WordArray.create(n)));for(let r=0;r<20;r++){let o=Math.ceil(t.sigBytes/4);for(let s=0;s{let r=i,o=n>=3?51:1;for(let c=0;c=3?20:1;for(let c=0;c{let s=i.clone().concat(r).concat(fe.default.lib.WordArray.create([Dv(o)],4)).concat(fe.default.lib.WordArray.create(t)),a=n>=3?51:1;for(let c=0;c{let t=e(8),i=e(8);return fe.default.SHA256(n.clone().concat(t)).concat(t).concat(i)},AP=(n,e,t)=>{let i=fe.default.SHA256(n.clone().concat(e)),r={mode:fe.default.mode.CBC,padding:fe.default.pad.NoPadding,iv:fe.default.lib.WordArray.create(null,16)};return fe.default.AES.encrypt(t,i,r).ciphertext},IP=(n,e,t)=>{let i=t(8),r=t(8);return fe.default.SHA256(n.clone().concat(i).concat(e)).concat(i).concat(r)},BP=(n,e,t,i)=>{let r=fe.default.SHA256(n.clone().concat(e).concat(t)),o={mode:fe.default.mode.CBC,padding:fe.default.pad.NoPadding,iv:fe.default.lib.WordArray.create(null,16)};return fe.default.AES.encrypt(i,r,o).ciphertext},OP=n=>n(32),LP=(n,e,t)=>{let i=fe.default.lib.WordArray.create([Dv(n),4294967295,1415668834],12).concat(t(4)),r={mode:fe.default.mode.ECB,padding:fe.default.pad.NoPadding};return fe.default.AES.encrypt(i,e,r).ciphertext},Mh=(n="")=>{let e=new Uint8Array(32),t=n.length,i=0;for(;i255)throw new Error("Password contains one or more invalid characters.");e[i]=r,i++}for(;i<32;)e[i]=MP[i-t],i++;return fe.default.lib.WordArray.create(e)},Fv=(n="")=>{let e=Math.min(127,n.length),t=new Uint8Array(e);for(let i=0;i(n&255)<<24|(n&65280)<<8|n>>8&65280|n>>24&255,tn=n=>{let e=[];for(let t=0;t>8*(3-t%4)&255);return Uint8Array.from(e)},MP=[40,191,78,94,78,117,138,65,100,0,78,86,255,250,1,8,46,46,0,182,208,104,62,128,47,12,169,254,100,83,105,122],Nh=rp;var nn=n=>1<n instanceof v?n:v.of(n),$=n=>n instanceof G?n:G.of(n),de=n=>n instanceof G?n.asNumber():n;var Nn;(function(n){n.Degrees="degrees",n.Radians="radians"})(Nn||(Nn={}));var NP=n=>(T(n,"radianAngle",["number"]),{type:Nn.Radians,angle:n}),te=n=>(T(n,"degreeAngle",["number"]),{type:Nn.Degrees,angle:n}),hi=n=>n*Math.PI/180,Pv=n=>n*180/Math.PI,ut=n=>n.type===Nn.Radians?n.angle:n.type===Nn.Degrees?hi(n.angle):sr(`Invalid rotation: ${JSON.stringify(n)}`),rn=n=>n.type===Nn.Radians?Pv(n.angle):n.type===Nn.Degrees?n.angle:sr(`Invalid rotation: ${JSON.stringify(n)}`),ui=(n=0)=>{let e=n/90%4;return e===0?0:e===1?90:e===2?180:e===3?270:0},on=(n,e=0)=>{let t=ui(e);return t===90||t===270?{width:n.height,height:n.width}:{width:n.width,height:n.height}},op=(n,e=0,t=0)=>{let{x:i,y:r,width:o,height:s}=n,a=ui(t),c=e/2;return a===0?{x:i-c,y:r-c,width:o,height:s}:a===90?{x:i-s+c,y:r-c,width:s,height:o}:a===180?{x:i-o+c,y:r-s+c,width:o,height:s}:a===270?{x:i-c,y:r-o+c,width:s,height:o}:{x:i-c,y:r-c,width:o,height:s}};var cc=()=>le.of(ce.ClipNonZero),RP=()=>le.of(ce.ClipEvenOdd),{cos:Rh,sin:Vh,tan:Hh}=Math,an=(n,e,t,i,r,o)=>le.of(ce.ConcatTransformationMatrix,[$(n),$(e),$(t),$(i),$(r),$(o)]),Ut=(n,e)=>an(1,0,0,1,n,e),Er=(n,e)=>an(n,0,0,e,0,0),Xs=n=>an(Rh(de(n)),Vh(de(n)),-Vh(de(n)),Rh(de(n)),0,0),Zs=n=>Xs(hi(de(n))),dc=(n,e)=>an(1,Hh(de(n)),Hh(de(e)),1,0,0),VP=(n,e)=>dc(hi(de(n)),hi(de(e))),hc=(n,e)=>le.of(ce.SetLineDashPattern,[`[${n.map($).join(" ")}]`,$(e)]),HP=()=>hc([],0),fi;(function(n){n[n.Butt=0]="Butt",n[n.Round=1]="Round",n[n.Projecting=2]="Projecting"})(fi||(fi={}));var zh=n=>le.of(ce.SetLineCapStyle,[$(n)]),Vo;(function(n){n[n.Miter=0]="Miter",n[n.Round=1]="Round",n[n.Bevel=2]="Bevel"})(Vo||(Vo={}));var zP=n=>le.of(ce.SetLineJoinStyle,[$(n)]),Tr=n=>le.of(ce.SetGraphicsStateParams,[Gs(n)]),Ye=()=>le.of(ce.PushGraphicsState),_e=()=>le.of(ce.PopGraphicsState),Ho=n=>le.of(ce.SetLineWidth,[$(n)]),zo=(n,e,t,i,r,o)=>le.of(ce.AppendBezierCurve,[$(n),$(e),$(t),$(i),$(r),$(o)]),Ys=(n,e,t,i)=>le.of(ce.CurveToReplicateInitialPoint,[$(n),$(e),$(t),$(i)]),Ar=()=>le.of(ce.ClosePath),Ni=(n,e)=>le.of(ce.MoveTo,[$(n),$(e)]),Je=(n,e)=>le.of(ce.LineTo,[$(n),$(e)]),kv=(n,e,t,i)=>le.of(ce.AppendRectangle,[$(n),$(e),$(t),$(i)]),UP=(n,e,t)=>kv(n,e,t,t),uc=()=>le.of(ce.StrokePath),sn;(function(n){n.NonZero="f",n.EvenOdd="f*"})(sn||(sn={}));var ap=()=>le.of(ce.FillNonZero),lp=()=>le.of(ce.FillEvenOdd),cp=()=>le.of(ce.FillNonZeroAndStroke),fc=()=>le.of(ce.EndPath),dp=()=>le.of(ce.NextLine),qP=(n,e)=>le.of(ce.MoveText,[$(n),$(e)]),pc=n=>le.of(ce.ShowText,[n]),gc=()=>le.of(ce.BeginText),mc=()=>le.of(ce.EndText),Uo=(n,e)=>le.of(ce.SetFontAndSize,[Gs(n),$(e)]),jP=n=>le.of(ce.SetCharacterSpacing,[$(n)]),WP=n=>le.of(ce.SetWordSpacing,[$(n)]),KP=n=>le.of(ce.SetTextHorizontalScaling,[$(n)]),hp=n=>le.of(ce.SetTextLineHeight,[$(n)]),GP=n=>le.of(ce.SetTextRise,[$(n)]),sp;(function(n){n[n.Fill=0]="Fill",n[n.Outline=1]="Outline",n[n.FillAndOutline=2]="FillAndOutline",n[n.Invisible=3]="Invisible",n[n.FillAndClip=4]="FillAndClip",n[n.OutlineAndClip=5]="OutlineAndClip",n[n.FillAndOutlineAndClip=6]="FillAndOutlineAndClip",n[n.Clip=7]="Clip"})(sp||(sp={}));var Uh=n=>le.of(ce.SetTextRenderingMode,[$(n)]),Cv=(n,e,t,i,r,o)=>le.of(ce.SetTextMatrix,[$(n),$(e),$(t),$(i),$(r),$(o)]),_s=(n,e,t,i,r)=>Cv(Rh(de(n)),Vh(de(n))+Hh(de(e)),-Vh(de(n))+Hh(de(t)),Rh(de(n)),i,r),XP=(n,e,t,i,r)=>_s(hi(de(n)),hi(de(e)),hi(de(t)),i,r),Js=n=>le.of(ce.DrawObject,[Gs(n)]),up=n=>le.of(ce.NonStrokingColorGray,[$(n)]),fp=n=>le.of(ce.StrokingColorGray,[$(n)]),pp=(n,e,t)=>le.of(ce.NonStrokingColorRgb,[$(n),$(e),$(t)]),gp=(n,e,t)=>le.of(ce.StrokingColorRgb,[$(n),$(e),$(t)]),mp=(n,e,t,i)=>le.of(ce.NonStrokingColorCmyk,[$(n),$(e),$(t),$(i)]),xp=(n,e,t,i)=>le.of(ce.StrokingColorCmyk,[$(n),$(e),$(t),$(i)]),qh=n=>le.of(ce.BeginMarkedContent,[Gs(n)]),jh=()=>le.of(ce.EndMarkedContent);var Gv=Wi(Kv(),1),Tt;(function(n){n.Grayscale="Grayscale",n.RGB="RGB",n.CMYK="CMYK"})(Tt||(Tt={}));var Zh=n=>(bt(n,"gray",0,1),{type:Tt.Grayscale,gray:n}),pe=(n,e,t)=>(bt(n,"red",0,1),bt(e,"green",0,1),bt(t,"blue",0,1),{type:Tt.RGB,red:n,green:e,blue:t}),Yh=(n,e,t,i)=>(bt(n,"cyan",0,1),bt(e,"magenta",0,1),bt(t,"yellow",0,1),bt(i,"key",0,1),{type:Tt.CMYK,cyan:n,magenta:e,yellow:t,key:i}),Dp=n=>{T(n,"color",["string"]);let e=(0,Gv.default)(n).unitObject();return{rgb:pe(e.r,e.g,e.b),alpha:e.alpha}},ln=n=>n.type===Tt.Grayscale?up(n.gray):n.type===Tt.RGB?pp(n.red,n.green,n.blue):n.type===Tt.CMYK?mp(n.cyan,n.magenta,n.yellow,n.key):sr(`Invalid color: ${JSON.stringify(n)}`),qo=n=>n.type===Tt.Grayscale?fp(n.gray):n.type===Tt.RGB?gp(n.red,n.green,n.blue):n.type===Tt.CMYK?xp(n.cyan,n.magenta,n.yellow,n.key):sr(`Invalid color: ${JSON.stringify(n)}`),vt=(n,e=1)=>(n==null?void 0:n.length)===1?Zh(n[0]*e):(n==null?void 0:n.length)===3?pe(n[0]*e,n[1]*e,n[2]*e):(n==null?void 0:n.length)===4?Yh(n[0]*e,n[1]*e,n[2]*e,n[3]*e):void 0,_h=n=>n.type===Tt.Grayscale?[n.gray]:n.type===Tt.RGB?[n.red,n.green,n.blue]:n.type===Tt.CMYK?[n.cyan,n.magenta,n.yellow,n.key]:sr(`Invalid color: ${JSON.stringify(n)}`);var ie=0,ne=0,De=0,Pe=0,vc=0,wc=0,Xv=new Map([["A",7],["a",7],["C",6],["c",6],["H",1],["h",1],["L",2],["l",2],["M",2],["m",2],["Q",4],["q",4],["S",4],["s",4],["T",2],["t",2],["V",1],["v",1],["Z",0],["z",0]]),ck=n=>{let e,t=[],i=[],r="",o=!1,s=0;for(let a of n)if(Xv.has(a))s=Xv.get(a),e&&(r.length>0&&(i[i.length]=+r),t[t.length]={cmd:e,args:i},i=[],r="",o=!1),e=a;else if([" ",","].includes(a)||a==="-"&&r.length>0&&r[r.length-1]!=="e"||a==="."&&o){if(r.length===0)continue;i.length===s?(t[t.length]={cmd:e,args:i},i=[+r],e==="M"&&(e="L"),e==="m"&&(e="l")):i[i.length]=+r,o=a===".",r=["-","."].includes(a)?a:""}else r+=a,a==="."&&(o=!0);return r.length>0&&(i.length===s?(t[t.length]={cmd:e,args:i},i=[+r],e==="M"&&(e="L"),e==="m"&&(e="l")):i[i.length]=+r),t[t.length]={cmd:e,args:i},t},dk=n=>{ie=ne=De=Pe=vc=wc=0;let e=[];for(let t=0;t{let[i,r,o,s,a,c,l]=t,d=hk(c,l,i,r,s,a,o,n,e),h=[];for(let u of d){let p=uk(...u);h.push(zo(...p))}return h},hk=(n,e,t,i,r,o,s,a,c)=>{let l=s*(Math.PI/180),d=Math.sin(l),h=Math.cos(l);t=Math.abs(t),i=Math.abs(i),De=h*(a-n)*.5+d*(c-e)*.5,Pe=h*(c-e)*.5-d*(a-n)*.5;let u=De*De/(t*t)+Pe*Pe/(i*i);u>1&&(u=Math.sqrt(u),t*=u,i*=u);let p=h/t,f=d/t,m=-d/i,x=h/i,g=p*a+f*c,b=m*a+x*c,w=p*n+f*e,y=m*n+x*e,D=1/((w-g)*(w-g)+(y-b)*(y-b))-.25;D<0&&(D=0);let C=Math.sqrt(D);o===r&&(C=-C);let k=.5*(g+w)-C*(y-b),E=.5*(b+y)+C*(w-g),B=Math.atan2(b-E,g-k),I=Math.atan2(y-E,w-k)-B;I<0&&o===1?I+=2*Math.PI:I>0&&o===0&&(I-=2*Math.PI);let O=Math.ceil(Math.abs(I/(Math.PI*.5+.001))),A=[];for(let N=0;N{let c=a*r,l=-s*o,d=s*r,h=a*o,u=.5*(i-t),p=8/3*Math.sin(u*.5)*Math.sin(u*.5)/Math.sin(u),f=n+Math.cos(t)-p*Math.sin(t),m=e+Math.sin(t)+p*Math.cos(t),x=n+Math.cos(i),g=e+Math.sin(i),b=x+p*Math.sin(i),w=g-p*Math.cos(i);return[c*f+l*m,d*f+h*m,c*b+l*w,d*b+h*w,c*x+l*g,d*x+h*g]},_v=n=>dk(ck(n));var oa=Wi(Ap(),1);var pi=class{constructor(e,t={}){this.svg=e,this.images=t}};var Re;(function(n){n.Normal="Normal",n.Multiply="Multiply",n.Screen="Screen",n.Overlay="Overlay",n.Darken="Darken",n.Lighten="Lighten",n.ColorDodge="ColorDodge",n.ColorBurn="ColorBurn",n.HardLight="HardLight",n.SoftLight="SoftLight",n.Difference="Difference",n.Exclusion="Exclusion"})(Re||(Re={}));var Dc=[1,0,0,1,0,0];var Zt=([n,e,t,i,r,o],[s,a,c,l,d,h])=>[n*s+t*a,e*s+i*a,n*c+t*l,e*c+i*l,n*d+t*h+r,e*d+i*h+o],eu=([n,e,t,i,r,o],{x:s,y:a})=>({x:n*s+t*a+r,y:e*s+i*a+o}),gi=(n,e)=>{switch(n){case"scale":case"scaleX":case"scaleY":{let[t,i=t]=e;return[n==="scaleY"?1:t,0,0,n==="scaleX"?1:i,0,0]}case"translate":case"translateX":case"translateY":{let[t,i=t]=e;return[1,0,0,1,n==="translateY"?0:t,n==="translateX"?0:-i]}case"rotate":{let[t,i=0,r=0]=e,o=gi("translate",[i,r]),s=gi("translate",[-i,-r]),a=hi(-t),c=[Math.cos(a),Math.sin(a),-Math.sin(a),Math.cos(a),0,0];return Zt(Zt(o,c),s)}case"skewY":case"skewX":{let t=hi(-e[0]),i=Math.tan(t);return[1,n==="skewY"?i:0,n==="skewX"?i:0,1,0,0]}case"matrix":{let[t,i,r,o,s,a]=e,c=gi("scale",[1,-1]);return Zt(Zt(c,[t,i,r,o,s,a]),c)}default:return Dc}},Vn=(n,e,t)=>Zt(n,gi(e,t)),Ak={butt:fi.Butt,round:fi.Round,square:fi.Projecting},Ik={evenodd:sn.EvenOdd,nonzero:sn.NonZero},Bk={bevel:Vo.Bevel,miter:Vo.Miter,round:Vo.Round},lw=(n,e)=>({text(t){let i=t.svgAttributes.textAnchor,r=t.svgAttributes.dominantBaseline,o=t.text.trim().replace(/\s/g," "),s=t.svgAttributes.fontSize||12,a=(f,m)=>{let x=f.fontFamily;if(!x)return;let g=f.fontWeight==="bold"||Number(f.fontWeight)>=700,b=f.fontStyle==="italic",w=(F,D,C)=>m[C+(F?"_bold":"")+(D?"_italic":"")],y=Object.keys(m).find(F=>F.startsWith(x));return w(g,b,x)||w(g,!1,x)||w(!1,b,x)||w(!1,!1,x)||(y?m[y]:void 0)},c=e.fonts&&a(t.svgAttributes,e.fonts),l=(c||n.getFont()[0]).widthOfTextAtSize(o,s),d=(c||n.getFont()[0]).heightAtSize(s),h=(c||n.getFont()[0]).heightAtSize(s,{descender:!1}),u=i==="middle"?l/2:i==="end"?l:0,p=0;switch(r){case"middle":case"central":p=h-d/2;break;case"mathematical":p=s*.6;break;case"hanging":p=h;break;case"text-before-edge":p=s;break;case"ideographic":case"text-after-edge":p=h-d;break;case"text-top":case"text-bottom":case"auto":case"use-script":case"no-change":case"reset-size":case"alphabetic":default:p=0;break}n.drawText(o,{x:-u,y:-p,font:c,size:s,color:t.svgAttributes.fill,opacity:t.svgAttributes.fillOpacity,matrix:t.svgAttributes.matrix,clipSpaces:t.svgAttributes.clipSpaces,blendMode:t.svgAttributes.blendMode||e.blendMode})},line(t){n.drawLine({start:{x:t.svgAttributes.x1||0,y:-t.svgAttributes.y1||0},end:{x:t.svgAttributes.x2||0,y:-t.svgAttributes.y2||0},thickness:t.svgAttributes.strokeWidth,color:t.svgAttributes.stroke,opacity:t.svgAttributes.strokeOpacity,lineCap:t.svgAttributes.strokeLineCap,matrix:t.svgAttributes.matrix,clipSpaces:t.svgAttributes.clipSpaces,blendMode:t.svgAttributes.blendMode||e.blendMode})},path(t){t.svgAttributes.d&&n.drawSvgPath(t.svgAttributes.d,{x:0,y:0,borderColor:t.svgAttributes.stroke,borderWidth:t.svgAttributes.strokeWidth,borderOpacity:t.svgAttributes.strokeOpacity,borderLineCap:t.svgAttributes.strokeLineCap,color:t.svgAttributes.fill,opacity:t.svgAttributes.fillOpacity,fillRule:t.svgAttributes.fillRule,matrix:Vn(t.svgAttributes.matrix,"scale",[1,-1]),clipSpaces:t.svgAttributes.clipSpaces,blendMode:t.svgAttributes.blendMode||e.blendMode})},image(t){var i,r;let{src:o}=t.svgAttributes;if(!(o&&(!((i=e.images)===null||i===void 0)&&i[o])))return;let s=(r=e.images)===null||r===void 0?void 0:r[o],{x:a,y:c,width:l,height:d}=Ok(s.width,s.height,t.svgAttributes.width||s.width,t.svgAttributes.height||s.height,t.svgAttributes.preserveAspectRatio);n.drawImage(s,{x:a,y:-c-d,width:l,height:d,opacity:t.svgAttributes.fillOpacity,matrix:t.svgAttributes.matrix,clipSpaces:t.svgAttributes.clipSpaces,blendMode:t.svgAttributes.blendMode||e.blendMode})},rect(t){!t.svgAttributes.fill&&!t.svgAttributes.stroke||n.drawRectangle({x:0,y:0,width:t.svgAttributes.width,height:t.svgAttributes.height,rx:t.svgAttributes.rx,ry:t.svgAttributes.ry,borderColor:t.svgAttributes.stroke,borderWidth:t.svgAttributes.strokeWidth,borderOpacity:t.svgAttributes.strokeOpacity,borderLineCap:t.svgAttributes.strokeLineCap,color:t.svgAttributes.fill,opacity:t.svgAttributes.fillOpacity,matrix:Vn(t.svgAttributes.matrix,"translateY",[t.svgAttributes.height]),clipSpaces:t.svgAttributes.clipSpaces,blendMode:t.svgAttributes.blendMode||e.blendMode})},ellipse(t){n.drawEllipse({x:t.svgAttributes.cx||0,y:-(t.svgAttributes.cy||0),xScale:t.svgAttributes.rx,yScale:t.svgAttributes.ry,borderColor:t.svgAttributes.stroke,borderWidth:t.svgAttributes.strokeWidth,borderOpacity:t.svgAttributes.strokeOpacity,borderLineCap:t.svgAttributes.strokeLineCap,color:t.svgAttributes.fill,opacity:t.svgAttributes.fillOpacity,matrix:t.svgAttributes.matrix,clipSpaces:t.svgAttributes.clipSpaces,blendMode:t.svgAttributes.blendMode||e.blendMode})},circle(t){return lw(n,e).ellipse(t)}}),gt=(n,e,t,i)=>{let r=e[t]||n[t];return!r&&typeof i!="undefined"?i:r},cw=n=>{let e=/([^:\s]+)*\s*:\s*([^;]+)/g,t={},i=e.exec(n);for(;i!==null;)t[i[1]]=i[2],i=e.exec(n);return t},Ip=(n,e)=>{if(!n||n.length===0||["none","transparent"].includes(n))return;if(n==="currentColor")return e||Ip("#000000");let t=Dp(n);return{rgb:t.rgb,alpha:t.alpha?t.alpha+"":void 0}},Bp=(n,e,t)=>{var i,r,o,s;let a=n.attributes,c=cw(a.style),l=gt(a,c,"width",""),d=gt(a,c,"height",""),h=Ip(gt(a,c,"fill")),u=gt(a,c,"fill-opacity"),p=gt(a,c,"opacity"),f=Ip(gt(a,c,"stroke")),m=gt(a,c,"stroke-opacity"),x=gt(a,c,"stroke-linecap"),g=gt(a,c,"stroke-linejoin"),b=gt(a,c,"fill-rule"),w=gt(a,c,"stroke-width"),y=gt(a,c,"font-family"),F=gt(a,c,"font-style"),D=gt(a,c,"font-weight"),C=gt(a,c,"font-size"),k=gt(a,c,"mix-blend-mode"),E=wt(l,e.width),B=wt(d,e.height),S=wt(a.x,e.width),I=wt(a.y,e.height),O=wt(a.x1,e.width),A=wt(a.x2,e.width),N=wt(a.y1,e.height),q=wt(a.y2,e.height),V=wt(a.cx,e.width),X=wt(a.cy,e.height),L=wt(a.rx||a.r,e.width),U=wt(a.ry||a.r,e.height),R={fontFamily:y||e.fontFamily,fontStyle:F||e.fontStyle,fontWeight:D||e.fontWeight,fontSize:(i=wt(C))!==null&&i!==void 0?i:e.fontSize,fill:(h==null?void 0:h.rgb)||e.fill,fillOpacity:(r=wt(u||p||(h==null?void 0:h.alpha)))!==null&&r!==void 0?r:e.fillOpacity,fillRule:Ik[b]||e.fillRule,stroke:(f==null?void 0:f.rgb)||e.stroke,strokeWidth:(o=wt(w))!==null&&o!==void 0?o:e.strokeWidth,strokeOpacity:(s=wt(m||p||(f==null?void 0:f.alpha)))!==null&&s!==void 0?s:e.strokeOpacity,strokeLineCap:Ak[x]||e.strokeLineCap,strokeLineJoin:Bk[g]||e.strokeLineJoin,width:E||e.width,height:B||e.height,rotation:e.rotation,viewBox:n.tagName==="svg"&&n.attributes.viewBox?tu(n.attributes.viewBox):e.viewBox,blendMode:Rk(k)||e.blendMode},M={src:a.src||a.href||a["xlink:href"],textAnchor:a["text-anchor"],dominantBaseline:a["dominant-baseline"],preserveAspectRatio:a.preserveAspectRatio},re=a.transform||"";["translate","translateX","translateY","skewX","skewY","rotate","scale","scaleX","scaleY","matrix"].forEach(Te=>{a[Te]&&(re=a[Te]+" "+re)}),(S||I)&&(re=re+`translate(${S||0} ${I||0}) `);let se=t;if(re){let Te=/(\w+)\((.+?)\)/g,he=Te.exec(re);for(;he!==null;){let[,dt,qt]=he,ji=(qt||"").split(/\s*,\s*|\s+/).filter(Ot=>Ot.length>0).map(Ot=>parseFloat(Ot));se=Vn(se,dt,ji),he=Te.exec(re)}}if(M.x=S,M.y=I,(a.cx||a.cy)&&(M.cx=V,M.cy=X),(a.rx||a.ry||a.r)&&(M.rx=L,M.ry=U),(a.x1||a.y1)&&(M.x1=O,M.y1=N),(a.x2||a.y2)&&(M.x2=A,M.y2=q),(a.width||a.height)&&(M.width=E!=null?E:e.width,M.height=B!=null?B:e.height),a.d&&(se=Vn(se,"scale",[1,-1]),M.d=a.d),R.fontFamily){let Te=R.fontFamily.match(/^"(.*?)"|^'(.*?)'/);Te&&(R.fontFamily=Te[1]||Te[2])}return R.strokeWidth&&(M.strokeWidth=R.strokeWidth),{inherited:R,svgAttributes:M,tagName:n.tagName,matrix:se}},Ok=(n,e,t,i,r)=>{if(r==="none")return{x:0,y:0,width:t,height:i};let o=n/e,s=t/i,a=s>o?o*i:t,c=s>=o?i:t/o,l=t-a,d=i-c,[h,u]=(()=>{switch(r){case"xMinYMin":return[0,0];case"xMidYMin":return[l/2,0];case"xMaxYMin":return[l,d/2];case"xMinYMid":return[0,d];case"xMaxYMid":return[l,d/2];case"xMinYMax":return[0,d];case"xMidYMax":return[l/2,d];case"xMaxYMax":return[l,d];case"xMidYMid":default:return[l/2,d/2]}})();return{x:h,y:u,width:a,height:c}},Lk=(n,e,t,i,r,o="xMidYMid")=>{let[s,a="meet"]=o.split(" "),c=i/e,l=r/t,d=Vn(n,"scale",[c,l]);if(s==="none")return{clipBox:d,content:d};let h=a==="slice"?Math.max(c,l):Math.min(c,l),u=i-e*h,p=r-t*h,[f,m]=(()=>{switch(s){case"xMinYMin":return[0,0];case"xMidYMin":return[u/2,0];case"xMaxYMin":return[u,p/2];case"xMinYMid":return[0,p];case"xMaxYMid":return[u,p/2];case"xMinYMax":return[0,p];case"xMidYMax":return[u/2,p];case"xMaxYMax":return[u,p];case"xMidYMid":default:return[u/2,p/2]}})(),x=Vn(Vn(n,"translate",[f,m]),"scale",[h]);return{clipBox:d,content:x}},Op=(n,e,t,i)=>{if(n.nodeType===oa.NodeType.COMMENT_NODE)return[];if(n.nodeType===oa.NodeType.TEXT_NODE)return[];if(n.tagName==="g")return Nk(n,e,t,i);if(n.tagName==="svg")return Mk(n,e,t,i);{n.tagName==="polygon"&&(n.tagName="path",n.attributes.d=`M${n.attributes.points}Z`,delete n.attributes.points);let r=Bp(n,e,t),o=Object.assign(Object.assign(Object.assign({},r.inherited),r.svgAttributes),{matrix:r.matrix,clipSpaces:i});return Object.assign(n,{svgAttributes:o}),[n]}},Mk=(n,e,t,i)=>{var r,o;(r=n.attributes.width)!==null&&r!==void 0||n.setAttribute("width",e.viewBox.width+""),(o=n.attributes.height)!==null&&o!==void 0||n.setAttribute("height",e.viewBox.height+"");let s=Bp(n,e,t),a=[],c=n.attributes.viewBox?tu(n.attributes.viewBox):n.attributes.width&&n.attributes.height?tu(`0 0 ${n.attributes.width} ${n.attributes.height}`):e.viewBox,l=parseFloat(n.attributes.x)||0,d=parseFloat(n.attributes.y)||0,h=Vn(t,"translate",[l,d]),{clipBox:u,content:p}=Lk(h,c.width,c.height,parseFloat(n.attributes.width),parseFloat(n.attributes.height),n.attributes.preserveAspectRatio),f=eu(u,{x:0,y:0}),m=eu(u,{x:c.width,y:0}),x=eu(u,{x:c.width,y:-c.height}),g=eu(u,{x:0,y:-c.height}),b={topLeft:f,topRight:m,bottomRight:x,bottomLeft:g};return h=Vn(p,"translate",[-c.x,-c.y]),n.childNodes.forEach(w=>{let y=Op(w,Object.assign(Object.assign({},s.inherited),{viewBox:c}),h,[...i,b]);a.push(...y)}),a},Nk=(n,e,t,i)=>{let r=Bp(n,e,t),o=[];return n.childNodes.forEach(s=>{o.push(...Op(s,r.inherited,r.matrix,i))}),o},wt=(n,e=1)=>{if(!n)return;let t=parseFloat(n);if(!isNaN(t))return n.endsWith("%")?t*e/100:t},Rk=n=>{switch(n){case"normal":return Re.Normal;case"multiply":return Re.Multiply;case"screen":return Re.Screen;case"overlay":return Re.Overlay;case"darken":return Re.Darken;case"lighten":return Re.Lighten;case"color-dodge":return Re.ColorDodge;case"color-burn":return Re.ColorBurn;case"hard-light":return Re.HardLight;case"soft-light":return Re.SoftLight;case"difference":return Re.Difference;case"exclusion":return Re.Exclusion;default:return}},tu=n=>{if(!n)return;let[e=0,t=0,i=1,r=1]=(n||"").split(" ").map(o=>wt(o));return{x:e,y:t,width:i,height:r}},Vk=(n,{width:e,height:t,fontSize:i},r,o)=>{let s=(0,oa.parse)(n).firstChild;return e&&s.setAttribute("width",e+""),t&&s.setAttribute("height",t+""),i&&s.setAttribute("font-size",i+""),Op(s,Object.assign(Object.assign({},r),{viewBox:tu(s.attributes.viewBox||"0 0 1 1")}),o,[])},dw=(n,e,t)=>{let i=typeof e=="string"?new pi(e):e;if(!i.svg)return;let r=n.getSize(),o=(0,oa.parse)(i.svg).querySelector("svg");if(!o)return console.error("This is not an svg. Ignoring: "+i.svg);let s=o.attributes,a=cw(s.style),c=gt(s,a,"width",""),l=gt(s,a,"height",""),d=t.width!==void 0?t.width:parseFloat(c),h=t.height!==void 0?t.height:parseFloat(l);s.viewBox||o.setAttribute("viewBox",`0 0 ${c||d} ${l||h}`),(t.width||t.height)&&(d!==void 0&&(a.width=d+(isNaN(d)?"":"px")),h!==void 0&&(a.height=h+(isNaN(h)?"":"px")),o.setAttribute("style",Object.entries(a).map(([m,x])=>`${m}:${x};`).join("")));let u=[1,0,0,1,t.x||0,t.y||0],p=Vk(o.outerHTML,t,r,u),f=lw(n,Object.assign(Object.assign({},t),{images:i.images}));p.forEach(m=>{var x;(x=f[m.tagName])===null||x===void 0||x.call(f,m)})};var Hk=({topLeft:n,topRight:e,bottomRight:t,bottomLeft:i})=>[Ni(n.x,n.y),Je(e.x,e.y),Je(t.x,t.y),Je(i.x,i.y),Ar(),cc(),fc()],iu=n=>n.flatMap(Hk),zk=(n,e)=>[Ye(),e.graphicsState&&Tr(e.graphicsState),gc(),ln(e.color),Uo(e.font,e.size),e.strokeWidth&&Ho(e.strokeWidth),e.strokeColor&&qo(e.strokeColor),e.renderMode&&Uh(e.renderMode),_s(ut(e.rotate),ut(e.xSkew),ut(e.ySkew),e.x,e.y),pc(n),mc(),_e()].filter(Boolean),Lp=(n,e)=>{let t=[Ye(),e.graphicsState&&Tr(e.graphicsState),...e.clipSpaces?iu(e.clipSpaces):[],e.matrix&&an(...e.matrix),gc(),ln(e.color),Uo(e.font,e.size),hp(e.lineHeight),e.strokeWidth&&Ho(e.strokeWidth),e.strokeColor&&qo(e.strokeColor),e.renderMode&&Uh(e.renderMode),_s(ut(e.rotate),ut(e.xSkew),ut(e.ySkew),e.x,e.y)].filter(Boolean);for(let i=0,r=n.length;i[Ye(),e.graphicsState&&Tr(e.graphicsState),...e.clipSpaces?iu(e.clipSpaces):[],e.matrix&&an(...e.matrix),Ut(e.x,e.y),Xs(ut(e.rotate)),Er(e.width,e.height),dc(ut(e.xSkew),ut(e.ySkew)),Js(n),_e()].filter(Boolean),Mp=(n,e)=>[Ye(),e.graphicsState&&Tr(e.graphicsState),Ut(e.x,e.y),Xs(ut(e.rotate)),Er(e.xScale,e.yScale),dc(ut(e.xSkew),ut(e.ySkew)),Js(n),_e()].filter(Boolean),Np=n=>{var e,t;return[Ye(),n.graphicsState&&Tr(n.graphicsState),...n.clipSpaces?iu(n.clipSpaces):[],n.matrix&&an(...n.matrix),n.color&&qo(n.color),Ho(n.thickness),hc((e=n.dashArray)!==null&&e!==void 0?e:[],(t=n.dashPhase)!==null&&t!==void 0?t:0),Ni(n.start.x,n.start.y),n.lineCap&&zh(n.lineCap),Ni(n.start.x,n.start.y),Je(n.end.x,n.end.y),uc(),_e()].filter(Boolean)},Br=4*((Math.sqrt(2)-1)/3),Or=n=>{let{width:e,height:t,xSkew:i,ySkew:r,rotate:o,matrix:s}=n,a=typeof e=="number"?e:e.asNumber(),c=typeof t=="number"?t:t.asNumber(),l=typeof n.x=="number"?n.x:n.x.asNumber(),d=typeof n.y=="number"?n.y:n.y.asNumber(),h=Math.max(0,Math.min(n.rx||0,a/2)),u=Math.max(0,Math.min(n.ry||0,c/2)),p=h>0||u>0?[`M ${h},0`,`H ${a-h}`,`C ${a-h*(1-Br)},0 ${a},${u*(1-Br)} ${a},${u}`,`V ${c-u}`,`C ${a},${c-u*(1-Br)} ${a-h*(1-Br)},${c} ${a-h},${c}`,`H ${h}`,`C ${h*(1-Br)},${c} 0,${c-u*(1-Br)} 0,${c-u}`,`V ${u}`,`C 0,${u*(1-Br)} ${h*(1-Br)},0 ${h},0`,"Z"].join(" "):`M 0,0 H ${a} V ${c} H 0 Z`,f=Zt(s||Dc,gi("translate",[l,-d]));return o&&(f=Zt(f,gi("rotate",[-rn(o)]))),i&&(f=Zt(f,gi("skewX",[rn(i)]))),r&&(f=Zt(f,gi("skewY",[-rn(r)]))),f=Zt(f,gi("translateY",[-c])),Cc(p,Object.assign(Object.assign({},n),{x:0,y:0,rotate:te(0),scale:1,matrix:f}))},Pc=n=>{let e=de(n.xScale),t=de(n.yScale),i=de(n.x),r=de(n.y),o=4*((Math.sqrt(2)-1)/3),s=e*o,a=t*o,c=[`M 0,${t}`,`C ${s},${t} ${e},${a} ${e},0`,`C ${e},${-a} ${s},${-t} 0,${-t}`,`C ${-s},${-t} ${-e},${-a} ${-e},0`,`C ${-e},${a} ${-s},${t} 0,${t}`,"Z"].join(" "),l=Zt(n.matrix||Dc,gi("translate",[i,-r]));return n.rotate&&(l=Zt(l,gi("rotate",[-rn(n.rotate)]))),Cc(c,Object.assign(Object.assign({},n),{x:0,y:0,rotate:te(0),scale:1,matrix:l}))},Cc=(n,e)=>{var t,i,r;let o=Uk(e);return o?[Ye(),e.graphicsState&&Tr(e.graphicsState),...e.clipSpaces?iu(e.clipSpaces):[],e.matrix&&an(...e.matrix),Ut(e.x,e.y),Xs(ut((t=e.rotate)!==null&&t!==void 0?t:te(0))),e.scale?Er(e.scale,-e.scale):Er(1,-1),e.color&&ln(e.color),e.borderColor&&qo(e.borderColor),e.borderWidth&&Ho(e.borderWidth),e.borderLineCap&&zh(e.borderLineCap),hc((i=e.borderDashArray)!==null&&i!==void 0?i:[],(r=e.borderDashPhase)!==null&&r!==void 0?r:0),..._v(n),o(),_e()].filter(Boolean):[]},hw=n=>{let e=de(n.size),t=-1+.75,i=-1+.51,r=1-.525,o=1-.31,s=-1+.325,a=-((s-t)*(o-t))/(r-i)+i;return[Ye(),n.color&&qo(n.color),Ho(n.thickness),Ut(n.x,n.y),Ni(s*e,a*e),Je(t*e,i*e),Je(o*e,r*e),uc(),_e()].filter(Boolean)},mi=n=>n.rotation===0?[Ut(0,0),Zs(0)]:n.rotation===90?[Ut(n.width,0),Zs(90)]:n.rotation===180?[Ut(n.width,n.height),Zs(180)]:n.rotation===270?[Ut(0,n.height),Zs(270)]:[],sa=n=>{let e=Or({x:n.x,y:n.y,width:n.width,height:n.height,borderWidth:n.borderWidth,color:n.color,borderColor:n.borderColor,rotate:te(0),xSkew:te(0),ySkew:te(0)});if(!n.filled)return e;let t=de(n.width),i=de(n.height),r=Math.min(t,i)/2,o=hw({x:t/2,y:i/2,size:r,thickness:n.thickness,color:n.markColor});return[Ye(),...e,...o,_e()]},aa=n=>{let e=de(n.width),t=de(n.height),i=Math.min(e,t)/2,r=Pc({x:n.x,y:n.y,xScale:i,yScale:i,color:n.color,borderColor:n.borderColor,borderWidth:n.borderWidth});if(!n.filled)return r;let o=Pc({x:n.x,y:n.y,xScale:i*.45,yScale:i*.45,color:n.dotColor,borderColor:void 0,borderWidth:0});return[Ye(),...r,...o,_e()]},nu=n=>{let e=de(n.x),t=de(n.y),i=de(n.width),r=de(n.height),o=Or({x:e,y:t,width:i,height:r,borderWidth:n.borderWidth,color:n.color,borderColor:n.borderColor,rotate:te(0),xSkew:te(0),ySkew:te(0)}),s=ru(n.textLines,{color:n.textColor,font:n.font,size:n.fontSize,rotate:te(0),xSkew:te(0),ySkew:te(0)});return[Ye(),...o,...s,_e()]},ru=(n,e)=>{let t=[gc(),ln(e.color),Uo(e.font,e.size)];for(let i=0,r=n.length;i{let e=de(n.x),t=de(n.y),i=de(n.width),r=de(n.height),o=de(n.borderWidth),s=de(n.padding),a=e+o/2+s,c=t+o/2+s,l=i-(o/2+s)*2,d=r-(o/2+s)*2,h=[Ni(a,c),Je(a,c+d),Je(a+l,c+d),Je(a+l,c),Ar(),cc(),fc()],u=Or({x:e,y:t,width:i,height:r,borderWidth:n.borderWidth,color:n.color,borderColor:n.borderColor,rotate:te(0),xSkew:te(0),ySkew:te(0)}),p=ru(n.textLines,{color:n.textColor,font:n.font,size:n.fontSize,rotate:te(0),xSkew:te(0),ySkew:te(0)}),f=[qh("Tx"),Ye(),...p,_e(),jh()];return[Ye(),...u,...h,...f,_e()]},Rp=n=>{let e=de(n.x),t=de(n.y),i=de(n.width),r=de(n.height),o=de(n.lineHeight),s=de(n.borderWidth),a=de(n.padding),c=e+s/2+a,l=t+s/2+a,d=i-(s/2+a)*2,h=r-(s/2+a)*2,u=[Ni(c,l),Je(c,l+h),Je(c+d,l+h),Je(c+d,l),Ar(),cc(),fc()],p=Or({x:e,y:t,width:i,height:r,borderWidth:n.borderWidth,color:n.color,borderColor:n.borderColor,rotate:te(0),xSkew:te(0),ySkew:te(0)}),f=[];for(let g=0,b=n.selectedLines.length;g{if(n&&t&&e)return cp;if(n)return i===sn.EvenOdd?lp:ap;if(t&&e)return uc};var Xo=class extends Error{constructor(){super("Input document to `PDFDocument.load` is encrypted. You can use `PDFDocument.load(..., { ignoreEncryption: true })` if you wish to load the document anyways.")}},Sc=class extends Error{constructor(){super("Input to `PDFDocument.embedFont` was a custom font, but no `fontkit` instance was found. You must register a `fontkit` instance with `PDFDocument.registerFontkit(...)` before embedding custom fonts.")}},Ec=class extends Error{constructor(){super("A `page` passed to `PDFDocument.addPage` or `PDFDocument.insertPage` was from a different (foreign) PDF document. If you want to copy pages from one PDFDocument to another, you must use `PDFDocument.copyPages(...)` to copy the pages before adding or inserting them.")}},Tc=class extends Error{constructor(){super("PDFDocument has no pages so `PDFDocument.removePage` cannot be called")}},Ac=class extends Error{constructor(e){let t=`PDFDocument has no form field with the name "${e}"`;super(t)}},Vi=class extends Error{constructor(e,t,i){var r,o;let s=t==null?void 0:t.name,a=(o=(r=i==null?void 0:i.constructor)===null||r===void 0?void 0:r.name)!==null&&o!==void 0?o:i,c=`Expected field "${e}" to be of type ${s}, but it is actually of type ${a}`;super(c)}},Vp=class extends Error{constructor(e){let t=`Failed to select check box due to missing onValue: "${e}"`;super(t)}},la=class extends Error{constructor(e){let t=`A field already exists with the specified name: "${e}"`;super(t)}},Ic=class extends Error{constructor(e){let t=`Field name contains invalid component: "${e}"`;super(t)}},Hp=class extends Error{constructor(e){let t=`A non-terminal field already exists with the specified name: "${e}"`;super(t)}},Bc=class extends Error{constructor(e){let t=`Reading rich text fields is not supported: Attempted to read rich text field: ${e}`;super(t)}},Oc=class extends Error{constructor(e,t){let i=`Failed to layout combed text as lineLength=${e} is greater than cellCount=${t}`;super(i)}},Lc=class extends Error{constructor(e,t,i){let r=`Attempted to set text with length=${e} for TextField with maxLength=${t} and name=${i}`;super(r)}},Mc=class extends Error{constructor(e,t,i){let r=`Attempted to set maxLength=${t}, which is less than ${e}, the length of this field's current value (name=${i})`;super(r)}};var Ue;(function(n){n[n.Left=0]="Left",n[n.Center=1]="Center",n[n.Right=2]="Right"})(Ue||(Ue={}));var uw=4,fw=500,pw=(n,e,t,i=!1)=>{let r=uw;for(;rn.length)return r-1;let s=e.heightAtSize(r);if((s+s*.2)*o>Math.abs(t.height))return r-1;r+=1}return r},qk=(n,e,t,i)=>{let r=t.width/i,o=t.height,s=uw,a=Ef(n);for(;sr*.75)return s-1}if(e.heightAtSize(s,{descender:!1})>o)return s-1;s+=1}return s},jk=n=>{for(let e=n.length;e>0;e--)if(/\s/.test(n[e]))return e},Wk=(n,e,t,i)=>{var r;let o=n.length;for(;o>0;){let s=n.substring(0,o),a=t.encodeText(s),c=t.widthOfTextAtSize(s,i);if(c{let o=Va(ir(n));(t===void 0||t===0)&&(t=pw(o,i,r,!0));let s=i.heightAtSize(t),a=s+s*.2,c=[],l=r.x,d=r.y,h=r.x+r.width,u=r.y+r.height,p=r.y+r.height;for(let f=0,m=o.length;fh&&(h=F+w),p+s>u&&(u=p+s),c.push({text:g,encoded:b,width:w,height:s,x:F,y:p}),x=y==null?void 0:y.trim()}}return{fontSize:t,lineHeight:a,lines:c,bounds:{x:l,y:d,width:h-l,height:u-d}}},zp=(n,{fontSize:e,font:t,bounds:i,cellCount:r})=>{let o=fd(ir(n));if(o.length>r)throw new Oc(o.length,r);(e===void 0||e===0)&&(e=qk(o,t,i,r));let s=i.width/r,a=t.heightAtSize(e,{descender:!1}),c=i.y+(i.height/2-a/2),l=[],d=i.x,h=i.y,u=i.x+i.width,p=i.y+i.height,f=0,m=0;for(;fu&&(u=F+w),c+a>p&&(p=c+a),l.push({text:o,encoded:b,width:w,height:a,x:F,y:c}),f+=1,m+=g}return{fontSize:e,cells:l,bounds:{x:d,y:h,width:u-d,height:p-h}}},ca=(n,{alignment:e,fontSize:t,font:i,bounds:r})=>{let o=fd(ir(n));(t===void 0||t===0)&&(t=pw([o],i,r));let s=i.encodeText(o),a=i.widthOfTextAtSize(o,t),c=i.heightAtSize(t,{descender:!1}),l=e===Ue.Left?r.x:e===Ue.Center?r.x+r.width/2-a/2:e===Ue.Right?r.x+r.width-a:r.x,d=r.y+(r.height/2-c/2);return{fontSize:t,line:{text:o,encoded:s,width:a,height:c,x:l,y:d},bounds:{x:l,y:d,width:a,height:c}}};var Yt=n=>"normal"in n?n:{normal:n},Kk=/\/([^\0\t\n\f\r ]+)[\0\t\n\f\r ]+(\d*\.\d+|\d+)[\0\t\n\f\r ]+Tf/,Lr=n=>{var e,t;let i=(e=n.getDefaultAppearance())!==null&&e!==void 0?e:"",r=(t=us(i,Kk).match)!==null&&t!==void 0?t:[],o=Number(r[2]);return isFinite(o)?o:void 0},Gk=/(\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)/,xi=n=>{var e;let t=(e=n.getDefaultAppearance())!==null&&e!==void 0?e:"",i=us(t,Gk).match,[,r,o,s,a,c]=i!=null?i:[];if(c==="g"&&r)return Zh(Number(r));if(c==="rg"&&r&&o&&s)return pe(Number(r),Number(o),Number(s));if(c==="k"&&r&&o&&s&&a)return Yh(Number(r),Number(o),Number(s),Number(a))},bi=(n,e,t,i=0)=>{var r;let o=[ln(e).toString(),Uo((r=t==null?void 0:t.name)!==null&&r!==void 0?r:"dummy__noop",i).toString()].join(` `);n.setDefaultAppearance(o)},Up=(n,e)=>{var t,i,r;let o=xi(e),s=xi(n.acroField),a=e.getRectangle(),c=e.getAppearanceCharacteristics(),l=e.getBorderStyle(),d=(t=l==null?void 0:l.getWidth())!==null&&t!==void 0?t:0,h=ui(c==null?void 0:c.getRotation()),{width:u,height:p}=on(a,h),f=mi(Object.assign(Object.assign({},a),{rotation:h})),m=pe(0,0,0),x=(i=vt(c==null?void 0:c.getBorderColor()))!==null&&i!==void 0?i:m,g=vt(c==null?void 0:c.getBackgroundColor()),b=vt(c==null?void 0:c.getBackgroundColor(),.8),w=(r=o!=null?o:s)!==null&&r!==void 0?r:m;bi(o?e:n.acroField,w);let y={x:0+d/2,y:0+d/2,width:u-d,height:p-d,thickness:1.5,borderWidth:d,borderColor:x,markColor:w};return{normal:{on:[...f,...sa(Object.assign(Object.assign({},y),{color:g,filled:!0}))],off:[...f,...sa(Object.assign(Object.assign({},y),{color:g,filled:!1}))]},down:{on:[...f,...sa(Object.assign(Object.assign({},y),{color:b,filled:!0}))],off:[...f,...sa(Object.assign(Object.assign({},y),{color:b,filled:!1}))]}}},qp=(n,e)=>{var t,i,r;let o=xi(e),s=xi(n.acroField),a=e.getRectangle(),c=e.getAppearanceCharacteristics(),l=e.getBorderStyle(),d=(t=l==null?void 0:l.getWidth())!==null&&t!==void 0?t:0,h=ui(c==null?void 0:c.getRotation()),{width:u,height:p}=on(a,h),f=mi(Object.assign(Object.assign({},a),{rotation:h})),m=pe(0,0,0),x=(i=vt(c==null?void 0:c.getBorderColor()))!==null&&i!==void 0?i:m,g=vt(c==null?void 0:c.getBackgroundColor()),b=vt(c==null?void 0:c.getBackgroundColor(),.8),w=(r=o!=null?o:s)!==null&&r!==void 0?r:m;bi(o?e:n.acroField,w);let y={x:u/2,y:p/2,width:u-d,height:p-d,borderWidth:d,borderColor:x,dotColor:w};return{normal:{on:[...f,...aa(Object.assign(Object.assign({},y),{color:g,filled:!0}))],off:[...f,...aa(Object.assign(Object.assign({},y),{color:g,filled:!1}))]},down:{on:[...f,...aa(Object.assign(Object.assign({},y),{color:b,filled:!0}))],off:[...f,...aa(Object.assign(Object.assign({},y),{color:b,filled:!1}))]}}},jp=(n,e,t)=>{var i,r,o,s,a;let c=xi(e),l=xi(n.acroField),d=Lr(e),h=Lr(n.acroField),u=e.getRectangle(),p=e.getAppearanceCharacteristics(),f=e.getBorderStyle(),m=p==null?void 0:p.getCaptions(),x=(i=m==null?void 0:m.normal)!==null&&i!==void 0?i:"",g=(o=(r=m==null?void 0:m.down)!==null&&r!==void 0?r:x)!==null&&o!==void 0?o:"",b=(s=f==null?void 0:f.getWidth())!==null&&s!==void 0?s:0,w=ui(p==null?void 0:p.getRotation()),{width:y,height:F}=on(u,w),D=mi(Object.assign(Object.assign({},u),{rotation:w})),C=pe(0,0,0),k=vt(p==null?void 0:p.getBorderColor()),E=vt(p==null?void 0:p.getBackgroundColor()),B=vt(p==null?void 0:p.getBackgroundColor(),.8),S={x:b,y:b,width:y-b*2,height:F-b*2},I=ca(x,{alignment:Ue.Center,fontSize:d!=null?d:h,font:t,bounds:S}),O=ca(g,{alignment:Ue.Center,fontSize:d!=null?d:h,font:t,bounds:S}),A=Math.min(I.fontSize,O.fontSize),N=(a=c!=null?c:l)!==null&&a!==void 0?a:C;bi(c||d!==void 0?e:n.acroField,N,t,A);let q={x:0+b/2,y:0+b/2,width:y-b,height:F-b,borderWidth:b,borderColor:k,textColor:N,font:t.name,fontSize:A};return{normal:[...D,...nu(Object.assign(Object.assign({},q),{color:E,textLines:[I.line]}))],down:[...D,...nu(Object.assign(Object.assign({},q),{color:B,textLines:[O.line]}))]}},Wp=(n,e,t)=>{var i,r,o,s;let a=xi(e),c=xi(n.acroField),l=Lr(e),d=Lr(n.acroField),h=e.getRectangle(),u=e.getAppearanceCharacteristics(),p=e.getBorderStyle(),f=(i=n.getText())!==null&&i!==void 0?i:"",m=(r=p==null?void 0:p.getWidth())!==null&&r!==void 0?r:0,x=ui(u==null?void 0:u.getRotation()),{width:g,height:b}=on(h,x),w=mi(Object.assign(Object.assign({},h),{rotation:x})),y=pe(0,0,0),F=vt(u==null?void 0:u.getBorderColor()),D=vt(u==null?void 0:u.getBackgroundColor()),C,k,E=n.isCombed()?0:1,B={x:m+E,y:m+E,width:g-(m+E)*2,height:b-(m+E)*2};if(n.isMultiline()){let O=su(f,{alignment:n.getAlignment(),fontSize:l!=null?l:d,font:t,bounds:B});C=O.lines,k=O.fontSize}else if(n.isCombed()){let O=zp(f,{fontSize:l!=null?l:d,font:t,bounds:B,cellCount:(o=n.getMaxLength())!==null&&o!==void 0?o:0});C=O.cells,k=O.fontSize}else{let O=ca(f,{alignment:n.getAlignment(),fontSize:l!=null?l:d,font:t,bounds:B});C=[O.line],k=O.fontSize}let S=(s=a!=null?a:c)!==null&&s!==void 0?s:y;bi(a||l!==void 0?e:n.acroField,S,t,k);let I={x:0+m/2,y:0+m/2,width:g-m,height:b-m,borderWidth:m!=null?m:0,borderColor:F,textColor:S,font:t.name,fontSize:k,color:D,textLines:C,padding:E};return[...w,...ou(I)]},Kp=(n,e,t)=>{var i,r,o;let s=xi(e),a=xi(n.acroField),c=Lr(e),l=Lr(n.acroField),d=e.getRectangle(),h=e.getAppearanceCharacteristics(),u=e.getBorderStyle(),p=(i=n.getSelected()[0])!==null&&i!==void 0?i:"",f=(r=u==null?void 0:u.getWidth())!==null&&r!==void 0?r:0,m=ui(h==null?void 0:h.getRotation()),{width:x,height:g}=on(d,m),b=mi(Object.assign(Object.assign({},d),{rotation:m})),w=pe(0,0,0),y=vt(h==null?void 0:h.getBorderColor()),F=vt(h==null?void 0:h.getBackgroundColor()),D=1,C={x:f+D,y:f+D,width:x-(f+D)*2,height:g-(f+D)*2},{line:k,fontSize:E}=ca(p,{alignment:Ue.Left,fontSize:c!=null?c:l,font:t,bounds:C}),B=(o=s!=null?s:a)!==null&&o!==void 0?o:w;bi(s||c!==void 0?e:n.acroField,B,t,E);let S={x:0+f/2,y:0+f/2,width:x-f,height:g-f,borderWidth:f!=null?f:0,borderColor:y,textColor:B,font:t.name,fontSize:E,color:F,textLines:[k],padding:D};return[...b,...ou(S)]},Gp=(n,e,t)=>{var i,r;let o=xi(e),s=xi(n.acroField),a=Lr(e),c=Lr(n.acroField),l=e.getRectangle(),d=e.getAppearanceCharacteristics(),h=e.getBorderStyle(),u=(i=h==null?void 0:h.getWidth())!==null&&i!==void 0?i:0,p=ui(d==null?void 0:d.getRotation()),{width:f,height:m}=on(l,p),x=mi(Object.assign(Object.assign({},l),{rotation:p})),g=pe(0,0,0),b=vt(d==null?void 0:d.getBorderColor()),w=vt(d==null?void 0:d.getBackgroundColor()),y=n.getOptions(),F=n.getSelected();n.isSorted()&&y.sort();let D="";for(let N=0,q=y.length;Nnew Hi(n,e,t);var Me=class{constructor(e,t,i){this.modified=!0,T(e,"ref",[[Y,"PDFRef"]]),T(t,"doc",[[We,"PDFDocument"]]),T(i,"embedder",[[Dr,"CustomFontEmbedder"],[Fr,"StandardFontEmbedder"]]),this.ref=e,this.doc=t,this.name=i.fontName,this.embedder=i}encodeText(e){return T(e,"text",["string"]),this.modified=!0,this.embedder.encodeText(e)}widthOfTextAtSize(e,t){return T(e,"text",["string"]),T(t,"size",["number"]),this.embedder.widthOfTextAtSize(e,t)}heightAtSize(e,t){var i;return T(e,"size",["number"]),H(t==null?void 0:t.descender,"options.descender",["boolean"]),this.embedder.heightOfFontAtSize(e,{descender:(i=t==null?void 0:t.descender)!==null&&i!==void 0?i:!0})}sizeAtHeight(e){return T(e,"height",["number"]),this.embedder.sizeOfFontAtHeight(e)}getCharacterSet(){return this.embedder instanceof Fr?this.embedder.encoding.supportedCodePoints:this.embedder.font.characterSet}embed(){return Q(this,void 0,void 0,function*(){this.modified&&(yield this.embedder.embedIntoContext(this.doc.context,this.ref),this.modified=!1)})}};Me.of=(n,e,t)=>new Me(n,e,t);var yi=class{constructor(e,t,i){T(e,"ref",[[Y,"PDFRef"]]),T(t,"doc",[[We,"PDFDocument"]]),T(i,"embedder",[[Us,"JpegEmbedder"],[js,"PngEmbedder"]]),this.ref=e,this.doc=t,this.width=i.width,this.height=i.height,this.embedder=i}scale(e){return T(e,"factor",["number"]),{width:this.width*e,height:this.height*e}}scaleToFit(e,t){T(e,"width",["number"]),T(t,"height",["number"]);let i=e/this.width,r=t/this.height,o=Math.min(i,r);return this.scale(o)}size(){return this.scale(1)}embed(){return Q(this,void 0,void 0,function*(){if(this.embedder){if(!this.embedTask){let{doc:e,ref:t}=this;this.embedTask=this.embedder.embedIntoContext(e.context,t)}yield this.embedTask,this.embedder=void 0}})}};yi.of=(n,e,t)=>new yi(n,e,t);var vi;(function(n){n[n.Left=0]="Left",n[n.Center=1]="Center",n[n.Right=2]="Right"})(vi||(vi={}));var wi=n=>{H(n==null?void 0:n.x,"options.x",["number"]),H(n==null?void 0:n.y,"options.y",["number"]),H(n==null?void 0:n.width,"options.width",["number"]),H(n==null?void 0:n.height,"options.height",["number"]),H(n==null?void 0:n.textColor,"options.textColor",[[Object,"Color"]]),H(n==null?void 0:n.backgroundColor,"options.backgroundColor",[[Object,"Color"]]),H(n==null?void 0:n.borderColor,"options.borderColor",[[Object,"Color"]]),H(n==null?void 0:n.borderWidth,"options.borderWidth",["number"]),H(n==null?void 0:n.rotate,"options.rotate",[[Object,"Rotation"]])},at=class{constructor(e,t,i){T(e,"acroField",[[zt,"PDFAcroTerminal"]]),T(t,"ref",[[Y,"PDFRef"]]),T(i,"doc",[[We,"PDFDocument"]]),this.acroField=e,this.ref=t,this.doc=i}getName(){var e;return(e=this.acroField.getFullyQualifiedName())!==null&&e!==void 0?e:""}isReadOnly(){return this.acroField.hasFlag(Kt.ReadOnly)}enableReadOnly(){this.acroField.setFlagTo(Kt.ReadOnly,!0)}disableReadOnly(){this.acroField.setFlagTo(Kt.ReadOnly,!1)}isRequired(){return this.acroField.hasFlag(Kt.Required)}enableRequired(){this.acroField.setFlagTo(Kt.Required,!0)}disableRequired(){this.acroField.setFlagTo(Kt.Required,!1)}isExported(){return!this.acroField.hasFlag(Kt.NoExport)}enableExporting(){this.acroField.setFlagTo(Kt.NoExport,!1)}disableExporting(){this.acroField.setFlagTo(Kt.NoExport,!0)}needsAppearancesUpdate(){throw new Ze(this.constructor.name,"needsAppearancesUpdate")}defaultUpdateAppearances(e){throw new Ze(this.constructor.name,"defaultUpdateAppearances")}markAsDirty(){this.doc.getForm().markFieldAsDirty(this.ref)}markAsClean(){this.doc.getForm().markFieldAsClean(this.ref)}isDirty(){return this.doc.getForm().fieldIsDirty(this.ref)}createWidget(e){var t;let i=e.textColor,r=e.backgroundColor,o=e.borderColor,s=e.borderWidth,a=rn(e.rotate),c=e.caption,l=e.x,d=e.y,h=e.width+s,u=e.height+s,p=!!e.hidden,f=e.page;hl(a,"degreesAngle",90);let m=bo.create(this.doc.context,this.ref),x=op({x:l,y:d,width:h,height:u},s,a);m.setRectangle(x),f&&m.setP(f);let g=m.getOrCreateAppearanceCharacteristics();r&&g.setBackgroundColor(_h(r)),g.setRotation(a),c&&g.setCaptions({normal:c}),o&&g.setBorderColor(_h(o));let b=m.getOrCreateBorderStyle();if(s!==void 0&&b.setWidth(s),m.setFlagTo(Ro.Print,!0),m.setFlagTo(Ro.Hidden,p),m.setFlagTo(Ro.Invisible,!1),i){let y=((t=this.acroField.getDefaultAppearance())!==null&&t!==void 0?t:"")+` `+ln(i).toString();this.acroField.setDefaultAppearance(y)}return m}updateWidgetAppearanceWithFont(e,t,{normal:i,rollover:r,down:o}){this.updateWidgetAppearances(e,{normal:this.createAppearanceStream(e,i,t),rollover:r&&this.createAppearanceStream(e,r,t),down:o&&this.createAppearanceStream(e,o,t)})}updateOnOffWidgetAppearance(e,t,{normal:i,rollover:r,down:o}){this.updateWidgetAppearances(e,{normal:this.createAppearanceDict(e,i,t),rollover:r&&this.createAppearanceDict(e,r,t),down:o&&this.createAppearanceDict(e,o,t)})}updateWidgetAppearances(e,{normal:t,rollover:i,down:r}){e.setNormalAppearance(t),i?e.setRolloverAppearance(i):e.removeRolloverAppearance(),r?e.setDownAppearance(r):e.removeDownAppearance()}createAppearanceStream(e,t,i){let{context:r}=this.acroField.dict,{width:o,height:s}=e.getRectangle(),a=i&&{Font:{[i.name]:i.ref}},c=r.formXObject(t,{Resources:a,BBox:r.obj([0,0,o,s]),Matrix:r.obj([1,0,0,1,0,0])});return r.register(c)}createImageAppearanceStream(e,t,i){var r;let{context:o}=this.acroField.dict,s=e.getRectangle(),a=e.getAppearanceCharacteristics(),c=e.getBorderStyle(),l=(r=c==null?void 0:c.getWidth())!==null&&r!==void 0?r:0,d=ui(a==null?void 0:a.getRotation()),h=mi(Object.assign(Object.assign({},s),{rotation:d})),u=on(s,d),p=t.scaleToFit(u.width-l*2,u.height-l*2),f={x:l,y:l,width:p.width,height:p.height,rotate:te(0),xSkew:te(0),ySkew:te(0)};i===vi.Center?(f.x+=(u.width-l*2)/2-p.width/2,f.y+=(u.height-l*2)/2-p.height/2):i===vi.Right&&(f.x=u.width-l-p.width,f.y=u.height-l-p.height);let m=this.doc.context.addRandomSuffix("Image",10),x=[...h,...kc(m,f)],g={XObject:{[m]:t.ref}},b=o.formXObject(x,{Resources:g,BBox:o.obj([0,0,s.width,s.height]),Matrix:o.obj([1,0,0,1,0,0])});return o.register(b)}createAppearanceDict(e,t,i){let{context:r}=this.acroField.dict,o=this.createAppearanceStream(e,t.on),s=this.createAppearanceStream(e,t.off),a=r.obj({});return a.set(i,o),a.set(v.of("Off"),s),a}};var _t=class extends at{constructor(e,t,i){super(e,t,i),T(e,"acroCheckBox",[[En,"PDFAcroCheckBox"]]),this.acroField=e}check(){var e;let t=(e=this.acroField.getOnValue())!==null&&e!==void 0?e:v.of("Yes");this.markAsDirty(),this.acroField.setValue(t)}uncheck(){this.markAsDirty(),this.acroField.setValue(v.of("Off"))}isChecked(){let e=this.acroField.getOnValue();return!!e&&e===this.acroField.getValue()}addToPage(e,t){var i,r,o,s,a,c;T(e,"page",[[Oe,"PDFPage"]]),wi(t),t||(t={}),"textColor"in t||(t.textColor=pe(0,0,0)),"backgroundColor"in t||(t.backgroundColor=pe(1,1,1)),"borderColor"in t||(t.borderColor=pe(0,0,0)),"borderWidth"in t||(t.borderWidth=1);let l=this.createWidget({x:(i=t.x)!==null&&i!==void 0?i:0,y:(r=t.y)!==null&&r!==void 0?r:0,width:(o=t.width)!==null&&o!==void 0?o:50,height:(s=t.height)!==null&&s!==void 0?s:50,textColor:t.textColor,backgroundColor:t.backgroundColor,borderColor:t.borderColor,borderWidth:(a=t.borderWidth)!==null&&a!==void 0?a:0,rotate:(c=t.rotate)!==null&&c!==void 0?c:te(0),hidden:t.hidden,page:e.ref}),d=this.doc.context.register(l.dict);this.acroField.addWidget(d),l.setAppearanceState(v.of("Off")),this.updateWidgetAppearance(l,v.of("Yes")),e.node.addAnnot(d)}needsAppearancesUpdate(){var e;let t=this.acroField.getWidgets();for(let i=0,r=t.length;inew _t(n,e,t);var Fi=class extends at{constructor(e,t,i){super(e,t,i),T(e,"acroComboBox",[[Tn,"PDFAcroComboBox"]]),this.acroField=e}getOptions(){let e=this.acroField.getOptions(),t=new Array(e.length);for(let i=0,r=t.length;i!r.includes(a))&&this.enableEditing(),this.markAsDirty(),(i.length>1||i.length===1&&t)&&this.enableMultiselect();let s=new Array(i.length);for(let a=0,c=i.length;anew Fi(n,e,t);var Di=class extends at{constructor(e,t,i){super(e,t,i),T(e,"acroListBox",[[Ln,"PDFAcroListBox"]]),this.acroField=e}getOptions(){let e=this.acroField.getOptions(),t=new Array(e.length);for(let i=0,r=t.length;i1||i.length===1&&t)&&this.enableMultiselect();let o=new Array(i.length);for(let s=0,a=i.length;snew Di(n,e,t);var Jt=class extends at{constructor(e,t,i){super(e,t,i),T(e,"acroRadioButton",[[On,"PDFAcroRadioButton"]]),this.acroField=e}getOptions(){let e=this.acroField.getExportValues();if(e){let r=new Array(e.length);for(let o=0,s=e.length;onew Jt(n,e,t);var zi=class extends at{constructor(e,t,i){super(e,t,i),T(e,"acroSignature",[[xr,"PDFAcroSignature"]]),this.acroField=e}needsAppearancesUpdate(){return!1}};zi.of=(n,e,t)=>new zi(n,e,t);var Pi=class extends at{constructor(e,t,i){super(e,t,i),T(e,"acroText",[[In,"PDFAcroText"]]),this.acroField=e}getText(){let e=this.acroField.getValue();if(!e&&this.isRichFormatted())throw new Bc(this.getName());return e==null?void 0:e.decodeText()}setText(e){H(e,"text",["string"]);let t=this.getMaxLength();if(t!==void 0&&e&&e.length>t)throw new Lc(e.length,t,this.getName());this.markAsDirty(),this.disableRichFormatting(),e?this.acroField.setValue(K.fromText(e)):this.acroField.removeValue()}getAlignment(){let e=this.acroField.getQuadding();return e===0?Ue.Left:e===1?Ue.Center:e===2?Ue.Right:Ue.Left}setAlignment(e){li(e,"alignment",Ue),this.markAsDirty(),this.acroField.setQuadding(e)}getMaxLength(){return this.acroField.getMaxLength()}setMaxLength(e){if(Vt(e,"maxLength",0,Number.MAX_SAFE_INTEGER),this.markAsDirty(),e===void 0)this.acroField.removeMaxLength();else{let t=this.getText();if(t&&t.length>e)throw new Mc(t.length,e,this.getName());this.acroField.setMaxLength(e)}}removeMaxLength(){this.markAsDirty(),this.acroField.removeMaxLength()}setImage(e){let t=this.getAlignment(),i=t===Ue.Center?vi.Center:t===Ue.Right?vi.Right:vi.Left,r=this.acroField.getWidgets();for(let o=0,s=r.length;onew Pi(n,e,t);var Zo;(function(n){n.Courier="Courier",n.CourierBold="Courier-Bold",n.CourierOblique="Courier-Oblique",n.CourierBoldOblique="Courier-BoldOblique",n.Helvetica="Helvetica",n.HelveticaBold="Helvetica-Bold",n.HelveticaOblique="Helvetica-Oblique",n.HelveticaBoldOblique="Helvetica-BoldOblique",n.TimesRoman="Times-Roman",n.TimesRomanBold="Times-Bold",n.TimesRomanItalic="Times-Italic",n.TimesRomanBoldItalic="Times-BoldItalic",n.Symbol="Symbol",n.ZapfDingbats="ZapfDingbats"})(Zo||(Zo={}));var Hn=class{constructor(e,t){this.embedDefaultFont=()=>this.doc.embedStandardFont(Zo.Helvetica),T(e,"acroForm",[[br,"PDFAcroForm"]]),T(t,"doc",[[We,"PDFDocument"]]),this.acroForm=e,this.doc=t,this.dirtyFields=new Set,this.defaultFontCache=ht.populatedBy(this.embedDefaultFont)}hasXFA(){return this.acroForm.dict.has(v.of("XFA"))}deleteXFA(){this.acroForm.dict.delete(v.of("XFA"))}getFields(){let e=this.acroForm.getAllFields(),t=[];for(let i=0,r=e.length;is.node.removeAnnot(e.ref)),this.acroForm.removeField(e.acroField);let r=e.acroField.normalizedEntries().Kids,o=r.size();for(let s=0;sr.ref===t);if(i===void 0){let r=this.doc.context.getObjectRef(e.dict);if(r===void 0)throw new Error("Could not find PDFRef for PDFObject");if(i=this.doc.findPageForAnnotationRef(r),i===void 0)throw new Error(`Could not find page for PDFRef ${r}`)}return i}findWidgetAppearanceRef(e,t){var i;let r=t.getNormalAppearance();if((e instanceof _t||e instanceof Jt)&&(r instanceof Y&&(r=this.doc.context.lookup(r,W)),r instanceof W)){let o=e.acroField.getValue(),s=(i=r.get(o))!==null&&i!==void 0?i:r.get(v.of("Off"));s instanceof Y&&(r=s)}if(!(r instanceof Y)){let o=e.getName();throw new Error(`Failed to extract appearance ref for: ${o}`)}return r}findOrCreateNonTerminals(e){let t=[this.acroForm];for(let i=0,r=e.length;inew Hn(n,e);var Xk=(n,e,t)=>{if(n instanceof Bn)return ki.of(n,e,t);if(n instanceof En)return _t.of(n,e,t);if(n instanceof Tn)return Fi.of(n,e,t);if(n instanceof Ln)return Di.of(n,e,t);if(n instanceof In)return Pi.of(n,e,t);if(n instanceof On)return Jt.of(n,e,t);if(n instanceof xr)return zi.of(n,e,t)},da=n=>{if(n.length===0)throw new Error("PDF field names must not be empty strings");let e=n.split(".");for(let t=0,i=e.length;t{let o=n.normalizedEntries(),s=Rs("Kids"in o?o.Kids:o.Fields);for(let a=0,c=s.length;anew _o(n,e,t);var zn=class{constructor(e,t,i){this.alreadyEmbedded=!1,this.ref=e,this.doc=t,this.embedder=i}embed(){return Q(this,void 0,void 0,function*(){if(!this.alreadyEmbedded){let{catalog:e,context:t}=this.doc,i=yield this.embedder.embedIntoContext(this.doc.context,this.ref);e.has(v.of("Names"))||e.set(v.of("Names"),t.obj({}));let r=e.lookup(v.of("Names"),W);r.has(v.of("JavaScript"))||r.set(v.of("JavaScript"),t.obj({}));let o=r.lookup(v.of("JavaScript"),W);o.has(v.of("Names"))||o.set(v.of("Names"),t.obj([]));let s=o.lookup(v.of("Names"),Z);s.push(K.fromText(this.embedder.scriptName)),s.push(i),this.alreadyEmbedded=!0}})}};zn.of=(n,e,t)=>new zn(n,e,t);var Xp=class n{static for(e,t){return new n(e,t)}constructor(e,t){this.script=e,this.scriptName=t}embedIntoContext(e,t){return Q(this,void 0,void 0,function*(){let i=e.obj({Type:"Action",S:"JavaScript",JS:K.fromText(this.script)});return t?(e.assign(t,i),t):e.register(i)})}},gw=Xp;var mw=512,Zp=class extends di{constructor(e,t,i){super(i),this.stream=e,this.decrypt=t,this.nextChunk=null,this.initialized=!1}readBlock(){let e;if(this.initialized?e=this.nextChunk:(e=this.stream.getBytes(mw),this.initialized=!0),!e||e.length===0){this.eof=!0;return}this.nextChunk=this.stream.getBytes(mw);let t=this.nextChunk&&this.nextChunk.length>0,i=this.decrypt;e=i(e,!t);let r=this.bufferLength,o=r+e.length;this.ensureBuffer(o).set(e,r),this.bufferLength=o}},xw=Zp;var Un=class{constructor(e){this.a=0,this.b=0;let t=new Uint8Array(256),i=e.length;for(let r=0;r<256;++r)t[r]=r;for(let r=0,o=0;r<256;++r){let s=t[r];o=o+s+e[r%i]&255,t[r]=t[o],t[o]=s}this.s=t}encryptBlock(e){let t=this.a,i=this.b,r=this.s,o=e.length,s=new Uint8Array(o);for(let a=0;a>5&255,u[p++]=s>>13&255,u[p++]=s>>21&255,u[p++]=s>>>29&255,u[p++]=0,u[p++]=0,u[p++]=0;let x=new Int32Array(16);for(p=0;p>>32-E)|0,g=C}a=a+g|0,c=c+b|0,l=l+w|0,d=d+y|0}return new Uint8Array([a&255,a>>8&255,a>>16&255,a>>>24&255,c&255,c>>8&255,c>>16&255,c>>>24&255,l&255,l>>8&255,l>>16&255,l>>>24&255,d&255,d>>8&255,d>>16&255,d>>>24&255])}return i})(),z=class{constructor(e,t){this.high=e|0,this.low=t|0}and(e){this.high&=e.high,this.low&=e.low}xor(e){this.high^=e.high,this.low^=e.low}or(e){this.high|=e.high,this.low|=e.low}shiftRight(e){e>=32?(this.low=this.high>>>e-32|0,this.high=0):(this.low=this.low>>>e|this.high<<32-e,this.high=this.high>>>e|0)}shiftLeft(e){e>=32?(this.high=this.low<>>32-e,this.low<<=e)}rotateRight(e){let t,i;e&32?(i=this.low,t=this.high):(t=this.low,i=this.high),e&=31,this.low=t>>>e|i<<32-e,this.high=i>>>e|t<<32-e}not(){this.high=~this.high,this.low=~this.low}add(e){let t=(this.low>>>0)+(e.low>>>0),i=(this.high>>>0)+(e.high>>>0);t>4294967295&&(i+=1),this.low=t|0,this.high=i|0}copyTo(e,t){e[t]=this.high>>>24&255,e[t+1]=this.high>>16&255,e[t+2]=this.high>>8&255,e[t+3]=this.high&255,e[t+4]=this.low>>>24&255,e[t+5]=this.low>>16&255,e[t+6]=this.low>>8&255,e[t+7]=this.low&255}assign(e){this.high=e.high,this.low=e.low}},fa=(function(){function e(d,h){return d>>>h|d<<32-h}function t(d,h,u){return d&h^~d&u}function i(d,h,u){return d&h^d&u^h&u}function r(d){return e(d,2)^e(d,13)^e(d,22)}function o(d){return e(d,6)^e(d,11)^e(d,25)}function s(d){return e(d,7)^e(d,18)^d>>>3}function a(d){return e(d,17)^e(d,19)^d>>>10}let c=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];function l(d,h,u){let p=1779033703,f=3144134277,m=1013904242,x=2773480762,g=1359893119,b=2600822924,w=528734635,y=1541459225,F=Math.ceil((u+9)/64)*64,D=new Uint8Array(F),C,k;for(C=0;C>>29&255,D[C++]=u>>21&255,D[C++]=u>>13&255,D[C++]=u>>5&255,D[C++]=u<<3&255;let B=new Uint32Array(64);for(C=0;C>24&255,p>>16&255,p>>8&255,p&255,f>>24&255,f>>16&255,f>>8&255,f&255,m>>24&255,m>>16&255,m>>8&255,m&255,x>>24&255,x>>16&255,x>>8&255,x&255,g>>24&255,g>>16&255,g>>8&255,g&255,b>>24&255,b>>16&255,b>>8&255,b&255,w>>24&255,w>>16&255,w>>8&255,w&255,y>>24&255,y>>16&255,y>>8&255,y&255])}return l})(),bw=(function(){function e(l,d,h,u,p){l.assign(d),l.and(h),p.assign(d),p.not(),p.and(u),l.xor(p)}function t(l,d,h,u,p){l.assign(d),l.and(h),p.assign(d),p.and(u),l.xor(p),p.assign(h),p.and(u),l.xor(p)}function i(l,d,h){l.assign(d),l.rotateRight(28),h.assign(d),h.rotateRight(34),l.xor(h),h.assign(d),h.rotateRight(39),l.xor(h)}function r(l,d,h){l.assign(d),l.rotateRight(14),h.assign(d),h.rotateRight(18),l.xor(h),h.assign(d),h.rotateRight(41),l.xor(h)}function o(l,d,h){l.assign(d),l.rotateRight(1),h.assign(d),h.rotateRight(8),l.xor(h),h.assign(d),h.shiftRight(7),l.xor(h)}function s(l,d,h){l.assign(d),l.rotateRight(19),h.assign(d),h.rotateRight(61),l.xor(h),h.assign(d),h.shiftRight(6),l.xor(h)}let a=[new z(1116352408,3609767458),new z(1899447441,602891725),new z(3049323471,3964484399),new z(3921009573,2173295548),new z(961987163,4081628472),new z(1508970993,3053834265),new z(2453635748,2937671579),new z(2870763221,3664609560),new z(3624381080,2734883394),new z(310598401,1164996542),new z(607225278,1323610764),new z(1426881987,3590304994),new z(1925078388,4068182383),new z(2162078206,991336113),new z(2614888103,633803317),new z(3248222580,3479774868),new z(3835390401,2666613458),new z(4022224774,944711139),new z(264347078,2341262773),new z(604807628,2007800933),new z(770255983,1495990901),new z(1249150122,1856431235),new z(1555081692,3175218132),new z(1996064986,2198950837),new z(2554220882,3999719339),new z(2821834349,766784016),new z(2952996808,2566594879),new z(3210313671,3203337956),new z(3336571891,1034457026),new z(3584528711,2466948901),new z(113926993,3758326383),new z(338241895,168717936),new z(666307205,1188179964),new z(773529912,1546045734),new z(1294757372,1522805485),new z(1396182291,2643833823),new z(1695183700,2343527390),new z(1986661051,1014477480),new z(2177026350,1206759142),new z(2456956037,344077627),new z(2730485921,1290863460),new z(2820302411,3158454273),new z(3259730800,3505952657),new z(3345764771,106217008),new z(3516065817,3606008344),new z(3600352804,1432725776),new z(4094571909,1467031594),new z(275423344,851169720),new z(430227734,3100823752),new z(506948616,1363258195),new z(659060556,3750685593),new z(883997877,3785050280),new z(958139571,3318307427),new z(1322822218,3812723403),new z(1537002063,2003034995),new z(1747873779,3602036899),new z(1955562222,1575990012),new z(2024104815,1125592928),new z(2227730452,2716904306),new z(2361852424,442776044),new z(2428436474,593698344),new z(2756734187,3733110249),new z(3204031479,2999351573),new z(3329325298,3815920427),new z(3391569614,3928383900),new z(3515267271,566280711),new z(3940187606,3454069534),new z(4118630271,4000239992),new z(116418474,1914138554),new z(174292421,2731055270),new z(289380356,3203993006),new z(460393269,320620315),new z(685471733,587496836),new z(852142971,1086792851),new z(1017036298,365543100),new z(1126000580,2618297676),new z(1288033470,3409855158),new z(1501505948,4234509866),new z(1607167915,987167468),new z(1816402316,1246189591)];function c(l,d,h,u=!1){let p,f,m,x,g,b,w,y;u?(p=new z(3418070365,3238371032),f=new z(1654270250,914150663),m=new z(2438529370,812702999),x=new z(355462360,4144912697),g=new z(1731405415,4290775857),b=new z(2394180231,1750603025),w=new z(3675008525,1694076839),y=new z(1203062813,3204075428)):(p=new z(1779033703,4089235720),f=new z(3144134277,2227873595),m=new z(1013904242,4271175723),x=new z(2773480762,1595750129),g=new z(1359893119,2917565137),b=new z(2600822924,725511199),w=new z(528734635,4215389547),y=new z(1541459225,327033209));let F=Math.ceil((h+17)/128)*128,D=new Uint8Array(F),C,k;for(C=0;C>>29&255,D[C++]=h>>21&255,D[C++]=h>>13&255,D[C++]=h>>5&255,D[C++]=h<<3&255;let B=new Array(80);for(C=0;C<80;C++)B[C]=new z(0,0);let S=new z(0,0),I=new z(0,0),O=new z(0,0),A=new z(0,0),N=new z(0,0),q=new z(0,0),V=new z(0,0),X=new z(0,0),L=new z(0,0),U=new z(0,0),R=new z(0,0),M=new z(0,0),re;for(C=0;C=1;--a){i=s[13],s[13]=s[9],s[9]=s[5],s[5]=s[1],s[1]=i,i=s[14],r=s[10],s[14]=s[6],s[10]=s[2],s[6]=i,s[2]=r,i=s[15],r=s[11],o=s[7],s[15]=s[3],s[11]=i,s[7]=r,s[3]=o;for(let c=0;c<16;++c)s[c]=this._inv_s[s[c]];for(let c=0,l=a*16;c<16;++c,++l)s[c]^=t[l];for(let c=0;c<16;c+=4){let l=this._mix[s[c]],d=this._mix[s[c+1]],h=this._mix[s[c+2]],u=this._mix[s[c+3]];i=l^d>>>8^d<<24^h>>>16^h<<16^u>>>24^u<<8,s[c]=i>>>24&255,s[c+1]=i>>16&255,s[c+2]=i>>8&255,s[c+3]=i&255}}i=s[13],s[13]=s[9],s[9]=s[5],s[5]=s[1],s[1]=i,i=s[14],r=s[10],s[14]=s[6],s[10]=s[2],s[6]=i,s[2]=r,i=s[15],r=s[11],o=s[7],s[15]=s[3],s[11]=i,s[7]=r,s[3]=o;for(let a=0;a<16;++a)s[a]=this._inv_s[s[a]],s[a]^=t[a];return s}_encrypt(e,t){let i=this._s,r,o,s,a=new Uint8Array(16);a.set(e);for(let c=0;c<16;++c)a[c]^=t[c];for(let c=1;c=p;--u)if(d[u]!==h){h=0;break}c-=h,s[s.length-1]=d.subarray(0,16-h)}}let l=new Uint8Array(c);for(let d=0,h=0,u=s.length;d=256&&(o=(o^27)&255));for(let u=0;u<4;++u)r[d]=s^=r[d-32],d++,r[d]=a^=r[d-32],d++,r[d]=c^=r[d-32],d++,r[d]=l^=r[d-32],d++}return r}},_p=class{checkOwnerPassword(e,t,i,r){let o=new Uint8Array(e.length+56);o.set(e,0),o.set(t,e.length),o.set(i,e.length+t.length);let s=fa(o,0,o.length);return fs(s,r)}checkUserPassword(e,t,i){let r=new Uint8Array(e.length+8);r.set(e,0),r.set(t,e.length);let o=fa(r,0,r.length);return fs(o,i)}getOwnerKey(e,t,i,r){let o=new Uint8Array(e.length+56);o.set(e,0),o.set(t,e.length),o.set(i,e.length+t.length);let s=fa(o,0,o.length);return new Jo(s).decryptBlock(r,!1,new Uint8Array(16))}getUserKey(e,t,i){let r=new Uint8Array(e.length+8);r.set(e,0),r.set(t,e.length);let o=fa(r,0,r.length);return new Jo(o).decryptBlock(i,!1,new Uint8Array(16))}},Jp=class{calculatePDF20Hash(e,t,i){let r=fa(t,0,t.length).subarray(0,32),o=new Uint8Array([0]),s=0;for(;s<64||o[o.length-1]>s-32;){let a=e.length+r.length+i.length,c=new Uint8Array(a),l=0;c.set(e,l),l+=e.length,c.set(r,l),l+=r.length,c.set(i,l);let d=new Uint8Array(a*64);for(let p=0,f=0;p<64;p++,f+=a)d.set(c,f);o=new au(r.subarray(0,16)).encrypt(d,r.subarray(16,32));let u=o.slice(0,16).reduce((p,f)=>p+f,0)%3;u===0?r=fa(o,0,o.length):u===1?r=Zk(o,0,o.length):u===2&&(r=bw(o,0,o.length)),s++}return r.subarray(0,32)}hash(e,t,i){return this.calculatePDF20Hash(e,t,i)}checkOwnerPassword(e,t,i,r){let o=new Uint8Array(e.length+56);o.set(e,0),o.set(t,e.length),o.set(i,e.length+t.length);let s=this.calculatePDF20Hash(e,o,i);return fs(s,r)}checkUserPassword(e,t,i){let r=new Uint8Array(e.length+8);r.set(e,0),r.set(t,e.length);let o=this.calculatePDF20Hash(e,r,new Uint8Array);return fs(o,i)}getOwnerKey(e,t,i,r){let o=new Uint8Array(e.length+56);o.set(e,0),o.set(t,e.length),o.set(i,e.length+t.length);let s=this.calculatePDF20Hash(e,o,i);return new Jo(s).decryptBlock(r,!1,new Uint8Array(16))}getUserKey(e,t,i){let r=new Uint8Array(e.length+8);r.set(e,0),r.set(t,e.length);let o=this.calculatePDF20Hash(e,r,new Uint8Array);return new Jo(o).decryptBlock(i,!1,new Uint8Array(16))}},lu=class{constructor(e,t){this.StringCipherConstructor=e,this.StreamCipherConstructor=t}createStream(e,t){let i=this.StreamCipherConstructor();return new xw(e,function(o,s){return i.decryptBlock(o,s)},t)}decryptString(e){let t=this.StringCipherConstructor(),i=hs(e);return i=t.decryptBlock(i,!0),xn(i)}decryptBytes(e){return this.StringCipherConstructor().decryptBlock(e,!0)}encryptString(e){let t=this.StringCipherConstructor();if(t instanceof Rc){let o=16-e.length%16;e+=String.fromCharCode(o).repeat(o);let s=new Uint8Array(16);if(typeof crypto!="undefined")crypto.getRandomValues(s);else for(let l=0;l<16;l++)s[l]=Math.floor(256*Math.random());let a=hs(e);a=t.encrypt(a,s);let c=new Uint8Array(16+a.length);return c.set(s),c.set(a,16),xn(c)}let i=hs(e);return i=t.encrypt(i),xn(i)}},cu=class{constructor(e,t,i){var r,o;this.defaultPasswordBytes=new Uint8Array([40,191,78,94,78,117,138,65,100,0,78,86,255,250,1,8,46,46,0,182,208,104,62,128,47,12,169,254,100,83,105,122]),this.identityName=v.of("Identity");let s=e.get(v.of("Filter"));if(s.asString()!=="/Standard")throw new Error("unknown encryption method");this.filterName=s.asString(),this.dict=e;let a=e.get(v.of("V")).asNumber();if(!Number.isInteger(a)||a!==1&&a!==2&&a!==4&&a!==5)throw new Error("unsupported encryption algorithm");this.algorithm=a;let c=(r=e.get(v.of("Length")))===null||r===void 0?void 0:r.asNumber();if(!c)if(a<=3)c=40;else{let b=e.get(v.of("CF")),w=e.get(v.of("StmF"));if(b instanceof W&&w instanceof v){b.suppressEncryption=!0;let y=b.get(v.of(w.asString())),F=null;y&&(F=y.get(v.of("Length"))),c=F&&F.asNumber()||128,c<40&&(c<<=3)}}if(c===void 0||!Number.isInteger(c)||c<40||c%8!==0)throw new Error(`invalid key length: ${c}`);let l=e.get(v.of("O")).asBytes(),d=e.get(v.of("U")).asBytes(),h=l.subarray(0,32),u=d.subarray(0,32),p=e.get(v.of("P")).asNumber(),f=e.get(v.of("R")).asNumber(),m=(a===4||a===5)&&((o=e.get(v.of("EncryptMetadata")))===null||o===void 0?void 0:o.asBoolean())!==!1;this.encryptMetadata=m;let x;if(i){if(f===6)try{i=unescape(encodeURIComponent(i))}catch(b){console.warn("CipherTransformFactory: Unable to convert UTF8 encoded password.")}x=hs(i)}let g;if(a!==5)g=this.prepareKeyData(t,x,h,u,p,f,c,m);else{let b=l.subarray(32,40),w=l.subarray(40,48),y=d.subarray(0,48),F=d.subarray(32,40),D=d.subarray(40,48),C=e.get(v.of("OE")).asBytes(),k=e.get(v.of("UE")).asBytes(),E=e.get(v.of("Perms")).asBytes();g=this.createEncryptionKey20(f,x,h,b,w,y,u,F,D,C,k,E)}if(!g&&!i)throw new Error("NEEDS PASSWORD");if(!g&&i){let b=this.decodeUserPassword(x,h,f,c);g=this.prepareKeyData(t,b,h,u,p,f,c,m)}if(!g)throw new Error("Password incorrect");if(this.encryptionKey=g,a>=4){let b=e.get(v.of("CF"));b instanceof W&&(b.suppressEncryption=!0),this.cf=b,this.stmf=e.get(v.of("StmF"))||this.identityName,this.strf=e.get(v.of("StrF"))||this.identityName,this.eff=e.get(v.of("EFF"))||this.stmf}}createCipherTransform(e,t){if(this.algorithm===4||this.algorithm===5)return new lu(this.buildCipherConstructor(this.cf,this.strf,e,t,this.encryptionKey),this.buildCipherConstructor(this.cf,this.stmf,e,t,this.encryptionKey));let i=this.buildObjectKey(e,t,this.encryptionKey,!1),r=function(){return new Un(i)};return new lu(r,r)}createEncryptionKey20(e,t,i,r,o,s,a,c,l,d,h,u){if(t){let f=Math.min(127,t.length);t=t.subarray(0,f)}else t=new Uint8Array;let p;return e===6?p=new Jp:p=new _p,p.checkUserPassword(t,c,a)?p.getUserKey(t,l,h):t.length&&p.checkOwnerPassword(t,r,s,i)?p.getOwnerKey(t,o,s,d):null}prepareKeyData(e,t,i,r,o,s,a,c){let l=40+i.length+e.length,d=new Uint8Array(l),h=0,u,p;if(t)for(p=Math.min(32,t.length);h>8&255,d[h++]=o>>16&255,d[h++]=o>>>24&255,u=0,p=e.length;u=4&&!c&&(d[h++]=255,d[h++]=255,d[h++]=255,d[h++]=255);let f=ua(d,0,h),m=a>>3;if(s>=3)for(u=0;u<50;++u)f=ua(f,0,m);let x=f.subarray(0,m),g,b;if(s>=3){for(h=0;h<32;++h)d[h]=this.defaultPasswordBytes[h];for(u=0,p=e.length;u>3;if(i>=3)for(c=0;c<50;++c)l=ua(l,0,l.length);let h,u;if(i>=3){u=t;let p=new Uint8Array(d);for(c=19;c>=0;c--){for(let f=0;f>8&255,o[a++]=e>>16&255,o[a++]=t&255,o[a++]=t>>8&255,r&&(o[a++]=115,o[a++]=65,o[a++]=108,o[a++]=84),ua(o,0,a).subarray(0,Math.min(i.length+5,16))}buildCipherConstructor(e,t,i,r,o){if(!(t instanceof v))throw new Error("Invalid crypt filter name.");let s=e.get(v.of(t.asString().replace("/",""))),a;if(s!=null&&(a=s.get(v.of("CFM"))),!a||a.asString()==="/None")return function(){return new Yp};if(a.asString()==="/V2")return()=>new Un(this.buildObjectKey(i,r,o,!1));if(a.asString()==="/AESV2")return()=>new au(this.buildObjectKey(i,r,o,!0));if(a.asString()==="/AESV3")return()=>new Jo(o);throw new Error("Unknown crypto method")}};var We=class n{static load(e,t={}){return Q(this,void 0,void 0,function*(){let{ignoreEncryption:i=!1,parseSpeed:r=Nc.Slow,throwOnInvalidObject:o=!1,warnOnInvalidObjects:s=!1,updateMetadata:a=!0,capNumbers:c=!1,password:l}=t;T(e,"pdf",["string",Uint8Array,ArrayBuffer]),T(i,"ignoreEncryption",["boolean"]),T(r,"parseSpeed",["number"]),T(o,"throwOnInvalidObject",["boolean"]),T(s,"warnOnInvalidObjects",["boolean"]),T(l,"password",["string","undefined"]);let d=$r(e),h=yield sc.forBytesWithOptions(d,r,o,c).parseDocument();if(h.lookup(h.trailerInfo.Encrypt)&&l!==void 0){let u=h.lookup(h.trailerInfo.ID,Z),p=h.lookup(h.trailerInfo.Encrypt,W),f=yield sc.forBytesWithOptions(d,r,o,s,c,new cu(p,u.get(0).asBytes(),l)).parseDocument();return new n(f,!0,a)}else return new n(h,i,a)})}static create(e={}){return Q(this,void 0,void 0,function*(){let{updateMetadata:t=!0}=e,i=po.create(),r=vr.withContext(i),o=i.register(r),s=yr.withContextAndPages(i,o);return i.trailerInfo.Root=i.register(s),new n(i,!1,t)})}constructor(e,t,i){if(this.defaultWordBreaks=[" "],this.computePages=()=>{let r=[];return this.catalog.Pages().traverse((o,s)=>{if(o instanceof et){let a=this.pageMap.get(o);a||(a=Oe.of(o,s,this),this.pageMap.set(o,a)),r.push(a)}}),r},this.getOrCreateForm=()=>{let r=this.catalog.getOrCreateAcroForm();return Hn.of(r,this)},T(e,"context",[[po,"PDFContext"]]),T(t,"ignoreEncryption",["boolean"]),this.context=e,this.catalog=e.lookup(e.trailerInfo.Root),e.lookup(e.trailerInfo.Encrypt)&&e.isDecrypted&&delete e.trailerInfo.Encrypt,this.isEncrypted=!!e.lookup(e.trailerInfo.Encrypt),this.pageCache=ht.populatedBy(this.computePages),this.pageMap=new Map,this.formCache=ht.populatedBy(this.getOrCreateForm),this.fonts=[],this.images=[],this.embeddedPages=[],this.embeddedFiles=[],this.javaScripts=[],!t&&this.isEncrypted)throw new Xo;i&&this.updateInfoDict()}registerFontkit(e){this.fontkit=e}getForm(){let e=this.formCache.access();return e.hasXFA()&&(console.warn("Removing XFA form data as pdf-lib does not support reading or writing XFA"),e.deleteXFA()),e}getTitle(){let e=this.getInfoDict().lookup(v.Title);if(e)return qn(e),e.decodeText()}getAuthor(){let e=this.getInfoDict().lookup(v.Author);if(e)return qn(e),e.decodeText()}getSubject(){let e=this.getInfoDict().lookup(v.Subject);if(e)return qn(e),e.decodeText()}getKeywords(){let e=this.getInfoDict().lookup(v.Keywords);if(e)return qn(e),e.decodeText()}getCreator(){let e=this.getInfoDict().lookup(v.Creator);if(e)return qn(e),e.decodeText()}getProducer(){let e=this.getInfoDict().lookup(v.Producer);if(e)return qn(e),e.decodeText()}getLanguage(){let e=this.catalog.get(v.of("Lang"));if(e)return qn(e),e.decodeText()}getCreationDate(){let e=this.getInfoDict().lookup(v.CreationDate);if(e)return qn(e),e.decodeDate()}getModificationDate(){let e=this.getInfoDict().lookup(v.ModDate);if(e)return qn(e),e.decodeDate()}setTitle(e,t){T(e,"title",["string"]);let i=v.of("Title");this.getInfoDict().set(i,K.fromText(e)),t!=null&&t.showInWindowTitleBar&&this.catalog.getOrCreateViewerPreferences().setDisplayDocTitle(!0)}setAuthor(e){T(e,"author",["string"]);let t=v.of("Author");this.getInfoDict().set(t,K.fromText(e))}setSubject(e){T(e,"author",["string"]);let t=v.of("Subject");this.getInfoDict().set(t,K.fromText(e))}setKeywords(e){T(e,"keywords",[Array]);let t=v.of("Keywords");this.getInfoDict().set(t,K.fromText(e.join(" ")))}setCreator(e){T(e,"creator",["string"]);let t=v.of("Creator");this.getInfoDict().set(t,K.fromText(e))}setProducer(e){T(e,"creator",["string"]);let t=v.of("Producer");this.getInfoDict().set(t,K.fromText(e))}setLanguage(e){T(e,"language",["string"]);let t=v.of("Lang");this.catalog.set(t,J.of(e))}setCreationDate(e){T(e,"creationDate",[[Date,"Date"]]);let t=v.of("CreationDate");this.getInfoDict().set(t,J.fromDate(e))}setModificationDate(e){T(e,"modificationDate",[[Date,"Date"]]);let t=v.of("ModDate");this.getInfoDict().set(t,J.fromDate(e))}getPageCount(){return this.pageCount===void 0&&(this.pageCount=this.getPages().length),this.pageCount}getPages(){return this.pageCache.access()}getPage(e){let t=this.getPages();return bt(e,"index",0,t.length-1),t[e]}getPageIndices(){return Mf(0,this.getPageCount())}removePage(e){let t=this.getPageCount();if(this.pageCount===0)throw new Tc;bt(e,"index",0,t-1),this.catalog.removeLeafNode(e),this.pageCount=t-1}addPage(e){return T(e,"page",["undefined",[Oe,"PDFPage"],Array]),this.insertPage(this.getPageCount(),e)}insertPage(e,t){let i=this.getPageCount();if(bt(e,"index",0,i),T(t,"page",["undefined",[Oe,"PDFPage"],Array]),!t||Array.isArray(t)){let o=Array.isArray(t)?t:Yo.A4;t=Oe.create(this),t.setSize(...o)}else if(t.doc!==this)throw new Ec;let r=this.catalog.insertLeafNode(t.ref,e);return t.node.setParent(r),this.pageMap.set(t.node,t),this.pageCache.invalidate(),this.pageCount=i+1,t}copyPages(e,t){return Q(this,void 0,void 0,function*(){T(e,"srcDoc",[[n,"PDFDocument"]]),T(t,"indices",[Array]),yield e.flush();let i=Hl.for(e.context,this.context),r=e.getPages(),o=t.map(s=>r[s]).map(s=>Q(this,void 0,void 0,function*(){return i.copy(s.node)})).map(s=>s.then(a=>Oe.of(a,this.context.register(a),this)));return Promise.all(o)})}copy(){return Q(this,void 0,void 0,function*(){let e=yield n.create(),t=yield e.copyPages(this,this.getPageIndices());for(let i=0,r=t.length;i{let r=i.lookup(v.of("EF"));if(!(r instanceof W))return[];let o=r.lookup(v.of("F"));if(!(o instanceof Ee))return[];let s=i.lookup(v.of("AFRelationship")),a=s instanceof v?s.toString().slice(1):s instanceof J?s.decodeText():void 0,c=o.dict,l=c.lookup(v.of("Subtype")),d=l instanceof v?l.toString().slice(1):l instanceof J?l.decodeText():void 0,h=c.lookup(v.of("Params"),W),u,p;if(h instanceof W){let x=h.lookup(v.of("CreationDate")),g=h.lookup(v.of("ModDate"));x instanceof J&&(u=x.decodeDate()),g instanceof J&&(p=g.decodeDate())}let f=i.lookup(v.of("Desc")),m;return f instanceof K&&(m=f.decodeText()),[{name:t.decodeText(),data:Pr(o).decode(),mimeType:d==null?void 0:d.replace(/#([0-9A-Fa-f]{2})/g,(x,g)=>String.fromCharCode(parseInt(g,16))),afRelationship:a,description:m,creationDate:u,modificationDate:p}]})}getUnsavedAttachments(){return this.embeddedFiles.map(t=>{let i=t.getEmbedder();return{name:i.fileName,data:i.getFileData(),description:i.options.description,mimeType:i.options.mimeType,afRelationship:i.options.afRelationship,creationDate:i.options.creationDate,modificationDate:i.options.modificationDate}})}getAttachments(){let e=this.getSavedAttachments(),t=this.getUnsavedAttachments();return[...e,...t]}embedFont(e,t={}){return Q(this,void 0,void 0,function*(){let{subset:i=!1,customName:r,features:o}=t;T(e,"font",["string",Uint8Array,ArrayBuffer]),T(i,"subset",["boolean"]);let s;if(Ld(e))s=Fr.for(e,r);else if(Rf(e)){let l=$r(e),d=this.assertFontkit();s=i?yield Wd.for(d,l,r,o):yield Dr.for(d,l,r,o)}else throw new TypeError("`font` must be one of `StandardFonts | string | Uint8Array | ArrayBuffer`");let a=this.context.nextRef(),c=Me.of(a,this,s);return this.fonts.push(c),c})}embedStandardFont(e,t){if(T(e,"font",["string"]),!Ld(e))throw new TypeError("`font` must be one of type `StandardFonts`");let i=Fr.for(e,t),r=this.context.nextRef(),o=Me.of(r,this,i);return this.fonts.push(o),o}embedJpg(e){return Q(this,void 0,void 0,function*(){T(e,"jpg",["string",Uint8Array,ArrayBuffer]);let t=$r(e),i=yield Us.for(t),r=this.context.nextRef(),o=yi.of(r,this,i);return this.images.push(o),o})}embedPng(e){return Q(this,void 0,void 0,function*(){T(e,"png",["string",Uint8Array,ArrayBuffer]);let t=$r(e),i=yield js.for(t),r=this.context.nextRef(),o=yi.of(r,this,i);return this.images.push(o),o})}embedSvg(e){return Q(this,void 0,void 0,function*(){if(!e)return new pi(e);let t=(0,du.parse)(e),i=s=>s.tagName==="image"?[s]:s.childNodes.map(a=>a.nodeType===du.NodeType.ELEMENT_NODE?i(a):[]).flat(),r=i(t),o={};return yield Promise.all(r.map(s=>Q(this,void 0,void 0,function*(){var a;let c=(a=s.attributes.href)!==null&&a!==void 0?a:s.attributes["xlink:href"];if(!c||o[c])return;let d=c.match(/\.png(\?|$)|^data:image\/png;base64/gim)?yield this.embedPng(c):yield this.embedJpg(c);o[c]=d}))),new pi(e,o)})}embedPdf(e,t=[0]){return Q(this,void 0,void 0,function*(){T(e,"pdf",["string",Uint8Array,ArrayBuffer,[n,"PDFDocument"]]),T(t,"indices",[Array]);let i=e instanceof n?e:yield n.load(e),r=Nf(i.getPages(),t);return this.embedPages(r)})}embedPage(e,t,i){return Q(this,void 0,void 0,function*(){T(e,"page",[[Oe,"PDFPage"]]);let[r]=yield this.embedPages([e],[t],[i]);return r})}embedPages(e,t=[],i=[]){return Q(this,void 0,void 0,function*(){if(e.length===0)return[];for(let a=0,c=e.length-1;aa:Hl.for(r,this.context).copy,s=new Array(e.length);for(let a=0,c=e.length;ah.widthOfTextAtSize(y,p),x=t.maxWidth===void 0?Va(ir(e)):Tf(e,f,t.maxWidth,m),g=new Array(x.length);for(let y=0,F=x.length;ynew Oe(n,e,t);Oe.create=n=>{T(n,"doc",[[We,"PDFDocument"]]);let e=Y.of(-1),t=et.withContextAndParent(n.context,e),i=n.context.register(t);return new Oe(t,i,n)};var ki=class extends at{constructor(e,t,i){super(e,t,i),T(e,"acroButton",[[Bn,"PDFAcroPushButton"]]),this.acroField=e}setImage(e,t=vi.Center){let i=this.acroField.getWidgets();for(let r=0,o=i.length;rnew ki(n,e,t);function nt(n,e){let t=Object.keys(e).map(i=>Yk(n,i,e[i]));return t.length===1?t[0]:function(){t.forEach(i=>i())}}function Yk(n,e,t){let i=n[e],r=n.hasOwnProperty(e),o=r?i:function(){return Object.getPrototypeOf(n)[e].apply(this,arguments)},s=t(o);return i&&Object.setPrototypeOf(s,i),Object.setPrototypeOf(a,s),n[e]=a,c;function a(...l){return s===o&&n[e]===a&&c(),s.apply(this,l)}function c(){n[e]===a&&(r?n[e]=o:delete n[e]),s!==o&&(s=o,Object.setPrototypeOf(a,i||Function))}}var ye=require("obsidian");var hu=require("obsidian"),Ke=class extends hu.Modal{constructor(e){super(e.app),this.plugin=e,this.lib=e.lib,this.component=new hu.Component,this.contentEl.addClass("pdf-plus-modal")}onOpen(){this.component.load()}onClose(){this.contentEl.empty(),this.component.unload()}};var fn=require("obsidian");var Tg={};vf(Tg,{BidirectionalMultiValuedMap:()=>Uc,CommandSuggest:()=>zc,FuzzyFileSuggest:()=>Hc,FuzzyFolderSuggest:()=>Rr,FuzzyInputSuggest:()=>Nr,FuzzyMarkdownFileSuggest:()=>Vc,MODIFIERS:()=>gg,MultiValuedMap:()=>$t,MutationObservingChild:()=>Wc,areOverlapping:()=>Cg,areOverlappingStrictly:()=>Sg,binarySearch:()=>hn,binarySearchForRangeStartingWith:()=>kg,camelCaseToKebabCase:()=>hg,capitalize:()=>tC,cropCanvas:()=>ig,dispatchMouseEvent:()=>sg,doubleClick:()=>pu,encodeLinktext:()=>Vr,evalInContext:()=>Eg,findReferenceCache:()=>wg,focusObsidian:()=>Zc,formatAnnotationID:()=>Xc,genId:()=>ug,getAndroidWebViewVersion:()=>ww,getBorderRadius:()=>tg,getCJKRegexp:()=>Pw,getCharacterBoundingBoxes:()=>vw,getCharactersWithBoundingBoxesInPDFCoords:()=>pg,getDirectPDFObj:()=>lt,getEventCoords:()=>fu,getFirstTextNodeIn:()=>nC,getInstallerVersion:()=>bu,getModifierDictInPlatform:()=>mg,getModifierNameInPlatform:()=>Bt,getNodeAndOffsetOfTextPos:()=>Wn,getObsidianDebugInfo:()=>yg,getObsidianDefaultHighlightColorRGB:()=>_k,getOffsetInTextLayerNode:()=>mu,getPathSeparator:()=>rC,getStyleSettings:()=>vg,getSubpathWithoutHash:()=>Dg,getSystemInfo:()=>Fw,getTextLayerInfo:()=>Dt,getTextLayerNode:()=>gu,getWordAt:()=>iC,hexToRgb:()=>Mr,hookInternalLinkMouseEventHandlers:()=>Qo,hover:()=>Qk,isAncestorOf:()=>Pg,isCanvas:()=>ma,isEmbed:()=>es,isHexString:()=>cn,isHoverEditor:()=>Dw,isHoverPopover:()=>xa,isModifierName:()=>xg,isMouseEventExternal:()=>Ci,isNonEmbedLike:()=>Kn,isSelectionForward:()=>un,isTargetElement:()=>yw,isTargetHTMLElement:()=>It,isTargetNode:()=>qc,isTypable:()=>ng,isVersionNewerThan:()=>pa,isVersionOlderThan:()=>bg,kebabCaseToCamelCase:()=>eC,loadComponentAsync:()=>kw,matchModifiers:()=>ag,onModKeyPress:()=>og,paramsToSubpath:()=>Gc,parsePDFSubpath:()=>$o,pdfJsQuadPointsToArrayOfRects:()=>dg,range:()=>fg,registerCharacterKeymap:()=>oC,removeExtension:()=>Fg,repeat:()=>is,repeatable:()=>ba,rgbStringToObject:()=>eg,rgbToHex:()=>$p,rotateCanvas:()=>uu,selectDoubleClickedWord:()=>lg,selectTrippleClickedTextLayerNode:()=>cg,showChildElOnParentElHover:()=>jc,showMenuUnderParentEl:()=>jn,stringCompare:()=>ts,subpathToParams:()=>ga,swapSelectionAnchorAndFocus:()=>Kc,toPDFCoords:()=>xu,toSingleLine:()=>Yc,walkDescendantComponents:()=>yu});var Ft=require("obsidian");function cn(n){return n.length===7&&n.startsWith("#")}function Mr(n){let e=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(n);return e?{r:parseInt(e[1],16),g:parseInt(e[2],16),b:parseInt(e[3],16)}:null}function $p(n){let{r:e,g:t,b:i}=n;return"#"+(1<<24|e<<16|t<<8|i).toString(16).slice(1)}function eg(n){let[e,t,i]=n.split(",").map(r=>parseInt(r.trim()));return{r:e,g:t,b:i}}function _k(){let[n,e,t]=getComputedStyle(document.body).getPropertyValue("--text-highlight-bg-rgb").split(",").map(i=>parseInt(i.trim()));return{r:n,g:e,b:t}}function tg(){let n=getComputedStyle(document.body).getPropertyValue("--radius-s");if(n.endsWith("px")){let e=parseInt(n.slice(0,-2));if(!isNaN(e))return e}return 0}var Qt=require("obsidian"),Jk={blurOnSelect:!0,closeOnSelect:!0},Nr=class extends Qt.AbstractInputSuggest{constructor(e,t,i){super(e,t),this.inputEl=t,this.options=Object.assign(Jk,i)}getSuggestions(e){let t=(0,Qt.prepareFuzzySearch)(e.trim()),i=this.getItems(),r=[];for(let o of i){let s=t(this.getItemText(o));s&&r.push({match:s,item:o})}return(0,Qt.sortSearchResults)(r),r}renderSuggestion(e,t){(0,Qt.renderResults)(t,this.getItemText(e.item),e.match)}selectSuggestion(e,t){super.selectSuggestion(e,t),this.inputEl.value=this.getItemText(e.item),this.options.blurOnSelect&&this.inputEl.blur(),this.options.closeOnSelect&&this.close()}},Vc=class extends Nr{getItems(){return this.app.vault.getMarkdownFiles()}getItemText(e){return e.path}},Hc=class extends Nr{getItems(){return this.app.vault.getFiles()}getItemText(e){return e.path}},Rr=class extends Nr{getItems(){return this.app.vault.getAllLoadedFiles().filter(e=>e instanceof Qt.TFolder)}getItemText(e){return e.path}},zc=class extends Qt.AbstractInputSuggest{constructor(e,t){super(e.plugin.app,t),this.inputEl=t,this.plugin=e.plugin,this.tab=e}getSuggestions(e){let t=(0,Qt.prepareFuzzySearch)(e),i=Object.values(this.plugin.app.commands.commands),r=[];for(let o of i){let s=t(o.name);s&&r.push({match:s,command:o})}return(0,Qt.sortSearchResults)(r),r.map(({command:o})=>o)}renderSuggestion(e,t){t.setText(e.name)}selectSuggestion(e){this.inputEl.blur(),this.plugin.settings.commandToExecuteWhenTargetNotIdentified=e.id,this.inputEl.value=e.name,this.close(),this.plugin.saveSettings(),this.tab.redisplay()}};var $t=class{constructor(){this.map=new Map}addValue(e,t){let i=this.map.get(e);i||(i=new Set,this.map.set(e,i)),i.add(t)}get(e){var t;return(t=this.map.get(e))!=null?t:new Set}delete(e){this.map.delete(e)}deleteValue(e,t){let i=this.map.get(e);i&&(i.delete(t),i.size===0&&this.map.delete(e))}has(e){return this.map.has(e)&&this.map.get(e).size>0}[Symbol.iterator](){return this.map[Symbol.iterator]()}},Uc=class{constructor(){this.keyToValues=new Map;this.valueToKeys=new Map}addValue(e,t){this.keyToValues.has(e)||this.keyToValues.set(e,new Set),this.keyToValues.get(e).add(t),this.valueToKeys.has(t)||this.valueToKeys.set(t,new Set),this.valueToKeys.get(t).add(e)}get(e){var t;return(t=this.keyToValues.get(e))!=null?t:new Set}getKeys(e){var t;return(t=this.valueToKeys.get(e))!=null?t:new Set}delete(e){let t=this.keyToValues.get(e);if(t)for(let i of t){let r=this.valueToKeys.get(i);if(!r)throw new Error("Value has no keys");r.delete(e),r.size===0&&this.valueToKeys.delete(i)}this.keyToValues.delete(e)}deleteValue(e){let t=this.valueToKeys.get(e);if(t)for(let i of t){let r=this.keyToValues.get(i);if(!r)throw new Error("Key has no values");r.delete(e),r.size===0&&this.keyToValues.delete(i)}this.valueToKeys.delete(e)}has(e){return this.keyToValues.has(e)&&this.keyToValues.get(e).size>0}hasValue(e){return this.valueToKeys.has(e)&&this.valueToKeys.get(e).size>0}keys(){return this.keyToValues.keys()}values(){return this.valueToKeys.keys()}};function ig(n,e,t={width:e.width,height:e.height}){let i=createEl("canvas");return i.width=t.width,i.height=t.height,i.getContext("2d").drawImage(n,e.left,e.top,e.width,e.height,0,0,t.width,t.height),i}function uu(n,e){if(e=(e%360+360)%360,![0,90,180,270].includes(e))throw new Error("rotate must be 0, 90, 180, or 270");if(!e)return n;let t=createEl("canvas"),i=t.getContext("2d");return e===90||e===270?(t.width=n.height,t.height=n.width):(t.width=n.width,t.height=n.height),i.translate(t.width/2,t.height/2),i.rotate(e*Math.PI/180),i.drawImage(n,-n.width/2,-n.height/2),t}var dn=require("obsidian");function Qo(n,e,t){e.querySelectorAll("a.internal-link").forEach(i=>{i.addEventListener("click",r=>{r.preventDefault();let o=i.getAttribute("href");o&&n.workspace.openLinkText(o,t,dn.Keymap.isModEvent(r))}),i.addEventListener("mouseover",r=>{r.preventDefault();let o=i.getAttribute("href");o&&n.workspace.trigger("hover-link",{event:r,source:"preview",hoverParent:{hoverPopover:null},targetEl:r.currentTarget,linktext:o,sourcePath:t})})})}function Ci(n,e){return!n.relatedTarget||yw(n,n.relatedTarget)&&!e.contains(n.relatedTarget)}function ng(n){return n.nodeName==="INPUT"||n.instanceOf(HTMLElement)&&n.contentEditable==="true"}function fu(n){return n.instanceOf(MouseEvent)?{x:n.clientX,y:n.clientY}:{x:n.touches[0].clientX,y:n.touches[0].clientY}}function rg(n,e,t){let i=e[t];return n instanceof i}function qc(n,e){return!!e&&(e instanceof Node||rg(e,n.win,"Node"))}function yw(n,e){return!!e&&(e instanceof Element||rg(e,n.win,"Element"))}function It(n,e){return!!e&&(e instanceof HTMLElement||rg(e,n.win,"HTMLElement"))}function og(n,e,t){if(dn.Keymap.isModifier(n,"Mod")){t();return}let i=n.doc,r=!1,o=()=>{r=!0,i.removeEventListener("keydown",s),i.removeEventListener("mouseover",a),i.removeEventListener("mouseleave",c)},s=l=>{r||(i.body.contains(e)?dn.Keymap.isModifier(l,"Mod")&&(o(),t()):o())},a=l=>{r||qc(l,l.target)&&!e.contains(l.target)&&o()},c=l=>{r||l.target===i&&o()};i.addEventListener("keydown",s),i.addEventListener("mouseover",a),i.addEventListener("mouseleave",c)}function jc(n){let{parentEl:e,createChildEl:t,removeChildEl:i,component:r,timeout:o}=n,s=a=>{if(Ci(a,e)){let c=!0,l=!1,d=t(),h=new dn.Component;r==null||r.addChild(h),h.register(()=>d&&i(d)),h.load();let u=()=>setTimeout(()=>{!c&&!l&&h.unload()},o!=null?o:120),p=f=>{Ci(f,e)&&(c=!1,u())};h.registerDomEvent(e,"mouseout",p),d&&h.registerDomEvent(d,"mouseover",f=>{if(Ci(f,d)){l=!0;let m=x=>{Ci(x,d)&&(l=!1,u())};h.registerDomEvent(d,"mouseout",m)}})}};e.addEventListener("mouseover",s)}function sg(n,e,t){n.dispatchEvent(new MouseEvent(e,{bubbles:!0,...t}))}function pu(n,e){sg(n,"dblclick",e)}function Qk(n,e,t){t!=null||(t={}),e&&(t[dn.Platform.isMacOS?"metaKey":"ctrlKey"]=!0);let{x:i,y:r}=n.getBoundingClientRect();sg(n,"mouseover",{doc:n.doc,clientX:i,clientY:r,...t})}var $k=["Mod","Ctrl","Meta","Shift","Alt"];function ag(n,e){return $k.every(t=>e.includes(t)?dn.Keymap.isModifier(n,t):!dn.Keymap.isModifier(n,t))}function lg(n){let e=n.doc,t=e.getSelection();if(!t)return;let i=null;if(e.caretRangeFromPoint)i=e.caretRangeFromPoint(n.clientX,n.clientY);else if(e.caretPositionFromPoint){let r=e.caretPositionFromPoint(n.clientX,n.clientY);if(!r)return;i=e.createRange(),i.setStart(r.offsetNode,r.offset),i.collapse(!0)}i&&(t.removeAllRanges(),t.addRange(i),t.modify("move","backward","word"),t.modify("extend","forward","word"))}function cg(n){if(n.detail<3||!qc(n,n.target))return;let e=n.target.nodeName==="SPAN"?n.target:n.target.parentElement;if(!e||!e.instanceOf(HTMLSpanElement)||!e.hasClass("textLayerNode"))return;let t=n.win.getSelection();if(!t)return;let i=n.doc.createRange();i.selectNodeContents(e),t.removeAllRanges(),t.addRange(i)}function lt(n,e){let t=n.get(v.of(e));return t instanceof Y?n.context.lookup(t):t}function dg(n){let e=[];if(ArrayBuffer.isView(n)){if(n.length%8)return e;for(let t=0;t`-${e.toLowerCase()}`)}function eC(n){return n.replace(/(-\w)/g,e=>e[1].toUpperCase())}function tC(n){return n.charAt(0).toUpperCase()+n.slice(1)}function iC(n,e){if(e<0||e>=n.length)return"";let t=Math.max(0,n.slice(0,e+1).search(/(?<=[^\s.,][\s.,]+)[^\s.,]*$/));n=n.slice(t),t=Math.max(0,n.search(/[^\s.,]/)),n=n.slice(t);let i=n.search(/[\s.,]/);return i===-1?n:n.slice(0,i)}function ug(){let n=()=>((1+Math.random())*65536|0).toString(16).substring(1);return n()+n()+"-"+n()+"-"+n()+"-"+n()+"-"+n()+n()+n()}function fg(n,e){return Array.from({length:e-n},(t,i)=>n+i)}function gu(n,e){if(!n.contains(e))return null;if(e.instanceOf(HTMLElement)&&e.hasClass("textLayerNode"))return e;let t=e;for(;t=t.parentNode;){if(t===n)return null;if(t.instanceOf(HTMLElement)&&t.hasClass("textLayerNode"))return t}return null}function mu(n,e,t){if(!n.contains(e))return null;let i=n.doc.createNodeIterator(n,NodeFilter.SHOW_TEXT),r,o=t;for(;(r=i.nextNode())&&e!==r;)o+=r.textContent.length;return o}function Wn(n,e){let t=n.doc.createNodeIterator(n,NodeFilter.SHOW_TEXT),i;for(;(i=t.nextNode())&&e>=i.textContent.length;)e-=i.textContent.length;return i?{node:i,offset:e}:null}function*vw(n){let e=n.doc.createNodeIterator(n,NodeFilter.SHOW_TEXT),t;for(;t=e.nextNode();)if(t.instanceOf(Text))for(let i=0;it.brand==="Android WebView");if(e)return e.version}let n=navigator.userAgent.match(/Chrome\/([\d]+)/);return n?n[1]:null}async function Fw(){if(window.electron){let r=require("os");return{"Obsidian version":window.electron.ipcRenderer.sendSync("version"),"Installer version":window.electron.remote.app.getVersion(),"Operating system":r.version()+" "+r.release()}}let n=await window.Capacitor.Plugins.App.getInfo(),e=await window.Capacitor.Plugins.Device.getInfo(),t={"Obsidian version":`${n.version} (${n.build})`,"API version":Ft.apiVersion,"Operating system":`${e.platform} ${e.osVersion} (${e.manufacturer} ${e.model})`},i=ww();return i&&(t["Android WebView version"]=i),t}async function yg(n){let e=n.customCss.theme,t=n.customCss.themes[e],i=n.customCss.snippets.filter(o=>n.customCss.enabledSnippets.has(o)).length,r=n.plugins.plugins;return{...await Fw(),"Use [[Wikilinks]]":n.vault.getConfig("useMarkdownLinks"),"Base color scheme":document.body.hasClass("theme-dark")?"dark":"light",'PDF "Adapt to theme"':!!n.loadLocalStorage("pdfjs-is-themed"),"Community theme":e?`${e} v${t.version}`:"none","Snippets enabled":i,"Plugins installed":Object.keys(n.plugins.manifests).length,"Plugins enabled":Object.values(r).map(o=>`${o.manifest.name} v${o.manifest.version}`)}}function vg(n){var i;let e=(i=n.plugins.plugins["obsidian-style-settings"])==null?void 0:i.settingsManager.settings;return e?Object.fromEntries(Object.entries(e).filter(([r])=>r.startsWith("pdf-plus@@"))):null}function wg(n,e,t){var i,r,o;return(o=(i=n.links)==null?void 0:i.find(s=>e<=s.position.start.offset&&s.position.end.offset<=t))!=null?o:(r=n.embeds)==null?void 0:r.find(s=>e<=s.position.start.offset&&s.position.end.offset<=t)}function Fg(n){let e=n.lastIndexOf(".");return e===-1||e===n.length-1||e===0?n:n.slice(0,e)}function Dg(n){let{subpath:e}=(0,Ft.parseLinktext)(n);return e.startsWith("#")&&(e=e.slice(1)),e}function ga(n){return n.startsWith("#")&&(n=n.slice(1)),new URLSearchParams(n)}function $o(n){let e=ga(n);if(!e.has("page"))return null;let t=+e.get("page");if(isNaN(t))return null;if(e.has("selection")){let i=e.get("selection").split(",").map(c=>parseInt(c.trim()));if(i.length!==4||i.some(c=>isNaN(c)))return null;let[r,o,s,a]=i;return{type:"selection",page:t,beginIndex:r,beginOffset:o,endIndex:s,endOffset:a}}if(e.has("annotation")){let i=e.get("annotation");return{type:"annotation",page:t,annotation:i}}return{type:"page",page:t}}function Gc(n){return"#"+Object.entries(n).filter(([e,t])=>e&&(t||t===0)).map(([e,t])=>`${e}=${t}`).join("&")}function Xc(n,e){return e===0?`${n}R`:`${n}R${e}`}var Wc=class extends Ft.Component{constructor(t,i,r){super();this.targetEl=t;this.callback=i;this.options=r;this.observer=new MutationObserver(i)}onload(){this.observer.observe(this.targetEl,this.options)}onunload(){this.observer.disconnect()}};function Kn(n){return!n.isEmbed&&!Dw(n)}function es(n){return n.isEmbed&&!ma(n)&&!xa(n)}function ma(n){var e;return!!((e=n.dom)!=null&&e.containerEl.hasClass("canvas-node-content"))}function xa(n){var e;return!!((e=n.dom)!=null&&e.containerEl.closest(".hover-popover"))}function Dw(n){var e;return!!((e=n.dom)!=null&&e.containerEl.closest(".hover-editor"))}function Zc(){activeWindow.open("obsidian://")}function Pg(n,e,t=!1){if(t&&n===e)return!0;let i=e.parent;for(;i;){if(i===n)return!0;i=i.parent}return!1}function Pw(n){n={japanese:!0,korean:!0,...n};let e="";return e+="\\u4e00-\\u9fff",e+="\\u3400-\\u4dbf",n.japanese&&(e+="\\u3040-\\u309F",e+="\\u30A0-\\u30FF",e+="\\uFF65-\\uFF9F",e+="\\u31F0-\\u31FF",e+="\\u3000-\\u303F"),n.korean&&(e+="\\u1100-\\u11FF",e+="\\uA960-\\uA97F",e+="\\uD7B0-\\uD7FF",e+="\\u3130-\\u318F",e+="\\uAC00-\\uD7AF"),new RegExp(`[${e}]`)}function Yc(n,e=!1){let t=Pw({korean:!1});return n=n.replace(/(.?)([\r\n]+)(.?)/g,(i,r,o,s)=>t.test(r)&&t.test(s)?r+s:r==="-"&&s.match(/[a-zA-Z]/)?s:s?r+" "+s:r),e&&(n=n.replace(new RegExp(`(${t.source}) (?=${t.source})`,"g"),"$1")),window.pdfjsViewer.removeNullCharacters(window.pdfjsLib.normalizeUnicode(n))}function Vr(n){return n.replace(/[\\\x00\x08\x0B\x0C\x0E-\x1F ]/g,e=>encodeURIComponent(e))}function oC(n,e,t){return n.register(null,e,(i,r)=>{if(r.key===e&&r.modifiers!==null&&["","Shift"].includes(r.modifiers))return t(i,r)})}function hn(n,e,t){var a,c,l,d;if(t&&t.findFirst&&t.findLast)throw Error("findFirst and findLast cannot be specified at the same time");let i=(a=t==null?void 0:t.findFirst)!=null?a:!1,r=(c=t==null?void 0:t.findLast)!=null?c:!1,o=(l=t==null?void 0:t.from)!=null?l:0,s=(d=t==null?void 0:t.to)!=null?d:n.length-1;if(o>s)return{found:!1,index:o};for(;;){let h=o+s+ +r>>1,u=n[h],p=e(u,h);if(p===0)if(i&&oh)o=h;else return{found:!0,index:h};else p>0?o=h+1:s=h-1;if(o>s)return{found:!1,index:h+ +(p>0)}}}function ts(n,e){return n===e?0:nts(e,t(a).slice(0,e.length)),{found:o,index:s}=hn(n,r,{findFirst:!0,...i});if(o){let{index:a}=hn(n,r,{findLast:!0,...i,from:s});return{from:s,to:a}}return null}function Cg(n,e){return n.from<=e.to&&n.to>=e.from}function Sg(n,e){return n.frome.from}function un(n){return n.anchorNode===n.focusNode?n.anchorOffsetis(n,e)}function Eg(n,e){return new Function(n.includes("await")?"(async () => {"+n+"})()":n).call(e)}function yu(n,e){if(e(n)!==!1)for(let i of n._children)yu(i,e)}async function kw(n){if(!n._loaded){n._loaded=!0,await n.onload();let e=n._children.map(kw);await Promise.all(e)}}var vu=class extends Ke{constructor(e,t,i,r){super(e),this.file=t,this.page=i,this.id=r}},Hr=class Hr extends vu{static isSubtypeSupported(e){return Hr.supportedSubtypes.includes(e)}static forSubtype(e,...t){return e==="Link"?Hr.forLinkAnnotation(...t):Hr.forTextMarkupAnnotation(...t)}static forTextMarkupAnnotation(...e){return new Hr({color:!1,opacity:!1,author:!1,contents:!0},...e)}static forLinkAnnotation(...e){return new Hr({color:!0,borderWidth:!0},...e)}constructor(e,...t){super(...t),this.allowNoValue=e,this.supportedKeys=Object.keys(e),this.oldValues={},this.newValues={},this.containerEl.addClass("pdf-plus-annotation-edit-modal"),this.buttonContainerEl=this.modalEl.createDiv(),this.scope.register(["Mod"],"Enter",()=>{this.onSaveButtonClick()})}async readOldValues(){let e=this.lib.highlight.writeFile.pdflib,t=await e.getAnnotation(this.file,this.page,this.id);if(!t)throw new Error(`${this.plugin.manifest.name}: Annotation not found.`);for(let i of this.supportedKeys)switch(i){case"color":this.oldValues.color=e.getColorFromAnnotation(t);break;case"opacity":this.oldValues.opacity=e.getOpacityFromAnnotation(t);break;case"borderWidth":this.oldValues.borderWidth=e.getBorderWidthFromAnnotation(t);break;case"author":this.oldValues.author=e.getAuthorFromAnnotation(t);break;case"contents":this.oldValues.contents=e.getContentsFromAnnotation(t);break}}async writeNewValues(){let e=this.lib.highlight.writeFile.pdflib,t=[];for(let i of this.supportedKeys)switch(i){case"color":if(this.newValues.color&&this.newValues.color!==this.oldValues.color){let r=this.newValues.color;t.push(o=>{e.setColorToAnnotation(o,r),this.lib.getLatestBacklinksForAnnotation(this.file,this.page,this.id).then(s=>{s.forEach(a=>this.lib.composer.linkUpdater.updateLinkColor(a.refCache,a.sourcePath,{type:"rgb",rgb:r},{linktext:!1}))})})}break;case"opacity":typeof this.newValues.opacity=="number"&&this.newValues.opacity!==this.oldValues.opacity&&t.push(r=>{e.setOpacityToAnnotation(r,this.newValues.opacity)});break;case"borderWidth":typeof this.newValues.borderWidth=="number"&&this.newValues.borderWidth!==this.oldValues.borderWidth&&t.push(r=>{e.setBorderWidthToAnnotation(r,this.newValues.borderWidth)});break;case"author":this.newValues.author&&this.newValues.author!==this.oldValues.author&&t.push(r=>{e.setAuthorToAnnotation(r,this.newValues.author)});break;case"contents":typeof this.newValues.contents=="string"&&this.newValues.contents!==this.oldValues.contents&&t.push(r=>{e.setContentsToAnnotation(r,this.newValues.contents)});break}t.length&&await e.processAnnotation(this.file,this.page,this.id,async i=>{t.forEach(r=>r(i))})}addColorSetting(){if(this.oldValues.color||this.allowNoValue.color){let e,t;new fn.Setting(this.contentEl).setName("Color").setDesc("You can choose a color from the color picker or select one from your custom named colors.").addColorPicker(i=>{var r;e=i,e.setValueRgb((r=this.oldValues.color)!=null?r:{r:0,g:0,b:0}).onChange(o=>{let s=Mr(o);s&&(this.newValues.color=s,t.setValue(o))})}).addDropdown(i=>{t=i,t.addOptions(Object.fromEntries(Object.entries(this.plugin.settings.colors).map(([r,o])=>[o,r]))).setValue(this.oldValues.color?$p(this.oldValues.color):"").onChange(r=>{let o=Mr(r);o&&(this.newValues.color=o,e.setValue(r))})})}}addOpacitySetting(){(this.oldValues.opacity||this.allowNoValue.opacity)&&new fn.Setting(this.contentEl).setName("Opacity").addSlider(e=>{var t;e.setLimits(0,1,.01).setValue((t=this.oldValues.opacity)!=null?t:1).setDynamicTooltip().onChange(i=>{this.newValues.opacity=i})})}addBorderWidthSetting(){(this.oldValues.borderWidth||this.allowNoValue.borderWidth)&&new fn.Setting(this.contentEl).setName("Draw border").addToggle(e=>{var t;e.setValue(!!((t=this.oldValues.borderWidth)==null||t)).onChange(i=>{this.newValues.borderWidth=i?1:0})})}addAuthorSetting(){(this.oldValues.author||this.allowNoValue.author)&&new fn.Setting(this.contentEl).setName("Annotation author").addText(e=>{var t;e.setValue((t=this.oldValues.author)!=null?t:"Author").onChange(i=>{this.newValues.author=i})})}initContentsSetting(){var e;if(this.textarea=null,this.editorEl=null,this.previewEl=null,this.plugin.settings.renderMarkdownInStickyNote){let t=(e=this.app.hotkeyManager.getHotkeys("markdown:toggle-preview"))!=null?e:this.app.hotkeyManager.getDefaultHotkeys("markdown:toggle-preview");if(t&&t.length){let i=t[0];this.scope.register(i.modifiers,i.key,()=>this.togglePreview())}}}addContentsSetting(){(this.oldValues.contents||this.allowNoValue.contents)&&new fn.Setting(this.contentEl).setName("Comment").then(e=>{this.previewEl=e.controlEl.createDiv("preview-container markdown-rendered"),this.plugin.settings.renderMarkdownInStickyNote?e.setDesc(`Press ${this.app.hotkeyManager.printHotkeyForCommand("markdown:toggle-preview")} to toggle preview.`):e.setDesc(createFragment(t=>{let i=createEl("a",{text:'"Render markdown in annotation popups when the annotation has text contents"'},r=>{r.onclick=o=>{let s=this.plugin.openSettingTab();s.scrollTo("renderMarkdownInStickyNote",{behavior:"smooth"}),s.updateHeaderElClassOnScroll(o)}});t.append("Tip: There is an option called "),t.append(i),t.append(".")}))}).addTextArea(e=>{var t;this.textarea=e,this.editorEl=e.inputEl,this.editorEl.addClass("editor-container"),e.inputEl.rows=5,e.inputEl.setCssStyles({width:"100%"}),e.setValue((t=this.oldValues.contents)!=null?t:"").onChange(i=>{this.newValues.contents=i})}),this.showEditor()}addButtons(){new fn.Setting(this.buttonContainerEl).addButton(e=>{e.setButtonText("Save").setCta().onClick(()=>{this.onSaveButtonClick()})}).addButton(e=>{e.setButtonText("Cancel").onClick(()=>this.close())}).setClass("no-border"),this.buttonContainerEl.createDiv({cls:"pdf-plus-annotation-edit-modal-save-instructions",text:`Press ${Bt("Mod")} + Enter to save.`})}onSaveButtonClick(){this.writeNewValues(),this.close()}async onOpen(){super.onOpen(),this.titleEl.setText(`${this.plugin.manifest.name}: edit annotation contents`),await this.readOldValues();for(let e of this.supportedKeys)switch(e){case"color":this.addColorSetting();break;case"opacity":this.addOpacitySetting();break;case"borderWidth":this.addBorderWidthSetting();break;case"author":this.addAuthorSetting();break;case"contents":this.initContentsSetting(),this.addContentsSetting();break}this.addButtons()}async showEditor(){var e,t;(e=this.editorEl)==null||e.show(),(t=this.previewEl)==null||t.hide()}async showPreview(){var e,t;this.editorEl&&this.previewEl&&(this.previewEl.setCssStyles({width:`${this.editorEl.clientWidth}px`,height:`${this.editorEl.clientHeight}px`}),this.previewEl.empty(),await fn.MarkdownRenderer.render(this.app,(t=(e=this.textarea)==null?void 0:e.getValue())!=null?t:"",this.previewEl,"",this.component),Qo(this.app,this.previewEl,this.file.path),this.editorEl.hide(),this.previewEl.show())}async togglePreview(){var e;return(e=this.editorEl)!=null&&e.isShown()?this.showPreview():this.showEditor()}};Hr.supportedSubtypes=["Highlight","Underline","Squiggly","StrikeOut","Link"];var zr=Hr,ya=class extends vu{onOpen(){super.onOpen(),this.titleEl.setText(`${this.plugin.manifest.name}: delete annotation`),this.contentEl.createEl("p",{text:"Are you sure you want to delete this annotation?"}),this.plugin.settings.warnEveryAnnotationDelete||this.contentEl.createEl("p",{cls:"mod-warning",text:"There are one or more links pointing to this annotation."}),new fn.Setting(this.contentEl).addButton(e=>{e.setButtonText("Delete").setWarning().onClick(()=>{this.deleteAnnotation(),this.close()})}).addButton(e=>{e.setButtonText("Cancel").onClick(()=>this.close())}).then(e=>e.setClass("no-border"))}openIfNeccessary(){return this.shouldOpen()?this.open():this.deleteAnnotation()}shouldOpen(){return this.plugin.settings.warnEveryAnnotationDelete||this.plugin.settings.warnBacklinkedAnnotationDelete&&this.lib.isBacklinked(this.file,{page:this.page,annotation:this.id})}deleteAnnotation(){this.lib.highlight.writeFile.deleteAnnotation(this.file,this.page,this.id)}};var va=require("obsidian");var _c,Ur,wu=class extends Ke{constructor(t,i,...r){super(...r);mn(this,_c);mn(this,Ur);this.file=t,this.page=i,Lt(this,_c,new Promise(o=>{Lt(this,Ur,o)}))}then(t){return qe(this,_c).then(i=>{i&&t()}),this}onOpen(){super.onOpen(),this.titleEl.setText(`${this.plugin.manifest.name}: delete page`),this.contentEl.createEl("p",{text:"Are you sure you want to delete this page?"}),this.plugin.settings.warnEveryAnnotationDelete||this.contentEl.createEl("p",{cls:"mod-warning",text:"There are one or more links pointing to this page."}),new va.Setting(this.contentEl).addButton(t=>{t.setButtonText("Delete").setWarning().onClick(()=>{qe(this,Ur).call(this,!0),this.close()})}).addButton(t=>{t.setButtonText("Cancel").onClick(()=>{qe(this,Ur).call(this,!1),this.close()})}).then(t=>t.setClass("no-border"))}onClose(){super.onClose(),qe(this,Ur).call(this,!1)}openIfNeccessary(){return this.shouldOpen()?(this.open(),this):(qe(this,Ur).call(this,!0),this)}shouldOpen(){return this.plugin.settings.warnEveryPageDelete||this.plugin.settings.warnBacklinkedPageDelete&&this.lib.isBacklinked(this.file,{page:this.page})}};_c=new WeakMap,Ur=new WeakMap;var Qc={keep:"Keep labels unchanged",update:"Update"},Jc,qr,Gn=class extends Ke{constructor(t,i,r,o,s){super(t);mn(this,Jc);mn(this,qr);this.askPageLabelUpdateMethod=i,this.defaultMethod=r,this.askInPlace=o,this.defaultInPlace=s,Lt(this,Jc,new Promise(a=>{Lt(this,qr,a)}))}ask(){return this.askPageLabelUpdateMethod||this.askInPlace?this.open():qe(this,qr).call(this,{pageLabelUpdateMethod:this.defaultMethod,inPlace:this.defaultInPlace}),this}then(t){qe(this,Jc).then(i=>{if(i){let{pageLabelUpdateMethod:r,inPlace:o}=i;t(r==="keep",o)}})}onOpen(){super.onOpen(),this.titleEl.setText(`${this.plugin.manifest.name}: Page composer`);let t=this.defaultMethod,i=this.defaultInPlace;this.askPageLabelUpdateMethod&&new va.Setting(this.contentEl).setName("Update the page labels?").setDesc(createFragment(r=>{r.createEl("a",{text:"Learn more",href:"https://github.com/RyotaUshio/obsidian-pdf-plus/wiki/Page-labels"})})).addDropdown(r=>{r.addOptions(Qc).setValue(t).onChange(o=>{t=o})}),this.askInPlace&&new va.Setting(this.contentEl).setName("Remove pages from original file?").addToggle(r=>{r.setValue(i).onChange(o=>{i=o})}),new va.Setting(this.contentEl).addButton(r=>{r.setButtonText("Proceed").setCta().onClick(()=>{(t==="keep"||t==="update")&&qe(this,qr).call(this,{pageLabelUpdateMethod:t,inPlace:i}),this.close()}),setTimeout(()=>r.buttonEl.focus())}).addButton(r=>{r.setButtonText("Cancel").onClick(()=>{qe(this,qr).call(this,null),this.close()})})}onClose(){super.onClose(),qe(this,qr).call(this,null)}};Jc=new WeakMap,qr=new WeakMap;var Fu=class extends Ke{constructor(){super(...arguments);this.pageSize="A4";this.orientation="portrait";this.next=[]}askOptions(){return this.open(),this}onOpen(){super.onOpen(),this.titleEl.setText(`${this.plugin.manifest.name}: Create new PDF`),this.addSetting().setName("Page size").addDropdown(t=>{Object.keys(Yo).forEach(i=>t.addOption(i,i)),t.setValue(this.pageSize).onChange(i=>{Yo.hasOwnProperty(i)&&(this.pageSize=i)})}),this.addSetting().setName("Orientation").addDropdown(t=>{t.addOption("portrait","Portrait").addOption("landscape","Landscape").setValue(this.orientation).onChange(i=>{(i==="portrait"||i==="landscape")&&(this.orientation=i)})}),this.addSetting().addButton(t=>{t.setButtonText("Create").setCta().then(i=>{setTimeout(()=>i.buttonEl.focus())}).onClick(async()=>{this.close();let i=await this.createPDFDocument();this.next.forEach(r=>r(i))})}).addButton(t=>{t.setButtonText("Cancel").onClick(()=>{this.close()})})}addSetting(){return new va.Setting(this.contentEl)}then(t){return this.next.push(t),this}async createPDFDocument(){let t=await We.create(),[i,r]=Yo[this.pageSize],o=Math.max(i,r),s=Math.min(i,r),a=this.orientation==="portrait"?[s,o]:[o,s];return t.addPage(a),t}};var $c=require("obsidian"),jr=class extends Ke{constructor(t,i){super(t);this.next=[];this.submitted=!1;this.title=null;this.modalTitle=i,this.component.registerDomEvent(this.modalEl.doc,"keypress",r=>{r.key==="Enter"&&this.submitAndClose()})}presetTitle(t){return this.title=t,this}onOpen(){super.onOpen(),this.titleEl.setText(`${this.plugin.manifest.name}: ${this.modalTitle}`),new $c.Setting(this.contentEl).setName("Title").addText(t=>{this.title!==null&&(t.setValue(this.title),t.inputEl.select()),t.inputEl.size=30,t.inputEl.id="pdf-plus-outline-title-modal"}),new $c.Setting(this.contentEl).addButton(t=>{t.setButtonText("Add").setCta().onClick(()=>{this.submitAndClose()})}).addButton(t=>{t.setButtonText("Cancel").onClick(()=>{this.close()})})}ask(){return this.open(),this}then(t){return this.submitted&&this.title!==null?t({title:this.title}):this.next.push(t),this}submitAndClose(){let t=this.contentEl.querySelector("#pdf-plus-outline-title-modal");t instanceof HTMLInputElement&&(this.title=t.value,this.submitted=!0,this.close())}onClose(){this.submitted&&this.title!==null&&this.next.forEach(t=>t({title:this.title}))}},Du=class extends $c.FuzzySuggestModal{constructor(t,i){super(t.plugin.app);this.next=[];this.outlines=t,this.plugin=t.plugin,this.items=[],this.outlines.iter({enter:r=>{!i.isAncestorOf(r,!0)&&!r.is(i.parent)&&this.items.push(r)}}),this.setPlaceholder("Type an outline item title")}askDestination(){return this.open(),this}then(t){return this.next.push(t),this}getItems(){return this.items}getItemText(t){return t.name}onChooseItem(t){this.next.forEach(i=>i(t))}};var Cw=require("obsidian"),ei=require("obsidian");var Pu=class{constructor(e){this._rootDict=e}get root(){return this.createNode(this._rootDict)}get(e){return this.root.get(e)}iterLeaves(e){this.root.iterLeaves(e)}getLeaves(){return this.root.getLeaves()}iter(e){this.root.iter(e)}[Symbol.iterator](){return this.root[Symbol.iterator]()}keys(){return this.root.keys()}values(){return this.root.values()}limitLeafSize(e){this.root.limitLeafSize(e)}},wa=class extends Pu{createNode(e){return new Ag(e)}},Wr=class extends Pu{createNode(e){return new Ig(e)}},ku=class{constructor(e){this.dict=e}is(e){return this.dict===e.dict}isRoot(){return!this._dictHas("Limits")}isUniqueNode(){return this.isRoot()&&this._dictHas(this.leafKey)}isLeaf(){return this._dictHas("Limits")&&this._dictHas(this.leafKey)}isIntermediate(){return this._dictHas("Limits")&&this._dictHas("Kids")}get kids(){let e=this.dict.get(v.of("Kids"));return e instanceof Z?e.asArray().map(t=>{let i=this.dict.context.lookup(t);if(i instanceof W)return new this.constructor(i);throw new Error("Kid is not a PDFDict")}):null}get limits(){let e=this.dict.get(v.of("Limits"));if(!(e instanceof Z))return null;if(e.size()!==2)throw new Error("Limits array must have 2 elements");return e.asArray().map(t=>this._toStringOrNumber(t))}get(e){let t=this.getLeafFor(e);if(!t)return null;let i=t._getNamesOrNums();if(!i)throw new Error("Node has no names or nums despite not having kids");let r=0,o=(i.length>>1)-1;for(;r<=o;){let s=r+o>>1,a=i[s*2];if(a===e){let c=i[s*2+1];if(c instanceof Se)return c;throw new Error("Value is not a PDFObject")}a{if(e>=i.length)return{done:!0,value:[]};let o=i[e]._getNamesOrNums();if(!o)throw new Error("Leaf has no names or nums");let s=o[t],a=o[t+1];return t+=2,t>=o.length&&(e++,t=0),{done:!1,value:[s,a]}}}}keys(){return Array.from(this,([e])=>e)}values(){return Array.from(this,([,e])=>e)}size(){let e=0;return this.iterLeaves(t=>{let i=t._getNamesOrNums();if(!i)throw new Error("Leaf has no names or nums");e+=i.length>>1}),e}iterLeaves(e){let t=[this];for(;t.length;){let i=t.shift(),r=i.kids;r?t.push(...r):e(i)}}getLeaves(){let e=[];return this.iterLeaves(t=>e.push(t)),e}sortKids(){let e=this.kids;if(!e)return;e.sort((i,r)=>{let o=i.limits,s=r.limits;if(!o||!s)throw new Error("Kid has no limits");return o[0]s[0]?1:0});let t=Z.withContext(this.dict.context);for(let i of e)t.push(i.dict);this.dict.set(v.of("Kids"),t)}flatten(){if(this.isUniqueNode()||this.isLeaf())return;let e=Z.withContext(this.dict.context);for(let[t,i]of this)e.push(this._toPDFStringOrPDFNumber(t)),e.push(i);this.dict.set(v.of(this.leafKey),e),this.dict.delete(v.of("Kids"))}iter(e){var t,i,r;(t=e.enter)==null||t.call(e,this),(i=this.kids)==null||i.forEach(o=>o.iter(e)),(r=e.leave)==null||r.call(e,this)}limitLeafSize(e){let t=[],i=[],r=()=>{let o=this.dict.context.obj(t),s=t[0],a=t[t.length-2],c=this.dict.context.obj([s,a]),l=this.dict.context.obj({[this.leafKey]:o,Limits:c}),d=this.dict.context.register(l);i.push(d)};for(let[o,s]of this)t.push(o,s),t.length>>1>=e&&(r(),t.length=0);if(t.length&&r(),i.length===1)this.dict.set(v.of(this.leafKey),this.dict.context.obj(t)),this.dict.delete(v.of("Kids")),this.dict.delete(v.of("Limits"));else{let o=this.dict.context.obj(i);this.dict.set(v.of("Kids"),o)}}getLeafFor(e){if(this.isUniqueNode())return this;let t=this.limits;if(t&&(e{let s=o.limits;if(!s)throw new Error("Kid has no limits");return s[0]<=e&&e<=s[1]}),!i)return null;r=i.kids}return i}_dictHas(e){return this.dict.has(v.of(e))}_getNamesOrNums(){let e=this.dict.get(v.of(this.leafKey));return e instanceof Z?e.asArray().map((t,i)=>i%2?t:this._toStringOrNumber(t)):null}},Ag=class extends ku{get leafKey(){return"Names"}_toStringOrNumber(e){if(e instanceof J||e instanceof K)return e.decodeText();throw new Error("Key is not a PDFString or a PDFHexString")}_toPDFStringOrPDFNumber(e){return K.fromText(e)}get names(){return this._getNamesOrNums()}},Ig=class extends ku{get leafKey(){return"Nums"}_toStringOrNumber(e){if(e instanceof G)return e.asNumber();throw new Error("Key is not a PDFNumber")}_toPDFStringOrPDFNumber(e){return G.of(e)}get nums(){return this._getNamesOrNums()}};var Bg={D:"1, 2, 3, ...",R:"I, II, III, ...",r:"i, ii, iii, ...",A:"A, B, C, ...",a:"a, b, c, ..."};function Og(n){return Bg.hasOwnProperty(n)}var ed=class n{static fromPDFDict(e){let t=new n,i=e.get(v.of("St"));i instanceof G&&(t.start=i.asNumber());let r=e.get(v.of("S"));if(r instanceof v){let s=r.decodeText();Og(s)&&(t.style=s)}let o=e.get(v.of("P"));return(o instanceof J||o instanceof K)&&(t.prefix=o.decodeText()),t}},Ui=class n{constructor(e,t){this.doc=e;this.ranges=t;this.normalize()}normalize(){var e;if(this.ranges.length){this.ranges.sort((t,i)=>t.pageFrom-i.pageFrom),this.ranges[0].pageFrom=1;for(let t=this.ranges.length-1;t>=0;t--){let i=this.getStartOfRange(t),r=this.getEndOfRange(t);if(i>r){this.ranges.splice(t,1);continue}let o=this.ranges[t],s=this.ranges[t-1];if(s&&typeof o.dict.start=="number"&&o.dict.prefix===s.dict.prefix&&o.dict.style===s.dict.style&&o.pageFrom-s.pageFrom===o.dict.start-((e=s.dict.start)!=null?e:1)){this.ranges.splice(t,1);continue}}}return this}static fromDocument(e){let t=lt(e.catalog,"PageLabels");if(!(t instanceof W))return null;let i=new Wr(t),r=[];for(let[o,s]of i){let a=s instanceof Y?e.context.lookup(s):s;if(!(a instanceof W))return null;r.push({pageFrom:o+1,dict:ed.fromPDFDict(a)})}return new n(e,r)}setToDocument(e){e||(e=this.doc);let t=[];for(let{pageFrom:r,dict:o}of this.normalize().ranges){t.push(r-1);let s={};o.style!==void 0&&(s.S=o.style),o.prefix!==void 0&&(s.P=K.fromText(o.prefix)),o.start!==void 0&&(s.St=o.start),t.push(e.context.obj(s))}let i=e.context.obj({Nums:t});new Wr(i).limitLeafSize(64),e.catalog.set(v.of("PageLabels"),i)}static removeFromDocument(e){e.catalog.delete(v.of("PageLabels"))}static processDocument(e,t){let i=n.fromDocument(e);return i?(t(i),i.setToDocument(),!0):!1}static createEmpty(e){return new n(e,[{pageFrom:1,dict:new ed}])}removeRange(e){return this.ranges.splice(e,1),this.normalize(),this}divideRangeAtPage(e,t,i){var a;let r=this.getRangeIndexAtPage(e);if(r===-1)return this;if(e===this.getStartOfRange(r))return this;let o=this.ranges[r],s=new ed;return s.prefix=o.dict.prefix,s.style=o.dict.style,t&&(s.start=e-o.pageFrom+((a=o.dict.start)!=null?a:1)),i==null||i(s),this.ranges.splice(r+1,0,{pageFrom:e,dict:s}),this}shiftRangesAfterPage(e,t){for(let i of this.ranges)i.pageFrom>=e&&(i.pageFrom+=t);return this}getStartOfRange(e){return this.ranges[e].pageFrom}getEndOfRange(e){let t=this.ranges[e+1];return t?t.pageFrom-1:this.doc.getPageCount()}getRangeIndexAtPage(e){for(let t=0;t(this.doc=await t.lib.loadPdfLibDocument(i),this.pageLabels=Ui.fromDocument(this.doc),{doc:this.doc,pageLabels:this.pageLabels}))(),this.scope.register([],"Enter",()=>this.redisplay())}},Mg=class{constructor(e,t){this.dict=e;this.containerEl=t;this.addNumberingStyleSetting(),this.addStartSetting(),this.addPrefixSetting()}addSetting(){return new ei.Setting(this.containerEl)}addNumberingStyleSetting(){this.addSetting().setName("Numbering Style").addDropdown(e=>{var t;e.addOptions({...Bg,None:"None"}).setValue((t=this.dict.style)!=null?t:"None").onChange(i=>{Og(i)?this.dict.style=i:delete this.dict.style})})}addStartSetting(){this.addSetting().setName("Start counting from").addText(e=>{e.inputEl.type="number",this.dict.start!==void 0?e.setValue(""+this.dict.start):e.setPlaceholder("1"),e.onChange(t=>{let i=Number(t);Number.isInteger(i)?(e.inputEl.removeClass("error"),i>1?this.dict.start=i:delete this.dict.start):(delete this.dict.start,e.inputEl.addClass("error"))})})}addPrefixSetting(){return this.addSetting().setName("Prefix").addText(e=>{var t;e.setValue((t=this.dict.prefix)!=null?t:"").onChange(i=>{i?this.dict.prefix=i:delete this.dict.prefix})})}},Cu=class extends Lg{constructor(){super(...arguments);this.buttonSetting=null}async onOpen(){super.onOpen(),this.titleEl.setText(`${this.plugin.manifest.name}: edit page labels`),new ei.Setting(this.contentEl).then(t=>{ei.MarkdownRenderer.render(this.app,["Each page in a PDF document can be assigned a ***page label***, which can be different from the page index.",'For example, a book might have a preface numbered as "i", "ii", "iii", ... and the main content numbered as "1", "2", "3", ...'].join(" "),t.descEl,"",this.component)}).then(t=>this.contentEl.prepend(t.settingEl)),this.controlEl.createDiv({cls:"page-labels-loading",text:"Loading..."}),await this.docLoadingPromise,this.display(),this.addButtons()}redisplay(){this.display()}display(){let{pageLabels:t,doc:i}=this;if(!i)return;if(this.controlEl.empty(),t===null||t.rangeCount()===0){this.addHeading(this.controlEl,"No page labels found","lucide-info").setDesc("This PDF document does not have any page labels.").addButton(o=>{o.setButtonText("Create").setCta().onClick(()=>{this.pageLabels=Ui.createEmpty(i),this.redisplay(),this.updateButtonVisibility()})}).addButton(o=>{o.setButtonText("Cancel").onClick(()=>this.close())});return}let r=i.getPageCount();for(let o=0;o{h>a.pageFrom&&u.addExtraButton(p=>{p.setIcon("lucide-separator-horizontal").setTooltip("Divide this labeling range").onClick(()=>{t.divideRangeAtPage(a.pageFrom+1,!1),this.redisplay()})})}).addExtraButton(u=>{u.setIcon("lucide-x").setTooltip("Label the pages in this range continuing from the previous range").onClick(()=>{t.removeRange(o),this.redisplay()})}),new ei.Setting(s).setName("From").setDesc("The index of the first page in this range.").then(u=>u.controlEl.appendText("Page")).addText(u=>{u.inputEl.type="number",u.setValue(""+a.pageFrom).onChange(p=>{let f=Number(p);Number.isInteger(f)&&(c?c.pageFrom:1)this.redisplay(),{once:!0})}).then(u=>this.addPreviewButton(u,a.pageFrom)),new ei.Setting(s).setName("To").setDesc("The index of the last page in this range.").then(u=>u.controlEl.appendText("Page")).addText(u=>{u.inputEl.type="number",u.setValue(""+h).onChange(p=>{let f=Number(p);Number.isInteger(f)&&a.pageFrom<=f&&f<=(d?d.pageFrom-1:r-1)?(l.pageFrom=f+1,u.inputEl.removeClass("error")):u.inputEl.addClass("error")}).setDisabled(o===t.ranges.length-1).then(p=>{p.disabled&&(0,Cw.setTooltip)(p.inputEl,"The last range cannot be extended.")}),u.inputEl.addEventListener("blur",()=>this.redisplay(),{once:!0})}).then(u=>this.addPreviewButton(u,h)),new Mg(a.dict,s)}}addHeading(t,i,r){return new ei.Setting(t).setName(i).setHeading().then(o=>{let s=createDiv();o.settingEl.prepend(s),(0,ei.setIcon)(s,r)})}addPreviewButton(t,i){return t.addExtraButton(r=>{r.setIcon("lucide-message-square").setTooltip(`Hover${this.plugin.requireModKeyForLinkHover()?"+"+Bt("Mod").toLowerCase():""} to preview`).then(o=>{this.component.registerDomEvent(o.extraSettingsEl,"mouseover",s=>{this.app.workspace.trigger("hover-link",{event:s,source:"pdf-plus",linktext:this.file.path+`#page=${i}`,targetEl:o.extraSettingsEl,hoverParent:this.component})})})})}addButtons(){var t;return(t=this.buttonSetting)!=null?t:new ei.Setting(this.contentEl).addButton(i=>{i.setButtonText("Save").setCta().onClick(async()=>{this.pageLabels&&this.doc?(this.pageLabels.rangeCount()>0?this.pageLabels.setToDocument(this.doc):Ui.removeFromDocument(this.doc),await this.app.vault.modifyBinary(this.file,await this.doc.save())):new ei.Notice(`${this.plugin.manifest.name}: Something went wrong.`),this.close()})}).addButton(i=>{i.setButtonText("Cancel").onClick(()=>this.close())}).then(i=>{this.buttonSetting=i,this.updateButtonVisibility()})}updateButtonVisibility(){this.buttonSetting&&(this.pageLabels&&this.pageLabels.rangeCount()>0?this.buttonSetting.settingEl.show():this.buttonSetting.settingEl.hide())}};var Si=require("obsidian");var td=class td extends Ke{constructor(...t){super(...t);this.source=null;this.uris=[];this.folderPath=null;this.scope.register([],"Enter",()=>{var i;((i=activeDocument.activeElement)==null?void 0:i.tagName)==="INPUT"&&this.submit()})}onOpen(){super.onOpen();let t=this.plugin.loadLocalStorage(td.LOCAL_STORAGE_KEY);["file","web"].includes(t)&&(this.source=t),this.folderPath=this.lib.dummyFileManager.getFolderPathForDummyFiles(this.app.workspace.getActiveFile()),this.titleEl.setText(`${this.plugin.manifest.name}: Create dummy file for external PDF`),this.modalEl.createDiv("",i=>{new Si.Setting(i).setDesc(createFragment(r=>{let o=this.plugin.settings.modifierToDropExternalPDFToCreateDummy;r.appendText(`You can also use ${o.length?o.map(Bt).join("+")+" +":""} drag & drop to create dummy files. `),r.createEl("a",{text:"Learn more about dummy PDF files",href:"https://ryotaushio.github.io/obsidian-pdf-plus/external-pdf-files"})})),setTimeout(()=>{this.modalEl.insertBefore(i,this.contentEl)})}),this.display()}display(){Si.Platform.isDesktopApp?this.displayDesktop():this.displayMobile()}displayDesktop(){this.contentEl.empty(),this.addSourceLocationSetting(),this.addFolderSetting(),this.source==="file"?this.addLocalFileSetting():this.source==="web"&&this.addWebFileSetting(),this.source&&this.addButtons()}displayMobile(){this.source="web",this.contentEl.empty(),this.addFolderSetting(),this.addWebFileSetting(),this.addButtons()}addSetting(){return new Si.Setting(this.contentEl)}addSourceLocationSetting(){return this.addSetting().setName("Source location").setDesc("Where the external PDF is located.").addDropdown(t=>{var i;t.addOptions({file:"On this computer",web:"Web"}).setValue((i=this.source)!=null?i:"").onChange(r=>{this.source=r,this.display()}),t.selectEl.tabIndex=this.source?-1:0})}addFolderSetting(){return this.addSetting().setName("Folder to save the dummy files").setDesc(createFragment(t=>{t.appendText("You can specify the default folder in the "),t.createEl("a",{text:"settings",href:"obsidian://pdf-plus?setting=dummyFileFolderPath"}),t.appendText(".")})).addText(t=>{var i;t.inputEl.size=30,t.setValue((i=this.folderPath)!=null?i:""),new Rr(this.app,t.inputEl).onSelect(({item:r})=>{this.folderPath=r.path})})}addLocalFileSetting(){this.addSetting().setName("Absolute path to the PDF").setDesc('Type the path in the input box or click the "Browse" button to select the file.').addButton(t=>{t.setButtonText("Browse").setCta().onClick(()=>{var r;let i=(r=window.electron)==null?void 0:r.remote.dialog.showOpenDialogSync({properties:["openFile","multiSelections","dontAddToRecent"],filters:[{name:"PDF files",extensions:["pdf"]}]});i&&i.length>0&&(this.uris=i.map(o=>this.lib.dummyFileManager.absolutePathToFileUri(o)),this.display())})}).addExtraButton(t=>{t.setIcon("plus").setTooltip("Add another file").onClick(()=>{this.uris.push(""),this.display()})}),this.addUriListSetting()}addWebFileSetting(){this.addSetting().setName("URL of the PDF").setDesc('Must start with "https://" or "http://".').addExtraButton(t=>{t.setIcon("plus").setTooltip("Add another URL").onClick(()=>{this.uris.push(""),this.display()})}),this.addUriListSetting()}addUriListSetting(){this.uris.length||this.uris.push("");for(let t=0;ti.settingEl.addClass("no-border")).addText(i=>{i.inputEl.size=30,this.source==="file"?i.setValue(this.uris[t]?this.uris[t].replace(/^file:\/\//,""):"").onChange(r=>{this.uris[t]="file://"+r}):i.setValue(this.uris[t]||"").onChange(r=>{this.uris[t]=r}),t===this.uris.length-1&&setTimeout(()=>i.inputEl.focus())}).addExtraButton(i=>{i.setIcon("trash").setTooltip(`Remove this ${this.source==="file"?"file":"URL"}`).onClick(()=>{this.uris.splice(t,1),this.display()}),this.uris.length===1&&i.extraSettingsEl.hide()})}addButtons(){this.contentEl.createDiv("modal-button-container",t=>{t.createEl("button",{text:"Create",cls:"mod-cta"},i=>{i.addEventListener("click",()=>{this.submit()})}),t.createEl("button",{text:"Cancel"},i=>{i.addEventListener("click",()=>{this.close()})})})}submit(){if(this.uris=this.uris.filter(t=>t),!this.uris.length){new Si.Notice(`${this.plugin.manifest.name}: The external PDF location is not specified.`);return}if(!this.folderPath){new Si.Notice(`${this.plugin.manifest.name}: The folder to save the dummy files is not specified.`);return}this.plugin.saveLocalStorage(td.LOCAL_STORAGE_KEY,this.source),this.createDummyFiles(),this.close()}async createDummyFiles(){if(this.folderPath){this.folderPath=(0,Si.normalizePath)(this.folderPath);let t=await this.lib.dummyFileManager.createDummyFilesInFolder(this.folderPath,this.uris);new Si.Notice(`${this.plugin.manifest.name}: Dummy files created successfully.`);for(let i of t)i&&await this.app.workspace.getLeaf(!0).openFile(i)}else new Si.Notice(`${this.plugin.manifest.name}: Failed to create dummy files for the following URIs: ${this.uris.join(", ")}`)}};td.LOCAL_STORAGE_KEY="last-used-dummy-file-source";var Fa=td;var id=require("obsidian");var Ng="1.6.5",Da=class n extends Ke{static openIfNecessary(e){let t=bu();t&&bg(t,Ng)&&e.app.workspace.onLayoutReady(()=>{new n(e).open()})}onOpen(){super.onOpen();let e=this.plugin.manifest.name;this.setTitle(`${e}: Obsidian installer update is required`),this.contentEl.createEl("p",{text:`Your Obsidian installer (${bu()}) is outdated and is incompatible with the latest ${e}. Please download the latest installer from Obsidian's website and re-install the Obsidian app.`}),(0,id.requireApiVersion)(Ng)||this.contentEl.createEl("p",{text:`Also, in the very near future, Obsidian ${Ng} or later will be required for you to be able to keep receiving updates of ${e}.`}),this.contentEl.createDiv("modal-button-container",t=>{let i="https://obsidian.md/download";new id.ButtonComponent(t).setButtonText("Get installer from obsidian.md").setTooltip(i).setCta().onClick(()=>{window.open(i)});let r="https://help.obsidian.md/Getting+started/Update+Obsidian#Installer%20updates";new id.ButtonComponent(t).setButtonText('What is "installer update"? (help.obsidian.md)').setTooltip(r).onClick(()=>{window.open(r)})})}};var Le=require("obsidian");var Sw=require("obsidian");var Pa=class n{constructor(){this.tree=null;this.dict=null}static fromDocument(e){if(e.catalog.has(v.of("Dests"))){let i=lt(e.catalog,"Dests");if(i instanceof W){let r=new n;return r.dict=i,r}}let t=lt(e.catalog,"Names");if(t instanceof W){let i=lt(t,"Dests");if(i instanceof W){let r=new n;return r.tree=new wa(i),r}}return null}getExplicitDest(e){var i,r;let t=null;if(this.dict){let o=lt(this.dict,e);t=(i=o instanceof Y?this.dict.context.lookup(o):o)!=null?i:null}else if(this.tree){let o=this.tree.get(e);t=(r=o instanceof Y?this.tree._rootDict.context.lookup(o):o)!=null?r:null}if(t instanceof Z)return t;if(t instanceof W){let o=t.get(v.of("D"));if(o instanceof Z)return o}return null}};var Ge=class n{constructor(e,t){this.plugin=e,this.doc=t,this.namedDests=Pa.fromDocument(t)}static async fromDocument(e,t){return new n(t,e)}static async fromFile(e,t){let{lib:i}=t,r=await i.loadPdfLibDocument(e);return new n(t,r)}get lib(){return this.plugin.lib}get root(){let e=lt(this.doc.catalog,"Outlines");return e instanceof W?new Su(this,e):null}set root(e){if(e){let t=this.doc.context.getObjectRef(e.dict);t||(t=this.doc.context.register(e.dict)),this.doc.catalog.set(v.of("Outlines"),t);return}this.doc.catalog.delete(v.of("Outlines"))}ensureRoot(){if(!this.root){let e=this.doc.context.obj({Type:"Outlines"});this.doc.context.register(e),this.root=new Su(this,e)}return this.root}getLeaves(){let e=[],t=i=>{i.firstChild&&t(i.firstChild),i.nextSibling&&t(i.nextSibling),i.firstChild||e.push(i)};return this.root&&t(this.root),e}iter(e){let t=i=>{var r,o;(r=e.enter)==null||r.call(e,i),i.iterChildren(t),(o=e.leave)==null||o.call(e,i)};this.root&&t(this.root)}async iterAsync(e){let t=async i=>{var r,o;await((r=e.enter)==null?void 0:r.call(e,i)),await i.iterChildrenAsync(t),await((o=e.leave)==null?void 0:o.call(e,i))};this.root&&await t(this.root)}async prune(){await this.iterAsync({leave:async e=>{await e.destNotExistInDoc()&&(e.removeAndLiftUpChildren(),e.updateCountForAllAncestors())}})}stringify(){let e="";return this.iter({enter:t=>{t.isRoot()||(e=e+" ".repeat(t.depth-1)+"- "+t.title+` `)}}),e}async findPDFjsOutlineTreeNode(e){let t=null;return await this.iterAsync({enter:async i=>{if(!(t||i.isRoot())&&e.item.title===i.title){let r=e.item.dest,o=i.getNormalizedDestination();if(typeof r=="string")typeof o=="string"&&r===o&&(t=i);else{let s=await e.getPageNumber();JSON.stringify(this.lib.normalizePDFJsDestArray(r,s))===JSON.stringify(o)&&(t=i)}}}}),t}static async processOutlineRoot(e,t,i){let{app:r}=i,o=await n.fromFile(t,i);e(o.ensureRoot());let s=await o.doc.save();await r.vault.modifyBinary(t,s)}static async findAndProcessOutlineItem(e,t,i,r){let{app:o}=r,s=await n.fromFile(i,r),a=await s.findPDFjsOutlineTreeNode(e);if(!a){new Sw.Notice(`${r.manifest.name}: Failed to process the outline item.`);return}t(a);let c=await s.doc.save();await o.vault.modifyBinary(i,c)}},Su=class n{constructor(e,t){this.outlines=e,this.dict=t}get doc(){return this.outlines.doc}get lib(){return this.outlines.plugin.lib}is(e){return e!==null&&this.dict===e.dict}_get(e){let t=lt(this.dict,e);return t instanceof W?new n(this.outlines,t):null}_setOrDelete(e,t){if(t){let i=this.doc.context.getObjectRef(t.dict);i||(i=this.doc.context.register(t.dict)),this.dict.set(v.of(e),i);return}this.dict.delete(v.of(e))}get firstChild(){return this._get("First")}set firstChild(e){if(e&&!this.is(e.parent))throw new Error(`Item "${e.name}" is not a child of this item "${this.name}"`);this._setOrDelete("First",e)}get lastChild(){return this._get("Last")}set lastChild(e){if(e&&!this.is(e.parent))throw new Error(`Item "${e.name}" is not a child of this item "${this.name}"`);this._setOrDelete("Last",e)}get nextSibling(){return this._get("Next")}set nextSibling(e){if(e&&!(e.parent&&e.parent.is(this.parent)))throw new Error(`Item "${e.name}" is not a sibling of this item "${this.name}"`);this._setOrDelete("Next",e)}get prevSibling(){return this._get("Prev")}set prevSibling(e){if(e&&!(e.parent&&e.parent.is(this.parent)))throw new Error(`Item "${e.name}" is not a sibling of this item "${this.name}"`);this._setOrDelete("Prev",e)}get parent(){return this._get("Parent")}set parent(e){if(e&&this.isRoot())throw new Error("Cannot set parent of the root of outline");this._setOrDelete("Parent",e)}get count(){let e=lt(this.dict,"Count");return e instanceof G?e.asNumber():null}set count(e){if(e===null){this.dict.delete(v.of("Count"));return}this.dict.set(v.of("Count"),G.of(e))}get title(){if(this.isRoot())throw new Error("Root of outline does not have a title");let e=lt(this.dict,"Title");if(e instanceof J||e instanceof K)return e.decodeText();throw new Error("Title is not a string")}set title(e){if(this.isRoot())throw new Error("Cannot set title of the root of outline");this.dict.set(v.of("Title"),K.fromText(e))}get name(){if(this.isRoot())return"(Root)";let e=this.title;return this.iterAncestors(t=>{t.isRoot()||(e=`${t.title}/${e}`)}),e}get depth(){let e=0;return this.iterAncestors(()=>e++),e}isLeaf(){return!this.firstChild}isRoot(){return this.parent===null}createChild(e,t){let i;if(typeof t=="string")i=K.fromText(t);else{i=Z.withContext(this.doc.context),i.push(this.doc.getPage(t[0]).ref),i.push(v.of(t[1]));for(let s of t.slice(2))i.push(typeof s=="number"?G.of(s):He)}let r=this.doc.context.getObjectRef(this.dict);if(!r)throw new Error("Could not get ref for parent");let o={Title:K.fromText(e),Dest:i,Parent:r};if(this.lastChild){Object.assign(o,{Prev:this.doc.context.getObjectRef(this.lastChild.dict)});let s=new n(this.outlines,this.doc.context.obj(o));this.lastChild.nextSibling=s,this.lastChild=s}else{let s=new n(this.outlines,this.doc.context.obj(o));this.firstChild=s,this.lastChild=s}return this.lastChild}appendChild(e){if(e.isAncestorOf(this,!0))throw new Error("Cannot append an ancestor as a child");e.remove(),e.updateCountForAllAncestors(),e.parent=this,this.lastChild?(this.lastChild.nextSibling=e,e.prevSibling=this.lastChild,this.lastChild=e):(this.firstChild=e,this.lastChild=e,e.prevSibling=null),e.nextSibling=null,e.updateCountForAllAncestors()}remove(){return this.prevSibling&&(this.prevSibling.nextSibling=this.nextSibling),this.nextSibling&&(this.nextSibling.prevSibling=this.prevSibling),this.parent&&(this.is(this.parent.firstChild)&&(this.parent.firstChild=this.nextSibling),this.is(this.parent.lastChild)&&(this.parent.lastChild=this.prevSibling)),this}removeAndLiftUpChildren(){if(this.remove(),this.firstChild){if(!this.lastChild)throw new Error("Last child is not set despite having children");this.iterChildren(e=>{e.parent=this.parent}),this.prevSibling?(this.prevSibling.nextSibling=this.firstChild,this.firstChild.prevSibling=this.prevSibling):this.parent&&(this.parent.firstChild=this.firstChild,this.firstChild.prevSibling=null),this.nextSibling?(this.nextSibling.prevSibling=this.lastChild,this.lastChild.nextSibling=this.nextSibling):this.parent&&(this.parent.lastChild=this.lastChild,this.lastChild.nextSibling=null)}}iterChildren(e){let t=this.firstChild;for(;t;)e(t),t=t.nextSibling}async iterChildrenAsync(e){let t=this.firstChild;for(;t;)await e(t),t=t.nextSibling}iterAncestors(e,t=!1){t&&e(this);let i=this.parent;for(;i;)e(i),i=i.parent;return this}isAncestorOf(e,t=!1){let i=!1;return e.iterAncestors(r=>{this.is(r)&&(i=!0)},t),i}async sortChildren(){let e=[];await this.iterChildrenAsync(async r=>{let o=r.getExplicitDestination();if(o===null)return 0;let s=o[0],a=o[1]==="XYZ"?o[3]:o[1]==="FitBH"||o[1]==="FitH"?o[2]:void 0;e.push({child:r,page:s,top:a!=null?a:void 0})}),e.sort((r,o)=>{var s,a;return r.page-o.page||((s=r.top)!=null?s:0)-((a=o.top)!=null?a:0)});let t=null,i=e.first();i&&(i.child.prevSibling=null,this.firstChild=i.child);for(let{child:r}of e)t&&(t.nextSibling=r,r.prevSibling=t),t=r;t&&(t.nextSibling=null,this.lastChild=t)}async destNotExistInDoc(){var r,o,s;if(this.isRoot())return!1;let e=this.getDestination(),t=null;if(e instanceof J||e instanceof K){let a=e.decodeText();t=(o=(r=this.outlines.namedDests)==null?void 0:r.getExplicitDest(a))!=null?o:null}else e instanceof Z&&(t=e);if(!t)return!0;let i=t.get(0);if(i instanceof Y){let a=this.doc.context.lookup(i);if(a instanceof et)return!((s=a.Parent())!=null&&s.Kids().asArray().includes(i))}throw new Error("The first element of a destination array must be a refernece of a page leaf node.")}countVisibleDescendants(){let e=0;return this.iterChildren(()=>e++),this.iterChildren(t=>{typeof t.count=="number"&&t.count>0&&(e+=t.countVisibleDescendants())}),e}updateCount(e){let t=this.countVisibleDescendants();if(this.isRoot()&&!e)throw new Error("Cannot close the root outline");this.count=e?t:-t}updateCountForAllAncestors(e=!1){return this.iterAncestors(t=>t.updateCount(t.isRoot()),e)}getDestination(){let e=lt(this.dict,"Dest");if(e)return e;let t=lt(this.dict,"A");if(t instanceof W){let i=lt(t,"S");if(i instanceof v&&i.decodeText()==="GoTo"){let r=lt(t,"D");return r!=null?r:null}}return null}getNormalizedDestination(){let e=this.getDestination();return e instanceof J||e instanceof K?e.decodeText():e instanceof Z?this.lib.normalizePdfLibDestArray(e,this.doc):null}getExplicitDestination(){var t,i;let e=this.getNormalizedDestination();if(typeof e=="string"){let r=(i=(t=this.outlines.namedDests)==null?void 0:t.getExplicitDest(e))!=null?i:null;return r?this.lib.normalizePdfLibDestArray(r,this.doc):null}return e}};var Kr=require("obsidian");function Ew(n,e,t){let i=(r,o)=>{if(o>=e.length)return;t.clickableParentItem&&r.setUseNativeMenu(!1);let s=new Set(r.items);e[o](r);let a=r.items.filter(c=>!s.has(c));if(o!=e.length-1){for(let c of a)if(c instanceof Kr.MenuItem){let l=c.callback,d=c.setSubmenu();if(t.vim){Vg(d);let h=d.scope.keys.find(u=>u.key==="Escape"&&u.modifiers==="");h&&(d.scope.unregister(h),d.scope.register([],"Escape",n.hide.bind(n)))}i(d,o+1),t.clickableParentItem&&c.onClick(l)}}};i(n,0)}function Tw(n){let e=[],t=[],i=n;for(;i&&i.selected>=0;){t.push(i.selected);let r=i.items[i.selected];r instanceof Kr.MenuItem&&e.push(r),i=r instanceof Kr.MenuItem?r.submenu:null}return{items:e,indices:t}}function Rg(n,e){n.openSubmenu=function(t){return this.parentMenu&&this.closeSubmenu(),Kr.Menu.prototype.openSubmenu.call(this,t)},n.openSubmenuSoon=(0,Kr.debounce)(n.openSubmenu.bind(n),e!=null?e:250,!0)}function Vg(n){n.scope.register([],"j",n.onArrowDown.bind(n)),n.scope.register([],"k",n.onArrowUp.bind(n)),n.scope.register([],"h",n.onArrowLeft.bind(n)),n.scope.register([],"l",n.onArrowRight.bind(n))}var ge=require("obsidian");var qg=require("obsidian");var Iw=require("obsidian");var Pt=require("obsidian");var Aw=require("obsidian"),ke=class extends Aw.Component{constructor(e){super(),this.plugin=e}get app(){return this.plugin.app}get lib(){return this.plugin.lib}get settings(){return this.plugin.settings}};var Eu=class Eu extends ke{constructor(e,t){super(e),this.child=t,this.destIdToBibText=new Map,this.destIdToParsedBib=new Map,this.events=new Pt.Events,this.initialized=!1,this.init()}isEnabled(){let e=this.child.pdfViewer;return this.settings.actionOnCitationHover!=="none"&&(Kn(e)||this.settings.enableBibInCanvas&&ma(e)||this.settings.enableBibInHoverPopover&&xa(e)||this.settings.enableBibInEmbed&&es(e))}async init(){this.isEnabled()&&(await this.extractBibText(),await this.parseBibText()),this.initialized=!0}async extractBibText(){return new Promise(e=>{this.lib.onDocumentReady(this.child.pdfViewer,t=>{new Hg(this.plugin,t).onExtracted((i,r)=>{this.destIdToBibText.set(i,r),this.events.trigger("extracted",i,r)}).extract().then(e)})})}async parseBibText(){let e=Array.from(this.destIdToBibText.values()).join(` `),t=await this.parseBibliographyText(e);if(t){let i=Array.from(this.destIdToBibText.keys());for(let r=0;r{let s=new Pt.HoverPopover(t,r,200);s.hoverEl.addClass("pdf-plus-bib-popover");let a=s.hoverEl.createDiv();s.addChild(new zg(this,e,a))};this.plugin.requireModKeyForLinkHover(Eu.HOVER_LINK_SOURCE_ID)?og(i,r,o):o()}getGoogleScholarSearchUrlFromDest(e){var r;let t="",i=this.destIdToParsedBib.get(e);if(i){let{author:o,title:s,year:a,"container-title":c}=i;s&&(t+=`${s[0]}`),o&&(t+=" "+o.map(l=>l.family).join(" ")),a&&(t+=` ${a}`),c&&(t+=` ${c[0]}`)}else t=(r=this.destIdToBibText.get(e))!=null?r:"";return t?`https://scholar.google.com/scholar?hl=en&as_sdt=0%2C5&q=${encodeURIComponent(t)}`:null}async parseBibliographyText(e){let{app:t,plugin:i,settings:r}=this,o=r.anystylePath;if(!o)return null;let s=i.getAnyStyleInputDir();if(Pt.Platform.isDesktopApp&&t.vault.adapter instanceof Pt.FileSystemAdapter&&s){let a=t.vault.adapter.getFullPath(s);await Pt.FileSystemAdapter.mkdir(a);let c=s+`/${ug()}.txt`,l=t.vault.adapter.getFullPath(c);await t.vault.adapter.write(c,e),this.register(()=>t.vault.adapter.remove(c));let{spawn:d}=require("child_process");return new Promise(h=>{let u=d(o,["parse",l]),p="";u.stdout.on("data",f=>{if(f){p+=f.toString();return}h(null)}),u.on("error",f=>{if("code"in f&&f.code==="ENOENT"){let m=`${i.manifest.name}: AnyStyle not found at the path "${o}".`;if(i.settings.anystylePath){let x=new Pt.Notice(m,8e3);x.noticeEl.appendText(" Click "),x.noticeEl.createEl("a",{text:"here"},g=>{g.addEventListener("click",()=>{i.openSettingTab().scrollTo("anystylePath")})}),x.noticeEl.appendText(" to update the path."),console.error(m)}else console.warn(m);return h(null)}}),u.on("close",f=>{var x;if(f)return h(null);let m=JSON.parse(p);if(Array.isArray(m)){for(let g of m)for(let b of(x=g.date)!=null?x:[]){let w=b.match(/\d{4}/);if(w){g.year=w[0];break}}h(m)}h(null)})})}return null}on(e,t,i){return this.events.on(e,t,i)}};Eu.HOVER_LINK_SOURCE_ID="pdf-plus-citation-link";var pn=Eu,Hg=class{constructor(e,t){this.plugin=e,this.doc=t,this.pageRefToTextContentItemsPromise={}}onExtracted(e){return this.onExtractedCallback=e,this}async extract(){let e=await this.doc.getDestinations(),t=[];for(let i in e)if(this.plugin.lib.isCitationId(i)){let r=e[i];t.push(this.extractBibTextForDest(r).then(o=>{var s;if(o){let a=o.text;(s=this.onExtractedCallback)==null||s.call(this,i,a)}}))}await Promise.all(t)}async getTextContentItemsFromPageRef(e){var i;let t=JSON.stringify(e);return(i=this.pageRefToTextContentItemsPromise[t])!=null?i:this.pageRefToTextContentItemsPromise[t]=(async()=>{let r=await this.doc.getPageIndex(e)+1;return(await(await this.doc.getPage(r)).getTextContent()).items})()}async extractBibTextForDest(e){let t=e[0],i=await this.getTextContentItemsFromPageRef(t),r=-1;if(e[1].name==="XYZ"){let d=e[2],h=e[3];if(d===null||h===null)return null;r=i.findIndex(u=>{if(!u.str)return!1;let p=u.transform[4],f=u.transform[5]+(u.height||u.transform[0])*.8;return d<=p&&f<=h})}else if(e[1].name==="FitBH"){let d=e[2];if(d===null)return null;r=i.findIndex(h=>h.str?h.transform[5]+(h.height||h.transform[0])*.8<=d:!1)}if(r===-1)return null;let o=i[r],s=o.transform[4],a=i[r].str,c=r+1,l=[o];for(;;){let d=i[c];if(!d||d.transform[4]<=s+Math.max(d.height,8)*.1)break;d.str.trimStart().startsWith(".")||d.str.trimStart().startsWith(",")?a=a.trimEnd()+d.str.trimStart():a+=` `+d.str,l.push(d),c++}return a=a.trimStart().replace(/^\[\d+\]/,""),a=a.trimStart().replace(/^\(\d+\)/,""),a=a.trimStart().replace(/^\d+\./,""),{text:Yc(a),items:l}}},zg=class extends ke{constructor(e,t,i){super(e.plugin),this.bib=e,this.destId=t,this.containerEl=i,this.containerEl.addClass("pdf-plus-bib")}get child(){return this.bib.child}renderParsedBib(e){let{author:t,title:i,year:r,"container-title":o}=e;return t?(this.containerEl.createDiv("",s=>{s.createDiv("bib-title",a=>{var c;a.setText((c=i==null?void 0:i[0])!=null?c:"No title")}),s.createDiv("bib-author-year",a=>{let c=t.map(l=>{let d="";return l.given&&(d+=l.given),l.family&&(d+=" "+l.family),d}).filter(l=>l).join(", ");a.appendText(c),r&&a.appendText(` (${r})`)}),o&&s.createDiv("bib-container-title",a=>{a.setText(o[0])})}),!0):!1}async onload(){await this.render()}async render(){this.containerEl.empty();let e=!1,t=this.bib.destIdToParsedBib.get(this.destId);if(t&&(e=this.renderParsedBib(t)),!e){let i=this.bib.destIdToBibText.get(this.destId);i?(this.containerEl.createDiv({text:i}),Pt.Platform.isDesktopApp&&this.settings.anystylePath&&this.registerRenderOn("parsed")):this.bib.initialized?this.containerEl.createDiv({text:"No bibliography found"}):(this.containerEl.createDiv({text:"Loading..."}),this.registerRenderOn("extracted"))}this.containerEl.createDiv("button-container",i=>{new Pt.ButtonComponent(i).setButtonText("Google Scholar").onClick(()=>{let r=this.bib.getGoogleScholarSearchUrlFromDest(this.destId);if(!r){new Pt.Notice(`${this.plugin.manifest.name}: ${this.bib.initialized?"No bibliography found":"Still loading the bibliography information. Please try again later."}`);return}window.open(r)}),new Pt.ExtraButtonComponent(i).setIcon("lucide-settings").setTooltip("Customize...").onClick(()=>{this.plugin.openSettingTab().scrollToHeading("citation")})})}registerRenderOn(e){let t=this.bib.on(e,i=>{i===this.destId&&(this.render(),this.bib.events.offref(t))});this.registerEvent(t)}onunload(){this.containerEl.empty()}};var Tu=class{get hoverPopover(){return this.child.hoverPopover}set hoverPopover(e){this.child.hoverPopover=e,e&&(e.hoverEl.addClass("pdf-plus-pdf-link-like-popover"),this.onHoverPopoverSet(e))}onHoverPopoverSet(e){}constructor(e,t,i){this.plugin=e,this.app=e.app,this.lib=e.lib,this.child=t,this.targetEl=i,this.useModifierKey()&&this.registerClickToOpenInNewLeaf(),this.shouldShowHoverPopover()&&this.registerHover(),this.shouldRecordHistory()&&this.registerClickToRecordHistory()}get hoverLinkSourceId(){return this.constructor.HOVER_LINK_SOURCE_ID}get file(){return this.child.file}get sourcePath(){var e,t;return(t=(e=this.file)==null?void 0:e.path)!=null?t:""}registerClickToOpenInNewLeaf(){let{app:e,plugin:t,targetEl:i}=this;t.registerDomEvent(i,"click",async r=>{if(r.defaultPrevented)return;let o=Iw.Keymap.isModEvent(r);if(!o)return;r.preventDefault(),r.stopPropagation();let s=await this.getLinkText(r);s!==null&&e.workspace.openLinkText(s,this.sourcePath,o)},{capture:!0})}async customHover(e){return!1}registerHover(){let{app:e,plugin:t,targetEl:i}=this;t.registerDomEvent(i,"mouseover",async r=>{if(await this.customHover(r))return;let o=null;try{o=await this.getLinkText(r)}catch(s){if(s.name==="UnknownErrorException")return console.warn(`${this.plugin.manifest.name}: The destination was not found in this document.`);throw s}o!==null&&e.workspace.trigger("hover-link",{event:r,source:this.hoverLinkSourceId,hoverParent:this,targetEl:i,linktext:o,sourcePath:this.sourcePath})})}registerClickToRecordHistory(){let{plugin:e,targetEl:t}=this;e.registerDomEvent(t,"click",i=>{this.recordLeafHistory()},{capture:!0})}recordLeafHistory(){this.lib.workspace.iteratePDFViews(e=>{if(e.containerEl.contains(this.targetEl)){let t=e.leaf;t.recordHistory(t.getHistoryState())}})}},Au=class extends Tu{async getLinkText(e){var c,l,d;let{lib:t,child:i,targetEl:r}=this;if(!Ci(e,r))return null;let o=(c=i.pdfViewer.pdfViewer)==null?void 0:c.pdfDocument;if(!o)return null;let s=this.getDest(),a=null;return typeof s=="string"?a=await t.destIdToSubpath(s,o):a=await t.pdfJsDestArrayToSubpath(s,o),a===null?null:((d=(l=this.file)==null?void 0:l.path)!=null?d:"")+a}onHoverPopoverSet(e){let t=e.hoverEl,i=this.getDest();typeof i=="string"&&(t.dataset.dest=i)}},nd=class nd extends Au{constructor(e,t,i){super(e,t,i.container),this.linkAnnotationElement=i}static registerEvents(e,t,i){return i.data.subtype==="Link"?new nd(e,t,i):null}async getLinkText(e){var t,i;if(this.plugin.settings.actionOnCitationHover==="google-scholar-popover"&&this.lib.requirePluginNewerThan("surfing","0.9.5")){let r=this.getDest();if(this.lib.isCitationId(r)&&((t=this.child.pdfViewer.pdfViewer)==null?void 0:t.pdfDocument)){let s=(i=this.child.bib)==null?void 0:i.getGoogleScholarSearchUrlFromDest(r);if(s)return s}}return super.getLinkText(e)}getDest(){return this.linkAnnotationElement.data.dest}useModifierKey(){return this.plugin.settings.clickPDFInternalLinkWithModifierKey}shouldShowHoverPopover(){return this.plugin.settings.enableHoverPDFInternalLink}isCitationLink(){let e=this.getDest();return this.lib.isCitationId(e)}get hoverLinkSourceId(){return this.isCitationLink()?pn.HOVER_LINK_SOURCE_ID:nd.HOVER_LINK_SOURCE_ID}shouldRecordHistory(){return this.plugin.settings.recordPDFInternalLinkHistory&&!this.child.opts.isEmbed}async customHover(e){if(this.plugin.settings.actionOnCitationHover==="pdf-plus-bib-popover"&&this.child.bib&&this.child.bib.isEnabled()){let t=this.getDest();if(this.lib.isCitationId(t))return this.child.bib.spawnBibPopoverOnModKeyDown(t,this,e,this.targetEl),!0}return!1}onHoverPopoverSet(e){super.onHoverPopoverSet(e),e.hoverEl.addClass("pdf-plus-pdf-internal-link-popover")}};nd.HOVER_LINK_SOURCE_ID="pdf-plus-internal-link";var Xn=nd,Iu=class Iu extends Au{constructor(e,t,i){super(e,t,i.selfEl),this.item=i}static registerEvents(e,t,i){return new Iu(e,t,i)}getDest(){return this.item.item.dest}useModifierKey(){return this.plugin.settings.clickOutlineItemWithModifierKey}shouldShowHoverPopover(){return this.plugin.settings.popoverPreviewOnOutlineHover}shouldRecordHistory(){return this.plugin.settings.recordHistoryOnOutlineClick&&!this.child.opts.isEmbed}onHoverPopoverSet(e){super.onHoverPopoverSet(e),e.hoverEl.addClass("pdf-plus-outline-item-popover")}};Iu.HOVER_LINK_SOURCE_ID="pdf-plus-outline";var Zn=Iu,Bu=class Bu extends Tu{static registerEvents(e,t){return new Bu(e,t,t.pdfViewer.pdfThumbnailViewer.container)}async getLinkText(e){var r,o;let t=It(e,e.target)&&e.target.closest('.pdf-thumbnail-view > a[href^="#page="]');if(!t)return null;let i=t.getAttribute("href");return((o=(r=this.file)==null?void 0:r.path)!=null?o:"")+i}useModifierKey(){return this.plugin.settings.clickThumbnailWithModifierKey}shouldShowHoverPopover(){return this.plugin.settings.popoverPreviewOnThumbnailHover}shouldRecordHistory(){return this.plugin.settings.recordHistoryOnThumbnailClick&&!this.child.opts.isEmbed}onHoverPopoverSet(e){super.onHoverPopoverSet(e),e.hoverEl.addClass("pdf-plus-thumbnail-item-popover")}};Bu.HOVER_LINK_SOURCE_ID="pdf-plus-thumbnail";var Yn=Bu;var rd=class rd extends ke{constructor(e,t,i){super(e),this.child=t,this.annot=i}get hoverPopover(){return this.child.hoverPopover}set hoverPopover(e){this.child.hoverPopover=e}get hoverLinkSourceId(){return rd.HOVER_LINK_SOURCE_ID}onload(){this.settings.popoverPreviewOnExternalLinkHover&&this.app.plugins.enabledPlugins.has("surfing")&&this.registerDomEvent(this.annot.container,"mouseover",e=>{let t=this.annot.data.url;t&&(t.startsWith("http://")||t.startsWith("https://"))&&this.app.workspace.trigger("hover-link",{event:e,source:this.hoverLinkSourceId,hoverParent:this,targetEl:this.annot.container,linktext:t})})}static registerEvents(e,t,i){var r;return i.data.subtype==="Link"&&i.data.url?(r=t.component)==null?void 0:r.addChild(new rd(e,t,i)):null}};rd.HOVER_LINK_SOURCE_ID="pdf-plus-external-link";var Gr=rd;var aC={highlight:"Highlight",underline:"Underline"},lC={open:"Open backlink",preview:"Popover preview of backlink"},Ou={"":"Current tab",tab:"New tab",right:"Split right",left:"Split left",down:"Split down",up:"Split up",window:"New window","right-sidebar":"Right sidebar","left-sidebar":"Left sidebar"},Bw={"last-paste":"Last pasted .md","last-active":"Last active .md","last-active-and-open":"Last active & open .md","last-paste-then-last-active":"Last pasted .md if any, otherwise last active .md","last-paste-then-last-active-and-open":"Last pasted .md if any, otherwise last active & open .md","last-active-and-open-then-last-paste":"Last active & open .md if any, otherwise last pasted .md"},cC={root:"Vault folder",current:"Same folder as current file",folder:"In the folder specified below"},Ow={root:"Vault folder",current:"Same folder as current file",folder:"In the folder specified below",subfolder:"In subfolder under current folder",obsidian:"Same as Obsidian's attachment location"},dC=["png","jpg","webp","bmp"],Mw="green",Ug={none:"Same as other internal links","pdf-plus-bib-popover":"PDF++'s custom bibliography popover","google-scholar-popover":"Google Scholar popover"},hC={text:"Copy text",obsidian:"Obsidian default (copy as quote)","pdf-plus":"Run PDF++'s copy command"},Jn={displayTextFormats:[{name:"Title & page",template:"{{file.basename}}, p.{{pageLabel}}"},{name:"Page",template:"p.{{pageLabel}}"},{name:"Text",template:"{{text}}"},{name:"Emoji",template:"\u{1F4D6}"},{name:"None",template:""}],defaultDisplayTextFormatIndex:0,syncDisplayTextFormat:!0,syncDefaultDisplayTextFormat:!1,copyCommands:[{name:"Quote",template:`> ({{linkWithDisplay}}) > {{text}} `},{name:"Link",template:"{{linkWithDisplay}}"},{name:"Embed",template:"!{{link}}"},{name:"Callout",template:`> [!{{calloutType}}|{{color}}] {{linkWithDisplay}} > {{text}} `},{name:"Quote in callout",template:`> [!{{calloutType}}|{{color}}] {{linkWithDisplay}} > > {{text}} > > `}],useAnotherCopyTemplateWhenNoSelection:!1,copyTemplateWhenNoSelection:"{{linkToPageWithDisplay}}",trimSelectionEmbed:!1,embedMargin:50,noSidebarInEmbed:!0,noSpreadModeInEmbed:!0,embedUnscrollable:!1,singleTabForSinglePDF:!0,highlightExistingTab:!1,existingTabHighlightOpacity:.5,existingTabHighlightDuration:.75,paneTypeForFirstPDFLeaf:"left",openLinkNextToExistingPDFTab:!0,openPDFWithDefaultApp:!1,openPDFWithDefaultAppAndObsidian:!0,focusObsidianAfterOpenPDFWithDefaultApp:!0,syncWithDefaultApp:!1,dontActivateAfterOpenPDF:!0,dontActivateAfterOpenMD:!0,highlightDuration:.75,noTextHighlightsInEmbed:!1,noAnnotationHighlightsInEmbed:!0,persistentTextHighlightsInEmbed:!0,persistentAnnotationHighlightsInEmbed:!1,highlightBacklinks:!0,selectionBacklinkVisualizeStyle:"highlight",dblclickEmbedToOpenLink:!0,highlightBacklinksPane:!0,highlightOnHoverBacklinkPane:!0,backlinkHoverColor:"",colors:{Yellow:"#ffd000",Red:"#ea5252",Note:"#086ddd",Important:"#bb61e5"},defaultColor:"",defaultColorPaletteItemIndex:0,syncColorPaletteItem:!0,syncDefaultColorPaletteItem:!1,colorPaletteInToolbar:!0,noColorButtonInColorPalette:!0,colorPaletteInEmbedToolbar:!1,quietColorPaletteTooltip:!1,showStatusInToolbar:!0,highlightColorSpecifiedOnly:!1,doubleClickHighlightToOpenBacklink:!0,hoverHighlightAction:"preview",paneTypeForFirstMDLeaf:"right",singleMDLeafInSidebar:!0,alwaysUseSidebar:!0,ignoreExistingMarkdownTabIn:[],defaultColorPaletteActionIndex:4,syncColorPaletteAction:!0,syncDefaultColorPaletteAction:!1,proxyMDProperty:"PDF",hoverPDFLinkToOpen:!1,ignoreHeightParamInPopoverPreview:!0,filterBacklinksByPageDefault:!0,showBacklinkToPage:!0,enableHoverPDFInternalLink:!0,recordPDFInternalLinkHistory:!0,alwaysRecordHistory:!0,renderMarkdownInStickyNote:!1,enablePDFEdit:!1,author:"",writeHighlightToFileOpacity:.2,defaultWriteFileToggle:!1,syncWriteFileToggle:!0,syncDefaultWriteFileToggle:!1,enableAnnotationDeletion:!0,warnEveryAnnotationDelete:!1,warnBacklinkedAnnotationDelete:!0,enableAnnotationContentEdit:!0,enableEditEncryptedPDF:!1,pdfLinkColor:"#04a802",pdfLinkBorder:!1,replaceContextMenu:!0,showContextMenuOnMouseUpIf:"Mod",contextMenuConfig:[{id:"action",visible:!0},{id:"selection",visible:!0},{id:"write-file",visible:!0},{id:"annotation",visible:!0},{id:"modify-annotation",visible:!0},{id:"link",visible:!0},{id:"text",visible:!0},{id:"search",visible:!0},{id:"speech",visible:!0},{id:"page",visible:!0},{id:"settings",visible:!0}],selectionProductMenuConfig:["color","copy-format","display"],writeFileProductMenuConfig:["color","copy-format","display"],annotationProductMenuConfig:["copy-format","display"],updateColorPaletteStateFromContextMenu:!0,mobileCopyAction:"pdf-plus",showContextMenuOnTablet:!1,executeBuiltinCommandForOutline:!0,executeBuiltinCommandForZoom:!0,executeFontSizeAdjusterCommand:!0,closeSidebarWithShowCommandIfExist:!0,autoHidePDFSidebar:!1,defaultSidebarView:1,outlineDrag:!0,outlineContextMenu:!0,outlineLinkDisplayTextFormat:"{{file.basename}}, {{text}}",outlineLinkCopyFormat:"{{linkWithDisplay}}",recordHistoryOnOutlineClick:!0,popoverPreviewOnOutlineHover:!0,thumbnailDrag:!0,thumbnailContextMenu:!0,thumbnailLinkDisplayTextFormat:"{{file.basename}}, p.{{pageLabel}}",thumbnailLinkCopyFormat:"{{linkWithDisplay}}",recordHistoryOnThumbnailClick:!0,popoverPreviewOnThumbnailHover:!0,annotationPopupDrag:!0,showAnnotationPopupOnHover:!0,useCallout:!0,calloutType:"PDF",calloutIcon:"highlighter",highlightBacklinksInEmbed:!1,highlightBacklinksInHoverPopover:!1,highlightBacklinksInCanvas:!0,clickPDFInternalLinkWithModifierKey:!0,clickOutlineItemWithModifierKey:!0,clickThumbnailWithModifierKey:!0,focusEditorAfterAutoPaste:!0,clearSelectionAfterAutoPaste:!0,respectCursorPositionWhenAutoPaste:!0,blankLineAboveAppendedContent:!0,autoCopy:!1,autoFocus:!1,autoPaste:!1,autoFocusTarget:"last-active-and-open-then-last-paste",autoPasteTarget:"last-active-and-open-then-last-paste",openAutoFocusTargetIfNotOpened:!0,howToOpenAutoFocusTargetIfNotOpened:"right",closeHoverEditorWhenLostFocus:!0,closeSidebarWhenLostFocus:!1,openAutoFocusTargetInEditingView:!0,executeCommandWhenTargetNotIdentified:!0,commandToExecuteWhenTargetNotIdentified:"switcher:open",autoPasteTargetDialogTimeoutSec:20,autoCopyToggleRibbonIcon:!0,autoCopyIconName:"highlighter",autoFocusToggleRibbonIcon:!0,autoFocusIconName:"zap",autoPasteToggleRibbonIcon:!0,autoPasteIconName:"clipboard-paste",viewSyncFollowPageNumber:!0,viewSyncPageDebounceInterval:.3,openAfterExtractPages:!0,howToOpenExtractedPDF:"tab",warnEveryPageDelete:!1,warnBacklinkedPageDelete:!0,extractPageInPlace:!1,askExtractPageInPlace:!0,pageLabelUpdateWhenInsertPage:"keep",pageLabelUpdateWhenDeletePage:"keep",pageLabelUpdateWhenExtractPage:"keep",askPageLabelUpdateWhenInsertPage:!0,askPageLabelUpdateWhenDeletePage:!0,askPageLabelUpdateWhenExtractPage:!0,copyOutlineAsListFormat:"{{linkWithDisplay}}",copyOutlineAsListDisplayTextFormat:"{{text}}",copyOutlineAsHeadingsFormat:`{{text}} {{linkWithDisplay}}`,copyOutlineAsHeadingsDisplayTextFormat:"p.{{pageLabel}}",copyOutlineAsHeadingsMinLevel:2,newFileNameFormat:"",newFileTemplatePath:"",newPDFLocation:"current",newPDFFolderPath:"",rectEmbedStaticImage:!1,rectImageFormat:"file",rectImageExtension:"webp",zoomToFitRect:!1,rectFollowAdaptToTheme:!0,rectEmbedResolution:100,includeColorWhenCopyingRectLink:!0,backlinkIconSize:50,showBacklinkIconForSelection:!1,showBacklinkIconForAnnotation:!1,showBacklinkIconForOffset:!0,showBacklinkIconForRect:!1,showBoundingRectForBacklinkedAnnot:!1,hideReplyAnnotation:!1,hideStampAnnotation:!1,searchLinkHighlightAll:"true",searchLinkCaseSensitive:"true",searchLinkMatchDiacritics:"default",searchLinkEntireWord:"false",dontFitWidthWhenOpenPDFLink:!0,preserveCurrentLeftOffsetWhenOpenPDFLink:!1,defaultZoomValue:"page-width",scrollModeOnLoad:0,spreadModeOnLoad:0,usePageUpAndPageDown:!0,hoverableDropdownMenuInToolbar:!0,zoomLevelInputBoxInToolbar:!0,popoverPreviewOnExternalLinkHover:!0,actionOnCitationHover:"pdf-plus-bib-popover",anystylePath:"",enableBibInEmbed:!1,enableBibInHoverPopover:!1,enableBibInCanvas:!0,citationIdPatterns:`^cite. ^bib\\d+$`,copyAsSingleLine:!0,removeWhitespaceBetweenCJChars:!0,dummyFileFolderPath:"",externalURIPatterns:[".*\\.pdf$","https://arxiv.org/pdf/.*"],modifierToDropExternalPDFToCreateDummy:["Shift"],vim:!1,vimrcPath:"",vimVisualMotion:!0,vimScrollSize:40,vimLargerScrollSizeWhenZoomIn:!0,vimContinuousScrollSpeed:1.2,vimSmoothScroll:!0,vimHlsearch:!0,vimIncsearch:!0,enableVimInContextMenu:!0,enableVimOutlineMode:!0,vimSmoothOutlineMode:!0,vimHintChars:"hjklasdfgyuiopqwertnmzxcvb",vimHintArgs:"all",PATH:"",autoCheckForUpdates:!0,fixObsidianTextSelectionBug:!0};function uC(n){return Jn.hasOwnProperty(n)}var _n=Bt("Mod").toLowerCase(),Lu=class extends ge.PluginSettingTab{constructor(t){super(t.app,t);this.plugin=t;this.events=new ge.Events;this.component=new ge.Component,this.items={},this.headings=new Map,this.iconHeadings=new Map,this.headerEls=new Map,this.promises=[],this.containerEl.addClass("pdf-plus-settings"),this.headerContainerEl=this.containerEl.createDiv("header-container"),this.contentEl=this.containerEl.createDiv("content")}addSetting(t){let i=new ge.Setting(this.contentEl);return t&&(this.items[t]=i,this.component.registerDomEvent(i.settingEl,"contextmenu",r=>{r.preventDefault(),new qg.Menu().addItem(o=>{o.setTitle("Restore default value of this setting").setIcon("lucide-undo-2").onClick(async()=>{this.plugin.settings[t]=this.plugin.getDefaultSettings()[t],await this.plugin.saveSettings(),this.redisplay(),new ge.Notice(`${this.plugin.manifest.name}: Default setting restored. Note that some options require a restart to take effect.`,6e3)})}).addItem(o=>{o.setTitle("Copy link to this setting").setIcon("lucide-link").onClick(()=>{navigator.clipboard.writeText(`obsidian://pdf-plus?setting=${t}`)})}).showAtMouseEvent(r)})),i}addHeading(t,i,r,o){let s=this.addSetting().setName(t).setHeading().then(a=>{if(r){let c=a.settingEl.parentElement;c&&c.insertBefore(createDiv("spacer"),a.settingEl);let l=createDiv();a.settingEl.prepend(l),(0,ge.setIcon)(l,r),a.settingEl.addClass("pdf-plus-setting-heading")}});return this.headings.set(i,s),this.component.registerDomEvent(s.settingEl,"contextmenu",a=>{a.preventDefault(),new qg.Menu().addItem(c=>{c.setTitle("Copy link to this heading").setIcon("lucide-link").onClick(()=>{navigator.clipboard.writeText(`obsidian://pdf-plus?setting=heading:${i}`)})}).showAtMouseEvent(a)}),r&&this.headerContainerEl.createDiv("clickable-icon header",a=>{let c=a.createDiv();(0,ge.setIcon)(c,r);let l=a.createDiv("header-title");l.setText(t),(0,ge.setTooltip)(a,t),this.component.registerDomEvent(a,"click",d=>{var h;((h=s.settingEl.previousElementSibling)!=null?h:s.settingEl).scrollIntoView({behavior:"smooth"}),this.updateHeaderElClassOnScroll(d)}),o==null||o({headerEl:a,iconEl:c,titleEl:l}),this.iconHeadings.set(i,s),this.headerEls.set(i,a)}),s}updateHeaderElClass(){var r,o,s;let t=this.containerEl.getBoundingClientRect().height,i=Array.from(this.iconHeadings.entries());for(let a=0;a=t*.2+this.headerContainerEl.clientHeight,h=i[a][0];(s=this.headerEls.get(h))==null||s.toggleClass("is-active",d)}}updateHeaderElClassOnScroll(t){var o;let i=(o=t==null?void 0:t.win)!=null?o:activeWindow,r=i.setInterval(()=>this.updateHeaderElClass(),50);i.setTimeout(()=>i.clearInterval(r),1500)}scrollTo(t,i){let r=this.items[t];r&&this.scrollToSetting(r,i)}scrollToHeading(t,i){let r=this.headings.get(t);r&&this.scrollToSetting(r,i)}scrollToSetting(t,i){let r=t.settingEl;r&&this.containerEl.scrollTo({top:r.offsetTop-this.headerContainerEl.offsetHeight,...i})}openFromObsidianUrl(t){let i=t.setting;i.startsWith("heading:")?this.plugin.openSettingTab().scrollToHeading(i.slice(8)):uC(i)&&this.plugin.openSettingTab().scrollTo(i)}getVisibilityToggler(t,i){let r=()=>{i()?t.settingEl.show():t.settingEl.hide()};return r(),r}showConditionally(t,i){let r=Array.isArray(t)?t:[t],o=r.map(s=>this.getVisibilityToggler(s,i));return this.events.on("update",()=>o.forEach(s=>s())),r}addTextSetting(t,i,r){let o=this.addSetting(t).addText(s=>{s.setValue(this.plugin.settings[t]).setPlaceholder(i!=null?i:"").then(a=>{i&&(a.inputEl.size=Math.max(a.inputEl.size,a.inputEl.placeholder.length))}).onChange(async a=>{this.plugin.settings[t]=a,await this.plugin.saveSettings()}),r&&(this.component.registerDomEvent(s.inputEl,"blur",()=>{r(o)}),this.component.registerDomEvent(s.inputEl,"keypress",a=>{a.key==="Enter"&&r(o)}))});return o}addTextAreaSetting(t,i,r){return this.addSetting(t).addTextArea(o=>{o.setValue(this.plugin.settings[t]).setPlaceholder(i!=null?i:"").onChange(async s=>{this.plugin.settings[t]=s,await this.plugin.saveSettings()}),r&&this.component.registerDomEvent(o.inputEl,"blur",r)})}addNumberSetting(t){return this.addSetting(t).addText(i=>{i.setValue(""+this.plugin.settings[t]).setPlaceholder(""+Jn[t]).then(r=>r.inputEl.type="number").onChange(async r=>{this.plugin.settings[t]=r===""?Jn[t]:+r,await this.plugin.saveSettings()})})}addToggleSetting(t,i){return this.addSetting(t).addToggle(r=>{r.setValue(this.plugin.settings[t]).onChange(async o=>{this.plugin.settings[t]=o,await this.plugin.saveSettings(),i==null||i(o)})})}addColorPickerSetting(t,i){return this.addSetting(t).addColorPicker(r=>{r.setValue(this.plugin.settings[t]).onChange(async o=>{this.plugin.settings[t]=o,await this.plugin.saveSettings(),i==null||i(o)})})}addDropdownSetting(t,...i){let r=[],o=a=>a,s=a=>{};return Array.isArray(i[0])?(r=i[0],typeof i[1]=="function"&&(o=i[1]),typeof i[2]=="function"&&(s=i[2])):(r=Object.keys(i[0]),o=a=>i[0][a],typeof i[1]=="function"&&(s=i[1])),this.addSetting(t).addDropdown(a=>{var c;for(let l of r){let d=(c=o(l))!=null?c:l;a.addOption(l,d)}a.setValue(this.plugin.settings[t]).onChange(async l=>{this.plugin.settings[t]=l,await this.plugin.saveSettings(),s==null||s(l)})})}addIndexDropdownSetting(t,i,r,o){return this.addSetting(t).addDropdown(s=>{var l;for(let d of i){let h=(l=r==null?void 0:r(d))!=null?l:d;s.addOption(d,h)}let a=this.plugin.settings[t],c=i[a];s.setValue(c).onChange(async d=>{let h=i.indexOf(d);h!==-1&&(this.plugin.settings[t]=h,await this.plugin.saveSettings(),o==null||o(h))})})}addEnumDropdownSetting(t,i,r){return this.addSetting(t).addDropdown(o=>{for(let[s,a]of Object.entries(i))parseInt(s).toString()===s&&o.addOption(s,a);o.setValue(""+this.plugin.settings[t]).onChange(async s=>{this.plugin.settings[t]=+s,await this.plugin.saveSettings(),r==null||r(+s)})})}addSliderSetting(t,i,r,o){return this.addSetting(t).addSlider(s=>{s.setLimits(i,r,o).setValue(this.plugin.settings[t]).setDynamicTooltip().onChange(async a=>{this.plugin.settings[t]=a,await this.plugin.saveSettings()})})}addDesc(t){return this.addSetting().setDesc(t)}addFileLocationSetting(t,i,r,o){return[this.addDropdownSetting(t,cC,()=>this.redisplay()).then(i),this.addSetting().addText(s=>{s.setValue(this.plugin.settings[r]),s.inputEl.size=30,new Rr(this.app,s.inputEl).onSelect(({item:a})=>{this.plugin.settings[r]=a.path,this.plugin.saveSettings()})}).then(s=>{o(s),this.plugin.settings[t]!=="folder"&&s.settingEl.hide()})]}addAttachmentLocationSetting(t,i,r){let o,s,a,c=()=>{let f=o.getValue();u.settingEl.toggle(f==="folder"),p.settingEl.toggle(f==="subfolder")},l=()=>{let f=o.getValue();return f==="root"?"/":f==="folder"?s.getValue()||i:f==="current"?"./":f==="subfolder"?"./"+(a.getValue()||i):""},d=f=>{if(f===""){o.setValue("obsidian");return}if(f==="/"){o.setValue("root");return}if(f!=="."&&f!=="./"){if(f.startsWith("./")){let m=f.slice(2);o.setValue("subfolder"),a.setValue(m!==i?m:"");return}o.setValue("folder"),s.setValue(f!==i?f:"");return}o.setValue("current")},h=this.addSetting(t).addDropdown(f=>{f.onChange(async()=>{c(),this.plugin.settings[t]=l(),await this.plugin.saveSettings()}),f.addOptions(Ow),o=f}),u=this.addSetting().addText(f=>{f.setPlaceholder(i).onChange(async()=>{this.plugin.settings[t]=l(),await this.plugin.saveSettings()}),new Rr(this.app,f.inputEl).onSelect(()=>{setTimeout(async()=>{this.plugin.settings[t]=l(),await this.plugin.saveSettings()})}),s=f}),p=this.addSetting().addText(f=>{f.setPlaceholder(i).onChange(async()=>{this.plugin.settings[t]=l(),await this.plugin.saveSettings()}),a=f});r(h,u,p),d(this.plugin.settings[t]),c()}addFundingButton(){let t=i=>{let r=i.firstElementChild;(r==null?void 0:r.tagName)==="svg"&&(r.setAttribute("fill","var(--color-red)"),r.setAttribute("stroke","var(--color-red)"))};return this.addHeading("Support development","funding","lucide-heart",({iconEl:i})=>t(i)).setDesc(`If you find PDF++ helpful, please consider supporting the development to help me keep this plugin alive. If you prefer PayPal, please make donations via Ko-fi. Thank you!`).then(i=>{let r=i.infoEl,o=i.settingEl.firstElementChild;if(!o)return;let s=i.settingEl.createDiv();s.appendChild(o),s.appendChild(r),i.settingEl.prepend(s),i.settingEl.id="pdf-plus-funding",s.id="pdf-plus-funding-icon-info-container",o.id="pdf-plus-funding-icon",t(o)}).addButton(i=>{i.setButtonText("GitHub Sponsors").onClick(()=>{open("https://github.com/sponsors/RyotaUshio")})}).addButton(i=>{i.setButtonText("Buy Me a Coffee").onClick(()=>{open("https://www.buymeacoffee.com/ryotaushio")})}).addButton(i=>{i.setButtonText("Ko-fi").onClick(()=>{open("https://ko-fi.com/ryotaushio")})})}async renderMarkdown(t,i){this.promises.push(this._renderMarkdown(t,i)),i.addClass("markdown-rendered")}async _renderMarkdown(t,i){await ge.MarkdownRenderer.render(this.app,Array.isArray(t)?t.join(` `):t,i,"",this.component),i.childNodes.length===1&&i.firstChild instanceof HTMLParagraphElement&&i.replaceChildren(...i.firstChild.childNodes)}addColorSetting(t){let i=this.plugin.settings.colors,[r,o]=Object.entries(i)[t],s=o;return this.addSetting().addText(a=>{a.setPlaceholder("Color name (case-insensitive)").then(c=>{c.inputEl.size=c.inputEl.placeholder.length,(0,ge.setTooltip)(c.inputEl,"Color name (case-insensitive)")}).setValue(r).onChange(async c=>{if(c in i){new ge.Notice("This color name is already used."),a.inputEl.addClass("error");return}a.inputEl.removeClass("error"),delete i[r];for(let l of["defaultColor","backlinkHoverColor"]){let d=this.items[l];if(d){let h=d.components[0].selectEl.querySelector(`:scope > option:nth-child(${t+2})`);h&&(h.value=c,h.textContent=c)}}this.plugin.settings.defaultColor===r&&(this.plugin.settings.defaultColor=c),r=c,i[r]=o,await this.plugin.saveSettings(),this.plugin.loadStyle()})}).addColorPicker(a=>{a.setValue(o),a.onChange(async c=>{s=o,o=c,i[r]=o,await this.plugin.saveSettings(),this.plugin.loadStyle()})}).addExtraButton(a=>{a.setIcon("rotate-ccw").setTooltip("Return to previous color").onClick(async()=>{o=s,i[r]=o,await this.plugin.saveSettings(),this.plugin.loadStyle(),this.redisplay()})}).addExtraButton(a=>{a.setIcon("trash").setTooltip("Delete").onClick(async()=>{this.plugin.settings.defaultColor===r&&(this.plugin.settings.defaultColor=""),delete i[r],await this.plugin.saveSettings(),this.plugin.loadStyle(),this.redisplay()})})}addNameValuePairListSetting(t,i,r,o,s){let{getName:a,setName:c,getValue:l,setValue:d}=o,h=t[i],u=a(h),p=l(h);return this.addSetting().addText(f=>{f.setPlaceholder(s.name.placeholder).then(m=>{m.inputEl.size=s.name.formSize,(0,ge.setTooltip)(m.inputEl,s.name.placeholder)}).setValue(u).onChange(async m=>{if(t.some(g=>a(g)===m)){new ge.Notice(s.name.duplicateMessage),f.inputEl.addClass("error");return}f.inputEl.removeClass("error"),c(h,m);let x=this.items[r];if(x){let g=x.components[0].selectEl.querySelector(`:scope > option:nth-child(${i+1})`);g&&(g.value=m,g.textContent=m)}await this.plugin.saveSettings()})}).then(f=>{s.value.hasOwnProperty("formRows")?f.addTextArea(m=>{m.setPlaceholder(s.value.placeholder).then(x=>{x.inputEl.rows=s.value.formRows,x.inputEl.cols=s.value.formSize,(0,ge.setTooltip)(x.inputEl,s.value.placeholder)}).setValue(p).onChange(async x=>{d(h,x),await this.plugin.saveSettings()})}):f.addText(m=>{m.setPlaceholder(s.value.placeholder).then(x=>{x.inputEl.size=s.value.formSize,(0,ge.setTooltip)(x.inputEl,s.value.placeholder)}).setValue(p).onChange(async x=>{d(h,x),await this.plugin.saveSettings()})})}).addExtraButton(f=>{f.setIcon("trash").setTooltip("Delete").onClick(async()=>{if(t.length===1){new ge.Notice(s.delete.deleteLastMessage);return}t.splice(i,1),this.plugin.settings[r]>i?this.plugin.settings[r]--:this.plugin.settings[r]===i&&(this.plugin.settings[r]=0),await this.plugin.saveSettings(),this.redisplay()})}).setClass("no-border")}addNamedTemplatesSetting(t,i,r,o){return this.addNameValuePairListSetting(t,i,r,{getName:s=>s.name,setName:(s,a)=>{s.name=a},getValue:s=>s.template,setValue:(s,a)=>{s.template=a}},o)}addDisplayTextSetting(t){return this.addNamedTemplatesSetting(this.plugin.settings.displayTextFormats,t,"defaultDisplayTextFormatIndex",{name:{placeholder:"Format name",formSize:30,duplicateMessage:"This format name is already used."},value:{placeholder:"Display text format",formSize:50},delete:{deleteLastMessage:"You cannot delete the last display text format."}})}addCopyCommandSetting(t){return this.addNamedTemplatesSetting(this.plugin.settings.copyCommands,t,"defaultColorPaletteActionIndex",{name:{placeholder:"Format name",formSize:30,duplicateMessage:"This format name is already used."},value:{placeholder:"Copied text format",formSize:50,formRows:3},delete:{deleteLastMessage:"You cannot delete the last copy format."}})}addHotkeySettingButton(t,i){t.addButton(r=>{r.setButtonText("Open hotkeys settings").onClick(()=>{this.plugin.openHotkeySettingTab(i)})})}addPagePreviewSettingButton(t){return t.addButton(i=>{i.setButtonText("Open page preview settings").onClick(()=>{this.app.setting.openTabById("page-preview")})})}addRequireModKeyOnHoverSetting(t){let i=this.app.workspace.hoverLinkSources[t].display,r=this.plugin.requireModKeyForLinkHover(t);return this.addSetting().setName(`Require ${_n} key while hovering`).setDesc(`Currently ${r?"required":"not required"}. You can toggle this on and off in the core Page Preview plugin settings > ${i}.`).then(o=>this.addPagePreviewSettingButton(o))}addIconSetting(t,i){let r=a=>a.startsWith("lucide-")?a.slice(7):a,o=a=>a.startsWith("lucide-")?a:"lucide-"+a,s=a=>{var d;let c=(d=a.controlEl.querySelector(":scope>.icon-preview"))!=null?d:a.controlEl.createDiv("icon-preview");(0,ge.setIcon)(c,o(this.plugin.settings[t]));let l=a.components[0];(!i||this.plugin.settings[t])&&!c.childElementCount?(l.inputEl.addClass("error"),(0,ge.setTooltip)(l.inputEl,"No icon found")):(l.inputEl.removeClass("error"),(0,ge.setTooltip)(l.inputEl,""))};return this.addTextSetting(t,void 0,a=>{this.plugin.settings[t]=r(this.plugin.settings[t]),this.plugin.saveSettings(),s(a)}).then(a=>{this.renderMarkdown(["You can use any icon from [Lucide](https://lucide.dev/icons)."+(i?" Leave blank to remove icons.":"")],a.descEl)}).then(s)}addProductMenuSetting(t,i){let r=Jn[t],o={color:"Colors","copy-format":"Copy format",display:"Display text format"},s=this.plugin.settings[t],a=this.addHeading(i,t);a.addExtraButton(d=>{d.setTooltip("Reset").setIcon("rotate-ccw").onClick(()=>{s.length=0,s.push(...r),this.redisplay()})});let c=[],l=r.slice();for(let d=0;d0){if(!ge.Platform.isDesktopApp)return;let h=c[d-1].getValue();if(!h)return;l.remove(h)}this.addSetting().then(h=>{ge.Platform.isDesktopApp&&h.setName(d===0?"Top-level menu":d===1?"Submenu":"Subsubmenu")}).addDropdown(h=>{var p;for(let f of l)h.addOption(f,o[f]);d>0&&h.addOption("","None");let u=(p=s[d])!=null?p:"";u&&!l.includes(u)&&l[0]&&(s[d]=l[0],u=s[d]),h.setValue(u).onChange(f=>{if(f)s[d]=f;else for(;s.length>d;)s.pop();this.plugin.saveSettings(),this.redisplay()}),c.push(h)}).then(h=>{h.settingEl.addClasses(["no-border","small-padding"])})}return a}createLinkTo(t,i){return createEl("a","",r=>{r.onclick=o=>{this.scrollTo(t,{behavior:"smooth"}),this.updateHeaderElClassOnScroll(o)},activeWindow.setTimeout(()=>{let o=this.items[t];!i&&o&&(i='"'+o.nameEl.textContent+'"'),r.setText(i!=null?i:"")})})}createLinkToHeading(t,i){return createEl("a","",r=>{r.onclick=o=>{this.scrollToHeading(t,{behavior:"smooth"}),this.updateHeaderElClassOnScroll(o)},activeWindow.setTimeout(()=>{let o=this.headings.get(t);!i&&o&&(i='"'+o.nameEl.textContent+'"'),r.setText(i!=null?i:"")})})}redisplay(){let t=this.contentEl.scrollTop;this.display(),this.contentEl.scroll({top:t}),this.events.trigger("update")}async display(){var c,l;Da.openIfNecessary(this.plugin),this.plugin.checkDeprecatedSettings(),this.headerContainerEl.empty(),this.contentEl.empty(),this.promises=[],this.component.load(),activeWindow.setTimeout(()=>this.updateHeaderElClass());for(let d of["wheel","touchmove"])this.component.registerDomEvent(this.contentEl,d,(0,ge.debounce)(()=>this.updateHeaderElClass(),100),{passive:!0});this.contentEl.createDiv("top-note",async d=>{await this.renderMarkdown(["> [!TIP]","> - You can easily navigate through the settings by clicking the icons in the header above.","> - Some settings below require reopening tabs or reloading the plugin to take effect.","> - [Visit the docs](https://ryotaushio.github.io/obsidian-pdf-plus/)",'> - '],d);let h=document.getElementById("pdf-plus-funding-link-placeholder");h&&(h.textContent="Help me keep PDF++ alive!",h.onclick=u=>{this.scrollToHeading("funding",{behavior:"smooth"}),this.updateHeaderElClassOnScroll(u)})}),this.addHeading("Editing PDF files","edit","lucide-save").then(d=>{this.renderMarkdown(["By allowing PDF++ to modify PDF files directly, you can:","- Add, edit and delete highlights and links in PDF files.","- Add, insert, delete or extract PDF pages and auto-update links.","- Add, rename, move and delete outline items.","- Edit [page labels](https://ryotaushio.github.io/obsidian-pdf-plus/page-labels.html).","","[Learn more](https://ryotaushio.github.io/obsidian-pdf-plus/editing-pdfs.html)"],d.descEl)}),this.addToggleSetting("enablePDFEdit",()=>this.redisplay()).setName("Enable PDF editing").then(d=>{this.renderMarkdown(['PDF++ will not modify PDF files themselves unless you turn on this option. The author assumes no responsibility for any data corruption. Please make sure you have a backup of your files. Also note that PDF++ currently does not support editing encrypted PDFs.'],d.descEl)}),this.plugin.settings.enablePDFEdit&&this.addTextSetting("author","Your name",d=>{let h=d.components[0].inputEl;h.toggleClass("error",!h.value)}).setName("Annotation author").setDesc("It must contain at least one character in order to make annotations referenceable & editable within Obsidian.").then(d=>{let h=d.components[0].inputEl;h.toggleClass("error",!h.value)}),this.addHeading("Backlink highlighting","backlink-highlight","lucide-highlighter").setDesc('Annotate PDF files with highlights just by linking to text selection. You can easily copy links to selections using color palette in the toolbar. See the "Color palette" section for the details.').then(d=>d.settingEl.addClass("normal-margin-top")),this.addToggleSetting("highlightBacklinks").setName("Highlight backlinks in PDF viewer").setDesc("In the PDF viewer, any referenced text will be highlighted for easy identification."),this.addDesc("Try turning off the following options if you experience performance issues."),this.addToggleSetting("highlightBacklinksInEmbed").setName("Highlight backlinks in PDF embeds"),this.addToggleSetting("highlightBacklinksInCanvas").setName("Highlight backlinks in Canvas"),this.addToggleSetting("highlightBacklinksInHoverPopover").setName("Highlight backlinks in hover popover previews"),this.addDropdownSetting("selectionBacklinkVisualizeStyle",aC).setName("Highlight style").setDesc("How backlinks to a text selection should be visualized."),this.addDropdownSetting("hoverHighlightAction",lC,()=>this.redisplay()).setName("Action when hovering over highlighted text").setDesc(`Easily open backlinks or display a popover preview of it by pressing ${Bt("Mod").toLowerCase()} (by default) while hovering over a highlighted text in PDF viewer.`),this.addRequireModKeyOnHoverSetting("pdf-plus"),this.addToggleSetting("doubleClickHighlightToOpenBacklink").setName("Double click highlighted text to open the corresponding backlink"),this.addHeading("How backlinks are opened","open-backlink").setDesc("Customize how backlinks are opened when "+(this.plugin.settings.hoverHighlightAction==="open"?`${Bt("Mod").toLowerCase()}+hovering over or `:"")+"double-clicking highlighted text."),this.addDropdownSetting("paneTypeForFirstMDLeaf",Ou,()=>this.redisplay()).setName("How to open the markdown file when no markdown file is opened"),(this.plugin.settings.paneTypeForFirstMDLeaf==="left-sidebar"||this.plugin.settings.paneTypeForFirstMDLeaf==="right-sidebar")&&(this.addToggleSetting("alwaysUseSidebar").setName("Always use sidebar to open markdown files from highlighted text").setDesc(`If turned on, the ${this.plugin.settings.paneTypeForFirstMDLeaf==="left-sidebar"?"left":"right"} sidebar will be used whether there is existing markdown tabs or not.`),this.addToggleSetting("singleMDLeafInSidebar").setName("Don't open multiple panes in sidebar").setDesc("Turn this on if you want to open markdown files in a single pane in the sidebar.")),this.addSetting("ignoreExistingMarkdownTabIn").setName("Ignore existing markdown tabs in...").setDesc("If some notes are opened in the ignored splits, PDF++ will still open the backlink in the way specified in the previous setting. For example, you might want to ignore the left sidebar if you are pinning a certain note (e.g. daily note) in it.");let t={leftSplit:"Left sidebar",rightSplit:"Right sidebar",floatingSplit:"Popout windows"},i=this.plugin.settings.ignoreExistingMarkdownTabIn;for(let[d,h]of Object.entries(t)){let u=d;this.addSetting().addToggle(p=>{p.setValue(i.includes(u)).onChange(f=>{f?i.push(u):i.remove(u),this.plugin.saveSettings()})}).then(p=>{p.controlEl.prepend(createEl("span",{text:h})),p.settingEl.addClasses(["no-border","ignore-split-setting"])})}this.addToggleSetting("dontActivateAfterOpenMD").setName("Don't move focus to markdown view after opening a backlink").setDesc("This option will be ignored when you open a link in a tab in the same split as the current tab."),this.addHeading("Colors","color"),this.addSetting("colors").setName("Highlight colors").then(d=>this.renderMarkdown(['You can optionally highlight the selection with **a specified color** by appending "&color=``" to a link text, where `` is one of the colors that you register below. e.g `[[file.pdf#page=1&selection=4,0,5,20&color=red]].` ',"Color names are case-insensitive. ","",'You can ues the color palette in PDF toolbars to easily copy links with "&color=..." appended automatically. See the "Color palette" section for the details.',"",'You can also opt not to use this plugin-dependent notation and apply a single color (the "default highlight color" setting) to all highlights.',"","These colors are also available as CSS variables, e.g. `--pdf-plus-yellow-rgb`. You can use them for various CSS customizations. See [README](https://github.com/RyotaUshio/obsidian-pdf-plus?tab=readme-ov-file#css-customization) for the details."],d.descEl)).addButton(d=>{d.setIcon("plus").setTooltip("Add a new color").onClick(()=>{this.plugin.settings.colors[""]="#",this.redisplay()})});for(let d=0;dthis.redisplay()).setName("Highlight a backlink only if a color is specified").setDesc("By default, all backlinks are highlighted. If this option is enabled, a backlink will be highlighted only when a color is specified in the link text."),this.plugin.settings.highlightColorSpecifiedOnly||this.addDropdownSetting("defaultColor",["",...Object.keys(this.plugin.settings.colors)],d=>d||"Obsidian default",()=>this.plugin.loadStyle()).setName("Default highlight color").setDesc("If no color is specified in link text, this color will be used."),this.addHeading("Backlink indicator bounding rectangles","backlink-bounding-rect"),this.addToggleSetting("showBoundingRectForBacklinkedAnnot").setName("Show bounding rectangles for backlinked annotations").setDesc("Bounding rectangles will be shown for annotations with backlinks."),this.addHeading("Backlink indicator icons","backlink-icon").setDesc("Show icons for text selections, annotations, offsets and rectangular selections with backlinks."),this.addToggleSetting("showBacklinkIconForSelection").setName("Show icon for text selection with backlinks"),this.addToggleSetting("showBacklinkIconForAnnotation").setName("Show icon for annotation with backlinks"),this.addToggleSetting("showBacklinkIconForOffset").setName("Show icon for offset backlinks"),this.addToggleSetting("showBacklinkIconForRect").setName("Show icon for rectangular selection backlinks"),this.addSliderSetting("backlinkIconSize",10,100,5).setName("Icon size"),this.addHeading("Rectangular selection embeds","rect","lucide-box-select").then(d=>{this.renderMarkdown(["You can embed a specified rectangular area from a PDF page into your note. [Learn more](https://ryotaushio.github.io/obsidian-pdf-plus/embedding-rectangular-selections.html)"],d.descEl)}),this.addToggleSetting("rectEmbedStaticImage",()=>this.redisplay()).setName("Paste as image").setDesc("By default, rectangular selection embeds are re-rendered every time you open the markdown file, which can slow down the loading time. Turn on this option to replace them with static images and improve the performance."),this.plugin.settings.rectEmbedStaticImage&&(this.addDropdownSetting("rectImageFormat",{file:"Create & embed image file","data-url":"Embed as data URL"},()=>this.redisplay()).setName("How to embed the image").then(d=>this.renderMarkdown(['- "Create & embed image file": Create an image file and embed it in the markdown file. The image file will be saved in the folder you specify in the "Default location for new attachments" setting in the core Obsidian settings.',`- "Embed as data URL": Embed the image as a [data URL](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/Data_URLs) without creating a file. This option is useful when you don't want to mess up your attachment folder. It also helps you make your notes self-contained.`],d.descEl)),this.plugin.settings.rectImageFormat==="file"&&this.addDropdownSetting("rectImageExtension",dC).setName("Image file format")),this.addToggleSetting("rectFollowAdaptToTheme").setName('Follow "adapt to theme" setting').setDesc('If enabled, rectangular selection embeds will be inverted in color when the "Adapt to theme" setting is enabled in the PDF toolbar. This will help you reduce eye strain in dark mode.'),this.addSliderSetting("rectEmbedResolution",10,200,1).setName("Rendering resolution").setDesc("The higher the value, the better the rendering quality, but the longer time it takes to render. The default value is 100."),this.addToggleSetting("includeColorWhenCopyingRectLink").setName("Include the selected color's name when copying a link to a rectangular selection").setDesc("When enabled, the name of the color selected in the color palette will be included in the link text. As a result, the rectangular selection will be highlighted with the specified color in the PDF viewer."),this.addToggleSetting("zoomToFitRect").setName("Zoom to fit rectangular selection when opening link").setDesc(createFragment(d=>{d.appendText("When enabled, the PDF viewer will zoom to fit the rectangular selection when you open a link to it. Otherwise, the viewer will keep the current zoom level. "),d.appendText("Note: check out the "),d.appendChild(this.createLinkTo("dblclickEmbedToOpenLink")),d.appendText(" option as well.")})),this.addHeading("PDF++ callouts","callout","lucide-quote").then(d=>{this.renderMarkdown("Create [callouts](https://help.obsidian.md/Editing+and+formatting/Callouts) with the same color as the highlight color without any CSS snippet scripting.",d.descEl)}),this.addToggleSetting("useCallout").setName("Use PDF++ callouts").then(d=>{this.renderMarkdown(["You can also disable this option and choose to use your own custom [CSS snippets](https://help.obsidian.md/Extending+Obsidian/CSS+snippets). See our [README](https://github.com/RyotaUshio/obsidian-pdf-plus?tab=readme-ov-file#css-customization) for the details."],d.descEl)}),this.addTextSetting("calloutType",void 0,()=>this.redisplay()).setName("Callout type name").then(d=>{var p,f;let h=this.plugin.settings.calloutType,u=(f=(p=Object.keys(this.plugin.settings.colors).first())==null?void 0:p.toLowerCase())!=null?f:"yellow";this.renderMarkdown([`For example, if this is set to "${h}", use the following syntax to insert a callout with color "${u}":`,"","```markdown",`> [!${h}|${u}] Title`,"> Content","```","",'You can also use explicit RGB color values like "255, 208, 0" instead of color names.',"I recommend setting this as a custom color palette action in the setting below, like so:","","```markdown","> [!{{calloutType}}|{{color}}] {{linkWithDisplay}}","> {{text}}","```"],d.descEl)}),this.addIconSetting("calloutIcon",!0).setName("Callout icon"),this.addHeading("PDF toolbar","toolbar","lucide-palette"),this.addToggleSetting("hoverableDropdownMenuInToolbar").setName("Hoverable dropdown menus").setDesc("(Not supported on smartphones) When enabled, the dropdown menus (\u2304) in the PDF toolbar will be opened by hovering over the icon, and you don't need to click it."),this.addToggleSetting("zoomLevelInputBoxInToolbar").setName("Show zoom level box").setDesc("A input box will be added to the PDF toolbar, which indicated the current zoom level and allows you to set the zoom level by typing a number."),this.addHeading("Color palette","palette").setDesc('Clicking a color while selecting a range of text will copy a link to the selection with "&color=..." appended.'),this.addToggleSetting("colorPaletteInToolbar",()=>{this.redisplay(),this.plugin.loadStyle()}).setName("Show color palette in the toolbar").setDesc("A color palette will be added to the toolbar of the PDF viewer."),this.plugin.settings.colorPaletteInToolbar&&(this.addToggleSetting("noColorButtonInColorPalette",()=>this.plugin.loadStyle()).setName('Show "without specifying color" button in the color palette'),this.addToggleSetting("colorPaletteInEmbedToolbar",()=>this.plugin.loadStyle()).setName("Show color palette in PDF embeds as well"),this.addIndexDropdownSetting("defaultColorPaletteItemIndex",["",...Object.keys(this.plugin.settings.colors)],d=>d||"Don't specify").setName("Default color selected in color palette").setDesc("This color will be selected in the color palette in a newly opened PDF viewer."),this.addToggleSetting("syncColorPaletteItem",()=>this.redisplay()).setName("Share a single color among all color palettes").setDesc("If disabled, you can specify a different color for each color palette."),this.plugin.settings.syncColorPaletteItem&&this.addToggleSetting("syncDefaultColorPaletteItem").setName("Share the color with newly opened color palettes as well"),this.addToggleSetting("quietColorPaletteTooltip").setName("Quiet tooltips in color palette").setDesc(`When disabled${Jn.quietColorPaletteTooltip?"":" (default)"}, the tooltip will show the color name as well as the selected copy format and display text format. If enabled, only the color name will be shown.`)),this.addHeading("Viewer options","viewer-option","lucide-monitor"),this.addSetting("defaultZoomValue").setName("Default zoom level").setDesc("This option will be ignored in PDF embeds.").addDropdown(d=>{d.addOptions({"page-width":"Fit width","page-height":"Fit height","page-fit":"Fit page",custom:"Custom..."}).setValue(this.plugin.settings.defaultZoomValue.startsWith("page-")?this.plugin.settings.defaultZoomValue:"custom").onChange(async h=>{h==="custom"&&(h="100"),this.plugin.settings.defaultZoomValue=h,r(),await this.plugin.saveSettings()})});let r=this.getVisibilityToggler(this.addSetting().setName("Custom zoom level (%)").addSlider(d=>{d.setLimits(10,400,5).setDynamicTooltip().setValue(this.plugin.settings.defaultZoomValue.startsWith("page-")?100:parseInt(this.plugin.settings.defaultZoomValue)).onChange(async h=>{this.plugin.settings.defaultZoomValue=""+h,await this.plugin.saveSettings()})}),()=>!this.plugin.settings.defaultZoomValue.startsWith("page-"));this.addEnumDropdownSetting("scrollModeOnLoad",{0:"Vertical",1:"Horizontal",3:"In-page",2:"Wrapped"},()=>o()).setName("Default scroll mode");let o=this.getVisibilityToggler(this.addEnumDropdownSetting("spreadModeOnLoad",{0:"Single page",1:"Two page (odd)",2:"Two page (even)"}).setName("Default spread mode"),()=>this.plugin.settings.scrollModeOnLoad!==2);if(this.addToggleSetting("usePageUpAndPageDown").setName("Use PageUp/PageDown key to go to previous/next page").setDesc(createFragment(d=>{d.appendText("You need to reopen PDF viewers after changing this option. Note that you can achieve the same thing (and even more advanced stuff) using "),d.appendChild(this.createLinkToHeading("vim","Vim keybindings")),d.appendText(".")})),this.addHeading("Context menu in PDF viewer","context-menu","lucide-mouse-pointer-click").setDesc("(Desktop & tablet only) Customize the behavior of the context menu that pops up when you right-click in the PDF viewer. For mobile users, see also the next section."),this.addToggleSetting("replaceContextMenu",()=>this.redisplay()).setName("Replace the built-in context menu with PDF++'s custom menu"),!this.plugin.settings.replaceContextMenu)this.addSetting().setName("Display text format").setDesc('You can customize the display text format in the setting "Copied text foramt > Display text format" below.');else{this.addToggleSetting("showContextMenuOnTablet").setName("Show context menu on tablet devices as well").setDesc('By default, Obsidian does not show the context menu after text selection on mobile devices, including tablets (iPad, etc.). If you want to show the context menu on tablets, turn this option on. Even if this option is turned off, you copy select the OS-native "Copy" option to run the "'+this.plugin.lib.commands.stripCommandNamePrefix(this.plugin.lib.commands.getCommand("copy-link-to-selection").name)+'" command.');let d=mg();this.addDropdownSetting("showContextMenuOnMouseUpIf",{always:"Always",...Object.fromEntries(Object.entries(d).map(([h,u])=>[h,`${u} key is pressed`])),never:"Never"}).setName("Show the context menu right after selecting text when...").setDesc(createFragment(h=>{h.appendText("If "),h.appendChild(this.createLinkToHeading("auto-copy","auto-copy")),h.appendText(" is enabled, it will be prioritized and the context menu will not be shown.")}));{this.addHeading("Menu items","context-menu-items").setDesc("Customize which menu items to show.");let h={action:'Look up "(selection)"',selection:"Copy link to selection","write-file":`Add ${this.plugin.settings.selectionBacklinkVisualizeStyle} to file`,annotation:"Copy link to annotation","modify-annotation":"Edit/delete annotation",link:"Copy PDF link / Search on Google Scholar / Paste copied PDF link to selection / Copy URL",text:"Copy selected text / Copy annotated text",search:"Copy link to search",speech:"Read aloud selected text",page:"Copy link to page",settings:"Customize menu..."},u=this.plugin.settings.contextMenuConfig,p=[];for(let f=0;f{g.setValue(m.visible).onChange(b=>{m.visible=b,this.plugin.saveSettings()})}).then(g=>{m.id==="action"?g.setDesc("Available only on macOS."):m.id==="write-file"||m.id==="modify-annotation"?g.setDesc(createFragment(b=>{b.appendText("Requires "),b.appendChild(this.createLinkTo("enablePDFEdit","PDF editing")),b.appendText(" to be enabled.")})):m.id==="link"?g.setDesc('"Search on Google Scholar": Available when right-clicking citation links in PDFs.'):m.id==="speech"?g.setDesc(createFragment(b=>{b.appendText("Requires the "),b.createEl("a",{text:"Text to Speech",href:"obsidian://show-plugin?id=obsidian-tts"}),b.appendText(" plugin to be enabled.")})):m.id==="page"&&g.setDesc("Available when right-clicking with no text selected.")}))}}this.addDesc("Customize nested menus."),this.addProductMenuSetting("selectionProductMenuConfig","Copy link to selection"),this.addProductMenuSetting("writeFileProductMenuConfig",`Add ${this.plugin.settings.selectionBacklinkVisualizeStyle} to file`),this.addProductMenuSetting("annotationProductMenuConfig","Copy link to annotation"),this.addToggleSetting("updateColorPaletteStateFromContextMenu").setName("Update color palette from context menu").setDesc(`In the context menu, the items (color, copy format and display text format) set in the color palette are selected by default. If this option is enabled, selecting a menu item will also update the color palette state and hence the default-selected items in the context menu as well. Even if this option is enabled, you can prevent the color palette from being updated by holding down the ${Bt("Mod")} key while selecting the menu item.`)}this.addHeading("Copying on mobile","mobile-copy","lucide-smartphone"),this.addDropdownSetting("mobileCopyAction",hC).setName('Action triggered by selecting "Copy" option on mobile devices'),this.addHeading("Copying links via hotkeys","copy-hotkeys","lucide-keyboard"),this.addSetting().setName("Set up hotkeys for copying links").then(d=>{this.renderMarkdown(["PDF++ offers two commands for quickly copying links via hotkeys.","","1. **Copy link to selection or annotation:**"," Copies a link to the text selection or focused annotation in the PDF viewer, which is formatted according to the options specified in the PDF toolbar.",'
If the "Add highlights to file directly" toggle switch in the PDF toolbar is on, it first adds a highlight annotation directly to the PDF file, and then copies the link to the created annotation.',"2. **Copy link to current page view:** Copies a link, clicking which will open the PDF file at the current scroll position and zoom level.","",'After running this command, you can add the copied link to the PDF file itself: select a range of text, right-click, and then click "Paste copied link to selection".'],d.descEl)}).then(d=>this.addHotkeySettingButton(d,`${this.plugin.manifest.name}: Copy link`)),this.addSetting().setName("Further workflow enhancements").setDesc(createFragment(d=>{d.appendText("See the "),d.appendChild(this.createLinkToHeading("auto",'"Auto-copy / auto-focus / auto-paste"')),d.appendText(" section below.")})),this.addHeading("Other shortcut commands","other-hotkeys","lucide-layers-2"),this.addSetting().then(d=>{this.renderMarkdown(["PDF++ also offers the following commands for reducing mouse clicks on the PDF toolbar by assigning hotkeys to them.","","- **Show outline** / **show thumbnail**","- **Close PDF siderbar**","- **Zoom in** / **zoom out**","- **Fit width** / **fit height**","- **Go to page**: This command brings the cursor to the page number input field in the PDF toolbar. Enter a page number and press Enter to jump to the page.","- **Show copy format menu** / **show display text format menu**: By running thes commands via hotkeys and then using the arrow keys, you can quickly select a format from the menu without using the mouse.","- **Enable PDF edit** / **disable PDF edit**","- And more..."],d.descEl)}).then(d=>this.addHotkeySettingButton(d)),this.addToggleSetting("executeBuiltinCommandForOutline").setName(`Show outline: when the active file is not PDF, run the core Outline plugin's "Show outline" command`).setDesc("By turning this on, you can use the same hotkey to show the outline of a markdown file and a PDF file without key conflict."),this.addToggleSetting("closeSidebarWithShowCommandIfExist").setName("Show outline / show thumbnail: close the sidebar if it is already open").setDesc("Enabling this will allow you to use the same hotkey to close the sidebar if it is already open."),this.addToggleSetting("executeBuiltinCommandForZoom").setName('Zoom in / zoom out: when the active file is not PDF, run the built-in "Zoom in" / "Zoom out" command').setDesc("By turning this on, you can use the same hotkey to zoom in/out a PDF viewer or any other type of view without key conflict."),this.addToggleSetting("executeFontSizeAdjusterCommand").setName(`Zoom in / zoom out: when the active file is not PDF, run Font Size Adjuster's "Increment font size" / "Decrement font size" command`).then(d=>{this.renderMarkdown(["(Requires the [Font Size Adjuster](obsidian://show-plugin?id=font-size) plugin enabled) ",'If both of this option and the above option are enabled, this option will be prioritized. The built-in "Zoom in" / "Zoom out" command will be executed if Font Size Adjuster is not installed or disabled.'],d.descEl)}),this.addHeading("Copy templates","template","lucide-copy").setDesc("The template format that will be used when copying a link to a selection or an annotation in PDF viewer. "),this.addSetting().then(d=>this.renderMarkdown(["Each `{{...}}` will be evaluated as a JavaScript expression given the variables listed below.","","Available variables are:","","- `file` or `pdf`: The PDF file ([`TFile`](https://docs.obsidian.md/Reference/TypeScript+API/TFile)). Use `file.basename` for the file name without extension, `file.name` for the file name with extension, `file.path` for the full path relative to the vault root, etc.","- `page`: The page number (`Number`). The first page is always page 1.","- `pageLabel`: The page number displayed in the counter in the toolbar (`String`). This can be different from `page`.",` - **Tip**: You can modify page labels with PDF++'s "Edit page labels" command.`,"- `pageCount`: The total number of pages (`Number`).","- `text` or `selection`: The selected text (`String`). In the case of links to annotations written directly in the PDF file, this is the text covered by the annotation.",'- `comment`: In the case of links to annotations written directly in the PDF file, this is the comment associated with the annotation (`String`). Otherwise, it is an empty string `""`.',"- `folder`: The folder containing the PDF file ([`TFolder`](https://docs.obsidian.md/Reference/TypeScript+API/TFolder)). This is an alias for `file.parent`.","- `obsidian`: The Obsidian API. See the [official developer documentation](https://docs.obsidian.md/Home) and the type definition file [`obsidian.d.ts`](https://github.com/obsidianmd/obsidian-api/blob/master/obsidian.d.ts) for the details.","- `dv`: Available if the [Dataview](obsidian://show-plugin?id=dataview) plugin is enabled. See Dataview's [official documentation](https://blacksmithgu.github.io/obsidian-dataview/api/code-reference/) for the details. You can use it almost the same as the `dv` variable available in `dataviewjs` code blocks, but there are some differences. For example, `dv.current()` is not available.","- `quickAddApi`: Available if the [QuickAdd](obsidian://show-plugin?id=quickadd) plugin is enabled. See QuickAdd's [official documentation](https://quickadd.obsidian.guide/docs/QuickAddAPI) for the details.","- `app`: The global Obsidian app object ([`App`](https://docs.obsidian.md/Reference/TypeScript+API/App)).","- and other global variables such as:",' - [`moment`](https://momentjs.com/docs/#/displaying/): For exampe, use `moment().format("YYYY-MM-DD")` to get the current date in the "YYYY-MM-DD" format.',"",`Additionally, you have access to the following variables when the PDF file has a corresponding markdown file specified via the "${this.plugin.settings.proxyMDProperty}" property(see the "Property to associate a markdown file to a PDF file" setting below): `,"","- `md`: The markdown file associated with the PDF file ([`TFile`](https://docs.obsidian.md/Reference/TypeScript+API/TFile)). If there is no such file, this is `null`.","- `properties`: The properties of `md` as an `Object` mapping each property name to the corresponding value. If `md` is `null` or the `md` has no properties, this is an empty object `{}`.",'\nThe following variables are deprecated and will be removed in the near future: `linkedFile`, `linkedFileProperties`. Remove them from your templates if you are using them.'],d.descEl)),this.addTextSetting("proxyMDProperty",void 0,()=>this.redisplay()).setName("Property to associate a markdown file to a PDF file").then(d=>{this.renderMarkdown(["Create a markdown file with this property to associate it with a PDF file. The PDF file is specified by a link, e.g. `[[file.pdf]]`.","It can be used to store properties/metadata that can be used when copying links.","",'[Dataview](obsidian://show-plugin?id=dataview)\'s inline field syntax such as `'+this.plugin.settings.proxyMDProperty+":: [[file.pdf]]` is supported for the time being, but it is deprecated and will likely not work in the future.","","Remarks:","- Make sure the associated markdown file can be uniquely identified. For example, if you have two markdown files `file1.md` and `file2.md` and both of their `"+this.plugin.settings.proxyMDProperty+"` properties point to the same PDF file, PDF++ cannot determine which markdown file is associated with `file.pdf`. However, PDF++ v1.0.0 or later will add support for this.","- If you are in Source Mode, be sure to enclose the link in double quotes."],d.descEl)}),this.addSetting("displayTextFormats").setName("Display text format").then(d=>this.renderMarkdown(["This format will be also used when copying a link to a selection or an annotation from the context menu."],d.descEl)).addButton(d=>{d.setIcon("plus").setTooltip("Add a new display text format").onClick(()=>{this.plugin.settings.displayTextFormats.push({name:"",template:""}),this.redisplay()})});for(let d=0;dd.name),void 0,()=>{this.plugin.loadStyle()}).setName("Default display text format"),this.addToggleSetting("syncDisplayTextFormat").setName("Share a single display text format among all PDF viewers").setDesc("If disabled, you can specify a different display text format for each PDF viewer from the dropdown menu in the PDF toolbar."),this.plugin.settings.syncDisplayTextFormat&&this.addToggleSetting("syncDefaultDisplayTextFormat").setName("Share the display text format with newly opened PDF viewers as well"),this.addSetting("copyCommands").setName("Custom copy formats").then(d=>this.renderMarkdown(["Customize the format to use when you copy a link by clicking a color palette item or running the commands while selecting a range of text in PDF viewer.","","In addition to the variables listed above, here you can use","","- `link`: The link without display text, e.g. `[[file.pdf#page=1&selection=0,1,2,3&color=red]]`,","- `linkWithDisplay`: The link with display text, e.g. `[[file.pdf#page=1&selection=0,1,2,3&color=red|file, page 1]]`,",'- `linktext`: The text content of the link without brackets and the display text, e.g. `file.pdf#page=1&selection=0,1,2,3&color=red`
(if the "Use \\[\\[Wikilinks\\]\\]" setting is turned off, `linktext` will be properly encoded for use in markdown links),',"- `display`: The display text formatted according to the above setting, e.g. `file, page 1`,","- `linkToPage`: The link to the page without display text, e.g. `[[file.pdf#page=1]]`,","- `linkToPageWithDisplay`: The link to the page with display text, e.g. `[[file.pdf#page=1|file, page 1]]`,",`- \`calloutType\`: The callout type you specify in the "Callout type name" setting above, in this case, "${this.plugin.settings.calloutType}", and`,"- `color` (or `colorName`): In the case of text selections, this is the name of the selected color in lowercase, e.g. `red`. If no color is specified, it will be an empty string. For text markup annotations (e.g. highlights and underlines), this is the RGB value of the color, e.g. `255,208,0`."],d.descEl)).addButton(d=>{d.setIcon("plus").setTooltip("Add a new copy command").onClick(()=>{this.plugin.settings.copyCommands.push({name:"",template:""}),this.redisplay()})});for(let d=0;dd.name),void 0,()=>{this.plugin.loadStyle()}).setName("Default action when clicking on color palette"),this.addToggleSetting("syncColorPaletteAction").setName("Share a single action among all PDF viewers").setDesc("If disabled, you can specify a different action for each PDF viewer from the dropdown menu in the PDF toolbar."),this.plugin.settings.syncColorPaletteAction&&this.addToggleSetting("syncDefaultColorPaletteAction").setName("Share the action with newly opened PDF viewers as well"),this.addToggleSetting("useAnotherCopyTemplateWhenNoSelection",()=>this.redisplay()).setName("Use another template when no text is selected").setDesc("For example, you can use this to copy a link to the page when there is no selection."),this.plugin.settings.useAnotherCopyTemplateWhenNoSelection&&this.addTextSetting("copyTemplateWhenNoSelection").setName("Link copy template used when no text is selected"),this.addHeading("Auto-copy / auto-focus / auto-paste","auto","lucide-zap").setDesc("Speed up the process of copying & pasting PDF links to your notes with some automation. Note that you can't activate both of auto-focus and auto-paste at the same time."),this.addHeading("Auto-copy","auto-copy").setDesc(`If enabled, the "Copy link to selection or annotation" command will be triggered automatically every time you select a range of text in a PDF viewer, meaning you don't even have to press a hotkey to copy a link.`),this.addToggleSetting("autoCopy",()=>this.plugin.autoCopyMode.toggle(this.plugin.settings.autoCopy)).setName("Enable").setDesc("You can also toggle auto-focus via an icon in the left ribbon menu if the next setting is enabled."),this.addToggleSetting("autoCopyToggleRibbonIcon",()=>this.redisplay()).setName("Show an icon to toggle auto-copy in the left ribbon menu").setDesc("You can also toggle this mode via a command. Reload the plugin after changing this setting to take effect."),this.plugin.settings.autoCopyToggleRibbonIcon&&this.addIconSetting("autoCopyIconName",!1).setName("Icon name").then(d=>{d.descEl.appendText(" Reload the plugin after changing this setting to take effect.")}),this.addHeading("Auto-focus","auto-focus").setDesc("If enabled, a markdown file will be focused automatically after copying a link to PDF text selection or annotation."),this.addSetting("autoFocus").setName("Enable").setDesc("Recommended if you prefer something less agressive than auto-paste. You can also toggle auto-focus via an icon in the left ribbon menu if the next setting is enabled.").addToggle(d=>{d.setValue(this.plugin.settings.autoFocus).onChange(h=>{this.plugin.toggleAutoFocus(h),this.redisplay()})}),this.addToggleSetting("autoFocusToggleRibbonIcon",()=>this.redisplay()).setName("Show an icon to toggle auto-focus in the left ribbon menu").setDesc("You can also toggle auto-focus via a command. Reload the plugin after changing this setting to take effect."),this.plugin.settings.autoFocusToggleRibbonIcon&&this.addIconSetting("autoFocusIconName",!1).setName("Icon name").then(d=>{d.descEl.appendText(" Reload the plugin after changing this setting to take effect.")}),this.addDropdownSetting("autoFocusTarget",Bw).setName("Target markdown file to focus on"),this.addHeading("Auto-paste","auto-paste").setDesc("If enabled, the copied link to PDF text selection or annotation will be automatically pasted into a markdown file right after copying."),this.addSetting("autoPaste").setName("Enable").setDesc("You can also toggle auto-paste via an icon in the left ribbon menu if the next setting is enabled.").addToggle(d=>{d.setValue(this.plugin.settings.autoPaste).onChange(h=>{this.plugin.toggleAutoPaste(h),this.redisplay()})}),this.addToggleSetting("autoPasteToggleRibbonIcon",()=>this.redisplay()).setName("Show an icon to toggle auto-paste in the left ribbon menu").setDesc("You can also toggle auto-paste via a command. Reload the plugin after changing this setting to take effect."),this.plugin.settings.autoPasteToggleRibbonIcon&&this.addIconSetting("autoPasteIconName",!1).setName("Icon name").then(d=>{d.descEl.appendText(" Reload the plugin after changing this setting to take effect.")}),this.addDropdownSetting("autoPasteTarget",Bw).setName("Target markdown file to paste links to"),this.addToggleSetting("focusEditorAfterAutoPaste",()=>this.events.trigger("update")).setName("Focus editor after auto-pasting").setDesc("If enabled, auto-paste will focus on the editor after pasting."),this.showConditionally(this.addToggleSetting("clearSelectionAfterAutoPaste").setName("Clear text selection after auto-pasting").setDesc("If enabled, the text selection in the PDF viewer will be automatically cleared after performing auto-pasting."),()=>!this.plugin.settings.focusEditorAfterAutoPaste),this.addToggleSetting("respectCursorPositionWhenAutoPaste",()=>this.events.trigger("update")).setName("Respect current cursor position").setDesc("When enabled, triggering auto-pasting will paste the copied text at the current cursor position if the target note is already opened. If disabled, the text will be always appended to the end of the note."),this.showConditionally(this.addToggleSetting("blankLineAboveAppendedContent").setName("Blank line above the appended content").setDesc("Because you disabled the option above, auto-pasted content will be added at the end of your note. Enable this option to make sure that you have a blank line between the existing content and the newly added content."),()=>!this.plugin.settings.respectCursorPositionWhenAutoPaste),this.addHeading("General","auto-general").setDesc("General settings that apply to both auto-focus and auto-paste."),this.addToggleSetting("openAutoFocusTargetIfNotOpened",()=>this.redisplay()).setName("Open target markdown file if not opened"),this.plugin.settings.openAutoFocusTargetIfNotOpened&&(this.addDropdownSetting("howToOpenAutoFocusTargetIfNotOpened",{...Ou,"hover-editor":"Hover Editor"},()=>this.redisplay()).setName("How to open target markdown file when not opened").then(d=>{this.renderMarkdown('The "Hover Editor" option is available if the [Hover Editor](obsidian://show-plugin?id=obsidian-hover-editor) plugin is enabled.',d.descEl),this.plugin.settings.howToOpenAutoFocusTargetIfNotOpened==="hover-editor"&&(this.app.plugins.plugins["obsidian-hover-editor"]||d.descEl.addClass("error"))}),this.showConditionally(this.addToggleSetting("closeHoverEditorWhenLostFocus").setName("Close Hover Editor when it loses focus").setDesc("This option will not affect the behavior of Hover Editor outside of PDF++."),()=>this.plugin.settings.howToOpenAutoFocusTargetIfNotOpened==="hover-editor"),this.addToggleSetting("closeSidebarWhenLostFocus").setName("Auto-hide sidebar when it loses focus after auto-pasting").setDesc("After auto-pasting into a markdown file opened in the left or right sidebar, the sidebar will be automatically collapsed once it loses focus."),this.addToggleSetting("openAutoFocusTargetInEditingView").setName("Always open in editing view").setDesc('This option can be useful especially when you set the previous option to "Hover Editor".')),this.addToggleSetting("executeCommandWhenTargetNotIdentified",()=>this.redisplay()).setName("Execute command when target file cannot be determined").setDesc("When PDF++ cannot determine which markdown file to focus on or paste to, it will execute the command specified in the next option to let you pick a target file.");let s=(l=(c=this.app.commands.findCommand(`${this.plugin.manifest.id}:create-new-note`))==null?void 0:c.name)!=null?l:"PDF++: Create new note for auto-focus or auto-paste";this.plugin.settings.executeCommandWhenTargetNotIdentified&&(this.addSetting("commandToExecuteWhenTargetNotIdentified").setName("Command to execute").then(d=>{var h,u,p,f,m,x;this.renderMarkdown(["Here's some examples of useful commands:","",`- ${(u=(h=this.app.commands.findCommand("file-explorer:new-file"))==null?void 0:h.name)!=null?u:"Create new note"}`,`- ${(f=(p=this.app.commands.findCommand("file-explorer:new-file-in-new-pane"))==null?void 0:p.name)!=null?f:"Create note to the right"}`,`- ${(x=(m=this.app.commands.findCommand("switcher:open"))==null?void 0:m.name)!=null?x:"Quick switcher: Open quick switcher"}`,"- [Omnisearch](obsidian://show-plugin?id=omnisearch): Vault search","- [Hover Editor](obsidian://show-plugin?id=obsidian-hover-editor): Open new Hover Editor",`- **${s}**: See below for the details.`],d.descEl)}).addText(d=>{let h=this.plugin.settings.commandToExecuteWhenTargetNotIdentified,u=this.app.commands.findCommand(h);u?d.setValue(u.name):(d.inputEl.addClass("error"),d.setPlaceholder("Command not found")),d.inputEl.size=30,new zc(this,d.inputEl)}),this.addSliderSetting("autoPasteTargetDialogTimeoutSec",1,60,1).setName("[Auto-paste] Maximum time to wait for the command to open the target file (sec)").setDesc("The link will be auto-pasted into the first markdown file that you open within this time frame after the command is executed. If you don't open any markdown file during this time, the auto-paste will not occur. This option is not related to auto-focus.")),this.addHeading(`The "${s}" command`,"create-new-note-command").setDesc('Creates a new note and opens it in a new pane specified in the "How to open target markdown file when not opened" option.'),this.addTextSetting("newFileNameFormat","Leave blank not to specify").setName("New note title format").then(async d=>{await this.renderMarkdown(['If this option is left blank or the active file is not a PDF, "Untitled \\*" will be used (if the language is set to English). You can use the following variables: `file`, `folder`, `app`, and other global variables such as `moment`.'],d.descEl),d.descEl.createSpan({text:"See "}),d.descEl.appendChild(this.createLinkToHeading("template","above")),d.descEl.createSpan({text:" for the details about these variables."})}),this.addTextSetting("newFileTemplatePath","Leave blank not to use a template").setName("Template file path").then(async d=>{await this.renderMarkdown(["You can leave this blank if you don't want to use a template.","You can use `file`, `folder`, `app`, and other global variables such as `moment`."],d.descEl),d.descEl.createSpan({text:"See "}),d.descEl.appendChild(this.createLinkToHeading("template","above")),d.descEl.createSpan({text:" for the details about these variables."}),await this.renderMarkdown(["You can also include [Templater](obsidian://show-plugin?id=templater-obsidian) syntaxes in the template.",'In that case, make sure the "Trigger templater on new file creation" option is enabled in the Templater settings.',"","Example:","```","---",`${this.plugin.settings.proxyMDProperty}: "[[{{ file.path }}|{{ file.basename }}]]"`,"---",'<%* const title = await tp.system.prompt("Type note tile") -%>',"<%* await tp.file.rename(title) %>","```"],d.descEl);let h=d.components[0].inputEl;new Vc(this.app,h).onSelect(({item:u})=>{this.plugin.settings.newFileTemplatePath=u.path,this.plugin.saveSettings()})}),this.addHeading("PDF Annotations","annot","lucide-message-square"),this.addToggleSetting("annotationPopupDrag").setName("Drag & drop annotation popup to insert a link to the annotation").setDesc("Note that turning on this option disables text selection in the annotation popup (e.g. modified date, author, etc)."),this.addToggleSetting("showAnnotationPopupOnHover").setName("If an annotation has a comment, show the annotation popup on hover").setDesc("This is the same behavior as the PDF viewers of some web browsers (e.g. Chrome/Firefox). You may have to reopen the PDF file after changing this option."),this.addToggleSetting("renderMarkdownInStickyNote").setName("Render markdown in annotation popups when the annotation has text contents"),this.plugin.settings.enablePDFEdit&&(this.addSliderSetting("writeHighlightToFileOpacity",0,1,.01).setName("Highlight opacity"),this.addToggleSetting("defaultWriteFileToggle").setName("Write highlight to file by default").setDesc("You can turn this on and off with the toggle button in the PDF viewer toolbar."),this.addToggleSetting("syncWriteFileToggle").setName("Share the same toggle state among all PDF viewers").setDesc("If disabled, you can specify whether to write highlights to files for each PDF viewer."),this.plugin.settings.syncWriteFileToggle&&this.addToggleSetting("syncDefaultWriteFileToggle").setName("Share the state with newly opened PDF viewers as well"),this.addToggleSetting("enableAnnotationContentEdit",()=>this.redisplay()).setName("Enable editing annotation contents").setDesc('If enabled, you can edit the text contents of annotations embedded in PDF files by clicking the "Edit" button in the annotation popup.'),this.addToggleSetting("enableAnnotationDeletion",()=>this.redisplay()).setName("Enable annotation deletion").setDesc('If enabled, you can delete annotations embedded in PDF files by clicking the "Delete" button in the annotation popup.'),this.plugin.settings.enableAnnotationDeletion&&(this.addToggleSetting("warnEveryAnnotationDelete",()=>this.redisplay()).setName("Always warn when deleting an annotation"),this.plugin.settings.warnEveryAnnotationDelete||this.addToggleSetting("warnBacklinkedAnnotationDelete").setName("Warn when deleting an annotation with backlinks"))),this.addHeading("PDF internal links","pdf-link","link").setDesc("Make it easier to work with internal links embedded in PDF files."),this.addToggleSetting("clickPDFInternalLinkWithModifierKey").then(d=>{this.renderMarkdown("Use [modifier keys](https://help.obsidian.md/User+interface/Tabs#Open+a+link) to open PDF internal links in various ways",d.nameEl)}).then(d=>{this.plugin.requireModKeyForLinkHover(Xn.HOVER_LINK_SOURCE_ID)&&d.setDesc(`You may want to turn this off to avoid conflicts with hover+${_n}.`),d.descEl.appendText("Reopen tabs or reload the app after changing this option.")}),this.addToggleSetting("enableHoverPDFInternalLink",()=>this.events.trigger("update")).setName(`Show a popover preview of PDF internal links by hover(+${_n})`),this.showConditionally(this.addRequireModKeyOnHoverSetting(Xn.HOVER_LINK_SOURCE_ID),()=>this.plugin.settings.enableHoverPDFInternalLink),this.addToggleSetting("recordPDFInternalLinkHistory").setName("Enable history navigation for PDF internal links").setDesc('When enabled, clicking the "navigate back" (left arrow) button will take you back to the page you were originally viewing before clicking on an internal link in the PDF file.'),this.addSetting().setName("Copy PDF link as Obsidian link").setDesc('(Requires custom context menu enabled) In the PDF viewer, right-click a PDF-embedded link and then click "Copy PDF link as Obsidian link". It will copy the PDF link as an Obsidian link that you can paste into markdown files. Clicking the pasted link will take you to the same destination as the original PDF link.'),this.addSetting().setName('"Copy link to current page view" command').setDesc("Running this command while viewing a PDF file will copy a link, clicking which will open the PDF file at the current scroll position and zoom level."),this.addSetting().setName("Paste copied link to a text selection in a PDF file").setDesc('(Requires custom context menu & PDF editing enabled) After copying a link by the above actions, you can "paste" it to a selection in PDF to create a PDF internal link. To do this, right-click the selection and click "Paste copied link to selection".'),this.plugin.settings.replaceContextMenu&&this.plugin.settings.enablePDFEdit&&(this.addToggleSetting("pdfLinkBorder",()=>this.redisplay()).setName("Draw borders around internal links").setDesc('Specify whether PDF internal links that you create by "Paste copied link to selection" should be surrounded by borders.'),this.plugin.settings.pdfLinkBorder&&this.addColorPickerSetting("pdfLinkColor").setName("Border color of internal links").setDesc('Specify the border color of PDF internal links that you create by "Paste copied link to selection".')),this.addHeading("Citations in PDF (experimental)","citation","lucide-graduation-cap").then(d=>{this.renderMarkdown(["Enjoy supercharged experiences of working with citations in PDF files, just like in [Google Scholar's PDF viewer](https://scholar.googleblog.com/2024/03/supercharge-your-pdf-reading-follow.html).","","The current implementation is based on some pretty primitive hand-crafted rules, and there is a lot of room for improvement. Code contribution is much appreciated!"],d.descEl)}),this.addDropdownSetting("actionOnCitationHover",Ug,()=>this.events.trigger("update")).setName(`Hover(+${_n}) on a citation link to show...`).then(d=>{this.renderMarkdown([`- **${Ug["pdf-plus-bib-popover"]}**: Recommended. It works without any additional stuff, but you can further boost the visibility by installing [AnyStyle](https://github.com/inukshuk/anystyle) (desktop only).`,`- **${Ug["google-scholar-popover"]}**: Requires [Surfing](obsidian://show-plugin?id=surfing) ver. 0.9.9 or higher enabled. Be careful not to exceed the rate limit of Google Scholar.`],d.descEl)}),this.showConditionally(this.addRequireModKeyOnHoverSetting(pn.HOVER_LINK_SOURCE_ID),()=>this.plugin.settings.actionOnCitationHover!=="none"),this.showConditionally(this.addSetting("anystylePath").setName("AnyStyle path").addText(d=>{d.setPlaceholder("anystyle").setValue(this.plugin.settings.anystylePath).onChange(h=>{this.plugin.settings.anystylePath=h,this.plugin.saveLocalStorage("anystylePath",h)})}).then(d=>{d.components[0].inputEl.size=35,this.renderMarkdown(["The path to the [AnyStyle](https://github.com/inukshuk/anystyle) executable. ","","PDF++ extracts the bibliography text from the PDF file for each citation link and uses AnyStyle to convert the extracted text into a structured metadata.","It works just fine without AnyStyle, but you can further boost the visibility by installing it and providing its path here.","","Note: This setting is saved in the [local storage](https://developer.mozilla.org/en-US/docs/Web/API/Window/localStorage) instead of `data.json` in the plugin folder."],d.descEl)}),()=>ge.Platform.isDesktopApp&&this.plugin.settings.actionOnCitationHover==="pdf-plus-bib-popover"),this.showConditionally(this.addTextAreaSetting("citationIdPatterns",void 0,()=>this.plugin.setCitationIdRegex()).setName("Citation ID patterns").setDesc("You don't need to care about this option in most use cases - just leave it to the default value. For advanced users: most internal links in PDF files use so-called destination names to specify the target location. This option allows you to specify the regular expressions (separated by line breaks) that determine whether a given internal link is a citation link based on the dsetination name."),()=>this.plugin.settings.actionOnCitationHover!=="none"),this.showConditionally([this.addDesc("Try turning off the following options if you experience performance issues."),this.addToggleSetting("enableBibInEmbed").setName("Enable bibliography extraction in PDF embeds"),this.addToggleSetting("enableBibInCanvas").setName("Enable bibliography extraction in Canvas"),this.addToggleSetting("enableBibInHoverPopover").setName("Enable bibliography extraction in hover popover previews")],()=>this.plugin.settings.actionOnCitationHover!=="none"),this.addHeading("External links in PDF","pdf-external-link","external-link").setDesc("Make it easier to work with external links embedded in PDF files."),this.addToggleSetting("popoverPreviewOnExternalLinkHover").setName(`Show a popover preview of external links by hover(+${_n})`).then(d=>{this.renderMarkdown(["Requires [Surfing](obsidian://show-plugin?id=surfing) ver. 0.9.9 or higher enabled."],d.descEl)}),this.showConditionally(this.addRequireModKeyOnHoverSetting(Gr.HOVER_LINK_SOURCE_ID),()=>this.plugin.settings.popoverPreviewOnExternalLinkHover),this.addHeading("PDF sidebar","sidebar","sidebar-left").setDesc("General settings for the PDF sidebar. The options specific to the outline and thumbnails are located in the corresponding sections below."),this.addToggleSetting("autoHidePDFSidebar").setName("Click on PDF content to hide sidebar").setDesc("Requires reopening the tabs after changing this option."),this.addEnumDropdownSetting("defaultSidebarView",{1:"Thumbnails",2:"Outline"}).setName("Default sidebar view").setDesc("Reopen PDFs after changing this option."),this.addHeading("PDF outline (table of contents)","outline","lucide-list").setDesc('Power up the outline view of the built-in PDF viewer: add, rename, or delete items via the right-click menu and the "Add to outline" command, drag & drop items to insert a section link, and more.'),this.addToggleSetting("clickOutlineItemWithModifierKey").then(d=>{this.renderMarkdown("Click PDF outline with [modifier keys](https://help.obsidian.md/User+interface/Tabs#Open+a+link) to open target section in various ways",d.nameEl)}).then(d=>{this.plugin.requireModKeyForLinkHover(Zn.HOVER_LINK_SOURCE_ID)&&d.setDesc(`You may want to turn this off to avoid conflicts with hover+${_n}.`),d.descEl.appendText("Reopen tabs or reload the app after changing this option.")}),this.addToggleSetting("popoverPreviewOnOutlineHover",()=>this.events.trigger("update")).setName(`Show popover preview by hover(+${_n})`).setDesc("Reopen tabs or reload the app after changing this option."),this.showConditionally(this.addRequireModKeyOnHoverSetting(Zn.HOVER_LINK_SOURCE_ID),()=>this.plugin.settings.popoverPreviewOnOutlineHover),this.addToggleSetting("recordHistoryOnOutlineClick").setName("Record to history when clicking an outline item").setDesc("Reopen tabs or reload the app after changing this option."),this.addToggleSetting("outlineContextMenu").setName("Replace the built-in context menu in the outline with a custom one").setDesc("This enables you to insert a section link with a custom format by right-clicking an item in the outline. Moreover, you will be able to add, rename, or delete outline items if PDF modification is enabled."),this.addToggleSetting("outlineDrag").setName("Drag & drop outline item to insert link to section").setDesc("Grab an item in the outline and drop it to a markdown file to insert a section link. Changing this option requires reopening the tabs or reloading the app."),(this.plugin.settings.outlineContextMenu||this.plugin.settings.outlineDrag)&&(this.addTextSetting("outlineLinkDisplayTextFormat").setName("Display text format").then(d=>{let h=d.components[0];h.inputEl.size=30}),this.addTextAreaSetting("outlineLinkCopyFormat").setName("Copy format").then(d=>{let h=d.components[0];h.inputEl.rows=3,h.inputEl.cols=30})),this.addHeading("Copy outline as markdown","outline-copy").setDesc('You can copy PDF outline as a markdown list or headings using the commands "Copy outline as markdown list" and "Copy outline as markdown headings".'),this.addTextSetting("copyOutlineAsListDisplayTextFormat").setName("List: display text format").then(d=>{let h=d.components[0];h.inputEl.size=30}),this.addTextAreaSetting("copyOutlineAsListFormat").setName("List: copy format").setDesc("You don't need to include leading hyphens in the template.").then(d=>{let h=d.components[0];h.inputEl.rows=3,h.inputEl.cols=30}),this.addTextSetting("copyOutlineAsHeadingsDisplayTextFormat").setName("Headings: display text format").then(d=>{let h=d.components[0];h.inputEl.size=30}),this.addTextAreaSetting("copyOutlineAsHeadingsFormat").setName("Headings: copy format").setDesc("You don't need to include leading hashes in the template.").then(d=>{let h=d.components[0];h.inputEl.rows=3,h.inputEl.cols=30}),this.addSliderSetting("copyOutlineAsHeadingsMinLevel",1,6,1).setName("Headings: minimum level").setDesc("The copied headings will start at this level."),this.addHeading("PDF thumbnails","thumbnail","lucide-gallery-thumbnails"),this.addToggleSetting("clickThumbnailWithModifierKey").then(d=>{this.renderMarkdown("Click PDF thumbnails with [modifier keys](https://help.obsidian.md/User+interface/Tabs#Open+a+link) to open target page in various ways",d.nameEl)}).then(d=>{this.plugin.requireModKeyForLinkHover(Yn.HOVER_LINK_SOURCE_ID)&&d.setDesc(`You may want to turn this off to avoid conflicts with hover+${_n}`),d.descEl.appendText("Reopen tabs or reload the app after changing this option.")}),this.addToggleSetting("popoverPreviewOnThumbnailHover",()=>this.events.trigger("update")).setName(`Show popover preview by hover(+${_n})`).setDesc("Reopen tabs or reload the app after changing this option."),this.showConditionally(this.addRequireModKeyOnHoverSetting(Yn.HOVER_LINK_SOURCE_ID),()=>this.plugin.settings.popoverPreviewOnThumbnailHover),this.addToggleSetting("recordHistoryOnThumbnailClick").setName("Record to history when clicking a thumbnail").setDesc("Reopen tabs or reload the app after changing this option."),this.addToggleSetting("thumbnailContextMenu").setName("Replace the built-in context menu in thumbnails with a custom one").setDesc("This enables you to copy a page link with a custom display text format specified in the PDF toolbar by right-clicking a thumbnail. Moreover, you will be able to insert, delete, extract pages if PDF modification is enabled."),this.addToggleSetting("thumbnailDrag").setName("Drag & drop PDF thumbnail to insert link to page").then(d=>{this.renderMarkdown(["Grab a thumbnail image and drop it to a markdown file to insert a page link. Changing this option requires reopening the tabs or reloading the app.","","Note: When disabled, drag-and-drop will cause the thumbnail image to be paste as a data url, which is seemingly Obsidian's bug."],d.descEl)}),(this.plugin.settings.thumbnailContextMenu||this.plugin.settings.thumbnailDrag)&&(this.addTextSetting("thumbnailLinkDisplayTextFormat").setName("Display text format").then(d=>{let h=d.components[0];h.inputEl.size=30}),this.addTextAreaSetting("thumbnailLinkCopyFormat").setName("Copy format").then(d=>{let h=d.components[0];h.inputEl.rows=3,h.inputEl.cols=30})),this.addHeading("PDF page composer (experimental)","composer","lucide-blocks").then(d=>{this.renderMarkdown(['Add, insert, delete or extract PDF pages via commands and **automatically update all the related links in the entire vault**. The "Editing PDF files directly" option has to be enabled to use these features.'],d.descEl)}),this.addToggleSetting("warnEveryPageDelete",()=>this.redisplay()).setName("Always warn when deleting a page"),this.plugin.settings.warnEveryPageDelete||this.addToggleSetting("warnBacklinkedPageDelete").setName("Warn when deleting a page with backlinks"),this.addToggleSetting("extractPageInPlace").setName("Remove the extracted pages from the original PDF by default"),this.addToggleSetting("askExtractPageInPlace").setName("Ask whether to remove the extracted pages from the original PDF before extracting"),this.addToggleSetting("openAfterExtractPages",()=>this.redisplay()).setName("Open extracted PDF file").setDesc('If enabled, the newly created PDF file will be opened after running the commands "Extract this page to a new file" or "Divide this PDF into two files at this page".'),this.plugin.settings.openAfterExtractPages&&this.addDropdownSetting("howToOpenExtractedPDF",Ou).setName("How to open"),this.addHeading("Page labels","page-label").then(d=>{this.renderMarkdown(["Each page in a PDF document can be assigned a ***page label***, which can be different from the page indices.",'For example, a book might have a preface numbered as "i", "ii", "iii", ... and the main content numbered as "1", "2", "3", ...',"","PDF++ allows you to choose whether page labels should be kept unchanged or updated when inserting/removing/extracting pages. [Learn more](https://github.com/RyotaUshio/obsidian-pdf-plus/wiki/Page-labels)","",'You can also modify page labels directly using the command "Edit page labels".'],d.descEl)}),this.addDropdownSetting("pageLabelUpdateWhenInsertPage",Qc).setName("Insert: default page label processing").setDesc('Applies to the commands "Insert page before/after this page".'),this.addToggleSetting("askPageLabelUpdateWhenInsertPage").setName("Insert: ask whether to update"),this.addDropdownSetting("pageLabelUpdateWhenDeletePage",Qc).setName("Delete: default page label processing").setDesc('Applies to the command "Delete this page".'),this.addToggleSetting("askPageLabelUpdateWhenDeletePage").setName("Delete: ask whether to update"),this.addDropdownSetting("pageLabelUpdateWhenExtractPage",Qc).setName("Extract: default page label processing").setDesc('Applies to the commands "Extract this page to a new file" and "Divide this PDF into two files at this page".'),this.addToggleSetting("askPageLabelUpdateWhenExtractPage").setName("Extract: ask whether to update"),this.addHeading("Opening links to PDF files","open-link","lucide-book-open"),this.addToggleSetting("alwaysRecordHistory").setName("Always record to history when opening PDF links").setDesc("By default, the history is recorded only when you open a link to a different PDF file. If enabled, the history will be recorded even when you open a link to the same PDF file as the current one, and you will be able to go back and forth the history by clicking the left/right arrow buttons even within a single PDF file."),this.addToggleSetting("singleTabForSinglePDF",()=>this.redisplay()).setName("Don't open a single PDF file in multiple tabs").then(d=>this.renderMarkdown('When opening a link to a PDF file without pressing any [modifier keys](https://help.obsidian.md/User+interface/Use+tabs+in+Obsidian#Open+a+link), a new tab will not be opened if the same file has already been already opened in another tab. Useful for annotating PDFs using a side-by-side view ("Split right"), displaying a PDF in one side and a markdown file in another.',d.descEl)),this.plugin.settings.singleTabForSinglePDF&&(this.addToggleSetting("dontActivateAfterOpenPDF").setName("Don't move focus to PDF viewer after opening a PDF link").setDesc("This option will be ignored when you open a PDF link in a tab in the same split as the PDF viewer."),this.addToggleSetting("highlightExistingTab",()=>this.redisplay()).setName("When opening a link to an already opened PDF file, highlight the tab"),this.plugin.settings.highlightExistingTab&&(this.addSliderSetting("existingTabHighlightOpacity",0,1,.01).setName("Highlight opacity of an existing tab"),this.addSliderSetting("existingTabHighlightDuration",.1,10,.05).setName("Highlight duration of an existing tab (sec)")),this.addToggleSetting("dontFitWidthWhenOpenPDFLink",()=>this.events.trigger("update")).setName("Preserve the current zoom level when opening a link to an already opened PDF file").setDesc("When you open a link to a PDF file that's already opened, Obsidian's default behavior causes the zoom level to be reset to fit the width of the PDF file to the viewer. If enabled, the current zoom level will be preserved. This option will be ignored in PDF embeds."),this.showConditionally(this.addToggleSetting("preserveCurrentLeftOffsetWhenOpenPDFLink").setName("Preserve the current horizontal scroll position").setDesc("This option will be ignored in PDF embeds."),()=>this.plugin.settings.dontFitWidthWhenOpenPDFLink)),this.addDropdownSetting("paneTypeForFirstPDFLeaf",Ou).setName("How to open PDF links when there is no open PDF file").then(d=>{this.renderMarkdown("This option will be ignored when you press [modifier keys](https://help.obsidian.md/User+interface/Use+tabs+in+Obsidian#Open+a+link) to explicitly specify how to open the link.",d.descEl)}),this.addToggleSetting("openLinkNextToExistingPDFTab").setName("Open PDF links next to an existing PDF tab").then(d=>this.renderMarkdown("If there is a PDF file opened in a tab, clicking a PDF link will first create a new tab next to it and then open the target PDF file in the created tab. This is especially useful when you are spliting the workspace vertically or horizontally and want PDF files to be always opened in one side. This option will be ignored when you press [modifier keys](https://help.obsidian.md/User+interface/Use+tabs+in+Obsidian#Open+a+link) to explicitly specify how to open the link.",d.descEl)),this.addToggleSetting("hoverPDFLinkToOpen").setName("Open PDF link instead of showing popover preview when target PDF is already opened").setDesc(`Press ${Bt("Mod").toLowerCase()} while hovering a PDF link to actually open it if the target PDF is already opened in another tab.`),this.addSetting().setName("Open PDF links with an external app").setDesc(createFragment(d=>{d.appendText("See the "),d.appendChild(this.createLinkToHeading("external-app")),d.appendText(" section for the details.")})),this.addSetting().setName("Clear highlights after a certain amount of time").addToggle(d=>{d.setValue(this.plugin.settings.highlightDuration>0).onChange(async h=>{this.plugin.settings.highlightDuration=h?this.plugin.settings.highlightDuration>0?this.plugin.settings.highlightDuration:1:0,await this.plugin.saveSettings(),this.redisplay()})}),this.plugin.settings.highlightDuration>0&&this.addSliderSetting("highlightDuration",.1,10,.05).setName("Highlight duration (sec)"),this.addToggleSetting("ignoreHeightParamInPopoverPreview").setName('Ignore "height" parameter in popover preview').setDesc('Obsidian lets you specify the height of a PDF embed by appending "&height=..." to a link, and this also applies to popover previews. Enable this option if you want to ignore the height parameter in popover previews.'),this.addHeading("Embedding PDF files","embed","picture-in-picture-2"),this.addToggleSetting("dblclickEmbedToOpenLink",()=>this.plugin.loadStyle()).setName("Double click PDF embeds to open links").setDesc("Double-clicking a PDF embed will open the embedded file."),this.addToggleSetting("trimSelectionEmbed",()=>this.redisplay()).setName("Trim selection/annotation embeds").then(d=>{this.renderMarkdown(['(Deprecated in favor of the rectangular selection embed feature introduced in PDF++ 0.36.0)',"When embedding a selection or an annotation from a PDF file, only the target selection/annotation and its surroundings are displayed rather than the entire page."],d.descEl)}),this.plugin.settings.trimSelectionEmbed&&this.addSliderSetting("embedMargin",0,200,1).setName("Selection/annotation embeds margin (px)"),this.addToggleSetting("noSidebarInEmbed").setName("Hide sidebar in PDF embeds or PDF popover previews by default"),this.addToggleSetting("noSpreadModeInEmbed").setName(`Don't display PDF embeds or PDF popover previews in "two page" layout`).setDesc('Regardless of the "two page" layout setting in existing PDF viewer, PDF embeds and PDF popover previews will be always displayed in "single page" layout. You can still turn it on for each embed by clicking the "two page" button in the toolbar, if shown.'),this.addToggleSetting("noTextHighlightsInEmbed").setName("Don't highlight text in text selection embeds"),this.addToggleSetting("noAnnotationHighlightsInEmbed").setName("Don't highlight annotations in annotation embeds"),this.addToggleSetting("persistentTextHighlightsInEmbed").setName("Don't clear highlights in text selection embeds"),this.addToggleSetting("persistentAnnotationHighlightsInEmbed").setName("Don't clear highlights in annotation embeds"),this.addToggleSetting("embedUnscrollable").setName("Make PDF embeds with a page specified unscrollable").setDesc("After changing this option, you need to reopen tabs or reload the app."),this.addHeading("Backlinks pane for PDF files","backlink-view","links-coming-in").then(d=>this.renderMarkdown("Improve the built-in [backlinks pane](https://help.obsidian.md/Plugins/Backlinks) for better PDF experience.",d.descEl)),this.addToggleSetting("filterBacklinksByPageDefault").setName("Filter backlinks by page by default").setDesc('You can toggle this on and off with the "Show only backlinks in the current page" button at the top right of the backlinks pane.'),this.addToggleSetting("showBacklinkToPage").setName("Show backlinks to the entire page").setDesc("If turned off, only backlinks to specific text selections, annotations or locations will be shown when filtering the backlinks page by page."),this.addToggleSetting("highlightBacklinksPane").setName("Hover sync (PDF viewer \u2192 Backlinks pane)").setDesc("Hovering your mouse over highlighted text or annotation will also highlight the corresponding item in the backlink pane."),this.addToggleSetting("highlightOnHoverBacklinkPane").setName("Hover sync (Backlinks pane \u2192 PDF viewer)").setDesc("In the backlinks pane, hover your mouse over an backlink item to highlight the corresponding text or annotation in the PDF viewer. This option requires reopening or switching tabs to take effect."),this.plugin.settings.highlightOnHoverBacklinkPane&&this.addDropdownSetting("backlinkHoverColor",["",...Object.keys(this.plugin.settings.colors)],d=>d||"PDF++ default",()=>this.plugin.loadStyle()).setName("Highlight color for hover sync (Backlinks pane \u2192 PDF viewer)").setDesc('To add a new color, click the "+" button in the "highlight colors" setting above.'),this.addHeading("Search from links","search-link","lucide-search").then(d=>{this.renderMarkdown(["You can trigger full-text search by opening a link to a PDF file with a search query appended, e.g. `[[file.pdf#search=keyword]]`."],d.descEl)}),this.addHeading("Search options","search-option").then(d=>{this.renderMarkdown(["The behavior of the search links can be customized globally by the following settings. ","Alternatively, you can specify the behavior for each link by including the following query parameters in the link text: ","","- `&case-sensitive=true` or `&case-sensitive=false`","- `&highlight-all=true` or `&highlight-all=false`","- `&match-diacritics=true` or `&match-diacritics=false`","- `&entire-word=true` or `&entire-word=false`"],d.descEl)});let a={true:"Yes",false:"No",default:"Follow default setting"};this.addDropdownSetting("searchLinkCaseSensitive",a).setName("Case sensitive search"),this.addDropdownSetting("searchLinkHighlightAll",a).setName("Highlight all search results"),this.addDropdownSetting("searchLinkMatchDiacritics",a).setName("Match diacritics"),this.addDropdownSetting("searchLinkEntireWord",a).setName("Match whole word"),this.addHeading("Integration with external apps (desktop-only)","external-app","lucide-share"),this.addToggleSetting("openPDFWithDefaultApp",()=>this.redisplay()).setName("Open PDF links with an external app").setDesc("Open PDF links with the OS-defined default application for PDF files."),this.plugin.settings.openPDFWithDefaultApp&&this.addToggleSetting("openPDFWithDefaultAppAndObsidian").setName("Open PDF links in Obsidian as well").setDesc("Open the same PDF file both in the default app and Obsidian at the same time."),this.addToggleSetting("syncWithDefaultApp").setName("Sync the external app with Obsidian").setDesc("When you focus on a PDF file in Obsidian, the external app will also focus on the same file."),this.addToggleSetting("focusObsidianAfterOpenPDFWithDefaultApp").setName("Focus Obsidian after opening a PDF file with an external app").setDesc("Otherwise, the focus will be moved to the external app."),this.addHeading("View Sync","view-sync","lucide-eye").then(d=>{this.renderMarkdown(["Integrate more seamlessly with the [View Sync](https://github.com/RyotaUshio/obsidian-view-sync) plugin."],d.descEl)}),this.addToggleSetting("viewSyncFollowPageNumber",()=>this.redisplay()).setName("Sync page number"),this.plugin.settings.viewSyncFollowPageNumber&&this.addSliderSetting("viewSyncPageDebounceInterval",.1,1,.05).setName("Minimum update interval of the View Sync file (sec)"),this.addHeading("Dummy PDFs for external files","dummy","lucide-file-symlink").then(d=>{this.renderMarkdown(["Using dummy PDF files, you can seamlessly integrate PDF files located outside your vault as if they were inside. Note that this is an experimental feature.","[Learn more](https://ryotaushio.github.io/obsidian-pdf-plus/external-pdf-files.html)"],d.descEl)}),this.addAttachmentLocationSetting("dummyFileFolderPath","Dummy PDFs",(d,h,u)=>{d.setName("Default location for new dummy PDF files").setDesc(`Where newly created dummy PDF files are placed. If set to "${Ow.obsidian}", dummy files will be saved in the folder specified in Obsidian settings > Files and links > Default location for new attachments.`),h.setName("Dummy file folder path").setDesc("Place newly created dummy PDF files in this folder."),u.setName("Subfolder name").setDesc('If your file is under "vault/folder", and you set subfolder name to "attachments", dummy PDF files will be saved to "vault/folder/attachments".')}),this.addSetting("modifierToDropExternalPDFToCreateDummy").setName("Modifier key to create a dummy PDF file on drag & drop").setDesc("After dragging an external PDF file, drop it on the editor while pressing this modifier key to create a dummy file and insert a link to it. You can drag a URL to a PDF file on the web from within your browser (link, URL bar, bookmark, etc.) or a PDF file on your desktop machine from your file manager ("+(ge.Platform.isMacOS?"Finder":"File Explorer")+" etc.). Note that on mobile, you might need to start pressing the modifier key before starting the drag operation.").addDropdown(d=>{let h=ge.Platform.isMacOS||ge.Platform.isIosApp?"Alt":"Ctrl";for(let u of[[],["Shift"],[h],[h,"Shift"]])d.addOption(u.join("+"),u.length?u.map(Bt).join("+"):"None");d.setValue(this.plugin.settings.modifierToDropExternalPDFToCreateDummy.join("+")).onChange(async u=>{this.plugin.settings.modifierToDropExternalPDFToCreateDummy=u.split("+"),await this.plugin.saveSettings()})}),this.addSetting("externalURIPatterns").setName("URI patterns for PDF files").setDesc("Specify the URI pattens for PDFs in regular expressions. When dragging and dropping a URI/URL from your browser to Obsidian's editor, it will be used to check if the destination file is a PDF file. If you need multiple patterns, separate them with a new line.").addTextArea(d=>{d.inputEl.rows=8,d.inputEl.cols=30,d.setValue(this.plugin.settings.externalURIPatterns.join(` `)),this.component.registerDomEvent(d.inputEl,"focusout",async()=>{let h=d.inputEl.value;this.plugin.settings.externalURIPatterns=h.split(` `).map(u=>u.trim()).filter(u=>u),await this.plugin.saveSettings()})}),this.addHeading("Vim keybindings","vim","vim").then(d=>this.renderMarkdown("Tracked at [this GitHub issue](https://github.com/RyotaUshio/obsidian-pdf-plus/issues/119).",d.descEl)),this.addSetting().then(d=>{this.renderMarkdown(['The default keybindings are as follows. You can customize them be creating a "vimrc" file and providing its path in the setting below.',"","- `j`/`k`/`h`/`l`: Scroll down/up/left/right","- `J`: Go to next page","- `K`: Go to previous page","- `gg`: Go to first page","- `G`: Go to last page","- `0`/`^`/`H`: Go to top of current page","- `$`/`L`: Go to bottom of current page","- ``/``: Scroll down/up as much as the viewer height (`C`=`Ctrl`)","- ``/``: Scroll down/up half as much as the viewer height","- `/`/`?`: Search forward/backward","- `n`/`N`: Go to next/previous match","- `gn`/`gN`: Select search result","- `+`/`zi`: Zoom in","- `-`/`zo`: Zoom out","- `=`/`z0`: Reset zoom","- `r`: Rotate pages clockwise","- `R`: Rotate pages counterclockwise","- `y`: Yank (copy) selected text",`- \`c\`: Run the "${this.plugin.lib.commands.stripCommandNamePrefix(this.plugin.lib.commands.getCommand("copy-link-to-selection").name)}" command`,"- `C`: Show context menu at text selection","- `o`: Swap the start and end of the selection","- `:`: Enter command-line mode (experimental)","- ``: Toggle outline (table of contents)","- ``: Toggle thumbnails (`S`=`Shift`)","- `f`: Enter hint mode by running `:hint` (experimental)","- ``: Go back to normal mode, abort search, etc","","Many of the commands above can be combined with counts. For example:","- `2j` scrolls down the page twice as much as `j`.","- `2J` advances two pages.","- `10G` takes you to page 10.","- `150=` sets the zoom level to 150%."],d.descEl)}),this.addToggleSetting("vim",()=>this.events.trigger("update")).setName("Enable").setDesc("Reopen the PDF viewers after changing this option."),this.showConditionally([this.addTextSetting("vimrcPath",void 0,()=>this.plugin.vimrc=null).setName("Vimrc file path (optional)").then(async d=>{await this.renderMarkdown(["Only the [Ex commands supported by PDF++](https://github.com/RyotaUshio/obsidian-pdf-plus/blob/main/src/vim/ex-commands.ts) are allowed.","","Example (not necessarily recommendations):","```",'" Use j/k, instead of J/K, to go to the next page',"map j J","map k K","",'" JavaScript commands','" - Hit Ctrl-h in Normal mode to show a message','nmap :js alert("Hello, world!")','" - Hit Ctrl-h in Visual mode to run a .js file',"vmap :jsfile filename.js","",'" Obsidian commands','" - Open the current PDF in the OS-default app by hitting d, e, and then f',"map def :obcommand open-with-default-app:open",'" - Go back and forth the history with Ctrl-o and Ctrl-i',"map :obcommand app:go-back","map :obcommand app:go-forward","```","","After changing the path or the file content, you need to reopen the PDF viewer. If the vimrc file is a hidden file or is under a hidden folder, you need to reload PDF++ or the app."],d.descEl);let h=d.components[0].inputEl;new Hc(this.app,h).onSelect(({item:u})=>{this.plugin.settings.vimrcPath=u.path,this.plugin.saveSettings()})}),this.addHeading("Visual mode","vim-visual"),this.addToggleSetting("vimVisualMotion").setName("Use motion keys to adjust text selection").then(d=>{this.renderMarkdown(["When some text is selected, you can modify the range of selection using the `j,` `k`, `h`, `l`, `w`, `e`, `b`, `0`, `^`, `$`, `H`, and `L` keys, similarly to Vim's visual mode (`H`/`L` are mapped to `^`/`$` by default). If disabled, you can use `j`/`k`/`h`/`l`/`0`/`^`/`$`/`H`/`L` keys to scroll the page regardless of text selection. Reload the viewer or the app after changing this option.","","Tips:","- You can use `o` to swap the start and end of the selection.","- As you know, `/` and `?` keys initiate search. Pressing `gn`/`gN` after the search will select the search result. You can also use search to extend the current selection to the search result.","","Note: On mobile, word-wise motions (`w`/`e`/`b`) might not work as expected around punctuations. Contributions to fix this are welcome!"],d.descEl)}),this.addHeading("Outline mode","vim-outline"),this.addToggleSetting("enableVimOutlineMode").setName("Enter outline mode when opening PDF outline view").then(d=>{this.renderMarkdown(["If enabled, you will enter the outline mode by opening the PDF outline view (from the icon in the toolbar or by ``), and you can use the following keybindings, similarly to [Zathura](https://pwmt.org/projects/zathura/)'s index mode.","","- `j`: Move down","- `k`: Move up","- `h`: Collapse & move to parent entry","- `l`: Expand entry & move to child entry","- `H`: Collapse all entries","- `L`: Expand all entries","- `/`: Open the selected entry (``=`Enter`)","- ``: Close sidebar and go back to normal mode","","If disabled, you can use j/k/h/l/H/L keys to scroll the page whether the outline view is opened or not. ","This option requires reload to take effect."],d.descEl)}),this.addToggleSetting("vimSmoothOutlineMode").setName("Smooth motion in outline mode"),this.addHeading("Command-line mode (experimental)","vim-command-line"),this.addSetting().then(d=>{this.renderMarkdown(['By pressing `:`, you can enter the command-line mode, where you can execute various commands called "Ex commands"',"","- You can always go back to normal mode by ``.","- For some commands, you can run `:help :` or `:h :` to see the help message.","- Use `` and `` to navigate through the suggestions (`S`=`Shift`).","- Use arrow down/up keys to go back and forth the command history.","- `` clears the command line, and `` deletes the last word (`C`=`Ctrl`).",'- `:` will take you to the -th page, where the page number always starts from 1. To go to the page with the page label (e.g. "i, ii, ..., x, 1, 2, ..."), use `:gotopage ` (or `:go `/`:goto ` in short).','- `:!` runs the shell command (not supported on mobile). By default, Obsidian does not know the value of the "PATH" environment variable, so you might need to explicitly provide it in the setting below (in the "Misc" section) to run some commands.'],d.descEl)}),this.addHeading("Hint mode (experimental)","vim-hint"),this.addSetting().then(d=>{this.renderMarkdown(["Hitting `f` will enter the hint mode, where you can perform certain actions on links, annotations, and backlink highlighting in the PDF page without using the mouse.",'For example, first press `f` to enter the hint mode, and if the link you want to open gets marked with "HK", then hit `h` and then `k` (without `Shift`) to open it.',"","This is inspired by [Tridactyl](https://github.com/tridactyl/tridactyl)'s hint mode.","","Also check out Style Settings > PDF++ > Vim keybindings > Hint mode."],d.descEl)}),this.addTextSetting("vimHintChars").setName("Characters to use in hint mode").setDesc(`They are used preferentially from left to right, so you might want to put the easier-to-reach keys first. This is the same as Tridactyl's "hintchars" option.`),this.addTextSetting("vimHintArgs").setName('Default arguments for the ":hint" Ex command').setDesc('Space-separated list of "link"/"annot"/"backlink" or "all". Run ":help :hint" for the details.'),this.addHeading("Context menu","vim-context-menu"),this.addToggleSetting("enableVimInContextMenu").setName("Enable Vim keys in PDF context menus").setDesc("If enabled, you can use j/k/h/l keys, instead of the arrow keys, to navigate through context menu items in the PDF viewer."),this.addHeading("Scrolling","vim-scroll"),this.addSliderSetting("vimScrollSize",5,500,5).setName("Scroll size (px) of the jkhl keys").setDesc("The size of scroll when one of the jkhl keys is pressed once."),this.addToggleSetting("vimLargerScrollSizeWhenZoomIn").setName("Increase scroll size when zoomed in"),this.addSliderSetting("vimContinuousScrollSpeed",.1,5,.1).setName("Speed of continuous scroll (px per ms)").setDesc("The speed of scroll when pressing and holding down the jkhl keys."),this.addToggleSetting("vimSmoothScroll").setName("Smooth scroll"),this.addHeading("Search","vim-search"),this.addToggleSetting("vimHlsearch").setName("hlsearch").setDesc("If enabled, all matches will be highlighted."),this.addToggleSetting("vimIncsearch").setName("incsearch").setDesc("Incremental search: while typing the search query, update the search results after every keystroke. If disabled, the results will be shown only after pressing Enter.")],()=>this.plugin.settings.vim),this.addHeading("Misc","misc","lucide-more-horizontal"),this.addToggleSetting("autoCheckForUpdates",()=>this.plugin.checkForUpdatesIfNeeded()).setName("Automatically check for updates").setDesc("If enabled, PDF++ will automatically check for updates every 24 hours and notify you if a new version is available."),this.addToggleSetting("fixObsidianTextSelectionBug").setName("Fix Obsidian 1.9's text selection bug").then(d=>{this.renderMarkdown(["As of June 10, 2025, Obsidian 1.9 has a bug related to PDF text selection that prevents Obsidian from recognizing text selection ranges properly (see [here](https://github.com/RyotaUshio/obsidian-pdf-plus/discussions/450) for more details). ","This option adds a experimental workaround to mitigate the issue."],d.descEl)}),this.addToggleSetting("showStatusInToolbar").setName("Show status in PDF toolbar").setDesc('For example, when you copy a link to a text selection in a PDF file, the status "Link copied" will be displayed in the PDF toolbar.'),this.addFileLocationSetting("newPDFLocation",d=>d.setName("Default location for new PDFs").setDesc('The "Create new PDF" command will create a new PDF file in the location specified here.'),"newPDFFolderPath",d=>d.setName("Folder to create new PDFs in").setDesc("Newly created PDFs will appear under this folder.")),this.addToggleSetting("hideReplyAnnotation").setName("Hide reply annotations").then(d=>{this.renderMarkdown(["Hide annotations that are replies to other annotations in the PDF viewer.","","This is a temporary fix for the issue that PDF.js (the library Obsidian's PDF viewer is based on) does not fulfill the PDF specification in that it renders reply annotations as if a standalone annotation."],d.descEl)}),this.addToggleSetting("hideStampAnnotation").setName("Disable popups for rubber stamp annotations").setDesc(`A rubber stamp annotation is a type of annotation that displays text or graphics intended to look like a rubber stamp. However, some applications, including iOS/iPadOS's "Markup", use this type of annotation also for handwriting. Often, all pieces of handwriting in a single page are grouped into a single rubber stamp annotation, which tends to be so large that it covers the entire page. In this case, annotation popups can be annoying, so you can disable them here.`),this.addToggleSetting("removeWhitespaceBetweenCJChars").setName("Remove half-width whitespace between two Chinese/Japanese characters when copying text").setDesc("Such whitespace can be introduced as a result of poor post-processing of OCR (optical character recognition). Enable this option to remove it when copying links to text selections."),this.addToggleSetting("copyAsSingleLine").setName("Override the default copy behavior in the PDF viewer").then(d=>{d.descEl.appendText('If enabled, whenever you copy text from the PDF viewer (using Ctrl/Cmd+C or via context menu), the text will go through the same pre-processing as the "'+this.plugin.lib.commands.stripCommandNamePrefix(this.plugin.lib.commands.getCommand("copy-link-to-selection").name)+'" command before written to the clipboard. The pre-processing includes transforming multi-line text into a single line by removing line breaks (if a word is split across lines, it will be concatenated), which is useful because it prevents the copied text from being split into multiple lines unnaturally. If the previous option is enabled, the whitespace removal will also be applied.'),d.descEl.appendText(' Also note that on mobile devices, the action performed by "Copy" depends on the '),d.descEl.appendChild(this.createLinkTo("mobileCopyAction")),d.descEl.appendText(" option.")}),ge.Platform.isDesktopApp&&this.addTextAreaSetting("PATH").then(d=>{let h=d.components[0];h instanceof ge.TextAreaComponent&&(h.inputEl.rows=8,h.inputEl.cols=30)}).setName('"PATH" environment variable').setDesc('Provide the "PATH" environment variable for PDF++ to run shell commands without the full paths specified. In MacOS and Linux, you can run "echo $PATH" in Terminal and then copy & paste the result here. Currently, it will be used only when you run ":!" in Vim mode.'),this.addHeading("Style settings","style-settings","lucide-settings-2").setDesc("You can find more options in Style Settings > PDF++.").addButton(d=>{d.setButtonText("Open style settings").onClick(()=>{let h=this.app.setting.pluginTabs.find(u=>u.id==="obsidian-style-settings");h?this.app.setting.openTab(h):open("obsidian://show-plugin?id=obsidian-style-settings")})}),this.addFundingButton(),await Promise.all(this.promises)}async hide(){this.plugin.settings.colors=Object.fromEntries(Object.entries(this.plugin.settings.colors).filter(([t,i])=>t&&cn(i))),this.plugin.settings.defaultColor&&!(this.plugin.settings.defaultColor in this.plugin.settings.colors)&&(this.plugin.settings.defaultColor=""),this.plugin.settings.backlinkHoverColor&&!(this.plugin.settings.backlinkHoverColor in this.plugin.settings.colors)&&(this.plugin.settings.backlinkHoverColor=""),this.plugin.settings.copyCommands=this.plugin.settings.copyCommands.filter(t=>t.name&&t.template),this.plugin.settings.displayTextFormats=this.plugin.settings.displayTextFormats.filter(t=>t.name),this.plugin.settings.enablePDFEdit&&!this.plugin.settings.author&&(this.plugin.settings.enablePDFEdit=!1,new ge.Notice(`${this.plugin.manifest.name}: Cannot enable writing highlights into PDF files because the "Annotation author" option is empty.`)),this.plugin.validateAutoFocusAndAutoPasteSettings(),await this.plugin.saveSettings(),this.plugin.loadStyle(),this.promises=[],this.component.unload()}};var Nw=async(n,e,t)=>{if(e.palette){if(Le.Platform.isDesktopApp){let i=window.electron;i&&t.isTrusted&&(t.stopPropagation(),t.stopImmediatePropagation(),await new Promise(r=>{let o=t.win.setTimeout(()=>r(null),1e3);i.ipcRenderer.once("context-menu",(s,a)=>{t.win.clearTimeout(o),r(a)}),i.ipcRenderer.send("context-menu")}))}t.defaultPrevented||await Wg(n,e,t)}};async function Wg(n,e,t){let i=await Nu.fromMouseEvent(n,e,t);e.clearEphemeralUI(),i.showAtMouseEvent(t),e.pdfViewer.isEmbed&&t.preventDefault()}async function Ru(n,e,t){if(!t||!t.focusNode||t.isCollapsed)return;let i=t.focusNode,r=t.focusOffset,o=i.doc,s=o.createRange();s.setStart(i,r),s.setEnd(i,r);let{x:a,y:c}=s.getBoundingClientRect(),l=new Nu(n,e);await l.addItems(),e.clearEphemeralUI(),n.shownMenus.forEach(d=>d.hide()),l.showAtPosition({x:a,y:c},o)}var Rw=(n,e,t)=>{var o;let{lib:i}=n,r=t.targetNode;if(r&&r.instanceOf(HTMLElement)&&r.hasClass("thumbnail")&&r.dataset.pageNumber!==void 0){let s=parseInt(r.dataset.pageNumber);if(Number.isNaN(s))return;let a=e.getMarkdownLink(`#page=${s}`,e.getPageLinkAlias(s)),l=(o=e.getPage(s).pageLabel)!=null?o:""+s,d=e.pdfViewer.pagesCount,h=""+s===l?`Copy link to page ${s}`:`Copy link to page ${l} (${s}/${d})`,u=new Le.Menu().addItem(p=>{p.setTitle(h).setIcon("lucide-copy").onClick(()=>{var m;((m=t.view)!=null?m:activeWindow).navigator.clipboard.writeText(a);let f=e.file;f&&(n.lastCopiedDestInfo={file:f,destArray:[s-1,"XYZ",null,null,null]})})});i.isEditable(e)&&u.addItem(p=>{p.setTitle("Insert page before this page").setIcon("lucide-plus").onClick(()=>{let f=e.file;if(!f){new Le.Notice(`${n.manifest.name}: Failed to insert the page.`);return}i.commands._insertPage(f,s,s)})}).addItem(p=>{p.setTitle("Insert page after this page").setIcon("lucide-plus").onClick(()=>{let f=e.file;if(!f){new Le.Notice(`${n.manifest.name}: Failed to insert the page.`);return}i.commands._insertPage(f,s+1,s)})}).addItem(p=>{p.setTitle("Delete page").setIcon("lucide-trash").onClick(()=>{let f=e.file;if(!f){new Le.Notice(`${n.manifest.name}: Failed to delete the page.`);return}i.commands._deletePage(f,s)})}).addItem(p=>{p.setTitle("Extract page to new file").setIcon("lucide-file-output").onClick(()=>{let f=e.file;if(!f){new Le.Notice(`${n.manifest.name}: Failed to extract the page.`);return}i.commands._extractPage(f,s)})}).addItem(p=>{p.setTitle("Divide document at this page").setIcon("lucide-split-square-vertical").onClick(()=>{let f=e.file;if(!f){new Le.Notice(`${n.manifest.name}: Failed to divide the document.`);return}i.commands._dividePDF(f,s)})}).addSeparator().addItem(p=>{p.setTitle("Customize...").setIcon("lucide-settings").onClick(()=>{n.openSettingTab().scrollToHeading("thumbnail")})}),u.showAtMouseEvent(t)}},Vw=(n,e,t,i,r)=>{let{app:o,lib:s}=n;e.pdfViewer.isEmbed&&r.preventDefault();let a=s.toSingleLine(i.item.title),c=a?`Copy link to "${a.length<=40?a:a.slice(0,39).trim()+"\u2026"}"`:"Copy link to section",l=new Le.Menu().addItem(d=>{d.setTitle(c).setIcon("lucide-copy").onClick(async()=>{var p;let h=await s.copyLink.getTextToCopyForOutlineItem(e,t,i);((p=r.view)!=null?p:activeWindow).navigator.clipboard.writeText(h);let u=i.item.dest;if(typeof u=="string")n.lastCopiedDestInfo={file:t,destName:u};else{let f=await i.getPageNumber(),m=s.normalizePDFJsDestArray(u,f);n.lastCopiedDestInfo={file:t,destArray:m}}})});s.isEditable(e)&&l.addItem(d=>{d.setTitle("Add subitem").setIcon("lucide-plus").onClick(()=>{new jr(n,"Add subitem to outline").ask().then(async({title:h})=>{let u=s.getPDFViewFromChild(e);if(u){let p=u.getState(),f=s.viewStateToDestArray(p,!0);if(f){await Ge.findAndProcessOutlineItem(i,m=>{m.createChild(h,f).updateCountForAllAncestors(),m.sortChildren()},t,n);return}}new Le.Notice(`${n.manifest.name}: Failed to add the subitem.`)})})}).addItem(d=>{d.setTitle("Rename...").setIcon("lucide-pencil").onClick(()=>{new jr(n,"Rename outline item").presetTitle(i.item.title).ask().then(async({title:h})=>{await Ge.findAndProcessOutlineItem(i,u=>{u.title=h},t,n)})})}).addItem(d=>{d.setTitle("Move item to...").setIcon("lucide-folder-tree").onClick(async()=>{let h=await Ge.fromFile(t,n),u=await h.findPDFjsOutlineTreeNode(i);if(!u){new Le.Notice(`${n.manifest.name}: Failed to load the PDF document.`);return}new Du(h,u).askDestination().then(async p=>{p.appendChild(u),p.sortChildren();let f=await h.doc.save();await o.vault.modifyBinary(t,f)})})}).addItem(d=>{d.setTitle("Delete").setIcon("lucide-trash").onClick(async()=>{await Ge.findAndProcessOutlineItem(i,h=>{h.remove(),h.updateCountForAllAncestors()},t,n)})}).addItem(d=>{d.setTitle("Extract to new file").setIcon("lucide-file-output").onClick(async()=>{let{lib:h,settings:u}=n,p=await Ge.fromFile(t,n),f=await p.findPDFjsOutlineTreeNode(i);if(!f){new Le.Notice(`${n.manifest.name}: Failed to process the outline item.`);return}let{doc:m}=p,x=f.getExplicitDestination(),g=x?x[0]+1:null,b=null,w=f;for(;!w.nextSibling&&w.parent;)w=w.parent;let y=w.nextSibling;if(y){let D=y.getExplicitDestination();D&&(b=D[0]+1)}else b=m.getPageCount()+1;if(g===null||b===null){new Le.Notice(`${n.manifest.name}: Failed to fetch page numbers from the outline item.`);return}if(g>b){new Le.Notice(`${n.manifest.name}: The page numbers are invalid: the beginning of this section is page ${g}, whereas the next section starts at page ${b}.`);return}g===b&&(b=g+1);let F=h.getAvailablePathForCopy(t);new Gn(n,u.askPageLabelUpdateWhenExtractPage,u.pageLabelUpdateWhenExtractPage,u.askExtractPageInPlace,u.extractPageInPlace).ask().then((D,C)=>{h.composer.extractPages(t,{from:g,to:b-1},F,!1,D,C).then(async k=>{if(!k){new Le.Notice(`${n.manifest.name}: Failed to extract section from PDF.`);return}if(u.openAfterExtractPages){let E=h.workspace.getLeaf(u.howToOpenExtractedPDF);await E.openFile(k),await h.workspace.revealLeaf(E)}})})})}).addSeparator().addItem(d=>{d.setTitle("Customize...").setIcon("lucide-settings").onClick(()=>{n.openSettingTab().scrollToHeading("outline")})}),l.showAtMouseEvent(r)},Hw=(n,e,t,i)=>{let{lib:r}=n;r.isEditable(e)&&new Le.Menu().addItem(o=>{o.setTitle("Add top-level item").setIcon("lucide-plus").onClick(()=>{new jr(n,"Add item to outline").ask().then(async({title:s})=>{let a=r.getPDFViewFromChild(e);if(a){let c=a.getState(),l=r.viewStateToDestArray(c,!0);if(l){await Ge.processOutlineRoot(d=>{d.createChild(s,l).updateCountForAllAncestors(),d.sortChildren()},t,n);return}}new Le.Notice(`${n.manifest.name}: Failed to add the item.`)})})}).showAtMouseEvent(i)},jg=class extends Le.Menu{constructor(e){super(),this.plugin=e}get app(){return this.plugin.app}get settings(){return this.plugin.settings}get lib(){return this.plugin.lib}},Nu=class n extends jg{constructor(e,t){super(e),this.child=t,this.currentSection=null,this.setUseNativeMenu(!1),this.addSections(Object.keys(Jn.contextMenuConfig)),e.settings.enableVimInContextMenu&&Vg(this)}static async fromMouseEvent(e,t,i){let r=new n(e,t);return await r.addItems(i),r}get win(){return this.child.containerEl.win}addItem(e){return this.currentSection?super.addItem(t=>{e(t),t.setSection(this.currentSection)}):super.addItem(e)}async addItems(e){var x,g;let{child:t,plugin:i,lib:r,app:o}=this,s=t.pdfViewer.pdfViewer,a=this.win.getSelection(),c=(x=r.copyLink.getPageAndTextRangeFromSelection(a))!=null?x:s?{page:s.currentPageNumber}:null;if(!c)return;let{page:l,selection:d}=c,h=r.toSingleLine((g=a==null?void 0:a.toString())!=null?g:""),u=b=>{var w;return(w=this.settings.contextMenuConfig.find(y=>y.id===b))==null?void 0:w.visible};Le.Platform.isMacOS&&Le.Platform.isDesktopApp&&this.win.electron&&h&&u("action")&&this.addItem(b=>b.setSection("action").setTitle(`Look up "${h.length<=25?h:h.slice(0,24).trim()+"\u2026"}"`).setIcon("lucide-library").onClick(()=>{this.win.electron.remote.getCurrentWebContents().showDefinitionForSelection()})),h&&h&&d&&t.palette&&(u("selection")&&od.create(this,t.palette).setSection("selection","Copy link to selection","lucide-copy").addItems(i.settings.selectionProductMenuConfig).onItemClick(({copyFormat:b,displayTextFormat:w,colorName:y})=>{r.copyLink.copyLinkToSelection(!1,{copyFormat:b,displayTextFormat:w},y!=null?y:void 0)}),r.isEditable(t)&&u("write-file")&&od.create(this,t.palette).setSection("write-file",`Add ${i.settings.selectionBacklinkVisualizeStyle} to file`,"lucide-edit").setShowNoColorButton(!1).addItems(i.settings.writeFileProductMenuConfig).onItemClick(({copyFormat:b,displayTextFormat:w,colorName:y})=>{r.copyLink.writeHighlightAnnotationToSelectionIntoFileAndCopyLink(!1,{copyFormat:b,displayTextFormat:w},y!=null?y:void 0)}));let p=t.getPage(l),f=e&&t.getAnnotationFromEvt(p,e),m=null;if(await(async()=>{var b;if(f){let{id:w}=r.getAnnotationInfoFromAnnotationElement(f);if(m=await t.getAnnotatedText(p,w),t.palette&&u("annotation")&&od.create(this,t.palette).setSection("annotation","Copy link to annotation","lucide-copy").addItems(i.settings.annotationProductMenuConfig).onItemClick(({copyFormat:y,displayTextFormat:F})=>{r.copyLink.copyLinkToAnnotation(t,!1,{copyFormat:y,displayTextFormat:F},l,w,!1,!0)}),r.isEditable(t)&&u("modify-annotation")){if(i.settings.enableAnnotationContentEdit&&zr.isSubtypeSupported(f.data.subtype)){let y=f.data.subtype;this.addItem(F=>F.setSection("modify-annotation").setTitle("Edit annotation").setIcon("lucide-pencil").onClick(()=>{t.file&&zr.forSubtype(y,i,t.file,l,w).open()}))}i.settings.enableAnnotationDeletion&&this.addItem(y=>y.setSection("modify-annotation").setTitle("Delete annotation").setIcon("lucide-trash").onClick(()=>{t.file&&new ya(i,t.file,l,w).openIfNeccessary()}))}if(f.data.subtype==="Link"&&u("link")){let y=(b=t.pdfViewer.pdfViewer)==null?void 0:b.pdfDocument;if("dest"in f.data&&typeof f.data.dest=="string"&&y&&t.file){let F=f.data.dest,D=t.file;this.addItem(C=>{C.setSection("link").setTitle("Copy PDF link").setIcon("lucide-copy").onClick(async()=>{let k=await r.destIdToSubpath(F,y);if(typeof k=="string"){let E=m;!E&&f.data.rect&&(E=t.getTextByRect(p,f.data.rect));let B=r.generateMarkdownLink(D,"",k,E!=null?E:void 0).slice(1);navigator.clipboard.writeText(B),i.lastCopiedDestInfo={file:D,destName:F}}})}),i.lib.isCitationId(F)&&this.addItem(C=>{C.setSection("link").setTitle("Search on Google Scholar").setIcon("lucide-search").onClick(()=>{var E;let k=(E=this.child.bib)==null?void 0:E.getGoogleScholarSearchUrlFromDest(F);if(typeof k!="string"){new Le.Notice(`${i.manifest.name}: Failed to find bibliographic information.`);return}window.open(k,"_blank")})})}if("url"in f.data&&typeof f.data.url=="string"){let F=f.data.url;this.currentSection="link",o.workspace.handleExternalLinkContextMenu(this,F),this.currentSection=null}}}})(),h&&d&&r.isEditable(t)&&i.lastCopiedDestInfo&&i.lastCopiedDestInfo.file===t.file&&u("link")){if("destArray"in i.lastCopiedDestInfo){let b=i.lastCopiedDestInfo.destArray;this.addItem(w=>w.setSection("link").setTitle("Paste copied PDF link to selection").setIcon("lucide-clipboard-paste").onClick(()=>{r.highlight.writeFile.addLinkAnnotationToSelection(b)}))}else if("destName"in i.lastCopiedDestInfo){let b=i.lastCopiedDestInfo.destName;this.addItem(w=>w.setSection("link").setTitle("Paste copied link to selection").setIcon("lucide-clipboard-paste").onClick(()=>{r.highlight.writeFile.addLinkAnnotationToSelection(b)}))}}h&&u("text")&&this.addItem(b=>b.setSection("text").setTitle("Copy selected text").setIcon("lucide-copy").onClick(()=>{var w;navigator.clipboard.writeText(this.plugin.settings.copyAsSingleLine?h:(w=a==null?void 0:a.toString())!=null?w:"")})),m&&u("text")&&this.addItem(b=>b.setSection("text").setTitle("Copy annotated text").setIcon("lucide-copy").onClick(()=>{navigator.clipboard.writeText(m)})),h&&d&&u("search")&&this.addItem(b=>{b.setSection("search").setTitle("Copy link to search").setIcon("lucide-search").onClick(()=>{r.copyLink.copyLinkToSearch(!1,t,l,h.trim())})}),r.speech.isEnabled()&&h&&u("speech")&&this.addItem(b=>{b.setSection("speech").setTitle("Read aloud selected text").setIcon("lucide-speech").onClick(()=>{r.speech.speak(h)})}),!this.items.length&&u("page")&&this.addItem(b=>{b.setSection("page").setTitle("Copy link to page").setIcon("lucide-copy").onClick(w=>{let y=t.getMarkdownLink(`#page=${l}`,t.getPageLinkAlias(l));w.win.navigator.clipboard.writeText(y);let F=t.file;F&&(i.lastCopiedDestInfo={file:F,destArray:[l-1,"XYZ",null,null,null]})})}),this.items.length&&u("settings")&&this.addItem(b=>{b.setSection("settings").setIcon("lucide-settings").setTitle("Customize menu...").onClick(()=>{this.plugin.openSettingTab().scrollToHeading("context-menu")})}),o.workspace.trigger("pdf-menu",this,{pageNumber:l,selection:h,annot:f})}},od=class n extends ke{constructor(t,i){super(i.plugin);this.clickItemCallback=null;this.itemToColorName=new Map;this.itemToCopyFormat=new Map;this.itemToDisplayTextFormat=new Map;this.rootMenu=t,this.palette=i,this.showNoColorButton=this.settings.noColorButtonInColorPalette}static create(t,i){return t.addChild(new n(t,i))}then(t){return t(this),this}setShowNoColorButton(t){return this.showNoColorButton=t,this}setSection(t,i,r){return this.section=t,this.sectionTitle=i,this.sectionIcon=r,this}addSectionTitle(){this.section&&this.sectionTitle&&this.rootMenu.addItem(t=>{t.setSection(this.section).setTitle(this.sectionTitle).setDisabled(!0),this.sectionIcon&&t.setIcon(this.sectionIcon)})}addItems(t){return this.addSectionTitle(),Le.Platform.isDesktopApp||(t=t.slice(0,1)),Ew(this.rootMenu,t.map(i=>{switch(i){case"color":return this.addColorItems.bind(this);case"copy-format":return this.addCopyFormatItems.bind(this);case"display":return this.addDisplayTextItems.bind(this)}}),{clickableParentItem:!0,vim:this.settings.enableVimInContextMenu}),this}addColorItems(t){let i=Object.keys(this.settings.colors),r=this.palette.getState().selectedColorName,o=r?i.map(s=>s.toLowerCase()).indexOf(r.toLowerCase()):-1;for(let s=this.showNoColorButton?-1:0;s{a.setTitle(s>=0?i[s]:"Don't specify color").onClick(l=>{this.finish({colorName:s>=0?i[s]:null},l)}),t!==this.rootMenu&&a.setChecked(s===o),this.section&&t===this.rootMenu&&a.setSection(this.section),this.itemToColorName.set(a,s>=0?i[s]:null);let c=s>=0?this.settings.colors[i[s]]:"transparent";a.dom.addClass("pdf-plus-color-menu-item"),a.titleEl.before(createDiv("pdf-plus-color-indicator",l=>{l.setCssStyles({backgroundColor:c})}))});Rg(t,100)}addNamedTemplateItems(t,i,r,o,s){for(let a=0;a{c.setTitle(i[a].name).onClick(l=>{s(i[a],l)}),t!==this.rootMenu&&c.setChecked(a===r),o.set(c,i[a].template),this.section&&t===this.rootMenu&&c.setSection(this.section)});Rg(t,100)}addDisplayTextItems(t){this.addNamedTemplateItems(t,this.settings.displayTextFormats,this.palette.getState().displayTextFormatIndex,this.itemToDisplayTextFormat,({template:i},r)=>this.finish({displayTextFormat:i},r))}addCopyFormatItems(t){this.addNamedTemplateItems(t,this.settings.copyCommands,this.palette.getState().actionIndex,this.itemToCopyFormat,({template:i},r)=>this.finish({copyFormat:i},r))}getOptionsFromColorPalette(){return{colorName:this.palette.getColorName(),copyFormat:this.palette.getCopyFormat(),displayTextFormat:this.palette.getDisplayTextFormat()}}getOptions(t){let i=this.getOptionsFromColorPalette();if(Le.Platform.isDesktopApp){let{items:r}=Tw(this.rootMenu);for(let o of r)this.itemToColorName.has(o)?i.colorName=this.itemToColorName.get(o):this.itemToCopyFormat.has(o)?i.copyFormat=this.itemToCopyFormat.get(o):this.itemToDisplayTextFormat.has(o)&&(i.displayTextFormat=this.itemToDisplayTextFormat.get(o))}return Object.assign(i,t),i}updateColorPaletteState(t){let i=t.colorName,r=this.settings.copyCommands.findIndex(({template:s})=>s===t.copyFormat),o=this.settings.displayTextFormats.findIndex(({template:s})=>s===t.displayTextFormat);this.palette.setState({selectedColorName:i,actionIndex:r,displayTextFormatIndex:o}),this.settings.syncColorPaletteItem&&this.settings.syncDefaultColorPaletteItem&&(this.settings.defaultColorPaletteItemIndex=i?Object.keys(this.settings.colors).indexOf(i)+1:0),this.settings.syncColorPaletteAction&&this.settings.syncDefaultColorPaletteAction&&(this.settings.defaultColorPaletteActionIndex=r),this.plugin.settings.syncDisplayTextFormat&&this.plugin.settings.syncDefaultDisplayTextFormat&&(this.plugin.settings.defaultDisplayTextFormatIndex=o),this.plugin.trigger("color-palette-state-change",{source:this.palette})}finish(t,i){var o;let r=this.getOptions(t);this.settings.updateColorPaletteStateFromContextMenu&&!Le.Keymap.isModifier(i,"Mod")&&this.updateColorPaletteState(r),(o=this.clickItemCallback)==null||o.call(this,r),this.rootMenu.hide()}onItemClick(t){this.clickItemCallback=t}},zw=(n,e,t)=>{var l;if(n.defaultPrevented||(l=activeWindow.getSelection())!=null&&l.toString())return;let{lib:i,settings:r,child:o}=e;if(t.page){let d=o.getPage(t.page);if(o.getAnnotationFromEvt(d,n))return}let s=t.getColor(),a=(s==null?void 0:s.type)==="name"?s.name:void 0,c=new Le.Menu().addSections(["copy","color","image"]);s&&c.addItem(d=>{d.setSection("color").setTitle("Unset color").setIcon("lucide-palette").onClick(()=>{i.composer.linkUpdater.updateLinkColor(t.refCache,t.sourcePath,null)})});for(let d of Object.keys(r.colors))d.toLowerCase()!==(a==null?void 0:a.toLowerCase())&&c.addItem(h=>{h.setSection("color").setTitle(`Change color to "${d}"`).setIcon("lucide-palette").onClick(()=>{i.composer.linkUpdater.updateLinkColor(t.refCache,t.sourcePath,{type:"name",name:d})})});if(t.page&&t.FitR){let d=o.getPage(t.page).pdfPage,{left:h,bottom:u,right:p,top:f}=t.FitR;c.addItem(m=>{m.setSection("image").setTitle("Copy as image").setIcon("lucide-image").onClick(()=>{let x=i.pdfPageToImageArrayBuffer(d,{type:"image/png",encoderOptions:1,cropRect:[h,u,p,f]}).then(g=>new Blob([g],{type:"image/png"}));navigator.clipboard.write([new ClipboardItem({"image/png":x})])})})}c.showAtMouseEvent(n),n.preventDefault()};var Kg=require("obsidian");var Uw=async(n,e,t,i)=>{let{app:r,lib:o}=n,s=[];for(let a of e.allItems)s.push((async()=>{let c=await o.copyLink.getTextToCopyForOutlineItemDynamic(t,i,a),l=o.toSingleLine(a.item.title),d=l?`${l.length<=40?l:l.slice(0,39).trim()+"\u2026"}`:"PDF section";r.dragManager.handleDrag(a.selfEl,h=>(r.dragManager.updateSource([a.selfEl],"is-being-dragged"),{source:"pdf-plus",type:"pdf-offset",icon:"lucide-heading",title:d,getText:c,item:a})),r.dragManager.handleDrop(a.selfEl,(h,u,p)=>{if(!o.isEditable(t)||!u||u.source!=="pdf-plus"||u.type!=="pdf-offset")return;let f=u.item;if(f&&!Pg(f,a,!0)&&f.parent!==a&&a.owner===f.owner)return p||(async()=>{let m=await Ge.fromFile(i,n),[x,g]=await Promise.all([m.findPDFjsOutlineTreeNode(a),m.findPDFjsOutlineTreeNode(f)]);if(!x||!g){new Kg.Notice(`${n.manifest.name}: Failed to move the outline item.`);return}x.appendChild(g),x.sortChildren();let b=await m.doc.save();await r.vault.modifyBinary(i,b)})(),{action:`Move into "${d}"`,dropEffect:"move",hoverEl:a.el,hoverClass:"is-being-dragged-over"}},!1)})());await Promise.all(s),r.dragManager.handleDrop(e.childrenEl,(a,c,l)=>{if(!o.isEditable(t)||!c||c.source!=="pdf-plus"||c.type!=="pdf-offset"||a.target!==a.currentTarget)return;let d=c.item;if(d&&d.parent&&e===d.owner)return l||(async()=>{let h=await Ge.fromFile(i,n),u=await(h==null?void 0:h.findPDFjsOutlineTreeNode(d));if(!u){new Kg.Notice(`${n.manifest.name}: Failed to move the outline item.`);return}let p=h.ensureRoot();p.appendChild(u),p.sortChildren();let f=await h.doc.save();await r.vault.modifyBinary(i,f)})(),{action:"Move to top level",dropEffect:"move",hoverEl:e.childrenEl,hoverClass:"is-being-dragged-over"}},!1)},qw=(n,e,t)=>{let{app:i,lib:r}=n;e.pdfViewer.pdfThumbnailViewer.container.querySelectorAll("div.thumbnail[data-page-number]").forEach(o=>{var h;let s=parseInt(o.dataset.pageNumber),c=(h=e.getPage(s).pageLabel)!=null?h:""+s,l=e.pdfViewer.pagesCount,d=""+s===c?`Page ${s}`:`Page ${c} (${s}/${l})`;i.dragManager.handleDrag(o,u=>(i.dragManager.updateSource([o],"is-being-dragged"),{source:"pdf-plus",type:"pdf-page",icon:"lucide-book-open",title:d,getText:p=>r.copyLink.getTextToCopy(e,n.settings.thumbnailLinkCopyFormat,n.settings.thumbnailLinkDisplayTextFormat,t,s,`#page=${s}`,"","",p)}))})},jw=(n,e,t,i,r,o)=>{let{app:s,lib:a}=n,c=t.getPage(r);t.getAnnotatedText(c,o).then(l=>{s.dragManager.handleDrag(e,d=>{s.dragManager.updateSource([e],"is-being-dragged");let h=a.getColorPaletteFromChild(t);if(!h)return null;let u=n.settings.copyCommands[h.actionIndex].template;return{source:"pdf-plus",type:"pdf-annotation",icon:"lucide-highlighter",title:"PDF annotation",getText:p=>a.copyLink.getTextToCopy(t,u,void 0,i,r,`#page=${r}&annotation=${o}`,l!=null?l:"","",p)}})})};var Hu=require("obsidian");var Xr=require("obsidian");var ka=class extends ke{constructor(e,t){super(e),this.file=t,this.events=new Xr.Events}onload(){this.init(),this.registerEvent(this.app.metadataCache.on("changed",(e,t,i)=>{this.update(e.path,i),this.trigger("update")})),this.registerEvent(this.app.metadataCache.on("deleted",e=>{this.deleteCachesForSourcePath(e.path),this.trigger("update")})),this.registerEvent(this.app.vault.on("rename",(e,t)=>{if(e instanceof Xr.TFile){this.deleteCachesForSourcePath(t);let i=this.app.metadataCache.getFileCache(e);i&&this.update(e.path,i),this.trigger("update")}}))}init(){this.pagesMap=new Map,this.sourcePaths=new $t,this.backlinks=new Set;let e=this.app.metadataCache.getBacklinksForFile(this.file);for(let t of e.keys()){let i=e.get(t);for(let r of i!=null?i:[])this.createCache(r,t)}}update(e,t){var r,o,s;this.deleteCachesForSourcePath(e);let i=[...(r=t.links)!=null?r:[],...(o=t.embeds)!=null?o:[],...(s=t.frontmatterLinks)!=null?s:[]];for(let a of i){let c=a.link;this.app.metadataCache.getFirstLinkpathDest((0,Xr.getLinkpath)(c),e)===this.file&&this.createCache(a,e)}}delete(e){this.backlinks.delete(e),this.sourcePaths.deleteValue(e.sourcePath,e),e.page&&this.getPageIndex(e.page).delete(e)}deleteCachesForSourcePath(e){let t=this.sourcePaths.get(e);for(let i of t)this.delete(i)}getPageIndex(e){return this.pagesMap.has(e)||this.pagesMap.set(e,new kt(this,e)),this.pagesMap.get(e)}createCache(e,t){let i=new Gg(this,e);this.backlinks.add(i),i.sourcePath=t;let{subpath:r}=(0,Xr.parseLinktext)(e.link),o=new URLSearchParams(r.startsWith("#")?r.slice(1):r);if(!o.has("page"))return i;let s=+o.get("page");if(!Number.isInteger(s))return i;if(i.page=s,o.has("selection")){let a=o.get("selection").split(",").map(c=>parseInt(c.trim()));if(a.length===4&&a.every(c=>!isNaN(c))){let[c,l,d,h]=a;i.selection={beginIndex:c,beginOffset:l,endIndex:d,endOffset:h}}}if(o.has("annotation")){let a=o.get("annotation");i.annotation={id:a}}if(o.has("offset")){let a=o.get("offset").split(",").map(h=>parseInt(h)),c=a[0],l=a[1],d=a[2];isNaN(d)?i.FitBH={top:l}:i.XYZ={left:c,top:l,zoom:d}}if(o.has("rect")){let a=o.get("rect").split(",").map(u=>parseFloat(u)),[c,l,d,h]=a;i.FitR={left:c,bottom:l,right:d,top:h}}if(o.has("color")){let a=o.get("color"),c=a.split(",").map(l=>parseInt(l));c.length===3&&c.every(l=>!isNaN(l))?i.setColor({rgb:{r:c[0],g:c[1],b:c[2]}}):i.setColor({name:a})}return i}on(e,t,i){return this.events.on(e,t,i)}trigger(e,...t){this.events.trigger(e,...t)}},kt=class n{constructor(e,t){this.sourcePaths=new $t;this.backlinks=new Set;this.selections=new $t;this.annotations=new $t;this.XYZs=new $t;this.FitBHs=new $t;this.FitRs=new $t;this.index=e,this.pageNumber=t}add(e){this.backlinks.add(e),this.sourcePaths.addValue(e.sourcePath,e),e.selection&&this.selections.addValue(n.selectionId(e.selection),e),e.annotation&&this.annotations.addValue(e.annotation.id,e),e.XYZ&&this.XYZs.addValue(n.XYZId(e.XYZ),e),e.FitBH&&this.FitBHs.addValue(n.FitBHId(e.FitBH),e),e.FitR&&this.FitRs.addValue(n.FitRId(e.FitR),e)}delete(e){this.backlinks.delete(e),this.sourcePaths.deleteValue(e.sourcePath,e),e.selection&&this.selections.deleteValue(n.selectionId(e.selection),e),e.annotation&&this.annotations.deleteValue(e.annotation.id,e),e.XYZ&&this.XYZs.deleteValue(n.XYZId(e.XYZ),e),e.FitBH&&this.FitBHs.deleteValue(n.FitBHId(e.FitBH),e),e.FitR&&this.FitRs.deleteValue(n.FitRId(e.FitR),e)}static selectionId(e){return`${e.beginIndex},${e.beginOffset},${e.endIndex},${e.endOffset}`}static selectionIdToParams(e){let[t,i,r,o]=e.split(",").map(s=>parseInt(s));return{beginIndex:t,beginOffset:i,endIndex:r,endOffset:o}}static XYZId(e){return`${e.left},${e.top},${e.zoom}`}static XYZIdToParams(e){let[t,i,r]=e.split(",").map(o=>parseFloat(o));return{left:t,top:i,zoom:r}}static FitBHId(e){return`${e.top}`}static FitBHIdToParams(e){return{top:parseFloat(e)}}static FitRId(e){return`${e.left},${e.bottom},${e.right},${e.top}`}static FitRIdToParams(e){let[t,i,r,o]=e.split(",").map(s=>parseFloat(s));return{left:t,bottom:i,right:r,top:o}}},Gg=class{constructor(e,t){this._sourcePath="";this._page=null;this._selection=null;this._annotation=null;this._XYZ=null;this._FitBH=null;this._FitR=null;this._color=null;this.index=e,this.refCache=t}getPageIndex(){return this.page?this.index.getPageIndex(this.page):null}get file(){return this.index.file}get sourcePath(){return this._sourcePath}set sourcePath(e){this._sourcePath=e,this.index.sourcePaths.addValue(e,this),this.page&&this.index.getPageIndex(this.page).sourcePaths.addValue(e,this)}get page(){return this._page}set page(e){this.page&&this.index.getPageIndex(this.page).delete(this),e&&this.index.getPageIndex(e).add(this),this._page=e}get selection(){return this._selection}set selection(e){let t=this.getPageIndex();t&&(this.selection&&(t==null||t.selections.deleteValue(kt.selectionId(this.selection),this)),e&&t.selections.addValue(kt.selectionId(e),this)),this._selection=e}get annotation(){return this._annotation}set annotation(e){let t=this.getPageIndex();t&&(this.annotation&&(t==null||t.annotations.deleteValue(this.annotation.id,this)),e&&t.annotations.addValue(e.id,this)),this._annotation=e}get XYZ(){return this._XYZ}set XYZ(e){let t=this.getPageIndex();t&&(this.XYZ&&(t==null||t.XYZs.deleteValue(kt.XYZId(this.XYZ),this)),e&&t.XYZs.addValue(kt.XYZId(e),this)),this._XYZ=e}get FitBH(){return this._FitBH}set FitBH(e){let t=this.getPageIndex();t&&(this.FitBH&&(t==null||t.FitBHs.deleteValue(kt.FitBHId(this.FitBH),this)),e&&t.FitBHs.addValue(kt.FitBHId(e),this)),this._FitBH=e}get FitR(){return this._FitR}set FitR(e){let t=this.getPageIndex();t&&(this.FitR&&(t==null||t.FitRs.deleteValue(kt.FitRId(this.FitR),this)),e&&t.FitRs.addValue(kt.FitRId(e),this)),this._FitR=e}setColor(e){"rgb"in e?this._color={type:"rgb",rgb:e.rgb}:this._color={type:"name",name:e.name}}getColor(){return this._color}};var Xg=class extends ke{constructor(e,t){super(e),this.file=t}get index(){var e;return(e=this._index)!=null?e:this._index=this.addChild(new ka(this.plugin,this.file))}processSelection(e,t,i){}processAnnotation(e,t,i){}processXYZ(e,t,i){}processFitBH(e,t,i){}processFitR(e,t,i){}},Zg=class extends ke{constructor(t){super(t.plugin);this.pagewiseCacheToDomsMap=new Map;this.pagewiseStatus=new Map;this.pagewiseOnClearDomCallbacksMap=new $t;this.visualizer=t}get file(){return this.visualizer.file}getCacheToDomsMap(t){let i=this.pagewiseCacheToDomsMap.get(t);return i||(i=new Uc,this.pagewiseCacheToDomsMap.set(t,i)),i}clearDomInPage(t){let i=this.getCacheToDomsMap(t);for(let r of i.values())r.closest(".pdf-plus-backlink-highlight-layer")&&r.remove();this.pagewiseOnClearDomCallbacksMap.get(t).forEach(r=>r()),this.pagewiseCacheToDomsMap.delete(t),this.updateStatus(t,{onPageReady:!1,onTextLayerReady:!1,onAnnotationLayerReady:!1})}clear(){for(let t of this.pagewiseCacheToDomsMap.keys())this.clearDomInPage(t)}getStatus(t){let i=this.pagewiseStatus.get(t);return i||(i={onPageReady:!1,onTextLayerReady:!1,onAnnotationLayerReady:!1},this.pagewiseStatus.set(t,i)),i}isPageProcessed(t){let i=this.getStatus(t);return i.onPageReady&&i.onTextLayerReady&&i.onAnnotationLayerReady}updateStatus(t,i){let r=this.getStatus(t);Object.assign(r,i)}postProcessPageIfReady(t){this.isPageProcessed(t)&&this.postProcessPage(t)}postProcessPage(t){let i=this.getCacheToDomsMap(t);for(let r of i.keys()){let o=r.getColor();for(let s of i.get(r))this.hookBacklinkOpeners(s,r),this.hookBacklinkViewEventHandlers(s,r),this.hookContextMenuHandler(s,r),this.hookClassAdderOnMouseOver(s,r),this.setHighlightColor(s,o)}}hookBacklinkOpeners(t,i){let r="position"in i.refCache?i.refCache.position:void 0,o=r==null?void 0:r.start.line,s={isTriggeredFromBacklinkVisualizer:!0};typeof o=="number"&&(s.scroll=o),this.registerDomEventForCache(i,t,"mouseover",a=>{this.app.workspace.trigger("hover-link",{event:a,source:"pdf-plus",hoverParent:this.visualizer,targetEl:t,linktext:i.sourcePath,sourcePath:this.file.path,state:s})}),this.registerDomEventForCache(i,t,"dblclick",a=>{if(this.plugin.settings.doubleClickHighlightToOpenBacklink){let c=Hu.Keymap.isModEvent(a);this.lib.workspace.openMarkdownLinkFromPDF(i.sourcePath,this.file.path,c,r?{pos:r}:void 0)}})}hookBacklinkViewEventHandlers(t,i){this.registerDomEventForCache(i,t,"mouseover",r=>{this.plugin.settings.highlightBacklinksPane&&this.lib.workspace.iterateBacklinkViews(o=>{if(this.file!==o.file||!o.containerEl.isShown()||!o.pdfManager)return;let s=o.pdfManager.findBacklinkItemEl(i);if(s){s.addClass("hovered-backlink");let a=c=>{Ci(c,s)&&(s.removeClass("hovered-backlink"),t.removeEventListener("mouseout",a))};t.addEventListener("mouseout",a)}})})}hookContextMenuHandler(t,i){this.registerDomEventForCache(i,t,"contextmenu",r=>{zw(r,this.visualizer,i)})}hookClassAdderOnMouseOver(t,i){let r=i.page;if(typeof r=="number"){let o="is-hovered";this.registerDomEventForCache(i,t,"mouseover",()=>{for(let a of this.getCacheToDomsMap(r).get(i))a.addClass(o);let s=()=>{for(let a of this.getCacheToDomsMap(r).get(i))a.removeClass(o);t.removeEventListener("mouseout",s)};t.addEventListener("mouseout",s)})}}setHighlightColor(t,i){if((i==null?void 0:i.type)==="name")t.dataset.highlightColor=i.name.toLowerCase();else if((i==null?void 0:i.type)==="rgb"){let{r,g:o,b:s}=i.rgb;t.setCssProps({"--pdf-plus-color":`rgb(${r}, ${o}, ${s})`,"--pdf-plus-backlink-icon-color":`rgb(${r}, ${o}, ${s})`,"--pdf-plus-rect-color":`rgb(${r}, ${o}, ${s})`})}}onClearDomInPage(t,i){this.pagewiseOnClearDomCallbacksMap.addValue(t,i)}registerDomEventForCache(t,i,r,o,s){this.registerDomEvent(i,r,o,s),t.page&&t.annotation&&this.onClearDomInPage(t.page,()=>{i.removeEventListener(r,o)})}},Yg=class extends ke{constructor(e){super(e.plugin),this.visualizer=e,this.pagewiseIdToRectsMap=new Map}get file(){return this.visualizer.file}get child(){return this.visualizer.child}onload(){this.registerEvent(this.app.vault.on("modify",e=>{e===this.file&&this.pagewiseIdToRectsMap.clear()}))}getIdToRectsMap(e){let t=this.pagewiseIdToRectsMap.get(e);return t||(t=new Map,this.pagewiseIdToRectsMap.set(e,t)),t}getRectsForSelection(e,t){var o;let i=this.getIdToRectsMap(e),r=(o=i.get(t))!=null?o:null;return r||(r=this.computeRectsForSelection(e,t),r?(i.set(t,r),r):null)}computeRectsForSelection(e,t){let i=this.child.getPage(e),{beginIndex:r,beginOffset:o,endIndex:s,endOffset:a}=kt.selectionIdToParams(t),c=i.textLayer;if(!c)return null;let l=Dt(c);return!l||!l.textDivs.length?null:this.lib.highlight.geometry.computeMergedHighlightRects(l,r,o,s,a)}},Vu=class n extends Xg{constructor(e,t,i){super(e,t),this.child=i}static create(e,t,i){return e.addChild(new n(e,t,i))}get hoverPopover(){return this.child.hoverPopover}set hoverPopover(e){this.child.hoverPopover=e,e==null||e.hoverEl.addClass("pdf-plus-backlink-popover")}onload(){this.shouldVisualizeBacklinks()&&(this.domManager=this.addChild(new Zg(this)),this.rectangleCache=this.addChild(new Yg(this)),this.visualize(),this.registerEvent(this.index.on("update",()=>{this.visualize()})))}shouldVisualizeBacklinks(){let e=this.child.pdfViewer;return this.settings.highlightBacklinks&&(Kn(e)||this.settings.highlightBacklinksInCanvas&&ma(e)||this.settings.highlightBacklinksInHoverPopover&&xa(e)||this.settings.highlightBacklinksInEmbed&&es(e))}visualize(){let e=this.child.pdfViewer;this.lib.onPageReady(e,this,t=>{this.domManager.clearDomInPage(t);let i=this.index.getPageIndex(t);for(let[r,o]of i.XYZs)this.processXYZ(t,r,o);for(let[r,o]of i.FitBHs)this.processFitBH(t,r,o);for(let[r,o]of i.FitRs)this.processFitR(t,r,o);this.domManager.updateStatus(t,{onPageReady:!0}),this.domManager.postProcessPageIfReady(t)}),this.lib.onTextLayerReady(e,this,t=>{let i=this.domManager.getStatus(t);if(!i.onPageReady||i.onTextLayerReady)return;let r=this.index.getPageIndex(t);for(let[o,s]of r.selections)this.processSelection(t,o,s);this.domManager.updateStatus(t,{onTextLayerReady:!0}),this.domManager.postProcessPageIfReady(t)}),this.lib.onAnnotationLayerReady(e,this,t=>{let i=this.domManager.getStatus(t);if(!i.onPageReady||i.onAnnotationLayerReady)return;let r=this.index.getPageIndex(t);for(let[o,s]of r.annotations)this.processAnnotation(t,o,s);this.domManager.updateStatus(t,{onAnnotationLayerReady:!0}),this.domManager.postProcessPageIfReady(t)})}processSelection(e,t,i){var d;if(this.settings.highlightColorSpecifiedOnly&&(i=new Set(Array.from(i).filter(h=>h.getColor())),!i.size))return;super.processSelection(e,t,i);let r=this.child.getPage(e),o=this.domManager.getCacheToDomsMap(e),s=r.textLayer;if(!s)return;let a=Dt(s);if(!a)return;let{textDivs:c}=a;if(!c||!c.length)return;let l=this.rectangleCache.getRectsForSelection(e,t);if(l){for(let{rect:h,indices:u}of l){let p=this.lib.highlight.viewer.placeRectInPage(h,r);p.addClasses(["pdf-plus-backlink","pdf-plus-backlink-selection"]);let f=c[u[0]];p.setCssStyles({fontSize:f.style.fontSize}),p.dataset.backlinkId=t;for(let m of i)o.addValue(m,p)}if(this.settings.showBacklinkIconForSelection){let h=(d=l.last())==null?void 0:d.rect;if(h){let u=this.showIcon(h[2],h[3],r);for(let p of i)o.addValue(p,u)}}}}processAnnotation(e,t,i){var u;super.processAnnotation(e,t,i);let r=this.child.getPage(e),o=(u=r.annotationLayer)==null?void 0:u.annotationLayer;if(!o)return;let s=o.getAnnotation(t);if(!s)return;s.container.addClasses(["pdf-plus-backlink","pdf-plus-backlink-annotation"]);let[,,a,c]=s.data.rect,l;this.settings.showBacklinkIconForAnnotation&&(l=this.showIcon(a,c,r));let d;this.settings.showBoundingRectForBacklinkedAnnot&&(d=this.lib.highlight.viewer.placeRectInPage(s.data.rect,r),d.addClass("pdf-plus-annotation-bounding-rect"));let h=this.domManager.getCacheToDomsMap(e);for(let p of i){h.addValue(p,s.container),l&&h.addValue(p,l),d&&h.addValue(p,d);let[f,m,x]=s.data.color;p.setColor({rgb:{r:f,g:m,b:x}})}}processXYZ(e,t,i){if(super.processXYZ(e,t,i),this.settings.showBacklinkIconForOffset){let r=this.child.getPage(e),{left:o,top:s}=kt.XYZIdToParams(t),a=this.showIcon(o,s,r,"left"),c=this.domManager.getCacheToDomsMap(e);for(let l of i)c.addValue(l,a)}}processFitBH(e,t,i){if(super.processFitBH(e,t,i),this.settings.showBacklinkIconForOffset){let r=this.child.getPage(e),{top:o}=kt.FitBHIdToParams(t),s=this.showIcon(0,o,r),a=this.domManager.getCacheToDomsMap(e);for(let c of i)a.addValue(c,s)}}processFitR(e,t,i){if(i=new Set(Array.from(i).filter(h=>!h.annotation)),!i.size)return;super.processFitR(e,t,i);let r=this.child.getPage(e),{left:o,bottom:s,right:a,top:c}=kt.FitRIdToParams(t),l=this.lib.highlight.viewer.placeRectInPage([o,s,a,c],r);l.addClasses(["pdf-plus-backlink","pdf-plus-backlink-fit-r"]);let d=this.domManager.getCacheToDomsMap(e);for(let h of i)d.addValue(h,l);if(this.settings.showBacklinkIconForRect){let h=this.showIcon(a,c,r);for(let u of i)d.addValue(u,h)}}showIcon(e,t,i,r="right"){var h;let o=Math.min(i.viewport.rawDims.pageWidth,i.viewport.rawDims.pageWidth)*this.settings.backlinkIconSize/2e3,s=[e,t-o,e+o,t],a=[e-o,t-o,e,t],c=r==="left"&&a[0]>=((h=i.viewport.rawDims.pageX)!=null?h:0)?a:s,l=this.lib.highlight.viewer.placeRectInPage(c,i);l.addClass("pdf-plus-backlink-icon"),(0,Hu.setIcon)(l,"links-coming-in");let d=l.querySelector("svg");return d==null||d.setAttribute("stroke","var(--pdf-plus-backlink-icon-color)"),l}};var Zr=require("obsidian");var ze=require("obsidian");var Ei=class Ei extends ke{constructor(e,t,i){super(e),this.child=t,this.toolbarLeftEl=i,this.spacerEl=null,this.paletteEl=null,this.itemEls=[],this.actionMenuEl=null,this.displayTextFormatMenuEl=null,this.writeFileButtonEl=null,this.cropButtonEl=null,this.statusContainerEl=null,this.statusEl=null,this.importButtonEl=null,this.selectedColorName=null,this.actionIndex=e.settings.defaultColorPaletteActionIndex,this.displayTextFormatIndex=e.settings.defaultDisplayTextFormatIndex,this.writeFile=this.lib.isEditable(this.child)&&e.settings.defaultWriteFileToggle}onload(){if(this.toolbarLeftEl.querySelectorAll("."+Ei.CLS).forEach(e=>{var t;(t=Ei.elInstanceMap.get(e))==null||t.unload()}),!(!this.plugin.settings.colorPaletteInEmbedToolbar&&this.toolbarLeftEl.closest(".pdf-embed"))){if(this.spacerEl=this.toolbarLeftEl.createDiv("pdf-toolbar-spacer"),this.paletteEl=this.toolbarLeftEl.createDiv(Ei.CLS),Ei.elInstanceMap.set(this.paletteEl,this),this.plugin.settings.colorPaletteInToolbar){this.addItem(this.paletteEl,null,"transparent");for(let[e,t]of Object.entries(this.plugin.settings.colors))this.addItem(this.paletteEl,e,t);this.setActiveItem([null,...Object.keys(this.plugin.settings.colors)][this.plugin.settings.defaultColorPaletteItemIndex])}this.actionMenuEl=this.addCopyActionDropdown(this.paletteEl),this.displayTextFormatMenuEl=this.addDisplayTextFormatDropdown(this.paletteEl),this.addCropButton(this.paletteEl),this.child.isFileExternal?this.addImportButton(this.paletteEl):this.addWriteFileToggle(this.paletteEl),this.statusContainerEl=this.paletteEl.createDiv("pdf-plus-color-palette-status-container"),this.statusEl=this.statusContainerEl.createSpan("pdf-plus-color-palette-status"),this.registerEvent(this.plugin.on("color-palette-state-change",({source:e})=>{e!==this&&this.syncTo(e)}))}}onunload(){var e;(e=this.spacerEl)==null||e.remove(),this.paletteEl&&(this.paletteEl.remove(),Ei.elInstanceMap.delete(this.paletteEl))}addItem(e,t,i){if(t&&!cn(i)||t===null&&!this.plugin.settings.noColorButtonInColorPalette)return;let r=e.createDiv({cls:[Ei.CLS+"-item","clickable-icon"],attr:t?{"data-highlight-color":t.toLowerCase()}:void 0});this.itemEls.push(r),r.createDiv(Ei.CLS+"-item-inner"),this.setTooltipToActionItem(r,t),r.addEventListener("pointerup",s=>this.onItemPointerUp(r,t,s));let o=!1;r.addEventListener("contextmenu",()=>{if(o)return;let s=new ze.Menu().addItem(a=>{a.setIcon("lucide-settings").setTitle("Customize...").onClick(()=>{this.plugin.openSettingTab().scrollTo("colors")})});s.onHide(()=>{o=!1}),jn(s,r),o=!0})}onItemPointerUp(e,t,i){let r=!e.hasClass("is-active");this.setActiveItem(t),this.plugin.settings.syncColorPaletteItem&&this.plugin.settings.syncDefaultColorPaletteItem&&(this.plugin.settings.defaultColorPaletteItemIndex=t?Object.keys(this.plugin.settings.colors).indexOf(t)+1:0),r&&this.plugin.trigger("color-palette-state-change",{source:this});let o=this.plugin.settings.copyCommands[this.actionIndex].template;this.writeFile?this.lib.copyLink.writeHighlightAnnotationToSelectionIntoFileAndCopyLink(!1,{copyFormat:o},t!=null?t:void 0):this.lib.copyLink.copyLinkToSelection(!1,{copyFormat:o},t!=null?t:void 0),i.preventDefault()}setActiveItem(e){this.selectedColorName=e?e.toLowerCase():null,this.itemEls.forEach(t=>{t.toggleClass("is-active",this.selectedColorName===t.dataset.highlightColor||this.selectedColorName===null&&t.dataset.highlightColor===void 0)})}addDropdown(e,t,i,r,o,s){return e.createDiv("clickable-icon",a=>{(0,ze.setIcon)(a,"lucide-chevron-down"),(0,ze.setTooltip)(a,r),a.dataset.checkedIndex=""+this[i];let c=!1;a.addEventListener("click",()=>{if(c)return;let l=new ze.Menu;for(let d=0;d{u.setTitle(h).setChecked(this[i]===d).onClick(()=>{let p=this[i]!==d;this.setCheckedIndex(i,d,a),o==null||o(),p&&this.plugin.trigger("color-palette-state-change",{source:this})})})}s==null||s(l),l.onHide(()=>{c=!1}),jn(l,a),c=!0})})}setCheckedIndex(e,t,i){this[e]=t,i.dataset.checkedIndex=""+t}setActionIndex(e){this.actionMenuEl&&this.setCheckedIndex("actionIndex",e,this.actionMenuEl),this.updateTooltips()}setDisplayTextFormatIndex(e){this.displayTextFormatMenuEl&&this.setCheckedIndex("displayTextFormatIndex",e,this.displayTextFormatMenuEl)}addCopyActionDropdown(e){let t="Link copy format";this.plugin.settings.colorPaletteInToolbar||(t=`${this.plugin.manifest.name}: link copy options (trigger via hotkeys)`);let i=this.addDropdown(e,this.plugin.settings.copyCommands.map(r=>r.name),"actionIndex",t,()=>{this.updateTooltips(),this.plugin.settings.syncColorPaletteAction&&this.plugin.settings.syncDefaultColorPaletteAction&&(this.plugin.settings.defaultColorPaletteActionIndex=this.actionIndex)},r=>{r.addItem(o=>{o.setTitle("Customize...").setIcon("lucide-settings").onClick(()=>{this.plugin.openSettingTab().scrollTo("copyCommands")})})});return i.addClass("pdf-plus-action-menu"),i}addDisplayTextFormatDropdown(e){let t=this.addDropdown(e,this.plugin.settings.displayTextFormats.map(i=>i.name),"displayTextFormatIndex","Display text format",()=>{this.plugin.settings.syncDisplayTextFormat&&this.plugin.settings.syncDefaultDisplayTextFormat&&(this.plugin.settings.defaultDisplayTextFormatIndex=this.displayTextFormatIndex)},i=>{i.addItem(r=>{r.setTitle("Customize...").setIcon("lucide-settings").onClick(()=>{this.plugin.openSettingTab().scrollTo("displayTextFormats")})})});return t.addClass("pdf-plus-display-text-format-menu"),t}addWriteFileToggle(e){this.removeWriteFileToggle(),this.writeFileButtonEl=e.createDiv("clickable-icon",t=>{(0,ze.setIcon)(t,"lucide-edit"),(0,ze.setTooltip)(t,`Add ${this.plugin.settings.selectionBacklinkVisualizeStyle}s to file directly`),t.toggleClass("is-disabled",!this.lib.isEditable(this.child));let i=!1;t.addEventListener("click",()=>{if(!this.lib.isEditable(this.child)){if(i)return;let r=new ze.Menu().addItem(o=>{o.setIcon("lucide-settings").setTitle("Enable PDF editing...").onClick(()=>{this.plugin.openSettingTab().scrollToHeading("edit")})});r.onHide(()=>{i=!1}),jn(r,t),i=!0;return}this.setWriteFile(!this.writeFile),this.plugin.settings.syncWriteFileToggle&&this.plugin.settings.syncDefaultWriteFileToggle&&(this.plugin.settings.defaultWriteFileToggle=this.writeFile),this.plugin.trigger("color-palette-state-change",{source:this})}),t.addEventListener("contextmenu",()=>{if(i)return;let r=new ze.Menu;this.lib.isEditable(this.child)&&r.addItem(o=>{o.setIcon("lucide-settings").setTitle("Customize...").onClick(()=>{this.plugin.openSettingTab().scrollToHeading("annot")})}),r.addItem(o=>{o.setIcon("lucide-settings").setTitle(this.lib.isEditable(this.child)?"Disable PDF editing...":"Enable PDF editing...").onClick(()=>{this.plugin.openSettingTab().scrollToHeading("edit")})}),r.onHide(()=>{i=!1}),jn(r,t),i=!0})}),this.cropButtonEl&&e.insertAfter(this.writeFileButtonEl,this.cropButtonEl),this.setWriteFile(this.writeFile)}removeWriteFileToggle(){var e;(e=this.writeFileButtonEl)==null||e.remove(),this.writeFileButtonEl=null}addImportButton(e){this.removeImportButton(),this.importButtonEl=e.createDiv("clickable-icon",t=>{(0,ze.setIcon)(t,"lucide-import"),(0,ze.setTooltip)(t,"Import external PDF into vault"),t.addEventListener("click",()=>{this.importFile()})}),this.cropButtonEl&&e.insertAfter(this.importButtonEl,this.cropButtonEl)}removeImportButton(){var e;(e=this.importButtonEl)==null||e.remove(),this.importButtonEl=null}async importFile(){let e=this.child.externalFileUrl,t=this.child.file;if(!e||!t)return;if(!ze.Platform.isDesktopApp&&e.startsWith(ze.Platform.resourcePathPrefix)){new ze.Notice(`${this.plugin.manifest.name}: Importing local PDFs outside the vault is supported only on the desktop app.`);return}let i=await fetch(e);if(i.ok){let r=await i.arrayBuffer();await this.app.vault.modifyBinary(t,r),this.removeImportButton(),this.paletteEl&&this.addWriteFileToggle(this.paletteEl),new ze.Notice(`${this.plugin.manifest.name}: Successfully imported the PDF file into the vault.`);return}new ze.Notice(`${this.plugin.manifest.name}: Import failed. Response status: ${i.status}`)}setWriteFile(e){var t;this.writeFile=e,(t=this.writeFileButtonEl)==null||t.toggleClass("is-active",e)}addCropButton(e){this.cropButtonEl=e.createDiv("clickable-icon pdf-plus-rect-select",t=>{(0,ze.setIcon)(t,"lucide-box-select"),(0,ze.setTooltip)(t,"Copy embed link to rectangular selection"),t.addEventListener("click",()=>{this.startRectangularSelection(!1)});let i=!1;t.addEventListener("contextmenu",()=>{if(i)return;let r=new ze.Menu().addItem(o=>{o.setIcon("lucide-settings").setTitle("Customize...").onClick(()=>{this.plugin.openSettingTab().scrollToHeading("rect")})});r.onHide(()=>{i=!1}),jn(r,t),i=!0})})}startRectangularSelection(e){var l;let t=this.cropButtonEl;if(!t)return;let i=this.child;if(!((l=i.pdfViewer.dom)!=null&&l.viewerEl))return;let r=i.pdfViewer.dom.viewerEl,o={left:0,top:0,width:0,height:0},s=d=>{if(!It(d,d.target))return;let h=d.target.closest("div.page[data-page-number]");if(!h)return;let u=h.dataset.pageNumber;if(!u)return;let p=i.getPage(+u),{x:f,y:m}=fu(d);o.left=f,o.top=m;let x=h.createDiv("pdf-plus-select-box"),g=h.getBoundingClientRect(),b=getComputedStyle(h),w=parseFloat(b.borderTopWidth),y=parseFloat(b.borderLeftWidth),F=parseFloat(b.paddingTop),D=parseFloat(b.paddingLeft);x.setCssStyles({left:o.left-(g.left+y+D)+"px",top:o.top-(g.top+w+F)+"px"});let C=B=>{let{x:S,y:I}=fu(B),O=h.getBoundingClientRect();o.width=S-o.left-(O.left-g.left),o.height=I-o.top-(O.top-g.top),x.setCssStyles({width:o.width+"px",height:o.height+"px"}),B.preventDefault(),B.stopImmediatePropagation()},k=B=>{B.preventDefault(),B.stopImmediatePropagation()},E=()=>{var N;if(h.removeEventListener("pointermove",C),h.removeEventListener("touchmove",k),h.removeEventListener("pointerup",E),h.removeChild(x),o.height<=0||o.width<=0)return;let B=o.left-(g.left+y+D),S=o.top-(g.top+w+F),I=B+o.width,O=S+o.height,A=window.pdfjsLib.Util.normalizeRect([...p.getPagePoint(B,O),...p.getPagePoint(I,S)]);this.lib.copyLink.copyEmbedLinkToRect(!1,i,p.id,A,this.plugin.settings.includeColorWhenCopyingRectLink&&(N=this.selectedColorName)!=null?N:void 0,e),c()};this.registerDomEvent(h,"pointermove",C),this.registerDomEvent(h,"touchmove",k),this.registerDomEvent(h,"pointerup",E)},a=d=>{d.key==="Escape"&&c()},c=()=>{var d;t.toggleClass("is-active",!t.hasClass("is-active")),r.toggleClass("pdf-plus-selecting",t.hasClass("is-active")),this.register(()=>r.removeClass("pdf-plus-selecting")),(d=activeWindow.getSelection())==null||d.empty(),t.hasClass("is-active")?(this.registerDomEvent(r,"pointerdown",s),this.registerDomEvent(r.doc,"keydown",a)):(r.removeEventListener("pointerdown",s),r.doc.removeEventListener("keydown",a))};c()}setStatus(e,t){this.plugin.settings.showStatusInToolbar&&this.statusEl&&(this.statusEl.setText(e),t>0&&setTimeout(()=>{var i;((i=this.statusEl)==null?void 0:i.getText())===e&&this.statusEl.setText("")},t))}setTooltipToActionItem(e,t){let i=e.querySelector(":scope > ."+Ei.CLS+"-item-inner"),r=this.plugin.settings.copyCommands[this.actionIndex].name,o=this.plugin.settings.quietColorPaletteTooltip,s=t!==null?o?t:`Copy link with format "${r}" & add ${t.toLowerCase()} ${this.plugin.settings.selectionBacklinkVisualizeStyle}`:o?"No color specified":`Copy link with "${r}" format without specifying color`;(0,ze.setTooltip)(i,s)}updateTooltips(){this.itemEls.forEach(e=>{var t;this.setTooltipToActionItem(e,(t=e.dataset.highlightColor)!=null?t:null)})}getState(){return{selectedColorName:this.selectedColorName,actionIndex:this.actionIndex,displayTextFormatIndex:this.displayTextFormatIndex,writeFile:this.writeFile}}setState(e){typeof e.selectedColorName=="string"&&this.setActiveItem(e.selectedColorName),typeof e.actionIndex=="number"&&this.setActionIndex(e.actionIndex),typeof e.displayTextFormatIndex=="number"&&this.setDisplayTextFormatIndex(e.displayTextFormatIndex),typeof e.writeFile=="boolean"&&this.setWriteFile(e.writeFile)}getColorName(){return this.getState().selectedColorName}getCopyFormat(){let e=this.getState();return this.plugin.settings.copyCommands[e.actionIndex].template}getDisplayTextFormat(){let e=this.getState();return this.plugin.settings.displayTextFormats[e.displayTextFormatIndex].template}syncTo(e){let t=e.getState();this.plugin.settings.syncColorPaletteItem||delete t.selectedColorName,this.plugin.settings.syncColorPaletteAction||delete t.actionIndex,this.plugin.settings.syncDisplayTextFormat||delete t.displayTextFormatIndex,this.plugin.settings.syncWriteFileToggle||delete t.writeFile,this.setState(t)}};Ei.CLS="pdf-plus-color-palette",Ei.elInstanceMap=new Map;var ti=Ei;var Ca=class extends ke{constructor(e,t,i){super(e),this.toolbar=t,this.child=i}onload(){this.addColorPalette(),this.replaceDisplayOptionsDropdown(),this.addZoomLevelInputEl(),this.makeDropdownInToolbarHoverable()}onunload(){}addColorPalette(){this.child.palette=this.addChild(new ti(this.plugin,this.child,this.toolbar.toolbarLeftEl))}makeDropdownInToolbarHoverable(){let{toolbar:e,plugin:t}=this;!t.settings.hoverableDropdownMenuInToolbar||Zr.Platform.isPhone||e.toolbarLeftEl.querySelectorAll("div.clickable-icon").forEach(i=>{let r=i.firstElementChild;if(r&&r.matches("svg.lucide-chevron-down")){let o=null;jc({parentEl:i,createChildEl:()=>{if(!i.hasClass("has-active-menu")){i.click();for(let s of t.shownMenus)if(s.parentEl===i)return o=s,s.dom}return o=null},removeChildEl:()=>{o&&(o.hide(),o=null)},component:this.child.component,timeout:200})}})}replaceDisplayOptionsDropdown(){let{app:e,toolbar:t,child:i}=this,r=t.zoomInEl.nextElementSibling;if(!(r!=null&&r.hasClass("clickable-icon")))return;let o=r.firstElementChild;if(!(o!=null&&o.matches("svg.lucide-chevron-down")))return;let s=t.pdfViewer.eventBus,a=t.pdfViewer.pdfViewer;!s||!a||t.zoomInEl.after(createDiv("clickable-icon",c=>{(0,Zr.setIcon)(c,"lucide-chevron-down"),(0,Zr.setTooltip)(c,"Display options");let l=!1;c.addEventListener("click",()=>{if(!l){let d=a.currentScaleValue,h=a.scrollMode,u=a.spreadMode,p=!!e.loadLocalStorage("pdfjs-is-themed"),f=new Zr.Menu().addSections(["zoom","scroll","spread","appearance","settings"]).addItem(m=>{m.setSection("zoom").setIcon("lucide-move-horizontal").setTitle("Fit width").setChecked(d==="page-width").onClick(()=>s.dispatch("scalechanged",{source:t,value:"page-width"}))}).addItem(m=>{m.setSection("zoom").setIcon("lucide-move-vertical").setTitle("Fit height").setChecked(d==="page-height").onClick(()=>s.dispatch("scalechanged",{source:t,value:"page-height"}))}).addItem(m=>{m.setSection("zoom").setIcon("lucide-move").setTitle("Fit page").setChecked(d==="page-fit").onClick(()=>s.dispatch("scalechanged",{source:t,value:"page-fit"}))}).addItem(m=>{m.setSection("scroll").setIcon("lucide-chevrons-up-down").setTitle("Vertical scroll").setChecked(h===0).onClick(()=>{s.dispatch("switchscrollmode",{source:t,mode:0})})}).addItem(m=>{m.setSection("scroll").setIcon("lucide-chevrons-left-right").setTitle("Hotizontal scroll").setChecked(h===1).onClick(()=>{s.dispatch("switchscrollmode",{source:t,mode:1})})}).addItem(m=>{m.setSection("scroll").setIcon("lucide-sticky-note").setTitle("In-page scroll").setChecked(h===3).onClick(()=>{s.dispatch("switchscrollmode",{source:t,mode:3})})}).addItem(m=>{m.setSection("scroll").setIcon("lucide-wrap-text").setTitle("Wrapped scroll").setChecked(h===2).onClick(()=>{s.dispatch("switchscrollmode",{source:t,mode:2})})}).addItem(m=>{m.setSection("spread").setIcon("lucide-rectangle-vertical").setTitle("Single page").setChecked(u===0).onClick(()=>{s.dispatch("switchspreadmode",{source:t,mode:0})})}).addItem(m=>{m.setSection("spread").setIcon("rectangle-vertical-double").setTitle("Two pages (odd)").setChecked(u===1).onClick(()=>{s.dispatch("switchspreadmode",{source:t,mode:1})})}).addItem(m=>{m.setSection("spread").setIcon("rectangle-vertical-double").setTitle("Two pages (even)").setChecked(u===2).onClick(()=>{s.dispatch("switchspreadmode",{source:t,mode:2})})}).addItem(m=>{m.setSection("appearance").setIcon("lucide-palette").setTitle("Adapt to theme").setChecked(p).onClick(()=>{e.saveLocalStorage("pdfjs-is-themed",p?null:"true"),i.onCSSChange(),this.plugin.trigger("adapt-to-theme-change",{adapt:!p})})}).addItem(m=>{m.setSection("settings").setIcon("lucide-settings").setTitle("Customize defaults...").onClick(()=>{this.plugin.openSettingTab().scrollToHeading("viewer-option")})});f.onHide(()=>{l=!1}),jn(f,c),l=!0}}),t.toolbarEl.doc.win.setTimeout(()=>{r.remove(),t.toolbarLeftEl.insertAfter(c,t.zoomInEl)})}))}addZoomLevelInputEl(){if(!this.settings.zoomLevelInputBoxInToolbar)return;let{toolbar:e}=this,t=e.pdfViewer.eventBus,i=e.pdfViewer.pdfViewer;if(!t||!i)return;let r=e.zoomOutEl.nextElementSibling;r!=null&&r.hasClass("pdf-toolbar-divider")&&(r.remove(),this.register(()=>e.zoomOutEl.after(createDiv("pdf-toolbar-divider"))),e.zoomOutEl.after(createEl("input","pdf-zoom-level-input",o=>{this.register(()=>o.remove()),o.type="number",o.addEventListener("click",()=>o.select()),o.addEventListener("change",()=>{let s=o.valueAsNumber/100,a=Math.min(Math.max(s,window.pdfjsViewer.MIN_SCALE),window.pdfjsViewer.MAX_SCALE);i.currentScale=a}),t.on("scalechanging",({scale:s})=>{o.value=Math.round(s*100)+""}),i.currentScale&&(o.value=Math.round(i.currentScale*100)+""),o.doc.win.setTimeout(()=>{o.after(createSpan({cls:"pdf-zoom-level-percent",text:"%"},s=>{this.register(()=>s.remove())}))})})))}};Ca.elInstanceMap=new Map;var _g=Wi(require("obsidian"));var ns=class extends ke{constructor(e,t){super(e),this.child=t}get file(){return this.child.file}get pdf(){return this.file}get folder(){var e,t;return(t=(e=this.file)==null?void 0:e.parent)!=null?t:null}get pdfViewer(){return this.child.pdfViewer}get dom(){return this.child.pdfViewer.dom}get doc(){return this.child.containerEl.doc}get obsidian(){return _g}get text(){var t;let e=(t=this.doc.getSelection())==null?void 0:t.toString();return e?this.lib.toSingleLine(e):""}get selection(){return this.text}get page(){var t,i,r,o;let e=this.doc.getSelection();return(o=(r=e&&((t=this.lib.copyLink.getPageAndTextRangeFromSelection(e))==null?void 0:t.page))!=null?r:(i=this.pdfViewer.pdfViewer)==null?void 0:i.currentPageNumber)!=null?o:null}get pageLabel(){let e=this.page;return e!==null?this.child.getPage(e).pageLabel:null}get pageCount(){var e,t;return(t=(e=this.pdfViewer.pdfViewer)==null?void 0:e.pagesCount)!=null?t:null}get color(){var e,t,i;return(i=(t=(e=this.child.palette)==null?void 0:e.getColorName())==null?void 0:t.toLowerCase())!=null?i:null}evaluateTemplate(e,t,i){if(!this.file||typeof this.page!="number")return"";let r=this.lib.copyLink.getPageAndTextRangeFromSelection(this.doc.getSelection());if(!r)return"";let{page:o,selection:s}=r;if(!s)return"";let a=Gc({page:o,selection:`${s.beginIndex},${s.beginOffset},${s.endIndex},${s.endOffset}`,color:i?i.toLowerCase():void 0});return this.lib.copyLink.getTextToCopy(this.child,e,t,this.file,this.page,a,this.text,i?i.toLowerCase():"")}writeFile(e,t,i){var r;return this.lib.write(_g.normalizePath(e),t,(r=i==null?void 0:i.existOk)!=null?r:!1)}async run(e){return Eg("const app=this.app;const api = this;"+e,this)}};var Ww=require("obsidian");var fC=n=>It(n,n.target)&&ng(n.target),zu=class n extends Ww.Scope{constructor(t){super(t);this.modeToKeymaps={};this.currentMode=null;this.currentKeys="";this.searchFrom=0;this.searchTo=-1;this.onEscapeCallbacks=[];this.escapeAliases=[];this.typableModes=[]}registerKeymaps(t,i){let r=(o,s)=>ts(o.keys,s.keys);for(let o of t){if(!this.modeToKeymaps.hasOwnProperty(o)){this.modeToKeymaps[o]=Object.entries(i).map(([s,a])=>({keys:s,func:a})).sort(r);continue}for(let s in i){let a=i[s],c={keys:s,func:a},l=this.modeToKeymaps[o],{found:d,index:h}=hn(l,u=>r(c,u));d?l[h]=c:l.splice(h,0,c)}}}unregisterAllKeymaps(t){for(let i of t)this.modeToKeymaps[i]&&(this.modeToKeymaps[i].length=0)}map(t,i){for(let r of t){let o=Object.fromEntries(Object.entries(i).map(([s,a])=>[s,c=>{let{found:l,index:d}=hn(this.modeToKeymaps[r],h=>ts(a,h.keys));if(l){let h=this.modeToKeymaps[r][d].func;return h(c)}}]));this.registerKeymaps([r],o)}}noremap(t,i){for(let r of t)if(this.modeToKeymaps.hasOwnProperty(r))for(let o in i){let s=i[o],{found:a,index:c}=hn(this.modeToKeymaps[r],l=>ts(s,l.keys));if(a){let l=this.modeToKeymaps[r][c];this.registerKeymaps([r],{[o]:l.func})}}}unmap(t,i){for(let r of t)if(this.modeToKeymaps.hasOwnProperty(r))for(let o of i){let{found:s,index:a}=hn(this.modeToKeymaps[r],c=>ts(o,c.keys));s&&this.modeToKeymaps[r].splice(a,1)}}setMode(t){this.currentMode=t,this.reset()}clearKeys(){this.currentKeys=""}reset(){this.clearKeys(),this.searchFrom=0,this.searchTo=-1}onEscape(t){this.onEscapeCallbacks.push(t)}addEscapeAliases(...t){this.escapeAliases.push(...t)}setTypable(...t){this.typableModes.push(...t)}handleKey(t,i){let r=!0;(()=>{if(this.currentMode===null)return this.reset();if(this.typableModes.includes(this.currentMode)!==fC(t))return;let o=n.canonicalizeKey(i);if(o===null)return this.reset();if(o===""||this.escapeAliases.includes(o))return this.onEscapeCallbacks.forEach(h=>h(o==="")),this.reset();this.currentKeys+=o;let s=this.currentKeys.match(/^([1-9]\d*)?([\D0][\d\D]*)?/);if(!s)return this.reset();let a=s[1]?+s[1]:void 0,c=s[2];if(!c)return;let l=this.modeToKeymaps[this.currentMode];if(!l||l.length===0)return this.reset();let d=kg(l,c,h=>h.keys,{from:(l.length+this.searchFrom)%l.length,to:(l.length+this.searchTo)%l.length});if(!d)return this.reset();if(d.from===d.to){let h=l[d.from];if(h.keys===c){this.reset(),h.func(a),t.preventDefault(),r=!1;return}}this.searchFrom=d.from,this.searchTo=d.to})(),r&&this.parent&&this.parent.handleKey(t,i)}static canonicalizeKey(t){var r;if(t.modifiers===null||t.key===null)return null;let i=n.canonicalizeSpecialKey(t.key);switch(t.modifiers){case"":return i?`<${i}>`:t.key;case"Shift":return t.key.length===1&&t.key!==" "?t.key:``;case"Ctrl":return``;case"Alt":return``;case"Meta":return``;default:return null}}static canonicalizeSpecialKey(t){switch(t){case"<":return"lt";case"Backspace":return"BS";case"Tab":return"Tab";case"Enter":return"CR";case"Escape":return"Esc";case" ":return"Space";case"\\":return"Bslash";case"|":return"Bar";case"ArrowUp":return"Up";case"ArrowDown":return"Down";case"ArrowLeft":return"Left";case"ArrowRight":return"Right";default:return null}}};var Uu=class{constructor(e){this.lastScroll=0;this.lastScrollInterval=0;this.vim=e}get settings(){return this.vim.settings}get viewerContainerEl(){var e,t;return(t=(e=this.vim.obsidianViewer)==null?void 0:e.dom)==null?void 0:t.viewerContainerEl}getPageDiv(e=0){var i;let t=this.vim.pdfViewer;if(t)return(i=t._pages[t.currentPageNumber-1+e])==null?void 0:i.div}scrollTo(e,t){let i=this.viewerContainerEl;if(!i)return;let r=this.isFirstScrollInAWhile(),o=r?this.settings.vimScrollSize:this.settings.vimContinuousScrollSpeed*this.lastScrollInterval;this.vim.pdfViewer&&this.settings.vimLargerScrollSizeWhenZoomIn&&(o*=Math.max(1,this.vim.pdfViewer.currentScale)),t!=null||(t=1),o*=t;let a={behavior:this.settings.vimSmoothScroll&&r?"smooth":"instant"};switch(e){case"left":a.left=-o;break;case"right":a.left=o;break;case"up":a.top=-o;break;case"down":a.top=o;break}i.scrollBy(a)}isFirstScrollInAWhile(){let e=Date.now();return this.lastScrollInterval=e-this.lastScroll,this.lastScroll=e,this.lastScrollInterval>100}scrollToTop(){if(!this.viewerContainerEl)return;let e=this.getPageDiv();e&&this.viewerContainerEl.scrollTo({top:e.offsetTop,behavior:this.settings.vimSmoothScroll?"smooth":"instant"})}scrollToBottom(){if(!this.viewerContainerEl)return;let e=this.getPageDiv();e&&this.viewerContainerEl.scrollTo({top:e.offsetTop+e.offsetHeight-this.viewerContainerEl.clientHeight,behavior:this.settings.vimSmoothScroll?"smooth":"instant"})}scrollVerticallyByVisualPage(e){if(!this.viewerContainerEl)return;let t=this.viewerContainerEl.clientHeight;t*=e,this.viewerContainerEl.scrollBy({top:t,behavior:this.settings.vimSmoothScroll?"smooth":"instant"})}scrollHorizontallyByVisualPage(e){if(!this.viewerContainerEl)return;let t=this.viewerContainerEl.clientWidth;t*=e,this.viewerContainerEl.scrollBy({left:t,behavior:this.settings.vimSmoothScroll?"smooth":"instant"})}};var Gw=require("obsidian");var Kw=200,qu=class{constructor(e){this.isActive=!1;this.isForward=!0;this.vim=e}get settings(){return this.vim.settings}get lib(){return this.vim.lib}get incsearch(){return this.settings.vimIncsearch}get hlsearch(){return this.settings.vimHlsearch}get findBar(){var e;return(e=this.vim.obsidianViewer)==null?void 0:e.findBar}findNext(e=1,t=!0){if(this.isActive&&this.findBar){for(this.vim.visualMode.rememberSelection();e-- >0;)this.findBar.dispatchEvent("again",t?!this.isForward:this.isForward);this.restoreSelectionAndExtendToMatch()}}findPrevious(e){this.findNext(e,!1)}restoreSelectionAndExtendToMatch(){setTimeout(()=>{let e=this.vim.doc.getSelection();if((!e||e.isCollapsed)&&this.vim.visualMode.restorePreviousSelection(),e=this.vim.doc.getSelection(),e&&!e.isCollapsed){let t=this.getSelectedMatchEl();t&&this.vim.visualMode.extendSelectionToNode(t)}},Kw)}start(e){let t=this.findBar;if(!t)return;if(this.vim.visualMode.rememberSelection(),t.opened){t.searchComponent.inputEl.select();return}this.isActive=!0,this.isForward=e,t.searchSettings.highlightAll=this.hlsearch,this.lib.updateSearchSettingsUI(t);let i=t.searchComponent.changeCallback;this.incsearch?t.searchComponent.onChange((0,Gw.debounce)(()=>{t.dispatchEvent("again")},250,!0)):t.searchComponent.onChange(()=>{}),t.showSearch();let r=o=>{this.isActive&&(o.isComposing||o.key==="Enter"&&(It(o,o.target)&&o.target.blur(),o.stopPropagation(),this.incsearch?this.restoreSelectionAndExtendToMatch():this.findNext()))};t.searchComponent.inputEl.addEventListener("keypress",r,!0),this.lib.registerPDFEvent("findbarclose",t.eventBus,null,()=>{this.isActive=!1,t.searchComponent.inputEl.removeEventListener("keypress",r,!0),i&&t.searchComponent.onChange(i)})}findAndSelectNextMatch(e,t){this.findNext(e,t),setTimeout(()=>{let i=this.vim.doc.getSelection();if(!i)return;let r=this.getSelectedMatchEl();r&&(i.isCollapsed?i.selectAllChildren(r):this.vim.visualMode.extendSelectionToNode(r,1))},Kw+1)}getSelectedMatchEl(){var i,r;let e=(r=(i=this.vim.obsidianViewer)==null?void 0:i.dom)==null?void 0:r.viewerEl;return e?e.querySelector(".textLayer .textLayerNode > .highlight.selected"):null}};var gn=class extends ke{get vimScope(){return this.vim.vimScope}get doc(){return this.vim.doc}get viewer(){return this.vim.viewer}get obsidianViewer(){return this.vim.obsidianViewer}get pdfViewer(){return this.vim.pdfViewer}constructor(e){super(e.plugin),this.vim=e}};var ju=class extends gn{constructor(t){super(t);this.selectionChangedByVisualMotion=!1;this.previousSelection=null;this.defineKeymaps()}get structureParser(){return this.vim.structureParser}onload(){this.registerDomEvent(this.doc,"selectionchange",()=>{let t=this.doc.getSelection();switch(this.vim.vimScope.currentMode){case"visual":(!t||t.isCollapsed)&&(this.selectionChangedByVisualMotion||this.vim.vimScope.setMode("normal"));break;default:if(t&&!t.isCollapsed&&t.rangeCount>0){let i=t.getRangeAt(0);this.vim.viewer.containerEl.contains(i.commonAncestorContainer)&&this.vim.vimScope.setMode("visual")}}this.selectionChangedByVisualMotion=!1})}defineKeymaps(){let t=i=>r=>(i(r),this.selectionChangedByVisualMotion=!0);this.vimScope.registerKeymaps(["visual"],{...this.settings.vimVisualMotion?{j:t(i=>this.extendSelectionByLine(i!=null?i:1)),k:t(i=>this.extendSelectionByLine(-(i!=null?i:1))),h:t(i=>this.extendSelectionByChar(i!=null?i:1,!1)),l:t(i=>this.extendSelectionByChar(i!=null?i:1,!0)),w:t(i=>{let r=this.doc.getSelection();r&&(is(()=>{r.modify("extend","forward","word"),r.modify("extend","forward","word"),r.modify("extend","backward","word"),un(r)&&r.modify("extend","forward","character")},i),this.ensureSelectionHeadAtTextDiv(r,!1))}),e:t(i=>{let r=this.doc.getSelection();r&&(is(()=>{un(r)||r.modify("extend","forward","character"),r.modify("extend","forward","word"),un(r)||r.modify("extend","backward","character")},i),this.ensureSelectionHeadAtTextDiv(r,!1))}),b:t(i=>{let r=this.doc.getSelection();r&&(is(()=>{un(r)&&r.modify("extend","backward","character"),r.modify("extend","backward","word"),un(r)&&r.modify("extend","forward","character")},i),this.ensureSelectionHeadAtTextDiv(r,!0))}),0:t(()=>this.extendSelctionToLineBoundary(!1)),"^":t(()=>this.extendSelctionToLineBoundary(!1)),$:t(()=>this.extendSelctionToLineBoundary(!0))}:{},o:t(()=>{let i=this.doc.getSelection();i&&Kc(i)}),y:()=>{let i=this.doc.getSelection();if(i){let r=i.toString();r&&(this.settings.copyAsSingleLine&&(r=this.lib.toSingleLine(r)),navigator.clipboard.writeText(r)),i.empty()}},c:()=>{var i;this.lib.commands.copyLink(!1),(i=this.doc.getSelection())==null||i.empty()},C:()=>{let i=this.doc.getSelection();i&&setTimeout(()=>{this.viewer.then(r=>{Ru(this.plugin,r,i)})})}})}getTextDivContainingNode(t){let i=t.instanceOf(Element)?t:t.parentElement;if(!i)return null;let r=i.closest(".textLayerNode");return r||null}getTextDivAtSelectionHead(t){let{focusNode:i}=t;return i?this.getTextDivContainingNode(i):null}getSelectionPos(t,i){let r=i==="head",o=r?t.focusNode:t.anchorNode;if(!o)return null;let s=this.getTextDivContainingNode(o);if(!s||s.dataset.idx===void 0)return null;let a=+s.dataset.idx,c=(()=>{let d=r?t.focusOffset:t.anchorOffset,h=this.doc.createNodeIterator(s,NodeFilter.SHOW_ALL),u,p=0;for(;u=h.nextNode();){if(u===o)return p+=u.nodeType===Node.TEXT_NODE?d:Array.from(o.childNodes).slice(0,d).map(f=>f.textContent.length).reduce((f,m)=>f+m,0),p;u.nodeType===Node.TEXT_NODE&&(p+=u.textContent.length)}return p})();if(typeof c!="number")return null;un(t)===r&&c--;let l=d=>d.instanceOf(HTMLElement)&&d.hasClass("textLayerNode")&&!!d.textContent;if(c<0){let d=s.previousSibling;for(;d&&!l(d);)d=d.previousSibling;d&&l(d)&&d.dataset.idx!==void 0&&(a=+d.dataset.idx,c=d.textContent.length-1)}else if(s.textContent&&c>=s.textContent.length){let d=s.nextSibling;for(;d&&!l(d);)d=d.nextSibling;d&&l(d)&&d.dataset.idx!==void 0&&(a=+d.dataset.idx,c=0)}return{index:a-this.plugin.textDivFirstIdx,offset:c}}extendSelection(t){var l,d,h;let i=this.doc.getSelection();if(!i)return;let r=this.lib.getPageElFromSelection(i);if(!r||r.dataset.pageNumber===void 0)return;let o=+r.dataset.pageNumber,s=(l=this.structureParser)==null?void 0:l.getPageParser(o);if(!s)return;let a=this.getSelectionPos(i,"head");if(!a)return;let c=t({currentHeadPos:a,pageNumber:o,pageParser:s});if(c){let u=s.divs[c.index],p=c.offset;p<0&&(p+=(h=(d=u.textContent)==null?void 0:d.length)!=null?h:0);let f=Wn(u,p);if(!f)return;this.extendSelectionToNode(f.node,f.offset)}}extendSelectionToNode(t,i){let r=this.doc.getSelection();r&&(r.extend(t,i),un(r)&&r.modify("extend","forward","character"))}extendSelectionByLine(t){this.extendSelection(({currentHeadPos:i,pageParser:r})=>r.getLineShiftPosition(i,t))}extendSelctionToLineBoundary(t){this.extendSelection(({currentHeadPos:i,pageParser:r})=>{let o=r.getBoundIndicesOfLine(i.index,0);return o?t?{index:o.end,offset:-1}:{index:o.start,offset:0}:null})}extendSelectionByChar(t,i){let r=this.doc.getSelection();r&&(is(()=>r.modify("extend",i?"forward":"backward","character"),t),this.ensureSelectionHeadAtTextDiv(r,i))}selectMatch(){var i;let t=this.vim.search.getSelectedMatchEl();t&&((i=this.vim.doc.getSelection())==null||i.selectAllChildren(t))}ensureSelectionHeadAtTextDiv(t,i){let r=this.getTextDivAtSelectionHead(t);for(;!r;)t.modify("extend",i?"forward":"backward","character"),r=this.getTextDivAtSelectionHead(t)}setSelectionByPos(t,i){let r=this.doc.getSelection();if(!r)return;let o=c=>{var m;let{page:l,pos:d}=c,h=(m=this.vim.child)==null?void 0:m.getPage(l).textLayer;if(!h)return;let u=Dt(h);if(!u)return;let p=u.textDivs;if(!p||!p.length)return;let f=p[d.index];return Wn(f,d.offset)},s=o(t),a=o(i);if(s&&a){r.setBaseAndExtent(s.node,s.offset,a.node,a.offset);let c=un(r);c||Kc(r),r.modify("extend","forward","character"),c||Kc(r)}}rememberSelection(){var i,r;let t=this.doc.getSelection();if(t&&!t.isCollapsed&&t.anchorNode&&t.focusNode){let o=(i=this.lib.getPageElAssociatedWithNode(t.anchorNode))==null?void 0:i.dataset.pageNumber,s=(r=this.lib.getPageElAssociatedWithNode(t.focusNode))==null?void 0:r.dataset.pageNumber;if(o&&s){let a=this.getSelectionPos(t,"anchor"),c=this.getSelectionPos(t,"head");a&&c&&(this.previousSelection={anchor:{page:+o,pos:a},head:{page:+s,pos:c}})}}}restorePreviousSelection(){if(this.vim.doc.getSelection()&&this.vim.visualMode.previousSelection){let{anchor:i,head:r}=this.vim.visualMode.previousSelection;this.setSelectionByPos(i,r)}}forgetPreviousSelection(){this.previousSelection=null}};var Wu=class extends gn{constructor(e){super(e),this.defineKeymaps()}onload(){this.viewer.then(e=>{this.lib.registerPDFEvent("sidebarviewchanged",e.pdfViewer.eventBus,this,({view:t})=>{t===2?this.vim.enterOutlineMode():this.vim.enterNormalMode()}),this.lib.registerPDFEvent("outlineloaded",e.pdfViewer.eventBus,this,({source:t})=>{e.pdfViewer.pdfSidebar.active===2?this.vim.enterOutlineMode():this.vim.enterNormalMode()})})}defineKeymaps(){this.registerOutlineKeymaps({j:(e,t)=>this.navigateOutline(e,!0,t),k:(e,t)=>this.navigateOutline(e,!1,t),h:e=>{let t=e.highlighted;t&&t.parent&&(this.changeActiveItemTo(t.parent),this.collapse(t.parent))},l:e=>{let t=e.highlighted;if(t){this.expand(t);let i=t.children[0];i&&this.changeActiveItemTo(i)}},H:e=>{let t=e.highlighted;if(e.allItems.forEach(i=>{this.collapse(i)}),t){let i=t;for(;i.parent;)i=i.parent;this.changeActiveItemTo(i)}},L:e=>{e.allItems.forEach(t=>{this.expand(t)})},"":e=>{let t=e.highlighted;t&&t.selfEl.click()}}),this.vimScope.noremap(["outline"],{"":"","":"j","":"k","":"h","":"l","":"H","":"L"})}registerOutlineKeymaps(e){let t={};for(let i in e)t[i]=this.toVimCommand(e[i]);this.vimScope.registerKeymaps(["outline"],t)}toVimCommand(e){return t=>{var r;let i=(r=this.obsidianViewer)==null?void 0:r.pdfOutlineViewer;i&&e(i,t)}}changeActiveItemTo(e){var i;let t=e.owner;(i=t.highlighted)==null||i.setActive(!1),e.setActive(!0),t.highlighted=e,e.selfEl.scrollIntoView({block:"center",behavior:this.settings.vimSmoothOutlineMode?"smooth":"instant"})}collapse(e){e.setCollapsed(!0,this.settings.vimSmoothOutlineMode)}expand(e){e.setCollapsed(!1,this.settings.vimSmoothOutlineMode)}navigateOutline(e,t,i){let r=e.highlighted;if(r){let o=(()=>{i!=null||(i=1);let s=1/0,a=e.children.slice().reverse(),c=[];for(;a.length;){let l=a.pop();if(c.push(l),l===r&&(s=c.length-1+(t?i:-i)),c.length>s)return c[s];!l.children.length||l.collapsed||a.push(...l.children.slice().reverse())}})();o&&this.changeActiveItemTo(o)}}};var rs=require("obsidian");var Jw=require("obsidian");var Yw=require("obsidian");function*Zw(n,e){let t=pC(e),i=Math.max(0,Math.ceil((n-e.length)/(e.length-1)));yield*mC(t,i,n+i)}function*pC(n){for(let e=1;;e++)yield*xC(gC(n,e),t=>t.join(""))}function*gC(n,e){let t=n.length,i=new Array(e).fill(0),r=1;for(let o of Jg(Math.pow(t,e))){yield i.map(s=>n[s]);for(let s of Jg(i.length))Xw(r,Math.pow(t,i.length-1-s))===0&&(i[s]=Xw(i[s]+1,t));r++}}function*mC(n,e,t){let i=n[Symbol.iterator]();t===void 0&&(t=e,e=0);for(let r of Jg(e))if(i.next().done)return;for(let r=e;r section.linkAnnotation:has(> a)",1:".annotationLayer > section:not(.linkAnnotation)",2:".pdf-plus-backlink-highlight-layer > .pdf-plus-backlink"},Gu=class n extends gn{constructor(){super(...arguments);this.onExitCallbacks=[];this.targets=[]}setTarget(...t){this.targets=t}getTargetSelector(){return this.targets.map(t=>Ku[t]).join(",")}enter(){if(this.targets.length===0&&this.setTarget(0),this.pdfViewer){let t=this.pdfViewer.currentPageNumber;if(this.hintPage(t),this.targets.includes(2)){let i=this.vim.eventBus;if(i){let r=()=>this.hintPage(t);i.on("textlayerrendered",r),this.onExit(()=>i.off("textlayerrendered",r))}}}}exit(){this.vimScope.unregisterAllKeymaps(["hint"]),this.onExitCallbacks.forEach(t=>t())}onExit(t){this.onExitCallbacks.push(t)}hintPage(t){if(!this.pdfViewer)return;let i=this.pdfViewer.getPageView(t-1),r=i.div;if(!r)return;let o={},s="pdf-plus-vim-hint-mode",a="pdfPlusVimHint";r.addClass(s),this.onExit(()=>r.removeClass(s));let c=this.getTargetSelector(),l=r.querySelectorAll(c),d=l.length;if(d===0){new Yw.Notice(`${this.plugin.manifest.name} (Vim mode): No hintable element found on this page`),this.exit(),this.vim.enterNormalMode();return}let h=Zw(d,this.settings.vimHintChars),u=null,p=null;l.forEach(f=>{var x;if(n.isLink(f)){let g=f.querySelector(":scope > a");if(u&&u.href===g.href&&bC(u,g))return;u=g}else u=null;if(n.isBacklinkHighlight(f)){let g=(x=f.dataset.backlinkId)!=null?x:null;if(p&&g&&p===g)return;p=g}else p=null;let m=""+h.next().value;f.dataset[a]=m,this.onExit(()=>delete f.dataset[a]),o[m]=()=>{this.openHintableEl(f,i),this.exit(),this.vim.enterNormalMode()}}),this.vimScope.unregisterAllKeymaps(["hint"]),this.vimScope.registerKeymaps(["hint"],o)}openHintableEl(t,i){var r,o;if(n.isLink(t))t.querySelector(":scope > a").click();else if(n.isNonLinkAnnot(t)){pu(t);let s=t.dataset.annotationId,a=s&&((r=i==null?void 0:i.annotationLayer)==null?void 0:r.annotationLayer.getAnnotation(s));a&&((o=this.vim.child)==null||o.renderAnnotationPopup(a))}else n.isBacklinkHighlight(t)&&pu(t)}static isLink(t){return t.matches(Ku[0])}static isNonLinkAnnot(t){return t.matches(Ku[1])}static isBacklinkHighlight(t){return t.matches(Ku[2])}},bC=(n,e)=>{let t=n.getBoundingClientRect(),i=e.getBoundingClientRect(),r=Math.min(i.height,i.width)*.5,o=r*5;return Math.abs((i.top+i.bottom)/2-(t.top+t.bottom)/2)[{id:"nextpage",func:()=>{var e;return(e=n.pdfViewer)==null?void 0:e.nextPage()}},{id:"prevpage",func:()=>{var e;return(e=n.pdfViewer)==null?void 0:e.previousPage()}},{id:"0",description:":0 - Go to the first page (same as :1)",func:()=>n.pdfViewer&&(n.pdfViewer.currentPageNumber=1)},{id:"$",description:":$ - Go to the last page.",func:()=>n.pdfViewer&&(n.pdfViewer.currentPageNumber=n.pdfViewer.pagesCount)},{id:"gotopage",pattern:/^go(to(page)?)?$/,description:":go[to[page]] - Go to the specified page. If the PDF has page labels, the argument is treated as a page label. Otherwise, it is treated as a page number.",minNargs:1,func:async e=>{if(n.pdfViewer){let t=await n.pdfViewer.pdfDocument.getPageLabels();if(t){let i=t.indexOf(e);if(i!==-1){let r=i+1;n.pdfViewer.currentPageNumber=r;return}}n.pdfViewer.currentPageNumber=+e}}},{id:"pagetop",func:()=>n.scroll.scrollToTop()},{id:"pagebottom",func:()=>n.scroll.scrollToBottom()},{id:"searchforward",pattern:/^search(f(orward)?)?$/,func:()=>setTimeout(()=>n.search.start(!0))},{id:"searchbackward",pattern:/^searchb(ackward)?$/,func:()=>setTimeout(()=>n.search.start(!1))},{id:"findnext",func:()=>n.search.findNext()},{id:"findprev",func:()=>n.search.findPrevious()},{id:"zoom",description:":zoom - Set the zoom level to percent.",minNargs:1,func:e=>n.pdfViewer&&(n.pdfViewer.currentScale=.01*+e)},{id:"zoomin",func:()=>{var e;return(e=n.obsidianViewer)==null?void 0:e.zoomIn()}},{id:"zoomout",func:()=>{var e;return(e=n.obsidianViewer)==null?void 0:e.zoomOut()}},{id:"zoomreset",func:()=>{var e;return(e=n.obsidianViewer)==null?void 0:e.zoomReset()}},{id:"rotate",func:()=>{var e;return(e=n.obsidianViewer)==null?void 0:e.rotatePages(90)}},{id:"yank",pattern:/^y(ank)?$/,func:()=>{let e=n.doc.getSelection();if(e){let t=e.toString();t&&navigator.clipboard.writeText(t),n.enterNormalMode()}}},{id:"outline",pattern:/^(outline)|(toc)$/,description:":outline or :toc - Show the outline view.",func:()=>n.lib.commands.showOutline(!1)},{id:"thumbnail",pattern:/^thumb(nail)?$/,description:":thumb[nail] - Show the thumbnails view.",func:()=>n.lib.commands.showThumbnail(!1)},{id:"closesidebar",func:()=>n.lib.commands.closeSidebar(!1)},{id:"help",pattern:/^h(elp)?$/,func:e=>{if(e&&e.startsWith(":")){let t=e.slice(1).split(" ")[0],i=n.commandLineMode.findCommand(t);if(i&&i.description){Xu.renderAsModal(n.plugin,yC(i.description));return}}n.plugin.openSettingTab().scrollToHeading("vim")}},{id:"map",minNargs:2,func:(e,...t)=>n.map(["normal","visual","outline"],e,t.join(" ")),description:Yr("map",["normal","visual","outline"])},{id:"noremap",pattern:/^no(remap)$/,minNargs:2,func:(e,...t)=>n.noremap(["normal","visual","outline"],e,t.join(" ")),description:Yr("no[remap]",["normal","visual","outline"],!0)},{id:"nmap",pattern:/^nm(ap)?$/,minNargs:2,func:(e,...t)=>n.map(["normal"],e,t.join(" ")),description:Yr("nm[ap]",["normal"])},{id:"nnoremap",pattern:/^nn(oremap)?$/,minNargs:2,func:(e,...t)=>n.noremap(["normal","visual","outline"],e,t.join(" ")),description:Yr("nn[oremap]",["normal"],!0)},{id:"vmap",pattern:/^vm(ap)?$/,minNargs:2,func:(e,...t)=>n.map(["visual"],e,t.join(" ")),description:Yr("vm[ap]",["visual"])},{id:"vnoremap",pattern:/^vn(oremap)?$/,minNargs:2,func:(e,...t)=>n.noremap(["visual"],e,t.join(" ")),description:Yr("vn[oremap]",["visual"],!0)},{id:"omap",pattern:/^om(ap)?$/,minNargs:2,func:(e,...t)=>n.map(["outline"],e,t.join(" ")),description:Yr("om[ap]",["outline"])},{id:"onoremap",pattern:/^ono(remap)?$/,minNargs:2,func:(e,...t)=>n.noremap(["outline"],e,t.join(" ")),description:Yr("ono[remap]",["outline"],!0)},{id:"unmap",pattern:/^unm(ap)?$/,minNargs:1,func:e=>n.vimScope.unmap(["normal","visual","outline"],[e]),description:":unm[ap] - Unmap in all modes."},{id:"nunmap",pattern:/^nun(map)?$/,minNargs:1,func:e=>n.vimScope.unmap(["normal"],[e]),description:":nun[map] - Unmap in normal mode."},{id:"vunmap",pattern:/^vu(nmap)?$/,minNargs:1,func:e=>n.vimScope.unmap(["visual"],[e]),description:":vu[nmap] - Unmap in visual mode."},{id:"ounmap",pattern:/^ou(nmap)?$/,minNargs:1,func:e=>n.vimScope.unmap(["outline"],[e]),description:":ou[nmap] - Unmap in outline mode."},{id:"js",pattern:/^js(command)?$/,minNargs:1,func:(...e)=>n.evalUserScript(e.join(" ")),description:`:js[command] : Execute the given javascript in a context where "this" points to a "${ns.name}" object.`},{id:"jsfile",minNargs:1,func:async(...e)=>{var r,o;let t=(0,Jw.normalizePath)(e.join(" ")),i=await n.app.vault.adapter.read((o=(r=n.app.metadataCache.getFirstLinkpathDest(t,""))==null?void 0:r.path)!=null?o:t);return await n.evalUserScript(i)},description:`:jsfile - Execute the javascript code in the file at (relative to the vault root; can be just the filename if it's unique). It can be any plain text file with arbitrary file extension. The code will be evaluated in a context where "this" points to a "${ns.name}" object.`},{id:"obcommand",description:":obcommand - Execute the Obsidian command with the specified ID. Inspired by esm's awesome Vimrc Support plugin.",minNargs:1,func:e=>n.app.commands.executeCommandById(e)},{id:"hint",description:` :hint [ ...] - Enter hint mode and show hint marks for the specified targets in the current page. Inspired by [Tridactyl](https://github.com/tridactyl/tridactyl)'s hint mode. If no target is specified, the default targets (configured in PDF++ settings) will be used. The accepted targets are: - \`all\`: all of the followings - \`link\`: internal & external links - \`annot\`: (non-link) annotations written in the file - \`backlink\`: backlink highlighting, i.e., highlights that is not written in the file itself `,func:(...e)=>{e.length===0&&(e=n.settings.vimHintArgs.trim().split(/\s+/)),e.includes("all")&&(e=["link","annot","backlink"]),n.hintMode.setTarget(...e.map(t=>{switch(t){case"link":return 0;case"annot":return 1;case"backlink":return 2;default:throw Error(`Unknown hint target: ${t}`)}})),setTimeout(()=>n.enterHintMode())}}],yC=(n,e=12,t=!0)=>(n=n.replace(new RegExp(`^ {${e}}`,"gm"),"").replace(/^\s*/,""),t?n.replace(/([<>])/g,"\\$1"):n),Yr=(n,e,t=!1)=>`:${n} - Map to ${t?"non-recusively ":""}in ${e.length>1?e.slice(0,-1).join(", ")+" and "+e.at(-1)+" modes":e[0]+" mode"}. If is an ex-command, it must be start with ":".`;var Zu=class extends gn{constructor(t){super(t);this.history=[];this.historyIndex=0;this.isActive=!1;this.dom=this.vim.viewer.containerEl.createDiv("pdf-plus-vim-command",i=>{this.register(()=>i.remove()),i.appendText(":"),this.inputEl=i.createEl("input",{cls:"pdf-plus-vim-command-input"},r=>{r.placeholder="type a command or page number...",r.addEventListener("focusout",()=>{setTimeout(()=>{this.isActive&&this.vim.enterNormalMode()})}),r.addEventListener("keydown",o=>{if(!o.isComposing&&o.key==="Enter"){this.submitCommand();return}if(o.key==="Escape"||o.key==="Backspace"&&!r.value){this.vim.enterNormalMode(),o.preventDefault();return}if(o.key==="ArrowUp"||o.key==="ArrowDown"){o.preventDefault(),this.navigateHistory(o.key==="ArrowDown");return}})}),i.hide()}),this.vimScope.registerKeymaps(["command"],{"":()=>this.inputEl.value="","":()=>this.inputEl.value=this.inputEl.value.replace(/\S+\s*$/,"")}),this.excmds=Qw(this.vim),this.suggest=new Qg(this).onSelect(({item:{minNargs:i}})=>setTimeout(()=>{if(!i){this.submitCommand();return}this.inputEl.value+=" "})),this.settings.vimrcPath&&this.viewer.then(i=>{let r=i.pdfViewer.eventBus;r&&r.on("pagesloaded",()=>setTimeout(()=>{if(this.plugin.vimrc===null){let o=(0,rs.normalizePath)(this.settings.vimrcPath);this.app.vault.adapter.read(o).then(s=>this.runScript(this.plugin.vimrc=s))}else this.runScript(this.plugin.vimrc)},{once:!0}))})}async executeCommand(t,i={error:["notice","console.error"],history:!0}){if(i={error:[],history:!0,...i},i.history&&(this.history.push(t),this.history.length>100&&this.history.shift(),this.historyIndex=this.history.length),t.startsWith("!")){if(!rs.Platform.isDesktopApp){this.reportError(`${this.plugin.manifest.name} (Vim mode): Shell command is not supported on mobile`,i.error);return}let{exec:a}=require("child_process"),c=process.env;return this.settings.PATH&&(c.PATH=this.settings.PATH),new Promise((l,d)=>a(t.slice(1),{env:c},(h,u,p)=>{h&&d(h),u&&(alert(u),l(u)),p&&console.warn(p)}))}if(/^[1-9]\d*$/.test(t)){let a=+t;this.pdfViewer&&(this.pdfViewer.currentPageNumber=a);return}let[r,...o]=t.split(/\s+/),s=this.findCommand(r);if(s){if(s.minNargs&&o.lengthi.pattern&&i.pattern.test(t)||i.id===t)}submitCommand(){let t=this.inputEl.value.trim();if(t){this.history[this.historyIndex]===t&&this.history.splice(this.historyIndex,1);try{this.executeCommand(t)}catch(r){new rs.Notice(`${this.plugin.manifest.name} (Vim mode): Error occurred while executing the command : ${r}`),console.error(r)}}this.vim.enterNormalMode()}runScript(t){this.parseScript(t).forEach(r=>this.executeCommand(r,{error:["console.warn"],history:!1}))}parseScript(t){return t.split(/\r?\n/).filter(i=>i.trim()&&!i.trimStart().startsWith('"')).join(` `).replace(/\\\n/g,"").split(` `)}enter(){this.inputEl.value="",this.dom.show(),this.inputEl.focus(),this.isActive=!0}exit(){this.isActive=!1,this.inputEl.value="",this.dom.hide()}navigateHistory(t){let i=this.inputEl;if(this.historyIndexo.key==="Escape"&&o.modifiers==="");t&&this.scope.unregister(t);let i=this.scope.keys.find(o=>o.key==="ArrowDown"&&o.modifiers===""),r=this.scope.keys.find(o=>o.key==="ArrowUp"&&o.modifiers==="");i&&(this.scope.unregister(i),this.scope.register([],"Tab",i.func)),r&&(this.scope.unregister(r),this.scope.register(["Shift"],"Tab",r.func))}getItems(){return this.commandLineMode.excmds}getItemText(e){return e.id}};var Yu=class extends ke{constructor(t,i,r){super(t);this.pages=new Map;this.pdfViewer=i,this.file=r}onload(){this.registerEvent(this.app.vault.on("modify",t=>{t===this.file&&this.pages.clear()}))}getPageParser(t){let i=this.pages.get(t);if(!i){let r=this.pdfViewer.getPageView(t-1);if(r){let o=r.textLayer,s=o&&Dt(o);if(s){let{textContentItems:a,textDivs:c}=s;i=new $g(r,a,c),this.pages.set(t,i)}}}return i}},$g=class{constructor(e,t,i){this.lineStartIndices=null;this.pageView=e,this.items=t,this.divs=i}getBoundIndicesOfLine(e,t){var a;let i=this._getIndexWithinLineStartIndicesForLineContainingItem(e),r=(a=this.lineStartIndices[i+t])!=null?a:null;if(r===null)return null;let o=this.lineStartIndices[i+1+t],s=o===void 0?this.items.length-1:o-1;for(;s>r&&!this.items[s].str.length;)s--;return{start:r,end:s}}getLineShiftPosition(e,t){let i=this.getBoundIndicesOfLine(e.index,t);if(!i)return null;let r=this._getHorizontalRangeOfChar(e);if(!r)return null;let{start:o,end:s}=i,a=o;for(;a<=s;a++){let d=this.items[a],h=this._getHorizontalRangeOfItem(d);if(Cg(r,h))break}for(a>s&&(a=s);a>o&&!this.items[a].str.length;)a--;let c=this.items[a],l=0;for(;;){let d=this._getHorizontalRangeOfChar({index:a,offset:l});if(!d)return null;if(d.from>=r.from||d.to>=r.to)return{index:a,offset:l};if(l+1e-r);return t?i:i-1}parse(){let e=this._findIndexOfFirstNonEmptyItem();if(e===-1){this.lineStartIndices=[0];return}this.lineStartIndices=[e];let t=[this.items[e]];for(let i=e+1;ithis.isItemNonEmpty(e))}isItemNonEmpty(e){let t=this._getVerticalRangeOfItem(e);return t.froms.from)),o=Math.max(...i.map(s=>s.to));return{from:r,to:o}}_getHorizontalRangeOfItem(e){return{from:e.transform[4],to:e.transform[4]+e.width}}_getHorizontalRangeOfChar(e){let t=e.index,i=e.offset,r=this.items[t];if(r.chars&&r.chars.length>=r.str.length){let p=r.chars[i];return{from:p.r[0],to:p.r[2]}}let o=this.divs[t],s=Wn(o,i);if(!s)return null;let{node:a,offset:c}=s,l=o.doc.createRange();l.setStart(a,c),l.setEnd(a,c+1);let d=l.getBoundingClientRect(),[[h],[u]]=[...xu(this.pageView,[{x:d.left,y:d.bottom},{x:d.right,y:d.top}])];return{from:h,to:u}}};var _u=class n extends ke{constructor(t,i){super(t);this._structureParser=null;this.viewer=i,this.vimScope=new zu(this.viewer.scope),this.vimScope.registerKeymaps(["normal","visual","outline"],{":":()=>this.enterCommandMode(),"":()=>{if(this.obsidianViewer){let r=this.obsidianViewer.pdfSidebar;r.isOpen&&r.active===2?r.close():r.switchView(2,!0)}},"":()=>{if(this.obsidianViewer){let r=this.obsidianViewer.pdfSidebar;r.isOpen&&r.active===1?r.close():r.switchView(1,!0)}},f:()=>this.commandLineMode.executeCommand("hint")}),this.vimScope.registerKeymaps(["normal","visual","outline"],{j:r=>this.scroll.scrollTo("down",r),k:r=>this.scroll.scrollTo("up",r),h:r=>this.scroll.scrollTo("left",r),l:r=>this.scroll.scrollTo("right",r),J:ba(()=>{var r;return(r=this.pdfViewer)==null?void 0:r.nextPage()}),K:ba(()=>{var r;return(r=this.pdfViewer)==null?void 0:r.previousPage()}),gg:()=>this.pdfViewer&&(this.pdfViewer.currentPageNumber=1),G:r=>this.pdfViewer&&(this.pdfViewer.currentPageNumber=r!=null?r:this.pdfViewer.pagesCount),0:()=>this.scroll.scrollToTop(),"^":()=>this.scroll.scrollToTop(),$:()=>this.scroll.scrollToBottom(),"":r=>this.scroll.scrollVerticallyByVisualPage(r!=null?r:1),"":r=>this.scroll.scrollVerticallyByVisualPage(-(r!=null?r:1)),"":r=>this.scroll.scrollVerticallyByVisualPage(.5*(r!=null?r:1)),"":r=>this.scroll.scrollVerticallyByVisualPage(-.5*(r!=null?r:1)),"/":()=>this.search.start(!0),"?":()=>this.search.start(!1),n:r=>this.search.findNext(r),N:r=>this.search.findPrevious(r),gn:r=>this.search.findAndSelectNextMatch((r!=null?r:1)-1),gN:r=>this.search.findAndSelectNextMatch((r!=null?r:1)-1,!1),"+":ba(()=>{var r;return(r=this.obsidianViewer)==null?void 0:r.zoomIn()}),"-":ba(()=>{var r;return(r=this.obsidianViewer)==null?void 0:r.zoomOut()}),"=":r=>{var o;if(typeof r=="number"&&this.pdfViewer){this.pdfViewer.currentScaleValue=""+.01*r;return}(o=this.obsidianViewer)==null||o.zoomReset()},r:r=>{var o;return(o=this.obsidianViewer)==null?void 0:o.rotatePages(90*(r!=null?r:1))},R:r=>{var o;return(o=this.obsidianViewer)==null?void 0:o.rotatePages(-90*(r!=null?r:1))}}),this.vimScope.noremap(["normal","visual","outline"],{H:"^",L:"$",zi:"+",zo:"-",z0:"="}),this.vimScope.setMode("normal"),this.vimScope.setTypable("command"),this.vimScope.onEscape(r=>{var o,s,a;this.enterNormalMode(),(o=this.obsidianViewer)==null||o.pdfSidebar.close(),(a=(s=this.child)==null?void 0:s.hoverPopover)==null||a.hide(),r||this.viewer.then(c=>{c.clearEphemeralUI(),c.findBar.close()})}),this.vimScope.addEscapeAliases("",""),this.scroll=new Uu(this),this.search=new qu(this),this.visualMode=this.addChild(new ju(this)),this.commandLineMode=this.addChild(new Zu(this)),this.outlineMode=this.addChild(new Wu(this)),this.hintMode=this.addChild(new Gu(this))}get child(){return this.viewer.child}get obsidianViewer(){var t;return(t=this.viewer.child)==null?void 0:t.pdfViewer}get pdfViewer(){var t,i;return(i=(t=this.viewer.child)==null?void 0:t.pdfViewer)==null?void 0:i.pdfViewer}get eventBus(){var t;return(t=this.obsidianViewer)==null?void 0:t.eventBus}get file(){var t;return(t=this.viewer.child)==null?void 0:t.file}get structureParser(){var t;return!this._structureParser&&this.pdfViewer&&((t=this.viewer.child)!=null&&t.file)&&(this._structureParser=this.addChild(new Yu(this.plugin,this.pdfViewer,this.viewer.child.file))),this._structureParser}get doc(){return this.viewer.containerEl.doc}onload(){this.lib.workspace.iteratePDFViews(t=>{t.viewer===this.viewer&&(t.scope=this.vimScope)})}onunload(){this.lib.workspace.iteratePDFViews(t=>{t.viewer===this.viewer&&(t.scope=this.viewer.scope)})}static register(t,i){t.settings.vim&&(i.vim=t.addChild(i.addChild(new n(t,i))))}enterNormalMode(){var t;this.vimScope.setMode("normal"),(t=this.doc.getSelection())==null||t.empty(),this.commandLineMode.exit(),this.hintMode.exit(),this.visualMode.forgetPreviousSelection()}enterCommandMode(){this.vimScope.setMode("command"),this.commandLineMode.enter()}enterOutlineMode(){if(this.settings.enableVimOutlineMode&&this.obsidianViewer){this.vimScope.setMode("outline");let t=this.obsidianViewer.pdfOutlineViewer;if(!t.highlighted){let i=t.children[0];i.setActive(!0),t.highlighted=i}}}enterHintMode(){this.vimScope.setMode("hint"),this.hintMode.enter()}mapOrNoremap(t,i,r,o){r.startsWith(":")?this.vimScope.registerKeymaps(t,{[i]:()=>this.commandLineMode.executeCommand(r.slice(1))}):r===""?this.vimScope.registerKeymaps(t,{[i]:()=>{}}):this.vimScope[o?"noremap":"map"](t,{[i]:r})}map(t,i,r){this.mapOrNoremap(t,i,r,!1)}noremap(t,i,r){this.mapOrNoremap(t,i,r,!0)}async evalUserScript(t){return new Promise(i=>{this.viewer.then(async r=>{let o=this.addChild(new ns(this.plugin,r));i(await o.run(t))})})}};var Sa=async(n,e)=>n.patchStatus.pdfInternals?!0:new Promise(t=>{e.then(i=>n.patchStatus.pdfInternals?t(!0):(wC(n,e),!i.toolbar||(FC(n,i),!i.pdfViewer)?t(!1):(DC(n,i.pdfViewer),PC(n),n.patchStatus.pdfInternals=!0,n.classes.PDFViewerComponent=e.constructor,n.classes.PDFViewerChild=i.constructor,vC(n),t(!0))))});function vC(n){let{lib:e}=n;e.workspace.iteratePDFViews(t=>$w(t.viewer,t.file,n.subpathWhenPatched)),e.workspace.iteratePDFEmbeds(t=>$w(t.viewer,t.file,t.subpath))}var $w=(n,e,t)=>{n.unload();let i=n.scope.keys.find(r=>r.modifiers===""&&r.key==="Escape");i&&n.scope.unregister(i),n.load(),e&&n.loadFile(e,t)},wC=(n,e)=>{n.register(nt(e.constructor.prototype,{loadFile(t){return async function(i,r){let o=await t.call(this,i,r);return this.then(s=>{var a;(!this.visualizer||this.visualizer.file!==i)&&((a=this.visualizer)==null||a.unload(),this.visualizer=this.addChild(Vu.create(n,i,s)))}),o}},onload(t){return async function(){let i=await t.call(this);return n.settings.usePageUpAndPageDown&&(this.scope.register([],"PageUp",()=>{var r,o,s;return(s=(o=(r=this.child)==null?void 0:r.pdfViewer)==null?void 0:o.pdfViewer)==null||s.previousPage(),!1}),this.scope.register([],"PageDown",()=>{var r,o,s;return(s=(o=(r=this.child)==null?void 0:r.pdfViewer)==null?void 0:o.pdfViewer)==null||s.nextPage(),!1})),_u.register(n,this),i}}}))},FC=(n,e)=>{let{app:t,lib:i}=n;n.register(nt(e.constructor.prototype,{load(o){return async function(...s){var p,f,m;this.hoverPopover=null,this.isFileExternal=!1,this.externalFileUrl=null,this.palette=null,this.rectHighlight=null,this.bib=null,this.component||(this.component=n.addChild(new ye.Component)),this.component.load();let a=await o.call(this,...s),c=(f=(p=this.pdfViewer)==null?void 0:p.dom)==null?void 0:f.viewerContainerEl;if(c){let x=!1,g=F=>{x||(x=xg(n.settings.showContextMenuOnMouseUpIf)&&ye.Keymap.isModifier(F,n.settings.showContextMenuOnMouseUpIf))};this.component.registerDomEvent(c,"pointerdown",F=>{var D;i.highlight.viewer.clearRectHighlight(this),g(F),(D=this.component)==null||D.registerDomEvent(c,"pointerup",y)});let b=c.doc,w=F=>{var I;let D=b.getSelection();if(!D||D.rangeCount===0)return;let C=D.getRangeAt(0),{endContainer:k,endOffset:E}=C;if(D.anchorNode&&D.focusNode===k&&k.instanceOf(HTMLElement)&&k.hasClass("textLayer"))for(let O=E-1;O>=0;O--){let A=k.childNodes[O];if(A.instanceOf(HTMLElement)&&A.hasClass("textLayerNode")&&A.lastChild&&A.lastChild.nodeType===Node.TEXT_NODE){let N=D.anchorNode,q=D.anchorOffset,V=A.lastChild,X=V.textContent.length;(I=b.getSelection())==null||I.setBaseAndExtent(N,q,V,X);break}}let{startContainer:B,startOffset:S}=C;if(E===0&&k.instanceOf(HTMLElement)&&k.matches(".textLayerNode[data-idx]")){if(+k.dataset.idx>0)return;let A=n.lib.getPageElAssociatedWithNode(B),N=n.lib.getPageElAssociatedWithNode(k);if(!A||!N||A===N)return;let q=Array.from(A.querySelectorAll(".textLayerNode")).at(-1);if(q){let V=b.getSelection();if(!V)return;V.setBaseAndExtent(B,S,q,q.childNodes.length);return}}},y=F=>{var D;if(g(F),n.obsidianHasTextSelectionBug&&n.settings.fixObsidianTextSelectionBug&&w(F),n.settings.autoCopy){i.commands.copyLink(!1,!1);return}n.settings.replaceContextMenu&&(n.settings.showContextMenuOnMouseUpIf==="always"||x)&&(D=F.win.getSelection())!=null&&D.toString()&&F.win.setTimeout(()=>Wg(n,this,F),80),c.removeEventListener("pointerup",y),x=!1}}let l=()=>{var x,g;try{if(this.toolbar)n.domManager.addChild(new Ca(n,this.toolbar,this));else{let w=window.setInterval(()=>{this.toolbar&&(n.domManager.addChild(new Ca(n,this.toolbar,this)),window.clearInterval(w))},100);window.setTimeout(()=>{window.clearInterval(w)},1e3)}let b=(g=(x=this.pdfViewer)==null?void 0:x.dom)==null?void 0:g.viewerContainerEl;n.settings.autoHidePDFSidebar&&b&&(this.component||(this.component=n.addChild(new ye.Component)),this.component.registerDomEvent(b,"click",()=>{this.pdfViewer.pdfSidebar.switchView(0)}))}catch(b){new ye.Notice(`${n.manifest.name}: An error occurred while mounting the color palette to the toolbar.`),console.error(b)}};if(l(),n.on("update-dom",l),!ye.Platform.isMobile&&this.pdfViewer){let x=this.pdfViewer.eventBus;x&&x.on("textlayerrendered",({source:g})=>{var w;let b=(w=g==null?void 0:g.textLayer)==null?void 0:w.div;b&&b.addEventListener("copy",r)})}let d="1.7.0",h=(m=this.findBar)==null?void 0:m.findNextButtonEl,u=h.firstElementChild;return!(0,ye.requireApiVersion)(d)&&u&&u.matches("svg.lucide-arrow-up")&&(0,ye.setIcon)(h,"lucide-arrow-down"),a}},unload(o){return function(){var s;return(s=this.component)==null||s.unload(),o.call(this)}},onResize(o){return function(){let s=this.containerEl.querySelector(".pdf-container");return s&&n.pdfViewerChildren.set(s,this),o.call(this)}},loadFile(o){return async function(s,a){var d;if(this.unloaded||!this.pdfViewer)return;this.component||(this.component=n.addChild(new ye.Component));let c=!1;if(s.stat.size<300){let h=await i.getExternalPDFUrl(s);if(h){let u=t.vault.getResourcePath(s).replace(/\?\d+$/,"");this.pdfViewer.pdfPlusRedirect={from:u,to:h},await o.call(this,s,a),this.component.register(()=>URL.revokeObjectURL(h)),c=!0,this.isFileExternal=!0,this.externalFileUrl=h,this.palette&&this.palette.paletteEl&&(this.palette.removeWriteFileToggle(),this.palette.addImportButton(this.palette.paletteEl))}}c||(this.isFileExternal=!1,this.externalFileUrl=null,await o.call(this,s,a));let l=this.containerEl.querySelector(".pdf-container");l&&n.pdfViewerChildren.set(l,this),(d=this.bib)==null||d.unload(),this.bib=this.component.addChild(new pn(n,this)),i.registerPDFEvent("annotationlayerrendered",this.pdfViewer.eventBus,this.component,h=>{var p,f;let{source:u}=h;(f=(p=u.annotationLayer)==null?void 0:p.div)==null||f.querySelectorAll("section[data-annotation-id]").forEach(m=>{var b,w;let x=m.dataset.annotationId;if(!x)return;let g=(b=u.annotationLayer)==null?void 0:b.annotationLayer.getAnnotation(x);g&&g.container.dataset.pdfPlusIsAnnotationPostProcessed!=="true"&&(g.data.subtype==="Link"&&typeof g.container.dataset.internalLink=="string"?Xn.registerEvents(n,this,g):g.data.subtype==="Link"&&g.data.url&&Gr.registerEvents(n,this,g),(n.settings.hideReplyAnnotation&&g.data.inReplyTo&&g.data.replyType==="R"||g.data.subtype==="Stamp"&&n.settings.hideStampAnnotation)&&g.container.hide(),!ye.Platform.isPhone&&n.settings.showAnnotationPopupOnHover&&((w=g.data.contentsObj)!=null&&w.str)&&jc({parentEl:g.container,createChildEl:()=>(this.destroyAnnotationPopup(),this.renderAnnotationPopup(g),this.activeAnnotationPopupEl),removeChildEl:()=>{var y;((y=this.activeAnnotationPopupEl)==null?void 0:y.dataset.annotationId)===g.data.id&&this.destroyAnnotationPopup()},component:this.component}),g.container.dataset.pdfPlusIsAnnotationPostProcessed="true")})}),i.registerPDFEvent("outlineloaded",this.pdfViewer.eventBus,null,async h=>{let u=h.source;if(!n.patchStatus.pdfOutlineViewer){let f=e1(n,u);n.patchStatus.pdfOutlineViewer=f}if(!h.outlineCount)return;let p=this.file;p&&(n.settings.outlineDrag&&await Uw(n,u,this,p),u.allItems.forEach(f=>Zn.registerEvents(n,this,f)),n.settings.outlineContextMenu&&n.registerDomEvent(u.childrenEl,"contextmenu",f=>{f.target===f.currentTarget&&Hw(n,this,p,f)}))}),i.registerPDFEvent("thumbnailrendered",this.pdfViewer.eventBus,null,()=>{let h=this.file;h&&(n.settings.thumbnailDrag&&qw(n,this,h),Yn.registerEvents(n,this))}),n.settings.noSpreadModeInEmbed&&!Kn(this.pdfViewer)&&i.registerPDFEvent("pagerendered",this.pdfViewer.eventBus,null,()=>{this.pdfViewer.eventBus.dispatch("switchspreadmode",{mode:0})}),es(this.pdfViewer)&&i.registerPDFEvent("documentinit",this.pdfViewer.eventBus,null,()=>{this.pdfViewer.eventBus.dispatch("scalechanged",{source:this.toolbar,value:"page-width"})}),i.registerPDFEvent("sidebarviewchanged",this.pdfViewer.eventBus,null,h=>{let{source:u}=h;n.settings.noSidebarInEmbed&&!Kn(this.pdfViewer)&&u.close(),n.settings.defaultSidebarView===2&&u.haveOutline&&u.switchView(2)}),Kn(this.pdfViewer)&&i.registerPDFEvent("pagechanging",this.pdfViewer.eventBus,this.component,(0,ye.debounce)(({pageNumber:h})=>{if(n.settings.viewSyncFollowPageNumber){let u=i.workspace.getActivePDFView();if(u&&u.viewer.child===this){let p={state:{file:this.file.path,page:h}};t.workspace.trigger("view-sync:state-change",u,p)}}},n.settings.viewSyncPageDebounceInterval*1e3)),this.pdfViewer.dom&&this.component&&(this.component.registerDomEvent(this.pdfViewer.dom.viewerEl,"dblclick",lg),this.component.registerDomEvent(this.pdfViewer.dom.viewerEl,"click",cg))}},applySubpath(o){return function(s){let a=l=>{if(!l)return null;let d=parseInt(l);return Number.isNaN(d)?null:d},c=l=>{if(!l)return null;let d=parseFloat(l);return Number.isNaN(d)?null:d};if(s){s=s.startsWith("#")?s.substring(1):s;let l=this.pdfViewer,d=new URLSearchParams(s);if(d.has("search")&&this.findBar){let f=d.get("search"),m={};n.settings.searchLinkHighlightAll!=="default"&&(m.highlightAll=n.settings.searchLinkHighlightAll==="true"),n.settings.searchLinkCaseSensitive!=="default"&&(m.caseSensitive=n.settings.searchLinkCaseSensitive==="true"),n.settings.searchLinkMatchDiacritics!=="default"&&(m.matchDiacritics=n.settings.searchLinkMatchDiacritics==="true"),n.settings.searchLinkEntireWord!=="default"&&(m.entireWord=n.settings.searchLinkEntireWord==="true");let x=g=>{let b=hg(g);if(d.has(b)){let w=d.get(b);(w==="true"||w==="false")&&(m[g]=w==="true")}};x("highlightAll"),x("caseSensitive"),x("matchDiacritics"),x("entireWord"),setTimeout(()=>i.search(this.findBar,f,m));return}let{dest:h,highlight:u}=(f=>{var b,w,y;if(!d.has("page"))return{dest:f,highlight:null};let m=(b=a(d.get("page")))!=null?b:1,x=null;if(n.settings.zoomToFitRect&&d.has("rect")){let F=d.get("rect").split(",").map(c);F.length===4&&F.every(D=>D!==null)&&(x=[m-1,{name:"FitR"},...F])}if(!x)if(d.has("offset")){let F=d.get("offset").split(","),D=c(F[0]),C=c(F[1]),k=c(F[2]);x=k===null?[m-1,{name:"FitBH"},C]:[m-1,{name:"XYZ"},D,C,k]}else if(!this.opts.isEmbed&&n.settings.dontFitWidthWhenOpenPDFLink){let F=(w=this.pdfViewer)==null?void 0:w.pdfViewer,D=F==null?void 0:F._location;n.settings.preserveCurrentLeftOffsetWhenOpenPDFLink?x=[m-1,{name:"XYZ"},(y=D==null?void 0:D.left)!=null?y:null,null,null]:x=[m-1,{name:"XYZ"},null,null,null]}else x=[m-1,{name:"FitBH"},null];let g=null;if(d.has("annotation"))g={type:"annotation",page:m,id:d.get("annotation")};else if(d.has("selection")){let F=d.get("selection").split(",").map(a),[D,C,k,E]=F;D!==null&&C!==null&&k!==null&&E!==null&&(g={type:"text",page:m,range:[[D,C],[k,E]]})}else if(d.has("rect")){let F=d.get("rect").split(",").map(c);F.length===4&&F.every(D=>D!==null)&&(g={type:"rect",page:m,rect:F})}return{dest:JSON.stringify(x),highlight:g}})(s),p=l.pdfLoadingTask;p?p.promise.then(()=>l.applySubpath(h)):l.subpath=h,this.subpathHighlight=u}}},getMarkdownLink(o){return function(s,a,c){if(!this.file)return o.call(this,s,a,c);let l=i.generateMarkdownLink(this.file,"",s,a);return c?l:l.slice(1)}},...ye.apiVersion==="1.8.0"?{getTextSelectionRangeStr(){return function(o){let s=o.win.getSelection(),a=s&&s.rangeCount>0?s.getRangeAt(0):null,c=a&&i.copyLink.getTextSelectionRange(o,a);if(c){let{beginIndex:l,beginOffset:d,endIndex:h,endOffset:u}=c;return`${l},${d},${h},${u}`}return null}}}:{},getPageLinkAlias(o){return function(s){var a,c;if(this.file){let l=i.copyLink.getDisplayText(this,void 0,this.file,s,i.toSingleLine((c=(a=activeWindow.getSelection())==null?void 0:a.toString())!=null?c:""));if(l)return l}return o.call(this,s)}},highlightText(o){return function(s,a){var u,p,f;let l=this.getPage(s).textLayer,d=l&&Dt(l),h=null;if(d){let m=d.textDivs,x=a[0][0];if(h=m[x],n.settings.trimSelectionEmbed&&this.pdfViewer.isEmbed&&this.pdfViewer.dom&&!(n.settings.ignoreHeightParamInPopoverPreview&&((u=this.pdfViewer.dom.containerEl.parentElement)!=null&&u.matches(".hover-popover")))){let g=a[1][0],b=m[g];h&&b&&setTimeout(()=>{let w=this.pdfViewer.dom.viewerContainerEl.getBoundingClientRect(),y=h.getBoundingClientRect(),D=b.getBoundingClientRect().bottom-y.top+2*Math.abs(y.top-w.top);this.pdfViewer.setHeight(D)},100)}}n.settings.noTextHighlightsInEmbed&&this.pdfViewer.isEmbed&&!((f=(p=this.pdfViewer.dom)==null?void 0:p.containerEl.parentElement)!=null&&f.matches(".hover-popover"))||o.call(this,s,a),h&&window.pdfjsViewer.scrollIntoView(h,{top:-n.settings.embedMargin},!0),n.trigger("highlight",{type:"selection",source:"obsidian",pageNumber:s,child:this})}},highlightAnnotation(o){return function(s,a){var d,h,u;let c=()=>{var f;return this.annotationHighlight?this.annotationHighlight:(f=this.getPage(s).annotationLayer)==null?void 0:f.div.querySelector(`[data-annotation-id="${a}"]`)};n.settings.trimSelectionEmbed&&this.pdfViewer.isEmbed&&this.pdfViewer.dom&&!(n.settings.ignoreHeightParamInPopoverPreview&&((d=this.pdfViewer.dom.containerEl.parentElement)!=null&&d.matches(".hover-popover")))&&setTimeout(()=>{let p=c();if(p){let f=this.pdfViewer.dom.viewerContainerEl.getBoundingClientRect(),m=p.getBoundingClientRect(),x=m.bottom-m.top+2*Math.abs(m.top-f.top);this.pdfViewer.setHeight(x)}},100),n.settings.noAnnotationHighlightsInEmbed&&this.pdfViewer.isEmbed&&!((u=(h=this.pdfViewer.dom)==null?void 0:h.containerEl.parentElement)!=null&&u.matches(".hover-popover"))||o.call(this,s,a);let l=c();l&&activeWindow.setTimeout(()=>{window.pdfjsViewer.scrollIntoView(l,{top:-n.settings.embedMargin},!0)}),n.trigger("highlight",{type:"annotation",source:"obsidian",pageNumber:s,child:this})}},clearTextHighlight(o){return function(){var s,a;n.settings.persistentTextHighlightsInEmbed&&((a=(s=this.pdfViewer)==null?void 0:s.isEmbed)!=null?a:this.opts.isEmbed)||o.call(this)}},clearAnnotationHighlight(o){return function(){n.settings.persistentAnnotationHighlightsInEmbed&&this.pdfViewer.isEmbed||o.call(this)}},clearEphemeralUI(o){return function(){o.call(this),i.highlight.viewer.clearRectHighlight(this)}},renderAnnotationPopup(o){return function(s,...a){var u,p;if(s.data.subtype==="Link")return;let c=o.call(this,s,...a);n.lastAnnotationPopupChild=this;let{page:l,id:d}=i.getAnnotationInfoFromAnnotationElement(s);if(n.settings.renderMarkdownInStickyNote&&this.file){let f=(u=this.activeAnnotationPopupEl)==null?void 0:u.querySelector(".popupContent");f&&(f.textContent="",i.highlight.writeFile.getAnnotationContents(this.file,l,d).then(async m=>{var x,g;m&&(f.addClass("markdown-rendered"),this.component||(this.component=n.addChild(new ye.Component)),await ye.MarkdownRenderer.render(t,m,f,"",this.component),Qo(t,f,(g=(x=this.file)==null?void 0:x.path)!=null?g:""))}))}let h=f=>{f.createDiv("pdf-plus-annotation-icon-container",m=>{let x=f==null?void 0:f.querySelector(".clickable-icon:last-child");if(x&&(x.remove(),m.createDiv("clickable-icon pdf-plus-copy-annotation-link",g=>{(0,ye.setIcon)(g,"lucide-copy"),(0,ye.setTooltip)(g,"Copy link"),g.addEventListener("click",async()=>{let b=i.getColorPaletteAssociatedWithNode(f);if(!b)return;let w=n.settings.copyCommands[b.actionIndex].template;i.copyLink.copyLinkToAnnotation(this,!1,{copyFormat:w},l,d),(0,ye.setIcon)(g,"lucide-check")})})),i.isEditable(this)&&n.settings.enableAnnotationContentEdit&&zr.isSubtypeSupported(s.data.subtype)){let g=s.data.subtype;m.createDiv("clickable-icon pdf-plus-edit-annotation",b=>{(0,ye.setIcon)(b,"lucide-pencil"),(0,ye.setTooltip)(b,"Edit"),b.addEventListener("click",async()=>{this.file&&zr.forSubtype(g,n,this.file,l,d).open()})})}i.isEditable(e)&&n.settings.enableAnnotationDeletion&&m.createDiv("clickable-icon pdf-plus-delete-annotation",g=>{(0,ye.setIcon)(g,"lucide-trash"),(0,ye.setTooltip)(g,"Delete"),g.addEventListener("click",async()=>{this.file&&new ya(n,this.file,l,d).openIfNeccessary()})})}),f.addEventListener("contextmenu",m=>{new ye.Menu().addItem(x=>{x.setTitle("Customize...").setIcon("lucide-settings").onClick(()=>{n.openSettingTab().scrollToHeading("annot")})}).showAtMouseEvent(m),m.preventDefault()})};if(ye.Platform.isPhone){let f=new MutationObserver((m,x)=>{for(let g of m)for(let b of g.addedNodes)if(b.instanceOf(HTMLElement)&&b.matches("div.modal-container.pdf-annotation-modal")){let w=b.querySelector(".popupMeta");if(w){h(w),x.disconnect();return}}});activeWindow.setTimeout(()=>f.observe(activeDocument.body,{childList:!0})),activeWindow.setTimeout(()=>f.disconnect(),1e3)}else{let f=(p=this.activeAnnotationPopupEl)==null?void 0:p.querySelector(".popupMeta");f&&h(f)}if(n.settings.annotationPopupDrag&&this.activeAnnotationPopupEl&&this.file){let f=this.activeAnnotationPopupEl,m=this.file;jw(n,f,this,m,l,d),f.addClass("pdf-plus-draggable")}return c}},destroyAnnotationPopup(o){return function(){return n.lastAnnotationPopupChild=null,o.call(this)}},onContextMenu(o){return async function(s){if(!ye.Platform.isPhone&&!(ye.Platform.isTablet&&!n.settings.showContextMenuOnTablet)){if(!n.settings.replaceContextMenu)return await o.call(this,s);Nw(n,this,s)}}},onMobileCopy(o){return function(s,a){switch(n.settings.mobileCopyAction){case"text":r(s);return;case"pdf-plus":setTimeout(()=>i.commands.copyLink(!1));return;case"obsidian":return o.call(this,s,a)}}},onThumbnailContextMenu(o){return function(s){if(!n.settings.thumbnailContextMenu)return o.call(this,s);Rw(n,this,s)}},getTextByRect(o){return function(s,a){let c="",l=s.textLayer,d=l&&Dt(l);if(d){let{textContentItems:h,textDivs:u}=d,[p,f,m,x]=a;for(let g=0;g{var c;if(!n.settings.copyAsSingleLine)return;let s=o.clipboardData;if(!s)return;let a=(c=o.target.win.getSelection())==null?void 0:c.toString();a&&(a=i.toSingleLine(a),s.setData("text/plain",a))}},DC=(n,e)=>{let t=Object.getPrototypeOf(e);n.register(nt(t,{open(i){return async function(r){if(this.pdfPlusRedirect){let{from:o,to:s}=this.pdfPlusRedirect,a=r.url;typeof a=="string"&&a.startsWith(o)&&(r.url=s)}return delete this.pdfPlusRedirect,await i.call(this,r)}},load(i){return function(r,...o){let s=this.pdfPlusCallbacksOnDocumentLoaded;if(s)for(let a of s)a(r);return delete this.pdfPlusCallbacksOnDocumentLoaded,i.call(this,r,...o)}}}))},PC=n=>{n.register(nt(window.pdfjsViewer.AppOptions,{get(e){return function(...t){let i=t[0];return["defaultZoomValue","scrollModeOnLoad","spreadModeOnLoad"].includes(i)?n.settings[i]:e.apply(this,t)}}}))};var t1=n=>{if(n.patchStatus.pdfView&&n.patchStatus.pdfInternals)return!0;let e=n.lib,t=e.getPDFView();return t&&(n.patchStatus.pdfView||(n.register(nt(t.constructor.prototype,{getState(i){return function(){var c,l,d,h,u;let r=i.call(this),s=this.viewer.child,a=(c=s==null?void 0:s.pdfViewer)==null?void 0:c.pdfViewer;return a&&(r.page=(d=(l=a._location)==null?void 0:l.pageNumber)!=null?d:a.currentPageNumber,r.left=(h=a._location)==null?void 0:h.left,r.top=(u=a._location)==null?void 0:u.top,r.zoom=a.currentScale),r}},setState(i){return function(r,o){return n.settings.alwaysRecordHistory&&(o.history=!0),i.call(this,r,o).then(()=>{var l;let a=this.viewer.child,c=(l=a==null?void 0:a.pdfViewer)==null?void 0:l.pdfViewer;typeof r.page=="number"&&c&&e.applyPDFViewStateToViewer(c,r)})}},onLoadFile(i){return async function(r){let o=this,s=o.getState(),a=e.viewStateToSubpath(s);return o.viewer.loadFile(r,a!=null?a:void 0)}}})),n.patchStatus.pdfView=!0,n.classes.PDFView=t.constructor),n.patchStatus.pdfInternals||Sa(n,t.viewer)),!1};var i1=n=>{if(n.patchStatus.pdfInternals)return!0;let{lib:e}=n,t=e.getPDFEmbed();return t&&Sa(n,t.viewer),!1};var e1=(n,e)=>(n.register(nt(e.constructor.prototype,{onItemContextMenu(t){return async function(i,r){let o=this,s=o.viewer,a=s.file;if(!n.settings.outlineContextMenu||!a)return await t.call(o,i,r);Vw(n,s,a,i,r)}}})),!0);var Ea=require("obsidian");var n1=n=>{let e=n.app,t=n.lib;n.register(nt(Ea.Workspace.prototype,{openLinkText(i){return function(r,o,s,a){var c;if((n.settings.openPDFWithDefaultApp||n.settings.singleTabForSinglePDF||n.settings.openLinkNextToExistingPDFTab||n.settings.paneTypeForFirstPDFLeaf)&&!s){let{path:l}=(0,Ea.parseLinktext)(r),d=e.metadataCache.getFirstLinkpathDest(l,o);if(d&&d.extension==="pdf"){if(Ea.Platform.isDesktopApp&&n.settings.openPDFWithDefaultApp){if(n.settings.openPDFWithDefaultAppAndObsidian&&n.settings.syncWithDefaultApp)return;let h=e.openWithDefaultApp(d.path);if(n.settings.focusObsidianAfterOpenPDFWithDefaultApp&&Zc(),!n.settings.openPDFWithDefaultAppAndObsidian)return h}if(n.settings.singleTabForSinglePDF){let{exists:h,promise:u}=t.workspace.openPDFLinkTextInExistingLeafForTargetPDF(r,o,a,d);if(h)return u}if(n.settings.openLinkNextToExistingPDFTab||n.settings.paneTypeForFirstPDFLeaf){let h=(c=t.getPDFView())==null?void 0:c.leaf;if(h){if(n.settings.openLinkNextToExistingPDFTab&&h.parentSplit){let u=e.workspace.createLeafInParent(h.parentSplit,-1);return t.workspace.openPDFLinkTextInLeaf(u,r,o,a)}}else if(n.settings.paneTypeForFirstPDFLeaf){let u=t.workspace.getLeaf(n.settings.paneTypeForFirstPDFLeaf);return t.workspace.openPDFLinkTextInLeaf(u,r,o,a)}}}}return i.call(this,r,o,s,a)}}})),n.patchStatus.workspace=!0};var r1=require("obsidian");var o1=n=>{let e=n.app,t=n.lib,i=e.internalPlugins.plugins["page-preview"].instance;return n.register(nt(i,{onLinkHover(r){return function(o,s,a,c,l){let{path:d,subpath:h}=(0,r1.parseLinktext)(a),u=e.metadataCache.getFirstLinkpathDest(d,c);if((!c||c.endsWith(".pdf"))&&n.settings.hoverHighlightAction==="open"&&(l!=null&&l.isTriggeredFromBacklinkVisualizer)){t.workspace.openMarkdownLinkFromPDF(a,c,!1,{line:l.scroll});return}if((u==null?void 0:u.extension)==="pdf"&&c.endsWith(".md")){if(n.settings.hoverPDFLinkToOpen){let{exists:p}=t.workspace.openPDFLinkTextInExistingLeafForTargetPDF(a,c,void 0,u);if(p)return}if(n.settings.ignoreHeightParamInPopoverPreview&&h.contains("height=")){let p=new URLSearchParams(h.slice(1));a=d+"#"+Array.from(p.entries()).filter(([f])=>f!=="height").map(([f,m])=>`${f}=${m}`).join("&")}}r.call(this,o,s,a,c,l)}}})),n.patchStatus.pagePreview=!0,!0};var s1=require("obsidian");var Ju=class extends ke{constructor(t,i,r){super(t);this.navButtonEl=null;this.renderer=i,this.file=r,this.pageTracker=new em(t,i,r),this.isTrackingPage=t.settings.filterBacklinksByPageDefault}onload(){this.navButtonEl=this.renderer.headerDom.addNavButton("lucide-filter","Show only backlinks in the current page",()=>{this.isTrackingPage=!this.isTrackingPage,this.updatePageTracker()}),this.updatePageTracker(),this.registerDomEvent(this.renderer.backlinkDom.el,"mouseover",t=>{this.processBacklinkVisualizerDomForEvent(t,(i,r,o,s)=>{if(!this.settings.highlightOnHoverBacklinkPane||!Ci(t,i))return;for(let l of r)l.addClass("hovered-highlight");let a=null;if(o.page&&o.annotation){let l=o.page,d=o.annotation.id;s.then(h=>{var f;let u=h.getPage(l),p=(f=u.annotationLayer)==null?void 0:f.annotationLayer.getAnnotation(d);p&&(a=this.lib.highlight.viewer.placeRectInPage(p.data.rect,u),a.addClass("pdf-plus-annotation-bounding-rect"))})}if(o.page&&o.FitR){let l=o.page,{left:d,bottom:h,right:u,top:p}=o.FitR;s.then(f=>{let m=f.getPage(l);a=this.lib.highlight.viewer.placeRectInPage([d,h,u,p],m),a.addClass("rect-highlight")})}let c=l=>{if(Ci(l,i)){for(let d of r)d.removeClass("hovered-highlight");a&&a.remove(),i.removeEventListener("mouseout",c)}};i.addEventListener("mouseout",c)})})}onunload(){var t;(t=this.navButtonEl)==null||t.remove(),this.pageTracker.unload()}setParents(...t){return t.forEach(i=>i.addChild(this)),this.register(()=>t.forEach(i=>i.removeChild(this))),this}updatePageTracker(){this.navButtonEl.toggleClass("is-active",this.isTrackingPage),this.isTrackingPage?this.pageTracker.load():this.pageTracker.unload()}findBacklinkItemEl(t){var l,d;let{refCache:i,sourcePath:r}=t,o=this.renderer.backlinkDom,s=this.app.vault.getAbstractFileByPath(r);if(!(s instanceof s1.TFile))return null;let a=o.getResult(s);if(!a)return null;if(!!a.childrenEl.querySelector(".better-search-views-tree")){let h=this.app.metadataCache.getFileCache(s);if(!(h!=null&&h.sections)||!("position"in i))return null;let u=new Set;for(let[f,m]of a.result.content){let x=h.sections.find(g=>g.position.start.offset<=f&&m<=g.position.end.offset);if(x&&(u.add(x),f===i.position.start.offset&&i.position.end.offset===m))break}let p=u.size-1;return p===-1?null:(d=a==null?void 0:a.childrenEl.querySelectorAll(".search-result-file-match")[p])!=null?d:null}else{let h=a==null?void 0:a.vChildren.children;if(!h)return null;let u=h.find(p=>{if("position"in i)return p.start<=i.position.start.offset&&i.position.end.offset<=p.end;for(let f of p.matches)return"key"in f&&f.key===i.key;return!1});return(l=u==null?void 0:u.el)!=null?l:null}}processBacklinkVisualizerDomForEvent(t,i){let r=t.target;if(!It(t,r))return;let o=this.renderer.backlinkDom.vChildren.children.find(s=>s.el.contains(r));if(o){let s=o.file.path;this.lib.workspace.iteratePDFViewerComponents(a=>{if(a.visualizer){let c=a.visualizer.index.sourcePaths.get(s);for(let l of c){if(l.page===null)continue;let d=this.findBacklinkItemEl(l);if(d!=null&&d.contains(r)){let u=a.visualizer.domManager.getCacheToDomsMap(l.page).get(l);i(d,u,l,a)}}}})}}},em=class extends ke{constructor(t,i,r){super(t);this.renderer=i;this.file=r;this.matchCountObserver=new Wc(this.renderer.backlinkDom.el,()=>{if(this.updateBacklinkCountEl(o=>`${o} in this page`),this.renderer.collapseAll)for(let o of this.renderer.backlinkDom.el.querySelectorAll(".tree-item.search-result")){let s=o.querySelector(":scope>.tree-item-self.search-result-file-title>.collapse-icon");s?s.style.visibility==="hidden"&&o.remove():o.remove()}else for(let o of this.renderer.backlinkDom.el.querySelectorAll(".tree-item.search-result:not(:has( .search-result-file-match))"))o.hasClass("is-collapsed")||o.remove()},{childList:!0,subtree:!0})}async onload(){this.renderer.backlinkDom.filter=void 0;let t=this.lib.workspace.getExistingLeafForPDFFile(this.file);if(t){await this.lib.workspace.ensureViewLoaded(t);let i=t.view;this.lib.isPDFView(i)&&i.viewer.then(r=>{this.renderer.backlinkDom.filter=(o,s)=>r.pdfViewer&&r.pdfViewer.pdfViewer?this.filter(r.pdfViewer.pdfViewer.currentPageNumber,s):!0,this.updateBacklinkDom(),this.lib.registerPDFEvent("pagechanging",r.pdfViewer.eventBus,this,o=>{var a;let s=typeof o.pageNumber=="number"?o.pageNumber:(a=r.pdfViewer.pdfViewer)==null?void 0:a.currentPageNumber;s&&(this.renderer.backlinkDom.filter=(c,l)=>this.filter(s,l)),this.updateBacklinkDom()})})}this.addChild(this.matchCountObserver)}onunload(){this.renderer.backlinkDom.filter=void 0,this.updateBacklinkDom()}updateBacklinkDom(){this.renderer.recomputeBacklink(this.file)}updateBacklinkCountEl(t){var r;let i=Array.from(this.renderer.backlinkDom.el.querySelectorAll("div.search-result-file-title span.tree-item-flair")).map(o=>+o.getText()).reduce((o,s)=>o+s,0);(r=this.renderer.backlinkCountEl)==null||r.setText(t?t(i):`${i}`)}filter(t,i){let r=Dg(i.link),o=new URLSearchParams(r);return o.has("page")?!this.settings.showBacklinkToPage&&!o.has("selection")&&!o.has("annotation")&&!o.has("offset")&&!o.has("rect")?!1:+o.get("page")===t:!1}};var a1=n=>{var o;let{app:e,lib:t}=n,i=(o=e.workspace.getLeavesOfType("backlink").find(s=>t.isBacklinkView(s.view)))==null?void 0:o.view,r=i==null?void 0:i.backlink;return!i||!r?!1:(n.register(nt(Object.getPrototypeOf(i.constructor.prototype),{onLoadFile(s){return async function(a){await s.call(this,a),this.getViewType()==="backlink"&&a.extension==="pdf"&&(this.pdfManager=new Ju(n,this.backlink,a).setParents(n,this))}},onUnloadFile(s){return async function(a){let c=this;a.extension==="pdf"&&c.pdfManager&&c.pdfManager.unload(),await s.call(this,a)}}})),n.register(nt(r.backlinkDom.constructor.prototype,{addResult(s){return function(a,c,l,d){var u;let h=this;if(h.filter){let p=e.metadataCache.getFileCache(a);if(p){let f=[];for(let[x,g]of c.content){let b=wg(p,x,g);b&&h.filter(a,b)&&f.push([x,g])}c.content.length=0,c.content.push(...f);let m=[];for(let x of c.properties){let g=(u=p.frontmatterLinks)==null?void 0:u.find(b=>b.key===x.key);g&&h.filter(a,g)&&m.push(x)}c.properties.length=0,c.properties.push(...m)}}return s.call(this,a,c,l,d)}}})),t.workspace.iterateBacklinkViews(s=>{var a;((a=s.file)==null?void 0:a.extension)==="pdf"&&s.onLoadFile(s.file)}),n.patchStatus.backlink=!0,!0)};var Ta=require("obsidian");var l1=n=>{let e=n.app,t;return e.workspace.iterateAllLeaves(i=>{i.view instanceof Ta.MarkdownView&&(t=i.view.editMode.clipboardManager)}),t?(n.register(nt(t.constructor.prototype,{handleDragOver(i){return function(r){let o=e.dragManager.draggable;if(!o||o.source!=="pdf-plus")return i.call(this,r);(Ta.Platform.isMacOS?r.shiftKey:r.altKey)||(CC(r,"link"),e.dragManager.setAction("Insert link here"))}},handleDrop(i){return function(r){let o=e.dragManager.draggable;if(!o||o.source!=="pdf-plus")return i.call(this,r);if(this.info instanceof Ta.MarkdownView&&(Ta.Platform.isMacOS?r.shiftKey:r.altKey))return r.preventDefault(),this.info.handleDrop(r,o,!1),!0;let s=this.info.editor;if(!s)return!1;let a=o.getText(this.getPath()),c=s.cm.posAtCoords({x:r.clientX,y:r.clientY},!1),l=s.offsetToPos(c);return s.setCursor(l),typeof a=="string"?(s.replaceSelection(a),s.focus(),r.preventDefault(),!0):!1}}})),!0):!1},kC={none:[],copy:["copy"],copyLink:["copy","link"],copyMove:["copy","move"],link:["link"],linkMove:["link","move"],move:["move"],all:["copy","link","move"],uninitialized:[]};function CC(n,e){if(!n.dataTransfer||n.dataTransfer.effectAllowed==="none"||n.dataTransfer.effectAllowed==="uninitialized")return;if(e==="none")return n.dataTransfer.dropEffect=e;kC[n.dataTransfer.effectAllowed].contains(e)&&(n.dataTransfer.dropEffect=e)}var c1=require("obsidian");var d1=n=>{n.register(nt(c1.Menu.prototype,{showAtPosition(e){return function(...t){var i;return n.settings.hoverableDropdownMenuInToolbar&&((i=this.parentEl)!=null&&i.closest("div.pdf-toolbar"))&&this.setUseNativeMenu(!1),n.shownMenus.add(this),e.call(this,...t)}},hide(e){return function(...t){return n.shownMenus.delete(this),e.call(this,...t)}}}))};var ve=require("obsidian");var qi=require("obsidian");var Be=class{constructor(e){this.app=e.app,this.plugin=e}get lib(){return this.plugin.lib}get settings(){return this.plugin.settings}};var os=require("obsidian"),SC=Wi(require("obsidian")),sd=class{constructor(e,t){this.plugin=e;this.variables=t}setVariable(e,t){this.variables[e]=t}evalPart(e){let t=new Function(...Object.keys(this.variables),`return ${e};`)(...Object.values(this.variables));if(t===void 0)throw Error(`The expression "${e}" cannot be evaluated.`);return t}evalTemplate(e){return e.replace(/{{(.*?)}}/g,(t,i)=>this.evalPart(i))}},ad=class extends sd{constructor(e,t){var d,h,u,p,f,m;let{app:i}=e;"colorName"in t&&(t.color=t.colorName),super(e,{...t,app:i,obsidian:SC,pdf:t.file,folder:t.file.parent,selection:t.text}),this.app=i,this.lib=e.lib;let r=this.findMarkdownFileAssociatedToPDF(t.file),o=(h=r&&((d=i.metadataCache.getFileCache(r))==null?void 0:d.frontmatter))!=null?h:{};this.setVariable("md",r),this.setVariable("properties",o);let s=this.findLinkedFile(t.file),a=(p=s&&((u=i.metadataCache.getFileCache(s))==null?void 0:u.frontmatter))!=null?p:{};this.setVariable("linkedFile",s),this.setVariable("linkedFileProperties",a);let c=(f=i.plugins.plugins.dataview)==null?void 0:f.api,l=(m=i.plugins.plugins.quickadd)==null?void 0:m.api;c&&this.setVariable("dv",c),l&&this.setVariable("quickAddApi",l)}findMarkdownFileAssociatedToPDF(e){var o,s,a;let t=this.plugin.app,i=[],r=(o=t.plugins.plugins.dataview)==null?void 0:o.api;if(r)i=r.pages().where(l=>{var d;return r.array((d=l[this.plugin.settings.proxyMDProperty])!=null?d:[]).path.includes(e.path)}).map(l=>t.vault.getAbstractFileByPath(l.file.path)).filter(l=>l instanceof os.TFile);else{let c=t.metadataCache.getBacklinksForFile(e);for(let l of c.keys()){let d=t.metadataCache.getCache(l);if(d&&((s=d.frontmatterLinks)==null?void 0:s.some(u=>{if(u.key!==this.plugin.settings.proxyMDProperty&&!new RegExp(`${this.plugin.settings.proxyMDProperty}.\\d+`).test(u.key))return!1;let p=(0,os.getLinkpath)(u.link),f=t.metadataCache.getFirstLinkpathDest(p,l);return f&&f.path===e.path}))){let u=t.vault.getAbstractFileByPath(l);u instanceof os.TFile&&i.push(u)}}}if(i.length>1){let c=`Multiple markdown files are associated with this PDF file: ${i.map(l=>"- "+l.path).join(` `)} Aborting.`;throw Error(c)}return(a=i.first())!=null?a:null}findLinkedFile(e){let t=null,i=this.lib.workspace.getActiveGroupLeaves();if(i){for(let r of i)if(r.view instanceof os.FileView&&r.view.file&&r.view.file!==e){t=r.view.file;break}}return t}};var Qu=class extends Be{constructor(){super(...arguments);this.statusDurationMs=2e3}getPageAndTextRangeFromSelection(t){if(t=t!=null?t:activeWindow.getSelection(),!t)return null;let i=this.lib.getPageElFromSelection(t);if(!i||i.dataset.pageNumber===void 0)return null;let r=+i.dataset.pageNumber,o=t.rangeCount>0?t.getRangeAt(0):null;if(o){let s=this.getTextSelectionRange(i,o);if(s)return{page:r,selection:s}}return{page:r}}getTextSelectionRange(t,i){if(i&&!i.collapsed){let r=gu(t,i.startContainer),o=gu(t,i.endContainer);if(r&&o){let s=r.dataset.idx,a=o.dataset.idx,c=mu(r,i.startContainer,i.startOffset),l=mu(o,i.endContainer,i.endOffset);if(s!==void 0&&a!==void 0&&c!==null&&l!==null)return{beginIndex:+s-this.plugin.textDivFirstIdx,beginOffset:c,endIndex:+a-this.plugin.textDivFirstIdx,endOffset:l}}}return null}getTemplateVariables(t){var d,h,u;let i=activeWindow.getSelection();if(!i)return null;let r=this.lib.getPageElFromSelection(i);if(!r||r.dataset.pageNumber===void 0)return null;let o=this.lib.getPDFViewerChildAssociatedWithNode(r),s=o==null?void 0:o.file;if(!s)return null;let a=+r.dataset.pageNumber;i.toString()||(a=(h=(d=o.pdfViewer.pdfViewer)==null?void 0:d.currentPageNumber)!=null?h:a);let c=o.getTextSelectionRangeStr(r);if(!c)return null;let l=Gc({page:a,selection:c,...t});return{child:o,file:s,subpath:l,page:a,pageCount:o.pdfViewer.pagesCount,pageLabel:(u=o.getPage(a).pageLabel)!=null?u:""+a,text:this.lib.toSingleLine(i.toString())}}getLinkTemplateVariables(t,i,r,o,s,a,c,l){l=l!=null?l:"";let d=this.app.fileManager.generateMarkdownLink(r,l,o).slice(1),h=this.app.metadataCache.fileToLinktext(r,l)+o;this.app.vault.getConfig("useMarkdownLinks")&&(h=Vr(h));let u=this.getDisplayText(t,i,r,s,a,c),p=this.lib.generateMarkdownLink(r,l,o,u||void 0).slice(1),f=this.app.fileManager.generateMarkdownLink(r,l,`#page=${s}`).slice(1),m=this.lib.generateMarkdownLink(r,l,`#page=${s}`,u||void 0).slice(1);return{link:d,linktext:h,display:u,linkWithDisplay:p,linkToPage:f,linkToPageWithDisplay:m}}getDisplayText(t,i,r,o,s,a){var c;if(!i){let l=this.lib.getColorPaletteFromChild(t);l?i=this.settings.displayTextFormats[l.displayTextFormatIndex].template:i=this.settings.displayTextFormats[this.settings.defaultDisplayTextFormatIndex].template}try{return new ad(this.plugin,{file:r,page:o,pageCount:t.pdfViewer.pagesCount,pageLabel:(c=t.getPage(o).pageLabel)!=null?c:""+o,text:s,comment:a!=null?a:""}).evalTemplate(i).trim()}catch(l){console.error(l),new qi.Notice(`${this.plugin.manifest.name}: Display text format is invalid. Error: ${l.message}`,3e3)}}getTextToCopy(t,i,r,o,s,a,c,l,d,h){var m,x,g,b,w,y;let u=t.getPage(s);if(typeof h!="string"){let F=ga(a).get("annotation");h=typeof F=="string"&&((w=(b=(g=(x=(m=u==null?void 0:u.annotationLayer)==null?void 0:m.annotationLayer)==null?void 0:x.getAnnotation(F))==null?void 0:g.data)==null?void 0:b.contentsObj)==null?void 0:w.str),h=this.lib.toSingleLine(h||"")}return new ad(this.plugin,{file:o,page:s,pageLabel:(y=u.pageLabel)!=null?y:""+s,pageCount:t.pdfViewer.pagesCount,text:c,comment:h,colorName:l,calloutType:this.settings.calloutType,...this.lib.copyLink.getLinkTemplateVariables(t,r,o,a,s,c,h,d)}).evalTemplate(i)}async getTextToCopyForOutlineItem(t,i,r,o){return(await this.getTextToCopyForOutlineItemDynamic(t,i,r))(o)}async getTextToCopyForOutlineItemDynamic(t,i,r){let o=await r.getExplicitDestination(),s=await r.getPageNumber(),a=this.lib.normalizePDFJsDestArray(o,s),c=this.lib.destArrayToSubpath(a);return l=>this.getTextToCopy(t,this.settings.outlineLinkCopyFormat,this.settings.outlineLinkDisplayTextFormat,i,s,c,r.item.title,"",l)}getSelectionLinkInfo(){var s;let t=this.lib.getColorPaletteAssociatedWithSelection();if(!t)return null;let i=this.settings.copyCommands[t.actionIndex].template,r=(s=t.selectedColorName)!=null?s:void 0,o=t.writeFile;return{template:i,colorName:r,writeFile:o}}getAnnotationLinkInfo(){let t=this.plugin.lastAnnotationPopupChild;if(!t)return null;let i=t.activeAnnotationPopupEl;if(!i)return null;let r=i.querySelector(".popupMeta div.clickable-icon:has(svg.lucide-copy)");if(!r)return null;let o=this.lib.getColorPaletteAssociatedWithNode(r),s;o?s=this.settings.copyCommands[o.actionIndex].template:s=this.settings.copyCommands[this.settings.defaultColorPaletteActionIndex].template;let a=this.lib.getAnnotationInfoFromPopupEl(i);if(!a)return null;let{page:c,id:l}=a;return{child:t,copyButtonEl:r,template:s,page:c,id:l}}copyLinkToSelection(t,i,r,o){let s=this.getTemplateVariables(r?{color:r.toLowerCase()}:{});if(s){let{child:a,file:c,subpath:l,page:d,text:h}=s;if(!h)if(this.settings.useAnotherCopyTemplateWhenNoSelection)i.copyFormat=this.settings.copyTemplateWhenNoSelection;else return!1;return t||(async()=>{var m;let u=this.getTextToCopy(a,i.copyFormat,i.displayTextFormat,c,d,l,h,(m=r==null?void 0:r.toLowerCase())!=null?m:"");await navigator.clipboard.writeText(u),this.onCopyFinish(u);let p=this.lib.getColorPaletteFromChild(a);p==null||p.setStatus("Link copied",this.statusDurationMs),this.autoFocusOrAutoPaste(u,o,p!=null?p:void 0);let f=$o(l);if(f&&"beginIndex"in f){let x=a.getPage(d).textLayer;if(x){let g=Dt(x);if(g){let{textContentItems:b}=g,w=b[f.beginIndex];if(w){let y=w.transform[4],F=w.transform[5]+w.height;typeof y=="number"&&typeof F=="number"&&(this.plugin.lastCopiedDestInfo={file:c,destArray:[d-1,"XYZ",y,F,null]})}}}}})(),!0}return!1}copyLinkToAnnotation(t,i,r,o,s,a,c){let l=t.file;if(!l)return!1;if(!i){let d=t.getPage(o);t.getAnnotatedText(d,s).then(async h=>{var y,F,D,C;let u=(C=(D=(F=(y=d.annotationLayer)==null?void 0:y.annotationLayer)==null?void 0:F.getAnnotation(s))==null?void 0:D.data)!=null?C:(await d.pdfPage.getAnnotations()).find(k=>k.id===s),p=u!=null&&u.color?`${u.color[0]}, ${u.color[1]}, ${u.color[2]}`:"",f=`#page=${o}&annotation=${s}`;if(u.subtype==="Square"){let k=u.rect;f+=`&rect=${k[0]},${k[1]},${k[2]},${k[3]}`}let m=this.getTextToCopy(t,r.copyFormat,r.displayTextFormat,l,o,f,h!=null?h:"",p);await navigator.clipboard.writeText(m),this.onCopyFinish(m);let x=this.lib.getColorPaletteFromChild(t);c&&(x==null||x.setStatus("Link copied",this.statusDurationMs)),this.autoFocusOrAutoPaste(m,a,x!=null?x:void 0);let g=u==null?void 0:u.rect,b=g==null?void 0:g[0],w=g==null?void 0:g[3];typeof b=="number"&&typeof w=="number"&&(this.plugin.lastCopiedDestInfo={file:l,destArray:[o-1,"XYZ",b,w,null]})})}return!0}copyLinkToAnnotationWithGivenTextAndFile(t,i,r,o,s,a,c,l,d){return o||(async()=>{let h=this.getTextToCopy(r,s.copyFormat,s.displayTextFormat,i,a,`#page=${a}&annotation=${c}`,t,l);await navigator.clipboard.writeText(h),this.onCopyFinish(h);let u=this.lib.getColorPaletteFromChild(r);u==null||u.setStatus("Link copied",this.statusDurationMs),this.autoFocusOrAutoPaste(h,d,u!=null?u:void 0)})(),!0}writeHighlightAnnotationToSelectionIntoFileAndCopyLink(t,i,r,o){let s=activeWindow.getSelection();if(!s)return!1;let a=this.lib.toSingleLine(s.toString());if(!a)return!1;if(!t){let c=this.lib.getColorPaletteAssociatedWithSelection();c==null||c.setStatus("Writing highlight annotation into file...",1e4),this.lib.highlight.writeFile.addTextMarkupAnnotationToSelection(this.settings.selectionBacklinkVisualizeStyle==="highlight"?"Highlight":"Underline",r).then(l=>{if(!l)return;let{child:d,file:h,page:u,annotationID:p,rects:f}=l;!p||!h||setTimeout(()=>{let m=this.lib.getColorPaletteFromChild(d);m==null||m.setStatus("Link copied",this.statusDurationMs);let{r:x,g,b}=this.plugin.domManager.getRgb(r);if(this.copyLinkToAnnotationWithGivenTextAndFile(a,h,d,!1,i,u,p,`${x}, ${g}, ${b}`,o),f){let w=Math.min(...f.map(F=>F[0])),y=Math.max(...f.map(F=>F[3]));typeof w=="number"&&typeof y=="number"&&(this.plugin.lastCopiedDestInfo={file:h,destArray:[u-1,"XYZ",w,y,null]})}},300)})}return!0}copyEmbedLinkToRect(t,i,r,o,s,a,c){if(a||(a=this.settings.autoPaste),!i.file)return!1;let l=i.file,d=this.lib.getColorPaletteFromChild(i);if(o.some(h=>isNaN(h)))return d==null||d.setStatus("Invalid selection",this.statusDurationMs),!1;if(!t){let h=this.getDisplayText(i,void 0,l,r,""),u=`#page=${r}&rect=${o.map(f=>Math.round(f)).join(",")}`;s&&(u+=`&color=${s}`);let p=this.lib.generateMarkdownLink(l,c!=null?c:"",u,h);(async()=>{let f=p,m=i.getPage(r).pdfPage,x=this.settings.rectImageExtension;if(!this.settings.rectEmbedStaticImage)await navigator.clipboard.writeText(f),this.onCopyFinish(f);else if(this.settings.rectImageFormat==="file"){let g=await this.app.fileManager.getAvailablePathForAttachment(l.basename+"."+x,"");f=(!this.app.vault.getConfig("useMarkdownLinks")?`![[${g}]]`:`![](${Vr(g)})`)+` `+p.slice(1),await navigator.clipboard.writeText(f);let y=async()=>{(i.containerEl.win!==window||m.destroyed)&&(m=await(await this.lib.loadPDFDocument(l)).getPage(r));let F=await this.lib.pdfPageToImageArrayBuffer(m,{type:`image/${x}`,cropRect:o,renderParams:this.lib.getOptionalRenderParameters()});return await this.app.vault.createBinary(g,F)};a?(await y(),this.onCopyFinish(f)):this.onCopyFinish(f,y)}else f=`![](${await this.lib.pdfPageToImageDataUrl(m,{type:`image/${x}`,cropRect:o})})`+` `+p.slice(1),await navigator.clipboard.writeText(f),this.onCopyFinish(f);this.plugin.lastCopiedDestInfo={file:l,destArray:[r-1,"FitR",...o]},d==null||d.setStatus("Link copied",this.statusDurationMs),await this.autoFocusOrAutoPaste(f,a,d!=null?d:void 0)})()}return!0}copyLinkToSearch(t,i,r,o,s,a){if(!i.file)return!1;let c=i.file,l=this.lib.getColorPaletteFromChild(i);if(!t){let d=this.lib.copyLink.getDisplayText(i,void 0,c,r,o),h=this.lib.generateMarkdownLink(c,"",`#search=${o}`,d).slice(1);(async()=>(await navigator.clipboard.writeText(h),this.onCopyFinish(h),l==null||l.setStatus("Link copied",this.statusDurationMs),await this.autoFocusOrAutoPaste(h,s,l!=null?l:void 0)))()}return!0}makeCanvasTextNodeFromSelection(t,i,r,o){var a;let s=this.getTemplateVariables(o?{color:o.toLowerCase()}:{});if(s){let{child:c,file:l,subpath:d,page:h,text:u}=s;if(!u)return!1;if(!t){let p=this.getTextToCopy(c,r,void 0,l,h,d,u,(a=o==null?void 0:o.toLowerCase())!=null?a:"");i.createTextNode({pos:i.posCenter(),position:"center",text:p})}return!0}return!1}makeCanvasTextNodeFromAnnotation(t,i,r,o,s,a){let c=r.file;if(!c)return!1;if(!t){let l=r.getPage(s);r.getAnnotatedText(l,a).then(d=>{let h=this.getTextToCopy(r,o,void 0,c,s,`#page=${s}&annotation=${a}`,d!=null?d:"","");i.createTextNode({pos:i.posCenter(),position:"center",text:h})})}return!0}async autoPaste(t){let i=this.getAutoFocusOrAutoPasteTarget(this.settings.autoPasteTarget);if(i)return await this.pasteTextToFile(t,i),!0;if(!this.settings.executeCommandWhenTargetNotIdentified)return!1;let r=this.app.commands.findCommand(this.settings.commandToExecuteWhenTargetNotIdentified);if(!r)return new qi.Notice(`${this.plugin.manifest.name}: Command "${this.settings.commandToExecuteWhenTargetNotIdentified}" was not found. Please update the "Command to execute when pasting a link for the first time with auto-focus or auto-paste" setting.`),!1;let o=!1;return new Promise(s=>{let a=this.app.workspace.on("file-open",async l=>{l&&l.extension==="md"&&(this.app.workspace.offref(a),await this.pasteTextToFile(t,l,!0),this.plugin.lastPasteFile=l,s(!0))}),c=this.lib.workspace.hoverEditor;this.plugin.registerOneTimeEvent(this.app.workspace,"active-leaf-change",l=>{l&&c.isHoverEditorLeaf(l)&&c.postProcessHoverEditorLeaf(l)}),this.app.commands.executeCommandById(r.id),activeWindow.setTimeout(()=>{if(!o){let{noticeEl:l}=new qi.Notice(`${this.plugin.manifest.name}: Could not find the auto-paste target markdown file within ${this.settings.autoPasteTargetDialogTimeoutSec} seconds.`);l.appendText(" Click "),l.createEl("a",{text:"here"},d=>{d.addEventListener("click",()=>{this.plugin.openSettingTab().scrollTo("autoPasteTargetDialogTimeoutSec")})}),l.appendText(" to change the timeout duration."),this.app.workspace.offref(a),s(!1)}},this.settings.autoPasteTargetDialogTimeoutSec*1e3)}).then(s=>(o=!0,s))}async autoFocus(){let t=this.getAutoFocusOrAutoPasteTarget(this.settings.autoFocusTarget);if(t){let{leaf:o,isExistingLeaf:s}=await this.prepareMarkdownLeafForPaste(t);return o&&o.view instanceof qi.MarkdownView&&await this.updateAndRevealCursorInEditor(o.view,{focus:!0,goEnd:!s}),!0}if(!this.settings.executeCommandWhenTargetNotIdentified)return!1;let i=this.app.commands.findCommand(this.settings.commandToExecuteWhenTargetNotIdentified);if(!i)return new qi.Notice(`${this.plugin.manifest.name}: Command "${this.settings.commandToExecuteWhenTargetNotIdentified}" was not found. Please update the "Command to execute when pasting a link for the first time with auto-focus or auto-paste" setting.`),!1;let r=this.lib.workspace.hoverEditor;return this.plugin.registerOneTimeEvent(this.app.workspace,"active-leaf-change",o=>{o&&r.isHoverEditorLeaf(o)&&r.postProcessHoverEditorLeaf(o)}),this.app.commands.executeCommandById(i.id)}getAutoFocusOrAutoPasteTarget(t){let i=this.plugin.lastActiveMarkdownFile,r=this.plugin.lastPasteFile,o=!!(i&&this.lib.workspace.isMarkdownFileOpened(i)),s=null;return t==="last-paste"?s=r:t==="last-active"?s=i:t==="last-active-and-open"?o&&(s=i):t==="last-paste-then-last-active"?s=r!=null?r:i:t==="last-paste-then-last-active-and-open"?r?s=r:o&&(s=i):t==="last-active-and-open-then-last-paste"&&(o?s=i:r&&(s=r)),s&&s.extension==="md"?s:null}async prepareMarkdownLeafForPaste(t){let i=this.lib.workspace.getExistingLeafForMarkdownFile(t),r=!!i;if(!i&&this.settings.openAutoFocusTargetIfNotOpened){let o=this.settings.howToOpenAutoFocusTargetIfNotOpened;if(o==="hover-editor"){let s=await this.lib.workspace.hoverEditor.createNewHoverEditorLeaf({hoverPopover:null},null,t.path,"");s&&(i=s)}else i=this.lib.workspace.getLeaf(o),await i.openFile(t,{active:!1});if(i&&this.settings.openAutoFocusTargetInEditingView){await this.lib.workspace.ensureViewLoaded(i);let s=i.view;s instanceof qi.MarkdownView&&(await s.setState({mode:"source"},{history:!1}),s.setEphemeralState({focus:!1}))}}return i&&(await this.lib.workspace.ensureViewLoaded(i),this.lib.workspace.hoverEditor.postProcessHoverEditorLeaf(i),this.settings.closeSidebarWhenLostFocus&&this.lib.workspace.registerHideSidebar(i)),{leaf:i,isExistingLeaf:r}}async pasteTextToFile(t,i,r=!1){let{leaf:o,isExistingLeaf:s}=await this.prepareMarkdownLeafForPaste(i);if(!r&&o&&s&&o.view instanceof qi.MarkdownView&&o.view.getMode()==="source"){let a=o.view,c=a.editor;if(this.settings.respectCursorPositionWhenAutoPaste)c.replaceSelection(t);else{let l=c.getValue();l=l.trimEnd(),l&&(l+=this.settings.blankLineAboveAppendedContent?` `:` `),l+=t,c.setValue(l)}a.save(),await this.updateAndRevealCursorInEditor(o.view,{focus:this.settings.focusEditorAfterAutoPaste,goEnd:!this.settings.respectCursorPositionWhenAutoPaste})}else await this.app.vault.process(i,a=>(a=a.trimEnd(),a&&(a+=this.settings.blankLineAboveAppendedContent?` `:` `),a+=t,a)),o&&activeWindow.setTimeout(async()=>{o.view instanceof qi.MarkdownView&&await this.updateAndRevealCursorInEditor(o.view,{focus:this.settings.focusEditorAfterAutoPaste,goEnd:!0})})}async updateAndRevealCursorInEditor(t,i){let{focus:r,goEnd:o}=i,s=t.editor;r&&(o&&s.exec("goEnd"),await this.lib.workspace.revealLeaf(t.leaf),this.app.workspace.setActiveLeaf(t.leaf),s.focus());let a=s.coordsAtPos(s.getCursor(),!0);if(a){let c=s.getScrollInfo();if(a.topc.top+c.clientHeight){let l={from:s.getCursor("from"),to:s.getCursor("to")};s.scrollIntoView(l,!0)}}}watchPaste(t,i){this.plugin.registerOneTimeEvent(this.app.workspace,"editor-paste",(r,o,s)=>{var d;if(((d=s.file)==null?void 0:d.extension)!=="md"||!r.clipboardData)return;let c=r.clipboardData.getData("text/plain").replace(/\r\n/g,` `),l=t.replace(/\r\n/g,` `);c===l&&(this.plugin.lastPasteFile=s.file,i==null||i()),s instanceof qi.MarkdownView&&setTimeout(()=>s.save())})}onCopyFinish(t,i){this.watchPaste(t,i),this.plugin.lastCopiedDestInfo=null}async autoFocusOrAutoPaste(t,i,r){if(i||this.settings.autoPaste)if(await this.autoPaste(t)){if(r==null||r.setStatus("Link copied & pasted",this.statusDurationMs),!this.settings.focusEditorAfterAutoPaste&&this.settings.clearSelectionAfterAutoPaste){let s=activeWindow.getSelection();s&&this.lib.copyLink.getPageAndTextRangeFromSelection(s)&&s.empty()}}else r==null||r.setStatus("Link copied but paste target not identified",this.statusDurationMs);else this.settings.autoFocus&&(await this.autoFocus()||r==null||r.setStatus("Link copied but paste target not identified",this.statusDurationMs))}};var $u=class extends Be{computeMergedHighlightRects(e,t,i,r,o){let{textContentItems:s,textDivs:a}=e,c=[],l=null,d=[];o===0&&(r--,o=s[r].str.length);for(let h=t;h<=r;h++){let u=s[h],p=a[h];if(!u.str)continue;let f=this.computeHighlightRectForItem(u,p,h,t,i,r,o);f&&(l?this.areRectanglesMergeable(l,f)?(l=this.mergeRectangles(l,f),d.push(h)):(c.push({rect:l,indices:d}),l=f,d=[h]):(l=f,d=[h]))}return l&&c.push({rect:l,indices:d}),c}computeHighlightRectForItem(e,t,i,r,o,s,a){return e.chars&&e.chars.length>=e.str.length?this.computeHighlightRectForItemFromChars(e,i,r,o,s,a):this.computeHighlightRectForItemFromTextLayer(e,t,i,r,o,s,a)}computeHighlightRectForItemFromChars(e,t,i,r,o,s){let a=e.chars.slice(e.chars.findIndex(u=>u.c===e.str.charAt(0)),e.chars.findLastIndex(u=>u.c===e.str.charAt(e.str.length-1))+1),c=t===i?r:0,l=(t===o?Math.min(s,a.length):a.length)-1;if(c>a.length-1||l<0)return null;let d=a[c],h=a[l];return[Math.min(d.r[0],h.r[0]),Math.min(d.r[1],h.r[1]),Math.max(d.r[2],h.r[2]),Math.max(d.r[3],h.r[3])]}computeHighlightRectForItemFromTextLayer(e,t,i,r,o,s,a){let c=e.transform[4],l=e.transform[5],d=e.transform[4]+e.width,h=e.transform[5]+e.height,u=t.doc.createRange();if(i===r){let m=Wn(t,o);m?u.setStart(m.node,m.offset):u.setStartBefore(t)}else u.setStartBefore(t);if(i===s){let m=Wn(t,a);m?u.setEnd(m.node,m.offset):u.setEndAfter(t)}else u.setEndAfter(t);let p=u.getBoundingClientRect(),f=t.getBoundingClientRect();return[c+(p.left-f.left)/f.width*e.width,l+(p.bottom-f.bottom)/f.height*e.height,d-(f.right-p.right)/f.width*e.width,h-(f.top-p.top)/f.height*e.height]}areRectanglesMergeable(e,t){return this.areRectanglesMergeableHorizontally(e,t)||this.areRectanglesMergeableVertically(e,t)}areRectanglesMergeableHorizontally(e,t){let[i,r,o,s]=e,[a,c,l,d]=t,h=(r+s)/2,u=(c+d)/2,p=Math.abs(s-r),f=Math.abs(d-c),m=Math.max(p,f)*.5;return Math.abs(h-u).85&&f/u>.85}mergeRectangles(...e){let t=e.map(s=>s[0]),i=e.map(s=>s[1]),r=e.map(s=>s[2]),o=e.map(s=>s[3]);return[Math.min(...t),Math.min(...i),Math.max(...r),Math.max(...o)]}rectsToQuadPoints(e){return e.flatMap(([t,i,r,o])=>[t,o,r,o,t,i,r,i])}};var ef=require("obsidian");var tf=class extends Be{getPDFPlusBacklinkHighlightLayer(e){var i;let t=e.div;return(i=t.querySelector("div.pdf-plus-backlink-highlight-layer"))!=null?i:t.createDiv("pdf-plus-backlink-highlight-layer",r=>{window.pdfjsLib.setLayerDimensions(r,e.viewport)})}placeRectInPage(e,t){let i=t.pdfPage.view,r=i[0],o=i[1],s=i[2]-i[0],a=i[3]-i[1],c=window.pdfjsLib.Util.normalizeRect([e[0],i[3]-e[1]+i[1],e[2],i[3]-e[3]+i[1]]),d=this.getPDFPlusBacklinkHighlightLayer(t).createDiv("pdf-plus-backlink");return d.setCssStyles({left:`${100*(c[0]-r)/s}%`,top:`${100*(c[1]-o)/a}%`,width:`${100*(c[2]-c[0])/s}%`,height:`${100*(c[3]-c[1])/a}%`}),d}highlightSubpath(e,t){var i,r,o;if(((i=e.subpathHighlight)==null?void 0:i.type)==="text"){let s=new ef.Component;s.load(),this.lib.onTextLayerReady(e.pdfViewer,s,a=>{var d;if(((d=e.subpathHighlight)==null?void 0:d.type)!=="text")return;let{page:c,range:l}=e.subpathHighlight;c===a&&(e.highlightText(c,l),t>0&&setTimeout(()=>{e.clearTextHighlight()},t*1e3),s.unload())})}else if(((r=e.subpathHighlight)==null?void 0:r.type)==="annotation"){let s=new ef.Component;s.load(),this.lib.onAnnotationLayerReady(e.pdfViewer,s,a=>{var d;if(((d=e.subpathHighlight)==null?void 0:d.type)!=="annotation")return;let{page:c,id:l}=e.subpathHighlight;c===a&&(e.highlightAnnotation(c,l),t>0&&setTimeout(()=>e.clearAnnotationHighlight(),t*1e3),s.unload())})}else if(((o=e.subpathHighlight)==null?void 0:o.type)==="rect"){let s=new ef.Component;s.load(),this.lib.onPageReady(e.pdfViewer,s,a=>{var d;if(((d=e.subpathHighlight)==null?void 0:d.type)!=="rect")return;let{page:c,rect:l}=e.subpathHighlight;c===a&&(this.highlightRect(e,c,l),t>0&&setTimeout(()=>{this.clearRectHighlight(e)},t*1e3),s.unload())})}}highlightRect(e,t,i){if(this.clearRectHighlight(e),1<=t&&t<=e.pdfViewer.pagesCount){let r=e.getPage(t);r!=null&&r.div.dataset.loaded&&(e.rectHighlight=this.placeRectInPage(i,r),e.rectHighlight.addClass("rect-highlight"),this.settings.zoomToFitRect||activeWindow.setTimeout(()=>{window.pdfjsViewer.scrollIntoView(e.rectHighlight,{top:-this.settings.embedMargin})}))}}clearRectHighlight(e){e.rectHighlight&&(e.rectHighlight.detach(),e.rectHighlight=null)}};var h1=require("obsidian");var nf=class extends Be{async addTextMarkupAnnotation(e,t,i,r,o,s){if(!this.plugin.settings.author)throw new Error(`${this.plugin.manifest.name}: The author name is not set. Please set it in the plugin settings.`);return await this.process(e,a=>{let c=a.getPage(t-1),{r:l,g:d,b:h}=this.plugin.domManager.getRgb(o),u=tg(),p=this.lib.highlight.geometry,f=this.addAnnotation(c,{Subtype:r,Rect:p.mergeRectangles(...i),QuadPoints:p.rectsToQuadPoints(i),Contents:K.fromText(s!=null?s:""),M:J.fromDate(new Date),T:K.fromText(this.plugin.settings.author),CA:r==="Highlight"?this.plugin.settings.writeHighlightToFileOpacity:1,Border:r==="Highlight"?[u,u,0]:void 0,C:[l/255,d/255,h/255]});return Xc(f.objectNumber,f.generationNumber)})}async addHighlightAnnotation(e,t,i,r,o){return await this.addTextMarkupAnnotation(e,t,i,"Highlight",r,o)}async addLinkAnnotation(e,t,i,r,o,s){return await this.process(e,a=>{let c=a.getPage(t-1),l=Mr(this.plugin.settings.pdfLinkColor),{r:d,g:h,b:u}=l!=null?l:{r:0,g:0,b:0},p=this.lib.highlight.geometry,f;typeof r=="string"?f=J.of(r):f=[a.getPage(r[0]).ref,r[1],...r.slice(2).map(b=>typeof b=="number"?G.of(b):He)];let m=this.addAnnotation(c,{Subtype:"Link",Rect:p.mergeRectangles(...i),QuadPoints:p.rectsToQuadPoints(i),Dest:f,M:J.fromDate(new Date),Border:[0,0,this.plugin.settings.pdfLinkBorder?1:0],C:[d/255,h/255,u/255]});return Xc(m.objectNumber,m.generationNumber)})}async process(e,t){let i=await this.lib.loadPdfLibDocument(e),r=await t(i);return await this.app.vault.modifyBinary(e,await i.save()),r}async read(e,t){let i=await this.lib.loadPdfLibDocument(e);return await t(i)}addAnnotation(e,t){let i=e.doc.context,r=i.register(i.obj({Type:"Annot",...t}));return e.node.addAnnot(r),r}async deleteAnnotation(e,t,i){await this.process(e,r=>{let o=r.getPage(t-1),s=this.findAnnotationRef(o,i);s&&o.node.removeAnnot(s)})}async getAnnotationContents(e,t,i){let r=await this.getAnnotation(e,t,i);if(r){let o=this.getContentsFromAnnotation(r);return o!=null?o:null}return null}async setAnnotationContents(e,t,i,r){await this.processAnnotation(e,t,i,o=>{this.setContentsToAnnotation(o,r)})}async getAnnotationColor(e,t,i){var o;let r=await this.getAnnotation(e,t,i);return r&&(o=this.getColorFromAnnotation(r))!=null?o:null}async setAnnotationColor(e,t,i,r){await this.processAnnotation(e,t,i,async o=>{this.setColorToAnnotation(o,r)})}async getAnnotationOpacity(e,t,i){var o;let r=await this.getAnnotation(e,t,i);return r&&(o=this.getOpacityFromAnnotation(r))!=null?o:null}async setAnnotationOpacity(e,t,i,r){await this.processAnnotation(e,t,i,async o=>{this.setOpacityToAnnotation(o,r)})}findAnnotationRef(e,t){var i;return(i=e.node.Annots())==null?void 0:i.asArray().find(r=>r instanceof Y&&Xc(r.objectNumber,r.generationNumber)===t)}async getAnnotation(e,t,i){return await this.read(e,r=>{let o=r.getPage(t-1),s=this.findAnnotationRef(o,i);return s?o.node.context.lookup(s,W):null})}async processAnnotation(e,t,i,r){return await this.process(e,async o=>{let s=o.getPage(t-1),a=this.findAnnotationRef(s,i);if(a){let c=s.node.context.lookup(a,W);await r(c)}})}getColorFromAnnotation(e){if(!e.get(v.of("AP"))){let i=e.get(v.of("C"));if(i instanceof Z){let r=i.asArray();if(r.length===3){let[o,s,a]=r.map(c=>{if(c instanceof G)return Math.round(c.asNumber()*255);throw new Error(`${this.plugin.manifest.name}: Invalid color`)});return{r:o,g:s,b:a}}}}}setColorToAnnotation(e,t){let i=e.get(v.of("C"));i instanceof Z&&(i.set(0,G.of(t.r/255)),i.set(1,G.of(t.g/255)),i.set(2,G.of(t.b/255)))}getContentsFromAnnotation(e){let t=e.get(v.of("Contents"));if(t instanceof J||t instanceof K)return t.decodeText()}setContentsToAnnotation(e,t){e.set(v.of("Contents"),K.fromText(t))}getOpacityFromAnnotation(e){if(!e.get(v.of("AP"))){let i=e.get(v.of("CA"));if(i instanceof G)return i.asNumber()}}setOpacityToAnnotation(e,t){e.set(v.of("CA"),G.of(t))}getAuthorFromAnnotation(e){let t=e.get(v.of("T"));if(t instanceof J||t instanceof K)return t.decodeText()}setAuthorToAnnotation(e,t){e.set(v.of("T"),K.fromText(t))}getBorderWidthFromAnnotation(e){let t=e.get(v.of("Border"));if(t instanceof Z){let i=t.asArray()[2];if(i instanceof G)return i.asNumber()}}setBorderWidthToAnnotation(e,t){let i=e.get(v.of("Border"));i instanceof Z&&i.set(2,G.of(t))}};var rf=class extends Be{constructor(e){super(e),this.pdflib=new nf(e)}getPdfIo(){return this.pdflib}async addTextMarkupAnnotationToSelection(e,t){return this.addAnnotationToSelection(async(i,r,o)=>await this.getPdfIo().addTextMarkupAnnotation(i,r,o,e,t))}async addLinkAnnotationToSelection(e){return this.addAnnotationToSelection(async(t,i,r)=>await this.getPdfIo().addLinkAnnotation(t,i,r,e))}async addAnnotationToSelection(e){let t=activeWindow.getSelection();if(!t)return null;let i=this.lib.copyLink.getPageAndTextRangeFromSelection(t);if(!i||!i.selection)return null;let{page:r,selection:{beginIndex:o,beginOffset:s,endIndex:a,endOffset:c}}=i,l=this.lib.getPDFViewerChildFromSelection(t);return l?{child:l,file:l.file,page:r,...await this.addAnnotationToTextRange(e,l,r,o,s,a,c)}:null}async addAnnotationToTextRange(e,t,i,r,o,s,a){if(t.file&&1<=i&&i<=t.pdfViewer.pagesCount){let c=t.getPage(i);if(c!=null&&c.textLayer&&c.div.dataset.loaded){let l=Dt(c.textLayer);if(l){let h=this.lib.highlight.geometry.computeMergedHighlightRects(l,r,o,s,a).map(({rect:p})=>p),u;try{u=await e(t.file,i,h)}catch(p){new h1.Notice(`${this.plugin.manifest.name}: An error occurred while attemping to add an annotation.`),console.error(p)}return{annotationID:u,rects:h}}}}}async deleteAnnotation(e,t,i){await this.getPdfIo().deleteAnnotation(e,t,i)}async getAnnotationContents(e,t,i){return await this.getPdfIo().getAnnotationContents(e,t,i)}async setAnnotationContents(e,t,i,r){return await this.getPdfIo().setAnnotationContents(e,t,i,r)}};var of=class extends Be{async getAnnotatedTextsInDocument(e){let t=new Map;for(let i=1;i<=e.numPages;i++){let r=await e.getPage(i),o=await this.getAnnotatedTextsInPage(r);t.set(i,o)}return t}async getAnnotatedTextsInPage(e){var o;let[{items:t},i]=await Promise.all([e.getTextContent({includeChars:!0}),e.getAnnotations()]),r=[];for(let s of i){if(!["Highlight","Underline","Squiggly","StrikeOut"].includes(s.subtype))continue;let c=dg(s.quadPoints);if(!c.length)continue;let l=c.map(u=>this.getTextByRect(t,u)),d=s.color?{r:s.color[0],g:s.color[1],b:s.color[2]}:null,h=(o=s.contentsObj)==null?void 0:o.str;r.push({id:s.id,textRanges:l,rgb:d,comment:h,left:c[0][0],top:c[0][3]})}return new Map(r.sort((s,a)=>{if(s.textRanges.length&&a.textRanges.length){let c=s.textRanges[0].from,l=a.textRanges[0].from;return c.index-l.index||c.offset-l.offset}return a.top-s.top||s.left-a.left}).map(s=>{let a=s.textRanges.map(c=>c.text).join(` `);return a=this.lib.toSingleLine(a),[s.id,{text:a,rgb:s.rgb,comment:s.comment}]}))}getTextByRect(e,t){let[i,r,o,s]=t,a="",c={index:-1,offset:-1},l={index:-1,offset:-1};for(let d=0;d{let i=t.view;this.lib.isPDFView(i)&&e(i)})}iterateBacklinkViews(e){this.app.workspace.getLeavesOfType("backlink").forEach(t=>e(t.view))}iterateCanvasViews(e){this.app.workspace.iterateAllLeaves(t=>{let i=t.view;this.lib.isCanvasView(i)&&e(i)})}iteratePDFEmbeds(e){this.app.workspace.iterateAllLeaves(t=>{let i=t.view;i instanceof Qe.MarkdownView?this.lib.getAllPDFEmbedsInMarkdownView(i).forEach(e):this.lib.isCanvasView(i)?this.lib.getAllPDFEmbedsInCanvasView(i).forEach(e):this.lib.isExcalidrawView(i)&&this.lib.getAllPDFEmbedsInExcalidrawView(i).forEach(e)})}iteratePDFViewerComponents(e){this.app.workspace.iterateAllLeaves(t=>{let i=t.view;this.lib.isPDFView(i)?e(i.viewer,i.file):i instanceof Qe.MarkdownView?this.lib.getAllPDFEmbedsInMarkdownView(i).forEach(r=>e(r.viewer,r.file)):this.lib.isCanvasView(i)?this.lib.getAllPDFEmbedsInCanvasView(i).forEach(r=>e(r.viewer,r.file)):this.lib.isExcalidrawView(i)&&this.lib.getAllPDFEmbedsInExcalidrawView(i).forEach(r=>e(r.viewer,r.file))})}iteratePDFViewerChild(e){this.iteratePDFViewerComponents(t=>{t.then(i=>e(i))})}getActivePDFView(){var t;if(this.plugin.classes.PDFView)return this.app.workspace.getActiveViewOfType(this.plugin.classes.PDFView);let e=(t=this.app.workspace.activeLeaf)==null?void 0:t.view;return e&&this.lib.isPDFView(e)?e:null}getActiveCanvasView(){var t;let e=(t=this.app.workspace.activeLeaf)==null?void 0:t.view;return e&&this.lib.isCanvasView(e)?e:null}getActiveExcalidrawView(){var t;let e=(t=this.app.workspace.activeLeaf)==null?void 0:t.view;return e&&this.lib.isExcalidrawView(e)?e:null}getExistingLeafForPDFFile(e){return this.getExistingLeafForFile(e)}getActiveGroupLeaves(){var t;let e=(t=this.app.workspace.activeLeaf)==null?void 0:t.group;return e?this.app.workspace.getGroupLeaves(e):null}async openMarkdownLinkFromPDF(e,t,i,r){var a;let o;i?o=this.app.workspace.getLeaf(i):u1(this.settings.paneTypeForFirstMDLeaf)&&this.settings.alwaysUseSidebar?o=this.getMarkdownLeafInSidebar(this.settings.paneTypeForFirstMDLeaf):o=this.getMarkdownLeafForLinkFromPDF(e,t);let s={};if(r){if("pos"in r){let{pos:c}=r;s.eState={line:c.start.line,startLoc:c.start,endLoc:c.end}}else{let{line:c}=r;s.eState={line:c}}s.eState.scroll=s.eState.line,s.eState.focus=!this.settings.dontActivateAfterOpenMD}o.parentSplit instanceof Qe.WorkspaceTabs&&o.parentSplit===((a=this.app.workspace.activeLeaf)==null?void 0:a.parentSplit)||(s.active=!this.plugin.settings.dontActivateAfterOpenMD),await o.openLinkText(e,t,s),await this.revealLeaf(o)}getMarkdownLeafInSidebar(e){var t;return this.settings.singleMDLeafInSidebar?(t=this.lib.workspace.getExistingMarkdownLeafInSidebar(e))!=null?t:this.lib.workspace.getNewLeafInSidebar(e):this.lib.workspace.getNewLeafInSidebar(e)}getMarkdownLeafForLinkFromPDF(e,t){var a;let{path:i}=(0,Qe.parseLinktext)(e),r=this.app.metadataCache.getFirstLinkpathDest(i,t),o,s;return this.app.workspace.iterateAllLeaves(c=>{if(o)return;let l=!0;if(c.view.getViewType()==="markdown"){let d=c.getRoot();for(let h of this.settings.ignoreExistingMarkdownTabIn)if(d===this.app.workspace[h])return;c.parentSplit instanceof Qe.WorkspaceTabs&&c.parentSplit.children.some(u=>{if(u instanceof Qe.WorkspaceLeaf&&u.view.getViewType()==="pdf")return this.getFilePathFromView(u.view)===t})&&(l=!1),l&&(s=c.parentSplit),r&&this.getFilePathFromView(c.view)===r.path&&(o=c)}}),o||(u1(this.settings.paneTypeForFirstMDLeaf)&&this.settings.singleMDLeafInSidebar&&s&&this.isInSidebar(s)?o=(a=this.getExistingMarkdownLeafInSidebar(this.settings.paneTypeForFirstMDLeaf))!=null?a:this.lib.workspace.getNewLeafInSidebar(this.settings.paneTypeForFirstMDLeaf):o=s?this.app.workspace.createLeafInParent(s,-1):this.getLeaf(this.plugin.settings.paneTypeForFirstMDLeaf)),o}isInSidebar(e){let t=e.getRoot();return t===this.app.workspace.rightSplit||t===this.app.workspace.leftSplit}getLeaf(e){return e===""&&(e=!1),typeof e=="boolean"||EC(e)?this.app.workspace.getLeaf(e):TC(e)?this.getLeafBySplit(e):this.getLeafInSidebar(e)}getLeafBySplit(e){let t=this.app.workspace.getMostRecentLeaf();if(t){if(["right","left"].contains(e))return this.app.workspace.createLeafBySplit(t,"vertical",e==="left");if(["down","up"].contains(e))return this.app.workspace.createLeafBySplit(t,"horizontal",e==="up")}return this.app.workspace.createLeafInParent(this.app.workspace.rootSplit,0)}getLeafInSidebar(e){return this.getNewLeafInSidebar(e)}getExistingMarkdownLeafInSidebar(e){let t,i=e==="right-sidebar"?this.app.workspace.rightSplit:this.app.workspace.leftSplit;return this.app.workspace.iterateAllLeaves(r=>{t||r.getRoot()!==i||r.view.getViewType()==="markdown"&&(t=r)}),t!=null?t:null}getNewLeafInSidebar(e){let t=e==="right-sidebar"?this.app.workspace.getRightLeaf(!1):this.app.workspace.getLeftLeaf(!1);if(!t)throw new Error("No sidebar leaf found");return t}async revealLeaf(e){if((0,Qe.requireApiVersion)("1.5.11")){await this.app.workspace.revealLeaf(e);return}if(!Qe.Platform.isDesktopApp){this.app.workspace.revealLeaf(e);return}let t=e.getRoot();t instanceof Qe.WorkspaceSidedock&&t.collapsed&&t.toggle();let i=e.parent;i instanceof Qe.WorkspaceTabs&&i.selectTab(e),e.getContainer().focus()}openPDFLinkTextInLeaf(e,t,i,r){let{subpath:o}=(0,Qe.parseLinktext)(t);return this.plugin.patchStatus.pdfInternals||(this.plugin.subpathWhenPatched=o),e.openLinkText(t,i,r).then(async()=>{await this.revealLeaf(e);let s=e.view;this.lib.isPDFView(s)&&s.viewer.then(a=>{let c=this.plugin.settings.highlightDuration;this.lib.highlight.viewer.highlightSubpath(a,c)})})}openPDFLinkTextInExistingLeafForTargetPDF(e,t,i,r){var a,c;if(!r){let{path:l}=(0,Qe.parseLinktext)(e);r=(a=this.app.metadataCache.getFirstLinkpathDest(l,t))!=null?a:void 0}if(!r)return{exists:!1,promise:Promise.resolve()};let o=this.getExistingLeafForPDFFile(r);return o?(o.parentSplit instanceof Qe.WorkspaceTabs&&o.parentSplit===((c=this.app.workspace.activeLeaf)==null?void 0:c.parentSplit)||(i=i!=null?i:{},i.active=!this.settings.dontActivateAfterOpenPDF),o.isVisible()&&this.settings.highlightExistingTab&&(o.containerEl.addClass("pdf-plus-link-opened","is-highlighted"),setTimeout(()=>o.containerEl.removeClass("pdf-plus-link-opened","is-highlighted"),this.settings.existingTabHighlightDuration*1e3)),{exists:!0,promise:this.openPDFLinkTextInLeaf(o,e,t,i)}):{exists:!1,promise:Promise.resolve()}}getExistingLeafForFile(e){let t=this.app.viewRegistry.getTypeByExtension(e.extension);if(!t)return null;let i=null;return this.app.workspace.iterateAllLeaves(r=>{i||r.view.getViewType()===t&&this.getFilePathFromView(r.view)===e.path&&(i=r)}),i}getExistingLeafForMarkdownFile(e){return this.getExistingLeafForFile(e)}isMarkdownFileOpened(e){return!!this.getExistingLeafForMarkdownFile(e)}registerHideSidebar(e){let t=e.getRoot();if(t===this.app.workspace.leftSplit||t===this.app.workspace.rightSplit){let i=t,r=this.app.workspace.on("active-leaf-change",o=>{o&&o.getRoot()!==i&&(i.collapse(),this.app.workspace.offref(r))})}}getFilePathFromView(e){let t=e.getState().file;return typeof t=="string"?t:null}async ensureViewLoaded(e){(0,Qe.requireApiVersion)("1.7.2")&&await e.loadIfDeferred()}},tm=class extends Be{get hoverEditorPlugin(){var e;return(e=this.app.plugins.plugins["obsidian-hover-editor"])!=null?e:null}get waitTime(){var e;return(e=this.hoverEditorPlugin)==null?void 0:e.settings.triggerDelay}isHoverEditorLeaf(e){return e.containerEl.closest(".popover.hover-popover.hover-editor")!==null}async createNewHoverEditorLeaf(e,t,i,r,o){return this.hoverEditorPlugin?new Promise(s=>{var c;let a=this.app.workspace.on("active-leaf-change",l=>{l&&this.isHoverEditorLeaf(l)&&(this.app.workspace.offref(a),s(l))});this.app.workspace.trigger("link-hover",e,t,i,r,o),window.setTimeout(()=>{this.app.workspace.offref(a),s(null)},((c=this.waitTime)!=null?c:300)+300)}):null}iterateHoverEditorLeaves(e){this.app.workspace.iterateAllLeaves(t=>{this.isHoverEditorLeaf(t)&&e(t)})}getHoverEditorForLeaf(e){var t,i;return(i=(t=this.hoverEditorPlugin)==null?void 0:t.activePopovers.find(r=>r.hoverEl.contains(e.containerEl)))!=null?i:null}postProcessHoverEditorLeaf(e){if(this.isHoverEditorLeaf(e)){let t=this.getHoverEditorForLeaf(e);if(t&&(t.hoverEl.hasClass("is-minimized")&&t.toggleMinimized(),this.settings.closeHoverEditorWhenLostFocus)){let i=this.app.workspace.on("active-leaf-change",r=>{r!==e&&(t.hide(),this.app.workspace.offref(i))})}}}};var ct=require("obsidian");var ld=require("obsidian");var lf=class extends Ke{onOpen(){var e;super.onOpen(),this.containerEl.addClass("pdf-plus-restore-default-modal"),this.titleEl.setText(`${this.plugin.manifest.name}: Restore default settings`),this.contentEl.createEl("p",{text:`This operation will overwrite your PDF++ config file (${((e=this.plugin.manifest.dir)!=null?e:this.app.vault.configDir+"/plugins/"+this.plugin.manifest.id)+"/data.json"}). You may want to back up the file before proceeding.`}),this.contentEl.createDiv("modal-button-container",t=>{new ld.ButtonComponent(t).setButtonText("I understand, restore default settings").setWarning().onClick(async()=>{await this.plugin.restoreDefaultSettings(),this.close(),new ld.Notice(`${this.plugin.manifest.name}: Default setting restored. Note that some options require a restart to take effect.`,6e3)}),new ld.ButtonComponent(t).setButtonText("Cancel").onClick(()=>{this.close()})}),setTimeout(()=>{let t=this.containerEl.doc.activeElement;t&&t.instanceOf(HTMLButtonElement)&&this.containerEl.contains(t)&&t.blur()})}};var _r=require("obsidian");var AC=(n,e,t)=>{let i=n.key.path,r=Array.isArray(n.value)?n.value:[n.value];r=r.filter(l=>l&&l.hasOwnProperty("path")&&l.hasOwnProperty("subpath"));let o=e.metadataCache.getCache(i);if(!o)return!1;let s=o.frontmatterLinks,a=s?s.filter(l=>l.key===t||l.key.startsWith(t+".")).length:0;return r.length-a>0},im=(n,e)=>{let t=n.app,i=async()=>{let r=await IC(n);e(r)};t.workspace.onLayoutReady(()=>{let r=t.plugins.plugins.dataview;if(r)if(r.index.initialized)i();else{let o=t.metadataCache.on("dataview:index-ready",()=>{i(),t.metadataCache.offref(o)});n.registerEvent(o)}})},IC=async n=>{let e=n.app,t=e.plugins.plugins.dataview;if(!t)return[];let i=t.api,r=n.settings.proxyMDProperty;try{let o=await i.query(`LIST ${r} WHERE ${r}`);return o.successful?o.value.values.filter(a=>AC(a,e,r)).map(a=>{let c=a.key.path;return e.vault.getFileByPath(c)}).filter(a=>a!==null):[]}catch(o){return console.error(n.manifest.name+": error while checking dataview inline fields"),console.error(o),[]}},Aa=class n extends Ke{constructor(e,t){super(e),this.filesWithInlineFields=t}static async open(e,t=!1){im(e,i=>{t&&i.length===0||new n(e,i).open()})}onOpen(){super.onOpen(),this.containerEl.setCssProps({"--layer-modal":"calc(var(--layer-popover) - 1)"});let e=this.plugin.settings.proxyMDProperty;this.setTitle(`${this.plugin.manifest.name}: About the "${e}" Dataview inline fields`),this.renderContent(),this.renderButtons()}renderContent(){let e=this.plugin.settings.proxyMDProperty;this.contentEl.createEl("p",{text:createFragment(i=>i.append("For the ",createEl("a",{text:'"Property to associate a markdown file to a PDF file"'},r=>{r.onclick=()=>{this.plugin.openSettingTab().scrollTo("proxyMDProperty")},(0,_r.setTooltip)(r,"Open in PDF++ settings",{placement:"top"})})," setting, ",createEl("a",{text:"Dataview",href:"obsidian://show-plugin?id=dataview"}),"'s inline field syntax such as ",createEl("code",{text:`${e}:: [[file.pdf]]`})," is supported for the time being, but ",createSpan({text:"it is deprecated and will likely not work in the future"},r=>r.setCssStyles({color:"var(--text-warning)"})),"."))}),this.contentEl.createEl("hr",{},i=>i.setCssStyles({margin:"1rem 0"}));let t=this.filesWithInlineFields;if(t.length===0){this.contentEl.createEl("p",{text:`No "${e}" inline fields detected. You're good to go!`});return}this.contentEl.createEl("p",{text:createFragment(i=>i.append(t.length>=2?"The following files seem to have ":"The following file seems to have ",`"${e}" inline fields.`,createEl("br"),"Please consider moving these inline fields to the ",createEl("a",{text:"properties (YAML frontmatter)",href:"https://help.obsidian.md/properties",cls:"external-link"},r=>{(0,_r.setTooltip)(r,"https://help.obsidian.md/properties",{placement:"top"})})," instead."))}),this.contentEl.createDiv({},i=>{i.setCssStyles({maxHeight:"200px",overflow:"auto",border:"1px solid var(--background-modifier-border)",borderRadius:"5px",backgroundColor:"var(--background-secondary)",margin:"var(--size-2-2)"}),i.createEl("ul",{},r=>{t.forEach(o=>{r.createEl("li",{},s=>{s.createEl("a",{text:this.app.metadataCache.fileToLinktext(o,""),cls:"internal-link",attr:{href:o.path,"data-href":o.path}})})}),Qo(this.app,r,"")})}),t.length>0?this.contentEl.createEl("p",{text:`To display this modal again, run the "${this.plugin.lib.commands.getCommand("open-dataview-inline-fields-modal").name}" command.`}):this.plugin.requiresDataviewInlineFieldsMigration=!1}renderButtons(){let e=this.filesWithInlineFields;this.contentEl.createDiv("modal-button-container",t=>{e.length>0&&new _r.ButtonComponent(t).setButtonText(e.length>=2?"Copy links as markdown":"Copy link as markdown").setCta().onClick(async()=>{let i=e.length>=2?e.map(r=>"- "+this.app.fileManager.generateMarkdownLink(r,"")).join(` `):this.app.fileManager.generateMarkdownLink(e[0],"");await navigator.clipboard.writeText(i),new _r.Notice(`${this.plugin.manifest.name}: Copied!`)}),new _r.ButtonComponent(t).setButtonText("Close").onClick(()=>{this.close()})})}};var cf=class extends Be{constructor(...e){super(...e);let t=[{id:"copy-link-to-selection",name:"Copy link to selection or annotation",checkCallback:i=>this.copyLink(i,!1)},{id:"rectangular-selection",name:"Start rectangular selection",checkCallback:i=>this.copyEmbedLinkToRectangularSelection(i,!1)},{id:"context-menu",name:"Show context menu at selection",checkCallback:i=>this.showContextMenu(i)},{id:"extract-annotation-and-copy-links",name:"Extract & copy annotations in this PDF",checkCallback:i=>this.extractHighlightedText(i)},{id:"copy-link-to-page-view",name:"Copy link to current page view",checkCallback:i=>this.copyLinkToPageView(i)},{id:"outline",name:"Show outline",checkCallback:i=>this.showOutline(i)},{id:"thumbnail",name:"Show thumbnail",checkCallback:i=>this.showThumbnail(i)},{id:"close-sidebar",name:"Close PDF sidebar",checkCallback:i=>this.closeSidebar(i)},{id:"toggle-sidebar",name:"Toggle PDF sidebar",checkCallback:i=>this.toggleSidebar(i)},{id:"fit-width",name:"Fit width",checkCallback:i=>this.setScaleValue(i,"page-width")},{id:"fit-height",name:"Fit height",checkCallback:i=>this.setScaleValue(i,"page-height")},{id:"zoom-in",name:"Zoom in",checkCallback:i=>this.zoom(i,!0)},{id:"zoom-out",name:"Zoom out",checkCallback:i=>this.zoom(i,!1)},{id:"adapt-to-theme",name:"Adapt to theme",checkCallback:i=>this.toggleAdaptToTheme(i,!0)},{id:"not-adapt-to-theme",name:"Don't adapt to theme",checkCallback:i=>this.toggleAdaptToTheme(i,!1)},{id:"toggle-adapt-to-theme",name:'Toggle "adapt to theme"',checkCallback:i=>this.toggleAdaptToTheme(i)},{id:"go-to-page",name:"Go to page",checkCallback:i=>this.focusAndSelectPageNumberEl(i)},{id:"copy-format-menu",name:"Show copy format menu",checkCallback:i=>this.showCopyFormatMenu(i)},{id:"display-text-format-menu",name:"Show display text format menu",checkCallback:i=>this.showDisplayTextFormatMenu(i)},{id:"enable-pdf-edit",name:"Enable PDF edit",checkCallback:i=>this.setWriteFile(i,!0)},{id:"disable-pdf-edit",name:"Disable PDF edit",checkCallback:i=>this.setWriteFile(i,!1)},{id:"toggle-auto-focus",name:"Toggle auto-focus",callback:()=>this.toggleAutoFocus()},{id:"toggle-auto-paste",name:"Toggle auto-paste",callback:()=>this.toggleAutoPaste()},{id:"toggle-auto-copy",name:"Toggle auto-copy",callback:()=>this.plugin.autoCopyMode.toggle()},{id:"add-page",name:"Add new page at the end",checkCallback:i=>this.addPage(i)},{id:"insert-page-before",name:"Insert page before this page",checkCallback:i=>this.insertPage(i,!0)},{id:"insert-page-after",name:"Insert page after this page",checkCallback:i=>this.insertPage(i,!1)},{id:"delete-page",name:"Delete this page",checkCallback:i=>this.deletePage(i)},{id:"extract-this-page",name:"Extract this page to a new file",checkCallback:i=>this.extractThisPage(i)},{id:"divide",name:"Divide this PDF into two files at this page",checkCallback:i=>this.dividePDF(i)},{id:"edit-page-labels",name:"Edit page labels",checkCallback:i=>this.editPageLabels(i)},{id:"copy-outline-as-list",name:"Copy PDF outline as markdown list",checkCallback:i=>this.copyOutline(i,"list")},{id:"copy-outline-as-headings",name:"Copy PDF outline as markdown headings",checkCallback:i=>this.copyOutline(i,"heading")},{id:"add-outline-item",name:"Add to outline (bookmark)",checkCallback:i=>this.addOutlineItem(i)},{id:"create-new-note",name:"Create new note for auto-focus or auto-paste",callback:()=>this.createNewNote()},{id:"copy-debug-info",name:"Copy debug info",callback:()=>this.copyDebugInfo()},{id:"load-debug-info",name:"Load debug info",checkCallback:i=>this.loadDebugInfo(i)},{id:"create-pdf",name:"Create new PDF",callback:()=>this.createPDF()},{id:"import",name:"Import this PDF into vault",checkCallback:i=>this.importExternalFileIntoVault(i)},{id:"open-external",name:"Open this PDF in the original location",checkCallback:i=>this.openExternalSource(i)},{id:"create-dummy",name:"Create dummy file for external PDF",callback:()=>this.createDummyForExternalPDF()},{id:"restore-default",name:"Restore default settings",callback:()=>new lf(this.plugin).open()},{id:"open-dataview-inline-fields-modal",name:"Check Dataview inline fields",checkCallback:i=>this.plugin.requiresDataviewInlineFieldsMigration?(i||Aa.open(this.plugin),!0):!1}];this.commands={};for(let i of t)this.commands[i.id]=i}registerCommands(){Object.values(this.commands).forEach(e=>{this.plugin.addCommand(this.plugin.obsidianHasFocusBug?this.restorePDFLeafFocus(e):e)})}restorePDFLeafFocus(e){let t=e.checkCallback;if(!t)return e;let i=null;return{...e,checkCallback:r=>{var o,s;return r?(i=(s=(o=this.lib.workspace.getActivePDFView())==null?void 0:o.leaf)!=null?s:null,t(r)):(i&&i!==this.app.workspace.activeLeaf&&(this.app.workspace.setActiveLeaf(i,{focus:!0}),i=null),t(r))}}}getCommand(e){return e.startsWith(this.plugin.manifest.id+":")&&(e=e.slice(this.plugin.manifest.id.length+1)),this.commands[e]}listCommands(){return Object.values(this.commands)}listCommandNames(){return Object.values(this.commands).map(e=>this.stripCommandNamePrefix(e.name))}stripCommandNamePrefix(e){return e.startsWith(this.plugin.manifest.name+": ")?e.slice(this.plugin.manifest.name.length+2):e}copyLink(e,t=!1){return!this.writeHighlightAnnotationToSelectionIntoFileAndCopyLink(e,t)&&!this.copyLinkToAnnotation(e,t)?this.copyLinkToSelection(e,t):!0}createCanvasCard(e){return this.createCanvasCardFromAnnotation(e)?!0:this.createCanvasCardFromSelection(e)}copyLinkToSelection(e,t=!1){let i=this.lib.copyLink.getSelectionLinkInfo();if(!i)return!1;let{template:r,colorName:o}=i;return this.lib.copyLink.copyLinkToSelection(e,{copyFormat:r},o,t)}copyLinkToAnnotation(e,t=!1){let i=this.lib.copyLink.getAnnotationLinkInfo();if(!i)return!1;let{child:r,copyButtonEl:o,template:s,page:a,id:c}=i,l=this.lib.copyLink.copyLinkToAnnotation(r,e,{copyFormat:s},a,c,t);return!e&&l&&(0,ct.setIcon)(o,"lucide-check"),l}writeHighlightAnnotationToSelectionIntoFileAndCopyLink(e,t=!1){var s;let i=this.lib.getColorPaletteAssociatedWithSelection();if(!i||!i.writeFile)return!1;let r=this.settings.copyCommands[i.actionIndex].template,o=(s=i.selectedColorName)!=null?s:void 0;return this.lib.copyLink.writeHighlightAnnotationToSelectionIntoFileAndCopyLink(e,{copyFormat:r},o,t)}copyEmbedLinkToRectangularSelection(e,t){let i=this.lib.getColorPalette();return!i||!i.cropButtonEl?!1:(e||i.startRectangularSelection(t),!0)}createCanvasCardFromSelection(e){var s;let t=(s=this.lib.workspace.getActiveCanvasView())==null?void 0:s.canvas;if(!t)return!1;let i=this.lib.copyLink.getSelectionLinkInfo();if(!i)return!1;let{template:r,colorName:o}=i;return this.lib.copyLink.makeCanvasTextNodeFromSelection(e,t,r,o)}createCanvasCardFromAnnotation(e){var l;let t=(l=this.lib.workspace.getActiveCanvasView())==null?void 0:l.canvas;if(!t)return!1;let i=this.lib.copyLink.getAnnotationLinkInfo();if(!i)return!1;let{child:r,template:o,page:s,id:a}=i;return this.lib.copyLink.makeCanvasTextNodeFromAnnotation(e,t,r,o,s,a)}copyLinkToPageView(e){var r,o,s,a,c;let t=this.lib.getPDFView(!0);if(!t||!t.file)return!1;let i=t.getState();if(typeof i.left!="number"||typeof i.top!="number")return!1;if(!e){let l=`#page=${i.page}`,d;((o=(r=t.viewer.child)==null?void 0:r.pdfViewer.pdfViewer)==null?void 0:o.currentScaleValue)==="page-width"?(l+=`&offset=,${i.top},`,d=[i.page-1,"FitBH",i.top]):(l+=`&offset=${i.left},${i.top},${(s=i.zoom)!=null?s:0}`,d=[i.page-1,"XYZ",i.left,i.top,(a=i.zoom)!=null?a:0]);let u=(c=t.viewer.child)==null?void 0:c.getPageLinkAlias(i.page),p=this.lib.generateMarkdownLink(t.file,"",l,u).slice(1);navigator.clipboard.writeText(p),new ct.Notice(`${this.plugin.manifest.name}: Link copied to clipboard`),this.plugin.lastCopiedDestInfo={file:t.file,destArray:d}}return!0}showOutline(e){var r;let t=this.lib.getObsidianViewer(!0);if(!t)return!1;let i=(r=t.dom)==null?void 0:r.containerEl;if(!t.isEmbed||i&&i.contains(i.doc.activeElement)){let o=t==null?void 0:t.pdfSidebar;if(o)return o.haveOutline?o.isOpen&&o.active===2?this.settings.closeSidebarWithShowCommandIfExist?(e||o.close(),!0):!1:(e||o.switchView(2,!0),!0):!1}return this.settings.executeBuiltinCommandForOutline&&this.app.internalPlugins.plugins.outline.enabled?(e||this.app.commands.executeCommandById("outline:open"),!0):!1}showThumbnail(e){var i;let t=(i=this.lib.getObsidianViewer(!0))==null?void 0:i.pdfSidebar;return t?t.isOpen&&t.active===1?this.settings.closeSidebarWithShowCommandIfExist?(e||t.close(),!0):!1:(e||t.switchView(1,!0),!0):!1}closeSidebar(e){var i;let t=(i=this.lib.getObsidianViewer(!0))==null?void 0:i.pdfSidebar;return!t||!t.isOpen?!1:(e||t.close(),!0)}toggleSidebar(e){var i;let t=(i=this.lib.getObsidianViewer(!0))==null?void 0:i.pdfSidebar;return t?(e||(t.isOpen?t.close():t.open()),!0):!1}setScaleValue(e,t){let i=this.lib.getPDFViewer(!0);return i?(e||(i.currentScaleValue=t),!0):!1}zoom(e,t){var o;let i=this.lib.getObsidianViewer(!0);if(!i)return!1;let r=(o=i.dom)==null?void 0:o.containerEl;if((!i.isEmbed||r&&r.contains(r.doc.activeElement))&&i)return e||(t?i.zoomIn():i.zoomOut()),!0;if(this.settings.executeFontSizeAdjusterCommand){let s=t?"font-size:increment-font-size":"font-size:decrement-font-size";if(this.app.commands.findCommand(s))return e||this.app.commands.executeCommandById(s),!0}if(this.settings.executeBuiltinCommandForZoom){let s=t?"window:zoom-in":"window:zoom-out";return this.app.commands.findCommand(s)?(e||this.app.commands.executeCommandById(s),!0):!1}return!1}toggleAdaptToTheme(e,t){let i=this.lib.getPDFViewerChild(!0);if(!i)return!1;let r=!!this.app.loadLocalStorage("pdfjs-is-themed");return typeof t=="boolean"&&(t&&r||!t&&!r)?!1:(t=t!=null?t:!r,e||(this.app.saveLocalStorage("pdfjs-is-themed",t?"true":null),i.onCSSChange()),!0)}focusAndSelectPageNumberEl(e){let t=this.lib.getToolbar(!0);return t?(e||(t.pageInputEl.focus(),t.pageInputEl.select()),!0):!1}showCopyFormatMenu(e){let t=this.lib.getColorPalette();return!t||!t.actionMenuEl?!1:(e||t.actionMenuEl.click(),!0)}showDisplayTextFormatMenu(e){let t=this.lib.getColorPalette();return!t||!t.displayTextFormatMenuEl?!1:(e||t.displayTextFormatMenuEl.click(),!0)}setWriteFile(e,t){let i=this.lib.getColorPalette();return!i||!this.lib.isEditable(i.child)||i.writeFile===t?!1:(e||i.setWriteFile(t),!0)}toggleAutoFocus(){this.plugin.toggleAutoFocus()}toggleAutoPaste(){this.plugin.toggleAutoPaste()}addPage(e){let t=this.lib.getPDFViewerChild(!0);if(!t||!this.lib.isEditable(t))return!1;let i=t.file;return i?(e||this.lib.composer.addPage(i),!0):!1}insertPage(e,t){let i=this.lib.workspace.getActivePDFView();if(!i||!i.file)return!1;let r=i.file,o=i.viewer.child;if(!o||!this.lib.isEditable(o))return!1;let s=i.getState().page,a=s+(t?0:1);return e||this._insertPage(r,a,s),!0}_insertPage(e,t,i){new Gn(this.plugin,this.settings.askPageLabelUpdateWhenInsertPage,this.settings.pageLabelUpdateWhenInsertPage,!1,!1).ask().then(r=>{this.lib.composer.insertPage(e,t,i,r)})}deletePage(e){let t=this.lib.workspace.getActivePDFView();if(!t||!t.file)return!1;let i=t.file,r=t.viewer.child;if(!r||!this.lib.isEditable(r))return!1;let o=t.getState().page;return e||this._deletePage(i,o),!0}_deletePage(e,t){new wu(e,t,this.plugin).openIfNeccessary().then(()=>{new Gn(this.plugin,this.settings.askPageLabelUpdateWhenDeletePage,this.settings.pageLabelUpdateWhenDeletePage,!1,!1).ask().then(i=>{this.lib.composer.removePage(e,t,i)})})}extractThisPage(e){let t=this.lib.workspace.getActivePDFView();if(!t)return!1;let i=t.file;if(!i)return!1;let r=t.viewer.child;if(!r||!this.lib.isEditable(r))return!1;if(!e){let o=t.getState().page;this._extractPage(i,o)}return!0}_extractPage(e,t){let i=this.lib.getAvailablePathForCopy(e);new Gn(this.plugin,this.settings.askPageLabelUpdateWhenExtractPage,this.settings.pageLabelUpdateWhenExtractPage,this.settings.askExtractPageInPlace,this.settings.extractPageInPlace).ask().then((r,o)=>{this.lib.composer.extractPages(e,[t],i,!1,r,o).then(async s=>{if(!s){new ct.Notice(`${this.plugin.manifest.name}: Failed to extract page.`);return}if(this.settings.openAfterExtractPages){let a=this.lib.workspace.getLeaf(this.settings.howToOpenExtractedPDF);await a.openFile(s),await this.lib.workspace.revealLeaf(a)}})})}dividePDF(e){let t=this.lib.workspace.getActivePDFView();if(!t)return!1;let i=t.file;if(!i)return!1;let r=t.viewer.child;if(!r||!this.lib.isEditable(r))return!1;if(!e){let o=t.getState().page;this._dividePDF(i,o)}return!0}_dividePDF(e,t){let i=this.lib.getAvailablePathForCopy(e);new Gn(this.plugin,this.settings.askPageLabelUpdateWhenExtractPage,this.settings.pageLabelUpdateWhenExtractPage,this.settings.askExtractPageInPlace,this.settings.extractPageInPlace).ask().then((r,o)=>{this.lib.composer.extractPages(e,{from:t},i,!1,r,o).then(async s=>{if(!s){new ct.Notice(`${this.plugin.manifest.name}: Failed to divide PDF.`);return}if(this.settings.openAfterExtractPages){let a=this.lib.workspace.getLeaf(this.settings.howToOpenExtractedPDF);await a.openFile(s),await this.lib.workspace.revealLeaf(a)}})})}createPDF(){var s,a,c;let e=this.app.workspace.getActiveFile(),t=this.settings.newPDFLocation,i=t==="root"?"/":t=="current"?(a=(s=e==null?void 0:e.parent)==null?void 0:s.path)!=null?a:"":(0,ct.normalizePath)(this.settings.newPDFFolderPath),r=(c=this.app.vault.getAbstractFileByPath(i))!=null?c:this.app.vault.getRoot(),o=this.app.vault.getAvailablePath((0,ct.normalizePath)(r.path+"/Untitled"),"pdf");new Fu(this.plugin).askOptions().then(async l=>{let d=await this.app.vault.createBinary(o,await l.save());await this.app.workspace.getLeaf("tab").openFile(d)})}editPageLabels(e){let t=this.lib.workspace.getActivePDFView();if(!t||!t.viewer.child||!this.lib.isEditable(t.viewer.child))return!1;let i=t.file;return i?(e||new Cu(this.plugin,i).open(),!0):!1}copyOutline(e,t){let i=this.lib.getPDFViewerChild(!0),r=i==null?void 0:i.file;if(!i||!r||!i.pdfViewer.pdfSidebar.haveOutline)return!1;if(!e){let s=t==="list"?this.settings.copyOutlineAsListFormat:this.settings.copyOutlineAsHeadingsFormat,a=t==="list"?this.settings.copyOutlineAsListDisplayTextFormat:this.settings.copyOutlineAsHeadingsDisplayTextFormat,c=this.settings.copyOutlineAsHeadingsMinLevel;(async()=>{let l=await Ge.fromFile(r,this.plugin),d="",h=this.app.vault.getConfig("useTab"),u=this.app.vault.getConfig("tabSize"),p=h?" ":" ".repeat(u);await l.iterAsync({enter:async f=>{var m;if(!f.isRoot()){let x=null,g=f.getExplicitDestination();g&&(x=await this.lib.destArrayToSubpath(g));let b=x?(m=$o(x))==null?void 0:m.page:void 0,w=x&&b!==void 0?this.lib.copyLink.getTextToCopy(i,s,a,r,b,x,f.title,"",""):f.title;t==="list"?d+=`${p.repeat(f.depth-1)}- ${w} `:t==="heading"&&(d+="#".repeat(f.depth+c-1)+` ${w} `)}}}),navigator.clipboard.writeText(d),new ct.Notice(`${this.plugin.manifest.name}: Outline copied to clipboard.`)})()}return!0}addOutlineItem(e){let t=this.lib.workspace.getActivePDFView(),i=t==null?void 0:t.file,r=t==null?void 0:t.viewer.child;if(!t||!i||!r||!this.lib.isEditable(r))return!1;let o=t.getState(),s=this.lib.viewStateToDestArray(o,!0);return s?(e||new jr(this.plugin,"Add to outline").ask().then(async({title:a})=>{let c=await Ge.fromFile(i,this.plugin),l=c.doc;c.ensureRoot().createChild(a,s).updateCountForAllAncestors(),c.ensureRoot().sortChildren(),await this.app.vault.modifyBinary(i,await l.save())}),!0):!1}async createNewNote(){var d;let e=this.app.workspace.getActiveFile(),t=(d=e==null?void 0:e.path)!=null?d:"",i=this.app.fileManager.getNewFileParent(t),r="",o="";if(e&&e.extension==="pdf"){let h=new sd(this.plugin,{file:e,folder:e.parent,app:this.app}),u=this.settings.newFileNameFormat;u&&(r=h.evalTemplate(u));let p=this.settings.newFileTemplatePath;if(p){let f=this.app.vault.getAbstractFileByPath(p);f instanceof ct.TFile&&(o=await this.app.vault.read(f),o=h.evalTemplate(o))}}let s=await this.app.fileManager.createNewMarkdownFile(i,r,o||void 0),a=async()=>{let{leaf:h,isExistingLeaf:u}=await this.lib.copyLink.prepareMarkdownLeafForPaste(s);if(h){await this.lib.workspace.revealLeaf(h),this.app.workspace.setActiveLeaf(h);let p=h.view;if(p instanceof ct.MarkdownView){let f=p.editor;f.focus(),u||f.exec("goEnd")}}};if(this.settings.howToOpenAutoFocusTargetIfNotOpened!=="hover-editor"){await a();return}let l=this.app.metadataCache.on("resolve",async h=>{h===s&&(this.app.metadataCache.offref(l),setTimeout(()=>a(),100))})}extractHighlightedText(e){let t=this.lib.getPDFViewerChild();if(!t)return!1;let i=t.file;if(!i)return!1;if(!e){let r=this.lib.getColorPaletteFromChild(t),o=r?this.settings.copyCommands[r.actionIndex].template:this.settings.copyCommands[this.settings.defaultColorPaletteActionIndex].template,s="";(async()=>{var l;let a=(l=this.lib.getPDFDocument(!0))!=null?l:await this.lib.loadPDFDocument(i);(await this.lib.highlight.extract.getAnnotatedTextsInDocument(a)).forEach((d,h)=>{d.forEach(({text:u,rgb:p,comment:f},m)=>{s&&(s=s.trimEnd()+` `);let x=p?`${p.r},${p.g},${p.b}`:"";s+=this.lib.copyLink.getTextToCopy(t,o,void 0,i,h,`#page=${h}&annotation=${m}`,u,x,void 0,f)})}),s?(await navigator.clipboard.writeText(s),new ct.Notice(`${this.plugin.manifest.name}: Highlighted text copied to clipboard.`)):new ct.Notice(`${this.plugin.manifest.name}: No highlighted text found.`)})()}return!0}async copyDebugInfo(){let e=await yg(this.app),t=Object.assign({},this.settings,{author:"*".repeat(this.settings.author.length)}),i=vg(this.app),r=this.plugin.domManager.styleEl.textContent,o=`#### Obsidian debug info `;for(let[s,a]of Object.entries(e)){if(Array.isArray(a)){o+=`- ${s}: ${a.length} `,a.forEach(c=>{o+=` - ${c} `});continue}o+=`- ${s}: ${a} `}o+=` #### PDF++ debug info `,o+="```\n"+JSON.stringify({settings:t,styleSettings:i,styleSheet:r})+"\n```\n",await navigator.clipboard.writeText(o),new ct.Notice(`${this.plugin.manifest.name}: Debug info copied to clipboard.`)}loadDebugInfo(e){return this.plugin.isDebugMode?(e||(async()=>{try{let{settings:t,styleSettings:i,styleSheet:r}=JSON.parse(await navigator.clipboard.readText());new ct.Notice(`${this.plugin.manifest.name}: Debug info loaded from clipboard.`),console.debug("Loaded debug info:"),console.debug("- settings:",t),console.debug("- styleSettings:",i),console.debug("- styleSheet:",r),window.pdfPlusDebugInfo={settings:t,styleSettings:i,styleSheet:r},this.plugin.settings=t;let o=this.app.setting.pluginTabs.find(s=>s.id===this.plugin.manifest.id);o&&await o.hide()}catch(t){console.error(t),new ct.Notice(`${this.plugin.manifest.name}: Debug info not found in clipboard.`)}})(),!0):!1}importExternalFileIntoVault(e){let t=this.lib.getPDFViewerChild(!0);return!t||!t.isFileExternal||!t.palette?!1:(e||t.palette.importFile(),!0)}openExternalSource(e){let t=this.lib.getPDFViewerChild(!0),i=t==null?void 0:t.file;return!t||!t.isFileExternal||!i?!1:(e||(async()=>{let r=(await this.app.vault.read(i)).trim();window.open(r,"_blank")})(),!0)}createDummyForExternalPDF(){new Fa(this.plugin).open()}showContextMenu(e){let t=this.lib.getPDFViewerChild(!0);if(!t)return!1;let r=t.containerEl.doc.getSelection();return!r||!r.focusNode||r.isCollapsed?!1:(e||Ru(this.plugin,t,r),!0)}};var ii=require("obsidian");var df=class extends Be{constructor(...e){super(...e),this.fileOperator=new nm(this.plugin),this.linkUpdater=new rm(this.plugin)}isEnabled(){return this.settings.enablePDFEdit}async addPage(e){return await this.linkUpdater.updateLinks(()=>this.fileOperator.addPage(e),[e],(t,i)=>({}))}async insertPage(e,t,i,r){return await this.linkUpdater.updateLinks(()=>this.fileOperator.insertPage(e,t,i,r),[e],(o,s)=>({pageNumber:typeof s=="number"&&s>=t?s+1:s}))}async removePage(e,t,i){return await this.linkUpdater.updateLinks(()=>this.fileOperator.removePage(e,t,i),[e],(r,o)=>({pageNumber:typeof o=="number"&&o>t?o-1:o}))}async mergeFiles(e,t,i){let r=(await this.fileOperator.read(e)).getPageCount();return await this.linkUpdater.updateLinks(()=>this.fileOperator.mergeFiles(e,t,i),[e,t],(o,s)=>o===e?{}:{file:e,pageNumber:typeof s=="number"?s+r:s})}async extractPages(e,t,i,r,o,s){let a;return Array.isArray(t)?a=t:(t.from===void 0&&(t.from=1),t.to===void 0&&(t.to=(await this.fileOperator.read(e)).getPageCount()),a=fg(t.from,t.to+1)),await this.linkUpdater.updateLinks(()=>this.fileOperator.extractPages(e,a,i,r,o,s),[e],(c,l)=>{if(l===void 0)return{};if(a.includes(l))return{file:i,pageNumber:a.filter(d=>d<=l).length};if(s){let d=a.filter(h=>h0?{pageNumber:l-d}:{}}return{}})}},nm=class extends Be{constructor(...e){super(...e),this.pageLabelUpdater=new om(this.plugin)}async read(e){return await this.lib.loadPdfLibDocument(e)}async write(e,t,i){let r=await t.save(),o=this.app.vault.getAbstractFileByPath(e);if(o instanceof ii.TFile)return i||new ii.Notice(`${this.plugin.manifest.name}: File already exists: ${e}`),await this.app.vault.modifyBinary(o,r),o;if(o===null){let s=(0,ii.normalizePath)(e.split("/").slice(0,-1).join("/"));return s&&(this.app.vault.getAbstractFileByPath(s)||await this.app.vault.createFolder(s)),await this.app.vault.createBinary(e,r)}return null}async addPage(e){let t=await this.read(e),i=t.getPage(t.getPageCount()-1),{width:r,height:o}=i.getSize();return t.addPage([r,o]),await this.write(e.path,t,!0)}async insertPage(e,t,i,r){let o=await this.read(e);this.pageLabelUpdater.insertPage(o,t,r);let s=o.getPage(i-1),{width:a,height:c}=s.getSize();return o.insertPage(t-1,[a,c]),await this.write(e.path,o,!0)}async removePage(e,t,i){let r=await this.read(e);return this.pageLabelUpdater.removePage(r,t,i),r.removePage(t-1),await(await Ge.fromDocument(r,this.plugin)).prune(),await this.write(e.path,r,!0)}async mergeFiles(e,t,i){let[r,o]=await Promise.all([this.read(e),this.read(t)]);this.pageLabelUpdater.mergeFiles(r,o,i);let s=await r.copyPages(o,o.getPageIndices());for(let c of s)r.addPage(c);let a=await this.write(e.path,r,!0);return a===null?null:(await this.app.fileManager.trashFile(t),a)}async extractPages(e,t,i,r,o,s){if(t.length===0)throw new Error("No pages to extract");return s?await this.extractPagesInPlace(e,t,i,r,o):await this.extractPagesAsNewFile(e,t,i,r,o)}async extractPagesInPlace(e,t,i,r,o){let[s,a]=await Promise.all([this.read(e),this.read(e)]),c=[];for(let h=1;h<=s.getPageCount();h++)t.includes(h)||c.push(h);this.pageLabelUpdater.removePages(s,t,o),this.pageLabelUpdater.removePages(a,c,o);for(let h=s.getPageCount();h>=1;h--)t.includes(h)?s.removePage(h-1):a.removePage(h-1);await Promise.all([s,a].map(async h=>{await(await Ge.fromDocument(h,this.plugin)).prune()}));let[l,d]=await Promise.all([this.write(e.path,s,!0),this.write(i,a,r)]);return d}async extractPagesAsNewFile(e,t,i,r,o){let s=await this.read(e),a=[];for(let l=1;l<=s.getPageCount();l++)t.includes(l)||a.push(l);this.pageLabelUpdater.removePages(s,a,o);for(let l of a.sort((d,h)=>h-d))s.removePage(l-1);return await(await Ge.fromDocument(s,this.plugin)).prune(),await this.write(i,s,r)}},rm=class extends Be{async updateLinks(e,t,i){await this.lib.metadataCacheUpdatePromise;let r=new Map;for(let c of t){let l=this.app.metadataCache.getBacklinksForFile(c);for(let d of l.keys()){let h=l.get(d);for(let u of h!=null?h:[]){let p=this.getNewLinkText(u.link,d,c,i);if(typeof p!="string")continue;let f=this.getNewLink(u,p),m=u.position;r.has(d)||r.set(d,[]),r.get(d).push({position:m,newLink:f})}}}let o=await e();if(!o)return null;let s=[],a={files:0,links:0};for(let[c,l]of r){let d=this.app.vault.getAbstractFileByPath(c);d instanceof ii.TFile&&(l.sort((h,u)=>u.position.start.offset-h.position.start.offset),s.push(this.app.vault.process(d,h=>{for(let{position:u,newLink:p}of l)h=h.slice(0,u.start.offset)+p+h.slice(u.end.offset),a.links++;return h})),l.length>0&&a.files++)}return await Promise.all(s),a.links&&new ii.Notice(`${this.plugin.manifest.name}: Updated ${a.links} links in ${a.files} files.`),o}getNewLinkText(e,t,i,r){let{path:o,subpath:s}=(0,ii.parseLinktext)(e),a;s.startsWith("#")&&(s=s.slice(1));let c=new URLSearchParams(s),l=c.get("page");l!==null&&(a=+l);let{file:d,pageNumber:h}=r(i,a);if(d===void 0&&h===void 0)return;let u=o;if(d instanceof ii.TFile){let m=!this.app.vault.getConfig("useMarkdownLinks");u=this.app.metadataCache.fileToLinktext(d,t,m)}else typeof d=="string"&&(u=d);let p=s;if(typeof h=="number"){p="",c.set("page",""+h);for(let[m,x]of c)p+=`${m}=${x}&`;p.endsWith("&")&&(p=p.slice(0,-1))}return u+(p?"#"+p:"")}getNewDisplay(e){return e}getNewLink(e,t){let i=e.original,r=e.displayText,o=e.link,s=i.startsWith("!");s&&(i=i.slice(1));let a="";return i.startsWith("[[")&&i.endsWith("]]")?typeof r=="string"&&i===`[[${o}|${r}]]`?a=`[[${t}|${r}]]`:a=`[[${t}]]`:i.startsWith("[")&&i.endsWith(")")&&(a=`[${r!=null?r:""}](${Vr(t)})`),s&&(a="!"+a),a}async updateLinkColor(e,t,i,r){r=Object.assign({linktext:!0,callout:!0},r);let o=this.app.vault.getAbstractFileByPath(t);if(!(o instanceof ii.TFile))return;let s=e.link,{path:a,subpath:c}=(0,ii.parseLinktext)(s),l=new URLSearchParams(c.startsWith("#")?c.slice(1):c);i&&r.linktext?l.set("color",i.type==="name"?i.name.toLowerCase():`${i.rgb.r},${i.rgb.g},${i.rgb.b}`):l.delete("color");let d="";for(let[p,f]of l.entries())d+=d?`&${p}=${f}`:`#${p}=${f}`;let h=a+d,u=this.getNewLink(e,h);if("position"in e){let p=e.position;await this.app.vault.process(o,f=>{var m,x;if(f=f.slice(0,p.start.offset)+u+f.slice(p.end.offset),r.callout){let b=((x=(m=this.app.metadataCache.getFileCache(o))==null?void 0:m.sections)!=null?x:[]).find(w=>w.position.start.offset<=p.start.offset&&p.end.offset<=w.position.end.offset);if(b&&b.type==="callout"){let w=f.split(/\r?\n/),y=b.position.start.line,F=w[y],D=new RegExp(`> *\\[\\! *${this.settings.calloutType} *(\\|(.*?))?\\]`,"i");w[y]=F.replace(D,`> [!${this.settings.calloutType}${i?`|${i.type==="name"?i.name.toLowerCase():`${i.rgb.r},${i.rgb.g},${i.rgb.b}`}`:""}]`),f=w.join(` `)}}return f})}else{let p=e.key;await this.app.fileManager.processFrontMatter(o,f=>{f[p]=u})}}},om=class extends Be{addPage(e){}insertPage(e,t,i){Ui.processDocument(e,r=>{if(i){r.divideRangeAtPage(t,!0).shiftRangesAfterPage(t,1).divideRangeAtPage(t,!1,o=>{delete o.prefix,delete o.style});return}r.shiftRangesAfterPage(t,1)})}removePage(e,t,i){this.removePages(e,[t],i)}removePages(e,t,i){Ui.processDocument(e,r=>{t.sort((o,s)=>s-o).forEach(o=>{this.removePageFromLabels(r,o,i)})})}removePageFromLabels(e,t,i){if(i){e.divideRangeAtPage(t+1,!0).shiftRangesAfterPage(t+1,-1);return}e.shiftRangesAfterPage(t+1,-1)}mergeFiles(e,t,i){}};var uf=require("obsidian");var sm=class{constructor(e){wf(this,"value");wf(this,"next");this.value=e}},ni,ss,as,cd=class{constructor(){mn(this,ni);mn(this,ss);mn(this,as);this.clear()}enqueue(e){let t=new sm(e);qe(this,ni)?(qe(this,ss).next=t,Lt(this,ss,t)):(Lt(this,ni,t),Lt(this,ss,t)),Ff(this,as)._++}dequeue(){let e=qe(this,ni);if(e)return Lt(this,ni,qe(this,ni).next),Ff(this,as)._--,e.value}peek(){if(qe(this,ni))return qe(this,ni).value}clear(){Lt(this,ni,void 0),Lt(this,ss,void 0),Lt(this,as,0)}get size(){return qe(this,as)}*[Symbol.iterator](){let e=qe(this,ni);for(;e;)yield e.value,e=e.next}*drain(){for(;qe(this,ni);)yield this.dequeue()}};ni=new WeakMap,ss=new WeakMap,as=new WeakMap;function am(n){f1(n);let e=new cd,t=0,i=()=>{t0&&(t++,e.dequeue()())},r=()=>{t--,i()},o=async(c,l,d)=>{let h=(async()=>c(...d))();l(h);try{await h}catch(u){}r()},s=(c,l,d)=>{new Promise(h=>{e.enqueue(h)}).then(o.bind(void 0,c,l,d)),tnew Promise(d=>{s(c,d,l)});return Object.defineProperties(a,{activeCount:{get:()=>t},pendingCount:{get:()=>e.size},clearQueue:{value(){e.clear()}},concurrency:{get:()=>n,set(c){f1(c),n=c,queueMicrotask(()=>{for(;t0;)i()})}},map:{async value(c,l){let d=c.map((h,u)=>this(l,h,u));return Promise.all(d)}}}),a}function f1(n){if(!((Number.isInteger(n)||n===Number.POSITIVE_INFINITY)&&n>0))throw new TypeError("Expected `concurrency` to be a number from 1 and up")}var hf=class hf extends uf.Component{constructor(t,i,r,o,s,a,c,l){super();this.plugin=t;this.ctx=i;this.file=r;this.subpath=o;this.pageNumber=s;this.rect=a;this.width=c;this.annotationId=l;this.app=i.app,this.containerEl=i.containerEl,this.rect=window.pdfjsLib.Util.normalizeRect(a),this.containerEl.addClass("pdf-cropped-embed"),c&&this.containerEl.setAttribute("width",""+c)}get lib(){return this.plugin.lib}onload(){super.onload(),this.shouldUpdateOnModify()&&this.registerEvent(this.app.vault.on("modify",t=>{t===this.file&&this.loadFile()})),this.plugin.settings.rectFollowAdaptToTheme&&(this.registerEvent(this.app.workspace.on("css-change",()=>{this.loadFile()})),this.registerEvent(this.plugin.on("adapt-to-theme-change",()=>{this.loadFile()})))}shouldUpdateOnModify(){return typeof this.annotationId=="string"}async loadFile(){let t=await hf.limit(this.computeDataUrl.bind(this));await new Promise((i,r)=>{this.containerEl.empty(),this.containerEl.createEl("img",{attr:{src:t}},o=>{o.addEventListener("load",()=>i()),o.addEventListener("error",c=>r(c));let s=this.containerEl.getAttribute("width"),a=this.containerEl.getAttribute("height");s&&o.setAttribute("width",s),a&&o.setAttribute("height",a)}),activeWindow.setTimeout(()=>r(),5e3)})}async computeDataUrl(){let t=await this.lib.loadPDFDocument(this.file),i=await t.getPage(this.pageNumber);if(this.annotationId){let s=(await i.getAnnotations()).find(a=>a.id===this.annotationId);s&&Array.isArray(s.rect)&&(this.rect=window.pdfjsLib.Util.normalizeRect(s.rect))}let r=await this.lib.pdfPageToImageDataUrl(i,{type:"image/png",cropRect:this.rect,renderParams:this.lib.getOptionalRenderParameters()});return await t.destroy(),r}};hf.limit=am(uf.Platform.isMobile?3:10);var Jr=hf;var ff=class extends Be{get ttsPlugin(){var e;return(e=this.app.plugins.plugins["obsidian-tts"])!=null?e:null}isEnabled(){return!!this.ttsPlugin}async speak(e){var t;await((t=this.ttsPlugin)==null?void 0:t.say(e))}};var Qn=require("obsidian");var pf=class extends Be{async createDummyFilesInFolder(e,t){if(!!!this.app.vault.getFolderByPath(e))try{await this.app.vault.createFolder(e)}catch(r){return console.error(`${this.plugin.manifest.name}: Failed to create folder "${e}" due to the following error: `,r),[]}return await Promise.all(t.map(async r=>{let o=r.split("/").pop().replace(/%20/g," ");Qn.Platform.isWin&&(o=o.replace(/\?/g," "));let s=(0,Qn.normalizePath)(e+"/"+o);s.endsWith(".pdf")&&(s=s.slice(0,-4));let a=this.app.vault.getAvailablePath(s,"pdf");try{return await this.app.vault.create(a,r)}catch(c){throw console.error(`${this.plugin.manifest.name}: Failed to create a dummy file "${a}" due to the following error: `,c),c}}))}async createDummyFilesFromObsidianUrl(e){let t=e["create-dummy"].replace(/^.*((https?)|(file):\/\/)/,"$1"),i=new Fa(this.plugin);if(i.source=t.startsWith("http")?"web":"file",i.uris=[t],"folder"in e){let r=e.folder;i.folderPath=(0,Qn.normalizePath)(r),await i.createDummyFiles();let o=this.lib.workspace.getActivePDFView();o&&o.setEphemeralState({rename:"all"});return}i.open()}async createDummyFilesOnEditorDrop(e,t,i){if(e.defaultPrevented||!ag(e,this.settings.modifierToDropExternalPDFToCreateDummy)||!e.dataTransfer)return;let r=this.getUrisFromDataTransfer(e.dataTransfer);if(r.length){e.preventDefault();let o=this.getFolderPathForDummyFiles(i.file),s=await this.createDummyFilesInFolder(o,r);new Qn.Notice(`${this.plugin.manifest.name}: Dummy files created successfully.`),s.forEach((a,c)=>{var d,h;let l=this.app.fileManager.generateMarkdownLink(a,(h=(d=i.file)==null?void 0:d.path)!=null?h:"");cr.type==="application/pdf"))return i.map(r=>{let o=window.electron.webUtils.getPathForFile(r);return this.absolutePathToFileUri(o)})}let t=e.getData("text/uri-list").split(`\r `).filter(i=>!i.startsWith("#"));return t.length&&t.every(i=>this.isUriPdf(i))?t:[]}getFolderPathForDummyFiles(e){var i;let t=this.settings.dummyFileFolderPath||this.app.vault.getConfig("attachmentFolderPath");return t==="."||t.startsWith("./")?(0,Qn.normalizePath)(((i=e==null?void 0:e.parent)!=null?i:this.app.vault.getRoot()).path+"/"+t.slice(1)):(0,Qn.normalizePath)(t)}absolutePathToFileUri(e){return e=e.replace(/\\/g,"/").replace(/ /g,"%20"),"file://"+(e.startsWith("/")?"":"/")+e}isUriPdf(e){return this.settings.externalURIPatterns.map(t=>new RegExp(t)).some(t=>t.test(e))}};var gf=class{constructor(e){this.utils=Tg;this.PDFCroppedEmbed=Jr;this.PDFOutlines=Ge;this.NameTree=wa;this.NumberTree=Wr;this.PDFNamedDestinations=Pa;this.PDFPageLabels=Ui;this.app=e.app,this.plugin=e,this.commands=new cf(e),this.copyLink=new Qu(e),this.highlight=new sf(e),this.workspace=new af(e),this.composer=new df(e),this.dummyFileManager=new pf(e),this.speech=new ff(e)}registerPDFEvent(e,t,i,r){let o=async s=>{await r(s),i||t.off(e,o)};i==null||i.register(()=>t.off(e,o)),t.on(e,o)}onPageReady(e,t,i){var r;(r=e.pdfViewer)==null||r._pages.forEach((o,s)=>{i(s+1,o,!1)}),this.registerPDFEvent("pagerendered",e.eventBus,t,o=>{i(o.pageNumber,o.source,!0)})}onTextLayerReady(e,t,i){var r;(r=e.pdfViewer)==null||r._pages.forEach((o,s)=>{o.textLayer&&i(s+1,o,!1)}),this.registerPDFEvent("textlayerrendered",e.eventBus,t,o=>{i(o.pageNumber,o.source,!0)})}onAnnotationLayerReady(e,t,i){var r;(r=e.pdfViewer)==null||r._pages.forEach((o,s)=>{o.annotationLayer&&i(s+1,o,!1)}),this.registerPDFEvent("annotationlayerrendered",e.eventBus,t,o=>{i(o.pageNumber,o.source,!0)})}applyPDFViewStateToViewer(e,t){let i=()=>{typeof t.left=="number"&&typeof t.top=="number"&&typeof t.zoom=="number"?e.scrollPageIntoView({pageNumber:t.page,destArray:[t.page,{name:"XYZ"},t.left,t.top,t.zoom]}):e.currentPageNumber=t.page};e.pagesCount?i():this.registerPDFEvent("pagesloaded",e.eventBus,null,()=>i())}getPageElAssociatedWithNode(e){let t=e.instanceOf(HTMLElement)?e:e.parentElement;if(!t)return null;let i=t.closest(".page");return!i||!i.instanceOf(HTMLElement)?null:i}getPageElFromSelection(e){let t=e.rangeCount>0?e.getRangeAt(0):null;return t?this.getPageElAssociatedWithNode(t.startContainer):null}getPageElFromEvent(e){return qc(e,e.target)?this.getPageElAssociatedWithNode(e.target):null}getPageNumberFromEvent(e){let t=this.getPageElFromEvent(e),i=t==null?void 0:t.dataset.pageNumber;return i===void 0?null:+i}getToolbarAssociatedWithNode(e){let t=e.instanceOf(HTMLElement)?e:e.parentElement;if(!t)return null;let i=t.closest(".pdf-container"),r=i==null?void 0:i.previousElementSibling;return r&&r.hasClass("pdf-toolbar")?r:null}getToolbarAssociatedWithSelection(){let e=activeWindow.getSelection();if(e&&e.rangeCount>0){let t=e.getRangeAt(0);return this.getToolbarAssociatedWithNode(t.startContainer)}return null}getColorPalette(){var t;let e=(t=this.getPDFViewerChild(!0))!=null?t:this.plugin.lastAnnotationPopupChild;return e?this.getColorPaletteFromChild(e):this.getColorPaletteAssociatedWithSelection()}getColorPaletteOptions(){let e=this.getColorPalette();if(e)return e.getState();let t=this.plugin.settings;return{selectedColorName:[null,...Object.keys(t.colors)][t.defaultColorPaletteItemIndex],actionIndex:t.defaultColorPaletteActionIndex,displayTextFormatIndex:t.defaultDisplayTextFormatIndex,writeFile:t.defaultWriteFileToggle}}getColorPaletteAssociatedWithNode(e){var r;let t=this.getToolbarAssociatedWithNode(e);if(!t)return null;let i=t.querySelector("."+ti.CLS);return i&&(r=ti.elInstanceMap.get(i))!=null?r:null}getColorPaletteAssociatedWithSelection(){let e=activeWindow.getSelection();if(e&&e.rangeCount>0){let t=e.getRangeAt(0);return this.getColorPaletteAssociatedWithNode(t.startContainer)}return null}getColorPaletteFromChild(e){var i;let t=(i=e.pdfViewer.dom)==null?void 0:i.viewerEl;return t?this.getColorPaletteAssociatedWithNode(t):null}getColorPaletteContainedIn(e){for(let[t,i]of ti.elInstanceMap)if(e.contains(t))return i;return null}getPDFViewerChildAssociatedWithNode(e){let t,i=e.instanceOf(HTMLElement)?e:e.parentElement;if(i){let r=i.closest(".pdf-container");r&&(t=this.plugin.pdfViewerChildren.get(r))}return t||this.workspace.iteratePDFViewerChild(r=>{!t&&r.containerEl.contains(e)&&(t=r)}),t!=null?t:null}getPDFViewerChildFromSelection(e){let t=e.rangeCount>0?e.getRangeAt(0):null;return t?this.getPDFViewerChildAssociatedWithNode(t.startContainer):null}async destIdToSubpath(e,t){let i=await t.getDestination(e);return i?this.pdfJsDestArrayToSubpath(i,t):null}async pdfJsDestArrayToSubpath(e,t){let i=await t.getPageIndex(e[0]);return this.destArrayToSubpath(this.normalizePDFJsDestArray(e,i+1))}normalizePDFJsDestArray(e,t){return[t-1,e[1].name,...e.slice(2)]}normalizePdfLibDestArray(e,t){let i=e.get(0);if(!(i instanceof Y))return null;let r=t.getPages().findIndex(s=>s.ref===i);if(r===-1)return null;let o=e.get(1);return o instanceof v?[r,o.decodeText(),...e.asArray().slice(2).map(s=>s instanceof G?s.asNumber():null)]:null}async ensureDestArray(e,t){if(typeof e=="string"){let i=await t.getDestination(e);if(!i)return null;e=this.normalizePDFJsDestArray(i,await t.getPageIndex(i[0])+1)}return e}async destToPageNumber(e,t){if(typeof e=="string"){let i=await t.getDestination(e);return i?await t.getPageIndex(i[0])+1:null}return e[0]+1}destArrayToSubpath(e){var a;let t=e[0],i="",r="",o="";return e[1]==="XYZ"?(typeof e[2]=="number"&&(r+=Math.round(e[2])),typeof e[3]=="number"&&(i+=Math.round(e[3])),o=""+Math.round(((a=e[4])!=null?a:0)*100)/100):e[1]==="FitBH"&&typeof e[2]=="number"&&(i+=e[2]),`#page=${t+1}&offset=${r},${i},${o}`}viewStateToSubpath(e,t=!1){var i;if(typeof e.left=="number"&&typeof e.top=="number"){let r=`#page=${e.page}`;return t?r+=`&offset=,${e.top},`:r+=`&offset=${e.left},${e.top},${(i=e.zoom)!=null?i:0}`,r}return null}viewStateToDestArray(e,t=!1){var i;return typeof e.left=="number"&&typeof e.top=="number"?t?[e.page-1,"FitBH",e.top]:[e.page-1,"XYZ",e.left,e.top,(i=e.zoom)!=null?i:0]:null}getPageLabelTree(e){let t=lt(e.catalog,"PageLabels");return t instanceof W?new Wr(t):null}getAnnotationInfoFromAnnotationElement(e){return{page:e.parent.page.pageNumber,id:e.data.id}}getAnnotationInfoFromPopupEl(e){if(!e.matches(".popupWrapper[data-annotation-id]"))return null;let t=e.closest("div.page");if(!t||t.dataset.pageNumber===void 0)return null;let i=+t.dataset.pageNumber,r=e.dataset.annotationId;return r===void 0?null:{page:i,id:r}}registerGlobalDomEvent(e,t,i,r){e.registerDomEvent(document,t,i,r),this.app.workspace.onLayoutReady(()=>{let o=new Set;this.app.workspace.iterateAllLeaves(s=>{let a=s.getContainer().win;a!==window&&o.add(a)}),o.forEach(s=>{e.registerDomEvent(s.document,t,i,r)}),e.registerEvent(this.app.workspace.on("window-open",(s,a)=>{e.registerDomEvent(a.document,t,i,r)}))})}generateMarkdownLink(e,t,i,r){let o=this.app,s=o.vault.getConfig("useMarkdownLinks"),a=!s,l=o.metadataCache.fileToLinktext(e,t,a)+(i||"");e.path===t&&i&&(l=i);let d;return s?d="[".concat(r||e.basename,"](").concat(Vr(l),")"):(r&&r.toLowerCase()===l.toLowerCase()&&(l=r,r=void 0),d=r?"[[".concat(l,"|").concat(r,"]]"):"[[".concat(l,"]]")),e.extension!=="md"?"!"+d:d}getBacklinkIndexForFile(e){return new ka(this.plugin,e)}async getLatestBacklinkIndexForFile(e){let t=this.getBacklinkIndexForFile(e);return await this.metadataCacheUpdatePromise,t.init(),t}async getLatestBacklinksForAnnotation(e,t,i){return(await this.getLatestBacklinkIndexForFile(e)).getPageIndex(t).annotations.get(i)}isBacklinked(e,t){if(t){let{page:c,selection:l,annotation:d}=t;if(isNaN(c)||c<1)throw new Error("Invalid page number");if(l&&(l.length!==4||l.some(h=>isNaN(h))))throw new Error("Invalid selection");if(l&&typeof d=="string")throw new Error("Selection and annotation cannot be used together")}let i=!t,r=t&&!t.selection&&!t.annotation,o=t&&!!t.selection,s=typeof(t==null?void 0:t.annotation)=="string",a=this.app.metadataCache.getBacklinksForFile(e);if(i)return a.count()>0;for(let c of a.keys()){let l=a.get(c);if(l)for(let d of l){let{subpath:h}=(0,ve.parseLinktext)(d.link),u=$o(h);if(u&&(r&&u.page===t.page||o&&"beginIndex"in u&&u.page===t.page&&u.beginIndex===t.selection[0]&&u.beginOffset===t.selection[1]&&u.endIndex===t.selection[2]&&u.endOffset===t.selection[3]||s&&"annotation"in u&&u.page===t.page&&u.annotation===t.annotation))return!0}}return!1}getPDFView(e=!1){let t=this.workspace.getActivePDFView();if(t)return t;if(!e){let i;if(this.app.workspace.iterateAllLeaves(r=>{this.isPDFView(r.view)&&(i=r.view)}),i)return i}return null}getPDFEmbedsInComponent(e,t){let i=[];return yu(e,r=>{if(t&&i.length)return!1;if(this.isPDFEmbed(r))return i.push(r),!1}),i}getPDFEmbedInMarkdownView(e){var t;return(t=this.getPDFEmbedsInComponent(e.currentMode,!0).first())!=null?t:null}getAllPDFEmbedsInMarkdownView(e){return this.getPDFEmbedsInComponent(e.currentMode,!1)}getPDFEmbedInCanvasView(e){let t=Array.from(e.canvas.nodes.values());for(let i of t)if("child"in i&&i.child instanceof ve.Component){let r=this.getPDFEmbedsInComponent(i.child,!0);if(r.length)return r[0]}return null}getAllPDFEmbedsInCanvasView(e){return Array.from(e.canvas.nodes.values()).flatMap(t=>"child"in t&&t.child instanceof ve.Component?this.getPDFEmbedsInComponent(t.child,!1):[])}getPDFEmbedInExcalidrawView(e){for(let t of e.embeddableLeafRefs.values()){let i=t.node;if(i&&"child"in i&&i.child instanceof ve.Component){let r=this.getPDFEmbedsInComponent(i.child,!0);if(r.length)return r[0]}}return null}getAllPDFEmbedsInExcalidrawView(e){return Array.from(e.embeddableLeafRefs.values()).flatMap(t=>{let i=t.node;return i?"child"in i&&i.child instanceof ve.Component?this.getPDFEmbedsInComponent(i.child,!1):[]:[]})}getPDFEmbedInActiveView(){let e=this.app.workspace.getActiveViewOfType(ve.MarkdownView);if(e){let r=this.getPDFEmbedInMarkdownView(e);if(r)return r}let t=this.workspace.getActiveCanvasView();if(t){let r=this.getPDFEmbedInCanvasView(t);if(r)return r}let i=this.workspace.getActiveExcalidrawView();if(i){let r=this.getPDFEmbedInExcalidrawView(i);if(r)return r}return null}getPDFEmbed(e=!1){let t=this.getPDFEmbedInActiveView();if(t)return t;if(!e){let i=null;if(this.app.workspace.iterateAllLeaves(r=>{if(i)return;let o=r.view;o instanceof ve.MarkdownView?i=this.getPDFEmbedInMarkdownView(o):this.isCanvasView(o)?i=this.getPDFEmbedInCanvasView(o):this.isExcalidrawView(o)&&(i=this.getPDFEmbedInExcalidrawView(o))}),i)return i}return null}getPDFViewerComponent(e=!1){var t,i;return(i=(t=this.getPDFView(e))!=null?t:this.getPDFEmbed())==null?void 0:i.viewer}getPDFViewerChild(e=!1){var t;return(t=this.getPDFViewerComponent(e))==null?void 0:t.child}getObsidianViewer(e=!1){var t;return(t=this.getPDFViewerChild(e))==null?void 0:t.pdfViewer}getPDFViewer(e=!1){var t;return(t=this.getObsidianViewer(e))==null?void 0:t.pdfViewer}getToolbar(e=!1){var t;return(t=this.getPDFViewerChild(e))==null?void 0:t.toolbar}getPage(e=!1){let t=this.getPDFViewer(e);return t?t.getPageView(t.currentPageNumber-1):null}getAnnotation(e){var t,i;return(i=(t=this.getPage(!0))==null?void 0:t.annotationLayer)==null?void 0:i.annotationLayer.getAnnotation(e)}getTextContentItems(){var t,i;let e=(t=this.getPage(!0))==null?void 0:t.textLayer;if(e)return(i=Dt(e))==null?void 0:i.textContentItems}getPDFDocument(e=!1){var t;return(t=this.getPDFViewer(e))==null?void 0:t.pdfDocument}getBacklinkVisualizer(e=!1){var t;return(t=this.getPDFViewerComponent(e))==null?void 0:t.visualizer}getBibliographyManager(e=!1){var t;return(t=this.getPDFViewerChild(e))==null?void 0:t.bib}getVim(e=!1){var t;return(t=this.getPDFViewerComponent(e))==null?void 0:t.vim}search(e,t,i,r){e.showSearch(),e.searchComponent.setValue(t),Object.assign(e.searchSettings,i),e.dispatchEvent("",r),this.updateSearchSettingsUI(e)}updateSearchSettingsUI(e){let t=e.settingsEl.querySelectorAll("div.checkbox-container"),i=t[0],r=t[1],o=t[2],s=e.searchComponent.containerEl.querySelector(".input-right-decorator.clickable-icon");i&&i.toggleClass("is-enabled",e.searchSettings.highlightAll),r&&r.toggleClass("is-enabled",e.searchSettings.matchDiacritics),o&&o.toggleClass("is-enabled",e.searchSettings.entireWord),s&&s.toggleClass("is-active",e.searchSettings.caseSensitive)}async getExternalPDFUrl(e){if(e.stat.size>300)return null;let t=(await this.app.vault.read(e)).trim();if(t.startsWith("https://")||t.startsWith("http://")){let i=await(0,ve.requestUrl)(t);if(i.status===200)return URL.createObjectURL(new Blob([i.arrayBuffer],{type:"application/pdf"}))}else if(t.startsWith("file:///"))return ve.Platform.resourcePathPrefix+t.substring(8);return null}async loadPDFDocument(e){let t=await this.getExternalPDFUrl(e);if(t)return await this.loadPDFDocumentFromArrayBufferOrUrl({url:t});let i=await this.app.vault.readBinary(e);return await this.loadPDFDocumentFromArrayBufferOrUrl({data:i})}async loadPDFDocumentFromArrayBuffer(e){return await this.loadPDFDocumentFromArrayBufferOrUrl({data:e})}async loadPDFDocumentFromArrayBufferOrUrl(e){return await window.pdfjsLib.getDocument({...e,cMapPacked:!0,cMapUrl:"/lib/pdfjs/cmaps/",standardFontDataUrl:"/lib/pdfjs/standard_fonts/"}).promise}async loadPdfLibDocument(e,t=!1){let i=await this.app.vault.readBinary(e);return await this.loadPdfLibDocumentFromArrayBuffer(i)}async loadPdfLibDocumentFromArrayBuffer(e,t=!1){try{return await We.load(e,{ignoreEncryption:t})}catch(i){throw i instanceof Xo&&new ve.Notice(`${this.plugin.manifest.name}: The PDF file is encrypted. This plugin currently does not support editing encrypted PDF files.`,8),i}}async getPdfLibDocument(e=!1){let t=this.getPDFDocument(e);if(t)return await this.loadPdfLibDocumentFromArrayBuffer(await t.getData())}async getPdfLibPage(e=!1){let t=this.getPDFViewer(e);if(!t)return;let i=t.currentPageNumber;if(i===void 0)return;let r=await this.loadPdfLibDocumentFromArrayBuffer(await t.pdfDocument.getData());if(r)return r.getPage(i-1)}async getPDFOutlines(){let e=await this.getPdfLibDocument();if(e)return new Ge(this.plugin,e)}getPDFViewFromChild(e){let t=null;return this.workspace.iteratePDFViews(i=>{i.viewer.child===e&&(t=i)}),t}isPDFView(e){return this.plugin.classes.PDFView?e instanceof this.plugin.classes.PDFView:e instanceof ve.EditableFileView&&e.getViewType()==="pdf"}isPDFEmbed(e){var t;return"loadFile"in e&&"file"in e&&"containerEl"in e&&e.file instanceof ve.TFile&&e.file.extension==="pdf"&&e.containerEl.instanceOf(HTMLElement)&&((t=e.containerEl)==null?void 0:t.matches(".pdf-embed"))&&e instanceof ve.Component&&!(e instanceof Jr)}isCanvasView(e){return e instanceof ve.TextFileView&&e.getViewType()==="canvas"&&"canvas"in e}isCanvasPDFNode(e){let t=e.getData();return t.type==="file"?t.file.endsWith(".pdf"):!1}isBacklinkView(e){return e instanceof ve.FileView&&e.getViewType()==="backlink"}isExcalidrawView(e){return e instanceof ve.TextFileView&&e.getViewType()==="excalidraw"}getAvailablePathForCopy(e){return this.app.vault.getAvailablePath(Fg(e.path),e.extension)}get metadataCacheUpdatePromise(){return new Promise(e=>this.app.metadataCache.onCleanCache(e))}async renderPDFPageToCanvas(e,t,i={}){var l;let r=createEl("canvas"),o=r.getContext("2d"),s=e.getViewport({scale:1}),a=(l=t!=null?t:window.devicePixelRatio)!=null?l:1;r.width=Math.floor(s.width*a),r.height=Math.floor(s.height*a),r.setCssStyles({width:Math.floor(s.width)+"px",height:Math.floor(s.height)+"px"});let c=[a,0,0,a,0,0];return await e.render({canvas:r,canvasContext:o,transform:c,viewport:s,...i}).promise,r}async pdfPageToImageDataUrl(e,t){let[i,r,o,s]=e.view,a=o-i,c=s-r,l=t==null?void 0:t.type,d=t==null?void 0:t.encoderOptions,h=t==null?void 0:t.resolution;typeof h!="number"&&(h=(ve.Platform.isDesktop?7:ve.Platform.isTablet?4:window.devicePixelRatio||1)*(this.plugin.settings.rectEmbedResolution/100));let u=t==null?void 0:t.cropRect,p=t==null?void 0:t.renderParams,f=await this.renderPDFPageToCanvas(e,h,p);if(!u)return f.toDataURL(l,d);let m=uu(f,360-e.rotate),x=m.width/a,g=m.height/c,b={left:(u[0]-i)*x,top:(r+c-u[3])*g,width:(u[2]-u[0])*x,height:(u[3]-u[1])*g};return uu(ig(m,b),e.rotate).toDataURL(l,d)}async pdfPageToImageArrayBuffer(e,t){var o;let r=(o=(await this.pdfPageToImageDataUrl(e,t)).match(/^data:image\/\w+;base64,(.*)/))==null?void 0:o[1];if(!r)throw new Error("Failed to convert data URL to base64");return(0,ve.base64ToArrayBuffer)(r)}getOptionalRenderParameters(){return this.plugin.settings.rectFollowAdaptToTheme&&this.app.loadLocalStorage("pdfjs-is-themed")?{background:document.body.getCssPropertyValue("--pdf-page-background"),invert:document.body.hasClass("theme-dark")}:{}}getSelectedText(e,t,i,r,o){if(t===r)return this.toSingleLine(e[t].str.slice(i,o));let s=[];s.push(e[t].str.slice(i));for(let a=t+1;at(i));return}e.pdfPlusCallbacksOnDocumentLoaded||(e.pdfPlusCallbacksOnDocumentLoaded=[]),e.pdfPlusCallbacksOnDocumentLoaded.push(t)}toSingleLine(e){return Yc(e,this.plugin.settings.removeWhitespaceBetweenCJChars)}async write(e,t,i){let r=this.app.vault.getAbstractFileByPath(e);if(r instanceof ve.TFile)return i||new ve.Notice(`${this.plugin.manifest.name}: File already exists: ${e}`),typeof t=="string"?await this.app.vault.modify(r,t):await this.app.vault.modifyBinary(r,t),r;if(r===null){let o=(0,ve.normalizePath)(e.split("/").slice(0,-1).join("/"));return o&&(this.app.vault.getAbstractFileByPath(o)||await this.app.vault.createFolder(o)),typeof t=="string"?await this.app.vault.create(e,t):await this.app.vault.createBinary(e,t)}return null}isCitationId(e){return typeof e=="string"&&this.plugin.citationIdRegex.test(e)}async checkForUpdates(e){var u,p;let{result:t,error:i}=await OC((0,ve.requestUrl)({url:"https://api.github.com/repos/ryotaushio/obsidian-pdf-plus/releases?per_page=10&page=1",headers:{accept:"application/vnd.github+json","X-GitHub-Api-Version":"2022-11-28"}}));if(i||t.status!==200)return i&&console.error(i),{success:!1,shouldUpdate:!1,detail:"Failed to connect to GitHub to check for updates."};let{result:r,error:o}=BC(()=>t.json);if(o)return console.error(o),{success:!1,shouldUpdate:!1,detail:"Failed to parse JSON releases from GitHub."};if(!Array.isArray(r)||r.length===0)return{success:!1,shouldUpdate:!1,detail:"No releases found on GitHub."};r.sort((f,m)=>new Date(m.published_at).getTime()-new Date(f.published_at).getTime());let s=(u=e==null?void 0:e.currentVersion)!=null?u:this.plugin.manifest.version,a=r.filter(f=>!f.prerelease&&!f.draft&&pa(f.tag_name,s));if(a.length===0)return{success:!0,shouldUpdate:!1,detail:"Already up-to-date."};if(a.some(f=>{let m=f.body.split(` `)[0];return/^\s*\s*$/.test(m)}))return{success:!0,shouldUpdate:!0,detail:"There is a newer version that should be updated to immediately."};let l=a.last(),d=(new Date().getTime()-new Date(l.published_at).getTime())/(1e3*60*60),h=(p=e==null?void 0:e.minHoursSinceRelease)!=null?p:24;return d{t||this.toggle()}):null,this.iconEl&&this.registerDomEvent(this.iconEl,"contextmenu",i=>{if(t)return;let r=new p1.Menu;r.addItem(o=>{o.setIcon("lucide-settings").setTitle("Customize...").onClick(()=>{this.plugin.openSettingTab().scrollToHeading("auto-copy")})}),r.onHide(()=>{t=!1}),r.showAtMouseEvent(i),t=!0})}}toggle(e){e=e!=null?e:!this.settings.autoCopy,e?this.enable():this.disable()}enable(){this.settings.autoCopy=!0,this.plugin.saveSettings(),this.load()}disable(){this.settings.autoCopy=!1,this.plugin.saveSettings(),this.unload()}onload(){var e;(e=this.iconEl)==null||e.addClass("is-active")}onunload(){var e;(e=this.iconEl)==null||e.removeClass("is-active")}};var g1=require("obsidian");var xf=class extends ke{constructor(e){super(e),this.styleEl=e.registerEl(createEl("style",{attr:{id:"pdf-plus-style"}})),document.head.append(this.styleEl)}update(){this.unload(),this.plugin.removeChild(this),this.plugin.addChild(this)}registerEl(e){return this.register(()=>e.remove()),e}onload(){this.plugin.trigger("update-dom"),this.updateStyleEl(),this.updateClass("pdf-plus-click-embed-to-open-link",this.settings.dblclickEmbedToOpenLink),this.updateClass("pdf-plus-backlink-selection-highlight",this.settings.selectionBacklinkVisualizeStyle==="highlight"),this.updateClass("pdf-plus-backlink-selection-underline",this.settings.selectionBacklinkVisualizeStyle==="underline"),this.app.workspace.trigger("css-change")}updateClass(e,t){document.body.toggleClass(e,t),this.register(()=>document.body.removeClass(e))}updateStyleEl(){let e=this.plugin.settings;this.styleEl.textContent=Object.entries(e.colors).map(([r,o])=>cn(o)?[`.pdf-plus-backlink-highlight-layer .pdf-plus-backlink:not(.hovered-highlight)[data-highlight-color="${r.toLowerCase()}"],`,`.pdf-embed[data-highlight-color="${r.toLowerCase()}"] .textLayer .mod-focused {`,` --pdf-plus-color: ${o};`,` --pdf-plus-backlink-icon-color: ${o};`,` --pdf-plus-rect-color: ${o};`,"}"].join(` `):"").join(` `);let t=e.colors[e.defaultColor];(!t||!cn(t))&&(t="rgb(var(--text-highlight-bg-rgb))"),this.styleEl.textContent+=[` .pdf-plus-backlink-highlight-layer .pdf-plus-backlink:not(.hovered-highlight) {`,` --pdf-plus-color: ${t};`,` --pdf-plus-backlink-icon-color: ${t};`,` --pdf-plus-rect-color: ${t};`,"}"].join(` `);let i=e.colors[e.backlinkHoverColor];(!i||!cn(i))&&(i=Mw),this.styleEl.textContent+=[` .pdf-plus-backlink-highlight-layer .pdf-plus-backlink.hovered-highlight {`,` --pdf-plus-color: ${i};`,` --pdf-plus-backlink-icon-color: ${i};`,` --pdf-plus-rect-color: ${i};`,"}"].join(` `);for(let[r,o]of Object.entries(e.colors))cn(o)&&(this.styleEl.textContent+=[` .${ti.CLS}-item[data-highlight-color="${r.toLowerCase()}"] > .${ti.CLS}-item-inner {`,` background-color: ${o};`,"}"].join(` `));this.styleEl.textContent+=[` .${ti.CLS}-item:not([data-highlight-color]) > .${ti.CLS}-item-inner {`," background-color: transparent;","}"].join(` `),this.styleEl.textContent+=[` .workspace-leaf.pdf-plus-link-opened.is-highlighted::before {`,` opacity: ${e.existingTabHighlightOpacity};`,"}"].join(` `),this.setCSSColorVariables(),this.updateCalloutStyle()}updateCalloutStyle(){var i;if(!this.plugin.settings.useCallout)return;let e=this.plugin.settings.calloutType.toLowerCase();for(let r of Object.keys(this.plugin.settings.colors)){let o=(i=this.toCSSVariableName(r))!=null?i:"--pdf-plus-default-color-rgb";this.styleEl.textContent+=[` .callout[data-callout="${e}"][data-callout-metadata="${r.toLowerCase()}"] {`,` --callout-color: var(${o});`," background-color: rgba(var(--callout-color), var(--pdf-plus-highlight-opacity, 0.2))","}"].join(` `)}this.styleEl.textContent+=[` .callout[data-callout="${e}"] {`," --callout-color: var(--pdf-plus-default-color-rgb);"," background-color: rgba(var(--callout-color), var(--pdf-plus-highlight-opacity, 0.2))","}"].join(` `);let t=this.plugin.settings.calloutIcon;t?this.styleEl.textContent+=[` .callout[data-callout="${e}"] {`,` --callout-icon: lucide-${t};`,"}"].join(` `):this.styleEl.textContent+=[` .callout[data-callout="${e}"] .callout-icon {`," display: none;","}"].join(` `)}registerCalloutRenderer(){let e=this.plugin.settings.calloutType.toLowerCase();this.plugin.registerMarkdownPostProcessor((t,i)=>{for(let r of t.querySelectorAll(`.callout[data-callout="${e}"][data-callout-metadata*=","]`))i.addChild(new lm(r))})}setCSSColorVariables(){let e=this.plugin.settings;for(let[i,r]of Object.entries(e.colors)){let o=this.toCSSVariableName(i),s=Mr(r);if(o!==null&&s!==null){let{r:a,g:c,b:l}=s;this.styleEl.textContent+=[` body {`,` ${o}: ${a}, ${c}, ${l}`,"}"].join(` `)}}let t=!1;if(e.defaultColor in e.colors){let i=this.toCSSVariableName(e.defaultColor);i!==null&&(this.styleEl.textContent+=[` body {`,` --pdf-plus-default-color-rgb: var(${i})`,"}"].join(` `),t=!0)}t||(this.styleEl.textContent+=[` body {`," --pdf-plus-default-color-rgb: var(--text-highlight-bg-rgb)","}"].join(` `))}toCSSVariableName(e){let t=e.toLowerCase().replace(/[^a-z0-9]+/g,"-");return t=t.replace(/^-+|-+$/g,""),t?"--pdf-plus-"+t+"-rgb":null}getRgb(e){let t="--pdf-plus-default-color-rgb";if(e){let o=this.toCSSVariableName(e);o&&(t=o)}let i=getComputedStyle(document.body).getPropertyValue(t);return eg(i)}},lm=class extends g1.MarkdownRenderChild{onload(){let e=this.containerEl.dataset.calloutMetadata;if(e){let t=e.split(",").map(r=>parseInt(r));t.length===3&&t.every(r=>0<=r&&r<=255)&&this.containerEl.style.setProperty("--callout-color",t.join(", "))}}};var bf=class extends we.Plugin{constructor(){super(...arguments);this.lib=new gf(this);this.events=new we.Events;this.autoFocusToggleIconEl=null;this.autoPasteToggleIconEl=null;this.patchStatus={workspace:!1,pagePreview:!1,pdfView:!1,pdfInternals:!1,pdfOutlineViewer:!1,backlink:!1};this.classes={};this.lastPasteFile=null;this.lastActiveMarkdownFile=null;this.lastAnnotationPopupChild=null;this.lastCopiedDestInfo=null;this.vimrc=null;this.pdfViewerChildren=new Map;this.shownMenus=new Set;this.requiresDataviewInlineFieldsMigration=!1;this.isDebugMode=!1}async onload(){this.checkVersion(),this.addIcons(),await(0,we.loadPdfJs)(),await this.loadSettings(),await this.saveSettings(),this.domManager=this.addChild(new xf(this)),this.domManager.registerCalloutRenderer(),this.registerRibbonIcons(),this.patchObsidian(),this.registerPDFEmbedCreator(),this.registerHoverLinkSources(),this.registerCommands(),this.registerGlobalVariables(),this.registerEvents(),this.startTrackingActiveMarkdownFile(),this.registerObsidianProtocolHandler("pdf-plus",this.obsidianProtocolHandler.bind(this)),this.addSettingTab(this.settingTab=new Lu(this)),this.registerStyleSettings(),this.checkDeprecatedSettings(),this.checkDataviewInlineFields(),this.registerAutoCheckForUpdates()}async onunload(){await this.cleanUpResources()}async cleanUpResources(){await this.cleanUpAnystyleFiles()}async cleanUpAnystyleFiles(){let t=this.app.vault.adapter;if(we.Platform.isDesktopApp&&t instanceof we.FileSystemAdapter){let i=this.getAnyStyleInputDir();if(i)try{await t.rmdir(i,!0)}catch(r){if(r.code!=="ENOENT")throw r}}}checkVersion(){this.textDivFirstIdx=we.apiVersion==="1.8.0"?1:0,this.obsidianHasFocusBug=!(0,we.requireApiVersion)("1.9.0"),this.obsidianHasTextSelectionBug=(0,we.requireApiVersion)("1.9.0"),Da.openIfNecessary(this)}addIcons(){(0,we.addIcon)("vim",'VIM')}getDefaultSettings(){return structuredClone(Jn)}async restoreDefaultSettings(){this.settings=this.getDefaultSettings(),await this.saveSettings()}async loadSettings(){if(this.settings=Object.assign(this.getDefaultSettings(),await this.loadData()),this.setCitationIdRegex(),!this.settings.anystylePath){let t=this.loadLocalStorage("anystylePath");typeof t=="string"&&(this.settings.anystylePath=t)}(this.settings.defaultDisplayTextFormatIndex<0||this.settings.defaultDisplayTextFormatIndex>=this.settings.displayTextFormats.length)&&(this.settings.defaultDisplayTextFormatIndex=0),(this.settings.defaultColorPaletteActionIndex<0||this.settings.defaultColorPaletteActionIndex>=this.settings.copyCommands.length)&&(this.settings.defaultColorPaletteActionIndex=0),this.validateAutoFocusAndAutoPasteSettings();for(let[t,i]of Object.entries(this.settings.colors))this.settings.colors[t]=i.toLowerCase();this.settings.paneTypeForFirstMDLeaf==="split"&&(this.settings.paneTypeForFirstMDLeaf="right");for(let t of this.settings.copyCommands)t.hasOwnProperty("format")&&(t.template=t.format,delete t.format);if(this.settings.hasOwnProperty("aliasFormat")&&(this.settings.displayTextFormats.push({name:"Custom",template:this.settings.aliasFormat}),delete this.settings.aliasFormat),this.settings.hasOwnProperty("showCopyLinkToSearchInContextMenu")){let t=this.settings.contextMenuConfig.find(({id:i})=>i==="search");t&&t.visible&&(t.visible=this.settings.showCopyLinkToSearchInContextMenu),delete this.settings.showCopyLinkToSearchInContextMenu}this.settings.showContextMenuOnMouseUpIf==="mod"&&(this.settings.showContextMenuOnMouseUpIf="Mod"),this.settings.enableEditEncryptedPDF=!1,this.renameSetting("enalbeWriteHighlightToFile","enablePDFEdit"),this.renameSetting("selectToCopyToggleRibbonIcon","autoCopyToggleRibbonIcon"),this.renameCommand("pdf-plus:toggle-select-to-copy",`${this.manifest.id}:toggle-auto-copy`),this.renameSetting("removeWhitespaceBetweenCJKChars","removeWhitespaceBetweenCJChars"),this.loadContextMenuConfig()}renameSetting(t,i){this.settings.hasOwnProperty(t)&&(this.settings[i]=this.settings[t],delete this.settings[t])}renameCommand(t,i){let{hotkeyManager:r}=this.app,o=r.getHotkeys(t);o&&(r.removeHotkeys(t),r.setHotkeys(i,o))}loadContextMenuConfig(){let t=this.getDefaultSettings().contextMenuConfig,i=[];for(let r of t){let o=this.settings.contextMenuConfig.find(({id:s})=>s===r.id);i.push(o!=null?o:r)}this.settings.contextMenuConfig.length=0,this.settings.contextMenuConfig.push(...i)}validateAutoFocusAndAutoPasteSettings(){this.settings.autoFocus&&this.settings.autoPaste&&(this.settings.autoFocus=!1)}checkDeprecatedSettings(){if(document.querySelectorAll(".pdf-plus-deprecated-setting-notice").length>0)return;let t=(a,c)=>{let l=new we.Notice("",0).setMessage(createFragment(d=>{let h=createEl("a",{href:"obsidian://pdf-plus?setting="+a});d.append("PDF++: "),c(d,h)}));l.containerEl.addClass("pdf-plus-deprecated-setting-notice"),l.messageEl.setCssStyles({color:"var(--text-warning)"})};this.settings.trimSelectionEmbed&&t("trimSelectionEmbed",(a,c)=>{a.append("The option "),c.textContent="Trim selection/annotation embeds",a.append(c),a.append(" is deprecated and will be removed in the near future. It is recommended to disable it and use the rectangular selection tool instead.")});let i=(a,c)=>new RegExp(`\\b${c}\\b`).test(a),r=(a,c)=>{for(let l of a.matchAll(/{{(.*?)}}/g))if(i(l[1],c))return!0;return!1},o=a=>{let c=this.settings[a],l=!1;typeof c=="string"?l=r(c,"linkedFile")||r(c,"linkedFileProperties"):Array.isArray(c)&&(l=c.some(({template:d})=>r(d,"linkedFile")||r(d,"linkedFileProperties"))),l&&t(a,(d,h)=>{d.append("The template variables "),d.createEl("code",{text:"linkedFile"}),d.append(" and "),d.createEl("code",{text:"linkedFileProperties"}),d.append(" are deprecated and will be removed in the near future. Please "),h.textContent="remove them from your templates",d.append(h),d.append(".")})};["displayTextFormats","copyCommands","outlineLinkDisplayTextFormat","outlineLinkCopyFormat","thumbnailLinkDisplayTextFormat","thumbnailLinkCopyFormat","copyOutlineAsHeadingsDisplayTextFormat","copyOutlineAsListDisplayTextFormat","copyOutlineAsListFormat","copyOutlineAsHeadingsFormat"].forEach(o)}async checkDataviewInlineFields(){im(this,t=>{if(t.length===0){this.requiresDataviewInlineFieldsMigration=!1;return}this.requiresDataviewInlineFieldsMigration=!0;let i=new we.Notice(createFragment(r=>r.append(`PDF++: Please consider moving the "${this.settings.proxyMDProperty}" Dataview inline fields to the properties (YAML frontmatter).`,createEl("br"),"Click ",createEl("a",{text:"here"},o=>{o.onclick=()=>{new Aa(this,t).open()}})," for more details.")),0);i.containerEl.addClass("pdf-plus-deprecated-setting-notice"),i.messageEl.setCssStyles({color:"var(--text-warning)"})})}async saveSettings(){let t=Object.assign({},this.settings);this.saveLocalStorage("anystylePath",t.anystylePath),delete t.anystylePath,await this.saveData(t)}loadLocalStorage(t){return this.app.loadLocalStorage(this.manifest.id+"-"+t)}saveLocalStorage(t,i){this.app.saveLocalStorage(this.manifest.id+"-"+t,i)}setCitationIdRegex(){let t=this.settings.citationIdPatterns.split(/\r?\n/).filter(i=>i.trim());this.citationIdRegex=new RegExp(t.join("|"))}registerStyleSettings(){this.app.workspace.trigger("parse-style-settings"),this.register(()=>this.app.workspace.trigger("parse-style-settings"))}registerRibbonIcons(){if(this.autoCopyMode=new mf(this),this.autoCopyMode.toggle(this.settings.autoCopy),this.register(()=>this.autoCopyMode.unload()),this.settings.autoFocusToggleRibbonIcon){let t=!1;this.autoFocusToggleIconEl=this.addRibbonIcon(this.settings.autoFocusIconName,`${this.manifest.name}: Toggle auto-focus`,()=>{t||this.toggleAutoFocus()}),this.autoFocusToggleIconEl.toggleClass("is-active",this.settings.autoFocus),this.registerDomEvent(this.autoFocusToggleIconEl,"contextmenu",i=>{if(t)return;let r=new we.Menu;r.addItem(o=>{o.setIcon("lucide-settings").setTitle("Customize...").onClick(()=>{this.openSettingTab().scrollToHeading("auto-focus")})}),r.onHide(()=>{t=!1}),r.showAtMouseEvent(i),t=!0})}if(this.settings.autoPasteToggleRibbonIcon){let t=!1;this.autoPasteToggleIconEl=this.addRibbonIcon(this.settings.autoPasteIconName,`${this.manifest.name}: Toggle auto-paste`,()=>{t||this.toggleAutoPaste()}),this.autoPasteToggleIconEl.toggleClass("is-active",this.settings.autoPaste),this.registerDomEvent(this.autoPasteToggleIconEl,"contextmenu",i=>{if(t)return;let r=new we.Menu;r.addItem(o=>{o.setIcon("lucide-settings").setTitle("Customize...").onClick(()=>{this.openSettingTab().scrollToHeading("auto-paste")})}),r.onHide(()=>{t=!1}),r.showAtMouseEvent(i),t=!0})}}toggleAutoFocusRibbonIcon(t){let i=this.autoFocusToggleIconEl;i&&(t=t!=null?t:!i.hasClass("is-active"),i.toggleClass("is-active",t))}toggleAutoPasteRibbonIcon(t){let i=this.autoPasteToggleIconEl;i&&(t=t!=null?t:!i.hasClass("is-active"),i.toggleClass("is-active",t))}async toggleAutoFocus(t,i){t=t!=null?t:!this.settings.autoFocus,this.toggleAutoFocusRibbonIcon(t),this.settings.autoFocus=t,this.settings.autoFocus&&this.settings.autoPaste&&this.toggleAutoPaste(!1,!1),(i==null||i)&&await this.saveSettings()}async toggleAutoPaste(t,i){t=t!=null?t:!this.settings.autoPaste,this.toggleAutoPasteRibbonIcon(t),this.settings.autoPaste=t,this.settings.autoPaste&&this.settings.autoFocus&&this.toggleAutoFocus(!1,!1),(i==null||i)&&await this.saveSettings()}patchObsidian(){this.app.workspace.onLayoutReady(()=>{n1(this),o1(this),d1(this)}),this.tryPatchUntilSuccess(t1),this.tryPatchUntilSuccess(i1),this.tryPatchUntilSuccess(a1),this.tryPatchUntilSuccess(l1)}tryPatchUntilSuccess(t,i){this.app.workspace.onLayoutReady(()=>{if(!t(this)){let o=i==null?void 0:i(),s=this.app.workspace.on("layout-change",()=>{t(this)&&(this.app.workspace.offref(s),o==null||o.hide())});this.registerEvent(s)}})}registerEl(t){return this.register(()=>t.remove()),t}loadStyle(){this.domManager.update()}registerPDFEmbedCreator(){let t=this.app.embedRegistry.embedByExtension.pdf;this.register(()=>{this.app.embedRegistry.unregisterExtension("pdf"),this.app.embedRegistry.registerExtension("pdf",t)}),this.app.embedRegistry.unregisterExtension("pdf"),this.app.embedRegistry.registerExtension("pdf",(i,r,o)=>{var c;let s=ga(o),a=null;if(s.has("rect")&&s.has("page")){let l=parseInt(s.get("page")),d=s.get("rect").split(",").map(p=>parseFloat(p)),h=s.has("width")?parseFloat(s.get("width")):void 0,u=(c=s.get("annotation"))!=null?c:void 0;Number.isInteger(l)&&d.length===4&&(a=new Jr(this,i,r,o,l,d,h,u))}if(a||(a=t(i,r,o),this.classes.PDFEmbed||(this.classes.PDFEmbed=a.constructor),this.patchStatus.pdfInternals||Sa(this,a.viewer)),this.registerDomEvent(a.containerEl,"dblclick",l=>{if(this.settings.dblclickEmbedToOpenLink&&It(l,l.target)&&(l.target.closest(".pdf-embed[src] > .pdf-container")||l.target.closest(".pdf-cropped-embed"))){let d=r.path+o;this.app.workspace.openLinkText(d,"",we.Keymap.isModEvent(l)),l.preventDefault()}}),this.settings.embedUnscrollable)for(let l of["wheel","touchmove"])this.registerDomEvent(a.containerEl,l,d=>{It(d,d.target)&&d.target.closest('.pdf-embed[src*="#"] .pdf-viewer-container')&&d.preventDefault()},{passive:!1});return a instanceof Jr&&this.registerDomEvent(a.containerEl,"click",l=>{It(l,l.target)&&l.target.closest(".cm-editor")&&l.preventDefault()}),s.has("color")?a.containerEl.dataset.highlightColor=s.get("color").toLowerCase():this.settings.defaultColor&&(a.containerEl.dataset.highlightColor=this.settings.defaultColor.toLowerCase()),a})}registerGlobalVariable(t,i,r=!0){if(t in window){if(r)throw new Error(`${this.manifest.name}: Global variable "${t}" already exists.`);return}window[t]=i,this.register(()=>delete window[t])}registerGlobalVariables(){this.registerGlobalVariable("pdfPlus",this,!1),this.registerGlobalVariable("pdflib",Qp,!1)}registerEvents(){this.registerEvent(this.app.workspace.on("layout-change",()=>{for(let t of this.pdfViewerChildren.keys())t!=null&&t.isShown()||this.pdfViewerChildren.delete(t)})),we.Platform.isDesktopApp&&this.registerEvent(this.app.workspace.on("active-leaf-change",t=>{if(this.settings.syncWithDefaultApp&&t&&this.lib.isPDFView(t.view)){let i=t.view.file;i&&(this.app.openWithDefaultApp(i.path),this.settings.focusObsidianAfterOpenPDFWithDefaultApp&&Zc())}})),this.registerEvent(this.app.vault.on("delete",t=>{t instanceof we.TFile&&t===this.lastPasteFile&&(this.lastPasteFile=null)})),this.registerEvent(this.app.vault.on("rename",(t,i)=>{t instanceof we.TFile&&this.settings.newFileTemplatePath===i&&(this.settings.newFileTemplatePath=t.path,this.saveSettings())})),this.registerEvent(this.app.vault.on("delete",t=>{t instanceof we.TFile&&this.settings.newFileTemplatePath===t.path&&(this.settings.newFileTemplatePath="",this.saveSettings())})),this.registerEvent(this.app.vault.on("modify",async t=>{t instanceof we.TFile&&t.path===this.settings.vimrcPath&&(this.vimrc=await this.app.vault.read(t))})),this.registerEvent(this.app.workspace.on("quit",async()=>{await this.cleanUpResources()})),this.registerEvent(this.app.workspace.on("editor-drop",(t,i,r)=>this.lib.dummyFileManager.createDummyFilesOnEditorDrop(t,i,r)))}registerOneTimeEvent(t,...[i,r,o]){let s=t.on(i,(...a)=>{r.call(o,...a),t.offref(s)},o);this.registerEvent(s)}async checkForUpdatesIfNeeded(){if(!this.settings.autoCheckForUpdates)return;(await this.lib.checkForUpdates({minHoursSinceRelease:24})).shouldUpdate&&this.app.workspace.onLayoutReady(()=>{new we.Notice(createFragment(i=>{i.append("PDF++: There is a newer version available! ",createEl("a",{text:"Update now",href:"obsidian://show-plugin?id=pdf-plus"}))}))})}registerAutoCheckForUpdates(){this.checkForUpdatesIfNeeded(),this.registerInterval(window.setInterval(()=>this.checkForUpdatesIfNeeded(),1e3*60*60*24))}registerHoverLinkSources(){this.registerHoverLinkSource("pdf-plus",{defaultMod:!0,display:"PDF++: backlink highlights"}),this.registerHoverLinkSource(Xn.HOVER_LINK_SOURCE_ID,{defaultMod:!0,display:"PDF++: internal links in PDF (except for citations)"}),this.registerHoverLinkSource(pn.HOVER_LINK_SOURCE_ID,{defaultMod:!1,display:"PDF++: citation links in PDF"}),this.registerHoverLinkSource(Gr.HOVER_LINK_SOURCE_ID,{defaultMod:!0,display:"PDF++: external links in PDF"}),this.registerHoverLinkSource(Zn.HOVER_LINK_SOURCE_ID,{defaultMod:!0,display:"PDF++: outlines (bookmarks)"}),this.registerHoverLinkSource(Yn.HOVER_LINK_SOURCE_ID,{defaultMod:!0,display:"PDF++: thumbnails"})}registerCommands(){this.lib.commands.registerCommands()}startTrackingActiveMarkdownFile(){let{workspace:t,vault:i}=this.app;t.onLayoutReady(()=>{let r=t.getActiveFile();if(r&&r.extension==="md")this.lastActiveMarkdownFile=r;else{let o=t.recentFileTracker.getRecentFiles({showMarkdown:!0,showCanvas:!1,showNonImageAttachments:!1,showImages:!1,maxCount:1}).first();if(o){let s=i.getAbstractFileByPath(o);s instanceof we.TFile&&s.extension==="md"&&(this.lastActiveMarkdownFile=s)}}this.registerEvent(t.on("file-open",o=>{o instanceof we.TFile&&o.extension==="md"&&(this.lastActiveMarkdownFile=o)})),this.registerEvent(i.on("delete",o=>{o instanceof we.TFile&&o===this.lastActiveMarkdownFile&&(this.lastActiveMarkdownFile=null)}))})}obsidianProtocolHandler(t){if("create-dummy"in t)return this.lib.dummyFileManager.createDummyFilesFromObsidianUrl(t);if("setting"in t)return this.settingTab.openFromObsidianUrl(t)}on(t,i,r){return this.events.on(t,i,r)}off(t,i){this.events.off(t,i)}offref(t){this.events.offref(t)}trigger(t,...i){this.events.trigger(t,...i)}requireModKeyForLinkHover(t="pdf-plus"){var i,r,o;return(o=(r=this.app.internalPlugins.plugins["page-preview"].instance.overrides[t])!=null?r:(i=this.app.workspace.hoverLinkSources[t])==null?void 0:i.defaultMod)!=null?o:!1}openSettingTab(){return this.app.setting.open(),this.app.setting.activeTab!==this.settingTab&&this.app.setting.openTabById(this.manifest.id),this.settingTab}openHotkeySettingTab(t){this.app.setting.open();let i=this.app.setting.openTabById("hotkeys");return i.setQuery(t!=null?t:this.manifest.id),i}getAnyStyleInputDir(){let t=this.manifest.dir;return t?t+"/anystyle":null}}; /*! Bundled license information: crypto-js/ripemd160.js: (** @preserve (c) 2012 by Cédric Mesnil. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *) crypto-js/mode-ctr-gladman.js: (** @preserve * Counter block mode compatible with Dr Brian Gladman fileenc.c * derived from CryptoJS.mode.CTR * Jan Hruby jhruby.web@gmail.com *) */ /* nosourcemap */