PageSourceSearch

https://assets.smarthr.jp/assets/base.babel.bundle-cf60c6e0cd2134d…5fb5dc721cde125c24f46b2ad6a263a0ae10b42b.js

js smarthr.jp collected 2026-09-24 17:20:50 UTC 562,533 bytes, 47 lines download raw bytes

1/*! LICENSE: base.babel.bundle.js.LICENSE.txt */
2!function(){try{var t="u">typeof window?window:"u">typeof global?global:"u">typeof globalThis?globalThis:"u">typeof self?self:{};t.SENTRY_RELEASE={id:"0c16f759a6665e802ca6577d1aa51200f83135cc"};var e=(new t.Error).stack;e&&(t._sentryDebugIds=t._sentryDebugIds||{},t._sentryDebugIds[e]="008bb509-6422-4c41-8d57-4a9c10f244a5",t._sentryDebugIdIdentifier="sentry-dbid-008bb509-6422-4c41-8d57-4a9c10f244a5")}catch(t){}}(),function(){try{var t="u">typeof window?window:"u">typeof global?global:"u">typeof globalThis?globalThis:"u">typeof self?self:{};t._sentryModuleMetadata=t._sentryModuleMetadata||{},t._sentryModuleMetadata[(new t.Error).stack]=function(t){for(var e=1;e<arguments.length;e++){var i=arguments[e];if(null!=i)for(var r in i)i.hasOwnProperty(r)&&(t[r]=i[r])}return t}({},t._sentryModuleMetadata[(new t.Error).stack],{"_sentryBundlerPluginAppKey:hanica":!0})}catch(t){}}(),(()=>{var t={3093(){var t,e,i,r,n,s,a,o,l,h,d,c,u,p,g,m,f,b,v;t=RegExp("(?:[。「」・ヲァィゥェォャュョッーアイエオナニヌネノマミムメモヤユヨラリルレロワン]|[ウカキクケコサシスセソタチツテト][゙]?|[ハヒフヘホ][゙゚]?)","g"),e=RegExp("(?:[。「」ァアィイゥウェエォオカガキギクグケゲコゴサザシジスズセゼソゾタダチヂッツヅテデトドナニヌネノハバパヒビピフブプヘベペホボポマミムメモャヤュユョヨラリルレロワヲンヴ・ー])","g"),i={"。":"。","「":"「","」":"」","・":"・",ー:"ー",ァ:"ァ",ア:"ア",ィ:"ィ",イ:"イ",ゥ:"ゥ",ウ:"ウ",ェ:"ェ",エ:"エ",ォ:"ォ",オ:"オ",カ:"カ",ガ:"ガ",キ:"キ",ギ:"ギ",ク:"ク",グ:"グ",ケ:"ケ",ゲ:"ゲ",コ:"コ",ゴ:"ゴ",サ:"サ",ザ:"ザ",シ:"シ",ジ:"ジ",ス:"ス",ズ:"ズ",セ:"セ",ゼ:"ゼ",ソ:"ソ",ゾ:"ゾ",タ:"タ",ダ:"ダ",チ:"チ",ヂ:"ヂ",ッ:"ッ",ツ:"ツ",ヅ:"ヅ",テ:"テ",デ:"デ",ト:"ト",ド:"ド",ナ:"ナ",ニ:"ニ",ヌ:"ヌ",ネ:"ネ",ノ:"ノ",ハ:"ハ",バ:"バ",パ:"パ",ヒ:"ヒ",ビ:"ビ",ピ:"ピ",フ:"フ",ブ:"ブ",プ:"プ",ヘ:"ヘ",ベ:"ベ",ペ:"ペ",ホ:"ホ",ボ:"ボ",ポ:"ポ",マ:"マ",ミ:"ミ",ム:"ム",メ:"メ",モ:"モ",ャ:"ャ",ヤ:"ヤ",ュ:"ュ",ユ:"ユ",ョ:"ョ",ヨ:"ヨ",ラ:"ラ",リ:"リ",ル:"ル",レ:"レ",ロ:"ロ",ワ:"ワ",ヲ:"ヲ",ン:"ン",ヴ:"ヴ"},n=(r=function(t){var e={};for(var i in t)e[t[i]]=i;return e})(i),s=function(e){return e.replace(t,function(t){return n[t]})},a=function(t){return t.replace(e,function(t){return i[t]})},o=function(t){for(var e=33;e<=126;e++)t[String.fromCharCode(e)]=String.fromCharCode(e+65280-32);return t}({"⦅":"⦅","⦆":"⦆","¢":"¢","£":"£","¬":"¬","¯":" ̄","¦":"¦","¥":"¥","₩":"₩"}),l=/[\x21-\x7E\u2985\u2986\xA2\xA3\xAC\xAF\xA6\xA5\u20A9]/g,h=r(o),d=/[\uFF01-\uFFE6]/g,c=function(t){return t.replace(l,function(t){return o[t]})},u=function(t){return t.replace(d,function(t){return h[t]})},p=function(t){return t.replace(/\u3000/g," ")},g=function(t){return t.replace(/ /g," ")},f=r(m=function(){for(var t={},e=12353;e<=12436;e++)t[String.fromCharCode(e)]=String.fromCharCode(e-12352+12448);return t}()),b=function(t){return t.replace(/[\u3041-\u3094]/g,function(t){return m[t]})},v=function(t){return t.replace(/[\u30A1-\u30F4]/g,function(t){return f[t]})},this.HanZenKaku=this.HanZenKaku||{h2z:s,z2h:a,fw2hw:u,hw2fw:c,fs2hs:p,hs2fs:g,h2k:b,k2h:v,version:"1.0.1"},"function"==typeof Object.defineProperty&&function(t,e){var i=function(t){return function(){return t(this)}};for(var r in e)t[r]||Object.defineProperty(t,r,{value:i(e[r]),enumerable:!1,writable:!0,configurable:!0})}(String.prototype,{toZenkaku:s,toHankaku:a,toFullwidth:c,toHalfwidth:u,toFullwidthSpace:g,toHalfwidthSpace:p,toKatakana:b,toHiragana:v})},6312(t){"use strict";t.exports=function(t,i,r,n){i=i||"&",r=r||"=";var s={};if("string"!=typeof t||0===t.length)return s;var a=/\+/g;t=t.split(i);var o=1e3;n&&"number"==typeof n.maxKeys&&(o=n.maxKeys);var l=t.length;o>0&&l>o&&(l=o);for(var h=0;h<l;++h){var d,c,u,p,g=t[h].replace(a,"%20"),m=g.indexOf(r);(m>=0?(d=g.substr(0,m),c=g.substr(m+1)):(d=g,c=""),u=decodeURIComponent(d),p=decodeURIComponent(c),Object.prototype.hasOwnProperty.call(s,u))?e(s[u])?s[u].push(p):s[u]=[s[u],p]:s[u]=p}return s};var e=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)}},3680(t){"use strict";var e=function(t){switch(typeof t){case"string":return t;case"boolean":return t?"true":"false";case"number":return isFinite(t)?t:"";default:return""}};t.exports=function(t,s,a,o){return(s=s||"&",a=a||"=",null===t&&(t=void 0),"object"==typeof t)?r(n(t),function(n){var o=encodeURIComponent(e(n))+a;return i(t[n])?r(t[n],function(t){return o+encodeURIComponent(e(t))}).join(s):o+encodeURIComponent(e(t[n]))}).join(s):o?encodeURIComponent(e(o))+a+encodeURIComponent(e(t)):""};var i=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)};function r(t,e){if(t.map)return t.map(e);for(var i=[],r=0;r<t.length;r++)i.push(e(t[r],r));return i}var n=Object.keys||function(t){var e=[];for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.push(i);return e}},4652(t,e,i){"use strict";e.qg=i(6312),e.As=i(3680)},9174(t,e){!function(i){"use strict";
2var r="function",n="undefined",s="object",a="string",o="major",l="model",h="name",d="type",c="vendor",u="version",p="architecture",g="console",m="mobile",f="tablet",b="smarttv",v="wearable",y="embedded",w="Amazon",x="Apple",A="ASUS",S="BlackBerry",T="Browser",_="Chrome",E="Firefox",C="Google",k="Honor",P="Huawei",M="Microsoft",D="Motorola",I="Nvidia",R="OnePlus",F="Opera",B="OPPO",O="Samsung",L="Sharp",N="Sony",U="Xiaomi",j="Zebra",z="Facebook",H="Chromium OS",V="Mac OS",W=" Browser",G=function(t,e){var i={};for(var r in t)e[r]&&e[r].length%2==0?i[r]=e[r].concat(t[r]):i[r]=t[r];return i},q=function(t){for(var e={},i=0;i<t.length;i++)e[t[i].toUpperCase()]=t[i];return e},K=function(t,e){return typeof t===a&&-1!==X(e).indexOf(X(t))},X=function(t){return t.toLowerCase()},Y=function(t,e){if(typeof t===a)return t=t.replace(/^\s\s*/,""),typeof e===n?t:t.substring(0,500)},J=function(t,e){for(var i,n,a,o,l,h,d=0;d<e.length&&!l;){var c=e[d],u=e[d+1];for(i=n=0;i<c.length&&!l&&c[i];)if(l=c[i++].exec(t))for(a=0;a<u.length;a++)h=l[++n],typeof(o=u[a])===s&&o.length>0?2===o.length?typeof o[1]==r?this[o[0]]=o[1].call(this,h):this[o[0]]=o[1]:3===o.length?typeof o[1]!==r||o[1].exec&&o[1].test?this[o[0]]=h?h.replace(o[1],o[2]):void 0:this[o[0]]=h?o[1].call(this,h,o[2]):void 0:4===o.length&&(this[o[0]]=h?o[3].call(this,h.replace(o[1],o[2])):void 0):this[o]=h||void 0;d+=2}},Q=function(t,e){for(var i in e)if(typeof e[i]===s&&e[i].length>0){for(var r=0;r<e[i].length;r++)if(K(e[i][r],t))return"?"===i?void 0:i}else if(K(e[i],t))return"?"===i?void 0:i;return e.hasOwnProperty("*")?e["*"]:t},Z={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2","8.1":"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},tt={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[u,[h,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[u,[h,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[h,u],[/opios[\/ ]+([\w\.]+)/i],[u,[h,F+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[u,[h,F+" GX"]],[/\bopr\/([\w\.]+)/i],[u,[h,F]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[u,[h,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[u,[h,"Maxthon"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon)\/([-\w\.]+)/i,/(heytap|ovi|115)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[h,u],[/quark(?:pc)?\/([-\w\.]+)/i],[u,[h,"Quark"]],[/\bddg\/([\w\.]+)/i],[u,[h,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[u,[h,"UC"+T]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[u,[h,"WeChat"]],[/konqueror\/([\w\.]+)/i],[u,[h,"Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[u,[h,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[u,[h,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[u,[h,"Smart Lenovo "+T]],[/(avast|avg)\/([\w\.]+)/i],[[h,/(.+)/,"$1 Secure "+T],u],[/\bfocus\/([\w\.]+)/i],[u,[h,E+" Focus"]],[/\bopt\/([\w\.]+)/i],[u,[h,F+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[u,[h,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[u,[h,"Dolphin"]],[/coast\/([\w\.]+)/i],[u,[h,F+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[u,[h,"MIUI"+W]],[/fxios\/([\w\.-]+)/i],[u,[h,E]],[/\bqihoobrowser\/?([\w\.]*)/i],[u,[h,"360"]],[/\b(qq)\/([\w\.]+)/i],[[h,/(.+)/,"$1Browser"],u],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[h,/(.+)/,"$1"+W],u],[/samsungbrowser\/([\w\.]+)/i],[u,[h,O+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[u,[h,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[h,"Sogou Mobile"],u],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[h,u],[/(lbbrowser|rekonq)/i,/\[(linkedin)app\]/i],[h],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[u,h],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[h,z],u],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/(daum)apps[\/ ]([\w\.]+)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i],[h,u],[/\bgsa\/([\w\.]+) .*safari\//i],[u,[h,"GSA"]],[/musical_ly(?:.
2+app_?version\/|_)([\w\.]+)/i],[u,[h,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[u,[h,_+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[h,_+" WebView"],u],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[u,[h,"Android "+T]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[h,u],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[u,[h,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[u,h],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[h,[u,Q,{"1.0":"/8","1.2":"/1","1.3":"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[h,u],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[h,"Netscape"],u],[/(wolvic|librewolf)\/([\w\.]+)/i],[h,u],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[u,[h,E+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(amaya|dillo|doris|icab|ladybird|lynx|mosaic|netsurf|obigo|polaris|w3m|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/\b(links) \(([\w\.]+)/i],[h,[u,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[h,[u,/master.|lts./,""]]],cpu:[[/\b((amd|x|x86[-_]?|wow|win)64)\b/i],[[p,"amd64"]],[/(ia32(?=;))/i,/\b((i[346]|x)86)(pc)?\b/i],[[p,"ia32"]],[/\b(aarch64|arm(v?[89]e?l?|_?64))\b/i],[[p,"arm64"]],[/\b(arm(v[67])?ht?n?[fl]p?)\b/i],[[p,"armhf"]],[/( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i],[[p,"arm"]],[/((ppc|powerpc)(64)?)( mac|;|\))/i],[[p,/ower/,"",X]],[/ sun4\w[;\)]/i],[[p,"sparc"]],[/\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i],[[p,X]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[l,[c,O],[d,f]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr])[-\w]+)/i,/sec-(sgh\w+)/i],[l,[c,O],[d,m]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[l,[c,x],[d,m]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[l,[c,x],[d,f]],[/(macintosh);/i],[l,[c,x]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[l,[c,L],[d,m]],[/\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i],[l,[c,k],[d,f]],[/honor([-\w ]+)[;\)]/i],[l,[c,k],[d,m]],[/\b((?:ag[rs][2356]?k?|bah[234]?|bg[2o]|bt[kv]|cmr|cpn|db[ry]2?|jdn2|got|kob2?k?|mon|pce|scm|sht?|[tw]gr|vrd)-[ad]?[lw][0125][09]b?|605hw|bg2-u03|(?:gem|fdr|m2|ple|t1)-[7a]0[1-4][lu]|t1-a2[13][lw]|mediapad[\w\. ]*(?= bui|\)))\b(?!.+d\/s)/i],[l,[c,P],[d,f]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[l,[c,P],[d,m]],[/oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i,/\b((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i],[[l,/_/g," "],[c,U],[d,f]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i,/ ([\w ]+) miui\/v?\d/i],[[l,/_/g," "],[c,U],[d,m]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[l,[c,B],[d,m]],[/\b(opd2(\d{3}a?))(?: bui|\))/i],[l,[c,Q,{OnePlus:["304","403","203"],"*":B}],[d,f]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[l,[c,"Vivo"],[d,m]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[l,[c,"Realme"],[d,m]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto(?! 360)[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[l,[c,D],[d,m]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[l,[c,D],[d,f]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[l,[c,"LG"],[d,f]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv|watch)\w+)/i,/\blg-?([\d\w]+) bui/i],[l,[c,"LG"],[d,m]],[/(ideatab[-\w ]+|602lv|d-42a|a101lv|a2109a|a3500-hv|s[56]000|pb-6505[my]|tb-?x?\d{3,4}
2(?:f[cu]|xu|[av])|yt\d?-[jx]?\d+[lfmx])( bui|;|\)|\/)/i,/lenovo ?(b[68]0[08]0-?[hf]?|tab(?:[\w- ]+?)|tb[\w-]{6,7})( bui|;|\)|\/)/i],[l,[c,"Lenovo"],[d,f]],[/(nokia) (t[12][01])/i],[c,l,[d,f]],[/(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i,/nokia[-_ ]?(([-\w\. ]*))/i],[[l,/_/g," "],[d,m],[c,"Nokia"]],[/(pixel (c|tablet))\b/i],[l,[c,C],[d,f]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[l,[c,C],[d,m]],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[l,[c,N],[d,m]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[l,"Xperia Tablet"],[c,N],[d,f]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[l,[c,R],[d,m]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[l,[c,w],[d,f]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[l,/(.+)/g,"Fire Phone $1"],[c,w],[d,m]],[/(playbook);[-\w\),; ]+(rim)/i],[l,c,[d,f]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[l,[c,S],[d,m]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[l,[c,A],[d,f]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[l,[c,A],[d,m]],[/(nexus 9)/i],[l,[c,"HTC"],[d,f]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[c,[l,/_/g," "],[d,m]],[/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])\w*(\)| bui)/i],[l,[c,"TCL"],[d,f]],[/(itel) ((\w+))/i],[[c,X],l,[d,Q,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[l,[c,"Acer"],[d,f]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[l,[c,"Meizu"],[d,m]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[l,[c,"Ulefone"],[d,m]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[l,[c,"Energizer"],[d,m]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[l,[c,"Cat"],[d,m]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[l,[c,"Smartfren"],[d,m]],[/droid.+; (a(?:015|06[35]|142p?))/i],[l,[c,"Nothing"],[d,m]],[/; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i,/archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i],[l,[c,"Archos"],[d,f]],[/archos ([\w ]+)( b|\))/i,/; (ac[3-6]\d\w{2,8})( b|\))/i],[l,[c,"Archos"],[d,m]],[/(imo) (tab \w+)/i,/(infinix) (x1101b?)/i],[c,l,[d,f]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus(?! zenw)|dell|jolla|meizu|motorola|polytron|infinix|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (hmd|imo) ([\w ]+?)(?: bui|\))/i,/(hp) ([\w ]+\w)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i,/(oppo) ?([\w ]+) bui/i],[c,l,[d,m]],[/(kobo)\s(ereader|touch)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[c,l,[d,f]],[/(surface duo)/i],[l,[c,M],[d,f]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[l,[c,"Fairphone"],[d,m]],[/(u304aa)/i],[l,[c,"AT&T"],[d,m]],[/\bsie-(\w*)/i],[l,[c,"Siemens"],[d,m]],[/\b(rct\w+) b/i],[l,[c,"RCA"],[d,f]],[/\b(venue[\d ]{2,7}) b/i],[l,[c,"Dell"],[d,f]],[/\b(q(?:mv|ta)\w+) b/i],[l,[c,"Verizon"],[d,f]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[l,[c,"Barnes & Noble"],[d,f]],[/\b(tm\d{3}\w+) b/i],[l,[c,"NuVision"],[d,f]],[/\b(k88) b/i],[l,[c,"ZTE"],[d,f]],[/\b(nx\d{3}j) b/i],[l,[c,"ZTE"],[d,m]],[/\b(gen\d{3}) b.+49h/i],[l,[c,"Swiss"],[d,m]],[/\b(zur\d{3}) b/i],[l,[c,"Swiss"],[d,f]],[/\b((zeki)?tb.*\b) b/i],[l,[c,"Zeki"],[d,f]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[c,"Dragon Touch"],l,[d,f]],[/\b(ns-?\w{0,9}) b/i],[l,[c,"Insignia"],[d,f]],[/\b((nxa|next)-?\w{0,9}) b/i],[l,[c,"NextBook"],[d,f]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[c,"Voice"],l,[d,m]],[/\b(lvtel\-)?(v1[12]) b/i],[[c,"LvTel"],l,[d,m]],[/\b(ph-1) /i],[l,[c,"Essential"],[d,m]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[l,[c,"Envizen"],[d,f]],[/\b(trio[-\w\. ]+) b/i],[l,[c,"MachSpeed"],[d,f]],[/\btu_(1491) b/i],[l,[c,"Rotor"],[d,f]],[/((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i],[l,[c,I],[d,f]],[/(sprint) (\w+)/i],[c,l,[d,m]],[/(kin\.[onetw]{3})/i],[[l,/\./g," "],[c,M],[d,m]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[l,[c,j],[d,f]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[l,[c,j],[d,m]],[/smart-tv.+(samsung)/i],[c,[d,b]],[/hbbtv.+maple;(\d+)/i],[[l,/^/,"SmartTV"],[c,O],[d,b]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[c,"LG"],[d,b]],[/(apple) ?tv/i],[c,[l,x+" TV"],[d,b]],[/crkey/i],[[l,_+"cast"],[c,C],[d,b]],[/droid.+aft(\w+)( bui|\))/i],[l,[c,w],[d,b]],[/(shield \w+ tv)/i],[l,[c,I],[d,b]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[l,[c,L],[d,b]],[/(bravia[\w ]+)( bui|\))/i],[l,[c,N],[d,b]],[/(mi(tv|box)-?\w+) bui/i],[l,[c,U],[d,b]],[/Hbbtv.*(technisat) (.*);/i],[c,l,[d,b]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[c,Y],[l,Y],[d,b]],[/droid.+; ([\w- ]+) (?:android tv|smart[- ]?tv)/i],[l,[d,b]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[d,b]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[c,l,[d,g]],[/droid.+; (shield)( bui|\))/i],[l,[c,I],[d,g]],[/(playstation \w+)/i],[l,[c,N],[d,g]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[l,[c,M],[d,g]],[/\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i],[l,[c,O],[d,v]],[/((pebble))app/i,/(asu
2s|google|lg|oppo) ((pixel |zen)?watch[\w ]*)( bui|\))/i],[c,l,[d,v]],[/(ow(?:19|20)?we?[1-3]{1,3})/i],[l,[c,B],[d,v]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[l,[c,x],[d,v]],[/(opwwe\d{3})/i],[l,[c,R],[d,v]],[/(moto 360)/i],[l,[c,D],[d,v]],[/(smartwatch 3)/i],[l,[c,N],[d,v]],[/(g watch r)/i],[l,[c,"LG"],[d,v]],[/droid.+; (wt63?0{2,3})\)/i],[l,[c,j],[d,v]],[/droid.+; (glass) \d/i],[l,[c,C],[d,v]],[/(pico) (4|neo3(?: link|pro)?)/i],[c,l,[d,v]],[/; (quest( \d| pro)?)/i],[l,[c,z],[d,v]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[c,[d,y]],[/(aeobc)\b/i],[l,[c,w],[d,y]],[/(homepod).+mac os/i],[l,[c,x],[d,y]],[/windows iot/i],[[d,y]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[l,[d,m]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[l,[d,f]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[d,f]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[d,m]],[/droid .+?; ([\w\. -]+)( bui|\))/i],[l,[c,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[u,[h,"EdgeHTML"]],[/(arkweb)\/([\w\.]+)/i],[h,u],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[u,[h,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[h,u],[/ladybird\//i],[[h,"LibWeb"]],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[u,h]],os:[[/microsoft (windows) (vista|xp)/i],[h,u],[/(windows (?:phone(?: os)?|mobile|iot))[\/ ]?([\d\.\w ]*)/i],[h,[u,Q,Z]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[u,Q,Z],[h,"Windows"]],[/[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[u,/_/g,"."],[h,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[h,V],[u,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[u,h],[/(ubuntu) ([\w\.]+) like android/i],[[h,/(.+)/,"$1 Touch"],u],[/(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen|webos)\w*[-\/; ]?([\d\.]*)/i],[h,u],[/\(bb(10);/i],[u,[h,S]],[/(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i],[u,[h,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[u,[h,E+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[u,[h,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[u,[h,"watchOS"]],[/crkey\/([\d\.]+)/i],[u,[h,_+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[h,H],u],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux)(?: arm\w*| x86\w*| ?)([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[h,u],[/(sunos) ?([\w\.\d]*)/i],[[h,"Solaris"],u],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[h,u]]},te=function(t,e){if(typeof t===s&&(e=t,t=void 0),!(this instanceof te))return new te(t,e).getResult();var g=typeof i!==n&&i.navigator?i.navigator:void 0,b=t||(g&&g.userAgent?g.userAgent:""),v=g&&g.userAgentData?g.userAgentData:void 0,y=e?G(tt,e):tt,w=g&&g.userAgent==b;return this.getBrowser=function(){var t,e={};return e[h]=void 0,e[u]=void 0,J.call(e,b,y.browser),e[o]=typeof(t=e[u])===a?t.replace(/[^\d\.]/g,"").split(".")[0]:void 0,w&&g&&g.brave&&typeof g.brave.isBrave==r&&(e[h]="Brave"),e},this.getCPU=function(){var t={};return t[p]=void 0,J.call(t,b,y.cpu),t},this.getDevice=function(){var t={};return t[c]=void 0,t[l]=void 0,t[d]=void 0,J.call(t,b,y.device),w&&
2!t[d]&&v&&v.mobile&&(t[d]=m),w&&"Macintosh"==t[l]&&g&&typeof g.standalone!==n&&g.maxTouchPoints&&g.maxTouchPoints>2&&(t[l]="iPad",t[d]=f),t},this.getEngine=function(){var t={};return t[h]=void 0,t[u]=void 0,J.call(t,b,y.engine),t},this.getOS=function(){var t={};return t[h]=void 0,t[u]=void 0,J.call(t,b,y.os),w&&!t[h]&&v&&v.platform&&"Unknown"!=v.platform&&(t[h]=v.platform.replace(/chrome os/i,H).replace(/macos/i,V)),t},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return b},this.setUA=function(t){return b=typeof t===a&&t.length>500?Y(t,500):t,this},this.setUA(b),this};te.VERSION="1.0.41",te.BROWSER=q([h,u,o]),te.CPU=q([p]),te.DEVICE=q([l,c,d,g,m,b,f,v,y]),te.ENGINE=te.OS=q([h,u]),typeof e!==n?(t.exports&&(e=t.exports=te),e.UAParser=te):typeof define===r&&define.amd?define(function(){return te}):typeof i!==n&&(i.UAParser=te);var ti=typeof i!==n&&(i.jQuery||i.Zepto);if(ti&&!ti.ua){var tr=new te;ti.ua=tr.getResult(),ti.ua.get=function(){return tr.getUA()},ti.ua.set=function(t){tr.setUA(t);var e=tr.getResult();for(var i in e)ti.ua[i]=e[i]}}}("object"==typeof window?window:this)},6772(t,e){e._getPrivFilters=function(){var t,e=/</g,i=/"/g,r=/'/g,n=/&/g,s=/\x00/g,a=/(?:^$|[\x00\x09-\x0D "'`=<>])/g,o=/[&<>"'`]/g,l=/(?:\x00|^-*!?>|--!?>|--?!?$|\]>|\]$)/g,h=/&(?:#([xX][0-9A-Fa-f]+|\d+);?|(Tab|NewLine|colon|semi|lpar|rpar|apos|sol|comma|excl|ast|midast|ensp|emsp|thinsp);|(nbsp|amp|AMP|lt|LT|gt|GT|quot|QUOT);?)/g,d={Tab:"	",NewLine:"\n",colon:":",semi:";",lpar:"(",rpar:")",apos:"'",sol:"/",comma:",",excl:"!",ast:"*",midast:"*",ensp:" ",emsp:" ",thinsp:" ",nbsp:" ",amp:"&",lt:"<",gt:">",quot:'"',QUOT:'"'},c=/^(?:(?!-*expression)#?[-\w]+|[+-]?(?:\d+|\d*\.\d+)(?:r?em|ex|ch|cm|mm|in|px|pt|pc|%|vh|vw|vmin|vmax)?|!important|)$/i,u=/[\x00-\x1F\x7F\[\]{}\\"]/g,p=/[\x00-\x1F\x7F\[\]{}\\']/g,g=/url[\(\u207D\u208D]+/g,m=/['\(\)]/g,f=/\/\/%5[Bb]([A-Fa-f0-9:]+)%5[Dd]/,b={javascript:1,data:1,vbscript:1,mhtml:1,"x-schema":1},v=/(?::|&#[xX]0*3[aA];?|&#0*58;?|&colon;)/,y=/(?:^[\x00-\x20]+|[\t\n\r\x00]+)/g,w={Tab:"	",NewLine:"\n"},x=function(t,e,i){return void 0===t?"undefined":null===t?"null":t.toString().replace(e,i)},A=String.fromCodePoint||function(t){return 0==arguments.length?"":t<=65535?String.fromCharCode(t):String.fromCharCode(((t-=65536)>>10)+55296,t%1024+56320)};function S(t){var e=t.split(v,2);return e[0]&&(2===e.length||t.length!==e[0].length)?e[0]:null}function T(e,i,r,n){return i=i||d,r=r||h,void 0===e?"undefined":null===e?"null":e.toString().replace(s,"�").replace(r,function(e,r,s,a){return r?(r=Number(r[0]<="9"?r:"0"+r),n?A(r):128===r?"€":130===r?"‚":131===r?"ƒ":132===r?"„":133===r?"…":134===r?"†":135===r?"‡":136===r?"ˆ":137===r?"‰":138===r?"Š":139===r?"‹":140===r?"Œ":142===r?"Ž":145===r?"‘":146===r?"’":147===r?"“":148===r?"”":149===r?"•":150===r?"–":151===r?"—":152===r?"˜":153===r?"™":154===r?"š":155===r?"›":156===r?"œ":158===r?"ž":159===r?"Ÿ":r>=55296&&r<=57343||13===r?"�":t.frCoPt(r)):i[s||a]||e})}function _(t){return"\\"+t.charCodeAt(0).toString(16).toLowerCase()+" "}function E(t){return t.replace(g,function(t){return"-x-"+t})}function C(e){var i=S(e=t.yufull(T(e)));return i&&b[i.toLowerCase()]?"##"+e:e}return t={frCoPt:function(t){return null==t?"":!isFinite(t=Number(t))||t<=0||t>1114111||t>=1&&t<=8||t>=14&&t<=31||t>=127&&t<=159||t>=64976&&t<=65007||11===t||(65535&t)==65535||(65535&t)==65534?"�":A(t)},d:T,yup:function(t){return(t=S(t.replace(s,"")))?T(t,w,null,!0).replace(y,"").toLowerCase():null},y:function(t){return x(t,o,function(t){return"&"===t?"&amp;":"<"===t?"&lt;":">"===t?"&gt;":'"'===t?"&quot;":"'"===t?"&#39;":"&#96;"})},ya:function(t){return x(t,n,"&amp;")},yd:function(t){return x(t,e,"&lt;")},yc:function(t){return x(t,l,function(t){return"\0"===t?"�":"--!"===t||"--"===t||"-"===t||"]"===t?t+" ":t.slice(0,-1)+" >"})},yavd:function(t){return x(t,i,"&quot;")},yavs:function(t){return x(t,r,"&#39;")},yavu:function(t){return x(t,a,function(t){return"	"===t?"&#9;":"\n"===t?"&#10;":"\v"===t?"&#11;":"\f"===t?"&#12;":"\r"===t?"&#13;":" "===t?"&#32;":"="===t?"&#61;":"<"===t?"&lt;":">"===t?"&gt;
2":'"'===t?"&quot;":"'"===t?"&#39;":"`"===t?"&#96;":"�"})},yu:encodeURI,yuc:encodeURIComponent,yubl:function(e){return b[t.yup(e)]?"x-"+e:e},yufull:function(e){return t.yu(e).replace(f,function(t,e){return"//["+e+"]"})},yublf:function(e){return t.yubl(t.yufull(e))},yceu:function(t){return t=T(t),c.test(t)?t:";-x:'"+E(t.replace(p,_))+"';-v:"},yced:function(t){return E(T(t).replace(u,_))},yces:function(t){return E(T(t).replace(p,_))},yceuu:function(t){return C(t).replace(m,function(t){return"'"===t?"\\27 ":"("===t?"%28":"%29"})},yceud:function(t){return C(t)},yceus:function(t){return C(t).replace(r,"\\27 ")}}};var i=e._privFilters=e._getPrivFilters();function r(t,e,r){return i.yubl(e((r||i.yufull)(t)))}e.inHTMLData=i.yd,e.inHTMLComment=i.yc,e.inSingleQuotedAttr=i.yavs,e.inDoubleQuotedAttr=i.yavd,e.inUnQuotedAttr=i.yavu,e.uriInSingleQuotedAttr=function(t){return r(t,i.yavs)},e.uriInDoubleQuotedAttr=function(t){return r(t,i.yavd)},e.uriInUnQuotedAttr=function(t){return r(t,i.yavu)},e.uriInHTMLData=i.yufull,e.uriInHTMLComment=function(t){return i.yc(i.yufull(t))},e.uriPathInSingleQuotedAttr=function(t){return r(t,i.yavs,i.yu)},e.uriPathInDoubleQuotedAttr=function(t){return r(t,i.yavd,i.yu)},e.uriPathInUnQuotedAttr=function(t){return r(t,i.yavu,i.yu)},e.uriPathInHTMLData=i.yu,e.uriPathInHTMLComment=function(t){return i.yc(i.yu(t))},e.uriQueryInSingleQuotedAttr=e.uriPathInSingleQuotedAttr,e.uriQueryInDoubleQuotedAttr=e.uriPathInDoubleQuotedAttr,e.uriQueryInUnQuotedAttr=e.uriPathInUnQuotedAttr,e.uriQueryInHTMLData=e.uriPathInHTMLData,e.uriQueryInHTMLComment=e.uriPathInHTMLComment,e.uriComponentInSingleQuotedAttr=function(t){return i.yavs(i.yuc(t))},e.uriComponentInDoubleQuotedAttr=function(t){return i.yavd(i.yuc(t))},e.uriComponentInUnQuotedAttr=function(t){return i.yavu(i.yuc(t))},e.uriComponentInHTMLData=i.yuc,e.uriComponentInHTMLComment=function(t){return i.yc(i.yuc(t))},e.uriFragmentInSingleQuotedAttr=function(t){return i.yubl(i.yavs(i.yuc(t)))},e.uriFragmentInDoubleQuotedAttr=function(t){return i.yubl(i.yavd(i.yuc(t)))},e.uriFragmentInUnQuotedAttr=function(t){return i.yubl(i.yavu(i.yuc(t)))},e.uriFragmentInHTMLData=e.uriComponentInHTMLData,e.uriFragmentInHTMLComment=e.uriComponentInHTMLComment}},e={};function i(r){var n=e[r];if(void 0!==n)return n.exports;var s=e[r]={exports:{}};return t[r].call(s.exports,s,s.exports,i),s.exports}i.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return i.d(e,{a:e}),e},i.d=(t,e,r)=>{var n=(e,r)=>{for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,[r]:e[n]})};n(e,"get"),n(r,"value")},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},(()=>{"use strict";var t={};function e(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}i.r(t),i.d(t,{EA:()=>rZ,D6:()=>r8,YE:()=>r7,rE:()=>nl});class r{execute(){this.functions.forEach(t=>{t()}),this.klasses.forEach(t=>{new t().attach()})}constructor(t,i=[]){e(this,"klasses",void 0),e(this,"functions",void 0),this.klasses=t,this.functions=i}}class n{static noOperation(){for(var t=arguments.length,e=Array(t),i=0;i<t;i++)e[i]=arguments[i]}static thatOrDefault(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;return void 0===t?e:t}static getAttr(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;return n.thatOrDefault(t[e],i)}static dig(t){for(var e=arguments.length,i=Array(e>1?e-1:0),r=1;r<e;r++)i[r-1]=arguments[r];if(!t)return;let s=i.length<=1,a=t[i.shift()];return s||void 0===a?a:n.dig(a,...i)}static fixThisReference(t,e){return function(){for(var i=arguments.length,r=Array(i),n=0;n<i;n++)r[n]=arguments[n];return t[e](...r)}}static lPad(t,e,i){let r=e-t.length;return r<1?t:"".concat(Array(r+1).join(i)).concat(t)}static arrayFlatten(t){return t.reduce((t,e)=>Array.isArray(e)?t.concat(n.arrayFlatten(e)):t.concat(e),[])}static convertString(t){return null==t?"":"".concat(t)}static totalArrayVal(t){return t.map(n.convertNumber).reduce((t,e)=>t+e,0)}static totalInputsVal(t){return n.totalArrayVal(t.map((t,e)=>e.value).get())}static clearForm(t){let{$check:e,$notcheck:i}=n._generateFormInputs(t),r=e.add(i);return e.prop("checked",!1),i.val(""),i.trigger("change.select2"),r.trigger("hanica.util.form.clear"),r}static toggleDisableInputs(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"input,select,textarea",r=t.find(i);r.prop("disabled",e),r.filter('[type="file"]').each((t,i)=>{let r=$(i).closest(".btn-file");r.toggleClass("disabled",e),r.removeAttr("disabled")})}static isFormEntered(t){let{$check:e,$notcheck:i}=n._generateFormInputs(t),r=(t,e)=>t.map((t,i)=>e($(i))).get().some(t=>!!t);return!!r(i,t=>""!==t.val())||r(e,t=>t.prop("checked"))}static _generateFormInputs(t){return{$check:t.find("input[type=checkbox],input[type=radio]"),$notcheck:t.find("input".concat(["checkbox","radio","hidden","submit","reset","button"].map(t=>"[type!=".concat(t,"]")).join(""),",select,textarea"))}}static isCanInput(t){return!t.prop("readonly")&&!t.prop("disabled")}static curry(t){for(var e=arguments.length,i=Array(e>1?e-1:0),r=1;r<e;r++)i[r-1]=arguments[r];return()=>t(...i)}static compactObject(t){let e={};for(let i in t){let r=t[i];n.isPresent(r)&&(e[i]=r)}return e}static compactArray(t){return t.filter(t=>n.isPresent(t))}static isPresent(t){return null!=t&&""!==t}static isBlank(t){return!n.isPresent(t)}static isRedirectLink(t){let e=n.convertString(t.attr("href"));return!(""===e||e.match("^#"))}static preventDefaultNotRedirectLink(t,e){n.isRedirectLink(t)||e.preventDefault()}}e(n,"convertNumber",t=>void 0===t?0:+t);var s=i(4652);let a=window;class o{static confirm(t){return a.confirm(t)}static get localStorage(){try{return a.localStorage}catch(e){let t=n.noOperation;return{setItem:t,getItem:t,removeItem:t}}}static get ga(){return a.ga}static get Intercom(){return a.Intercom}static _generateParsedQuerystring(t){let e=s.qg(t.replace(/^\?/,""));for(let t in e){if(!t.match(/\[\]$/))continue;let i=e[t];e[t]=Array.isArray(i)?i:[i]}return e}}e(o,"window",a),e(o,"$window",$(a)),e(o,"document",a.document),e(o,"$document",$(a.document)),e(o,"location",a.location),e(o,"gon",a.gon),e(o,"parsedQuerystring",o._generateParsedQuerystring(a.location.search));class l{send(){let t=this._trackerName;
2this._dispfeatures&&this._ga("".concat(t,".require"),"displayfeatures"),this._uid&&this._ga("".concat(t,".set"),"&uid",this._uid),this._ga("".concat(t,".set"),"location",this._location.href.split("#")[0]),this._ga("".concat(t,".send"),"pageview")}static bindToGlobal(){o.window.GAWrapper=l}constructor(t){e(this,"_trackerId",void 0),e(this,"_trackerName",void 0),e(this,"_uid",void 0),e(this,"_dispfeatures",void 0),e(this,"_ga",void 0),e(this,"_location",void 0),this._trackerId=t.trackerId,this._trackerName=t.trackerName,this._uid=t.uid,this._dispfeatures=t.dispfeatures,this._ga=o.ga,this._location=o.location,this._ga("create",this._trackerId,{name:this._trackerName})}}let h=jQuery;var d=i.n(h);class c{static attachCocoonAfterInsert(t){t(),o.$document.on("cocoon:after-insert",t)}}class u{addRoutes(){for(var t=arguments.length,e=Array(t),i=0;i<t;i++)e[i]=arguments[i];this.routes=this.routes.concat(e)}eachAddRoutes(t,e){let i=[];t.each((t,r)=>{i.push(e($(r)))}),this.addRoutes(...i)}executeRouter(){this.routes.forEach(t=>{let[e,i]=t;this.canMethod(e)&&(i instanceof u?i.execute():i(...e))})}execute(){this.executeRouter()}makeRoute(){for(var t=arguments.length,e=Array(t),i=0;i<t;i++)e[i]=arguments[i];return u.makeRoute(...e)}static makeRoute(t){for(var e=arguments.length,i=Array(e>1?e-1:0),r=1;r<e;r++)i[r-1]=arguments[r];return[i,t]}static canAlways(){return!0}constructor(t,i){e(this,"routes",void 0),e(this,"canMethod",void 0),this.routes=t||[],this.canMethod=i||u.isAllExistTargets}}e(u,"isExistTarget",t=>t.length>0),e(u,"isAllExistTargets",t=>t.every(u.isExistTarget));let p="hide",g=$("body");class m extends u{attach(){this.executeRouter()}static attachClickModalShow(t,e){t.on("click",t=>{t.preventDefault(),t.stopPropagation(),m.showModal(e)})}isPageName(t){return this.$body.hasClass(t)}static showModal(t){t.modal("show")}static showElement(t){t.removeClass(p)}static hideElement(t){t.addClass(p)}static toggleElement(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;t.toggleClass(p,void 0===e?e:!e)}static fadeInElement(t){t.hide(),m.showElement(t),t.fadeIn(200)}static goTo(t){o.location.href=t}constructor(...t){super(...t),e(this,"$body",void 0),this.$body=g}}let f="input_helper:additional_form:init",b=".js-additional-form-wrapper",v=".js-additional-form-trigger",y=".js-additional-form-inputs";class w extends c{static init(){w.attachClickShowInputs(o.$document),w.attachChangeToggleInputs(o.$document)}static attachClickShowInputs(t){let e="".concat(b," a").concat(v);t.on("click",e,t=>{let e=d()(t.currentTarget),i=w.fetchTargetInputs(e);t.preventDefault(),m.showElement(i),m.hideElement(e)}).find(e).each((t,e)=>{let i=d()(e);w.fetchTargetInputs(i).is(":hidden")||m.hideElement(i)})}static attachChangeToggleInputs(t){let e=["input","select"].map(t=>"".concat(b," ").concat(t).concat(v)).join(",");t.on("change ".concat(f),e,t=>{let e=d()(t.currentTarget),i=w.fetchTargetInputs(e);w.toggleInputs(e,i)}),w.attachCocoonAfterInsert(()=>{t.find(e).trigger(f)})}static fetchTargetInputs(t){let e=t.closest(b).find(y).first();return e.add(e.siblings(y))}static toggleInputs(t,e){switch(t.prop("type")){case"checkbox":return(t.prop("checked")?w.showInputs:w.hideInputs)(e);case"radio":return w.toggleInputsForRadio(t,e)}(t.val()==="".concat(t.data("additional-form"))?w.showInputs:w.hideInputs)(e)}static toggleInputsForRadio(t,e){let i=t.closest(b).find(v).filter(":checked").val();e.each((e,r)=>{let n,s=d()(r);(((n=s.attr("data-additional-form-inputs-id"))?n.split(" ").includes(i):t.prop("checked"))?w.showInputs:w.hideInputs)(s)})}}function x(t,e){let{feature:i,stage:r}=e;if(!window.Sentry)return;let n=t instanceof Error?t:Error(String(t));window.Sentry.captureException(n,{tags:{feature:i,stage:r},fingerprint:[i,r,n.name]})}function A(t,e,i,r){let{feature:n,stage:s}=r;"abort"!==e&&0!==t.status&&x(i,{feature:n,stage:s})}e(w,"showInputs",t=>{t.show(200,()=>{t.css("display","block")})}),e(w,"hideInputs",t=>{n.clearForm(t),t.hide(200);let e=t.find(v);0!==e.length&&e.each((t,e)=>{w.hideInputs(w.fetchTargetInputs(d()(e)))})});class S{static init(){S.attachKeyupAndChangeZipCode(o.$document)}static attachKeyupAndChangeZipCode(t){let e=null;t.on("keyup change",".js-zip-code",t=>{null!==e&&clearTimeout(e),e=setTimeout(()=>
2{S.complementAddress(d()(t.target).closest(".js-zip-code"))},250)})}static complementAddress(t){let e=S.generateFormIDPrefix(t),i=S.generateZipCode(t,e);7===i.length&&d().ajax({type:"GET",url:"/jpostcode",dataType:"json",data:{q:i}}).done(i=>{let r=i[0];r?S.setAddressForm(t,e,r):S.clearAddressForm(t,e)}).fail((t,e,i)=>{A(t,e,i,{feature:"address_lookup",stage:"fetch"})})}static generateFormIDPrefix(t){let e=t.find("input").eq(0);return"#".concat(e.attr("id").replace("zip_code0",""))}static generateZipCode(t,e){let i="".concat(e,"zip_code"),r=t.find("".concat(i,"0")).val(),n=t.find("".concat(i,"1")).val();return"".concat(r).concat(n)}static setAddressForm(t,e,i){let r=S.dataFormatterForComplementAddress(i),n=t.closest(".js-address-forResident");Object.keys(r).forEach(t=>{n.find("".concat(e).concat(t)).val(r[t])})}static dataFormatterForComplementAddress(t){let e={};["prefecture","prefecture_kana","city","city_kana","town","town_kana","office_name","office_name_kana"].forEach(i=>{e[i]=n.convertString(t[i])});let i=e.prefecture_kana,r=e.city_kana,s=e.town_kana,a=e.office_name_kana,o=i||r||s||a?"".concat(i," ").concat(r," ").concat(s," ").concat(a):"";return o&&(o=o.trim().replace(/\s+/g," ")),{address:"".concat(e.prefecture).concat(e.city).concat(e.town).concat(e.office_name),address_yomi:o,literal_yomi:o,pref:e.prefecture,city:e.city,building:e.office_name,street:e.town}}static clearAddressForm(t,e){S.setAddressForm(t,e,{})}}class T{static init(){T.attach(o.$document)}static attach(t){t.on("shown.bs.modal",".modal",t=>{let e=$(t.currentTarget);T.focusForm(e.find("[autofocus]:first"),e.find(".select2-container:first"))})}static focusForm(t,e){t.length>0?t.focus():e.length>0&&e.select2("focus")}}let _=moment;var E=i.n(_);let C=/[0-9]/g;class k extends c{static init(){k.attachCocoonAfterInsert(k.attach)}static attach(){let t="binded_number_halfwidth_input";d()("input.number_halfwidth:not(.".concat(t,")")).each((e,i)=>{d()(i).on("change",()=>{let t=i.value;""!==t&&null!=t&&(i.value=k.convert(t))}).addClass(t)})}static convert(t){return"".concat(t).replace(C,t=>String.fromCharCode(t.charCodeAt(0)-65248))}}let P="令和",M="平成",D="昭和",I="大正",R="明治",F=[[P,2019,4,30,M],[M,1989,1,7,D],[D,1926,12,24,I],[I,1912,7,29,R]],B={t:1911,T:1911,[I]:1911,s:1925,S:1925,[D]:1925,h:1988,H:1988,[M]:1988,r:2018,R:2018,[P]:2018,m:1867,M:1867,[R]:1867},O="YYYY/MM/DD",L="data-org-input-data",N=new RegExp("^(".concat(Object.keys(B).join("|"),")([0-90-9]{1,2})([:\\/\\-\\.\\s年月日])(.*)$")),U=/^([0-9]{4})\/([0-9]{2})\/([0-9]{2})([\s ]([0-9]{2}):([0-9]{2}))?$/i,j="binded_datepicker_era",z=null;class H extends c{static init(){H.attachCocoonAfterInsert(H.attach)}static attach(){H.attachConvertEra2AD(d()(".datepicker:not(.".concat(j,"),.datetimepicker:not(.").concat(j,")")))}static attachConvertEra2AD(t){t.each((t,e)=>{let i=d()(e),r=i.find("input"),s=i.closest(".form-group").find(".datepicker-era-render,.datetimepicker-era-render"),a=n.curry(H.renderDateEra,s,r);i.addClass(j).datetimepicker(H.generateDatetimePickerConfig(r)).on("dp.change hanica.util.form.clear",t=>{H.formatterEra(t),a()}),r.on("keyup",H.formatterEraKeyup).on("blur",t=>{H.throttleFormatterEraBlur(t,a)}),a()})}static generateDatetimePickerConfig(t){let e,i,r=t.data();return{minDate:(e=r.minDate||"1900/01/01",E()(e,O)),maxDate:(i=r.maxDate||"2100/01/01",E()(i,O)),icons:{time:"fa fa-clock-o",date:"fa fa-calendar",up:"fa fa-chevron-up",down:"fa fa-chevron-down",previous:"fa fa-chevron-left",next:"fa fa-chevron-right",today:"fa fa-crosshairs",clear:"fa fa-tras
2h",close:"fa fa-remove"}}}static renderDateEra(t,e){let i=e.val();t.html(i?H.convertAnyFormatDate2EraDate(i):"")}static formatterEra(t){if(!t.date)return;let e=t.date.creationData().input;e&&H.isEraDate(e)&&(t.target.querySelector("input").value=e)}static formatterEraKeyup(t){let e=t.target;e.setAttribute(L,e.value)}static throttleFormatterEraBlur(t,e){let i=t.target;null!==z&&clearTimeout(z),z=setTimeout(()=>{H.formatterEraBlur(i),e()},10)}static formatterEraBlur(t){let e=t.getAttribute(L);if(!e)return;let i=H.convertEraDate2ADDate(e);i&&(t.value=i)}static isEraDate(t){return!!t.match(N)}static convertEraDate2ADDate(t){let e=k.convert(t).match(N);return e?E()("".concat(H.convertEraYear2ADYear(e[1],e[2])).concat(e[3]).concat(e[4]),O).format(O):""}static convertEraYear2ADYear(t,e){return H.convertEraSign2ADYear(t)+n.convertNumber(e)}static convertEraSign2ADYear(t){return B[t]||B[R]}static convertADDate2EraDate(t){let e=t.match(U);if(!e)return"";let i=n.convertNumber(e[1]),r=n.convertNumber(e[2]),s=n.convertNumber(e[3]),a=!!e[4],o=a?n.convertNumber(e[5]):"",l=a?n.convertNumber(e[6]):"",h=H.convertADDate2EraSign(i,r,s),d=i-H.convertEraSign2ADYear(h);return"".concat(h).concat(d,"年").concat(r,"月").concat(s,"日").concat(a?"".concat(o,"時").concat(l,"分"):"")}static convertADDate2EraSign(t,e,i){for(let[r,n,s,a,o]of F)if(t>n)return r;else if(t===n){if(e>s||e===s&&i>a)return r;return o}return R}static convertAnyFormatDate2EraDate(t){return H.convertADDate2EraDate(H.isEraDate(t)?H.convertEraDate2ADDate(t):t)}static convertADDate2EraYearWithSign(t){let e=t.match(U);if(!e)return"";let i=n.convertNumber(e[1]),r=n.convertNumber(e[2]),s=n.convertNumber(e[3]),a=H.convertADDate2EraSign(i,r,s),o=i-H.convertEraSign2ADYear(a),l=n.lPad(o.toString(),2,"0");return"".concat(a).concat(l)}}let V="disable_auto_complete_".concat(Math.random().toString(36).substring(2)),W="data-disable-auto-complete-actual-name",G="data-disable-auto-complete-fake-name",q="binded_disable_auto_complete";class K extends c{static init(){K.attachCocoonAfterInsert(K.attach)}static attach(){let t=$('form[autocomplete="off"]'),e=Date.now();t.find("[name]:not(.".concat(q,"):not([type=radio]):not([type=hidden])")).each((t,i)=>{let r=$(i);K.addActualNameAttributeAndReplaceNameAttribute(r,"".concat(V,"_").concat(e,"_").concat(t)),r.on("focus",()=>{K.setFakeNameAttribute(r)}),r.on("blur",()=>{K.restoreNameAttribute(r)})});let i=t.filter(":not(.".concat(q,")"));i.on("submit",()=>{t.find(".".concat(q,"[name]")).each((t,e)=>{K.restoreNameAttribute($(e))})}),i.addClass(q)}static addActualNameAttributeAndReplaceNameAttribute(t,e){if(t.attr(W))return;let i="radio"===t.attr("type")?t.closest("form").find("[type='radio'][name='".concat(t.attr("name"),"']")):t;i.attr({[W]:t.attr("name"),[G]:e,autocomplete:"section-".concat(e," off")}),i.addClass(q)}static restoreNameAttribute(t){t.attr("name",t.attr(W))}static setFakeNameAttribute(t){t.attr("name",t.attr(G))}static generateNameAttributeSelector(t){return"[name".concat(t,"],[").concat(W).concat(t,"]")}}class X{static init(){X.attach(o.$document)}static attach(t){t.on("focus","form input[type=number]",t=>{d()(t.currentTarget).on("wheel",t=>{t.preventDefault()})}),t.on("blur","form input[type=number]",t=>{d()(t.currentTarget).off("wheel")})}}class Y{static init(){Y.attach(o.$document)}static attach(t){t.on("keypress","form:not([data-allow-enter-submit])",t=>{Y.stopBubbleupEvent(t)})}static stopBubbleupEvent(t){Y.isSubmitByEnterKey(t)&&(t.preventDefault(),t.stopPropagation())}static isSubmitByEnterKey(t){return 13===t.keyCode&&"textarea"!==t.target.nodeName.toLowerCase()}}function J(t){for(var i=1;i<arguments.length;i++){var r=null!=arguments[i]?arguments[i]:{},n=Object.keys(r);"function"==typeof Object.getOwnPropertySymbols&&(n=n.concat(Object.getOwnPropertySymbols(r).filter(function(t){return Object.getOwnPropertyDescriptor(r,t).enumerable}))),n.forEach(function(i){e(t,i,r[i])})}return t}function Q(t,e){return e=null!=e?e:{},Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):(function(t){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e.push.apply(e,i)}return e}
2)(Object(e)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(e,i))}),t}let Z=Q(J({},{"common/AddressRelationName/FetchError":"Failed to load the relationship list."},{"procedures/CrewSelector/Placeholder":"Find employee","procedures/CrewSelector/InputTooShort":"Enter an employee ID, or their name (full or partial)"},{"common/Pwstrength/Prefix":"Password strength: ","common/Pwstrength/ErrorMessages/WordLength":"Please enter at least %{min} characters.","common/Pwstrength/ErrorMessages/WordNotEmail":"Do not use your email address.","common/Pwstrength/ErrorMessages/WordSimilarToUsername":"Do not include your username in the password.","common/Pwstrength/ErrorMessages/WordRepetitions":"Avoid repeating the same character.","common/Pwstrength/ErrorMessages/WordSequences":"Avoid using sequential characters.","common/Pwstrength/Verdicts/Weak":"Weak","common/Pwstrength/Verdicts/FairlyWeak":"Fairly weak","common/Pwstrength/Verdicts/Medium":"Medium","common/Pwstrength/Verdicts/Strong":"Strong","common/Pwstrength/Verdicts/VeryStrong":"Very strong"}),{common:{FileInput:{browseLabel:"Select file...",fileSizeTooLarge:"Files larger than %{size}MB cannot be selected.",fileSingle:"file",filePlural:"files",removeLabel:"Remove",removeTitle:"Clear selected files",cancelLabel:"Cancel",cancelTitle:"Abort ongoing upload",uploadLabel:"Upload",uploadTitle:"Upload selected files",dropZoneTitle:"Drag & drop files here &hellip;",fileActionSettings:{removeTitle:"Remove file",uploadTitle:"Upload file",indicatorNewTitle:"Not uploaded yet",indicatorSuccessTitle:"Uploaded",indicatorErrorTitle:"Upload Error",indicatorLoadingTitle:"Uploading..."}}}}),tt=Q(J({},{"common/AddressRelationName/FetchError":""},{"procedures/CrewSelector/Placeholder":"","procedures/CrewSelector/InputTooShort":""},{"common/Pwstrength/Prefix":"Kekuatan kata sandi: ","common/Pwstrength/ErrorMessages/WordLength":"Masukkan setidaknya %{min} karakter.","common/Pwstrength/ErrorMessages/WordNotEmail":"Jangan gunakan alamat email Anda.","common/Pwstrength/ErrorMessages/WordSimilarToUsername":"Jangan sertakan nama pengguna dalam kata sandi.","common/Pwstrength/ErrorMessages/WordRepetitions":"Hindari pengulangan karakter yang sama.","common/Pwstrength/ErrorMessages/WordSequences":"Hindari penggunaan karakter berurutan.","common/Pwstrength/Verdicts/Weak":"Lemah","common/Pwstrength/Verdicts/FairlyWeak":"Cukup lemah","common/Pwstrength/Verdicts/Medium":"Sedang","common/Pwstrength/Verdicts/Strong":"Kuat","common/Pwstrength/Verdicts/VeryStrong":"Sangat kuat"}),{common:{FileInput:{browseLabel:"",fileSizeTooLarge:"",fileSingle:"",filePlural:"",removeLabel:"",removeTitle:"",cancelLabel:"",cancelTitle:"",uploadLabel:"",uploadTitle:"",dropZoneTitle:"",fileActionSettings:{removeTitle:"",uploadTitle:"",indicatorNewTitle:"",indicatorSuccessTitle:"",indicatorErrorTitle:"",indicatorLoadingTitle:""}}}}),te=Q(J({},{"common/AddressRelationName/FetchError":"かんけいリストを とれませんでした。"},{"procedures/CrewSelector/Placeholder":"従業員を さがす","procedures/CrewSelector/InputTooShort":"社員番号 または 名前(一部でも OK)を 入れてください"},{"common/Pwstrength/Prefix":"パスワードの つよさ: ","common/Pwstrength/ErrorMessages/WordLength":"%{min}文字 いじょうで 入れてください。","common/Pwstrength/ErrorMessages/WordNotEmail":"メールアドレスを 使わないで ください。","common/Pwstrength/ErrorMessages/WordSimilarToUsername":"パスワードに ユーザー名を 入れないで ください。","common/Pwstrength/ErrorMessages/WordRepetitions":"おなじ 文字を くりかえさないで ください。","common/Pwstrength/ErrorMessages/WordSequences":"つづく 文字を 使わないで ください。","common/Pwstrength/Verdicts/Weak":"よわい","common/Pwstrength/Verdicts/FairlyWeak":"すこし よわい","common/Pwstrength/Verdicts/Medium":"ふつう","common/Pwstrength/Verdicts/Strong":"つよい","common/Pwstrength/Verdicts/VeryStrong":"とても つよい"}),{common:{FileInput:{browseLabel:"ファイルを えらぶ…",fileSizeTooLarge:"%{size}MBより 大きなファイルは えらぶことが できません。",fileSingle:"ファイル",filePlural:"ファイル",removeLabel:"消す",removeTitle:"えらんだ ファイルを 消す",cancelLabel:"キャンセル",cancelTitle:"アップロードを やめる",uploadLabel:"アップロード",uploadTitle:"えらんだ ファイルを アップロード",dropZoneTitle:"ファイルを ここに ドラッグ&ドロップ…",fileActionSettings:{removeTitle:"ファイルを 消す",uploadTitle:"ファイルを アップロード",indicatorNewTitle:"まだ アップロード していません",indicatorSuccessTitle:"アップロードした",indicatorErrorTitle:"アップロードできなかった",indicatorLoadingTitle:"アップロードしています…"}}}}),ti=Q(J({},{"common/AddressRelationName/FetchError":"続柄一覧の取得に失敗しました。"},{"procedures/CrewSelector/Placeholder":"従業員を検索","procedures/CrewSelector/InputTooShort":"社員番号 または 氏名(一部でも可) を入力してください"},{"common/Pwstrength/Prefix":"パスワード強度: ","common/Pwstrength/ErrorMessages/WordLength":"%{min}文字以上で入力してください。","common/Pwstrength/ErrorMessages/WordNotEmail"
2:"Eメールを利用しないでください。","common/Pwstrength/ErrorMessages/WordSimilarToUsername":"パスワードにユーザ名を含めないでください。","common/Pwstrength/ErrorMessages/WordRepetitions":"同じ文字の繰り返しを避けてください。","common/Pwstrength/ErrorMessages/WordSequences":"連続する文字の利用を避けてください。","common/Pwstrength/Verdicts/Weak":"弱","common/Pwstrength/Verdicts/FairlyWeak":"やや弱い","common/Pwstrength/Verdicts/Medium":"普通","common/Pwstrength/Verdicts/Strong":"強い","common/Pwstrength/Verdicts/VeryStrong":"とても強い"}),{common:{FileInput:{browseLabel:"ファイルを選択…",fileSizeTooLarge:"%{size}MBを超えるファイルは選択できません。",fileSingle:"ファイル",filePlural:"ファイル",removeLabel:"削除",removeTitle:"選択したファイルを削除",cancelLabel:"キャンセル",cancelTitle:"アップロードをキャンセル",uploadLabel:"アップロード",uploadTitle:"選択したファイルをアップロード",dropZoneTitle:"ファイルをドラッグ&ドロップ&hellip;",fileActionSettings:{removeTitle:"ファイルを削除",uploadTitle:"ファイルをアップロード",indicatorNewTitle:"まだアップロードされていません",indicatorSuccessTitle:"アップロード済み",indicatorErrorTitle:"アップロード失敗",indicatorLoadingTitle:"アップロード中..."}}}}),tr=Q(J({},{"common/AddressRelationName/FetchError":"관계 목록을 불러오지 못했습니다."},{"procedures/CrewSelector/Placeholder":"직원 검색","procedures/CrewSelector/InputTooShort":"사원번호 또는 이름(일부만 입력해도 됩니다)을 입력해 주세요."},{"common/Pwstrength/Prefix":"비밀번호 강도: ","common/Pwstrength/ErrorMessages/WordLength":"%{min}자 이상 입력해 주세요.","common/Pwstrength/ErrorMessages/WordNotEmail":"이메일 주소를 사용하지 마세요.","common/Pwstrength/ErrorMessages/WordSimilarToUsername":"비밀번호에 사용자 이름을 포함하지 마세요.","common/Pwstrength/ErrorMessages/WordRepetitions":"같은 문자를 반복하지 마세요.","common/Pwstrength/ErrorMessages/WordSequences":"연속된 문자 사용을 피하세요.","common/Pwstrength/Verdicts/Weak":"약함","common/Pwstrength/Verdicts/FairlyWeak":"다소 약함","common/Pwstrength/Verdicts/Medium":"보통","common/Pwstrength/Verdicts/Strong":"강함","common/Pwstrength/Verdicts/VeryStrong":"매우 강함"}),{common:{FileInput:{browseLabel:"파일을 선택",fileSizeTooLarge:"%{size}MB를 초과하는 파일은 선택할 수 없습니다.",fileSingle:"파일",filePlural:"파일",removeLabel:"삭제",removeTitle:"선택한 파일 삭제",cancelLabel:"취소",cancelTitle:"업로드 취소",uploadLabel:"업로드",uploadTitle:"선택한 파일 업로드",dropZoneTitle:"여기에 파일을 끌어다 놓으세요 &hellip;",fileActionSettings:{removeTitle:"파일 삭제",uploadTitle:"파일 업로드",indicatorNewTitle:"아직 업로드되지 않음",indicatorSuccessTitle:"업로드 완료",indicatorErrorTitle:"업로드 실패",indicatorLoadingTitle:"업로드 중..."}}}}),tn={"ja-JP":ti,"ja-JP-x-easy":te,"en-US":Z,"id-ID":tt,"pt-BR":Q(J({},{"common/AddressRelationName/FetchError":"Não foi possível obter a lista de parentesco."},{"procedures/CrewSelector/Placeholder":"Pesquisar funcionários","procedures/CrewSelector/InputTooShort":"Digite o número de funcionário ou o nome (correspondência parcial é aceita)."},{"common/Pwstrength/Prefix":"Força da senha: ","common/Pwstrength/ErrorMessages/WordLength":"Digite pelo menos %{min} caracteres.","common/Pwstrength/ErrorMessages/WordNotEmail":"Não use seu endereço de e-mail.","common/Pwstrength/ErrorMessages/WordSimilarToUsername":"Não inclua seu nome de usuário na senha.","common/Pwstrength/ErrorMessages/WordRepetitions":"Evite repetir o mesmo caractere.","common/Pwstrength/ErrorMessages/WordSequences":"Evite usar caracteres sequenciais.","common/Pwstrength/Verdicts/Weak":"Fraca","common/Pwstrength/Verdicts/FairlyWeak":"Relativamente fraca","common/Pwstrength/Verdicts/Medium":"Média","common/Pwstrength/Verdicts/Strong":"Forte","common/Pwstrength/Verdicts/VeryStrong":"Muito forte"}),{common:{FileInput:{browseLabel:"Procurar…",fileSizeTooLarge:"Não é possível selecionar arquivos que ultrapassam %{size} MB.",fileSingle:"arquivo",filePlural:"arquivos",removeLabel:"Remover",removeTitle:"Remover arquivos selecionados",cancelLabel:"Cancelar",cancelTitle:"Interromper envio em andamento",uploadLabel:"Enviar",uploadTitle:"Enviar arquivos selecionados",dropZoneTitle:"Arraste e solte os arquivos aqui…",fileActionSettings:{removeTitle:"Remover arquivo",uploadTitle:"Carregar arquivo",indicatorNewTitle:"Ainda não carregou",indicatorSuccessTitle:"Carregado",indicatorErrorTitle:"Carregar Erro",indicatorLoadingTitle:"A carregar ..."}}}}),"vi-VN":Q(J({},{"common/AddressRelationName/FetchError":"Không thể tải danh sách mối quan hệ."},{"procedures/CrewSelector/Placeholder":"Tìm kiếm nhân viên","procedures/CrewSelector/InputTooShort":"
2Vui lòng nhập mã nhân viên hoặc họ tên (có thể nhập một phần)."},{"common/Pwstrength/Prefix":"Độ mạnh mật khẩu: ","common/Pwstrength/ErrorMessages/WordLength":"Vui lòng nhập ít nhất %{min} ký tự.","common/Pwstrength/ErrorMessages/WordNotEmail":"Không sử dụng địa chỉ email của bạn.","common/Pwstrength/ErrorMessages/WordSimilarToUsername":"Không bao gồm tên người dùng trong mật khẩu.","common/Pwstrength/ErrorMessages/WordRepetitions":"Tránh lặp lại cùng một ký tự.","common/Pwstrength/ErrorMessages/WordSequences":"Tránh sử dụng các ký tự liên tiếp.","common/Pwstrength/Verdicts/Weak":"Yếu","common/Pwstrength/Verdicts/FairlyWeak":"Hơi yếu","common/Pwstrength/Verdicts/Medium":"Trung bình","common/Pwstrength/Verdicts/Strong":"Mạnh","common/Pwstrength/Verdicts/VeryStrong":"Rất mạnh"}),{common:{FileInput:{browseLabel:"Chọn tệp",fileSizeTooLarge:"Không thể chọn tệp lớn hơn %{size}MB.",fileSingle:"Tệp",filePlural:"Tệp",removeLabel:"Xóa",removeTitle:"Xóa tệp đã chọn",cancelLabel:"Hủy",cancelTitle:"Hủy tải lên",uploadLabel:"Tải lên",uploadTitle:"Tải lên tệp đã chọn",dropZoneTitle:"Kéo và thả tệp vào đây &hellip;",fileActionSettings:{removeTitle:"Xóa tệp",uploadTitle:"Tải lên tệp",indicatorNewTitle:"Chưa tải lên",indicatorSuccessTitle:"Đã tải lên",indicatorErrorTitle:"Tải lên thất bại",indicatorLoadingTitle:"Đang tải lên..."}}}}),"ko-KR":tr,"zh-Hans-CN":Q(J({},{"common/AddressRelationName/FetchError":"获取亲属关系列表失败。"},{"procedures/CrewSelector/Placeholder":"搜索员工","procedures/CrewSelector/InputTooShort":"请输入员工编号或姓名(支持部分匹配)。"},{"common/Pwstrength/Prefix":"密码强度:","common/Pwstrength/ErrorMessages/WordLength":"请输入至少 %{min} 个字符。","common/Pwstrength/ErrorMessages/WordNotEmail":"请勿使用电子邮件地址。","common/Pwstrength/ErrorMessages/WordSimilarToUsername":"请勿在密码中包含用户名。","common/Pwstrength/ErrorMessages/WordRepetitions":"请避免重复相同的字符。","common/Pwstrength/ErrorMessages/WordSequences":"请避免使用连续的字符。","common/Pwstrength/Verdicts/Weak":"弱","common/Pwstrength/Verdicts/FairlyWeak":"较弱","common/Pwstrength/Verdicts/Medium":"一般","common/Pwstrength/Verdicts/Strong":"强","common/Pwstrength/Verdicts/VeryStrong":"非常强"}),{common:{FileInput:{browseLabel:"选择文件…",fileSizeTooLarge:"无法选择超过 %{size}MB 的文件。",fileSingle:"文件",filePlural:"文件",removeLabel:"删除",removeTitle:"删除选中文件",cancelLabel:"取消",cancelTitle:"取消进行中的上传",uploadLabel:"上传",uploadTitle:"上传选中文件",dropZoneTitle:"拖拽文件到这里&hellip;",fileActionSettings:{removeTitle:"删除文件",uploadTitle:"上传文件",indicatorNewTitle:"尚未上传",indicatorSuccessTitle:"已上传",indicatorErrorTitle:"上传失败",indicatorLoadingTitle:"正在上传..."}}}}),"zh-Hant-TW":Q(J({},{"common/AddressRelationName/FetchError":"取得關係列表失敗。"},{"procedures/CrewSelector/Placeholder":"搜尋員工","procedures/CrewSelector/InputTooShort":"請輸入員工編號或姓名(支援部分比對)。"},{"common/Pwstrength/Prefix":"密碼強度:","common/Pwstrength/ErrorMessages/WordLength":"請輸入至少 %{min} 個字元。","common/Pwstrength/ErrorMessages/WordNotEmail":"請勿使用電子郵件地址。","common/Pwstrength/ErrorMessages/WordSimilarToUsername":"請勿在密碼中包含使用者名稱。","common/Pwstrength/ErrorMessages/WordRepetitions":"請避免重複相同的字元。","common/Pwstrength/ErrorMessages/WordSequences":"請避免使用連續的字元。","common/Pwstrength/Verdicts/Weak":"弱","common/Pwstrength/Verdicts/FairlyWeak":"較弱","common/Pwstrength/Verdicts/Medium":"普通","common/Pwstrength/Verdicts/Strong":"強","common/Pwstrength/Verdicts/VeryStrong":"非常強"}),{common:{FileInput:{browseLabel:"瀏覽 …",fileSizeTooLarge:"無法選擇超過%{size}MB的檔案。",fileSingle:"單一檔案",filePlural:"複選檔案",removeLabel:"移除",removeTitle:"清除選取檔案",cancelLabel:"取消",cancelTitle:"取消上傳中檔案",uploadLabel:"上傳",uploadTitle:"上傳選取檔案",dropZoneTitle:"拖曳檔案至此 …",fileActionSettings:{removeTitle:"刪除檔案",uploadTitle:"上傳檔案",indicatorNewTitle:"尚未上傳",indicatorSuccessTitle:"上傳成功",indicatorErrorTitle:"上傳失敗",indicatorLoadingTitle:"上傳中 ..."}}}})},ts="ja-JP",ta={ja:"ja-JP",en:"en-US",ko:"ko-KR",vi:"vi-VN",id:"id-ID",pt:"pt-BR","zh-CN":"zh-Hans-CN","zh-TW":"zh-Hant-TW","ja-JP":"ja-JP","ja-JP-x-easy":"ja-JP-x-easy","ja-easy":"ja-JP-x-easy","en-US":"en-US","i
2d-ID":"id-ID","pt-BR":"pt-BR","vi-VN":"vi-VN","ko-KR":"ko-KR","zh-Hans-CN":"zh-Hans-CN","zh-Hant-TW":"zh-Hant-TW"},to=()=>{var t;let e;return ta[(!("u">typeof window&&window.document)?"":(e=null==(t=window.document.documentElement)?void 0:t.lang)?e.trim():"")||""]||ts},tl=(t,e,i)=>null!=e?String(e):i,th=t=>null!=t&&"object"==typeof t,td=(t,e)=>{let i=tn[t];if(i){if("string"==typeof i[e])return i[e];let t=e.split("/"),r=i;for(let e=0;e<t.length;e+=1){if(!th(r))return;r=r[t[e]]}return"string"==typeof r?r:void 0}},tc=function(){for(var t=arguments.length,e=Array(t),i=0;i<t;i++)e[i]=arguments[i];for(let t=0;t<e.length;t+=1){let i=e[t];if(null!=i)return i}return""},tu=function(t){var e;let i,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{id:n,defaultMessage:s}=t;return i=String((e=to(),tc(td(e,n),td(ts,n),s)||n)),i.replace(/%\{(\w+)\}/g,(t,e)=>tl(e,r[e],"%{".concat(e,"}"))).replace(/\{(\w+)\}/g,(t,e)=>tl(e,r[e],"{".concat(e,"}")))},tp={"ja-JP":"ja","ja-JP-x-easy":"ja-easy","en-US":"en","id-ID":"id","pt-BR":"pt-BR","vi-VN":"vi","ko-KR":"ko","zh-Hans-CN":"zh","zh-Hant-TW":"zh-TW"};var tg=i(9174),tm=i.n(tg);class tf extends c{static init(){tf.attachCocoonAfterInsert(tf.attach),tf.attachSubmitForm(o.$document)}static attach(){d()("input[type=file]:not(.".concat(tf.BINDED_CLASS_FILE_HELPER,")")).each((t,e)=>{let i=d()(e),r=tf.fetchRemoveFileCheckbox(i);i.addClass(tf.BINDED_CLASS_FILE_HELPER);let n=i.hasClass("carrierwave")||i.hasClass("file")?10:30;tf.attachFileSizeError(i,tf.LIMIT_SIZE_HASH[n]),tf.attachFileInput(i,n),i.closest(".form-group").children("div").hasClass("file-input__temporary")&&tf.attachChangeWarningString(i),0!==r.length&&tf.attachChangeFileInput(i,r)})}static attachFileInput(t,e){t.fileinput(tf.generateFileInputParams(t,e))}static attachChangeFileInput(t,e){t.on("change",()=>{t.closest(".file-input").find(".file-preview-frame-for-ie").addClass("hide"),e.prop("checked",!1)})}static attachChangeWarningString(t){t.on("change",()=>{t.closest(".form-group").find(".file-input__temporary").toggleClass("hide",!t.val())})}static attachFileSizeError(t,e){t.on("change",()=>{if(t.val()){let i=t[0].files[0].size>e;i&&t.val(null),t.closest(".file-input").find(".file-size-error-block").toggleClass("hide",!i)}})}static attachSubmitForm(t){t.on("submit","form",t=>{tf.clearUnnecessaryFileInputValue(d()(t.currentTarget))})}static clearUnnecessaryFileInputValue(t){t.find("input[type=file]").each((t,e)=>{let i=d()(e),r=tf.fetchRemoveFileCheckbox(i);0!==r.length&&r.prop("checked")&&i.val("")})}static fetchRemoveFileCheckbox(t){return t.closest(".form-group.carrierwave").find('[name="'.concat(tf.generateRemoveFileCheckboxName(t),'"]'))}static generateRemoveFileCheckboxName(t){let e="remove_",i=t.attr("name");return i.match(/\[.+\]/)?i.replace(/\[([^\[\]]+)?\]$/,"[".concat(e,"$1]")):"".concat(e).concat(i)}static generateFileInputParams(t,e){let i=tu({id:"common/FileInput/browseLabel",defaultMessage:"ファイルを選択…"}),r=tu({id:"common/FileInput/fileSizeTooLarge",defaultMessage:"%{size}MBを超えるファイルは選択できません。"},{size:e}),n=t.data("customized")?{}:{showUpload:!1,showRemove:!1,showPreview:!1,browseClass:"btn btn-default",browseLabel:i},s=["IE","Edge"].includes(tf.UA_PARSER.getBrowser().name)?"":'\n      <div class="pdfjs-canvases pdfjs-canvases-for-file-preview mini" data-url="{data}">\n        <div class="loading"></div>\n      </div>';return Q(J({},n),{language:tp[to()]||tp["ja-JP"],browseIcon:'<i class="fa fa-folder-open"></i>&nbsp;',removeIcon:'<i class="fa fa-trash"></i>',uploadIcon:'<i class="fa fa-upload"></i>',cancelIcon:'<i class="fa fa-ban"></i>',previewFileIcon:'<i class="fa fa-file"></i>',layoutTemplates:{main1:'\n          {preview}\n          <div class="kv-upload-progress hide"></div>\n          <div class="input-group {class}">\n             <div class="input-group-btn">\n                 {remove}\n                 {cancel}\n                 {upload}\n                 {browse}\n             </div>\n             {caption}\n          </div>\n          <div class="file-size-error-block help-block hide">\n            <i class="fa fa-exclamation-circle fa-danger"></i>'.concat(r,"\n          </div>"),caption:'\n          <div class="form-control file-caption {class}">\n            <div class="file-caption-name text-more-muted"></div>\n          </div>',icon:""},previewTemplates:{object:s}})}}e(tf,"BINDED_CLASS_FILE_HELPER","binded_file_helper"),e(tf,"UA_PARSER",new(tm())),e(tf,"LIMIT_SIZE_HASH",{10:0xa00000,30:0x1e00000});class tb{static init(){tb.attachChangeDependentGenderAutoSelect(o.$document)}static attachChangeDependentGenderAutoSelect(t){t.on("change",".js-dependent-gender-auto-select select.js-dependent-relation-select",t=>{let e=d()(t.target);tb.toggleGenderRadioBtn(e.find("option:selected").text(),e.closest(".
2js-dependent-gender-auto-select").find("input.js-dependent-gender"))})}static toggleGenderRadioBtn(t,e){let i=tb.isMale(t)?"male":"female";e.prop("checked",!1),e.filter('[value="'.concat(i,'"]')).prop("checked",!0)}static isMale(t){return!/(お母さん|お姉さん|おばあさん|おばさん|女の子ども|(女)|妻(つま)|外孙女|孙女|孫女|外甥女|侄女|姪女)/.test(t)&&!!t.match(RegExp("父|男|兄|弟|息|甥|夫|お父さん|おじいさん|おじさん|お兄さん|男の子ども|(男)|Husband|Father|Son|Brother|Uncle|Nephew|Grandfather|Grandson|(?<!Mẹ )Chồng|Bố|Cha|trai|Anh trai|^Anh$|Ông|Chú|cậu|Suami|Ayah|Putra|laki-laki|Kakek|Paman|Marido|Pai|Filho|Irmão|Avô|Neto|Tio|Sobrinho|Sogro|남편|실부|의부|장남|차남|삼남|사남|오남|형|오빠|남동생|할아버지|손자|삼촌|남조카|丈夫|生父|次子|三子|四子|五子|弟弟|祖父|外甥(?!女)|配偶父亲|长子|兄长|外祖父|孙子|外孙(?!女)|叔父|舅父|侄子|公公|岳父|長子|哥哥|孫子|叔叔|舅舅|姪子","i"))}}var tv=i(3093);let ty={"(":"(",")":")",".":".","/":"/"};class tw extends c{static init(){tw.attachCocoonAfterInsert(tw.attach)}static attach(){tw.initAutoKana(),tw.initHanToZen()}static initAutoKana(){let t="binded_autokana";d()("input.katakana:not(.".concat(t,")")).each((e,i)=>{let r=d()(i),n=r.attr("id"),s=n.replace(/(_yomi|ヨミ)$/,"");if(n===s||0===d()("#".concat(s)).length)return!0;d().fn.autoKana("#".concat(s),"#".concat(n),{katakana:!0}),r.addClass(t)})}static initHanToZen(){let t="binded_kanahantozen";d()("input.katakana:not(.".concat(t,")")).each((e,i)=>{let r=d()(i);r.on("change",()=>{let t=tv.HanZenKaku.h2z(r.val());t=t.replace(/-/g,"-"),t=tw.hanToZenByBankAccount(r.attr("id"),t),r.val(t)}),r.addClass(t)})}static hanToZenByBankAccount(t,e){return(null==t?void 0:t.includes("bank-account-holder-name"))?e.replace(/[()./]/g,t=>ty[t]):e}}class tx extends c{static init(){tx.attachCocoonAfterInsert(tx.attach)}static attach(){let t="binded_provisional_fieldset";d()("".concat(tx.selector,":not(.").concat(t,")")).each((e,i)=>{let r=d()(i);tx.toggleDisableInputs(r),r.addClass(t)})}static toggleDisableInputs(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0;void 0!==e&&t.attr("data-disabled",e?"true":"false"),tx._toggleNestedDisableInputs(t,e)}static _toggleNestedDisableInputs(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,i=tx.getEmulatedDisabled(t);if(n.toggleDisableInputs(t,i,void 0!==e?void 0:tx.inputSelector),i)return;let r=t.find(tx.selector);if(r.length>0)return void r.each((t,i)=>{tx._toggleNestedDisableInputs(d()(i),e)})}static getEmulatedDisabled(t){if("true"===t.attr("data-disabled"))return!0;let e=t.parent().closest(tx.selector);return e.length>0&&tx.getEmulatedDisabled(e)}}e(tx,"selector",".js-provisional-fieldset"),e(tx,"inputSelector",["input","select","textarea"].map(t=>"".concat(t,":not([disabled=disabled])")).join(","));class tA extends c{static init(){tA.attachCocoonAfterInsert(tA.attach)}static attach(){let t="binded_roman_upper_case_input";d()("input.roman_upper_case:not(.".concat(t,")")).each((e,i)=>{d()(i).on("change",()=>{i.value=tA.convert(n.convertString(i.value))}).addClass(t)})}static convert(t){return t.toUpperCase()}}var tS=i(6772);class tT{static init(){tT.initDepartmentSelect2(),tT.initSelect2Clear()}static initDepartmentSelect2(){let t="binded_departmentinput",e=d()(".js-department-select2:not(.".concat(t,")"));if(0===e.length){d()(".js-adding-department-fields").length>0&&tT.fetchJSON(n.noOperation);return}tT.fetchJSON(()=>{tT.attachSelect2(e)}),e.addClass(t)}static initSelect2Clear(){let t=d()(".js-crew-job-assignment-clear:not(.".concat("binded_item_clear_input",")"));0!==t.length&&t.on("click",t=>{let e=d()(t.currentTarget).closest(".js-crew-job-assignment").find(".js-crew-job-assignment-item-id");e.val(""),e.trigger("change.select2")})}static fetchJSON(t){let e=tT.STORE;if(null===e.departments){e.departments=!1;let i="crew[valid_from]",r=o.parsedQuerystring[i];d().ajax({url:"/departments.json".concat(r?"?".concat(i,"=").concat(r):""),dataType:"json"}).done(i=>{e.departments=tT.generateFormattedJSON(i),t()}).fail((t,e,i)=>{A(t,e,i,{feature:"select2_department",stage:"fetchJSON"})})}else e.departments&&t()}static generateFormattedJSON(t){return t.map(t=>({id:t.id,text:tS.inHTMLData(t.hierarchy_name)}))}static attachSelect2(t){let e=tT.STORE;t.select2({placeholder:"部署を検索",data:e.departments})}}e(tT,"STORE",{departments:null});class t_{static init(){t_.initJobTitleSelect2()}static initJobTitleSelect2(){let t="binded_job_title_input",e=d()(".js-job-title-select2:not(.".concat(t,")"));if(0===e.length){d()(".js-adding-job-title-fields").length>0&&t_.fetchJSON(n.noOperation);return}t_.fetchJSON(()=>{t_.attachSelect2(e)}),e.addClass(t)}static fetchJSON(t){let e=t_.STORE;
2if(null===e.jobTitles){e.jobTitles=!1;let i="crew[valid_from]",r=o.parsedQuerystring[i];d().ajax({url:"/job_titles.json".concat(r?"?".concat(i,"=").concat(r):""),dataType:"json"}).done(i=>{e.jobTitles=t_.generateFormattedJSON(i),t()}).fail((t,e,i)=>{A(t,e,i,{feature:"select2_job_title",stage:"fetchJSON"})})}else e.jobTitles&&t()}static generateFormattedJSON(t){return t.map(t=>({id:t.id,text:tS.inHTMLData(t.name)}))}static attachSelect2(t){let e=t_.STORE;t.select2({placeholder:"役職を検索",data:e.jobTitles})}}e(t_,"STORE",{jobTitles:null});class tE{static init(){tE.initWorkLocationSelect2()}static initWorkLocationSelect2(){let t="binded_work_location_input",e=d()(".js-work-location-select2:not(.".concat(t,")"));0!==e.length&&(tE.fetchJSON(()=>{tE.attachSelect2(e)}),e.addClass(t))}static fetchJSON(t){let e=tE.STORE;null===e.workLocations?(e.workLocations=!1,d().ajax({url:"/work_locations.json",dataType:"json"}).done(i=>{e.workLocations=tE.generateFormattedJSON(i),t()}).fail((t,e,i)=>{A(t,e,i,{feature:"select2_work_location",stage:"fetchJSON"})})):e.workLocations&&t()}static generateFormattedJSON(t){return t.map(t=>({id:t.id,text:tS.inHTMLData(t.name)}))}static attachSelect2(t){let e=tE.STORE;t.select2({placeholder:"勤務地を検索",data:e.workLocations})}}e(tE,"STORE",{workLocations:null});class tC{static generateFreewordSelectQuery(t){return e=>{tC.bindFreewordSelectQuery(e,t)}}static bindFreewordSelectQuery(t,e){let i=e.filter(e=>!t.term||t.matcher(t.term,e.text));t.term&&i.push({id:t.term,text:t.term}),t.callback({results:i})}}class tk{static showServerSideAlert(){let t=d()(".smarthr_server_side_alert");if(0===t.length)return;let e=t.last(),{type:i,duration:r}=e.data();tk.show(e.html(),i,r,!0)}static show(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"warning",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1e4,r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=tk.generateMessageElement(t,e,r);function s(){tk.remove()}tk.remove(),d()("main").prepend(n),n.find(".smarthr_alert_container_closer").on("click",s),setTimeout(()=>{n.fadeOut("slow",s)},i)}static getContainer(){return d()(".smarthr_alert_container")}static hide(t){tk.getContainer().fadeOut(t,()=>{tk.remove()})}static remove(){tk.getContainer().remove()}static generateMessageElement(t,e,i){return d()('<div class="smarthr_alert_container animated bounce">\n      <div class="alert alert-'.concat(e,'">\n        <span class="right-buffer-10">').concat(i?t:tS.inHTMLData(t),'</span>\n        <span class="smarthr_alert_container_closer text-more-muted">&times;</span>\n      </div>\n    </div>'))}}class tP extends tC{static init(){let t="binded_address_relation_input",e=d()("input.js-address-relation-name:not(.".concat(t,")"));0!==e.length&&tP.fetchJSON(()=>{e.each((e,i)=>{let r=d()(i);tP.attachSelect2(r),r.addClass(t)})})}static fetchJSON(t){let e=tP.STORE;if(null===e.dependent_relations){let i="crew[valid_from]",r=o.parsedQuerystring[i];d().ajax({url:"/dependent_relations.json".concat(r?"?".concat(i,"=").concat(r):""),dataType:"json"}).done(i=>{e.dependent_relations=i,t()}).fail(()=>{tk.show(tu({id:"common/AddressRelationName/FetchError",defaultMessage:"続柄一覧の取得に失敗しました。"}),"danger")})}else e.dependent_relations&&t()}static attachSelect2(t){let e=t.data("selfOptionId"),i=e?[{id:e,text:t.data("selfOptionLabel")}]:[];t.select2(tP.generateSelectOptions(i))}static generateSelectOptions(t){let e=t.concat(tP.STORE.dependent_relations);return{allowClear:!0,width:"10em",initSelection:(t,i)=>{let r=d()(t).val();r&&i(e.find(t=>t.id===r)||{id:r,text:r})},query:tP.generateFreewordSelectQuery(e)}}}e(tP,"STORE",{dependent_relations:null});class tM{static init(){tM.initProxySubmissionSettingsSelect2()}static initProxySubmissionSettingsSelect2(){let t="binded_proxy_submission_settings_input",e=d()(".js-proxySubmissionSettings-select2:not(.".concat(t,")"));if(0===e.length){d()(".js-adding-proxy-submission-settings-fields").length>0&&tM.fetchJSON(n.noOperation);return}tM.fetchJSON(()=>{tM.attachSelect2(e)}),e.addClass(t)}static fetchJSON(t){let e=tM.STORE;null===e.proxySubmissionSettings?(e.proxySubmissionSettings=!1,d().ajax({url:"/api/internal/hanica/proxy_submission_settings/combobox.json",dataType:"json"}).done(i=>{e.proxySubmissionSettings=tM.generateFormattedJSON(i),t()}).fail((t,e,i)=>{A(t,e,i,{feature:"select2_proxy_submission_settings",stage:"fetchJSON"})})):e.proxySubmissionSettings&&t()}static generateFormattedJSON(t){return t.map(t=>{let[e,i]=t;return{id:i,text:tS.inHTMLData(e)}})}static attachSelect2(t){let e=tM.STORE;t.select2({placeholder:"代理提出設定を検索",data:e.proxySubmissionSettings})}}e(tM,"STORE",{proxySubmissionSettings:null});class tD extends c{static init(){tD.attachCocoonAfterInsert(tD.attach)}static attach(){tT.init(),t_.init(),tE.init(),tP.init(),tM.init()}}class tI extends c{static init(){"iOS"===tI.UA_PARSER.getOS().name&&tI.attachCocoonAfterInsert(tI.attach)}static attach(){d()("select:not(.".concat(tI.bindedclass,")")).each((t,e)=>{tI.insertOptGroup(e),d()(e).addClass(tI.bindedclass)})}static createOptGroupElement(){return document.createElement("optgroup")}static insertOptGroup(t){t.appendChild(tI.createOptGroupElement())}}e(tI,"UA_PARSER",new(tm())),e(tI,"bindedclass","binded_insert_optgroup");class tR{static init(){tR.attach(o.$document)}static attach(t){t.on("click ".concat(tR.triggerEvent),tR.selector,t=>{tR.disableAndReplaceText(t.currentTarget)})}static disableAndReplaceText(t){let e=$(t),i=e.attr(tR.attribute);switch(e.prop("disabled",!0),t.tagName.toLowerCase()){case"input":e.val(i);break;case"button":e.text(i)}}}e(tR,"attribute","data-disable-with"),e(tR,"selector",['input[type="submit"]',"button"].map(t=>
2"".concat(t,"[data-disable-with]:not(form [data-disable-with])")).join(",")),e(tR,"triggerEvent","disableAndReplaceText.dataDisableWithOutOfForm");class tF extends c{static init(){let t="binded_dependent_relation_name_input",e=d()(".dependent-relation-field:not(.".concat(t,")"));0!==e.length&&(tF.attachEvents(e),e.addClass(t))}static attachEvents(t){let e=new u;t.each((t,i)=>{let r=d()(i),n=r.find(":radio"),s=r.find("select option");e.addRoutes(e.makeRoute(tF.attachChangeRadioForFilterOptions,n,s),e.makeRoute(tF.attachChangeRadioForSelectBank,n,s),e.makeRoute(tF.attachChangeRadioForToggleDisableTaxLawSupportType,n,r.closest(".dependentFormWrapper").find(".js-tax-law-support-type-input").filter('[value="special_spousal_exemption"]')))}),e.execute()}static attachChangeRadioForFilterOptions(t,e){let i=()=>{tF.filterOptions(e,t.filter(":checked").val())};i(),t.on("change",i)}static attachChangeRadioForSelectBank(t,e){t.on("change",()=>{tF.selectBlankIfNotSelected(e)})}static attachChangeRadioForToggleDisableTaxLawSupportType(t,e){let i=()=>{tF.toggleDisableSpecialSpousalExemptionSupported(e,"true"===t.filter(":checked").val())};i(),t.on("change",i)}static filterOptions(t,e){let i=t.filter(":not(:first)");m.hideElement(i),i.prop("disabled",!0);let r=i.filter("[data-spouse=".concat(e,"]"));m.showElement(r),r.prop("disabled",!1)}static selectBlankIfNotSelected(t){t.prop("selected",!1),t.filter(":first").prop("selected",!0)}static toggleDisableSpecialSpousalExemptionSupported(t,e){t.prop({disabled:!e,checked:!!e&&t.prop("checked")}),t.trigger("change")}}class tB extends c{static init(){tB.attachCocoonAfterInsert(tB.attach)}static attach(){tF.init()}}class tO{static init(){tO.attach(o.$document)}static attach(t){t.on("submit","form",t=>{tO.disableNullFileInput($(t.currentTarget))})}static disableNullFileInput(t){t.find("input[type=file]").each((t,e)=>{let i=$(e);i.val()||i.prop("disabled",!0)})}}class tL{static init(){tL.attach(o.$document)}static attach(t){t.on("blur",".input-group.yen>input",t=>{let e=$(t.currentTarget),i=e.val(),r=i.trim();i!==r&&e.val(r)})}}let tN=".js-tax-cd-wrapper",tU=".js-tax-cd-select",tj=".js-tax-cd-hidden",tz=".js-tax-cd-radio";class tH{static init(){tH.attachInputForm(o.$document),tH.updateTaxCd(o.$document)}static attachInputForm(t){tH.changeStateSelectBox(),t.on("change",tz,()=>{tH.changeStateSelectBox()})}static updateTaxCd(t){t.on("change",tU,t=>{let e=d()(t.target);e.closest(tN).find(tj).val(e.val())}),t.on("change",tz,t=>{let e=d()(t.target),i=e.closest(tN),r=i.find(tj),n=i.find(tU),s=e.val();r.val("other"===s?n.val():s)})}static changeStateSelectBox(){let t=d()(tU),e=d()("".concat(tz,":checked")).val();void 0!==e&&"other"!==e||void 0===e?t.prop("disabled",!0).trigger("change"):!0!==d()(tz).prop("disabled")&&t.prop("disabled",!1).trigger("change")}}class t$ extends c{static init(){"iOS"===t$.UA_PARSER.getOS().name&&t$.attachCocoonAfterInsert(t$.attach)}static attach(){d()('select[required], input[type="radio"][required]').prop("required",!1)}}e(t$,"UA_PARSER",new(tm()));let tV=".js-industry-category-select",tW=".js-industry-subcategory-select";class tG{static init(){tG.industryCategories=d()("#js-industry-category-data").data("categories")||[],tG.setInitialSubcategoryOptions(),tG.registerInputEvents(o.$document)}static registerInputEvents(t){t.on("change",tV,t=>{let e=d()(t.target).val();tG.setSubcategoryOptions(e),tG.toggleDisbledSubcategorySelects(!e)})}static setInitialSubcategoryOptions(){let t=d()(tV).val();t&&tG.setSubcategoryOptions(t),tG.toggleDisbledSubcategorySelects(!t)}static setSubcategoryOptions(t){let e=d()(tW);if(0===e.length||0===tG.industryCategories.length)return;let i=tG.industryCategories.find(e=>e.id===t);e.each((t,e)=>{let r=d()(e),n=r.val();r.empty().append(d()("<option>",{value:""})),i&&i.subcategories.forEach(t=>{r.append(d()("<option>",{value:t.id,text:t.name})),t.id===n&&r.val(t.id)})})}static toggleDisbledSubcategorySelects(t){d()(tW).each((e,i)=>{let r=d()(i);r.prop("disabled",t),t&&r.val("")})}}e(tG,"industryCategories",[]);class tq{static initAllHelpers(){$("#reactRoot").length>0||[H,tf,tw,k,tx,tA,tD,tB,w,S,T,K,X,Y,tb,tR,tO,tL,tH,tG,tI,t$].forEach(t=>{t.init()})}}class tK{attach(){let t=this.elements;t.$searchBox.length>0&&t.$searchBtn.length>0&&this.attachExecuteSearch(),t.$filterTriggers.length>0&&this.attachExecuteFilter()}attachExecuteSearch(){let t=this.elements.$searchBox,e=this.elements.$searchBtn,i=i=>{i.preventDefault(),t.add(e).prop("disabled",!0),e.text(e.data("disable-with")),this.execute({[t.attr("name")]:t.val()})};e.on("click",i),t.on("keypress",t=>{13===t.keyCode&&i(t)})}attachExecuteFilter(){this.elements.$filterTriggers.on("click",t=>{t.preventDefault();let e=$(t.currentTarget).data();this.execute({[e.paramname]:e.value})})}get(t){return this.store[t]}upsert(t,e){return this.store[t]=e,this}upserts(t){return Object.entries(t).forEach(t=>{let[e,i]=t;this.upsert(e,i)}),this}del(t){return delete this.store[t],this}execute(t){t&&this.upserts(t),this.del("page"),o.location.search=this.generateQuerystring()}generateQuerystring(){return s.As(this.store)}constructor(){e(this,"store",void 0),e(this,"elements",void 0),this.store=tK._store;let t=".js-ransack-",i=$("".concat(t,"search")),r=$("".concat(t,"filter"));this.elements={$searchBox:i.find("".concat(t,"searchbox")),$searchBtn:i.find("button"),$filterTriggers:r.find("".concat(t,"filter-trigger"))}}}e(tK,"_store",J({},o.parsedQuerystring));class tX extends m{static getTargets(){return d()('a[target=_blank]:not([rel*="noopener"])')}static attachCocoonAfterInsert(){o.$document.on("cocoon:after-insert",()=>{tX.attrRelAttrWithNoOpenerAndReferrer(tX.getTargets())})}static attrRelAttrWithNoOpenerAndReferrer(t){t.each(function(){let t=d()(this),e=t.attr("href");if(e)try{new URL(e).hostname.endsWith("smarthr.jp")?(t.attr("rel","noopener"),t.attr("referrerpolicy","no-referrer-when-downgrade")):t.attr("rel","noopener noreferrer")}catch(e){t.attr("rel","noopener noreferrer")}})}constructor(){super(),this.addRoutes(this.makeRoute(tX.attrRelAttrWithNoOpenerAndReferrer,tX.getTargets())),tX.attachCocoonAfterInsert()}}class tY extends m{static attachClickShowMoreContent(t){t.on("click",".help-block a",t=>
2{let e=d()(t.currentTarget),i=e.closest(".js-moreContents").find(".form-group");0!==i.length&&(t.preventDefault(),tY.showMoreContent(i,e))})}static showMoreContent(t,e){tY.showElement(t),tY.hideElement(e)}constructor(){super(),this.addRoutes(this.makeRoute(tY.attachClickShowMoreContent,o.$document))}}class tJ extends m{static sendTrackErrors(){d()(()=>{setTimeout(()=>{let t=o.Intercom;null!=t&&(tJ.sendTrackErrorEventIfHasAlert(t,d()(".alert-block:not(:empty) li"),d()("#flash_alert")),tJ.sendTrackErrorEventIfHasHttpError(t,d()(".js-httpError")))},100)})}static sendTrackErrorEventIfHasAlert(t,e,i){let r=e.map(function(){return d()(this).text()}).get(),n=i.text();if(0===r.length&&!n)return;let s={};r.forEach((t,e)=>{s["alert".concat(e+1)]=t}),n&&(s.flash=n),t("trackEvent","validation-faild",s)}static sendTrackErrorEventIfHasHttpError(t,e){e.each(function(){t("trackEvent","http-error-occurred",{status_code:d()(this).attr("data-error-code")})})}constructor(){super(),this.addRoutes(this.makeRoute(tJ.sendTrackErrors))}}class tQ extends m{static attachSelect2(t){t.select2({placeholder:"テナントを検索",allowClear:!0})}static attachChangeGoTo(t){t.on("change",()=>{tQ.goTo(t.val())})}constructor(){super();let t=d()("select.js-tenant-selector-select2");this.addRoutes(this.makeRoute(tQ.attachSelect2,t)),this.eachAddRoutes(t,t=>this.makeRoute(tQ.attachChangeGoTo,t))}}class tZ extends m{static replaceTelNumberText(t){t.wrap("<a href='tel:".concat(t.text(),"'></a>"))}constructor(){if(super(),"mobile"!==tZ.PARSER.getDevice().type)return;this.eachAddRoutes(d()(".text-telephone"),t=>this.makeRoute(tZ.replaceTelNumberText,t))}}e(tZ,"PARSER",new(tm()));class t0 extends m{static replace(t){let e="REPLACE_URL_TEMP_HTTP_PROTOCOL_".concat(Math.random().toString().slice(-8));[...t.find("a[href^=http]")].reverse().forEach(t=>{let i=d()(t);i.attr("href",i.attr("href").replace(/^http/,e)),i.html(i.html().replace(/http(s)?:\/\//g,"".concat(e,"$1://")))}),t.html(t.html().replace(/(http(s)?:\/\/([^\s\t\r\n<]+))/g,'<a href="$1" target="_blank" rel="noopener noreferrer">$1</a>').replace(RegExp(e,"g"),"http"))}constructor(){super(),this.eachAddRoutes(d()(".replace_url"),t=>this.makeRoute(t0.replace,t))}}var t1={9306(t,e,i){var r=i(4901),n=i(6823),s=TypeError;t.exports=function(t){if(r(t))return t;throw new s(n(t)+" is not a function")}},3506(t,e,i){var r=i(3925),n=String,s=TypeError;t.exports=function(t){if(r(t))return t;throw new s("Can't set "+n(t)+" as a prototype")}},7080(t,e,i){var r=i(4402).has;t.exports=function(t){return r(t),t}},3463(t){var e=TypeError;t.exports=function(t){if("string"==typeof t)return t;throw new e("Argument is not a string")}},4328(t,e,i){var r=i(4995),n=new r.WeakMap,s=r.set,a=r.remove;t.exports=function(t){return s(n,t,1),a(n,t),t}},6557(t,e,i){var r=i(4995).has;t.exports=function(t){return r(t),t}},6469(t,e,i){var r=i(608),n=i(2360),s=i(4913).f,a=r("unscopables"),o=Array.prototype;void 0===o[a]&&s(o,a,{configurable:!0,value:n(null)}),t.exports=function(t){o[a][t]=!0}},679(t,e,i){var r=i(1625),n=TypeError;t.exports=function(t,e){if(r(e,t))return t;throw new n("Incorrect invocation")}},3972(t,e,i){var r=i(34),n=String,s=TypeError;t.exports=function(t){if(void 0===t||r(t))return t;throw new s(n(t)+" is not an object or undefined")}},8551(t,e,i){var r=i(34),n=String,s=TypeError;t.exports=function(t){if(r(t))return t;throw new s(n(t)+" is not an object")}},4154(t,e,i){var r=i(6955),n=TypeError;t.exports=function(t){if("Uint8Array"===r(t))return t;throw new n("Argument is not an Uint8Array")}},7811(t){t.exports="u">typeof ArrayBuffer&&"u">typeof DataView},7394(t,e,i){var r=i(4576),n=i(6706),s=i(2195),a=r.ArrayBuffer,o=r.TypeError;t.exports=a&&n(a.prototype,"byteLength","get")||function(t){if("ArrayBuffer"!==s(t))throw new o("ArrayBuffer expected");return t.byteLength}},3238(t,e,i){var r=i(4576),n=i(7811),s=i(7394),a=r.DataView;t.exports=function(t){if(!n||0!==s(t))return!1;try{return new a(t),!1}catch(t){return!0}}},5169(t,e,i){var r=i(3238),n=TypeError;t.exports=function(t){if(r(t))throw new n("ArrayBuffer is detached");return t}},5636(t,e,i){var r=i(4576),n=i(9504),s=i(6706),a=i(7696),o=i(5169),l=i(7394),h=i(4483),d=i(1548),c=r.structuredClone,u=r.ArrayBuffer,p=r.DataView,g=Math.max,m=Math.min,f=u.prototype,b=p.prototype,v=n(f.slice),y=s(f,"resizable","get"),w=s(f,"maxByteLength","get"),x=n(b.getInt8),A=n(b.setInt8);
vendor: 21,888 bytes, line 2
2t.exports=(d||h)&&function(t,e,i){var r,n=l(t),s=void 0===e?n:a(e),f=!y||!y(t);if(o(t),d&&(t=c(t,{transfer:[t]}),n===s&&(i||f)))return t;if(n>=s&&(!i||f))r=v(t,0,s);else{var b=i&&!f&&w?{maxByteLength:g(s,w(t))}:void 0;r=new u(s,b);for(var S=new p(t),T=new p(r),_=m(s,n),E=0;E<_;E++)A(T,E,x(S,E))}return d||h(t),r}},4644(t,e,i){var r,n,s,a=i(7811),o=i(3724),l=i(4576),h=i(4901),d=i(34),c=i(9297),u=i(6955),p=i(6823),g=i(6699),m=i(6840),f=i(2106),b=i(1625),v=i(2787),y=i(2967),w=i(608),x=i(3392),A=i(1181),S=A.enforce,T=A.get,_=l.Int8Array,E=_&&_.prototype,C=l.Uint8ClampedArray,k=C&&C.prototype,P=_&&v(_),M=E&&v(E),D=Object.prototype,I=l.TypeError,R=w("toStringTag"),F=x("TYPED_ARRAY_TAG"),B="TypedArrayConstructor",O=a&&!!y&&"Opera"!==u(l.opera),L=!1,N={Int8Array:1,Uint8Array:1,Uint8ClampedArray:1,Int16Array:2,Uint16Array:2,Int32Array:4,Uint32Array:4,Float32Array:4,Float64Array:8},U={BigInt64Array:8,BigUint64Array:8},j=function(t){var e=v(t);if(d(e)){var i=T(e);return i&&c(i,B)?i[B]:j(e)}},z=function(t){if(!d(t))return!1;var e=u(t);return c(N,e)||c(U,e)};for(r in N)(s=(n=l[r])&&n.prototype)?S(s)[B]=n:O=!1;for(r in U)(s=(n=l[r])&&n.prototype)&&(S(s)[B]=n);if((!O||!h(P)||P===Function.prototype)&&(P=function(){throw new I("Incorrect invocation")},O))for(r in N)l[r]&&y(l[r],P);if((!O||!M||M===D)&&(M=P.prototype,O))for(r in N)l[r]&&y(l[r].prototype,M);if(O&&v(k)!==M&&y(k,M),o&&!c(M,R))for(r in L=!0,f(M,R,{configurable:!0,get:function(){return d(this)?this[F]:void 0}}),N)l[r]&&g(l[r].prototype,F,r);t.exports={NATIVE_ARRAY_BUFFER_VIEWS:O,TYPED_ARRAY_TAG:L&&F,aTypedArray:function(t){if(z(t))return t;throw new I("Target is not a typed array")},aTypedArrayConstructor:function(t){if(h(t)&&(!y||b(P,t)))return t;throw new I(p(t)+" is not a typed array constructor")},exportTypedArrayMethod:function(t,e,i,r){if(o){if(i)for(var n in N){var s=l[n];if(s&&c(s.prototype,t))try{delete s.prototype[t]}catch(i){try{s.prototype[t]=e}catch(t){}}}(!M[t]||i)&&m(M,t,i?e:O&&E[t]||e,r)}},exportTypedArrayStaticMethod:function(t,e,i){var r,n;if(o){if(y){if(i){for(r in N)if((n=l[r])&&c(n,t))try{delete n[t]}catch(t){}}if(P[t]&&!i)return;try{return m(P,t,i?e:O&&P[t]||e)}catch(t){}}for(r in N)(n=l[r])&&(!n[t]||i)&&m(n,t,e)}},getTypedArrayConstructor:j,isView:function(t){if(!d(t))return!1;var e=u(t);return"DataView"===e||c(N,e)||c(U,e)},isTypedArray:z,TypedArray:P,TypedArrayPrototype:M}},5370(t,e,i){var r=i(6198);t.exports=function(t,e,i){for(var n=0,s=arguments.length>2?i:r(e),a=new t(s);s>n;)a[n]=e[n++];return a}},9617(t,e,i){var r=i(5397),n=i(5610),s=i(6198),a=function(t){return function(e,i,a){var o,l=r(e),h=s(l);if(0===h)return!t&&-1;var d=n(a,h);if(t&&i!=i){for(;h>d;)if((o=l[d++])!=o)return!0}else for(;h>d;d++)if((t||d in l)&&l[d]===i)return t||d||0;return!t&&-1}};t.exports={includes:a(!0),indexOf:a(!1)}},4527(t,e,i){var r=i(3724),n=i(4376),s=TypeError,a=Object.getOwnPropertyDescriptor;t.exports=r&&!function(){if(void 0!==this)return!0;try{Object.defineProperty([],"length",{writable:!1}).length=1}catch(t){return t instanceof TypeError}}()?function(t,e){if(n(t)&&!a(t,"length").writable)throw new s("Cannot set read only .length");return t.length=e}:function(t,e){return t.length=e}},7680(t,e,i){t.exports=i(9504)([].slice)},2804(t){var e="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=e+"+/",r=e+"-_",n=function(t){for(var e={},i=0;i<64;i++)e[t.charAt(i)]=i;return e};t.exports={i2c:i,c2i:n(i),i2cUrl:r,c2iUrl:n(r)}},6319(t,e,i){var r=i(8551),n=i(9539);t.exports=function(t,e,i,s){try{return s?e(r(i)[0],i[1]):e(i)}catch(e){n(t,"throw",e)}}},2195(t,e,i){var r=i(9504),n=r({}.toString),s=r("".slice);t.exports=function(t){return s(n(t),8,-1)}},6955(t,e,i){var r=i(2140),n=i(4901),s=i(2195),a=i(608)("toStringTag"),o=Object,l="Arguments"===s(function(){return arguments}()),h=function(t,e){try{return t[e]}catch(t){}};t.exports=r?s:function(t){var e,i,r;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(i=h(e=o(t),a))?i:l?s(e):"Object"===(r=s(e))&&n(e.callee)?"Arguments":r}},7740(t,e,i){var r=i(9297),n=i(5031),s=i(7347),a=i(4913);t.exports=function(t,e,i){for(var o=n(e),l=a.f,h=s.f,d=0;d<o.length;d++){var c=o[d];r(t,c)||i&&r(i,c)||l(t,c,h(e,c))}}},2211(t,e,i){t.exports=!i(9039)(function(){function t(){}return t.prototype.constructor=null,Object.getPrototypeOf(new t)!==t.prototype})},2529(t){t.exports=function(t,e){return{value:t,done:e}}},6699(t,e,i){var r=i(3724),n=i(4913),s=i(6980);t.exports=r?function(t,e,i){return n.f(t,e,s(1,i))}:function(t,e,i){return t[e]=i,t}},6980(t){t.exports=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}}},4659(t,e,i){var r=i(3724),n=i(4913),s=i(6980);t.exports=function(t,e,i){r?n.f(t,e,s(0,i)):t[e]=i}},2106(t,e,i){var r=i(283),n=i(4913);t.exports=function(t,e,i){return i.get&&r(i.get,e,{getter:!0}),i.set&&r(i.set,e,{setter:!0}),n.f(t,e,i)}},6840(t,e,i){var r=i(4901),n=i(4913),s=i(283),a=i(9433);t.exports=function(t,e,i,o){o||(o={});var l=o.enumerable,h=void 0!==o.name?o.name:e;if(r(i)&&s(i,h,o),o.global)l?t[e]=i:a(e,i);else{try{o.unsafe?t[e]&&(l=!0):delete t[e]}catch(t){}l?t[e]=i:n.f(t,e,{value:i,enumerable:!1,configurable:!o.nonConfigurable,writable:!o.nonWritable})}return t}},6279(t,e,i){var r=i(6840);t.exports=function(t,e,i){for(var n in e)r(t,n,e[n],i);return t}},9433(t,e,i){var r=i(4576),n=Object.defineProperty;t.exports=function(t,e){try{n(r,t,{value:e,configurable:!0,writable:!0})}catch(i){r[t]=e}return e}},3724(t,e,i){t.exports=!i(9039)(function(){return 7!==Object.defineProperty({},1,{get:function(){return 7}})[1]})},4483(t,e,i){var r,n,s,a,o=i(4576),l=i(9429),h=i(1548),d=o.structuredClone,c=o.ArrayBuffer,u=o.MessageChannel,p=!1;if(h)p=function(t){d(t,{transfer:[t]})};else if(c)try{!u&&(r=l("worker_threads"))&&(u=r.MessageChannel),u&&(n=new u,s=new c(2),a=function(t){n.port1.postMessage(null,[t])},2===s.byteLength&&(a(s),0===s.byteLength&&(p=a)))}catch(t){}t.exports=p},4055(t,e,i){var r=i(4576),n=i(34),s=r.document,a=n(s)&&n(s.createElement);t.exports=function(t){return a?s.createElement(t):{}}},6837(t){var e=TypeError;t.exports=function(t){if(t>0x1fffffffffffff)throw new e("Maximum allowed index exceeded");return t}},5002(t){t.exports={IndexSizeError:{s:"INDEX_SIZE_ERR",c:1,m:1},DOMStringSizeError:{s:"DOMSTRING_SIZE_ERR",c:2,m:0},HierarchyRequestError:{s:"HIERARCHY_REQUEST_ERR",c:3,m:1},WrongDocumentError:{s:"WRONG_DOCUMENT_ERR",c:4,m:1},InvalidCharacterError:{s:"INVALID_CHARACTER_ERR",c:5,m:1},NoDataAllowedError:{s:"NO_DATA_ALLOWED_ERR",c:6,m:0},NoModificationAllowedError:{s:"NO_MODIFICATION_ALLOWED_ERR",c:7,m:1},NotFoundError:{s:"NOT_FOUND_ERR",c:8,m:1},NotSupportedError:{s:"NOT_SUPPORTED_ERR",c:9,m:1},InUseAttributeError:{s:"INUSE_ATTRIBUTE_ERR",c:10,m:1},InvalidStateError:{s:"INVALID_STATE_ERR",c:11,m:1},SyntaxError:{s:"SYNTAX_ERR",c:12,m:1},InvalidModificationError:{s:"INVALID_MODIFICATION_ERR",c:13,m:1},NamespaceError:{s:"NAMESPACE_ERR",c:14,m:1},InvalidAccessError:{s:"INVALID_ACCESS_ERR",c:15,m:1},ValidationError:{s:"VALIDATION_ERR",c:16,m:0},TypeMismatchError:{s:"TYPE_MISMATCH_ERR",c:17,m:1},SecurityError:{s:"SECURITY_ERR",c:18,m:1},NetworkError:{s:"NETWORK_ERR",c:19,m:1},AbortError:{s:"ABORT_ERR",c:20,m:1},URLMismatchError:{s:"URL_MISMATCH_ERR",c:21,m:1},QuotaExceededError:{s:"QUOTA_EXCEEDED_ERR",c:22,m:1},TimeoutError:{s:"TIMEOUT_ERR",c:23,m:1},InvalidNodeTypeError:{s:"INVALID_NODE_TYPE_ERR",c:24,m:1},DataCloneError:{s:"DATA_CLONE_ERR",c:25,m:1}}},8727(t){t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},6193(t,e,i){t.exports="NODE"===i(4215)},2839(t,e,i){var r=i(4576).navigator,n=r&&r.userAgent;t.exports=n?String(n):""},9519(t,e,i){var r,n,s=i(4576),a=i(2839),o=s.process,l=s.Deno,h=o&&o.versions||l&&l.version,d=h&&h.v8;d&&(n=(r=d.split("."))[0]>0&&r[0]<4?1:+(r[0]+r[1])),!n&&a&&(!(r=a.match(/Edge\/(\d+)/))||r[1]>=74)&&(r=a.match(/Chrome\/(\d+)/))&&(n=+r[1]),t.exports=n},4215(t,e,i){var r=i(4576),n=i(2839),s=i(2195),a=function(t){return n.slice(0,t.length)===t};t.exports=a("Bun/")?"BUN":a("Cloudflare-Workers")?"CLOUDFLARE":a("Deno/")?"DENO":a("Node.js/")?"NODE":r.Bun&&"string"==typeof Bun.version?"BUN":r.Deno&&"object"==typeof Deno.version?"DENO":"process"===s(r.process)?"NODE":r.window&&r.document?"BROWSER":"REST"},8574(t,e,i){var r=i(9504),n=Error,s=r("".replace),a=String(new n("zxcasd").stack),o=/\n\s*at [^:]*:[^\n]*/,l=o.test(a);t.exports=function(t,e){if(l&&"string"==typeof t&&!n.prepareStackTrace)for(;e--;)t=s(t,o,"");return t}},6518(t,e,i){var r=i(4576),n=i(7347).f,s=i(6699),a=i(6840),o=i(9433),l=i(7740),h=i(2796);t.exports=function(t,e){var i,d,c,u,p,g=t.target,m=t.global,f=t.stat;if(i=m?r:f?r[g]||o(g,{}):r[g]&&r[g].prototype)for(d in e){if(u=e[d],c=t.dontCallGetSet?(p=n(i,d))&&p.value:i[d],!h(m?d:g+(f?".":"#")+d,t.forced)&&void 0!==c){if(typeof u==typeof c)continue;l(u,c)}(t.sham||c&&c.sham)&&s(u,"sham",!0),a(i,d,u,t)}}},9039(t){t.exports=function(t){try{return!!t()}catch(t){return!0}}},8745(t,e,i){var r=i(616),n=Function.prototype,s=n.apply,a=n.call;t.exports="object"==typeof Reflect&&Reflect.apply||(r?a.bind(s):function(){return a.apply(s,arguments)})},6080(t,e,i){var r=i(7476),n=i(9306),s=i(616),a=r(r.bind);t.exports=function(t,e){return n(t),void 0===e?t:s?a(t,e):function(){return t.apply(e,arguments)}}},616(t,e,i){t.exports=!i(9039)(function(){var t=(function(){}).bind();return"function"!=typeof t||t.hasOwnProperty("prototype")})},9565(t,e,i){var r=i(616),n=Function.prototype.call;t.exports=r?n.bind(n):function(){return n.apply(n,arguments)}},350(t,e,i){var r=i(3724),n=i(9297),s=Function.prototype,a=r&&Object.getOwnPropertyDescriptor,o=n(s,"name"),l=o&&(!r||r&&a(s,"name").configurable);t.exports={EXISTS:o,PROPER:o&&"something"===(function(){}).name,CONFIGURABLE:l}},6706(t,e,i){var r=i(9504),n=i(9306);t.exports=function(t,e,i){try{return r(n(Object.getOwnPropertyDescriptor(t,e)[i]))}catch(t){}}},7476(t,e,i){var r=i(2195),n=i(9504);t.exports=function(t){if("Function"===r(t))return n(t)}},9504(t,e,i){var r=i(616),n=Function.prototype,s=n.call,a=r&&n.bind.bind(s,s);t.exports=r?a:function(t){return function(){return s.apply(t,arguments)}}},944(t){var e=TypeError;t.exports=function(t){var i=t&&t.alphabet;if(void 0===i||"base64"===i||"base64url"===i)return i||"base64";throw new e("Incorrect `alphabet` option")}},9429(t,e,i){var r=i(4576),n=i(6193);t.exports=function(t){if(n){try{return r.process.getBuiltinModule(t)}catch(t){}try{return Function('return require("'+t+'")')()}catch(t){}}}},7751(t,e,i){var r=i(4576),n=i(4901);t.exports=function(t,e){var i;return arguments.length<2?n(i=r[t])?i:void 0:r[t]&&r[t][e]}},1767(t){t.exports=function(t){return{iterator:t,next:t.next,done:!1}}},8646(t,e,i){var r=i(9565),n=i(8551),s=i(1767),a=i(851);t.exports=function(t,e){e&&"string"==typeof t||n(t);var i=a(t);return s(n(void 0!==i?r(i,t):t))}},851(t,e,i){var r=i(6955),n=i(5966),s=i(4117),a=i(6269),o=i(608)("iterator");t.exports=function(t){if(!s(t))return n(t,o)||n(t,"@@iterator")||a[r(t)]}},81(t,e,i){var r=i(9565),n=i(9306),s=i(8551),a=i(6823),o=i(851),l=TypeError;t.exports=function(t,e){var i=arguments.length<2?o(t):e;if(n(i))return s(r(i,t));throw new l(a(t)+" is not iterable")}},5966(t,e,i){var r=i(9306),n=i(4117);t.exports=function(t,e){var i=t[e];return n(i)?void 0:r(i)}},3789(t,e,i){var r=i(9306),n=i(8551),s=i(9565),a=i(1291),o=i(1767),l="Invalid size",h=RangeError,d=TypeError,c=Math.max,u=function(t,e){this.set=t,this.size=c(e,0),this.has=r(t.has),this.keys=r(t.keys)};u.prototype={getIterator:function(){return o(n(s(this.keys,this.set)))},includes:function(t){return s(this.has,this.set,t)}},t.exports=function(t){n(t);var e=+t.size;if(e!=e)throw new d(l);var i=a(e);if(i<0)throw new h(l);return new u(t,i)}},4576(t){var e=function(t){return t&&t.Math===Math&&t};t.exports=e("object"==typeof globalThis&&globalThis)||e("object"==typeof window&&window)||e("object"==typeof self&&self)||e("object"==typeof global&&global)||e("object"==typeof this&&this)||function(){return this}()||Function("return this")()},9297(t,e,i){var r=i(9504),n=i(8981),s=r({}.hasOwnProperty);t.exports=Object.hasOwn||function(t,e){return s(n(t),e)}},421(t){t.exports={}},397(t,e,i){t.exports=i(7751)("document","documentElement")},5917(t,e,i){var r=i(3724),n=i(9039),s=i(4055);t.exports=!r&&!n(function(){return 7!==Object.defineProperty(s("div"),"a",{get:function(){return 7}}).a})},7055(t,e,i){var r=i(9504),n=i(9039),s=i(2195),a=Object,o=r("".split);t.exports=n(function(){return!a("z").propertyIsEnumerable(0)})?function(t){return"String"===s(t)?o(t,""):a(t)}:a},3167(t,e,i){var r=i(4901),n=i(34),s=i(2967);t.exports=function(t,e,i){var a,o;return s&&r(a=e.constructor)&&a!==i&&n(o=a.prototype)&&o!==i.prototype&&s(t,o),t}},3706(t,e,i){var r=i(9504),n=i(4901),s=i(7629),a=r(Function.toString);n(s.inspectSource)||(s.inspectSource=function(t){return a(t)}),t.exports=s.inspectSource},1181(t,e,i){var r,n,s,a=i(8622),o=i(4576),l=i(34),h=i(6699),d=i(9297),c=i(7629),u=i(6119),p=i(421),g="Object already initialized",m=o.TypeError,f=o.WeakMap;if(a||c.state){var b=c.state||(c.state=new f);b.get=b.get,b.has=b.has,b.set=b.set,r=function(t,e){if(b.has(t))throw new m(g);return e.facade=t,b.set(t,e),e},n=function(t){return b.get(t)||{}},s=function(t){return b.has(t)}}else{var v=u("state");p[v]=!0,r=function(t,e){if(d(t,v))throw new m(g);return e.facade=t,h(t,v,e),e},n=function(t){return d(t,v)?t[v]:{}},s=function(t){return d(t,v)}}t.exports={set:r,get:n,has:s,enforce:function(t){return s(t)?n(t):r(t,{})},getterFor:function(t){return function(e){var i;if(!l(e)||(i=n(e)).type!==t)throw new m("Incompatible receiver, "+t+" required");return i}}}},4209(t,e,i){var r=i(608),n=i(6269),s=r("iterator"),a=Array.prototype;t.exports=function(t){return void 0!==t&&(n.Array===t||a[s]===t)}},4376(t,e,i){var r=i(2195);t.exports=Array.isArray||function(t){return"Array"===r(t)}},1108(t,e,i){var r=i(6955);t.exports=function(t){var e=r(t);return"BigInt64Array"===e||"BigUint64Array"===e}},4901(t){var e="object"==typeof document&&document.all;t.exports=void 0===e&&void 0!==e?function(t){return"function"==typeof t||t===e}:function(t){return"function"==typeof t}},2796(t,e,i){var r=i(9039),n=i(4901),s=/#|\.prototype\./,a=function(t,e){var i=l[o(t)];return i===d||i!==h&&(n(e)?r(e):!!e)},o=a.normalize=function(t){return String(t).replace(s,".").toLowerCase()},l=a.data={},h=a.NATIVE="N",d=a.POLYFILL="P";t.exports=a},4117(t){t.exports=function(t){return null==t}},34(t,e,i){var r=i(4901);t.exports=function(t){return"object"==typeof t?null!==t:r(t)}},3925(t,e,i){var r=i(34);t.exports=function(t){return r(t)||null===t}},6395(t){t.exports=!1},5810(t,e,i){var r=i(34),n=i(1181).get;t.exports=function(t){if(!r(t))return!1;var e=n(t);return!!e&&"RawJSON"===e.type}},757(t,e,i){var r=i(7751),n=i(4901),s=i(1625),a=i(7040),o=Object;t.exports=a?function(t){return"symbol"==typeof t}:function(t){var e=r("Symbol");return n(e)&&s(e.prototype,o(t))}},507(t,e,i){var r=i(9565);t.exports=function(t,e,i){for(var n,s,a=i?t:t.iterator,o=t.next;!(n=r(o,a)).done;)if(void 0!==(s=e(n.value)))return s}},2652(t,e,i){var r=i(6080),n=i(9565),s=i(8551),a=i(6823),o=i(4209),l=i(6198),h=i(1625),d=i(81),c=i(851),u=i(9539),p=TypeError,g=function(t,e){this.stopped=t,this.result=e},m=g.prototype;t.exports=function(t,e,i){var f,b,v,y,w,x,A,S=i&&i.that,T=!!(i&&i.AS_ENTRIES),_=!!(i&&i.IS_RECORD),E=!!(i&&i.IS_ITERATOR),C=!!(i&&i.INTERRUPTED),k=r(e,S),P=function(t){var e=f;return f=void 0,e&&u(e,"normal"),new g(!0,t)},M=function(t){return T?(s(t),C?k(t[0],t[1],P):k(t[0],t[1])):C?k(t,P):k(t)};if(_)f=t.iterator;else if(E)f=t;else{if(!(b=c(t)))throw new p(a(t)+" is not iterable");if(o(b)){for(v=0,y=l(t);y>v;v++)if((w=M(t[v]))&&h(m,w))return w;return new g(!1)}f=d(t,b)}for(x=_?t.next:f.next;!(A=n(x,f)).done;){var D=A.value;try{w=M(D)}catch(t){if(f)u(f,"throw",t);else throw t}if("object"==typeof w&&w&&h(m,w))return w}return new g(!1)}},1385(t,e,i){var r=i(9539);t.exports=function(t,e,i){for(var n=t.length-1;n>=0;n--)if(void 0!==t[n])try{i=r(t[n].iterator,e,i)}catch(t){e="throw",i=t}if("throw"===e)throw i;return i}},9539(t,e,i){var r=i(9565),n=i(8551),s=i(5966);t.exports=function(t,e,i){var a,o;n(t);try{if(!(a=s(t,"return"))){if("throw"===e)throw i;return i}a=r(a,t)}catch(t){o=!0,a=t}if("throw"===e)throw i;if(o)throw a;return n(a),i}},9462(t,e,i){var r=i(9565),n=i(2360),s=i(6699),a=i(6279),o=i(608),l=i(1181),h=i(5966),d=i(7657).IteratorPrototype,c=i(2529),u=i(9539),p=i(1385),g=o("toStringTag"),m="IteratorHelper",f="WrapForValidIterator",b="normal",v="throw",y=l.set,w=function(t){var e=l.getterFor(t?f:m);return a(n(d),{next:function(){var i=e(this);if(t)return i.nextHandler();if(i.done)return c(void 0,!0);try{var r=i.nextHandler();return i.returnHandlerResult?r:c(r,i.done)}catch(t){throw i.done=!0,t}},return:function(){var i=e(this),n=i.iterator,s=i.done;if(i.done=!0,t){var a=h(n,"return");return a?r(a,n):c(void 0,!0)}if(s)return c(void 0,!0);if(i.inner)try{u(i.inner.iterator,b)}catch(t){return u(n,v,t)}if(i.openIters)try{p(i.openIters,b)}catch(t){if(n)return u(n,v,t);throw t}return n&&u(n,b),c(void 0,!0)}})},x=w(!0),A=w(!1);s(A,g,"Iterator Helper"),t.exports=function(t,e,i){var r=function(r,n){n?(n.iterator=r.iterator,n.next=r.next):n=r,n.type=e?f:m,n.returnHandlerResult=!!i,n.nextHandler=t,n.counter=0,n.done=!1,y(this,n)};return r.prototype=e?x:A,r}},684(t){t.exports=function(t,e){var i="function"==typeof Iterator&&Iterator.prototype[t];if(i)try{i.call({next:null},e).next()}catch(t){return!0}}},4549(t,e,i){var r=i(4576);t.exports=function(t,e){var i=r.Iterator,n=i&&i.prototype,s=n&&n[t],a=!1;if(s)try{s.call({next:function(){return{done:!0}},return:function(){a=!0}},-1)}catch(t){t instanceof e||(a=!1)}if(!a)return s}},7657(t,e,i){var r,n,s,a=i(9039),o=i(4901),l=i(34),h=i(2360),d=i(2787),c=i(6840),u=i(608),p=i(6395),g=u("iterator"),m=!1;[].keys&&("next"in(s=[].keys())?(n=d(d(s)))!==Object.prototype&&(r=n):m=!0),!l(r)||a(function(){var t={};return r[g].call(t)!==t})?r={}:p&&(r=h(r)),o(r[g])||c(r,g,function(){return this}),t.exports={IteratorPrototype:r,BUGGY_SAFARI_ITERATORS:m}},6269(t){t.exports={}},6198(t,e,i){var r=i(8014);t.exports=function(t){return r(t.length)}},283(t,e,i){var r=i(9504),n=i(9039),s=i(4901),a=i(9297),o=i(3724),l=i(350).CONFIGURABLE,h=i(3706),d=i(1181),c=d.enforce,u=d.get,p=String,g=Object.defineProperty,m=r("".slice),f=r("".replace),b=r([].join),v=o&&!n(function(){return 8!==g(function(){},"length",{value:8}).length}),y=String(String).split("String"),w=t.exports=function(t,e,i){"Symbol("===m(p(e),0,7)&&(e="["+f(p(e),/^Symbol\(([^)]*)\).*$/,"$1")+"]"),i&&i.getter&&(e="get "+e),i&&i.setter&&(e="set "+e),(!a(t,"name")||l&&t.name!==e)&&(o?g(t,"name",{value:e,configurable:!0}):t.name=e),v&&i&&a(i,"arity")&&t.length!==i.arity&&g(t,"length",{value:i.arity});try{i&&a(i,"constructor")&&i.constructor?o&&g(t,"prototype",{writable:!1}):t.prototype&&(t.prototype=void 0)}catch(t){}var r=c(t);return a(r,"source")||(r.source=b(y,"string"==typeof e?e:"")),t};Function.prototype.toString=w(function(){return s(this)&&u(this).source||h(this)},"toString")},2248(t,e,i){var r=i(9504),n=Map.prototype;t.exports={Map:Map,set:r(n.set),get:r(n.get),has:r(n.has),remove:r(n.delete),proto:n}},741(t){var e=Math.ceil,i=Math.floor;t.exports=Math.trunc||function(t){var r=+t;return(r>0?i:e)(r)}},7819(t,e,i){t.exports=!i(9039)(function(){var t="9007199254740993",e=JSON.rawJSON(t);return!JSON.isRawJSON(e)||JSON.stringify(e)!==t})},6043(t,e,i){var r=i(9306),n=TypeError,s=function(t){var e,i;this.promise=new t(function(t,r){if(void 0!==e||void 0!==i)throw new n("Bad Promise constructor");e=t,i=r}),this.resolve=r(e),this.reject=r(i)};t.exports.f=function(t){return new s(t)}},2603(t,e,i){var r=i(655);t.exports=function(t,e){return void 0===t?arguments.length<2?"":e:r(t)}},4149(t){var e=RangeError;t.exports=function(t){if(t==t)return t;throw new e("NaN is not allowed")}},2360(t,e,i){var r,n=i(8551),s=i(6801),a=i(8727),o=i(421),l=i(397),h=i(4055),d=i(6119),c="prototype",u="script",p=d("IE_PROTO"),g=function(){},m=function(t){return"<"+u+">"+t+"</"+u+">"},f=function(t){t.write(m("")),t.close();var e=t.parentWindow.Object;return t=null,e},b=function(){var t,e=h("iframe");return e.style.display="none",l.appendChild(e),e.src=String("java"+u+":"),(t=e.contentWindow.document).open(),t.write(m("document.F=Object")),t.close(),t.F},v=function(){try{r=new ActiveXObject("htmlfile")}catch(t){}v="u">typeof document?document.domain&&r?f(r):b():f(r);for(var t=a.length;t--;)delete v[c][a[t]];return v()};o[p]=!0,t.exports=Object.create||function(t,e){var i;return null!==t?(g[c]=n(t),i=new g,g[c]=null,i[p]=t):i=v(),void 0===e?i:s.f(i,e)}},6801(t,e,i){var r=i(3724),n=i(8686),s=i(4913),a=i(8551),o=i(5397),l=i(1072);e.f=r&&!n?Object.defineProperties:function(t,e){a(t);for(var i,r=o(e),n=l(e),h=n.length,d=0;h>d;)s.f(t,i=n[d++],r[i]);return t}},4913(t,e,i){var r=i(3724),n=i(5917),s=i(8686),a=i(8551),o=i(6969),l=TypeError,h=Object.defineProperty,d=Object.getOwnPropertyDescriptor,c="enumerable",u="configurable",p="writable";e.f=r?s?function(t,e,i){if(a(t),e=o(e),a(i),"function"==typeof t&&"prototype"===e&&"value"in i&&p in i&&!i[p]){var r=d(t,e);r&&r[p]&&(t[e]=i.value,i={configurable:u in i?i[u]:r[u],enumerable:c in i?i[c]:r[c],writable:!1})}return h(t,e,i)}:h:function(t,e,i){if(a(t),e=o(e),a(i),n)try{return h(t,e,i)}catch(t){}if("get"in i||"set"in i)throw new l("Accessors not supported");return"value"in i&&(t[e]=i.value),t}},7347(t,e,i){var r=i(3724),n=i(9565),s=i(8773),a=i(6980),o=i(5397),l=i(6969),h=i(9297),d=i(5917),c=Object.getOwnPropertyDescriptor;e.f=r?c:function(t,e){if(t=o(t),e=l(e),d)try{return c(t,e)}catch(t){}if(h(t,e))return a(!n(s.f,t,e),t[e])}},8480(t,e,i){var r=i(1828),n=i(8727).concat("length","prototype");e.f=Object.getOwnPropertyNames||function(t){return r(t,n)}},3717(t,e){e.f=Object.getOwnPropertySymbols}
2,2787(t,e,i){var r=i(9297),n=i(4901),s=i(8981),a=i(6119),o=i(2211),l=a("IE_PROTO"),h=Object,d=h.prototype;t.exports=o?h.getPrototypeOf:function(t){var e=s(t);if(r(e,l))return e[l];var i=e.constructor;return n(i)&&e instanceof i?i.prototype:e instanceof h?d:null}},1625(t,e,i){t.exports=i(9504)({}.isPrototypeOf)},1828(t,e,i){var r=i(9504),n=i(9297),s=i(5397),a=i(9617).indexOf,o=i(421),l=r([].push);t.exports=function(t,e){var i,r=s(t),h=0,d=[];for(i in r)!n(o,i)&&n(r,i)&&l(d,i);for(;e.length>h;)n(r,i=e[h++])&&(~a(d,i)||l(d,i));return d}},1072(t,e,i){var r=i(1828),n=i(8727);t.exports=Object.keys||function(t){return r(t,n)}},8773(t,e){var i={}.propertyIsEnumerable,r=Object.getOwnPropertyDescriptor;e.f=r&&!i.call({1:2},1)?function(t){var e=r(this,t);return!!e&&e.enumerable}:i},2967(t,e,i){var r=i(6706),n=i(34),s=i(7750),a=i(3506);t.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var t,e=!1,i={};try{(t=r(Object.prototype,"__proto__","set"))(i,[]),e=i instanceof Array}catch(t){}return function(i,r){return s(i),a(r),n(i)&&(e?t(i,r):i.__proto__=r),i}}():void 0)},4270(t,e,i){var r=i(9565),n=i(4901),s=i(34),a=TypeError;t.exports=function(t,e){var i,o;if("string"===e&&n(i=t.toString)&&!s(o=r(i,t))||n(i=t.valueOf)&&!s(o=r(i,t))||"string"!==e&&n(i=t.toString)&&!s(o=r(i,t)))return o;throw new a("Can't convert object to primitive value")}},5031(t,e,i){var r=i(7751),n=i(9504),s=i(8480),a=i(3717),o=i(8551),l=n([].concat);t.exports=r("Reflect","ownKeys")||function(t){var e=s.f(o(t)),i=a.f;return i?l(e,i(t)):e}},8235(t,e,i){var r=i(9504),n=i(9297),s=SyntaxError,a=parseInt,o=String.fromCharCode,l=r("".charAt),h=r("".slice),d=r(/./.exec),c={'\\"':'"',"\\\\":"\\","\\/":"/","\\b":"\b","\\f":"\f","\\n":"\n","\\r":"\r","\\t":"	"},u=/^[\da-f]{4}$/i,p=/^[\u0000-\u001F]$/;t.exports=function(t,e){for(var i=!0,r="";e<t.length;){var g=l(t,e);if("\\"===g){var m=h(t,e,e+2);if(n(c,m))r+=c[m],e+=2;else if("\\u"===m){var f=h(t,e+=2,e+4);if(!d(u,f))throw new s("Bad Unicode escape at: "+e);r+=o(a(f,16)),e+=4}else throw new s('Unknown escape sequence: "'+m+'"')}else if('"'===g){i=!1,e++;break}else{if(d(p,g))throw new s("Bad control character in string literal at: "+e);r+=g,e++}}if(i)throw new s("Unterminated string at: "+e);return{value:r,end:e}}},1103(t){t.exports=function(t){try{return{error:!1,value:t()}}catch(t){return{error:!0,value:t}}}},7750(t,e,i){var r=i(4117),n=TypeError;t.exports=function(t){if(r(t))throw new n("Can't call method on "+t);return t}},9286(t,e,i){var r=i(4402),n=i(8469),s=r.Set,a=r.add;t.exports=function(t){var e=new s;return n(t,function(t){a(e,t)}),e}},3440(t,e,i){var r=i(7080),n=i(4402),s=i(9286),a=i(5170),o=i(3789),l=i(8469),h=i(507),d=n.has,c=n.remove;t.exports=function(t){var e=r(this),i=o(t),n=s(e);return a(n)<=i.size?l(n,function(t){i.includes(t)&&c(n,t)}):h(i.getIterator(),function(t){d(n,t)&&c(n,t)}),n}},4402(t,e,i){var r=i(9504),n=Set.prototype;t.exports={Set:Set,add:r(n.add),has:r(n.has),remove:r(n.delete),proto:n}},8750(t,e,i){var r=i(7080),n=i(4402),s=i(5170),a=i(3789),o=i(8469),l=i(507),h=n.Set,d=n.add,c=n.has;t.exports=function(t){var e=r(this),i=a(t),n=new h;return s(e)>i.size?l(i.getIterator(),function(t){c(e,t)&&d(n,t)}):o(e,function(t){i.includes(t)&&d(n,t)}),n}},4449(t,e,i){var r=i(7080),n=i(4402).has,s=i(5170),a=i(3789),o=i(8469),l=i(507),h=i(9539);t.exports=function(t){var e=r(this),i=a(t);if(s(e)<=i.size)return!1!==o(e,function(t){if(i.includes(t))return!1},!0);var d=i.getIterator();return!1!==l(d,function(t){if(n(e,t))return h(d.iterator,"normal",!1)})}},3838(t,e,i){var r=i(7080),n=i(5170),s=i(8469),a=i(3789);t.exports=function(t){var e=r(this),i=a(t);return!(n(e)>i.size)&&!1!==s(e,function(t){if(!i.includes(t))return!1},!0)}},8527(t,e,i){var r=i(7080),n=i(4402).has,s=i(5170),a=i(3789),o=i(507),l=i(9539);t.exports=function(t){var e=r(this),i=a(t);if(s(e)<i.size)return!1;var h=i.getIterator();return!1!==o(h,function(t){if(!n(e,t))return l(h.iterator,"normal",!1)})}},8469(t,e,i){var r=i(9504),n=i(507),s=i(4402),a=s.Set,o=s.proto,l=r(o.forEach),h=r(o.keys),d=h(new a).next;t.exports=function(t,e,i){return i?n({iterator:h(t),next:d},e):l(t,e)}},4916(t,e,i){var r=i(7751),n=function(t){return{size:t,has:function(){return!1},keys:function(){return{next:function(){return{done:!0}}}}}},s=function(t){return{size:t,has:function(){return!0},keys:function(){throw Error("e")}}};t.exports=function(t,e){var i=r("Set");try{new i()[t](n(0));try{return new i()[t](n(-1)),!1}catch(r){if(!e)return!0;try{return new i()[t](s(-1/0)),!1}catch(r){var a=new i([1,2]);
2return e(a[t](s(1/0)))}}}catch(t){return!1}}},9835(t){t.exports=function(t){try{var e=new Set,i=e[t]({size:0,has:function(){return!0},keys:function(){return Object.defineProperty({},"next",{get:function(){return e.clear(),e.add(4),function(){return{done:!0}}}})}});return 1===i.size&&4===i.values().next().value}catch(t){return!1}}},5170(t,e,i){t.exports=i(6706)(i(4402).proto,"size","get")||function(t){return t.size}},3650(t,e,i){var r=i(7080),n=i(4402),s=i(9286),a=i(3789),o=i(507),l=n.add,h=n.has,d=n.remove;t.exports=function(t){var e=r(this),i=a(t).getIterator(),n=s(e);return o(i,function(t){h(e,t)?d(n,t):l(n,t)}),n}},4204(t,e,i){var r=i(7080),n=i(4402).add,s=i(9286),a=i(3789),o=i(507);t.exports=function(t){var e=r(this),i=a(t).getIterator(),l=s(e);return o(i,function(t){n(l,t)}),l}},6119(t,e,i){var r=i(5745),n=i(3392),s=r("keys");t.exports=function(t){return s[t]||(s[t]=n(t))}},7629(t,e,i){var r=i(6395),n=i(4576),s=i(9433),a="__core-js_shared__",o=t.exports=n[a]||s(a,{});(o.versions||(o.versions=[])).push({version:"3.49.0",mode:r?"pure":"global",copyright:"© 2013–2025 Denis Pushkarev (zloirock.ru), 2025–2026 CoreJS Company (core-js.io). All rights reserved.",license:"https://github.com/zloirock/core-js/blob/v3.49.0/LICENSE",source:"https://github.com/zloirock/core-js"})},5745(t,e,i){var r=i(7629);t.exports=function(t,e){return r[t]||(r[t]=e||{})}},1548(t,e,i){var r=i(4576),n=i(9039),s=i(9519),a=i(4215),o=r.structuredClone;t.exports=!!o&&!n(function(){if("DENO"===a&&s>92||"NODE"===a&&s>94||"BROWSER"===a&&s>97)return!1;var t=new ArrayBuffer(8),e=o(t,{transfer:[t]});return 0!==t.byteLength||8!==e.byteLength})},4495(t,e,i){var r=i(9519),n=i(9039),s=i(4576).String;t.exports=!!Object.getOwnPropertySymbols&&!n(function(){var t=Symbol("symbol detection");return!s(t)||!(Object(t)instanceof Symbol)||!Symbol.sham&&r&&r<41})},5610(t,e,i){var r=i(1291),n=Math.max,s=Math.min;t.exports=function(t,e){var i=r(t);return i<0?n(i+e,0):s(i,e)}},5854(t,e,i){var r=i(2777),n=TypeError;t.exports=function(t){var e=r(t,"number");if("number"==typeof e)throw new n("Can't convert number to bigint");return BigInt(e)}},7696(t,e,i){var r=i(1291),n=i(8014),s=RangeError;t.exports=function(t){if(void 0===t)return 0;var e=r(t),i=n(e);if(e!==i)throw new s("Wrong length or index");return i}},5397(t,e,i){var r=i(7055),n=i(7750);t.exports=function(t){return r(n(t))}},1291(t,e,i){var r=i(741);t.exports=function(t){var e=+t;return e!=e||0===e?0:r(e)}},8014(t,e,i){var r=i(1291),n=Math.min;t.exports=function(t){var e=r(t);return e>0?n(e,0x1fffffffffffff):0}},8981(t,e,i){var r=i(7750),n=Object;t.exports=function(t){return n(r(t))}},9590(t,e,i){var r=i(1291),n=RangeError;t.exports=function(t){var e=r(t);if(e<0)throw new n("The argument can't be less than 0");return e}},2777(t,e,i){var r=i(9565),n=i(34),s=i(757),a=i(5966),o=i(4270),l=i(608),h=TypeError,d=l("toPrimitive");t.exports=function(t,e){if(!n(t)||s(t))return t;var i,l=a(t,d);if(l){if(void 0===e&&(e="default"),!n(i=r(l,t,e))||s(i))return i;throw new h("Can't convert object to primitive value")}return void 0===e&&(e="number"),o(t,e)}},6969(t,e,i){var r=i(2777),n=i(757);t.exports=function(t){var e=r(t,"string");return n(e)?e:e+""}},2140(t,e,i){var r=i(608)("toStringTag"),n={};n[r]="z",t.exports="[object z]"===String(n)},655(t,e,i){var r=i(6955),n=String;t.exports=function(t){if("Symbol"===r(t))throw TypeError("Cannot convert a Symbol value to a string");return n(t)}},6823(t){var e=String;t.exports=function(t){try{return e(t)}catch(t){return"Object"}}},3392(t,e,i){var r=i(9504),n=0,s=Math.random(),a=r(1.1.toString);t.exports=function(t){return"Symbol("+(void 0===t?"":t)+")_"+a(++n+s,36)}},9143(t,e,i){var r=i(4576),n=i(9504),s=i(3972),a=i(3463),o=i(9297),l=i(2804),h=i(944),d=i(5169),c=l.c2i,u=l.c2iUrl,p=r.SyntaxError,g=r.TypeError,m=n("".charAt),f=function(t,e){for(var i=t.length;e<i;e++){var r=m(t,e);if(" "!==r&&"	"!==r&&"\n"!==r&&"\f"!==r&&"\r"!==r)break}return e},b=function(t,e,i){var r=t.length;r<4&&(t+=2===r?"AA":"A");var n=(e[m(t,0)]<<18)+(e[m(t,1)]<<12)+(e[m(t,2)]<<6)+e[m(t,3)],s=[n>>16&255,n>>8&255,255&n];if(2===r){if(i&&0!==s[1])throw new p("Extra bits");return[s[0]]}if(3===r){if(i&&0!==s[2])throw new p("Extra bits");return[s[0],s[1]]}return s}
2,v=function(t,e,i){for(var r=e.length,n=0;n<r;n++)t[i+n]=e[n];return i+r};t.exports=function(t,e,i,r){a(t),s(e);var n="base64"===h(e)?c:u,l=e?e.lastChunkHandling:void 0;if(void 0===l&&(l="loose"),"loose"!==l&&"strict"!==l&&"stop-before-partial"!==l)throw new g("Incorrect `lastChunkHandling` option");i&&d(i.buffer);var y=t.length,w=i||[],x=0,A=0,S="",T=0;if(r)for(;;){if((T=f(t,T))===y){if(S.length>0){if("stop-before-partial"===l)break;if("loose"===l){if(1===S.length)throw new p("Malformed padding: exactly one additional character");x=v(w,b(S,n,!1),x)}else throw new p("Missing padding")}A=y;break}var _=m(t,T);if(++T,"="===_){if(S.length<2)throw new p("Padding is too early");if(T=f(t,T),2===S.length){if(T===y){if("stop-before-partial"===l)break;throw new p("Malformed padding: only one =")}"="===m(t,T)&&(T=f(t,++T))}if(T<y)throw new p("Unexpected character after padding");x=v(w,b(S,n,"strict"===l),x),A=y;break}if(!o(n,_))throw new p("Unexpected character");var E=r-x;if(1===E&&2===S.length||2===E&&3===S.length||4===(S+=_).length&&(x=v(w,b(S,n,!1),x),S="",A=T,x===r))break}return{bytes:w,read:A,written:x}}},2303(t,e,i){var r=i(4576),n=i(9504),s=r.Uint8Array,a=r.SyntaxError,o=Math.min,l=n("".match);t.exports=function(t,e){var i=t.length;if(i%2!=0)throw new a("String should be an even number of characters");for(var r=e?o(e.length,i/2):i/2,n=e||new s(r),h=l(t,/.{2}/g),d=0;d<r;d++){var c=+("0x"+h[d]+"0");if(c!=c)throw new a("String should only contain hex characters");n[d]=c>>4}return{bytes:n,read:d<<1}}},7416(t,e,i){var r=i(9039),n=i(608),s=i(3724),a=i(6395),o=n("iterator");t.exports=!r(function(){var t=new URL("b?a=1&b=2&c=3","https://a"),e=t.searchParams,i=new URLSearchParams("a=1&a=2&b=3"),r="";return t.pathname="c%20d",e.forEach(function(t,i){e.delete("b"),r+=i+t}),i.delete("a",2),i.delete("b",void 0),a&&(!t.toJSON||!i.has("a",1)||i.has("a",2)||!i.has("a",void 0)||i.has("b"))||!e.size&&(a||!s)||!e.sort||"https://a/c%20d?a=1&c=3"!==t.href||"3"!==e.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!e[o]||"a"!==new URL("https://a@b").username||"b"!==new URLSearchParams(new URLSearchParams("a=b")).get("a")||"xn--e1aybc"!==new URL("https://тест").host||"#%D0%B1"!==new URL("https://a#б").hash||"a1c3"!==r||"x"!==new URL("https://x",void 0).host})},7040(t,e,i){t.exports=i(4495)&&!Symbol.sham&&"symbol"==typeof Symbol.iterator},8686(t,e,i){var r=i(3724),n=i(9039);t.exports=r&&n(function(){return 42!==Object.defineProperty(function(){},"prototype",{value:42,writable:!1}).prototype})},2812(t){var e=TypeError;t.exports=function(t,i){if(t<i)throw new e("Not enough arguments");return t}},8622(t,e,i){var r=i(4576),n=i(4901),s=r.WeakMap;t.exports=n(s)&&/native code/.test(String(s))},4995(t,e,i){var r=i(9504),n=WeakMap.prototype;t.exports={WeakMap:WeakMap,set:r(n.set),get:r(n.get),has:r(n.has),remove:r(n.delete)}},608(t,e,i){var r=i(4576),n=i(5745),s=i(9297),a=i(3392),o=i(4495),l=i(7040),h=r.Symbol,d=n("wks"),c=l?h.for||h:h&&h.withoutSetter||a;t.exports=function(t){return s(d,t)||(d[t]=o&&s(h,t)?h[t]:c("Symbol."+t)),d[t]}},6573(t,e,i){var r=i(3724),n=i(2106),s=i(3238),a=ArrayBuffer.prototype;!r||"detached"in a||n(a,"detached",{configurable:!0,get:function(){return s(this)}})},7936(t,e,i){var r=i(6518),n=i(5636);n&&r({target:"ArrayBuffer",proto:!0},{transferToFixedLength:function(){return n(this,arguments.length?arguments[0]:void 0,!1)}})},8100(t,e,i){var r=i(6518),n=i(5636);n&&r({target:"ArrayBuffer",proto:!0},{transfer:function(){return n(this,arguments.length?arguments[0]:void 0,!0)}})},4423(t,e,i){var r=i(6518),n=i(9617).includes,s=i(9039),a=i(6469),o=s(function(){return![,].includes()}),l=s(function(){return[,1].includes(void 0,1)});r({target:"Array",proto:!0,forced:o||l},{includes:function(t){return n(this,t,arguments.length>1?arguments[1]:void 0)}}),a("includes")},4114(t,e,i){var r=i(6518),n=i(8981),s=i(6198),a=i(4527),o=i(6837);r({target:"Array",proto:!0,arity:1,forced:i(9039)(function(){return 0x100000001!==[].push.call({length:0x100000000},1)})||!function(){try{Object.defineProperty([],"length",{writable:!1}).push()}catch(t){return t instanceof TypeError}}()},{push:function(t){var e=n(this),i=s(e),r=arguments.length;o(i+r);for(var l=0;l<r;l++)e[i]=arguments[l],i++;return a(e,i),i}})},8111(t,e,i){var r=i(6518),n=i(4576),s=i(679),a=i(8551),o=i(4901),l=i(2787),h=i(2106),d=i(4659),c=i(9039),u=i(9297),p=i(608),g=i(7657).IteratorPrototype,m=i(3724),f=i(6395),b="constructor",v="Iterator",y=p("toStringTag"),w=TypeError,x=n[v],A=f||!o(x)||x.prototype!==g||!c(function(){x({})}),S=function(){if(s(this,g),l(this)===g)throw new w("Abstract class Iterator not directly constructable")},T=function(t,e){m?h(g,t,{configurable:!0,get:function(){return e},set:function(e){if(a(this),this===g)throw new w("You can't redefine this property");u(this,t)?this[t]=e:d(this,t,e)}}):g[t]=e};u(g,y)||T(y,v),(A||!u(g,b)||g[b]===Object)&&T(b,S),S.prototype=g,r({global:!0,constructor:!0,forced:A},{Iterator:S})},9314(t,e,i){var r=i(6518),n=i(9565),s=i(8551),a=i(1767),o=i(4149),l=i(9590),h=i(9539),d=i(9462),c=i(684),u=i(4549),p=i(6395),g=!p&&!c("drop",0),m=!p&&!g&&u("drop",RangeError),f=p||g||m,b=d(function(){for(var t,e,i=this.iterator,r=this.next;this.remaining;)if(this.remaining--,t=s(n(r,i)),this.done=!!t.done)return;if(t=s(n(r,i)),!(this.done=!!t.done))return t.value});r({target:"Iterator",proto:!0,real:!0,forced:f},{drop:function(t){var e;s(this);try{e=l(o(+t))}catch(t){h(this,"throw",t)}return m?n(m,this,e):new b(a(this),{remaining:e})}})},1148(t,e,i){var r=i(6518),n=i(9565),s=i(2652),a=i(9306),o=i(8551),l=i(1767),h=i(9539),d=i(4549)("every",TypeError);r({target:"Iterator",proto:!0,real:!0,forced:d},{every:function(t){o(this);try{a(t)}catch(t){h(this,"throw",t)}if(d)return n(d,this,t);var e=l(this),i=0;return!s(e,function(e,r){if(!t(e,i++))return r()},{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})},2489(t,e,i){var r=i(6518),n=i(9565),s=i(9306),a=i(8551),o=i(1767),l=i(9462),h=i(6319),d=i(6395),c=i(9539),u=i(684),p=i(4549),g=!d&&!u("filter",function(){}),m=!d&&!g&&p("filter",TypeError),f=d||g||m,b=l(function(){for(var t,e,i=this.iterator,r=this.predicate,s=this.next;;){if(t=a(n(s,i)),this.done=!!t.done)return;if(h(i,r,[e=t.value,this.counter++],!0))return e}});r({target:"Iterator",proto:!0,real:!0,forced:f},{filter:function(t){a(this);try{s(t)}catch(t){c(this,"throw",t)}return m?n(m,this,t):new b(o(this),{predicate:t})}})},116(t,e,i){var r=i(6518),n=i(9565),s=i(2652),a=i(9306),o=i(8551),l=i(1767),h=i(9539),d=i(4549)("find",TypeError);r({target:"Iterator",proto:!0,real:!0,forced:d},{find:function(t){o(this);try{a(t)}catch(t){h(this,"throw",t)}if(d)return n(d,this,t);var e=l(this),i=0;return s(e,function(e,r){if(t(e,i++))return r(e)},{IS_RECORD:!0,INTERRUPTED:!0}).result}})},531(t,e,i){var r=i(6518),n=i(9565),s=i(9306),a=i(8551),o=i(1767),l=i(8646),h=i(9462),d=i(9539),c=i(6395),u=i(684),p=i(4549),g=!c&&!u("flatMap",function(){}),m=!c&&!g&&p("flatMap",TypeError),f=c||g||m||function(){try{var t=Iterator.prototype.flatMap.call(new Map([[4,5]]).entries(),function(t){return t});t.next(),t.return()}catch(t){return!0}}(),b=h(function(){for(var t,e,i=this.iterator,r=this.mapper;;){if(e=this.inner)try{if(!(t=a(n(e.next,e.iterator))).done)return t.value;this.inner=null}catch(t){d(i,"throw",t)}if(t=a(n(this.next,i)),this.done=!!t.done)return;try{this.inner=l(r(t.value,this.counter++),!1)}catch(t){d(i,"throw",t)}}});r({target:"Iterator",proto:!0,real:!0,forced:f},{flatMap:function(t){a(this);try{s(t)}catch(t){d(this,"throw",t)}return m?n(m,this,t):new b(o(this),{mapper:t,inner:null})}})},7588(t,e,i){var r=i(6518),n=i(9565),s=i(2652),a=i(9306),o=i(8551),l=i(1767),h=i(9539),d=i(4549)("forEac
2h",TypeError);r({target:"Iterator",proto:!0,real:!0,forced:d},{forEach:function(t){o(this);try{a(t)}catch(t){h(this,"throw",t)}if(d)return n(d,this,t);var e=l(this),i=0;s(e,function(e){t(e,i++)},{IS_RECORD:!0})}})},1701(t,e,i){var r=i(6518),n=i(9565),s=i(9306),a=i(8551),o=i(1767),l=i(9462),h=i(6319),d=i(9539),c=i(684),u=i(4549),p=i(6395),g=!p&&!c("map",function(){}),m=!p&&!g&&u("map",TypeError),f=p||g||m,b=l(function(){var t=this.iterator,e=a(n(this.next,t));if(!(this.done=!!e.done))return h(t,this.mapper,[e.value,this.counter++],!0)});r({target:"Iterator",proto:!0,real:!0,forced:f},{map:function(t){a(this);try{s(t)}catch(t){d(this,"throw",t)}return m?n(m,this,t):new b(o(this),{mapper:t})}})},3579(t,e,i){var r=i(6518),n=i(9565),s=i(2652),a=i(9306),o=i(8551),l=i(1767),h=i(9539),d=i(4549)("some",TypeError);r({target:"Iterator",proto:!0,real:!0,forced:d},{some:function(t){o(this);try{a(t)}catch(t){h(this,"throw",t)}if(d)return n(d,this,t);var e=l(this),i=0;return s(e,function(e,r){if(t(e,i++))return r()},{IS_RECORD:!0,INTERRUPTED:!0}).stopped}})},4972(t,e,i){var r=i(6518),n=i(9565),s=i(8551),a=i(1767),o=i(4149),l=i(9590),h=i(9462),d=i(9539),c=i(684),u=i(4549),p=i(6395),g=!p&&!c("take",1),m=!p&&!g&&u("take",RangeError),f=p||g||m,b=h(function(){var t=this.iterator;if(!this.remaining--)return this.done=!0,d(t,"normal",void 0);var e=s(n(this.next,t));if(!(this.done=!!e.done))return e.value});r({target:"Iterator",proto:!0,real:!0,forced:f},{take:function(t){var e;s(this);try{e=l(o(+t))}catch(t){d(this,"throw",t)}return m?n(m,this,e):new b(a(this),{remaining:e})}})},9112(t,e,i){var r=i(6518),n=i(3724),s=i(4576),a=i(7751),o=i(9504),l=i(9565),h=i(4901),d=i(34),c=i(4376),u=i(9297),p=i(655),g=i(6198),m=i(4659),f=i(9039),b=i(8235),v=i(4495),y=s.JSON,w=s.Number,x=s.SyntaxError,A=y&&y.parse,S=a("Object","keys"),T=Object.getOwnPropertyDescriptor,_=o("".charAt),E=o("".slice),C=o(/./.exec),k=o([].push),P=/^\d$/,M=/^[1-9]$/,D=/^[\d-]$/,I=/^[\t\n\r ]$/,R=function(t,e){var i=new L(t=p(t),0),r=i.parse(),n=r.value,s=i.skip(I,r.end);if(s<t.length)throw new x('Unexpected extra character: "'+_(t,s)+'" after the parsed data at: '+s);return h(e)?F({"":n},"",e,r):n},F=function(t,e,i,r){var n,s,a,o,h,p=t[e],m=r&&p===r.value,f=m&&"string"==typeof r.source?{source:r.source}:{};if(d(p)){var b=c(p),v=m?r.nodes:b?[]:{};if(b)for(n=v.length,a=g(p),o=0;o<a;o++)B(p,o,F(p,""+o,i,o<n?v[o]:void 0));else for(a=g(s=S(p)),o=0;o<a;o++)B(p,h=s[o],F(p,h,i,u(v,h)?v[h]:void 0))}return l(i,t,e,p,f)},B=function(t,e,i){if(n){var r=T(t,e);if(r&&!r.configurable)return}void 0===i?delete t[e]:m(t,e,i)},O=function(t,e,i,r){this.value=t,this.end=e,this.source=i,this.nodes=r},L=function(t,e){this.source=t,this.index=e};L.prototype={fork:function(t){return new L(this.source,t)},parse:function(){var t=this.source,e=this.skip(I,this.index),i=this.fork(e),r=_(t,e);if(C(D,r))return i.number();switch(r){case"{":return i.object();case"[":return i.array();case'"':return i.string();case"t":return i.keyword(!0);case"f":return i.keyword(!1);case"n":return i.keyword(null)}throw new x('Unexpected character: "'+r+'" at: '+e)},node:function(t,e,i,r,n){return new O(e,r,t?null:E(this.source,i,r),n)},object:function(){for(var t=this.source,e=this.index+1,i=!1,r={},n={},s=!1;e<t.length;){if("}"===_(t,e=this.until(['"',"}"],e))&&!i){e++,s=!0;break}var a=this.fork(e).string(),o=a.value;e=a.end,e=this.until([":"],e)+1,e=this.skip(I,e),m(n,o,a=this.fork(e).parse()),m(r,o,a.value);var l=_(t,e=this.until([",","}"],a.end));if(","===l)i=!0,e++;else if("}"===l){e++,s=!0;break}}if(!s)throw new x("Unterminated object at: "+e);return this.node(1,r,this.index,e,n)},array:function(){for(var t=this.source,e=this.index+1,i=!1,r=[],n=[],s=!1;e<t.length;){if("]"===_(t,e=this.skip(I,e))&&!i){e++,s=!0;break}var a=this.fork(e).parse();if(k(n,a),k(r,a.value),","===_(t,e=this.until([",","]"],a.end)))i=!0,e++;else if("]"===_(t,e)){e++,s=!0;break}}if(!s)throw new x("Unterminated array at: "+e);return this.node(1,r,this.index,e,n)},string:function(){var t=this.index,e=b(this.source,this.index+1);return this.node(0,e.value,t,e.end)},number:function(){var t=this.source,e=this.index,i=e;if("-"===_(t,i)&&i++,"0"===_(t,i))i++;else if(C(M,_(t,i)))i=this.skip(P,i+1);else throw new x("Failed to parse number at: "+i);if("."===_(t,i)){var r=i+1;if(i=this.skip(P,r),r===i)throw new x("Failed to parse number's fraction at: "+i)}if(("e"===_(t,i)||"E"===_(t,i))&&(("+"===_(t,++i)||"-"===_(t,i))&&i++,i===(i=this.skip(P,i))))throw new x("Failed to parse number's exponent value at: "+i);return this.node(0,w(E(t,e,i)),e,i)},keyword:function(t){var e=""+t,i=this.index,r=i+e.length;if(E(this.source,i,r)!==e)throw new x("Failed to parse value at: "+i);return this.node(0,t,i,r)},skip:function(t,e){for(var i=this.source;e<i.length&&C(t,_(i,e));e++);return e},until:function(t,e){e=this.skip(I,e);for(var i=_(this.source,e),r=0;r<t.length;r++)if(t[r]===i)return e;throw new x('Unexpected character: "'+i+'" at: '+e)}};var N=f(function(){var t,e="9007199254740993";return A(e,function(e,i,r){t=r.source}),t!==e}),U=v&&!f(function(){return 1/A("-0 	")!=-1/0});r({target:"JSON",stat:!0,forced:N},{parse:function(t,e){return U&&!h(e)?A(t):R(t,e)}})},3110(t,e,i){var r=i(6518),n=i(7751),s=i(8745),a=i(9565),o=i(9504),l=i(9039),h=i(4376),d=i(4901),c=i(5810),u=i(757),p=i(2195),g=i(655),m=i(7680),f=i(8235),b=i(3392),v=i(4495),y=i(7819),w=String,x=n("JSON","stringify"),A=o(/./.exec),S=o("".charAt),T=o("".charCodeAt),_=o("".replace),E=o("".slice),C=o([].push),k=o(1.1.toString),P=/[\uD800-\uDFFF]/g,M=/^[\uD800-\uDBFF]$/,D=/^[\uDC00-\uDFFF]$/,I=b(),R=I.length,F=!v||l(function(){var t=n("Symbol")("stringify detection");return"[null]"!==x([t])||"{}"!==x({a:t})||"{}"!==x(Object(t))}),B=l(function(){return'"\\udf06\\ud834"'!==x("\uDF06\uD834")||'"\\udead"'!==x("\uDEAD")}),O=F?function(t,e){var i=m(arguments),r=N(e);if(!(!d(r)&&(void 0===t||u(t))))return i[1]=function(t,e){if(d(r)&&(e=a(r,this,w(t),e)),!u(e))return e},s(x,null,i)}
2:x,L=function(t,e,i){var r=S(i,e-1),n=S(i,e+1);return A(M,t)&&!A(D,n)||A(D,t)&&!A(M,r)?"\\u"+k(T(t,0),16):t},N=function(t){if(d(t))return t;if(h(t)){for(var e=t.length,i=[],r=0;r<e;r++){var n=t[r];"string"==typeof n?C(i,n):("number"==typeof n||"Number"===p(n)||"String"===p(n))&&C(i,g(n))}var s=i.length,a=!0;return function(t,e){if(a)return a=!1,e;if(h(this))return e;for(var r=0;r<s;r++)if(i[r]===t)return e}}};x&&r({target:"JSON",stat:!0,arity:3,forced:F||B||!y},{stringify:function(t,e,i){var r=N(e),n=[],s=O(t,function(t,e){var i=d(r)?a(r,this,w(t),e):e;return!y&&c(i)?I+(C(n,i.rawJSON)-1):i},i);if("string"!=typeof s||(B&&(s=_(s,P,L)),y))return s;for(var o="",l=s.length,h=0;h<l;h++){var u=S(s,h);if('"'===u){var p=f(s,++h).end-1,g=E(s,h,p);o+=E(g,0,R)===I?n[E(g,R)]:'"'+g+'"',h=p}else o+=u}return o}})},2731(t,e,i){var r=i(6518),n=i(9306),s=i(2248),a=i(6395),o=s.get,l=s.has,h=s.set;r({target:"Map",proto:!0,real:!0,forced:a},{getOrInsertComputed:function(t,e){var i=l(this,t);if(n(e),i)return o(this,t);0===t&&1/t==-1/0&&(t=0);var r=e(t);return h(this,t,r),r}})},5367(t,e,i){var r=i(6518),n=i(2248),s=i(6395),a=n.get,o=n.has,l=n.set;r({target:"Map",proto:!0,real:!0,forced:s},{getOrInsert:function(t,e){return o(this,t)?a(this,t):(l(this,t,e),e)}})},3068(t,e,i){var r=i(6518),n=i(9504),s=i(2652),a=RangeError,o=TypeError,l=Math.abs,h=Math.pow,d=n([].push),c=h(2,1023),u=h(2,53)-1,p=Number.MAX_VALUE,g=h(2,971),m={},f={},b={},v={},y={},w=function(t,e){var i=t+e;return{hi:i,lo:e-(i-t)}};r({target:"Math",stat:!0},{sumPrecise:function(t){var e,i,r,n,h,x,A=[],S=0,T=v;switch(s(t,function(t){if(++S>u)throw new a("Maximum allowed index exceeded");if("number"!=typeof t)throw new o("Value is not a number");T!==m&&(t!=t?T=m:1/0===t?T=T===f?m:b:-1/0===t?T=T===b?m:f:(0!==t||1/t==1/0)&&(T===v||T===y)&&(T=y,d(A,t)))}),T){case m:return 0/0;case f:return -1/0;case b:return 1/0;case v:return -0}for(var _=[],E=0,C=0;C<A.length;C++){e=A[C];for(var k=0,P=0;P<_.length;P++){if(i=_[P],l(e)<l(i)&&(x=e,e=i,i=x),n=(r=w(e,i)).hi,h=r.lo,1/0===l(n)){var M=1/0===n?1:-1;E+=M,l(e=e-M*c-M*c)<l(i)&&(x=e,e=i,i=x),n=(r=w(e,i)).hi,h=r.lo}0!==h&&(_[k++]=h),e=n}_.length=k,0!==e&&d(_,e)}var D=_.length-1;if(n=0,h=0,0!==E){var I=D>=0?_[D]:0;if(D--,l(E)>1||E>0&&I>0||E<0&&I<0)return E>0?1/0:-1/0;if(n=(r=w(E*c,I/2)).hi,h=2*r.lo,1/0===l(2*n))return n>0?n===c&&h===-(g/2)&&D>=0&&_[D]<0?p:1/0:n===-c&&h===g/2&&D>=0&&_[D]>0?-p:-1/0;0!==h&&(_[++D]=h,h=0),n*=2}for(;D>=0&&(n=(r=w(n,_[D--])).hi,0===(h=r.lo)););return D>=0&&(h<0&&_[D]<0||h>0&&_[D]>0)&&(e=n+(i=2*h),i===e-n&&(n=e)),n}})},1689(t,e,i){var r=i(6518),n=i(4576),s=i(8745),a=i(7680),o=i(6043),l=i(9306),h=i(1103),d=n.Promise,c=!1;r({target:"Promise",stat:!0,forced:!d||!d.try||h(function(){d.try(function(t){c=8===t},8)}).error||!c},{try:function(t){var e=arguments.length>1?a(arguments,1):[],i=o.f(this),r=h(function(){return s(l(t),void 0,e)});return(r.error?i.reject:i.resolve)(r.value),i.promise}})},4628(t,e,i){var r=i(6518),n=i(6043);r({target:"Promise",stat:!0},{withResolvers:function(){var t=n.f(this);return{promise:t.promise,resolve:t.resolve,reject:t.reject}}})},7642(t,e,i){var r=i(6518),n=i(3440),s=i(9039);r({target:"Set",proto:!0,real:!0,forced:!i(4916)("difference",function(t){return 0===t.size})||s(function(){var t=new Set([1,2,3,4]);return 3!==t.difference({size:1,has:function(){return!0},keys:function(){var e=0;return{next:function(){var i=e++>1;return t.has(1)&&t.clear(),{done:i,value:2}}}}}).size})},{difference:n})},8004(t,e,i){var r=i(6518),n=i(9039),s=i(8750);r({target:"Set",proto:!0,real:!0,forced:!i(4916)("intersection",function(t){return 2===t.size&&t.has(1)&&t.has(2)})||n(function(){return"3,2"!==String(Array.from(new Set([1,2,3]).intersection(new Set([3,2]))))})},{intersection:s})},3853(t,e,i){var r=i(6518),n=i(4449);r({target:"Set",proto:!0,real:!0,forced:!i(4916)("isDisjointFrom",function(t){return!t})},{isDisjointFrom:n})},5876(t,e,i){var r=i(6518),n=i(3838);r({target:"Set",proto:!0,real:!0,forced:!i(4916)("isSubsetOf",function(t){return t})},{isSubsetOf:n})},2475(t,e,i){var r=i(6518),n=i(8527);r({target:"Set",proto:!0,real:!0,forced:!i(4916)("isSupersetOf",function(t){return!t})},{isSupersetOf:n})},5024(t,e,i){var r=i(6518),n=i(3650),s=i(9835);r({target:"Set",proto:!0,real:!0,forced:!i(4916)("symmetricDifference")||!s("symmetricDifference")},{symmetricDifference:n})}
2,1698(t,e,i){var r=i(6518),n=i(4204),s=i(9835);r({target:"Set",proto:!0,real:!0,forced:!i(4916)("union")||!s("union")},{union:n})},9577(t,e,i){var r=i(4644),n=i(1108),s=i(6198),a=i(1291),o=i(5854),l=r.aTypedArray,h=r.getTypedArrayConstructor,d=r.exportTypedArrayMethod,c=RangeError,u=function(){try{new Int8Array(1).with(2,{valueOf:function(){throw 8}})}catch(t){return 8===t}}(),p=u&&function(){try{new Int8Array(1).with(-.5,1)}catch(t){return!0}}();d("with",{with:function(t,e){var i=l(this),r=s(i),d=a(t),u=d<0?r+d:d,p=n(i)?o(e):+e;if(u>=r||u<0)throw new c("Incorrect index");for(var g=new(h(i))(r),m=0;m<r;m++)g[m]=m===u?p:i[m];return g}}.with,!u||p)},5213(t,e,i){var r=i(6518),n=i(4576),s=i(5370),a=i(9143),o=n.Uint8Array,l=!o||!o.fromBase64||!function(){try{o.fromBase64("a");return}catch(t){}try{o.fromBase64("",null)}catch(t){return!0}}();o&&r({target:"Uint8Array",stat:!0,forced:l},{fromBase64:function(t){var e=a(t,arguments.length>1?arguments[1]:void 0,null,0x1fffffffffffff);return s(o,e.bytes)}})},6632(t,e,i){var r=i(6518),n=i(4576),s=i(9143),a=i(4154),o=n.Uint8Array,l=!o||!o.prototype.setFromBase64||!function(){var t=new o([255,255,255,255,255]);try{t.setFromBase64("",null);return}catch(t){}try{t.setFromBase64("a");return}catch(t){}try{t.setFromBase64("MjYyZg===")}catch(e){return 50===t[0]&&54===t[1]&&50===t[2]&&255===t[3]&&255===t[4]}}();o&&r({target:"Uint8Array",proto:!0,forced:l},{setFromBase64:function(t){a(this);var e=s(t,arguments.length>1?arguments[1]:void 0,this,this.length);return{read:e.read,written:e.written}}})},4226(t,e,i){var r=i(6518),n=i(4576),s=i(3463),a=i(4154),o=i(5169),l=i(2303);n.Uint8Array&&r({target:"Uint8Array",proto:!0,forced:function(){try{var t=new ArrayBuffer(16,{maxByteLength:1024});new Uint8Array(t).setFromHex("cafed00d")}catch(t){return!0}}()},{setFromHex:function(t){a(this),s(t),o(this.buffer);var e=l(t,this).read;return{read:e,written:e/2}}})},9486(t,e,i){var r=i(6518),n=i(4576),s=i(9504),a=i(3972),o=i(4154),l=i(5169),h=i(2804),d=i(944),c=h.i2c,u=h.i2cUrl,p=s("".charAt),g=n.Uint8Array,m=!g||!g.prototype.toBase64||!function(){try{new g().toBase64(null)}catch(t){return!0}}();g&&r({target:"Uint8Array",proto:!0,forced:m},{toBase64:function(){var t,e=o(this),i=arguments.length?a(arguments[0]):void 0,r="base64"===d(i)?c:u,n=!!i&&!!i.omitPadding;l(this.buffer);for(var s="",h=0,g=e.length,m=function(e){return p(r,t>>6*e&63)};h+2<g;h+=3)t=(e[h]<<16)+(e[h+1]<<8)+e[h+2],s+=m(3)+m(2)+m(1)+m(0);return h+2===g?(t=(e[h]<<16)+(e[h+1]<<8),s+=m(3)+m(2)+m(1)+(n?"":"=")):h+1===g&&(t=e[h]<<16,s+=m(3)+m(2)+(n?"":"==")),s}})},456(t,e,i){var r=i(6518),n=i(4576),s=i(9504),a=i(4154),o=i(5169),l=s(1.1.toString),h=s([].join),d=Array,c=n.Uint8Array,u=!c||!c.prototype.toHex||!function(){try{var t=new c([255,255,255,255,255,255,255,255]);return"ffffffffffffffff"===t.toHex()}catch(t){return!1}}();c&&r({target:"Uint8Array",proto:!0,forced:u},{toHex:function(){a(this),o(this.buffer);for(var t=d(this.length),e=0,i=this.length;e<i;e++){var r=l(this[e],16);t[e]=1===r.length?"0"+r:r}return h(t,"")}})},9452(t,e,i){var r=i(6518),n=i(9306),s=i(6557),a=i(4328),o=i(4995),l=i(6395),h=o.get,d=o.has,c=o.set;r({target:"WeakMap",proto:!0,real:!0,forced:l||!function(){try{WeakMap.prototype.getOrInsertComputed&&new WeakMap().getOrInsertComputed(1,function(){throw 1})}catch(t){return t instanceof TypeError}}()},{getOrInsertComputed:function(t,e){if(l||s(this),a(t),n(e),d(this,t))return h(this,t);var i=e(t);return c(this,t,i),i}})},8454(t,e,i){var r=i(6518),n=i(4995),s=i(6395),a=n.get,o=n.has,l=n.set;r({target:"WeakMap",proto:!0,real:!0,forced:s},{getOrInsert:function(t,e){return o(this,t)?a(this,t):(l(this,t,e),e)}})},4979(t,e,i){var r=i(6518),n=i(4576),s=i(7751),a=i(6980),o=i(4913).f,l=i(9297),h=i(679),d=i(3167),c=i(2603),u=i(5002),p=i(8574),g=i(3724),m=i(6395),f="DOMException",b=s("Error"),v=s(f),y=function(){h(this,w);var t=arguments.length,e=c(t<1?void 0:arguments[0]),i=c(t<2?void 0:arguments[1],"Error"),r=new v(e,i),n=new b(e);return n.name=f,o(r,"stack",a(1,p(n.stack,1))),d(r,this,y),r},w=y.prototype=v.prototype,x="stack"in new b(f),A="stack"in new v(1,2),S=v&&g&&Object.getOwnPropertyDescriptor(n,f),T=!!S&&!(S.writable&&S.configurable),_=x&&!T&&!A;r({global:!0,constructor:!0,forced:m||_},{DOMException:_?y:v});var E=s(f),C=E.prototype;if(C.constructor!==E){for(var k in m||o(C,"constructor",a(1,E)),u)if(l(u,k)){var P=u[k],M=P.s;l(E,M)||o(E,M,a(6,P.c))}}},4603(t,e,i){var r=i(6840),n=i(9504),s=i(655),a=i(2812),o=URLSearchParams,l=o.prototype,h=n(l.append),d=n(l.delete),c=n(l.forEach),u=n([].push),p=new o("a=1&a=2&b=3");p.delete("a",1),p.delete("b",void 0),p+""!="a=2"&&r(l,"delete",function(t){var e,i=arguments.length,r=i<2?void 0:arguments[1];if(i&&void 0===r)return d(this,t);var n=[];c(this,function(t,e){u(n,{key:e,value:t})}),a(i,1);for(var o=s(t),l=s(r),p=0,g=n.length;p<g;)d(this,(e=n[p]).key),p++;for(p=0;p<g;)((e=n[p++]).key!==o||e.value!==l)&&h(this,e.key,e.value)},{enumerable:!0,unsafe:!0})},7566(t,e,i){var r=i(6840),n=i(9504),s=i(655),a=i(2812),o=URLSearchParams,l=o.prototype,h=n(l.getAll),d=n(l.has),c=new o("a=1");(c.has("a",2)||!c.has("a",void 0))&&r(l,"has",function(t){var e=arguments.length,i=e<2?void 0:arguments[1];if(e&&void 0===i)return d(this,t);var r=h(this,t);a(e,1);for(var n=s(i),o=0;o<r.length;)if(r[o++]===n)return!0;return!1},{enumerable:!0,unsafe:!0})},8721(t,e,i){var r=i(3724),n=i(9504),s=i(2106),a=URLSearchParams.prototype,o=n(a.forEac
2h);!r||"size"in a||s(a,"size",{get:function(){var t=0;return o(this,function(){t++}),t},configurable:!0,enumerable:!0})},5781(t,e,i){var r=i(6518),n=i(7751),s=i(2812),a=i(655),o=i(7416),l=n("URL");r({target:"URL",stat:!0,forced:!o},{parse:function(t){var e=s(arguments.length,1),i=a(t),r=e<2||void 0===arguments[1]?void 0:a(arguments[1]);try{return new l(i,r)}catch(t){return null}}})}},t2={};function t5(t){var e=t2[t];if(void 0!==e)return e.exports;var i=t2[t]={exports:{}};return t1[t].call(i.exports,i,i.exports,t5),i.exports}t5.d=(t,e)=>{for(var i in e)t5.o(e,i)&&!t5.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},t5.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),t5(4423),t5(4114),t5(6573),t5(8100),t5(7936),t5(5367),t5(2731),t5(9577),t5(6632),t5(4226),t5(9486),t5(456),t5(5781);let t3="object"==typeof process&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&"browser"!==process.type),t6=[1/0,1/0,-1/0,-1/0],t4=new Float32Array(t6),t9=[.001,0,0,.001,0,0],t8={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},t7="pdfjs_internal_editor_",et={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,POPUP:16,SIGNATURE:101,COMMENT:102},ee={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,INK_COLOR_AND_OPACITY:24,HIGHLIGHT_COLOR:31,HIGHLIGHT_THICKNESS:32,HIGHLIGHT_FREE:33,HIGHLIGHT_SHOW_ALL:34,DRAW_STEP:41},ei={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},er={TEXT:1,LINK:2,FREETEXT:3,LINE:4,SQUARE:5,CIRCLE:6,POLYGON:7,POLYLINE:8,HIGHLIGHT:9,UNDERLINE:10,SQUIGGLY:11,STRIKEOUT:12,STAMP:13,CARET:14,INK:15,POPUP:16,FILEATTACHMENT:17,SOUND:18,MOVIE:19,WIDGET:20,SCREEN:21,PRINTERMARK:22,TRAPNET:23,WATERMARK:24,THREED:25,REDACT:26},en={ERRORS:0,WARNINGS:1,INFOS:5},es={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotation:80,endAnnotation:81,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91,setStrokeTransparent:92,setFillTransparent:93,rawFillPath:94},ea=en.WARNINGS;function eo(t){ea>=en.INFOS&&console.info(`Info: ${t}`)}function el(t){ea>=en.WARNINGS&&console.warn(`Warning: ${t}`)}function eh(t){throw Error(t)}function ed(t,e){t||eh(e)}function ec(t,e=null,i=null){if(!t)return null;if(i&&"string"==typeof t){if(i.addDefaultProtocol&&t.startsWith("www.")){let e=t.match(/\./g);e?.length>=2&&(t=`http://${t}`)}if(i.tryConvertEncoding)try{var r;r=t,t=decodeURIComponent(escape(r))}catch{}}let n=e?URL.parse(t,e):URL.parse(t);return!function(t){switch(t?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}(n)?null:n}function eu(t,e,i=!1){let r=URL.parse(t);return r?(r.hash=e,r.href):i&&ec(t,"http://example.com")?t.split("#",1)[0]+`${e?`#${e}`:""}`:""}function ep(t){return t.substring(t.lastIndexOf("/")+1)}function eg(t,e,i,r=!1){return Object.defineProperty(t,e,{value:i,enumerable:!r,configurable:!0,writable:!1}),i}let em=function(){function t(t,e){this.message=t,this.name=e}return t.prototype=Error(),t.constructor=t,t}();class ef extends em{constructor(t,e){super(t,"PasswordException"),this.code=e}}class eb extends em{constructor(t,e){super(t,"UnknownErrorException"),this.details=e}}class ev extends em{constructor(t){super(t,"InvalidPDFException")}}class ey extends em{constructor(t,e,i){super(t,"ResponseException"),this.status=e,this.missing=i}}class ew extends em{constructor(t){super(t,"FormatError")}}class ex extends em{constructor(t){super(t,"AbortException")}}function eA(t){"string"!=typeof t&&eh("Invalid argument for stringToBytes");let e=t.length,i=new Uint8Array(e);for(let r=0;r<e;++r)i[r]=255&t.charCodeAt(r);return i}class eS{static get isLittleEndian(){let t;return eg(this,"isLittleEndian",((t=new Uint8Array(4))[0]=1,1===new Uint32Array(t.buffer,0,1)[0]))}static get isOffscreenCanvasSupported(){return eg(this,"isOffscreenCanvasSupported","u">typeof OffscreenCanvas)}static get isImageDecoderSupported(){return eg(this,"isImageDecoderSupported","u">typeof ImageDecoder)}static get isFloat16ArraySupported(){return eg(this,"isFloat16ArraySupported","u">typeof Float16Array)}static get isSanitizerSupported(){return eg(this,"isSanitizerSupported","u">typeof Sanitizer)}static get platform(){let{platform:t,userAgent:e}=navigator;return eg(this,"platform",{isAndroid:e.includes("Android"),isLinux:t.includes("Linux"),isMac:t.includes("Mac"),isWindows:t.includes("Win"),isFirefox:e.includes("Firefox")})}static get isCSSRoundSupported(){return eg(this,"isCSSRoundSupported",globalThis.CSS?.supports?.("width: round(1.5px, 1px)"))}static get isAlphaColorInputSupported(){return eg(this,"isAlphaColorInputSupported",(()=>{if("u"<typeof document)return!1;let t=document.createElement("input");return t.type="color",t.setAttribute("alpha",""),t.value="#ff000080","#ff0000"!==t.value})())}}class eT{static get hexNums(){return eg(this,"hexNums",Array.from(Array(256).keys(),t=>t.toString(16).padStart(2,"0")))}static makeHexColor(t,e,i){return`#${this.hexNums[t]}${this.hexNums[e]}${this.hexNums[i]}`}static domMatrixToTransform(t){return[t.a,t.b,t.c,t.d,t.e,t.f]}static scaleMinMax(t,e){let i;t[0]?(t[0]<0&&(i=e[0],e[0]=e[2],e[2]=i),e[0]*=t[0],e[2]*=t[0],t[3]<0&&(i=e[1],e[1]=e[3],e[3]=i),e[1]*=t[3],e[3]*=t[3]):(i=e[0],e[0]=e[1],e[1]=i,i=e[2],e[2]=e[3],e[3]=i,t[1]<0&&(i=e[1],e[1]=e[3],e[3]=i),e[1]*=t[1],e[3]*=t[1],t[2]<0&&(i=e[0],e[0]=e[2],e[2]=i),e[0]*=t[2],e[2]*=t[2]),e[0]+=t[4],e[1]+=t[5],e[2]+=t[4],e[3]+=t[5]}static transform(t,e){return[t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],t[0]*e[4]+t[2]*e[5]+t[4],t[1]*e[4]+t[3]*e[5]+t[5]]}static multiplyByDOMMatrix(t,e){return[t[0]*e.a+t[2]*e.b,t[1]*e.a+t[3]*e.b,t[0]*e.c+t[2]*e.d,t[1]*e.c+t[3]*e.d,t[0]*e.e+t[2]*e.f+t[4],t[1]*e.e+t[3]*e.f+t[5]]}static applyTransform(t,e,i=0){let r=t[i],n=t[i+1];t[i]=r*e[0]+n*e[2]+e[4],t[i+1]=r*e[1]+n*e[3]+e[5]}static applyTransformToBezier(t,e,i=0){let r=e[0],n=e[1],s=e[2],a=e[3],o=e[4],l=e[5];for(let e=0;e<6;e+=2){let h=t[i+e],d=t[i+e+1];t[i+e]=h*r+d*s+o,t[i+e+1]=h*n+d*a+l}}static applyInverseTransform(t,e){let i=t[0],r=t[1],n=e[0]*e[3]-e[1]*e[2];t[0]=(i*e[3]-r*e[2]+e[2]*e[5]-e[4]*e[3])/n,t[1]=(-i*e[1]+r*e[0]+e[4]*e[1]-e[5]*e[0])/n}static axialAlignedBoundingBox(t,e,i){let r=e[0],n=e[1],s=e[2],a=e[3],o=e[4],l=e[5],h=t[0],d=t[1],c=t[2],u=t[3],p=r*h+o,g=p,m=r*c+o,f=m,b=a*d+l,v=b,y=a*u+l,w=y;if(0!==n||0!==s){let t=n*h,e=n*c,i=s*d,r=s*u;p+=i,f+=i,m+=r,g+=r,b+=t,w+=t,y+=e,v+=e}i[0]=Math.min(i[0],p,m,g,f),i[1]=Math.min(i[1],b,y,v,w),i[2]=Math.max(i[2],p,m,g,f),i[3]=Math.max(i[3],b,y,v,w)}static inverseTransform(t){let e=t[0]*t[3]-t[1]*t[2];return[t[3]/e,-t[1]/e,-t[2]/e,t[0]/e,(t[2]*t[5]-t[4]*t[3])/e,(t[4]*t[1]-t[5]*t[0])/e]}static singularValueDecompose2dScale(t,e){let i=t[0],r=t[1],n=t[2],s=t[3],a=i**2+r**2,o=n**2+s**2,l=(a+o)/2,h=Math.sqrt(l**2-(a*o-(i*n+r*s)**2));e[0]=Math.sqrt(l+h||1),e[1]=Math.sqrt(l-h||1)}static normalizeRect(t){let e=t.slice(0);return t[0]>t[2]&&(e[0]=t[2],e[2]=t[0]),t[1]>t[3]&&(e[1]=t[3],e[3]=t[1]),e}static intersect(t,e){let i=Math.max(Math.min(t[0],t[2]),Math.min(e[0],e[2])),r
2=Math.min(Math.max(t[0],t[2]),Math.max(e[0],e[2]));if(i>r)return null;let n=Math.max(Math.min(t[1],t[3]),Math.min(e[1],e[3])),s=Math.min(Math.max(t[1],t[3]),Math.max(e[1],e[3]));return n>s?null:[i,n,r,s]}static pointBoundingBox(t,e,i){i[0]=Math.min(i[0],t),i[1]=Math.min(i[1],e),i[2]=Math.max(i[2],t),i[3]=Math.max(i[3],e)}static rectBoundingBox(t,e,i,r,n){n[0]=Math.min(n[0],t,i),n[1]=Math.min(n[1],e,r),n[2]=Math.max(n[2],t,i),n[3]=Math.max(n[3],e,r)}static #t(t,e,i,r,n,s,a,o,l,h){if(l<=0||l>=1)return;let d=1-l,c=l*l,u=c*l,p=d*(d*(d*t+3*l*e)+3*c*i)+u*r,g=d*(d*(d*n+3*l*s)+3*c*a)+u*o;h[0]=Math.min(h[0],p),h[1]=Math.min(h[1],g),h[2]=Math.max(h[2],p),h[3]=Math.max(h[3],g)}static #e(t,e,i,r,n,s,a,o,l,h,d,c){if(1e-12>Math.abs(l)){Math.abs(h)>=1e-12&&this.#t(t,e,i,r,n,s,a,o,-d/h,c);return}let u=h**2-4*d*l;if(u<0)return;let p=Math.sqrt(u),g=2*l;this.#t(t,e,i,r,n,s,a,o,(-h+p)/g,c),this.#t(t,e,i,r,n,s,a,o,(-h-p)/g,c)}static bezierBoundingBox(t,e,i,r,n,s,a,o,l){l[0]=Math.min(l[0],t,a),l[1]=Math.min(l[1],e,o),l[2]=Math.max(l[2],t,a),l[3]=Math.max(l[3],e,o),this.#e(t,i,n,a,e,r,s,o,3*(-t+3*(i-n)+a),6*(t-2*i+n),3*(i-t),l),this.#e(t,i,n,a,e,r,s,o,3*(-e+3*(r-s)+o),6*(e-2*r+s),3*(r-e),l)}}let e_=null,eE=null;function eC(){if("function"==typeof crypto.randomUUID)return crypto.randomUUID();let t=new Uint8Array(32);return crypto.getRandomValues(t),function(t){("object"!=typeof t||t?.length===void 0)&&eh("Invalid argument for bytesToString");let e=t.length;if(e<8192)return String.fromCharCode.apply(null,t);let i=[];for(let r=0;r<e;r+=8192){let n=Math.min(r+8192,e),s=t.subarray(r,n);i.push(String.fromCharCode.apply(null,s))}return i.join("")}(t)}let ek="pdfjs_internal_id_",eP=()=>[],eM=()=>new Map,eD=()=>Object.create(null);function eI(t,e,i){return Math.min(Math.max(t,e),i)}"function"!=typeof Blob.prototype.bytes&&(Blob.prototype.bytes=async function(){return new Uint8Array(await this.arrayBuffer())}),"function"!=typeof Response.prototype.bytes&&(Response.prototype.bytes=async function(){return new Uint8Array(await this.arrayBuffer())}),"function"!=typeof AbortSignal.any&&(AbortSignal.any=function(t){let e=new AbortController,{signal:i}=e;for(let r of t)if(r.aborted)return e.abort(r.reason),i;for(let r of t)r.addEventListener("abort",()=>{e.abort(r.reason)},{signal:i});return i}),t5(8111),t5(1701),t5(4603),t5(7566),t5(8721);class eR{static textContent(t){let e=[],i={items:e,styles:Object.create(null)};return!function t(i){if(!i)return;let r=null,n=i.name;if("#text"===n)r=i.value;else{if(!eR.shouldBuildText(n))return;i?.attributes?.textContent?r=i.attributes.textContent:i.value&&(r=i.value)}if(null!==r&&e.push({str:r}),i.children)for(let e of i.children)t(e)}(t),i}static shouldBuildText(t){return"textarea"!==t&&"input"!==t&&"option"!==t&&"select"!==t}}class eF{static setupStorage(t,e,i,r,n){let s=r.getValue(e,{value:null});switch(i.name){case"textarea":if(null!==s.value&&(t.textContent=s.value),"print"===n)break;t.addEventListener("input",t=>{r.setValue(e,{value:t.target.value})});break;case"input":if("radio"===i.attributes.type||"checkbox"===i.attributes.type){if(s.value===i.attributes.xfaOn?t.setAttribute("checked",!0):s.value===i.attributes.xfaOff&&t.removeAttribute("checked"),"print"===n)break;t.addEventListener("change",t=>{r.setValue(e,{value:t.target.checked?t.target.getAttribute("xfaOn"):t.target.getAttribute("xfaOff")})})}else{if(null!==s.value&&t.setAttribute("value",s.value),"print"===n)break;t.addEventListener("input",t=>{r.setValue(e,{value:t.target.value})})}break;case"select":if(null!==s.value)for(let e of(t.setAttribute("value",s.value),i.children))e.attributes.value===s.value?e.attributes.selected=!0:Object.hasOwn(e.attributes,"selected")&&delete e.attributes.selected;t.addEventListener("input",t=>{let i=t.target.options,n=-1===i.selectedIndex?"":i[i.selectedIndex].value;r.setValue(e,{value:n})})}}static setAttributes({html:t,element:e,storage:i=null,intent:r,linkService:n}){let{attributes:s}=e,a=t instanceof HTMLAnchorElement;for(let[e,i]of("radio"===s.type&&(s.name=`${s.name}-${r}`),Object.entries(s)))if(null!=i)switch(e){case"class":i.length&&t.setAttribute(e,i.join(" "));break;case"dataId":break;case"id":t.setAttribute("data-element-id",i);break;case"style":Object.assign(t.style,i);break;case"textContent":t.textContent=i;break;default:a&&("href"===e||"newWindow"===e)||t.setAttribute(e,i)}a&&n.addLinkAttributes(t,s.href,s.newWindow),i&&s.dataId&&this.setupStorage(t,s.dataId,e,i)}static render(t){let e=t.annotationStorage,i=t.linkService,r=t.xfaHtml,n=t.
2intent||"display",s=document.createElement(r.name);r.attributes&&this.setAttributes({html:s,element:r,intent:n,linkService:i});let a="richText"!==n,o=t.div;if(o.append(s),t.viewport){let e=`matrix(${t.viewport.transform.join(",")})`;o.style.transform=e}a&&o.setAttribute("class","xfaLayer xfaFont");let l=[];if(0===r.children.length){if(r.value){let t=document.createTextNode(r.value);s.append(t),a&&eR.shouldBuildText(r.name)&&l.push(t)}return{textDivs:l}}let h=[[r,-1,s]];for(;h.length>0;){let[t,r,s]=h.at(-1);if(r+1===t.children.length){h.pop();continue}let o=t.children[++h.at(-1)[1]];if(null===o)continue;let{name:d}=o;if("#text"===d){let t=document.createTextNode(o.value);l.push(t),s.append(t);continue}let c=o?.attributes?.xmlns?document.createElementNS(o.attributes.xmlns,d):document.createElement(d);if(s.append(c),o.attributes&&this.setAttributes({html:c,element:o,storage:e,intent:n,linkService:i}),o.children?.length>0)h.push([o,-1,c]);else if(o.value){let t=document.createTextNode(o.value);a&&eR.shouldBuildText(d)&&l.push(t),c.append(t)}}for(let t of o.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))t.setAttribute("readOnly",!0);return{textDivs:l}}static update(t){let e=`matrix(${t.viewport.transform.join(",")})`;t.div.style.transform=e,t.div.hidden=!1}}let eB="http://www.w3.org/2000/svg";class eO{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=this.CSS/this.PDF}async function eL(t,e="text"){if(e$(t,document.baseURI)){let i=await fetch(t);if(!i.ok)throw Error(i.statusText);switch(e){case"blob":return i.blob();case"bytes":return i.bytes();case"json":return i.json()}return i.text()}return new Promise((i,r)=>{let n=new XMLHttpRequest;n.open("GET",t,!0),n.responseType="bytes"===e?"arraybuffer":e,n.onreadystatechange=()=>{if(n.readyState===XMLHttpRequest.DONE){if(200===n.status||0===n.status){switch(e){case"bytes":i(new Uint8Array(n.response));return;case"blob":case"json":i(n.response);return}i(n.responseText);return}r(Error(n.statusText))}},n.send(null)})}class eN{constructor({viewBox:t,userUnit:e,scale:i,rotation:r,offsetX:n=0,offsetY:s=0,dontFlip:a=!1}){let o,l,h,d,c,u,p,g;this.viewBox=t,this.userUnit=e,this.scale=i,this.rotation=r,this.offsetX=n,this.offsetY=s,i*=e;let m=(t[2]+t[0])/2,f=(t[3]+t[1])/2;switch((r%=360)<0&&(r+=360),r){case 180:o=-1,l=0,h=0,d=1;break;case 90:o=0,l=1,h=1,d=0;break;case 270:o=0,l=-1,h=-1,d=0;break;case 0:o=1,l=0,h=0,d=-1;break;default:throw Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}a&&(h=-h,d=-d),0===o?(c=Math.abs(f-t[1])*i+n,u=Math.abs(m-t[0])*i+s,p=(t[3]-t[1])*i,g=(t[2]-t[0])*i):(c=Math.abs(m-t[0])*i+n,u=Math.abs(f-t[1])*i+s,p=(t[2]-t[0])*i,g=(t[3]-t[1])*i),this.transform=[o*i,l*i,h*i,d*i,c-o*i*m
2-h*i*f,u-l*i*m-d*i*f],this.width=p,this.height=g}get rawDims(){let t=this.viewBox;return eg(this,"rawDims",{pageWidth:t[2]-t[0],pageHeight:t[3]-t[1],pageX:t[0],pageY:t[1]})}clone({scale:t=this.scale,rotation:e=this.rotation,offsetX:i=this.offsetX,offsetY:r=this.offsetY,dontFlip:n=!1}={}){return new eN({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:t,rotation:e,offsetX:i,offsetY:r,dontFlip:n})}convertToViewportPoint(t,e){let i=[t,e];return eT.applyTransform(i,this.transform),i}convertToViewportRectangle(t){let e=[t[0],t[1]];eT.applyTransform(e,this.transform);let i=[t[2],t[3]];return eT.applyTransform(i,this.transform),[e[0],e[1],i[0],i[1]]}convertToPdfPoint(t,e){let i=[t,e];return eT.applyInverseTransform(i,this.transform),i}}class eU extends em{constructor(t,e=0){super(t,"RenderingCancelledException"),this.extraDelay=e}}function ej(t){let e=t.length,i=0;for(;i<e&&""===t[i].trim();)i++;return"data:"===t.substring(i,i+5).toLowerCase()}function ez(t){return"string"==typeof t&&/\.pdf$/i.test(t)}class eH{#i=new Map;times=[];time(t){this.#i.has(t)&&el(`Timer is already running for ${t}`),this.#i.set(t,Date.now())}timeEnd(t){this.#i.has(t)||el(`Timer has not been started for ${t}`),this.times.push({name:t,start:this.#i.get(t),end:Date.now()}),this.#i.delete(t)}toString(){let t=Math.max(...this.times.map(t=>t.name.length));return this.times.map(e=>`${e.name.padEnd(t)} ${e.end-e.start}ms
3`).join("")}}function e$(t,e){let i=e?URL.parse(t,e):URL.parse(t);return/https?:/.test(i?.protocol??"")}function eV(t){t.preventDefault()}function eW(t){t.preventDefault(),t.stopPropagation()}class eG{static #r;static toDateObject(t){if(t instanceof Date)return t;if(!t||"string"!=typeof t)return null;this.#r||=RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?");let e=this.#r.exec(t);if(!e)return null;let i=parseInt(e[1],10),r=parseInt(e[2],10);r=r>=1&&r<=12?r-1:0;let n=parseInt(e[3],10);n=n>=1&&n<=31?n:1;let s=parseInt(e[4],10);s=s>=0&&s<=23?s:0;let a=parseInt(e[5],10);a=a>=0&&a<=59?a:0;let o=parseInt(e[6],10);o=o>=0&&o<=59?o:0;let l=e[7]||"Z",h=parseInt(e[8],10);h=h>=0&&h<=23?h:0;let d=parseInt(e[9],10)||0;return d=d>=0&&d<=59?d:0,"-"===l?(s+=h,a+=d):"+"===l&&(s-=h,a-=d),new Date(Date.UTC(i,r,n,s,a,o))}}function eq(t){if(t.startsWith("#")){let e=t.slice(1);return[parseInt(e.slice(0,2),16),parseInt(e.slice(2,4),16),parseInt(e.slice(4,6),16),e.length>=8?parseInt(e.slice(6,8),16)/255:1]}if(t.startsWith("rgb(")){let[e,i,r]=t.slice(4,-1).split(",").map(t=>parseInt(t,10));return[e,i,r,1]}if(t.startsWith("rgba(")){let e=t.slice(5,-1).split(",");return[parseInt(e[0],10),parseInt(e[1],10),parseInt(e[2],10),parseFloat(e[3])]}let e=t.match(/^color\(srgb\s+([\d.]+)\s+([\d.]+)\s+([\d.]+)(?:\s*\/\s*([\d.]+|none))?\)$/);return e?[Math.round(255*parseFloat(e[1])),Math.round(255*parseFloat(e[2])),Math.round(255*parseFloat(e[3])),void 0!==e[4]&&"none"!==e[4]?parseFloat(e[4]):1]:null}function eK(t){let e=eq(t);return e?e.slice(0,3):(el(`Not a valid color format: "${t}"`),[0,0,0])}function eX(t){let{a:e,b:i,c:r,d:n,e:s,f:a}=t.getTransform();return[e,i,r,n,s,a]}function eY(t){let{a:e,b:i,c:r,d:n,e:s,f:a}=t.getTransform().invertSelf();return[e,i,r,n,s,a]}function eJ(t,e,i=!1,r=!0){if(e instanceof eN){let{pageWidth:r,pageHeight:n}=e.rawDims,{style:s}=t,a=eS.isCSSRoundSupported,o=`var(--total-scale-factor) * ${r}px`,l=`var(--total-scale-factor) * ${n}px`,h=a?`round(down, ${o}, var(--scale-round-x))`:`calc(${o})`,d=a?`round(down, ${l}, var(--scale-round-y))`:`calc(${l})`;i&&e.rotation%180!=0?(s.width=d,s.height=h):(s.width=h,s.height=d)}r&&t.setAttribute("data-main-rotation",e.rotation)}class eQ{constructor(){let{pixelRatio:t}=eQ;this.sx=t,this.sy=t}get scaled(){return 1!==this.sx||1!==this.sy}get symmetric(){return this.sx===this.sy}limitCanvas(t,e,i,r,n=-1){let s=1/0,a=1/0,o=1/0;(i=eQ.capPixels(i,n))>0&&(s=Math.sqrt(i/(t*e))),-1!==r&&(a=r/t,o=r/e);let l=Math.min(s,a,o);return(this.sx>l||this.sy>l)&&(this.sx=l,this.sy=l,!0)}static get pixelRatio(){return globalThis.devicePixelRatio||1}static capPixels(t,e){if(e>
3=0){let i=Math.ceil(window.screen.availWidth*window.screen.availHeight*this.pixelRatio**2*(1+e/100));return t>0?Math.min(t,i):i}return t}}let eZ=["image/apng","image/avif","image/bmp","image/gif","image/jpeg","image/png","image/svg+xml","image/webp","image/x-icon"];class e0{static get isDarkMode(){return eg(this,"isDarkMode",!!window?.matchMedia?.("(prefers-color-scheme: dark)").matches)}}function e1(t,e){let i=t[0]/255,r=t[1]/255,n=t[2]/255,s=Math.max(i,r,n),a=Math.min(i,r,n),o=(s+a)/2;if(s===a)e[0]=e[1]=0;else{let t=s-a;switch(e[1]=o<.5?t/(s+a):t/(2-s-a),s){case i:e[0]=((r-n)/t+6*(r<n))*60;break;case r:e[0]=((n-i)/t+2)*60;break;case n:e[0]=((i-r)/t+4)*60}}e[2]=o}function e2(t,e){let i=t[0],r=t[1],n=t[2],s=(1-Math.abs(2*n-1))*r,a=s*(1-Math.abs(i/60%2-1)),o=n-s/2;switch(Math.floor(i/60)){case 0:e[0]=s+o,e[1]=a+o,e[2]=o;break;case 1:e[0]=a+o,e[1]=s+o,e[2]=o;break;case 2:e[0]=o,e[1]=s+o,e[2]=a+o;break;case 3:e[0]=o,e[1]=a+o,e[2]=s+o;break;case 4:e[0]=a+o,e[1]=o,e[2]=s+o;break;case 5:case 6:e[0]=s+o,e[1]=o,e[2]=a+o}}function e5(t){return t<=.03928?t/12.92:((t+.055)/1.055)**2.4}function e3(t,e,i){e2(t,i),i.map(e5);let r=.2126*i[0]+.7152*i[1]+.0722*i[2];e2(e,i),i.map(e5);let n=.2126*i[0]+.7152*i[1]+.0722*i[2];return r>n?(r+.05)/(n+.05):(n+.05)/(r+.05)}let e6=new Map;function e4({html:t,dir:e,className:i},r){let n=document.createDocumentFragment();if("string"==typeof t){let i=document.createElement("p");i.dir=e||"auto";let r=t.split(/(?:\r\n?|\n)/);for(let t=0,e=r.length;t<e;++t){let n=r[t];i.append(document.createTextNode(n)),t<e-1&&i.append(document.createElement("br"))}n.append(i)}else eF.render({xfaHtml:t,div:n,intent:"richText"});n.firstElementChild.classList.add("richText",i),r.append(n)}function e9(t){let e=new Path2D;if(!t)return e;for(let i=0,r=t.length;i<r;)switch(t[i++]){case 0:e.moveTo(t[i++],t[i++]);break;case 1:e.lineTo(t[i++],t[i++]);break;case 2:e.bezierCurveTo(t[i++],t[i++],t[i++],t[i++],t[i++],t[i++]);break;case 3:e.quadraticCurveTo(t[i++],t[i++],t[i++],t[i++]);break;case 4:e.closePath();break;default:el(`Unrecognized drawing path operator: ${t[i-1]}`)}return e}t5(4972),t5(4628),t5(7642),t5(8004),t5(3853),t5(5876),t5(2475),t5(5024),t5(1698),t5(8454),t5(9452),t5(4979),t5(3579),t5(3110),t5(9314),t5(1148),t5(9112);class e8{#n=null;#s=null;#a;#o=null;#l=null;#h=null;#d=null;#c=null;static #u=null;constructor(t){this.#a=t,e8.#u||=Object.freeze({freetext:"pdfjs-editor-remove-freetext-button",highlight:"pdfjs-editor-remove-highlight-button",ink:"pdfjs-editor-remove-ink-button",stamp:"pdfjs-editor-remove-stamp-button",signature:"pdfjs-editor-remove-signature-button"})}render(){let t=this.#n=document.createElement("div");t.classList.add("editToolbar","hidden"),t.setAttribute("role","toolbar");let e=this.#a._uiManager._signal;e instanceof AbortSignal&&!e.aborted&&(t.addEventListener("contextmenu",eV,{signal:e}),t.addEventListener("pointerdown",e8.#p,{signal:e}));let i=this.#o=document.createElement("div");i.className="buttons",t.append(i);let r=this.#a.toolbarPosition;if(r){let{style:e}=t,i="ltr"===this.#a._uiManager.direction?1-r[0]:r[0];e.insetInlineEnd=`${100*i}%`,e.top=`calc(${100*r[1]}% + var(--editor-toolbar-vert-offset))`}return t}get div(){return this.#n}static #p(t){t.stopPropagation()}#g(t){this.#a._focusEventsAllowed=!1,eW(t)}#m(t){this.#a._focusEventsAllowed=!0,eW(t)}#f(t){let e=this.#a._uiManager._signal;return e instanceof AbortSignal&&!e.aborted&&(t.addEventListener("focusin",this.#g.bind(this),{capture:!0,signal:e}),t.addEventListener("focusout",this.#m.bind(this),{capture:!0,signal:e}),t.addEventListener("contextmenu",eV,{signal:e}),!0)}hide(){this.#n.classList.add("hidden"),this.#s?.hideDropdown()}show(){this.#n.classList.remove("hidden"),this.#l?.shown(),this.#h?.shown()}addDeleteButton(){let{editorType:t,_uiManager:e}=this.#a,i=document.createElement("button");i.classList.add("basic","deleteButton"),i.tabIndex=0,i.setAttribute("data-l10n-id",e8.#u[t]),this.#f(i)&&i.addEventListener("click",t=>{e.delete()},{signal:e._signal}),this.#o.append(i)}get #b(){let t=document.createElement("div");return t.className="divider",t}async addAltText(t){let e=await t.render();this.#f(e),this.#o.append(e,this.#b),this.#l=t}addComment(t,e=null){if(this.#h)return;let i=t.renderForToolbar();if(!i)return;this.#f(i);let r=this.#d=this.#b;e?(this.#o.insertBefore(i,e),this.#o.insertBefore(r,e)):this.#o.append(i,r),this.#h=t,t.toolbar=this}addColorPicker(t){if(this.#s)return;this.#s=t;let e=t.renderButton();this.#f(e),this.#o.append(e,this.#b)}async addEditSignatureButton(t){let e=this.#c=await t.renderEditButton(this.#a);this.#f(e),this.#o.append(e,this.#b)}removeButton(t){"comment"===t&&(this.#h?.removeToolbarCommentButton(),this.#h=null,this.#d?.remove(),this.#d=null)}async addButton(t,e){switch(t){case"colorPicker":e&&this.addColorPicker(e);break;case"altText":e&&await this.addAltText(e);break;case"editSignature":e&&await this.addEditSignatureButton(e);break;case"delete":this.addDeleteButton();break;case"comment":e&&this.addComment(e)}}async addButtonBefore(t,e,i){if(!e&&"comment"===t)return;let r=this.#o.querySelector(i);r&&"comment"===t&&this.addComment(e,r)}updateEditSignatureButton(t){this.#c&&(this.#c.title=t)}remove(){this.#n.remove(),this.#s?.destroy(),this.#s=null}}class e7{#o=null;#n=null;#v;constructor(t){this.#v=t}#y(){let t=this.#n=document.createElement("div");t.className="editToolbar",t.setAttribute("role","toolbar");let e=this.#v._signal;e instanceof AbortSignal&&!e.aborted&&t.addEventListener("contextmenu",eV,{signal:e});let i=this.#o=document.createElement("div");return i.className="buttons",t.append(i),this.#v.hasCommentManager()&&this.#w("commentButton","pdfjs-comment-floating-button","pdfjs-comment-floating-button-label",()=>{this.#v.commentSelection("floating_button")}),this.#w("highlightButton","pdfjs-highlight-floating-button1","pdfjs-highlight-floating-button-label",()=>{this.#v.highlightSelection("floating_button")}),t}#x(t,e){let i=0,r=0;for(let n of t){let t=n.y+n.height;if(t<i)continue;let s=n.x+(e?n.width:0);if(t>i){r=s,i=t;continue}e?s>r&&(r=s):s<r&&(r=s)}return[e?1-r:r,i]}
3show(t,e,i){let[r,n]=this.#x(e,i),{style:s}=this.#n||=this.#y();t.append(this.#n),s.insetInlineEnd=`${100*r}%`,s.top=`calc(${100*n}% + var(--editor-toolbar-vert-offset))`}hide(){this.#n.remove()}#w(t,e,i,r){let n=document.createElement("button");n.classList.add("basic",t),n.tabIndex=0,n.setAttribute("data-l10n-id",e);let s=document.createElement("span");n.append(s),s.className="visuallyHidden",s.setAttribute("data-l10n-id",i);let a=this.#v._signal;a instanceof AbortSignal&&!a.aborted&&(n.addEventListener("contextmenu",eV,{signal:a}),n.addEventListener("click",r,{signal:a})),this.#o.append(n)}}function it(t,e,i){for(let r of i)e.addEventListener(r,t[r].bind(t))}class ie{static #A=0/0;static #S=null;static #T=0/0;static #_=null;static initializeAndAddPointerId(t){(ie.#S||=new Set).add(t)}static setPointer(t,e){ie.#A||=e,ie.#_??=t}static setTimeStamp(t){ie.#T=t}static isSamePointerId(t){return ie.#A===t}static isSamePointerIdOrRemove(t){return ie.#A===t||(ie.#S?.delete(t),!1)}static isSamePointerType(t){return ie.#_===t}static isInitializedAndDifferentPointerType(t){return null!==ie.#_&&!ie.isSamePointerType(t)}static isSameTimeStamp(t){return ie.#T===t}static isUsingMultiplePointers(){return ie.#S?.size>=1}static clearPointerType(){ie.#_=null}static clearPointerIds(){ie.#A=0/0,ie.#S=null}static clearTimeStamp(){ie.#T=0/0}}class ii{#E=0;get id(){return`${t7}${this.#E++}`}}class ir{#C=eC();#E=0;#k=null;static get _isSVGFittingCanvas(){let t=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),e=new Image;return e.src='data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" style="fill:red;"/></svg>',eg(this,"_isSVGFittingCanvas",e.decode().then(()=>(t.drawImage(e,0,0,1,1,0,0,1,3),0===new Uint32Array(t.getImageData(0,0,1,1).data.buffer)[0])))}async #P(t,e){this.#k||=new Map;let i=this.#k.get(t);if(null===i)return null;if(i?.bitmap)return i.refCounter+=1,i;try{let t;if(i||={bitmap:null,id:`image_${this.#C}_${this.#E++}`,refCounter:0,isSvg:!1},"string"==typeof e?(i.url=e,t=await eL(e,"blob")):e instanceof File?t=i.file=e:e instanceof Blob&&(t=e),"image/svg+xml"===t.type){let e=ir._isSVGFittingCanvas,r=new FileReader,n=new Image,s=new Promise((t,s)=>{n.onload=()=>{i.bitmap=n,i.isSvg=!0,t()},r.onload=async()=>{let t=i.svgUrl=r.result;n.src=await e?`${t}#svgView(preserveAspectRatio(none))`:t},n.onerror=r.onerror=s});r.readAsDataURL(t),await s}else i.bitmap=await createImageBitmap(t);i.refCounter=1}catch(t){el(t),i=null}return this.#k.set(t,i),i&&this.#k.set(i.id,i),i}async getFromFile(t){let{lastModified:e,name:i,size:r,type:n}=t;return this.#P(`${e}_${i}_${r}_${n}`,t)}async getFromUrl(t){return this.#P(t,t)}async getFromBlob(t,e){let i=await e;return this.#P(t,i)}async getFromId(t){this.#k||=new Map;let e=this.#k.get(t);if(!e)return null;if(e.bitmap)return e.refCounter+=1,e;if(e.file)return this.getFromFile(e.file);if(e.blobPromise){let{blobPromise:t}=e;return delete e.blobPromise,this.getFromBlob(e.id,t)}return this.getFromUrl(e.url)}getFromCanvas(t,e){this.#k||=new Map;let i=this.#k.get(t);if(i?.bitmap)return i.refCounter+=1,i;let r=new OffscreenCanvas(e.width,e.height);return r.getContext("2d").drawImage(e,0,0),i={bitmap:r.transferToImageBitmap(),id:`image_${this.#C}_${this.#E++}`,refCounter:1,isSvg:!1},this.#k.set(t,i),this.#k.set(i.id,i),i}getSvgUrl(t){let e=this.#k.get(t);return e?.isSvg?e.svgUrl:null}deleteId(t){this.#k||=new Map;let e=this.#k.get(t);if(!e||(e.refCounter-=1,0!==e.refCounter))return;let{bitmap:i}=e;if(!e.url&&!e.file){let t=new OffscreenCanvas(i.width,i.height);t.getContext("bitmaprenderer").transferFromImageBitmap(i),e.blobPromise=t.convertToBlob()}i.close?.(),e.bitmap=null}isValidId(t){return t.startsWith(`image_${this.#C}_`)}}class is{#M=[];#D=!1;#I;#R=-1;constructor(t=128){this.#I=t}add({cmd:t,undo:e,post:i,mustExec:r,type:n=0/0,overwriteIfSameType:s=!1,keepUndo:a=!1}){if(r&&t(),this.#D)return;let o={cmd:t,undo:e,post:i,type:n};if(-1===this.#R){this.#M.length>0&&(this.#M.length=0),this.#R=0,this.#M.push(o);return}if(s&&this.#M[this.#R].type===n){a&&(o.undo=this.#M[this.#R].undo),this.#M[this.#R]=o;return}let l=this.#R+1;l===this.#I?this.#M.splice(0,1):(this.#R=l,l<this.#M.length&&this.#M.splice(l)),this.#M.push(o)}undo(){if(-1===this.#R)return;this.#D=!0;let{undo:t,post:e}=this.#M[this.#R];t(),e?.(),this.#D=!1,this.#R-=1}redo(){if(this.#R<this.#M.length-1){this.#R+=1,this.#D=!0;let{cmd:t,post:e}=this.#M[this.#R];t(),e?.(),this.#D=!1}}hasSomethingToUndo(){return -1!==this.#R}hasSomethingToRedo(){return this.#R<this.#M.length-1}cleanType(t){if(-1!==this.#R){for(let e=this.#R;e>=0;e--)if(this.#M[e].type!==t){this.#M.splice(e+1,this.#R-e),this.#R=e;return}this.#M.length=0,this.#R=-1}}destroy(){this.#M=null}}class ia{constructor(t){this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;let{isMac:e}=eS.platform;for(let[i,r,n={}]of t)for(let t of i){let i=t.startsWith("mac+");e&&i?(this.callbacks.set(t.slice(4),{callback:r,options:n}),this.allKeys.add(t.split("+").at(-1))):e||i||(this.callbacks.set(t,{callback:r,options:n}),this.allKeys.add(t.split("+").at(-1)))}}#F(t){t.altKey&&this.buffer.push("alt"),t.ctrlKey&&this.buffer.push("ctrl"),t.metaKey&&this.buffer.push("meta"),t.shiftKey&&this.buffer.push("shift"),this.buffer.push(t.key);let e=this.buffer.join("+");return this.buffer.length=0,e}exec(t,e){if(!this.allKeys.has(e.key))return;let i=this.callbacks.get(this.#F(e));if(!i)return;let{callback:r,options:{bubbles:n=!1,args:s=[],checker:a=null}}=i;(!a||a(t,e))&&(r.bind(t,...s,e)(),n||eW(e))}}class io{static _colorsMapping=new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]);get _colors(){let t=new Map([["CanvasText",null],["Canvas",null]]),e=document.createElement("span");for(let i of(e.style.visibility="hidden",e.style.colorScheme="only light",document.body.append(e),t.keys())){e.style.color=i;let r=window.getComputedStyle(e).color;t.set(i,eK(r))}return e.remove(),eg(this,"_colors",t)}convert(t){let e=eK(t);if(!window.matchMedia("(forced-colors: active)").matches)return e;for(let[t,i]of this._colors)if(i.every((t,i)=>t===e[i]))return io._colorsMapping.get(t);return e}getHexCode(t){let e=this._colors.get(t);return e?eT.makeHexColor(...e):t}}class il{#B=new AbortController;#O=null;#L=null;#N=new Map;#U=new Map;#j=null;#z=null;#H=null;#$=null;#V=new is;#W=null;#G=null;#q=null;#K=0;#X=new Set;#Y=null;#J=null;#Q=new Set;_editorUndoBar=null;#Z=!1;#tt=!1;#te=!1;#ti=null;#tr=null;#tn=null;#ts=null;#ta=!1;#to=null;
3#tl=new ii;#th=!1;#td=!1;#tc=!1;#tu=null;#tp=null;#tg=null;#tm=null;#tf=null;#tb=et.NONE;#tv=new Set;#ty=null;#tw=null;#tx=null;#tA=null;#tS=null;#tT={isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1};#t_=[0,0];#tE=null;#tC=null;#tk=null;#tP=null;#tM=null;static TRANSLATE_SMALL=1;static TRANSLATE_BIG=10;static get _keyboardManager(){let t=il.prototype,e=t=>t.#tC.contains(document.activeElement)&&"BUTTON"!==document.activeElement.tagName&&t.hasSomethingToControl(),i=(t,{target:e})=>{if(e instanceof HTMLInputElement){let{type:t}=e;return"text"!==t&&"number"!==t}return!0},r=this.TRANSLATE_SMALL,n=this.TRANSLATE_BIG;return eg(this,"_keyboardManager",new ia([[["ctrl+a","mac+meta+a"],t.selectAll,{checker:i}],[["ctrl+z","mac+meta+z"],t.undo,{checker:i}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],t.redo,{checker:i}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],t.delete,{checker:i}],[["Enter","mac+Enter"],t.addNewEditorFromKeyboard,{checker:(t,{target:e})=>!(e instanceof HTMLButtonElement)&&t.#tC.contains(e)&&!t.isEnterHandled}],[[" ","mac+ "],t.addNewEditorFromKeyboard,{checker:(t,{target:e})=>!(e instanceof HTMLButtonElement)&&t.#tC.contains(document.activeElement)}],[["Escape","mac+Escape"],t.unselectAll],[["ArrowLeft","mac+ArrowLeft"],t.translateSelectedEditors,{args:[-r,0],checker:e}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t.translateSelectedEditors,{args:[-n,0],checker:e}],[["ArrowRight","mac+ArrowRight"],t.translateSelectedEditors,{args:[r,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t.translateSelectedEditors,{args:[n,0],checker:e}],[["ArrowUp","mac+ArrowUp"],t.translateSelectedEditors,{args:[0,-r],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t.translateSelectedEditors,{args:[0,-n],checker:e}],[["ArrowDown","mac+ArrowDown"],t.translateSelectedEditors,{args:[0,r],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t.translateSelectedEditors,{args:[0,n],checker:e}]]))}constructor(t,e,i,r,n,s,a,o,l,h,d,c,u,p,g,m){let f=this._signal=this.#B.signal;this.#tC=t,this.#tk=e,this.#tP=i,this.#z=r,this.#W=n,this.#tw=s,this.#tS=o,this._eventBus=a,a._on("editingaction",this.onEditingAction.bind(this),{signal:f}),a._on("pagechanging",this.onPageChanging.bind(this),{signal:f}),a._on("scalechanging",this.onScaleChanging.bind(this),{signal:f}),a._on("rotationchanging",this.onRotationChanging.bind(this),{signal:f}),a._on("setpreference",this.onSetPreference.bind(this),{signal:f}),a._on("switchannotationeditorparams",t=>this.updateParams(t.type,t.value),{signal:f}),window.addEventListener("pointerdown",()=>{this.#td=!0},{capture:!0,signal:f}),window.addEventListener("pointerup",()=>{this.#td=!1},{capture:!0,signal:f}),window.addEventListener("beforeunload",this.#tD.bind(this),{capture:!0,signal:f}),this.#tI(),this.#tR(),this.#tF(),this.#H=o.annotationStorage,this.#ti=o.filterFactory,this.#tx=l,this.#ts=h||null,this.#Z=d,this.#tt=c,this.#te=u,this.#tf=p||null,this.viewParameters={realScale:eO.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=g||null,this._supportsPinchToZoom=!1!==m,n?.setSidebarUiManager(this)}destroy(){for(let t of(this.#tM?.resolve(),this.#tM=null,this.#B?.abort(),this.#B=null,this._signal=null,this.#U.values()))t.destroy();this.#U.clear(),this.#N.clear(),this.#Q.clear(),this.#tm?.clear(),this.#O=null,this.#tv.clear(),this.#V.destroy(),this.#z?.destroy(),this.#W?.destroy(),this.#tw?.destroy(),this.#to?.hide(),this.#to=null,this.#tg?.destroy(),this.#tg=null,this.#L=null,this.#tr&&(clearTimeout(this.#tr),this.#tr=null),this.#tE&&(clearTimeout(this.#tE),this.#tE=null),this._editorUndoBar?.destroy(),this.#tS=null}combinedSignal(t){return AbortSignal.any([this._signal,t.signal])}get mlManager(){return this.#tf}get useNewAltTextFlow(){return this.#tt}get useNewAltTextWhenAddingImage(){return this.#te}get hcmFilter(){return eg(this,"hcmFilter",this.#tx?this.#ti.addHCMFilter(this.#tx.foreground,this.#tx.background):"none")}get direction(){return eg(this,"direction",getComputedStyle(this.#tC).direction)}get _highlightColors(){return eg(this,"_highlightColors",this.#ts?new Map(this.#ts.split(",").map(t=>((t=t.split("=").map(t=>t.trim()))[1]=t[1].toUpperCase(),t))):null)}get highlightColors(){let{_highlightColors:t}=this;if(!t)return eg(this,"highlightColors",null);let e=new Map,i=!!this.#tx;for(let[r,n]of t){let t=r.endsWith("_HCM");if(i&&t){e.set(r.replace("_HCM",""),n);continue}i||t||e.set(r,n)}return eg(this,"highlightColors",e)}get highlightColorNames(){return eg(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,t=>t.reverse())):null)}getNonHCMColor(t){if(!this._highlightColors)return t;let e=this.highlightColorNames.get(t);return this._highlightColors.get(e)||t}getNonHCMColorName(t){return this.highlightColorNames.get(t)||t}setCurrentDrawingSession(t){t?(this.unselectAll(),this.disableUserSelect(!0)):this.disableUserSelect(!1),this.#q=t}setMainHighlightColorPicker(t){this.#tg=t}editAltText(t,e=!1){this.#z?.editAltText(this,t,e)}hasCommentManager(){return!!this.#W}editComment(t,e,i,r){this.#W?.showDialog(this,t,e,i,r)}selectComment(t,e){let i=this.#U.get(t),r=i?.getEditorByUID(e);r?.toggleComment(!0,!0)}updateComment(t){this.#W?.updateComment(t.getData())}updatePopupColor(t){this.#W?.updatePopupColor(t)}
3removeComment(t){this.#W?.removeComments([t.uid])}deleteComment(t,e){let i=()=>{t.comment=e},r=()=>{this._editorUndoBar?.show(i,"comment"),this.toggleComment(null),t.comment=null};this.addCommands({cmd:r,undo:i,mustExec:!0})}toggleComment(t,e,i){this.#W?.toggleCommentPopup(t,e,i)}makeCommentColor(t,e){return t&&this.#W?.makeCommentColor(t,e)||null}getCommentDialogElement(){return this.#W?.dialogElement||null}async waitForEditorsRendered(t){if(this.#U.has(t-1))return;let{resolve:e,promise:i}=Promise.withResolvers(),r=i=>{i.pageNumber===t&&(this._eventBus._off("editorsrendered",r),e())};this._eventBus.on("editorsrendered",r),await i}getSignature(t){this.#tw?.getSignature({uiManager:this,editor:t})}get signatureManager(){return this.#tw}switchToMode(t,e){this._eventBus.on("annotationeditormodechanged",e,{once:!0,signal:this._signal}),this._eventBus.dispatch("showannotationeditorui",{source:this,mode:t})}setPreference(t,e){this._eventBus.dispatch("setpreference",{source:this,name:t,value:e})}onSetPreference({name:t,value:e}){"enableNewAltTextWhenAddingImage"===t&&(this.#te=e)}onPageChanging({pageNumber:t}){this.#K=t-1}deletePage(t){for(let e of this.getEditors(t))e.remove();this.#U.delete(t),this.#K===t&&(this.#K=0)}focusMainContainer(){this.#tC.focus()}findParent(t,e){for(let i of this.#U.values()){let{x:r,y:n,width:s,height:a}=i.div.getBoundingClientRect();if(t>=r&&t<=r+s&&e>=n&&e<=n+a)return i}return null}disableUserSelect(t=!1){this.#tk.classList.toggle("noUserSelect",t)}addShouldRescale(t){this.#Q.add(t)}removeShouldRescale(t){this.#Q.delete(t)}onScaleChanging({scale:t}){for(let e of(this.commitOrRemove(),this.viewParameters.realScale=t*eO.PDF_TO_CSS_UNITS,this.#Q))e.onScaleChanging();this.#q?.onScaleChanging()}onRotationChanging({pagesRotation:t}){this.commitOrRemove(),this.viewParameters.rotation=t}#tB({anchorNode:t}){return t.nodeType===Node.TEXT_NODE?t.parentElement:t}#tO(t){let{currentLayer:e}=this;if(e.hasTextLayer(t))return e;for(let e of this.#U.values())if(e.hasTextLayer(t))return e;return null}highlightSelection(t="",e=!1){let i=document.getSelection();if(!i||i.isCollapsed)return;let{anchorNode:r,anchorOffset:n,focusNode:s,focusOffset:a}=i,o=i.toString(),l=this.#tB(i).closest(".textLayer"),h=this.getSelectionBoxes(l);if(!h)return;i.empty();let d=this.#tO(l),c=this.#tb===et.NONE,u=()=>{let i=d?.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:t,boxes:h,anchorNode:r,anchorOffset:n,focusNode:s,focusOffset:a,text:o});c&&this.showAllEditors("highlight",!0,!0),e&&i?.editComment()};c?this.switchToMode(et.HIGHLIGHT,u):u()}commentSelection(t=""){this.highlightSelection(t,!0)}#tD(t){this.commitOrRemove(),this.currentLayer?.endDrawingSession(!1)}#tL(){let t=document.getSelection();if(!t||t.isCollapsed)return;let e=this.#tB(t).closest(".textLayer"),i=this.getSelectionBoxes(e);i&&(this.#to||=new e7(this),this.#to.show(e,i,"ltr"===this.direction))}getAndRemoveDataFromAnnotationStorage(t){if(!this.#H)return null;let e=`${t7}${t}`,i=this.#H.getRawValue(e);return i&&this.#H.remove(e),i}addToAnnotationStorage(t){t.isEmpty()||!this.#H||this.#H.has(t.id)||this.#H.setValue(t.id,t)}a11yAlert(t,e=null){let i=this.#tP;i&&(i.setAttribute("data-l10n-id",t),e?i.setAttribute("data-l10n-args",JSON.stringify(e)):i.removeAttribute("data-l10n-args"))}#tN(){let t=document.getSelection();if(!t||t.isCollapsed){this.#ty&&(this.#to?.hide(),this.#ty=null,this.#tU({hasSelectedText:!1}));return}let{anchorNode:e}=t;if(e===this.#ty)return;let i=this.#tB(t).closest(".textLayer");if(!i){this.#ty&&(this.#to?.hide(),this.#ty=null,this.#tU({hasSelectedText:!1}));return}if(this.#to?.hide(),this.#ty=e,this.#tU({hasSelectedText:!0}),(this.#tb===et.HIGHLIGHT||this.#tb===et.NONE)&&(this.#tb===et.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),this.#ta=this.isShiftKeyDown,!this.isShiftKeyDown)){let t=this.#tb===et.HIGHLIGHT?this.#tO(i):null;if(t?.toggleDrawing(),this.#td){let e=new AbortController,i=this.combinedSignal(e),r=i=>{("pointerup"!==i.type||0===i.button)&&(e.abort(),t?.toggleDrawing(!0),"pointerup"===i.type&&this.#tj("main_toolbar"))};window.addEventListener("pointerup",r,{signal:i}),window.addEventListener("blur",r,{signal:i})}else t?.toggleDrawing(!0),this.#tj("main_toolbar")}}#tj(t=""){this.#tb===et.HIGHLIGHT?this.highlightSelection(t):this.#Z&&this.#tL()}#tI(){document.addEventListener("selectionchange",this.#tN.bind(this),{signal:this._signal})}#tz(){if(this.#tn)return;this.#tn=new AbortController;let t=this.combinedSignal(this.#tn);window.addEventListener("focus",this.focus.bind(this),{signal:t}),window.addEventListener("blur",this.blur.bind(this),{signal:t})}#tH(){this.#tn?.abort(),this.#tn=null}blur(){if(this.isShiftKeyDown=!1,this.#ta&&(this.#ta=!1,this.#tj("main_toolbar")),!this.hasSelection)return;let{activeElement:t}=document;for(let e of this.#tv)if(e.div.contains(t)){this.#tp=[e,t],e._focusEventsAllowed=!1;break}}focus(){if(!this.#tp)return;let[t,e]=this.#tp;this.#tp=null,e.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:this._signal}),e.focus()}#tF(){if(this.#tu)return;this.#tu=new AbortController;let t=this.combinedSignal(this.#tu);window.addEventListener("keydown",this.keydown.bind(this),{signal:t}),window.addEventListener("keyup",this.keyup.bind(this),{signal:t})}#t$(){this.#tu?.abort(),this.#tu=null}#tV(){if(this.#G)return;this.#G=new AbortController;let t=this.combinedSignal(this.#G);document.addEventListener("copy",this.copy.bind(this),{signal:t}),document.addEventListener("cut",this.cut.bind(this),{signal:t}),document.addEventListener("paste",this.paste.bind(this),{signal:t})}#tW(){this.#G?.abort(),this.#G=null}#tR(){let t=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:t}),document.addEventListener("drop",this.drop.bind(this),{signal:t})}addEditListeners(){this.#tF(),this.setEditingState(!0)}removeEditListeners(){this.#t$(),this.setEditingState(!1)}dragOver(t){for(let{type:e}of t.dataTransfer.items)for(let i of this.#J)if(i.isHandlingMimeForPasting(e)){t.dataTransfer.dropEffect="copy",t.preventDefault();return}}drop(t){for(let e of t.dataTransfer.items)for(let i of this.#J)if(i.isHandlingMimeForPasting(e.type)){i.paste(e,this.currentLayer),t.preventDefault();return}}copy(t){if(t.preventDefault(),this.#O?.commitOrRemove(),!this.hasSelection)return;let e=[];for(let t of this.#tv){let i=t.serialize(!0);i&&e.push(i)}0!==e.length&&t.clipboardData.setData("application/pdfjs",JSON.stringify(e))}cut(t){this.copy(t),this.delete()}async paste(t){t.preventDefault();let{clipboardData:e}=t;for(let t of e.items)for(let e of this.#J)if(e.isHandlingMimeForPasting(t.type))return void e.paste(t,this.currentLayer);let i=e.getData("application/pdfjs");if(!i)return;try{i=JSON.parse(i)}catch(t){el(`paste: "${t.message}".`);return}if(!Array.isArray(i))return;this.unselectAll();let r=this.currentLayer;try{let t=[];for(let e of i){let i=await r.deserialize(e);if(!i)return;t.push(i)}let e=()=>{for(let e of t)this.#tG(e);this.#tq(t)};this.addCommands({cmd:e,undo:()=>{for(let e of t)e.remove()},mustExec:!0})}catch(t){el(`paste: "${t.message}".`)}}keydown(t){this.isShiftKeyDown||"Shift"!==t.key||(this.isShiftKeyDown=!0),this.#tb===et.NONE||this.isEditorHandlingKeyboard||il._keyboardManager.exec(this,t)}keyup(t){this.isShiftKeyDown&&"Shift"===t.key&&(this.isShiftKeyDown=!1,this.#ta&&(this.#ta=!1,this.#tj("main_toolbar")))}onEditingAction({name:t}){switch(t){case"undo":case"redo":case"delete":case"selectAll":this[t]();break;case"highlightSelection":this.highlightSelection("context_menu");break;case"commentSelection":this.commentSelection("context_menu")}}updatePageIndex(t,e){for(let i of this.getEditors(t))i.pageIndex=e;let i=this.#j.get(t);i&&(i.pageIndex=e,this.#U.set(e,i),this.#th?i.enable():i.disable())}startUpdatePages(){this.#j=new Map(this.#U),this.#U.clear()}endUpdatePages(){this.#j=null}
3clonePage(t,e){for(let i of this.getEditors(t)){let t=i.serialize(i.mode!==et.HIGHLIGHT);t&&(t.pageIndex=e,t.id=this.getId(),t.isClone=!0,delete t.popupRef,this.#H.setValue(t.id,t))}}findClonesForPage(t){let e=[],{pageIndex:i}=t;for(let[r,n]of this.#H)n.pageIndex===i&&n.isClone&&(this.#H.remove(r),e.push(t.deserialize(n).then(e=>{e&&(e.isClone=!0,t.addOrRebuild(e))})));return Promise.all(e)}#tU(t){Object.entries(t).some(([t,e])=>this.#tT[t]!==e)&&(this._eventBus.dispatch("editingstateschanged",{source:this,details:Object.assign(this.#tT,t)}),this.#tb===et.HIGHLIGHT&&!1===t.hasSelectedEditor&&this.#tK([[ee.HIGHLIGHT_FREE,!0]]))}#tK(t){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:t})}setEditingState(t){t?(this.#tz(),this.#tV(),this.#tU({isEditing:this.#tb!==et.NONE,isEmpty:this.#tX(),hasSomethingToUndo:this.#V.hasSomethingToUndo(),hasSomethingToRedo:this.#V.hasSomethingToRedo(),hasSelectedEditor:!1})):(this.#tH(),this.#tW(),this.#tU({isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(t){if(!this.#J)for(let e of(this.#J=t,this.#J))this.#tK(e.defaultPropertiesToUpdate)}getId(){return this.#tl.id}get currentLayer(){return this.#U.get(this.#K)}getLayer(t){return this.#U.get(t)}get currentPageIndex(){return this.#K}addLayer(t){this.#U.set(t.pageIndex,t),this.#th?t.enable():t.disable()}removeLayer(t){this.#U.delete(t.pageIndex)}async updateMode(t,e=null,i=!1,r=!1,n=!1,s=!1){if(this.#tb!==t&&(!this.#tM||(await this.#tM.promise,this.#tM))){if(this.#tM=Promise.withResolvers(),this.#q?.commitOrRemove(),this.#tb===et.POPUP&&this.#W?.hideSidebar(),this.#W?.destroyPopup(),this.#tb=t,t===et.NONE){for(let t of(this.setEditingState(!1),this.#tY(),this.#N.values()))t.hideStandaloneCommentButton();this._editorUndoBar?.hide(),this.toggleComment(null),this.#tM.resolve();return}for(let t of this.#N.values())t.addStandaloneCommentButton();for(let e of(t===et.SIGNATURE&&await this.#tw?.loadSignatures(),i&&ie.clearPointerType(),this.setEditingState(!0),await this.#tJ(),this.unselectAll(),this.#U.values()))e.updateMode(t);if(t===et.POPUP){this.#L||=await this.#tS.getAnnotationsByType(new Set(this.#J.map(t=>t._editorType)));let t=new Set,e=[];for(let i of this.#N.values()){let{annotationElementId:r,hasComment:n,deleted:s}=i;r&&t.add(r),n&&!s&&e.push(i.getData())}for(let i of this.#L){let{id:r,popupRef:n,contentsObj:s}=i;n&&s?.str&&!t.has(r)&&!this.#X.has(r)&&e.push(i)}this.#W?.showSidebar(e)}if(!e){r&&this.addNewEditorFromKeyboard(),this.#tM.resolve();return}for(let t of this.#N.values())t.uid===e?(this.setSelected(t),s?t.editComment():n?t.enterInEditMode():t.focus()):t.unselect();this.#tM.resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(t){t.mode!==this.#tb&&this._eventBus.dispatch("switchannotationeditormode",{source:this,...t})}updateParams(t,e){if(this.#J){switch(t){case ee.CREATE:this.currentLayer.addNewEditor(e);return;case ee.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(this.#tA||=new Map).set(t,e),this.showAllEditors("highlight",e)}if(this.hasSelection)for(let i of this.#tv)i.updateParams(t,e);else for(let i of this.#J)i.updateDefaultParams(t,e)}}showAllEditors(t,e,i=!1){for(let i of this.#N.values())i.editorType===t&&i.show(e);(this.#tA?.get(ee.HIGHLIGHT_SHOW_ALL)??!0)!==e&&this.#tK([[ee.HIGHLIGHT_SHOW_ALL,e]])}enableWaiting(t=!1){if(this.#tc!==t)for(let e of(this.#tc=t,this.#U.values()))t?e.disableClick():e.enableClick(),e.div.classList.toggle("waiting",t)}async #tJ(){if(!this.#th){this.#th=!0;let t=[];for(let e of this.#U.values())t.push(e.enable());for(let e of(await Promise.all(t),this.#N.values()))e.enable()}}#tY(){if(this.unselectAll(),this.#th){for(let t of(this.#th=!1,this.#U.values()))t.disable();for(let t of this.#N.values())t.disable()}}*getEditors(t){for(let e of this.#N.values())e.pageIndex===t&&(yield e)}getEditor(t){return this.#N.get(t)}addEditor(t){this.#N.set(t.id,t)}removeEditor(t){t.div.contains(document.activeElement)&&(this.#tr&&clearTimeout(this.#tr),this.#tr=setTimeout(()=>{this.focusMainContainer(),this.#tr=null},0)),this.#N.delete(t.id),t.annotationElementId&&this.#tm?.delete(t.annotationElementId),this.unselect(t),t.annotationElementId&&this.#X.has(t.annotationElementId)||this.#H?.remove(t.id)}addDeletedAnnotationElement(t){this.#X.add(t.annotationElementId),this.addChangedExistingAnnotation(t),t.deleted=!0}
3isDeletedAnnotationElement(t){return this.#X.has(t)}removeDeletedAnnotationElement(t){this.#X.delete(t.annotationElementId),this.removeChangedExistingAnnotation(t),t.deleted=!1}#tG(t){let e=this.#U.get(t.pageIndex);e?e.addOrRebuild(t):(this.addEditor(t),this.addToAnnotationStorage(t))}setActiveEditor(t){this.#O!==t&&(this.#O=t,t&&this.#tK(t.propertiesToUpdate))}get #tQ(){let t=null;for(t of this.#tv);return t}updateUI(t){this.#tQ===t&&this.#tK(t.propertiesToUpdate)}updateUIForDefaultProperties(t){this.#tK(t.defaultPropertiesToUpdate)}toggleSelected(t){if(this.#tv.has(t)){this.#tv.delete(t),t.unselect(),this.#tU({hasSelectedEditor:this.hasSelection});return}this.#tv.add(t),t.select(),this.#tK(t.propertiesToUpdate),this.#tU({hasSelectedEditor:!0})}setSelected(t){for(let e of(this.updateToolbar({mode:t.mode,editId:t.uid}),this.#q?.commitOrRemove(),this.#tv))e!==t&&e.unselect();this.#W?.destroyPopup(),this.#tv.clear(),this.#tv.add(t),t.select(),this.#tK(t.propertiesToUpdate),this.#tU({hasSelectedEditor:!0})}isSelected(t){return this.#tv.has(t)}get firstSelectedEditor(){return this.#tv.values().next().value}unselect(t){t.unselect(),this.#tv.delete(t),this.#tU({hasSelectedEditor:this.hasSelection})}get hasSelection(){return 0!==this.#tv.size}get isEnterHandled(){return 1===this.#tv.size&&this.firstSelectedEditor.isEnterHandled}undo(){this.#V.undo(),this.#tU({hasSomethingToUndo:this.#V.hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:this.#tX()}),this._editorUndoBar?.hide()}redo(){this.#V.redo(),this.#tU({hasSomethingToUndo:!0,hasSomethingToRedo:this.#V.hasSomethingToRedo(),isEmpty:this.#tX()})}addCommands(t){this.#V.add(t),this.#tU({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#tX()})}cleanUndoStack(t){this.#V.cleanType(t)}#tX(){if(0===this.#N.size)return!0;if(1===this.#N.size)for(let t of this.#N.values())return t.isEmpty();return!1}delete(){this.commitOrRemove();let t=this.currentLayer?.endDrawingSession(!0);if(!this.hasSelection&&!t)return;let e=t?[t]:[...this.#tv],i=()=>{for(let t of(this._editorUndoBar?.show(r,1===e.length?e[0].editorType:e.length),e))t.remove()},r=()=>{for(let t of e)this.#tG(t)};this.addCommands({cmd:i,undo:r,mustExec:!0})}commitOrRemove(){this.#O?.commitOrRemove()}hasSomethingToControl(){return this.#O||this.hasSelection}#tq(t){for(let t of this.#tv)t.unselect();for(let e of(this.#tv.clear(),t))e.isEmpty()||(this.#tv.add(e),e.select());this.#tU({hasSelectedEditor:this.hasSelection})}selectAll(){for(let t of this.#tv)t.commit();this.#tq(this.#N.values())}unselectAll(){if(!this.#O||(this.#O.commitOrRemove(),this.#tb===et.NONE)){if(!this.#q?.commitOrRemove()&&(this.#W?.destroyPopup(),this.hasSelection)){for(let t of this.#tv)t.unselect();this.#tv.clear(),this.#tU({hasSelectedEditor:!1})}}}translateSelectedEditors(t,e,i=!1){if(i||this.commitOrRemove(),!this.hasSelection)return;this.#t_[0]+=t,this.#t_[1]+=e;let[r,n]=this.#t_,s=[...this.#tv];for(let i of(this.#tE&&clearTimeout(this.#tE),this.#tE=setTimeout(()=>{this.#tE=null,this.#t_[0]=this.#t_[1]=0,this.addCommands({cmd:()=>{for(let t of s)this.#N.has(t.id)&&(t.translateInPage(r,n),t.translationDone())},undo:()=>{for(let t of s)this.#N.has(t.id)&&(t.translateInPage(-r,-n),t.translationDone())},mustExec:!1})},1e3),s))i.translateInPage(t,e),i.translationDone()}setUpDragSession(){if(this.hasSelection)for(let t of(this.disableUserSelect(!0),this.#Y=new Map,this.#tv))this.#Y.set(t,{savedX:t.x,savedY:t.y,savedPageIndex:t.pageIndex,newX:0,newY:0,newPageIndex:-1})}endDragSession(){if(!this.#Y)return!1;this.disableUserSelect(!1);let t=this.#Y;this.#Y=null;let e=!1;for(let[{x:i,y:r,pageIndex:n},s]of t)s.newX=i,s.newY=r,s.newPageIndex=n,e||=i!==s.savedX||r!==s.savedY||n!==s.savedPageIndex;if(!e)return!1;let i=(t,e,i,r)=>{if(this.#N.has(t.id)){let n=this.#U.get(r);n?t._setParentAndPosition(n,e,i):(t.pageIndex=r,t.x=e,t.y=i)}};return this.addCommands({cmd:()=>{for(let[e,{newX:r,newY:n,newPageIndex:s}]of t)i(e,r,n,s)},undo:()=>{for(let[e,{savedX:r,savedY:n,savedPageIndex:s}]of t)i(e,r,n,s)},mustExec:!0}),!0}dragSelectedEditors(t,e){if(this.#Y)for(let i of this.#Y.keys())i.drag(t,e)}rebuild(t){if(null===t.parent){let e=this.getLayer(t.pageIndex);e?(e.changeParent(t),e.addOrRebuild(t)):(this.addEditor(t),this.addToAnnotationStorage(t),t.rebuild())}else t.parent.addOrRebuild(t)}get isEditorHandlingKeyboard(){return this.getActive()?.shouldGetKeyboardEvents()||1===this.#tv.size&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(t){return this.#O===t}getActive(){return this.#O}getMode(){return this.#tb}isEditingMode(){return this.#tb!==et.NONE}get imageManager(){return eg(this,"imageManager",new ir)}getSelectionBoxes(t){let e;if(!t)return null;let i=document.getSelection();for(let e=0,r=i.rangeCount;e<r;e++)if(!t.contains(i.getRangeAt(e).commonAncestorContainer))return null;let{x:r,y:n,width:s,height:a}=t.getBoundingClientRect();switch(t.getAttribute("data-main-rotation")){case"90":e=(t,e,i,o)=>
3({x:(e-n)/a,y:1-(t+i-r)/s,width:o/a,height:i/s});break;case"180":e=(t,e,i,o)=>({x:1-(t+i-r)/s,y:1-(e+o-n)/a,width:i/s,height:o/a});break;case"270":e=(t,e,i,o)=>({x:1-(e+o-n)/a,y:(t-r)/s,width:o/a,height:i/s});break;default:e=(t,e,i,o)=>({x:(t-r)/s,y:(e-n)/a,width:i/s,height:o/a})}let o=[];for(let t=0,r=i.rangeCount;t<r;t++){let r=i.getRangeAt(t);if(!r.collapsed)for(let{x:t,y:i,width:n,height:s}of r.getClientRects())0!==n&&0!==s&&o.push(e(t,i,n,s))}return 0===o.length?null:o}addChangedExistingAnnotation({annotationElementId:t,id:e}){(this.#$||=new Map).set(t,e)}removeChangedExistingAnnotation({annotationElementId:t}){this.#$?.delete(t)}renderAnnotationElement(t){let e=this.#$?.get(t.data.id);if(!e)return;let i=this.#H.getRawValue(e);!i||(this.#tb!==et.NONE||i.hasBeenModified)&&i.renderAnnotationElement(t)}setMissingCanvas(t,e,i){let r=this.#tm?.get(t);r&&(r.setCanvas(e,i),this.#tm.delete(t))}addMissingCanvas(t,e){(this.#tm||=new Map).set(t,e)}}class ih{#l=null;#tZ=!1;#t0=null;#t1=null;#t2=null;#t5=null;#t3=!1;#t6=null;#a=null;#t4=null;#t9=null;#t8=!1;static #t7=null;static _l10n=null;constructor(t){this.#a=t,this.#t8=t._uiManager.useNewAltTextFlow,ih.#t7||=Object.freeze({added:"pdfjs-editor-new-alt-text-added-button","added-label":"pdfjs-editor-new-alt-text-added-button-label",missing:"pdfjs-editor-new-alt-text-missing-button","missing-label":"pdfjs-editor-new-alt-text-missing-button-label",review:"pdfjs-editor-new-alt-text-to-review-button","review-label":"pdfjs-editor-new-alt-text-to-review-button-label"})}static initialize(t){ih._l10n??=t}async render(){let t=this.#t0=document.createElement("button");t.className="altText",t.tabIndex="0";let e=this.#t1=document.createElement("span");t.append(e),this.#t8?(t.classList.add("new"),t.setAttribute("data-l10n-id",ih.#t7.missing),e.setAttribute("data-l10n-id",ih.#t7["missing-label"])):(t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label"));let i=this.#a._uiManager._signal;t.addEventListener("contextmenu",eV,{signal:i}),t.addEventListener("pointerdown",t=>t.stopPropagation(),{signal:i});let r=t=>{t.preventDefault(),this.#a._uiManager.editAltText(this.#a),this.#t8&&this.#a._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:this.#et}})};return t.addEventListener("click",r,{capture:!0,signal:i}),t.addEventListener("keydown",e=>{e.target===t&&"Enter"===e.key&&(this.#t3=!0,r(e))},{signal:i}),await this.#ee(),t}get #et(){return this.#l&&"added"||null===this.#l&&this.guessedText&&"review"||"missing"}finish(){this.#t0&&(this.#t0.focus({focusVisible:this.#t3}),this.#t3=!1)}isEmpty(){return this.#t8?null===this.#l:!this.#l&&!this.#tZ}hasData(){return this.#t8?null!==this.#l||!!this.#t4:this.isEmpty()}get guessedText(){return this.#t4}async setGuessedText(t){null===this.#l&&(this.#t4=t,this.#t9=await ih._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:t}),this.#ee())}toggleAltTextBadge(t=!1){if(!this.#t8||this.#l){this.#t6?.remove(),this.#t6=null;return}if(!this.#t6){let t=this.#t6=document.createElement("div");t.className="noAltTextBadge",this.#a.div.append(t)}this.#t6.classList.toggle("hidden",!t)}serialize(t){let e=this.#l;return t||this.#t4!==e||(e=this.#t9),{altText:e,decorative:this.#tZ,guessedText:this.#t4,textWithDisclaimer:this.#t9}}get data(){return{altText:this.#l,decorative:this.#tZ}}set data({altText:t,decorative:e,guessedText:i,textWithDisclaimer:r,cancel:n=!1}){i&&(this.#t4=i,this.#t9=r),(this.#l!==t||this.#tZ!==e)&&(n||(this.#l=t,this.#tZ=e),this.#ee())}toggle(t=!1){this.#t0&&(!t&&this.#t5&&(clearTimeout(this.#t5),this.#t5=null),this.#t0.disabled=!t)}shown(){this.#a._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:this.#et}})}destroy(){this.#t0?.remove(),this.#t0=null,this.#t1=null,this.#t2=null,this.#t6?.remove(),this.#t6=null}async #ee(){let t=this.#t0;if(!t)return;if(this.#t8){if(t.classList.toggle("done",!!this.#l),t.setAttribute("data-l10n-id",ih.#t7[this.#et]),this.#t1?.setAttribute("data-l10n-id",ih.#t7[`${this.#et}-label`]),!this.#l)return void this.#t2?.remove()}else{if(!this.#l&&!this.#tZ){t.classList.remove("done"),this.#t2?.remove();return}t.classList.add("done"),t.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let e=this.#t2;if(!e){this.#t2=e=document.createElement("span"),e.className="tooltip",e.setAttribute("role","tooltip"),e.id=`alt-text-tooltip-${this.#a.id}`;let i=this.#a._uiManager._signal;i.addEventListener("abort",()=>{clearTimeout(this.#t5),this.#t5=null},{once:!0}),t.addEventListener("mouseenter",()=>{this.#t5=setTimeout(()=>{this.#t5=null,this.#t2.classList.add("show"),this.#a._reportTelemetry({action:"alt_text_tooltip"})},100)},{signal:i}),t.addEventListener("mouseleave",()=>{this.#t5&&(clearTimeout(this.#t5),this.#t5=null),this.#t2?.classList.remove("show")},{signal:i})}this.#tZ?e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(e.removeAttribute("data-l10n-id"),e.textContent=this.#l),e.parentNode||t.append(e);let i=this.#a.getElementForAltText();i?.setAttribute("aria-describedby",e.id)}}
3class id{#ei=null;#er=null;#en=!1;#a=null;#es=null;#ea=null;#eo=null;#el=null;#eh=!1;#ed=null;constructor(t){this.#a=t}renderForToolbar(){let t=this.#er=document.createElement("button");return t.className="comment",this.#y(t,!1)}renderForStandalone(){let t=this.#ei=document.createElement("button");t.className="annotationCommentButton";let e=this.#a.commentButtonPosition;if(e){let{style:i}=t;i.insetInlineEnd=`calc(${100*("ltr"===this.#a._uiManager.direction?1-e[0]:e[0])}% - var(--comment-button-dim))`,i.top=`calc(${100*e[1]}% - var(--comment-button-dim))`;let r=this.#a.commentButtonColor;r&&(i.backgroundColor=r)}return this.#y(t,!0)}focusButton(){setTimeout(()=>{(this.#ei??this.#er)?.focus()},0)}onUpdatedColor(){if(!this.#ei)return;let t=this.#a.commentButtonColor;t&&(this.#ei.style.backgroundColor=t),this.#a._uiManager.updatePopupColor(this.#a)}get commentButtonWidth(){return(this.#ei?.getBoundingClientRect().width??0)/this.#a.parent.boundingClientRect.width}get commentPopupPositionInLayer(){if(this.#ed)return this.#ed;if(!this.#ei)return null;let{x:t,y:e,height:i}=this.#ei.getBoundingClientRect(),{x:r,y:n,width:s,height:a}=this.#a.parent.boundingClientRect;return[(t-r)/s,(e+i-n)/a]}set commentPopupPositionInLayer(t){this.#ed=t}hasDefaultPopupPosition(){return null===this.#ed}removeStandaloneCommentButton(){this.#ei?.remove(),this.#ei=null}removeToolbarCommentButton(){this.#er?.remove(),this.#er=null}setCommentButtonStates({selected:t,hasPopup:e}){this.#ei&&(this.#ei.classList.toggle("selected",t),this.#ei.ariaExpanded=e)}#y(t,e){if(!this.#a._uiManager.hasCommentManager())return null;t.tabIndex="0",t.ariaHasPopup="dialog",e?(t.ariaControls="commentPopup",t.setAttribute("data-l10n-id","pdfjs-show-comment-button")):(t.ariaControlsElements=[this.#a._uiManager.getCommentDialogElement()],t.setAttribute("data-l10n-id","pdfjs-editor-add-comment-button"));let i=this.#a._uiManager._signal;if(!(i instanceof AbortSignal)||i.aborted)return t;t.addEventListener("contextmenu",eV,{signal:i}),e&&(t.addEventListener("focusin",t=>{this.#a._focusEventsAllowed=!1,eW(t)},{capture:!0,signal:i}),t.addEventListener("focusout",t=>{this.#a._focusEventsAllowed=!0,eW(t)},{capture:!0,signal:i})),t.addEventListener("pointerdown",t=>t.stopPropagation(),{signal:i});let r=e=>{e.preventDefault(),t===this.#er?this.edit():this.#a.toggleComment(!0)};return t.addEventListener("click",r,{capture:!0,signal:i}),t.addEventListener("keydown",e=>{e.target===t&&"Enter"===e.key&&(this.#en=!0,r(e))},{signal:i}),t.addEventListener("pointerenter",()=>{this.#a.toggleComment(!1,!0)},{signal:i}),t.addEventListener("pointerleave",()=>{this.#a.toggleComment(!1,!1)},{signal:i}),t}edit(t){let e,i,r=this.commentPopupPositionInLayer;if(r)[e,i]=r;else{[e,i]=this.#a.commentButtonPosition;let{width:t,height:r,x:n,y:s}=this.#a;e=n+e*t,i=s+i*r}let n=this.#a.parent.boundingClientRect,{x:s,y:a,width:o,height:l}=n;this.#a._uiManager.editComment(this.#a,s+e*o,a+i*l,{...t,parentDimensions:n})}finish(){this.#er&&(this.#er.focus({focusVisible:this.#en}),this.#en=!1)}isDeleted(){return this.#eh||""===this.#eo}isEmpty(){return null===this.#eo}hasBeenEdited(){return this.isDeleted()||this.#eo!==this.#es}serialize(){return this.data}get data(){return{text:this.#eo,richText:this.#ea,date:this.#el,deleted:this.isDeleted()}}set data(t){if(t!==this.#eo&&(this.#ea=null),null===t){this.#eo="",this.#eh=!0;return}this.#eo=t,this.#el=new Date,this.#eh=!1}restoreData({text:t,richText:e,date:i}){this.#eo=t,this.#ea=e,this.#el=i,this.#eh=!1}setInitialText(t,e=null){this.#es=t,this.data=t,this.#el=null,this.#ea=e}shown(){}destroy(){this.#er?.remove(),this.#er=null,this.#ei?.remove(),this.#ei=null,this.#eo="",this.#ea=null,this.#el=null,this.#a=null,this.#en=!1,this.#eh=!1}}class ic{#tC;#ec=!1;#eu=null;#ep;#eg;#em;#ef;#eb=null;#ev;#ey=null;#ew;#ex=null;constructor({container:t,isPinchingDisabled:e=null,isPinchingStopped:i=null,onPinchStart:r=null,onPinching:n=null,onPinchEnd:s=null,signal:a}){this.#tC=t,this.#eu=i,this.#ep=e,this.#eg=r,this.#em=n,this.#ef=s,this.#ew=new AbortController,this.#ev=AbortSignal.any([a,this.#ew.signal]),t.addEventListener("touchstart",this.#eA.bind(this),{passive:!1,signal:this.#ev})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return 35/eQ.pixelRatio}#eA(t){if(this.#ep?.())return;if(1===t.touches.length){if(this.#eb)return;let t=this.#eb=new AbortController,e=AbortSignal.any([this.#ev,t.signal]),i=this.#tC,r={capture:!0,signal:e,passive:!1},n=t=>{"touch"===t.pointerType&&(this.#eb?.abort(),this.#eb=null)};i.addEventListener("pointerdown",t=>{"touch"===t.pointerType&&(eW(t),n(t))},r),i.addEventListener("pointerup",n,r),i.addEventListener("pointercancel",n,r);return}if(!this.#ex){this.#ex=new AbortController;let t=AbortSignal.any([this.#ev,this.#ex.signal]),e=this.#tC,i={signal:t,capture:!1,passive:!1};e.addEventListener("touchmove",this.#eS.bind(this),i);let r=this.#eT.bind(this);e.addEventListener("touchend",r,i),e.addEventListener("touchcancel",r,i),i.capture=!0,e.addEventListener("pointerdown",eW,i),e.addEventListener("pointermove",eW,i),e.addEventListener("pointercancel",eW,i),e.addEventListener("pointerup",eW,i),this.#eg?.()}if(eW(t),2!==t.touches.length||this.#eu?.()){this.#ey=null;return}let[e,i]=t.touches;e.identifier>i.identifier&&([e,i]=[i,e]),this.#ey={touch0X:e.screenX,touch0Y:e.screenY,touch1X:i.screenX,touch1Y:i.screenY}}#eS(t){if(!this.#ey||2!==t.touches.length)return;eW(t);let[e,i]=t.touches;e.identifier>i.identifier&&([e,i]=[i,e]);let{screenX:r,screenY:n}=e,{screenX:s,screenY:a}=i,o=this.#ey,{touch0X:l,touch0Y:h,touch1X:d,touch1Y:c}=o,u=Math.hypot(s-r,a-n)||1,p=Math.hypot(d-l,c-h)||1;if(!this.#ec&&Math.abs(p-u)<=ic.MIN_TOUCH_DISTANCE_TO_PINCH)return;if(o.touch0X=r,o.touch0Y=n,o.touch1X=s,o.touch1Y=a,!this.#ec){this.#ec=!0;return}let g=[(r+s)/2,(n+a)/2];this.#em?.(g,p,u)}#eT(t){t.touches.length>
vendor: 4,095 bytes, line 3
3=2||(this.#ex&&(this.#ex.abort(),this.#ex=null,this.#ef?.()),this.#ey&&(eW(t),this.#ey=null,this.#ec=!1))}destroy(){this.#ew?.abort(),this.#ew=null,this.#eb?.abort(),this.#eb=null}}class iu{#e_=null;#eE=null;#l=null;#h=null;#ei=null;#eC=!1;#ek=null;#eP="";#eM=null;#eD=null;#eI=null;#eR=null;#eF=null;#eB="";#eO=!1;#eL=null;#eN=!1;#eU=!1;#ej=!1;#ez=null;#eH=0;#e$=0;#eV=null;#eW=null;isSelected=!1;_isCopy=!1;_editToolbar=null;_initialOptions=Object.create(null);_initialData=null;_isVisible=!0;_uiManager=null;_focusEventsAllowed=!0;static _l10n=null;static _l10nResizer=null;#eG=!1;#eq=iu._zIndex++;static _borderLineWidth=-1;static _colorManager=new io;static _zIndex=1;static _telemetryTimeout=1e3;static get _resizerKeyboardManager(){let t=iu.prototype._resizeWithKeyboard,e=il.TRANSLATE_SMALL,i=il.TRANSLATE_BIG;return eg(this,"_resizerKeyboardManager",new ia([[["ArrowLeft","mac+ArrowLeft"],t,{args:[-e,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t,{args:[-i,0]}],[["ArrowRight","mac+ArrowRight"],t,{args:[e,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t,{args:[i,0]}],[["ArrowUp","mac+ArrowUp"],t,{args:[0,-e]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t,{args:[0,-i]}],[["ArrowDown","mac+ArrowDown"],t,{args:[0,e]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t,{args:[0,i]}],[["Escape","mac+Escape"],iu.prototype._stopResizingWithKeyboard]]))}constructor(t){this.parent=t.parent,this.id=t.id,this.width=this.height=null,this.pageIndex=t.parent.pageIndex,this.name=t.name,this.div=null,this._uiManager=t.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=t.isCentered,this._structTreeParentId=null,this.annotationElementId=t.annotationElementId||null,this.creationDate=t.creationDate||new Date,this.modificationDate=t.modificationDate||null,this.canAddComment=!0;let{rotation:e,rawDims:{pageWidth:i,pageHeight:r,pageX:n,pageY:s}}=this.parent.viewport;this.rotation=e,this.pageRotation=(360+e-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[i,r],this.pageTranslation=[n,s];let[a,o]=this.parentDimensions;this.x=t.x/a,this.y=t.y/o,this.isAttachedToDOM=!1,this.deleted=!1}updatePageIndex(t){this.pageIndex=t}get editorType(){return Object.getPrototypeOf(this).constructor._type}get mode(){return Object.getPrototypeOf(this).constructor._editorType}static get isDrawer(){return!1}static get _defaultLineColor(){return eg(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(t){let e=new ip({id:t._uiManager.getId(),parent:t.parent,uiManager:t._uiManager});e.annotationElementId=t.annotationElementId,e.deleted=!0,e._uiManager.addToAnnotationStorage(e)}static initialize(t,e){if(iu._l10n??=t,iu._l10nResizer||=Object.freeze({topLeft:"pdfjs-editor-resizer-top-left",topMiddle:"pdfjs-editor-resizer-top-middle",topRight:"pdfjs-editor-resizer-top-right",middleRight:"pdfjs-editor-resizer-middle-right",bottomRight:"pdfjs-editor-resizer-bottom-right",bottomMiddle:"pdfjs-editor-resizer-bottom-middle",bottomLeft:"pdfjs-editor-resizer-bottom-left",middleLeft:"pdfjs-editor-resizer-middle-left"}),-1!==iu._borderLineWidth)return;let i=getComputedStyle(document.documentElement);iu._borderLineWidth=parseFloat(i.getPropertyValue("--outline-width"))||0}static updateDefaultParams(t,e){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(t){return!1}static paste(t,e){eh("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return this.#eG}set _isDraggable(t){this.#eG=t,this.div?.classList.toggle("draggable",t)}get uid(){return this.annotationElementId||this.id}get isEnterHandled(){return!0}center(){let[t,e]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*e/(2*t),this.y+=this.width*t/(2*e);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*e/(2*t),this.y-=this.width*t/(2*e);break;default:this.x-=this.width/2,this.y-=this.height/2}this.fixAndSetPosition()}addCommands(t){this._uiManager.addCommands(t)}get currentLayer(){return this._uiManager.currentLayer}
3setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=this.#eq}setParent(t){null!==t?(this.pageIndex=t.pageIndex,this.pageDimensions=t.pageDimensions):(this.#eK(),this.#eR?.remove(),this.#eR=null),this.parent=t}focusin(t){this._focusEventsAllowed&&(this.#eO?this.#eO=!1:this.parent.setSelected(this))}focusout(t){if(!this._focusEventsAllowed||!this.isAttachedToDOM)return;let e=t.relatedTarget;!e?.closest(`#${this.id}`)&&(t.preventDefault(),this.parent?.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.isInEditMode()&&this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(t,e,i,r){let[n,s]=this.parentDimensions;[i,r]=this.screenToPageTranslation(i,r),this.x=(t+i)/n,this.y=(e+r)/s,this.fixAndSetPosition()}_moveAfterPaste(t,e){if(this.isClone)return void delete this.isClone;let[i,r]=this.parentDimensions;this.setAt(t*i,e*r,this.width*i,this.height*r),this._onTranslated()}#eX([t,e],i,r){[i,r]=this.screenToPageTranslation(i,r),this.x+=i/t,this.y+=r/e,this._onTranslating(this.x,this.y),this.fixAndSetPosition()}translate(t,e){this.#eX(this.parentDimensions,t,e)}translateInPage(t,e){this.#eL||=[this.x,this.y,this.width,this.height],this.#eX(this.pageDimensions,t,e),this.div.scrollIntoView({block:"nearest"})}translationDone(){this._onTranslated(this.x,this.y)}drag(t,e){this.#eL||=[this.x,this.y,this.width,this.height];let{div:i,parentDimensions:[r,n]}=this;if(this.x+=t/r,this.y+=e/n,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){let{x:t,y:e}=this.div.getBoundingClientRect();this.parent.findNewParent(this,t,e)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:s,y:a}=this,[o,l]=this.getBaseTranslation();s+=o,a+=l;let{style:h}=i;h.left=`${(100*s).toFixed(2)}%`,h.top=`${(100*a).toFixed(2)}%`,this._onTranslating(s,a),i.scrollIntoView({block:"nearest"})}_onTranslating(t,e){}_onTranslated(t,e){}get _hasBeenMoved(){return!!this.#eL&&(this.#eL[0]!==this.x||this.#eL[1]!==this.y)}get _hasBeenResized(){return!!this.#eL&&(this.#eL[2]!==this.width||this.#eL[3]!==this.height)}getBaseTranslation(){let[t,e]=this.parentDimensions,{_borderLineWidth:i}=iu,r=i/t,n=i/e;switch(this.rotation){case 90:return[-r,n];case 180:return[r,n];case 270:return[r,-n];default:return[-r,-n]}}get _mustFixPosition(){return!0}fixAndSetPosition(t=this.rotation){let{div:{style:e},pageDimensions:[i,r]}=this,{x:n,y:s,width:a,height:o}=this;if(a*=i,o*=r,n*=i,s*=r,this._mustFixPosition)switch(t){case 0:n=eI(n,0,i-a),s=eI(s,0,r-o);break;case 90:n=eI(n,0,i-o),s=eI(s,a,r);break;case 180:n=eI(n,a,i),s=eI(s,o,r);break;case 270:n=eI(n,o,i),s=eI(s,0,r-a)}this.x=n/=i,this.y=s/=r;let[l,h]=this.getBaseTranslation();n+=l,s+=h,e.left=`${(100*n).toFixed(2)}%`,e.top=`${(100*s).toFixed(2)}%`,this.moveInDOM()}static #eY(t,e,i){switch(i){case 90:return[e,-t];case 180:return[-t,-e];case 270:return[-e,t];default:return[t,e]}}screenToPageTranslation(t,e){return iu.#eY(t,e,this.parentRotation)}pageTranslationToScreen(t,e){return iu.#eY(t,e,360-this.parentRotation)}#eJ(t){switch(t){case 90:{let[t,e]=this.pageDimensions;return[0,-t/e,e/t,0]}case 180:return[-1,0,0,-1];case 270:{let[t,e]=this.pageDimensions;return[0,t/e,-e/t,0]}default:return[1,0,0,1]}}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){let{parentScale:t,pageDimensions:[e,i]}=this;return[e*t,i*t]}setDims(){let{div:{style:t},width:e,height:i}=this;t.width=`${(100*e).toFixed(2)}%`,t.height=`${(100*i).toFixed(2)}%`}getInitialTranslation(){return[0,0]}#eQ(){if(this.#eM)return;this.#eM=document.createElement("div"),this.#eM.classList.add("resizers");let t=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],e=this._uiManager._signal;for(let i of t){let t=document.createElement("div");this.#eM.append(t),t.classList.add("resizer",i),t.setAttribute("data-resizer-name",i),t.addEventListener("pointerdown",this.#eZ.bind(this,i),{signal:e}),t.addEventListener("contextmenu",eV,{signal:e}),t.tabIndex=-1}this.div.prepend(this.#eM)}#eZ(t,e){e.preventDefault();let{isMac:i}=eS.platform;if(0!==e.button||e.ctrlKey&&i)return;this.#l?.toggle(!1);let r=this._isDraggable;this._isDraggable=!1,this.#eD=[e.screenX,e.screenY];let n=new AbortController,s=this._uiManager.combinedSignal(n);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",this.#e0.bind(this,t),{passive:!0,capture:!0,signal:s}),window.addEventListener("touchmove",eW,{passive:!1,signal:s}),window.addEventListener("contextmenu",eV,{signal:s}),this.#eI={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};let a=this.parent.div.style.cursor,o=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(e.target).cursor;let l=()=>{n.abort(),this.parent.togglePointerEvents(!0),this.#l?.toggle(!0),this._isDraggable=r,this.parent.div.style.cursor=a,this.div.style.cursor=o,this.#e1()};window.addEventListener("pointerup",l,{signal:s}),window.addEventListener("blur",l,{signal:s})}#e2(t,e,i,r){this.width=i,this.height=r,this.x=t,this.y=e,this.setDims(),this.fixAndSetPosition(),this._onResized()}_onResized(){}#e1(){if(!this.#eI)return;let{savedX:t,savedY:e,savedWidth:i,savedHeight:r}=this.#eI;this.#eI=null;let n=this.x,s=this.y,a=this.width,o=this.height;(n!==t||s!==e||a!==i||o!==r)&&this.addCommands({cmd:this.#e2.bind(this,n,s,a,o),undo:this.#e2.bind(this,t,e,i,r),mustExec:!0})}static _round(t){return Math.round(1e4*t)/1e4}#e0(t,e){let i,r,n,s,a,o,[l,h]=this.parentDimensions,d=this.x,c=this.y,u=this.width,p=this.height,g=iu.MIN_SIZE/l,m=iu.MIN_SIZE/h,f=this.#eJ(this.rotation),b=(t,e)=>[f[0]*t+f[2]*e,f[1]*t+f[3]*e],v=this.#eJ(360-this.rotation),y=!1,w=!1;switch(t){case"topLeft":y=!0,i=(t,e)=>
3[0,0],r=(t,e)=>[t,e];break;case"topMiddle":i=(t,e)=>[t/2,0],r=(t,e)=>[t/2,e];break;case"topRight":y=!0,i=(t,e)=>[t,0],r=(t,e)=>[0,e];break;case"middleRight":w=!0,i=(t,e)=>[t,e/2],r=(t,e)=>[0,e/2];break;case"bottomRight":y=!0,i=(t,e)=>[t,e],r=(t,e)=>[0,0];break;case"bottomMiddle":i=(t,e)=>[t/2,e],r=(t,e)=>[t/2,0];break;case"bottomLeft":y=!0,i=(t,e)=>[0,e],r=(t,e)=>[t,0];break;case"middleLeft":w=!0,i=(t,e)=>[0,e/2],r=(t,e)=>[t,e/2]}let x=i(u,p),A=r(u,p),S=b(...A),T=iu._round(d+S[0]),_=iu._round(c+S[1]),E=1,C=1;if(e.fromKeyboard)({deltaX:n,deltaY:s}=e);else{let{screenX:t,screenY:i}=e,[r,a]=this.#eD;[n,s]=this.screenToPageTranslation(t-r,i-a),this.#eD[0]=t,this.#eD[1]=i}if([n,s]=(a=n/l,o=s/h,[v[0]*a+v[2]*o,v[1]*a+v[3]*o]),y){let t=Math.hypot(u,p);E=C=Math.max(Math.min(Math.hypot(A[0]-x[0]-n,A[1]-x[1]-s)/t,1/u,1/p),g/u,m/p)}else w?E=eI(Math.abs(A[0]-x[0]-n),g,1)/u:C=eI(Math.abs(A[1]-x[1]-s),m,1)/p;let k=iu._round(u*E),P=iu._round(p*C),M=T-(S=b(...r(k,P)))[0],D=_-S[1];this.#eL||=[this.x,this.y,this.width,this.height],this.width=k,this.height=P,this.x=M,this.y=D,this.setDims(),this.fixAndSetPosition(),this._onResizing()}_onResizing(){}altTextFinish(){this.#l?.finish()}get toolbarButtons(){return null}async addEditToolbar(){if(this._editToolbar||this.#eU)return this._editToolbar;this._editToolbar=new e8(this),this.div.append(this._editToolbar.render());let{toolbarButtons:t}=this;if(t)for(let[e,i]of t)await this._editToolbar.addButton(e,i);return this.hasComment||this._editToolbar.addButton("comment",this.addCommentButton()),this._editToolbar.addButton("delete"),this._editToolbar}addCommentButtonInToolbar(){this._editToolbar?.addButtonBefore("comment",this.addCommentButton(),".deleteButton")}removeCommentButtonFromToolbar(){this._editToolbar?.removeButton("comment")}removeEditToolbar(){this._editToolbar?.remove(),this._editToolbar=null,this.#l?.destroy()}addContainer(t){let e=this._editToolbar?.div;e?e.before(t):this.div.append(t)}getClientDimensions(){return this.div.getBoundingClientRect()}createAltText(){return!this.#l&&(ih.initialize(iu._l10n),this.#l=new ih(this),this.#e_&&(this.#l.data=this.#e_,this.#e_=null)),this.#l}get altTextData(){return this.#l?.data}set altTextData(t){this.#l&&(this.#l.data=t)}get guessedAltText(){return this.#l?.guessedText}async setGuessedAltText(t){await this.#l?.setGuessedText(t)}serializeAltText(t){return this.#l?.serialize(t)}hasAltText(){return!!this.#l&&!this.#l.isEmpty()}hasAltTextData(){return this.#l?.hasData()??!1}focusCommentButton(){this.#h?.focusButton()}addCommentButton(){return this.canAddComment?this.#h||=new id(this):null}addStandaloneCommentButton(){if(this._uiManager.hasCommentManager()){if(this.#ei){this._uiManager.isEditingMode()&&this.#ei.classList.remove("hidden");return}this.hasComment&&(this.#ei=this.#h.renderForStandalone(),this.div.append(this.#ei))}}removeStandaloneCommentButton(){this.#h.removeStandaloneCommentButton(),this.#ei=null}hideStandaloneCommentButton(){this.#ei?.classList.add("hidden")}get comment(){if(!this.#h)return null;let{data:{richText:t,text:e,date:i,deleted:r}}=this.#h;return{text:e,richText:t,date:i,deleted:r,color:this.getNonHCMColor(),opacity:this.opacity??1}}set comment(t){this.#h||=new id(this),"object"==typeof t&&null!==t?this.#h.restoreData(t):this.#h.data=t,this.hasComment?(this.removeCommentButtonFromToolbar(),this.addStandaloneCommentButton(),this._uiManager.updateComment(this)):(this.addCommentButtonInToolbar(),this.removeStandaloneCommentButton(),this._uiManager.removeComment(this))}setCommentData({comment:t,popupRef:e,richText:i}){if(!e||(this.#h||=new id(this),this.#h.setInitialText(t,i),!this.annotationElementId))return;let r=this._uiManager.getAndRemoveDataFromAnnotationStorage(this.annotationElementId);r&&this.updateFromAnnotationLayer(r)}get hasEditedComment(){return this.#h?.hasBeenEdited()}get hasDeletedComment(){return this.#h?.isDeleted()}get hasComment(){return!!this.#h&&!this.#h.isEmpty()&&!this.#h.isDeleted()}async editComment(t){this.#h||=new id(this),this.#h.edit(t)}toggleComment(t,e){this.hasComment&&this._uiManager.toggleComment(this,t,e)}setSelectedCommentButton(t){this.#h.setSelectedButton(t)}addComment(t){if(this.hasEditedComment){let[,,,e]=t.rect,[i]=this.pageDimensions,[r]=this.pageTranslation,n=r+i+1;t.popup={contents:this.comment.text,deleted:this.comment.deleted,rect:[n,e-100,n+180,e]}}}updateFromAnnotationLayer({popup:{contents:t,deleted:e}}){this.#h.data=e?null:t}get parentBoundingClientRect(){return this.parent.boundingClientRect}render(){let t=this.div=document.createElement("div");t.setAttribute("data-editor-rotation",(360-this.rotation)%360),t.className=this.name,t.setAttribute("id",this.id),t.tabIndex=this.#eC?-1:0,t.setAttribute("role","application"),this.defaultL10nId&&t.setAttribute("data-l10n-id",this.defaultL10nId),this._isVisible||t.classList.add("hidden"),this.setInForeground(),this.#e5();let[e,i]=this.parentDimensions;this.parentRotation%180!=0&&(t.style.maxWidth=`${(100*i/e).toFixed(2)}%`,t.style.maxHeight=`${(100*e/i).toFixed(2)}%`);let[r,n]=this.getInitialTranslation();return this.translate(r,n),it(this,t,["keydown","pointerdown","dblclick"]),this.isResizable&&this._uiManager._supportsPinchToZoom&&(this.#eW||=new ic({container:t,isPinchingDisabled:()=>!this.isSelected,onPinchStart:this.#e3.bind(this),onPinching:this.#e6.bind(this),onPinchEnd:this.#e4.bind(this),signal:this._uiManager._signal})),this.addStandaloneCommentButton(),this._uiManager._editorUndoBar?.hide(),t}#e3(){this.#eI={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height},this.#l?.toggle(!1),this.parent.togglePointerEvents(!1)}#e6(t,e,i){let r=i/e*.7+1-.7;
3if(1===r)return;let n=this.#eJ(this.rotation),s=(t,e)=>[n[0]*t+n[2]*e,n[1]*t+n[3]*e],[a,o]=this.parentDimensions,l=this.x,h=this.y,d=this.width,c=this.height;r=Math.max(Math.min(r,1/d,1/c),iu.MIN_SIZE/a/d,iu.MIN_SIZE/o/c);let u=iu._round(d*r),p=iu._round(c*r);if(u===d&&p===c)return;this.#eL||=[l,h,d,c];let g=s(d/2,c/2),m=iu._round(l+g[0]),f=iu._round(h+g[1]),b=s(u/2,p/2);this.x=m-b[0],this.y=f-b[1],this.width=u,this.height=p,this.setDims(),this.fixAndSetPosition(),this._onResizing()}#e4(){this.#l?.toggle(!0),this.parent.togglePointerEvents(!0),this.#e1()}pointerdown(t){let{isMac:e}=eS.platform;0!==t.button||t.ctrlKey&&e?t.preventDefault():(this.#eO=!0,this._isDraggable)?this.#e9(t):this.#e8(t)}#e8(t){let{isMac:e}=eS.platform;t.ctrlKey&&!e||t.shiftKey||t.metaKey&&e?this.parent.toggleSelected(this):this.parent.setSelected(this)}#e9(t){let{isSelected:e}=this;this._uiManager.setUpDragSession();let i=!1,r=new AbortController,n=this._uiManager.combinedSignal(r),s={capture:!0,passive:!1,signal:n},a=t=>{r.abort(),this.#ek=null,this.#eO=!1,this._uiManager.endDragSession()||this.#e8(t),i&&this._onStopDragging()};e&&(this.#eH=t.clientX,this.#e$=t.clientY,this.#ek=t.pointerId,this.#eP=t.pointerType,window.addEventListener("pointermove",t=>{i||(i=!0,this._uiManager.toggleComment(this,!0,!1),this._onStartDragging());let{clientX:e,clientY:r,pointerId:n}=t;if(n!==this.#ek)return void eW(t);let[s,a]=this.screenToPageTranslation(e-this.#eH,r-this.#e$);this.#eH=e,this.#e$=r,this._uiManager.dragSelectedEditors(s,a)},s),window.addEventListener("touchmove",eW,s),window.addEventListener("pointerdown",t=>{t.pointerType===this.#eP&&(this.#eW||t.isPrimary)&&a(t),eW(t)},s));let o=t=>{this.#ek&&this.#ek!==t.pointerId?eW(t):a(t)};window.addEventListener("pointerup",o,{signal:n}),window.addEventListener("blur",o,{signal:n})}_onStartDragging(){}_onStopDragging(){}moveInDOM(){this.#ez&&clearTimeout(this.#ez),this.#ez=setTimeout(()=>{this.#ez=null,this.parent?.moveEditorInDOM(this)},0)}_setParentAndPosition(t,e,i){t.changeParent(this),this.x=e,this.y=i,this.fixAndSetPosition(),this._onTranslated()}getRect(t,e,i=this.rotation){let r=this.parentScale,[n,s]=this.pageDimensions,[a,o]=this.pageTranslation,l=t/r,h=e/r,d=this.x*n,c=this.y*s,u=this.width*n,p=this.height*s;switch(i){case 0:return[d+l+a,s-c-h-p+o,d+l+u+a,s-c-h+o];case 90:return[d+h+a,s-c+l+o,d+h+p+a,s-c+l+u+o];case 180:return[d-l-u+a,s-c+h+o,d-l+a,s-c+h+p+o];case 270:return[d-h-p+a,s-c-l-u+o,d-h+a,s-c-l+o];default:throw Error("Invalid rotation")}}getRectInCurrentCoords(t,e){let[i,r,n,s]=t,a=n-i,o=s-r;switch(this.rotation){case 0:return[i,e-s,a,o];case 90:return[i,e-r,o,a];case 180:return[n,e-r,a,o];case 270:return[n,e-s,o,a];default:throw Error("Invalid rotation")}}getPDFRect(){return this.getRect(0,0)}getNonHCMColor(){return this.color&&iu._colorManager.convert(this._uiManager.getNonHCMColor(this.color))}onUpdatedColor(){this.#h?.onUpdatedColor()}getData(){let{comment:{text:t,color:e,date:i,opacity:r,deleted:n,richText:s},uid:a,pageIndex:o,creationDate:l,modificationDate:h}=this;return{id:a,pageIndex:o,rect:this.getPDFRect(),richText:s,contentsObj:{str:t},creationDate:l,modificationDate:i||h,popupRef:!n,color:e,opacity:r}}onceAdded(t){}isEmpty(){return!1}enableEditMode(){return!this.isInEditMode()&&(this.parent.setEditingState(!1),this.#eU=!0,!0)}disableEditMode(){return!!this.isInEditMode()&&(this.parent.setEditingState(!0),this.#eU=!1,!0)}isInEditMode(){return this.#eU}shouldGetKeyboardEvents(){return this.#ej}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}get isOnScreen(){let{top:t,left:e,bottom:i,right:r}=this.getClientDimensions(),{innerHeight:n,innerWidth:s}=window;return e<s&&r>0&&t<n&&i>0}#e5(){if(this.#eF||!this.div)return;this.#eF=new AbortController;let t=this._uiManager.combinedSignal(this.#eF);this.div.addEventListener("focusin",this.focusin.bind(this),{signal:t}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:t})}rebuild(){this.#e5()}rotate(t){}resize(){}serializeDeleted(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:this._initialData?.popupRef||""}}serialize(t=!1,e=null){return{annotationType:this.mode,pageIndex:this.pageIndex,rect:this.getPDFRect(),rotation:this.rotation,structTreeParentId:this._structTreeParentId,popupRef:this._initialData?.popupRef||""}}static async deserialize(t,e,i){let r=new this.prototype.constructor({parent:e,id:i.getId(),uiManager:i,annotationElementId:t.annotationElementId,creationDate:t.creationDate,modificationDate:t.modificationDate});r.rotation=t.rotation,r.#e_=t.accessibilityData,r._isCopy=t.isCopy||!1;
3let[n,s]=r.pageDimensions,[a,o,l,h]=r.getRectInCurrentCoords(t.rect,s);return r.x=a/n,r.y=o/s,r.width=l/n,r.height=h/s,r}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||null!==this.serialize())}remove(){if(this.#eF?.abort(),this.#eF=null,this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.hideCommentPopup(),this.#ez&&(clearTimeout(this.#ez),this.#ez=null),this.#eK(),this.removeEditToolbar(),this.#eV){for(let t of this.#eV.values())clearTimeout(t);this.#eV=null}this.parent=null,this.#eW?.destroy(),this.#eW=null,this.#eR?.remove(),this.#eR=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(this.#eQ(),this.#eM.classList.remove("hidden"))}get toolbarPosition(){return null}get commentButtonPosition(){return"ltr"===this._uiManager.direction?[1,0]:[0,0]}get commentButtonPositionInPage(){let{commentButtonPosition:[t,e]}=this,[i,r,n,s]=this.getPDFRect();return[iu._round(i+(n-i)*t),iu._round(r+(s-r)*(1-e))]}get commentButtonColor(){return this._uiManager.makeCommentColor(this.getNonHCMColor(),this.opacity)}get commentPopupPosition(){return this.#h.commentPopupPositionInLayer}set commentPopupPosition(t){this.#h.commentPopupPositionInLayer=t}hasDefaultPopupPosition(){return this.#h.hasDefaultPopupPosition()}get commentButtonWidth(){return this.#h.commentButtonWidth}get elementBeforePopup(){return this.div}setCommentButtonStates(t){this.#h?.setCommentButtonStates(t)}keydown(t){if(!this.isResizable||t.target!==this.div||"Enter"!==t.key)return;this._uiManager.setSelected(this),this.#eI={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};let e=this.#eM.children;if(!this.#eE){this.#eE=Array.from(e);let t=this.#e7.bind(this),i=this.#it.bind(this),r=this._uiManager._signal;for(let e of this.#eE){let n=e.getAttribute("data-resizer-name");e.setAttribute("role","spinbutton"),e.addEventListener("keydown",t,{signal:r}),e.addEventListener("blur",i,{signal:r}),e.addEventListener("focus",this.#ie.bind(this,n),{signal:r}),e.setAttribute("data-l10n-id",iu._l10nResizer[n])}}let i=this.#eE[0],r=0;for(let t of e){if(t===i)break;r++}let n=(360-this.rotation+this.parentRotation)%360/90*(this.#eE.length/4);if(n!==r){if(n<r)for(let t=0;t<r-n;t++)this.#eM.append(this.#eM.firstElementChild);else if(n>r)for(let t=0;t<n-r;t++)this.#eM.firstElementChild.before(this.#eM.lastElementChild);let t=0;for(let i of e){let e=this.#eE[t++].getAttribute("data-resizer-name");i.setAttribute("data-l10n-id",iu._l10nResizer[e])}}this.#ii(0),this.#ej=!0,this.#eM.firstElementChild.focus({focusVisible:!0}),t.preventDefault(),t.stopImmediatePropagation()}#e7(t){iu._resizerKeyboardManager.exec(this,t)}#it(t){this.#ej&&t.relatedTarget?.parentNode!==this.#eM&&this.#eK()}#ie(t){this.#eB=this.#ej?t:""}#ii(t){if(this.#eE)for(let e of this.#eE)e.tabIndex=t}_resizeWithKeyboard(t,e){this.#ej&&this.#e0(this.#eB,{deltaX:t,deltaY:e,fromKeyboard:!0})}#eK(){this.#ej=!1,this.#ii(-1),this.#e1()}_stopResizingWithKeyboard(){this.#eK(),this.div.focus()}select(){this.isSelected&&this._editToolbar?this._editToolbar.show():(this.isSelected=!0,this.makeResizable(),this.div?.classList.add("selectedEditor"),this._editToolbar)?(this._editToolbar?.show(),this.#l?.toggleAltTextBadge(!1)):this.addEditToolbar().then(()=>{this.div?.classList.contains("selectedEditor")&&this._editToolbar?.show()})}focus(){this.div&&!this.div.contains(document.activeElement)&&setTimeout(()=>this.div?.focus({preventScroll:!0}),0)}unselect(){this.isSelected&&(this.isSelected=!1,this.#eM?.classList.add("hidden"),this.div?.classList.remove("selectedEditor"),this.div?.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),this._editToolbar?.hide(),this.#l?.toggleAltTextBadge(!0),this.hideCommentPopup())}hideCommentPopup(){this.hasComment&&this._uiManager.toggleComment(null)}updateParams(t,e){}disableEditing(){}enableEditing(){}get canChangeContent(){return!1}enterInEditMode(){this.canChangeContent&&(this.enableEditMode(),this.div.focus())}dblclick(t){"BUTTON"!==t.target.nodeName&&(this.enterInEditMode(),this.parent.updateToolbar({mode:this.constructor._editorType,editId:this.uid}))}getElementForAltText(){return this.div}get contentDiv(){return this.div}get isEditing(){return this.#eN}set isEditing(t){this.#eN=t,this.parent&&(t?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(t,e=!1){if(e){this.#eV||=new Map;let{action:e}=t,i=this.#eV.get(e);i&&clearTimeout(i),i=setTimeout(()=>{this._reportTelemetry(t),this.#eV.delete(e),0===this.#eV.size&&(this.#eV=null)},iu._telemetryTimeout),this.#eV.set(e,i);return}t.type||=this.editorType,this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:t}})}
3show(t=this._isVisible){this.div.classList.toggle("hidden",!t),this._isVisible=t}enable(){this.div&&(this.div.tabIndex=0),this.#eC=!1}disable(){this.div&&(this.div.tabIndex=-1),this.#eC=!0}updateFakeAnnotationElement(t){if(!this.#eR&&!this.deleted){this.#eR=t.addFakeAnnotation(this);return}if(this.deleted){this.#eR.remove(),this.#eR=null;return}(this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized)&&this.#eR.updateEdited({rect:this.getPDFRect(),popup:this.comment})}renderAnnotationElement(t){if(this.deleted)return t.hide(),null;let e=t.container.querySelector(".annotationContent");if(e){if("CANVAS"===e.nodeName){let t=e;(e=document.createElement("div")).classList.add("annotationContent",this.editorType),t.before(e)}}else(e=document.createElement("div")).classList.add("annotationContent",this.editorType),t.container.prepend(e);return e}resetAnnotationElement(t){let{firstElementChild:e}=t.container;e?.nodeName==="DIV"&&e.classList.contains("annotationContent")&&e.remove()}}class ip extends iu{constructor(t){super(t),this.annotationElementId=t.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}}class ig{constructor(t){this.h1=t?0|t:0xc3d2e1f0,this.h2=t?0|t:0xc3d2e1f0}update(t){let e,i;if("string"==typeof t){e=new Uint8Array(2*t.length),i=0;for(let r=0,n=t.length;r<n;r++){let n=t.charCodeAt(r);n<=255?e[i++]=n:(e[i++]=n>>>8,e[i++]=255&n)}}else if(ArrayBuffer.isView(t))i=(e=t.slice()).byteLength;else throw Error("Invalid data format, must be a string or TypedArray.");let r=i>>2,n=i-4*r,s=new Uint32Array(e.buffer,0,r),a=0,o=0,l=this.h1,h=this.h2;for(let t=0;t<r;t++)1&t?(l^=a=0x1b873593*(a=(a=0xcc9e2d51*(a=s[t])&0xffff0000|11601*a&65535)<<15|a>>>17)&0xffff0000|13715*a&65535,l=5*(l=l<<13|l>>>19)+0xe6546b64):(h^=o=0x1b873593*(o=(o=0xcc9e2d51*(o=s[t])&0xffff0000|11601*o&65535)<<15|o>>>17)&0xffff0000|13715*o&65535,h=5*(h=h<<13|h>>>19)+0xe6546b64);switch(a=0,n){case 3:a^=e[4*r+2]<<16;case 2:a^=e[4*r+1]<<8;case 1:a^=e[4*r],a=0x1b873593*(a=(a=0xcc9e2d51*a&0xffff0000|11601*a&65535)<<15|a>>>17)&0xffff0000|13715*a&65535,1&r?l^=a:h^=a}this.h1=l,this.h2=h}hexdigest(){let t=this.h1,e=this.h2;return t^=e>>>1,e=0xff51afd7*e&0xffff0000|((e<<16|(t=0xed558ccd*t&0xffff0000|36045*t&65535)>>>16)*0xafd7ed55&0xffff0000)>>>16,t^=e>>>1,e=0xc4ceb9fe*e&0xffff0000|((e<<16|(t=0x1a85ec53*t&0xffff0000|60499*t&65535)>>>16)*0xb9fe1a85&0xffff0000)>>>16,((t^=e>>>1)>>>0).toString(16).padStart(8,"0")+(e>>>0).toString(16).padStart(8,"0")}}let im=Object.freeze({map:null,hash:"",transfer:void 0});class ib{#ir=!1;#is=null;#ia=null;#io=new Map;onSetModified=null;onResetModified=null;onAnnotationEditor=null;getValue(t,e){let i=this.#io.get(t);return void 0===i?e:Object.assign(e,i)}getRawValue(t){return this.#io.get(t)}remove(t){let e=this.#io.get(t);void 0===e||(e instanceof iu&&this.#ia.delete(e.annotationElementId),this.#io.delete(t),0===this.#io.size&&this.resetModified(),this.#io.values().some(t=>t instanceof iu)||this.onAnnotationEditor?.(null))}setValue(t,e){let i=this.#io.get(t),r=!1;if(void 0!==i)for(let[t,n]of Object.entries(e))i[t]!==n&&(r=!0,i[t]=n);else r=!0,this.#io.set(t,e);r&&this.#il(),e instanceof iu&&((this.#ia||=new Map).set(e.annotationElementId,e),this.onAnnotationEditor?.(e.constructor._type))}has(t){return this.#io.has(t)}get size(){return this.#io.size}#il(){this.#ir||(this.#ir=!0,this.onSetModified?.())}resetModified(){this.#ir&&(this.#ir=!1,this.onResetModified?.())}get print(){return new iv(this)}get serializable(){if(0===this.#io.size)return im;let t=new Map,e=new ig,i=[],r=Object.create(null),n=!1;for(let[i,s]of this.#io){let a=s instanceof iu?s.serialize(!1,r):s;s.page&&(s.pageIndex=s.page._pageIndex,delete s.page),a&&(t.set(i,a),e.update(`${i}:${JSON.stringify(a)}`),n||=!!a.bitmap)}if(n)for(let e of t.values())e.bitmap&&i.push(e.bitmap);return t.size>0?{map:t,hash:e.hexdigest(),transfer:i}:im}get editorStats(){let t=null,e=new Map,i=0,r=0;for(let n of this.#io.values()){if(!(n instanceof iu)){n.popup&&(n.popup.deleted?r+=1:i+=1);continue}n.isCommentDeleted?r+=1:n.hasEditedComment&&(i+=1);let s=n.telemetryFinalData;if(!s)continue;let{type:a}=s;e.has(a)||e.set(a,Object.getPrototypeOf(n).constructor),t||=Object.create(null);let o=t[a]||=new Map;for(let[t,e]of Object.entries(s)){if("type"===t)continue;let i=o.getOrInsertComputed(t,eM);i.set(e,(i.get(e)??0)+1)}}if((r>0||i>0)&&((t||=Object.create(null)).comments={deleted:r,edited:i}),!t)return null;for(let[i,r]of e)t[i]=r.computeTelemetryFinalData(t[i]);return t}resetModifiedIds(){this.#is=null}updateEditor(t,e){let i=this.#ia?.get(t);return!!i&&(i.updateFromAnnotationLayer(e),!0)}getEditor(t){return this.#ia?.get(t)||null}get modifiedIds(){if(this.#is)return this.#is;let t=[];
3if(this.#ia)for(let e of this.#ia.values())e.serialize()&&t.push(e.annotationElementId);let e="";if(t.length){let i=new ig;i.update(t.join(",")),e=i.hexdigest()}return this.#is={ids:new Set(t),hash:e}}[Symbol.iterator](){return this.#io.entries()}}class iv extends ib{#ih=im;constructor(t){super();let{serializable:e}=t;if(e===im)return;let{map:i,hash:r,transfer:n}=e,s=structuredClone(i,n?{transfer:n}:null);this.#ih={map:s,hash:r,transfer:[]}}get print(){eh("Should not call PrintAnnotationStorage.print")}get serializable(){return this.#ih}get modifiedIds(){return eg(this,"modifiedIds",{ids:new Set,hash:""})}}t5(7588);let iy="__forcedDependency",{floor:iw,ceil:ix}=Math;function iA(t,e,i,r,n,s){t[4*e+0]=Math.min(t[4*e+0],i),t[4*e+1]=Math.min(t[4*e+1],r),t[4*e+2]=Math.max(t[4*e+2],n),t[4*e+3]=Math.max(t[4*e+3],s)}let iS=new Uint32Array(new Uint8Array([255,255,0,0]).buffer)[0];class iT{#id;#ic;constructor(t,e){this.#id=t,this.#ic=e}get length(){return this.#id.length}isEmpty(t){return this.#id[t]===iS}minX(t){return this.#ic[4*t+0]/256}minY(t){return this.#ic[4*t+1]/256}maxX(t){return(this.#ic[4*t+2]+1)/256}maxY(t){return(this.#ic[4*t+3]+1)/256}}let i_=(t,e)=>t?.getOrInsertComputed(e,()=>({dependencies:new Set,isRenderingOperation:!1}));class iE{#iu=[[1,0,0,1,0,0]];#ip=[-1/0,-1/0,1/0,1/0];#ig=new Float64Array(t6);_pendingBBoxIdx=-1;#im;#ib;#iv;#id;_savesStack=[];_markedContentStack=[];constructor(t,e){this.#im=t.width,this.#ib=t.height,this.#iy(e)}growOperationsCount(t){t>=this.#id.length&&this.#iy(t,this.#id)}#iy(t,e){let i=new ArrayBuffer(4*t);this.#iv=new Uint8ClampedArray(i),this.#id=new Uint32Array(i),e&&e.length>0?(this.#id.set(e),this.#id.fill(iS,e.length)):this.#id.fill(iS)}get clipBox(){return this.#ip}save(t){return this.#ip={__proto__:this.#ip},this._savesStack.push(t),this}restore(t,e){let i=Object.getPrototypeOf(this.#ip);if(null===i)return this;this.#ip=i;let r=this._savesStack.pop();return void 0!==r&&(e?.(r,t),this.#id[t]=this.#id[r]),this}recordOpenMarker(t){return this._savesStack.push(t),this}getOpenMarker(){return 0===this._savesStack.length?null:this._savesStack.at(-1)}recordCloseMarker(t,e){let i=this._savesStack.pop();return void 0!==i&&(e?.(i,t),this.#id[t]=this.#id[i]),this}beginMarkedContent(t){return this._markedContentStack.push(t),this}endMarkedContent(t,e){let i=this._markedContentStack.pop();return void 0!==i&&(e?.(i,t),this.#id[t]=this.#id[i]),this}pushBaseTransform(t){return this.#iu.push(eT.multiplyByDOMMatrix(this.#iu.at(-1),t.getTransform())),this}popBaseTransform(){return this.#iu.length>1&&this.#iu.pop(),this}resetBBox(t){return this._pendingBBoxIdx!==t&&(this._pendingBBoxIdx=t,this.#ig.set(t6,0)),this}recordClipBox(t,e,i,r,n,s){let a=eT.multiplyByDOMMatrix(this.#iu.at(-1),e.getTransform()),o=t6.slice();eT.axialAlignedBoundingBox([i,n,r,s],a,o);let l=eT.intersect(this.#ip,o);return l?(this.#ip[0]=l[0],this.#ip[1]=l[1],this.#ip[2]=l[2],this.#ip[3]=l[3]):(this.#ip[0]=this.#ip[1]=1/0,this.#ip[2]=this.#ip[3]=-1/0),this}recordBBox(t,e,i,r,n,s){let a=this.#ip;if(1/0===a[0])return this;let o=eT.multiplyByDOMMatrix(this.#iu.at(-1),e.getTransform());if(-1/0===a[0])return eT.axialAlignedBoundingBox([i,n,r,s],o,this.#ig),this;let l=t6.slice();return eT.axialAlignedBoundingBox([i,n,r,s],o,l),this.#ig[0]=eI(l[0],a[0],this.#ig[0]),this.#ig[1]=eI(l[1],a[1],this.#ig[1]),this.#ig[2]=eI(l[2],this.#ig[2],a[2]),this.#ig[3]=eI(l[3],this.#ig[3],a[3]),this}recordFullPageBBox(t){return this.#ig[0]=Math.max(0,this.#ip[0]),this.#ig[1]=Math.max(0,this.#ip[1]),this.#ig[2]=Math.min(this.#im,this.#ip[2]),this.#ig[3]=Math.min(this.#ib,this.#ip[3]),this}recordOperation(t,e=!1,i){if(this._pendingBBoxIdx!==t)return this;let r=iw(256*this.#ig[0]/this.#im),n=iw(256*this.#ig[1]/this.#ib),s=ix(256*this.#ig[2]/this.#im),a=ix(256*this.#ig[3]/this.#ib);if(iA(this.#iv,t,r,n,s,a),i)for(let e of i)for(let i of e)i!==t&&iA(this.#iv,i,r,n,s,a);return e||(this._pendingBBoxIdx=-1),this}bboxToClipBoxDropOperation(t){return this._pendingBBoxIdx===t&&(this._pendingBBoxIdx=-1,this.#ip[0]=Math.max(this.#ip[0],this.#ig[0]),this.#ip[1]=Math.max(this.#ip[1],this.#ig[1]),this.#ip[2]=Math.min(this.#ip[2],this.#ig[2]),this.#ip[3]=Math.min(this.#ip[3],this.#ig[3])),this}take(){return new iT(this.#id,this.#iv)}takeDebugMetadata(){throw Error("Unreachable")}recordSimpleData(t,e){return this}recordIncrementalData(t,e){return this}resetIncrementalData(t,e){return this}recordNamedData(t,e){return this}
3recordSimpleDataFromNamed(t,e,i){return this}recordFutureForcedDependency(t,e){return this}inheritSimpleDataAsFutureForcedDependencies(t){return this}inheritPendingDependenciesAsFutureForcedDependencies(){return this}recordCharacterBBox(t,e,i,r=1,n=0,s=0,a){return this}getSimpleIndex(t){}recordDependencies(t,e){return this}recordNamedDependency(t,e){return this}recordShowTextOperation(t,e=!1){return this}}class iC{#iw={__proto__:null};#ix={__proto__:null,transform:[],moveText:[],sameLineText:[],[iy]:[]};#iA=new Map;#iS=new Set;#iT=new Map;#i_;#iE;#iC;constructor(t,e=!1){this.#iC=t,e&&(this.#i_=new Map,this.#iE=(t,e)=>{i_(this.#i_,e).dependencies.add(t)})}get clipBox(){return this.#iC.clipBox}growOperationsCount(t){this.#iC.growOperationsCount(t)}save(t){return this.#iw={__proto__:this.#iw},this.#ix={__proto__:this.#ix,transform:{__proto__:this.#ix.transform},moveText:{__proto__:this.#ix.moveText},sameLineText:{__proto__:this.#ix.sameLineText},[iy]:{__proto__:this.#ix[iy]}},this.#iC.save(t),this}restore(t){this.#iC.restore(t,this.#iE);let e=Object.getPrototypeOf(this.#iw);return null===e||(this.#iw=e,this.#ix=Object.getPrototypeOf(this.#ix)),this}recordOpenMarker(t){return this.#iC.recordOpenMarker(t,this.#iE),this}getOpenMarker(){return this.#iC.getOpenMarker()}recordCloseMarker(t){return this.#iC.recordCloseMarker(t,this.#iE),this}beginMarkedContent(t){return this.#iC.beginMarkedContent(t),this}endMarkedContent(t){return this.#iC.endMarkedContent(t,this.#iE),this}pushBaseTransform(t){return this.#iC.pushBaseTransform(t),this}popBaseTransform(){return this.#iC.popBaseTransform(),this}recordSimpleData(t,e){return this.#iw[t]=e,this}recordIncrementalData(t,e){return this.#ix[t].push(e),this}resetIncrementalData(t,e){return this.#ix[t].length=0,this}recordNamedData(t,e){return this.#iA.set(t,e),this}recordSimpleDataFromNamed(t,e,i){this.#iw[t]=this.#iA.get(e)??i}recordFutureForcedDependency(t,e){return this.recordIncrementalData(iy,e),this}inheritSimpleDataAsFutureForcedDependencies(t){for(let e of t)e in this.#iw&&this.recordFutureForcedDependency(e,this.#iw[e]);return this}inheritPendingDependenciesAsFutureForcedDependencies(){for(let t of this.#iS)this.recordFutureForcedDependency(iy,t);return this}resetBBox(t){return this.#iC.resetBBox(t),this}recordClipBox(t,e,i,r,n,s){return this.#iC.recordClipBox(t,e,i,r,n,s),this}recordBBox(t,e,i,r,n,s){return this.#iC.recordBBox(t,e,i,r,n,s),this}recordCharacterBBox(t,e,i,r=1,n=0,s=0,a){let o,l,h=i.bbox;if(h&&!1!==(o=h[2]!==h[0]&&h[3]!==h[1]&&this.#iT.get(i))&&(l=[0,0,0,0],eT.axialAlignedBoundingBox(h,i.fontMatrix,l),(1!==r||0!==n||0!==s)&&eT.scaleMinMax([r,0,0,-r,n,s],l),o))return this.recordBBox(t,e,l[0],l[2],l[1],l[3]);if(!a)return this.recordFullPageBBox(t);let d=a();return h&&l&&void 0===o&&(o=l[0]<=n-d.actualBoundingBoxLeft&&l[2]>=n+d.actualBoundingBoxRight&&l[1]<=s-d.actualBoundingBoxAscent&&l[3]>=s+d.actualBoundingBoxDescent,this.#iT.set(i,o),o)?this.recordBBox(t,e,l[0],l[2],l[1],l[3]):this.recordBBox(t,e,n-d.actualBoundingBoxLeft,n+d.actualBoundingBoxRight,s-d.actualBoundingBoxAscent,s+d.actualBoundingBoxDescent)}recordFullPageBBox(t){return this.#iC.recordFullPageBBox(t),this}getSimpleIndex(t){return this.#iw[t]}recordDependencies(t,e){let i=this.#iS,r=this.#iw,n=this.#ix;for(let t of e)t in this.#iw?i.add(r[t]):t in n&&n[t].forEach(i.add,i);return this}recordNamedDependency(t,e){return this.#iA.has(e)&&this.#iS.add(this.#iA.get(e)),this}recordOperation(t,e=!1){if(this.recordDependencies(t,[iy]),this.#i_){let e=i_(this.#i_,t),{dependencies:i}=e;this.#iS.forEach(i.add,i),this.#iC._savesStack.forEach(i.add,i),this.#iC._markedContentStack.forEach(i.add,i),i.delete(t),e.isRenderingOperation=!0}let i=!e&&t===this.#iC._pendingBBoxIdx;return this.#iC.recordOperation(t,e,[this.#iS,this.#iC._savesStack,this.#iC._markedContentStack]),i&&this.#iS.clear(),this}recordShowTextOperation(t,e=!1){let i=Array.from(this.#iS);for(let r of(this.recordOperation(t,e),this.recordIncrementalData("sameLineText",t),i))this.recordIncrementalData("sameLineText",r);return this}bboxToClipBoxDropOperation(t,e=!1){let i=!e&&t===this.#iC._pendingBBoxIdx;return this.#iC.bboxToClipBoxDropOperation(t),i&&this.#iS.clear(),this}take(){return this.#iT.clear(),this.#iC.take()}takeDebugMetadata(){return this.#i_}}class ik{#ik;#iP;#iM;#iD=0;#iI=0;constructor(t,e,i){if(t instanceof ik&&!!i===t.#iM)return t;this.#ik=t,this.#iP=e,this.#iM=!!i}get clipBox(){return this.#ik.clipBox}growOperationsCount(){throw Error("Unreachable")}save(t){return this.#iI++,this.#ik.save(this.#iP),this}restore(t){return this.#iI>0&&(this.#ik.restore(this.#iP),this.#iI--),this}recordOpenMarker(t){return this.#iD++,this}getOpenMarker(){return this.#iD>0?this.#iP:this.#ik.getOpenMarker()}recordCloseMarker(t){return this.#iD--,this}beginMarkedContent(t){return this}endMarkedContent(t){return this}pushBaseTransform(t){return this.#ik.pushBaseTransform(t),this}popBaseTransform(){return this.#ik.popBaseTransform(),this}recordSimpleData(t,e){return this.#ik.recordSimpleData(t,this.#iP),this}recordIncrementalData(t,e){return this.#ik.recordIncrementalData(t,this.#iP),this}resetIncrementalData(t,e){return this.#ik.resetIncrementalData(t,this.#iP),this}recordNamedData(t,e){return this}
3recordSimpleDataFromNamed(t,e,i){return this.#ik.recordSimpleDataFromNamed(t,e,this.#iP),this}recordFutureForcedDependency(t,e){return this.#ik.recordFutureForcedDependency(t,this.#iP),this}inheritSimpleDataAsFutureForcedDependencies(t){return this.#ik.inheritSimpleDataAsFutureForcedDependencies(t),this}inheritPendingDependenciesAsFutureForcedDependencies(){return this.#ik.inheritPendingDependenciesAsFutureForcedDependencies(),this}resetBBox(t){return this.#iM||this.#ik.resetBBox(this.#iP),this}recordClipBox(t,e,i,r,n,s){return this.#iM||this.#ik.recordClipBox(this.#iP,e,i,r,n,s),this}recordBBox(t,e,i,r,n,s){return this.#iM||this.#ik.recordBBox(this.#iP,e,i,r,n,s),this}recordCharacterBBox(t,e,i,r,n,s,a){return this.#iM||this.#ik.recordCharacterBBox(this.#iP,e,i,r,n,s,a),this}recordFullPageBBox(t){return this.#iM||this.#ik.recordFullPageBBox(this.#iP),this}getSimpleIndex(t){return this.#ik.getSimpleIndex(t)}recordDependencies(t,e){return this.#ik.recordDependencies(this.#iP,e),this}recordNamedDependency(t,e){return this.#ik.recordNamedDependency(this.#iP,e),this}recordOperation(t){return this.#ik.recordOperation(this.#iP,!0),this}recordShowTextOperation(t){return this.#ik.recordShowTextOperation(this.#iP,!0),this}bboxToClipBoxDropOperation(t){return this.#iM||this.#ik.bboxToClipBoxDropOperation(this.#iP,!0),this}take(){throw Error("Unreachable")}takeDebugMetadata(){throw Error("Unreachable")}}let iP=["path","transform","filter","strokeColor","strokeAlpha","lineWidth","lineCap","lineJoin","miterLimit","dash"],iM=["path","transform","filter","fillColor","fillAlpha","globalCompositeOperation","SMask"],iD=["transform","SMask","filter","fillAlpha","strokeAlpha","globalCompositeOperation"],iI=["filter","fillColor","fillAlpha"],iR=["transform","leading","charSpacing","wordSpacing","hScale","textRise","moveText","textMatrix","font","fontObj","filter","fillColor","textRenderingMode","SMask","fillAlpha","strokeAlpha","globalCompositeOperation","sameLineText"],iF=["transform"],iB=["transform","fillColor"];class iO{#im;#ib;#iR=4;#iF=0;#ic=new iO.#iB(6*this.#iR);static #iB=eS.isFloat16ArraySupported?Float16Array:Float32Array;constructor(t){this.#im=t.width,this.#ib=t.height}record(t,e,i,r){let n;if(this.#iF===this.#iR){this.#iR*=2;let t=new iO.#iB(6*this.#iR);t.set(this.#ic),this.#ic=t}let s=eT.domMatrixToTransform(t.getTransform());if(1/0!==r[0]){let t=t6.slice();eT.axialAlignedBoundingBox([0,-i,e,0],s,t);let a=eT.intersect(r,t);if(!a)return;let[o,l,h,d]=a;if(o!==t[0]||l!==t[1]||h!==t[2]||d!==t[3]){let t=Math.atan2(s[1],s[0]),e=Math.abs(Math.sin(t)),i=Math.abs(Math.cos(t));if(e<1e-6||i<1e-6||1e-6>Math.abs(e-i))n=[o,l,o,d,h,l];else{let t=h-o,r=d-l,s=e*e,a=i*i,c=i*e,u=a-s,p=(r*a-t*c)/u;n=[o+(r*c-t*s)/u,l,o,l+p,h,d-p]}}}n||(n=[0,-i,0,0,e,-i],eT.applyTransform(n,s,0),eT.applyTransform(n,s,2),eT.applyTransform(n,s,4)),n[0]/=this.#im,n[1]/=this.#ib,n[2]/=this.#im,n[3]/=this.#ib,n[4]/=this.#im,n[5]/=this.#ib,this.#ic.set(n,6*this.#iF),this.#iF++}take(){return this.#ic.subarray(0,6*this.#iF)}}class iL{#iO=new Set;constructor({ownerDocument:t=globalThis.document,styleElement:e=null}){this._document=t,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(t){this.nativeFontFaces.add(t),this._document.fonts.add(t)}removeNativeFontFace(t){this.nativeFontFaces.delete(t),this._document.fonts.delete(t)}insertRule(t){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));let e=this.styleElement.sheet;e.insertRule(t,e.cssRules.length)}clear(){for(let t of this.nativeFontFaces)this._document.fonts.delete(t);this.nativeFontFaces.clear(),this.#iO.clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:t,disableFontFace:e,_inspectFont:i}){if(!(!t||this.#iO.has(t.loadedName))){if(ed(!e,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){let{loadedName:e,src:r,style:n}=t,s=new FontFace(e,r,n);this.addNativeFontFace(s);try{await s.load(),this.#iO.add(e),i?.(t)}catch{el(`Cannot load system font: ${t.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(s)}return}eh("Not implemented: loadSystemFont without the Font Loading API.")}}async bind(t){if(t.attached||t.missingFile&&!t.systemFontInfo)return;if(t.attached=!0,t.systemFontInfo)return void await this.loadSystemFont(t);if(this.isFontLoadingAPISupported){let e=t.createNativeFontFace();if(e){this.addNativeFontFace(e);try{await e.loaded}catch(i){throw el(`Failed to load font '${e.family}': '${i}'.`),t.disableFontFace=!0,i}}return}let e=t.createFontFaceRule();if(e){if(this.insertRule(e),this.isSyncFontLoadingSupported)return;await new Promise(e=>{let i=this._queueLoadingCallback(e);this._prepareFontLoadEvent(t,i)})}}get isFontLoadingAPISupported(){return eg(this,"isFontLoadingAPISupported",!!this._document?.fonts)}get isSyncFontLoadingSupported(){return eg(this,"isSyncFontLoadingSupported",t3||eS.platform.isFirefox)}_queueLoadingCallback(t){let{loadingRequests:e}=this,i={done:!1,complete:function(){for(ed(!i.done,"completeRequest() cannot be called twice."),i.done=!0;e.length>0&&e[0].done;)setTimeout(e.shift().callback,0)},callback:t};return e.push(i),i}get _loadTestFont(){return eg(this,"_loadTestFont",atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA=="))}_prepareFontLoadEvent(t,e){var i;let r,n;function s(t,e){return t.charCodeAt(e)<<24|t.charCodeAt(e+1)<<16|t.charCodeAt(e+2)<<8|255&t.charCodeAt(e+3)}function a(t,e,i,r){return t.substring(0,e)+r+t.substring(e+i)}let o=this._document.createElement("canvas");o.width=1,o.height=1;let l=o.getContext("2d"),h=0,d=`lt${Date.now()}${this.loadTestFontId++}`,c=this._loadTestFont,u=s(c=a(c,976,d.length,d),16);for(r=0,n=d.length-3;r<n;r+=4)u=u-0x58585858+s(d,r)|0;r<d.length&&(u=u-0x58585858+s(d+"XXX",r)|0),c=a(c,16,4,String.fromCharCode((i=u)>>24&255,i>>16&255,i>>8&255,255&i));let p=`url(data:font/opentype;base64,${btoa(c)});`,g=`@font-face {font-family:"${d}";src:${p}}`;this.insertRule(g);let m=this._document.createElement("div");for(let e of(m.style.visibility="hidden",m.style.width=m.style.height="10px",m.style.position="absolute",m.style.top=m.style.left="0px",[t.loadedName,d])){let t=this._document.createElement("span");t.textContent="Hi",t.style.fontFamily=e,m.append(t)}this._document.body.append(m),function t(e,i){if(++h>30){el("Load test font never loaded."),i();return}(l.font="30px "+e,l.fillText(".",0,20),l.getImageData(0,0,1,1).data[3]>0)?i():setTimeout(t.bind(null,e,i))}(d,()=>{m.remove(),e.complete()})}}class iN{compiledGlyphs=Object.create(null);#iL;constructor(t,e=null,i,r){this.#iL=t,this._inspectFont=e,i&&(this.charProcOperatorList=i),r&&Object.assign(this,r)}createNativeFontFace(){let t;if(!this.data||this.disableFontFace)return null;if(this.cssFontInfo){let e={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(e.style=`oblique ${this.cssFontInfo.italicAngle}deg`),t=new FontFace(this.cssFontInfo.fontFamily,this.data,e)}else t=new FontFace(this.loadedName,this.data,{});return this._inspectFont?.(this),t}createFontFaceRule(){let t;if(!this.data||this.disableFontFace)return null;let e=`url(data:${this.mimetype};base64,${this.data.toBase64()});`;if(this.cssFontInfo){let i=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(i+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),t=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${i}src:${e}}`}else t=`@font-face {font-family:"${this.loadedName}";src:${e}}`;return this._inspectFont?.(this,e),t}getPathGenerator(t,e){let i;if(void 0!==this.compiledGlyphs[e])return this.compiledGlyphs[e];let r=this.loadedName+"_path_"+e;try{i=t.get(r)}catch(t){el(`getPathGenerator - ignoring character: "${t}".`)}let n=e9(i?.path);return this.fontExtraProperties||t.delete(r),this.compiledGlyphs[e]=n}get black(){return this.#iL.black}get bold(){return this.#iL.bold}get disableFontFace(){return this.#iL.disableFontFace}set disableFontFace(t){eg(this,"disableFontFace",!!t)}get fontExtraProperties(){return this.#iL.fontExtraProperties}get isInvalidPDFjsFont(){return this.#iL.isInvalidPDFjsFont}get isType3Font(){return this.#iL.isType3Font}get italic(){return this.#iL.italic}get missingFile(){return this.#iL.missingFile}get remeasure(){return this.#iL.remeasure}get vertical(){return this.#iL.vertical}get ascent(){return this.#iL.ascent}get defaultWidth(){return this.#iL.defaultWidth}get descent(){return this.#iL.descent}get bbox(){return this.#iL.bbox}get fontMatrix(){return this.#iL.fontMatrix}get fallbackName(){return this.#iL.fallbackName}get loadedName(){return this.#iL.loadedName}get mimetype(){return this.#iL.mimetype}get name(){return this.#iL.name}get data(){return this.#iL.data}clearData(){this.#iL.clearData()}get cssFontInfo(){return this.#iL.cssFontInfo}get systemFontInfo(){return this.#iL.systemFontInfo}get defaultVMetrics(){return this.#iL.defaultVMetrics}}class iU{static strings=["fontFamily","fontWeight","italicAngle"]}class ij{static strings=["css","loadedName","baseFontName","src"]}
3class iz{static bools=["black","bold","disableFontFace","fontExtraProperties","isInvalidPDFjsFont","isType3Font","italic","missingFile","remeasure","vertical"];static numbers=["ascent","defaultWidth","descent"];static strings=["fallbackName","loadedName","mimetype","name"];static OFFSET_NUMBERS=Math.ceil(2*this.bools.length/8);static OFFSET_BBOX=this.OFFSET_NUMBERS+8*this.numbers.length;static OFFSET_FONT_MATRIX=this.OFFSET_BBOX+1+8;static OFFSET_DEFAULT_VMETRICS=this.OFFSET_FONT_MATRIX+1+48;static OFFSET_STRINGS=this.OFFSET_DEFAULT_VMETRICS+1+6}class iH{static KIND=0;static HAS_BBOX=1;static HAS_BACKGROUND=2;static SHADING_TYPE=3;static N_COORD=4;static N_COLOR=8;static N_STOP=12;static N_FIGURES=16}class i${#iN;#iU=new TextDecoder;#ij;constructor(t){this.#iN=t,this.#ij=new DataView(t)}#iz(t){ed(t<iU.strings.length,"Invalid string index");let e=0;for(let i=0;i<t;i++)e+=this.#ij.getUint32(e)+4;let i=this.#ij.getUint32(e);return this.#iU.decode(new Uint8Array(this.#iN,e+4,i))}get fontFamily(){return this.#iz(0)}get fontWeight(){return this.#iz(1)}get italicAngle(){return this.#iz(2)}}class iV{#iN;#iU=new TextDecoder;#ij;constructor(t){this.#iN=t,this.#ij=new DataView(t)}get guessFallback(){return 0!==this.#ij.getUint8(0)}#iz(t){ed(t<ij.strings.length,"Invalid string index");let e=5;for(let i=0;i<t;i++)e+=this.#ij.getUint32(e)+4;let i=this.#ij.getUint32(e);return this.#iU.decode(new Uint8Array(this.#iN,e+4,i))}get css(){return this.#iz(0)}get loadedName(){return this.#iz(1)}get baseFontName(){return this.#iz(2)}get src(){return this.#iz(3)}get style(){let t=1;t+=4+this.#ij.getUint32(t);let e=this.#ij.getUint32(t),i=this.#iU.decode(new Uint8Array(this.#iN,t+4,e));t+=4+e;let r=this.#ij.getUint32(t),n=this.#iU.decode(new Uint8Array(this.#iN,t+4,r));return{style:i,weight:n}}}class iW{#iN;#iU=new TextDecoder;#ij;constructor({buffer:t,extra:e}){this.#iN=t,this.#ij=new DataView(t),e&&Object.assign(this,e)}#iH(t){ed(t<iz.bools.length,"Invalid boolean index");let e=Math.floor(t/4),i=this.#ij.getUint8(e)>>2*t%8&3;return 0===i?void 0:2===i}get black(){return this.#iH(0)}get bold(){return this.#iH(1)}get disableFontFace(){return this.#iH(2)}get fontExtraProperties(){return this.#iH(3)}get isInvalidPDFjsFont(){return this.#iH(4)}get isType3Font(){return this.#iH(5)}get italic(){return this.#iH(6)}get missingFile(){return this.#iH(7)}get remeasure(){return this.#iH(8)}get vertical(){return this.#iH(9)}#i$(t){return ed(t<iz.numbers.length,"Invalid number index"),this.#ij.getFloat64(iz.OFFSET_NUMBERS+8*t)}get ascent(){return this.#i$(0)}get defaultWidth(){return this.#i$(1)}get descent(){return this.#i$(2)}#iV(t,e,i,r){let n=this.#ij.getUint8(t);if(0===n)return;ed(n===e,"Invalid array length."),t+=1;let s=Array(n);for(let e=0;e<n;e++)s[e]=this.#ij[i](t,!0),t+=r;return s}get bbox(){return this.#iV(iz.OFFSET_BBOX,4,"getInt16",2)}get fontMatrix(){return this.#iV(iz.OFFSET_FONT_MATRIX,6,"getFloat64",8)}get defaultVMetrics(){return this.#iV(iz.OFFSET_DEFAULT_VMETRICS,3,"getInt16",2)}#iz(t){ed(t<iz.strings.length,"Invalid string index");let e=iz.OFFSET_STRINGS+4;for(let i=0;i<t;i++)e+=this.#ij.getUint32(e)+4;let i=this.#ij.getUint32(e);return this.#iU.decode(new Uint8Array(this.#iN,e+4,i))}get fallbackName(){return this.#iz(0)}get loadedName(){return this.#iz(1)}get mimetype(){return this.#iz(2)}get name(){return this.#iz(3)}#iW(){let t=iz.OFFSET_STRINGS,e=this.#ij.getUint32(t);t+=4+e;let i=this.#ij.getUint32(t);t+=4+i;let r=this.#ij.getUint32(t);t+=4+r;let n=this.#ij.getUint32(t);return{offset:t,length:n}}get data(){let{offset:t,length:e}=this.#iW();return 0===e?void 0:new Uint8Array(this.#iN,t+4,e)}clearData(){let{offset:t,length:e}=this.#iW();0!==e&&(this.#ij.setUint32(t,0),this.#iN=new Uint8Array(this.#iN,0,t+4).slice().buffer,this.#ij=new DataView(this.#iN))}get cssFontInfo(){let t=iz.OFFSET_STRINGS,e=this.#ij.getUint32(t);t+=4+e;let i=this.#ij.getUint32(t);t+=4+i;let r=this.#ij.getUint32(t);if(0===r)return null;let n=new Uint8Array(r);return n.set(new Uint8Array(this.#iN,t+4,r)),new i$(n.buffer)}get systemFontInfo(){let t=iz.OFFSET_STRINGS,e=this.#ij.getUint32(t);t+=4+e;let i=this.#ij.getUint32(t);if(0===i)return null;let r=new Uint8Array(i);return r.set(new Uint8Array(this.#iN,t+4,i)),new iV(r.buffer)}}class iG{constructor(t){this.buffer=t,this.view=new DataView(t),this.data=new Uint8Array(t)}getIR(){let t=this.view,e=this.data[iH.KIND],i=!!this.data[iH.HAS_BBOX],r=!!this.data[iH.HAS_BACKGROUND],n=t.getUint32(iH.N_COORD,!0),s=t.getUint32(iH.N_COLOR,!0),a=t.getUint32(iH.N_STOP,!0),o=20,l=new Float32Array(this.buffer,o,2*n);o+=8*n;let h=new Uint8Array(this.buffer,o,4*s);o+=4*s;let d=[];for(let e=0;e<a;++e){let e=t.getFloat32(o,!0);o+=4;let i=t.getUint32(o,!0);o+=4,d.push([e,`#${i.toString(16).padStart(6,"0")}`])}let c=null;if(i){c=[];for(let e=0;e<4;++e)c.push(t.getFloat32(o,!0)),o+=4}let u=null;if(r&&(u=new Uint8Array(this.buffer,o,3),o+=3),1===e)return["RadialAxial","axial",c,d,Array.from(l.slice(0,2)),Array.from(l.slice(2,4)),null,null];if(2===e)return["RadialAxial","radial",c,d,[l[0],l[1]],[l[3],l[4]],l[2],l[5]];if(3===e){let t=this.data[iH.SHADING_TYPE],e=null;if(l.length>0){e=t6.slice();for(let t=0,i=l.length;t<i;t+=2)eT.pointBoundingBox(l[t],l[t+1],e)}return["Mesh",t,l,h,n,e,c,u]}throw Error(`Unsupported pattern kind: ${e}`)}}class iq{#iN;constructor(t){this.#iN=t}get path(){return eS.isFloat16ArraySupported?new Float16Array(this.#iN):new Float32Array(this.#iN)}}function iK(t){if("string"!=typeof t)return null;if(t.endsWith("/"))return t;throw Error(`Invalid factory url: "${t}" must include trailing slash.`)}let iX=t=>"object"==typeof t&&Number.isInteger(t?.num)&&t.num>=0&&Number.isInteger(t?.gen)&&t.gen>
3=0,iY=(function(t,e,i){if(!Array.isArray(i)||i.length<2)return!1;let[r,n,...s]=i;if(!t(r)&&!Number.isInteger(r)||!e(n))return!1;let a=s.length,o=!0;switch(n.name){case"XYZ":if(a<2||a>3)return!1;break;case"Fit":case"FitB":return 0===a;case"FitH":case"FitBH":case"FitV":case"FitBV":if(a>1)return!1;break;case"FitR":if(4!==a)return!1;o=!1;break;default:return!1}for(let t of s)if("number"!=typeof t&&(!o||null!==t))return!1;return!0}).bind(null,iX,t=>"object"==typeof t&&"string"==typeof t?.name);class iJ{#iG=new Map;#iq=Promise.resolve();postMessage(t,e){let i={data:structuredClone(t,e?{transfer:e}:null)};this.#iq.then(()=>{for(let[t]of this.#iG)t.call(this,i)})}addEventListener(t,e,i=null){let r=null;if(i?.signal instanceof AbortSignal){let{signal:n}=i;if(n.aborted)return void el("LoopbackPort - cannot use an `aborted` signal.");let s=()=>this.removeEventListener(t,e);r=()=>n.removeEventListener("abort",s),n.addEventListener("abort",s)}this.#iG.set(e,r)}removeEventListener(t,e){let i=this.#iG.get(e);i?.(),this.#iG.delete(e)}terminate(){for(let[,t]of this.#iG)t?.();this.#iG.clear()}}t5(1689);function iQ(){}function iZ(t){if(t instanceof ex||t instanceof ev||t instanceof ef||t instanceof ey||t instanceof eb)return t;switch(!(t instanceof Error||"object"==typeof t&&null!==t)&&eh('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),t.name){case"AbortException":return new ex(t.message);case"InvalidPDFException":return new ev(t.message);case"PasswordException":return new ef(t.message,t.code);case"ResponseException":return new ey(t.message,t.status,t.missing);case"UnknownErrorException":return new eb(t.message,t.details)}return new eb(t.message,t.toString())}class i0{#iK=new AbortController;constructor(t,e,i){this.sourceName=t,this.targetName=e,this.comObj=i,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),i.addEventListener("message",this.#iX.bind(this),{signal:this.#iK.signal})}#iX({data:t}){if(t.targetName!==this.sourceName)return;if(t.stream)return void this.#iY(t);if(t.callback){let e=t.callbackId,i=this.callbackCapabilities[e];if(!i)throw Error(`Cannot resolve callback ${e}`);if(delete this.callbackCapabilities[e],1===t.callback)i.resolve(t.data);else if(2===t.callback)i.reject(iZ(t.reason));else throw Error("Unexpected callback case");return}let e=this.actionHandler[t.action];if(!e)throw Error(`Unknown action from worker: ${t.action}`);if(t.callbackId){let i=this.sourceName,r=t.sourceName,n=this.comObj;Promise.try(e,t.data).then(function(e){n.postMessage({sourceName:i,targetName:r,callback:1,callbackId:t.callbackId,data:e})},function(e){n.postMessage({sourceName:i,targetName:r,callback:2,callbackId:t.callbackId,reason:iZ(e)})});return}t.streamId?this.#iJ(t):e(t.data)}on(t,e){let i=this.actionHandler;if(i[t])throw Error(`There is already an actionName called "${t}"`);i[t]=e}send(t,e,i){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,data:e},i)}sendWithPromise(t,e,i){let r=this.callbackId++,n=Promise.withResolvers();this.callbackCapabilities[r]=n;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,callbackId:r,data:e},i)}catch(t){n.reject(t)}return n.promise}sendWithStream(t,e,i,r){let n=this.streamId++,s=this.sourceName,a=this.targetName,o=this.comObj;return new ReadableStream({start:i=>{let l=Promise.withResolvers();return this.streamControllers[n]={controller:i,startCall:l,pullCall:null,cancelCall:null,isClosed:!1},o.postMessage({sourceName:s,targetName:a,action:t,streamId:n,data:e,desiredSize:i.desiredSize},r),l.promise},pull:t=>{let e=Promise.withResolvers();return this.streamControllers[n].pullCall=e,o.postMessage({sourceName:s,targetName:a,stream:6,streamId:n,desiredSize:t.desiredSize}),e.promise},cancel:t=>{ed(t instanceof Error,"cancel must have a valid reason");let e=Promise.withResolvers();return this.streamControllers[n].cancelCall=e,this.streamControllers[n].isClosed=!0,o.postMessage({sourceName:s,targetName:a,stream:1,streamId:n,reason:iZ(t)}),e.promise}},i)}#iJ(t){let e=t.streamId,i=this.sourceName,r=t.sourceName,n=this.comObj,s=this,a=this.actionHandler[t.action],o={enqueue(t,s=1,a){if(this.isCancelled)return;let o=this.desiredSize;this.desiredSize-=s,o>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),n.postMessage({sourceName:i,targetName:r,stream
3:4,streamId:e,chunk:t},a)},close(){this.isCancelled||(this.isCancelled=!0,n.postMessage({sourceName:i,targetName:r,stream:3,streamId:e}),delete s.streamSinks[e])},error(t){ed(t instanceof Error,"error must have a valid reason"),this.isCancelled||(this.isCancelled=!0,n.postMessage({sourceName:i,targetName:r,stream:5,streamId:e,reason:iZ(t)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:t.desiredSize,ready:null};o.sinkCapability.resolve(),o.ready=o.sinkCapability.promise,this.streamSinks[e]=o,Promise.try(a,t.data,o).then(function(){n.postMessage({sourceName:i,targetName:r,stream:8,streamId:e,success:!0})},function(t){n.postMessage({sourceName:i,targetName:r,stream:8,streamId:e,reason:iZ(t)})})}#iY(t){let e=t.streamId,i=this.sourceName,r=t.sourceName,n=this.comObj,s=this.streamControllers[e],a=this.streamSinks[e];switch(t.stream){case 8:t.success?s.startCall.resolve():s.startCall.reject(iZ(t.reason));break;case 7:t.success?s.pullCall.resolve():s.pullCall.reject(iZ(t.reason));break;case 6:if(!a){n.postMessage({sourceName:i,targetName:r,stream:7,streamId:e,success:!0});break}a.desiredSize<=0&&t.desiredSize>0&&a.sinkCapability.resolve(),a.desiredSize=t.desiredSize,Promise.try(a.onPull||iQ).then(function(){n.postMessage({sourceName:i,targetName:r,stream:7,streamId:e,success:!0})},function(t){n.postMessage({sourceName:i,targetName:r,stream:7,streamId:e,reason:iZ(t)})});break;case 4:if(ed(s,"enqueue should have stream controller"),s.isClosed)break;s.controller.enqueue(t.chunk);break;case 3:if(ed(s,"close should have stream controller"),s.isClosed)break;s.isClosed=!0,s.controller.close(),this.#iQ(s,e);break;case 5:ed(s,"error should have stream controller"),s.controller.error(iZ(t.reason)),this.#iQ(s,e);break;case 2:t.success?s.cancelCall.resolve():s.cancelCall.reject(iZ(t.reason)),this.#iQ(s,e);break;case 1:if(!a)break;let o=iZ(t.reason);Promise.try(a.onCancel||iQ,o).then(function(){n.postMessage({sourceName:i,targetName:r,stream:2,streamId:e,success:!0})},function(t){n.postMessage({sourceName:i,targetName:r,stream:2,streamId:e,reason:iZ(t)})}),a.sinkCapability.reject(o),a.isCancelled=!0,delete this.streamSinks[e];break;default:throw Error("Unexpected stream case")}}async #iQ(t,e){await Promise.allSettled([t.startCall?.promise,t.pullCall?.promise,t.cancelCall?.promise]),delete this.streamControllers[e]}destroy(){this.#iK?.abort(),this.#iK=null}}class i1{#iZ=Object.freeze({cMapUrl:"CMap",standardFontDataUrl:"font",wasmUrl:"wasm"});constructor({cMapUrl:t=null,standardFontDataUrl:e=null,wasmUrl:i=null}){this.cMapUrl=t,this.standardFontDataUrl=e,this.wasmUrl=i}async fetch({kind:t,filename:e}){switch(t){case"cMapUrl":case"standardFontDataUrl":case"wasmUrl":break;default:eh(`Not implemented: ${t}`)}let i=this[t];if(!i)throw Error(`Ensure that the \`${t}\` API parameter is provided.`);let r=`${i}${e}`;return this._fetch(r,t).catch(e=>{throw Error(`Unable to load ${this.#iZ[t]} data at: ${r}`)})}async _fetch(t,e){eh("Abstract method `_fetch` called.")}}class i2 extends i1{async _fetch(t,e){let i="cMapUrl"!==e||t.endsWith(".bcmap")?"bytes":"text",r=await eL(t,i);return r instanceof Uint8Array?r:eA(r)}}class i5{#i0=!1;constructor({enableHWA:t=!1}){this.#i0=t}create(t,e){if(t<=0||e<=0)throw Error("Invalid canvas size");let i=this._createCanvas(t,e);return{canvas:i,context:i.getContext("2d",{willReadFrequently:!this.#i0})}}reset({canvas:t},e,i){if(!t)throw Error("Canvas is not specified");if(e<=0||i<=0)throw Error("Invalid canvas size");t.width=e,t.height=i}destroy(t){let{canvas:e}=t;if(!e)throw Error("Canvas is not specified");e.width=e.height=0,t.canvas=null,t.context=null}_createCanvas(t,e){eh("Abstract method `_createCanvas` called.")}}class i3 extends i5{constructor({ownerDocument:t=globalThis.document,enableHWA:e=!1}){super({enableHWA:e}),this._document=t}_createCanvas(t,e){let i=this._document.createElement("canvas");return i.width=t,i.height=e,i}}t5(2489);class i6{addFilter(t){return"none"}addHCMFilter(t,e){return"none"}addAlphaFilter(t){return"none"}addLuminosityFilter(t){return"none"}addHighlightHCMFilter(t,e,i,r,n){return"none"}destroy(t=!1){}}class i4 extends i6{#i1;#i2;#i5;#i3;#i6;#i4;#E=0;constructor({docId:t,ownerDocument:e=globalThis.document}){super(),this.#i3=t,this.#i6=e}get #k(){return this.#i2||=new Map}get #i9(){return this.#i4||=new Map}
3get #i8(){if(!this.#i5){let t=this.#i6.createElement("div"),{style:e}=t;e.visibility="hidden",e.contain="strict",e.width=e.height=0,e.position="absolute",e.top=e.left=0,e.zIndex=-1;let i=this.#i6.createElementNS(eB,"svg");i.setAttribute("width",0),i.setAttribute("height",0),this.#i5=this.#i6.createElementNS(eB,"defs"),t.append(i),i.append(this.#i5),this.#i6.body.append(t)}return this.#i5}#i7(t){if(1===t.length){let e=t[0],i=Array(256);for(let t=0;t<256;t++)i[t]=e[t]/255;let r=i.join(",");return[r,r,r]}let[e,i,r]=t,n=Array(256),s=Array(256),a=Array(256);for(let t=0;t<256;t++)n[t]=e[t]/255,s[t]=i[t]/255,a[t]=r[t]/255;return[n.join(","),s.join(","),a.join(",")]}#rt(t){if(void 0===this.#i1){this.#i1="";let t=this.#i6.URL;t!==this.#i6.baseURI&&(ej(t)?el('#createUrl: ignore "data:"-URL for performance reasons.'):this.#i1=eu(t,""))}return`url(${this.#i1}#${t})`}addFilter(t){if(!t)return"none";let e=this.#k.get(t);if(e)return e;let[i,r,n]=this.#i7(t),s=1===t.length?i:`${i}${r}${n}`;if(e=this.#k.get(s))return this.#k.set(t,e),e;let a=`g_${this.#i3}_transfer_map_${this.#E++}`,o=this.#rt(a);this.#k.set(t,o),this.#k.set(s,o);let l=this.#re(a);return this.#ri(i,r,n,l),o}addHCMFilter(t,e){let i=`${t}-${e}`,r="base",n=this.#i9.get(r);if(n?.key===i||(n?(n.filter?.remove(),n.key=i,n.url="none",n.filter=null):(n={key:i,url:"none",filter:null},this.#i9.set(r,n)),!t||!e))return n.url;let s=this.#rr(t);t=eT.makeHexColor(...s);let a=this.#rr(e);if(e=eT.makeHexColor(...a),this.#i8.style.color="","#000000"===t&&"#ffffff"===e||t===e)return n.url;let o=Array(256);for(let t=0;t<=255;t++){let e=t/255;o[t]=e<=.03928?e/12.92:((e+.055)/1.055)**2.4}let l=o.join(","),h=`g_${this.#i3}_hcm_filter`,d=n.filter=this.#re(h);this.#ri(l,l,l,d),this.#rn(d);let c=(t,e)=>{let i=s[t]/255,r=a[t]/255,n=Array(e+1);for(let t=0;t<=e;t++)n[t]=i+t/e*(r-i);return n.join(",")};return this.#ri(c(0,5),c(1,5),c(2,5),d),n.url=this.#rt(h),n.url}addAlphaFilter(t){let e=this.#k.get(t);if(e)return e;let[i]=this.#i7([t]),r=`alpha_${i}`;if(e=this.#k.get(r))return this.#k.set(t,e),e;let n=`g_${this.#i3}_alpha_map_${this.#E++}`,s=this.#rt(n);this.#k.set(t,s),this.#k.set(r,s);let a=this.#re(n);return this.#rs(i,a),s}addLuminosityFilter(t){let e,i,r=this.#k.get(t||"luminosity");if(r)return r;if(t?([e]=this.#i7([t]),i=`luminosity_${e}`):i="luminosity",r=this.#k.get(i))return this.#k.set(t,r),r;let n=`g_${this.#i3}_luminosity_map_${this.#E++}`,s=this.#rt(n);this.#k.set(t,s),this.#k.set(i,s);let a=this.#re(n);return this.#ra(a),t&&this.#rs(e,a),s}addHighlightHCMFilter(t,e,i,r,n){let s=`${e}-${i}-${r}-${n}`,a=this.#i9.get(t);if(a?.key===s||(a?(a.filter?.remove(),a.key=s,a.url="none",a.filter=null):(a={key:s,url:"none",filter:null},this.#i9.set(t,a)),!e||!i))return a.url;let[o,l]=[e,i].map(this.#rr.bind(this)),h=Math.round(.2126*o[0]+.7152*o[1]+.0722*o[2]),d=Math.round(.2126*l[0]+.7152*l[1]+.0722*l[2]),[c,u]=[r,n].map(this.#rr.bind(this));d<h&&([h,d,c,u]=[d,h,u,c]),this.#i8.style.color="";let p=(t,e,i)=>{let r=Array(256),n=(d-h)/i,s=t/255,a=(e-t)/(255*i),o=0;for(let t=0;t<=i;t++){let e=Math.round(h+t*n),i=s+t*a;for(let t=o;t<=e;t++)r[t]=i;o=e+1}for(let t=o;t<256;t++)r[t]=r[o-1];return r.join(",")},g=`g_${this.#i3}_hcm_${t}_filter`,m=a.filter=this.#re(g);return this.#rn(m),this.#ri(p(c[0],u[0],5),p(c[1],u[1],5),p(c[2],u[2],5),m),a.url=this.#rt(g),a.url}destroy(t=!1){t&&this.#i4?.size||(this.#i5?.parentNode.parentNode.remove(),this.#i5=null,this.#i2?.clear(),this.#i2=null,this.#i4?.clear(),this.#i4=null,this.#E=0)}#ra(t){let e=this.#i6.createElementNS(eB,"feColorMatrix");e.setAttribute("type","matrix"),e.setAttribute("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0"),t.append(e)}#rn(t){let e=this.#i6.createElementNS(eB,"feColorMatrix");e.setAttribute("type","matrix"),e.setAttribute("values","0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0"),t.append(e)}#re(t){let e=this.#i6.createElementNS(eB,"filter");return e.setAttribute("color-interpolation-filters","sRGB"),e.setAttribute("id",t),this.#i8.append(e),e}#ro(t,e,i){let r=this.#i6.createElementNS(eB,e);r.setAttribute("type","discrete"),r.setAttribute("tableValues",i),t.append(r)}#ri(t,e,i,r){let n=this.#i6.createElementNS(eB,"feComponentTransfer");r.append(n),this.#ro(n,"feFuncR",t),this.#ro(n,"feFuncG",e),this.#ro(n,"feFuncB",i)}#rs(t,e){let i=this.#i6.createElementNS(eB,"feComponentTransfer");e.append(i),this.#ro(i,"feFuncA",t)}#rr(t){return this.#i8.style.color=t,eK(getComputedStyle(this.#i8).getPropertyValue("color"))}}if(t3){let t;try{let e=process.getBuiltinModule("module").createRequire("file:///home/circleci/project/node_modules/.pnpm/[email protected]/node_modules/pdfjs-dist/legacy/build/pdf.mjs");try{t=e("@napi-rs/canvas")}catch(t){el(`Cannot load "@napi-rs/canvas" package: "${t}".`)}}catch(t){el(`Cannot access the \`require\` function: "${t}".`)}globalThis.DOMMatrix||(t?.DOMMatrix?globalThis.DOMMatrix=t.DOMMatrix:el("Cannot polyfill `DOMMatrix`, rendering may be broken.")),globalThis.ImageData||(t?.ImageData?globalThis.ImageData=t.ImageData:el("Cannot polyfill `ImageData`, rendering may be broken.")),globalThis.Path2D||(t?.Path2D?globalThis.Path2D=t.Path2D:el("Cannot polyfill `Path2D`, rendering may be broken.")),globalThis.navigator?.language||(globalThis.navigator={language:"en-US",platform:"",userAgent:""})}async function i9(t){let e=process.getBuiltinModule("fs/promises");return new Uint8Array(await e.readFile(t))}class i8 extends i6{}class i7 extends i5{_createCanvas(t,e){return process.getBuiltinModule("module").createRequire("file:///home/circleci/project/node_modules/.pnpm/[email protected]/node_modules/pdfjs-dist/legacy/build/pdf.mjs")("@napi-rs/canvas").createCanvas(t,e)}}class rt extends i1{async _fetch(t,e){return i9(t)}}let re=`
4struct Uniforms {
5  offsetX      : f32,
6  offsetY      : f32,
7  scaleX       : f32,
8  scaleY       : f32,
9  paddedWidth  : f32,
10  paddedHeight : f32,
11  borderSize   : f32,
12  _pad         : f32,
13};
14
15@group(0) @binding(0) var<uniform> u : Uniforms;
16
17struct VertexInput {
18  @location(0) position : vec2<f32>,
19  @location(1) color    : vec4<f32>,
20};
21
22struct VertexOutput {
23  @builtin(position) position : vec4<f32>,
24  @location(0)       color    : vec3<f32>,
25};
26
27@vertex
28fn vs_main(in : VertexInput) -> VertexOutput {
29  var out : VertexOutput;
30  let cx = (in.position.x + u.offsetX) * u.scaleX;
31  let cy = (in.position.y + u.offsetY) * u.scaleY;
32  out.position = vec4<f32>(
33    ((cx + u.borderSize) / u.paddedWidth) * 2.0 - 1.0,
34    1.0 - ((cy + u.borderSize) / u.paddedHeight) * 2.0,
35    0.0,
36    1.0
37  );
38  out.color = in.color.rgb;
39  return out;
40}
41
42@fragment
43fn fs_main(in : VertexOutput) -> @location(0) vec4<f32> {
44  return vec4<f32>(in.color, 1.0);
45}
46`,ri=new class{#rl=null;#rh=null;#rd=null;#rc=null;async #ru(){if(!globalThis.navigator?.gpu)return!1;try{let t=await navigator.gpu.requestAdapter();if(!t)return!1;return this.#rc=navigator.gpu.getPreferredCanvasFormat(),this.#rh=await t.requestDevice(),!0}catch{return!1}}init(){return this.#rl||=this.#ru()}get isReady(){return null!==this.#rh}loadMeshShader(){if(!this.#rh||this.#rd)return;let t=this.#rh.createShaderModule({code:re});this.#rd=this.#rh.createRenderPipeline({layout:"auto",vertex:{module:t,entryPoint:"vs_main",buffers:[{arrayStride:8,attributes:[{shaderLocation:0,offset:0,format:"float32x2"}]},{arrayStride:4,attributes:[{shaderLocation:1,offset:0,format:"unorm8x4"}]}]},fragment:{module:t,entryPoint:"fs_main",targets:[{format:this.#rc}]},primitive:{topology:"triangle-list"}})}draw(t,e,i,r,n,s,a,o){this.loadMeshShader();let l=this.#rh,{offsetX:h,offsetY:d,scaleX:c,scaleY:u}=r,p=l.createBuffer({size:Math.max(t.byteLength,4),usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST});t.byteLength>0&&l.queue.writeBuffer(p,0,t);let g=l.createBuffer({size:Math.max(e.byteLength,4),usage:GPUBufferUsage.VERTEX|GPUBufferUsage.COPY_DST});e.byteLength>0&&l.queue.writeBuffer(g,0,e);let m=l.createBuffer({size:32,usage:GPUBufferUsage.UNIFORM|GPUBufferUsage.COPY_DST});l.queue.writeBuffer(m,0,new Float32Array([h,d,c,u,s,a,o,0]));let f=l.createBindGroup({layout:this.#rd.getBindGroupLayout(0),entries:[{binding:0,resource:{buffer:m}}]}),b=new OffscreenCanvas(s,a),v=b.getContext("webgpu");v.configure({device:l,format:this.#rc,alphaMode:n?"opaque":"premultiplied"});let y=n?{r:n[0]/255,g:n[1]/255,b:n[2]/255,a:1}:{r:0,g:0,b:0,a:0},w=l.createCommandEncoder(),x=w.beginRenderPass({colorAttachments:[{view:v.getCurrentTexture().createView(),clearValue:y,loadOp:"clear",storeOp:"store"}]});return i>0&&(x.setPipeline(this.#rd),x.setBindGroup(0,f),x.setVertexBuffer(0,p),x.setVertexBuffer(1,g),x.draw(i)),x.end(),l.queue.submit([w.finish()]),p.destroy(),g.destroy(),m.destroy(),b.transferToImageBitmap()}},rr="Fill",rn="Stroke",rs="Shading";function ra(t,e){if(!e)return;let i=e[2]-e[0],r=e[3]-e[1],n=new Path2D;n.rect(e[0],e[1],i,r),t.clip(n)}class ro{isModifyingCurrentTransform(){return!1}getPattern(){eh("Abstract method `getPattern` called.")}}class rl extends ro{constructor(t){super(),this._type=t[1],this._bbox=t[2],this._colorStops=t[3],this._p0=t[4],this._p1=t[5],this._r0=t[6],this._r1=t[7],this.matrix=null}isOriginBased(){return 0===this._p0[0]&&0===this._p0[1]&&(!this.isRadial()||0===this._p1[0]&&0===this._p1[1])}isRadial(){return"radial"===this._type}areConic(){if(!this.isRadial())return!1;let t=Math.hypot(this._p0[0]-this._p1[0],this._p0[1]-this._p1[1]);return t+this._r1>this._r0&&t+this._r0>this._r1}_createGradient(t,e=null){let i,r=this._p0,n=this._p1;if(e&&(r=r.slice(),n=n.slice(),eT.applyTransform(r,e),eT.applyTransform(n,e)),"axial"===this._type)i=t.createLinearGradient(r[0],r[1],n[0],n[1]);else if("radial"===this._type){let s=this._r0,a=this._r1;if(e){let t=new Float32Array(2);eT.singularValueDecompose2dScale(e,t),s*=t[0],a*=t[0]}i=t.createRadialGradient(r[0],r[1],s,n[0],n[1],a)}for(let t of this._colorStops)i.addColorStop(t[0],t[1]);return i}_createReversedGradient(t,e=null){let i=this._p1,r=this._p0;e&&(i=i.slice(),r=r.slice(),eT.applyTransform(i,e),eT.applyTransform(r,e));let n=this._r1,s=this._r0;if(e){let t=new Float32Array(2);eT.singularValueDecompose2dScale(e,t),n*=t[0],s*=t[0]}let a=t.createRadialGradient(i[0],i[1],n,r[0],r[1],s);for(let[t,e]of this._colorStops.map(([t,e])=>[1-t,e]).reverse())a.addColorStop(t,e);return a}getPattern(t,e,i,r){let n;if(r===rn||r===rr){if(this.isOriginBased()){let r=eT.transform(i,e.baseTransform);
46this.matrix&&(r=eT.transform(r,this.matrix));let n=Math.hypot(r[0],r[1]),s=Math.hypot(r[2],r[3]);if(.001>Math.abs((r[0]*r[2]+r[1]*r[3])/(n*s))){if(!this.isRadial())return this._createGradient(t,r);else if(.001>Math.abs(n-s))return this._createGradient(t,r)}}let s=e.current.getClippedPathBoundingBox(r,eX(t))||[0,0,0,0],a=Math.ceil(s[2]-s[0])||1,o=Math.ceil(s[3]-s[1])||1,l=e.canvasFactory.create(a,o),h=l.context;h.clearRect(0,0,h.canvas.width,h.canvas.height),h.beginPath(),h.rect(0,0,h.canvas.width,h.canvas.height),h.translate(-s[0],-s[1]),i=eT.transform(i,[1,0,0,1,s[0],s[1]]),h.transform(...e.baseTransform),this.matrix&&h.transform(...this.matrix),ra(h,this._bbox),this.areConic()&&(h.fillStyle=this._createReversedGradient(h),h.fill()),h.fillStyle=this._createGradient(h),h.fill(),n=t.createPattern(l.canvas,"no-repeat"),e.canvasFactory.destroy(l);let d=new DOMMatrix(i);n.setTransform(d)}else this.areConic()&&(t.save(),ra(t,this._bbox),t.fillStyle=this._createReversedGradient(t),t.fillRect(-1e10,-1e10,2e10,2e10),t.restore()),ra(t,this._bbox),n=this._createGradient(t);return n}}class rh extends ro{constructor(t){super(),this._posData=t[2],this._colData=t[3],this._vertexCount=t[4],this._bounds=t[5],this._bbox=t[6],this._background=t[7],this.matrix=null,ri.loadMeshShader()}_createMeshCanvas(t,e,i){let r=Math.floor(this._bounds[0]),n=Math.floor(this._bounds[1]),s=Math.ceil(this._bounds[2])-r,a=Math.ceil(this._bounds[3])-n,o=Math.min(Math.ceil(Math.abs(s*t[0]*1.1)),3e3)||1,l=Math.min(Math.ceil(Math.abs(a*t[1]*1.1)),3e3)||1,h=s?s/o:1,d=a?a/l:1,c={coords:this._posData,colors:this._colData,offsetX:-r,offsetY:-n,scaleX:1/h,scaleY:1/d},u=o+4,p=l+4,g=i.create(u,p);if(ri.isReady&&this._vertexCount>48){var m,f,b;g.context.drawImage((m=this._posData,f=this._colData,b=this._vertexCount,ri.draw(m,f,b,c,e,u,p,2)),0,0)}else{let t=g.context.createImageData(o,l);if(e){let i=t.data;for(let t=0,r=i.length;t<r;t+=4)i[t]=e[0],i[t+1]=e[1],i[t+2]=e[2],i[t+3]=255}for(let e=0,i=this._vertexCount;e<i;e+=3)!function(t,e,i,r,n,s,a,o){let l,h,d,c,u,p,g,m,f,b=e.coords,v=e.colors,y=t.data,w=4*t.width;b[2*i+1]>b[2*r+1]&&(l=i,i=r,r=l,l=s,s=a,a=l),b[2*r+1]>b[2*n+1]&&(l=r,r=n,n=l,l=a,a=o,o=l),b[2*i+1]>b[2*r+1]&&(l=i,i=r,r=l,l=s,s=a,a=l);let x=(b[2*i]+e.offsetX)*e.scaleX,A=(b[2*i+1]+e.offsetY)*e.scaleY,S=(b[2*r]+e.offsetX)*e.scaleX,T=(b[2*r+1]+e.offsetY)*e.scaleY,_=(b[2*n]+e.offsetX)*e.scaleX,E=(b[2*n+1]+e.offsetY)*e.scaleY;if(A>=E)return;let C=v[4*s],k=v[4*s+1],P=v[4*s+2],M=v[4*a],D=v[4*a+1],I=v[4*a+2],R=v[4*o],F=v[4*o+1],B=v[4*o+2],O=Math.round(A),L=Math.round(E);for(let t=O;t<=L;t++){let e;if(t<T){let e=t<A?0:(A-t)/(A-T);h=x-(x-S)*e,d=C-(C-M)*e,c=k-(k-D)*e,u=P-(P-I)*e}else{let e;h=S-(S-_)*(e=t>E?1:T===E?0:(T-t)/(T-E)),d=M-(M-R)*e,c=D-(D-F)*e,u=I-(I-B)*e}p=x-(x-_)*(e=t<A?0:t>E?1:(A-t)/(A-E)),g=C-(C-R)*e,m=k-(k-F)*e,f=P-(P-B)*e;let i=Math.round(Math.min(h,p)),r=Math.round(Math.max(h,p)),n=w*t+4*i;for(let t=i;t<=r;t++)(e=(h-t)/(h-p))<0?e=0:e>1&&(e=1),y[n++]=d-(d-g)*e|0,y[n++]=c-(c-m)*e|0,y[n++]=u-(u-f)*e|0,y[n++]=255}}(t,c,e,e+1,e+2,e,e+1,e+2);g.context.putImageData(t,2,2)}return{canvas:g.canvas,offsetX:r-2*h,offsetY:n-2*d,scaleX:h,scaleY:d}}isModifyingCurrentTransform(){return!0}getPattern(t,e,i,r){ra(t,this._bbox);let n=new Float32Array(2);if(r===rs)eT.singularValueDecompose2dScale(eX(t),n);else if(this.matrix){eT.singularValueDecompose2dScale(this.matrix,n);let[t,i]=n;eT.singularValueDecompose2dScale(e.baseTransform,n),n[0]*=t,n[1]*=i}else eT.singularValueDecompose2dScale(e.baseTransform,n);let s=this._createMeshCanvas(n,r===rs?null:this._background,e.canvasFactory);r!==rs&&(t.setTransform(...e.baseTransform),this.matrix&&t.transform(...this.matrix)),t.translate(s.offsetX,s.offsetY),t.scale(s.scaleX,s.scaleY);let a=t.createPattern(s.canvas,"no-repeat");return e.canvasFactory.destroy(s),a}}class rd extends ro{getPattern(){return"hotpink"}}class rc{static MAX_PATTERN_SIZE=3e3;constructor(t,e,i,r){this.color=t[1],this.operatorList=t[2],this.matrix=t[3],this.bbox=t[4],this.xstep=t[5],this.ystep=t[6],this.paintType=t[7],this.tilingType=t[8],this.needsIsolation=t[9]??!0,this.ctx=e,this.canvasGraphicsFactory=i,this.baseTransform=r,this.patternBaseMatrix=this.matrix?eT.transform(r,this.matrix
46):r}canSkipPatternCanvas([t,e,i,r]){let[n,s,a,o]=this.bbox,l=Math.abs(this.xstep),h=Math.abs(this.ystep);if(t>l+1e-6||e>h+1e-6)return null;let d=Math.floor((i-a)/l)+1,c=Math.floor((r-o)/h)+1,u=Math.ceil((r+e-s)/h)-1;return Math.ceil((i+t-n)/l)-1<=d&&u<=c?[d,c]:null}updatePatternDims(t,e){let i=eT.inverseTransform(this.patternBaseMatrix),r=[t[0],t[1]],n=[t[2],t[3]];eT.applyTransform(r,i),eT.applyTransform(n,i),e[0]=Math.abs(n[0]-r[0]),e[1]=Math.abs(n[1]-r[1]),e[2]=Math.min(r[0],n[0]),e[3]=Math.min(r[1],n[1])}_renderTileCanvas(t,e,i,r){let[n,s,a,o]=this.bbox,l=t.canvasFactory.create(i.size,r.size),h=l.context,d=this.canvasGraphicsFactory.createCanvasGraphics(h,e);return d.groupLevel=t.groupLevel,this.setFillAndStrokeStyleToContext(d,this.paintType,this.color),h.translate(-i.scale*n,-r.scale*s),d.transform(0,i.scale,0,0,r.scale,0,0),h.save(),d.dependencyTracker?.save(),this.clipBbox(d,n,s,a,o),d.baseTransform=eX(d.ctx),d.executeOperatorList(this.operatorList),d.endDrawing(),d.dependencyTracker?.restore(),h.restore(),l}_getCombinedScales(){let t=new Float32Array(2);eT.singularValueDecompose2dScale(this.matrix,t);let[e,i]=t;return eT.singularValueDecompose2dScale(this.baseTransform,t),[e*t[0],i*t[1]]}drawPattern(t,e,i=!1,[r,n],s){let[a,o,l,h]=this.bbox,d=t.dependencyTracker;if(d&&(t.dependencyTracker=new ik(d,s)),t.save(),i?t.ctx.clip(e,"evenodd"):t.ctx.clip(e),t.ctx.setTransform(...this.patternBaseMatrix),t.ctx.translate(r*this.xstep,n*this.ystep),this.needsIsolation||1!==t.ctx.globalAlpha||"source-over"!==t.ctx.globalCompositeOperation||t.inSMaskMode){let e=l-a,i=h-o,[r,n]=this._getCombinedScales(),d=this.getSizeAndScale(e,this.ctx.canvas.width,r),c=this.getSizeAndScale(i,this.ctx.canvas.height,n),u=this._renderTileCanvas(t,s,d,c);t.ctx.drawImage(u.canvas,a,o,e,i),t.canvasFactory.destroy(u)}else this.setFillAndStrokeStyleToContext(t,this.paintType,this.color),this.clipBbox(t,a,o,l,h),t.baseTransformStack.push(t.baseTransform),t.baseTransform=eX(t.ctx),t.executeOperatorList(this.operatorList),t.baseTransform=t.baseTransformStack.pop();t.restore(),d&&(t.dependencyTracker=d)}createPatternCanvas(t,e){let[i,r,n,s]=this.bbox,a=n-i,o=s-r,{xstep:l,ystep:h}=this;l=Math.abs(l),h=Math.abs(h),eo("TilingType: "+this.tilingType);let[d,c]=this._getCombinedScales(),u=a,p=o,g=!1,m=!1;Math.ceil(l*d)>=Math.ceil(a*d)?u=l:g=!0,Math.ceil(h*c)>=Math.ceil(o*c)?p=h:m=!0;let f=this.getSizeAndScale(u,this.ctx.canvas.width,d),b=this.getSizeAndScale(p,this.ctx.canvas.height,c),v=this._renderTileCanvas(t,e,f,b);if(g||m){let e=v.canvas;g&&(u=l),m&&(p=h);let n=this.getSizeAndScale(u,this.ctx.canvas.width,d),s=this.getSizeAndScale(p,this.ctx.canvas.height,c),f=n.size,b=s.size,y=t.canvasFactory.create(f,b),w=y.context,x=g?Math.floor(a/l):0,A=m?Math.floor(o/h):0;for(let t=0;t<=x;t++)for(let i=0;i<=A;i++)w.drawImage(e,f*t,b*i,f,b,0,0,f,b);return t.canvasFactory.destroy(v),{canvas:y.canvas,canvasEntry:y,scaleX:n.scale,scaleY:s.scale,offsetX:i,offsetY:r}}return{canvas:v.canvas,canvasEntry:v,scaleX:f.scale,scaleY:b.scale,offsetX:i,offsetY:r}}getSizeAndScale(t,e,i){let r=Math.max(rc.MAX_PATTERN_SIZE,e),n=Math.ceil(t*i);return n>=r?n=r:i=n/t,{scale:i,size:n}}clipBbox(t,e,i,r,n){let s=r-e,a=n-i,o=new Path2D;o.rect(e,i,s,a),eT.axialAlignedBoundingBox([e,i,r,n],eX(t.ctx),t.current.minMax),t.ctx.clip(o),t.current.updateClipFromPath()}setFillAndStrokeStyleToContext(t,e,i){let r=t.ctx,n=t.current;switch(n.patternFill=n.patternStroke=!1,e){case 1:let{fillStyle:s,strokeStyle:a}=this.ctx;r.fillStyle=n.fillColor=s,r.strokeStyle=n.strokeColor=a;break;case 2:r.fillStyle=r.strokeStyle=i,n.fillColor=n.strokeColor=i;break;default:throw new ew(`Unsupported paint type: ${e}`)}}isModifyingCurrentTransform(){return!1}getPattern(t,e,i,r,n){let s=r!==rs?eT.transform(i,this.patternBaseMatrix):i,a=this.createPatternCanvas(e,n),o=new DOMMatrix(s);o=(o=o.translate(a.offsetX,a.offsetY)).scale(1/a.scaleX,1/a.scaleY);let l=t.createPattern(a.canvas,"repeat");return e.canvasFactory.destroy(a.canvasEntry),l.setTransform(o),l}}let ru=new DOMMatrix,rp=new Float32Array(2);function rg(t,e,i,r,n,s,a,o,l,h){let[d,c,u,p,g,m]=eX(t);if(0===c&&0===u){let f=Math.round(a*d+g),b=Math.round(o*p+m),v=Math.abs(Math.round((a+l)*d+g)-f)||
461,y=Math.abs(Math.round((o+h)*p+m)-b)||1;return t.setTransform(Math.sign(d),0,0,Math.sign(p),f,b),t.drawImage(e,i,r,n,s,0,0,v,y),t.setTransform(d,c,u,p,g,m),[v,y]}if(0===d&&0===p){let f=Math.round(o*u+g),b=Math.round(a*c+m),v=Math.abs(Math.round((o+h)*u+g)-f)||1,y=Math.abs(Math.round((a+l)*c+m)-b)||1;return t.setTransform(0,Math.sign(c),Math.sign(u),0,f,b),t.drawImage(e,i,r,n,s,0,0,y,v),t.setTransform(d,c,u,p,g,m),[y,v]}return t.drawImage(e,i,r,n,s,a,o,l,h),[Math.hypot(d,c)*l,Math.hypot(u,p)*h]}class rm{alphaIsShape=!1;fontSize=0;fontSizeScale=1;textMatrix=null;textMatrixScale=1;fontMatrix=t9;leading=0;x=0;y=0;lineX=0;lineY=0;charSpacing=0;wordSpacing=0;textHScale=1;textRenderingMode=0;textRise=0;fillColor="#000000";strokeColor="#000000";tilingPatternDims=null;patternFill=!1;patternStroke=!1;fillAlpha=1;strokeAlpha=1;lineWidth=1;activeSMask=null;transferMaps="none";minMax=t4.slice();constructor(t,e){this.clipBox=new Float32Array([0,0,t,e])}clone(){let t=Object.create(this);return t.clipBox=this.clipBox.slice(),t.minMax=this.minMax.slice(),t.tilingPatternDims=this.tilingPatternDims?.slice(),t}getPathBoundingBox(t=rr,e=null){let i=this.minMax.slice();if(t===rn){e||eh("Stroke bounding box must include transform."),eT.singularValueDecompose2dScale(e,rp);let t=rp[0]*this.lineWidth/2,r=rp[1]*this.lineWidth/2;i[0]-=t,i[1]-=r,i[2]+=t,i[3]+=r}return i}updateClipFromPath(){let t=eT.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(t||[0,0,0,0])}isEmptyClip(){return 1/0===this.minMax[0]}startNewPathAndClipBox(t){this.clipBox.set(t,0),this.minMax.set(t4,0)}getClippedPathBoundingBox(t=rr,e=null){return eT.intersect(this.clipBox,this.getPathBoundingBox(t,e))}}function rf(t,e){let i,r,n,s;if(e instanceof ImageData)return void t.putImageData(e,0,0);let a=e.height,o=e.width,l=a%16,h=(a-l)/16,d=0===l?h:h+1,c=t.createImageData(o,16),u=0,p,g=e.data,m=c.data;if(e.kind===ei.GRAYSCALE_1BPP){let e=g.byteLength,s=new Uint32Array(m.buffer,0,m.byteLength>>2),a=s.length,f=o+7>>3,b=eS.isLittleEndian?0xff000000:255;for(i=0;i<d;i++){for(n=i<h?16:l,p=0,r=0;r<n;r++){let t=e-u,i=0,r=t>f?o:8*t-7,n=-8&r,a=0,l=0;for(;i<n;i+=8)l=g[u++],s[p++]=128&l?0xffffffff:b,s[p++]=64&l?0xffffffff:b,s[p++]=32&l?0xffffffff:b,s[p++]=16&l?0xffffffff:b,s[p++]=8&l?0xffffffff:b,s[p++]=4&l?0xffffffff:b,s[p++]=2&l?0xffffffff:b,s[p++]=1&l?0xffffffff:b;for(;i<r;i++)0===a&&(l=g[u++],a=128),s[p++]=l&a?0xffffffff:b,a>>=1}for(;p<a;)s[p++]=0;t.putImageData(c,0,16*i)}}else if(e.kind===ei.RGBA_32BPP){for(r=0,s=16*o*4,i=0;i<h;i++)m.set(g.subarray(u,u+s)),u+=s,t.putImageData(c,0,r),r+=16;i<d&&(s=o*l*4,m.set(g.subarray(u,u+s)),t.putImageData(c,0,r))}else if(e.kind===ei.RGB_24BPP)for(s=o*(n=16),i=0;i<d;i++){for(i>=h&&(s=o*(n=l)),p=0,r=s;r--;)m[p++]=g[u++],m[p++]=g[u++],m[p++]=g[u++],m[p++]=255;t.putImageData(c,0,16*i)}else throw Error(`bad image kind: ${e.kind}`)}function rb(t,e){if(e.bitmap)return void t.drawImage(e.bitmap,0,0);let i=e.height,r=e.width,n=i%16,s=(i-n)/16,a=0===n?s:s+1,o=t.createImageData(r,16),l=0,h=e.data,d=o.data;for(let e=0;e<a;e++){let i=e<s?16:n;({srcPos:l}=function({src:t,srcPos:e=0,dest:i,width:r,height:n,nonBlackColor:s=0xffffffff,inverseDecode:a=!1}){let o=eS.isLittleEndian?0xff000000:255,[l,h]=a?[s,o]:[o,s],d=r>>3,c=7&r,u=l^h,p=t.length;i=new Uint32Array(i.buffer);let g=0;for(let r=0;r<n;++r){for(let r=e+d;e<r;++e,g+=8){let r=t[e];i[g]=l^-(r>>7&1)&u,i[g+1]=l^-(r>>6&1)&u,i[g+2]=l^-(r>>5&1)&u,i[g+3]=l^-(r>>4&1)&u,i[g+4]=l^-(r>>3&1)&u,i[g+5]=l^-(r>>2&1)&u,i[g+6]=l^-(r>>1&1)&u,i[g+7]=l^-(1&r)&u}if(0===c)continue;let r=e<p?t[e++]:255;for(let t=0;t<c;++t,++g)i[g]=l^-(r>>7-t&1)&u}return{srcPos:e,destPos:g}}({src:h,srcPos:l,dest:d,width:r,height:i,nonBlackColor:0})),t.putImageData(o,0,16*e)}}function rv(t,e){for(let i of["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"])void 0!==t[i]&&(e[i]=t[i]);void 0!==t.setLineDash&&(e.setLineDash(t.getLineDash()),e.lineDashOffset=t.lineDashOffset)}function ry(t){t.strokeStyle=t.fillStyle="#000000",t.fillRule="nonzero",t.globalAlpha=1,t.lineWidth=1,t.lineCap="butt",t.lineJoin="miter",t.miter
46Limit=10,t.globalCompositeOperation="source-over",t.font="10px sans-serif",void 0!==t.setLineDash&&(t.setLineDash([]),t.lineDashOffset=0);let{filter:e}=t;"none"!==e&&""!==e&&(t.filter="none")}function rw(t,e){if(e)return!0;eT.singularValueDecompose2dScale(t,rp);let i=Math.fround(eQ.pixelRatio*eO.PDF_TO_CSS_UNITS);return rp[0]<=i&&rp[1]<=i}let rx=["butt","round","square"],rA=["miter","round","bevel"],rS={},rT={};class r_{constructor(t,e,i,r,n,{optionalContentConfig:s,markedContentStack:a=null},o,l,h,d){this.ctx=t,this.current=new rm(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.commonObjs=e,this.objs=i,this.canvasFactory=r,this.filterFactory=n,this.groupStack=[],this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.tempSMask=null,this.smaskGroupCanvases=[],this.smaskPreparedEntry=null,this.smaskPreparedFor=null,this.smaskPreparedOffsetX=0,this.smaskPreparedOffsetY=0,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=a||[],this.optionalContentConfig=s,this.cachedPatterns=new Map,this.annotationCanvasMap=o,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=l,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map,this.dependencyTracker=h??null,this.imagesTracker=d??null}getObject(t,e,i=null){return"string"==typeof e?(this.dependencyTracker?.recordNamedDependency(t,e),e.startsWith("g_")?this.commonObjs.get(e):this.objs.get(e)):i}beginDrawing({transform:t,viewport:e,transparency:i=!1,background:r=null}){let n=this.ctx.canvas.width,s=this.ctx.canvas.height,a=this.ctx.fillStyle;if(this.ctx.fillStyle=r||"#ffffff",this.ctx.fillRect(0,0,n,s),this.ctx.fillStyle=a,i){let t=this.transparentCanvasEntry=this.canvasFactory.create(n,s);this.compositeCtx=this.ctx,({canvas:this.transparentCanvas,context:this.ctx}=t),this.ctx.save(),this.ctx.transform(...eX(this.compositeCtx))}this.ctx.save(),ry(this.ctx),t&&(this.ctx.transform(...t),this.outputScaleX=t[0],this.outputScaleY=t[3]),this.ctx.transform(...e.transform),this.viewportScale=e.scale,this.baseTransform=eX(this.ctx)}executeOperatorList(t,e,i,r,n){let s,a,o=t.argsArray,l=t.fnArray,h=e||0,d=o.length;if(d===h)return h;let c=d-h>10&&"function"==typeof i,u=c?Date.now()+15:0,p=0,g=this.commonObjs,m=this.objs;for(;;){if(void 0!==r){if(h===r.nextBreakPoint)return r.breakIt(h,i),h;if(r.shouldSkip(h)){if(++h===d)return h;continue}}if(!n||n(h))if(s=l[h],a=o[h]??null,s!==es.dependency)null===a?this[s](h):this[s](h,...a);else for(let t of a){this.dependencyTracker?.recordNamedData(t,h);let e=t.startsWith("g_")?g:m;if(!e.has(t))return e.get(t,i),h}if(++h===d)return h;if(c&&++p>10){if(Date.now()>u)return i(),h;p=0}}}#rp(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.current.activeSMask=null,this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.canvasFactory.destroy(this.transparentCanvasEntry),this.transparentCanvas=null,this.transparentCanvasEntry=null)}endDrawing(){for(let t of(this.#rp(),this.smaskGroupCanvases))this.canvasFactory.destroy(t);for(let t of(this.smaskGroupCanvases.length=0,this._clearPreparedSMask(),this.tempSMask=null,this.smaskStack.length=0,this.cachedPatterns.clear(),this._cachedBitmapsMap.values())){for(let e of t.values())"u">typeof HTMLCanvasElement&&e instanceof HTMLCanvasElement&&(e.width=e.height=0);t.clear()}this._cachedBitmapsMap.clear(),this.#rg()}#rg(){if(this.pageColors){let t=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if("none"!==t){let e=this.ctx.filter;this.ctx.filter=t,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=e}}}_scaleImage(t,e){let i=t.width??t.displayWidth,r=t.height??t.displayHeight,n=Math.max(Math.hypot(e[0],e[1]),1),s=Math.max(Math.hypot(e[2],e[3]),1),a=[],o=n,l=s,h=i,d=r;for(;o>2&&h>1||l>2&&d>1;){let t=h,e=d;o>2&&h>1&&(t=Math.ceil(h/2),o/=h/t),l>2&&d>1&&(e=Math.ceil(d/2),l/=d/e),a.push({newWidth:t,newHeight:e}),h=t,d=e}if(0===a.length)return{img:t,paintWidth:i,paintHeight:r,tmpCanvas:null};if(1===a.length){let{newWidth:e,newHeight:n}=a[0],s=this.canvasFactory.create(e,n);return s.context.drawImage(t,0,0,i,r,0,0,e,n),{img:s.canvas,paintWidth:e,paintHeight:n,tmpCanvas:s}}let c=this.canvasFactory.create(1,1),u=this.canvasFactory.create(1,1),p=i,g=r,m=t;for(let{newWidth:t,newHeight:e}of a)this.canvasFactory.reset(u,t,e),u.context.drawImage(m,0,0,p,g,0,0,t,e),[c,u]=[u,c],m=c.canvas,p=t,g=e;return this.canvasFactory.destroy(u),{img:c.canvas,paintWidth:p,paintHeight:g,tmpCanvas:c}}_createMaskCanvas(t,e){let i,r,n,s,a=this.ctx,{width:o,height:l}=e,h=this.current.fillColor,d=this.current.patternFill,c=eX(a);if((e.bitmap||e.data)&&e.count>1){let s=e.bitmap||e.data.buffer;r=JSON.stringify(d?c:[c.slice(0,4),h]);let a=(i=this._cachedBitmapsMap.getOrInsertComputed(s,eM)).get(r);if(a&&!d){let e=Math.round(Math.min(c[0],c[2])+c[4]),i=Math.round(Math.min(c[1],c[3])+c[5]);return this.dependencyTracker?.recordDependencies(t,iB),{canvas:a,offsetX:e,offsetY:i}}n=a}n||rb((s=this.canvasFactory.create(o,l)).context,e);let u=eT.transform(c,[1/o,0,0,-1/l,0,0]);u=eT.transform(u,[1,0,0,1,0,-l]);let p=t4.slice();eT.axialAlignedBoundingBox([0,0,o,l],u,p);let[g,m,f,b]=p,v=Math.round(f-g)||1,y=Math.round(b-m)||1,w=this.canvasFactory.create(v,y),x=w.context;x.translate(-g,-m),x.transform(...u);let A=null;if(!n){let t=this._scaleImage(s.canvas,eY(x));n=t.img,A=t.tmpCanvas,n!==s.canvas&&(this.canvasFactory.destroy(s),s=null),i&&d&&(i.set(r,n),A=null,s=null)}x.imageSmoothingEnabled=rw(eX(x),e.interpolate),rg(x,n,0,0,n.width,n.height,0,0,o,l),A&&this.canvasFactory.destroy(A),s&&this.canvasFactory.destroy(s),x.globalCompositeOperation="source-in";let S=eT.transform(eY(x),[1,0,0,1,-g,-m]);return x.fillStyle=d?h.getPattern(a,this,S,rr,t):h,x.fillRect(0,0,o,l),i&&!d&&i.set(r,w.canvas),this.dependencyTracker?.recordDependencies(t,iB),{canvas:w.canvas,canvasEntry:i&&!d?null:w,offsetX:Math.round(g),offsetY:Math.round(m)}}setLineWidth(t,e){this.dependencyTracker?.recordSimpleData("lineWidth",t),e!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=e,this.ctx.lineWidth=e}setLineCap(t,e){this.dependencyTracker?.recordSimpleData("lineCap",t),this.ctx.lineCap=rx[e]}setLineJoin(t,e){this.dependencyTracker?.recordSimpleData("lineJoin",t),this.ctx.lineJoin=rA[e]}setMiterLimit(t,e){this.dependencyTracker?.recordSimpleData("miterLimit",t),this.ctx.miterLimit=e}setDash(t,e,i){this.dependencyTracker?.recordSimpleData("dash",t);let r=this.ctx;void 0!==r.setLineDash&&(r.setLineDash(e),r.lineDashOffset=i)}
46setRenderingIntent(t,e){}setFlatness(t,e){}setGState(t,e){for(let[i,r]of e)switch(i){case"LW":this.setLineWidth(t,r);break;case"LC":this.setLineCap(t,r);break;case"LJ":this.setLineJoin(t,r);break;case"ML":this.setMiterLimit(t,r);break;case"D":this.setDash(t,r[0],r[1]);break;case"RI":this.setRenderingIntent(t,r);break;case"FL":this.setFlatness(t,r);break;case"Font":this.setFont(t,r[0],r[1]);break;case"CA":this.dependencyTracker?.recordSimpleData("strokeAlpha",t),this.current.strokeAlpha=r;break;case"ca":this.dependencyTracker?.recordSimpleData("fillAlpha",t),this.ctx.globalAlpha=this.current.fillAlpha=r;break;case"BM":this.dependencyTracker?.recordSimpleData("globalCompositeOperation",t),this.ctx.globalCompositeOperation=r;break;case"SMask":this.dependencyTracker?.recordSimpleData("SMask",t),this.current.activeSMask=r?this.tempSMask:null,this.current.activeSMask&&(this.current.activeSMask.blendMode=this.ctx.globalCompositeOperation),this.tempSMask=null,this.checkSMaskState(t);break;case"TR":this.dependencyTracker?.recordSimpleData("filter",t),this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(r)}}get inSMaskMode(){return!!this.suspendedCtx}_clearPreparedSMask(){this.smaskPreparedEntry&&(this.canvasFactory.destroy(this.smaskPreparedEntry),this.smaskPreparedEntry=null),this.smaskPreparedFor=null,this.smaskPreparedOffsetX=0,this.smaskPreparedOffsetY=0}_ensurePreparedSMask(t,e,i){t!==this.smaskPreparedFor&&(this._clearPreparedSMask(),this._prepareSMaskCanvas(t,e,i))}checkSMaskState(t){let e=this.inSMaskMode;this.current.activeSMask&&!e?this.beginSMaskMode(t):!this.current.activeSMask&&e?this.endSMaskMode():this.current.activeSMask&&e&&this._ensurePreparedSMask(this.current.activeSMask,this.ctx.canvas.width,this.ctx.canvas.height)}_prepareSMaskCanvas(t,e,i){let r,n,s,{canvas:a,subtype:o,backdrop:l,transferMap:h}=t,d="Luminosity"===o||"Alpha"===o&&h;if(!l&&!d){this.smaskPreparedFor=t;return}if(l&&d){let d=this.canvasFactory.create(e,i),c=d.context;c.drawImage(a,t.offsetX,t.offsetY),c.globalCompositeOperation="destination-atop",c.fillStyle=l,c.fillRect(0,0,e,i),c.globalCompositeOperation="source-over";let u=(r=this.canvasFactory.create(e,i)).context;u.filter="Alpha"===o?this.filterFactory.addAlphaFilter(h):this.filterFactory.addLuminosityFilter(h),u.drawImage(d.canvas,0,0),u.filter="none",this.canvasFactory.destroy(d),n=s=0}else if(d){let e=(r=this.canvasFactory.create(a.width,a.height)).context;e.filter="Alpha"===o?this.filterFactory.addAlphaFilter(h):this.filterFactory.addLuminosityFilter(h),e.drawImage(a,0,0),e.filter="none",{offsetX:n,offsetY:s}=t}else{let o=(r=this.canvasFactory.create(e,i)).context;o.drawImage(a,t.offsetX,t.offsetY),o.globalCompositeOperation="destination-atop",o.fillStyle=l,o.fillRect(0,0,e,i),o.globalCompositeOperation="source-over",n=s=0}this.smaskPreparedEntry=r,this.smaskPreparedFor=t,this.smaskPreparedOffsetX=n,this.smaskPreparedOffsetY=s}beginSMaskMode(t){if(this.inSMaskMode)throw Error("beginSMaskMode called while already in smask mode");let{width:e,height:i}=this.ctx.canvas,r=this.canvasFactory.create(e,i);this.smaskScratchCanvas=r,this.suspendedCtx=this.ctx;let n=this.ctx=r.context;n.setTransform(this.suspendedCtx.getTransform()),rv(this.suspendedCtx,n);var s=this.suspendedCtx;if(n._removeMirroring)throw Error("Context is already forwarding operations.");n.__originalSave=n.save,n.__originalRestore=n.restore,n.__originalRotate=n.rotate,n.__originalScale=n.scale,n.__originalTranslate=n.translate,n.__originalTransform=n.transform,n.__originalSetTransform=n.setTransform,n.__originalResetTransform=n.resetTransform,n.__originalClip=n.clip,n.__originalMoveTo=n.moveTo,n.__originalLineTo=n.lineTo,n.__originalBezierCurveTo=n.bezierCurveTo,n.__originalRect=n.rect,n.__originalClosePath=n.closePath,n.__originalBeginPath=n.beginPath,n._removeMirroring=()=>{n.save=n.__originalSave,n.restore=n.__originalRestore,n.rotate=n.__originalRotate,n.scale=n.__originalScale,n.translate=n.__originalTranslate,n.transform=n.__originalTransform,n.setTransform=n.__originalSetTransform,n.resetTransform=n.__originalResetTransform,n.clip=n.__originalClip,n.moveTo=n.__originalMoveTo,n.lineTo=n.__originalLineTo,n.bezierCurveTo=n.__originalBezierCurveTo,n.rect=n.__originalRect,n.closePath=n.__originalClosePath,n.beginPath=n.__originalBeginPath,delete n._removeMirroring},n.save=function(){s.save(),this.__originalSave()}
46,n.restore=function(){s.restore(),this.__originalRestore()},n.translate=function(t,e){s.translate(t,e),this.__originalTranslate(t,e)},n.scale=function(t,e){s.scale(t,e),this.__originalScale(t,e)},n.transform=function(t,e,i,r,n,a){s.transform(t,e,i,r,n,a),this.__originalTransform(t,e,i,r,n,a)},n.setTransform=function(t,e,i,r,n,a){void 0===e?(s.setTransform(t),this.__originalSetTransform(t)):(s.setTransform(t,e,i,r,n,a),this.__originalSetTransform(t,e,i,r,n,a))},n.resetTransform=function(){s.resetTransform(),this.__originalResetTransform()},n.rotate=function(t){s.rotate(t),this.__originalRotate(t)},n.clip=function(t){s.clip(t),this.__originalClip(t)},n.moveTo=function(t,e){s.moveTo(t,e),this.__originalMoveTo(t,e)},n.lineTo=function(t,e){s.lineTo(t,e),this.__originalLineTo(t,e)},n.bezierCurveTo=function(t,e,i,r,n,a){s.bezierCurveTo(t,e,i,r,n,a),this.__originalBezierCurveTo(t,e,i,r,n,a)},n.rect=function(t,e,i,r){s.rect(t,e,i,r),this.__originalRect(t,e,i,r)},n.closePath=function(){s.closePath(),this.__originalClosePath()},n.beginPath=function(){s.beginPath(),this.__originalBeginPath()},this._ensurePreparedSMask(this.current.activeSMask,e,i),this.setGState(t,[["BM","source-over"]])}endSMaskMode(){if(!this.inSMaskMode)throw Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),rv(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null,this.canvasFactory.destroy(this.smaskScratchCanvas),this.smaskScratchCanvas=null,this._clearPreparedSMask()}compose(t){if(!this.current.activeSMask)return;t?(t[0]=Math.floor(t[0]),t[1]=Math.floor(t[1]),t[2]=Math.ceil(t[2]),t[3]=Math.ceil(t[3])):t=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];let e=this.current.activeSMask,i=this.suspendedCtx;this.composeSMask(i,e,this.ctx,t),this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(t[0],t[1],t[2]-t[0],t[3]-t[1]),this.ctx.restore()}composeSMask(t,e,i,r){let n=r[0],s=r[1],a=r[2]-n,o=r[3]-s;if(0===a||0===o)return;let l=this.smaskPreparedEntry;if(l){let t=n-this.smaskPreparedOffsetX,e=s-this.smaskPreparedOffsetY;i.save(),i.globalAlpha=1,i.setTransform(1,0,0,1,0,0);let r=new Path2D;r.rect(n,s,a,o),i.clip(r),i.globalCompositeOperation="destination-in",i.drawImage(l.canvas,t,e,a,o,n,s,a,o),i.restore()}else this.genericComposeSMask(e.context,i,a,o,n,s,e.offsetX,e.offsetY);t.save(),t.globalAlpha=1,t.globalCompositeOperation=e.blendMode||"source-over",t.setTransform(1,0,0,1,0,0),t.drawImage(i.canvas,n,s,a,o,n,s,a,o),t.restore()}genericComposeSMask(t,e,i,r,n,s,a,o){let l=t.canvas,h=n-a,d=s-o;e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0);let c=new Path2D;c.rect(n,s,i,r),e.clip(c),e.globalCompositeOperation="destination-in",e.drawImage(l,h,d,i,r,n,s,i,r),e.restore()}save(t){this.inSMaskMode&&rv(this.ctx,this.suspendedCtx),this.ctx.save();let e=this.current;this.stateStack.push(e),this.current=e.clone(),this.dependencyTracker?.save(t)}restore(t){if(this.dependencyTracker?.restore(t),0===this.stateStack.length){this.inSMaskMode&&this.endSMaskMode();return}this.current=this.stateStack.pop(),this.ctx.restore(),this.inSMaskMode&&(rv(this.suspendedCtx,this.ctx),this.ctx.setTransform(this.suspendedCtx.getTransform())),this.checkSMaskState(t),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}transform(t,e,i,r,n,s,a){this.dependencyTracker?.recordIncrementalData("transform",t),this.ctx.transform(e,i,r,n,s,a),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(t,e,i,r){let[n]=i;if(!r){n||=i[0]=new Path2D,e!==es.stroke&&e!==es.closeStroke&&(this.current.tilingPatternDims=null),this[e](t,n);return}if(null!==this.dependencyTracker){let i=e===es.stroke?this.current.lineWidth/2:0;this.dependencyTracker.resetBBox(t).recordBBox(t,this.ctx,r[0]-i,r[2]+i,r[1]-i,r[3]+i).recordDependencies(t,["transform"])}n instanceof Path2D||(n=i[0]=e9(n)),eT.axialAlignedBoundingBox(r,eX(this.ctx),this.current.minMax);let s=this.current.tilingPatternDims;if(s&&e!==es.stroke&&e!==es.closeStroke&&this.current.fillColor instanceof rc){let t=eT.intersect(this.current.clipBox,this.current.minMax);t?this.current.fillColor.updatePatternDims(t,s):this.current.tilingPatternDims=null}this[e](t,n),this._pathStartIdx=t}closePath(t){this.ctx.closePath()}stroke(t,e,i=!0){let r=this.ctx,n=this.current.strokeColor;if(r.globalAlpha=this.current.strokeAlpha,this.contentVisible)if("object"==typeof n&&n?.getPattern){let i=n.isModifyingCurrentTransform()?r.getTransform():null;if(r.save(),r.strokeStyle=n.getPattern(r,this,eY(r),rn,t),i){let t=new Path2D;t.addPath(e,r.getTransform().invertSelf().multiplySelf(i)),e=t}
46this.rescaleAndStroke(e,!1),r.restore()}else this.rescaleAndStroke(e,!0);this.dependencyTracker?.recordDependencies(t,iP),i&&this.consumePath(t,e,this.current.getClippedPathBoundingBox(rn,eX(this.ctx))),r.globalAlpha=this.current.fillAlpha}closeStroke(t,e){this.stroke(t,e)}fill(t,e,i=!0){let r=this.ctx,n=this.current.fillColor,s=this.current.patternFill,a=!1,o=this.current.getClippedPathBoundingBox();if(this.dependencyTracker?.recordDependencies(t,iM),s){let s=this.current.tilingPatternDims,l=s&&n.canSkipPatternCanvas(s);if(l){n.drawPattern(this,e,this.pendingEOFill,l,t),this.pendingEOFill=!1,i&&this.consumePath(t,e,o),this.current.tilingPatternDims=null;return}let h=n.isModifyingCurrentTransform()?r.getTransform():null;if(this.dependencyTracker?.save(t),r.save(),r.fillStyle=n.getPattern(r,this,eY(r),rr,t),h){let t=new Path2D;t.addPath(e,r.getTransform().invertSelf().multiplySelf(h)),e=t}a=!0}this.contentVisible&&null!==o&&(this.pendingEOFill?(r.fill(e,"evenodd"),this.pendingEOFill=!1):r.fill(e)),a&&(r.restore(),this.dependencyTracker?.restore(t)),i&&this.consumePath(t,e,o)}eoFill(t,e){this.pendingEOFill=!0,this.fill(t,e)}fillStroke(t,e){this.fill(t,e,!1),this.stroke(t,e,!1),this.consumePath(t,e)}eoFillStroke(t,e){this.pendingEOFill=!0,this.fillStroke(t,e)}closeFillStroke(t,e){this.fillStroke(t,e)}closeEOFillStroke(t,e){this.pendingEOFill=!0,this.fillStroke(t,e)}endPath(t,e){this.consumePath(t,e)}rawFillPath(t,e){this.ctx.fill(e),this.dependencyTracker?.recordDependencies(t,iI).recordOperation(t)}clip(t){this.dependencyTracker?.recordFutureForcedDependency("clipMode",t),this.pendingClip=rS}eoClip(t){this.dependencyTracker?.recordFutureForcedDependency("clipMode",t),this.pendingClip=rT}beginText(t){this.current.textMatrix=null,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0,this.dependencyTracker?.recordOpenMarker(t).resetIncrementalData("sameLineText").resetIncrementalData("moveText",t)}endText(t){let e=this.pendingTextPaths,i=this.ctx;if(this.dependencyTracker){let{dependencyTracker:i}=this;void 0!==e&&i.recordFutureForcedDependency("textClip",i.getOpenMarker()).recordFutureForcedDependency("textClip",t),i.recordCloseMarker(t)}if(void 0!==e){let t=new Path2D,r=i.getTransform().invertSelf();for(let{transform:i,x:n,y:s,fontSize:a,path:o}of e)o&&t.addPath(o,new DOMMatrix(i).preMultiplySelf(r).translate(n,s).scale(a,-a));i.clip(t)}delete this.pendingTextPaths}setCharSpacing(t,e){this.dependencyTracker?.recordSimpleData("charSpacing",t),this.current.charSpacing=e}setWordSpacing(t,e){this.dependencyTracker?.recordSimpleData("wordSpacing",t),this.current.wordSpacing=e}setHScale(t,e){this.dependencyTracker?.recordSimpleData("hScale",t),this.current.textHScale=e/100}setLeading(t,e){this.dependencyTracker?.recordSimpleData("leading",t),this.current.leading=-e}setFont(t,e,i){this.dependencyTracker?.recordSimpleData("font",t).recordSimpleDataFromNamed("fontObj",e,t);let r=this.commonObjs.get(e),n=this.current;if(!r)throw Error(`Can't find font for ${e}`);if(n.fontMatrix=r.fontMatrix||t9,(0===n.fontMatrix[0]||0===n.fontMatrix[3])&&el("Invalid font matrix for font "+e),i<0?(i=-i,n.fontDirection=-1):n.fontDirection=1,this.current.font=r,this.current.fontSize=i,r.isType3Font)return;let s=r.loadedName||"sans-serif",a=r.systemFontInfo?.css||`"${s}", ${r.fallbackName}`,o="normal";r.black?o="900":r.bold&&(o="bold");let l=r.italic?"italic":"normal",h=i;i<16?h=16:i>100&&(h=100),this.current.fontSizeScale=i/h,this.ctx.font=`${l} ${o} ${h}px ${a}`}setTextRenderingMode(t,e){this.dependencyTracker?.recordSimpleData("textRenderingMode",t),this.current.textRenderingMode=e}setTextRise(t,e){this.dependencyTracker?.recordSimpleData("textRise",t),this.current.textRise=e}moveText(t,e,i){this.dependencyTracker?.resetIncrementalData("sameLineText").recordIncrementalData("moveText",t),this.current.x=this.current.lineX+=e,this.current.y=this.current.lineY+=i}setLeadingMoveText(t,e,i){this.setLeading(t,-i),this.moveText(t,e,i)}setTextMatrix(t,e){this.dependencyTracker?.resetIncrementalData("sameLineText").recordSimpleData("textMatrix",t);let{current:i}=this;i.textMatrix=e,i.textMatrixScale=Math.hypot(e[0],e[1]),i.x=i.lineX=0,i.y=i.lineY=0}nextLine(t){this.moveText(t,0,this.current.leading),this.dependencyTracker?.recordIncrementalData("moveText",this.dependencyTracker.getSimpleIndex("leading")??t)}#rm(t,e,i){let r=new Path2D;return r.addPath(t,new DOMMatrix(i).invertSelf().multiplySelf(e)),r}paintChar(t,e,i,r,n,s){let a,o=this.ctx,l=this.current,h=l.font,d=l.textRenderingMode,c=l.fontSize/l.fontSizeScale,u=3&d,p=!!(4&d),g=l.patternFill&&!h.missingFile,m=l.patternStroke&&!h.missingFile;if((h.disableFontFace||p||g||m)&&!h.missingFile&&(a=h.getPathGenerator(this.commonObjs,e)),a&&(h.disableFontFace||g||m)){let e;if(o.save(),o.translate(i,r),o.scale(c,-c),this.dependencyTracker?.recordCharacterBBox(t,o,h),0===u||2===u)if(n){e=o.getTransform(),o.setTransform(...n);let t=this.#rm(a,e,n);o.fill(t)}else o.fill(a);if(1===u||2===u)if(s){e||=o.getTransform(),o.setTransform(...s);let{a:t,b:i,c:r,d:n}=e,l=eT.inverseTransform(s),h=eT.transform([t,i,r,n,0,0],l);eT.singularValueDecompose2dScale(h,rp),o.lineWidth*=Math.max(rp[0],rp[1])/c,o.stroke(this.#rm(a,e,s))}else o.lineWidth/=c,o.stroke(a);
46o.restore()}else(0===u||2===u)&&(o.fillText(e,i,r),this.dependencyTracker?.recordCharacterBBox(t,o,h,c,i,r,()=>o.measureText(e))),(1===u||2===u)&&(this.dependencyTracker&&this.dependencyTracker?.recordCharacterBBox(t,o,h,c,i,r,()=>o.measureText(e)).recordDependencies(t,iP),o.strokeText(e,i,r));p&&((this.pendingTextPaths||=[]).push({transform:eX(o),x:i,y:r,fontSize:c,path:a}),this.dependencyTracker?.recordCharacterBBox(t,o,h,c,i,r))}get isFontSubpixelAAEnabled(){let t=this.canvasFactory.create(10,10),e=t.context;e.scale(1.5,1),e.fillText("I",0,10);let i=e.getImageData(0,0,10,10).data;this.canvasFactory.destroy(t);let r=!1;for(let t=3;t<i.length;t+=4)if(i[t]>0&&i[t]<255){r=!0;break}return eg(this,"isFontSubpixelAAEnabled",r)}showText(t,e){let i,r;this.dependencyTracker&&(this.dependencyTracker.recordDependencies(t,iR).resetBBox(t),4&this.current.textRenderingMode&&this.dependencyTracker.recordFutureForcedDependency("textClip",t).inheritPendingDependenciesAsFutureForcedDependencies());let n=this.current,s=n.font;if(s.isType3Font){this.showType3Text(t,e),this.dependencyTracker?.recordShowTextOperation(t);return}let a=n.fontSize;if(0===a)return void this.dependencyTracker?.recordOperation(t);let o=this.ctx,l=n.fontSizeScale,h=n.charSpacing,d=n.wordSpacing,c=n.fontDirection,u=n.textHScale*c,p=e.length,g=s.vertical,m=g?1:-1,f=s.defaultVMetrics,b=a*n.fontMatrix[0],v=0===n.textRenderingMode&&!s.disableFontFace&&!n.patternFill;o.save(),n.textMatrix&&o.transform(...n.textMatrix),o.translate(n.x,n.y+n.textRise),c>0?o.scale(u,-1):o.scale(u,1);let y=3&n.textRenderingMode,w=1===y||2===y,x=n.lineWidth,A=n.textMatrixScale;if(0===A||0===x?w&&(x=this.getSinglePixelWidth()):x/=A,1!==l&&(o.scale(l,l),x/=l),o.lineWidth=x,(0===y||2===y)&&n.patternFill){o.save();let e=n.fillColor.getPattern(o,this,eY(o),rr,t);i=eX(o),o.restore(),o.fillStyle=e}if(w&&n.patternStroke){o.save();
46let e=n.strokeColor.getPattern(o,this,eY(o),rn,t);r=eX(o),o.restore(),o.strokeStyle=e}if(s.isInvalidPDFjsFont){let i=[],r=0;for(let t of e)i.push(t.unicode),r+=t.width;let s=i.join("");if(o.fillText(s,0,0),null!==this.dependencyTracker){let e=o.measureText(s);this.dependencyTracker.recordBBox(t,this.ctx,-e.actualBoundingBoxLeft,e.actualBoundingBoxRight,-e.actualBoundingBoxAscent,e.actualBoundingBoxDescent).recordShowTextOperation(t)}n.x+=r*b*u,o.restore(),this.compose();return}let S=0,T;for(T=0;T<p;++T){let n,u,p,y=e[T];if("number"==typeof y){S+=m*y*a/1e3;continue}let w=!1,x=(y.isSpace?d:0)+h,A=y.fontChar,_=y.accent,E=y.width;if(g){let t=y.vmetric||f,e=-(y.vmetric?t[1]:.5*E)*b,i=t[2]*b;E=t?-t[0]:E,n=e/l,u=(S+i)/l}else n=S/l,u=0;if(s.remeasure&&E>0){let t=1e3*(p=o.measureText(A)).width/a*l;if(E<t&&this.isFontSubpixelAAEnabled){let e=E/t;w=!0,o.save(),o.scale(e,1),n/=e}else E!==t&&(n+=(E-t)/2e3*a/l)}if(this.contentVisible&&(y.isInFont||s.missingFile)){if(v&&!_)o.fillText(A,n,u),this.dependencyTracker?.recordCharacterBBox(t,o,p?{bbox:null}:s,a/l,n,u,()=>p??o.measureText(A));else if(this.paintChar(t,A,n,u,i,r),_){let e=n+a*_.offset.x/l,s=u-a*_.offset.y/l;this.paintChar(t,_.fontChar,e,s,i,r)}}S+=g?E*b-x*c:E*b+x*c,w&&o.restore()}
46g?n.y-=S:n.x+=S*u,o.restore(),this.compose(),this.dependencyTracker?.recordShowTextOperation(t)}showType3Text(t,e){let i,r,n,s,a=this.ctx,o=this.current,l=o.font,h=o.fontSize,d=o.fontDirection,c=l.vertical?1:-1,u=o.charSpacing,p=o.wordSpacing,g=o.textHScale*d,m=o.fontMatrix||t9,f=e.length;if(3===o.textRenderingMode||0===h)return;this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,a.save(),o.textMatrix&&a.transform(...o.textMatrix),a.translate(o.x,o.y+o.textRise),a.scale(g,d);let b=this.dependencyTracker;for(this.dependencyTracker=b?new ik(b,t):null,i=0;i<f;++i){if("number"==typeof(r=e[i])){s=c*r*h/1e3,this.ctx.translate(s,0),o.x+=s*g;continue}let t=(r.isSpace?p:0)+u,d=l.charProcOperatorList[r.operatorListId];d?this.contentVisible&&(this.save(),a.scale(h,h),a.transform(...m),this.executeOperatorList(d),this.restore()):el(`Type3 character "${r.operatorListId}" is not available.`);let f=[r.width,0];eT.applyTransform(f,m),n=f[0]*h+t,a.translate(n,0),o.x+=n*g}a.restore(),b&&(this.dependencyTracker=b)}setCharWidth(t,e,i){}
46setCharWidthAndBounds(t,e,i,r,n,s,a){let o=new Path2D;o.rect(r,n,s-r,a-n),this.ctx.clip(o),this.dependencyTracker?.recordBBox(t,this.ctx,r,s,n,a).recordClipBox(t,this.ctx,r,s,n,a),this.endPath(t)}getColorN_Pattern(t,e){let i;if("TilingPattern"===e[0]){let t=this.baseTransform||eX(this.ctx);i=new rc(e,this.ctx,{createCanvasGraphics:(t,e)=>new r_(t,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack},void 0,void 0,this.dependencyTracker?new ik(this.dependencyTracker,e,!0):null)},t)}else i=this._getPattern(t,e[1],e[2]);return i}setStrokeColorN(t,...e){this.dependencyTracker?.recordSimpleData("strokeColor",t),this.current.strokeColor=this.getColorN_Pattern(t,e),this.current.patternStroke=!0}setFillColorN(t,...e){this.dependencyTracker?.recordSimpleData("fillColor",t);let i=this.current.fillColor=this.getColorN_Pattern(t,e);this.current.patternFill=!0,this.current.tilingPatternDims=i instanceof rc?[0,0,0,0]:null}setStrokeRGBColor(t,e){this.dependencyTracker?.recordSimpleData("strokeColor",t),this.ctx.strokeStyle=this.current.strokeColor=e,this.current.patternStroke=!1}
46setStrokeTransparent(t){this.dependencyTracker?.recordSimpleData("strokeColor",t),this.ctx.strokeStyle=this.current.strokeColor="transparent",this.current.patternStroke=!1}setFillRGBColor(t,e){this.dependencyTracker?.recordSimpleData("fillColor",t),this.ctx.fillStyle=this.current.fillColor=e,this.current.patternFill=!1,this.current.tilingPatternDims=null}setFillTransparent(t){this.dependencyTracker?.recordSimpleData("fillColor",t),this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1,this.current.tilingPatternDims=null}_getPattern(t,e,i=null){let r;return this.cachedPatterns.has(e)?r=this.cachedPatterns.get(e):(r=function(t){switch(t[0]){case"RadialAxial":return new rl(t);case"Mesh":return new rh(t);case"Dummy":return new rd}throw Error(`Unknown IR type: ${t[0]}`)}(this.getObject(t,e)),this.cachedPatterns.set(e,r)),i&&(r.matrix=i),r}shadingFill(t,e){if(!this.contentVisible)return;let i=this.ctx;this.save(t),i.fillStyle=this._getPattern(t,e).getPattern(i,this,eY(i),rs,t);let r=eY(i);if(r){let{width:t,height:e}=i.canvas,n=t4.slice();eT.axialAlignedBoundingBox([0,0,t,e],r,n);let[s,a,o,l]=n;this.ctx.fillRect(s,a,o-s,l-a)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.dependencyTracker?.resetBBox(t).recordFullPageBBox(t).recordDependencies(t,iF).recordDependencies(t,iM).recordOperation(t),this.compose(this.current.getClippedPathBoundingBox()),this.restore(t)}beginInlineImage(){eh("Should not call beginInlineImage")}beginImageData(){eh("Should not call beginImageData")}
46paintFormXObjectBegin(t,e,i){if(this.contentVisible&&(this.save(t),this.baseTransformStack.push(this.baseTransform),e&&this.transform(t,...e),this.baseTransform=eX(this.ctx),i)){eT.axialAlignedBoundingBox(i,this.baseTransform,this.current.minMax);let[e,r,n,s]=i,a=new Path2D;a.rect(e,r,n-e,s-r),this.ctx.clip(a),this.dependencyTracker?.recordClipBox(t,this.ctx,e,n,r,s),this.endPath(t)}}paintFormXObjectEnd(t){this.contentVisible&&(this.restore(t),this.baseTransform=this.baseTransformStack.pop())}beginGroup(t,e){let i;if(!this.contentVisible)return;this.save(t);let{inSMaskMode:r}=this;r&&(this.endSMaskMode(),this.current.activeSMask=null);let n=this.ctx;if(e.isolated||eo("TODO: Support non-isolated groups."),e.knockout&&el("Knockout groups not supported."),!e.needsIsolation&&1===n.globalAlpha&&"source-over"===n.globalCompositeOperation&&!r){if(e.bbox){let t=new Path2D,[i,r,s,a]=e.bbox;if(t.rect(i,r,s-i,a-r),e.matrix){let i=new Path2D;i.addPath(t,new DOMMatrix(e.matrix)),t=i}n.clip(t)}this.groupStack.push(null),this.groupLevel++;return}let s=eX(n);e.matrix&&n.transform(...e.matrix);let a=[0,0,n.canvas.width,n.canvas.height];e.bbox?(i=t4.slice(),eT.axialAlignedBoundingBox(e.bbox,eX(n),i),i=eT.intersect(i,a)||[0,0,0,0]):i=a;let o=Math.floor(i[0]),l=Math.floor(i[1]),h=Math.max(Math.ceil(i[2])-o,1),d=Math.max(Math.ceil(i[3])-l,1);this.current.startNewPathAndClipBox([0,0,h,d]);let c=this.canvasFactory.create(h,d);e.smask&&this.smaskGroupCanvases.push(c);let u=c.context;if(u.translate(-o,-l),u.transform(...s),!e.isolated&&!e.smask&&r&&e.needsIsolation&&(u.save(),u.setTransform(1,0,0,1,0,0),u.drawImage(n.canvas,-o,-l),u.restore()),e.bbox){let t=new Path2D,[i,r,n,s]=e.bbox;if(t.rect(i,r,n-i,s-r),e.matrix){let i=new Path2D;i.addPath(t,new DOMMatrix(e.matrix)),t=i}u.clip(t)}e.smask&&this.smaskStack.push({canvas:c.canvas,context:u,offsetX:o,offsetY:l,subtype:e.smask.subtype,backdrop:e.smask.backdrop,transferMap:e.smask.transferMap||null}),(!e.smask||this.dependencyTracker)&&(n.setTransform(1,0,0,1,0,0),n.translate(o,l),n.save()),rv(n,u),this.ctx=u,this.dependencyTracker?.inheritSimpleDataAsFutureForcedDependencies(["fillAlpha","strokeAlpha","globalCompositeOperation"]).pushBaseTransform(n),this.setGState(t,[["BM","source-over"],["ca",1],["CA",1],["TR",null]]),this.groupStack.push(n),this.groupLevel++}endGroup(t,e){if(!this.contentVisible)return;this.groupLevel--;let i=this.ctx,r=this.groupStack.pop();if(null===r)return void this.restore(t);if(this.ctx=r,this.ctx.imageSmoothingEnabled=!1,this.dependencyTracker?.popBaseTransform(),e.smask)this.tempSMask=this.smaskStack.pop(),this.restore(t),this.dependencyTracker&&(this.ctx.restore(),this.inSMaskMode&&this.ctx.setTransform(this.suspendedCtx.getTransform()));else{this.ctx.restore();let e=eX(this.ctx);this.restore(t),this.ctx.save(),this.ctx.setTransform(...e);let r=t4.slice();eT.axialAlignedBoundingBox([0,0,i.canvas.width,i.canvas.height],e,r),this.ctx.drawImage(i.canvas,0,0),this.ctx.restore(),this.canvasFactory.destroy({canvas:i.canvas,context:i}),this.compose(r)}}beginAnnotation(t,e,i,r,n,s){if(this.#rp(),ry(this.ctx),this.ctx.save(),this.save(t),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),i){let n=i[2]-i[0],a=i[3]-i[1];if(s&&this.annotationCanvasMap){r=r.slice(),r[4]-=i[0],r[5]-=i[1],(i=i.slice())[0]=i[1]=0,i[2]=n,i[3]=a,eT.singularValueDecompose2dScale(eX(this.ctx),rp);let{viewportScale:t}=this,s=Math.ceil(n*this.outputScaleX*t),o=Math.ceil(a*this.outputScaleY*t);this.annotationCanvas=this.canvasFactory.create(s,o);let{canvas:l,context:h}=this.annotationCanvas;this.annotationCanvasMap.set(e,l),this.annotationCanvas.savedCtx=this.ctx,this.ctx=h,this.ctx.save(),this.ctx.setTransform(rp[0],0,0,-rp[1],0,a*rp[1]),ry(this.ctx)}else{ry(this.ctx),this.endPath(t);let e=new Path2D;e.rect(i[0],i[1],n,a),this.ctx.clip(e)}}this.current=new rm(this.ctx.canvas.width,this.ctx.canvas.height),this.baseTransformStack.push(this.baseTransform),this.transform(t,...r),this.transform(t,...n),this.baseTransform=eX(this.ctx)}endAnnotation(t){this.annotationCanvas&&(this.ctx.restore(),this.#rg(),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas),this.baseTransform=this.baseTransformStack.pop()}paintImageMaskXObject(t,e){if(!this.contentVisible)return;let i=e.count;(e=this.getObject(t,e.data,e)).count=i;let r=this.ctx,n=this._createMaskCanvas(t,e),s=n.canvas;r.save(),r.setTransform(1,0,0,1,0,0),r.drawImage(s,n.offsetX,n.offsetY),this.dependencyTracker?.resetBBox(t).recordBBox(t,this.ctx,n.offsetX,n.offsetX+s.width,n.offsetY,n.offsetY+s.height).recordOperation(t),r.restore(
46),n.canvasEntry&&this.canvasFactory.destroy(n.canvasEntry),this.compose()}paintImageMaskXObjectRepeat(t,e,i,r=0,n=0,s,a){if(!this.contentVisible)return;e=this.getObject(t,e.data,e);let o=this.ctx;o.save();let l=eX(o);o.transform(i,r,n,s,0,0);let h=this._createMaskCanvas(t,e);o.setTransform(1,0,0,1,h.offsetX-l[4],h.offsetY-l[5]),this.dependencyTracker?.resetBBox(t);for(let e=0,d=a.length;e<d;e+=2){let d=eT.transform(l,[i,r,n,s,a[e],a[e+1]]);o.drawImage(h.canvas,d[4],d[5]),this.dependencyTracker?.recordBBox(t,this.ctx,d[4],d[4]+h.canvas.width,d[5],d[5]+h.canvas.height)}o.restore(),h.canvasEntry&&this.canvasFactory.destroy(h.canvasEntry),this.compose(),this.dependencyTracker?.recordOperation(t)}paintImageMaskXObjectGroup(t,e){if(!this.contentVisible)return;let i=this.ctx,r=this.current.fillColor,n=this.current.patternFill;for(let s of(this.dependencyTracker?.resetBBox(t).recordDependencies(t,iB),e)){let{data:e,width:a,height:o,transform:l}=s,h=this.canvasFactory.create(a,o),d=h.context;d.save(),rb(d,this.getObject(t,e,s)),d.globalCompositeOperation="source-in",d.fillStyle=n?r.getPattern(d,this,eY(i),rr,t):r,d.fillRect(0,0,a,o),d.restore(),i.save(),i.transform(...l),i.scale(1,-1),rg(i,h.canvas,0,0,a,o,0,-1,1,1),this.canvasFactory.destroy(h),this.dependencyTracker?.recordBBox(t,i,0,a,0,o),i.restore()}this.compose(),this.dependencyTracker?.recordOperation(t)}paintImageXObject(t,e){if(!this.contentVisible)return;let i=this.getObject(t,e);i?this.paintInlineImageXObject(t,i):el("Dependent image isn't ready yet")}paintImageXObjectRepeat(t,e,i,r,n){if(!this.contentVisible)return;let s=this.getObject(t,e);if(!s)return void el("Dependent image isn't ready yet");let a=s.width,o=s.height,l=[];for(let t=0,e=n.length;t<e;t+=2)l.push({transform:[i,0,0,r,n[t],n[t+1]],x:0,y:0,w:a,h:o});this.paintInlineImageXObjectGroup(t,s,l)}applyTransferMapsToCanvas(t){return"none"!==this.current.transferMaps&&(t.filter=this.current.transferMaps,t.drawImage(t.canvas,0,0),t.filter="none"),t.canvas}applyTransferMapsToBitmap(t){if("none"===this.current.transferMaps)return{img:t.bitmap,canvasEntry:null};let{bitmap:e,width:i,height:r}=t,n=this.canvasFactory.create(i,r),s=n.context;return s.filter=this.current.transferMaps,s.drawImage(e,0,0),s.filter="none",{img:n.canvas,canvasEntry:n}}paintInlineImageXObject(t,e){let i;if(!this.contentVisible)return;let r=e.width,n=e.height,s=this.ctx;this.save(t);let{filter:a}=s;"none"!==a&&""!==a&&(s.filter="none"),s.scale(1/r,-1/n);let o=null;if(e.bitmap){let t=this.applyTransferMapsToBitmap(e);i=t.img,o=t.canvasEntry}else if("function"==typeof HTMLElement&&e instanceof HTMLElement||!e.data)i=e;else{let t=this.canvasFactory.create(r,n);rf(t.context,e),i=this.applyTransferMapsToCanvas(t.context),o=t}let l=this._scaleImage(i,eY(s));s.imageSmoothingEnabled=rw(eX(s),e.interpolate),this.dependencyTracker&&(this.dependencyTracker.resetBBox(t).recordBBox(t,s,0,r,-n,0).recordDependencies(t,iD).recordOperation(t),this.imagesTracker?.record(s,r,n,this.dependencyTracker.clipBox)),rg(s,l.img,0,0,l.paintWidth,l.paintHeight,0,-n,r,n),l.tmpCanvas&&this.canvasFactory.destroy(l.tmpCanvas),o&&this.canvasFactory.destroy(o),this.compose(),this.restore(t)}paintInlineImageXObjectGroup(t,e,i){let r;if(!this.contentVisible)return;let n=this.ctx,s=null;if(e.bitmap)r=e.bitmap;else{let t=e.width,i=e.height,n=this.canvasFactory.create(t,i);rf(n.context,e),r=this.applyTransferMapsToCanvas(n.context),s=n}for(let e of(this.dependencyTracker?.resetBBox(t),i))n.save(),n.transform(...e.transform),n.scale(1,-1),rg(n,r,e.x,e.y,e.w,e.h,0,-1,1,1),this.dependencyTracker?.recordBBox(t,n,0,1,-1,0),n.restore();s&&this.canvasFactory.destroy(s),this.dependencyTracker?.recordOperation(t),this.compose()}paintSolidColorImageMask(t){this.contentVisible&&(this.dependencyTracker?.resetBBox(t).recordBBox(t,this.ctx,0,1,0,1).recordDependencies(t,iM).recordOperation(t),this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(t,e){}
46markPointProps(t,e,i){}beginMarkedContent(t,e){this.dependencyTracker?.beginMarkedContent(t),this.markedContentStack.push({visible:!0})}beginMarkedContentProps(t,e,i){this.dependencyTracker?.beginMarkedContent(t),"OC"===e?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(i)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(t){this.dependencyTracker?.endMarkedContent(t),this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(t){}endCompat(t){}consumePath(t,e,i){let r=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(i);let n=this.ctx;this.pendingClip?(r||(this.pendingClip===rT?n.clip(e,"evenodd"):n.clip(e)),this.pendingClip=null,this.dependencyTracker?.bboxToClipBoxDropOperation(t).recordFutureForcedDependency("clipPath",t)):this.dependencyTracker?.recordOperation(t),this.current.startNewPathAndClipBox(this.current.clipBox)}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){let t=eX(this.ctx);if(0===t[1]&&0===t[2])this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(t[0]),Math.abs(t[3]));else{let e=Math.abs(t[0]*t[3]-t[2]*t[1]),i=Math.hypot(t[0],t[2]),r=Math.hypot(t[1],t[3]);this._cachedGetSinglePixelWidth=Math.max(i,r)/e}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(-1===this._cachedScaleForStroking[0]){let t,e,{lineWidth:i}=this.current,{a:r,b:n,c:s,d:a}=this.ctx.getTransform();if(0===n&&0===s){let n=Math.abs(r),s=Math.abs(a);if(n===s)if(0===i)t=e=1/n;else{let r=n*i;t=e=r<1?1/r:1}else if(0===i)t=1/n,e=1/s;else{let r=n*i,a=s*i;t=r<1?1/r:1,e=a<1?1/a:1}}else{let o=Math.abs(r*a-n*s),l=Math.hypot(r,n),h=Math.hypot(s,a);if(0===i)t=h/o,e=l/o;else{let r=i*o;t=h>r?h/r:1,e=l>r?l/r:1}}this._cachedScaleForStroking[0]=t,this._cachedScaleForStroking[1]=e}return this._cachedScaleForStroking}rescaleAndStroke(t,e){let{ctx:i,current:{lineWidth:r}}=this,[n,s]=this.getScaleForStroking();if(n===s){i.lineWidth=(r||1)*n,i.stroke(t);return}let a=i.getLineDash();e&&i.save(),i.scale(n,s),ru.a=1/n,ru.d=1/s;let o=new Path2D;if(o.addPath(t,ru),a.length>0){let t=Math.max(n,s);i.setLineDash(a.map(e=>e/t)),i.lineDashOffset/=t}i.lineWidth=r||1,i.stroke(o),e&&i.restore()}isContentVisible(){for(let t=this.markedContentStack.length-1;t>=0;t--)if(!this.markedContentStack[t].visible)return!1;return!0}}for(let t in es)void 0!==r_.prototype[t]&&(r_.prototype[es[t]]=r_.prototype[t]);class rE{#rf=null;#rb=null;_fullReader=null;_rangeReaders=new Set;_source=null;constructor(t,e,i){this._source=t,this.#rf=e,this.#rb=i}get _progressiveDataLength(){return this._fullReader?._loaded??0}getFullReader(){return ed(!this._fullReader,"BasePDFStream.getFullReader can only be called once."),this._fullReader=new this.#rf(this)}getRangeReader(t,e){if(e<=this._progressiveDataLength)return null;let i=new this.#rb(this,t,e);return this._rangeReaders.add(i),i}cancelAllRequests(t){for(let e of(this._fullReader?.cancel(t),new Set(this._rangeReaders)))e.cancel(t)}}class rC{onProgress=null;_contentLength=0;_filename=null;_headersCapability=Promise.withResolvers();_isRangeSupported=!1;_isStreamingSupported=!1;_loaded=0;_stream=null;constructor(t){this._stream=t}_callOnProgress(){this.onProgress?.({loaded:this._loaded,total:this._contentLength})}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){eh("Abstract method `read` called")}cancel(t){eh("Abstract method `cancel` called")}}class rk{_stream=null;constructor(t,e,i){this._stream=t}async read(){eh("Abstract method `read` called")}cancel(t){eh("Abstract method `cancel` called")}}function rP(t,e){let i=new Headers;if(!t||!e||"object"!=typeof e)return i;for(let t in e){let r=e[t];void 0!==r&&i.append(t,r)}return i}function rM(t){return URL.parse(t)?.origin??null}function rD({responseHeaders:t,isHttp:e,rangeChunkSize:i,disableRange:r}){let n={contentLength:0,isRangeSupported:!1},s=parseInt(t.get("Content-Length"),10);return Number.isInteger(s)&&(n.contentLength=s,s<=2*i||r||!e||"bytes"!==t.get("Accept-Ranges")||"identity"===(t.get("Content-Encoding")||"identity")&&(n.isRangeSupported=!0)),n}function rI(t){let e=t.get("Content-Disposition");if(e){let t=function(t){let e=!0,i=r("filename\\*","i").exec(t);if(i){let t=a(i=i[1]);return s(t=l(t=o(t=unescape(t))))}if(i=function(t){let e,i=[],n=r("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;null!==(e=n.exec(t));){let[,t,r,n]=e;if((t=parseInt(t,10))in i){if(0===t)break;continue}i[t]=[r,n]}let s=[];for(let t=0;t<i.length&&t in i;++t){let[e,r]=i[t];r=a(r),e&&(r=unescape(r),0===t&&(r=o(r))),s.push(r)}return s.join("")}(t))return s(l(i));
46if(i=r("filename","i").exec(t)){let t=a(i=i[1]);return s(t=l(t))}function r(t,e){return RegExp("(?:^|;)\\s*"+t+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',e)}function n(t,i){if(t){if(!/^[\x00-\xFF]+$/.test(i))return i;try{let r=new TextDecoder(t,{fatal:!0}),n=eA(i);i=r.decode(n),e=!1}catch{}}return i}function s(t){return e&&/[\x80-\xff]/.test(t)&&(t=n("utf-8",t),e&&(t=n("iso-8859-1",t))),t}function a(t){if(t.startsWith('"')){let e=t.slice(1).split('\\"');for(let t=0;t<e.length;++t){let i=e[t].indexOf('"');-1!==i&&(e[t]=e[t].slice(0,i),e.length=t+1),e[t]=e[t].replaceAll(/\\(.)/g,"$1")}t=e.join('"')}return t}function o(t){let e=t.indexOf("'");return -1===e?t:n(t.slice(0,e),t.slice(e+1).replace(/^[^']*'/,""))}function l(t){return!t.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(t)?t:t.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(t,e,i,r){if("q"===i||"Q"===i)return n(e,r=(r=r.replaceAll("_"," ")).replaceAll(/=([0-9a-fA-F]{2})/g,function(t,e){return String.fromCharCode(parseInt(e,16))}));try{r=atob(r)}catch{}return n(e,r)})}return""}(e);if(t.includes("%"))try{t=decodeURIComponent(t)}catch{}if(ez(t))return t}return null}function rR(t,e){return new ey(`Unexpected server response (${t}) while retrieving PDF "${e.href}".`,t,404===t||0===t&&"file:"===e.protocol)}function rF(t,e){if(t!==e)throw Error(`Expected range response-origin "${t}" to match "${e}".`)}function rB(t,e,i,r){return fetch(t,{method:"GET",headers:e,signal:r.signal,mode:"cors",credentials:i?"include":"same-origin",redirect:"follow"})}function rO(t,e){if(200!==t&&206!==t)throw rR(t,e)}function rL(t){if(t instanceof Uint8Array)return t.buffer;if(t instanceof ArrayBuffer)return t;throw Error(`getArrayBuffer - unexpected data: ${t}`)}class rN extends rE{_responseOrigin=null;constructor(t){super(t,rU,rj);let{httpHeaders:e,url:i}=t;ed(/https?:/.test(i.protocol),"PDFFetchStream only supports http(s):// URLs."),this.headers=rP(!0,e)}}class rU extends rC{_abortController=new AbortController;_reader=null;constructor(t){super(t);let{disableRange:e,disableStream:i,rangeChunkSize:r,url:n,withCredentials:s}=t._source;this._isStreamingSupported=!i,rB(n,new Headers(t.headers),s,this._abortController).then(i=>{t._responseOrigin=rM(i.url),rO(i.status,n),this._reader=i.body.getReader();let s=i.headers,{contentLength:a,isRangeSupported:o}=rD({responseHeaders:s,isHttp:!0,rangeChunkSize:r,disableRange:e});this._contentLength=a,this._isRangeSupported=o,this._filename=rI(s),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new ex("Streaming is disabled.")),this._headersCapability.resolve()}).catch(this._headersCapability.reject)}async read(){await this._headersCapability.promise;let{value:t,done:e}=await this._reader.read();return e?{value:t,done:e}:(this._loaded+=t.byteLength,this._callOnProgress(),{value:rL(t),done:!1})}cancel(t){this._reader?.cancel(t),this._abortController.abort()}}class rj extends rk{_abortController=new AbortController;_readCapability=Promise.withResolvers();_reader=null;constructor(t,e,i){super(t,e,i);let{url:r,withCredentials:n}=t._source,s=new Headers(t.headers);s.append("Range",`bytes=${e}-${i-1}`),rB(r,s,n,this._abortController).then(e=>{rF(rM(e.url),t._responseOrigin),rO(e.status,r),this._reader=e.body.getReader(),this._readCapability.resolve()}).catch(this._readCapability.reject)}async read(){await this._readCapability.promise;let{value:t,done:e}=await this._reader.read();return e?{value:t,done:e}:{value:rL(t),done:!1}}cancel(t){this._reader?.cancel(t),this._abortController.abort()}}function rz(t){return t instanceof Uint8Array&&t.byteLength===t.buffer.byteLength?t.buffer:new Uint8Array(t).buffer}function rH(){for(let t of this._requests)t.resolve({value:void 0,done:!0});this._requests.length=0}t5(116);class r$ extends rE{_progressiveDone=!1;_queuedChunks=[];constructor(t){super(t,rV,rW);let{pdfDataRangeTransport:e}=t,{initialData:i,progressiveDone:r}=e;if(i?.length>0){let t=rz(i);this._queuedChunks.push(t)}this._progressiveDone=r;let n=t=>{switch(t.type){case"range":case"progressiveRead":this.#rv(t.begin,t.chunk);break;case"progressiveDone":this._fullReader?.progressiveDone(),this._progressiveDone=!0}};e.transportReady(n)}#rv(t,e){let i=rz(e);if(void 0===t)this._fullReader?this._fullReader._enqueue(i):this._queuedChunks.push(i);else{let e=this._rangeReaders.keys().find(e=>e._begin===t);ed(e,"#onReceiveData - no `PDFDataTransportStreamRangeReader` instance found."),e._enqueue(i)}}getFullReader(){let t=super.getFullReader();return this._queuedChunks=null,t}getRangeReader(t,e){let i=super.getRangeReader(t,e);return i&&(i.onDone=()=>this._rangeReaders.delete(i),this._source.pdfDataRangeTransport.requestDataRange(t,e)),i}cancelAllRequests(t){super.cancelAllRequests(t),this._source.pdfDataRangeTransport.abort()}}
46class rV extends rC{#ry=rH.bind(this);_done=!1;_queuedChunks=null;_requests=[];constructor(t){super(t);let{pdfDataRangeTransport:e,disableRange:i,disableStream:r}=t._source,{length:n,contentDispositionFilename:s}=e;for(let e of(this._queuedChunks=t._queuedChunks||[],this._queuedChunks))this._loaded+=e.byteLength;this._done=t._progressiveDone,this._contentLength=n,this._isStreamingSupported=!r,this._isRangeSupported=!i,ez(s)&&(this._filename=s),this._headersCapability.resolve();let a=this._loaded;Promise.resolve().then(()=>{a>0&&this._loaded===a&&this._callOnProgress()})}_enqueue(t){this._done||(this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunks.push(t),this._loaded+=t.byteLength,this._callOnProgress())}async read(){if(this._queuedChunks.length>0)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};let t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0,this.#ry()}progressiveDone(){this._done||=!0,0===this._queuedChunks.length&&this.#ry()}}class rW extends rk{#ry=rH.bind(this);onDone=null;_begin=-1;_done=!1;_queuedChunk=null;_requests=[];constructor(t,e,i){super(t,e,i),this._begin=e}_enqueue(t){this._done||(0===this._requests.length?this._queuedChunk=t:(this._requests.shift().resolve({value:t,done:!1}),this.#ry()),this._done=!0,this.onDone?.())}async read(){if(this._queuedChunk){let t=this._queuedChunk;return this._queuedChunk=null,{value:t,done:!1}}if(this._done)return{value:void 0,done:!0};let t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0,this.#ry(),this.onDone?.()}}class rG extends rE{#rw=new WeakMap;_responseOrigin=null;constructor(t){super(t,rq,rK);let{httpHeaders:e,url:i}=t;this.url=i,this.isHttp=/https?:/.test(i.protocol),this.headers=rP(this.isHttp,e)}_request(t){let e=new XMLHttpRequest,i={validateStatus:null,onHeadersReceived:t.onHeadersReceived,onDone:t.onDone,onError:t.onError,onProgress:t.onProgress};for(let[t,r]of(this.#rw.set(e,i),e.open("GET",this.url),e.withCredentials=this._source.withCredentials,this.headers))e.setRequestHeader(t,r);return this.isHttp&&"begin"in t&&"end"in t?(e.setRequestHeader("Range",`bytes=${t.begin}-${t.end-1}`),i.validateStatus=t=>206===t||200===t):i.validateStatus=t=>200===t,e.responseType="arraybuffer",ed(t.onError,"Expected `onError` callback to be provided."),e.onerror=()=>t.onError(e.status),e.onreadystatechange=this.#rx.bind(this,e),e.onprogress=this.#rA.bind(this,e),e.send(null),e}#rA(t,e){let i=this.#rw.get(t);i?.onProgress?.(e)}#rx(t,e){var i;let r=this.#rw.get(t);if(!r||(t.readyState>=2&&r.onHeadersReceived&&(r.onHeadersReceived(),delete r.onHeadersReceived),4!==t.readyState||!this.#rw.has(t)))return;if(this.#rw.delete(t),0===t.status&&this.isHttp)return void r.onError(t.status);let n=t.status||200;if(!r.validateStatus(n))return void r.onError(t.status);let s="string"!=typeof(i=t.response)?i:eA(i).buffer;if(206===n){let e=t.getResponseHeader("Content-Range");/bytes (\d+)-(\d+)\/(\d+)/.test(e)?r.onDone(s):(el('Missing or invalid "Content-Range" header.'),r.onError(0))}else s?r.onDone(s):r.onError(t.status)}_abortRequest(t){this.#rw.has(t)&&(this.#rw.delete(t),t.abort())}getRangeReader(t,e){let i=super.getRangeReader(t,e);return i&&(i.onClosed=()=>this._rangeReaders.delete(i)),i}}class rq extends rC{#ry=rH.bind(this);_cachedChunks=[];_done=!1;_requests=[];_storedError=null;constructor(t){super(t),this._fullRequestXhr=t._request({onHeadersReceived:this.#rS.bind(this),onDone:this.#rT.bind(this),onError:this.#r_.bind(this),onProgress:this.#rA.bind(this)})}#rS(){let t=this._stream,{disableRange:e,rangeChunkSize:i}=t._source,r=this._fullRequestXhr;t._responseOrigin=rM(r.responseURL);let n=r.getAllResponseHeaders(),s=new Headers(n?n.trimStart().replace(/[^\S ]+$/,"").split(/[\r\n]+/).map(t=>{let[e,...i]=t.split(": ");return[e,i.join(": ")]}):[]),{contentLength:a,isRangeSupported:o}=rD({responseHeaders:s,isHttp:t.isHttp,rangeChunkSize:i,disableRange:e});this._contentLength=a,this._isRangeSupported=o,this._filename=rI(s),this._isRangeSupported&&t._abortRequest
46(r),this._headersCapability.resolve()}#rT(t){this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._cachedChunks.push(t),this._done=!0,0===this._cachedChunks.length&&this.#ry()}#r_(t){for(let e of(this._storedError=rR(t,this._stream.url),this._headersCapability.reject(this._storedError),this._requests))e.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}#rA(t){this.onProgress?.({loaded:t.loaded,total:t.lengthComputable?t.total:this._contentLength})}async read(){if(await this._headersCapability.promise,this._storedError)throw this._storedError;if(this._cachedChunks.length>0)return{value:this._cachedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};let t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0,this._headersCapability.reject(t),this.#ry(),this._stream._abortRequest(this._fullRequestXhr),this._fullRequestXhr=null}}class rK extends rk{#ry=rH.bind(this);onClosed=null;_done=!1;_queuedChunk=null;_requests=[];_storedError=null;constructor(t,e,i){super(t,e,i),this._requestXhr=t._request({begin:e,end:i,onHeadersReceived:this.#rS.bind(this),onDone:this.#rT.bind(this),onError:this.#r_.bind(this),onProgress:null})}#rS(){let t=rM(this._requestXhr?.responseURL);try{rF(t,this._stream._responseOrigin)}catch(t){this._storedError=t,this.#r_(0)}}#rT(t){this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunk=t,this._done=!0,this.#ry(),this.onClosed?.()}#r_(t){for(let e of(this._storedError??=rR(t,this._stream.url),this._requests))e.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}async read(){if(this._storedError)throw this._storedError;if(null!==this._queuedChunk){let t=this._queuedChunk;return this._queuedChunk=null,{value:t,done:!1}}if(this._done)return{value:void 0,done:!0};let t=Promise.withResolvers();return this._requests.push(t),t.promise}cancel(t){this._done=!0,this.#ry(),this._stream._abortRequest(this._requestXhr),this.onClosed?.()}}function rX(t,e=null){let i=process.getBuiltinModule("fs"),{Readable:r}=process.getBuiltinModule("stream"),n=i.createReadStream(t,e);return r.toWeb(n)}class rY extends rE{constructor(t){super(t,rJ,rQ);let{url:e}=t;ed("file:"===e.protocol,"PDFNodeStream only supports file:// URLs.")}}class rJ extends rC{_reader=null;constructor(t){super(t);let{disableRange:e,disableStream:i,rangeChunkSize:r,url:n}=t._source;this._isStreamingSupported=!i,process.getBuiltinModule("fs/promises").lstat(n).then(t=>{let i=rX(n);this._reader=i.getReader();let{size:s}=t;this._contentLength=s,this._isRangeSupported=!e&&s>2*r,!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new ex("Streaming is disabled.")),this._headersCapability.resolve()}).catch(t=>{"ENOENT"===t.code&&(t=rR(0,n)),this._headersCapability.reject(t)})}async read(){await this._headersCapability.promise;let{value:t,done:e}=await this._reader.read();return e?{value:t,done:e}:(this._loaded+=t.byteLength,this._callOnProgress(),{value:rL(t),done:!1})}cancel(t){this._reader?.cancel(t)}}class rQ extends rk{_readCapability=Promise.withResolvers();_reader=null;constructor(t,e,i){super(t,e,i);let{url:r}=t._source;try{let t=rX(r,{start:e,end:i-1});this._reader=t.getReader(),this._readCapability.resolve()}catch(t){this._readCapability.reject(t)}}async read(){await this._readCapability.promise;let{value:t,done:e}=await this._reader.read();return e?{value:t,done:e}:{value:rL(t),done:!1}}cancel(t){this._reader?.cancel(t)}}class rZ{static #rE=null;static #rC="";static get workerPort(){return this.#rE}static set workerPort(t){if(!("u">typeof Worker&&t instanceof Worker)&&null!==t)throw Error("Invalid `workerPort` type.");this.#rE=t}static get workerSrc(){return this.#rC}static set workerSrc(t){if("string"!=typeof t)throw Error("Invalid `workerSrc` type.");this.#rC=t}}class r0{#rk;#rP;constructor({parsedData:t,rawData:e}){this.#rk=t,this.#rP=e}getRaw(){return this.#rP}get(t){return this.#rk.get(t)??null}[Symbol.iterator](){return this.#rk.entries()}}let r1=Symbol("INTERNAL");class r2{#rM=!1;#rD=!1;#rI=!1;#rR=!0;constructor(t,{name:e,intent:i,usage:r,rbGroups:n}){this.#rM=!!(2&t),this.#rD=!!(4&t),this.name=e,this.intent=i,this.usage=r,this.rbGroups=n}get visible(){if(this.#rI)return this.#rR;if(!this.#rR)return!1;let{print:t,view:e}=this.usage;return this.#rM?e?.viewState!=="OFF":!this.#rD||t?.printState!=="OFF"}_setVisible(t,e,i=!1){t!==r1&&eh("Internal method `_setVisible` called."),this.#rI=i,this.#rR=e}}class r5{#rF=null;#rB=new Map;#rO=null;#rL=null;constructor(t,e=2){if(this.renderingIntent=e,this.name=null,this.creator=null,null===t)return;for(let i of(this.name=t.name,this.creator=t.creator,this.#rL=t.order,t.groups))this.#rB.set(i.id,new r2(e,i));if("OFF"===t.baseState)for(let t of this.#rB.values())t._setVisible(r1,!1);for(let e of t.on)this.#rB.get(e)._setVisible(r1,!0);for(let e of t.off)this.#rB.get(e)._setVisible(r1,!1);this.#rO=this.getHash()}#rN(t){let e=t.length;if(e<2)return!0;let i=t[0];for(let r=1;r<e;r++){let e,n=t[r];if(Array.isArray(n))e=this.#rN(n);else{if(!this.#rB.has(n))return el(`Optional content group not found: ${n}`),!0;e=this.#rB.get(n).visible}switch(i){case"And":if(!e)return!1;break;case"Or":if(e)return!0;break;case"Not":return!e;default:return!0}}return"And"===i}isVisible(t){if(0===this.#rB.size)return!0;
46if(!t)return eo("Optional content group not defined."),!0;if("OCG"===t.type)return this.#rB.has(t.id)?this.#rB.get(t.id).visible:(el(`Optional content group not found: ${t.id}`),!0);if("OCMD"===t.type){if(t.expression)return this.#rN(t.expression);if(t.policy&&"AnyOn"!==t.policy){if("AllOn"===t.policy){for(let e of t.ids){if(!this.#rB.has(e)){el(`Optional content group not found: ${e}`);break}if(!this.#rB.get(e).visible)return!1}return!0}else if("AnyOff"===t.policy){for(let e of t.ids){if(!this.#rB.has(e))return el(`Optional content group not found: ${e}`),!0;if(!this.#rB.get(e).visible)return!0}return!1}else if("AllOff"===t.policy){for(let e of t.ids){if(!this.#rB.has(e)){el(`Optional content group not found: ${e}`);break}if(this.#rB.get(e).visible)return!1}return!0}}else{for(let e of t.ids){if(!this.#rB.has(e))return el(`Optional content group not found: ${e}`),!0;if(this.#rB.get(e).visible)return!0}return!1}return el(`Unknown optional content policy ${t.policy}.`),!0}return el(`Unknown group type ${t.type}.`),!0}setVisibility(t,e=!0,i=!0){let r=this.#rB.get(t);if(!r)return void el(`Optional content group not found: ${t}`);if(i&&e&&r.rbGroups.length)for(let e of r.rbGroups)for(let i of e)i!==t&&this.#rB.get(i)?._setVisible(r1,!1,!0);r._setVisible(r1,!!e,!0),this.#rF=null}setOCGState({state:t,preserveRB:e}){let i;for(let r of t){switch(r){case"ON":case"OFF":case"Toggle":i=r;continue}let t=this.#rB.get(r);if(t)switch(i){case"ON":this.setVisibility(r,!0,e);break;case"OFF":this.setVisibility(r,!1,e);break;case"Toggle":this.setVisibility(r,!t.visible,e)}}this.#rF=null}get hasInitialVisibility(){return null===this.#rO||this.getHash()===this.#rO}getOrder(){return this.#rB.size?this.#rL?this.#rL.slice():[...this.#rB.keys()]:null}getGroup(t){return this.#rB.get(t)||null}getHash(){if(null!==this.#rF)return this.#rF;let t=new ig;for(let[e,i]of this.#rB)t.update(`${e}:${i.visible}`);return this.#rF=t.hexdigest()}[Symbol.iterator](){return this.#rB.entries()}}class r3{#rU=null;#rj=null;#rz=0;#rH=null;#r$=null;get pagesNumber(){return this.#rz}set pagesNumber(t){this.#rz!==t&&(this.#rz=t,this.#rU=null,this.#rj=null)}#rV(){if(this.#rU)return;let t=this.#rz,e=this.#rU=new Uint32Array(t);for(let i=0;i<t;i++)e[i]=i+1;this.#rj=new Int32Array(e)}#rW(){let t=new Map,e=this.#rU;for(let i=0,r=this.#rz;i<r;i++){let r=e[i],n=t.get(r);n?n.push(i+1):t.set(r,[i+1])}return t}movePages(t,e,i){this.#rV();let r=this.#rU,n=this.#rW(),s=e.length,a=new Uint32Array(s),o=0;for(let t=0;t<s;t++){let n=e[t]-1;a[t]=r[n],n<i&&o++}let l=this.#rz,h=l-s,d=eI(i-o,0,h);for(let e=0,i=0;e<l;e++)t.has(e+1)||(r[i++]=r[e]);r.copyWithin(d+s,d,h),r.set(a,d),this.#rG(n),r.every((t,e)=>t===e+1)&&(this.#rU=null)}deletePages(t){this.#rV();let e=this.#rU,i=this.#rW();this.#r$={pageNumberToId:e.slice(),pagesNumber:this.#rz,prevPageNumbers:this.#rj.slice()};let r=this.#rz-t.length;this.#rz=r;let n=this.#rU=new Uint32Array(r);this.#rj=new Int32Array(r);let s=0,a=0;for(let i of t){let t=i-1;t!==s&&(n.set(e.subarray(s,t),a),a+=t-s),s=t+1}s<e.length&&n.set(e.subarray(s),a),this.#rG(i,new Set(t))}cancelDelete(){this.#r$&&(this.#rU=this.#r$.pageNumberToId,this.#rz=this.#r$.pagesNumber,this.#rj=this.#r$.prevPageNumbers,this.#r$=null)}cleanSavedData(){this.#r$=null}copyPages(t){this.#rV(),this.#rH={pageNumbers:t,pageIds:t.map(t=>this.#rU[t-1])}}cancelCopy(){this.#rH=null}pastePages(t){this.#rV();let e=this.#rU,i=this.#rW(),{pageNumbers:r,pageIds:n}=this.#rH,s=this.#rz+r.length;this.#rz=s;let a=this.#rU=new Uint32Array(s);this.#rj=new Int32Array(s),a.set(e.subarray(0,t),0),a.set(n,t),a.set(e.subarray(t),t+r.length),this.#rG(i,null,t,r),this.#rH=null}#rG(t,e=null,i=-1,r=null){let n=this.#rj,s=this.#rU,a=i+(r?.length??0),o=new Map;for(let l=0,h=this.#rz;l<h;l++){if(l>=i&&l<a){n[l]=-r[l-i];continue}let h=s[l],d=t.get(h),c=o.get(h)||0;if(e&&d)for(;c<d.length&&e.has(d[c]);)c++;n[l]=d?.[c],o.set(h,c+1)}}hasBeenAltered(){return null!==this.#rU}getPageMappingForSaving(t=null){t??=this.#rW();let e=0;for(let i of t.values())e=Math.max(e,i.length);let i=Array(e);for(let t=0;t<e;t++)i[t]={document:null,pageIndices:[],includePages:[]};for(let[e,r]of t)for(let t=0,n=r.length;t<n;
46t++)i[t].includePages.push([e-1,r[t]-1]);for(let{includePages:t,pageIndices:e}of i){t.sort((t,e)=>t[0]-e[0]);for(let i=0,r=t.length;i<r;i++)e.push(t[i][1]),t[i]=t[i][0]}return i}extractPages(t){t=Array.from(t).sort((t,e)=>t-e);let e=new Map;for(let i=0,r=t.length;i<r;i++){let r=this.getPageId(t[i]);e.getOrInsertComputed(r,eP).push(i+1)}return this.getPageMappingForSaving(e)}getPrevPageNumber(t){return this.#rj?.[t-1]??0}getPageNumber(t){if(!this.#rU)return t;let e=this.#rU;for(let i=0,r=this.#rz;i<r;i++)if(e[i]===t)return i+1;return 0}getPageId(t){return this.#rU?.[t-1]??t}getMapping(){return this.#rU?.subarray(0,this.pagesNumber)}}let r6=Symbol("INITIAL_DATA"),r4=()=>({...Promise.withResolvers(),data:r6});class r9{#rq=new Map;get(t,e=null){if(e){let i=this.#rq.getOrInsertComputed(t,r4);return i.promise.then(()=>e(i.data)),null}let i=this.#rq.get(t);if(!i||i.data===r6)throw Error(`Requesting object that isn't resolved yet ${t}.`);return i.data}has(t){let e=this.#rq.get(t);return!!e&&e.data!==r6}delete(t){let e=this.#rq.get(t);return!!e&&e.data!==r6&&(this.#rq.delete(t),!0)}resolve(t,e=null){let i=this.#rq.getOrInsertComputed(t,r4);if(i.data!==r6)throw Error(`Object already resolved ${t}.`);i.data=e,i.resolve()}clear(){for(let{data:t}of this.#rq.values())t?.bitmap?.close();this.#rq.clear()}*[Symbol.iterator](){for(let[t,{data:e}]of this.#rq)e!==r6&&(yield[t,e])}}class r8{#rK=Promise.withResolvers();#tC=null;#rX=!1;#rY=!!globalThis.FontInspector?.enabled;#rJ=null;#rQ=null;#rZ=null;#r0=0;#r1=0;#r2=null;#r5=null;#r3=0;#r6=0;#r4=Object.create(null);#r9=[];#r8=null;#r7=[];#nt=new WeakMap;#ne=null;static #ni=new Map;static #nr=new Map;static #nn=new WeakMap;static #ns=null;static #na=new Set;constructor({textContentSource:t,images:e,container:i,viewport:r}){if(t instanceof ReadableStream)this.#r8=t;else if("object"==typeof t)this.#r8=new ReadableStream({start(e){e.enqueue(t),e.close()}});else throw Error('No "textContentSource" parameter specified.');this.#tC=this.#r5=i,this.#rJ=e,this.#r6=r.scale*eQ.pixelRatio,this.#r3=r.rotation,this.#rZ={div:null,properties:null,ctx:null};let{pageWidth:n,pageHeight:s,pageX:a,pageY:o}=r.rawDims;this.#ne=[1,0,0,-1,-a,o+s],this.#r1=n,this.#r0=s,r8.#no(),i.style.setProperty("--min-font-size",r8.#ns),eJ(i,r),this.#rK.promise.finally(()=>{r8.#na.delete(this),this.#rZ=null,this.#r4=null}).catch(()=>{})}static get fontFamilyMap(){let{isWindows:t,isFirefox:e}=eS.platform;return eg(this,"fontFamilyMap",new Map([["sans-serif",`${t&&e?"Calibri, ":""}sans-serif`],["monospace",`${t&&e?"Lucida Console, ":""}monospace`]]))}render(){this.#rJ&&this.#tC.append(this.#rJ.render());let t=()=>{this.#r2.read().then(({value:e,done:i})=>{i?this.#rK.resolve():(this.#rQ??=e.lang,Object.assign(this.#r4,e.styles),this.#nl(e.items),t())},this.#rK.reject)};return this.#r2=this.#r8.getReader(),r8.#na.add(this),t(),this.#rK.promise}update({viewport:t,onBefore:e=null}){let i=t.scale*eQ.pixelRatio,r=t.rotation;if(r!==this.#r3&&(e?.(),this.#r3=r,eJ(this.#r5,{rotation:r})),i!==this.#r6){e?.(),this.#r6=i;let t={div:null,properties:null,ctx:r8.#nh(this.#rQ)};for(let e of this.#r7)t.properties=this.#nt.get(e),t.div=e,this.#nd(t)}}cancel(){let t=new ex("TextLayer task cancelled.");this.#r2?.cancel(t).catch(()=>{}),this.#r2=null,this.#rK.reject(t)}get textDivs(){return this.#r7}get textContentItemsStr(){return this.#r9}#nl(t){if(this.#rX)return;this.#rZ.ctx??=r8.#nh(this.#rQ);let e=this.#r7,i=this.#r9;for(let r of t){if(e.length>1e5){el("Ignoring additional textDivs for performance reasons."),this.#rX=!0;return}if(void 0===r.str){if("beginMarkedContentProps"===r.type||"beginMarkedContent"===r.type){let t=this.#tC;this.#tC=document.createElement("span"),this.#tC.classList.add("markedContent"),r.id&&this.#tC.setAttribute("id",`${r.id}`),"Artifact"===r.tag&&(this.#tC.ariaHidden=!0),t.append(this.#tC)}else"endMarkedContent"===r.type&&(this.#tC=this.#tC.parentNode);continue}i.push(r.str),this.#nc(r)}}#nc(t){let e,i,r=document.createElement("span"),n={angle:0,canvasWidth:0,hasText:""!==t.str,hasEOL:t.hasEOL,fontSize:0};this.#r7.push(r);let s=eT.transform(this.#ne,t.transform),a=Math.atan2(s[1],s[0]),o=this.#r4[t.fontName];o.vertical&&(a+=Math.PI/2);let l=this.#rY&&o.fontSubstitution||o.fontFamily;l=r8.fontFamilyMap.get(l)||l;let h=Math.hypot(s[2],s[3]),d=h*r8.#nu(l,o,this.#rQ);0===a?(e=s[4],i=s[5]-d):(e=s[4]+d*Math.sin(a),i=s[5]-d*Math.cos(a));let c=r.style;c.left=`${(100*e/this.#r1).toFixed(2)}%`,c.top=`${(100*i/this.#r0).toFixed(2)}%`,c.setProperty("--font-height",`${h.toFixed(2)}px`),c.fontFamily=l,n.fontSize=h,r.setAttribute("role","presentation"),r.textContent=t.str,r.dir=t.dir,this.#rY&&(r.dataset.fontName=o.fontSubstitutionLoadedName||t.fontName),0!==a&&(n.angle=180/Math.PI*a);let u=!1;if(t.str.length>1)u=!0;else if(" "!==t.str&&t.transform[0]!==t.transform[3]){let e=Math.abs(t.transform[0]),i=Math.abs(t.transform[3]);e!==i&&Math.max(e,i)/Math.min(e,i)>1.5&&(u=!0)}if(u&&(n.canvasWidth=o.vertical?t.height:t.width),this.#nt.set(r,n),this.#rZ.div=r,this.#rZ.properties=n,this.#nd(this.#rZ),n.hasText&&this.#tC.append(r),n.hasEOL){let t=document.createElement("br");t.setAttribute("role","presentation"),this.#tC.append(t)}}#nd(t){let{div:e,properties:i,ctx:r}=t,{style:n}=e;if(0!==i.canvasWidth&&i.hasText){let{fontFamily:t}=n,{canvasWidth:s,fontSize:a}=i;r8.#np(r,a*this.#r6,t);let{width:o}=r.measureText(e.textContent);o>0&&n.setProperty("--scale-x",s*this.#r6/o)}0!==i.angle&&n.setProperty("--rotate",`${i.angle}deg`)}static cleanup(){if(!(this.#na.size>0)){for(let{canvas:t}
46of(this.#ni.clear(),this.#nr.values()))t.remove();this.#nr.clear()}}static #nh(t=null){let e=this.#nr.get(t||="");if(!e){let i=document.createElement("canvas");i.className="hiddenCanvasElement",i.lang=t,document.body.append(i),e=i.getContext("2d",{alpha:!1,willReadFrequently:!0}),this.#nr.set(t,e),this.#nn.set(e,{size:0,family:""})}return e}static #np(t,e,i){let r=this.#nn.get(t);(e!==r.size||i!==r.family)&&(t.font=`${e}px ${i}`,r.size=e,r.family=i)}static #no(){if(null!==this.#ns)return;let t=document.createElement("div");t.style.opacity=0,t.style.lineHeight=1,t.style.fontSize="1px",t.style.position="absolute",t.textContent="X",document.body.append(t),this.#ns=t.getBoundingClientRect().height,t.remove()}static #nu(t,e,i){let r=this.#ni.get(t);if(r)return r;let n=this.#nh(i);n.canvas.width=n.canvas.height=30,this.#np(n,30,t);let s=n.measureText(""),a=s.fontBoundingBoxAscent,o=Math.abs(s.fontBoundingBoxDescent);n.canvas.width=n.canvas.height=0;let l=.8;return a?l=a/(a+o):(eS.platform.isFirefox&&el("Enable the `dom.textMetrics.fontBoundingBox.enabled` preference in `about:config` to improve TextLayer rendering."),e.ascent?l=e.ascent:e.descent&&(l=1+e.desce
46nt)),this.#ni.set(t,l),l}}function r7(t={}){"string"==typeof t||t instanceof URL?t={url:t}:(t instanceof ArrayBuffer||ArrayBuffer.isView(t))&&(t={data:t});let e=new nt,{docId:i}=e,r=t.url?function(t){if(t instanceof URL)return t;if("string"==typeof t){if(t3)return new URL(/^[a-z][a-z0-9\-+.]+:/i.test(t)?t:process.getBuiltinModule("url").pathToFileURL(t));let e=URL.parse(t,window.location);if(e)return e}throw Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}(t.url):null,n=t.data?function(t){if(t3&&"u">typeof Buffer&&t instanceof Buffer)throw Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(t instanceof Uint8Array&&t.byteLength===t.buffer.byteLength)return t;if("string"==typeof t)return eA(t);if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)||"object"==typeof t&&!isNaN(t?.length))return new Uint8Array(t);throw Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}(t.data):null,s=t.httpHeaders||null,a=!0===t.withCredentials,o=t.password??null,l=t.range instanceof ne?t.range:null,h=Number.isInteger(t.rangeChunkSize)&&t.rangeChunkSize>0?t.rangeChunkSize:65536,d=t.worker instanceof nn?t.worker:null,c=t.verbosity,u="string"!=typeof t.docBaseUrl||ej(t.docBaseUrl)?null:t.docBaseUrl,p=iK(t.cMapUrl),g=!1!==t.cMapPacked,m=iK(t.iccUrl),f=iK(t.standardFontDataUrl),b=iK(t.wasmUrl),v=!0!==t.stopAtErrors,y=Number.isInteger(t.maxImageSize)&&t.maxImageSize>-1?t.maxImageSize:-1,w="boolean"==typeof t.isOffscreenCanvasSupported?t.isOffscreenCanvasSupported:!t3,x="boolean"==typeof t.isImageDecoderSupported?t.isImageDecoderSupported:!t3&&(eS.platform.isFirefox||!globalThis.chrome),A=Number.isInteger(t.canvasMaxAreaInBytes)?t.canvasMaxAreaInBytes:-1,S="boolean"==typeof t.disableFontFace?t.disableFontFace:t3,T=!0===t.fontExtraProperties,_=!0===t.enableXfa,E=t.ownerDocument||globalThis.document,C=!0===t.disableRange,k=!0===t.disableStream,P=!0===t.disableAutoFetch,M=!0===t.pdfBug,D=t.CanvasFactory||(t3?i7:i3),I=t.FilterFactory||(t3?i8:i4),R=t.BinaryDataFactory||(t3?rt:i2),F=!0===t.enableHWA,B=!0===t.enableWebGPU?ri.init():Promise.resolve(!1),O=!1!==t.useWasm,L=t.pagesMapper||new r3,N="boolean"==typeof t.useSystemFonts?t.useSystemFonts:!t3&&!S,U="boolean"==typeof t.useWorkerFetch?t.useWorkerFetch:!!(R===i2&&p&&g&&f&&b&&e$(p,document.baseURI)&&e$(f,document.baseURI)&&e$(b,document.baseURI));Number.isInteger(c)&&(ea=c);let j={canvasFactory:new D({ownerDocument:E,enableHWA:F}),filterFactory:new I({docId:i,ownerDocument:E}),binaryDataFactory:U?null:new R({cMapUrl:p,standardFontDataUrl:f,wasmUrl:b})};d||(e._worker=d=nn.create({verbosity:c,port:rZ.workerPort}));let z={docId:i,apiVersion:"5.7.284",data:n,password:o,disableAutoFetch:P,rangeChunkSize:h,docBaseUrl:u,enableXfa:_,evaluatorOptions:{maxImageSize:y,disableFontFace:S,ignoreErrors:v,isOffscreenCanvasSupported:w,isImageDecoderSupported:x,canvasMaxAreaInBytes:A,fontExtraProperties:T,useSystemFonts:N,useWasm:O,useWorkerFetch:U,cMapUrl:p,cMapPacked:g,iccUrl:m,standardFontDataUrl:f,wasmUrl:b,hasGPU:!1}},H={ownerDocument:E,pdfBug:M,styleElement:null,enableHWA:F,loadingParams:{disableAutoFetch:P,enableXfa:_}};return Promise.all([d.promise,B]).then(function([,t]){let o;if(e.destroyed)throw Error("Loading aborted");if(d.destroyed)throw Error("Worker was destroyed");z.evaluatorOptions.hasGPU=t;let c=d.messageHandler.sendWithPromise("GetDocRequest",z,n?[n.buffer]:null);if(n);else if(l)o=new r$({pdfDataRangeTransport:l,disableRange:C,disableStream:k});else if(r)o=new(e$(r)?rN:t3?rY:rG)({url:r,httpHeaders:s,withCredentials:a,rangeChunkSize:h,disableRange:C,disableStream:k});else throw Error("getDocument - expected either `data`, `range`, or `url` parameter.");return c.then(t=>{if(e.destroyed)throw Error("Loading aborted");if(d.destroyed)throw Error("Worker was destroyed");let r=new i0(i,t,d.port),n=new ns(r,e,o,H,j,L);e._transport=n,r.send("Ready",null)})}).catch(e._capability.reject),e}class nt{static #i3=0;_capability=Promise.withResolvers();_transport=null;_worker=null;docId=`d${nt.#i3++}`;destroyed=!1;onPassword=null;onProgress=null;get promise(){return this._capability.promise}async destroy(){this.destroyed=!0;try{this._worker?.port&&(this._worker._pendingDestroy=!0),await this._transport?.destroy()}catch(t){throw this._worker?.port&&delete this._worker._pendingDestroy,t}this._transport=null,this._worker?.destroy(),this._worker=null}async getData(){return this._transport.getData()}}class ne{#rK=Promise.withResolvers();#ng=null;constructor(t,e,i=!1,r=null){this.length=t,this.initialData=e,this.progressiveDone=i,this.contentDispositionFilename=r,Object.defineProperty(this,"onDataProgress",{value:()=>{console.log("Deprecated API usage: `PDFDataRangeTransport.prototype.onDataProgress` - method was removed, since loading progress is now reported automatically through the `PDFDataTransportStream` class (and related code).")}})}onDataRange(t,e){this.#ng({type:"range",begin:t,chunk:e})}onDataProgressiveRead(t){this.#rK.promise.then(()=>{this.#ng({type:"progressiveRead",chunk:t})})}onDataProgressiveDone(){this.#rK.promise.then(()=>{this.#ng({type:"progressiveDone"})})}transportReady(t){this.#ng=t,this.#rK.resolve()}requestDataRange(t,e){eh("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}class ni{constructor(t,e){this._pdfInfo=t,this._transport=e}get pagesMapper(){return this._transport.pagesMapper}get annotationStorage(){return this._transport.annotationStorage}get canvasFactory(){return this._transport.canvasFactory}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return eg(this,"isPureXfa",!!this._transport._htmlForXfa)}get allXfaHtml(){return this._transport._htmlForXfa}getPage(t){return this._transport.getPage(t)}getPageIndex(t){return this._transport.getPageIndex(t)}getDestinations(){return this._transport.getDestinations()}getDestination(t){return this._transport.getDestination(t)}getPageLabels(){return this._transport.getPageLabels()}getPageLayout(){return this._transport.getPageLayout()}getPageMode(){return this._transport.getPageMode()}getViewerPreferences(){return this._transport.getViewerPreferences()}getOpenAction(){return this._transport.getOpenAction()}getAttachments(){return this._transport.getAttachments()}getAnnotationsByType(t,e){return this._transport.getAnnotationsByType(t,e)}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig({intent:t="display"}={}){let{renderingIntent:e}
46=this._transport.getRenderingIntent(t);return this._transport.getOptionalContentConfig(e)}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){return this._transport.saveDocument()}extractPages(t){return this._transport.extractPages(t)}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}getRawData(t){return this._transport.getRawData(t)}cleanup(t=!1){return this._transport.startCleanup(t||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}cachedPageNumber(t){return this._transport.cachedPageNumber(t)}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}class nr{#nm=!1;#nf=null;constructor(t,e,i,r,n=!1){this._pageIndex=t,this._pageInfo=e,this._transport=i,this._stats=n?new eH:null,this._pdfBug=n,this.commonObjs=i.commonObjs,this.objs=new r9,this._intentStates=new Map,this.destroyed=!1,this.recordedBBoxes=null,this.#nf=r,this.imageCoordinates=null}clone(t){let e=new nr(t,this._pageInfo,this._transport,this.#nf,this._pdfBug);return e.clonedFromIndex=this.clonedFromIndex??this._pageIndex,this._transport.updatePage(e),e}get pageNumber(){return this._pageIndex+1}set pageNumber(t){this._pageIndex=t-1,this._transport.updatePage(this)}get rotate(){return this._pageInfo.rotate}get ref(){return this._pageInfo.ref}get userUnit(){return this._pageInfo.userUnit}get view(){return this._pageInfo.view}getViewport({scale:t,rotation:e=this.rotate,offsetX:i=0,offsetY:r=0,dontFlip:n=!1}={}){return new eN({viewBox:this.view,userUnit:this.userUnit,scale:t,rotation:e,offsetX:i,offsetY:r,dontFlip:n})}getAnnotations({intent:t="display"}={}){let{renderingIntent:e}=this._transport.getRenderingIntent(t);return this._transport.getAnnotations(this._pageIndex,e)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return eg(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){return this._transport._htmlForXfa?.children[this._pageIndex]||null}
46render({canvasContext:t,canvas:e=t.canvas,viewport:i,intent:r="display",annotationMode:n=t8.ENABLE,transform:s=null,background:a=null,optionalContentConfigPromise:o=null,annotationCanvasMap:l=null,pageColors:h=null,printAnnotationStorage:d=null,isEditing:c=!1,recordImages:u=!1,recordOperations:p=!1,operationsFilter:g=null}){this._stats?.time("Overall");let m=this._transport.getRenderingIntent(r,n,d,c),{renderingIntent:f,cacheKey:b}=m;this.#nm=!1,o||=this._transport.getOptionalContentConfig(f);let v=this._intentStates.getOrInsertComputed(b,eD);v.streamReaderCancelTimeout&&(clearTimeout(v.streamReaderCancelTimeout),v.streamReaderCancelTimeout=null);let y=!!(4&f);v.displayReadyCapability||(v.displayReadyCapability=Promise.withResolvers(),v.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(m));let w=!!(this._pdfBug&&globalThis.StepperManager?.enabled),x=!!e&&!this.recordedBBoxes&&(p||w),A=!!e&&!this.imageCoordinates&&u,S=t=>{if(v.renderTasks.delete(E),x){let t=E.gfx?.dependencyTracker.take();t&&(E.stepper?.setOperatorBBoxes(t,E.gfx.dependencyTracker.takeDebugMetadata()),p&&(this.recordedBBoxes=t))}A&&!t&&(this.imageCoordinates=E.gfx?.imagesTracker.take()),y&&(this.#nm=!0),this.#nb(),t?(E.capability.reject(t),this._abortOperatorList({intentState:v,reason:t instanceof Error?t:Error(t)})):E.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),globalThis.Stats?.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},T=null,_=null;(x||A)&&(_=new iE(e,v.operatorList.length)),x&&(T=new iC(_,w));let E=new no({callback:S,params:{canvas:e,canvasContext:t,dependencyTracker:T??_,imagesTracker:A?new iO(e):null,viewport:i,transform:s,background:a},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:l,operatorList:v.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!y,pdfBug:this._pdfBug,pageColors:h,enableHWA:this._transport.enableHWA,operationsFilter:g});(v.renderTasks||=new Set).add(E);let C=E.task;return Promise.all([v.displayReadyCapability.promise,o]).then(([t,e])=>{if(this.destroyed)return void S();if(this._stats?.time("Rendering"),!(e.renderingIntent&f))throw Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");E.initializeGraphics({transparency:t,optionalContentConfig:e}),E.operatorListChanged()}).catch(S),C}getOperatorList({intent:t="display",annotationMode:e=t8.ENABLE,printAnnotationStorage:i=null,isEditing:r=!1}={}){let n,s=this._transport.getRenderingIntent(t,e,i,r,!0),a=this._intentStates.getOrInsertComputed(s.
46cacheKey,eD);return a.opListReadCapability||((n=Object.create(null)).operatorListChanged=function(){a.operatorList.lastChunk&&(a.opListReadCapability.resolve(a.operatorList),a.renderTasks.delete(n))},a.opListReadCapability=Promise.withResolvers(),(a.renderTasks||=new Set).add(n),a.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(s)),a.opListReadCapability.promise}streamTextContent({includeMarkedContent:t=!1,disableNormalization:e=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageId:this.#nf.getPageId(this._pageIndex+1)-1,pageIndex:this._pageIndex,includeMarkedContent:!0===t,disableNormalization:!0===e},{highWaterMark:100,size:t=>t.items.length})}async getTextContent(t={}){if(this._transport._htmlForXfa)return this.getXfa().then(t=>eR.textContent(t));let e=this.streamTextContent(t),i={items:[],styles:Object.create(null),lang:null};for await(let t of e)i.lang??=t.lang,Object.assign(i.styles,t.styles),i.items.push(...t.items);return i}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;let t=[];for(let e of this._intentStates.values())if(this._abortOperatorList({intentState:e,reason:Error("Page was destroyed."),force:!0}),!e.opListReadCapability)for(let i of e.renderTasks)t.push(i.completed),i.cancel();return this.objs.clear(),this.#nm=!1,Promise.all(t)}cleanup(t=!1){this.#nm=!0;let e=this.#nb();return t&&e&&(this._stats&&=new eH),e}#nb(){if(!this.#nm||this.destroyed)return!1;for(let{renderTasks:t,operatorList:e}of this._intentStates.values())if(t.size>0||!e.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),this.#nm=!1,!0}_startRenderPage(t,e){let i=this._intentStates.get(e);i&&(this._stats?.timeEnd("Page Request"),i.displayReadyCapability?.resolve(t))}_renderPageChunk(t,e){for(let i=0,r=t.length;i<r;i++)e.operatorList.fnArray.push(t.fnArray[i]),e.operatorList.argsArray.push(t.argsArray[i]);for(let i of(e.operatorList.lastChunk=t.lastChunk,e.operatorList.separateAnnots=t.separateAnnots,e.renderTasks))i.operatorListChanged();t.lastChunk&&this.#nb()}_pumpOperatorList({renderingIntent:t,cacheKey:e,annotationStorageSerializable:i,modifiedIds:r}){let{map:n,transfer:s}=i,a=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageId:this.#nf.getPageId(this._pageIndex+1)-1,pageIndex:this._pageIndex,intent:t,cacheKey:e,annotationStorage:n,modifiedIds:r},void 0,s).getReader(),o=this._intentStates.get(e);o.streamReader=a;let l=()=>{a.read().then(({value:t,done:e})=>{if(e){o.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(t,o),l())},t=>{if(o.streamReader=null,!this._transport.destroyed){if(o.operatorList){for(let t of(o.operatorList.lastChunk=!0,o.renderTasks))t.operatorListChanged();this.#nb()}if(o.displayReadyCapability)o.displayReadyCapability.reject(t);else if(o.opListReadCapability)o.opListReadCapability.reject(t);else throw t}})};l()}_abortOperatorList({intentState:t,reason:e,force:i=!1}){if(t.streamReader){if(t.streamReaderCancelTimeout&&(clearTimeout(t.streamReaderCancelTimeout),t.streamReaderCancelTimeout=null),!i){if(t.renderTasks.size>0)return;if(e instanceof eU){let i=100;e.extraDelay>0&&e.extraDelay<1e3&&(i+=e.extraDelay),t.streamReaderCancelTimeout=setTimeout(()=>{t.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:t,reason:e,force:!0})},i);return}}if(t.streamReader.cancel(new ex(e.message)).catch(()=>{}),t.streamReader=null,!this._transport.destroyed){for(let[e,i]of this._intentStates)if(i===t){this._intentStates.delete(e);break}this.cleanup()}}}get stats(){return this._stats}}class nn{#rK=Promise.withResolvers();#nv=null;#rE=null;#ny=null;static #nw=0;static #nx=!1;static #nA=new WeakMap;static{t3&&(this.#nx=!0,rZ.workerSrc||="./pdf.worker.mjs"),this._isSameOrigin=(t,e)=>{let i=URL.parse(t);if(!i?.origin||"null"===i.origin)return!1;let r=new URL(e,i);return i.origin===r.origin},this._createCDNWrapper=t=>{let e=`await import("${t}");`;return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))}}constructor({name:t=null,port:e=null,verbosity:i=ea}={}){if(this.name=t,this.destroyed=!1,this.verbosity=i,e){if(nn.#nA.has(e))throw Error("Cannot use more than one PDFWorker per port.");nn.#nA.set(e,this),this.#nS(e)}else this.#nT()}get promise(){return this.#rK.promise}#n_(){this.#rK.resolve(),this.#nv.send("configure",{verbosity:this.verbosity})}get port(){return this.#rE}get messageHandler(){return this.#nv}#nS(t){this.#rE=t,this.#nv=new i0("main","worker",t),this.#nv.on("ready",()=>{}),this.#n_()}#nT(){if(nn.#nx||nn.#nE)return void this.#nC();let{workerSrc:t}=nn;try{nn._isSameOrigin(window.location,t)||(t=nn._createCDNWrapper(new URL(t,window.location).href));let e=new Worker(t,{type:"module"}),i=new i0("main","worker",e),r=()=>{n.abort(),i.destroy(),e.terminate(),this.destroyed?this.#rK.reject(Error("Worker was destroyed")):this.#nC()},n=new AbortController;e.addEventListener("error",()=>{this.#ny||r()},{signal:n.signal}),i.on("test",t=>{(n.abort(),this.destroyed||!t)?r():(this.#nv=i,this.#rE=e,this.#ny=e,this.#n_())}),i.on("ready",t=>{if(n.abort(),this.destroyed)return void r();try{s()}catch{this.#nC()}});let s=()=>{let t=new Uint8Array;i.send("test",t,[t.buffer])};s();return}catch{eo("The worker has been disabled.")}this.#nC()}#nC(){nn.#nx||(el("Setting up fake worker."),nn.#nx=!0),nn._setupFakeWorkerGlobal.then(t=>{if(this.destroyed)return void this.#rK.reject(Error("Worker was destroyed"));let e=new iJ;this.#rE=e;let i=`fake${nn.#nw++}`,r=new i0(i+"_worker",i,e);t.setup(r,e),this.#nv=new i0(i,i+"_worker",e),this.#n_()}).catch(t=>{this.#rK.reject(Error(`Setting up fake worker failed: "${t.message}".`))})}destroy(){this.destroyed=!0,this.#ny?.terminate(),this.#ny=null,nn.#nA.delete(this.#rE),this.#rE=null,this.#nv?.destroy(),this.#nv=null}static create(t){let e=this.#nA.get(t?.port);
46if(e){if(e._pendingDestroy)throw Error("PDFWorker.create - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return e}return new nn(t)}static get workerSrc(){if(rZ.workerSrc)return rZ.workerSrc;throw Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get #nE(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}}static get _setupFakeWorkerGlobal(){return eg(this,"_setupFakeWorkerGlobal",(async()=>this.#nE?this.#nE:(await import(this.workerSrc)).WorkerMessageHandler)())}}class ns{downloadInfoCapability=Promise.withResolvers();#nk=null;#nP=new Map;#nM=null;#nD=new Map;#nI=new Map;#nR=new Map;#nF=null;constructor(t,e,i,r,n,s){this.messageHandler=t,this.loadingTask=e,this.#nM=i,this.commonObjs=new r9,this.fontLoader=new iL({ownerDocument:r.ownerDocument,styleElement:r.styleElement}),this.enableHWA=r.enableHWA,this.loadingParams=r.loadingParams,this._params=r,this.canvasFactory=n.canvasFactory,this.filterFactory=n.filterFactory,this.binaryDataFactory=n.binaryDataFactory,this.pagesMapper=s,this.destroyed=!1,this.destroyCapability=null,this.setupMessageHandler()}updatePage(t){let{_pageIndex:e}=t;this.#nD.set(e,t),this.#nI.set(e,Promise.resolve(t))}#nB(t,e=null){return this.#nP.getOrInsertComputed(t,()=>this.messageHandler.sendWithPromise(t,e))}#rA({loaded:t,total:e}){this.loadingTask.onProgress?.({loaded:t,total:e,percent:e?eI(Math.round(t/e*100),0,100):0/0})}get annotationStorage(){return eg(this,"annotationStorage",new ib)}getRenderingIntent(t,e=t8.ENABLE,i=null,r=!1,n=!1){let s=2,a=im;switch(t){case"any":s=1;break;case"display":break;case"print":s=4;break;default:el(`getRenderingIntent - invalid intent: ${t}`)}let o=4&s&&i instanceof iv?i:this.annotationStorage;switch(e){case t8.DISABLE:s+=64;break;case t8.ENABLE:break;case t8.ENABLE_FORMS:s+=16;break;case t8.ENABLE_STORAGE:s+=32,a=o.serializable;break;default:el(`getRenderingIntent - invalid annotationMode: ${e}`)}r&&(s+=128),n&&(s+=256);let{ids:l,hash:h}=o.modifiedIds,d=[s,a.hash,h];return{renderingIntent:s,cacheKey:d.join("_"),annotationStorageSerializable:a,modifiedIds:l}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),this.#nF?.reject(Error("Worker was destroyed during onPassword callback"));let t=[];for(let e of this.#nD.values())t.push(e._destroy());this.#nD.clear(),this.#nI.clear(),this.#nR.clear(),Object.hasOwn(this,"annotationStorage")&&this.annotationStorage.resetModified();let e=this.messageHandler.sendWithPromise("Terminate",null);return t.push(e),Promise.all(t).then(()=>{this.commonObjs.clear(),this.fontLoader.clear(),this.#nP.clear(),this.filterFactory.destroy(),r8.cleanup(),this.#nM?.cancelAllRequests(new ex("Worker was terminated.")),this.messageHandler?.destroy(),this.messageHandler=null,this.destroyCapability.resolve()},this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){let{messageHandler:t,loadingTask:e}=this;t.on("GetReader",(t,e)=>{ed(this.#nM,"GetReader - no `BasePDFStream` instance available."),this.#nk=this.#nM.getFullReader(),this.#nk.onProgress=t=>this.#rA(t),e.onPull=()=>{this.#nk.read().then(function({value:t,done:i}){i?e.close():(ed(t instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),e.enqueue(new Uint8Array(t),1,[t]))}).catch(t=>{e.error(t)})},e.onCancel=t=>{this.#nk.cancel(t),e.ready.catch(t=>{if(!this.destroyed)throw t})}}),t.on("ReaderHeadersReady",async t=>{await this.#nk.headersReady;let{isStreamingSupported:e,isRangeSupported:i,contentLength:r}=this.#nk;return e&&i&&(this.#nk.onProgress=null),{isStreamingSupported:e,isRangeSupported:i,contentLength:r}}),t.on("GetRangeReader",(t,e)=>{ed(this.#nM,"GetRangeReader - no `BasePDFStream` instance available.");let i=this.#nM.getRangeReader(t.begin,t.end);i?(e.onPull=()=>{i.read().then(function({value:t,done:i}){i?e.close():(ed(t instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),e.enqueue(new Uint8Array(t),1,[t]))}).catch(t=>{e.error(t)})},e.onCancel=t=>{i.cancel(t),e.ready.catch(t=>{if(!this.destroyed)throw t})}):e.close()}),t.on("GetDoc",({pdfInfo:t})=>{this.pagesMapper.pagesNumber=t.numPages,this._numPages=t.numPages,this._htmlForXfa=t.htmlForXfa,delete t.htmlForXfa,e._capability.resolve(new ni(t,this))}),t.on("DocException",t=>{e._capability.reject(iZ(t))}
46),t.on("PasswordRequest",t=>{this.#nF=Promise.withResolvers();try{if(!e.onPassword)throw iZ(t);let i=t=>{t instanceof Error?this.#nF.reject(t):this.#nF.resolve({password:t})};e.onPassword(i,t.code)}catch(t){this.#nF.reject(t)}return this.#nF.promise}),t.on("DataLoaded",t=>{this.#rA({loaded:t.length,total:t.length}),this.downloadInfoCapability.resolve(t)}),t.on("StartRenderPage",t=>{this.destroyed||this.#nD.get(t.pageIndex)._startRenderPage(t.transparency,t.cacheKey)}),t.on("commonobj",([e,i,r])=>{if(this.destroyed||this.commonObjs.has(e))return null;switch(i){case"Font":if("error"in r){let t=r.error;el(`Error during font loading: ${t}`),this.commonObjs.resolve(e,t);break}let n=new iN(new iW(r),this._params.pdfBug&&globalThis.FontInspector?.enabled?(t,e)=>globalThis.FontInspector.fontAdded(t,e):null,r.charProcOperatorList,r.extra);this.fontLoader.bind(n).catch(()=>t.sendWithPromise("FontFallback",{id:e})).finally(()=>{n.fontExtraProperties||n.clearData(),this.commonObjs.resolve(e,n)});break;case"CopyLocalImage":let{imageRef:s}=r;for(let t of(ed(s,"The imageRef must be defined."),this.#nD.values()))for(let[,i]of t.objs){if(i?.ref!==s)continue;if(!i.dataLen)return null;let t=structuredClone(i);return this.commonObjs.resolve(e,t),i.dataLen}break;case"FontPath":this.commonObjs.resolve(e,new iq(r));break;case"Image":this.commonObjs.resolve(e,r);break;case"Pattern":let a=new iG(r);this.commonObjs.resolve(e,a.getIR());break;default:throw Error(`Got unknown common object type ${i}`)}return null}),t.on("obj",([t,e,i,r])=>{if(this.destroyed)return;let n=this.#nD.get(e);if(!n.objs.has(t)){if(0===n._intentStates.size)return void r?.bitmap?.close();switch(i){case"Image":case"Pattern":n.objs.resolve(t,r);break;default:throw Error(`Got unknown object type ${i}`)}}}),t.on("DocProgress",t=>{this.destroyed||this.#rA(t)}),t.on("FetchBinaryData",async t=>{if(this.destroyed)throw Error("Worker was destroyed.");if(!this.binaryDataFactory)throw Error("`BinaryDataFactory` not initialized, see the `useWorkerFetch` parameter.");return this.binaryDataFactory.fetch(t)})}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){this.annotationStorage.size<=0&&el("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");let{map:t,transfer:e}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:t,filename:this.#nk?.filename??null},e).finally(()=>{this.annotationStorage.resetModified()})}extractPages(t){let e,i={pageInfos:t};if(this.annotationStorage.size>0){let{map:t,transfer:r}=this.annotationStorage.serializable;i.annotationStorage=t,e=r}return this.messageHandler.sendWithPromise("ExtractPages",i,e).finally(()=>{this.annotationStorage.resetModified()})}getPage(t){if(!Number.isInteger(t)||t<=0||t>this.pagesMapper.pagesNumber)return Promise.reject(Error("Invalid page request."));let e=t-1,i=this.pagesMapper.getPageId(t)-1,r=this.#nI.get(e);if(r)return r;let n=this.messageHandler.sendWithPromise("GetPage",{pageIndex:i}).then(t=>{if(this.destroyed)throw Error("Transport destroyed");t.refStr&&this.#nR.set(t.refStr,i);let r=new nr(e,t,this,this.pagesMapper,this._params.pdfBug);return this.#nD.set(e,r),r});return this.#nI.set(e,n),n}async getPageIndex(t){if(!iX(t))throw Error("Invalid pageIndex request.");let e=await this.messageHandler.sendWithPromise("GetPageIndex",{num:t.num,gen:t.gen}),i=this.pagesMapper.getPageNumber(e+1);if(0===i)throw Error("GetPageIndex: page has been removed.");return i-1}getAnnotations(t,e){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:this.pagesMapper.getPageId(t+1)-1,intent:e})}getFieldObjects(){return this.#nB("GetFieldObjects")}hasJSActions(){return this.#nB("HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(t){return"string"!=typeof t?Promise.reject(Error("Invalid destination request.")):this.messageHandler.sendWithProm
46ise("GetDestination",{id:t})}getPageLabels(){return this.messageHandler.sendWithPromise("GetPageLabels",null)}getPageLayout(){return this.messageHandler.sendWithPromise("GetPageLayout",null)}getPageMode(){return this.messageHandler.sendWithPromise("GetPageMode",null)}getViewerPreferences(){return this.messageHandler.sendWithPromise("GetViewerPreferences",null)}getOpenAction(){return this.messageHandler.sendWithPromise("GetOpenAction",null)}getAttachments(){return this.messageHandler.sendWithPromise("GetAttachments",null)}getAnnotationsByType(t,e){return this.messageHandler.sendWithPromise("GetAnnotationsByType",{types:t,pageIndexesToSkip:e})}getDocJSActions(){return this.#nB("GetDocJSActions")}getPageJSActions(t){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:this.pagesMapper.getPageId(t+1)-1})}getStructTree(t){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:this.pagesMapper.getPageId(t+1)-1})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(t){return this.#nB("GetOptionalContentConfig").then(e=>new r5(e,t))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){let t="GetMetadata";return this.#nP.getOrInsertComputed(t,()=>this.messageHandler.sendWithPromise(t,null).then(t=>({info:t[0],metadata:t[1]?new r0(t[1]):null,contentDispositionFilename:this.#nk?.filename??null,contentLength:this.#nk?.contentLength??null,hasStructTree:t[2]})))}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}getRawData(t){return this.messageHandler.sendWithPromise("GetRawData",t)}async startCleanup(t=!1){if(!this.destroyed){for(let t of(await this.messageHandler.sendWithPromise("Cleanup",null),this.#nD.values()))if(!t.cleanup())throw Error(`startCleanup: Page ${t.pageNumber} is currently rendering.`);this.commonObjs.clear(),t||this.fontLoader.clear(),this.#nP.clear(),this.filterFactory.destroy(!0),r8.cleanup()}}cachedPageNumber(t){if(!iX(t))return null;let e=0===t.gen?`${t.num}R`:`${t.num}R${t.gen}`,i=this.#nR.get(e);if(i>=0){let t=this.pagesMapper.getPageNumber(i+1);if(0!==t)return t}return null}}class na{_internalRenderTask=null;onContinue=null;onError=null;constructor(t){this._internalRenderTask=t}get promise(){return this._internalRenderTask.capability.promise}cancel(t=0){this._internalRenderTask.cancel(null,t)}get separateAnnots(){let{separateAnnots:t}=this._internalRenderTask.operatorList;if(!t)return!1;let{annotationCanvasMap:e}=this._internalRenderTask;return t.form||t.canvas&&e?.size>0}get imageCoordinates(){return this._internalRenderTask.imageCoordinates||null}}class no{#nO=null;static #nL=new WeakSet;constructor({callback:t,params:e,objs:i,commonObjs:r,annotationCanvasMap:n,operatorList:s,pageIndex:a,canvasFactory:o,filterFactory:l,useRequestAnimationFrame:h=!1,pdfBug:d=!1,pageColors:c=null,enableHWA:u=!1,operationsFilter:p=null}){this.callback=t,this.params=e,this.objs=i,this.commonObjs=r,this.annotationCanvasMap=n,this.operatorListIdx=null,this.operatorList=s,this._pageIndex=a,this.canvasFactory=o,this.filterFactory=l,this._pdfBug=d,this.pageColors=c,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=!0===h&&"u">typeof window,this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new na(this),this._cancelBound=this.cancel.bind(this),this._continueBound=this._continue.bind(this),this._scheduleNextBound=this._scheduleNext.bind(this),this._nextBound=this._next.bind(this),this._canvas=e.canvas,this._canvasContext=e.canvas?null:e.canvasContext,this._enableHWA=u,this._dependencyTracker=e.dependencyTracker,this._imagesTracker=e.imagesTracker,this._operationsFilter=p}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:t=!1,optionalContentConfig:e}){if(this.cancelled)return;if(this._canvas){if(no.#nL.has(this._canvas))throw Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");no.#nL.add(this._canvas)}this._pdfBug&&globalThis.StepperManager?.enabled&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());let{viewport:i,transform:r,background:n,dependencyTracker:s,imagesTracker:a}=this.params,o=this._canvasContext||this._canvas.getContext("2d",{alpha:!1,willReadFrequently:!this._enableHWA});this.gfx=new r_(o,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:e},this.annotationCanvasMap,this.pageColors,s,a),this.gfx.beginDrawing({transform:r,viewport:i,transparency:t,background:n}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback?.()}cancel(t=null,e=0){this.running=!1,this.cancelled=!0,this.gfx?.endDrawing(),this.#nO&&(window.cancelAnimationFrame(this.#nO),this.#nO=null),no.#nL.delete(this._canvas),t||=new eU(`Rendering cancelled, page ${this._pageIndex+1}`,e),this.callback(t),this.task.onError?.(t)}operatorListChanged(){if(!this.graphicsReady){this.graphicsReadyCallback||=this._continueBound;return}this.gfx.dependencyTracker?.growOperationsCount(this.operatorList.fnArray.length),this.stepper?.updateOperatorList(this.operatorList),this.running||this._continue()}_continue(){this.running=!0,this.cancelled||(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?this.#nO=window.requestAnimationFrame(()=>{this.#nO=null,this._nextBound().catch(this._cancelBound)}
46):Promise.resolve().then(this._nextBound).catch(this._cancelBound)}async _next(){!this.cancelled&&(this.operatorListIdx=this.gfx.executeOperatorList(this.operatorList,this.operatorListIdx,this._continueBound,this.stepper,this._operationsFilter),this.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),no.#nL.delete(this._canvas),this.callback())))}}let nl="5.7.284";t5(3068);class nh{#nN=null;#nU=null;#nj;#nz=null;#nH=!1;#n$=!1;#a=null;#nV;#nW=null;#v=null;static #nG=null;static get _keyboardManager(){return eg(this,"_keyboardManager",new ia([[["Escape","mac+Escape"],nh.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],nh.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],nh.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],nh.prototype._moveToPrevious],[["Home","mac+Home"],nh.prototype._moveToBeginning],[["End","mac+End"],nh.prototype._moveToEnd]]))}constructor({editor:t=null,uiManager:e=null}){t?(this.#n$=!1,this.#a=t):this.#n$=!0,this.#v=t?._uiManager||e,this.#nV=this.#v._eventBus,this.#nj=t?.color?.toUpperCase()||this.#v?.highlightColors.values().next().value||"#FFFF98",nh.#nG||=Object.freeze({blue:"pdfjs-editor-colorpicker-blue",green:"pdfjs-editor-colorpicker-green",pink:"pdfjs-editor-colorpicker-pink",red:"pdfjs-editor-colorpicker-red",yellow:"pdfjs-editor-colorpicker-yellow"})}renderButton(){let t=this.#nN=document.createElement("button");t.className="colorPicker",t.tabIndex="0",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),t.ariaHasPopup="true",this.#a&&(t.ariaControls=`${this.#a.id}_colorpicker_dropdown`);let e=this.#v._signal;t.addEventListener("click",this.#nq.bind(this),{signal:e}),t.addEventListener("keydown",this.#nK.bind(this),{signal:e});let i=this.#nU=document.createElement("span");return i.className="swatch",i.ariaHidden="true",i.style.backgroundColor=this.#nj,t.append(i),t}renderMainDropdown(){let t=this.#nz=this.#nX();return t.ariaOrientation="horizontal",t.ariaLabelledBy="highlightColorPickerLabel",t}#nX(){let t=document.createElement("div"),e=this.#v._signal;for(let[i,r]of(t.addEventListener("contextmenu",eV,{signal:e}),t.className="dropdown",t.role="listbox",t.ariaMultiSelectable="false",t.ariaOrientation="vertical",t.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown"),this.#a&&(t.id=`${this.#a.id}_colorpicker_dropdown`),this.#v.highlightColors)){let n=document.createElement("button");n.tabIndex="0",n.role="option",n.setAttribute("data-color",r),n.title=i,n.setAttribute("data-l10n-id",nh.#nG[i]);let s=document.createElement("span");n.append(s),s.className="swatch",s.style.backgroundColor=r,n.ariaSelected=r===this.#nj,n.addEventListener("click",this.#nY.bind(this,r),{signal:e}),t.append(n)}return t.addEventListener("keydown",this.#nK.bind(this),{signal:e}),t}#nY(t,e){e.stopPropagation(),this.#nV.dispatch("switchannotationeditorparams",{source:this,type:ee.HIGHLIGHT_COLOR,value:t}),this.updateColor(t)}_colorSelectFromKeyboard(t){if(t.target===this.#nN)return void this.#nq(t);let e=t.target.getAttribute("data-color");e&&this.#nY(e,t)}_moveToNext(t){this.#nJ?t.target===this.#nN?this.#nz.firstElementChild?.focus():t.target.nextSibling?.focus():this.#nq(t)}_moveToPrevious(t){if(t.target===this.#nz?.firstElementChild||t.target===this.#nN){this.#nJ&&this._hideDropdownFromKeyboard();return}this.#nJ||this.#nq(t),t.target.previousSibling?.focus()}_moveToBeginning(t){this.#nJ?this.#nz.firstElementChild?.focus():this.#nq(t)}_moveToEnd(t){this.#nJ?this.#nz.lastElementChild?.focus():this.#nq(t)}#nK(t){nh._keyboardManager.exec(this,t)}#nq(t){if(this.#nJ)return void this.hideDropdown();if(this.#nH=0===t.detail,this.#nW||(this.#nW=new AbortController,window.addEventListener("pointerdown",this.#p.bind(this),{signal:this.#v.combinedSignal(this.#nW)})),this.#nN.ariaExpanded="true",this.#nz)return void this.#nz.classList.remove("hidden");let e=this.#nz=this.#nX();this.#nN.append(e)}#p(t){this.#nz?.contains(t.target)||this.hideDropdown()}hideDropdown(){this.#nz?.classList.add("hidden"),this.#nN.ariaExpanded="false",this.#nW?.abort(),this.#nW=null}get #nJ(){return this.#nz&&!this.#nz.classList.contains("hidden")}_hideDropdownFromKeyboard(){if(!this.#n$){if(!this.#nJ)return void this.#a?.unselect();this.hideDropdown(),this.#nN.focus({preventScroll:!0,focusVisible:this.#nH})}}updateColor(t){if(this.#nU&&(this.#nU.style.backgroundColor=t),!this.#nz)return;let e=this.#v.highlightColors.values();for(let i of this.#nz.children)i.ariaSelected=e.next().value===t.toUpperCase()}destroy(){this.#nN?.remove(),this.#nN=null,this.#nU=null,this.#nz?.remove(),this.#nz=null}}class nd{#nQ=null;#nZ=!1;#a=null;#v=null;static #nG=null;constructor(t){this.#a=t,this.#v=t._uiManager,nd.#nG||=Object.freeze({freetext:"pdfjs-editor-color-picker-free-text-input",ink:"pdfjs-editor-color-picker-ink-input"})}renderButton(){if(this.#nQ)return this.#nQ;let{editorType:t,colorType:e,colorAndOpacityType:i,opacityType:r,color:n,opacity:s}=this.#a,a=this.#nZ=eS.isAlphaColorInputSupported&&void 0!==r,o=this.#nQ=document.createElement("input");return o.type="color",a?(o.setAttribute("alpha",""),o.value=(n||"#000000")+eT.hexNums[Math.round((s??1)*255)]):o.value=n||"#000000",o.className="basicColorPicker",o.tabIndex=0,o.setAttribute("data-l10n-id",nd.#nG[t]),o.addEventListener("input",()=>{if(a){let t=eq(o.value);if(!t)return;let[n,s,a,l]=t,h=eT.makeHexColor(n,s,a);void 0!==i?this.#v.updateParams(i,{color:h,opacity:l}):(this.#v.updateParams(e,h),this.#v.updateParams(r,l))}else this.#v.updateParams(e,o.value)},{signal:this.#v._signal}),o}update(t){if(this.#nQ)if(this.#nZ){let e=eT.hexNums[Math.round(255*this.#a.opacity)];this.#nQ.value=t+e}else this.#nQ.value=t}updateOpacity(t){if(!this.#nQ||!this.#nZ)return;let e=eT.hexNums[Math.round(255*t)];this.#nQ.value=this.#a.color+e}destroy(){this.#nQ?.remove(),this.#nQ=null}hideDropdown(){}}function nc(t){return Math.floor(255*eI(t,0,1)).toString(16).padStart(2,"0")}function nu(t){return 255*eI(t,0,1)}t5(531);
46class np{static CMYK_G([t,e,i,r]){return["G",1-Math.min(1,.3*t+.59*i+.11*e+r)]}static G_CMYK([t]){return["CMYK",0,0,0,1-t]}static G_RGB([t]){return["RGB",t,t,t]}static G_rgb([t]){return[t=nu(t),t,t]}static G_HTML([t]){let e=nc(t);return`#${e}${e}${e}`}static RGB_G([t,e,i]){return["G",.3*t+.59*e+.11*i]}static RGB_rgb(t){return t.map(nu)}static RGB_HTML(t){return`#${t.map(nc).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([t,e,i,r]){return["RGB",1-Math.min(1,t+r),1-Math.min(1,i+r),1-Math.min(1,e+r)]}static CMYK_rgb([t,e,i,r]){return[nu(1-Math.min(1,t+r)),nu(1-Math.min(1,i+r)),nu(1-Math.min(1,e+r))]}static CMYK_HTML(t){let e=this.CMYK_RGB(t).slice(1);return this.RGB_HTML(e)}static RGB_CMYK([t,e,i]){let r=1-t,n=1-e,s=1-i,a=Math.min(r,n,s);return["CMYK",r,n,s,a]}}class ng{create(t,e,i=!1){if(t<=0||e<=0)throw Error("Invalid SVG dimensions");let r=this._createSVG("svg:svg");return r.setAttribute("version","1.1"),i||(r.setAttribute("width",`${t}px`),r.setAttribute("height",`${e}px`)),r.setAttribute("preserveAspectRatio","none"),r.setAttribute("viewBox",`0 0 ${t} ${e}`),r}createElement(t){if("string"!=typeof t)throw Error("Invalid SVG element type");return this._createSVG(t)}_createSVG(t){eh("Abstract method `_createSVG` called.")}}class nm extends ng{_createSVG(t){return document.createElementNS(eB,t)}}let nf=new WeakSet,nb=60*new Date().getTimezoneOffset()*1e3;class nv{static create(t){switch(t.data.annotationType){case er.LINK:return new nx(t);case er.TEXT:return new nA(t);case er.WIDGET:switch(t.data.fieldType){case"Tx":return new nT(t);case"Btn":if(t.data.radioButton)return new nC(t);if(t.data.checkBox)return new nE(t);return new nk(t);case"Ch":return new nP(t);case"Sig":return new n_(t)}return new nS(t);case er.POPUP:return new nM(t);case er.FREETEXT:return new nI(t);case er.LINE:return new nR(t);case er.SQUARE:return new nF(t);case er.CIRCLE:return new nB(t);case er.POLYLINE:return new nO(t);case er.CARET:return new nN(t);case er.INK:return new nU(t);case er.POLYGON:return new nL(t);case er.HIGHLIGHT:return new nj(t);case er.UNDERLINE:return new nz(t);case er.SQUIGGLY:return new nH(t);case er.STRIKEOUT:return new n$(t);case er.STAMP:return new nV(t);case er.FILEATTACHMENT:return new nW(t);default:return new ny(t)}}}class ny{#n0=null;#n1=!1;#n2=null;constructor(t,{isRenderable:e=!1,ignoreBorder:i=!1,createQuadrilaterals:r=!1}={}){this.isRenderable=e,this.data=t.data,this.layer=t.layer,this.linkService=t.linkService,this.downloadManager=t.downloadManager,this.imageResourcesPath=t.imageResourcesPath,this.renderForms=t.renderForms,this.svgFactory=t.svgFactory,this.annotationStorage=t.annotationStorage,this.enableComment=t.enableComment,this.enableScripting=t.enableScripting,this.hasJSActions=t.hasJSActions,this._fieldObjects=t.fieldObjects,this.parent=t.parent,this.hasOwnCommentButton=!1,e&&(this.contentElement=this.container=this._createContainer(i)),r&&this._createQuadrilaterals()}static _hasPopupData({contentsObj:t,richText:e}){return!!(t?.str||e?.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return ny._hasPopupData(this.data)||this.enableComment&&!!this.commentText}get commentData(){let{data:t}=this,e=this.annotationStorage?.getEditor(t.id);return e?e.getData():t}get hasCommentButton(){return this.enableComment&&this.hasPopupElement}
46get commentButtonPosition(){let t=this.annotationStorage?.getEditor(this.data.id);if(t)return t.commentButtonPositionInPage;let{quadPoints:e,inkLists:i,rect:r}=this.data,n=-1/0,s=-1/0;if(e?.length>=8){for(let t=0;t<e.length;t+=8)e[t+1]>s?(s=e[t+1],n=e[t+2]):e[t+1]===s&&(n=Math.max(n,e[t+2]));return[n,s]}if(i?.length>=1){for(let t of i)for(let e=0,i=t.length;e<i;e+=2)t[e+1]>s?(s=t[e+1],n=t[e]):t[e+1]===s&&(n=Math.max(n,t[e]));if(1/0!==n)return[n,s]}return r?[r[2],r[3]]:null}_normalizePoint(t){let{page:{view:e},viewport:{rawDims:{pageWidth:i,pageHeight:r,pageX:n,pageY:s}}}=this.parent;return t[1]=e[3]-t[1]+e[1],t[0]=100*(t[0]-n)/i,t[1]=100*(t[1]-s)/r,t}get commentText(){let{data:t}=this;return this.annotationStorage.getRawValue(`${t7}${t.id}`)?.popup?.contents||t.contentsObj?.str||""}set commentText(t){let{data:e}=this,i={deleted:!t,contents:t||""};this.annotationStorage.updateEditor(e.id,{popup:i})||this.annotationStorage.setValue(`${t7}${e.id}`,{id:e.id,annotationType:e.annotationType,page:this.parent.page,popup:i,popupRef:e.popupRef,modificationDate:new Date}),t||this.removePopup()}removePopup(){(this.#n2?.popup||this.popup)?.remove(),this.#n2=this.popup=null}updateEdited(t){if(!this.container)return;t.rect&&(this.#n0||={rect:this.data.rect.slice(0)});let{rect:e,popup:i}=t;e&&this.#n5(e);let r=this.#n2?.popup||this.popup;!r&&i?.text&&(this._createPopup(i),r=this.#n2.popup),r&&(r.updateEdited(t),i?.deleted&&(r.remove(),this.#n2=null,this.popup=null))}resetEdited(){this.#n0&&(this.#n5(this.#n0.rect),this.#n2?.popup.resetEdited(),this.#n0=null)}#n5(t){let{container:{style:e},data:{rect:i,rotation:r},parent:{viewport:{rawDims:{pageWidth:n,pageHeight:s,pageX:a,pageY:o}}}}=this;i?.splice(0,4,...t),e.left=`${100*(t[0]-a)/n}%`,e.top=`${100*(s-t[3]+o)/s}%`,0===r?(e.width=`${100*(t[2]-t[0])/n}%`,e.height=`${100*(t[3]-t[1])/s}%`):this.setRotation(r)}_createContainer(t){let{data:e,parent:{page:i,viewport:r}}=this,n=document.createElement("section");n.setAttribute("data-annotation-id",e.id),this instanceof nS||this instanceof nx||(n.tabIndex=0);let{style:s}=n;if(s.zIndex=this.parent.zIndex,this.parent.zIndex+=2,e.alternativeText&&(n.title=e.alternativeText),e.noRotate&&n.classList.add("norotate"),!e.rect||this instanceof nM){let{rotation:t}=e;return e.hasOwnCanvas||0===t||this.setRotation(t,n),n}let{width:a,height:o}=this;if(!t&&e.borderStyle.width>0){s.borderWidth=`${e.borderStyle.width}px`;let t=e.borderStyle.horizontalCornerRadius,i=e.borderStyle.verticalCornerRadius;switch(t>0||i>0?s.borderRadius=`calc(${t}px * var(--total-scale-factor)) / calc(${i}px * var(--total-scale-factor))`:this instanceof nC&&(s.borderRadius=`calc(${a}px * var(--total-scale-factor)) / calc(${o}px * var(--total-scale-factor))`),e.borderStyle.style){case 1:s.borderStyle="solid";break;case 2:s.borderStyle="dashed";break;case 3:el("Unimplemented border style: beveled");break;case 4:el("Unimplemented border style: inset");break;case 5:s.borderBottomStyle="solid"}let r=e.borderColor||null;r?(this.#n1=!0,s.borderColor=eT.makeHexColor(...r)):s.borderWidth=0}let l=eT.normalizeRect([e.rect[0],i.view[3]-e.rect[1]+i.view[1],e.rect[2],i.view[3]-e.rect[3]+i.view[1]]),{pageWidth:h,pageHeight:d,pageX:c,pageY:u}=r.rawDims;s.left=`${100*(l[0]-c)/h}%`,s.top=`${100*(l[1]-u)/d}%`;let{rotation:p}=e;return e.hasOwnCanvas||0===p?(s.width=`${100*a/h}%`,s.height=`${100*o/d}%`):this.setRotation(p,n),n}setRotation(t,e=this.container){if(!this.data.rect)return;let{pageWidth:i,pageHeight:r}=this.parent.viewport.rawDims,{width:n,height:s}=this;t%180!=0&&([n,s]=[s,n]),e.style.width=`${100*n/i}%`,e.style.height=`${100*s/r}%`,e.setAttribute("data-main-rotation",(360-t)%360)}get _commonActions(){let t=(t,e,i)=>{let r=i.detail[t],n=r[0],s=r.slice(1);i.target.style[e]=np[`${n}_HTML`](s),this.annotationStorage.setValue(this.data.id,{[e]:np[`${n}_rgb`](s)})};return eg(this,"_commonActions",{display:t=>{let{display:e}=t.detail,i=e%2==1;this.container.style.visibility=i?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:i,noPrint:1===e||2===e})},print:t=>{this.annotationStorage.setValue(this.data.id,{noPrint:!t.detail.print})},hidden:t=>{let{hidden:e}=t.detail;this.container.style.visibility=e?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:e,noView:e})},focus:t=>{setTimeout(()=>
46t.target.focus({preventScroll:!1}),0)},userName:t=>{t.target.title=t.detail.userName},readonly:t=>{t.target.disabled=t.detail.readonly},required:t=>{this._setRequired(t.target,t.detail.required)},bgColor:e=>{t("bgColor","backgroundColor",e)},fillColor:e=>{t("fillColor","backgroundColor",e)},fgColor:e=>{t("fgColor","color",e)},textColor:e=>{t("textColor","color",e)},borderColor:e=>{t("borderColor","borderColor",e)},strokeColor:e=>{t("strokeColor","borderColor",e)},rotation:t=>{let e=t.detail.rotation;this.setRotation(e),this.annotationStorage.setValue(this.data.id,{rotation:e})}})}_dispatchEventFromSandbox(t,e){let i=this._commonActions;for(let r of Object.keys(e.detail)){let n=t[r]||i[r];n?.(e)}}_setDefaultPropertiesFromJS(t){if(!this.enableScripting)return;let e=this.annotationStorage.getRawValue(this.data.id);if(!e)return;let i=this._commonActions;for(let[r,n]of Object.entries(e)){let s=i[r];s&&(s({detail:{[r]:n},target:t}),delete e[r])}}_createQuadrilaterals(){let t;if(!this.container)return;let{quadPoints:e}=this.data;if(!e)return;let[i,r,n,s]=this.data.rect.map(t=>Math.fround(t));if(8===e.length){let[t,a,o,l]=e.subarray(2,6);if(n===t&&s===a&&i===o&&r===l)return}let{style:a}=this.container;if(this.#n1){let{borderColor:e,borderWidth:i}=a;a.borderWidth=0,t=["url('data:image/svg+xml;utf8,",'<svg xmlns="http://www.w3.org/2000/svg"',' preserveAspectRatio="none" viewBox="0 0 1 1">',`<g fill="transparent" stroke="${e}" stroke-width="${i}">`],this.container.classList.add("hasBorder")}let o=n-i,l=s-r,{svgFactory:h}=this,d=h.createElement("svg");d.classList.add("quadrilateralsContainer"),d.setAttribute("width",0),d.setAttribute("height",0),d.role="none";let c=h.createElement("defs");d.append(c);let u=h.createElement("clipPath"),p=`clippath_${this.data.id}`;u.setAttribute("id",p),u.setAttribute("clipPathUnits","objectBoundingBox"),c.append(u);for(let r=2,n=e.length;r<n;r+=8){let n=e[r],a=e[r+1],d=e[r+2],c=e[r+3],p=h.createElement("rect"),g=(d-i)/o,m=(s-a)/l,f=(n-d)/o,b=(a-c)/l;p.setAttribute("x",g),p.setAttribute("y",m),p.setAttribute("width",f),p.setAttribute("height",b),u.append(p),t?.push(`<rect vector-effect="non-scaling-stroke" x="${g}" y="${m}" width="${f}" height="${b}"/>`)}this.#n1&&(t.push("</g></svg>')"),a.backgroundImage=t.join("")),this.container.append(d),this.container.style.clipPath=`url(#${p})`}_createPopup(t=null){let e,i,{data:r}=this;t?(e={str:t.text},i=t.date):(e=r.contentsObj,i=r.modificationDate),this.#n2=new nM({data:{color:r.color,titleObj:r.titleObj,modificationDate:i,contentsObj:e,richText:r.richText,parentRect:r.rect,borderStyle:0,id:`popup_${r.id}`,rotation:r.rotation,noRotate:!0},linkService:this.linkService,parent:this.parent,elements:[this]})}get hasPopupElement(){return!!(this.#n2||this.popup||this.data.popupRef)}get extraPopupElement(){return this.#n2}render(){eh("Abstract method `AnnotationElement.render` called")}_getElementsByName(t,e=null){let i=[];if(this._fieldObjects){let r=this._fieldObjects[t];if(r)for(let{page:t,id:n,exportValues:s}of r){if(-1===t||n===e)continue;let r="string"==typeof s?s:null,a=document.querySelector(`[data-element-id="${n}"]`);if(a&&!nf.has(a)){el(`_getElementsByName - element not allowed: ${n}`);continue}i.push({id:n,exportValue:r,domElement:a})}return i}for(let r of document.getElementsByName(t)){let{exportValue:t}=r,n=r.getAttribute("data-element-id");n!==e&&nf.has(r)&&i.push({id:n,exportValue:t,domElement:r})}return i}show(){this.container&&(this.container.hidden=!1),this.popup?.maybeShow()}hide(){this.container&&(this.container.hidden=!0),this.popup?.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){let t=this.getElementsToTriggerPopup();if(Array.isArray(t))for(let e of t)e.classList.add("highlightArea");else t.classList.add("highlightArea")}_editOnDoubleClick(){if(!this._isEditable)return;let{annotationEditorType:t,data:{id:e}}=this;this.container.addEventListener("dblclick",()=>{this.linkService.eventBus?.dispatch("switchannotationeditormode",{source:this,mode:t,editId:e,mustEnterInEditMode:!0})})}get width(){return this.data.rect[2]-this.data.rect[0]}get height(){return this.data.rect[3]-this.data.rect[1]}}class nw extends ny{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.editor=t.editor}render(){return this.container.className="editorAnnotation",this.container}createOrUpdatePopup(){let{editor:t}=this;t.hasComment&&this._createPopup(t.comment)}get hasCommentButton(){return this.enableComment&&this.editor.hasComment}
46get commentButtonPosition(){return this.editor.commentButtonPositionInPage}get commentText(){return this.editor.comment.text}set commentText(t){this.editor.comment=t,t||this.removePopup()}get commentData(){return this.editor.getData()}remove(){this.parent.removeAnnotation(this.data.id),this.container.remove(),this.container=null,this.removePopup()}}class nx extends ny{constructor(t,e=null){super(t,{isRenderable:!0,ignoreBorder:!!e?.ignoreBorder,createQuadrilaterals:!0}),this.isTooltipOnly=t.data.isTooltipOnly}render(){let{data:t,linkService:e}=this,i=document.createElement("a");i.setAttribute("data-element-id",t.id);let r=!1;return t.url?(e.addLinkAttributes(i,t.url,t.newWindow),r=!0):t.action?(this._bindNamedAction(i,t.action,t.overlaidText),r=!0):t.attachment?(this.#n3(i,t.attachment,t.overlaidText,t.attachmentDest),r=!0):t.setOCGState?(this.#n6(i,t.setOCGState,t.overlaidText),r=!0):t.dest?(this._bindLink(i,t.dest,t.overlaidText),r=!0):(t.actions&&(t.actions.Action||t.actions["Mouse Up"]||t.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(i,t),r=!0),t.resetForm?(this._bindResetFormAction(i,t.resetForm),r=!0):this.isTooltipOnly&&!r&&(this._bindLink(i,""),r=!0)),this.container.classList.add("linkAnnotation"),r&&(this.contentElement=i,this.container.append(i)),this.container}#n4(){this.container.setAttribute("data-internal-link","")}_bindLink(t,e,i=""){t.href=this.linkService.getDestinationHash(e),t.onclick=()=>(e&&this.linkService.goToDestination(e),!1),(e||""===e)&&this.#n4(),i&&(t.title=i)}_bindNamedAction(t,e,i=""){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeNamedAction(e),!1),i&&(t.title=i),this.#n4()}#n3(t,e,i="",r=null){t.href=this.linkService.getAnchorUrl(""),e.description?t.title=e.description:i&&(t.title=i),t.onclick=()=>(this.downloadManager?.openOrDownloadData(e.content,e.filename,r),!1),this.#n4()}#n6(t,e,i=""){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeSetOCGState(e),!1),i&&(t.title=i),this.#n4()}_bindJSAction(t,e){t.href=this.linkService.getAnchorUrl("");let i=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(let r of Object.keys(e.actions)){let n=i.get(r);n&&(t[n]=()=>(this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e.id,name:r}}),!1))}e.overlaidText&&(t.title=e.overlaidText),t.onclick||(t.onclick=()=>!1),this.#n4()}_bindResetFormAction(t,e){let i=t.onclick;if(i||(t.href=this.linkService.getAnchorUrl("")),this.#n4(),!this._fieldObjects){el('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),i||(t.onclick=()=>!1);return}t.onclick=()=>{i?.();let{fields:t,refs:r,include:n}=e,s=[];if(0!==t.length||0!==r.length){let e=new Set(r);for(let i of t)for(let{id:t}of this._fieldObjects[i]||[])e.add(t);for(let t of Object.values(this._fieldObjects))for(let i of t)e.has(i.id)===n&&s.push(i)}else for(let t of Object.values(this._fieldObjects))s.push(...t);let a=this.annotationStorage,o=[];for(let t of s){let{id:e}=t;switch(o.push(e),t.type){case"text":{let i=t.defaultValue||"";a.setValue(e,{value:i});break}case"checkbox":case"radiobutton":{let i=t.defaultValue===t.exportValues;a.setValue(e,{value:i});break}case"combobox":case"listbox":{let i=t.defaultValue||"";a.setValue(e,{value:i});break}default:continue}let i=document.querySelector(`[data-element-id="${e}"]`);if(i){if(!nf.has(i)){el(`_bindResetFormAction - element not allowed: ${e}`);continue}i.dispatchEvent(new Event("resetform"))}}return this.enableScripting&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:o,name:"ResetForm"}}),!1}}}class nA extends ny{constructor(t){super(t,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");let t=document.createElement("img");return t.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",t.setAttribute("data-l10n-id","pdfjs-text-annotation-type"),t.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.append(t),this.container}}
46class nS extends ny{render(){return this.container}showElementAndHideCanvas(t){this.data.hasOwnCanvas&&(t.previousSibling?.nodeName==="CANVAS"&&(t.previousSibling.hidden=!0),t.hidden=!1)}_getKeyModifier(t){return eS.platform.isMac?t.metaKey:t.ctrlKey}_setEventListener(t,e,i,r,n){i.includes("mouse")?t.addEventListener(i,t=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:r,value:n(t),shift:t.shiftKey,modifier:this._getKeyModifier(t)}})}):t.addEventListener(i,t=>{if("blur"===i){if(!e.focused||!t.relatedTarget)return;e.focused=!1}else if("focus"===i){if(e.focused)return;e.focused=!0}n&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:r,value:n(t)}})})}_setEventListeners(t,e,i,r){for(let[n,s]of i)("Action"===s||this.data.actions?.[s])&&(("Focus"===s||"Blur"===s)&&(e||={focused:!1}),this._setEventListener(t,e,n,s,r),"Focus"!==s||this.data.actions?.Blur?"Blur"!==s||this.data.actions?.Focus||this._setEventListener(t,e,"focus","Focus",null):this._setEventListener(t,e,"blur","Blur",null))}_setBackgroundColor(t){let e=this.data.backgroundColor||null;t.style.backgroundColor=null===e?"transparent":eT.makeHexColor(...e)}_setTextStyle(t){let e,{fontColor:i}=this.data.defaultAppearanceData,r=this.data.defaultAppearanceData.fontSize||9,n=t.style,s=t=>Math.round(10*t)/10;if(this.data.multiLine){let t=Math.abs(this.data.rect[3]-this.data.rect[1]-2),i=Math.round(t/(1.35*r))||1;e=Math.min(r,s(t/i/1.35))}else e=Math.min(r,s(Math.abs(this.data.rect[3]-this.data.rect[1]-2)/1.35));n.fontSize=`calc(${e}px * var(--total-scale-factor))`,n.color=eT.makeHexColor(...i),null!==this.data.textAlignment&&(n.textAlign=["left","center","right"][this.data.textAlignment])}_setRequired(t,e){e?t.setAttribute("required",!0):t.removeAttribute("required"),t.setAttribute("aria-required",e)}}class nT extends nS{constructor(t){let e=t.renderForms||t.data.hasOwnCanvas||!t.data.hasAppearance&&!!t.data.fieldValue;super(t,{isRenderable:e})}setPropertyOnSiblings(t,e,i,r){let n=this.annotationStorage;
46for(let s of this._getElementsByName(t.name,t.id))s.domElement&&(s.domElement[e]=i),n.setValue(s.id,{[r]:i})}render(){let t=this.annotationStorage,e=this.data.id;this.container.classList.add("textWidgetAnnotation");let i=null;if(this.renderForms){let r=t.getValue(e,{value:this.data.fieldValue}),n=r.value||"",s=t.getValue(e,{charLimit:this.data.maxLen}).charLimit;s&&n.length>s&&(n=n.slice(0,s));let a=r.formattedValue||this.data.textContent?.join("\n")||null;a&&this.data.comb&&(a=a.replaceAll(/\s+/g,""));let o={userValue:n,formattedValue:a,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?((i=document.createElement("textarea")).textContent=a??n,this.data.doNotScroll&&(i.style.overflowY="hidden")):((i=document.createElement("input")).type=this.data.password?"password":"text",i.setAttribute("value",a??n),this.data.doNotScroll&&(i.style.overflowX="hidden")),this.data.hasOwnCanvas&&(i.hidden=!0),nf.add(i),this.contentElement=i,i.setAttribute("data-element-id",e),i.disabled=this.data.readOnly,i.name=this.data.fieldName,i.tabIndex=0;let{datetimeFormat:l,datetimeType:h,timeStep:d}=this.data,c=!!h&&this.enableScripting;l&&(i.title=l),this._setRequired(i,this.data.required),s&&(i.maxLength=s),i.addEventListener("input",r=>{t.setValue(e,{value:r.target.value}),this.setPropertyOnSiblings(i,"value",r.target.value,"value"),o.formattedValue=null}),i.addEventListener("resetform",t=>{let e=this.data.defaultFieldValue??"";i.value=o.userValue=e,o.formattedValue=null});let u=t=>{let{formattedValue:e}=o;null!=e&&(t.target.value=e),t.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){i.addEventListener("focus",t=>{if(o.focused)return;let{target:e}=t;if(c&&(e.type=h,d&&(e.step=d)),o.userValue){let t=o.userValue;if(c)if("time"===h){let i=new Date(t);e.value=[i.getHours(),i.getMinutes(),i.getSeconds()].map(t=>t.toString().padStart(2,"0")).join(":")}else e.value=new Date(t-nb).toISOString().split("date"===h?"T":".",1)[0];else e.value=t}o.lastCommittedValue=e.value,o.commitKey=1,this.data.actions?.Focus||(o.focused=!0)}),i.addEventListener("updatefromsandbox",i=>{this.showElementAndHideCanvas(i.target),this._dispatchEventFromSandbox({value(i){o.userValue=i.detail.value??"",c||t.setValue(e,{value:o.userValue.toString()}),i.target.value=o.userValue},formattedValue(i){let{formattedValue:r}=i.detail;o.formattedValue=r,null!=r&&i.target!==document.activeElement&&(i.target.value=r);let n={formattedValue:r};c&&(n.value=r),t.setValue(e,n)},selRange(t){t.target.setSelectionRange(...t.detail.selRange)},charLimit:i=>{let{charLimit:r}=i.detail,{target:n}=i;if(0===r)return void n.removeAttribute("maxLength");n.setAttribute("maxLength",r);let s=o.userValue;s&&!(s.length<=r)&&(n.value=o.userValue=s=s.slice(0,r),t.setValue(e,{value:s}),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:s,willCommit:!0,commitKey:1,selStart:n.selectionStart,selEnd:n.selectionEnd}}))}},i)}),i.addEventListener("keydown",t=>{o.commitKey=1;let i=-1;if("Escape"===t.key?i=0:"Enter"!==t.key||this.data.multiLine?"Tab"===t.key&&(o.commitKey=3):i=2,-1===i)return;let{value:r}=t.target;o.lastCommittedValue!==r&&(o.lastCommittedValue=r,o.userValue=r,this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:r,willCommit:!0,commitKey:i,selStart:t.target.selectionStart,selEnd:t.target.selectionEnd}}))});let r=u;u=null,i.addEventListener("blur",t=>{if(!o.focused||!t.relatedTarget)return;this.data.actions?.Blur||(o.focused=!1);let{target:i}=t,{value:n}=i;if(c){if(n&&"time"===h){let t=n.split(":").map(t=>parseInt(t,10));n=new Date(2e3,0,1,t[0],t[1],t[2]||0).valueOf(),i.step=""}else n.includes("T")||(n=`${n}T00:00`),n=new Date(n).valueOf();i.type="text"}o.userValue=n,o.lastCommittedValue!==n&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:n,willCommit:!0,commitKey:o.commitKey,selStart:t.target.selectionStart,selEnd:t.target.selectionEnd}}),r(t)}),this.data.actions?.Keystroke&&i.addEventListener("beforeinput",t=>{o.lastCommittedValue=null;let{data:i,target:r}=t,{value:n,selectionStart:s,selectionEnd:a}=r,l=s,h=a;switch(t.inputType){case"deleteWordBackward":{let t=n.substring(0,s).match(/\w*[^\
46w]*$/);t&&(l-=t[0].length);break}case"deleteWordForward":{let t=n.substring(s).match(/^[^\w]*\w*/);t&&(h+=t[0].length);break}case"deleteContentBackward":s===a&&(l-=1);break;case"deleteContentForward":s===a&&(h+=1)}t.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:n,change:i||"",willCommit:!1,selStart:l,selEnd:h}})}),this._setEventListeners(i,o,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],t=>t.target.value)}if(u&&i.addEventListener("blur",u),this.data.comb){let t=(this.data.rect[2]-this.data.rect[0])/s;i.classList.add("comb"),i.style.letterSpacing=`calc(${t}px * var(--total-scale-factor) - 1ch)`}}else(i=document.createElement("div")).textContent=this.data.fieldValue,i.style.verticalAlign="middle",i.style.display="table-cell",this.data.hasOwnCanvas&&(i.hidden=!0);return this._setTextStyle(i),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class n_ extends nS{constructor(t){super(t,{isRenderable:!!t.data.hasOwnCanvas})}}class nE extends nS{constructor(t){super(t,{isRenderable:t.renderForms})}render(){let t=this.annotationStorage,e=this.data,i=e.id,r=t.getValue(i,{value:e.exportValue===e.fieldValue}).value;"string"==typeof r&&(r="Off"!==r,t.setValue(i,{value:r})),this.container.classList.add("buttonWidgetAnnotation","checkBox");let n=document.createElement("input");return nf.add(n),n.setAttribute("data-element-id",i),n.disabled=e.readOnly,this._setRequired(n,this.data.required),n.type="checkbox",n.name=e.fieldName,r&&n.setAttribute("checked",!0),n.setAttribute("exportValue",e.exportValue),n.tabIndex=0,n.addEventListener("change",r=>{let{name:n,checked:s}=r.target;for(let r of this._getElementsByName(n,i)){let i=s&&r.exportValue===e.exportValue;r.domElement&&(r.domElement.checked=i),t.setValue(r.id,{value:i})}t.setValue(i,{value:s})}),n.addEventListener("resetform",t=>{let i=e.defaultFieldValue||"Off";t.target.checked=i===e.exportValue}),this.enableScripting&&this.hasJSActions&&(n.addEventListener("updatefromsandbox",e=>{this._dispatchEventFromSandbox({value(e){e.target.checked="Off"!==e.detail.value,t.setValue(i,{value:e.target.checked})}},e)}),this._setEventListeners(n,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],t=>t.target.checked)),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class nC extends nS{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");let t=this.annotationStorage,e=this.data,i=e.id,r=t.getValue(i,{value:e.fieldValue===e.buttonValue}).value;if("string"==typeof r&&(r=r!==e.buttonValue,t.setValue(i,{value:r})),r)for(let r of this._getElementsByName(e.fieldName,i))t.setValue(r.id,{value:!1});let n=document.createElement("input");if(nf.add(n),n.setAttribute("data-element-id",i),n.disabled=e.readOnly,this._setRequired(n,this.data.required),n.type="radio",n.name=e.fieldName,r&&n.setAttribute("checked",!0),n.tabIndex=0,n.addEventListener("change",e=>{let{name:r,checked:n}=e.target;for(let e of this._getElementsByName(r,i))t.setValue(e.id,{value:!1});t.setValue(i,{value:n})}),n.addEventListener("resetform",t=>{let i=e.defaultFieldValue;t.target.checked=null!=i&&i===e.buttonValue}),this.enableScripting&&this.hasJSActions){let r=e.buttonValue;n.addEventListener("updatefromsandbox",e=>{this._dispatchEventFromSandbox({value:e=>{let n=r===e.detail.value;for(let r of this._getElementsByName(e.target.name)){let e=n&&r.id===i;r.domElement&&(r.domElement.checked=e),t.setValue(r.id,{value:e})}}},e)}),this._setEventListeners(n,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],t=>t.target.checked)}
46return this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class nk extends nx{constructor(t){super(t,{ignoreBorder:t.data.hasAppearance})}render(){let t=super.render();t.classList.add("buttonWidgetAnnotation","pushButton");let e=t.lastChild;return this.enableScripting&&this.hasJSActions&&e&&(this._setDefaultPropertiesFromJS(e),e.addEventListener("updatefromsandbox",t=>{this._dispatchEventFromSandbox({},t)})),t}}class nP extends nS{constructor(t){super(t,{isRenderable:t.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");let t=this.annotationStorage,e=this.data.id,i=t.getValue(e,{value:this.data.fieldValue}),r=document.createElement("select");nf.add(r),r.setAttribute("data-element-id",e),r.disabled=this.data.readOnly,this._setRequired(r,this.data.required),r.name=this.data.fieldName,r.tabIndex=0;let n=this.data.combo&&this.data.options.length>0;!this.data.combo&&(r.size=this.data.options.length,this.data.multiSelect&&(r.multiple=!0)),r.addEventListener("resetform",t=>{let e=this.data.defaultFieldValue;for(let t of r.options)t.selected=t.value===e});let s=(t,e)=>{let i=e.replaceAll(" "," ");t.textContent=i,i!==e&&t.setAttribute("display-value",e)};for(let t of this.data.options){let e=document.createElement("option");s(e,t.displayValue),e.value=t.exportValue,i.value.includes(t.exportValue)&&(e.setAttribute("selected",!0),n=!1),r.append(e)}let a=null;if(n){let t=document.createElement("option");t.value=" ",t.setAttribute("hidden",!0),t.setAttribute("selected",!0),r.prepend(t),a=()=>{t.remove(),r.removeEventListener("input",a),a=null},r.addEventListener("input",a)}let o=t=>{let e=t?"value":"textContent",{options:i,multiple:n}=r;return n?Array.prototype.filter.call(i,t=>t.selected).map(t=>t[e]):-1===i.selectedIndex?null:i[i.selectedIndex][e]},l=o(!1),h=t=>{let e=t.target.options;return Array.prototype.map.call(e,t=>({displayValue:t.getAttribute("display-value")||t.textContent,exportValue:t.value}))};return this.enableScripting&&this.hasJSActions?(r.addEventListener("updatefromsandbox",i=>{this._dispatchEventFromSandbox({value(i){a?.();let n=i.detail.value,s=new Set(Array.isArray(n)?n:[n]);for(let t of r.options)t.selected=s.has(t.value);t.setValue(e,{value:o(!0)}),l=o(!1)},multipleSelection(t){r.multiple=!0},remove(i){let n=r.options,s=i.detail.remove;n[s].selected=!1,r.remove(s),n.length>0&&-1===Array.prototype.findIndex.call(n,t=>t.selected)&&(n[0].selected=!0),t.setValue(e,{value:o(!0),items:h(i)}),l=o(!1)},clear(i){for(;0!==r.length;)r.remove(0);t.setValue(e,{value:null,items:[]}),l=o(!1)},insert(i){let{index:n,displayValue:a,exportValue:d}=i.detail.insert,c=r.children[n],u=document.createElement("option");s(u,a),u.value=d,c?c.before(u):r.append(u),t.setValue(e,{value:o(!0),items:h(i)}),l=o(!1)},items(i){let{items:n}=i.detail;for(;0!==r.length;)r.remove(0);for(let t of n){let{displayValue:e,exportValue:i}=t,n=document.createElement("option");s(n,e),n.value=i,r.append(n)}r.options.length>0&&(r.options[0].selected=!0),t.setValue(e,{value:o(!0),items:h(i)}),l=o(!1)},indices(i){let r=new Set(i.detail.indices);for(let t of i.target.options)t.selected=r.has(t.index);t.setValue(e,{value:o(!0)}),l=o(!1)},editable(t){t.target.disabled=!t.detail.editable}},i)}),r.addEventListener("input",i=>{let r=o(!0),n=o(!1);t.setValue(e,{value:r}),i.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:e,name:"Keystroke",value:l,change:n,changeEx:r,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(r,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],t=>t.target.value)):r.addEventListener("input",function(i){t.setValue(e,{value:o(!0)})}),this.data.combo&&this._setTextStyle(r),this._setBackgroundColor(r),this._setDefaultPropertiesFromJS(r),this.container.append(r),this.container}}class nM extends ny{constructor(t){let{data:e,elements:i,parent:r}=t,n=!!r._commentManager;if(super(t,{isRenderable:!n&&ny._hasPopupData(e)}),this.elements=i,n&&ny._hasPopupData(e)){let t=this.popup=this.#n9();for(let e of i)e.popup=t}else this.popup=null}#n9(){return new nD({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate||this.data.creationDate,contentsObj:this.data.contentsObj,richText:this.data.richText,rect:this.data.rect,parentRect:this.data.parentRect||null,parent:this.parent,elements:this.elements,open:this.data.open,c
46ommentManager:this.parent._commentManager})}render(){let{container:t}=this;t.classList.add("popupAnnotation"),t.role="comment";let e=this.popup=this.#n9(),i=[];for(let t of this.elements)t.popup=e,t.container.ariaHasPopup="dialog",i.push(t.data.id),t.addHighlightArea();return this.container.setAttribute("aria-controls",i.map(t=>`${ek}${t}`).join(",")),this.container}}class nD{#W=null;#n8=this.#nK.bind(this);#n7=this.#st.bind(this);#se=this.#si.bind(this);#sr=this.#sn.bind(this);#ss=null;#tC=null;#sa=null;#so=null;#sl=null;#sh=null;#sd=null;#sc=!1;#su=null;#sp=null;#R=null;#sg=null;#sm=null;#ed=null;#sf=null;#ea=null;#sb=null;#n0=null;#sv=!1;#sy=null;#sw=null;constructor({container:t,color:e,elements:i,titleObj:r,modificationDate:n,contentsObj:s,richText:a,parent:o,rect:l,parentRect:h,open:d,commentManager:c=null}){this.#tC=t,this.#sb=r,this.#sa=s,this.#ea=a,this.#sh=o,this.#ss=e,this.#sf=l,this.#sd=h,this.#sl=i,this.#W=c,this.#sy=i[0],this.#so=eG.toDateObject(n),this.trigger=i.flatMap(t=>t.getElementsToTriggerPopup()),!c&&(this.#sx(),this.#tC.hidden=!0,d&&this.#sn())}#sx(){if(this.#sp)return;this.#sp=new AbortController;let{signal:t}=this.#sp;for(let e of this.trigger)e.addEventListener("click",this.#sr,{signal:t}),e.addEventListener("pointerenter",this.#se,{signal:t}),e.addEventListener("pointerleave",this.#n7,{signal:t}),e.classList.add("popupTriggerArea");for(let e of this.#sl)e.container?.addEventListener("keydown",this.#n8,{signal:t})}#sA(){let t=this.#sl.find(t=>t.hasCommentButton);t&&(this.#sm=t._normalizePoint(t.commentButtonPosition))}renderCommentButton(){if(this.#sg){this.#sg.parentNode||this.#sy.container.after(this.#sg);return}if(this.#sm||this.#sA(),!this.#sm)return;let{signal:t}=this.#sp=new AbortController,e=this.#sy.hasOwnCommentButton,i=()=>{this.#W.toggleCommentPopup(this,!0,void 0,!e)},r=()=>{this.#W.toggleCommentPopup(this,!1,!0,!e)},n=()=>{this.#W.toggleCommentPopup(this,!1,!1)};if(e)for(let e of(this.#sg=this.#sy.container,this.trigger))e.ariaHasPopup="dialog",e.ariaControls="commentPopup",e.addEventListener("keydown",this.#n8,{signal:t}),e.addEventListener("click",i,{signal:t}),e.addEventListener("pointerenter",r,{signal:t}),e.addEventListener("pointerleave",n,{signal:t}),e.classList.add("popupTriggerArea");else{let e=this.#sg=document.createElement("button");e.className="annotationCommentButton";let s=this.#sy.container;e.style.zIndex=parseInt(s.style.zIndex,10)+1,e.tabIndex=0,e.ariaHasPopup="dialog",e.ariaControls="commentPopup",e.setAttribute("data-l10n-id","pdfjs-show-comment-button"),this.#sS(),this.#sT(),e.addEventListener("keydown",this.#n8,{signal:t}),e.addEventListener("click",i,{signal:t}),e.addEventListener("pointerenter",r,{signal:t}),e.addEventListener("pointerleave",n,{signal:t}),s.after(e)}}#sT(){if(this.#sy.extraPopupElement&&!this.#sy.editor)return;this.#sg||this.renderCommentButton();let[t,e]=this.#sm,{style:i}=this.#sg;i.left=`calc(${t}%)`,i.top=`calc(${e}% - var(--comment-button-dim))`}#sS(){this.#sy.extraPopupElement||(this.#sg||this.renderCommentButton(),this.#sg.style.backgroundColor=this.commentButtonColor||"")}get commentButtonColor(){let{color:t,opacity:e}=this.#sy.commentData;return t?this.#sh._commentManager.makeCommentColor(t,e):null}focusCommentButton(){setTimeout(()=>{this.#sg?.focus()},0)}getData(){let{richText:t,color:e,opacity:i,creationDate:r,modificationDate:n}=this.#sy.commentData;return{contentsObj:{str:this.comment},richText:t,color:e,opacity:i,creationDate:r,modificationDate:n}}get elementBeforePopup(){return this.#sg}get comment(){return this.#sw||=this.#sy.commentText,this.#sw}set comment(t){t!==this.comment&&(this.#sy.commentText=this.#sw=t)}focus(){this.#sy.container?.focus()}get parentBoundingClientRect(){return this.#sy.layer.getBoundingClientRect()}setCommentButtonStates({selected:t,hasPopup:e}){this.#sg&&(this.#sg.classList.toggle("selected",t),this.#sg.ariaExpanded=e)}setSelectedCommentButton(t){this.#sg.classList.toggle("selected",t)}get commentPopupPosition(){if(this.#ed)return this.#ed;let{x:t,y:e,height:i}=this.#sg.getBoundingClientRect(),{x:r,y:n,width:s,height:a}=this.#sy.layer.getBoundingClientRect();return[(t-r)/s,(e+i-n)/a]}set commentPopupPosition(t){this.#ed=t}hasDefaultPopupPosition(){return null===this.#ed}get commentButtonPosition(){return this.#sm}get commentButtonWidth(){return this.#sg.getBoundingClientRect().width/this.parentBoundingClientRect.width}editComment(t){let[e,i]=this.#ed||this.commentButtonPosition.map(t=>t/100),r=this.parentBoundingClientRect,{x:n,y:s,width:a,height:o}=r;this.#W.showDialog(null,this,n+e*a,s+i*o,{...t,parentDimensions:r})}
46render(){if(this.#su)return;let t=this.#su=document.createElement("div");if(t.className="popup",this.#ss){let e=t.style.outlineColor=eT.makeHexColor(...this.#ss);t.style.backgroundColor=`color-mix(in srgb, ${e} 30%, white)`}let e=document.createElement("span");if(e.className="header",this.#sb?.str){let t=document.createElement("span");t.className="title",e.append(t),{dir:t.dir,str:t.textContent}=this.#sb}if(t.append(e),this.#so){let t=document.createElement("time");t.className="popupDate",t.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),t.setAttribute("data-l10n-args",JSON.stringify({dateObj:this.#so.valueOf()})),t.dateTime=this.#so.toISOString(),e.append(t)}e4({html:this.#s_||this.#sa.str,dir:this.#sa?.dir,className:"popupContent"},t),this.#tC.append(t)}get #s_(){let t=this.#ea,e=this.#sa;return t?.str&&(!e?.str||e.str===t.str)&&this.#ea.html||null}get #sE(){return this.#s_?.attributes?.style?.fontSize||0}get #sC(){return this.#s_?.attributes?.style?.color||null}#sk(t){let e=[],i={style:{color:this.#sC,fontSize:this.#sE?`calc(${this.#sE}px * var(--total-scale-factor))`:""}};for(let r of t.split("\n"))e.push({name:"span",value:r,attributes:i});return{str:t,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:e}]}}}#nK(t){t.altKey||t.shiftKey||t.ctrlKey||t.metaKey||("Enter"===t.key||"Escape"===t.key&&this.#sc)&&this.#sn()}updateEdited({rect:t,popup:e,deleted:i}){if(this.#W){i?(this.remove(),this.#sw=null):e&&(e.deleted?this.remove():(this.#sS(),this.#sw=e.text)),t&&(this.#sm=null,this.#sA(),this.#sT());return}i||e?.deleted?this.remove():(this.#sx(),this.#n0||={contentsObj:this.#sa,richText:this.#ea},t&&(this.#R=null),e&&e.text&&(this.#ea=this.#sk(e.text),this.#so=eG.toDateObject(e.date),this.#sa=null),this.#su?.remove(),this.#su=null)}resetEdited(){this.#n0&&({contentsObj:this.#sa,richText:this.#ea}=this.#n0,this.#n0=null,this.#su?.remove(),this.#su=null,this.#R=null)}remove(){if(this.#sp?.abort(),this.#sp=null,this.#su?.remove(),this.#su=null,this.#sv=!1,this.#sc=!1,this.#sg?.remove(),this.#sg=null,this.trigger)for(let t of this.trigger)t.classList.remove("popupTriggerArea")}#sP(){if(null!==this.#R)return;let{page:{view:t},viewport:{rawDims:{pageWidth:e,pageHeight:i,pageX:r,pageY:n}}}=this.#sh,s=!!this.#sd,a=s?this.#sd:this.#sf;for(let t of this.#sl)if(!a||null!==eT.intersect(t.data.rect,a)){a=t.data.rect,s=!0;break}let o=eT.normalizeRect([a[0],t[3]-a[1]+t[1],a[2],t[3]-a[3]+t[1]]),l=s?a[2]-a[0]+5:0,h=o[0]+l,d=o[1];this.#R=[100*(h-r)/e,100*(d-n)/i];let{style:c}=this.#tC;c.left=`${this.#R[0]}%`,c.top=`${this.#R[1]}%`}#sn(){this.#W?this.#W.toggleCommentPopup(this,!1):(this.#sc=!this.#sc,this.#sc?(this.#si(),this.#tC.addEventListener("click",this.#sr),this.#tC.addEventListener("keydown",this.#n8)):(this.#st(),this.#tC.removeEventListener("click",this.#sr),this.#tC.removeEventListener("keydown",this.#n8)))}#si(){this.#su||this.render(),this.isVisible?this.#sc&&this.#tC.classList.add("focused"):(this.#sP(),this.#tC.hidden=!1,this.#tC.style.zIndex=parseInt(this.#tC.style.zIndex,10)+1e3)}#st(){this.#tC.classList.remove("focused"),!this.#sc&&this.isVisible&&(this.#tC.hidden=!0,this.#tC.style.zIndex=parseInt(this.#tC.style.zIndex,10)-1e3)}forceHide(){this.#sv=this.isVisible,this.#sv&&(this.#tC.hidden=!0)}maybeShow(){this.#W||(this.#sx(),this.#sv&&(this.#su||this.#si(),this.#sv=!1,this.#tC.hidden=!1))}get isVisible(){return!this.#W&&!1===this.#tC.hidden}}class nI extends ny{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.textContent=t.data.textContent,this.textPosition=t.data.textPosition,this.annotationEditorType=et.FREETEXT}render(){if(this.container.classList.add("freeTextAnnotation"),this.textContent){let t=this.contentElement=document.createElement("div");for(let e of(t.classList.add("annotationTextContent"),t.setAttribute("role","comment"),this.textContent)){let i=document.createElement("span");i.textContent=e,t.append(i)}this.container.append(t)}return!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this._editOnDoubleClick(),this.container}}
46class nR extends ny{#sM=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("lineAnnotation");let{data:t,width:e,height:i}=this,r=this.svgFactory.create(e,i,!0),n=this.#sM=this.svgFactory.createElement("svg:line");return n.setAttribute("x1",t.rect[2]-t.lineCoordinates[0]),n.setAttribute("y1",t.rect[3]-t.lineCoordinates[1]),n.setAttribute("x2",t.rect[2]-t.lineCoordinates[2]),n.setAttribute("y2",t.rect[3]-t.lineCoordinates[3]),n.setAttribute("stroke-width",t.borderStyle.width||1),n.setAttribute("stroke","transparent"),n.setAttribute("fill","transparent"),r.append(n),this.container.append(r),!t.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return this.#sM}addHighlightArea(){this.container.classList.add("highlightArea")}}class nF extends ny{#sD=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("squareAnnotation");let{data:t,width:e,height:i}=this,r=this.svgFactory.create(e,i,!0),n=t.borderStyle.width,s=this.#sD=this.svgFactory.createElement("svg:rect");return s.setAttribute("x",n/2),s.setAttribute("y",n/2),s.setAttribute("width",e-n),s.setAttribute("height",i-n),s.setAttribute("stroke-width",n||1),s.setAttribute("stroke","transparent"),s.setAttribute("fill","transparent"),r.append(s),this.container.append(r),!t.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return this.#sD}addHighlightArea(){this.container.classList.add("highlightArea")}}class nB extends ny{#sI=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){this.container.classList.add("circleAnnotation");let{data:t,width:e,height:i}=this,r=this.svgFactory.create(e,i,!0),n=t.borderStyle.width,s=this.#sI=this.svgFactory.createElement("svg:ellipse");return s.setAttribute("cx",e/2),s.setAttribute("cy",i/2),s.setAttribute("rx",e/2-n/2),s.setAttribute("ry",i/2-n/2),s.setAttribute("stroke-width",n||1),s.setAttribute("stroke","transparent"),s.setAttribute("fill","transparent"),r.append(s),this.container.append(r),!t.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return this.#sI}addHighlightArea(){this.container.classList.add("highlightArea")}}class nO extends ny{#sR=null;constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.classList.add(this.containerClassName);let{data:{rect:t,vertices:e,borderStyle:i,popupRef:r},width:n,height:s}=this;if(!e)return this.container;let a=this.svgFactory.create(n,s,!0),o=[];for(let i=0,r=e.length;i<r;i+=2){let r=e[i]-t[0],n=t[3]-e[i+1];o.push(`${r},${n}`)}o=o.join(" ");let l=this.#sR=this.svgFactory.createElement(this.svgElementName);return l.setAttribute("points",o),l.setAttribute("stroke-width",i.width||1),l.setAttribute("stroke","transparent"),l.setAttribute("fill","transparent"),a.append(l),this.container.append(a),!r&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}getElementsToTriggerPopup(){return this.#sR}addHighlightArea(){this.container.classList.add("highlightArea")}}class nL extends nO{constructor(t){super(t),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class nN extends ny{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0})}render(){return this.container.classList.add("caretAnnotation"),!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container}}class nU extends ny{#sF=null;#sB=[];constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline",this.annotationEditorType="InkHighlight"===this.data.it?et.HIGHLIGHT:et.INK}#sO(t,e){switch(t){case 90:return{transform:`rotate(90) translate(${-e[0]},${e[1]}) scale(1,-1)`,width:e[3]-e[1],height:e[2]-e[0]};case 180:return{transform:`rotate(180) translate(${-e[2]},${e[1]}) scale(1,-1)`,width:e[2]-e[0],height:e[3]-e[1]};case 270:return{transform:`rotate(270) translate(${-e[2]},${e[3]}) scale(1,-1)`,width:e[3]-e[1],height:e[2]-e[0]};default:return{transform:`translate(${-e[0]},${e[3]}) scale(1,-1)`,width:e[2]-e[0],height:e[3]-e[1]}}}render(){this.container.classList.add(this.containerClassName);let{data:{rect:t,rotation:e,inkLists:i,borderStyle:r,popupRef:n}}=this,{transform:s,width:a,height:o}=this.#sO(e,t),l=this.svgFactory.create(a,o,!0),h=this.#sF=this.svgFactory.createElement("svg:g");l.append(h),h.setAttribute("stroke-width",r.width||1),h.setAttribute("stroke-linecap","round"),h.setAttribute("stroke-linejoin","round"),h.setAttribute("stroke-miterlimit",10),h.setAttribute("stroke","transparent"),h.setAttribute("fill","transparent"),h.setAttribute("transform",s);for(let t=0,e=i.length;t<e;t++){let e=this.svgFactory.createElement(this.svgElementName);this.#sB.push(e),e.setAttribute("points",i[t].join(",")),h.append(e)}return!n&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.append(l),this._editOnDoubleClick(),this.container}updateEdited(t){super.updateEdited(t);let{thickness:e,points:i,rect:r}=t,n=this.#sF;if(e>=0&&n.setAttribute("stroke-width",e||1),i)for(let t=0,e=this.#sB.length;t<e;t++)this.#sB[t].setAttribute("points",i[t].join(","));if(r){let{transform:t,width:e,height:i}=this.#sO(this.data.rotation,r);n.parentElement.setAttribute("viewBox",`0 0 ${e} ${i}`),n.setAttribute("transform",t)}}getElementsToTriggerPopup(){return this.#sB}addHighlightArea(){this.container.classList.add("highlightArea")}}class nj extends ny{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0}),this.annotationEditorType=et.HIGHLIGHT}render(){let{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add("highlightAnnotation"),this._editOnDoubleClick(),t){let e=document.createElement("mark");e.classList.add("overlaidText"),e.textContent=t,this.container.append(e)}return this.container}}
46class nz extends ny{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){let{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add("underlineAnnotation"),t){let e=document.createElement("u");e.classList.add("overlaidText"),e.textContent=t,this.container.append(e)}return this.container}}class nH extends ny{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){let{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add("squigglyAnnotation"),t){let e=document.createElement("u");e.classList.add("overlaidText"),e.textContent=t,this.container.append(e)}return this.container}}class n$ extends ny{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0,createQuadrilaterals:!0})}render(){let{data:{overlaidText:t,popupRef:e}}=this;if(!e&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this.container.classList.add("strikeoutAnnotation"),t){let e=document.createElement("s");e.classList.add("overlaidText"),e.textContent=t,this.container.append(e)}return this.container}}class nV extends ny{constructor(t){super(t,{isRenderable:!0,ignoreBorder:!0}),this.annotationEditorType=et.STAMP}render(){return this.container.classList.add("stampAnnotation"),this.container.setAttribute("role","img"),!this.data.popupRef&&this.hasPopupData&&(this.hasOwnCommentButton=!0,this._createPopup()),this._editOnDoubleClick(),this.container}}class nW extends ny{#sL=null;constructor(t){super(t,{isRenderable:!0});let{file:e}=this.data;this.filename=e.filename,this.content=e.content,this.linkService.eventBus?.dispatch("fileattachmentannotation",{source:this,...e})}render(){let t;this.container.classList.add("fileAttachmentAnnotation");let{container:e,data:i}=this;i.hasAppearance||0===i.fillAlpha?t=document.createElement("div"):((t=document.createElement("img")).src=`${this.imageResourcesPath}annotation-${/paperclip/i.test(i.name)?"paperclip":"pushpin"}.svg`,i.fillAlpha&&i.fillAlpha<1&&(t.style=`filter: opacity(${Math.round(100*i.fillAlpha)}%);`)),t.addEventListener("dblclick",this.#sN.bind(this)),this.#sL=t;let{isMac:r}=eS.platform;return e.addEventListener("keydown",t=>{"Enter"===t.key&&(r?t.metaKey:t.ctrlKey)&&this.#sN()}),!i.popupRef&&this.hasPopupData?(this.hasOwnCommentButton=!0,this._createPopup()):t.classList.add("popupTriggerArea"),e.append(t),e}getElementsToTriggerPopup(){return this.#sL}addHighlightArea(){this.container.classList.add("highlightArea")}#sN(){this.downloadManager?.openOrDownloadData(this.content,this.filename)}}class nG{#sU=null;#sj=null;#H=null;#sz=new Map;#sH=null;#s$=null;#sl=[];#sV=!1;zIndex=0;constructor({div:t,accessibilityManager:e,annotationCanvasMap:i,annotationEditorUIManager:r,page:n,viewport:s,structTreeLayer:a,commentManager:o,linkService:l,annotationStorage:h}){this.div=t,this.#sU=e,this.#sj=i,this.#sH=a||null,this.#s$=l||null,this.#H=h||new ib,this.page=n,this.viewport=s,this._annotationEditorUIManager=r,this._commentManager=o||null}hasEditableAnnotations(){return this.#sz.size>0}async render(t){let{annotations:e}=t,i=this.div;eJ(i,this.viewport);let r=new Map,n=[],s={data:null,layer:i,linkService:this.#s$,downloadManager:t.downloadManager,imageResourcesPath:t.imageResourcesPath||"",renderForms:!1!==t.renderForms,svgFactory:new nm,annotationStorage:this.#H,enableComment:!0===t.enableComment,enableScripting:!0===t.enableScripting,hasJSActions:t.hasJSActions,fieldObjects:t.fieldObjects,parent:this,elements:null};for(let t of e){if(t.noHTML)continue;let e=t.annotationType===er.POPUP;if(e){let e=r.get(t.id);if(!e)continue;if(!this._commentManager){n.push(t);continue}s.elements=e}else if(t.rect[2]===t.rect[0]||t.rect[3]===t.rect[1])continue;s.data=t;let i=nv.create(s);if(!i.isRenderable)continue;!e&&(this.#sl.push(i),t.popupRef&&r.getOrInsertComputed(t.popupRef,eP).push(i));let a=i.render();t.hidden&&(a.style.visibility="hidden"),i._isEditable&&(this.#sz.set(i.data.id,i),this._annotationEditorUIManager?.renderAnnotationElement(i))}for(let t of(await this.#sW(),n)){let e=s.elements=r.get(t.id);s.data=t;let i=nv.create(s);if(!i.isRenderable)continue;let n=i.render();i.contentElement.id=`${ek}${t.id}`,t.hidden&&(n.style.visibility="hidden"),e.at(-1).container.after(n)}this.#sG()}async #sW(){if(0===this.#sl.length)return;this.div.replaceChildren();let t=[];if(!this.#sV)for(let{contentElement:e,data:{id:i}}of(this.#sV=!0,this.#sl)){let r=e.id=`${ek}${i}`;t.push(this.#sH?.getAriaAttributes(r).then(t=>{if(t)for(let[i,r]of t)e.setAttribute(i,r)}))}this.#sl.sort(({data:{rect:[t,e,i,r]}},{data:{rect:[n,s,a,o]}})=>{if(t===i&&e===r)return 1;if(n===a&&s===o)return -1;let l=(e+r)/2,h=(s+o)/2;return l>=o&&h<=e?-1:h>=r&&l<=s?1:(t+i)/2-(n+a)/2});let e=document.createDocumentFragment();for(let t of this.#sl)e.append(t.container),this._commentManager?(t.extraPopupElement?.popup||t.popup)?.renderCommentButton():t.extraPopupElement&&e.append(t.extraPopupElement.render());if(this.div.append(e),await Promise.all(t),this.#sU)for(let t of this.#sl)this.#sU.addPointerInTextLayer(t.contentElement,!1)}async addLinkAnnotations(t){let e={data:null,layer:this.div,linkService:this.#s$,svgFactory:new nm,parent:this};for(let i of t){i.borderStyle||=nG._defaultBorderStyle,e.data=i;let t=nv.create(e);t.isRenderable&&(t.render(),t.contentElement.id=`${ek}${i.id}`,this.#sl.push(t))}await this.#sW()}update({viewport:t}){let e=this.div;this.viewport=t,eJ(e,{rotation:t.rotation}),this.#sG(),e.hidden=!1}#sG(){if(!this.#sj)return;let t=this.div;for(let[e,i]of this.#sj){let r=t.querySelector(`[data-annotation-id="${e}"]`);if(!r)continue;i.className="annotationContent";let{firstChild:n}=r;n?"CANVAS"===n.nodeName?n.replaceWith(i):n.classList.contains("annotationContent")?n.after(i):n.before(i):r.append(i);let s=this.#sz.get(e);s&&(s._hasNoCanvas?(this._annotationEditorUIManager?.setMissingCanvas(e,r.id,i),s._hasNoCanvas=!1):s.canvas=i)}this.#sj.clear()}getEditableAnnotations(){return this.#sz.values()}getEditableAnnotation(t){return this.#sz.get(t)}addFakeAnnotation(t){let{div:e}=this,{id:i,rotation:r}=t,n=new nw({data:{id:i,rect:t.getPDFRect(),rotation:r},editor:t,layer:e,parent:this,enableComment:!!this._commentManager,linkService:this.#s$,annotationStorage:this.#H});return n.render(),n.contentElement.id=`${ek}${i}`,n.createOrUpdatePopup(),this.#sl.push(n),n}removeAnnotation(t){let e=this.#sl.findIndex(e=>e.data.id===t);if(e<0)return;let[i]=this.#sl.splice(e,1);this.#sU?.removePointerInTextLayer(i.contentElement)}updateFakeAnnotations(t){if(0!==t.length){for(let e of t)e.updateFakeAnnotationElement(this);this.#sW()}}togglePointerEvents(t=!1){this.div.classList.toggle("disabled",!t)}static get _defaultBorderStyle(){return eg(this,"_defaultBorderStyle",Object.freeze({width:1,rawWidth:1,style:1,dashArray:[3],horizontalCornerRadius:0,verticalCornerRadius:0}))}}let nq=/\r\n?|\n/g;class nK extends iu{#sq="";#sK=`${this.id}-editor`;#sX=null;#sE;_colorPicker=null;static _freeTextDefaultContent="";static _internalPadding=0;static _defaultColor=null;static _defaultFontSize=10;static get _keyboardManager(){let t=nK.prototype,e=t=>t.isEmpty(),i=il.TRANSLATE_SMALL,r=il.TRANSLATE_BIG;return eg(this,"_keyboardManager",new ia([[["ctrl+s","mac+meta+s","ctrl+p","mac+meta+p"],t.commitOrRemove,{bubbles:!0}],[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],t.commitOrRemove],[["ArrowLeft","mac+ArrowLeft"],t._translateEmpty,{args:[-i,0],checker:e}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],t._translateEmpty,{args:[-r,0],checker:e}],[["ArrowRight","mac+ArrowRight"],t._translateEmpty,{args:[i,0],checker:e}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],t._translateEmpty,{args:[r,0],checker:e}],[["ArrowUp","mac+ArrowUp"],t._translateEmpty,{args:[0,-i],checker:e}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],t._translateEmpty,{args:[0,-r],checker:e}],[["ArrowDown","mac+ArrowDown"],t._translateEmpty,{args:[0,i],checker:e}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],t._translateEmpty,{args:[0,r],checker:e}]]))}static _type="freetext";static _editorType=et.FREETEXT;constructor(t){super({...t,name:"freeTextEditor"}),this.color=t.color||nK._defaultColor||iu._defaultLineColor,this.#sE=t.fontSize||nK._defaultFontSize,this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-freetext-added-alert"),this.canAddComment=!1}static initialize(t,e){iu.initialize(t,e);let i=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(i.getPropertyValue("--freetext-padding"))}
46static updateDefaultParams(t,e){switch(t){case ee.FREETEXT_SIZE:nK._defaultFontSize=e;break;case ee.FREETEXT_COLOR:nK._defaultColor=e}}updateParams(t,e){switch(t){case ee.FREETEXT_SIZE:this.#sY(e);break;case ee.FREETEXT_COLOR:this.#sS(e)}}static get defaultPropertiesToUpdate(){return[[ee.FREETEXT_SIZE,nK._defaultFontSize],[ee.FREETEXT_COLOR,nK._defaultColor||iu._defaultLineColor]]}get propertiesToUpdate(){return[[ee.FREETEXT_SIZE,this.#sE],[ee.FREETEXT_COLOR,this.color]]}get toolbarButtons(){return this._colorPicker||=new nd(this),[["colorPicker",this._colorPicker]]}get colorType(){return ee.FREETEXT_COLOR}#sY(t){let e=t=>{this.editorDiv.style.fontSize=`calc(${t}px * var(--total-scale-factor))`,this.translate(0,-(t-this.#sE)*this.parentScale),this.#sE=t,this.#sJ()},i=this.#sE;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:ee.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}onUpdatedColor(){this.editorDiv.style.color=this.color,this._colorPicker?.update(this.color),super.onUpdatedColor()}#sS(t){let e=t=>{this.color=t,this.onUpdatedColor()},i=this.color;this.addCommands({cmd:e.bind(this,t),undo:e.bind(this,i),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:ee.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}_translateEmpty(t,e){this._uiManager.translateSelectedEditors(t,e,!0)}getInitialTranslation(){let t=this.parentScale;return[-nK._internalPadding*t,-(nK._internalPadding+this.#sE)*t]}rebuild(){!this.parent||(super.rebuild(),null!==this.div&&(this.isAttachedToDOM||this.parent.add(this)))}enableEditMode(){if(!super.enableEditMode())return!1;this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this._isDraggable=!1,this.div.removeAttribute("aria-activedescendant"),this.#sX=new AbortController;let t=this._uiManager.combinedSignal(this.#sX);return this.editorDiv.addEventListener("keydown",this.editorDivKeydown.bind(this),{signal:t}),this.editorDiv.addEventListener("focus",this.editorDivFocus.bind(this),{signal:t}),this.editorDiv.addEventListener("blur",this.editorDivBlur.bind(this),{signal:t}),this.editorDiv.addEventListener("input",this.editorDivInput.bind(this),{signal:t}),this.editorDiv.addEventListener("paste",this.editorDivPaste.bind(this),{signal:t}),!0}disableEditMode(){return!!super.disableEditMode()&&(this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.setAttribute("aria-activedescendant",this.#sK),this._isDraggable=!0,this.#sX?.abort(),this.#sX=null,this.div.focus({preventScroll:!0}),this.isEditing=!1,this.parent.div.classList.add("freetextEditing"),!0)}focusin(t){this._focusEventsAllowed&&(super.focusin(t),t.target!==this.editorDiv&&this.editorDiv.focus())}onceAdded(t){this.width||(this.enableEditMode(),t&&this.editorDiv.focus(),this._initialOptions?.isCentered&&this.center(),this._initialOptions=null)}isEmpty(){return!this.editorDiv||""===this.editorDiv.innerText.trim()}remove(){this.isEditing=!1,this.parent&&(this.parent.setEditingState(!0),this.parent.div.classList.add("freetextEditing")),super.remove()}#sQ(){let t=[];this.editorDiv.normalize();let e=null;for(let i of this.editorDiv.childNodes)(e?.nodeType!==Node.TEXT_NODE||"BR"!==i.nodeName)&&(t.push(nK.#sZ(i)),e=i);return t.join("\n")}#sJ(){let t,[e,i]=this.parentDimensions;if(this.isAttachedToDOM)t=this.div.getBoundingClientRect();else{let{currentLayer:e,div:i}=this,r=i.style.display,n=i.classList.contains("hidden");i.classList.remove("hidden"),i.style.display="hidden",e.div.append(this.div),t=i.getBoundingClientRect(),i.remove(),i.style.display=r,i.classList.toggle("hidden",n)}this.rotation%180==this.parentRotation%180?(this.width=t.width/e,this.height=t.height/i):(this.width=t.height/e,this.height=t.width/i),this.fixAndSetPosition()}commit(){if(!this.isInEditMode())return;super.commit(),this.disableEditMode();let t=this.#sq,e=this.#sq=this.#sQ().trimEnd();if(t===e)return;let i=t=>{(this.#sq=t,t)?(this.#s0(),this._uiManager.rebuild(this),this.#sJ()):this.remove()};this.addCommands({cmd:()=>{i(e)},undo:()=>{i(t)},mustExec:!1}),this.#sJ()}shouldGetKeyboardEvents(){return this.isInEditMode()}enterInEditMode(){this.enableEditMode(),this.editorDiv.focus()}keydown(t){t.target===this.div&&"Enter"===t.key&&(this.enterInEditMode(),t.preventDefault())}editorDivKeydown(t){nK._keyboardManager.exec(this,t)}editorDivFocus(t){this.isEditing=!0}editorDivBlur(t){this.isEditing=!1}editorDivInput(t){this.parent.div.classList.toggle("freetextEditing",this.isEmpty())}disableEditing(){this.editorDiv.setAttribute("role","comment"),this.editorDiv.removeAttribute("aria-multiline")}enableEditing(){this.editorDiv.setAttribute("role","textbox"),this.editorDiv.setAttribute("aria-multiline",!0)}get canChangeContent(){return!0}render(){let t,e;if(this.div)return this.div;(this._isCopy||this.annotationElementId)&&(t=this.x,e=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",this.#sK),this.editorDiv.setAttribute("data-l10n-id","pdfjs-free-text2"),this.editorDiv.setAttribute("data-l10n-attrs","default-content"),this.enableEditing(),this.editorDiv.contentEditable=!0;let{style:i}=this.editorDiv;if(i.fontSize=`calc(${this.#sE}px * var(--total-scale-factor))`,i.color=this.color,this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),this._isCopy||this.annotationElementId){let[i,r]=this.parentDimensions;
46if(this.annotationElementId){let n,s,{position:a}=this._initialData,[o,l]=this.getInitialTranslation();[o,l]=this.pageTranslationToScreen(o,l);let[h,d]=this.pageDimensions,[c,u]=this.pageTranslation;switch(this.rotation){case 0:n=t+(a[0]-c)/h,s=e+this.height-(a[1]-u)/d;break;case 90:n=t+(a[0]-c)/h,s=e-(a[1]-u)/d,[o,l]=[l,-o];break;case 180:n=t-this.width+(a[0]-c)/h,s=e-(a[1]-u)/d,[o,l]=[-o,-l];break;case 270:n=t+(a[0]-c-this.height*d)/h,s=e+(a[1]-u-this.width*h)/d,[o,l]=[-l,o]}this.setAt(n*i,s*r,o,l)}else this._moveAfterPaste(t,e);this.#s0(),this._isDraggable=!0,this.editorDiv.contentEditable=!1}else this._isDraggable=!1,this.editorDiv.contentEditable=!0;return this.div}static #sZ(t){return(t.nodeType===Node.TEXT_NODE?t.nodeValue:t.innerText).replaceAll(nq,"")}editorDivPaste(t){let e=t.clipboardData||window.clipboardData,{types:i}=e;if(1===i.length&&"text/plain"===i[0])return;t.preventDefault();let r=nK.#s1(e.getData("text")||"").replaceAll(nq,"\n");if(!r)return;let n=window.getSelection();if(!n.rangeCount)return;this.editorDiv.normalize(),n.deleteFromDocument();let s=n.getRangeAt(0);if(!r.includes("\n")){s.insertNode(document.createTextNode(r)),this.editorDiv.normalize(),n.collapseToStart();return}let{startContainer:a,startOffset:o}=s,l=[],h=[];if(a.nodeType===Node.TEXT_NODE){let t=a.parentElement;if(h.push(a.nodeValue.slice(o).replaceAll(nq,"")),t!==this.editorDiv){let e=l;for(let i of this.editorDiv.childNodes){if(i===t){e=h;continue}e.push(nK.#sZ(i))}}l.push(a.nodeValue.slice(0,o).replaceAll(nq,""))}else if(a===this.editorDiv){let t=l,e=0;for(let i of this.editorDiv.childNodes)e++===o&&(t=h),t.push(nK.#sZ(i))}this.#sq=`${l.join("\n")}${r}${h.join("\n")}`,this.#s0();let d=new Range,c=Math.sumPrecise(l.map(t=>t.length));for(let{firstChild:t}of this.editorDiv.childNodes)if(t.nodeType===Node.TEXT_NODE){let e=t.nodeValue.length;if(c<=e){d.setStart(t,c),d.setEnd(t,c);break}c-=e}n.removeAllRanges(),n.addRange(d)}#s0(){if(this.editorDiv.replaceChildren(),this.#sq)for(let t of this.#sq.split("\n")){let e=document.createElement("div");e.append(t?document.createTextNode(t):document.createElement("br")),this.editorDiv.append(e)}}#s2(){return this.#sq.replaceAll(" "," ")}static #s1(t){return t.replaceAll(" "," ")}get contentDiv(){return this.editorDiv}getPDFRect(){let t=nK._internalPadding*this.parentScale;return this.getRect(t,t)}static async deserialize(t,e,i){let r=null;if(t instanceof nI){let{data:{defaultAppearanceData:{fontSize:e,fontColor:i},rect:n,rotation:s,id:a,popupRef:o,richText:l,contentsObj:h,creationDate:d,modificationDate:c},textContent:u,textPosition:p,parent:{page:{pageNumber:g}}}=t;if(!u||0===u.length)return null;r=t={annotationType:et.FREETEXT,color:Array.from(i),fontSize:e,value:u.join("\n"),position:p,pageIndex:g-1,rect:n.slice(0),rotation:s,annotationElementId:a,id:a,deleted:!1,popupRef:o,comment:h?.str||null,richText:l,creationDate:d,modificationDate:c}}let n=await super.deserialize(t,e,i);return n.#sE=t.fontSize,n.color=eT.makeHexColor(...t.color),n.#sq=nK.#s1(t.value),n._initialData=r,t.comment&&n.setCommentData(t),n}serialize(t=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let e=iu._colorManager.convert(this.isAttachedToDOM?getComputedStyle(this.editorDiv).color:this.color),i=Object.assign(super.serialize(t),{color:e,fontSize:this.#sE,value:this.#s2()});return(this.addComment(i),t)?(i.isCopy=!0,i):this.annotationElementId&&!this.#s5(i)?null:(i.id=this.annotationElementId,i)}#s5(t){let{value:e,fontSize:i,color:r,pageIndex:n}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||t.value!==e||t.fontSize!==i||t.color.some((t,e)=>t!==r[e])||t.pageIndex!==n}renderAnnotationElement(t){let e=super.renderAnnotationElement(t);if(!e)return null;let{style:i}=e;for(let t of(i.fontSize=`calc(${this.#sE}px * var(--total-scale-factor))`,i.color=this.color,e.replaceChildren(),this.#sq.split("\n"))){let i=document.createElement("div");i.append(t?document.createTextNode(t):document.createElement("br")),e.append(i)}return t.updateEdited({rect:this.getPDFRect(),popup:this._uiManager.hasCommentManager()||this.hasEditedComment?this.comment:{text:this.#sq}}),e}resetAnnotationElement(t){super.resetAnnotationElement(t),t.resetEdited()}}class nX{static PRECISION=1e-4;toSVGPath(){eh("Abstract method `toSVGPath` must be implemented.")}get box(){eh("Abstract getter `box` must be implemented.")}serialize(t,e){eh("Abstract method `serialize` must be implemented.")}static _rescale(t,e,i,r,n,s){s||=new Float32Array(t.length);for(let a=0,o=t.length;a<o;a+=2)s[a]=e+t[a]*r,s[a+1]=i+t[a+1]*n;return s}static _rescaleAndSwap(t,e,i,r,n,s){s||=new Float32Array(t.length);for(let a=0,o=t.length;a<o;a+=2)s[a]=e+t[a+1]*r,s[a+1]=i+t[a]*n;return s}static _translate(t,e,i,r){r||=new Float32Array(t.length);for(let n=0,s=t.length;n<s;n+=2)r[n]=e+t[n],r[n+1]=i+t[n+1];return r}static svgRound(t){return Math.round(1e4*t)}static _normalizePoint(t,e,i,r,n){switch(n){case 90:return[1-e/i,t/r];case 180:return[1-t/i,1-e/r];case 270:return[e/i,1-t/r];default:return[t/i,e/r]}}static _normalizePagePoint(t,e,i){switch(i){case 90:return[1-e,t];case 180:return[1-t,1-e];case 270:return[e,1-t];default:return[t,e]}}static createBezierPoints(t,e,i,r,n,s){return[(t+5*i)/6,(e+5*r)/6,(5*i+n)/6,(5*r+s)/6,(i+n)/2,(r+s)/2]}}class nY{#s3;#s6=[];#s4;#s9;#s8=[];#s7=new Float32Array(18);#at;#ae;#ai;#ar;#an;#as;#aa=[];
46static #ao=8;static #al=2;static #ah=nY.#ao+nY.#al;constructor({x:t,y:e},i,r,n,s,a=0){this.#s3=i,this.#as=n*r,this.#s9=s,this.#s7.set([0/0,0/0,0/0,0/0,t,e],6),this.#s4=a,this.#ar=nY.#ao*r,this.#ai=nY.#ah*r,this.#an=r,this.#aa.push(t,e)}isEmpty(){return isNaN(this.#s7[8])}#ad(){let t=this.#s7.subarray(4,6),e=this.#s7.subarray(16,18),[i,r,n,s]=this.#s3;return[(this.#at+(t[0]-e[0])/2-i)/n,(this.#ae+(t[1]-e[1])/2-r)/s,(this.#at+(e[0]-t[0])/2-i)/n,(this.#ae+(e[1]-t[1])/2-r)/s]}add({x:t,y:e}){this.#at=t,this.#ae=e;let[i,r,n,s]=this.#s3,[a,o,l,h]=this.#s7.subarray(8,12),d=t-l,c=e-h,u=Math.hypot(d,c);if(u<this.#ai)return!1;let p=u-this.#ar,g=p/u,m=g*d,f=g*c,b=a,v=o;a=l,o=h,l+=m,h+=f,this.#aa?.push(t,e);let y=-f/p*this.#as,w=m/p*this.#as;return(this.#s7.set(this.#s7.subarray(2,8),0),this.#s7.set([l+y,h+w],4),this.#s7.set(this.#s7.subarray(14,18),12),this.#s7.set([l-y,h-w],16),isNaN(this.#s7[6]))?(0===this.#s8.length&&(this.#s7.set([a+y,o+w],2),this.#s8.push(0/0,0/0,0/0,0/0,(a+y-i)/n,(o+w-r)/s),this.#s7.set([a-y,o-w],14),this.#s6.push(0/0,0/0,0/0,0/0,(a-y-i)/n,(o-w-r)/s)),this.#s7.set([b,v,a,o,l,h],6),!this.isEmpty()):((this.#s7.set([b,v,a,o,l,h],6),Math.abs(Math.atan2(v-o,b-a)-Math.atan2(f,m))<Math.PI/2)?([a,o,l,h]=this.#s7.subarray(2,6),this.#s8.push(0/0,0/0,0/0,0/0,((a+l)/2-i)/n,((o+h)/2-r)/s),[a,o,b,v]=this.#s7.subarray(14,18),this.#s6.push(0/0,0/0,0/0,0/0,((b+a)/2-i)/n,((v+o)/2-r)/s)):([b,v,a,o,l,h]=this.#s7.subarray(0,6),this.#s8.push(((b+5*a)/6-i)/n,((v+5*o)/6-r)/s,((5*a+l)/6-i)/n,((5*o+h)/6-r)/s,((a+l)/2-i)/n,((o+h)/2-r)/s),[l,h,a,o,b,v]=this.#s7.subarray(12,18),this.#s6.push(((b+5*a)/6-i)/n,((v+5*o)/6-r)/s,((5*a+l)/6-i)/n,((5*o+h)/6-r)/s,((a+l)/2-i)/n,((o+h)/2-r)/s)),!0)}toSVGPath(){if(this.isEmpty())return"";let t=this.#s8,e=this.#s6;if(isNaN(this.#s7[6])&&!this.isEmpty())return this.#ac();let i=[];i.push(`M${t[4]} ${t[5]}`);for(let e=6;e<t.length;e+=6)isNaN(t[e])?i.push(`L${t[e+4]} ${t[e+5]}`):i.push(`C${t[e]} ${t[e+1]} ${t[e+2]} ${t[e+3]} ${t[e+4]} ${t[e+5]}`);this.#au(i);for(let t=e.length-6;t>=6;t-=6)isNaN(e[t])?i.push(`L${e[t+4]} ${e[t+5]}`):i.push(`C${e[t]} ${e[t+1]} ${e[t+2]} ${e[t+3]} ${e[t+4]} ${e[t+5]}`);return this.#ap(i),i.join(" ")}#ac(){let[t,e,i,r]=this.#s3,[n,s,a,o]=this.#ad();return`M${(this.#s7[2]-t)/i} ${(this.#s7[3]-e)/r} L${(this.#s7[4]-t)/i} ${(this.#s7[5]-e)/r} L${n} ${s} L${a} ${o} L${(this.#s7[16]-t)/i} ${(this.#s7[17]-e)/r} L${(this.#s7[14]-t)/i} ${(this.#s7[15]-e)/r} Z`}#ap(t){let e=this.#s6;t.push(`L${e[4]} ${e[5]} Z`)}#au(t){let[e,i,r,n]=this.#s3,s=this.#s7.subarray(4,6),a=this.#s7.subarray(16,18),[o,l,h,d]=this.#ad();t.push(`L${(s[0]-e)/r} ${(s[1]-i)/n} L${o} ${l} L${h} ${d} L${(a[0]-e)/r} ${(a[1]-i)/n}`)}newFreeDrawOutline(t,e,i,r,n,s){return new nJ(t,e,i,r,n,s)}getOutlines(){let t=this.#s8,e=this.#s6,i=this.#s7,[r,n,s,a]=this.#s3,o=new Float32Array((this.#aa?.length??0)+2);for(let t=0,e=o.length-2;t<e;t+=2)o[t]=(this.#aa[t]-r)/s,o[t+1]=(this.#aa[t+1]-n)/a;if(o[o.length-2]=(this.#at-r)/s,o[o.length-1]=(this.#ae-n)/a,isNaN(i[6])&&!this.isEmpty())return this.#ag(o);let l=new Float32Array(this.#s8.length+24+this.#s6.length),h=t.length;for(let e=0;e<h;e+=2){if(isNaN(t[e])){l[e]=l[e+1]=0/0;continue}l[e]=t[e],l[e+1]=t[e+1]}h=this.#am(l,h);for(let t=e.length-6;t>=6;t-=6)for(let i=0;i<6;i+=2){if(isNaN(e[t+i])){l[h]=l[h+1]=0/0,h+=2;continue}l[h]=e[t+i],l[h+1]=e[t+i+1],h+=2}return this.#af(l,h),this.newFreeDrawOutline(l,o,this.#s3,this.#an,this.#s4,this.#s9)}#ag(t){let e=this.#s7,[i,r,n,s]=this.#s3,[a,o,l,h]=this.#ad(),d=new Float32Array(36);return d.set([0/0,0/0,0/0,0/0,(e[2]-i)/n,(e[3]-r)/s,0/0,0/0,0/0,0/0,(e[4]-i)/n,(e[5]-r)/s,0/0,0/0,0/0,0/0,a,o,0/0,0/0,0/0,0/0,l,h,0/0,0/0,0/0,0/0,(e[16]-i)/n,(e[17]-r)/s,0/0,0/0,0/0,0/0,(e[14]-i)/n,(e[15]-r)/s],0),this.newFreeDrawOutline(d,t,this.#s3,this.#an,this.#s4,this.#s9)}#af(t,e){let i=this.#s6;return t.set([0/0,0/0,0/0,0/0,i[4],i[5]],e),e+=6}#am(t,e){let i=this.#s7.subarray(4,6),r=this.#s7.subarray(16,18),[n,s,a,o]=this.#s3,[l,h,d,c]=this.#ad();return t.set([0/0,0/0,0/0,0/0,(i[0]-n)/a,(i[1]-s)/o,0/0,0/0,0/0,0/0,l,h,0/0,0/0,0/0,0/0,d,c,0/0,0/0,0/0,0/0,(r[0]-n)/a,(r[1]-s)/o],e),e+=24}}class nJ extends nX{#s3;#ab=new Float32Array(4);#s4;#s9;#aa;#an;#av;constructor(t,e,i,r,n,s){super(),this.#av=t,this.#aa=e,this.#s3=i,this.#an=r,this.#s4=n,this.#s9=s,this.firstPoint=[0/0,0/0],this.lastPoint=[0/0,0/0],this.#ay(s);let[a,o,l,h]=this.#ab;for(let e=0,i=t.length;e<i;e+=2)t[e]=(t[e]-a)/l,t[e+1]=(t[e+1]-o)/h;for(let t=0,i=e.length;t<i;t+=2)e[t]=(e[t]-a)/l,e[t+1]=(e[t+1]-o)/h}toSVGPath(){let t=[`M${this.#av[4]} ${this.#av[5]}`];for(let e=6,i=this.#av.length;e<i;e+=6){if(isNaN(this.#av[e])){t.push(`L${this.#av[e+4]} ${this.#av[e+5]}`);continue}t.push(`C${this.#av[e]} ${this.#av[e+1]} ${this.#av[e+2]} ${this.#av[e+3]} ${this.#av[e+4]} ${this.#av[e+5]}`)}return t.push("Z"),t.join(" ")}serialize([t,e,i,r],n){let s,a,o=i-t,l=r-e;switch(n){case 0:s=nX._rescale(this.#av,t,r,o,-l),a=nX._rescale(this.#aa,t,r,o,-l);break;case 90:s=nX._rescaleAndSwap(this.#av,t,e,o,l),a=nX._rescaleAndSwap(this.#aa,t,e,o,l);break;case 180:s=nX._rescale(this.#av,i,e,-o,l),a=nX._rescale(this.#aa,i,e,-
46o,l);break;case 270:s=nX._rescaleAndSwap(this.#av,i,r,-o,-l),a=nX._rescaleAndSwap(this.#aa,i,r,-o,-l)}return{outline:Array.from(s),points:[Array.from(a)]}}#ay(t){let e=this.#av,i=e[4],r=e[5],n=[i,r,i,r],s=i,a=r,o=i,l=r,h=t?Math.max:Math.min,d=new Float32Array(4);for(let t=6,c=e.length;t<c;t+=6){let c=e[t+4],u=e[t+5];isNaN(e[t])?(eT.pointBoundingBox(c,u,n),a>u?(s=c,a=u):a===u&&(s=h(s,c)),l<u?(o=c,l=u):l===u&&(o=h(o,c))):(d.set(t6,0),eT.bezierBoundingBox(i,r,...e.slice(t,t+6),d),eT.rectBoundingBox(...d,n),a>d[1]?(s=d[0],a=d[1]):a===d[1]&&(s=h(s,d[0])),l<d[3]?(o=d[2],l=d[3]):l===d[3]&&(o=h(o,d[2]))),i=c,r=u}let c=this.#ab;c[0]=n[0]-this.#s4,c[1]=n[1]-this.#s4,c[2]=n[2]-n[0]+2*this.#s4,c[3]=n[3]-n[1]+2*this.#s4,this.firstPoint=[s,a],this.lastPoint=[o,l]}get box(){return this.#ab}newOutliner(t,e,i,r,n,s=0){return new nY(t,e,i,r,n,s)}getNewOutline(t,e){let[i,r,n,s]=this.#ab,[a,o,l,h]=this.#s3,d=n*l,c=s*h,u=i*l+a,p=r*h+o,g=this.newOutliner({x:this.#aa[0]*d+u,y:this.#aa[1]*c+p},this.#s3,this.#an,t,this.#s9,e??this.#s4);for(let t=2;t<this.#aa.length;t+=2)g.add({x:this.#aa[t]*d+u,y:this.#aa[t+1]*c+p});return g.getOutlines()}}class nQ{#s3;#aw;#ax;#aA=[];#aS=[];constructor(t,e=0,i=0,r=!0){let n=t6.slice();for(let{x:i,y:r,width:s,height:a}of t){let t=1e-4*Math.floor((i-e)/1e-4),o=1e-4*Math.ceil((i+s+e)/1e-4),l=1e-4*Math.floor((r-e)/1e-4),h=1e-4*Math.ceil((r+a+e)/1e-4),d=[t,l,h,!0],c=[o,l,h,!1];this.#aA.push(d,c),eT.rectBoundingBox(t,l,o,h,n)}let s=n[2]-n[0]+2*i,a=n[3]-n[1]+2*i,o=n[0]-i,l=n[1]-i,h=r?-1/0:1/0,d=1/0,c=this.#aA.at(r?-1:-2),u=[c[0],c[2]];for(let t of this.#aA){let[e,i,n,c]=t;!c&&r?i<d?(d=i,h=e):i===d&&(h=Math.max(h,e)):c&&!r&&(i<d?(d=i,h=e):i===d&&(h=Math.min(h,e))),t[0]=(e-o)/s,t[1]=(i-l)/a,t[2]=(n-l)/a}this.#s3=new Float32Array([o,l,s,a]),this.#aw=[h,d],this.#ax=u}getOutlines(){this.#aA.sort((t,e)=>t[0]-e[0]||t[1]-e[1]||t[2]-e[2]);let t=[];for(let e of this.#aA)e[3]?(t.push(...this.#aT(e)),this.#a_(e)):(this.#aE(e),t.push(...this.#aT(e)));return this.#aC(t)}#aC(t){let e,i=[],r=new Set;for(let e of t){let[t,r,n]=e;i.push([t,r,e],[t,n,e])}i.sort((t,e)=>t[1]-e[1]||t[0]-e[0]);for(let t=0,e=i.length;t<e;t+=2){let e=i[t][2],n=i[t+1][2];e.push(n),n.push(e),r.add(e),r.add(n)}let n=[];for(;r.size>0;){let t=r.values().next().value,[i,s,a,o,l]=t;r.delete(t);let h=i,d=s;for(e=[i,a],n.push(e);;){let t;if(r.has(o))t=o;else if(r.has(l))t=l;else break;r.delete(t),[i,s,a,o,l]=t,h!==i&&(e.push(h,d,i,d===s?s:a),h=i),d=d===s?a:s}e.push(h,d)}return new nZ(n,this.#s3,this.#aw,this.#ax)}#ak(t){let e=this.#aS,i=0,r=e.length-1;for(;i<=r;){let n=i+r>>1,s=e[n][0];if(s===t)return n;s<t?i=n+1:r=n-1}return r+1}#a_([,t,e]){let i=this.#ak(t);this.#aS.splice(i,0,[t,e])}#aE([,t,e]){let i=this.#ak(t);for(let r=i;r<this.#aS.length;r++){let[i,n]=this.#aS[r];if(i!==t)break;if(i===t&&n===e)return void this.#aS.splice(r,1)}for(let r=i-1;r>=0;r--){let[i,n]=this.#aS[r];if(i!==t)break;if(i===t&&n===e)return void this.#aS.splice(r,1)}}#aT(t){let[e,i,r]=t,n=[[e,i,r]],s=this.#ak(r);for(let t=0;t<s;t++){let[i,r]=this.#aS[t];for(let t=0,s=n.length;t<s;t++){let[,a,o]=n[t];if(!(r<=a)&&!(o<=i)){if(a>=i){if(o>r)n[t][1]=r;else{if(1===s)return[];n.splice(t,1),t--,s--}continue}n[t][2]=i,o>r&&n.push([e,r,o])}}}return n}}class nZ extends nX{#s3;#aP;constructor(t,e,i,r){super(),this.#aP=t,this.#s3=e,this.firstPoint=i,this.lastPoint=r}toSVGPath(){let t=[];for(let e of this.#aP){let[i,r]=e;t.push(`M${i} ${r}`);for(let n=2;n<e.length;n+=2){let s=e[n],a=e[n+1];s===i?(t.push(`V${a}`),r=a):a===r&&(t.push(`H${s}`),i=s)}t.push("Z")}return t.join(" ")}serialize([t,e,i,r],n){let s=[],a=i-t,o=r-e;for(let e of this.#aP){let i=Array(e.length);for(let n=0;n<e.length;n+=2)i[n]=t+e[n]*a,i[n+1]=r-e[n+1]*o;s.push(i)}return s}get box(){return this.#s3}get classNamesForOutlining(){return["highlightOutline"]}}class n0 extends nY{newFreeDrawOutline(t,e,i,r,n,s){return new n1(t,e,i,r,n,s)}}class n1 extends nJ{newOutliner(t,e,i,r,n,s=0){return new n0(t,e,i,r,n,s)}}class n2 extends iu{#aM=null;#aD=0;#aI;#aR=null;#s=null;#aF=null;#aB=null;#aO=0;#aL=null;#aN=null;#E=null;#aU=!1;#aw=null;#ax=null;#aj=null;#eo="";#as;#az="";static _defaultColor=null;static _defaultOpacity=1;static _defaultThickness=12;static _type="highlight";static _editorType=et.HIGHLIGHT;static _freeHighlightId=-1;static _freeHighlight=null;static _freeHighlightClipId="";static get _keyboardManager(){let t=n2.prototype;return eg(this,"_keyboardManager",new ia([[["ArrowLeft","mac+ArrowLeft"],t._moveCaret,{args:[0]}],[["ArrowRight","mac+ArrowRight"],t._moveCaret,{args:[1]}],[["ArrowUp","mac+ArrowUp"],t._moveCaret,{args:[2]}],[["ArrowDown","mac+ArrowDown"],t._moveCaret,{args:[3]}]]))}constructor(t){super({...t,name:"highlightEditor"}),this.color=t.color||n2._defaultColor,this.#as=t.thickness||n2._defaultThickness,this.opacity=t.opacity||n2._defaultOpacity,this.#aI=t.boxes||null,this.#az=t.methodOfCreation||"",this.#eo=t.text||"",this._isDraggable=!1,this.defaultL10nId="pdfjs-editor-highlight-editor",t.highlightId>-1?(this.#aU=!0,this.#aH(t),this.#a$()):this.#aI&&(this.#aM=t.anchorNode,this.#aD=t.anchorOffset,this.#aB=t.focusNode,this.#aO=t.focusOffset,this.#aV(),this.#a$(),this.rotate(this.rotation)),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-highlight-added-alert")}get telemetryInitialData(){return{action:"added",type:this.#aU?"free_highlight":"highlight",color:this._uiManager.getNonHCMColorName(this.color),thickness:this.#as,methodOfCreation:this.#az}}get telemetryFinalData(){return{type:"highlight",color:this._uiManager.getNonHCMColorName(this.color)}}static computeTelemetryFinalData(t){return{numberOfColors:t.get("color").size}}#aV(){let t=new nQ(this.#aI,.001);this.#aN=t.getOutlines(),[this.x,this.y,this.width,this.height]=this.#aN.box;let e=new nQ(this.#aI,.0025,.001,"ltr"===this._uiManager.direction);this.#aF=e.getOutlines();let{firstPoint:i}=this.#aN;this.#aw=[(i[0]-this.x)/this.width,(i[1]-this.y)/this.height];let{lastPoint:r}=this.#aF;this.#ax=[(r[0]-this.x)/this.width,(r[1]-this.y)/this.height]}#aH({highlightOutlines:t,highlightId:e,clipPathId:i}){if(this.#aN=t,this.#aF=t.getNewOutline(this.#as/2+1.5,.0025),e>=0)this.#E=e,this.#aR=i,this.parent.drawLayer.finalizeDraw(e,{bbox:t.box,path:{d:t.toSVGPath()}}),this.#aj=this.parent.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:!0},bbox:this.#aF.box,path:{d:this.#aF.toSVGPath()}},!0);else if(this.parent){let e=this.parent.viewport.rotation;this.parent.drawLayer.updateProperties(this.#E,{bbox:n2.#aW(this.#aN.box,(e-this.rotation+360)%360),path:{d:t.toSVGPath()}}),this.parent.drawLayer.updateProperties(this.#aj,{bbox:n2.#aW(this.#aF.box,e),path:{d:this.#aF.toSVGPath()}})}let[r,n,s,a]=t.box;switch(this.rotation){case 0:this.x=r,this.y=n,this.width=s,this.height=a;break;case 90:{let[t,e]=this.parentDimensions;this.x=n,this.y=1-r,this.width=s*e/t,this.height=a*t/e;break}case 180:this.x=1-r,this.y=1-n,this.width=s,this.height=a;break;case 270:{let[t,e]=this.parentDimensions;this.x=1-n,this.y=r,this.width=s*e/t,this.height=a*t/e}}let{firstPoint:o}=t;this.#aw=[(o[0]-r)/s,(o[1]-n)/a];let{lastPoint:l}=this.#aF;this.#ax=[(l[0]-r)/s,(l[1]-n)/a]}static initialize(t,e){iu.initialize(t,e),n2._defaultColor||=e.highlightColors?.values().next().value||"#fff066"}static updateDefaultParams(t,e){switch(t){case ee.HIGHLIGHT_COLOR:n2._defaultColor=e;break;case ee.HIGHLIGHT_THICKNESS:n2._defaultThickness=e}}translateInPage(t,e){}get toolbarPosition(){return this.#ax}get commentButtonPosition(){return this.#aw}updateParams(t,e){switch(t){case ee.HIGHLIGHT_COLOR:this.#sS(e);break;case ee.HIGHLIGHT_THICKNESS:this.#aG(e)}}static get defaultPropertiesToUpdate(){return[[ee.HIGHLIGHT_COLOR,n2._defaultColor],[ee.HIGHLIGHT_THICKNESS,n2._defaultThickness]]}get propertiesToUpdate(){return[[ee.HIGHLIGHT_COLOR,this.color||n2._defaultColor],[ee.HIGHLIGHT_THICKNESS,this.#as||n2._defaultThickness],[ee.HIGHLIGHT_FREE,this.#aU]]}onUpdatedColor(){this.parent?.drawLayer.updateProperties(this.#E,{root:{fill:this.color,"fill-opacity":this.opacity}}),this.#s?.updateColor(this.color),super.onUpdatedColor()}#sS(t){let e=(t,e)=>{this.color=t,this.opacity=e,this.onUpdatedColor()},i=this.color,r=this.opacity;this.addCommands({cmd:e.bind(this,t,n2._defaultOpacity),undo:e.bind(this,i,r),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:ee.HIGHLIGHT_COLOR,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"color_changed",color:this._uiManager.getNonHCMColorName(t)},!0)}#aG(t){let e=this.#as,i=t=>{this.#as=t,this.#aq(t)};this.addCommands({cmd:i.bind(this,t),undo:i.bind(this,e),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:ee.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0}),this._reportTelemetry({action:"thickness_changed",thickness:t},!0)}get toolbarButtons(){return this._uiManager.highlightColors?[["colorPicker",this.#s=new nh({editor:this})]]:super.toolbarButtons}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}fixAndSetPosition(){return super.fixAndSetPosition(this.#aK())}getBaseTranslation(){return[0,0]}getRect(t,e){return super.getRect(t,e,this.#aK())}onceAdded(t){this.annotationElementId||this.parent.addUndoableEditor(this),t&&this.div.focus()}remove(){this.#aX(),this._reportTelemetry({action:"deleted"}),super.remove()}rebuild(){!this.parent||(super.rebuild(),null!==this.div&&(this.#a$(),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){let e=!1;this.parent&&!t?this.#aX():t&&(this.#a$(t),e=!this.parent&&this.div?.classList.contains("selectedEditor")),super.setParent(t),this.show(this._isVisible),e&&this.select()}#aq(t){this.#aU&&(this.#aH({highlightOutlines:this.#aN.getNewOutline(t/2)}),this.fixAndSetPosition(),this.setDims())}#aX(){null!==this.#E&&this.parent&&(this.parent.drawLayer.remove(this.#E),this.#E=null,this.parent.drawLayer.remove(this.#aj),this.#aj=null)}#a$(t=this.parent){null===this.#E&&({id:this.#E,clipPathId:this.#aR}=t.drawLayer.draw({bbox:this.#aN.box,root:{viewBox:"0 0 1 1",fill:this.color,"fill-opacity":this.opacity},rootClass:{highlight:!0,free:this.#aU},path:{d:this.#aN.toSVGPath()}},!1,!0),this.#aj=t.drawLayer.drawOutline({rootClass:{highlightOutline:!0,free:this.#aU},bbox:this.#aF.box,path:{d:this.#aF.toSVGPath()}},this.#aU),this.#aL&&(this.#aL.style.clipPath=this.#aR))}static #aW([t,e,i,r],n){switch(n){case 90:return[1-e-r,t,r,i];case 180:return[1-t-i,1-e-r,i,r];case 270:return[e,1-t-i,r,i]}return[t,e,i,r]}rotate(t){let e,{drawLayer:i}
46=this.parent;this.#aU?(t=(t-this.rotation+360)%360,e=n2.#aW(this.#aN.box,t)):e=n2.#aW([this.x,this.y,this.width,this.height],t),i.updateProperties(this.#E,{bbox:e,root:{"data-main-rotation":t}}),i.updateProperties(this.#aj,{bbox:n2.#aW(this.#aF.box,t),root:{"data-main-rotation":t}})}render(){if(this.div)return this.div;let t=super.render();this.#eo&&(t.setAttribute("aria-label",this.#eo),t.setAttribute("role","mark")),this.#aU?t.classList.add("free"):this.div.addEventListener("keydown",this.#aY.bind(this),{signal:this._uiManager._signal});let e=this.#aL=document.createElement("div");return t.append(e),e.setAttribute("aria-hidden","true"),e.className="internal",e.style.clipPath=this.#aR,this.setDims(),it(this,this.#aL,["pointerover","pointerleave"]),this.enableEditing(),t}pointerover(){this.isSelected||this.parent?.drawLayer.updateProperties(this.#aj,{rootClass:{hovered:!0}})}pointerleave(){this.isSelected||this.parent?.drawLayer.updateProperties(this.#aj,{rootClass:{hovered:!1}})}#aY(t){n2._keyboardManager.exec(this,t)}_moveCaret(t){switch(this.parent.unselect(this),t){case 0:case 2:this.#aJ(!0);break;case 1:case 3:this.#aJ(!1)}}#aJ(t){if(!this.#aM)return;let e=window.getSelection();t?e.setPosition(this.#aM,this.#aD):e.setPosition(this.#aB,this.#aO)}select(){super.select(),this.#aj&&this.parent?.drawLayer.updateProperties(this.#aj,{rootClass:{hovered:!1,selected:!0}})}unselect(){super.unselect(),this.#aj&&(this.parent?.drawLayer.updateProperties(this.#aj,{rootClass:{selected:!1}}),this.#aU||this.#aJ(!1))}get _mustFixPosition(){return!this.#aU}show(t=this._isVisible){super.show(t),this.parent&&(this.parent.drawLayer.updateProperties(this.#E,{rootClass:{hidden:!t}}),this.parent.drawLayer.updateProperties(this.#aj,{rootClass:{hidden:!t}}))}#aK(){return this.#aU?this.rotation:0}#aQ(){if(this.#aU)return null;let[t,e]=this.pageDimensions,[i,r]=this.pageTranslation,n=this.#aI,s=new Float32Array(8*n.length),a=0;for(let{x:o,y:l,width:h,height:d}of n){let n=o*t+i,c=(1-l)*e+r;s[a]=s[a+4]=n,s[a+1]=s[a+3]=c,s[a+2]=s[a+6]=n+h*t,s[a+5]=s[a+7]=c-d*e,a+=8}return s}#aZ(t){return this.#aN.serialize(t,this.#aK())}static startHighlighting(t,e,{target:i,x:r,y:n}){let{x:s,y:a,width:o,height:l}=i.getBoundingClientRect(),h=new AbortController,d=t.combinedSignal(h),c=e=>{h.abort(),this.#a0(t,e)};window.addEventListener("blur",c,{signal:d}),window.addEventListener("pointerup",c,{signal:d}),window.addEventListener("pointerdown",eW,{capture:!0,passive:!1,signal:d}),window.addEventListener("contextmenu",eV,{signal:d}),i.addEventListener("pointermove",this.#a1.bind(this,t),{signal:d}),this._freeHighlight=new n0({x:r,y:n},[s,a,o,l],t.scale,this._defaultThickness/2,e,.001),{id:this._freeHighlightId,clipPathId:this._freeHighlightClipId}=t.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:this._defaultColor,"fill-opacity":this._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:this._freeHighlight.toSVGPath()}},!0,!0)}static #a1(t,e){this._freeHighlight.add(e)&&t.drawLayer.updateProperties(this._freeHighlightId,{path:{d:this._freeHighlight.toSVGPath()}})}static #a0(t,e){this._freeHighlight.isEmpty()?t.drawLayer.remove(this._freeHighlightId):t.createAndAddNewEditor(e,!1,{highlightId:this._freeHighlightId,highlightOutlines:this._freeHighlight.getOutlines(),clipPathId:this._freeHighlightClipId,methodOfCreation:"main_toolbar"}),this._freeHighlightId=-1,this._freeHighlight=null,this._freeHighlightClipId=""}static async deserialize(t,e,i){let r=null;if(t instanceof nj){let{data:{quadPoints:e,rect:i,rotation:n,id:s,color:a,opacity:o,popupRef:l,richText:h,contentsObj:d,creationDate:c,modificationDate:u},parent:{page:{pageNumber:p}}}=t;r=t={annotationType:et.HIGHLIGHT,color:Array.from(a),opacity:o,quadPoints:e,boxes:null,pageIndex:p-1,rect:i.slice(0),rotation:n,annotationElementId:s,id:s,deleted:!1,popupRef:l,richText:h,comment:d?.str||null,creationDate:c,modificationDate:u}}else if(t instanceof nU){let{data:{inkLists:e,rect:i,rotation:n,id:s,color:a,borderStyle:{rawWidth:o},popupRef:l,richText:h,contentsObj:d,creationDate:c,modificationDate:u},parent:{page:{pageNumber:p}}}=t;r=t={annotationType:et.HIGHLIGHT,color:Array.from(a),thickness:o,inkLists:e,boxes:null,pageIndex:p-1,rect:i.slice(0),rotation:n,annotationElementId:s,id:s,deleted:!1,popupRef:l,richText:h,comment:d?.str||null,creationDate:c,modificationDate:u}}let{color:n,quadPoints:s,inkLists:a,outlines:o,opacity:l}=t,h=await super.deserialize(t,e,i);h.color=eT.makeHexColor(...n),h.opacity=l||1,a&&(h.#as=t.thickness),h._initialData=r,t.comment&&h.setCommentData(t);let[d,c]=h.pageDimensions,[u,p]=h.pageTranslation;if(s){let t=h.#aI=[];for(let e=0;e<s.length;e+=8)t.push({x:(s[e]-u)/d,y:1-(s[e+1]-p)/c,width:(s[e+2]-s[e])/d,height:(s[e+1]-s[e+5])/c});h.#aV(),h.#a$(),h.rotate(h.rotation)}else if(a||o){h.#aU=!0;let t=(a||o.points)[0],i={x:t[0]-u,y:c-(t[1]-p)},r=new n0(i,[0,0,d,c],1,h.#as/2,!0,.001);for(let e=0,n=t.length;e<n;e+=2)i.x=t[e]-u,i.y=c-(t[e+1]-p),r.add(i);let{id:n,clipPathId:s}=e.drawLayer.draw({bbox:[0,0,1,1],root:{viewBox:"0 0 1 1",fill:h.color,"fill-opacity":h._defaultOpacity},rootClass:{highlight:!0,free:!0},path:{d:r.toSVGPath()}},!0,!0);h.#aH({highlightOutlines:r.getOutlines(),highlightId:n,clipPathId:s}),h.#a$(),h.rotate(h.parentRotation)}return h}serialize(t=!1){if(this.isEmpty()||t)return null;if(this.deleted)return this.serializeDeleted();let e=iu._colorManager.convert(this._uiManager.getNonHCMColor(this.color)),i=super.serialize(t);return(Object.assign(i,{color:e,opacity:this.opacity,thickness:this.#as,quadPoints:this.#aQ(),outlines:this.#aZ(i.rect)}),this.addComment(i),this.annotationElementId&&!this.#s5(i))?null:(i.id=this.annotationElementId,i)}#s5(t){let{color:e}=this._initialData;return this.hasEditedComment||t.color.some((t,i)=>t!==e[i])}renderAnnotationElement(t){return this.deleted?t.hide():t.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null}static canCreateNewEmptyEditor(){return!1}}class n5{#a2=Object.create(null);updateProperty(t,e){this[t]=e,this.updateSVGProperty(t,e)}updateProperties(t){if(t)for(let[e,i]of Object.entries(t))e.startsWith("_")||this.updateProperty(e,i)}updateSVGProperty(t,e){this.#a2[t]=e}toSVGProperties(){let t=this.#a2;return this.#a2=Object.create(null),{root:t}}reset(){this.#a2=Object.create(null)}updateAll(t=this){this.updateProperties(t)}clone(){eh("Not implemented")}}class n3 extends iu{#a5=null;#a3;_colorPicker=null;_drawId=null;static _currentDrawId=-1;static _currentParent=null;static #a6=null;static #a4=null;static #a9=null;static _INNER_MARGIN=3;
46constructor(t){super(t),this.#a3=t.mustBeCommitted||!1,this._addOutlines(t)}onUpdatedColor(){this._colorPicker?.update(this.color),super.onUpdatedColor()}onUpdatedOpacity(){this._colorPicker?.updateOpacity?.(this.opacity)}_addOutlines(t){t.drawOutlines&&(this.#a8(t),this.#a$())}#a8({drawOutlines:t,drawId:e,drawingOptions:i}){this.#a5=t,this._drawingOptions||=i,this.annotationElementId||this._uiManager.a11yAlert(`pdfjs-editor-${this.editorType}-added-alert`),e>=0?(this._drawId=e,this.parent.drawLayer.finalizeDraw(e,t.defaultProperties)):this._drawId=this.#a7(t,this.parent),this.#ot(t.box)}#a7(t,e){let{id:i}=e.drawLayer.draw(n3._mergeSVGProperties(this._drawingOptions.toSVGProperties(),t.defaultSVGProperties),!1,!1);return i}static _mergeSVGProperties(t,e){let i=new Set(Object.keys(t));for(let[r,n]of Object.entries(e))i.has(r)?Object.assign(t[r],n):t[r]=n;return t}static getDefaultDrawingOptions(t){eh("Not implemented")}static get typesMap(){eh("Not implemented")}static get isDrawer(){return!0}static get supportMultipleDrawings(){return!1}static updateDefaultParams(t,e){let i=this.typesMap.get(t);i&&this._defaultDrawingOptions.updateProperty(i,e),this._currentParent&&(n3.#a6.updateProperty(i,e),this._currentParent.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}updateParams(t,e){let i=this.constructor.typesMap.get(t);i&&this._updateProperty(t,i,e)}static get defaultPropertiesToUpdate(){let t=[],e=this._defaultDrawingOptions;for(let[i,r]of this.typesMap)t.push([i,e[r]]);return t}get propertiesToUpdate(){let t=[],{_drawingOptions:e}=this;for(let[i,r]of this.constructor.typesMap)t.push([i,e[r]]);return t}_updateProperty(t,e,i){let r=this._drawingOptions,n=r[e],s=i=>{r.updateProperty(e,i);let n=this.#a5.updateProperty(e,i);n&&this.#ot(n),this.parent?.drawLayer.updateProperties(this._drawId,r.toSVGProperties()),t===this.colorType?this.onUpdatedColor():t===this.opacityType&&this.onUpdatedOpacity()};this.addCommands({cmd:s.bind(this,i),undo:s.bind(this,n),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:t,overwriteIfSameType:!0,keepUndo:!0})}_updateColorAndOpacity(t,e){let i=this.constructor.typesMap.get(this.colorType),r=this.constructor.typesMap.get(this.opacityType),n=this._drawingOptions,s=n[i],a=n[r],o=(t,e)=>{n.updateProperty(i,t),n.updateProperty(r,e),this.#a5.updateProperty(i,t),this.#a5.updateProperty(r,e),this.parent?.drawLayer.updateProperties(this._drawId,n.toSVGProperties()),this.onUpdatedColor(),this.onUpdatedOpacity()};this.addCommands({cmd:o.bind(this,t,e),undo:o.bind(this,s,a),post:this._uiManager.updateUI.bind(this._uiManager,this),mustExec:!0,type:ee.INK_COLOR_AND_OPACITY,overwriteIfSameType:!0,keepUndo:!0})}_onResizing(){this.parent?.drawLayer.updateProperties(this._drawId,n3._mergeSVGProperties(this.#a5.getPathResizingSVGProperties(this.#oe()),{bbox:this.#oi()}))}_onResized(){this.parent?.drawLayer.updateProperties(this._drawId,n3._mergeSVGProperties(this.#a5.getPathResizedSVGProperties(this.#oe()),{bbox:this.#oi()}))}_onTranslating(t,e){this.parent?.drawLayer.updateProperties(this._drawId,{bbox:this.#oi()})}_onTranslated(){this.parent?.drawLayer.updateProperties(this._drawId,n3._mergeSVGProperties(this.#a5.getPathTranslatedSVGProperties(this.#oe(),this.parentDimensions),{bbox:this.#oi()}))}_onStartDragging(){this.parent?.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!0}})}_onStopDragging(){this.parent?.drawLayer.updateProperties(this._drawId,{rootClass:{moving:!1}})}commit(){super.commit(),this.disableEditMode(),this.disableEditing()}disableEditing(){super.disableEditing(),this.div.classList.toggle("disabled",!0)}enableEditing(){super.enableEditing(),this.div.classList.toggle("disabled",!1)}getBaseTranslation(){return[0,0]}get isResizable(){return!0}onceAdded(t){this.annotationElementId||this.parent.addUndoableEditor(this),this._isDraggable=!0,this.#a3&&(this.#a3=!1,this.commit(),this.parent.setSelected(this),t&&this.isOnScreen&&this.div.focus())}remove(){this.#aX(),super.remove()}rebuild(){!this.parent||(super.rebuild(),null!==this.div&&(this.#a$(),this.#ot(this.#a5.box),this.isAttachedToDOM||this.parent.add(this)))}setParent(t){let e=!1;this.parent&&!t?(this._uiManager.removeShouldRescale(this),this.#aX()):t&&(this._uiManager.addShouldRescale(this),this.#a$(t),e=!this.parent&&this.div?.classList.contains("selectedEditor")),super.setParent(t),e&&this.select()}#aX(){null!==this._drawId&&this.parent&&(this.parent.drawLayer.remove(this._drawId),this._drawId=null,this._drawingOptions.reset())}#a$(t=this.parent){if(null===this._drawId||this.parent!==t){if(null!==this._drawId)return void this.parent.drawLayer.updateParent(this._drawId,t.drawLayer);this._drawingOptions.updateAll(),this._drawId=this.#a7(this.#a5,t)}}#or([t,e,i,r]){let{parentDimensions:[n,s],rotation:a}=this;switch(a){case 90:return[e,1-t,s/n*i,n/s*r];case 180:return[1-t,1-e,i,r];case 270:return[1-e,t,s/n*i,n/s*r];default:return[t,e,i,r]}}#oe(){let{x:t,y:e,width:i,height:r,parentDimensions:[n,s],rotation:a}=this;switch(a){case 90:return[1-e,t,n/s*i,s/n*r];case 180:return[1-t,1-e,i,r];case 270:return[e,1-t,n/s*i,s/n*r];default:return[t,e,i,r]}}#ot(t){[this.x,this.y,this.width,this.height]=this.#or(t),this.div&&(this.fixAndSetPosition(),this.setDims()),this._onResized()}#oi(){let{x:t,y:e,width:i,height:r,rotation:n,parentRotation:s,parentDimensions:[a,o]}=this;switch((4*n+s)/90){case 1:return[1-e-r,t,r,i];case 2:return[1-t-i,1-e-r,i,r];case 3:return[e,1-t-i,r,i];case 4:return[t,e-a/o*i,o/a*r,a/o*i];case 5:return[1-e,t,a/o*i,o/a*r];case 6:return[1-t-o/a*r,1-e,o/a*r,a/o*i];case 7:return[e-a/o*i,1-t-o/a*r,a/o*i,o/a*r];case 8:return[t-i,e-r,i,r];case 9:return[1-e,t-i,r,i];case 10:return[1-t,1-e,i,r];case 11:return[e-r,1-t,r,i];case 12:return[t-o/a*r,e,o/a*r,a/o*i];case 13:return[1-e-a/o*i,t-o/a*r,a/o*i,o/a*r];case 14:return[1-t,1-e-a/o*i,o/a*r,a/o*i];case 15:return[e,1-t,a/o*i,o/a*r];default:return[t,e,i,r]}}rotate(){this.parent&&this.parent.drawLayer.updateProperties(this._drawId,n3._mergeSVGProperties({bbox:this.#oi()},this.#a5.updateRotation((this.parentRotation-this.rotation+360)%360)))}onScaleChanging(){this.parent&&this.#ot(this.#a5.updateParentDimensions(this.parentDimensions,this.parent.scale))}static onScaleChangingWhenDrawing(){}render(){let t,e;if(this.div)return this.div;this._isCopy&&(t=this.x,e=this.y);let i=super.render();i.classList.add("draw");let r=document.createElement("div");return i.append(r),r.setAttribute("aria-hidden","true"),r.className="internal",this.setDims(),this._uiManager.addShouldRescale(this),this.disableEditing(),this._isCopy&&this._moveAfterPaste(t,e),i}static createDrawerInstance(t,e,i,r,n){eh("Not implemented")}static startDrawing(t,e,i,r){let{target:n,offsetX:s,offsetY:a,pointerId:o,pointerType:l}=r;if(ie.isInitializedAndDifferentPointerType(l))return;let{viewport:{rotation:h}}=t,{width:d,height:c}=n.getBoundingClientRect(),u=n3.#a4=new AbortController,p=t.combinedSignal(u);(ie.setPointer(l,o),window.addEventListener("pointerup",t=>{ie.isSamePointerIdOrRemove(t.pointerId)&&this._endDraw(t)},{signal:p}),window.addEventListener("pointercancel",t=>{ie.isSamePointerIdOrRemove(t.pointerId)&&this._currentParent.endDrawingSession()},{signal:p}),window.addEventListener("pointerdown",t=>{ie.isSamePointerType(t.pointerType)&&(ie.initializeAndAddPointerId(t.pointerId),n3.#a6.isCancellable()&&(n3.#a6.removeLastElement(),n3.#a6.isEmpty()?this._currentParent.endDrawingSession(!0):this._endDraw(null)))},{capture:!0,passive:!1,signal:p}),window.addEventListener("contextmenu",eV,{signal:p}),n.addEventListener("pointermove",this._drawMove.bind(this),{signal:p}),n.addEventListener("touchmove",t=>{ie.isSameTimeStamp(t.timeStamp)&&eW(t)},{signal:p}),t.toggleDrawing(),e._editorUndoBar?.hide(),n3.#a6)?t.drawLayer.updateProperties(this._currentDrawId,n3.#a6.startNew(s,a,d,c,h)):(e.updateUIForDefaultProperties(this),n3.#a6=this.createDrawerInstance(s,a,d,c,h),n3.#a9=this.getDefaultDrawingOptions(),this._currentParent=t,{id:this._currentDrawId}=t.drawLayer.draw(this._mergeSVGProperties(n3.#a9.toSVGProperties(),n3.#a6.defaultSVGProperties),!0,!1))}static _drawMove(t){if(ie.isSameTimeStamp(t.timeStamp),!n3.#a6)return;let{offsetX:e,offsetY:i,pointerId:r}=t;if(ie.isSamePointerId(r)){if(ie.isUsingMultiplePointers())return void this._endDraw(t);this._currentParent.drawLayer.updateProperties(this._currentDrawId,n3.#a6.add(e,i)),ie.setTimeStamp(t.timeStamp),eW(t)}}static _cleanup(t){t&&(this._currentDrawId=-1,this._currentParent=null,n3.#a6=null,n3.#a9=null,ie.clearTimeStamp()),n3.#a4&&(n3.#a4.abort(),n3.#a4=null,ie.clearPointerIds())}static _endDraw(t){let e=this._currentParent;if(e){if(e.toggleDrawing(!0),this._cleanup(!1),t?.target===e.div&&e.drawLayer.updateProperties(this._currentDrawId,n3.#a6.end(t.offsetX,t.offsetY)),this.supportMultipleDrawings){let t=n3.#a6,i=this._currentDrawId,r=t.getLastElement();e.addCommands({cmd:()=>{e.drawLayer.updateProperties(i,t.setLastElement(r))},undo:()=>{e.drawLayer.updateProperties(i,t.removeLastElement())},mustExec:!1,type:ee.DRAW_STEP});return}this.endDrawing(!1)}}static endDrawing(t){let e=this._currentParent;if(!e)return null;if(e.toggleDrawing(!0),e.cleanUndoStack(ee.DRAW_STEP),!n3.#a6.isEmpty()){let{pageDimensions:[i,r],scale:n}=e,s=e.createAndAddNewEditor({offsetX:0,offsetY:0},!1,{drawId:this._currentDrawId,drawOutlines:n3.#a6.getOutlines(i*n,r*n,n,this._INNER_MARGIN),drawingOptions:n3.#a9,mustBeCommitted:!t});return this._cleanup(!0),s}return e.drawLayer.remove(this._currentDrawId),this._cleanup(!0),null}createDrawingOptions(t){}static deserializeDraw(t,e,i,r,n,s){eh("Not implemented")}static async deserialize(t,e,i){let{rawDims:{pageWidth:r,pageHeight:n,pageX:s,pageY:a}}=e.viewport,o=this.deserializeDraw(s,a,r,n,this._INNER_MARGIN,t),l=await super.deserialize(t,e,i);return l.createDrawingOptions(t),l.#a8({drawOutlines:o}),l.#a$(),l.onScaleChanging(),l.rotate(),l}serializeDraw(t){let[e,i]=this.pageTranslation,[r,n]=this.pageDimensions;return this.#a5.serialize([e,i,r,n],t)}renderAnnotationElement(t){return t.updateEdited({rect:this.getPDFRect()}),null}static canCreateNewEmptyEditor(){return!1}}class n6{#s7=new Float64Array(6);#sM;#on;#r3;#as;#aa;#os="";#oa=0;#aP=new n4;#oo;#ol;constructor(t,e,i,r,n,s){this.#oo=i,this.#ol=r,this.#r3=n,this.#as=s,[t,e]=this.#oh(t,e);let a=this.#sM=[0/0,0/0,0/0,0/0,t,e];this.#aa=[t,e],this.#on=[{line:a,points:this.#aa}],this.#s7.set(a,0)}updateProperty(t,e){"stroke-width"===t&&(this.#as=e)}#oh(t,e){return nX._normalizePoint(t,e,this.#oo,this.#ol,this.#r3)}
46isEmpty(){return!this.#on||0===this.#on.length}isCancellable(){return this.#aa.length<=10}add(t,e){[t,e]=this.#oh(t,e);let[i,r,n,s]=this.#s7.subarray(2,6),a=t-n,o=e-s;return 2>=Math.hypot(this.#oo*a,this.#ol*o)?null:((this.#aa.push(t,e),isNaN(i))?(this.#s7.set([n,s,t,e],2),this.#sM.push(0/0,0/0,0/0,0/0,t,e)):(isNaN(this.#s7[0])&&this.#sM.splice(6,6),this.#s7.set([i,r,n,s,t,e],0),this.#sM.push(...nX.createBezierPoints(i,r,n,s,t,e))),{path:{d:this.toSVGPath()}})}end(t,e){let i=this.add(t,e);return i||(2===this.#aa.length?{path:{d:this.toSVGPath()}}:null)}startNew(t,e,i,r,n){this.#oo=i,this.#ol=r,this.#r3=n,[t,e]=this.#oh(t,e);let s=this.#sM=[0/0,0/0,0/0,0/0,t,e];this.#aa=[t,e];let a=this.#on.at(-1);return a&&(a.line=new Float32Array(a.line),a.points=new Float32Array(a.points)),this.#on.push({line:s,points:this.#aa}),this.#s7.set(s,0),this.#oa=0,this.toSVGPath(),null}getLastElement(){return this.#on.at(-1)}setLastElement(t){return this.#on?(this.#on.push(t),this.#sM=t.line,this.#aa=t.points,this.#oa=0,{path:{d:this.toSVGPath()}}):this.#aP.setLastElement(t)}removeLastElement(){if(!this.#on)return this.#aP.removeLastElement();this.#on.pop(),this.#os="";for(let t=0,e=this.#on.length;t<e;t++){let{line:e,points:i}=this.#on[t];this.#sM=e,this.#aa=i,this.#oa=0,this.toSVGPath()}return{path:{d:this.#os}}}toSVGPath(){let t=nX.svgRound(this.#sM[4]),e=nX.svgRound(this.#sM[5]);if(2===this.#aa.length)return this.#os=`${this.#os} M ${t} ${e} Z`,this.#os;if(this.#aa.length<=6){let i=this.#os.lastIndexOf("M");this.#os=`${this.#os.slice(0,i)} M ${t} ${e}`,this.#oa=6}if(4===this.#aa.length){let t=nX.svgRound(this.#sM[10]),e=nX.svgRound(this.#sM[11]);return this.#os=`${this.#os} L ${t} ${e}`,this.#oa=12,this.#os}let i=[];0===this.#oa&&(i.push(`M ${t} ${e}`),this.#oa=6);for(let t=this.#oa,e=this.#sM.length;t<e;t+=6){let[e,r,n,s,a,o]=this.#sM.slice(t,t+6).map(nX.svgRound);i.push(`C${e} ${r} ${n} ${s} ${a} ${o}`)}return this.#os+=i.join(" "),this.#oa=this.#sM.length,this.#os}getOutlines(t,e,i,r){let n=this.#on.at(-1);return n.line=new Float32Array(n.line),n.points=new Float32Array(n.points),this.#aP.build(this.#on,t,e,i,this.#r3,this.#as,r),this.#s7=null,this.#sM=null,this.#on=null,this.#os=null,this.#aP}get defaultSVGProperties(){return{root:{viewBox:"0 0 10000 10000"},rootClass:{draw:!0},bbox:[0,0,1,1]}}}class n4 extends nX{#ab;#od=0;#s4;#on;#oo;#ol;#oc;#r3;#as;build(t,e,i,r,n,s,a){this.#oo=e,this.#ol=i,this.#oc=r,this.#r3=n,this.#as=s,this.#s4=a??0,this.#on=t,this.#ou()}get thickness(){return this.#as}setLastElement(t){return this.#on.push(t),{path:{d:this.toSVGPath()}}}removeLastElement(){return this.#on.pop(),{path:{d:this.toSVGPath()}}}toSVGPath(){let t=[];for(let{line:e}of this.#on){if(t.push(`M${nX.svgRound(e[4])} ${nX.svgRound(e[5])}`),6===e.length){t.push("Z");continue}if(12===e.length&&isNaN(e[6])){t.push(`L${nX.svgRound(e[10])} ${nX.svgRound(e[11])}`);continue}for(let i=6,r=e.length;i<r;i+=6){let[r,n,s,a,o,l]=e.subarray(i,i+6).map(nX.svgRound);t.push(`C${r} ${n} ${s} ${a} ${o} ${l}`)}}return t.join("")}serialize([t,e,i,r],n){let s,a,o,l,h,d,c,u,p,g=[],m=[],[f,b,v,y]=this.#op();switch(this.#r3){case 0:p=nX._rescale,s=t,a=e+r,o=i,l=-r,h=t+f*i,d=e+(1-b-y)*r,c=t+(f+v)*i,u=e+(1-b)*r;break;case 90:p=nX._rescaleAndSwap,s=t,a=e,o=i,l=r,h=t+b*i,d=e+f*r,c=t+(b+y)*i,u=e+(f+v)*r;break;case 180:p=nX._rescale,s=t+i,a=e,o=-i,l=r,h=t+(1-f-v)*i,d=e+b*r,c=t+(1-f)*i,u=e+(b+y)*r;break;case 270:p=nX._rescaleAndSwap,s=t+i,a=e+r,o=-i,l=-r,h=t+(1-b-y)*i,d=e+(1-f-v)*r,c=t+(1-b)*i,u=e+(1-f)*r}for(let{line:t,points:e}of this.#on)g.push(p(t,s,a,o,l,n?Array(t.length):null)),m.push(p(e,s,a,o,l,n?Array(e.length):null));return{lines:g,points:m,rect:[h,d,c,u]}}static deserialize(t,e,i,r,n,{paths:{lines:s,points:a},rotation:o,thickness:l}){let h,d,c,u,p,g=[];switch(o){case 0:p=nX._rescale,h=-t/i,d=e/r+1,c=1/i,u=-1/r;break;case 90:p=nX._rescaleAndSwap,h=-e/r,d=-t/i,c=1/r,u=1/i;break;case 180:p=nX._rescale,h=t/i+1,d=-e/r,c=-1/i,u=1/r;break;case 270:p=nX._rescaleAndSwap,h=e/r+1,d=t/i+1,c=-1/r,u=-1/i}if(!s)for(let t of(s=[],a)){let e=t.length;if(2===e){s.push(new Float32Array([0/0,0/0,0/0,0/0,t[0],t[1]]));continue}if(4===e){s.push(new Float32Array([0/0,0/0,0/0,0/0,t[0],t[1],0/0,0/0,0/0,0/0,t[2],t[3]]));continue}let i=new Float32Array(3*(e-2));s.push(i);let[r,n,a,o]=t.subarray(0,4);i.set([0/0,0/0,0/0,0/0,r,n],0);for(let s=4;s<e;s+=2){let e=t[s],l=t[s+1];i.set(nX.createBezierPoints(r,n,a,o,e,l),(s-2)*3),[r,n,a,o]=[a,o,e,l]}}for(let t=0,e=s.length;t<e;t++)g.push({line:p(s[t].map(t=>t??0/0),h,d,c,u),points:p(a[t].map(t=>t??0/0),h,d,c,u)});let m=new this.prototype.constructor;return m.build(g,i,r,1,o,l,n),m}#og(t=this.#as){let e=this.#s4+t/2*this.#oc;return this.#r3%180==0?[e/this.#oo,e/this.#ol]:[e/this.#ol,e/this.#oo]}#op(){let[t,e,i,r]=this.#ab,[n,s]=this.#og(0);return[t+n,e+s,i-2*n,r-2*s]}#ou(){let t=this.#ab=t4.slice();for(let{line:e}
46of this.#on){if(e.length<=12){for(let i=4,r=e.length;i<r;i+=6)eT.pointBoundingBox(e[i],e[i+1],t);continue}let i=e[4],r=e[5];for(let n=6,s=e.length;n<s;n+=6){let[s,a,o,l,h,d]=e.subarray(n,n+6);eT.bezierBoundingBox(i,r,s,a,o,l,h,d,t),i=h,r=d}}let[e,i]=this.#og();t[0]=eI(t[0]-e,0,1),t[1]=eI(t[1]-i,0,1),t[2]=eI(t[2]+e,0,1),t[3]=eI(t[3]+i,0,1),t[2]-=t[0],t[3]-=t[1]}get box(){return this.#ab}updateProperty(t,e){return"stroke-width"===t?this.#aG(e):null}#aG(t){let[e,i]=this.#og();this.#as=t;let[r,n]=this.#og(),[s,a]=[r-e,n-i],o=this.#ab;return o[0]-=s,o[1]-=a,o[2]+=2*s,o[3]+=2*a,o}updateParentDimensions([t,e],i){let[r,n]=this.#og();this.#oo=t,this.#ol=e,this.#oc=i;let[s,a]=this.#og(),o=s-r,l=a-n,h=this.#ab;return h[0]-=o,h[1]-=l,h[2]+=2*o,h[3]+=2*l,h}updateRotation(t){return this.#od=t,{path:{transform:this.rotationTransform}}}get viewBox(){return this.#ab.map(nX.svgRound).join(" ")}get defaultProperties(){let[t,e]=this.#ab;return{root:{viewBox:this.viewBox},path:{"transform-origin":`${nX.svgRound(t)} ${nX.svgRound(e)}`}}}get rotationTransform(){let[,,t,e]=this.#ab,i=0,r=0,n=0,s=0,a=0,o=0;switch(this.#od){case 90:r=e/t,n=-t/e,a=t;break;case 180:i=-1,s=-1,a=t,o=e;break;case 270:r=-e/t,n=t/e,o=e;break;default:return""}return`matrix(${i} ${r} ${n} ${s} ${nX.svgRound(a)} ${nX.svgRound(o)})`}getPathResizingSVGProperties([t,e,i,r]){let[n,s]=this.#og(),[a,o,l,h]=this.#ab;if(Math.abs(l-n)<=nX.PRECISION||Math.abs(h-s)<=nX.PRECISION){let n=t+i/2-(a+l/2),s=e+r/2-(o+h/2);return{path:{"transform-origin":`${nX.svgRound(t)} ${nX.svgRound(e)}`,transform:`${this.rotationTransform} translate(${n} ${s})`}}}let d=(i-2*n)/(l-2*n),c=(r-2*s)/(h-2*s);return{path:{"transform-origin":`${nX.svgRound(a)} ${nX.svgRound(o)}`,transform:`${this.rotationTransform} scale(${l/i} ${h/r}) translate(${nX.svgRound(n)} ${nX.svgRound(s)}) scale(${d} ${c}) translate(${nX.svgRound(-n)} ${nX.svgRound(-s)})`}}}getPathResizedSVGProperties([t,e,i,r]){let[n,s]=this.#og(),a=this.#ab,[o,l,h,d]=a;if(a[0]=t,a[1]=e,a[2]=i,a[3]=r,Math.abs(h-n)<=nX.PRECISION||Math.abs(d-s)<=nX.PRECISION){let n=t+i/2-(o+h
46/2),s=e+r/2-(l+d/2);for(let{line:t,points:e}of this.#on)nX._translate(t,n,s,t),nX._translate(e,n,s,e);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${nX.svgRound(t)} ${nX.svgRound(e)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}let c=(i-2*n)/(h-2*n),u=(r-2*s)/(d-2*s),p=-c*(o+n)+t+n,g=-u*(l+s)+e+s;if(1!==c||1!==u||0!==p||0!==g)for(let{line:t,points:e}of this.#on)nX._rescale(t,p,g,c,u,t),nX._rescale(e,p,g,c,u,e);return{root:{viewBox:this.viewBox},path:{"transform-origin":`${nX.svgRound(t)} ${nX.svgRound(e)}`,transform:this.rotationTransform||null,d:this.toSVGPath()}}}getPathTranslatedSVGProperties([t,e],i){let[r,n]=i,s=this.#ab,a=t-s[0],o=e-s[1];if(this.#oo===r&&this.#ol===n)for(let{line:t,points:e}of this.#on)nX._translate(t,a,o,t),nX._translate(e,a,o,e);else{let t=this.#oo/r,e=this.#ol/n;for(let{line:i,points:s}of(this.#oo=r,this.#ol=n,this.#on))nX._rescale(i,a,o,t,e,i),nX._rescale(s,a,o,t,e,s);s[2]*=t,s[3]*=e}return s[0]=t,s[1]=e,{root:{viewBox:this.viewBox},path:{d:this.toSVGPath(),"transform-origin":`${nX.svgRound(t)} ${nX.svgRound(e)}`}}}get defaultSVGProperties(){let t=this.#ab;return{root:{viewBox:this.viewBox},rootClass:{draw:!0},path:{d:this.toSVGPath(),"transform-origin":`${nX.svgRound(t[0])} ${nX.svgRound(t[1])}`,transform:this.rotationTransform||null},bbox:t}}}class n9 extends n5{constructor(t){super(),this._viewParameters=t,super.updateProperties({fill:"none",stroke:iu._defaultLineColor,"stroke-opacity":1,"stroke-width":1,"stroke-linecap":"round","stroke-linejoin":"round","stroke-miterlimit":10})}updateSVGProperty(t,e){"stroke-width"===t&&(e??=this["stroke-width"],e*=this._viewParameters.realScale),super.updateSVGProperty(t,e)}clone(){let t=new n9(this._viewParameters);return t.updateAll(this),t}}class n8 extends n3{static _type="ink";static _editorType=et.INK;static _defaultDrawingOptions=null;constructor(t){super({...t,name:"inkEditor"}),this._willKeepAspectRatio=!0,this.defaultL10nId="pdfjs-editor-ink-editor"}static initialize(t,e){iu.initialize(t,e),this._defaultDrawingOptions=new n9(e.viewParameters)}static getDefaultDrawingOptions(t){let e=this._defaultDrawingOptions.clone();return e.updateProperties(t),e}static get supportMultipleDrawings(){return!0}static get typesMap(){return eg(this,"typesMap",new Map([[ee.INK_THICKNESS,"stroke-width"],[ee.INK_COLOR,"stroke"],[ee.INK_OPACITY,"stroke-opacity"]]))}static createDrawerInstance(t,e,i,r,n){return new n6(t,e,i,r,n,this._defaultDrawingOptions["stroke-width"])}static deserializeDraw(t,e,i,r,n,s){return n4.deserialize(t,e,i,r,n,s)}static async deserialize(t,e,i){let r=null;if(t instanceof nU){let{data:{inkLists:e,rect:i,rotation:n,id:s,color:a,opacity:o,borderStyle:{rawWidth:l},popupRef:h,richText:d,contentsObj:c,creationDate:u,modificationDate:p},parent:{page:{pageNumber:g}}}=t;r=t={annotationType:et.INK,color:Array.from(a),thickness:l,opacity:o,paths:{points:e},boxes:null,pageIndex:g-1,rect:i.slice(0),rotation:n,annotationElementId:s,id:s,deleted:!1,popupRef:h,richText:d,comment:c?.str||null,creationDate:u,modificationDate:p}}let n=await super.deserialize(t,e,i);return n._initialData=r,t.comment&&n.setCommentData(t),n}get toolbarButtons(){return this._colorPicker||=new nd(this),[["colorPicker",this._colorPicker]]}get colorType(){return ee.INK_COLOR}get colorAndOpacityType(){return ee.INK_COLOR_AND_OPACITY}get opacityType(){return ee.INK_OPACITY}updateParams(t,e){t===ee.INK_COLOR_AND_OPACITY?this._updateColorAndOpacity(e.color,e.opacity):super.updateParams(t,e)}static updateDefaultParams(t,e){if(t===ee.INK_COLOR_AND_OPACITY){super.updateDefaultParams(ee.INK_COLOR,e.color),super.updateDefaultParams(ee.INK_OPACITY,e.opacity);return}super.updateDefaultParams(t,e)}get color(){return this._drawingOptions.stroke}get opacity(){return this._drawingOptions["stroke-opacity"]}onScaleChanging(){if(!this.parent)return;super.onScaleChanging();let{_drawId:t,_drawingOptions:e,parent:i}=this;e.updateSVGProperty("stroke-width"),i.drawLayer.updateProperties(t,e.toSVGProperties())}static onScaleChangingWhenDrawing(){let t=this._currentParent;t&&(super.onScaleChangingWhenDrawing(),this._defaultDrawingOptions.updateSVGProperty("stroke-width"),t.drawLayer.updateProperties(this._currentDrawId,this._defaultDrawingOptions.toSVGProperties()))}createDrawingOptions({color:t,thickness:e,opacity:i}){this._drawingOptions=n8.getDefaultDrawingOptions({stroke:eT.makeHexColor(...t),"stroke-width":e,"stroke-opacity":i})}serialize(t=!1){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let{lines:e,points:i}=this.serializeDraw(t),{_drawingOptions:{stroke:r,"stroke-opacity":n,"stroke-width":s}}=this,a=Object.assign(super.serialize(t),{color:iu._colorManager.convert(r),opacity:n,thickness:s,paths:{lines:e,points:i}});return(this.addComment(a),t)?(a.isCopy=!0,a):this.annotationElementId&&!this.#s5(a)?null:(a.id=this.annotationElementId,a)}#s5(t){let{color:e,thickness:i,opacity:r,pageIndex:n}=this._initialData;return this.hasEditedComment||this._hasBeenMoved||this._hasBeenResized||t.color.some((t,i)=>t!==e[i])||t.thickness!==i||t.opacity!==r||t.pageIndex!==n}renderAnnotationElement(t){if(this.deleted)return t.hide(),null;let{points:e,rect:i}=this.serializeDraw(!1);return t.updateEdited({rect:i,thickness:this._drawingOptions["stroke-width"],points:e,popup:this.comment}),null}}class n7 extends n4{toSVGPath(){let t=super.toSVGPath();return t.endsWith("Z")||(t+="Z"),t}}t5(5213);class st{static #om={maxDim:512,sigmaSFactor:.02,sigmaR:25,kernelSize:16};static #of(t,e,i,r){return(i-=t,r-=e,0===i)?r>0?0:4:1===i?r+6:2-r}static #ob=new Int32Array([0,1,-1,1,-1,0,-1,-1,0,-1,1,-1,1,0,1,1]);static #ov(t,e,i,r,n,s,a){let o=this.#of(i,r,n,s);for(let n=0;n<8;n++){let s=(-n+o-a+16)%8;if(0!==t[(i+this.#ob[2*s])*e+(r+this.#ob[2*s+1])])return s}return -1}static #oy(t,e,i,r,n,s,a){let o=this.#of(i,r,n,s);for(let n=0;n<8;n++){let s=(n+o+a+16)%8;if(0!==t[(i+this.#ob[2*s])*e+(r+this.#ob[2*s+1])])return s}return -1}static #ow(t,e,i,r){let n,s=t.length,a=new Int32Array(s);for(let e=0;e<s;e++)a[e]=+(t[e]<=r);for(let t=1;t<i-1;t++)a[t*e]=a[t*e+e-1]=0;for(let t=0;t<e;t++)a[t]=a[e*i-1-t]=0;let o=1,l=[];for(let t=1;t<i-1;t++){n=1;for(let i=1;i<e-1;i++){let r,s=t*e+i,h=a[s];if(0===h)continue;let d=t,c=i;if(1===h&&0===a[s-1])o+=1,c-=1;else if(h>=1&&0===a[s+1])o+=1,c+=1,h>1&&(n=h);else{1!==h&&(n=Math.abs(h));continue}let u=[i,t],p=c===i+1,g={isHole:p,points:u,id:o,parent:0};for(let t of(l.push(g),l))if(t.id===n){r=t;break}r?r.isHole?g.parent=p?r.parent:n:g.parent=p?n:r.parent:g.parent=p?n:0;let m=this.#ov(a,e,t,i,d,c,0);if(-1===m){a[s]=-o,1!==a[s]&&(n=Math.abs(a[s]));continue}let f=this.#ob[2*m],b=this.#ob[2*m+1],v=t+f,y=i+b;d=v,c=y;let w=t,x=i;for(;;){let r=this.#oy(a,e,w,x,d,c,1);f=this.#ob[2*r],b=this.#ob[2*r+1];let l=w+f,h=x+b;u.push(h,l);let p=w*e+x;if(0===a[p+1]?a[p]=-o:1===a[p]&&(a[p]=o),l===t&&h===i&&w===v&&x===y){1!==a[s]&&(n=Math.abs(a[s]));break}d=w,c=x,w=l,x=h}}}return l}static #ox(t,e,i,r){if(i-e<=4){for(let n=e;n<i-2;n+=2)r.push(t[n],t[n+1]);return}let n=t[e],s=t[e+1],a=t[i-4]-n,o=t[i-3]-s,l=Math.hypot(a,o),h=a/l,d=o/l,c=h*s-d*n,u=1/l,p=Math.atan(o/a),g=Math.cos(p),m=Math.sin(p),f=u*(Math.abs(g)+Math.abs(m)),b=u*(1-f+f**2),v=Math.max(Math.atan(Math.abs(m+g)*b),Math.atan(Math.abs(m-g)*b)),y=0,w=e;for(let r=e+2;r<i-2;r+=2){let e=Math.abs(c-h*t[r+1]+d*t[r]);e>y&&(w=r,y=e)}y>(l*v)**2?(this.#ox(t,e,w+2,r),this.#ox(t,w,i,r)):r.push(n,s)}static #oA(t){let e=[],i=t.length;return this.#ox(t,0,i,e),e.push(t[i-2],t[i-1]),e.length<=4?null:e}static #oS(t,e,i,r,n,s){let a=new Float32Array(s**2),o=-2*r**2,l=s>>1;for(let t=0;t<s;t++){let e=(t-l)**2;for(let i=0;i<s;i++)a[t*s+i]=Math.exp((e+(i-l)**2)/o)}let h=new Float32Array(256),d=-2*n**2;for(let t=0;t<256;t++)h[t]=Math.exp(t**2/d);let c=new Uint8Array(t.length),u=new Uint32Array(256);for(let r=0;r<i;r++)for(let n=0;n<e;n++){let o=r*e+n,d=t[o],p=0,g=0;for(let o=0;o<s;o++){let c=r+o-l;if(!(c<0)&&!(c>=i))for(let i=0;i<s;i++){let r=n+i-l;if(r<0||r>=e)continue;let u=t[c*e+r],m=a[o*s+i]*h[Math.abs(u-d)];p+=u*m,g+=m}}let m=c[o]=Math.round(p/g);u[m]++}return[c,u]}static #oT(t){let e=new Uint32Array(256);for(let i of t)e[i]++;return e}static #o_(t){let e=new Uint8ClampedArray(t.length>>2),i=-1/0,r=1/0;for(let n=0,s=e.length;n<s;n++){let s=e[n]=t[n<<2];i=Math.max(i,s),r=Math.min(r,s)}let n=255/(i-r);for(let t=0,i=e.length;t<i;t++)e[t]=(e[t]-r)*n;return e}static #oE(t){let e,i=-1/0,r=-1/0,n=t.findIndex(t=>0!==t),s=n,a=n;for(e=n;e<256;e++){let n=t[e];n>i&&(e-s>r&&(r=e-s,a=e-1),i=n,s=e)}for(e=a-1;e>=0&&!(t[e]>t[e+1]);e--);return e}static #oC(t){let e=t,{width:i,height:r}=t,{maxDim:n}=this.#om,s=i,a=r;if(i>n||r>n){let o=i,l=r,h=Math.log2(Math.max(i,r)/n),d=Math.floor(h);h=h===d?d-1:d;for(let i=0;i<h;i++){let i=new OffscreenCanvas(s=Math.ceil(o/2),a=Math.ceil(l/2));i.getContext("2d").drawImage(t,0,0,o,l,0,0,s,a),o=s,l=a,t!==e&&t.close(),t=i.transferToImageBitmap()}let c=Math.min(n/s,n/a);s=Math.round(s*c),a=Math.round(a*c)}let o=new OffscreenCanvas(s,a).getContext("2d",{willReadFrequently:!0});o.fillStyle="white",o.fillRect(0,0,s,a),o.filter="grayscale(1)",o.drawImage(t,0,0,t.width,t.height,0,0,s,a);let l=o.getImageData(0,0,s,a).data;return[this.#o_(l),s,a]}static extractContoursFromText(t,{fontFamily:e,fontStyle:i,fontWeight:r},n,s,a,o){let l=new OffscreenCanvas(1,1),h=l.getContext("2d",{alpha:!1}),d=h.font=`${i} ${r} 200px ${e}`,{actualBoundingBoxLeft:c,actualBoundingBoxRight:u,actualBoundingBoxAscent:p,actualBoundingBoxDescent:g,fontBoundingBoxAscent:m,fontBoundingBoxDescent:f,width:b}=h.measureText(t),v=Math.ceil(1.5*Math.max(Math.abs(c)+Math.abs(u)||0,b)),y=Math.ceil(1.5*Math.max(Math.abs(p)+Math.abs(g)||200,Math.abs(m)+Math.abs(f)||200));(h=(l=new OffscreenCanvas(v,y)).getContext("2d",{alpha:!0,willReadFrequently:!0})).font=d,h.filter="grayscale(1)",h.fillStyle="white",h.fillRect(0,0,v,y),h.fillStyle="black",h.fillText(t,.5*v/2,1.5*y/2);let w=this.#o_(h.getImageData(0,0,v,y).data),x=this.#oT(w),A=this.#oE(x),S=this.#ow(w,v,y,A);return this.processDrawnLines({lines:{curves:S,width:v,height:y},pageWidth:n,pageHeight:s,rotation:a,innerMargin:o,mustSmooth:!0,areContours:!0})}
46static process(t,e,i,r,n){let[s,a,o]=this.#oC(t),[l,h]=this.#oS(s,a,o,Math.hypot(a,o)*this.#om.sigmaSFactor,this.#om.sigmaR,this.#om.kernelSize),d=this.#oE(h),c=this.#ow(l,a,o,d);return this.processDrawnLines({lines:{curves:c,width:a,height:o},pageWidth:e,pageHeight:i,rotation:r,innerMargin:n,mustSmooth:!0,areContours:!0})}static processDrawnLines({lines:t,pageWidth:e,pageHeight:i,rotation:r,innerMargin:n,mustSmooth:s,areContours:a}){r%180!=0&&([e,i]=[i,e]);let{curves:o,width:l,height:h}=t,d=t.thickness??0,c=[],u=Math.min(e/l,i/h),p=u/e,g=u/i,m=[];for(let{points:t}of o){let e=s?this.#oA(t):t;if(!e)continue;m.push(e);let i=e.length,r=new Float32Array(i),n=new Float32Array(3*(2===i?2:i-2));if(c.push({line:n,points:r}),2===i){r[0]=e[0]*p,r[1]=e[1]*g,n.set([0/0,0/0,0/0,0/0,r[0],r[1]],0);continue}let[a,o,l,h]=e;a*=p,o*=g,l*=p,h*=g,r.set([a,o,l,h],0),n.set([0/0,0/0,0/0,0/0,a,o],0);for(let t=4;t<i;t+=2){let i=r[t]=e[t]*p,s=r[t+1]=e[t+1]*g;n.set(nX.createBezierPoints(a,o,l,h,i,s),(t-2)*3),[a,o,l,h]=[l,h,i,s]}}if(0===c.length)return null;let f=a?new n7:new n4;return f.build(c,e,i,1,r,a?0:d,n),{outline:f,newCurves:m,areContours:a,thickness:d,width:l,height:h}}static async compressSignature({outlines:t,areContours:e,thickness:i,width:r,height:n}){let s,a=1/0,o=-1/0,l=0;for(let e of t){l+=e.length;for(let t=2,i=e.length;t<i;t++){let i=e[t]-e[t-2];a=Math.min(a,i),o=Math.max(o,i)}}s=a>=-128&&o<=127?Int8Array:a>=-32768&&o<=32767?Int16Array:Int32Array;let h=t.length,d=8+3*h,c=new Uint32Array(d),u=0;for(let a of(c[u++]=d*Uint32Array.BYTES_PER_ELEMENT+(l-2*h)*s.BYTES_PER_ELEMENT,c[u++]=0,c[u++]=r,c[u++]=n,c[u++]=+!e,c[u++]=Math.max(0,Math.floor(i??0)),c[u++]=h,c[u++]=s.BYTES_PER_ELEMENT,t))c[u++]=a.length-2,c[u++]=a[0],c[u++]=a[1];let p=new CompressionStream("deflate-raw"),g=p.writable.getWriter();await g.ready,g.write(c);let m=s.prototype.constructor;for(let e of t){let t=new m(e.length-2);for(let i=2,r=e.length;i<r;i++)t[i-2]=e[i]-e[i-2];g.write(t)}return g.close(),(await new Response(p.readable).bytes()).toBase64()}static async decompressSignature(t){try{let e,i=Uint8Array.fromBase64(t),{readable:r,writable:n}=new DecompressionStream("deflate-raw"),s=n.getWriter();await s.ready,s.write(i).then(async()=>{await s.ready,await s.close()}).catch(()=>{});let a=null,o=0;for await(let t of r)(a||=new Uint8Array(new Uint32Array(t.buffer,0,4)[0])).set(t,o),o+=t.length;let l=new Uint32Array(a.buffer,0,a.length>>2),h=l[1];if(0!==h)throw Error(`Invalid version: ${h}`);let d=l[2],c=l[3],u=0===l[4],p=l[5],g=l[6],m=l[7],f=[],b=(8+3*g)*Uint32Array.BYTES_PER_ELEMENT;switch(m){case Int8Array.BYTES_PER_ELEMENT:e=new Int8Array(a.buffer,b);break;case Int16Array.BYTES_PER_ELEMENT:e=new Int16Array(a.buffer,b);break;case Int32Array.BYTES_PER_ELEMENT:e=new Int32Array(a.buffer,b)}o=0;for(let t=0;t<g;t++){let i=l[3*t+8],r=new Float32Array(i+2);f.push(r);for(let e=0;e<2;e++)r[e]=l[3*t+8+e+1];for(let t=0;t<i;t++)r[t+2]=r[t]+e[o++]}return{areContours:u,thickness:p,outlines:f,width:d,height:c}}catch(t){return el(`decompressSignature: ${t}`),null}}}class se extends n5{constructor(){super(),super.updateProperties({fill:iu._defaultLineColor,"stroke-width":0})}clone(){let t=new se;return t.updateAll(this),t}}class si extends n9{constructor(t){super(t),super.updateProperties({stroke:iu._defaultLineColor,"stroke-width":1})}clone(){let t=new si(this._viewParameters);return t.updateAll(this),t}}class sr extends n3{#ok=!1;#oP=null;#oM=null;#oD=null;static _type="signature";static _editorType=et.SIGNATURE;static _defaultDrawingOptions=null;constructor(t){super({...t,mustBeCommitted:!0,name:"signatureEditor"}),this._willKeepAspectRatio=!0,this.#oM=t.signatureData||null,this.#oP=null,this.defaultL10nId="pdfjs-editor-signature-editor1"}static initialize(t,e){iu.initialize(t,e),this._defaultDrawingOptions=new se,this._defaultDrawnSignatureOptions=new si(e.viewParameters)}static getDefaultDrawingOptions(t){let e=this._defaultDrawingOptions.clone();return e.updateProperties(t),e}static get supportMultipleDrawings(){return!1}static get typesMap(){return eg(this,"typesMap",new Map)}static get isDrawer(){return!1}get telemetryFinalData(){return{type:"signature",hasDescription:!!this.#oP}}static computeTelemetryFinalData(t){let e=t.get("hasDescription");return{hasAltText:e.get(!0)??0,hasNoAltText:e.get(!1)??0}}get isResizable(){return!0}onScaleChanging(){null!==this._drawId&&super.onScaleChanging()}render(){let t,e;if(this.div)return this.div;let{_isCopy:i}=this;if(i&&(this._isCopy=!1,t=this.x,e=this.y),super.render(),null===this._drawId)if(this.#oM){let{lines:t,mustSmooth:e,areContours:i,description:r,uuid:n,heightInPage:s}=this.#oM,{rawDims:{pageWidth:a,pageHeight:o},rotation:l}=this.parent.viewport,h=st.processDrawnLines({lines:t,pageWidth:a,pageHeight:o,rotation:l,innerMargin:sr._INNER_MARGIN,mustSmooth:e,areContours:i});this.addSignature(h,s,r,n)}else this.div.setAttribute("data-l10n-args",JSON.stringify({description:""})),this.div.hidden=!0,this._uiManager.getSignature(this);else this.div.setAttribute("data-l10n-args",JSON.stringify({description:this.#oP||""}));return i&&(this._isCopy=!0,this._moveAfterPaste(t,e)),this.div}setUuid(t){this.#oD=t,this.addEditToolbar()}getUuid(){return this.#oD}get description(){return this.#oP}set description(t){this.#oP=t,this.div&&(this.div.setAttribute("data-l10n-args",JSON.stringify({description:t})),super.addEditToolbar().then(e=>{e?.updateEditSignatureButton(t)}))}getSignaturePreview(){let{newCurves:t,areContours:e,thickness:i,width:r,height:n}=this.#oM,s=Math.max(r,n),a=st.processDrawnLines({lines:{curves:t.map(t=>({points:t})),thickness:i,width:r,height:n},pageWidth:s,pageHeight:s,rotation:0,innerMargin:0,mustSmooth:!1,areContours:e});return{areContours:e,outline:a.outline}}get toolbarButtons(){return this._uiManager.signatureManager?[["editSignature",this._uiManager.signatureManager]]:super.toolbarButtons}addSignature(t,e,i,r){let n,{x:s,y:a}=this,{outline:o}=this.#oM=t;this.#ok=o instanceof n7,this.description=i,this.#ok?n=sr.getDefaultDrawingOptions():(n=sr._defaultDrawnSignatureOptions.clone()).updateProperties({"stroke-width":o.thickness}),this._addOutlines({drawOutlines:o,drawingOptions:n});let[,l]=this.pageDimensions,h=e/l;h=h>=1?.5:h,this.width*=h/this.height,this.width>=1&&(h*=.9/this.width,this.width=.9),this.height=h,this.setDims(),this.x=s,this.y=a,this.center(),this._onResized(),this.onScaleChanging(),this.rotate(),this._uiManager.addToAnnotationStorage(this),this.setUuid(r),this._reportTelemetry({action:"pdfjs.signature.inserted",data:{hasBeenSaved:!!r,hasDescription:!!i}}),this.div.hidden=!1}getFromImage(t){let{rawDims:{pageWidth:e,pageHeight:i},rotation:r}=this.parent.viewport;
46return st.process(t,e,i,r,sr._INNER_MARGIN)}getFromText(t,e){let{rawDims:{pageWidth:i,pageHeight:r},rotation:n}=this.parent.viewport;return st.extractContoursFromText(t,e,i,r,n,sr._INNER_MARGIN)}getDrawnSignature(t){let{rawDims:{pageWidth:e,pageHeight:i},rotation:r}=this.parent.viewport;return st.processDrawnLines({lines:t,pageWidth:e,pageHeight:i,rotation:r,innerMargin:sr._INNER_MARGIN,mustSmooth:!1,areContours:!1})}createDrawingOptions({areContours:t,thickness:e}){t?this._drawingOptions=sr.getDefaultDrawingOptions():(this._drawingOptions=sr._defaultDrawnSignatureOptions.clone(),this._drawingOptions.updateProperties({"stroke-width":e}))}serialize(t=!1){if(this.isEmpty())return null;let{lines:e,points:i}=this.serializeDraw(t),{_drawingOptions:{"stroke-width":r}}=this,n=Object.assign(super.serialize(t),{isSignature:!0,areContours:this.#ok,color:[0,0,0],thickness:this.#ok?0:r});return this.addComment(n),t?(n.paths={lines:e,points:i},n.uuid=this.#oD,n.isCopy=!0):n.lines=e,this.#oP&&(n.accessibilityData={type:"Figure",alt:this.#oP}),n}static deserializeDraw(t,e,i,r,n,s){return s.areContours?n7.deserialize(t,e,i,r,n,s):n4.deserialize(t,e,i,r,n,s)}static async deserialize(t,e,i){let r=await super.deserialize(t,e,i);return r.#ok=t.areContours,r.description=t.accessibilityData?.alt||"",r.#oD=t.uuid,r}}class sn extends iu{#oI=null;#oR=null;#oF=null;#oB=null;#oO=null;#oL="";#oN=null;#oU=!1;#oj=null;#oz=!1;#oH=!1;static _type="stamp";static _editorType=et.STAMP;constructor(t){super({...t,name:"stampEditor"}),this.#oB=t.bitmapUrl,this.#oO=t.bitmapFile,this.defaultL10nId="pdfjs-editor-stamp-editor"}static initialize(t,e){iu.initialize(t,e)}static isHandlingMimeForPasting(t){return eZ.includes(t)}static paste(t,e){e.pasteEditor({mode:et.STAMP},{bitmapFile:t.getAsFile()})}altTextFinish(){this._uiManager.useNewAltTextFlow&&(this.div.hidden=!1),super.altTextFinish()}get telemetryFinalData(){return{type:"stamp",hasAltText:!!this.altTextData?.altText}}static computeTelemetryFinalData(t){let e=t.get("hasAltText");return{hasAltText:e.get(!0)??0,hasNoAltText:e.get(!1)??0}}#o$(t,e=!1){t?(this.#oI=t.bitmap,e||(this.#oR=t.id,this.#oz=t.isSvg),t.file&&(this.#oL=t.file.name),this.#oV()):this.remove()}#oW(){if(this.#oF=null,this._uiManager.enableWaiting(!1),this.#oN){if(this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&this.#oI)return void this.addEditToolbar().then(()=>{this._editToolbar.hide(),this._uiManager.editAltText(this,!0)});if(!this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&this.#oI){this._reportTelemetry({action:"pdfjs.image.image_added",data:{alt_text_modal:!1,alt_text_type:"empty"}});try{this.mlGuessAltText()}catch{}}this.div.focus()}}async mlGuessAltText(t=null,e=!0){if(this.hasAltTextData())return null;let{mlManager:i}=this._uiManager;if(!i)throw Error("No ML.");if(!await i.isEnabledFor("altText"))throw Error("ML isn't enabled for alt text.");let{data:r,width:n,height:s}=t||this.copyCanvas(null,null,!0).imageData,a=await i.guess({name:"altText",request:{data:r,width:n,height:s,channels:r.length/(n*s)}});if(!a)throw Error("No response from the AI service.");if(a.error)throw Error("Error from the AI service.");if(a.cancel)return null;if(!a.output)throw Error("No valid response from the AI service.");let o=a.output;return await this.setGuessedAltText(o),e&&!this.hasAltTextData()&&(this.altTextData={alt:o,decorative:!1}),o}#oG(){if(this.#oR){this._uiManager.enableWaiting(!0),this._uiManager.imageManager.getFromId(this.#oR).then(t=>this.#o$(t,!0)).finally(()=>this.#oW());return}if(this.#oB){let t=this.#oB;this.#oB=null,this._uiManager.enableWaiting(!0),this.#oF=this._uiManager.imageManager.getFromUrl(t).then(t=>this.#o$(t)).finally(()=>this.#oW());return}if(this.#oO){let t=this.#oO;this.#oO=null,this._uiManager.enableWaiting(!0),this.#oF=this._uiManager.imageManager.getFromFile(t).then(t=>this.#o$(t)).finally(()=>this.#oW());return}let t=document.createElement("input");t.type="file",t.accept=eZ.join(",");let e=this._uiManager._signal;this.#oF=new Promise(i=>{t.addEventListener("change",async()=>
46{if(t.files&&0!==t.files.length){this._uiManager.enableWaiting(!0);let e=await this._uiManager.imageManager.getFromFile(t.files[0]);this._reportTelemetry({action:"pdfjs.image.image_selected",data:{alt_text_modal:this._uiManager.useNewAltTextFlow}}),this.#o$(e)}else this.remove();i()},{signal:e}),t.addEventListener("cancel",()=>{this.remove(),i()},{signal:e})}).finally(()=>this.#oW()),t.click()}remove(){this.#oR&&(this.#oI=null,this._uiManager.imageManager.deleteId(this.#oR),this.#oN?.remove(),this.#oN=null,this.#oj&&(clearTimeout(this.#oj),this.#oj=null)),super.remove()}rebuild(){if(!this.parent){this.#oR&&this.#oG();return}super.rebuild(),null!==this.div&&(this.#oR&&null===this.#oN&&this.#oG(),this.isAttachedToDOM||this.parent.add(this))}onceAdded(t){this._isDraggable=!0,t&&this.div.focus()}isEmpty(){return!(this.#oF||this.#oI||this.#oB||this.#oO||this.#oR||this.#oU)}get toolbarButtons(){return[["altText",this.createAltText()]]}get isResizable(){return!0}render(){let t,e;return this.div||(this._isCopy&&(t=this.x,e=this.y),super.render(),this.div.hidden=!0,this.createAltText(),this.#oU||(this.#oI?this.#oV():this.#oG()),this._isCopy&&this._moveAfterPaste(t,e),this._uiManager.addShouldRescale(this)),this.div}setCanvas(t,e){let{id:i,bitmap:r}=this._uiManager.imageManager.getFromCanvas(t,e);e.remove(),i&&this._uiManager.imageManager.isValidId(i)&&(this.#oR=i,r&&(this.#oI=r),this.#oU=!1,this.#oV())}_onResized(){this.onScaleChanging()}onScaleChanging(){this.parent&&(null!==this.#oj&&clearTimeout(this.#oj),this.#oj=setTimeout(()=>{this.#oj=null,this.#oq()},200))}#oV(){let{div:t}=this,{width:e,height:i}=this.#oI,[r,n]=this.pageDimensions;if(this.width)e=this.width*r,i=this.height*n;else if(e>.75*r||i>.75*n){let t=Math.min(.75*r/e,.75*n/i);e*=t,i*=t}this._uiManager.enableWaiting(!1);let s=this.#oN=document.createElement("canvas");s.setAttribute("role","img"),this.addContainer(s),this.width=e/r,this.height=i/n,this.setDims(),this._initialOptions?.isCentered?this.center():this.fixAndSetPosition(),this._initialOptions=null,this._uiManager.useNewAltTextWhenAddingImage&&this._uiManager.useNewAltTextFlow&&!this.annotationElementId||(t.hidden=!1),this.#oq(),this.#oH||(this.parent.addUndoableEditor(this),this.#oH=!0),this._reportTelemetry({action:"inserted_image"}),this.#oL&&this.div.setAttribute("aria-description",this.#oL),this.annotationElementId||this._uiManager.a11yAlert("pdfjs-editor-stamp-added-alert")}copyCanvas(t,e,i=!1){t||(t=224);let{width:r,height:n}=this.#oI,s=new eQ,a=this.#oI,o=r,l=n,h=null;if(e){if(r>e||n>e){let t=Math.min(e/r,e/n);o=Math.floor(r*t),l=Math.floor(n*t)}let t=(h=document.createElement("canvas")).width=Math.ceil(o*s.sx),i=h.height=Math.ceil(l*s.sy);this.#oz||(a=this.#oK(t,i));let d=h.getContext("2d");d.filter=this._uiManager.hcmFilter;let c="white",u="#cfcfd8";"none"!==this._uiManager.hcmFilter?u="black":e0.isDarkMode&&(c="#8f8f9d",u="#42414d");let p=15*s.sx,g=15*s.sy,m=new OffscreenCanvas(2*p,2*g),f=m.getContext("2d");f.fillStyle=c,f.fillRect(0,0,2*p,2*g),f.fillStyle=u,f.fillRect(0,0,p,g),f.fillRect(p,g,p,g),d.fillStyle=d.createPattern(m,"repeat"),d.fillRect(0,0,t,i),d.drawImage(a,0,0,a.width,a.height,0,0,t,i)}let d=null;if(i){let e,i;if(s.symmetric&&a.width<t&&a.height<t)e=a.width,i=a.height;else if(a=this.#oI,r>t||n>t){let s=Math.min(t/r,t/n);e=Math.floor(r*s),i=Math.floor(n*s),this.#oz||(a=this.#oK(e,i))}let o=new OffscreenCanvas(e,i).getContext("2d",{willReadFrequently:!0});o.drawImage(a,0,0,a.width,a.height,0,0,e,i),d={width:e,height:i,data:o.getImageData(0,0,e,i).data}}return{canvas:h,width:o,height:l,imageData:d}}#oK(t,e){let{width:i,height:r}=this.#oI,n=i,s=r,a=this.#oI;for(;n>2*t||s>2*e;){let i=n,r=s;n>2*t&&(n=Math.ceil(n/2)),s>2*e&&(s=Math.ceil(s/2));let o=new OffscreenCanvas(n,s);o.getContext("2d").drawImage(a,0,0,i,r,0,0,n,s),a=o.transferToImageBitmap()}return a}#oq(){let[t,e]=this.parentDimensions,{width:i,height:r}=this,n=new eQ,s=Math.ceil(i*t*n.sx),a=Math.ceil(r*e*n.sy),o=this.#oN;if(!o||o.width===s&&o.height===a)return;o.width=s,o.height=a;let l=this.#oz?this.#oI:this.#oK(s,a),h=o.getContext("2d");h.filter=this._uiManager.hcmFilter,h.drawImage(l,0,0,l.width,l.height,0,0,s,a)}#oX(t){if(t){if(this.#oz){let t=this._uiManager.imageManager.getSvgUrl(this.#oR);if(t)return t}let t=document.createElement("canvas");return{width:t.width,height:t.height}=this.#oI,t.getContext("2d").drawImage(this.#oI,0,0),t.toDataURL()}if(this.#oz){let[t,e]=this.pageDimensions,i=Math.round(this.width*t*eO.PDF_TO_CSS_UNITS),r=Math.round(this.height*e*eO.PDF_TO_CSS_UNITS),n=new OffscreenCanvas(i,r);return n.getContext("2d").drawImage(this.#oI,0,0,this.#oI.width,this.#oI.height,0,0,i,r),n.transferToImageBitmap()}return structuredClone(this.#oI)}static async deserialize(t,e,i){let r=null,n=!1;if(t instanceof nV){let s,a,{data:{rect:o,rotation:l,id:h,structParent:d,popupRef:c,richText:u,contentsObj:p,creationDate:g,modificationDate:m},container:f,parent:{page:{pageNumber:b}},canvas:v}=t;v?(delete t.canvas,{id:s,bitmap:a}=i.imageManager.getFromCanvas(f.id,v),v.remove()):(n=!0,t._hasNoCanvas=!0);let y=(await e._structTree.getAriaAttributes(`${ek}${h}`))?.get("aria-label")||"";r=t={annotationType:et.STAMP,bitmapId:s,bitmap:a,pageIndex:b-1,rect:o.slice(0),rotation:l,annotationElementId:h,id:h,deleted:!1,accessibilityData:{decorative:!1,altText:y},isSvg:!1,structParent:d,popupRef:c,richText:u,comment:p?.str||null,creationDate:g,modificationDate:m}}let s=await super.deserialize(t,e,i),{rect:a,bitmap:o,bitmapUrl:l,bitmapId:h,isSvg:d,accessibilityData:c}=t;n?(i.addMissingCanvas(t.id,s),s.#oU=!0):h&&i.imageManager.isValidId(h)?(s.#oR=h,o&&(s.#oI=o)):s.#oB=l,s.#oz=d;let[u,p]=s.pageDimensions;return s.width=(a[2]-a[0])/u,s.height=(a[3]-a[1])/p,c&&(s.altTextData=c),s._initialData=r,t.comment&&s.setCommentData(t),s.#oH=!!r,s}serialize(t=!1,e=null){if(this.isEmpty())return null;if(this.deleted)return this.serializeDeleted();let i=Object.assign(super.serialize(t),{bitmapId:this.#oR,isSvg:this.#oz});if(this.addComment(i),t)return i.bitmapUrl=this.#oX(!0),i.accessibilityData=this.serializeAltText(!0),i.isCopy=!0,i;let{decorative:r,altText:n}=this.serializeAltText(!1);if(!r&&n&&(i.accessibilityData={type:"Figure",alt:n}),this.annotationElementId){let t=this.#s5(i);return t.isSame?null:(t.isSameAltText?delete i.accessibilityData:i.accessibilityData.structParent=this._initialData.structParent??-1,i.id=this.annotationElementId,delete i.bitmapId,i)}if(null===e)return i;e.stamps||=new Map;let s=this.#oz?(i.rect[2]-i.rect[0])*(i.rect[3]-i.rect[1]):null;if(e.stamps.has(this.#oR)){if(this.#oz){let t=e.stamps.get(this.#oR);s>t.area&&(t.area=s,t.serialized.bitmap.close(),t.serialized.bitmap=this.#oX(!1))}}else e.stamps.set(this.#oR,{area:s,serialized:i}),i.bitmap=this.#oX(!1);return i}#s5(t){let{pageIndex:e,accessibilityData:{altText:i}}=this._initialData,r=t.pageIndex===e,n=(t.accessibilityData?.alt||"")===i;return{isSame:!this.hasEditedComment&&!this._hasBeenMoved&&!this._hasBeenResized&&r&&n,isSameAltText:n}}renderAnnotationElement(t){return this.deleted?t.hide():t.updateEdited({rect:this.getPDFRect(),popup:this.comment}),null}}class ss{#sU;#oY=!1;#oJ=null;#oQ=null;#oZ=null;#o0=new Map;#o1=!1;#o2=!1;#o5=!1;#o3=null;#o6=null;#o4=null;#o9=null;#o8=null;#o7=-1;#v;static _initialized=!1;static #J=new Map([nK,n8,sn,n2,sr].map(t=>[t._editorType,t]));constructor({uiManager:t,pageIndex:e,div:i,structTreeLayer:r,accessibilityManager:n,annotationLayer:s,drawLayer:a,textLayer:o,viewport:l,l10n:h}){let d=[...ss.#J.values()];if(!ss._initialized)for(let e of(ss._initialized=!0,d))e.initialize(h,t);
46t.registerEditorTypes(d),this.#v=t,this.pageIndex=e,this.div=i,this.#sU=n,this.#oJ=s,this.viewport=l,this.#o4=o,this.drawLayer=a,this._structTree=r,this.#v.addLayer(this)}get isEmpty(){return 0===this.#o0.size}get isInvisible(){return this.isEmpty&&this.#v.getMode()===et.NONE}updateToolbar(t){this.#v.updateToolbar(t)}updateMode(t=this.#v.getMode()){switch(this.#lt(),t){case et.NONE:this.div.classList.toggle("nonEditing",!0),this.disableTextSelection(),this.togglePointerEvents(!1),this.toggleAnnotationLayerPointerEvents(!0),this.disableClick();return;case et.INK:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick();break;case et.HIGHLIGHT:this.enableTextSelection(),this.togglePointerEvents(!1),this.disableClick();break;default:this.disableTextSelection(),this.togglePointerEvents(!0),this.enableClick()}this.toggleAnnotationLayerPointerEvents(!1);let{classList:e}=this.div;if(e.toggle("nonEditing",!1),t===et.POPUP)e.toggle("commentEditing",!0);else for(let i of(e.toggle("commentEditing",!1),ss.#J.values()))e.toggle(`${i._type}Editing`,t===i._editorType);this.div.hidden=!1}hasTextLayer(t){return t===this.#o4?.div}setEditingState(t){this.#v.setEditingState(t)}addCommands(t){this.#v.addCommands(t)}cleanUndoStack(t){this.#v.cleanUndoStack(t)}toggleDrawing(t=!1){this.div.classList.toggle("drawing",!t)}togglePointerEvents(t=!1){this.div.classList.toggle("disabled",!t)}toggleAnnotationLayerPointerEvents(t=!1){this.#oJ?.togglePointerEvents(t)}get #le(){return 0!==this.#o0.size?this.#o0.values():this.#v.getEditors(this.pageIndex)}async enable(){this.#o5=!0,this.div.tabIndex=0,this.togglePointerEvents(!0),this.div.classList.toggle("nonEditing",!1),this.#o8?.abort(),this.#o8=null;let t=new Set;for(let e of this.#le)e.enableEditing(),e.show(!0),e.annotationElementId&&(this.#v.removeChangedExistingAnnotation(e),t.add(e.annotationElementId));let e=this.#oJ;if(e)for(let i of e.getEditableAnnotations()){if(i.hide(),this.#v.isDeletedAnnotationElement(i.data.id)||t.has(i.data.id))continue;let e=await this.deserialize(i);e&&(this.addOrRebuild(e),e.enableEditing())}this.#o5=!1,this.#v._eventBus.dispatch("editorsrendered",{source:this,pageNumber:this.pageIndex+1})}disable(){if(this.#o2=!0,this.div.tabIndex=-1,this.togglePointerEvents(!1),this.div.classList.toggle("nonEditing",!0),this.#o4&&!this.#o8){this.#o8=new AbortController;let t=this.#v.combinedSignal(this.#o8);this.#o4.div.addEventListener("pointerdown",t=>{let e,{clientX:i,clientY:r,timeStamp:n}=t;if(n-this.#o7>500){this.#o7=n;return}this.#o7=-1;let{classList:s}=this.div;s.toggle("getElements",!0);let a=document.elementsFromPoint(i,r);if(s.toggle("getElements",!1),!this.div.contains(a[0]))return;let o=RegExp(`^${t7}[0-9]+$`);for(let t of a)if(o.test(t.id)){e=t.id;break}if(!e)return;let l=this.#o0.get(e);l?.annotationElementId===null&&(eW(t),l.dblclick(t))},{signal:t,capture:!0})}let t=this.#oJ,e=[];if(t){let i=new Map,r=new Map;for(let t of this.#le){if(t.disableEditing(),!t.annotationElementId){e.push(t);continue}if(null!==t.serialize()){i.set(t.annotationElementId,t);continue}r.set(t.annotationElementId,t),this.getEditableAnnotation(t.annotationElementId)?.show(),t.remove()}for(let e of t.getEditableAnnotations()){let{id:t}=e.data;if(this.#v.isDeletedAnnotationElement(t)){e.updateEdited({deleted:!0});continue}let n=r.get(t);if(n){n.resetAnnotationElement(e),n.show(!1),e.show();continue}(n=i.get(t))&&(this.#v.addChangedExistingAnnotation(n),n.renderAnnotationElement(e)&&n.show(!1)),e.show()}}this.#lt(),this.isEmpty&&(this.div.hidden=!0);let{classList:i}=this.div;for(let t of ss.#J.values())i.remove(`${t._type}Editing`);this.disableTextSelection(),this.toggleAnnotationLayerPointerEvents(!0),t?.updateFakeAnnotations(e),this.#o2=!1}getEditableAnnotation(t){return this.#oJ?.getEditableAnnotation(t)||null}setActiveEditor(t){this.#v.getActive()!==t&&this.#v.setActiveEditor(t)}enableTextSelection(){if(this.div.tabIndex=-1,this.#o4?.div&&!this.#o9){this.#o9=new AbortController;let t=this.#v.combinedSignal(this.#o9);this.#o4.div.addEventListener("pointerdown",this.#li.bind(this),{signal:t}),this.#o4.div.classList.add("highlighting")}}disableTextSelection(){this.div.tabIndex=0,this.#o4?.div&&this.#o9&&(this.#o9.abort(),this.#o9=null,this.#o4.div.classList.remove("highlighting"))}#li(t){this.#v.unselectAll();let{target:e}=t;if(e===this.#o4.div||("img"===e.getAttribute("role")||e.classList.contains("endOfContent")||e.classList.contains("textLayerImagePlaceholder"))&&this.#o4.div.contains(e)){let{isMac:e}=eS.platform;if(0!==t.button||t.ctrlKey&&e)return;
46this.#v.showAllEditors("highlight",!0,!0),this.#o4.div.classList.add("free"),this.toggleDrawing(),n2.startHighlighting(this,"ltr"===this.#v.direction,{target:this.#o4.div,x:t.x,y:t.y}),this.#o4.div.addEventListener("pointerup",()=>{this.#o4.div.classList.remove("free"),this.toggleDrawing(!0)},{once:!0,signal:this.#v._signal}),t.preventDefault()}}enableClick(){if(this.#oQ)return;this.#oQ=new AbortController;let t=this.#v.combinedSignal(this.#oQ);this.div.addEventListener("pointerdown",this.pointerdown.bind(this),{signal:t});let e=this.pointerup.bind(this);this.div.addEventListener("pointerup",e,{signal:t}),this.div.addEventListener("pointercancel",e,{signal:t})}disableClick(){this.#oQ?.abort(),this.#oQ=null}attach(t){this.#o0.set(t.id,t);let{annotationElementId:e}=t;e&&this.#v.isDeletedAnnotationElement(e)&&this.#v.removeDeletedAnnotationElement(t)}detach(t){this.#o0.delete(t.id),this.#sU?.removePointerInTextLayer(t.contentDiv),!this.#o2&&t.annotationElementId&&this.#v.addDeletedAnnotationElement(t)}remove(t){this.detach(t),this.#v.removeEditor(t),t.div.remove(),t.isAttachedToDOM=!1}changeParent(t){t.parent!==this&&(t.parent&&t.annotationElementId&&(this.#v.addDeletedAnnotationElement(t),iu.deleteAnnotationElement(t),t.annotationElementId=null),this.attach(t),t.parent?.detach(t),t.setParent(this),t.div&&t.isAttachedToDOM&&(t.div.remove(),this.div.append(t.div)))}add(t){if(t.parent!==this||!t.isAttachedToDOM){if(this.changeParent(t),this.#v.addEditor(t),this.attach(t),!t.isAttachedToDOM){let e=t.render();this.div.append(e),t.isAttachedToDOM=!0}t.fixAndSetPosition(),t.onceAdded(!this.#o5),this.#v.addToAnnotationStorage(t),t._reportTelemetry(t.telemetryInitialData)}}moveEditorInDOM(t){if(!t.isAttachedToDOM)return;let{activeElement:e}=document;t.div.contains(e)&&!this.#oZ&&(t._focusEventsAllowed=!1,this.#oZ=setTimeout(()=>{this.#oZ=null,t.div.contains(document.activeElement)?t._focusEventsAllowed=!0:(t.div.addEventListener("focusin",()=>{t._focusEventsAllowed=!0},{once:!0,signal:this.#v._signal}),e.focus())},0)),t._structTreeParentId=this.#sU?.moveElementInDOM(this.div,t.div,t.contentDiv,!0)}addOrRebuild(t){t.needsToBeRebuilt()?(t.parent||=this,t.rebuild(),t.show()):this.add(t)}addUndoableEditor(t){this.addCommands({cmd:()=>t._uiManager.rebuild(t),undo:()=>{t.remove()},mustExec:!1})}getEditorByUID(t){for(let e of this.#o0.values())if(e.uid===t)return e;return null}get #lr(){return ss.#J.get(this.#v.getMode())}combinedSignal(t){return this.#v.combinedSignal(t)}#ln(t){let e=this.#lr;return e?new e.prototype.constructor(t):null}canCreateNewEmptyEditor(){return this.#lr?.canCreateNewEmptyEditor()}async pasteEditor(t,e){this.updateToolbar(t),await this.#v.updateMode(t.mode);let{offsetX:i,offsetY:r}=this.#ls(),n=this.#v.getId(),s=this.#ln({parent:this,id:n,x:i,y:r,uiManager:this.#v,isCentered:!0,...e});s&&this.add(s)}async deserialize(t){return await ss.#J.get(t.annotationType??t.annotationEditorType)?.deserialize(t,this,this.#v)||null}createAndAddNewEditor(t,e,i={}){let r=this.#v.getId(),n=this.#ln({parent:this,id:r,x:t.offsetX,y:t.offsetY,uiManager:this.#v,isCentered:e,...i});return n&&this.add(n),n}get boundingClientRect(){return this.div.getBoundingClientRect()}#ls(){let{x:t,y:e,width:i,height:r}=this.boundingClientRect,n=Math.max(0,t),s=Math.max(0,e),a=Math.min(window.innerWidth,t+i),o=Math.min(window.innerHeight,e+r),l=(n+a)/2-t,h=(s+o)/2-e,[d,c]=this.viewport.rotation%180==0?[l,h]:[h,l];return{offsetX:d,offsetY:c}}addNewEditor(t={}){this.createAndAddNewEditor(this.#ls(),!0,t)}setSelected(t){this.#v.setSelected(t)}toggleSelected(t){this.#v.toggleSelected(t)}unselect(t){this.#v.unselect(t)}pointerup(t){let{isMac:e}=eS.platform;if(0!==t.button||t.ctrlKey&&e||t.target!==this.div||!this.#o1||(this.#o1=!1,this.#lr?.isDrawer&&this.#lr.supportMultipleDrawings))return;if(!this.#oY){this.#oY=!0;return}let i=this.#v.getMode();i===et.STAMP||i===et.POPUP||i===et.SIGNATURE?this.#v.unselectAll():this.createAndAddNewEditor(t,!1)}pointerdown(t){if(this.#v.getMode()===et.HIGHLIGHT&&this.enableTextSelection(),this.#o1){this.#o1=!1;return}let{isMac:e}=eS.platform;if(0!==t.button||t.ctrlKey&&e||t.target!==this.div)return;if(this.#o1=!0,this.#lr?.isDrawer)return void this.startDrawingSession(t);let i=this.#v.getActive();this.#oY=!i||i.isEmpty()}startDrawingSession(t){if(this.div.focus({preventScroll:!0}),this.#o3)return void this.#lr.startDrawing(this,this.#v,!1,t);
46this.#v.setCurrentDrawingSession(this),this.#o3=new AbortController;let e=this.#v.combinedSignal(this.#o3);this.div.addEventListener("blur",({relatedTarget:t})=>{t&&!this.div.contains(t)&&(this.#o6=null,this.commitOrRemove())},{signal:e}),this.#lr.startDrawing(this,this.#v,!1,t)}pause(t){if(t){let{activeElement:t}=document;this.div.contains(t)&&(this.#o6=t);return}this.#o6&&setTimeout(()=>{this.#o6?.focus(),this.#o6=null},0)}endDrawingSession(t=!1){return this.#o3?(this.#v.setCurrentDrawingSession(null),this.#o3.abort(),this.#o3=null,this.#o6=null,this.#lr.endDrawing(t)):null}findNewParent(t,e,i){let r=this.#v.findParent(e,i);return null!==r&&r!==this&&(r.changeParent(t),!0)}commitOrRemove(){return!!this.#o3&&(this.endDrawingSession(),!0)}onScaleChanging(){this.#o3&&this.#lr.onScaleChangingWhenDrawing(this)}destroy(){for(let t of(this.commitOrRemove(),this.#v.getActive()?.parent===this&&(this.#v.commitOrRemove(),this.#v.setActiveEditor(null)),this.#oZ&&(clearTimeout(this.#oZ),this.#oZ=null),this.#o0.values()))this.#sU?.removePointerInTextLayer(t.contentDiv),t.setParent(null),t.isAttachedToDOM=!1,t.div.remove();this.div=null,this.#o0.clear(),this.#v.removeLayer(this)}#lt(){for(let t of this.#o0.values())t.isEmpty()&&t.remove()}async render({viewport:t}){for(let e of(this.viewport=t,eJ(this.div,t),this.#v.getEditors(this.pageIndex)))this.add(e),e.rebuild();await this.#v.findClonesForPage(this),this.div.hidden=this.isEmpty,this.updateMode()}update({viewport:t}){this.#v.commitOrRemove(),this.#lt();let e=this.viewport.rotation,i=t.rotation;if(this.viewport=t,eJ(this.div,{rotation:i}),e!==i)for(let t of this.#o0.values())t.rotate(i)}get pageDimensions(){let{pageWidth:t,pageHeight:e}=this.viewport.rawDims;return[t,e]}get scale(){return this.#v.viewParameters.realScale}}class sa{#sh=null;#la=new Map;#lo=new Map;static #E=0;setParent(t){if(!this.#sh){this.#sh=t;return}if(this.#sh!==t){if(this.#la.size>0)for(let e of this.#la.values())e.remove(),t.append(e);this.#sh=t}}static get _svgFactory(){return eg(this,"_svgFactory",new nm)}static #ll(t,[e,i,r,n]){let{style:s}=t;s.top=`${100*i}%`,s.left=`${100*e}%`,s.width=`${100*r}%`,s.height=`${100*n}%`}#lh(){let t=sa._svgFactory.create(1,1,!0);return this.#sh.append(t),t.setAttribute("aria-hidden",!0),t}#ld(t,e){let i=sa._svgFactory.createElement("clipPath");t.append(i);let r=`clip_${e}`;i.setAttribute("id",r),i.setAttribute("clipPathUnits","objectBoundingBox");let n=sa._svgFactory.createElement("use");return i.append(n),n.setAttribute("href",`#${e}`),n.classList.add("clip"),r}#lc(t,e){for(let[i,r]of Object.entries(e))null===r?t.removeAttribute(i):t.setAttribute(i,r)}draw(t,e=!1,i=!1){let r=sa.#E++,n=this.#lh(),s=sa._svgFactory.createElement("defs");n.append(s);let a=sa._svgFactory.createElement("path");s.append(a);let o=`path_${r}`;a.setAttribute("id",o),a.setAttribute("vector-effect","non-scaling-stroke"),e&&this.#lo.set(r,a);let l=i?this.#ld(s,o):null,h=sa._svgFactory.createElement("use");return n.append(h),h.setAttribute("href",`#${o}`),this.updateProperties(n,t),this.#la.set(r,n),{id:r,clipPathId:`url(#${l})`}}drawOutline(t,e){let i,r=sa.#E++,n=this.#lh(),s=sa._svgFactory.createElement("defs");n.append(s);let a=sa._svgFactory.createElement("path");s.append(a);let o=`path_${r}`;if(a.setAttribute("id",o),a.setAttribute("vector-effect","non-scaling-stroke"),e){let t=sa._svgFactory.createElement("mask");s.append(t),i=`mask_${r}`,t.setAttribute("id",i),t.setAttribute("maskUnits","objectBoundingBox");let e=sa._svgFactory.createElement("rect");t.append(e),e.setAttribute("width","1"),e.setAttribute("height","1"),e.setAttribute("fill","white");let n=sa._svgFactory.createElement("use");t.append(n),n.setAttribute("href",`#${o}`),n.setAttribute("stroke","none"),n.setAttribute("fill","black"),n.setAttribute("fill-rule","nonzero"),n.classList.add("mask")}let l=sa._svgFactory.createElement("use");n.append(l),l.setAttribute("href",`#${o}`),i&&l.setAttribute("mask",`url(#${i})`);let h=l.cloneNode();return n.append(h),l.classList.add("mainOutline"),h.classList.add("secondaryOutline"),this.updateProperties(n,t),this.#la.set(r,n),r}finalizeDraw(t,e){this.#lo.delete(t),this.updateProperties(t,e)}updateProperties(t,e){if(!e)return;let{root:i,bbox:r,rootClass:n,path:s}=e,a="number"==typeof t?this.#la.get(t):t;if(a){if(i&&this.#lc(a,i),r&&sa.#ll(a,r),n){let{classList:t}=a;for(let[e,i]of Object.entries(n))t.toggle(e,i)}if(s){let t=a.firstElementChild.firstElementChild;
46this.#lc(t,s)}}}updateParent(t,e){if(e===this)return;let i=this.#la.get(t);i&&(e.#sh.append(i),this.#la.delete(t),e.#la.set(t,i))}remove(t){this.#lo.delete(t),null!==this.#sh&&(this.#la.get(t).remove(),this.#la.delete(t))}destroy(){for(let t of(this.#sh=null,this.#la.values()))t.remove();this.#la.clear(),this.#lo.clear()}}function so(t){return`${(100*t).toFixed(2)}%`}class sl{#lu=[];#lp=new Map;#lg=null;#lm=0;#r1=0;#r0=0;static #lf=null;constructor(t,e,i,r){this.#lm=t,this.#lu=e,this.#r1=i.rawDims.pageWidth,this.#r0=i.rawDims.pageHeight,this.#lg=r}render(){let t=document.createElement("div");t.className="textLayerImages";for(let e=0;e<this.#lu.length;e+=6){let i=this.#lb(this.#lu.subarray(e,e+6));i&&t.append(i)}return t.addEventListener("contextmenu",t=>{if(!(t.target instanceof HTMLCanvasElement))return;let e=t.target,i=this.#lp.get(e);if(!i)return;let r=sl.#lf?.deref();if(r===e)return;r&&(r.width=0,r.height=0),sl.#lf=new WeakRef(e);let{inverseTransform:n,x1:s,y1:a,width:o,height:l}=i,h=this.#lg(),d=Math.ceil(s*h.width),c=Math.ceil(a*h.height),u=Math.floor((s+o/this.#r1)*h.width),p=Math.floor((a+l/this.#r0)*h.height);e.width=u-d,e.height=p-c;let g=e.getContext("2d");g.setTransform(...n),g.translate(-d,-c),g.drawImage(h,0,0)}),t}#lb([t,e,i,r,n,s]){let a=Math.hypot((n-t)*this.#r1,(s-e)*this.#r0),o=Math.hypot((i-t)*this.#r1,(r-e)*this.#r0);if(a<this.#lm||o<this.#lm)return null;let l=[(n-t)*this.#r1/a,(s-e)*this.#r0/a,(i-t)*this.#r1/o,(r-e)*this.#r0/o,0,0],h=eT.inverseTransform(l),d=document.createElement("canvas");return d.className="textLayerImagePlaceholder",d.width=0,d.height=0,Object.assign(d.style,{opacity:0,position:"absolute",left:so(t),top:so(e),width:so(a/this.#r1),height:so(o/this.#r0),transformOrigin:"0% 0%",transform:`matrix(${l.join(",")})`}),this.#lp.set(d,{inverseTransform:h,width:a,height:o,x1:t,y1:e}),d}}globalThis._pdfjsTestingUtils={HighlightOutliner:nQ},globalThis.pdfjsLib={AbortException:ex,AnnotationEditorLayer:ss,AnnotationEditorParamsType:ee,AnnotationEditorType:et,AnnotationEditorUIManager:il,AnnotationLayer:nG,AnnotationMode:t8,AnnotationType:er,applyOpacity:function(t,e){let i=255*(1-(e=eI(e??1,0,1)));return t.map(t=>Math.round(t*e+i))},build:"7e5b36c2d",ColorPicker:nh,createValidAbsoluteUrl:ec,CSSConstants:class{static get commentForegroundColor(){let t=document.createElement("span");t.classList.add("comment","sidebar");let{style:e}=t;e.width=e.height="0",e.display="none",e.color="var(--comment-fg-color)",document.body.append(t);let{color:i}=window.getComputedStyle(t);return t.remove(),eg(this,"commentForegroundColor",eK(i))}},DOMSVGFactory:nm,DrawLayer:sa,FeatureTest:eS,fetchData:eL,findContrastColor:function(t,e){let i=t[0]+256*t[1]+65536*t[2]+0x1000000*e[0]+0x100000000*e[1]+0x10000000000*e[2],r=e6.get(i);if(r)return r;let n=new Float32Array(9),s=n.subarray(0,3),a=n.subarray(3,6);e1(t,a);let o=n.subarray(6,9);e1(e,o);let l=o[2]<.5,h=l?12:4.5;if(a[2]=l?Math.sqrt(a[2]):1-Math.sqrt(1-a[2]),e3(a,o,s)<h){let t,e;for(l?(t=a[2],e=1):(t=0,e=a[2]);e-t>.005;){let i=a[2]=(t+e)/2;l===e3(a,o,s)<h?t=i:e=i}a[2]=l?e:t}return e2(a,s),r=eT.makeHexColor(Math.round(255*s[0]),Math.round(255*s[1]),Math.round(255*s[2])),e6.set(i,r),r},getDocument:r7,getFilenameFromUrl:function(t){return[t]=t.split(/[#?]/,1),ep(t)},getPdfFilenameFromUrl:function(t,e="document.pdf"){if("string"!=typeof t)return e;if(ej(t))return el('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),e;let i=(t=>{try{return new URL(t)}catch{try{return new URL(decodeURIComponent(t))}catch{try{return new URL(t,"https://foo.bar")}catch{try{return new URL(decodeURIComponent(t),"https://foo.bar")}catch{return null}}}}})(t);if(!i)return e;let r=t=>{try{let e=decodeURIComponent(t);if(e.includes("/")&&(e=ep(e),/^\.pdf$/i.test(e)))return t;return e}catch{return t}},n=/\.pdf$/i,s=ep(i.pathname);if(n.test(s))return r(s);if(i.searchParams.size>0){let t=t=>[...t].findLast(t=>n.test(t)),e=t(i.searchParams.values())??t(i.searchParams.keys());if(e)return r(e)}if(i.hash){let t=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i.exec(i.hash);if(t)return r(t[0])}return e},getRGB:eK,getRGBA:eq,getUuid:eC,getXfaPageViewport:function(t,{scale:e=1,rotation:i=0}){let{width:r,height:n}=t.attributes.style;return new eN({viewBox:[0,0,parseInt(r,10),parseInt(n,10)],userUnit:1,scale:e,rotation:i})},GlobalWorkerOptions:rZ,ImageKind:ei,InvalidPDFException:ev,isDataScheme:ej,isPdfFile:ez,isValidExplicitDest:iY,makeArr:eP,makeMap:eM,makeObj:eD,MathClamp:eI,noContextMenu:eV,normalizeUnicode:function(t){return e_||(e_=/([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc-\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa-\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu,eE=new Map([["ſt","ſt"]])),t.replaceAll(e_,(t,e,i)=>e?e.normalize("NFKC"):eE.get(i))},OPS:es,OutputScale:eQ,PasswordResponses:{NEED_PASSWORD:1,INCORRECT_PASSWORD:2}
46,PDFDataRangeTransport:ne,PDFDateString:eG,PDFWorker:nn,PermissionFlag:{PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},PixelsPerInch:eO,RenderingCancelledException:eU,renderRichText:e4,ResponseException:ey,setLayerDimensions:eJ,shadow:eg,SignatureExtractor:st,stopEvent:eW,SupportedImageMimeTypes:eZ,TextLayer:r8,TextLayerImages:sl,TouchManager:ic,updateUrlHash:eu,Util:eT,VerbosityLevel:en,version:nl,XfaLayer:eF},"u">typeof ReadableStream&&"function"!=typeof ReadableStream.prototype[Symbol.asyncIterator]&&(ReadableStream.prototype[Symbol.asyncIterator]=function(t){let e=!!(t&&t.preventCancel),i=this.getReader(),r=!1,n=null,s=()=>{try{i.releaseLock()}catch(t){}},a=()=>r?Promise.resolve({value:void 0,done:!0}):i.read().then(t=>(t.done&&(r=!0,s()),t),t=>{throw r=!0,s(),t}),o=t=>{let e=n?n.then(t):t();return n=e.then(()=>void 0,()=>void 0),e};return{next:()=>o(a),return:t=>o(()=>(t=>{if(r)return Promise.resolve({value:t,done:!0});if(r=!0,e)return s(),Promise.resolve({value:t,done:!0});let n=i.cancel(t);return s(),n.then(()=>({value:t,done:!0}))})(t)),[Symbol.asyncIterator](){return this}}},"function"!=typeof ReadableStream.prototype.values&&(ReadableStream.prototype.values=ReadableStream.prototype[Symbol.asyncIterator])),rZ.workerSrc="/pdfjs-worker/old-env/pdf.worker.min.mjs?v=".concat(nl);let{D6:sh}=t;class sd extends m{static attachShownBsModal(t,e){t.on("shown.bs.modal",()=>{sd.renderPdfForCanvasInModal(e)})}static attachFileChange(t){t.on("change",'.form-group.carrierwave .file-input input[type="file"]',t=>{let e=$(t.currentTarget),i=()=>e.closest(".file-input").find(".file-preview-thumbnails .pdfjs-canvases-for-file-preview");i().remove(),setTimeout(()=>{if(e.is(":hidden"))return;let t=i();0!==t.length&&sd.renderPdfForInputPreview(t)},1e3)})}static replaceOpenPdfPreviewFileModalLink(t){t.attr({"data-target":null,"data-toggle":null,href:t.attr("data-url"),target:"_blank",rel:"noopener noreferrer"})}static replacePdfPreviewToExternalLink(t,e){t.before('<div class="bottom-buffer-5"><i class="fa fa-fw fa-window-maximize"></i>&nbsp;'.concat(e.attr("title"),"を開く</div>")),t.remove()}static renderPdfForCanvasInModal(t){sd.renderPdf(t,"all")}static renderPdfForInputPreview(t){sd.renderPdf(t,"mini")}static renderPdf(t,e){if(t.hasClass("loaded"))return;let i=Math.round(t.width());r7({url:t.attr("data-url"),cMapUrl:"/cmaps/",cMapPacked:!0,wasmUrl:"/pdfjs-wasm/",isEvalSupported:!1}).promise.then(r=>{if(t.is(":hidden"))return;t.addClass(e);let n=t.find(".loading"),s=window.devicePixelRatio||1,a=1!==s?[s,0,0,s,0,0]:null,o=l=>{let h=$('<div class="pdfjs-page"><canvas class="pdfjs-canvas"></canvas><div class="textLayer"></div></div>'),d=h.find(".pdfjs-canvas"),c=h.find(".textLayer");n.before(h);let u=()=>{l++,"mini"!==e&&r.numPages>=l?setTimeout(o,100,l):t.addClass("loaded")};r.getPage(l).then(r=>{let[n,o,h,p]=r.view,g=r.rotate%180!=0,m=h-n,f=p-o,b=g?f:m,v=g?m:f,y=i,w=y/b,A=v*w;d.attr({width:Math.round(y*s),height:Math.round(A*s)}),A=v*(w=(y=i=Math.round(t.width()))/b),d.attr({width:Math.round(y*s),height:Math.round(A*s)}),d.css({width:"".concat(y,"px"),height:"".concat(A,"px")}),c.css({width:"".concat(y,"px"),height:"".concat(A,"px")});let S=r.getViewport({scale:w}),T=r.render({canvasContext:d[0].getContext("2d"),viewport:S,transform:a}).promise;"mini"!==e&&r.getTextContent().then(t=>(c[0].style.setProperty("--total-scale-factor",String(w)),new sh({textContentSource:t,container:c[0],viewport:S}).render())).catch(t=>x(t,{feature:"pdf_preview",stage:"getTextContent"})),T.catch(t=>x(t,{feature:"pdf_preview",stage:"render"})).then(()=>{"mini"===e&&1===l&&t.height(A),u()})}).catch(t=>{x(t,{feature:"pdf_preview",stage:"getPage"}),u()})};o(1)}).catch(t=>x(t,{feature:"pdf_preview",stage:"getDocument"}))}constructor(){super();let t=$(".pdfjs-canvases-for-file-preview");["IE","Edge"].includes(new(tm())().getBrowser().name)?(this.eachAddRoutes($('.js-open-preview-file-modal[data-filetype="pdf"]'),t=>this.makeRoute(sd.replaceOpenPdfPreviewFileModalLink,t)),this.eachAddRoutes(t,t=>this.makeRoute(sd.replacePdfPreviewToExternalLink,t,t.closest("a")))):(this.eachAddRoutes($(".modal-previewFile"),t=>this.makeRoute(sd.attachShownBsModal,t,t.find(".pdfjs-canvases"))),this.addRoutes(this.makeRoute(sd.attachFileChange,o.$document)),t.each((t,e)=>{setTimeout(()=>{let t=$(e);t.is(":visible")&&sd.renderPdfForInputPreview(t)},1e3*t)}))}}let sc=window,su={title:t=>t.attr("title")?null:t.attr("data-title"),placement:t=>t.attr("data-placement"),container:t=>t.attr("data-container"),html:t=>"true"===t.attr("data-html")||null};class sp{static isBootstrap5(){return!!sc.bootstrap}static attach(t,e){t.each((t,i)=>{let r=d()(i),n=r.attr("aria-label");r.tooltip(J({},sp.optionsFrom(r),e||{})),void 0===n?r.removeAttr("aria-label"):r.attr("aria-label",n)})}static optionsFrom(t){let e={};return Object.keys(su).forEach(i=>
46{let r=su[i](t);null!=r&&(e[i]=r)}),e}static dispose(t){t.tooltip(sp.isBootstrap5()?"dispose":"destroy")}static setTitle(t,e){t.attr(sp.titleAttribute(),e)}static titleAttribute(){return sp.isBootstrap5()?"data-bs-original-title":"data-original-title"}}class sg extends m{static attachTooltip(t){sp.attach(t)}constructor(){super(),this.addRoutes(this.makeRoute(sg.attachTooltip,d()('[data-toggle="tooltip"]')))}}class sm{}e(sm,"API_ENDPOINT_ZENGIN_BANK","https://".concat("zengin-api.herokuapp.com","/v2/banks/"));class sf extends m{static fetchAndRender(t,e,i,r){let n=t.data("bank-code"),s=t.data("bank-branch-code"),a="".concat(sm.API_ENDPOINT_ZENGIN_BANK).concat(n);$.when(sf._fetchBankMeta("".concat(a,".json?suffix=true"),n,e),sf._fetchBankMeta("".concat(a,"/branches/").concat(s,".json"),s,i)).always(()=>{sf.hideElement(r);let e=t.parents(".js-dropmenu-in-table-responsive-wrap").find("table");e.length>0&&e.trigger("update")})}static _fetchBankMeta(t,e,i){if(!e)return n.noOperation;let r={url:t,dataType:"json"};return r.headers={Authorization:"Basic ".concat(String("c21hcnRocl96ZW5naW46TDFPanNFRnBhQ1YxeFJLelI2SnM="))},$.ajax(r).done(t=>{i.text(t.name)}).fail(()=>{i.text(e).addClass("only-code")})}constructor(){super(),this.eachAddRoutes($(".js-bankAccount"),t=>this.makeRoute(sf.fetchAndRender,t,t.find(".bankAccount__bankName"),t.find(".bankAccount__bankBranchName"),t.find(".js-loader")))}}let sb=()=>new Promise(t=>{let e=document.querySelector("script[data-wovn-enabled]");if((null==e?void 0:e.dataset.wovnEnabled)==="false")return t(!1);if(window.WOVN)return t(!0);let i=setInterval(()=>{window.WOVN&&(clearInterval(i),t(!0))},100)}),sv=()=>{let t=window.WOVN.io.getCurrentLang();"eu"===t.code?document.documentElement.lang="ja":document.documentElement.lang=t.code},sy=()=>{sv(),window.addEventListener("wovnLangChanged",sv)},sw=async()=>{await sb()&&(window.WOVN.io.isApiReady()?sy():window.addEventListener("wovnApiReady",sy,{once:!0}))},sx=()=>{var t;let e=null==(t=window.gon)?void 0:t.locale;if(!e)return void console.warn("[language_synchronizer] gon.locale is not defined");let i=(t=>{if(t)return({"ja-JP":"ja","en-US":"en","ko-KR":"ko","zh-Hans-CN":"zh-CHS","zh-Hant-TW":"zh-CHT","vi-VN":"vi","pt-BR":"pt","ja-JP-x-easy":"eu","id-ID":"id"})[t]})(e);i?window.WOVN.io.changeLang(i)||console.warn("[language_synchronizer] Failed to change WOVN language to: ".concat(i)):console.warn("[language_synchronizer] No WOVN language code found for locale: ".concat(e))},sA=()=>{sx(),window.addEventListener("wovnLanguageChanged",sx);let t=3,e=setInterval(()=>{t<=0?clearInterval(e):(t--,sx())},1e3)},sS=async()=>{await sb()&&(window.WOVN.io.isApiReady()?sA():window.addEventListener("wovnApiReady",sA,{once:!0}))};new class extends r{constructor(){super([tK,tX,tY,tJ,tQ,tZ,t0,sd,sg,sf],[l.bindToGlobal,tq.initAllHelpers,tk.showServerSideAlert,sw,sS])}}().execute()})()})();
47

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.