@weavy/uikit-react 14.0.2 → 14.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js CHANGED
@@ -6,7 +6,7 @@
6
6
  *
7
7
  * This source code is licensed under the MIT license found in the
8
8
  * LICENSE file in the root directory of this source tree.
9
- */function requireReactIs_development(){return hasRequiredReactIs_development||(hasRequiredReactIs_development=1,"production"!==process.env.NODE_ENV&&function(){var e="function"==typeof Symbol&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,i=e?Symbol.for("react.strict_mode"):60108,s=e?Symbol.for("react.profiler"):60114,a=e?Symbol.for("react.provider"):60109,o=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,c=e?Symbol.for("react.concurrent_mode"):60111,u=e?Symbol.for("react.forward_ref"):60112,d=e?Symbol.for("react.suspense"):60113,h=e?Symbol.for("react.suspense_list"):60120,p=e?Symbol.for("react.memo"):60115,f=e?Symbol.for("react.lazy"):60116,g=e?Symbol.for("react.block"):60121,m=e?Symbol.for("react.fundamental"):60117,v=e?Symbol.for("react.responder"):60118,y=e?Symbol.for("react.scope"):60119;function b(e){if("object"==typeof e&&null!==e){var h=e.$$typeof;switch(h){case t:var g=e.type;switch(g){case l:case c:case r:case s:case i:case d:return g;default:var m=g&&g.$$typeof;switch(m){case o:case u:case f:case p:case a:return m;default:return h}}case n:return h}}}var _=l,w=c,E=o,S=a,C=t,A=u,P=r,x=f,T=p,R=n,M=s,L=i,I=d,k=!1;function O(e){return b(e)===c}reactIs_development.AsyncMode=_,reactIs_development.ConcurrentMode=w,reactIs_development.ContextConsumer=E,reactIs_development.ContextProvider=S,reactIs_development.Element=C,reactIs_development.ForwardRef=A,reactIs_development.Fragment=P,reactIs_development.Lazy=x,reactIs_development.Memo=T,reactIs_development.Portal=R,reactIs_development.Profiler=M,reactIs_development.StrictMode=L,reactIs_development.Suspense=I,reactIs_development.isAsyncMode=function(e){return k||(k=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),O(e)||b(e)===l},reactIs_development.isConcurrentMode=O,reactIs_development.isContextConsumer=function(e){return b(e)===o},reactIs_development.isContextProvider=function(e){return b(e)===a},reactIs_development.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},reactIs_development.isForwardRef=function(e){return b(e)===u},reactIs_development.isFragment=function(e){return b(e)===r},reactIs_development.isLazy=function(e){return b(e)===f},reactIs_development.isMemo=function(e){return b(e)===p},reactIs_development.isPortal=function(e){return b(e)===n},reactIs_development.isProfiler=function(e){return b(e)===s},reactIs_development.isStrictMode=function(e){return b(e)===i},reactIs_development.isSuspense=function(e){return b(e)===d},reactIs_development.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===r||e===c||e===s||e===i||e===d||e===h||"object"==typeof e&&null!==e&&(e.$$typeof===f||e.$$typeof===p||e.$$typeof===a||e.$$typeof===o||e.$$typeof===u||e.$$typeof===m||e.$$typeof===v||e.$$typeof===y||e.$$typeof===g)},reactIs_development.typeOf=b}()),reactIs_development}function requireReactIs(){return hasRequiredReactIs||(hasRequiredReactIs=1,e=reactIs,"production"===process.env.NODE_ENV?e.exports=requireReactIs_production_min():e.exports=requireReactIs_development()),reactIs.exports;var e}
9
+ */function requireReactIs_development(){return hasRequiredReactIs_development||(hasRequiredReactIs_development=1,"production"!==process.env.NODE_ENV&&function(){var e="function"==typeof Symbol&&Symbol.for,t=e?Symbol.for("react.element"):60103,n=e?Symbol.for("react.portal"):60106,r=e?Symbol.for("react.fragment"):60107,i=e?Symbol.for("react.strict_mode"):60108,s=e?Symbol.for("react.profiler"):60114,a=e?Symbol.for("react.provider"):60109,o=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,c=e?Symbol.for("react.concurrent_mode"):60111,u=e?Symbol.for("react.forward_ref"):60112,d=e?Symbol.for("react.suspense"):60113,h=e?Symbol.for("react.suspense_list"):60120,p=e?Symbol.for("react.memo"):60115,f=e?Symbol.for("react.lazy"):60116,g=e?Symbol.for("react.block"):60121,m=e?Symbol.for("react.fundamental"):60117,v=e?Symbol.for("react.responder"):60118,y=e?Symbol.for("react.scope"):60119;function b(e){if("object"==typeof e&&null!==e){var h=e.$$typeof;switch(h){case t:var g=e.type;switch(g){case l:case c:case r:case s:case i:case d:return g;default:var m=g&&g.$$typeof;switch(m){case o:case u:case f:case p:case a:return m;default:return h}}case n:return h}}}var _=l,w=c,E=o,S=a,C=t,A=u,P=r,x=f,R=p,T=n,M=s,L=i,I=d,k=!1;function O(e){return b(e)===c}reactIs_development.AsyncMode=_,reactIs_development.ConcurrentMode=w,reactIs_development.ContextConsumer=E,reactIs_development.ContextProvider=S,reactIs_development.Element=C,reactIs_development.ForwardRef=A,reactIs_development.Fragment=P,reactIs_development.Lazy=x,reactIs_development.Memo=R,reactIs_development.Portal=T,reactIs_development.Profiler=M,reactIs_development.StrictMode=L,reactIs_development.Suspense=I,reactIs_development.isAsyncMode=function(e){return k||(k=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),O(e)||b(e)===l},reactIs_development.isConcurrentMode=O,reactIs_development.isContextConsumer=function(e){return b(e)===o},reactIs_development.isContextProvider=function(e){return b(e)===a},reactIs_development.isElement=function(e){return"object"==typeof e&&null!==e&&e.$$typeof===t},reactIs_development.isForwardRef=function(e){return b(e)===u},reactIs_development.isFragment=function(e){return b(e)===r},reactIs_development.isLazy=function(e){return b(e)===f},reactIs_development.isMemo=function(e){return b(e)===p},reactIs_development.isPortal=function(e){return b(e)===n},reactIs_development.isProfiler=function(e){return b(e)===s},reactIs_development.isStrictMode=function(e){return b(e)===i},reactIs_development.isSuspense=function(e){return b(e)===d},reactIs_development.isValidElementType=function(e){return"string"==typeof e||"function"==typeof e||e===r||e===c||e===s||e===i||e===d||e===h||"object"==typeof e&&null!==e&&(e.$$typeof===f||e.$$typeof===p||e.$$typeof===a||e.$$typeof===o||e.$$typeof===u||e.$$typeof===m||e.$$typeof===v||e.$$typeof===y||e.$$typeof===g)},reactIs_development.typeOf=b}()),reactIs_development}function requireReactIs(){return hasRequiredReactIs||(hasRequiredReactIs=1,e=reactIs,"production"===process.env.NODE_ENV?e.exports=requireReactIs_production_min():e.exports=requireReactIs_development()),reactIs.exports;var e}
10
10
  /*
11
11
  object-assign
12
12
  (c) Sindre Sorhus
@@ -35,27 +35,5 @@ module=exenv,canUseDOM=!("undefined"==typeof window||!window.document||!window.d
35
35
  Licensed under the MIT License (MIT), see
36
36
  http://jedwatson.github.io/classnames
37
37
  */
38
- !function(e){!function(){var t={}.hasOwnProperty;function n(){for(var e=[],r=0;r<arguments.length;r++){var i=arguments[r];if(i){var s=typeof i;if("string"===s||"number"===s)e.push(i);else if(Array.isArray(i)){if(i.length){var a=n.apply(null,i);a&&e.push(a)}}else if("object"===s)if(i.toString===Object.prototype.toString)for(var o in i)t.call(i,o)&&i[o]&&e.push(o);else e.push(i.toString())}}return e.join(" ")}e.exports?(n.default=n,e.exports=n):window.classNames=n}()}(classnames);var classNames=classnames.exports;const OverlayImpl=({children:e,className:t="",isOpen:n,style:r})=>{const[i,s]=React.useState(!1);return React.createElement(Modal,{isOpen:n,ariaHideApp:!1,onAfterOpen:()=>{s(!0)},onRequestClose:()=>{s(!1)},className:classNames("wy-panel wy-overlay wy-transition",t,{"wy-open":i}),overlayClassName:"wy-overlays wy-viewport",contentLabel:"Example Modal",style:r},e)},UIOverlay={UI:OverlayImpl};var mdiArrowLeft="M20,11V13H8L13.5,18.5L12.08,19.92L4.16,12L12.08,4.08L13.5,5.5L8,11H20Z",mdiArrowRight="M4,11V13H16L10.5,18.5L11.92,19.92L19.84,12L11.92,4.08L10.5,5.5L16,11H4Z",mdiAttachment="M7.5,18A5.5,5.5 0 0,1 2,12.5A5.5,5.5 0 0,1 7.5,7H18A4,4 0 0,1 22,11A4,4 0 0,1 18,15H9.5A2.5,2.5 0 0,1 7,12.5A2.5,2.5 0 0,1 9.5,10H17V11.5H9.5A1,1 0 0,0 8.5,12.5A1,1 0 0,0 9.5,13.5H18A2.5,2.5 0 0,0 20.5,11A2.5,2.5 0 0,0 18,8.5H7.5A4,4 0 0,0 3.5,12.5A4,4 0 0,0 7.5,16.5H17V18H7.5Z",mdiBox="M15.39,14.04V14.04C15.39,12.62 14.24,11.47 12.82,11.47C11.41,11.47 10.26,12.62 10.26,14.04V14.04C10.26,15.45 11.41,16.6 12.82,16.6C14.24,16.6 15.39,15.45 15.39,14.04M17.1,14.04C17.1,16.4 15.18,18.31 12.82,18.31C11.19,18.31 9.77,17.39 9.05,16.04C8.33,17.39 6.91,18.31 5.28,18.31C2.94,18.31 1.04,16.43 1,14.11V14.11H1V7H1V7C1,6.56 1.39,6.18 1.86,6.18C2.33,6.18 2.7,6.56 2.71,7V7H2.71V10.62C3.43,10.08 4.32,9.76 5.28,9.76C6.91,9.76 8.33,10.68 9.05,12.03C9.77,10.68 11.19,9.76 12.82,9.76C15.18,9.76 17.1,11.68 17.1,14.04V14.04M7.84,14.04V14.04C7.84,12.62 6.69,11.47 5.28,11.47C3.86,11.47 2.71,12.62 2.71,14.04V14.04C2.71,15.45 3.86,16.6 5.28,16.6C6.69,16.6 7.84,15.45 7.84,14.04M22.84,16.96V16.96C22.95,17.12 23,17.3 23,17.47C23,17.73 22.88,18 22.66,18.15C22.5,18.26 22.33,18.32 22.15,18.32C21.9,18.32 21.65,18.21 21.5,18L19.59,15.47L17.7,18V18C17.53,18.21 17.28,18.32 17.03,18.32C16.85,18.32 16.67,18.26 16.5,18.15C16.29,18 16.17,17.72 16.17,17.46C16.17,17.29 16.23,17.11 16.33,16.96V16.96H16.33V16.96L18.5,14.04L16.33,11.11V11.11H16.33V11.11C16.22,10.96 16.17,10.79 16.17,10.61C16.17,10.35 16.29,10.1 16.5,9.93C16.89,9.65 17.41,9.72 17.7,10.09V10.09L19.59,12.61L21.5,10.09C21.76,9.72 22.29,9.65 22.66,9.93C22.89,10.1 23,10.36 23,10.63C23,10.8 22.95,10.97 22.84,11.11V11.11H22.84V11.11L20.66,14.04L22.84,16.96V16.96H22.84Z",mdiClose="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z",mdiCloseCircle="M12,2C17.53,2 22,6.47 22,12C22,17.53 17.53,22 12,22C6.47,22 2,17.53 2,12C2,6.47 6.47,2 12,2M15.59,7L12,10.59L8.41,7L7,8.41L10.59,12L7,15.59L8.41,17L12,13.41L15.59,17L17,15.59L13.41,12L17,8.41L15.59,7Z",mdiCloud="M19.35,10.03C18.67,6.59 15.64,4 12,4C9.11,4 6.6,5.64 5.35,8.03C2.34,8.36 0,10.9 0,14A6,6 0 0,0 6,20H19A5,5 0 0,0 24,15C24,12.36 21.95,10.22 19.35,10.03Z",mdiDotsVertical="M12,16A2,2 0 0,1 14,18A2,2 0 0,1 12,20A2,2 0 0,1 10,18A2,2 0 0,1 12,16M12,10A2,2 0 0,1 14,12A2,2 0 0,1 12,14A2,2 0 0,1 10,12A2,2 0 0,1 12,10M12,4A2,2 0 0,1 14,6A2,2 0 0,1 12,8A2,2 0 0,1 10,6A2,2 0 0,1 12,4Z",mdiDownload="M5,20H19V18H5M19,9H15V3H9V9H5L12,16L19,9Z",mdiDropbox="M3 6.2L8 9.39L13 6.2L8 3L3 6.2M13 6.2L18 9.39L23 6.2L18 3L13 6.2M3 12.55L8 15.74L13 12.55L8 9.35L3 12.55M18 9.35L13 12.55L18 15.74L23 12.55L18 9.35M8.03 16.8L13.04 20L18.04 16.8L13.04 13.61L8.03 16.8Z",mdiEmail="M20,8L12,13L4,8V6L12,11L20,6M20,4H4C2.89,4 2,4.89 2,6V18A2,2 0 0,0 4,20H20A2,2 0 0,0 22,18V6C22,4.89 21.1,4 20,4Z",mdiFile="M13,9V3.5L18.5,9M6,2C4.89,2 4,2.89 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2H6Z",mdiFileCode="M13,9H18.5L13,3.5V9M6,2H14L20,8V20A2,2 0 0,1 18,22H6C4.89,22 4,21.1 4,20V4C4,2.89 4.89,2 6,2M6.12,15.5L9.86,19.24L11.28,17.83L8.95,15.5L11.28,13.17L9.86,11.76L6.12,15.5M17.28,15.5L13.54,11.76L12.12,13.17L14.45,15.5L12.12,17.83L13.54,19.24L17.28,15.5Z",mdiFileDocument="M13,9H18.5L13,3.5V9M6,2H14L20,8V20A2,2 0 0,1 18,22H6C4.89,22 4,21.1 4,20V4C4,2.89 4.89,2 6,2M15,18V16H6V18H15M18,14V12H6V14H18Z",mdiFileExcel="M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M15.8,20H14L12,16.6L10,20H8.2L11.1,15.5L8.2,11H10L12,14.4L14,11H15.8L12.9,15.5L15.8,20M13,9V3.5L18.5,9H13Z",mdiFileImage="M13,9H18.5L13,3.5V9M6,2H14L20,8V20A2,2 0 0,1 18,22H6C4.89,22 4,21.1 4,20V4C4,2.89 4.89,2 6,2M6,20H15L18,20V12L14,16L12,14L6,20M8,9A2,2 0 0,0 6,11A2,2 0 0,0 8,13A2,2 0 0,0 10,11A2,2 0 0,0 8,9Z",mdiFileMusic="M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M13,13H11V18A2,2 0 0,1 9,20A2,2 0 0,1 7,18A2,2 0 0,1 9,16C9.4,16 9.7,16.1 10,16.3V11H13V13M13,9V3.5L18.5,9H13Z",mdiFilePowerpoint="M12.6,12.3H10.6V15.5H12.7C13.3,15.5 13.6,15.3 13.9,15C14.2,14.7 14.3,14.4 14.3,13.9C14.3,13.4 14.2,13.1 13.9,12.8C13.6,12.5 13.2,12.3 12.6,12.3M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M15.2,16C14.6,16.5 14.1,16.7 12.8,16.7H10.6V20H9V11H12.8C14.1,11 14.7,11.3 15.2,11.8C15.8,12.4 16,13 16,13.9C16,14.8 15.8,15.5 15.2,16M13,9V3.5L18.5,9H13Z",mdiFileVideo="M13,9H18.5L13,3.5V9M6,2H14L20,8V20A2,2 0 0,1 18,22H6C4.89,22 4,21.1 4,20V4C4,2.89 4.89,2 6,2M17,19V13L14,15.2V13H7V19H14V16.8L17,19Z",mdiFileWord="M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M15.2,20H13.8L12,13.2L10.2,20H8.8L6.6,11H8.1L9.5,17.8L11.3,11H12.6L14.4,17.8L15.8,11H17.3L15.2,20M13,9V3.5L18.5,9H13Z",mdiFitToPage="M20,2H4C2.89,2 2,2.89 2,4V20C2,21.11 2.89,22 4,22H20C21.11,22 22,21.11 22,20V4C22,2.89 21.11,2 20,2M12,4L15,7H13V9H11V7H9M7,15L4,12L7,9V11H9V13H7M12,20L9,17H11V15H13V17H15M17,15V13H15V11H17V9L20,12",mdiFitToScreen="M17 4H20C21.1 4 22 4.9 22 6V8H20V6H17V4M4 8V6H7V4H4C2.9 4 2 4.9 2 6V8H4M20 16V18H17V20H20C21.1 20 22 19.1 22 18V16H20M7 18H4V16H2V18C2 19.1 2.9 20 4 20H7V18M18 8H6V16H18V8Z",mdiFolderZip="M20 6H12L10 4H4C2.9 4 2 4.9 2 6V18C2 19.1 2.9 20 4 20H20C21.1 20 22 19.1 22 18V8C22 6.9 21.1 6 20 6M18 12H16V14H18V16H16V18H14V16H16V14H14V12H16V10H14V8H16V10H18V12Z",mdiGoogleDrive="M7.71,3.5L1.15,15L4.58,21L11.13,9.5M9.73,15L6.3,21H19.42L22.85,15M22.28,14L15.42,2H8.58L8.57,2L15.43,14H22.28Z",mdiMagnify="M9.5,3A6.5,6.5 0 0,1 16,9.5C16,11.11 15.41,12.59 14.44,13.73L14.71,14H15.5L20.5,19L19,20.5L14,15.5V14.71L13.73,14.44C12.59,15.41 11.11,16 9.5,16A6.5,6.5 0 0,1 3,9.5A6.5,6.5 0 0,1 9.5,3M9.5,5C7,5 5,7 5,9.5C5,12 7,14 9.5,14C12,14 14,12 14,9.5C14,7 12,5 9.5,5Z",mdiMicrosoftOnedrive="M18.21 10.29Q19 10.34 19.7 10.68 20.39 11 20.9 11.57 21.41 12.12 21.71 12.83 22 13.54 22 14.34 22 15.18 21.68 15.92 21.36 16.66 20.8 17.21 20.25 17.76 19.5 18.08 18.78 18.41 17.94 18.41H7Q5.97 18.41 5.06 18 4.15 17.61 3.47 16.94 2.79 16.26 2.4 15.35 2 14.44 2 13.41 2 12.59 2.26 11.83 2.5 11.08 3 10.45 3.44 9.82 4.08 9.35 4.72 8.88 5.5 8.63 5.87 8.5 6.21 8.5 6.56 8.43 6.93 8.41H6.94Q7.37 7.75 7.95 7.23 8.5 6.71 9.2 6.34 9.87 6 10.62 5.78 11.37 5.59 12.16 5.59 13.22 5.59 14.2 5.94 15.18 6.29 16 6.91 16.8 7.53 17.37 8.39 17.95 9.26 18.21 10.29M12.16 6.84Q11.05 6.84 10.06 7.3 9.06 7.75 8.36 8.6 8.73 8.7 9.07 8.85 9.4 9 9.73 9.2L13.71 11.58L16 10.62Q16.21 10.53 16.44 10.45 16.67 10.38 16.92 10.33 16.68 9.55 16.21 8.91 15.74 8.27 15.11 7.81 14.5 7.35 13.73 7.1 13 6.84 12.16 6.84M4 15.66L12.27 12.18L9.08 10.26Q8.59 9.97 8.06 9.81 7.5 9.66 6.95 9.66 6.19 9.66 5.5 9.96 4.84 10.26 4.34 10.77 3.84 11.29 3.54 11.97 3.25 12.65 3.25 13.41 3.25 14 3.45 14.59 3.64 15.19 4 15.66M17.94 17.16Q18.41 17.16 18.84 17 19.27 16.86 19.64 16.58L13.61 13L5.03 16.59Q5.47 16.86 5.97 17 6.47 17.16 7 17.16M20.45 15.61Q20.75 15 20.75 14.34 20.75 13.7 20.5 13.17 20.26 12.65 19.85 12.28 19.43 11.91 18.88 11.71 18.32 11.5 17.7 11.5 17.35 11.5 17 11.6 16.66 11.68 16.33 11.81 16 11.93 15.67 12.08 15.35 12.23 15.04 12.37Z",mdiMinus="M19,13H5V11H19V13Z",mdiOpenInNew="M14,3V5H17.59L7.76,14.83L9.17,16.24L19,6.41V10H21V3M19,19H5V5H12V3H5C3.89,3 3,3.9 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V12H19V19Z",mdiPin="M16,12V4H17V2H7V4H8V12L6,14V16H11.2V22H12.8V16H18V14L16,12Z",mdiPlus="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z",mdiPlusCircleOutline="M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M13,7H11V11H7V13H11V17H13V13H17V11H13V7Z",mdiSend="M2,21L23,12L2,3V10L17,12L2,14V21Z",mdiVideo="M17,10.5V7A1,1 0 0,0 16,6H4A1,1 0 0,0 3,7V17A1,1 0 0,0 4,18H16A1,1 0 0,0 17,17V13.5L21,17.5V6.5L17,10.5Z",Icon$1=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=2)}([function(e,t){e.exports=requirePropTypes()},function(e,t){e.exports=React},function(e,t,n){n.r(t);var r=n(1),i=n(0),s=function(){return(s=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},a=0,o=r.forwardRef((function(e,t){var n=e.title,i=void 0===n?null:n,o=e.description,l=void 0===o?null:o,c=e.size,u=void 0===c?null:c,d=e.color,h=void 0===d?"currentColor":d,p=e.horizontal,f=void 0===p?null:p,g=e.vertical,m=void 0===g?null:g,v=e.rotate,y=void 0===v?null:v,b=e.spin,_=void 0===b?null:b,w=e.style,E=void 0===w?{}:w,S=e.children,C=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(e,["title","description","size","color","horizontal","vertical","rotate","spin","style","children"]);a++;var A,P=null!==_&&_,x=r.Children.map(S,(function(e){var t=e;!0!==P&&(P=!0===(null===_?t.props.spin:_));var n=t.props.size;"number"==typeof u&&"number"==typeof t.props.size&&(n=t.props.size/u);var i={size:n,color:null===h?t.props.color:h,horizontal:null===f?t.props.horizontal:f,vertical:null===m?t.props.vertical:m,rotate:null===y?t.props.rotate:y,spin:null===_?t.props.spin:_,inStack:!0};return r.cloneElement(t,i)}));null!==u&&(E.width="string"==typeof u?u:1.5*u+"rem");var T,R="stack_labelledby_"+a,M="stack_describedby_"+a;if(i)A=l?R+" "+M:R;else if(T="presentation",l)throw new Error("title attribute required when description is set");return r.createElement("svg",s({ref:t,viewBox:"0 0 24 24",style:E,role:T,"aria-labelledby":A},C),i&&r.createElement("title",{id:R},i),l&&r.createElement("desc",{id:M},l),P&&r.createElement("style",null,"@keyframes spin { to { transform: rotate(360deg) } }","@keyframes spin-inverse { to { transform: rotate(-360deg) } }"),x)}));o.displayName="Stack",o.propTypes={size:i.oneOfType([i.number,i.string]),color:i.string,horizontal:i.bool,vertical:i.bool,rotate:i.number,spin:i.oneOfType([i.bool,i.number]),children:i.oneOfType([i.arrayOf(i.node),i.node]).isRequired,className:i.string,style:i.object},o.defaultProps={size:null,color:null,horizontal:null,vertical:null,rotate:null,spin:null};var l=o;n.d(t,"Icon",(function(){return d})),n.d(t,"Stack",(function(){return l}));var c=function(){return(c=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},u=0,d=r.forwardRef((function(e,t){var n=e.path,i=e.id,s=void 0===i?++u:i,a=e.title,o=void 0===a?null:a,l=e.description,d=void 0===l?null:l,h=e.size,p=void 0===h?null:h,f=e.color,g=void 0===f?"currentColor":f,m=e.horizontal,v=void 0!==m&&m,y=e.vertical,b=void 0!==y&&y,_=e.rotate,w=void 0===_?0:_,E=e.spin,S=void 0!==E&&E,C=e.style,A=void 0===C?{}:C,P=e.inStack,x=void 0!==P&&P,T=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(e,["path","id","title","description","size","color","horizontal","vertical","rotate","spin","style","inStack"]),R={},M=[];null!==p&&(x?M.push("scale("+p+")"):(A.width="string"==typeof p?p:1.5*p+"rem",A.height=A.width)),v&&M.push("scaleX(-1)"),b&&M.push("scaleY(-1)"),0!==w&&M.push("rotate("+w+"deg)"),null!==g&&(R.fill=g);var L=r.createElement("path",c({d:n,style:R},x?T:{})),I=L;M.length>0&&(A.transform=M.join(" "),A.transformOrigin="center",x&&(I=r.createElement("g",{style:A},L,r.createElement("rect",{width:"24",height:"24",fill:"transparent"}))));var k,O=I,F=!0===S||"number"!=typeof S?2:S,D=!x&&(v||b);if(F<0&&(D=!D),S&&(O=r.createElement("g",{style:{animation:"spin"+(D?"-inverse":"")+" linear "+Math.abs(F)+"s infinite",transformOrigin:"center"}},I,!(v||b||0!==w)&&r.createElement("rect",{width:"24",height:"24",fill:"transparent"}))),x)return O;var N,U="icon_labelledby_"+s,j="icon_describedby_"+s;if(o)k=d?U+" "+j:U;else if(N="presentation",d)throw new Error("title attribute required when description is set");return r.createElement("svg",c({ref:t,viewBox:"0 0 24 24",style:A,role:N,"aria-labelledby":k},T),o&&r.createElement("title",{id:U},o),d&&r.createElement("desc",{id:j},d),!x&&S&&(D?r.createElement("style",null,"@keyframes spin-inverse { to { transform: rotate(-360deg) } }"):r.createElement("style",null,"@keyframes spin { to { transform: rotate(360deg) } }")),O)}));d.displayName="Icon",d.propTypes={path:i.string.isRequired,size:i.oneOfType([i.number,i.string]),color:i.string,horizontal:i.bool,vertical:i.bool,rotate:i.number,spin:i.oneOfType([i.bool,i.number]),style:i.object,inStack:i.bool,className:i.string},d.defaultProps={size:null,color:"currentColor",horizontal:!1,vertical:!1,rotate:0,spin:!1},t.default=d}]);const iconMapping={attachment:mdiAttachment,back:mdiArrowLeft,close:mdiClose,"close-circle":mdiCloseCircle,"dots-vertical":mdiDotsVertical,download:mdiDownload,"emoticon-plus":"M 19 0 L 19 3 L 16 3 L 16 5 L 19 5 L 19 8 L 21 8 L 21 5 L 24 5 L 24 3 L 21 3 L 21 0 L 19 0 z M 12 2 C 6.5 2 2 6.5 2 12 C 2 17.5 6.5 22 12 22 C 17.5 22 22 17.5 22 12 L 20 12 C 20 16.4 16.4 20 12 20 C 7.6 20 4 16.4 4 12 C 4 7.6 7.6 4 12 4 L 12 2 z M 8.5 8 C 7.7 8 7 8.7 7 9.5 C 7 10.3 7.7 11 8.5 11 C 9.3 11 10 10.3 10 9.5 C 10 8.7 9.3 8 8.5 8 z M 15.5 8 C 14.7 8 14 8.7 14 9.5 C 14 10.3 14.7 11 15.5 11 C 16.3 11 17 10.3 17 9.5 C 17 8.7 16.3 8 15.5 8 z M 6.9 14 C 7.7 16 9.7 17.5 12 17.5 C 14.3 17.5 16.3 16 17.1 14 L 6.9 14 z","fit-screen":mdiFitToScreen,"fit-width":mdiFitToPage,magnify:mdiMagnify,minus:mdiMinus,next:mdiArrowRight,"open-in-new":mdiOpenInNew,pin:mdiPin,plus:mdiPlus,"plus-circle-outline":mdiPlusCircleOutline,previous:mdiArrowLeft,send:mdiSend,video:mdiVideo,email:mdiEmail,file:mdiFile,"file-music":mdiFileMusic,"file-image":mdiFileImage,"file-video":mdiFileVideo,"file-code":mdiFileCode,"file-xml":mdiFileCode,"file-document":mdiFileDocument,"file-word":mdiFileWord,"file-excel":mdiFileExcel,"file-pdf":mdiFileDocument,"file-powerpoint":mdiFilePowerpoint,"file-compressed":mdiFolderZip,dropbox:mdiDropbox,ondedrive:mdiMicrosoftOnedrive,box:mdiBox,"google-drive":mdiGoogleDrive,zoom:"m12 2c-5.6 0-10 4.5-10 10 0 5.6 4.5 10 10 10 5.5 0 9.9-4.5 9.9-10 .1-5.6-4.4-10-9.9-10zm2.6 13.1c0 .2-.1.3-.3.3h-6.9c-1.1 0-1.9-.8-1.9-1.9v-4.6c0-.2.1-.3.3-.3h6.9c1 0 1.9.8 1.9 1.9zm3.8.1c0 .4-.2.4-.5.2l-2.8-2.1v-2.6l2.8-2.1c.2-.2.5-.1.5.2z",cloud:mdiCloud};function getIconMapping(e){let[t]=e.split("+");return t in iconMapping?iconMapping[t]:""}function getIconOverlay(e){let[,t]=e.split("+");return t in iconMapping?iconMapping[t]:""}const Icon=e=>{var{name:t,color:n="",size:r}=e,i=__rest(e,["name","color","size"]);let s=getIconMapping(t),a=getIconOverlay(t);return React.createElement("span",Object.assign({className:"wy-icon"+(n?" wy-icon-"+n:""),style:{width:r&&1.5*r+"rem",height:r&&1.5*r+"rem"}},i),s?React.createElement(Icon$1.Icon,{color:n,path:s,size:r}):t,a&&React.createElement(Icon$1.Icon,{color:n,path:a,className:"wy-icon-overlay",size:(r||1)/2}))},UIIcon={UI:Icon},Button=e=>{var{active:t=!1,type:n="button",onClick:r,className:i="",children:s}=e,a=__rest(e,["active","type","onClick","className","children"]);let o=1===React.Children.count(s)&&React.Children.toArray(s).pop(),l=classNames("wy-button",i,{"wy-active":t,"wy-button-icon":(null==o?void 0:o.type)===UIIcon.UI});return React.createElement("button",Object.assign({type:n,className:l,onClick:r},a),s)},UIButton={UI:Button},SpinnerImpl=({spin:e=!0,size:t=24,overlay:n=!1})=>React.createElement("svg",{className:classNames("wy-spinner",{"wy-spin":e,"wy-spinner-overlay":n}),width:t,height:t,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},React.createElement("circle",{fill:"none",cx:"12",cy:"12",r:"11",strokeLinecap:"butt",strokeWidth:"2"})),UISpinner={UI:SpinnerImpl};function commonjsRequire(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var pdf={exports:{}},_nodeResolve_empty={},_nodeResolve_empty$1=Object.freeze({__proto__:null,default:_nodeResolve_empty}),require$$5=getAugmentedNamespace(_nodeResolve_empty$1);
39
- /**
40
- * @licstart The following is the entire license notice for the
41
- * JavaScript code in this page
42
- *
43
- * Copyright 2022 Mozilla Foundation
44
- *
45
- * Licensed under the Apache License, Version 2.0 (the "License");
46
- * you may not use this file except in compliance with the License.
47
- * You may obtain a copy of the License at
48
- *
49
- * http://www.apache.org/licenses/LICENSE-2.0
50
- *
51
- * Unless required by applicable law or agreed to in writing, software
52
- * distributed under the License is distributed on an "AS IS" BASIS,
53
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
54
- * See the License for the specific language governing permissions and
55
- * limitations under the License.
56
- *
57
- * @licend The above is the entire license notice for the
58
- * JavaScript code in this page
59
- */
60
- (function(module,exports){var factory;globalThis,factory=()=>(()=>{var __webpack_modules__=[,(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.VerbosityLevel=t.Util=t.UnknownErrorException=t.UnexpectedResponseException=t.UNSUPPORTED_FEATURES=t.TextRenderingMode=t.StreamType=t.RenderingIntentFlag=t.PermissionFlag=t.PasswordResponses=t.PasswordException=t.PageActionEventType=t.OPS=t.MissingPDFException=t.LINE_FACTOR=t.LINE_DESCENT_FACTOR=t.InvalidPDFException=t.ImageKind=t.IDENTITY_MATRIX=t.FormatError=t.FontType=t.FeatureTest=t.FONT_IDENTITY_MATRIX=t.DocumentActionEventType=t.CMapCompressionType=t.BaseException=t.AnnotationType=t.AnnotationStateModelType=t.AnnotationReviewState=t.AnnotationReplyType=t.AnnotationMode=t.AnnotationMarkedState=t.AnnotationFlag=t.AnnotationFieldFlag=t.AnnotationEditorType=t.AnnotationEditorPrefix=t.AnnotationEditorParamsType=t.AnnotationBorderStyleType=t.AnnotationActionEventType=t.AbortException=void 0,t.arrayByteLength=u,t.arraysToBytes=function(e){const t=e.length;if(1===t&&e[0]instanceof Uint8Array)return e[0];let n=0;for(let r=0;r<t;r++)n+=u(e[r]);let r=0;const i=new Uint8Array(n);for(let n=0;n<t;n++){let t=e[n];t instanceof Uint8Array||(t="string"==typeof t?c(t):new Uint8Array(t));const s=t.byteLength;i.set(t,r),r+=s}return i},t.assert=function(e,t){e||a(t)},t.bytesToString=function(e){"object"==typeof e&&null!==e&&void 0!==e.length||a("Invalid argument for bytesToString");const t=e.length,n=8192;if(t<n)return String.fromCharCode.apply(null,e);const r=[];for(let i=0;i<t;i+=n){const s=Math.min(i+n,t),a=e.subarray(i,s);r.push(String.fromCharCode.apply(null,a))}return r.join("")},t.createPromiseCapability=function(){const e=Object.create(null);let t=!1;return Object.defineProperty(e,"settled",{get:()=>t}),e.promise=new Promise((function(n,r){e.resolve=function(e){t=!0,n(e)},e.reject=function(e){t=!0,r(e)}})),e},t.createValidAbsoluteUrl=function(e,t=null,n=null){if(!e)return null;try{if(n&&"string"==typeof e){if(n.addDefaultProtocol&&e.startsWith("www.")){const t=e.match(/\./g);t&&t.length>=2&&(e=`http://${e}`)}if(n.tryConvertEncoding)try{e=f(e)}catch(e){}}const r=t?new URL(e,t):new URL(e);if(function(e){if(!e)return!1;switch(e.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}(r))return r}catch(e){}return null},t.escapeString=function(e){return e.replace(/([()\\\n\r])/g,(e=>"\n"===e?"\\n":"\r"===e?"\\r":`\\${e}`))},t.getModificationDate=function(e=new Date){return[e.getUTCFullYear().toString(),(e.getUTCMonth()+1).toString().padStart(2,"0"),e.getUTCDate().toString().padStart(2,"0"),e.getUTCHours().toString().padStart(2,"0"),e.getUTCMinutes().toString().padStart(2,"0"),e.getUTCSeconds().toString().padStart(2,"0")].join("")},t.getVerbosityLevel=function(){return i},t.info=function(e){i>=r.INFOS&&console.log(`Info: ${e}`)},t.isArrayBuffer=function(e){return"object"==typeof e&&null!==e&&void 0!==e.byteLength},t.isArrayEqual=function(e,t){if(e.length!==t.length)return!1;for(let n=0,r=e.length;n<r;n++)if(e[n]!==t[n])return!1;return!0},t.isAscii=function(e){return/^[\x00-\x7F]*$/.test(e)},t.objectFromMap=function(e){const t=Object.create(null);for(const[n,r]of e)t[n]=r;return t},t.objectSize=function(e){return Object.keys(e).length},t.setVerbosityLevel=function(e){Number.isInteger(e)&&(i=e)},t.shadow=o,t.string32=function(e){return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,255&e)},t.stringToBytes=c,t.stringToPDFString=function(e){if(e[0]>="ï"){let t;if("þ"===e[0]&&"ÿ"===e[1]?t="utf-16be":"ÿ"===e[0]&&"þ"===e[1]?t="utf-16le":"ï"===e[0]&&"»"===e[1]&&"¿"===e[2]&&(t="utf-8"),t)try{const n=new TextDecoder(t,{fatal:!0}),r=c(e);return n.decode(r)}catch(e){s(`stringToPDFString: "${e}".`)}}const t=[];for(let n=0,r=e.length;n<r;n++){const r=p[e.charCodeAt(n)];t.push(r?String.fromCharCode(r):e.charAt(n))}return t.join("")},t.stringToUTF16BEString=function(e){const t=["þÿ"];for(let n=0,r=e.length;n<r;n++){const r=e.charCodeAt(n);t.push(String.fromCharCode(r>>8&255),String.fromCharCode(255&r))}return t.join("")},t.stringToUTF8String=f,t.unreachable=a,t.utf8StringToString=function(e){return unescape(encodeURIComponent(e))},t.warn=s,n(2),t.IDENTITY_MATRIX=[1,0,0,1,0,0],t.FONT_IDENTITY_MATRIX=[.001,0,0,.001,0,0],t.LINE_FACTOR=1.35,t.LINE_DESCENT_FACTOR=.35,t.RenderingIntentFlag={ANY:1,DISPLAY:2,PRINT:4,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,OPLIST:256},t.AnnotationMode={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},t.AnnotationEditorPrefix="pdfjs_internal_editor_",t.AnnotationEditorType={DISABLE:-1,NONE:0,FREETEXT:3,INK:15},t.AnnotationEditorParamsType={FREETEXT_SIZE:1,FREETEXT_COLOR:2,FREETEXT_OPACITY:3,INK_COLOR:11,INK_THICKNESS:12,INK_OPACITY:13},t.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},t.TextRenderingMode={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_ADD_TO_PATH:4,STROKE_ADD_TO_PATH:5,FILL_STROKE_ADD_TO_PATH:6,ADD_TO_PATH:7,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},t.ImageKind={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},t.AnnotationType={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},t.AnnotationStateModelType={MARKED:"Marked",REVIEW:"Review"},t.AnnotationMarkedState={MARKED:"Marked",UNMARKED:"Unmarked"},t.AnnotationReviewState={ACCEPTED:"Accepted",REJECTED:"Rejected",CANCELLED:"Cancelled",COMPLETED:"Completed",NONE:"None"},t.AnnotationReplyType={GROUP:"Group",REPLY:"R"},t.AnnotationFlag={INVISIBLE:1,HIDDEN:2,PRINT:4,NOZOOM:8,NOROTATE:16,NOVIEW:32,READONLY:64,LOCKED:128,TOGGLENOVIEW:256,LOCKEDCONTENTS:512},t.AnnotationFieldFlag={READONLY:1,REQUIRED:2,NOEXPORT:4,MULTILINE:4096,PASSWORD:8192,NOTOGGLETOOFF:16384,RADIO:32768,PUSHBUTTON:65536,COMBO:131072,EDIT:262144,SORT:524288,FILESELECT:1048576,MULTISELECT:2097152,DONOTSPELLCHECK:4194304,DONOTSCROLL:8388608,COMB:16777216,RICHTEXT:33554432,RADIOSINUNISON:33554432,COMMITONSELCHANGE:67108864},t.AnnotationBorderStyleType={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},t.AnnotationActionEventType={E:"Mouse Enter",X:"Mouse Exit",D:"Mouse Down",U:"Mouse Up",Fo:"Focus",Bl:"Blur",PO:"PageOpen",PC:"PageClose",PV:"PageVisible",PI:"PageInvisible",K:"Keystroke",F:"Format",V:"Validate",C:"Calculate"},t.DocumentActionEventType={WC:"WillClose",WS:"WillSave",DS:"DidSave",WP:"WillPrint",DP:"DidPrint"},t.PageActionEventType={O:"PageOpen",C:"PageClose"},t.StreamType={UNKNOWN:"UNKNOWN",FLATE:"FLATE",LZW:"LZW",DCT:"DCT",JPX:"JPX",JBIG:"JBIG",A85:"A85",AHX:"AHX",CCF:"CCF",RLX:"RLX"},t.FontType={UNKNOWN:"UNKNOWN",TYPE1:"TYPE1",TYPE1STANDARD:"TYPE1STANDARD",TYPE1C:"TYPE1C",CIDFONTTYPE0:"CIDFONTTYPE0",CIDFONTTYPE0C:"CIDFONTTYPE0C",TRUETYPE:"TRUETYPE",CIDFONTTYPE2:"CIDFONTTYPE2",TYPE3:"TYPE3",OPENTYPE:"OPENTYPE",TYPE0:"TYPE0",MMTYPE1:"MMTYPE1"};const r={ERRORS:0,WARNINGS:1,INFOS:5};t.VerbosityLevel=r,t.CMapCompressionType={NONE:0,BINARY:1,STREAM:2},t.OPS={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,beginAnnotations:78,endAnnotations:79,beginAnnotation:80,endAnnotation:81,paintJpegXObject:82,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91},t.UNSUPPORTED_FEATURES={unknown:"unknown",forms:"forms",javaScript:"javaScript",signatures:"signatures",smask:"smask",shadingPattern:"shadingPattern",font:"font",errorTilingPattern:"errorTilingPattern",errorExtGState:"errorExtGState",errorXObject:"errorXObject",errorFontLoadType3:"errorFontLoadType3",errorFontState:"errorFontState",errorFontMissing:"errorFontMissing",errorFontTranslate:"errorFontTranslate",errorColorSpace:"errorColorSpace",errorOperatorList:"errorOperatorList",errorFontToUnicode:"errorFontToUnicode",errorFontLoadNative:"errorFontLoadNative",errorFontBuildPath:"errorFontBuildPath",errorFontGetPath:"errorFontGetPath",errorMarkedContent:"errorMarkedContent",errorContentSubStream:"errorContentSubStream"},t.PasswordResponses={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let i=r.WARNINGS;function s(e){i>=r.WARNINGS&&console.log(`Warning: ${e}`)}function a(e){throw new Error(e)}function o(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!1}),n}const l=function(){function e(t,n){this.constructor===e&&a("Cannot initialize BaseException."),this.message=t,this.name=n}return e.prototype=new Error,e.constructor=e,e}();function c(e){"string"!=typeof e&&a("Invalid argument for stringToBytes");const t=e.length,n=new Uint8Array(t);for(let r=0;r<t;++r)n[r]=255&e.charCodeAt(r);return n}function u(e){return void 0!==e.length?e.length:void 0!==e.byteLength?e.byteLength:void a("Invalid argument for arrayByteLength")}t.BaseException=l,t.PasswordException=class extends l{constructor(e,t){super(e,"PasswordException"),this.code=t}},t.UnknownErrorException=class extends l{constructor(e,t){super(e,"UnknownErrorException"),this.details=t}},t.InvalidPDFException=class extends l{constructor(e){super(e,"InvalidPDFException")}},t.MissingPDFException=class extends l{constructor(e){super(e,"MissingPDFException")}},t.UnexpectedResponseException=class extends l{constructor(e,t){super(e,"UnexpectedResponseException"),this.status=t}},t.FormatError=class extends l{constructor(e){super(e,"FormatError")}},t.AbortException=class extends l{constructor(e){super(e,"AbortException")}},t.FeatureTest=class{static get isLittleEndian(){return o(this,"isLittleEndian",function(){const e=new Uint8Array(4);return e[0]=1,1===new Uint32Array(e.buffer,0,1)[0]}())}static get isEvalSupported(){return o(this,"isEvalSupported",function(){try{return new Function(""),!0}catch(e){return!1}}())}static get isOffscreenCanvasSupported(){return o(this,"isOffscreenCanvasSupported","undefined"!=typeof OffscreenCanvas)}};const d=[...Array(256).keys()].map((e=>e.toString(16).padStart(2,"0")));class h{static makeHexColor(e,t,n){return`#${d[e]}${d[t]}${d[n]}`}static scaleMinMax(e,t){let n;e[0]?(e[0]<0&&(n=t[0],t[0]=t[1],t[1]=n),t[0]*=e[0],t[1]*=e[0],e[3]<0&&(n=t[2],t[2]=t[3],t[3]=n),t[2]*=e[3],t[3]*=e[3]):(n=t[0],t[0]=t[2],t[2]=n,n=t[1],t[1]=t[3],t[3]=n,e[1]<0&&(n=t[2],t[2]=t[3],t[3]=n),t[2]*=e[1],t[3]*=e[1],e[2]<0&&(n=t[0],t[0]=t[1],t[1]=n),t[0]*=e[2],t[1]*=e[2]),t[0]+=e[4],t[1]+=e[4],t[2]+=e[5],t[3]+=e[5]}static transform(e,t){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]}static applyTransform(e,t){return[e[0]*t[0]+e[1]*t[2]+t[4],e[0]*t[1]+e[1]*t[3]+t[5]]}static applyInverseTransform(e,t){const n=t[0]*t[3]-t[1]*t[2];return[(e[0]*t[3]-e[1]*t[2]+t[2]*t[5]-t[4]*t[3])/n,(-e[0]*t[1]+e[1]*t[0]+t[4]*t[1]-t[5]*t[0])/n]}static getAxialAlignedBoundingBox(e,t){const n=h.applyTransform(e,t),r=h.applyTransform(e.slice(2,4),t),i=h.applyTransform([e[0],e[3]],t),s=h.applyTransform([e[2],e[1]],t);return[Math.min(n[0],r[0],i[0],s[0]),Math.min(n[1],r[1],i[1],s[1]),Math.max(n[0],r[0],i[0],s[0]),Math.max(n[1],r[1],i[1],s[1])]}static inverseTransform(e){const t=e[0]*e[3]-e[1]*e[2];return[e[3]/t,-e[1]/t,-e[2]/t,e[0]/t,(e[2]*e[5]-e[4]*e[3])/t,(e[4]*e[1]-e[5]*e[0])/t]}static apply3dTransform(e,t){return[e[0]*t[0]+e[1]*t[1]+e[2]*t[2],e[3]*t[0]+e[4]*t[1]+e[5]*t[2],e[6]*t[0]+e[7]*t[1]+e[8]*t[2]]}static singularValueDecompose2dScale(e){const t=[e[0],e[2],e[1],e[3]],n=e[0]*t[0]+e[1]*t[2],r=e[0]*t[1]+e[1]*t[3],i=e[2]*t[0]+e[3]*t[2],s=e[2]*t[1]+e[3]*t[3],a=(n+s)/2,o=Math.sqrt((n+s)**2-4*(n*s-i*r))/2,l=a+o||1,c=a-o||1;return[Math.sqrt(l),Math.sqrt(c)]}static normalizeRect(e){const t=e.slice(0);return e[0]>e[2]&&(t[0]=e[2],t[2]=e[0]),e[1]>e[3]&&(t[1]=e[3],t[3]=e[1]),t}static intersect(e,t){const n=Math.max(Math.min(e[0],e[2]),Math.min(t[0],t[2])),r=Math.min(Math.max(e[0],e[2]),Math.max(t[0],t[2]));if(n>r)return null;const i=Math.max(Math.min(e[1],e[3]),Math.min(t[1],t[3])),s=Math.min(Math.max(e[1],e[3]),Math.max(t[1],t[3]));return i>s?null:[n,i,r,s]}static bezierBoundingBox(e,t,n,r,i,s,a,o){const l=[],c=[[],[]];let u,d,h,p,f,g,m,v;for(let c=0;c<2;++c)if(0===c?(d=6*e-12*n+6*i,u=-3*e+9*n-9*i+3*a,h=3*n-3*e):(d=6*t-12*r+6*s,u=-3*t+9*r-9*s+3*o,h=3*r-3*t),Math.abs(u)<1e-12){if(Math.abs(d)<1e-12)continue;p=-h/d,0<p&&p<1&&l.push(p)}else m=d*d-4*h*u,v=Math.sqrt(m),m<0||(f=(-d+v)/(2*u),0<f&&f<1&&l.push(f),g=(-d-v)/(2*u),0<g&&g<1&&l.push(g));let y,b=l.length;const _=b;for(;b--;)p=l[b],y=1-p,c[0][b]=y*y*y*e+3*y*y*p*n+3*y*p*p*i+p*p*p*a,c[1][b]=y*y*y*t+3*y*y*p*r+3*y*p*p*s+p*p*p*o;return c[0][_]=e,c[1][_]=t,c[0][_+1]=a,c[1][_+1]=o,c[0].length=c[1].length=_+2,[Math.min(...c[0]),Math.min(...c[1]),Math.max(...c[0]),Math.max(...c[1])]}}t.Util=h;const p=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,728,711,710,729,733,731,730,732,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8226,8224,8225,8230,8212,8211,402,8260,8249,8250,8722,8240,8222,8220,8221,8216,8217,8218,8482,64257,64258,321,338,352,376,381,305,322,339,353,382,0,8364];function f(e){return decodeURIComponent(escape(e))}},(e,t,n)=>{n(3)},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isNodeJS=void 0;const n=!("object"!=typeof process||process+""!="[object process]"||process.versions.nw||process.versions.electron&&process.type&&"browser"!==process.type);t.isNodeJS=n},(__unused_webpack_module,exports,__w_pdfjs_require__)=>{Object.defineProperty(exports,"__esModule",{value:!0}),exports.build=exports.RenderTask=exports.PDFWorkerUtil=exports.PDFWorker=exports.PDFPageProxy=exports.PDFDocumentProxy=exports.PDFDocumentLoadingTask=exports.PDFDataRangeTransport=exports.LoopbackPort=exports.DefaultStandardFontDataFactory=exports.DefaultCanvasFactory=exports.DefaultCMapReaderFactory=void 0,exports.getDocument=getDocument,exports.setPDFNetworkStreamFactory=setPDFNetworkStreamFactory,exports.version=void 0;var _util=__w_pdfjs_require__(1),_annotation_storage=__w_pdfjs_require__(5),_display_utils=__w_pdfjs_require__(8),_font_loader=__w_pdfjs_require__(11),_canvas=__w_pdfjs_require__(12),_worker_options=__w_pdfjs_require__(15),_is_node=__w_pdfjs_require__(3),_message_handler=__w_pdfjs_require__(16),_metadata=__w_pdfjs_require__(17),_optional_content_config=__w_pdfjs_require__(18),_transport_stream=__w_pdfjs_require__(19),_xfa_text=__w_pdfjs_require__(20);const DEFAULT_RANGE_CHUNK_SIZE=65536,RENDERING_CANCELLED_TIMEOUT=100;let DefaultCanvasFactory=_display_utils.DOMCanvasFactory;exports.DefaultCanvasFactory=DefaultCanvasFactory;let DefaultCMapReaderFactory=_display_utils.DOMCMapReaderFactory;exports.DefaultCMapReaderFactory=DefaultCMapReaderFactory;let DefaultStandardFontDataFactory=_display_utils.DOMStandardFontDataFactory,createPDFNetworkStream;if(exports.DefaultStandardFontDataFactory=DefaultStandardFontDataFactory,_is_node.isNodeJS){const{NodeCanvasFactory:e,NodeCMapReaderFactory:t,NodeStandardFontDataFactory:n}=__w_pdfjs_require__(21);exports.DefaultCanvasFactory=DefaultCanvasFactory=e,exports.DefaultCMapReaderFactory=DefaultCMapReaderFactory=t,exports.DefaultStandardFontDataFactory=DefaultStandardFontDataFactory=n}function setPDFNetworkStreamFactory(e){createPDFNetworkStream=e}function getDocument(e){const t=new PDFDocumentLoadingTask;let n;if("string"==typeof e||e instanceof URL)n={url:e};else if((0,_util.isArrayBuffer)(e))n={data:e};else if(e instanceof PDFDataRangeTransport)n={range:e};else{if("object"!=typeof e)throw new Error("Invalid parameter in getDocument, need either string, URL, TypedArray, or parameter object.");if(!e.url&&!e.data&&!e.range)throw new Error("Invalid parameter object: need either .data, .range or .url");n=e}const r=Object.create(null);let i=null,s=null;for(const e in n){const t=n[e];switch(e){case"url":if("undefined"!=typeof window)try{r[e]=new URL(t,window.location).href;continue}catch(e){(0,_util.warn)(`Cannot create valid URL: "${e}".`)}else if("string"==typeof t||t instanceof URL){r[e]=t.toString();continue}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.");case"range":i=t;continue;case"worker":s=t;continue;case"data":if(_is_node.isNodeJS&&"undefined"!=typeof Buffer&&t instanceof Buffer)r[e]=new Uint8Array(t);else{if(t instanceof Uint8Array)break;if("string"==typeof t)r[e]=(0,_util.stringToBytes)(t);else if("object"!=typeof t||null===t||isNaN(t.length)){if(!(0,_util.isArrayBuffer)(t))throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.");r[e]=new Uint8Array(t)}else r[e]=new Uint8Array(t)}continue}r[e]=t}if(r.CMapReaderFactory=r.CMapReaderFactory||DefaultCMapReaderFactory,r.StandardFontDataFactory=r.StandardFontDataFactory||DefaultStandardFontDataFactory,r.ignoreErrors=!0!==r.stopAtErrors,r.fontExtraProperties=!0===r.fontExtraProperties,r.pdfBug=!0===r.pdfBug,r.enableXfa=!0===r.enableXfa,(!Number.isInteger(r.rangeChunkSize)||r.rangeChunkSize<1)&&(r.rangeChunkSize=DEFAULT_RANGE_CHUNK_SIZE),("string"!=typeof r.docBaseUrl||(0,_display_utils.isDataScheme)(r.docBaseUrl))&&(r.docBaseUrl=null),(!Number.isInteger(r.maxImageSize)||r.maxImageSize<-1)&&(r.maxImageSize=-1),"string"!=typeof r.cMapUrl&&(r.cMapUrl=null),"string"!=typeof r.standardFontDataUrl&&(r.standardFontDataUrl=null),"boolean"!=typeof r.useWorkerFetch&&(r.useWorkerFetch=r.CMapReaderFactory===_display_utils.DOMCMapReaderFactory&&r.StandardFontDataFactory===_display_utils.DOMStandardFontDataFactory),"boolean"!=typeof r.isEvalSupported&&(r.isEvalSupported=!0),"boolean"!=typeof r.disableFontFace&&(r.disableFontFace=_is_node.isNodeJS),"boolean"!=typeof r.useSystemFonts&&(r.useSystemFonts=!_is_node.isNodeJS&&!r.disableFontFace),"object"==typeof r.ownerDocument&&null!==r.ownerDocument||(r.ownerDocument=globalThis.document),"boolean"!=typeof r.disableRange&&(r.disableRange=!1),"boolean"!=typeof r.disableStream&&(r.disableStream=!1),"boolean"!=typeof r.disableAutoFetch&&(r.disableAutoFetch=!1),(0,_util.setVerbosityLevel)(r.verbosity),!s){const e={verbosity:r.verbosity,port:_worker_options.GlobalWorkerOptions.workerPort};s=e.port?PDFWorker.fromPort(e):new PDFWorker(e),t._worker=s}const a=t.docId;return s.promise.then((function(){if(t.destroyed)throw new Error("Loading aborted");const e=_fetchDocument(s,r,i,a),n=new Promise((function(e){let t;i?t=new _transport_stream.PDFDataTransportStream({length:r.length,initialData:r.initialData,progressiveDone:r.progressiveDone,contentDispositionFilename:r.contentDispositionFilename,disableRange:r.disableRange,disableStream:r.disableStream},i):r.data||(t=createPDFNetworkStream({url:r.url,length:r.length,httpHeaders:r.httpHeaders,withCredentials:r.withCredentials,rangeChunkSize:r.rangeChunkSize,disableRange:r.disableRange,disableStream:r.disableStream})),e(t)}));return Promise.all([e,n]).then((function([e,n]){if(t.destroyed)throw new Error("Loading aborted");const i=new _message_handler.MessageHandler(a,e,s.port),o=new WorkerTransport(i,t,n,r);t._transport=o,i.send("Ready",null)}))})).catch(t._capability.reject),t}async function _fetchDocument(e,t,n,r){if(e.destroyed)throw new Error("Worker was destroyed");n&&(t.length=n.length,t.initialData=n.initialData,t.progressiveDone=n.progressiveDone,t.contentDispositionFilename=n.contentDispositionFilename);const i=await e.messageHandler.sendWithPromise("GetDocRequest",{docId:r,apiVersion:"2.16.105",source:{data:t.data,url:t.url,password:t.password,disableAutoFetch:t.disableAutoFetch,rangeChunkSize:t.rangeChunkSize,length:t.length},maxImageSize:t.maxImageSize,disableFontFace:t.disableFontFace,docBaseUrl:t.docBaseUrl,ignoreErrors:t.ignoreErrors,isEvalSupported:t.isEvalSupported,fontExtraProperties:t.fontExtraProperties,enableXfa:t.enableXfa,useSystemFonts:t.useSystemFonts,cMapUrl:t.useWorkerFetch?t.cMapUrl:null,standardFontDataUrl:t.useWorkerFetch?t.standardFontDataUrl:null});if(t.data&&(t.data=null),e.destroyed)throw new Error("Worker was destroyed");return i}class PDFDocumentLoadingTask{static#e=0;constructor(){this._capability=(0,_util.createPromiseCapability)(),this._transport=null,this._worker=null,this.docId="d"+PDFDocumentLoadingTask.#e++,this.destroyed=!1,this.onPassword=null,this.onProgress=null,this.onUnsupportedFeature=null}get promise(){return this._capability.promise}async destroy(){this.destroyed=!0,await(this._transport?.destroy()),this._transport=null,this._worker&&(this._worker.destroy(),this._worker=null)}}exports.PDFDocumentLoadingTask=PDFDocumentLoadingTask;class PDFDataRangeTransport{constructor(e,t,n=!1,r=null){this.length=e,this.initialData=t,this.progressiveDone=n,this.contentDispositionFilename=r,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=(0,_util.createPromiseCapability)()}addRangeListener(e){this._rangeListeners.push(e)}addProgressListener(e){this._progressListeners.push(e)}addProgressiveReadListener(e){this._progressiveReadListeners.push(e)}addProgressiveDoneListener(e){this._progressiveDoneListeners.push(e)}onDataRange(e,t){for(const n of this._rangeListeners)n(e,t)}onDataProgress(e,t){this._readyCapability.promise.then((()=>{for(const n of this._progressListeners)n(e,t)}))}onDataProgressiveRead(e){this._readyCapability.promise.then((()=>{for(const t of this._progressiveReadListeners)t(e)}))}onDataProgressiveDone(){this._readyCapability.promise.then((()=>{for(const e of this._progressiveDoneListeners)e()}))}transportReady(){this._readyCapability.resolve()}requestDataRange(e,t){(0,_util.unreachable)("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}exports.PDFDataRangeTransport=PDFDataRangeTransport;class PDFDocumentProxy{constructor(e,t){this._pdfInfo=e,this._transport=t,Object.defineProperty(this,"fingerprint",{get(){return(0,_display_utils.deprecated)("`PDFDocumentProxy.fingerprint`, please use `PDFDocumentProxy.fingerprints` instead."),this.fingerprints[0]}}),Object.defineProperty(this,"getStats",{value:async()=>((0,_display_utils.deprecated)("`PDFDocumentProxy.getStats`, please use the `PDFDocumentProxy.stats`-getter instead."),this.stats||{streamTypes:{},fontTypes:{}})})}get annotationStorage(){return this._transport.annotationStorage}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get stats(){return this._transport.stats}get isPureXfa(){return!!this._transport._htmlForXfa}get allXfaHtml(){return this._transport._htmlForXfa}getPage(e){return this._transport.getPage(e)}getPageIndex(e){return this._transport.getPageIndex(e)}getDestinations(){return this._transport.getDestinations()}getDestination(e){return this._transport.getDestination(e)}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()}getJavaScript(){return this._transport.getJavaScript()}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig(){return this._transport.getOptionalContentConfig()}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(e=!1){return this._transport.startCleanup(e||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}saveDocument(){return this._transport.annotationStorage.size<=0&&(0,_display_utils.deprecated)("saveDocument called while `annotationStorage` is empty, please use the getData-method instead."),this._transport.saveDocument()}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}exports.PDFDocumentProxy=PDFDocumentProxy;class PDFPageProxy{constructor(e,t,n,r,i=!1){this._pageIndex=e,this._pageInfo=t,this._ownerDocument=r,this._transport=n,this._stats=i?new _display_utils.StatTimer:null,this._pdfBug=i,this.commonObjs=n.commonObjs,this.objs=new PDFObjects,this._bitmaps=new Set,this.cleanupAfterRender=!1,this.pendingCleanup=!1,this._intentStates=new Map,this._annotationPromises=new Map,this.destroyed=!1}get pageNumber(){return this._pageIndex+1}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:e,rotation:t=this.rotate,offsetX:n=0,offsetY:r=0,dontFlip:i=!1}={}){return new _display_utils.PageViewport({viewBox:this.view,scale:e,rotation:t,offsetX:n,offsetY:r,dontFlip:i})}getAnnotations({intent:e="display"}={}){const t=this._transport.getRenderingIntent(e);let n=this._annotationPromises.get(t.cacheKey);return n||(n=this._transport.getAnnotations(this._pageIndex,t.renderingIntent),this._annotationPromises.set(t.cacheKey,n),n=n.then((e=>{for(const t of e)void 0!==t.titleObj&&Object.defineProperty(t,"title",{get:()=>((0,_display_utils.deprecated)("`title`-property on annotation, please use `titleObj` instead."),t.titleObj.str)}),void 0!==t.contentsObj&&Object.defineProperty(t,"contents",{get:()=>((0,_display_utils.deprecated)("`contents`-property on annotation, please use `contentsObj` instead."),t.contentsObj.str)});return e}))),n}getJSActions(){return this._jsActionsPromise||=this._transport.getPageJSActions(this._pageIndex)}async getXfa(){return this._transport._htmlForXfa?.children[this._pageIndex]||null}render({canvasContext:e,viewport:t,intent:n="display",annotationMode:r=_util.AnnotationMode.ENABLE,transform:i=null,imageLayer:s=null,canvasFactory:a=null,background:o=null,optionalContentConfigPromise:l=null,annotationCanvasMap:c=null,pageColors:u=null,printAnnotationStorage:d=null}){void 0!==arguments[0]?.renderInteractiveForms&&((0,_display_utils.deprecated)("render no longer accepts the `renderInteractiveForms`-option, please use the `annotationMode`-option instead."),!0===arguments[0].renderInteractiveForms&&r===_util.AnnotationMode.ENABLE&&(r=_util.AnnotationMode.ENABLE_FORMS)),void 0!==arguments[0]?.includeAnnotationStorage&&((0,_display_utils.deprecated)("render no longer accepts the `includeAnnotationStorage`-option, please use the `annotationMode`-option instead."),!0===arguments[0].includeAnnotationStorage&&r===_util.AnnotationMode.ENABLE&&(r=_util.AnnotationMode.ENABLE_STORAGE)),this._stats&&this._stats.time("Overall");const h=this._transport.getRenderingIntent(n,r,d);this.pendingCleanup=!1,l||(l=this._transport.getOptionalContentConfig());let p=this._intentStates.get(h.cacheKey);p||(p=Object.create(null),this._intentStates.set(h.cacheKey,p)),p.streamReaderCancelTimeout&&(clearTimeout(p.streamReaderCancelTimeout),p.streamReaderCancelTimeout=null);const f=a||new DefaultCanvasFactory({ownerDocument:this._ownerDocument}),g=!!(h.renderingIntent&_util.RenderingIntentFlag.PRINT);p.displayReadyCapability||(p.displayReadyCapability=(0,_util.createPromiseCapability)(),p.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats&&this._stats.time("Page Request"),this._pumpOperatorList(h));const m=e=>{p.renderTasks.delete(v),(this.cleanupAfterRender||g)&&(this.pendingCleanup=!0),this._tryCleanup(),e?(v.capability.reject(e),this._abortOperatorList({intentState:p,reason:e instanceof Error?e:new Error(e)})):v.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"))},v=new InternalRenderTask({callback:m,params:{canvasContext:e,viewport:t,transform:i,imageLayer:s,background:o},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:c,operatorList:p.operatorList,pageIndex:this._pageIndex,canvasFactory:f,useRequestAnimationFrame:!g,pdfBug:this._pdfBug,pageColors:u});(p.renderTasks||=new Set).add(v);const y=v.task;return Promise.all([p.displayReadyCapability.promise,l]).then((([e,t])=>{this.pendingCleanup?m():(this._stats&&this._stats.time("Rendering"),v.initializeGraphics({transparency:e,optionalContentConfig:t}),v.operatorListChanged())})).catch(m),y}getOperatorList({intent:e="display",annotationMode:t=_util.AnnotationMode.ENABLE,printAnnotationStorage:n=null}={}){const r=this._transport.getRenderingIntent(e,t,n,!0);let i,s=this._intentStates.get(r.cacheKey);return s||(s=Object.create(null),this._intentStates.set(r.cacheKey,s)),s.opListReadCapability||(i=Object.create(null),i.operatorListChanged=function(){s.operatorList.lastChunk&&(s.opListReadCapability.resolve(s.operatorList),s.renderTasks.delete(i))},s.opListReadCapability=(0,_util.createPromiseCapability)(),(s.renderTasks||=new Set).add(i),s.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats&&this._stats.time("Page Request"),this._pumpOperatorList(r)),s.opListReadCapability.promise}streamTextContent({disableCombineTextItems:e=!1,includeMarkedContent:t=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,combineTextItems:!0!==e,includeMarkedContent:!0===t},{highWaterMark:100,size:e=>e.items.length})}getTextContent(e={}){if(this._transport._htmlForXfa)return this.getXfa().then((e=>_xfa_text.XfaText.textContent(e)));const t=this.streamTextContent(e);return new Promise((function(e,n){const r=t.getReader(),i={items:[],styles:Object.create(null)};!function t(){r.read().then((function({value:n,done:r}){r?e(i):(Object.assign(i.styles,n.styles),i.items.push(...n.items),t())}),n)}()}))}getStructTree(){return this._structTreePromise||=this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const e=[];for(const t of this._intentStates.values())if(this._abortOperatorList({intentState:t,reason:new Error("Page was destroyed."),force:!0}),!t.opListReadCapability)for(const n of t.renderTasks)e.push(n.completed),n.cancel();this.objs.clear();for(const e of this._bitmaps)e.close();return this._bitmaps.clear(),this._annotationPromises.clear(),this._jsActionsPromise=null,this._structTreePromise=null,this.pendingCleanup=!1,Promise.all(e)}cleanup(e=!1){return this.pendingCleanup=!0,this._tryCleanup(e)}_tryCleanup(e=!1){if(!this.pendingCleanup)return!1;for(const{renderTasks:e,operatorList:t}of this._intentStates.values())if(e.size>0||!t.lastChunk)return!1;this._intentStates.clear(),this.objs.clear(),this._annotationPromises.clear(),this._jsActionsPromise=null,this._structTreePromise=null,e&&this._stats&&(this._stats=new _display_utils.StatTimer);for(const e of this._bitmaps)e.close();return this._bitmaps.clear(),this.pendingCleanup=!1,!0}_startRenderPage(e,t){const n=this._intentStates.get(t);n&&(this._stats&&this._stats.timeEnd("Page Request"),n.displayReadyCapability&&n.displayReadyCapability.resolve(e))}_renderPageChunk(e,t){for(let n=0,r=e.length;n<r;n++)t.operatorList.fnArray.push(e.fnArray[n]),t.operatorList.argsArray.push(e.argsArray[n]);t.operatorList.lastChunk=e.lastChunk,t.operatorList.separateAnnots=e.separateAnnots;for(const e of t.renderTasks)e.operatorListChanged();e.lastChunk&&this._tryCleanup()}_pumpOperatorList({renderingIntent:e,cacheKey:t,annotationStorageMap:n}){const r=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:e,cacheKey:t,annotationStorage:n}).getReader(),i=this._intentStates.get(t);i.streamReader=r;const s=()=>{r.read().then((({value:e,done:t})=>{t?i.streamReader=null:this._transport.destroyed||(this._renderPageChunk(e,i),s())}),(e=>{if(i.streamReader=null,!this._transport.destroyed){if(i.operatorList){i.operatorList.lastChunk=!0;for(const e of i.renderTasks)e.operatorListChanged();this._tryCleanup()}if(i.displayReadyCapability)i.displayReadyCapability.reject(e);else{if(!i.opListReadCapability)throw e;i.opListReadCapability.reject(e)}}}))};s()}_abortOperatorList({intentState:e,reason:t,force:n=!1}){if(e.streamReader){if(!n){if(e.renderTasks.size>0)return;if(t instanceof _display_utils.RenderingCancelledException)return void(e.streamReaderCancelTimeout=setTimeout((()=>{this._abortOperatorList({intentState:e,reason:t,force:!0}),e.streamReaderCancelTimeout=null}),RENDERING_CANCELLED_TIMEOUT))}if(e.streamReader.cancel(new _util.AbortException(t.message)).catch((()=>{})),e.streamReader=null,!this._transport.destroyed){for(const[t,n]of this._intentStates)if(n===e){this._intentStates.delete(t);break}this.cleanup()}}}get stats(){return this._stats}}exports.PDFPageProxy=PDFPageProxy;class LoopbackPort{constructor(){this._listeners=[],this._deferred=Promise.resolve()}postMessage(e,t){const n={data:structuredClone(e,t)};this._deferred.then((()=>{for(const e of this._listeners)e.call(this,n)}))}addEventListener(e,t){this._listeners.push(t)}removeEventListener(e,t){const n=this._listeners.indexOf(t);this._listeners.splice(n,1)}terminate(){this._listeners.length=0}}exports.LoopbackPort=LoopbackPort;const PDFWorkerUtil={isWorkerDisabled:!1,fallbackWorkerSrc:null,fakeWorkerId:0};if(exports.PDFWorkerUtil=PDFWorkerUtil,_is_node.isNodeJS&&"function"==typeof commonjsRequire)PDFWorkerUtil.isWorkerDisabled=!0,PDFWorkerUtil.fallbackWorkerSrc="./pdf.worker.js";else if("object"==typeof document){const e=document?.currentScript?.src;e&&(PDFWorkerUtil.fallbackWorkerSrc=e.replace(/(\.(?:min\.)?js)(\?.*)?$/i,".worker$1$2"))}PDFWorkerUtil.isSameOrigin=function(e,t){let n;try{if(n=new URL(e),!n.origin||"null"===n.origin)return!1}catch(e){return!1}const r=new URL(t,n);return n.origin===r.origin},PDFWorkerUtil.createCDNWrapper=function(e){const t=`importScripts("${e}");`;return URL.createObjectURL(new Blob([t]))};class PDFWorker{static#t=new WeakMap;constructor({name:e=null,port:t=null,verbosity:n=(0,_util.getVerbosityLevel)()}={}){if(t&&PDFWorker.#t.has(t))throw new Error("Cannot use more than one PDFWorker per port.");if(this.name=e,this.destroyed=!1,this.verbosity=n,this._readyCapability=(0,_util.createPromiseCapability)(),this._port=null,this._webWorker=null,this._messageHandler=null,t)return PDFWorker.#t.set(t,this),void this._initializeFromPort(t);this._initialize()}get promise(){return this._readyCapability.promise}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(e){this._port=e,this._messageHandler=new _message_handler.MessageHandler("main","worker",e),this._messageHandler.on("ready",(function(){})),this._readyCapability.resolve()}_initialize(){if(!PDFWorkerUtil.isWorkerDisabled&&!PDFWorker._mainThreadWorkerMessageHandler){let{workerSrc:e}=PDFWorker;try{PDFWorkerUtil.isSameOrigin(window.location.href,e)||(e=PDFWorkerUtil.createCDNWrapper(new URL(e,window.location).href));const t=new Worker(e),n=new _message_handler.MessageHandler("main","worker",t),r=()=>{t.removeEventListener("error",i),n.destroy(),t.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},i=()=>{this._webWorker||r()};t.addEventListener("error",i),n.on("test",(e=>{t.removeEventListener("error",i),this.destroyed?r():e?(this._messageHandler=n,this._port=t,this._webWorker=t,this._readyCapability.resolve(),n.send("configure",{verbosity:this.verbosity})):(this._setupFakeWorker(),n.destroy(),t.terminate())})),n.on("ready",(e=>{if(t.removeEventListener("error",i),this.destroyed)r();else try{s()}catch(e){this._setupFakeWorker()}}));const s=()=>{const e=new Uint8Array;n.send("test",e,[e.buffer])};return void s()}catch(e){(0,_util.info)("The worker has been disabled.")}}this._setupFakeWorker()}_setupFakeWorker(){PDFWorkerUtil.isWorkerDisabled||((0,_util.warn)("Setting up fake worker."),PDFWorkerUtil.isWorkerDisabled=!0),PDFWorker._setupFakeWorkerGlobal.then((e=>{if(this.destroyed)return void this._readyCapability.reject(new Error("Worker was destroyed"));const t=new LoopbackPort;this._port=t;const n="fake"+PDFWorkerUtil.fakeWorkerId++,r=new _message_handler.MessageHandler(n+"_worker",n,t);e.setup(r,t);const i=new _message_handler.MessageHandler(n,n+"_worker",t);this._messageHandler=i,this._readyCapability.resolve(),i.send("configure",{verbosity:this.verbosity})})).catch((e=>{this._readyCapability.reject(new Error(`Setting up fake worker failed: "${e.message}".`))}))}destroy(){this.destroyed=!0,this._webWorker&&(this._webWorker.terminate(),this._webWorker=null),PDFWorker.#t.delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.destroy(),this._messageHandler=null)}static fromPort(e){if(!e?.port)throw new Error("PDFWorker.fromPort - invalid method signature.");return this.#t.has(e.port)?this.#t.get(e.port):new PDFWorker(e)}static get workerSrc(){if(_worker_options.GlobalWorkerOptions.workerSrc)return _worker_options.GlobalWorkerOptions.workerSrc;if(null!==PDFWorkerUtil.fallbackWorkerSrc)return _is_node.isNodeJS||(0,_display_utils.deprecated)('No "GlobalWorkerOptions.workerSrc" specified.'),PDFWorkerUtil.fallbackWorkerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _mainThreadWorkerMessageHandler(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch(e){return null}}static get _setupFakeWorkerGlobal(){const loader=async()=>{const mainWorkerMessageHandler=this._mainThreadWorkerMessageHandler;if(mainWorkerMessageHandler)return mainWorkerMessageHandler;if(_is_node.isNodeJS&&"function"==typeof commonjsRequire){const worker=eval("require")(this.workerSrc);return worker.WorkerMessageHandler}return await(0,_display_utils.loadScript)(this.workerSrc),window.pdfjsWorker.WorkerMessageHandler};return(0,_util.shadow)(this,"_setupFakeWorkerGlobal",loader())}}exports.PDFWorker=PDFWorker,PDFWorker.getWorkerSrc=function(){return(0,_display_utils.deprecated)("`PDFWorker.getWorkerSrc()`, please use `PDFWorker.workerSrc` instead."),this.workerSrc};class WorkerTransport{#n=null;#r=new Map;#i=new Map;#s=null;constructor(e,t,n,r){this.messageHandler=e,this.loadingTask=t,this.commonObjs=new PDFObjects,this.fontLoader=new _font_loader.FontLoader({docId:t.docId,onUnsupportedFeature:this._onUnsupportedFeature.bind(this),ownerDocument:r.ownerDocument,styleElement:r.styleElement}),this._params=r,r.useWorkerFetch||(this.CMapReaderFactory=new r.CMapReaderFactory({baseUrl:r.cMapUrl,isCompressed:r.cMapPacked}),this.StandardFontDataFactory=new r.StandardFontDataFactory({baseUrl:r.standardFontDataUrl})),this.destroyed=!1,this.destroyCapability=null,this._passwordCapability=null,this._networkStream=n,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=(0,_util.createPromiseCapability)(),this.setupMessageHandler()}get annotationStorage(){return(0,_util.shadow)(this,"annotationStorage",new _annotation_storage.AnnotationStorage)}get stats(){return this.#n}getRenderingIntent(e,t=_util.AnnotationMode.ENABLE,n=null,r=!1){let i=_util.RenderingIntentFlag.DISPLAY,s=null;switch(e){case"any":i=_util.RenderingIntentFlag.ANY;break;case"display":break;case"print":i=_util.RenderingIntentFlag.PRINT;break;default:(0,_util.warn)(`getRenderingIntent - invalid intent: ${e}`)}switch(t){case _util.AnnotationMode.DISABLE:i+=_util.RenderingIntentFlag.ANNOTATIONS_DISABLE;break;case _util.AnnotationMode.ENABLE:break;case _util.AnnotationMode.ENABLE_FORMS:i+=_util.RenderingIntentFlag.ANNOTATIONS_FORMS;break;case _util.AnnotationMode.ENABLE_STORAGE:i+=_util.RenderingIntentFlag.ANNOTATIONS_STORAGE,s=(i&_util.RenderingIntentFlag.PRINT&&n instanceof _annotation_storage.PrintAnnotationStorage?n:this.annotationStorage).serializable;break;default:(0,_util.warn)(`getRenderingIntent - invalid annotationMode: ${t}`)}return r&&(i+=_util.RenderingIntentFlag.OPLIST),{renderingIntent:i,cacheKey:`${i}_${_annotation_storage.AnnotationStorage.getHash(s)}`,annotationStorageMap:s}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=(0,_util.createPromiseCapability)(),this._passwordCapability&&this._passwordCapability.reject(new Error("Worker was destroyed during onPassword callback"));const e=[];for(const t of this.#r.values())e.push(t._destroy());this.#r.clear(),this.#i.clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const t=this.messageHandler.sendWithPromise("Terminate",null);return e.push(t),Promise.all(e).then((()=>{this.commonObjs.clear(),this.fontLoader.clear(),this.#s=null,this._getFieldObjectsPromise=null,this._hasJSActionsPromise=null,this._networkStream&&this._networkStream.cancelAllRequests(new _util.AbortException("Worker was terminated.")),this.messageHandler&&(this.messageHandler.destroy(),this.messageHandler=null),this.destroyCapability.resolve()}),this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:e,loadingTask:t}=this;e.on("GetReader",((e,t)=>{(0,_util.assert)(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=e=>{this._lastProgress={loaded:e.loaded,total:e.total}},t.onPull=()=>{this._fullReader.read().then((function({value:e,done:n}){n?t.close():((0,_util.assert)((0,_util.isArrayBuffer)(e),"GetReader - expected an ArrayBuffer."),t.enqueue(new Uint8Array(e),1,[e]))})).catch((e=>{t.error(e)}))},t.onCancel=e=>{this._fullReader.cancel(e),t.ready.catch((e=>{if(!this.destroyed)throw e}))}})),e.on("ReaderHeadersReady",(e=>{const n=(0,_util.createPromiseCapability)(),r=this._fullReader;return r.headersReady.then((()=>{r.isStreamingSupported&&r.isRangeSupported||(this._lastProgress&&t.onProgress?.(this._lastProgress),r.onProgress=e=>{t.onProgress?.({loaded:e.loaded,total:e.total})}),n.resolve({isStreamingSupported:r.isStreamingSupported,isRangeSupported:r.isRangeSupported,contentLength:r.contentLength})}),n.reject),n.promise})),e.on("GetRangeReader",((e,t)=>{(0,_util.assert)(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const n=this._networkStream.getRangeReader(e.begin,e.end);n?(t.onPull=()=>{n.read().then((function({value:e,done:n}){n?t.close():((0,_util.assert)((0,_util.isArrayBuffer)(e),"GetRangeReader - expected an ArrayBuffer."),t.enqueue(new Uint8Array(e),1,[e]))})).catch((e=>{t.error(e)}))},t.onCancel=e=>{n.cancel(e),t.ready.catch((e=>{if(!this.destroyed)throw e}))}):t.close()})),e.on("GetDoc",(({pdfInfo:e})=>{this._numPages=e.numPages,this._htmlForXfa=e.htmlForXfa,delete e.htmlForXfa,t._capability.resolve(new PDFDocumentProxy(e,this))})),e.on("DocException",(function(e){let n;switch(e.name){case"PasswordException":n=new _util.PasswordException(e.message,e.code);break;case"InvalidPDFException":n=new _util.InvalidPDFException(e.message);break;case"MissingPDFException":n=new _util.MissingPDFException(e.message);break;case"UnexpectedResponseException":n=new _util.UnexpectedResponseException(e.message,e.status);break;case"UnknownErrorException":n=new _util.UnknownErrorException(e.message,e.details);break;default:(0,_util.unreachable)("DocException - expected a valid Error.")}t._capability.reject(n)})),e.on("PasswordRequest",(e=>{if(this._passwordCapability=(0,_util.createPromiseCapability)(),t.onPassword){const n=e=>{e instanceof Error?this._passwordCapability.reject(e):this._passwordCapability.resolve({password:e})};try{t.onPassword(n,e.code)}catch(e){this._passwordCapability.reject(e)}}else this._passwordCapability.reject(new _util.PasswordException(e.message,e.code));return this._passwordCapability.promise})),e.on("DataLoaded",(e=>{t.onProgress?.({loaded:e.length,total:e.length}),this.downloadInfoCapability.resolve(e)})),e.on("StartRenderPage",(e=>{this.destroyed||this.#r.get(e.pageIndex)._startRenderPage(e.transparency,e.cacheKey)})),e.on("commonobj",(([t,n,r])=>{if(!this.destroyed&&!this.commonObjs.has(t))switch(n){case"Font":const i=this._params;if("error"in r){const e=r.error;(0,_util.warn)(`Error during font loading: ${e}`),this.commonObjs.resolve(t,e);break}let s=null;i.pdfBug&&globalThis.FontInspector?.enabled&&(s={registerFont(e,t){globalThis.FontInspector.fontAdded(e,t)}});const a=new _font_loader.FontFaceObject(r,{isEvalSupported:i.isEvalSupported,disableFontFace:i.disableFontFace,ignoreErrors:i.ignoreErrors,onUnsupportedFeature:this._onUnsupportedFeature.bind(this),fontRegistry:s});this.fontLoader.bind(a).catch((n=>e.sendWithPromise("FontFallback",{id:t}))).finally((()=>{!i.fontExtraProperties&&a.data&&(a.data=null),this.commonObjs.resolve(t,a)}));break;case"FontPath":case"Image":this.commonObjs.resolve(t,r);break;default:throw new Error(`Got unknown common object type ${n}`)}})),e.on("obj",(([e,t,n,r])=>{if(this.destroyed)return;const i=this.#r.get(t);if(!i.objs.has(e))switch(n){case"Image":i.objs.resolve(e,r);const t=8e6;if(r){let e;if(r.bitmap){const{bitmap:t,width:n,height:s}=r;e=n*s*4,i._bitmaps.add(t)}else e=r.data?.length||0;e>t&&(i.cleanupAfterRender=!0)}break;case"Pattern":i.objs.resolve(e,r);break;default:throw new Error(`Got unknown object type ${n}`)}})),e.on("DocProgress",(e=>{this.destroyed||t.onProgress?.({loaded:e.loaded,total:e.total})})),e.on("DocStats",(e=>{this.destroyed||(this.#n=Object.freeze({streamTypes:Object.freeze(e.streamTypes),fontTypes:Object.freeze(e.fontTypes)}))})),e.on("UnsupportedFeature",this._onUnsupportedFeature.bind(this)),e.on("FetchBuiltInCMap",(e=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.CMapReaderFactory?this.CMapReaderFactory.fetch(e):Promise.reject(new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter.")))),e.on("FetchStandardFontData",(e=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.StandardFontDataFactory?this.StandardFontDataFactory.fetch(e):Promise.reject(new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter."))))}_onUnsupportedFeature({featureId:e}){this.destroyed||this.loadingTask.onUnsupportedFeature?.(e)}getData(){return this.messageHandler.sendWithPromise("GetData",null)}getPage(e){if(!Number.isInteger(e)||e<=0||e>this._numPages)return Promise.reject(new Error("Invalid page request."));const t=e-1,n=this.#i.get(t);if(n)return n;const r=this.messageHandler.sendWithPromise("GetPage",{pageIndex:t}).then((e=>{if(this.destroyed)throw new Error("Transport destroyed");const n=new PDFPageProxy(t,e,this,this._params.ownerDocument,this._params.pdfBug);return this.#r.set(t,n),n}));return this.#i.set(t,r),r}getPageIndex(e){return"object"!=typeof e||null===e||!Number.isInteger(e.num)||e.num<0||!Number.isInteger(e.gen)||e.gen<0?Promise.reject(new Error("Invalid pageIndex request.")):this.messageHandler.sendWithPromise("GetPageIndex",{num:e.num,gen:e.gen})}getAnnotations(e,t){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:e,intent:t})}saveDocument(){return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:this.annotationStorage.serializable,filename:this._fullReader?.filename??null}).finally((()=>{this.annotationStorage.resetModified()}))}getFieldObjects(){return this._getFieldObjectsPromise||=this.messageHandler.sendWithPromise("GetFieldObjects",null)}hasJSActions(){return this._hasJSActionsPromise||=this.messageHandler.sendWithPromise("HasJSActions",null)}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(e){return"string"!=typeof e?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:e})}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)}getJavaScript(){return this.messageHandler.sendWithPromise("GetJavaScript",null)}getDocJSActions(){return this.messageHandler.sendWithPromise("GetDocJSActions",null)}getPageJSActions(e){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:e})}getStructTree(e){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:e})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(){return this.messageHandler.sendWithPromise("GetOptionalContentConfig",null).then((e=>new _optional_content_config.OptionalContentConfig(e)))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){return this.#s||=this.messageHandler.sendWithPromise("GetMetadata",null).then((e=>({info:e[0],metadata:e[1]?new _metadata.Metadata(e[1]):null,contentDispositionFilename:this._fullReader?.filename??null,contentLength:this._fullReader?.contentLength??null})))}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(e=!1){if(await this.messageHandler.sendWithPromise("Cleanup",null),!this.destroyed){for(const e of this.#r.values())if(!e.cleanup())throw new Error(`startCleanup: Page ${e.pageNumber} is currently rendering.`);this.commonObjs.clear(),e||this.fontLoader.clear(),this.#s=null,this._getFieldObjectsPromise=null,this._hasJSActionsPromise=null}}get loadingParams(){const e=this._params;return(0,_util.shadow)(this,"loadingParams",{disableAutoFetch:e.disableAutoFetch,enableXfa:e.enableXfa})}}class PDFObjects{#a=Object.create(null);#o(e){const t=this.#a[e];return t||(this.#a[e]={capability:(0,_util.createPromiseCapability)(),data:null})}get(e,t=null){if(t){const n=this.#o(e);return n.capability.promise.then((()=>t(n.data))),null}const n=this.#a[e];if(!n?.capability.settled)throw new Error(`Requesting object that isn't resolved yet ${e}.`);return n.data}has(e){return this.#a[e]?.capability.settled||!1}resolve(e,t=null){const n=this.#o(e);n.data=t,n.capability.resolve()}clear(){this.#a=Object.create(null)}}class RenderTask{#l=null;constructor(e){this.#l=e,this.onContinue=null}get promise(){return this.#l.capability.promise}cancel(){this.#l.cancel()}get separateAnnots(){const{separateAnnots:e}=this.#l.operatorList;if(!e)return!1;const{annotationCanvasMap:t}=this.#l;return e.form||e.canvas&&t?.size>0}}exports.RenderTask=RenderTask;class InternalRenderTask{static#c=new WeakSet;constructor({callback:e,params:t,objs:n,commonObjs:r,annotationCanvasMap:i,operatorList:s,pageIndex:a,canvasFactory:o,useRequestAnimationFrame:l=!1,pdfBug:c=!1,pageColors:u=null}){this.callback=e,this.params=t,this.objs=n,this.commonObjs=r,this.annotationCanvasMap=i,this.operatorListIdx=null,this.operatorList=s,this._pageIndex=a,this.canvasFactory=o,this._pdfBug=c,this.pageColors=u,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=!0===l&&"undefined"!=typeof window,this.cancelled=!1,this.capability=(0,_util.createPromiseCapability)(),this.task=new RenderTask(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=t.canvasContext.canvas}get completed(){return this.capability.promise.catch((function(){}))}initializeGraphics({transparency:e=!1,optionalContentConfig:t}){if(this.cancelled)return;if(this._canvas){if(InternalRenderTask.#c.has(this._canvas))throw new Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");InternalRenderTask.#c.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());const{canvasContext:n,viewport:r,transform:i,imageLayer:s,background:a}=this.params;this.gfx=new _canvas.CanvasGraphics(n,this.commonObjs,this.objs,this.canvasFactory,s,t,this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:i,viewport:r,transparency:e,background:a}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback&&this.graphicsReadyCallback()}cancel(e=null){this.running=!1,this.cancelled=!0,this.gfx&&this.gfx.endDrawing(),this._canvas&&InternalRenderTask.#c.delete(this._canvas),this.callback(e||new _display_utils.RenderingCancelledException(`Rendering cancelled, page ${this._pageIndex+1}`,"canvas"))}operatorListChanged(){this.graphicsReady?(this.stepper&&this.stepper.updateOperatorList(this.operatorList),this.running||this._continue()):this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound)}_continue(){this.running=!0,this.cancelled||(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?window.requestAnimationFrame((()=>{this._nextBound().catch(this._cancelBound)})):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.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),this._canvas&&InternalRenderTask.#c.delete(this._canvas),this.callback())))}}const version="2.16.105";exports.version=version;const build="172ccdbe5";exports.build=build},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PrintAnnotationStorage=t.AnnotationStorage=void 0;var r=n(1),i=n(6),s=n(10);class a{constructor(){this._storage=new Map,this._modified=!1,this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(e,t){const n=this._storage.get(e);return void 0===n?t:Object.assign(t,n)}getRawValue(e){return this._storage.get(e)}remove(e){if(this._storage.delete(e),0===this._storage.size&&this.resetModified(),"function"==typeof this.onAnnotationEditor){for(const e of this._storage.values())if(e instanceof i.AnnotationEditor)return;this.onAnnotationEditor(null)}}setValue(e,t){const n=this._storage.get(e);let r=!1;if(void 0!==n)for(const[e,i]of Object.entries(t))n[e]!==i&&(r=!0,n[e]=i);else r=!0,this._storage.set(e,t);r&&this.#u(),t instanceof i.AnnotationEditor&&"function"==typeof this.onAnnotationEditor&&this.onAnnotationEditor(t.constructor._type)}has(e){return this._storage.has(e)}getAll(){return this._storage.size>0?(0,r.objectFromMap)(this._storage):null}get size(){return this._storage.size}#u(){this._modified||(this._modified=!0,"function"==typeof this.onSetModified&&this.onSetModified())}resetModified(){this._modified&&(this._modified=!1,"function"==typeof this.onResetModified&&this.onResetModified())}get print(){return new o(this)}get serializable(){if(0===this._storage.size)return null;const e=new Map;for(const[t,n]of this._storage){const r=n instanceof i.AnnotationEditor?n.serialize():n;r&&e.set(t,r)}return e}static getHash(e){if(!e)return"";const t=new s.MurmurHash3_64;for(const[n,r]of e)t.update(`${n}:${JSON.stringify(r)}`);return t.hexdigest()}}t.AnnotationStorage=a;class o extends a{#d=null;constructor(e){super(),this.#d=structuredClone(e.serializable)}get print(){(0,r.unreachable)("Should not call PrintAnnotationStorage.print")}get serializable(){return this.#d}}t.PrintAnnotationStorage=o},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AnnotationEditor=void 0;var r=n(7),i=n(1);class s{#h=this.focusin.bind(this);#p=this.focusout.bind(this);#f=!1;#g=!1;#m=!1;#v=s._zIndex++;static _colorManager=new r.ColorManager;static _zIndex=1;constructor(e){this.constructor===s&&(0,i.unreachable)("Cannot initialize AnnotationEditor."),this.parent=e.parent,this.id=e.id,this.width=this.height=null,this.pageIndex=e.parent.pageIndex,this.name=e.name,this.div=null;const[t,n]=this.parent.viewportBaseDimensions;this.x=e.x/t,this.y=e.y/n,this.rotation=this.parent.viewport.rotation,this.isAttachedToDOM=!1}static get _defaultLineColor(){return(0,i.shadow)(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=this.#v}focusin(e){this.#f?this.#f=!1:this.parent.setSelected(this)}focusout(e){this.isAttachedToDOM&&(e.relatedTarget?.closest(`#${this.id}`)||(e.preventDefault(),this.parent.isMultipleSelection||this.commitOrRemove()))}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.parent.addToAnnotationStorage(this)}dragstart(e){const t=this.parent.div.getBoundingClientRect();this.startX=e.clientX-t.x,this.startY=e.clientY-t.y,e.dataTransfer.setData("text/plain",this.id),e.dataTransfer.effectAllowed="move"}setAt(e,t,n,r){const[i,s]=this.parent.viewportBaseDimensions;[n,r]=this.screenToPageTranslation(n,r),this.x=(e+n)/i,this.y=(t+r)/s,this.div.style.left=100*this.x+"%",this.div.style.top=100*this.y+"%"}translate(e,t){const[n,r]=this.parent.viewportBaseDimensions;[e,t]=this.screenToPageTranslation(e,t),this.x+=e/n,this.y+=t/r,this.div.style.left=100*this.x+"%",this.div.style.top=100*this.y+"%"}screenToPageTranslation(e,t){const{rotation:n}=this.parent.viewport;switch(n){case 90:return[t,-e];case 180:return[-e,-t];case 270:return[-t,e];default:return[e,t]}}setDims(e,t){const[n,r]=this.parent.viewportBaseDimensions;this.div.style.width=100*e/n+"%",this.div.style.height=100*t/r+"%"}getInitialTranslation(){return[0,0]}render(){this.div=document.createElement("div"),this.div.setAttribute("data-editor-rotation",(360-this.rotation)%360),this.div.className=this.name,this.div.setAttribute("id",this.id),this.div.setAttribute("tabIndex",0),this.setInForeground(),this.div.addEventListener("focusin",this.#h),this.div.addEventListener("focusout",this.#p);const[e,t]=this.getInitialTranslation();return this.translate(e,t),(0,r.bindEvents)(this,this.div,["dragstart","pointerdown"]),this.div}pointerdown(e){const t=r.KeyboardManager.platform.isMac;0!==e.button||e.ctrlKey&&t?e.preventDefault():(e.ctrlKey&&!t||e.shiftKey||e.metaKey&&t?this.parent.toggleSelected(this):this.parent.setSelected(this),this.#f=!0)}getRect(e,t){const[n,r]=this.parent.viewportBaseDimensions,[i,s]=this.parent.pageDimensions,a=i*e/n,o=s*t/r,l=this.x*i,c=this.y*s,u=this.width*i,d=this.height*s;switch(this.rotation){case 0:return[l+a,s-c-o-d,l+a+u,s-c-o];case 90:return[l+o,s-c+a,l+o+d,s-c+a+u];case 180:return[l-a-u,s-c+o,l-a,s-c+o+d];case 270:return[l-o-d,s-c-a-u,l-o,s-c-a];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(e,t){const[n,r,i,s]=e,a=i-n,o=s-r;switch(this.rotation){case 0:return[n,t-s,a,o];case 90:return[n,t-r,o,a];case 180:return[i,t-r,a,o];case 270:return[i,t-s,o,a];default:throw new Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){this.#m=!0}disableEditMode(){this.#m=!1}isInEditMode(){return this.#m}shouldGetKeyboardEvents(){return!1}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}rebuild(){this.div?.addEventListener("focusin",this.#h)}serialize(){(0,i.unreachable)("An editor must be serializable")}static deserialize(e,t){const n=new this.prototype.constructor({parent:t,id:t.getNextId()});n.rotation=e.rotation;const[r,i]=t.pageDimensions,[s,a,o,l]=n.getRectInCurrentCoords(e.rect,i);return n.x=s/r,n.y=a/i,n.width=o/r,n.height=l/i,n}remove(){this.div.removeEventListener("focusin",this.#h),this.div.removeEventListener("focusout",this.#p),this.isEmpty()||this.commit(),this.parent.remove(this)}select(){this.div?.classList.add("selectedEditor")}unselect(){this.div?.classList.remove("selectedEditor")}updateParams(e,t){}disableEditing(){}enableEditing(){}get propertiesToUpdate(){return{}}get contentDiv(){return this.div}get isEditing(){return this.#g}set isEditing(e){this.#g=e,e?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null)}}t.AnnotationEditor=s},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.KeyboardManager=t.CommandManager=t.ColorManager=t.AnnotationEditorUIManager=void 0,t.bindEvents=function(e,t,n){for(const r of n)t.addEventListener(r,e[r].bind(e))},t.opacityToHex=function(e){return Math.round(Math.min(255,Math.max(1,255*e))).toString(16).padStart(2,"0")};var r=n(1),i=n(8);class s{#y=0;getId(){return`${r.AnnotationEditorPrefix}${this.#y++}`}}class a{#b=[];#_=!1;#w;#E=-1;constructor(e=128){this.#w=e}add({cmd:e,undo:t,mustExec:n,type:r=NaN,overwriteIfSameType:i=!1,keepUndo:s=!1}){if(n&&e(),this.#_)return;const a={cmd:e,undo:t,type:r};if(-1===this.#E)return this.#b.length>0&&(this.#b.length=0),this.#E=0,void this.#b.push(a);if(i&&this.#b[this.#E].type===r)return s&&(a.undo=this.#b[this.#E].undo),void(this.#b[this.#E]=a);const o=this.#E+1;o===this.#w?this.#b.splice(0,1):(this.#E=o,o<this.#b.length&&this.#b.splice(o)),this.#b.push(a)}undo(){-1!==this.#E&&(this.#_=!0,this.#b[this.#E].undo(),this.#_=!1,this.#E-=1)}redo(){this.#E<this.#b.length-1&&(this.#E+=1,this.#_=!0,this.#b[this.#E].cmd(),this.#_=!1)}hasSomethingToUndo(){return-1!==this.#E}hasSomethingToRedo(){return this.#E<this.#b.length-1}destroy(){this.#b=null}}t.CommandManager=a;class o{constructor(e){this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const t=o.platform.isMac;for(const[n,r]of e)for(const e of n){const n=e.startsWith("mac+");t&&n?(this.callbacks.set(e.slice(4),r),this.allKeys.add(e.split("+").at(-1))):t||n||(this.callbacks.set(e,r),this.allKeys.add(e.split("+").at(-1)))}}static get platform(){const e="undefined"!=typeof navigator?navigator.platform:"";return(0,r.shadow)(this,"platform",{isWin:e.includes("Win"),isMac:e.includes("Mac")})}#S(e){e.altKey&&this.buffer.push("alt"),e.ctrlKey&&this.buffer.push("ctrl"),e.metaKey&&this.buffer.push("meta"),e.shiftKey&&this.buffer.push("shift"),this.buffer.push(e.key);const t=this.buffer.join("+");return this.buffer.length=0,t}exec(e,t){if(!this.allKeys.has(t.key))return;const n=this.callbacks.get(this.#S(t));n&&(n.bind(e)(),t.stopPropagation(),t.preventDefault())}}t.KeyboardManager=o;class l{#C=null;copy(e){e&&(Array.isArray(e)?this.#C=e.map((e=>e.serialize())):this.#C=[e.serialize()],this.#C=this.#C.filter((e=>!!e)),0===this.#C.length&&(this.#C=null))}paste(){return this.#C}isEmpty(){return null===this.#C}destroy(){this.#C=null}}class c{static _colorsMapping=new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]);get _colors(){const e=new Map([["CanvasText",null],["Canvas",null]]);return(0,i.getColorValues)(e),(0,r.shadow)(this,"_colors",e)}convert(e){const t=(0,i.getRGB)(e);if(!window.matchMedia("(forced-colors: active)").matches)return t;for(const[e,n]of this._colors)if(n.every(((e,n)=>e===t[n])))return c._colorsMapping.get(e);return t}getHexCode(e){const t=this._colors.get(e);return t?r.Util.makeHexColor(...t):e}}t.ColorManager=c;class u{#A=null;#P=new Map;#x=new Map;#T=new l;#R=new a;#M=0;#L=null;#I=null;#k=new s;#O=!1;#F=r.AnnotationEditorType.NONE;#D=new Set;#N=this.keydown.bind(this);#U=this.onEditingAction.bind(this);#j=this.onPageChanging.bind(this);#$={isEditing:!1,isEmpty:!0,hasEmptyClipboard:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1};#H=null;static _keyboardManager=new o([[["ctrl+a","mac+meta+a"],u.prototype.selectAll],[["ctrl+c","mac+meta+c"],u.prototype.copy],[["ctrl+v","mac+meta+v"],u.prototype.paste],[["ctrl+x","mac+meta+x"],u.prototype.cut],[["ctrl+z","mac+meta+z"],u.prototype.undo],[["ctrl+y","ctrl+shift+Z","mac+meta+shift+Z"],u.prototype.redo],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete"],u.prototype.delete],[["Escape","mac+Escape"],u.prototype.unselectAll]]);constructor(e,t){this.#H=e,this.#I=t,this.#I._on("editingaction",this.#U),this.#I._on("pagechanging",this.#j)}destroy(){this.#B(),this.#I._off("editingaction",this.#U),this.#I._off("pagechanging",this.#j);for(const e of this.#x.values())e.destroy();this.#x.clear(),this.#P.clear(),this.#A=null,this.#D.clear(),this.#T.destroy(),this.#R.destroy()}onPageChanging({pageNumber:e}){this.#M=e-1}focusMainContainer(){this.#H.focus()}#V(){this.#H.addEventListener("keydown",this.#N)}#B(){this.#H.removeEventListener("keydown",this.#N)}keydown(e){this.getActive()?.shouldGetKeyboardEvents()||u._keyboardManager.exec(this,e)}onEditingAction(e){["undo","redo","cut","copy","paste","delete","selectAll"].includes(e.name)&&this[e.name]()}#W(e){Object.entries(e).some((([e,t])=>this.#$[e]!==t))&&this.#I.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(this.#$,e)})}#q(e){this.#I.dispatch("annotationeditorparamschanged",{source:this,details:e})}setEditingState(e){e?(this.#V(),this.#W({isEditing:this.#F!==r.AnnotationEditorType.NONE,isEmpty:this.#z(),hasSomethingToUndo:this.#R.hasSomethingToUndo(),hasSomethingToRedo:this.#R.hasSomethingToRedo(),hasSelectedEditor:!1,hasEmptyClipboard:this.#T.isEmpty()})):(this.#B(),this.#W({isEditing:!1}))}registerEditorTypes(e){this.#L=e;for(const e of this.#L)this.#q(e.defaultPropertiesToUpdate)}getId(){return this.#k.getId()}addLayer(e){this.#x.set(e.pageIndex,e),this.#O?e.enable():e.disable()}removeLayer(e){this.#x.delete(e.pageIndex)}updateMode(e){if(this.#F=e,e===r.AnnotationEditorType.NONE)this.setEditingState(!1),this.#G();else{this.setEditingState(!0),this.#Q();for(const t of this.#x.values())t.updateMode(e)}}updateToolbar(e){e!==this.#F&&this.#I.dispatch("switchannotationeditormode",{source:this,mode:e})}updateParams(e,t){for(const n of this.#D)n.updateParams(e,t);for(const n of this.#L)n.updateDefaultParams(e,t)}#Q(){if(!this.#O){this.#O=!0;for(const e of this.#x.values())e.enable()}}#G(){if(this.unselectAll(),this.#O){this.#O=!1;for(const e of this.#x.values())e.disable()}}getEditors(e){const t=[];for(const n of this.#P.values())n.pageIndex===e&&t.push(n);return t}getEditor(e){return this.#P.get(e)}addEditor(e){this.#P.set(e.id,e)}removeEditor(e){this.#P.delete(e.id),this.unselect(e)}#X(e){const t=this.#x.get(e.pageIndex);t?t.addOrRebuild(e):this.addEditor(e)}setActiveEditor(e){this.#A!==e&&(this.#A=e,e&&this.#q(e.propertiesToUpdate))}toggleSelected(e){if(this.#D.has(e))return this.#D.delete(e),e.unselect(),void this.#W({hasSelectedEditor:this.hasSelection});this.#D.add(e),e.select(),this.#q(e.propertiesToUpdate),this.#W({hasSelectedEditor:!0})}setSelected(e){for(const t of this.#D)t!==e&&t.unselect();this.#D.clear(),this.#D.add(e),e.select(),this.#q(e.propertiesToUpdate),this.#W({hasSelectedEditor:!0})}isSelected(e){return this.#D.has(e)}unselect(e){e.unselect(),this.#D.delete(e),this.#W({hasSelectedEditor:this.hasSelection})}get hasSelection(){return 0!==this.#D.size}undo(){this.#R.undo(),this.#W({hasSomethingToUndo:this.#R.hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:this.#z()})}redo(){this.#R.redo(),this.#W({hasSomethingToUndo:!0,hasSomethingToRedo:this.#R.hasSomethingToRedo(),isEmpty:this.#z()})}addCommands(e){this.#R.add(e),this.#W({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#z()})}#z(){if(0===this.#P.size)return!0;if(1===this.#P.size)for(const e of this.#P.values())return e.isEmpty();return!1}delete(){if(this.#A&&this.#A.commitOrRemove(),!this.hasSelection)return;const e=[...this.#D];this.addCommands({cmd:()=>{for(const t of e)t.remove()},undo:()=>{for(const t of e)this.#X(t)},mustExec:!0})}copy(){if(this.#A&&this.#A.commitOrRemove(),this.hasSelection){const e=[];for(const t of this.#D)t.isEmpty()||e.push(t);if(0===e.length)return;this.#T.copy(e),this.#W({hasEmptyClipboard:!1})}}cut(){this.copy(),this.delete()}paste(){if(this.#T.isEmpty())return;this.unselectAll();const e=this.#x.get(this.#M),t=this.#T.paste().map((t=>e.deserialize(t)));this.addCommands({cmd:()=>{for(const e of t)this.#X(e);this.#K(t)},undo:()=>{for(const e of t)e.remove()},mustExec:!0})}#K(e){this.#D.clear();for(const t of e)t.isEmpty()||(this.#D.add(t),t.select());this.#W({hasSelectedEditor:!0})}selectAll(){for(const e of this.#D)e.commit();this.#K(this.#P.values())}unselectAll(){if(this.#A)this.#A.commitOrRemove();else if(0!==this.#K.size){for(const e of this.#D)e.unselect();this.#D.clear(),this.#W({hasSelectedEditor:!1})}}isActive(e){return this.#A===e}getActive(){return this.#A}getMode(){return this.#F}}t.AnnotationEditorUIManager=u},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StatTimer=t.RenderingCancelledException=t.PixelsPerInch=t.PageViewport=t.PDFDateString=t.DOMStandardFontDataFactory=t.DOMSVGFactory=t.DOMCanvasFactory=t.DOMCMapReaderFactory=t.AnnotationPrefix=void 0,t.deprecated=function(e){console.log("Deprecated API usage: "+e)},t.getColorValues=function(e){const t=document.createElement("span");t.style.visibility="hidden",document.body.append(t);for(const n of e.keys()){t.style.color=n;const r=window.getComputedStyle(t).color;e.set(n,m(r))}t.remove()},t.getCurrentTransform=function(e){const{a:t,b:n,c:r,d:i,e:s,f:a}=e.getTransform();return[t,n,r,i,s,a]},t.getCurrentTransformInverse=function(e){const{a:t,b:n,c:r,d:i,e:s,f:a}=e.getTransform().invertSelf();return[t,n,r,i,s,a]},t.getFilenameFromUrl=function(e){const t=e.indexOf("#"),n=e.indexOf("?"),r=Math.min(t>0?t:e.length,n>0?n:e.length);return e.substring(e.lastIndexOf("/",r)+1,r)},t.getPdfFilenameFromUrl=function(e,t="document.pdf"){if("string"!=typeof e)return t;if(p(e))return(0,i.warn)('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),t;const n=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,r=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/.exec(e);let s=n.exec(r[1])||n.exec(r[2])||n.exec(r[3]);if(s&&(s=s[0],s.includes("%")))try{s=n.exec(decodeURIComponent(s))[0]}catch(e){}return s||t},t.getRGB=m,t.getXfaPageViewport=function(e,{scale:t=1,rotation:n=0}){const{width:r,height:i}=e.attributes.style,s=[0,0,parseInt(r),parseInt(i)];return new d({viewBox:s,scale:t,rotation:n})},t.isDataScheme=p,t.isPdfFile=function(e){return"string"==typeof e&&/\.pdf$/i.test(e)},t.isValidFetchUrl=f,t.loadScript=function(e,t=!1){return new Promise(((n,r)=>{const i=document.createElement("script");i.src=e,i.onload=function(e){t&&i.remove(),n(e)},i.onerror=function(){r(new Error(`Cannot load script at: ${i.src}`))},(document.head||document.documentElement).append(i)}))};var r=n(9),i=n(1);t.AnnotationPrefix="pdfjs_internal_id_";class s{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=this.CSS/this.PDF}t.PixelsPerInch=s;class a extends r.BaseCanvasFactory{constructor({ownerDocument:e=globalThis.document}={}){super(),this._document=e}_createCanvas(e,t){const n=this._document.createElement("canvas");return n.width=e,n.height=t,n}}async function o(e,t=!1){if(f(e,document.baseURI)){const n=await fetch(e);if(!n.ok)throw new Error(n.statusText);return t?new Uint8Array(await n.arrayBuffer()):(0,i.stringToBytes)(await n.text())}return new Promise(((n,r)=>{const s=new XMLHttpRequest;s.open("GET",e,!0),t&&(s.responseType="arraybuffer"),s.onreadystatechange=()=>{if(s.readyState===XMLHttpRequest.DONE){if(200===s.status||0===s.status){let e;if(t&&s.response?e=new Uint8Array(s.response):!t&&s.responseText&&(e=(0,i.stringToBytes)(s.responseText)),e)return void n(e)}r(new Error(s.statusText))}},s.send(null)}))}t.DOMCanvasFactory=a;class l extends r.BaseCMapReaderFactory{_fetchData(e,t){return o(e,this.isCompressed).then((e=>({cMapData:e,compressionType:t})))}}t.DOMCMapReaderFactory=l;class c extends r.BaseStandardFontDataFactory{_fetchData(e){return o(e,!0)}}t.DOMStandardFontDataFactory=c;class u extends r.BaseSVGFactory{_createSVG(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}}t.DOMSVGFactory=u;class d{constructor({viewBox:e,scale:t,rotation:n,offsetX:r=0,offsetY:i=0,dontFlip:s=!1}){this.viewBox=e,this.scale=t,this.rotation=n,this.offsetX=r,this.offsetY=i;const a=(e[2]+e[0])/2,o=(e[3]+e[1])/2;let l,c,u,d,h,p,f,g;switch((n%=360)<0&&(n+=360),n){case 180:l=-1,c=0,u=0,d=1;break;case 90:l=0,c=1,u=1,d=0;break;case 270:l=0,c=-1,u=-1,d=0;break;case 0:l=1,c=0,u=0,d=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}s&&(u=-u,d=-d),0===l?(h=Math.abs(o-e[1])*t+r,p=Math.abs(a-e[0])*t+i,f=Math.abs(e[3]-e[1])*t,g=Math.abs(e[2]-e[0])*t):(h=Math.abs(a-e[0])*t+r,p=Math.abs(o-e[1])*t+i,f=Math.abs(e[2]-e[0])*t,g=Math.abs(e[3]-e[1])*t),this.transform=[l*t,c*t,u*t,d*t,h-l*t*a-u*t*o,p-c*t*a-d*t*o],this.width=f,this.height=g}clone({scale:e=this.scale,rotation:t=this.rotation,offsetX:n=this.offsetX,offsetY:r=this.offsetY,dontFlip:i=!1}={}){return new d({viewBox:this.viewBox.slice(),scale:e,rotation:t,offsetX:n,offsetY:r,dontFlip:i})}convertToViewportPoint(e,t){return i.Util.applyTransform([e,t],this.transform)}convertToViewportRectangle(e){const t=i.Util.applyTransform([e[0],e[1]],this.transform),n=i.Util.applyTransform([e[2],e[3]],this.transform);return[t[0],t[1],n[0],n[1]]}convertToPdfPoint(e,t){return i.Util.applyInverseTransform([e,t],this.transform)}}t.PageViewport=d;class h extends i.BaseException{constructor(e,t){super(e,"RenderingCancelledException"),this.type=t}}function p(e){const t=e.length;let n=0;for(;n<t&&""===e[n].trim();)n++;return"data:"===e.substring(n,n+5).toLowerCase()}function f(e,t){try{const{protocol:n}=t?new URL(e,t):new URL(e);return"http:"===n||"https:"===n}catch(e){return!1}}let g;function m(e){if(e.startsWith("#")){const t=parseInt(e.slice(1),16);return[(16711680&t)>>16,(65280&t)>>8,255&t]}return e.startsWith("rgb(")?e.slice(4,-1).split(",").map((e=>parseInt(e))):e.startsWith("rgba(")?e.slice(5,-1).split(",").map((e=>parseInt(e))).slice(0,3):((0,i.warn)(`Not a valid color format: "${e}"`),[0,0,0])}t.RenderingCancelledException=h,t.StatTimer=class{constructor(){this.started=Object.create(null),this.times=[]}time(e){e in this.started&&(0,i.warn)(`Timer is already running for ${e}`),this.started[e]=Date.now()}timeEnd(e){e in this.started||(0,i.warn)(`Timer has not been started for ${e}`),this.times.push({name:e,start:this.started[e],end:Date.now()}),delete this.started[e]}toString(){const e=[];let t=0;for(const e of this.times){const n=e.name;n.length>t&&(t=n.length)}for(const n of this.times){const r=n.end-n.start;e.push(`${n.name.padEnd(t)} ${r}ms\n`)}return e.join("")}},t.PDFDateString=class{static toDateObject(e){if(!e||"string"!=typeof e)return null;g||(g=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));const t=g.exec(e);if(!t)return null;const n=parseInt(t[1],10);let r=parseInt(t[2],10);r=r>=1&&r<=12?r-1:0;let i=parseInt(t[3],10);i=i>=1&&i<=31?i:1;let s=parseInt(t[4],10);s=s>=0&&s<=23?s:0;let a=parseInt(t[5],10);a=a>=0&&a<=59?a:0;let o=parseInt(t[6],10);o=o>=0&&o<=59?o:0;const l=t[7]||"Z";let c=parseInt(t[8],10);c=c>=0&&c<=23?c:0;let u=parseInt(t[9],10)||0;return u=u>=0&&u<=59?u:0,"-"===l?(s+=c,a+=u):"+"===l&&(s-=c,a-=u),new Date(Date.UTC(n,r,i,s,a,o))}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BaseStandardFontDataFactory=t.BaseSVGFactory=t.BaseCanvasFactory=t.BaseCMapReaderFactory=void 0;var r=n(1);class i{constructor(){this.constructor===i&&(0,r.unreachable)("Cannot initialize BaseCanvasFactory.")}create(e,t){if(e<=0||t<=0)throw new Error("Invalid canvas size");const n=this._createCanvas(e,t);return{canvas:n,context:n.getContext("2d")}}reset(e,t,n){if(!e.canvas)throw new Error("Canvas is not specified");if(t<=0||n<=0)throw new Error("Invalid canvas size");e.canvas.width=t,e.canvas.height=n}destroy(e){if(!e.canvas)throw new Error("Canvas is not specified");e.canvas.width=0,e.canvas.height=0,e.canvas=null,e.context=null}_createCanvas(e,t){(0,r.unreachable)("Abstract method `_createCanvas` called.")}}t.BaseCanvasFactory=i;class s{constructor({baseUrl:e=null,isCompressed:t=!1}){this.constructor===s&&(0,r.unreachable)("Cannot initialize BaseCMapReaderFactory."),this.baseUrl=e,this.isCompressed=t}async fetch({name:e}){if(!this.baseUrl)throw new Error('The CMap "baseUrl" parameter must be specified, ensure that the "cMapUrl" and "cMapPacked" API parameters are provided.');if(!e)throw new Error("CMap name must be specified.");const t=this.baseUrl+e+(this.isCompressed?".bcmap":""),n=this.isCompressed?r.CMapCompressionType.BINARY:r.CMapCompressionType.NONE;return this._fetchData(t,n).catch((e=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${t}`)}))}_fetchData(e,t){(0,r.unreachable)("Abstract method `_fetchData` called.")}}t.BaseCMapReaderFactory=s;class a{constructor({baseUrl:e=null}){this.constructor===a&&(0,r.unreachable)("Cannot initialize BaseStandardFontDataFactory."),this.baseUrl=e}async fetch({filename:e}){if(!this.baseUrl)throw new Error('The standard font "baseUrl" parameter must be specified, ensure that the "standardFontDataUrl" API parameter is provided.');if(!e)throw new Error("Font filename must be specified.");const t=`${this.baseUrl}${e}`;return this._fetchData(t).catch((e=>{throw new Error(`Unable to load font data at: ${t}`)}))}_fetchData(e){(0,r.unreachable)("Abstract method `_fetchData` called.")}}t.BaseStandardFontDataFactory=a;class o{constructor(){this.constructor===o&&(0,r.unreachable)("Cannot initialize BaseSVGFactory.")}create(e,t,n=!1){if(e<=0||t<=0)throw new Error("Invalid SVG dimensions");const r=this._createSVG("svg:svg");return r.setAttribute("version","1.1"),n||(r.setAttribute("width",`${e}px`),r.setAttribute("height",`${t}px`)),r.setAttribute("preserveAspectRatio","none"),r.setAttribute("viewBox",`0 0 ${e} ${t}`),r}createElement(e){if("string"!=typeof e)throw new Error("Invalid SVG element type");return this._createSVG(e)}_createSVG(e){(0,r.unreachable)("Abstract method `_createSVG` called.")}}t.BaseSVGFactory=o},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MurmurHash3_64=void 0;var r=n(1);const i=3285377520,s=4294901760,a=65535;t.MurmurHash3_64=class{constructor(e){this.h1=e?4294967295&e:i,this.h2=e?4294967295&e:i}update(e){let t,n;if("string"==typeof e){t=new Uint8Array(2*e.length),n=0;for(let r=0,i=e.length;r<i;r++){const i=e.charCodeAt(r);i<=255?t[n++]=i:(t[n++]=i>>>8,t[n++]=255&i)}}else{if(!(0,r.isArrayBuffer)(e))throw new Error("Wrong data format in MurmurHash3_64_update. Input must be a string or array.");t=e.slice(),n=t.byteLength}const i=n>>2,o=n-4*i,l=new Uint32Array(t.buffer,0,i);let c=0,u=0,d=this.h1,h=this.h2;const p=3432918353,f=461845907,g=11601,m=13715;for(let e=0;e<i;e++)1&e?(c=l[e],c=c*p&s|c*g&a,c=c<<15|c>>>17,c=c*f&s|c*m&a,d^=c,d=d<<13|d>>>19,d=5*d+3864292196):(u=l[e],u=u*p&s|u*g&a,u=u<<15|u>>>17,u=u*f&s|u*m&a,h^=u,h=h<<13|h>>>19,h=5*h+3864292196);switch(c=0,o){case 3:c^=t[4*i+2]<<16;case 2:c^=t[4*i+1]<<8;case 1:c^=t[4*i],c=c*p&s|c*g&a,c=c<<15|c>>>17,c=c*f&s|c*m&a,1&i?d^=c:h^=c}this.h1=d,this.h2=h}hexdigest(){let e=this.h1,t=this.h2;e^=t>>>1,e=3981806797*e&s|36045*e&a,t=4283543511*t&s|(2950163797*(t<<16|e>>>16)&s)>>>16,e^=t>>>1,e=444984403*e&s|60499*e&a,t=3301882366*t&s|(3120437893*(t<<16|e>>>16)&s)>>>16,e^=t>>>1;const n=(e>>>0).toString(16),r=(t>>>0).toString(16);return n.padStart(8,"0")+r.padStart(8,"0")}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FontLoader=t.FontFaceObject=void 0;var r=n(1);class i{constructor({docId:e,onUnsupportedFeature:t,ownerDocument:n=globalThis.document,styleElement:s=null}){this.constructor===i&&(0,r.unreachable)("Cannot initialize BaseFontLoader."),this.docId=e,this._onUnsupportedFeature=t,this._document=n,this.nativeFontFaces=[],this.styleElement=null}addNativeFontFace(e){this.nativeFontFaces.push(e),this._document.fonts.add(e)}insertRule(e){let t=this.styleElement;t||(t=this.styleElement=this._document.createElement("style"),t.id=`PDFJS_FONT_STYLE_TAG_${this.docId}`,this._document.documentElement.getElementsByTagName("head")[0].append(t));const n=t.sheet;n.insertRule(e,n.cssRules.length)}clear(){for(const e of this.nativeFontFaces)this._document.fonts.delete(e);this.nativeFontFaces.length=0,this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async bind(e){if(e.attached||e.missingFile)return;if(e.attached=!0,this.isFontLoadingAPISupported){const t=e.createNativeFontFace();if(t){this.addNativeFontFace(t);try{await t.loaded}catch(n){throw this._onUnsupportedFeature({featureId:r.UNSUPPORTED_FEATURES.errorFontLoadNative}),(0,r.warn)(`Failed to load font '${t.family}': '${n}'.`),e.disableFontFace=!0,n}}return}const t=e.createFontFaceRule();if(t){if(this.insertRule(t),this.isSyncFontLoadingSupported)return;await new Promise((n=>{const r=this._queueLoadingCallback(n);this._prepareFontLoadEvent([t],[e],r)}))}}_queueLoadingCallback(e){(0,r.unreachable)("Abstract method `_queueLoadingCallback`.")}get isFontLoadingAPISupported(){const e=!!this._document?.fonts;return(0,r.shadow)(this,"isFontLoadingAPISupported",e)}get isSyncFontLoadingSupported(){(0,r.unreachable)("Abstract method `isSyncFontLoadingSupported`.")}get _loadTestFont(){(0,r.unreachable)("Abstract method `_loadTestFont`.")}_prepareFontLoadEvent(e,t,n){(0,r.unreachable)("Abstract method `_prepareFontLoadEvent`.")}}let s;t.FontLoader=s,t.FontLoader=s=class extends i{constructor(e){super(e),this.loadingContext={requests:[],nextRequestId:0},this.loadTestFontId=0}get isSyncFontLoadingSupported(){let e=!1;return("undefined"==typeof navigator||/Mozilla\/5.0.*?rv:(\d+).*? Gecko/.exec(navigator.userAgent)?.[1]>=14)&&(e=!0),(0,r.shadow)(this,"isSyncFontLoadingSupported",e)}_queueLoadingCallback(e){const t=this.loadingContext,n={id:"pdfjs-font-loading-"+t.nextRequestId++,done:!1,complete:function(){for((0,r.assert)(!n.done,"completeRequest() cannot be called twice."),n.done=!0;t.requests.length>0&&t.requests[0].done;){const e=t.requests.shift();setTimeout(e.callback,0)}},callback:e};return t.requests.push(n),n}get _loadTestFont(){return(0,r.shadow)(this,"_loadTestFont",atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA=="))}_prepareFontLoadEvent(e,t,n){function i(e,t){return e.charCodeAt(t)<<24|e.charCodeAt(t+1)<<16|e.charCodeAt(t+2)<<8|255&e.charCodeAt(t+3)}function s(e,t,n,r){return e.substring(0,t)+r+e.substring(t+n)}let a,o;const l=this._document.createElement("canvas");l.width=1,l.height=1;const c=l.getContext("2d");let u=0;const d=`lt${Date.now()}${this.loadTestFontId++}`;let h=this._loadTestFont;h=s(h,976,d.length,d);const p=1482184792;let f=i(h,16);for(a=0,o=d.length-3;a<o;a+=4)f=f-p+i(d,a)|0;a<d.length&&(f=f-p+i(d+"XXX",a)|0),h=s(h,16,4,(0,r.string32)(f));const g=`@font-face {font-family:"${d}";src:url(data:font/opentype;base64,${btoa(h)});}`;this.insertRule(g);const m=[];for(const e of t)m.push(e.loadedName);m.push(d);const v=this._document.createElement("div");v.style.visibility="hidden",v.style.width=v.style.height="10px",v.style.position="absolute",v.style.top=v.style.left="0px";for(const e of m){const t=this._document.createElement("span");t.textContent="Hi",t.style.fontFamily=e,v.append(t)}this._document.body.append(v),function e(t,n){if(u++,u>30)return(0,r.warn)("Load test font never loaded."),void n();c.font="30px "+t,c.fillText(".",0,20),c.getImageData(0,0,1,1).data[3]>0?n():setTimeout(e.bind(null,t,n))}(d,(()=>{v.remove(),n.complete()}))}},t.FontFaceObject=class{constructor(e,{isEvalSupported:t=!0,disableFontFace:n=!1,ignoreErrors:r=!1,onUnsupportedFeature:i,fontRegistry:s=null}){this.compiledGlyphs=Object.create(null);for(const t in e)this[t]=e[t];this.isEvalSupported=!1!==t,this.disableFontFace=!0===n,this.ignoreErrors=!0===r,this._onUnsupportedFeature=i,this.fontRegistry=s}createNativeFontFace(){if(!this.data||this.disableFontFace)return null;let e;if(this.cssFontInfo){const t={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(t.style=`oblique ${this.cssFontInfo.italicAngle}deg`),e=new FontFace(this.cssFontInfo.fontFamily,this.data,t)}else e=new FontFace(this.loadedName,this.data,{});return this.fontRegistry&&this.fontRegistry.registerFont(this),e}createFontFaceRule(){if(!this.data||this.disableFontFace)return null;const e=(0,r.bytesToString)(this.data),t=`url(data:${this.mimetype};base64,${btoa(e)});`;let n;if(this.cssFontInfo){let e=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(e+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),n=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${e}src:${t}}`}else n=`@font-face {font-family:"${this.loadedName}";src:${t}}`;return this.fontRegistry&&this.fontRegistry.registerFont(this,t),n}getPathGenerator(e,t){if(void 0!==this.compiledGlyphs[t])return this.compiledGlyphs[t];let n;try{n=e.get(this.loadedName+"_path_"+t)}catch(e){if(!this.ignoreErrors)throw e;return this._onUnsupportedFeature({featureId:r.UNSUPPORTED_FEATURES.errorFontGetPath}),(0,r.warn)(`getPathGenerator - ignoring character: "${e}".`),this.compiledGlyphs[t]=function(e,t){}}if(this.isEvalSupported&&r.FeatureTest.isEvalSupported){const e=[];for(const t of n){const n=void 0!==t.args?t.args.join(","):"";e.push("c.",t.cmd,"(",n,");\n")}return this.compiledGlyphs[t]=new Function("c","size",e.join(""))}return this.compiledGlyphs[t]=function(e,t){for(const r of n)"scale"===r.cmd&&(r.args=[t,-t]),e[r.cmd].apply(e,r.args)}}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CanvasGraphics=void 0;var r=n(8),i=n(1),s=n(13),a=n(14),o=n(3);const l=4096,c=o.isNodeJS&&"undefined"==typeof Path2D?-1:1e3,u=16;class d{constructor(e){this.canvasFactory=e,this.cache=Object.create(null)}getCanvas(e,t,n){let r;return void 0!==this.cache[e]?(r=this.cache[e],this.canvasFactory.reset(r,t,n)):(r=this.canvasFactory.create(t,n),this.cache[e]=r),r}delete(e){delete this.cache[e]}clear(){for(const e in this.cache){const t=this.cache[e];this.canvasFactory.destroy(t),delete this.cache[e]}}}function h(e,t,n,i,s,a,o,l,c,u){const[d,h,p,f,g,m]=(0,r.getCurrentTransform)(e);if(0===h&&0===p){const r=o*d+g,v=Math.round(r),y=l*f+m,b=Math.round(y),_=(o+c)*d+g,w=Math.abs(Math.round(_)-v)||1,E=(l+u)*f+m,S=Math.abs(Math.round(E)-b)||1;return e.setTransform(Math.sign(d),0,0,Math.sign(f),v,b),e.drawImage(t,n,i,s,a,0,0,w,S),e.setTransform(d,h,p,f,g,m),[w,S]}if(0===d&&0===f){const r=l*p+g,v=Math.round(r),y=o*h+m,b=Math.round(y),_=(l+u)*p+g,w=Math.abs(Math.round(_)-v)||1,E=(o+c)*h+m,S=Math.abs(Math.round(E)-b)||1;return e.setTransform(0,Math.sign(h),Math.sign(p),0,v,b),e.drawImage(t,n,i,s,a,0,0,S,w),e.setTransform(d,h,p,f,g,m),[S,w]}return e.drawImage(t,n,i,s,a,o,l,c,u),[Math.hypot(d,h)*c,Math.hypot(p,f)*u]}class p{constructor(e,t){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=i.IDENTITY_MATRIX,this.textMatrixScale=1,this.fontMatrix=i.FONT_IDENTITY_MATRIX,this.leading=0,this.x=0,this.y=0,this.lineX=0,this.lineY=0,this.charSpacing=0,this.wordSpacing=0,this.textHScale=1,this.textRenderingMode=i.TextRenderingMode.FILL,this.textRise=0,this.fillColor="#000000",this.strokeColor="#000000",this.patternFill=!1,this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.activeSMask=null,this.transferMaps=null,this.startNewPathAndClipBox([0,0,e,t])}clone(){const e=Object.create(this);return e.clipBox=this.clipBox.slice(),e}setCurrentPoint(e,t){this.x=e,this.y=t}updatePathMinMax(e,t,n){[t,n]=i.Util.applyTransform([t,n],e),this.minX=Math.min(this.minX,t),this.minY=Math.min(this.minY,n),this.maxX=Math.max(this.maxX,t),this.maxY=Math.max(this.maxY,n)}updateRectMinMax(e,t){const n=i.Util.applyTransform(t,e),r=i.Util.applyTransform(t.slice(2),e);this.minX=Math.min(this.minX,n[0],r[0]),this.minY=Math.min(this.minY,n[1],r[1]),this.maxX=Math.max(this.maxX,n[0],r[0]),this.maxY=Math.max(this.maxY,n[1],r[1])}updateScalingPathMinMax(e,t){i.Util.scaleMinMax(e,t),this.minX=Math.min(this.minX,t[0]),this.maxX=Math.max(this.maxX,t[1]),this.minY=Math.min(this.minY,t[2]),this.maxY=Math.max(this.maxY,t[3])}updateCurvePathMinMax(e,t,n,r,s,a,o,l,c,u){const d=i.Util.bezierBoundingBox(t,n,r,s,a,o,l,c);if(u)return u[0]=Math.min(u[0],d[0],d[2]),u[1]=Math.max(u[1],d[0],d[2]),u[2]=Math.min(u[2],d[1],d[3]),void(u[3]=Math.max(u[3],d[1],d[3]));this.updateRectMinMax(e,d)}getPathBoundingBox(e=s.PathType.FILL,t=null){const n=[this.minX,this.minY,this.maxX,this.maxY];if(e===s.PathType.STROKE){t||(0,i.unreachable)("Stroke bounding box must include transform.");const e=i.Util.singularValueDecompose2dScale(t),r=e[0]*this.lineWidth/2,s=e[1]*this.lineWidth/2;n[0]-=r,n[1]-=s,n[2]+=r,n[3]+=s}return n}updateClipFromPath(){const e=i.Util.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(e||[0,0,0,0])}isEmptyClip(){return this.minX===1/0}startNewPathAndClipBox(e){this.clipBox=e,this.minX=1/0,this.minY=1/0,this.maxX=0,this.maxY=0}getClippedPathBoundingBox(e=s.PathType.FILL,t=null){return i.Util.intersect(this.clipBox,this.getPathBoundingBox(e,t))}}function f(e,t,n=null){if("undefined"!=typeof ImageData&&t instanceof ImageData)return void e.putImageData(t,0,0);const r=t.height,s=t.width,a=r%u,o=(r-a)/u,l=0===a?o:o+1,c=e.createImageData(s,u);let d,h=0;const p=t.data,f=c.data;let g,m,v,y,b,_,w,E;if(n)switch(n.length){case 1:b=n[0],_=n[0],w=n[0],E=n[0];break;case 4:b=n[0],_=n[1],w=n[2],E=n[3]}if(t.kind===i.ImageKind.GRAYSCALE_1BPP){const t=p.byteLength,n=new Uint32Array(f.buffer,0,f.byteLength>>2),r=n.length,y=s+7>>3;let b=4294967295,_=i.FeatureTest.isLittleEndian?4278190080:255;for(E&&255===E[0]&&0===E[255]&&([b,_]=[_,b]),g=0;g<l;g++){for(v=g<o?u:a,d=0,m=0;m<v;m++){const e=t-h;let r=0;const i=e>y?s:8*e-7,a=-8&i;let o=0,l=0;for(;r<a;r+=8)l=p[h++],n[d++]=128&l?b:_,n[d++]=64&l?b:_,n[d++]=32&l?b:_,n[d++]=16&l?b:_,n[d++]=8&l?b:_,n[d++]=4&l?b:_,n[d++]=2&l?b:_,n[d++]=1&l?b:_;for(;r<i;r++)0===o&&(l=p[h++],o=128),n[d++]=l&o?b:_,o>>=1}for(;d<r;)n[d++]=0;e.putImageData(c,0,g*u)}}else if(t.kind===i.ImageKind.RGBA_32BPP){const t=!!(b||_||w);for(m=0,y=s*u*4,g=0;g<o;g++){if(f.set(p.subarray(h,h+y)),h+=y,t)for(let e=0;e<y;e+=4)b&&(f[e+0]=b[f[e+0]]),_&&(f[e+1]=_[f[e+1]]),w&&(f[e+2]=w[f[e+2]]);e.putImageData(c,0,m),m+=u}if(g<l){if(y=s*a*4,f.set(p.subarray(h,h+y)),t)for(let e=0;e<y;e+=4)b&&(f[e+0]=b[f[e+0]]),_&&(f[e+1]=_[f[e+1]]),w&&(f[e+2]=w[f[e+2]]);e.putImageData(c,0,m)}}else{if(t.kind!==i.ImageKind.RGB_24BPP)throw new Error(`bad image kind: ${t.kind}`);{const t=!!(b||_||w);for(v=u,y=s*v,g=0;g<l;g++){for(g>=o&&(v=a,y=s*v),d=0,m=y;m--;)f[d++]=p[h++],f[d++]=p[h++],f[d++]=p[h++],f[d++]=255;if(t)for(let e=0;e<d;e+=4)b&&(f[e+0]=b[f[e+0]]),_&&(f[e+1]=_[f[e+1]]),w&&(f[e+2]=w[f[e+2]]);e.putImageData(c,0,g*u)}}}}function g(e,t){if(t.bitmap)return void e.drawImage(t.bitmap,0,0);const n=t.height,r=t.width,i=n%u,s=(n-i)/u,o=0===i?s:s+1,l=e.createImageData(r,u);let c=0;const d=t.data,h=l.data;for(let t=0;t<o;t++){const n=t<s?u:i;({srcPos:c}=(0,a.applyMaskImageData)({src:d,srcPos:c,dest:h,width:r,height:n})),e.putImageData(l,0,t*u)}}function m(e,t){const n=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font"];for(let r=0,i=n.length;r<i;r++){const i=n[r];void 0!==e[i]&&(t[i]=e[i])}void 0!==e.setLineDash&&(t.setLineDash(e.getLineDash()),t.lineDashOffset=e.lineDashOffset)}function v(e,t){e.strokeStyle=e.fillStyle=t||"#000000",e.fillRule="nonzero",e.globalAlpha=1,e.lineWidth=1,e.lineCap="butt",e.lineJoin="miter",e.miterLimit=10,e.globalCompositeOperation="source-over",e.font="10px sans-serif",void 0!==e.setLineDash&&(e.setLineDash([]),e.lineDashOffset=0)}function y(e,t,n,r){const i=e.length;for(let s=3;s<i;s+=4){const i=e[s];if(0===i)e[s-3]=t,e[s-2]=n,e[s-1]=r;else if(i<255){const a=255-i;e[s-3]=e[s-3]*i+t*a>>8,e[s-2]=e[s-2]*i+n*a>>8,e[s-1]=e[s-1]*i+r*a>>8}}}function b(e,t,n){const r=e.length;for(let i=3;i<r;i+=4){const r=n?n[e[i]]:e[i];t[i]=t[i]*r*.00392156862745098|0}}function _(e,t,n){const r=e.length;for(let i=3;i<r;i+=4){const r=77*e[i-3]+152*e[i-2]+28*e[i-1];t[i]=n?t[i]*n[r>>8]>>8:t[i]*r>>16}}function w(e,t,n,r){const i=r[0],s=r[1],a=r[2]-i,o=r[3]-s;0!==a&&0!==o&&(function(e,t,n,r,i,s,a,o,l,c,u){const d=!!s,h=d?s[0]:0,p=d?s[1]:0,f=d?s[2]:0;let g;g="Luminosity"===i?_:b;const m=Math.min(r,Math.ceil(1048576/n));for(let i=0;i<r;i+=m){const s=Math.min(m,r-i),v=e.getImageData(o-c,i+(l-u),n,s),b=t.getImageData(o,i+l,n,s);d&&y(v.data,h,p,f),g(v.data,b.data,a),t.putImageData(b,o,i+l)}}(t.context,n,a,o,t.subtype,t.backdrop,t.transferMap,i,s,t.offsetX,t.offsetY),e.save(),e.globalAlpha=1,e.globalCompositeOperation="source-over",e.setTransform(1,0,0,1,0,0),e.drawImage(n.canvas,0,0),e.restore())}function E(e,t){const n=i.Util.singularValueDecompose2dScale(e);n[0]=Math.fround(n[0]),n[1]=Math.fround(n[1]);const s=Math.fround((globalThis.devicePixelRatio||1)*r.PixelsPerInch.PDF_TO_CSS_UNITS);return void 0!==t?t:n[0]<=s||n[1]<=s}const S=["butt","round","square"],C=["miter","round","bevel"],A={},P={};class x{constructor(e,t,n,r,i,s,a,o){this.ctx=e,this.current=new p(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=t,this.objs=n,this.canvasFactory=r,this.imageLayer=i,this.groupStack=[],this.processingType3=null,this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.smaskCounter=0,this.tempSMask=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=[],this.optionalContentConfig=s,this.cachedCanvases=new d(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=a,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.backgroundColor=o?.background||null,this.foregroundColor=o?.foreground||null,this._cachedScaleForStroking=null,this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(e,t=null){return"string"==typeof e?e.startsWith("g_")?this.commonObjs.get(e):this.objs.get(e):t}beginDrawing({transform:e,viewport:t,transparency:n=!1,background:i=null}){const s=this.ctx.canvas.width,a=this.ctx.canvas.height,o=i||"#ffffff";if(this.ctx.save(),this.foregroundColor&&this.backgroundColor){this.ctx.fillStyle=this.foregroundColor;const e=this.foregroundColor=this.ctx.fillStyle;this.ctx.fillStyle=this.backgroundColor;const t=this.backgroundColor=this.ctx.fillStyle;let n=!0,i=o;if(this.ctx.fillStyle=o,i=this.ctx.fillStyle,n="string"==typeof i&&/^#[0-9A-Fa-f]{6}$/.test(i),"#000000"===e&&"#ffffff"===t||e===t||!n)this.foregroundColor=this.backgroundColor=null;else{const[n,s,a]=(0,r.getRGB)(i),o=e=>(e/=255)<=.03928?e/12.92:((e+.055)/1.055)**2.4,l=Math.round(.2126*o(n)+.7152*o(s)+.0722*o(a));this.selectColor=(n,r,i)=>{const s=.2126*o(n)+.7152*o(r)+.0722*o(i);return Math.round(s)===l?t:e}}}if(this.ctx.fillStyle=this.backgroundColor||o,this.ctx.fillRect(0,0,s,a),this.ctx.restore(),n){const e=this.cachedCanvases.getCanvas("transparent",s,a);this.compositeCtx=this.ctx,this.transparentCanvas=e.canvas,this.ctx=e.context,this.ctx.save(),this.ctx.transform(...(0,r.getCurrentTransform)(this.compositeCtx))}this.ctx.save(),v(this.ctx,this.foregroundColor),e&&(this.ctx.transform(...e),this.outputScaleX=e[0],this.outputScaleY=e[0]),this.ctx.transform(...t.transform),this.viewportScale=t.scale,this.baseTransform=(0,r.getCurrentTransform)(this.ctx),this.imageLayer&&((0,r.deprecated)("The `imageLayer` functionality will be removed in the future."),this.imageLayer.beginLayout())}executeOperatorList(e,t,n,r){const s=e.argsArray,a=e.fnArray;let o=t||0;const l=s.length;if(l===o)return o;const c=l-o>10&&"function"==typeof n,u=c?Date.now()+15:0;let d=0;const h=this.commonObjs,p=this.objs;let f;for(;;){if(void 0!==r&&o===r.nextBreakPoint)return r.breakIt(o,n),o;if(f=a[o],f!==i.OPS.dependency)this[f].apply(this,s[o]);else for(const e of s[o]){const t=e.startsWith("g_")?h:p;if(!t.has(e))return t.get(e,n),o}if(o++,o===l)return o;if(c&&++d>10){if(Date.now()>u)return n(),o;d=0}}}#Y(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();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.transparentCanvas=null)}endDrawing(){this.#Y(),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const e of this._cachedBitmapsMap.values()){for(const t of e.values())"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement&&(t.width=t.height=0);e.clear()}this._cachedBitmapsMap.clear(),this.imageLayer&&this.imageLayer.endLayout()}_scaleImage(e,t){const n=e.width,r=e.height;let i,s,a=Math.max(Math.hypot(t[0],t[1]),1),o=Math.max(Math.hypot(t[2],t[3]),1),l=n,c=r,u="prescale1";for(;a>2&&l>1||o>2&&c>1;){let t=l,n=c;a>2&&l>1&&(t=Math.ceil(l/2),a/=l/t),o>2&&c>1&&(n=Math.ceil(c/2),o/=c/n),i=this.cachedCanvases.getCanvas(u,t,n),s=i.context,s.clearRect(0,0,t,n),s.drawImage(e,0,0,l,c,0,0,t,n),e=i.canvas,l=t,c=n,u="prescale1"===u?"prescale2":"prescale1"}return{img:e,paintWidth:l,paintHeight:c}}_createMaskCanvas(e){const t=this.ctx,{width:n,height:a}=e,o=this.current.fillColor,l=this.current.patternFill,c=(0,r.getCurrentTransform)(t);let u,d,p,f;if((e.bitmap||e.data)&&e.count>1){const t=e.bitmap||e.data.buffer,n=c.slice(0,4);d=JSON.stringify(l?n:[n,o]),u=this._cachedBitmapsMap.get(t),u||(u=new Map,this._cachedBitmapsMap.set(t,u));const r=u.get(d);if(r&&!l)return{canvas:r,offsetX:Math.round(Math.min(c[0],c[2])+c[4]),offsetY:Math.round(Math.min(c[1],c[3])+c[5])};p=r}p||(f=this.cachedCanvases.getCanvas("maskCanvas",n,a),g(f.context,e));let m=i.Util.transform(c,[1/n,0,0,-1/a,0,0]);m=i.Util.transform(m,[1,0,0,1,0,-a]);const v=i.Util.applyTransform([0,0],m),y=i.Util.applyTransform([n,a],m),b=i.Util.normalizeRect([v[0],v[1],y[0],y[1]]),_=Math.round(b[2]-b[0])||1,w=Math.round(b[3]-b[1])||1,S=this.cachedCanvases.getCanvas("fillCanvas",_,w),C=S.context,A=Math.min(v[0],y[0]),P=Math.min(v[1],y[1]);C.translate(-A,-P),C.transform(...m),p||(p=this._scaleImage(f.canvas,(0,r.getCurrentTransformInverse)(C)),p=p.img,u&&l&&u.set(d,p)),C.imageSmoothingEnabled=E((0,r.getCurrentTransform)(C),e.interpolate),h(C,p,0,0,p.width,p.height,0,0,n,a),C.globalCompositeOperation="source-in";const x=i.Util.transform((0,r.getCurrentTransformInverse)(C),[1,0,0,1,-A,-P]);return C.fillStyle=l?o.getPattern(t,this,x,s.PathType.FILL):o,C.fillRect(0,0,n,a),u&&!l&&(this.cachedCanvases.delete("fillCanvas"),u.set(d,S.canvas)),{canvas:S.canvas,offsetX:Math.round(A),offsetY:Math.round(P)}}setLineWidth(e){e!==this.current.lineWidth&&(this._cachedScaleForStroking=null),this.current.lineWidth=e,this.ctx.lineWidth=e}setLineCap(e){this.ctx.lineCap=S[e]}setLineJoin(e){this.ctx.lineJoin=C[e]}setMiterLimit(e){this.ctx.miterLimit=e}setDash(e,t){const n=this.ctx;void 0!==n.setLineDash&&(n.setLineDash(e),n.lineDashOffset=t)}setRenderingIntent(e){}setFlatness(e){}setGState(e){for(let t=0,n=e.length;t<n;t++){const n=e[t],r=n[0],i=n[1];switch(r){case"LW":this.setLineWidth(i);break;case"LC":this.setLineCap(i);break;case"LJ":this.setLineJoin(i);break;case"ML":this.setMiterLimit(i);break;case"D":this.setDash(i[0],i[1]);break;case"RI":this.setRenderingIntent(i);break;case"FL":this.setFlatness(i);break;case"Font":this.setFont(i[0],i[1]);break;case"CA":this.current.strokeAlpha=n[1];break;case"ca":this.current.fillAlpha=n[1],this.ctx.globalAlpha=n[1];break;case"BM":this.ctx.globalCompositeOperation=i;break;case"SMask":this.current.activeSMask=i?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.current.transferMaps=i}}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const e=this.inSMaskMode;this.current.activeSMask&&!e?this.beginSMaskMode():!this.current.activeSMask&&e&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const e=this.ctx.canvas.width,t=this.ctx.canvas.height,n="smaskGroupAt"+this.groupLevel,i=this.cachedCanvases.getCanvas(n,e,t);this.suspendedCtx=this.ctx,this.ctx=i.context;const s=this.ctx;s.setTransform(...(0,r.getCurrentTransform)(this.suspendedCtx)),m(this.suspendedCtx,s),function(e,t){if(e._removeMirroring)throw new Error("Context is already forwarding operations.");e.__originalSave=e.save,e.__originalRestore=e.restore,e.__originalRotate=e.rotate,e.__originalScale=e.scale,e.__originalTranslate=e.translate,e.__originalTransform=e.transform,e.__originalSetTransform=e.setTransform,e.__originalResetTransform=e.resetTransform,e.__originalClip=e.clip,e.__originalMoveTo=e.moveTo,e.__originalLineTo=e.lineTo,e.__originalBezierCurveTo=e.bezierCurveTo,e.__originalRect=e.rect,e.__originalClosePath=e.closePath,e.__originalBeginPath=e.beginPath,e._removeMirroring=()=>{e.save=e.__originalSave,e.restore=e.__originalRestore,e.rotate=e.__originalRotate,e.scale=e.__originalScale,e.translate=e.__originalTranslate,e.transform=e.__originalTransform,e.setTransform=e.__originalSetTransform,e.resetTransform=e.__originalResetTransform,e.clip=e.__originalClip,e.moveTo=e.__originalMoveTo,e.lineTo=e.__originalLineTo,e.bezierCurveTo=e.__originalBezierCurveTo,e.rect=e.__originalRect,e.closePath=e.__originalClosePath,e.beginPath=e.__originalBeginPath,delete e._removeMirroring},e.save=function(){t.save(),this.__originalSave()},e.restore=function(){t.restore(),this.__originalRestore()},e.translate=function(e,n){t.translate(e,n),this.__originalTranslate(e,n)},e.scale=function(e,n){t.scale(e,n),this.__originalScale(e,n)},e.transform=function(e,n,r,i,s,a){t.transform(e,n,r,i,s,a),this.__originalTransform(e,n,r,i,s,a)},e.setTransform=function(e,n,r,i,s,a){t.setTransform(e,n,r,i,s,a),this.__originalSetTransform(e,n,r,i,s,a)},e.resetTransform=function(){t.resetTransform(),this.__originalResetTransform()},e.rotate=function(e){t.rotate(e),this.__originalRotate(e)},e.clip=function(e){t.clip(e),this.__originalClip(e)},e.moveTo=function(e,n){t.moveTo(e,n),this.__originalMoveTo(e,n)},e.lineTo=function(e,n){t.lineTo(e,n),this.__originalLineTo(e,n)},e.bezierCurveTo=function(e,n,r,i,s,a){t.bezierCurveTo(e,n,r,i,s,a),this.__originalBezierCurveTo(e,n,r,i,s,a)},e.rect=function(e,n,r,i){t.rect(e,n,r,i),this.__originalRect(e,n,r,i)},e.closePath=function(){t.closePath(),this.__originalClosePath()},e.beginPath=function(){t.beginPath(),this.__originalBeginPath()}}(s,this.suspendedCtx),this.setGState([["BM","source-over"],["ca",1],["CA",1]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),m(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(e){if(!this.current.activeSMask)return;e?(e[0]=Math.floor(e[0]),e[1]=Math.floor(e[1]),e[2]=Math.ceil(e[2]),e[3]=Math.ceil(e[3])):e=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const t=this.current.activeSMask;w(this.suspendedCtx,t,this.ctx,e),this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore()}save(){this.inSMaskMode?(m(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();const e=this.current;this.stateStack.push(e),this.current=e.clone()}restore(){0===this.stateStack.length&&this.inSMaskMode&&this.endSMaskMode(),0!==this.stateStack.length&&(this.current=this.stateStack.pop(),this.inSMaskMode?(this.suspendedCtx.restore(),m(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking=null,this._cachedGetSinglePixelWidth=null)}transform(e,t,n,r,i,s){this.ctx.transform(e,t,n,r,i,s),this._cachedScaleForStroking=null,this._cachedGetSinglePixelWidth=null}constructPath(e,t,n){const s=this.ctx,a=this.current;let o,l,c=a.x,u=a.y;const d=(0,r.getCurrentTransform)(s),h=0===d[0]&&0===d[3]||0===d[1]&&0===d[2],p=h?n.slice(0):null;for(let n=0,r=0,f=e.length;n<f;n++)switch(0|e[n]){case i.OPS.rectangle:c=t[r++],u=t[r++];const e=t[r++],n=t[r++],f=c+e,g=u+n;s.moveTo(c,u),0===e||0===n?s.lineTo(f,g):(s.lineTo(f,u),s.lineTo(f,g),s.lineTo(c,g)),h||a.updateRectMinMax(d,[c,u,f,g]),s.closePath();break;case i.OPS.moveTo:c=t[r++],u=t[r++],s.moveTo(c,u),h||a.updatePathMinMax(d,c,u);break;case i.OPS.lineTo:c=t[r++],u=t[r++],s.lineTo(c,u),h||a.updatePathMinMax(d,c,u);break;case i.OPS.curveTo:o=c,l=u,c=t[r+4],u=t[r+5],s.bezierCurveTo(t[r],t[r+1],t[r+2],t[r+3],c,u),a.updateCurvePathMinMax(d,o,l,t[r],t[r+1],t[r+2],t[r+3],c,u,p),r+=6;break;case i.OPS.curveTo2:o=c,l=u,s.bezierCurveTo(c,u,t[r],t[r+1],t[r+2],t[r+3]),a.updateCurvePathMinMax(d,o,l,c,u,t[r],t[r+1],t[r+2],t[r+3],p),c=t[r+2],u=t[r+3],r+=4;break;case i.OPS.curveTo3:o=c,l=u,c=t[r+2],u=t[r+3],s.bezierCurveTo(t[r],t[r+1],c,u,c,u),a.updateCurvePathMinMax(d,o,l,t[r],t[r+1],c,u,c,u,p),r+=4;break;case i.OPS.closePath:s.closePath()}h&&a.updateScalingPathMinMax(d,p),a.setCurrentPoint(c,u)}closePath(){this.ctx.closePath()}stroke(e){e=void 0===e||e;const t=this.ctx,n=this.current.strokeColor;t.globalAlpha=this.current.strokeAlpha,this.contentVisible&&("object"==typeof n&&n?.getPattern?(t.save(),t.strokeStyle=n.getPattern(t,this,(0,r.getCurrentTransformInverse)(t),s.PathType.STROKE),this.rescaleAndStroke(!1),t.restore()):this.rescaleAndStroke(!0)),e&&this.consumePath(this.current.getClippedPathBoundingBox()),t.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(e){e=void 0===e||e;const t=this.ctx,n=this.current.fillColor;let i=!1;this.current.patternFill&&(t.save(),t.fillStyle=n.getPattern(t,this,(0,r.getCurrentTransformInverse)(t),s.PathType.FILL),i=!0);const a=this.current.getClippedPathBoundingBox();this.contentVisible&&null!==a&&(this.pendingEOFill?(t.fill("evenodd"),this.pendingEOFill=!1):t.fill()),i&&t.restore(),e&&this.consumePath(a)}eoFill(){this.pendingEOFill=!0,this.fill()}fillStroke(){this.fill(!1),this.stroke(!1),this.consumePath()}eoFillStroke(){this.pendingEOFill=!0,this.fillStroke()}closeFillStroke(){this.closePath(),this.fillStroke()}closeEOFillStroke(){this.pendingEOFill=!0,this.closePath(),this.fillStroke()}endPath(){this.consumePath()}clip(){this.pendingClip=A}eoClip(){this.pendingClip=P}beginText(){this.current.textMatrix=i.IDENTITY_MATRIX,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){const e=this.pendingTextPaths,t=this.ctx;if(void 0!==e){t.save(),t.beginPath();for(const n of e)t.setTransform(...n.transform),t.translate(n.x,n.y),n.addToPath(t,n.fontSize);t.restore(),t.clip(),t.beginPath(),delete this.pendingTextPaths}else t.beginPath()}setCharSpacing(e){this.current.charSpacing=e}setWordSpacing(e){this.current.wordSpacing=e}setHScale(e){this.current.textHScale=e/100}setLeading(e){this.current.leading=-e}setFont(e,t){const n=this.commonObjs.get(e),r=this.current;if(!n)throw new Error(`Can't find font for ${e}`);if(r.fontMatrix=n.fontMatrix||i.FONT_IDENTITY_MATRIX,0!==r.fontMatrix[0]&&0!==r.fontMatrix[3]||(0,i.warn)("Invalid font matrix for font "+e),t<0?(t=-t,r.fontDirection=-1):r.fontDirection=1,this.current.font=n,this.current.fontSize=t,n.isType3Font)return;const s=n.loadedName||"sans-serif";let a="normal";n.black?a="900":n.bold&&(a="bold");const o=n.italic?"italic":"normal",l=`"${s}", ${n.fallbackName}`;let c=t;t<16?c=16:t>100&&(c=100),this.current.fontSizeScale=t/c,this.ctx.font=`${o} ${a} ${c}px ${l}`}setTextRenderingMode(e){this.current.textRenderingMode=e}setTextRise(e){this.current.textRise=e}moveText(e,t){this.current.x=this.current.lineX+=e,this.current.y=this.current.lineY+=t}setLeadingMoveText(e,t){this.setLeading(-t),this.moveText(e,t)}setTextMatrix(e,t,n,r,i,s){this.current.textMatrix=[e,t,n,r,i,s],this.current.textMatrixScale=Math.hypot(e,t),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(e,t,n,s){const a=this.ctx,o=this.current,l=o.font,c=o.textRenderingMode,u=o.fontSize/o.fontSizeScale,d=c&i.TextRenderingMode.FILL_STROKE_MASK,h=!!(c&i.TextRenderingMode.ADD_TO_PATH_FLAG),p=o.patternFill&&!l.missingFile;let f;(l.disableFontFace||h||p)&&(f=l.getPathGenerator(this.commonObjs,e)),l.disableFontFace||p?(a.save(),a.translate(t,n),a.beginPath(),f(a,u),s&&a.setTransform(...s),d!==i.TextRenderingMode.FILL&&d!==i.TextRenderingMode.FILL_STROKE||a.fill(),d!==i.TextRenderingMode.STROKE&&d!==i.TextRenderingMode.FILL_STROKE||a.stroke(),a.restore()):(d!==i.TextRenderingMode.FILL&&d!==i.TextRenderingMode.FILL_STROKE||a.fillText(e,t,n),d!==i.TextRenderingMode.STROKE&&d!==i.TextRenderingMode.FILL_STROKE||a.strokeText(e,t,n)),h&&(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:(0,r.getCurrentTransform)(a),x:t,y:n,fontSize:u,addToPath:f})}get isFontSubpixelAAEnabled(){const{context:e}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);e.scale(1.5,1),e.fillText("I",0,10);const t=e.getImageData(0,0,10,10).data;let n=!1;for(let e=3;e<t.length;e+=4)if(t[e]>0&&t[e]<255){n=!0;break}return(0,i.shadow)(this,"isFontSubpixelAAEnabled",n)}showText(e){const t=this.current,n=t.font;if(n.isType3Font)return this.showType3Text(e);const a=t.fontSize;if(0===a)return;const o=this.ctx,l=t.fontSizeScale,c=t.charSpacing,u=t.wordSpacing,d=t.fontDirection,h=t.textHScale*d,p=e.length,f=n.vertical,g=f?1:-1,m=n.defaultVMetrics,v=a*t.fontMatrix[0],y=t.textRenderingMode===i.TextRenderingMode.FILL&&!n.disableFontFace&&!t.patternFill;let b;if(o.save(),o.transform(...t.textMatrix),o.translate(t.x,t.y+t.textRise),d>0?o.scale(h,-1):o.scale(h,1),t.patternFill){o.save();const e=t.fillColor.getPattern(o,this,(0,r.getCurrentTransformInverse)(o),s.PathType.FILL);b=(0,r.getCurrentTransform)(o),o.restore(),o.fillStyle=e}let _=t.lineWidth;const w=t.textMatrixScale;if(0===w||0===_){const e=t.textRenderingMode&i.TextRenderingMode.FILL_STROKE_MASK;e!==i.TextRenderingMode.STROKE&&e!==i.TextRenderingMode.FILL_STROKE||(_=this.getSinglePixelWidth())}else _/=w;1!==l&&(o.scale(l,l),_/=l),o.lineWidth=_;let E,S=0;for(E=0;E<p;++E){const t=e[E];if("number"==typeof t){S+=g*t*a/1e3;continue}let r=!1;const i=(t.isSpace?u:0)+c,s=t.fontChar,h=t.accent;let p,_,w,C=t.width;if(f){const e=t.vmetric||m,n=-(t.vmetric?e[1]:.5*C)*v,r=e[2]*v;C=e?-e[0]:C,p=n/l,_=(S+r)/l}else p=S/l,_=0;if(n.remeasure&&C>0){const e=1e3*o.measureText(s).width/a*l;if(C<e&&this.isFontSubpixelAAEnabled){const t=C/e;r=!0,o.save(),o.scale(t,1),p/=t}else C!==e&&(p+=(C-e)/2e3*a/l)}if(this.contentVisible&&(t.isInFont||n.missingFile))if(y&&!h)o.fillText(s,p,_);else if(this.paintChar(s,p,_,b),h){const e=p+a*h.offset.x/l,t=_-a*h.offset.y/l;this.paintChar(h.fontChar,e,t,b)}w=f?C*v-i*d:C*v+i*d,S+=w,r&&o.restore()}f?t.y-=S:t.x+=S*h,o.restore(),this.compose()}showType3Text(e){const t=this.ctx,n=this.current,r=n.font,s=n.fontSize,a=n.fontDirection,o=r.vertical?1:-1,l=n.charSpacing,c=n.wordSpacing,u=n.textHScale*a,d=n.fontMatrix||i.FONT_IDENTITY_MATRIX,h=e.length;let p,f,g,m;if(n.textRenderingMode!==i.TextRenderingMode.INVISIBLE&&0!==s){for(this._cachedScaleForStroking=null,this._cachedGetSinglePixelWidth=null,t.save(),t.transform(...n.textMatrix),t.translate(n.x,n.y),t.scale(u,a),p=0;p<h;++p){if(f=e[p],"number"==typeof f){m=o*f*s/1e3,this.ctx.translate(m,0),n.x+=m*u;continue}const a=(f.isSpace?c:0)+l,h=r.charProcOperatorList[f.operatorListId];h?(this.contentVisible&&(this.processingType3=f,this.save(),t.scale(s,s),t.transform(...d),this.executeOperatorList(h),this.restore()),g=i.Util.applyTransform([f.width,0],d)[0]*s+a,t.translate(g,0),n.x+=g*u):(0,i.warn)(`Type3 character "${f.operatorListId}" is not available.`)}t.restore(),this.processingType3=null}}setCharWidth(e,t){}setCharWidthAndBounds(e,t,n,r,i,s){this.ctx.rect(n,r,i-n,s-r),this.ctx.clip(),this.endPath()}getColorN_Pattern(e){let t;if("TilingPattern"===e[0]){const n=e[1],i=this.baseTransform||(0,r.getCurrentTransform)(this.ctx),a={createCanvasGraphics:e=>new x(e,this.commonObjs,this.objs,this.canvasFactory)};t=new s.TilingPattern(e,n,this.ctx,a,i)}else t=this._getPattern(e[1],e[2]);return t}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(e,t,n){const r=this.selectColor?.(e,t,n)||i.Util.makeHexColor(e,t,n);this.ctx.strokeStyle=r,this.current.strokeColor=r}setFillRGBColor(e,t,n){const r=this.selectColor?.(e,t,n)||i.Util.makeHexColor(e,t,n);this.ctx.fillStyle=r,this.current.fillColor=r,this.current.patternFill=!1}_getPattern(e,t=null){let n;return this.cachedPatterns.has(e)?n=this.cachedPatterns.get(e):(n=(0,s.getShadingPattern)(this.objs.get(e)),this.cachedPatterns.set(e,n)),t&&(n.matrix=t),n}shadingFill(e){if(!this.contentVisible)return;const t=this.ctx;this.save();const n=this._getPattern(e);t.fillStyle=n.getPattern(t,this,(0,r.getCurrentTransformInverse)(t),s.PathType.SHADING);const a=(0,r.getCurrentTransformInverse)(t);if(a){const e=t.canvas,n=e.width,r=e.height,s=i.Util.applyTransform([0,0],a),o=i.Util.applyTransform([0,r],a),l=i.Util.applyTransform([n,0],a),c=i.Util.applyTransform([n,r],a),u=Math.min(s[0],o[0],l[0],c[0]),d=Math.min(s[1],o[1],l[1],c[1]),h=Math.max(s[0],o[0],l[0],c[0]),p=Math.max(s[1],o[1],l[1],c[1]);this.ctx.fillRect(u,d,h-u,p-d)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){(0,i.unreachable)("Should not call beginInlineImage")}beginImageData(){(0,i.unreachable)("Should not call beginImageData")}paintFormXObjectBegin(e,t){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),Array.isArray(e)&&6===e.length&&this.transform(...e),this.baseTransform=(0,r.getCurrentTransform)(this.ctx),t)){const e=t[2]-t[0],n=t[3]-t[1];this.ctx.rect(t[0],t[1],e,n),this.current.updateRectMinMax((0,r.getCurrentTransform)(this.ctx),t),this.clip(),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(e){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const t=this.ctx;e.isolated||(0,i.info)("TODO: Support non-isolated groups."),e.knockout&&(0,i.warn)("Knockout groups not supported.");const n=(0,r.getCurrentTransform)(t);if(e.matrix&&t.transform(...e.matrix),!e.bbox)throw new Error("Bounding box is required.");let s=i.Util.getAxialAlignedBoundingBox(e.bbox,(0,r.getCurrentTransform)(t));const a=[0,0,t.canvas.width,t.canvas.height];s=i.Util.intersect(s,a)||[0,0,0,0];const o=Math.floor(s[0]),c=Math.floor(s[1]);let u=Math.max(Math.ceil(s[2])-o,1),d=Math.max(Math.ceil(s[3])-c,1),h=1,p=1;u>l&&(h=u/l,u=l),d>l&&(p=d/l,d=l),this.current.startNewPathAndClipBox([0,0,u,d]);let f="groupAt"+this.groupLevel;e.smask&&(f+="_smask_"+this.smaskCounter++%2);const g=this.cachedCanvases.getCanvas(f,u,d),v=g.context;v.scale(1/h,1/p),v.translate(-o,-c),v.transform(...n),e.smask?this.smaskStack.push({canvas:g.canvas,context:v,offsetX:o,offsetY:c,scaleX:h,scaleY:p,subtype:e.smask.subtype,backdrop:e.smask.backdrop,transferMap:e.smask.transferMap||null,startTransformInverse:null}):(t.setTransform(1,0,0,1,0,0),t.translate(o,c),t.scale(h,p),t.save()),m(t,v),this.ctx=v,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(t),this.groupLevel++}endGroup(e){if(!this.contentVisible)return;this.groupLevel--;const t=this.ctx,n=this.groupStack.pop();if(this.ctx=n,this.ctx.imageSmoothingEnabled=!1,e.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const e=(0,r.getCurrentTransform)(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...e);const n=i.Util.getAxialAlignedBoundingBox([0,0,t.canvas.width,t.canvas.height],e);this.ctx.drawImage(t.canvas,0,0),this.ctx.restore(),this.compose(n)}}beginAnnotation(e,t,n,s,a){if(this.#Y(),v(this.ctx,this.foregroundColor),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),Array.isArray(t)&&4===t.length){const s=t[2]-t[0],o=t[3]-t[1];if(a&&this.annotationCanvasMap){(n=n.slice())[4]-=t[0],n[5]-=t[1],(t=t.slice())[0]=t[1]=0,t[2]=s,t[3]=o;const[a,l]=i.Util.singularValueDecompose2dScale((0,r.getCurrentTransform)(this.ctx)),{viewportScale:c}=this,u=Math.ceil(s*this.outputScaleX*c),d=Math.ceil(o*this.outputScaleY*c);this.annotationCanvas=this.canvasFactory.create(u,d);const{canvas:h,context:p}=this.annotationCanvas;this.annotationCanvasMap.set(e,h),this.annotationCanvas.savedCtx=this.ctx,this.ctx=p,this.ctx.setTransform(a,0,0,-l,0,o*l),v(this.ctx,this.foregroundColor)}else v(this.ctx,this.foregroundColor),this.ctx.rect(t[0],t[1],s,o),this.ctx.clip(),this.endPath()}this.current=new p(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...n),this.transform(...s)}endAnnotation(){this.annotationCanvas&&(this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(e){if(!this.contentVisible)return;const t=e.count;(e=this.getObject(e.data,e)).count=t;const n=this.ctx,r=this.processingType3;if(r&&(void 0===r.compiled&&(r.compiled=function(e){const{width:t,height:n}=e;if(t>c||n>c)return null;const r=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),i=t+1;let s,a,o,l=new Uint8Array(i*(n+1));const u=t+7&-8;let d=new Uint8Array(u*n),h=0;for(const t of e.data){let e=128;for(;e>0;)d[h++]=t&e?0:255,e>>=1}let p=0;for(h=0,0!==d[h]&&(l[0]=1,++p),a=1;a<t;a++)d[h]!==d[h+1]&&(l[a]=d[h]?2:1,++p),h++;for(0!==d[h]&&(l[a]=2,++p),s=1;s<n;s++){h=s*u,o=s*i,d[h-u]!==d[h]&&(l[o]=d[h]?1:8,++p);let e=(d[h]?4:0)+(d[h-u]?8:0);for(a=1;a<t;a++)e=(e>>2)+(d[h+1]?4:0)+(d[h-u+1]?8:0),r[e]&&(l[o+a]=r[e],++p),h++;if(d[h-u]!==d[h]&&(l[o+a]=d[h]?2:4,++p),p>1e3)return null}for(h=u*(n-1),o=s*i,0!==d[h]&&(l[o]=8,++p),a=1;a<t;a++)d[h]!==d[h+1]&&(l[o+a]=d[h]?4:8,++p),h++;if(0!==d[h]&&(l[o+a]=4,++p),p>1e3)return null;const f=new Int32Array([0,i,-1,0,-i,0,0,0,1]),g=new Path2D;for(s=0;p&&s<=n;s++){let e=s*i;const n=e+t;for(;e<n&&!l[e];)e++;if(e===n)continue;g.moveTo(e%i,s);const r=e;let a=l[e];do{const t=f[a];do{e+=t}while(!l[e]);const n=l[e];5!==n&&10!==n?(a=n,l[e]=0):(a=n&51*a>>4,l[e]&=a>>2|a<<2),g.lineTo(e%i,e/i|0),l[e]||--p}while(r!==e);--s}return d=null,l=null,function(e){e.save(),e.scale(1/t,-1/n),e.translate(0,-n),e.fill(g),e.beginPath(),e.restore()}}(e)),r.compiled))return void r.compiled(n);const i=this._createMaskCanvas(e),s=i.canvas;n.save(),n.setTransform(1,0,0,1,0,0),n.drawImage(s,i.offsetX,i.offsetY),n.restore(),this.compose()}paintImageMaskXObjectRepeat(e,t,n=0,s=0,a,o){if(!this.contentVisible)return;e=this.getObject(e.data,e);const l=this.ctx;l.save();const c=(0,r.getCurrentTransform)(l);l.transform(t,n,s,a,0,0);const u=this._createMaskCanvas(e);l.setTransform(1,0,0,1,0,0);for(let e=0,r=o.length;e<r;e+=2){const r=i.Util.transform(c,[t,n,s,a,o[e],o[e+1]]),[d,h]=i.Util.applyTransform([0,0],r);l.drawImage(u.canvas,d,h)}l.restore(),this.compose()}paintImageMaskXObjectGroup(e){if(!this.contentVisible)return;const t=this.ctx,n=this.current.fillColor,i=this.current.patternFill;for(const a of e){const{data:e,width:o,height:l,transform:c}=a,u=this.cachedCanvases.getCanvas("maskCanvas",o,l),d=u.context;d.save(),g(d,this.getObject(e,a)),d.globalCompositeOperation="source-in",d.fillStyle=i?n.getPattern(d,this,(0,r.getCurrentTransformInverse)(t),s.PathType.FILL):n,d.fillRect(0,0,o,l),d.restore(),t.save(),t.transform(...c),t.scale(1,-1),h(t,u.canvas,0,0,o,l,0,-1,1,1),t.restore()}this.compose()}paintImageXObject(e){if(!this.contentVisible)return;const t=this.getObject(e);t?this.paintInlineImageXObject(t):(0,i.warn)("Dependent image isn't ready yet")}paintImageXObjectRepeat(e,t,n,r){if(!this.contentVisible)return;const s=this.getObject(e);if(!s)return void(0,i.warn)("Dependent image isn't ready yet");const a=s.width,o=s.height,l=[];for(let e=0,i=r.length;e<i;e+=2)l.push({transform:[t,0,0,n,r[e],r[e+1]],x:0,y:0,w:a,h:o});this.paintInlineImageXObjectGroup(s,l)}paintInlineImageXObject(e){if(!this.contentVisible)return;const t=e.width,n=e.height,s=this.ctx;let a;if(this.save(),s.scale(1/t,-1/n),"function"==typeof HTMLElement&&e instanceof HTMLElement||!e.data)a=e;else{const r=this.cachedCanvases.getCanvas("inlineImage",t,n);f(r.context,e,this.current.transferMaps),a=r.canvas}const o=this._scaleImage(a,(0,r.getCurrentTransformInverse)(s));s.imageSmoothingEnabled=E((0,r.getCurrentTransform)(s),e.interpolate);const[l,c]=h(s,o.img,0,0,o.paintWidth,o.paintHeight,0,-n,t,n);if(this.imageLayer){const[t,s]=i.Util.applyTransform([0,-n],(0,r.getCurrentTransform)(this.ctx));this.imageLayer.appendImage({imgData:e,left:t,top:s,width:l,height:c})}this.compose(),this.restore()}paintInlineImageXObjectGroup(e,t){if(!this.contentVisible)return;const n=this.ctx,s=e.width,a=e.height,o=this.cachedCanvases.getCanvas("inlineImage",s,a);f(o.context,e,this.current.transferMaps);for(const l of t){if(n.save(),n.transform(...l.transform),n.scale(1,-1),h(n,o.canvas,l.x,l.y,l.w,l.h,0,-1,1,1),this.imageLayer){const[t,n]=i.Util.applyTransform([l.x,l.y],(0,r.getCurrentTransform)(this.ctx));this.imageLayer.appendImage({imgData:e,left:t,top:n,width:s,height:a})}n.restore()}this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(e){}markPointProps(e,t){}beginMarkedContent(e){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(e,t){"OC"===e?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(t)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(e){const t=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(e);const n=this.ctx;this.pendingClip&&(t||(this.pendingClip===P?n.clip("evenodd"):n.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),n.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const e=(0,r.getCurrentTransform)(this.ctx);if(0===e[1]&&0===e[2])this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(e[0]),Math.abs(e[3]));else{const t=Math.abs(e[0]*e[3]-e[2]*e[1]),n=Math.hypot(e[0],e[2]),r=Math.hypot(e[1],e[3]);this._cachedGetSinglePixelWidth=Math.max(n,r)/t}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(!this._cachedScaleForStroking){const{lineWidth:e}=this.current,t=(0,r.getCurrentTransform)(this.ctx);let n,i;if(0===t[1]&&0===t[2]){const r=Math.abs(t[0]),s=Math.abs(t[3]);if(0===e)n=1/r,i=1/s;else{const t=r*e,a=s*e;n=t<1?1/t:1,i=a<1?1/a:1}}else{const r=Math.abs(t[0]*t[3]-t[2]*t[1]),s=Math.hypot(t[0],t[1]),a=Math.hypot(t[2],t[3]);if(0===e)n=a/r,i=s/r;else{const t=e*r;n=a>t?a/t:1,i=s>t?s/t:1}}this._cachedScaleForStroking=[n,i]}return this._cachedScaleForStroking}rescaleAndStroke(e){const{ctx:t}=this,{lineWidth:n}=this.current,[i,s]=this.getScaleForStroking();if(t.lineWidth=n||1,1===i&&1===s)return void t.stroke();let a,o,l;e&&(a=(0,r.getCurrentTransform)(t),o=t.getLineDash().slice(),l=t.lineDashOffset),t.scale(i,s);const c=Math.max(i,s);t.setLineDash(t.getLineDash().map((e=>e/c))),t.lineDashOffset/=c,t.stroke(),e&&(t.setTransform(...a),t.setLineDash(o),t.lineDashOffset=l)}isContentVisible(){for(let e=this.markedContentStack.length-1;e>=0;e--)if(!this.markedContentStack[e].visible)return!1;return!0}}t.CanvasGraphics=x;for(const e in i.OPS)void 0!==x.prototype[e]&&(x.prototype[i.OPS[e]]=x.prototype[e])},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TilingPattern=t.PathType=void 0,t.getShadingPattern=function(e){switch(e[0]){case"RadialAxial":return new c(e);case"Mesh":return new h(e);case"Dummy":return new p}throw new Error(`Unknown IR type: ${e[0]}`)};var r=n(1),i=n(8),s=n(3);const a={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function o(e,t){if(!t||s.isNodeJS)return;const n=t[2]-t[0],r=t[3]-t[1],i=new Path2D;i.rect(t[0],t[1],n,r),e.clip(i)}t.PathType=a;class l{constructor(){this.constructor===l&&(0,r.unreachable)("Cannot initialize BaseShadingPattern.")}getPattern(){(0,r.unreachable)("Abstract method `getPattern` called.")}}class c extends l{constructor(e){super(),this._type=e[1],this._bbox=e[2],this._colorStops=e[3],this._p0=e[4],this._p1=e[5],this._r0=e[6],this._r1=e[7],this.matrix=null}_createGradient(e){let t;"axial"===this._type?t=e.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):"radial"===this._type&&(t=e.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const e of this._colorStops)t.addColorStop(e[0],e[1]);return t}getPattern(e,t,n,s){let l;if(s===a.STROKE||s===a.FILL){const a=t.current.getClippedPathBoundingBox(s,(0,i.getCurrentTransform)(e))||[0,0,0,0],c=Math.ceil(a[2]-a[0])||1,u=Math.ceil(a[3]-a[1])||1,d=t.cachedCanvases.getCanvas("pattern",c,u,!0),h=d.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(-a[0],-a[1]),n=r.Util.transform(n,[1,0,0,1,a[0],a[1]]),h.transform(...t.baseTransform),this.matrix&&h.transform(...this.matrix),o(h,this._bbox),h.fillStyle=this._createGradient(h),h.fill(),l=e.createPattern(d.canvas,"no-repeat");const p=new DOMMatrix(n);try{l.setTransform(p)}catch(e){(0,r.warn)(`RadialAxialShadingPattern.getPattern: "${e?.message}".`)}}else o(e,this._bbox),l=this._createGradient(e);return l}}function u(e,t,n,r,i,s,a,o){const l=t.coords,c=t.colors,u=e.data,d=4*e.width;let h;l[n+1]>l[r+1]&&(h=n,n=r,r=h,h=s,s=a,a=h),l[r+1]>l[i+1]&&(h=r,r=i,i=h,h=a,a=o,o=h),l[n+1]>l[r+1]&&(h=n,n=r,r=h,h=s,s=a,a=h);const p=(l[n]+t.offsetX)*t.scaleX,f=(l[n+1]+t.offsetY)*t.scaleY,g=(l[r]+t.offsetX)*t.scaleX,m=(l[r+1]+t.offsetY)*t.scaleY,v=(l[i]+t.offsetX)*t.scaleX,y=(l[i+1]+t.offsetY)*t.scaleY;if(f>=y)return;const b=c[s],_=c[s+1],w=c[s+2],E=c[a],S=c[a+1],C=c[a+2],A=c[o],P=c[o+1],x=c[o+2],T=Math.round(f),R=Math.round(y);let M,L,I,k,O,F,D,N;for(let e=T;e<=R;e++){if(e<m){let t;t=e<f?0:(f-e)/(f-m),M=p-(p-g)*t,L=b-(b-E)*t,I=_-(_-S)*t,k=w-(w-C)*t}else{let t;t=e>y?1:m===y?0:(m-e)/(m-y),M=g-(g-v)*t,L=E-(E-A)*t,I=S-(S-P)*t,k=C-(C-x)*t}let t;t=e<f?0:e>y?1:(f-e)/(f-y),O=p-(p-v)*t,F=b-(b-A)*t,D=_-(_-P)*t,N=w-(w-x)*t;const n=Math.round(Math.min(M,O)),r=Math.round(Math.max(M,O));let i=d*e+4*n;for(let e=n;e<=r;e++)t=(M-e)/(M-O),t<0?t=0:t>1&&(t=1),u[i++]=L-(L-F)*t|0,u[i++]=I-(I-D)*t|0,u[i++]=k-(k-N)*t|0,u[i++]=255}}function d(e,t,n){const r=t.coords,i=t.colors;let s,a;switch(t.type){case"lattice":const o=t.verticesPerRow,l=Math.floor(r.length/o)-1,c=o-1;for(s=0;s<l;s++){let t=s*o;for(let s=0;s<c;s++,t++)u(e,n,r[t],r[t+1],r[t+o],i[t],i[t+1],i[t+o]),u(e,n,r[t+o+1],r[t+1],r[t+o],i[t+o+1],i[t+1],i[t+o])}break;case"triangles":for(s=0,a=r.length;s<a;s+=3)u(e,n,r[s],r[s+1],r[s+2],i[s],i[s+1],i[s+2]);break;default:throw new Error("illegal figure")}}class h extends l{constructor(e){super(),this._coords=e[2],this._colors=e[3],this._figures=e[4],this._bounds=e[5],this._bbox=e[7],this._background=e[8],this.matrix=null}_createMeshCanvas(e,t,n){const r=Math.floor(this._bounds[0]),i=Math.floor(this._bounds[1]),s=Math.ceil(this._bounds[2])-r,a=Math.ceil(this._bounds[3])-i,o=Math.min(Math.ceil(Math.abs(s*e[0]*1.1)),3e3),l=Math.min(Math.ceil(Math.abs(a*e[1]*1.1)),3e3),c=s/o,u=a/l,h={coords:this._coords,colors:this._colors,offsetX:-r,offsetY:-i,scaleX:1/c,scaleY:1/u},p=o+4,f=l+4,g=n.getCanvas("mesh",p,f,!1),m=g.context,v=m.createImageData(o,l);if(t){const e=v.data;for(let n=0,r=e.length;n<r;n+=4)e[n]=t[0],e[n+1]=t[1],e[n+2]=t[2],e[n+3]=255}for(const e of this._figures)d(v,e,h);return m.putImageData(v,2,2),{canvas:g.canvas,offsetX:r-2*c,offsetY:i-2*u,scaleX:c,scaleY:u}}getPattern(e,t,n,s){let l;if(o(e,this._bbox),s===a.SHADING)l=r.Util.singularValueDecompose2dScale((0,i.getCurrentTransform)(e));else if(l=r.Util.singularValueDecompose2dScale(t.baseTransform),this.matrix){const e=r.Util.singularValueDecompose2dScale(this.matrix);l=[l[0]*e[0],l[1]*e[1]]}const c=this._createMeshCanvas(l,s===a.SHADING?null:this._background,t.cachedCanvases);return s!==a.SHADING&&(e.setTransform(...t.baseTransform),this.matrix&&e.transform(...this.matrix)),e.translate(c.offsetX,c.offsetY),e.scale(c.scaleX,c.scaleY),e.createPattern(c.canvas,"no-repeat")}}class p extends l{getPattern(){return"hotpink"}}const f=1,g=2;class m{static get MAX_PATTERN_SIZE(){return(0,r.shadow)(this,"MAX_PATTERN_SIZE",3e3)}constructor(e,t,n,r,i){this.operatorList=e[2],this.matrix=e[3]||[1,0,0,1,0,0],this.bbox=e[4],this.xstep=e[5],this.ystep=e[6],this.paintType=e[7],this.tilingType=e[8],this.color=t,this.ctx=n,this.canvasGraphicsFactory=r,this.baseTransform=i}createPatternCanvas(e){const t=this.operatorList,n=this.bbox,s=this.xstep,a=this.ystep,o=this.paintType,l=this.tilingType,c=this.color,u=this.canvasGraphicsFactory;(0,r.info)("TilingType: "+l);const d=n[0],h=n[1],p=n[2],f=n[3],g=r.Util.singularValueDecompose2dScale(this.matrix),m=r.Util.singularValueDecompose2dScale(this.baseTransform),v=[g[0]*m[0],g[1]*m[1]],y=this.getSizeAndScale(s,this.ctx.canvas.width,v[0]),b=this.getSizeAndScale(a,this.ctx.canvas.height,v[1]),_=e.cachedCanvases.getCanvas("pattern",y.size,b.size,!0),w=_.context,E=u.createCanvasGraphics(w);E.groupLevel=e.groupLevel,this.setFillAndStrokeStyleToContext(E,o,c);let S=d,C=h,A=p,P=f;return d<0&&(S=0,A+=Math.abs(d)),h<0&&(C=0,P+=Math.abs(h)),w.translate(-y.scale*S,-b.scale*C),E.transform(y.scale,0,0,b.scale,0,0),w.save(),this.clipBbox(E,S,C,A,P),E.baseTransform=(0,i.getCurrentTransform)(E.ctx),E.executeOperatorList(t),E.endDrawing(),{canvas:_.canvas,scaleX:y.scale,scaleY:b.scale,offsetX:S,offsetY:C}}getSizeAndScale(e,t,n){e=Math.abs(e);const r=Math.max(m.MAX_PATTERN_SIZE,t);let i=Math.ceil(e*n);return i>=r?i=r:n=i/e,{scale:n,size:i}}clipBbox(e,t,n,r,s){const a=r-t,o=s-n;e.ctx.rect(t,n,a,o),e.current.updateRectMinMax((0,i.getCurrentTransform)(e.ctx),[t,n,r,s]),e.clip(),e.endPath()}setFillAndStrokeStyleToContext(e,t,n){const i=e.ctx,s=e.current;switch(t){case f:const e=this.ctx;i.fillStyle=e.fillStyle,i.strokeStyle=e.strokeStyle,s.fillColor=e.fillStyle,s.strokeColor=e.strokeStyle;break;case g:const a=r.Util.makeHexColor(n[0],n[1],n[2]);i.fillStyle=a,i.strokeStyle=a,s.fillColor=a,s.strokeColor=a;break;default:throw new r.FormatError(`Unsupported paint type: ${t}`)}}getPattern(e,t,n,i){let s=n;i!==a.SHADING&&(s=r.Util.transform(s,t.baseTransform),this.matrix&&(s=r.Util.transform(s,this.matrix)));const o=this.createPatternCanvas(t);let l=new DOMMatrix(s);l=l.translate(o.offsetX,o.offsetY),l=l.scale(1/o.scaleX,1/o.scaleY);const c=e.createPattern(o.canvas,"repeat");try{c.setTransform(l)}catch(e){(0,r.warn)(`TilingPattern.getPattern: "${e?.message}".`)}return c}}t.TilingPattern=m},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.applyMaskImageData=function({src:e,srcPos:t=0,dest:n,destPos:i=0,width:s,height:a,inverseDecode:o=!1}){const l=r.FeatureTest.isLittleEndian?4278190080:255,[c,u]=o?[0,l]:[l,0],d=s>>3,h=7&s,p=e.length;n=new Uint32Array(n.buffer);for(let r=0;r<a;r++){for(const r=t+d;t<r;t++){const r=t<p?e[t]:255;n[i++]=128&r?u:c,n[i++]=64&r?u:c,n[i++]=32&r?u:c,n[i++]=16&r?u:c,n[i++]=8&r?u:c,n[i++]=4&r?u:c,n[i++]=2&r?u:c,n[i++]=1&r?u:c}if(0===h)continue;const r=t<p?e[t++]:255;for(let e=0;e<h;e++)n[i++]=r&1<<7-e?u:c}return{srcPos:t,destPos:i}};var r=n(1)},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GlobalWorkerOptions=void 0;const n=Object.create(null);t.GlobalWorkerOptions=n,n.workerPort=void 0===n.workerPort?null:n.workerPort,n.workerSrc=void 0===n.workerSrc?"":n.workerSrc},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MessageHandler=void 0;var r=n(1);const i=1,s=2,a=1,o=2,l=3,c=4,u=5,d=6,h=7,p=8;function f(e){switch(e instanceof Error||"object"==typeof e&&null!==e||(0,r.unreachable)('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),e.name){case"AbortException":return new r.AbortException(e.message);case"MissingPDFException":return new r.MissingPDFException(e.message);case"PasswordException":return new r.PasswordException(e.message,e.code);case"UnexpectedResponseException":return new r.UnexpectedResponseException(e.message,e.status);case"UnknownErrorException":return new r.UnknownErrorException(e.message,e.details);default:return new r.UnknownErrorException(e.message,e.toString())}}t.MessageHandler=class{constructor(e,t,n){this.sourceName=e,this.targetName=t,this.comObj=n,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),this._onComObjOnMessage=e=>{const t=e.data;if(t.targetName!==this.sourceName)return;if(t.stream)return void this._processStreamMessage(t);if(t.callback){const e=t.callbackId,n=this.callbackCapabilities[e];if(!n)throw new Error(`Cannot resolve callback ${e}`);if(delete this.callbackCapabilities[e],t.callback===i)n.resolve(t.data);else{if(t.callback!==s)throw new Error("Unexpected callback case");n.reject(f(t.reason))}return}const r=this.actionHandler[t.action];if(!r)throw new Error(`Unknown action from worker: ${t.action}`);if(t.callbackId){const e=this.sourceName,a=t.sourceName;new Promise((function(e){e(r(t.data))})).then((function(r){n.postMessage({sourceName:e,targetName:a,callback:i,callbackId:t.callbackId,data:r})}),(function(r){n.postMessage({sourceName:e,targetName:a,callback:s,callbackId:t.callbackId,reason:f(r)})}))}else t.streamId?this._createStreamSink(t):r(t.data)},n.addEventListener("message",this._onComObjOnMessage)}on(e,t){const n=this.actionHandler;if(n[e])throw new Error(`There is already an actionName called "${e}"`);n[e]=t}send(e,t,n){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,data:t},n)}sendWithPromise(e,t,n){const i=this.callbackId++,s=(0,r.createPromiseCapability)();this.callbackCapabilities[i]=s;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,callbackId:i,data:t},n)}catch(e){s.reject(e)}return s.promise}sendWithStream(e,t,n,i){const s=this.streamId++,o=this.sourceName,l=this.targetName,c=this.comObj;return new ReadableStream({start:n=>{const a=(0,r.createPromiseCapability)();return this.streamControllers[s]={controller:n,startCall:a,pullCall:null,cancelCall:null,isClosed:!1},c.postMessage({sourceName:o,targetName:l,action:e,streamId:s,data:t,desiredSize:n.desiredSize},i),a.promise},pull:e=>{const t=(0,r.createPromiseCapability)();return this.streamControllers[s].pullCall=t,c.postMessage({sourceName:o,targetName:l,stream:d,streamId:s,desiredSize:e.desiredSize}),t.promise},cancel:e=>{(0,r.assert)(e instanceof Error,"cancel must have a valid reason");const t=(0,r.createPromiseCapability)();return this.streamControllers[s].cancelCall=t,this.streamControllers[s].isClosed=!0,c.postMessage({sourceName:o,targetName:l,stream:a,streamId:s,reason:f(e)}),t.promise}},n)}_createStreamSink(e){const t=e.streamId,n=this.sourceName,i=e.sourceName,s=this.comObj,a=this,o=this.actionHandler[e.action],d={enqueue(e,a=1,o){if(this.isCancelled)return;const l=this.desiredSize;this.desiredSize-=a,l>0&&this.desiredSize<=0&&(this.sinkCapability=(0,r.createPromiseCapability)(),this.ready=this.sinkCapability.promise),s.postMessage({sourceName:n,targetName:i,stream:c,streamId:t,chunk:e},o)},close(){this.isCancelled||(this.isCancelled=!0,s.postMessage({sourceName:n,targetName:i,stream:l,streamId:t}),delete a.streamSinks[t])},error(e){(0,r.assert)(e instanceof Error,"error must have a valid reason"),this.isCancelled||(this.isCancelled=!0,s.postMessage({sourceName:n,targetName:i,stream:u,streamId:t,reason:f(e)}))},sinkCapability:(0,r.createPromiseCapability)(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:e.desiredSize,ready:null};d.sinkCapability.resolve(),d.ready=d.sinkCapability.promise,this.streamSinks[t]=d,new Promise((function(t){t(o(e.data,d))})).then((function(){s.postMessage({sourceName:n,targetName:i,stream:p,streamId:t,success:!0})}),(function(e){s.postMessage({sourceName:n,targetName:i,stream:p,streamId:t,reason:f(e)})}))}_processStreamMessage(e){const t=e.streamId,n=this.sourceName,i=e.sourceName,s=this.comObj,g=this.streamControllers[t],m=this.streamSinks[t];switch(e.stream){case p:e.success?g.startCall.resolve():g.startCall.reject(f(e.reason));break;case h:e.success?g.pullCall.resolve():g.pullCall.reject(f(e.reason));break;case d:if(!m){s.postMessage({sourceName:n,targetName:i,stream:h,streamId:t,success:!0});break}m.desiredSize<=0&&e.desiredSize>0&&m.sinkCapability.resolve(),m.desiredSize=e.desiredSize,new Promise((function(e){e(m.onPull&&m.onPull())})).then((function(){s.postMessage({sourceName:n,targetName:i,stream:h,streamId:t,success:!0})}),(function(e){s.postMessage({sourceName:n,targetName:i,stream:h,streamId:t,reason:f(e)})}));break;case c:if((0,r.assert)(g,"enqueue should have stream controller"),g.isClosed)break;g.controller.enqueue(e.chunk);break;case l:if((0,r.assert)(g,"close should have stream controller"),g.isClosed)break;g.isClosed=!0,g.controller.close(),this._deleteStreamController(g,t);break;case u:(0,r.assert)(g,"error should have stream controller"),g.controller.error(f(e.reason)),this._deleteStreamController(g,t);break;case o:e.success?g.cancelCall.resolve():g.cancelCall.reject(f(e.reason)),this._deleteStreamController(g,t);break;case a:if(!m)break;new Promise((function(t){t(m.onCancel&&m.onCancel(f(e.reason)))})).then((function(){s.postMessage({sourceName:n,targetName:i,stream:o,streamId:t,success:!0})}),(function(e){s.postMessage({sourceName:n,targetName:i,stream:o,streamId:t,reason:f(e)})})),m.sinkCapability.reject(f(e.reason)),m.isCancelled=!0,delete this.streamSinks[t];break;default:throw new Error("Unexpected stream case")}}async _deleteStreamController(e,t){await Promise.allSettled([e.startCall&&e.startCall.promise,e.pullCall&&e.pullCall.promise,e.cancelCall&&e.cancelCall.promise]),delete this.streamControllers[t]}destroy(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Metadata=void 0;var r=n(1);t.Metadata=class{#J;#Z;constructor({parsedData:e,rawData:t}){this.#J=e,this.#Z=t}getRaw(){return this.#Z}get(e){return this.#J.get(e)??null}getAll(){return(0,r.objectFromMap)(this.#J)}has(e){return this.#J.has(e)}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OptionalContentConfig=void 0;var r=n(1);const i=Symbol("INTERNAL");class s{#ee=!0;constructor(e,t){this.name=e,this.intent=t}get visible(){return this.#ee}_setVisible(e,t){e!==i&&(0,r.unreachable)("Internal method `_setVisible` called."),this.#ee=t}}t.OptionalContentConfig=class{#te=!0;#ne=new Map;#re=null;#ie=null;constructor(e){if(this.name=null,this.creator=null,null!==e){this.name=e.name,this.creator=e.creator,this.#ie=e.order;for(const t of e.groups)this.#ne.set(t.id,new s(t.name,t.intent));if("OFF"===e.baseState)for(const e of this.#ne.values())e._setVisible(i,!1);for(const t of e.on)this.#ne.get(t)._setVisible(i,!0);for(const t of e.off)this.#ne.get(t)._setVisible(i,!1);this.#re=new Map;for(const[e,t]of this.#ne)this.#re.set(e,t.visible)}}#se(e){const t=e.length;if(t<2)return!0;const n=e[0];for(let i=1;i<t;i++){const t=e[i];let s;if(Array.isArray(t))s=this.#se(t);else{if(!this.#ne.has(t))return(0,r.warn)(`Optional content group not found: ${t}`),!0;s=this.#ne.get(t).visible}switch(n){case"And":if(!s)return!1;break;case"Or":if(s)return!0;break;case"Not":return!s;default:return!0}}return"And"===n}isVisible(e){if(0===this.#ne.size)return!0;if(!e)return(0,r.warn)("Optional content group not defined."),!0;if("OCG"===e.type)return this.#ne.has(e.id)?this.#ne.get(e.id).visible:((0,r.warn)(`Optional content group not found: ${e.id}`),!0);if("OCMD"===e.type){if(e.expression)return this.#se(e.expression);if(!e.policy||"AnyOn"===e.policy){for(const t of e.ids){if(!this.#ne.has(t))return(0,r.warn)(`Optional content group not found: ${t}`),!0;if(this.#ne.get(t).visible)return!0}return!1}if("AllOn"===e.policy){for(const t of e.ids){if(!this.#ne.has(t))return(0,r.warn)(`Optional content group not found: ${t}`),!0;if(!this.#ne.get(t).visible)return!1}return!0}if("AnyOff"===e.policy){for(const t of e.ids){if(!this.#ne.has(t))return(0,r.warn)(`Optional content group not found: ${t}`),!0;if(!this.#ne.get(t).visible)return!0}return!1}if("AllOff"===e.policy){for(const t of e.ids){if(!this.#ne.has(t))return(0,r.warn)(`Optional content group not found: ${t}`),!0;if(this.#ne.get(t).visible)return!1}return!0}return(0,r.warn)(`Unknown optional content policy ${e.policy}.`),!0}return(0,r.warn)(`Unknown group type ${e.type}.`),!0}setVisibility(e,t=!0){this.#ne.has(e)?(this.#ne.get(e)._setVisible(i,!!t),this.#te=null):(0,r.warn)(`Optional content group not found: ${e}`)}get hasInitialVisibility(){if(null!==this.#te)return this.#te;for(const[e,t]of this.#ne){const n=this.#re.get(e);if(t.visible!==n)return this.#te=!1}return this.#te=!0}getOrder(){return this.#ne.size?this.#ie?this.#ie.slice():[...this.#ne.keys()]:null}getGroups(){return this.#ne.size>0?(0,r.objectFromMap)(this.#ne):null}getGroup(e){return this.#ne.get(e)||null}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFDataTransportStream=void 0;var r=n(1),i=n(8);t.PDFDataTransportStream=class{constructor(e,t){(0,r.assert)(t,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.'),this._queuedChunks=[],this._progressiveDone=e.progressiveDone||!1,this._contentDispositionFilename=e.contentDispositionFilename||null;const n=e.initialData;if(n?.length>0){const e=new Uint8Array(n).buffer;this._queuedChunks.push(e)}this._pdfDataRangeTransport=t,this._isStreamingSupported=!e.disableStream,this._isRangeSupported=!e.disableRange,this._contentLength=e.length,this._fullRequestReader=null,this._rangeReaders=[],this._pdfDataRangeTransport.addRangeListener(((e,t)=>{this._onReceiveData({begin:e,chunk:t})})),this._pdfDataRangeTransport.addProgressListener(((e,t)=>{this._onProgress({loaded:e,total:t})})),this._pdfDataRangeTransport.addProgressiveReadListener((e=>{this._onReceiveData({chunk:e})})),this._pdfDataRangeTransport.addProgressiveDoneListener((()=>{this._onProgressiveDone()})),this._pdfDataRangeTransport.transportReady()}_onReceiveData(e){const t=new Uint8Array(e.chunk).buffer;if(void 0===e.begin)this._fullRequestReader?this._fullRequestReader._enqueue(t):this._queuedChunks.push(t);else{const n=this._rangeReaders.some((function(n){return n._begin===e.begin&&(n._enqueue(t),!0)}));(0,r.assert)(n,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}_onProgress(e){if(void 0===e.total){const t=this._rangeReaders[0];t?.onProgress&&t.onProgress({loaded:e.loaded})}else{const t=this._fullRequestReader;t?.onProgress&&t.onProgress({loaded:e.loaded,total:e.total})}}_onProgressiveDone(){this._fullRequestReader&&this._fullRequestReader.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(e){const t=this._rangeReaders.indexOf(e);t>=0&&this._rangeReaders.splice(t,1)}getFullReader(){(0,r.assert)(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const e=this._queuedChunks;return this._queuedChunks=null,new s(this,e,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const n=new a(this,e,t);return this._pdfDataRangeTransport.requestDataRange(e,t),this._rangeReaders.push(n),n}cancelAllRequests(e){this._fullRequestReader&&this._fullRequestReader.cancel(e);for(const t of this._rangeReaders.slice(0))t.cancel(e);this._pdfDataRangeTransport.abort()}};class s{constructor(e,t,n=!1,r=null){this._stream=e,this._done=n||!1,this._filename=(0,i.isPdfFile)(r)?r:null,this._queuedChunks=t||[],this._loaded=0;for(const e of this._queuedChunks)this._loaded+=e.byteLength;this._requests=[],this._headersReady=Promise.resolve(),e._fullRequestReader=this,this.onProgress=null}_enqueue(e){this._done||(this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunks.push(e),this._loaded+=e.byteLength)}get headersReady(){return this._headersReady}get filename(){return this._filename}get isRangeSupported(){return this._stream._isRangeSupported}get isStreamingSupported(){return this._stream._isStreamingSupported}get contentLength(){return this._stream._contentLength}async read(){if(this._queuedChunks.length>0)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const e=(0,r.createPromiseCapability)();return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class a{constructor(e,t,n){this._stream=e,this._begin=t,this._end=n,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(e){if(!this._done){if(0===this._requests.length)this._queuedChunk=e;else{this._requests.shift().resolve({value:e,done:!1});for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0,this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}async read(){if(this._queuedChunk){const e=this._queuedChunk;return this._queuedChunk=null,{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};const e=(0,r.createPromiseCapability)();return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.XfaText=void 0;class n{static textContent(e){const t=[],r={items:t,styles:Object.create(null)};return function e(r){if(!r)return;let i=null;const s=r.name;if("#text"===s)i=r.value;else{if(!n.shouldBuildText(s))return;r?.attributes?.textContent?i=r.attributes.textContent:r.value&&(i=r.value)}if(null!==i&&t.push({str:i}),r.children)for(const t of r.children)e(t)}(e),r}static shouldBuildText(e){return!("textarea"===e||"input"===e||"option"===e||"select"===e)}}t.XfaText=n},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.NodeStandardFontDataFactory=t.NodeCanvasFactory=t.NodeCMapReaderFactory=void 0;var r=n(9);const i=function(e){return new Promise(((t,n)=>{require$$5.readFile(e,((e,r)=>{!e&&r?t(new Uint8Array(r)):n(new Error(e))}))}))};class s extends r.BaseCanvasFactory{_createCanvas(e,t){return require$$5.createCanvas(e,t)}}t.NodeCanvasFactory=s;class a extends r.BaseCMapReaderFactory{_fetchData(e,t){return i(e).then((e=>({cMapData:e,compressionType:t})))}}t.NodeCMapReaderFactory=a;class o extends r.BaseStandardFontDataFactory{_fetchData(e){return i(e)}}t.NodeStandardFontDataFactory=o},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AnnotationEditorLayer=void 0;var r=n(7),i=n(1),s=n(23),a=n(24);class o{#ae;#oe=!1;#le=this.pointerup.bind(this);#ce=this.pointerdown.bind(this);#ue=new Map;#de=!1;#he=!1;#pe;static _initialized=!1;constructor(e){o._initialized||(o._initialized=!0,s.FreeTextEditor.initialize(e.l10n),a.InkEditor.initialize(e.l10n),e.uiManager.registerEditorTypes([s.FreeTextEditor,a.InkEditor])),this.#pe=e.uiManager,this.annotationStorage=e.annotationStorage,this.pageIndex=e.pageIndex,this.div=e.div,this.#ae=e.accessibilityManager,this.#pe.addLayer(this)}updateToolbar(e){this.#pe.updateToolbar(e)}updateMode(e=this.#pe.getMode()){this.#fe(),e===i.AnnotationEditorType.INK?(this.addInkEditorIfNeeded(!1),this.disableClick()):this.enableClick(),this.#pe.unselectAll()}addInkEditorIfNeeded(e){if(e||this.#pe.getMode()===i.AnnotationEditorType.INK){if(!e)for(const e of this.#ue.values())if(e.isEmpty())return void e.setInBackground();this.#ge({offsetX:0,offsetY:0}).setInBackground()}}setEditingState(e){this.#pe.setEditingState(e)}addCommands(e){this.#pe.addCommands(e)}enable(){this.div.style.pointerEvents="auto";for(const e of this.#ue.values())e.enableEditing()}disable(){this.div.style.pointerEvents="none";for(const e of this.#ue.values())e.disableEditing()}setActiveEditor(e){this.#pe.getActive()!==e&&this.#pe.setActiveEditor(e)}enableClick(){this.div.addEventListener("pointerdown",this.#ce),this.div.addEventListener("pointerup",this.#le)}disableClick(){this.div.removeEventListener("pointerdown",this.#ce),this.div.removeEventListener("pointerup",this.#le)}attach(e){this.#ue.set(e.id,e)}detach(e){this.#ue.delete(e.id),this.#ae?.removePointerInTextLayer(e.contentDiv)}remove(e){this.#pe.removeEditor(e),this.detach(e),this.annotationStorage.remove(e.id),e.div.style.display="none",setTimeout((()=>{e.div.style.display="",e.div.remove(),e.isAttachedToDOM=!1,document.activeElement===document.body&&this.#pe.focusMainContainer()}),0),this.#he||this.addInkEditorIfNeeded(!1)}#me(e){e.parent!==this&&(this.attach(e),e.pageIndex=this.pageIndex,e.parent?.detach(e),e.parent=this,e.div&&e.isAttachedToDOM&&(e.div.remove(),this.div.append(e.div)))}add(e){if(this.#me(e),this.#pe.addEditor(e),this.attach(e),!e.isAttachedToDOM){const t=e.render();this.div.append(t),e.isAttachedToDOM=!0}this.moveEditorInDOM(e),e.onceAdded(),this.addToAnnotationStorage(e)}moveEditorInDOM(e){this.#ae?.moveElementInDOM(this.div,e.div,e.contentDiv,!0)}addToAnnotationStorage(e){e.isEmpty()||this.annotationStorage.has(e.id)||this.annotationStorage.setValue(e.id,e)}addOrRebuild(e){e.needsToBeRebuilt()?e.rebuild():this.add(e)}addANewEditor(e){this.addCommands({cmd:()=>{this.addOrRebuild(e)},undo:()=>{e.remove()},mustExec:!0})}addUndoableEditor(e){this.addCommands({cmd:()=>{this.addOrRebuild(e)},undo:()=>{e.remove()},mustExec:!1})}getNextId(){return this.#pe.getId()}#ve(e){switch(this.#pe.getMode()){case i.AnnotationEditorType.FREETEXT:return new s.FreeTextEditor(e);case i.AnnotationEditorType.INK:return new a.InkEditor(e)}return null}deserialize(e){switch(e.annotationType){case i.AnnotationEditorType.FREETEXT:return s.FreeTextEditor.deserialize(e,this);case i.AnnotationEditorType.INK:return a.InkEditor.deserialize(e,this)}return null}#ge(e){const t=this.getNextId(),n=this.#ve({parent:this,id:t,x:e.offsetX,y:e.offsetY});return n&&this.add(n),n}setSelected(e){this.#pe.setSelected(e)}toggleSelected(e){this.#pe.toggleSelected(e)}isSelected(e){return this.#pe.isSelected(e)}unselect(e){this.#pe.unselect(e)}pointerup(e){const t=r.KeyboardManager.platform.isMac;0!==e.button||e.ctrlKey&&t||e.target===this.div&&this.#de&&(this.#de=!1,this.#oe?this.#ge(e):this.#oe=!0)}pointerdown(e){const t=r.KeyboardManager.platform.isMac;if(0!==e.button||e.ctrlKey&&t)return;if(e.target!==this.div)return;this.#de=!0;const n=this.#pe.getActive();this.#oe=!n||n.isEmpty()}drop(e){const t=e.dataTransfer.getData("text/plain"),n=this.#pe.getEditor(t);if(!n)return;e.preventDefault(),e.dataTransfer.dropEffect="move",this.#me(n);const r=this.div.getBoundingClientRect(),i=e.clientX-r.x,s=e.clientY-r.y;n.translate(i-n.startX,s-n.startY),this.moveEditorInDOM(n),n.div.focus()}dragover(e){e.preventDefault()}destroy(){this.#pe.getActive()?.parent===this&&this.#pe.setActiveEditor(null);for(const e of this.#ue.values())this.#ae?.removePointerInTextLayer(e.contentDiv),e.isAttachedToDOM=!1,e.div.remove(),e.parent=null;this.div=null,this.#ue.clear(),this.#pe.removeLayer(this)}#fe(){this.#he=!0;for(const e of this.#ue.values())e.isEmpty()&&e.remove();this.#he=!1}render(e){this.viewport=e.viewport,(0,r.bindEvents)(this,this.div,["dragover","drop"]),this.setDimensions();for(const e of this.#pe.getEditors(this.pageIndex))this.add(e);this.updateMode()}update(e){this.viewport=e.viewport,this.setDimensions(),this.updateMode()}get scaleFactor(){return this.viewport.scale}get pageDimensions(){const[e,t,n,r]=this.viewport.viewBox;return[n-e,r-t]}get viewportBaseDimensions(){const{width:e,height:t,rotation:n}=this.viewport;return n%180==0?[e,t]:[t,e]}setDimensions(){const{width:e,height:t,rotation:n}=this.viewport,r=n%180!=0,i=Math.floor(e)+"px",s=Math.floor(t)+"px";this.div.style.width=r?s:i,this.div.style.height=r?i:s,this.div.setAttribute("data-main-rotation",n)}}t.AnnotationEditorLayer=o},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FreeTextEditor=void 0;var r=n(1),i=n(7),s=n(6);class a extends s.AnnotationEditor{#ye=this.editorDivBlur.bind(this);#be=this.editorDivFocus.bind(this);#_e=this.editorDivKeydown.bind(this);#we;#Ee="";#Se=!1;#Ce;static _freeTextDefaultContent="";static _l10nPromise;static _internalPadding=0;static _defaultColor=null;static _defaultFontSize=10;static _keyboardManager=new i.KeyboardManager([[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],a.prototype.commitOrRemove]]);static _type="freetext";constructor(e){super({...e,name:"freeTextEditor"}),this.#we=e.color||a._defaultColor||s.AnnotationEditor._defaultLineColor,this.#Ce=e.fontSize||a._defaultFontSize}static initialize(e){this._l10nPromise=new Map(["free_text_default_content","editor_free_text_aria_label"].map((t=>[t,e.get(t)])));const t=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(t.getPropertyValue("--freetext-padding"))}static updateDefaultParams(e,t){switch(e){case r.AnnotationEditorParamsType.FREETEXT_SIZE:a._defaultFontSize=t;break;case r.AnnotationEditorParamsType.FREETEXT_COLOR:a._defaultColor=t}}updateParams(e,t){switch(e){case r.AnnotationEditorParamsType.FREETEXT_SIZE:this.#Ae(t);break;case r.AnnotationEditorParamsType.FREETEXT_COLOR:this.#Pe(t)}}static get defaultPropertiesToUpdate(){return[[r.AnnotationEditorParamsType.FREETEXT_SIZE,a._defaultFontSize],[r.AnnotationEditorParamsType.FREETEXT_COLOR,a._defaultColor||s.AnnotationEditor._defaultLineColor]]}get propertiesToUpdate(){return[[r.AnnotationEditorParamsType.FREETEXT_SIZE,this.#Ce],[r.AnnotationEditorParamsType.FREETEXT_COLOR,this.#we]]}#Ae(e){const t=e=>{this.editorDiv.style.fontSize=`calc(${e}px * var(--scale-factor))`,this.translate(0,-(e-this.#Ce)*this.parent.scaleFactor),this.#Ce=e,this.#xe()},n=this.#Ce;this.parent.addCommands({cmd:()=>{t(e)},undo:()=>{t(n)},mustExec:!0,type:r.AnnotationEditorParamsType.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}#Pe(e){const t=this.#we;this.parent.addCommands({cmd:()=>{this.#we=e,this.editorDiv.style.color=e},undo:()=>{this.#we=t,this.editorDiv.style.color=t},mustExec:!0,type:r.AnnotationEditorParamsType.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}getInitialTranslation(){return[-a._internalPadding*this.parent.scaleFactor,-(a._internalPadding+this.#Ce)*this.parent.scaleFactor]}rebuild(){super.rebuild(),null!==this.div&&(this.isAttachedToDOM||this.parent.add(this))}enableEditMode(){this.isInEditMode()||(this.parent.setEditingState(!1),this.parent.updateToolbar(r.AnnotationEditorType.FREETEXT),super.enableEditMode(),this.enableEditing(),this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this.div.draggable=!1,this.editorDiv.addEventListener("keydown",this.#_e),this.editorDiv.addEventListener("focus",this.#be),this.editorDiv.addEventListener("blur",this.#ye))}disableEditMode(){this.isInEditMode()&&(this.parent.setEditingState(!0),super.disableEditMode(),this.disableEditing(),this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.draggable=!0,this.editorDiv.removeEventListener("keydown",this.#_e),this.editorDiv.removeEventListener("focus",this.#be),this.editorDiv.removeEventListener("blur",this.#ye),this.div.focus(),this.isEditing=!1)}focusin(e){super.focusin(e),e.target!==this.editorDiv&&this.editorDiv.focus()}onceAdded(){this.width||(this.enableEditMode(),this.editorDiv.focus())}isEmpty(){return!this.editorDiv||""===this.editorDiv.innerText.trim()}remove(){this.isEditing=!1,this.parent.setEditingState(!0),super.remove()}#Te(){const e=this.editorDiv.getElementsByTagName("div");if(0===e.length)return this.editorDiv.innerText;const t=[];for(let n=0,r=e.length;n<r;n++){const r=e[n].firstChild;"#text"===r?.nodeName?t.push(r.data):t.push("")}return t.join("\n")}#xe(){const[e,t]=this.parent.viewportBaseDimensions,n=this.div.getBoundingClientRect();this.width=n.width/e,this.height=n.height/t}commit(){super.commit(),this.#Se||(this.#Se=!0,this.parent.addUndoableEditor(this)),this.disableEditMode(),this.#Ee=this.#Te().trimEnd(),this.#xe()}shouldGetKeyboardEvents(){return this.isInEditMode()}dblclick(e){this.enableEditMode(),this.editorDiv.focus()}keydown(e){e.target===this.div&&"Enter"===e.key&&(this.enableEditMode(),this.editorDiv.focus())}editorDivKeydown(e){a._keyboardManager.exec(this,e)}editorDivFocus(e){this.isEditing=!0}editorDivBlur(e){this.isEditing=!1}disableEditing(){this.editorDiv.setAttribute("role","comment"),this.editorDiv.removeAttribute("aria-multiline")}enableEditing(){this.editorDiv.setAttribute("role","textbox"),this.editorDiv.setAttribute("aria-multiline",!0)}render(){if(this.div)return this.div;let e,t;this.width&&(e=this.x,t=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",`${this.id}-editor`),this.enableEditing(),a._l10nPromise.get("editor_free_text_aria_label").then((e=>this.editorDiv?.setAttribute("aria-label",e))),a._l10nPromise.get("free_text_default_content").then((e=>this.editorDiv?.setAttribute("default-content",e))),this.editorDiv.contentEditable=!0;const{style:n}=this.editorDiv;if(n.fontSize=`calc(${this.#Ce}px * var(--scale-factor))`,n.color=this.#we,this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),(0,i.bindEvents)(this,this.div,["dblclick","keydown"]),this.width){const[n,r]=this.parent.viewportBaseDimensions;this.setAt(e*n,t*r,this.width*n,this.height*r);for(const e of this.#Ee.split("\n")){const t=document.createElement("div");t.append(e?document.createTextNode(e):document.createElement("br")),this.editorDiv.append(t)}this.div.draggable=!0,this.editorDiv.contentEditable=!1}else this.div.draggable=!1,this.editorDiv.contentEditable=!0;return this.div}get contentDiv(){return this.editorDiv}static deserialize(e,t){const n=super.deserialize(e,t);return n.#Ce=e.fontSize,n.#we=r.Util.makeHexColor(...e.color),n.#Ee=e.value,n}serialize(){if(this.isEmpty())return null;const e=a._internalPadding*this.parent.scaleFactor,t=this.getRect(e,e),n=s.AnnotationEditor._colorManager.convert(getComputedStyle(this.editorDiv).color);return{annotationType:r.AnnotationEditorType.FREETEXT,color:n,fontSize:this.#Ce,value:this.#Ee,pageIndex:this.parent.pageIndex,rect:t,rotation:this.rotation}}}t.FreeTextEditor=a},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.InkEditor=void 0,Object.defineProperty(t,"fitCurve",{enumerable:!0,get:function(){return s.fitCurve}});var r=n(1),i=n(6),s=n(25),a=n(7);const o=16;class l extends i.AnnotationEditor{#Re=0;#Me=0;#Le=0;#Ie=this.canvasPointermove.bind(this);#ke=this.canvasPointerleave.bind(this);#Oe=this.canvasPointerup.bind(this);#Fe=this.canvasPointerdown.bind(this);#De=!1;#Ne=!1;#Ue=null;#je=null;#$e=0;#He=0;#Be=null;static _defaultColor=null;static _defaultOpacity=1;static _defaultThickness=1;static _l10nPromise;static _type="ink";constructor(e){super({...e,name:"inkEditor"}),this.color=e.color||null,this.thickness=e.thickness||null,this.opacity=e.opacity||null,this.paths=[],this.bezierPath2D=[],this.currentPath=[],this.scaleFactor=1,this.translationX=this.translationY=0,this.x=0,this.y=0}static initialize(e){this._l10nPromise=new Map(["editor_ink_canvas_aria_label","editor_ink_aria_label"].map((t=>[t,e.get(t)])))}static updateDefaultParams(e,t){switch(e){case r.AnnotationEditorParamsType.INK_THICKNESS:l._defaultThickness=t;break;case r.AnnotationEditorParamsType.INK_COLOR:l._defaultColor=t;break;case r.AnnotationEditorParamsType.INK_OPACITY:l._defaultOpacity=t/100}}updateParams(e,t){switch(e){case r.AnnotationEditorParamsType.INK_THICKNESS:this.#Ve(t);break;case r.AnnotationEditorParamsType.INK_COLOR:this.#Pe(t);break;case r.AnnotationEditorParamsType.INK_OPACITY:this.#We(t)}}static get defaultPropertiesToUpdate(){return[[r.AnnotationEditorParamsType.INK_THICKNESS,l._defaultThickness],[r.AnnotationEditorParamsType.INK_COLOR,l._defaultColor||i.AnnotationEditor._defaultLineColor],[r.AnnotationEditorParamsType.INK_OPACITY,Math.round(100*l._defaultOpacity)]]}get propertiesToUpdate(){return[[r.AnnotationEditorParamsType.INK_THICKNESS,this.thickness||l._defaultThickness],[r.AnnotationEditorParamsType.INK_COLOR,this.color||l._defaultColor||i.AnnotationEditor._defaultLineColor],[r.AnnotationEditorParamsType.INK_OPACITY,Math.round(100*(this.opacity??l._defaultOpacity))]]}#Ve(e){const t=this.thickness;this.parent.addCommands({cmd:()=>{this.thickness=e,this.#qe()},undo:()=>{this.thickness=t,this.#qe()},mustExec:!0,type:r.AnnotationEditorParamsType.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0})}#Pe(e){const t=this.color;this.parent.addCommands({cmd:()=>{this.color=e,this.#ze()},undo:()=>{this.color=t,this.#ze()},mustExec:!0,type:r.AnnotationEditorParamsType.INK_COLOR,overwriteIfSameType:!0,keepUndo:!0})}#We(e){e/=100;const t=this.opacity;this.parent.addCommands({cmd:()=>{this.opacity=e,this.#ze()},undo:()=>{this.opacity=t,this.#ze()},mustExec:!0,type:r.AnnotationEditorParamsType.INK_OPACITY,overwriteIfSameType:!0,keepUndo:!0})}rebuild(){super.rebuild(),null!==this.div&&(this.canvas||(this.#Ge(),this.#Qe()),this.isAttachedToDOM||(this.parent.add(this),this.#Xe()),this.#qe())}remove(){null!==this.canvas&&(this.isEmpty()||this.commit(),this.canvas.width=this.canvas.height=0,this.canvas.remove(),this.canvas=null,this.#je.disconnect(),this.#je=null,super.remove())}enableEditMode(){this.#De||null===this.canvas||(super.enableEditMode(),this.div.draggable=!1,this.canvas.addEventListener("pointerdown",this.#Fe),this.canvas.addEventListener("pointerup",this.#Oe))}disableEditMode(){this.isInEditMode()&&null!==this.canvas&&(super.disableEditMode(),this.div.draggable=!this.isEmpty(),this.div.classList.remove("editing"),this.canvas.removeEventListener("pointerdown",this.#Fe),this.canvas.removeEventListener("pointerup",this.#Oe))}onceAdded(){this.div.draggable=!this.isEmpty()}isEmpty(){return 0===this.paths.length||1===this.paths.length&&0===this.paths[0].length}#Ke(){const{width:e,height:t,rotation:n}=this.parent.viewport;switch(n){case 90:return[0,e,e,t];case 180:return[e,t,e,t];case 270:return[t,0,e,t];default:return[0,0,e,t]}}#Ye(){this.ctx.lineWidth=this.thickness*this.parent.scaleFactor/this.scaleFactor,this.ctx.lineCap="round",this.ctx.lineJoin="round",this.ctx.miterLimit=10,this.ctx.strokeStyle=`${this.color}${(0,a.opacityToHex)(this.opacity)}`}#Je(e,t){this.isEditing=!0,this.#Ne||(this.#Ne=!0,this.#Xe(),this.thickness||=l._defaultThickness,this.color||=l._defaultColor||i.AnnotationEditor._defaultLineColor,this.opacity??=l._defaultOpacity),this.currentPath.push([e,t]),this.#Ue=null,this.#Ye(),this.ctx.beginPath(),this.ctx.moveTo(e,t),this.#Be=()=>{this.#Be&&(this.#Ue&&(this.isEmpty()?(this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height)):this.#ze(),this.ctx.lineTo(...this.#Ue),this.#Ue=null,this.ctx.stroke()),window.requestAnimationFrame(this.#Be))},window.requestAnimationFrame(this.#Be)}#Ze(e,t){const[n,r]=this.currentPath.at(-1);e===n&&t===r||(this.currentPath.push([e,t]),this.#Ue=[e,t])}#et(e,t){this.ctx.closePath(),this.#Be=null,e=Math.min(Math.max(e,0),this.canvas.width),t=Math.min(Math.max(t,0),this.canvas.height);const[n,r]=this.currentPath.at(-1);let i;if(e===n&&t===r||this.currentPath.push([e,t]),1!==this.currentPath.length)i=(0,s.fitCurve)(this.currentPath,30,null);else{const n=[e,t];i=[[n,n.slice(),n.slice(),n]]}const a=l.#tt(i);this.currentPath.length=0,this.parent.addCommands({cmd:()=>{this.paths.push(i),this.bezierPath2D.push(a),this.rebuild()},undo:()=>{this.paths.pop(),this.bezierPath2D.pop(),0===this.paths.length?this.remove():(this.canvas||(this.#Ge(),this.#Qe()),this.#qe())},mustExec:!0})}#ze(){if(this.isEmpty())return void this.#nt();this.#Ye();const{canvas:e,ctx:t}=this;t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,e.width,e.height),this.#nt();for(const e of this.bezierPath2D)t.stroke(e)}commit(){this.#De||(super.commit(),this.isEditing=!1,this.disableEditMode(),this.setInForeground(),this.#De=!0,this.div.classList.add("disabled"),this.#qe(!0),this.parent.addInkEditorIfNeeded(!0),this.parent.moveEditorInDOM(this),this.div.focus())}focusin(e){super.focusin(e),this.enableEditMode()}canvasPointerdown(e){0===e.button&&this.isInEditMode()&&!this.#De&&(this.setInForeground(),"mouse"!==e.type&&this.div.focus(),e.stopPropagation(),this.canvas.addEventListener("pointerleave",this.#ke),this.canvas.addEventListener("pointermove",this.#Ie),this.#Je(e.offsetX,e.offsetY))}canvasPointermove(e){e.stopPropagation(),this.#Ze(e.offsetX,e.offsetY)}canvasPointerup(e){0===e.button&&this.isInEditMode()&&0!==this.currentPath.length&&(e.stopPropagation(),this.#rt(e),this.setInBackground())}canvasPointerleave(e){this.#rt(e),this.setInBackground()}#rt(e){this.#et(e.offsetX,e.offsetY),this.canvas.removeEventListener("pointerleave",this.#ke),this.canvas.removeEventListener("pointermove",this.#Ie),this.parent.addToAnnotationStorage(this)}#Ge(){this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=0,this.canvas.className="inkEditorCanvas",l._l10nPromise.get("editor_ink_canvas_aria_label").then((e=>this.canvas?.setAttribute("aria-label",e))),this.div.append(this.canvas),this.ctx=this.canvas.getContext("2d")}#Qe(){this.#je=new ResizeObserver((e=>{const t=e[0].contentRect;t.width&&t.height&&this.setDimensions(t.width,t.height)})),this.#je.observe(this.div)}render(){if(this.div)return this.div;let e,t;this.width&&(e=this.x,t=this.y),super.render(),l._l10nPromise.get("editor_ink_aria_label").then((e=>this.div?.setAttribute("aria-label",e)));const[n,r,i,s]=this.#Ke();if(this.setAt(n,r,0,0),this.setDims(i,s),this.#Ge(),this.width){const[n,r]=this.parent.viewportBaseDimensions;this.setAt(e*n,t*r,this.width*n,this.height*r),this.#Ne=!0,this.#Xe(),this.setDims(this.width*n,this.height*r),this.#ze(),this.#it(),this.div.classList.add("disabled")}else this.div.classList.add("editing"),this.enableEditMode();return this.#Qe(),this.div}#Xe(){if(!this.#Ne)return;const[e,t]=this.parent.viewportBaseDimensions;this.canvas.width=Math.ceil(this.width*e),this.canvas.height=Math.ceil(this.height*t),this.#nt()}setDimensions(e,t){const n=Math.round(e),r=Math.round(t);if(this.#$e===n&&this.#He===r)return;this.#$e=n,this.#He=r,this.canvas.style.visibility="hidden",this.#Re&&Math.abs(this.#Re-e/t)>.01&&(t=Math.ceil(e/this.#Re),this.setDims(e,t));const[i,s]=this.parent.viewportBaseDimensions;this.width=e/i,this.height=t/s,this.#De&&this.#st(e,t),this.#Xe(),this.#ze(),this.canvas.style.visibility="visible"}#st(e,t){const n=this.#at(),r=(e-n)/this.#Le,i=(t-n)/this.#Me;this.scaleFactor=Math.min(r,i)}#nt(){const e=this.#at()/2;this.ctx.setTransform(this.scaleFactor,0,0,this.scaleFactor,this.translationX*this.scaleFactor+e,this.translationY*this.scaleFactor+e)}static#tt(e){const t=new Path2D;for(let n=0,r=e.length;n<r;n++){const[r,i,s,a]=e[n];0===n&&t.moveTo(...r),t.bezierCurveTo(i[0],i[1],s[0],s[1],a[0],a[1])}return t}#ot(e,t,n,r){const i=[],s=this.thickness/2;let a,o;for(const l of this.paths){a=[],o=[];for(let i=0,c=l.length;i<c;i++){const[c,u,d,h]=l[i],p=e*(c[0]+t)+s,f=r-e*(c[1]+n)-s,g=e*(u[0]+t)+s,m=r-e*(u[1]+n)-s,v=e*(d[0]+t)+s,y=r-e*(d[1]+n)-s,b=e*(h[0]+t)+s,_=r-e*(h[1]+n)-s;0===i&&(a.push(p,f),o.push(p,f)),a.push(g,m,v,y,b,_),this.#lt(p,f,g,m,v,y,b,_,4,o)}i.push({bezier:a,points:o})}return i}#lt(e,t,n,r,i,s,a,o,l,c){if(this.#ct(e,t,n,r,i,s,a,o))c.push(a,o);else{for(let u=1;u<l-1;u++){const d=u/l,h=1-d;let p=d*e+h*n,f=d*t+h*r,g=d*n+h*i,m=d*r+h*s;p=d*p+h*g,f=d*f+h*m,g=d*g+h*(d*i+h*a),m=d*m+h*(d*s+h*o),p=d*p+h*g,f=d*f+h*m,c.push(p,f)}c.push(a,o)}}#ct(e,t,n,r,i,s,a,o){const l=(3*n-2*e-a)**2,c=(3*r-2*t-o)**2,u=(3*i-e-2*a)**2,d=(3*s-t-2*o)**2;return Math.max(l,u)+Math.max(c,d)<=10}#ut(){let e=1/0,t=-1/0,n=1/0,i=-1/0;for(const s of this.paths)for(const[a,o,l,c]of s){const s=r.Util.bezierBoundingBox(...a,...o,...l,...c);e=Math.min(e,s[0]),n=Math.min(n,s[1]),t=Math.max(t,s[2]),i=Math.max(i,s[3])}return[e,n,t,i]}#at(){return this.#De?Math.ceil(this.thickness*this.parent.scaleFactor):0}#qe(e=!1){if(this.isEmpty())return;if(!this.#De)return void this.#ze();const t=this.#ut(),n=this.#at();this.#Le=Math.max(o,t[2]-t[0]),this.#Me=Math.max(o,t[3]-t[1]);const r=Math.ceil(n+this.#Le*this.scaleFactor),i=Math.ceil(n+this.#Me*this.scaleFactor),[s,a]=this.parent.viewportBaseDimensions;this.width=r/s,this.height=i/a,this.#Re=r/i,this.#it();const l=this.translationX,c=this.translationY;this.translationX=-t[0],this.translationY=-t[1],this.#Xe(),this.#ze(),this.#$e=r,this.#He=i,this.setDims(r,i);const u=e?n/this.scaleFactor/2:0;this.translate(l-this.translationX-u,c-this.translationY-u)}#it(){const{style:e}=this.div;this.#Re>=1?(e.minHeight="16px",e.minWidth=`${Math.round(this.#Re*o)}px`):(e.minWidth="16px",e.minHeight=`${Math.round(o/this.#Re)}px`)}static deserialize(e,t){const n=super.deserialize(e,t);n.thickness=e.thickness,n.color=r.Util.makeHexColor(...e.color),n.opacity=e.opacity;const[i,s]=t.pageDimensions,a=n.width*i,l=n.height*s,c=t.scaleFactor,u=e.thickness/2;n.#Re=a/l,n.#De=!0,n.#$e=Math.round(a),n.#He=Math.round(l);for(const{bezier:t}of e.paths){const e=[];n.paths.push(e);let r=c*(t[0]-u),i=c*(l-t[1]-u);for(let n=2,s=t.length;n<s;n+=6){const s=c*(t[n]-u),a=c*(l-t[n+1]-u),o=c*(t[n+2]-u),d=c*(l-t[n+3]-u),h=c*(t[n+4]-u),p=c*(l-t[n+5]-u);e.push([[r,i],[s,a],[o,d],[h,p]]),r=h,i=p}const s=this.#tt(e);n.bezierPath2D.push(s)}const d=n.#ut();return n.#Le=Math.max(o,d[2]-d[0]),n.#Me=Math.max(o,d[3]-d[1]),n.#st(a,l),n}serialize(){if(this.isEmpty())return null;const e=this.getRect(0,0),t=this.rotation%180==0?e[3]-e[1]:e[2]-e[0],n=i.AnnotationEditor._colorManager.convert(this.ctx.strokeStyle);return{annotationType:r.AnnotationEditorType.INK,color:n,thickness:this.thickness,opacity:this.opacity,paths:this.#ot(this.scaleFactor/this.parent.scaleFactor,this.translationX,this.translationY,t),pageIndex:this.parent.pageIndex,rect:e,rotation:this.rotation}}}t.InkEditor=l},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.fitCurve=void 0;const r=n(26);t.fitCurve=r},e=>{function t(e,i,s,a,o){var c,u,d,h,p,f,g,m,v,y,b,_,w;if(2===e.length)return _=l.vectorLen(l.subtract(e[0],e[1]))/3,[c=[e[0],l.addArrays(e[0],l.mulItems(i,_)),l.addArrays(e[1],l.mulItems(s,_)),e[1]]];if(u=function(e){var t,n,r,i=[];return e.forEach(((e,s)=>{t=s?n+l.vectorLen(l.subtract(e,r)):0,i.push(t),n=t,r=e})),i=i.map((e=>e/n))}(e),[c,h,f]=n(e,u,u,i,s,o),0===h||h<a)return[c];if(h<a*a)for(d=u,p=h,g=f,w=0;w<20;w++){if(d=r(c,e,d),[c,h,f]=n(e,u,d,i,s,o),h<a)return[c];if(f===g){let e=h/p;if(e>.9999&&e<1.0001)break}p=h,g=f}return b=[],(m=l.subtract(e[f-1],e[f+1])).every((e=>0===e))&&(m=l.subtract(e[f-1],e[f]),[m[0],m[1]]=[-m[1],m[0]]),v=l.normalize(m),y=l.mulItems(v,-1),b=(b=b.concat(t(e.slice(0,f+1),i,v,a,o))).concat(t(e.slice(f),y,s,a,o))}function n(e,t,n,r,i,o){var u,d,h;return u=function(e,t,n,r){var i,s,a,o,u,d,h,p,f,g,m,v,y,b,_,w,E,S=e[0],C=e[e.length-1];for(i=[S,null,null,C],s=l.zeros_Xx2x2(t.length),y=0,b=t.length;y<b;y++)E=1-(w=t[y]),(a=s[y])[0]=l.mulItems(n,3*w*(E*E)),a[1]=l.mulItems(r,3*E*(w*w));for(o=[[0,0],[0,0]],u=[0,0],y=0,b=e.length;y<b;y++)w=t[y],a=s[y],o[0][0]+=l.dot(a[0],a[0]),o[0][1]+=l.dot(a[0],a[1]),o[1][0]+=l.dot(a[0],a[1]),o[1][1]+=l.dot(a[1],a[1]),_=l.subtract(e[y],c.q([S,S,C,C],w)),u[0]+=l.dot(a[0],_),u[1]+=l.dot(a[1],_);return d=o[0][0]*o[1][1]-o[1][0]*o[0][1],h=o[0][0]*u[1]-o[1][0]*u[0],p=u[0]*o[1][1]-u[1]*o[0][1],f=0===d?0:p/d,g=0===d?0:h/d,v=l.vectorLen(l.subtract(S,C)),f<(m=1e-6*v)||g<m?(i[1]=l.addArrays(S,l.mulItems(n,v/3)),i[2]=l.addArrays(C,l.mulItems(r,v/3))):(i[1]=l.addArrays(S,l.mulItems(n,f)),i[2]=l.addArrays(C,l.mulItems(r,g))),i}(e,n,r,i),[d,h]=function(e,t,n){var r,i,o,u,d,h,p,f;i=0,o=Math.floor(e.length/2);const g=s(t,10);for(d=0,h=e.length;d<h;d++)p=e[d],f=a(0,n[d],g,10),(r=(u=l.subtract(c.q(t,f),p))[0]*u[0]+u[1]*u[1])>i&&(i=r,o=d);return[i,o]}(e,u,t),o&&o({bez:u,points:e,params:t,maxErr:d,maxPoint:h}),[u,d,h]}function r(e,t,n){return n.map(((n,r)=>i(e,t[r],n)))}function i(e,t,n){var r=l.subtract(c.q(e,n),t),i=c.qprime(e,n),s=l.mulMatrix(r,i),a=l.sum(l.squareItems(i))+2*l.mulMatrix(r,c.qprimeprime(e,n));return 0===a?n:n-s/a}var s=function(e,t){for(var n,r=[0],i=e[0],s=0,a=1;a<=t;a++)n=c.q(e,a/t),s+=l.vectorLen(l.subtract(n,i)),r.push(s),i=n;return r=r.map((e=>e/s))};function a(e,t,n,r){if(t<0)return 0;if(t>1)return 1;for(var i,s,a,o,l=1;l<=r;l++)if(t<=n[l]){a=(l-1)/r,s=l/r,o=(t-(i=n[l-1]))/(n[l]-i)*(s-a)+a;break}return o}function o(e,t){return l.normalize(l.subtract(e,t))}class l{static zeros_Xx2x2(e){for(var t=[];e--;)t.push([0,0]);return t}static mulItems(e,t){return e.map((e=>e*t))}static mulMatrix(e,t){return e.reduce(((e,n,r)=>e+n*t[r]),0)}static subtract(e,t){return e.map(((e,n)=>e-t[n]))}static addArrays(e,t){return e.map(((e,n)=>e+t[n]))}static addItems(e,t){return e.map((e=>e+t))}static sum(e){return e.reduce(((e,t)=>e+t))}static dot(e,t){return l.mulMatrix(e,t)}static vectorLen(e){return Math.hypot(...e)}static divItems(e,t){return e.map((e=>e/t))}static squareItems(e){return e.map((e=>e*e))}static normalize(e){return this.divItems(e,this.vectorLen(e))}}class c{static q(e,t){var n=1-t,r=l.mulItems(e[0],n*n*n),i=l.mulItems(e[1],3*n*n*t),s=l.mulItems(e[2],3*n*t*t),a=l.mulItems(e[3],t*t*t);return l.addArrays(l.addArrays(r,i),l.addArrays(s,a))}static qprime(e,t){var n=1-t,r=l.mulItems(l.subtract(e[1],e[0]),3*n*n),i=l.mulItems(l.subtract(e[2],e[1]),6*n*t),s=l.mulItems(l.subtract(e[3],e[2]),3*t*t);return l.addArrays(l.addArrays(r,i),s)}static qprimeprime(e,t){return l.addArrays(l.mulItems(l.addArrays(l.subtract(e[2],l.mulItems(e[1],2)),e[0]),6*(1-t)),l.mulItems(l.addArrays(l.subtract(e[3],l.mulItems(e[2],2)),e[1]),6*t))}}e.exports=function(e,n,r){if(!Array.isArray(e))throw new TypeError("First argument should be an array");if(e.forEach((t=>{if(!Array.isArray(t)||t.some((e=>"number"!=typeof e))||t.length!==e[0].length)throw Error("Each point should be an array of numbers. Each point should have the same amount of numbers.")})),e=e.filter(((t,n)=>0===n||!t.every(((t,r)=>t===e[n-1][r])))),e.length<2)return[];const i=e.length,s=o(e[1],e[0]),a=o(e[i-2],e[i-1]);return t(e,s,a,n,r)},e.exports.fitCubic=t,e.exports.createTangent=o},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AnnotationLayer=void 0;var r=n(1),i=n(8),s=n(5),a=n(28),o=n(29);const l=1e3,c=new WeakSet;function u(e){return{width:e[2]-e[0],height:e[3]-e[1]}}class d{static create(e){switch(e.data.annotationType){case r.AnnotationType.LINK:return new p(e);case r.AnnotationType.TEXT:return new f(e);case r.AnnotationType.WIDGET:switch(e.data.fieldType){case"Tx":return new m(e);case"Btn":return e.data.radioButton?new y(e):e.data.checkBox?new v(e):new b(e);case"Ch":return new _(e)}return new g(e);case r.AnnotationType.POPUP:return new w(e);case r.AnnotationType.FREETEXT:return new S(e);case r.AnnotationType.LINE:return new C(e);case r.AnnotationType.SQUARE:return new A(e);case r.AnnotationType.CIRCLE:return new P(e);case r.AnnotationType.POLYLINE:return new x(e);case r.AnnotationType.CARET:return new R(e);case r.AnnotationType.INK:return new M(e);case r.AnnotationType.POLYGON:return new T(e);case r.AnnotationType.HIGHLIGHT:return new L(e);case r.AnnotationType.UNDERLINE:return new I(e);case r.AnnotationType.SQUIGGLY:return new k(e);case r.AnnotationType.STRIKEOUT:return new O(e);case r.AnnotationType.STAMP:return new F(e);case r.AnnotationType.FILEATTACHMENT:return new D(e);default:return new h(e)}}}class h{constructor(e,{isRenderable:t=!1,ignoreBorder:n=!1,createQuadrilaterals:r=!1}={}){this.isRenderable=t,this.data=e.data,this.layer=e.layer,this.page=e.page,this.viewport=e.viewport,this.linkService=e.linkService,this.downloadManager=e.downloadManager,this.imageResourcesPath=e.imageResourcesPath,this.renderForms=e.renderForms,this.svgFactory=e.svgFactory,this.annotationStorage=e.annotationStorage,this.enableScripting=e.enableScripting,this.hasJSActions=e.hasJSActions,this._fieldObjects=e.fieldObjects,this._mouseState=e.mouseState,t&&(this.container=this._createContainer(n)),r&&(this.quadrilaterals=this._createQuadrilaterals(n))}_createContainer(e=!1){const t=this.data,n=this.page,i=this.viewport,s=document.createElement("section"),{width:a,height:o}=u(t.rect),[l,c,d,h]=i.viewBox,p=d-l,f=h-c;s.setAttribute("data-annotation-id",t.id);const g=r.Util.normalizeRect([t.rect[0],n.view[3]-t.rect[1]+n.view[1],t.rect[2],n.view[3]-t.rect[3]+n.view[1]]);if(!e&&t.borderStyle.width>0){s.style.borderWidth=`${t.borderStyle.width}px`;const e=t.borderStyle.horizontalCornerRadius,n=t.borderStyle.verticalCornerRadius;if(e>0||n>0){const t=`calc(${e}px * var(--scale-factor)) / calc(${n}px * var(--scale-factor))`;s.style.borderRadius=t}else if(this instanceof y){const e=`calc(${a}px * var(--scale-factor)) / calc(${o}px * var(--scale-factor))`;s.style.borderRadius=e}switch(t.borderStyle.style){case r.AnnotationBorderStyleType.SOLID:s.style.borderStyle="solid";break;case r.AnnotationBorderStyleType.DASHED:s.style.borderStyle="dashed";break;case r.AnnotationBorderStyleType.BEVELED:(0,r.warn)("Unimplemented border style: beveled");break;case r.AnnotationBorderStyleType.INSET:(0,r.warn)("Unimplemented border style: inset");break;case r.AnnotationBorderStyleType.UNDERLINE:s.style.borderBottomStyle="solid"}const i=t.borderColor||null;i?s.style.borderColor=r.Util.makeHexColor(0|i[0],0|i[1],0|i[2]):s.style.borderWidth=0}s.style.left=100*(g[0]-l)/p+"%",s.style.top=100*(g[1]-c)/f+"%";const{rotation:m}=t;return t.hasOwnCanvas||0===m?(s.style.width=100*a/p+"%",s.style.height=100*o/f+"%"):this.setRotation(m,s),s}setRotation(e,t=this.container){const[n,r,i,s]=this.viewport.viewBox,a=i-n,o=s-r,{width:l,height:c}=u(this.data.rect);let d,h;e%180==0?(d=100*l/a,h=100*c/o):(d=100*c/a,h=100*l/o),t.style.width=`${d}%`,t.style.height=`${h}%`,t.setAttribute("data-main-rotation",(360-e)%360)}get _commonActions(){const e=(e,t,n)=>{const r=n.detail[e];n.target.style[t]=a.ColorConverters[`${r[0]}_HTML`](r.slice(1))};return(0,r.shadow)(this,"_commonActions",{display:e=>{const t=e.detail.display%2==1;this.container.style.visibility=t?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{hidden:t,print:0===e.detail.display||3===e.detail.display})},print:e=>{this.annotationStorage.setValue(this.data.id,{print:e.detail.print})},hidden:e=>{this.container.style.visibility=e.detail.hidden?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{hidden:e.detail.hidden})},focus:e=>{setTimeout((()=>e.target.focus({preventScroll:!1})),0)},userName:e=>{e.target.title=e.detail.userName},readonly:e=>{e.detail.readonly?e.target.setAttribute("readonly",""):e.target.removeAttribute("readonly")},required:e=>{this._setRequired(e.target,e.detail.required)},bgColor:t=>{e("bgColor","backgroundColor",t)},fillColor:t=>{e("fillColor","backgroundColor",t)},fgColor:t=>{e("fgColor","color",t)},textColor:t=>{e("textColor","color",t)},borderColor:t=>{e("borderColor","borderColor",t)},strokeColor:t=>{e("strokeColor","borderColor",t)},rotation:e=>{const t=e.detail.rotation;this.setRotation(t),this.annotationStorage.setValue(this.data.id,{rotation:t})}})}_dispatchEventFromSandbox(e,t){const n=this._commonActions;for(const r of Object.keys(t.detail)){const i=e[r]||n[r];i&&i(t)}}_setDefaultPropertiesFromJS(e){if(!this.enableScripting)return;const t=this.annotationStorage.getRawValue(this.data.id);if(!t)return;const n=this._commonActions;for(const[r,i]of Object.entries(t)){const s=n[r];s&&(s({detail:{[r]:i},target:e}),delete t[r])}}_createQuadrilaterals(e=!1){if(!this.data.quadPoints)return null;const t=[],n=this.data.rect;for(const n of this.data.quadPoints)this.data.rect=[n[2].x,n[2].y,n[1].x,n[1].y],t.push(this._createContainer(e));return this.data.rect=n,t}_createPopup(e,t){let n=this.container;this.quadrilaterals&&(e=e||this.quadrilaterals,n=this.quadrilaterals[0]),e||((e=document.createElement("div")).className="popupTriggerArea",n.append(e));const r=new E({container:n,trigger:e,color:t.color,titleObj:t.titleObj,modificationDate:t.modificationDate,contentsObj:t.contentsObj,richText:t.richText,hideWrapper:!0}).render();r.style.left="100%",n.append(r)}_renderQuadrilaterals(e){for(const t of this.quadrilaterals)t.className=e;return this.quadrilaterals}render(){(0,r.unreachable)("Abstract method `AnnotationElement.render` called")}_getElementsByName(e,t=null){const n=[];if(this._fieldObjects){const i=this._fieldObjects[e];if(i)for(const{page:e,id:s,exportValues:a}of i){if(-1===e)continue;if(s===t)continue;const i="string"==typeof a?a:null,o=document.querySelector(`[data-element-id="${s}"]`);!o||c.has(o)?n.push({id:s,exportValue:i,domElement:o}):(0,r.warn)(`_getElementsByName - element not allowed: ${s}`)}return n}for(const r of document.getElementsByName(e)){const{id:e,exportValue:i}=r;e!==t&&c.has(r)&&n.push({id:e,exportValue:i,domElement:r})}return n}static get platform(){const e="undefined"!=typeof navigator?navigator.platform:"";return(0,r.shadow)(this,"platform",{isWin:e.includes("Win"),isMac:e.includes("Mac")})}}class p extends h{constructor(e,t=null){super(e,{isRenderable:!0,ignoreBorder:!!t?.ignoreBorder,createQuadrilaterals:!0}),this.isTooltipOnly=e.data.isTooltipOnly}render(){const{data:e,linkService:t}=this,n=document.createElement("a");n.setAttribute("data-element-id",e.id);let r=!1;return e.url?(t.addLinkAttributes(n,e.url,e.newWindow),r=!0):e.action?(this._bindNamedAction(n,e.action),r=!0):e.dest?(this._bindLink(n,e.dest),r=!0):(e.actions&&(e.actions.Action||e.actions["Mouse Up"]||e.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(n,e),r=!0),e.resetForm?(this._bindResetFormAction(n,e.resetForm),r=!0):this.isTooltipOnly&&!r&&(this._bindLink(n,""),r=!0)),this.quadrilaterals?this._renderQuadrilaterals("linkAnnotation").map(((e,t)=>{const r=0===t?n:n.cloneNode();return e.append(r),e})):(this.container.className="linkAnnotation",r&&this.container.append(n),this.container)}_bindLink(e,t){e.href=this.linkService.getDestinationHash(t),e.onclick=()=>(t&&this.linkService.goToDestination(t),!1),(t||""===t)&&(e.className="internalLink")}_bindNamedAction(e,t){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeNamedAction(t),!1),e.className="internalLink"}_bindJSAction(e,t){e.href=this.linkService.getAnchorUrl("");const n=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const r of Object.keys(t.actions)){const i=n.get(r);i&&(e[i]=()=>(this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t.id,name:r}}),!1))}e.onclick||(e.onclick=()=>!1),e.className="internalLink"}_bindResetFormAction(e,t){const n=e.onclick;if(n||(e.href=this.linkService.getAnchorUrl("")),e.className="internalLink",!this._fieldObjects)return(0,r.warn)('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),void(n||(e.onclick=()=>!1));e.onclick=()=>{n&&n();const{fields:e,refs:i,include:s}=t,a=[];if(0!==e.length||0!==i.length){const t=new Set(i);for(const n of e){const e=this._fieldObjects[n]||[];for(const{id:n}of e)t.add(n)}for(const e of Object.values(this._fieldObjects))for(const n of e)t.has(n.id)===s&&a.push(n)}else for(const e of Object.values(this._fieldObjects))a.push(...e);const o=this.annotationStorage,l=[];for(const e of a){const{id:t}=e;switch(l.push(t),e.type){case"text":{const n=e.defaultValue||"";o.setValue(t,{value:n});break}case"checkbox":case"radiobutton":{const n=e.defaultValue===e.exportValues;o.setValue(t,{value:n});break}case"combobox":case"listbox":{const n=e.defaultValue||"";o.setValue(t,{value:n});break}default:continue}const n=document.querySelector(`[data-element-id="${t}"]`);n&&(c.has(n)?n.dispatchEvent(new Event("resetform")):(0,r.warn)(`_bindResetFormAction - element not allowed: ${t}`))}return this.enableScripting&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:l,name:"ResetForm"}}),!1}}}class f extends h{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.titleObj?.str||e.data.contentsObj?.str||e.data.richText?.str)})}render(){this.container.className="textAnnotation";const e=document.createElement("img");return e.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",e.alt="[{{type}} Annotation]",e.dataset.l10nId="text_annotation_type",e.dataset.l10nArgs=JSON.stringify({type:this.data.name}),this.data.hasPopup||this._createPopup(e,this.data),this.container.append(e),this.container}}class g extends h{render(){return this.data.alternativeText&&(this.container.title=this.data.alternativeText),this.container}_getKeyModifier(e){const{isWin:t,isMac:n}=h.platform;return t&&e.ctrlKey||n&&e.metaKey}_setEventListener(e,t,n,r){t.includes("mouse")?e.addEventListener(t,(e=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:n,value:r(e),shift:e.shiftKey,modifier:this._getKeyModifier(e)}})})):e.addEventListener(t,(e=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:n,value:r(e)}})}))}_setEventListeners(e,t,n){for(const[r,i]of t)("Action"===i||this.data.actions?.[i])&&this._setEventListener(e,r,i,n)}_setBackgroundColor(e){const t=this.data.backgroundColor||null;e.style.backgroundColor=null===t?"transparent":r.Util.makeHexColor(t[0],t[1],t[2])}_setTextStyle(e){const t=["left","center","right"],{fontColor:n}=this.data.defaultAppearanceData,i=this.data.defaultAppearanceData.fontSize||9,s=e.style;let a;if(this.data.multiLine){const e=Math.abs(this.data.rect[3]-this.data.rect[1]),t=e/(Math.round(e/(r.LINE_FACTOR*i))||1);a=Math.min(i,Math.round(t/r.LINE_FACTOR))}else{const e=Math.abs(this.data.rect[3]-this.data.rect[1]);a=Math.min(i,Math.round(e/r.LINE_FACTOR))}s.fontSize=`calc(${a}px * var(--scale-factor))`,s.color=r.Util.makeHexColor(n[0],n[1],n[2]),null!==this.data.textAlignment&&(s.textAlign=t[this.data.textAlignment])}_setRequired(e,t){t?e.setAttribute("required",!0):e.removeAttribute("required"),e.setAttribute("aria-required",t)}}class m extends g{constructor(e){super(e,{isRenderable:e.renderForms||!e.data.hasAppearance&&!!e.data.fieldValue})}setPropertyOnSiblings(e,t,n,r){const i=this.annotationStorage;for(const s of this._getElementsByName(e.name,e.id))s.domElement&&(s.domElement[t]=n),i.setValue(s.id,{[r]:n})}render(){const e=this.annotationStorage,t=this.data.id;this.container.className="textWidgetAnnotation";let n=null;if(this.renderForms){const r=e.getValue(t,{value:this.data.fieldValue});let i=r.formattedValue||r.value||"";const s=e.getValue(t,{charLimit:this.data.maxLen}).charLimit;s&&i.length>s&&(i=i.slice(0,s));const a={userValue:i,formattedValue:null,valueOnFocus:""};this.data.multiLine?(n=document.createElement("textarea"),n.textContent=i,this.data.doNotScroll&&(n.style.overflowY="hidden")):(n=document.createElement("input"),n.type="text",n.setAttribute("value",i),this.data.doNotScroll&&(n.style.overflowX="hidden")),c.add(n),n.setAttribute("data-element-id",t),n.disabled=this.data.readOnly,n.name=this.data.fieldName,n.tabIndex=l,this._setRequired(n,this.data.required),s&&(n.maxLength=s),n.addEventListener("input",(r=>{e.setValue(t,{value:r.target.value}),this.setPropertyOnSiblings(n,"value",r.target.value,"value")})),n.addEventListener("resetform",(e=>{const t=this.data.defaultFieldValue??"";n.value=a.userValue=t,a.formattedValue=null}));let o=e=>{const{formattedValue:t}=a;null!=t&&(e.target.value=t),e.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){n.addEventListener("focus",(e=>{a.userValue&&(e.target.value=a.userValue),a.valueOnFocus=e.target.value})),n.addEventListener("updatefromsandbox",(n=>{const r={value(n){a.userValue=n.detail.value??"",e.setValue(t,{value:a.userValue.toString()}),n.target.value=a.userValue},formattedValue(n){const{formattedValue:r}=n.detail;a.formattedValue=r,null!=r&&n.target!==document.activeElement&&(n.target.value=r),e.setValue(t,{formattedValue:r})},selRange(e){e.target.setSelectionRange(...e.detail.selRange)},charLimit:n=>{const{charLimit:r}=n.detail,{target:i}=n;if(0===r)return void i.removeAttribute("maxLength");i.setAttribute("maxLength",r);let s=a.userValue;!s||s.length<=r||(s=s.slice(0,r),i.value=a.userValue=s,e.setValue(t,{value:s}),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:s,willCommit:!0,commitKey:1,selStart:i.selectionStart,selEnd:i.selectionEnd}}))}};this._dispatchEventFromSandbox(r,n)})),n.addEventListener("keydown",(e=>{let n=-1;if("Escape"===e.key?n=0:"Enter"===e.key?n=2:"Tab"===e.key&&(n=3),-1===n)return;const{value:r}=e.target;a.valueOnFocus!==r&&(a.userValue=r,this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:r,willCommit:!0,commitKey:n,selStart:e.target.selectionStart,selEnd:e.target.selectionEnd}}))}));const r=o;o=null,n.addEventListener("blur",(e=>{const{value:n}=e.target;a.userValue=n,this._mouseState.isDown&&a.valueOnFocus!==n&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:n,willCommit:!0,commitKey:1,selStart:e.target.selectionStart,selEnd:e.target.selectionEnd}}),r(e)})),this.data.actions?.Keystroke&&n.addEventListener("beforeinput",(e=>{const{data:n,target:r}=e,{value:i,selectionStart:s,selectionEnd:a}=r;let o=s,l=a;switch(e.inputType){case"deleteWordBackward":{const e=i.substring(0,s).match(/\w*[^\w]*$/);e&&(o-=e[0].length);break}case"deleteWordForward":{const e=i.substring(s).match(/^[^\w]*\w*/);e&&(l+=e[0].length);break}case"deleteContentBackward":s===a&&(o-=1);break;case"deleteContentForward":s===a&&(l+=1)}e.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:i,change:n||"",willCommit:!1,selStart:o,selEnd:l}})})),this._setEventListeners(n,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(e=>e.target.value))}if(o&&n.addEventListener("blur",o),this.data.comb){const e=(this.data.rect[2]-this.data.rect[0])/s;n.classList.add("comb"),n.style.letterSpacing=`calc(${e}px * var(--scale-factor) - 1ch)`}}else n=document.createElement("div"),n.textContent=this.data.fieldValue,n.style.verticalAlign="middle",n.style.display="table-cell";return this._setTextStyle(n),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class v extends g{constructor(e){super(e,{isRenderable:e.renderForms})}render(){const e=this.annotationStorage,t=this.data,n=t.id;let r=e.getValue(n,{value:t.exportValue===t.fieldValue}).value;"string"==typeof r&&(r="Off"!==r,e.setValue(n,{value:r})),this.container.className="buttonWidgetAnnotation checkBox";const i=document.createElement("input");return c.add(i),i.setAttribute("data-element-id",n),i.disabled=t.readOnly,this._setRequired(i,this.data.required),i.type="checkbox",i.name=t.fieldName,r&&i.setAttribute("checked",!0),i.setAttribute("exportValue",t.exportValue),i.tabIndex=l,i.addEventListener("change",(r=>{const{name:i,checked:s}=r.target;for(const r of this._getElementsByName(i,n)){const n=s&&r.exportValue===t.exportValue;r.domElement&&(r.domElement.checked=n),e.setValue(r.id,{value:n})}e.setValue(n,{value:s})})),i.addEventListener("resetform",(e=>{const n=t.defaultFieldValue||"Off";e.target.checked=n===t.exportValue})),this.enableScripting&&this.hasJSActions&&(i.addEventListener("updatefromsandbox",(t=>{const r={value(t){t.target.checked="Off"!==t.detail.value,e.setValue(n,{value:t.target.checked})}};this._dispatchEventFromSandbox(r,t)})),this._setEventListeners(i,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(e=>e.target.checked))),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class y extends g{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.className="buttonWidgetAnnotation radioButton";const e=this.annotationStorage,t=this.data,n=t.id;let r=e.getValue(n,{value:t.fieldValue===t.buttonValue}).value;"string"==typeof r&&(r=r!==t.buttonValue,e.setValue(n,{value:r}));const i=document.createElement("input");if(c.add(i),i.setAttribute("data-element-id",n),i.disabled=t.readOnly,this._setRequired(i,this.data.required),i.type="radio",i.name=t.fieldName,r&&i.setAttribute("checked",!0),i.tabIndex=l,i.addEventListener("change",(t=>{const{name:r,checked:i}=t.target;for(const t of this._getElementsByName(r,n))e.setValue(t.id,{value:!1});e.setValue(n,{value:i})})),i.addEventListener("resetform",(e=>{const n=t.defaultFieldValue;e.target.checked=null!=n&&n===t.buttonValue})),this.enableScripting&&this.hasJSActions){const r=t.buttonValue;i.addEventListener("updatefromsandbox",(t=>{const i={value:t=>{const i=r===t.detail.value;for(const r of this._getElementsByName(t.target.name)){const t=i&&r.id===n;r.domElement&&(r.domElement.checked=t),e.setValue(r.id,{value:t})}}};this._dispatchEventFromSandbox(i,t)})),this._setEventListeners(i,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(e=>e.target.checked))}return this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class b extends p{constructor(e){super(e,{ignoreBorder:e.data.hasAppearance})}render(){const e=super.render();e.className="buttonWidgetAnnotation pushButton",this.data.alternativeText&&(e.title=this.data.alternativeText);const t=e.lastChild;return this.enableScripting&&this.hasJSActions&&t&&(this._setDefaultPropertiesFromJS(t),t.addEventListener("updatefromsandbox",(e=>{this._dispatchEventFromSandbox({},e)}))),e}}class _ extends g{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.className="choiceWidgetAnnotation";const e=this.annotationStorage,t=this.data.id,n=e.getValue(t,{value:this.data.fieldValue}),r=document.createElement("select");c.add(r),r.setAttribute("data-element-id",t),r.disabled=this.data.readOnly,this._setRequired(r,this.data.required),r.name=this.data.fieldName,r.tabIndex=l;let i=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",(e=>{const t=this.data.defaultFieldValue;for(const e of r.options)e.selected=e.value===t}));for(const e of this.data.options){const t=document.createElement("option");t.textContent=e.displayValue,t.value=e.exportValue,n.value.includes(e.exportValue)&&(t.setAttribute("selected",!0),i=!1),r.append(t)}let s=null;if(i){const e=document.createElement("option");e.value=" ",e.setAttribute("hidden",!0),e.setAttribute("selected",!0),r.prepend(e),s=()=>{e.remove(),r.removeEventListener("input",s),s=null},r.addEventListener("input",s)}const a=(e,t)=>{const n=t?"value":"textContent",r=e.target.options;return e.target.multiple?Array.prototype.filter.call(r,(e=>e.selected)).map((e=>e[n])):-1===r.selectedIndex?null:r[r.selectedIndex][n]},o=e=>{const t=e.target.options;return Array.prototype.map.call(t,(e=>({displayValue:e.textContent,exportValue:e.value})))};return this.enableScripting&&this.hasJSActions?(r.addEventListener("updatefromsandbox",(n=>{const i={value(n){s?.();const i=n.detail.value,o=new Set(Array.isArray(i)?i:[i]);for(const e of r.options)e.selected=o.has(e.value);e.setValue(t,{value:a(n,!0)})},multipleSelection(e){r.multiple=!0},remove(n){const i=r.options,s=n.detail.remove;i[s].selected=!1,r.remove(s),i.length>0&&-1===Array.prototype.findIndex.call(i,(e=>e.selected))&&(i[0].selected=!0),e.setValue(t,{value:a(n,!0),items:o(n)})},clear(n){for(;0!==r.length;)r.remove(0);e.setValue(t,{value:null,items:[]})},insert(n){const{index:i,displayValue:s,exportValue:l}=n.detail.insert,c=r.children[i],u=document.createElement("option");u.textContent=s,u.value=l,c?c.before(u):r.append(u),e.setValue(t,{value:a(n,!0),items:o(n)})},items(n){const{items:i}=n.detail;for(;0!==r.length;)r.remove(0);for(const e of i){const{displayValue:t,exportValue:n}=e,i=document.createElement("option");i.textContent=t,i.value=n,r.append(i)}r.options.length>0&&(r.options[0].selected=!0),e.setValue(t,{value:a(n,!0),items:o(n)})},indices(n){const r=new Set(n.detail.indices);for(const e of n.target.options)e.selected=r.has(e.index);e.setValue(t,{value:a(n,!0)})},editable(e){e.target.disabled=!e.detail.editable}};this._dispatchEventFromSandbox(i,n)})),r.addEventListener("input",(n=>{const r=a(n,!0),i=a(n,!1);e.setValue(t,{value:r}),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:i,changeEx:r,willCommit:!0,commitKey:1,keyDown:!1}})})),this._setEventListeners(r,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"]],(e=>e.target.checked))):r.addEventListener("input",(function(n){e.setValue(t,{value:a(n,!0)})})),this.data.combo&&this._setTextStyle(r),this._setBackgroundColor(r),this._setDefaultPropertiesFromJS(r),this.container.append(r),this.container}}class w extends h{constructor(e){super(e,{isRenderable:!!(e.data.titleObj?.str||e.data.contentsObj?.str||e.data.richText?.str)})}render(){if(this.container.className="popupAnnotation",["Line","Square","Circle","PolyLine","Polygon","Ink"].includes(this.data.parentType))return this.container;const e=`[data-annotation-id="${this.data.parentId}"]`,t=this.layer.querySelectorAll(e);if(0===t.length)return this.container;const n=new E({container:this.container,trigger:Array.from(t),color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate,contentsObj:this.data.contentsObj,richText:this.data.richText}),i=this.page,s=r.Util.normalizeRect([this.data.parentRect[0],i.view[3]-this.data.parentRect[1]+i.view[1],this.data.parentRect[2],i.view[3]-this.data.parentRect[3]+i.view[1]]),a=s[0]+this.data.parentRect[2]-this.data.parentRect[0],o=s[1],[l,c,u,d]=this.viewport.viewBox,h=u-l,p=d-c;return this.container.style.left=100*(a-l)/h+"%",this.container.style.top=100*(o-c)/p+"%",this.container.append(n.render()),this.container}}class E{constructor(e){this.container=e.container,this.trigger=e.trigger,this.color=e.color,this.titleObj=e.titleObj,this.modificationDate=e.modificationDate,this.contentsObj=e.contentsObj,this.richText=e.richText,this.hideWrapper=e.hideWrapper||!1,this.pinned=!1}render(){const e=document.createElement("div");e.className="popupWrapper",this.hideElement=this.hideWrapper?e:this.container,this.hideElement.hidden=!0;const t=document.createElement("div");t.className="popup";const n=this.color;if(n){const e=.7*(255-n[0])+n[0],i=.7*(255-n[1])+n[1],s=.7*(255-n[2])+n[2];t.style.backgroundColor=r.Util.makeHexColor(0|e,0|i,0|s)}const s=document.createElement("h1");s.dir=this.titleObj.dir,s.textContent=this.titleObj.str,t.append(s);const a=i.PDFDateString.toDateObject(this.modificationDate);if(a){const e=document.createElement("span");e.className="popupDate",e.textContent="{{date}}, {{time}}",e.dataset.l10nId="annotation_date_string",e.dataset.l10nArgs=JSON.stringify({date:a.toLocaleDateString(),time:a.toLocaleTimeString()}),t.append(e)}if(!this.richText?.str||this.contentsObj?.str&&this.contentsObj.str!==this.richText.str){const e=this._formatContents(this.contentsObj);t.append(e)}else o.XfaLayer.render({xfaHtml:this.richText.html,intent:"richText",div:t}),t.lastChild.className="richText popupContent";Array.isArray(this.trigger)||(this.trigger=[this.trigger]);for(const e of this.trigger)e.addEventListener("click",this._toggle.bind(this)),e.addEventListener("mouseover",this._show.bind(this,!1)),e.addEventListener("mouseout",this._hide.bind(this,!1));return t.addEventListener("click",this._hide.bind(this,!0)),e.append(t),e}_formatContents({str:e,dir:t}){const n=document.createElement("p");n.className="popupContent",n.dir=t;const r=e.split(/(?:\r\n?|\n)/);for(let e=0,t=r.length;e<t;++e){const i=r[e];n.append(document.createTextNode(i)),e<t-1&&n.append(document.createElement("br"))}return n}_toggle(){this.pinned?this._hide(!0):this._show(!0)}_show(e=!1){e&&(this.pinned=!0),this.hideElement.hidden&&(this.hideElement.hidden=!1,this.container.style.zIndex=parseInt(this.container.style.zIndex)+1e3)}_hide(e=!0){e&&(this.pinned=!1),this.hideElement.hidden||this.pinned||(this.hideElement.hidden=!0,this.container.style.zIndex=parseInt(this.container.style.zIndex)-1e3)}}class S extends h{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.titleObj?.str||e.data.contentsObj?.str||e.data.richText?.str),ignoreBorder:!0}),this.textContent=e.data.textContent}render(){if(this.container.className="freeTextAnnotation",this.textContent){const e=document.createElement("div");e.className="annotationTextContent",e.setAttribute("role","comment");for(const t of this.textContent){const n=document.createElement("span");n.textContent=t,e.append(n)}this.container.append(e)}return this.data.hasPopup||this._createPopup(null,this.data),this.container}}class C extends h{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.titleObj?.str||e.data.contentsObj?.str||e.data.richText?.str),ignoreBorder:!0})}render(){this.container.className="lineAnnotation";const e=this.data,{width:t,height:n}=u(e.rect),r=this.svgFactory.create(t,n,!0),i=this.svgFactory.createElement("svg:line");return i.setAttribute("x1",e.rect[2]-e.lineCoordinates[0]),i.setAttribute("y1",e.rect[3]-e.lineCoordinates[1]),i.setAttribute("x2",e.rect[2]-e.lineCoordinates[2]),i.setAttribute("y2",e.rect[3]-e.lineCoordinates[3]),i.setAttribute("stroke-width",e.borderStyle.width||1),i.setAttribute("stroke","transparent"),i.setAttribute("fill","transparent"),r.append(i),this.container.append(r),this._createPopup(i,e),this.container}}class A extends h{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.titleObj?.str||e.data.contentsObj?.str||e.data.richText?.str),ignoreBorder:!0})}render(){this.container.className="squareAnnotation";const e=this.data,{width:t,height:n}=u(e.rect),r=this.svgFactory.create(t,n,!0),i=e.borderStyle.width,s=this.svgFactory.createElement("svg:rect");return s.setAttribute("x",i/2),s.setAttribute("y",i/2),s.setAttribute("width",t-i),s.setAttribute("height",n-i),s.setAttribute("stroke-width",i||1),s.setAttribute("stroke","transparent"),s.setAttribute("fill","transparent"),r.append(s),this.container.append(r),this._createPopup(s,e),this.container}}class P extends h{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.titleObj?.str||e.data.contentsObj?.str||e.data.richText?.str),ignoreBorder:!0})}render(){this.container.className="circleAnnotation";const e=this.data,{width:t,height:n}=u(e.rect),r=this.svgFactory.create(t,n,!0),i=e.borderStyle.width,s=this.svgFactory.createElement("svg:ellipse");return s.setAttribute("cx",t/2),s.setAttribute("cy",n/2),s.setAttribute("rx",t/2-i/2),s.setAttribute("ry",n/2-i/2),s.setAttribute("stroke-width",i||1),s.setAttribute("stroke","transparent"),s.setAttribute("fill","transparent"),r.append(s),this.container.append(r),this._createPopup(s,e),this.container}}class x extends h{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.titleObj?.str||e.data.contentsObj?.str||e.data.richText?.str),ignoreBorder:!0}),this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.className=this.containerClassName;const e=this.data,{width:t,height:n}=u(e.rect),r=this.svgFactory.create(t,n,!0);let i=[];for(const t of e.vertices){const n=t.x-e.rect[0],r=e.rect[3]-t.y;i.push(n+","+r)}i=i.join(" ");const s=this.svgFactory.createElement(this.svgElementName);return s.setAttribute("points",i),s.setAttribute("stroke-width",e.borderStyle.width||1),s.setAttribute("stroke","transparent"),s.setAttribute("fill","transparent"),r.append(s),this.container.append(r),this._createPopup(s,e),this.container}}class T extends x{constructor(e){super(e),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class R extends h{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.titleObj?.str||e.data.contentsObj?.str||e.data.richText?.str),ignoreBorder:!0})}render(){return this.container.className="caretAnnotation",this.data.hasPopup||this._createPopup(null,this.data),this.container}}class M extends h{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.titleObj?.str||e.data.contentsObj?.str||e.data.richText?.str),ignoreBorder:!0}),this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline"}render(){this.container.className=this.containerClassName;const e=this.data,{width:t,height:n}=u(e.rect),r=this.svgFactory.create(t,n,!0);for(const t of e.inkLists){let n=[];for(const r of t){const t=r.x-e.rect[0],i=e.rect[3]-r.y;n.push(`${t},${i}`)}n=n.join(" ");const i=this.svgFactory.createElement(this.svgElementName);i.setAttribute("points",n),i.setAttribute("stroke-width",e.borderStyle.width||1),i.setAttribute("stroke","transparent"),i.setAttribute("fill","transparent"),this._createPopup(i,e),r.append(i)}return this.container.append(r),this.container}}class L extends h{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.titleObj?.str||e.data.contentsObj?.str||e.data.richText?.str),ignoreBorder:!0,createQuadrilaterals:!0})}render(){return this.data.hasPopup||this._createPopup(null,this.data),this.quadrilaterals?this._renderQuadrilaterals("highlightAnnotation"):(this.container.className="highlightAnnotation",this.container)}}class I extends h{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.titleObj?.str||e.data.contentsObj?.str||e.data.richText?.str),ignoreBorder:!0,createQuadrilaterals:!0})}render(){return this.data.hasPopup||this._createPopup(null,this.data),this.quadrilaterals?this._renderQuadrilaterals("underlineAnnotation"):(this.container.className="underlineAnnotation",this.container)}}class k extends h{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.titleObj?.str||e.data.contentsObj?.str||e.data.richText?.str),ignoreBorder:!0,createQuadrilaterals:!0})}render(){return this.data.hasPopup||this._createPopup(null,this.data),this.quadrilaterals?this._renderQuadrilaterals("squigglyAnnotation"):(this.container.className="squigglyAnnotation",this.container)}}class O extends h{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.titleObj?.str||e.data.contentsObj?.str||e.data.richText?.str),ignoreBorder:!0,createQuadrilaterals:!0})}render(){return this.data.hasPopup||this._createPopup(null,this.data),this.quadrilaterals?this._renderQuadrilaterals("strikeoutAnnotation"):(this.container.className="strikeoutAnnotation",this.container)}}class F extends h{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.titleObj?.str||e.data.contentsObj?.str||e.data.richText?.str),ignoreBorder:!0})}render(){return this.container.className="stampAnnotation",this.data.hasPopup||this._createPopup(null,this.data),this.container}}class D extends h{constructor(e){super(e,{isRenderable:!0});const{filename:t,content:n}=this.data.file;this.filename=(0,i.getFilenameFromUrl)(t),this.content=n,this.linkService.eventBus?.dispatch("fileattachmentannotation",{source:this,filename:t,content:n})}render(){this.container.className="fileAttachmentAnnotation";const e=document.createElement("div");return e.className="popupTriggerArea",e.addEventListener("dblclick",this._download.bind(this)),!this.data.hasPopup&&(this.data.titleObj?.str||this.data.contentsObj?.str||this.data.richText)&&this._createPopup(e,this.data),this.container.append(e),this.container}_download(){this.downloadManager?.openOrDownloadData(this.container,this.content,this.filename)}}class N{static#dt(e,t,n,r){const s=e.firstChild||e;s.id=`${i.AnnotationPrefix}${t}`,n.append(e),r?.moveElementInDOM(n,e,s,!1)}static render(e){const{annotations:t,div:n,viewport:a,accessibilityManager:o}=e;this.#ht(n,a);let l=0;for(const c of t){if(c.annotationType!==r.AnnotationType.POPUP){const{width:e,height:t}=u(c.rect);if(e<=0||t<=0)continue}const t=d.create({data:c,layer:n,page:e.page,viewport:a,linkService:e.linkService,downloadManager:e.downloadManager,imageResourcesPath:e.imageResourcesPath||"",renderForms:!1!==e.renderForms,svgFactory:new i.DOMSVGFactory,annotationStorage:e.annotationStorage||new s.AnnotationStorage,enableScripting:e.enableScripting,hasJSActions:e.hasJSActions,fieldObjects:e.fieldObjects,mouseState:e.mouseState||{isDown:!1}});if(t.isRenderable){const e=t.render();if(c.hidden&&(e.style.visibility="hidden"),Array.isArray(e))for(const t of e)t.style.zIndex=l++,N.#dt(t,c.id,n,o);else e.style.zIndex=l++,t instanceof w?n.prepend(e):N.#dt(e,c.id,n,o)}}this.#pt(n,e.annotationCanvasMap)}static update(e){const{annotationCanvasMap:t,div:n,viewport:r}=e;this.#ht(n,r),this.#pt(n,t),n.hidden=!1}static#ht(e,{width:t,height:n,rotation:r}){const{style:i}=e,s=r%180!=0,a=Math.floor(t)+"px",o=Math.floor(n)+"px";i.width=s?o:a,i.height=s?a:o,e.setAttribute("data-main-rotation",r)}static#pt(e,t){if(t){for(const[n,r]of t){const t=e.querySelector(`[data-annotation-id="${n}"]`);if(!t)continue;const{firstChild:i}=t;i?"CANVAS"===i.nodeName?i.replaceWith(r):i.before(r):t.append(r)}t.clear()}}}t.AnnotationLayer=N},(e,t)=>{function n(e){return Math.floor(255*Math.max(0,Math.min(1,e))).toString(16).padStart(2,"0")}Object.defineProperty(t,"__esModule",{value:!0}),t.ColorConverters=void 0,t.ColorConverters=class{static CMYK_G([e,t,n,r]){return["G",1-Math.min(1,.3*e+.59*n+.11*t+r)]}static G_CMYK([e]){return["CMYK",0,0,0,1-e]}static G_RGB([e]){return["RGB",e,e,e]}static G_HTML([e]){const t=n(e);return`#${t}${t}${t}`}static RGB_G([e,t,n]){return["G",.3*e+.59*t+.11*n]}static RGB_HTML([e,t,r]){return`#${n(e)}${n(t)}${n(r)}`}static T_HTML(){return"#00000000"}static CMYK_RGB([e,t,n,r]){return["RGB",1-Math.min(1,e+r),1-Math.min(1,n+r),1-Math.min(1,t+r)]}static CMYK_HTML(e){const t=this.CMYK_RGB(e).slice(1);return this.RGB_HTML(t)}static RGB_CMYK([e,t,n]){const r=1-e,i=1-t,s=1-n;return["CMYK",r,i,s,Math.min(r,i,s)]}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.XfaLayer=void 0;var r=n(20);t.XfaLayer=class{static setupStorage(e,t,n,r,i){const s=r.getValue(t,{value:null});switch(n.name){case"textarea":if(null!==s.value&&(e.textContent=s.value),"print"===i)break;e.addEventListener("input",(e=>{r.setValue(t,{value:e.target.value})}));break;case"input":if("radio"===n.attributes.type||"checkbox"===n.attributes.type){if(s.value===n.attributes.xfaOn?e.setAttribute("checked",!0):s.value===n.attributes.xfaOff&&e.removeAttribute("checked"),"print"===i)break;e.addEventListener("change",(e=>{r.setValue(t,{value:e.target.checked?e.target.getAttribute("xfaOn"):e.target.getAttribute("xfaOff")})}))}else{if(null!==s.value&&e.setAttribute("value",s.value),"print"===i)break;e.addEventListener("input",(e=>{r.setValue(t,{value:e.target.value})}))}break;case"select":if(null!==s.value)for(const e of n.children)e.attributes.value===s.value&&(e.attributes.selected=!0);e.addEventListener("input",(e=>{const n=e.target.options,i=-1===n.selectedIndex?"":n[n.selectedIndex].value;r.setValue(t,{value:i})}))}}static setAttributes({html:e,element:t,storage:n=null,intent:r,linkService:i}){const{attributes:s}=t,a=e instanceof HTMLAnchorElement;"radio"===s.type&&(s.name=`${s.name}-${r}`);for(const[t,n]of Object.entries(s))if(null!=n)switch(t){case"class":n.length&&e.setAttribute(t,n.join(" "));break;case"dataId":break;case"id":e.setAttribute("data-element-id",n);break;case"style":Object.assign(e.style,n);break;case"textContent":e.textContent=n;break;default:(!a||"href"!==t&&"newWindow"!==t)&&e.setAttribute(t,n)}a&&i.addLinkAttributes(e,s.href,s.newWindow),n&&s.dataId&&this.setupStorage(e,s.dataId,t,n)}static render(e){const t=e.annotationStorage,n=e.linkService,i=e.xfaHtml,s=e.intent||"display",a=document.createElement(i.name);i.attributes&&this.setAttributes({html:a,element:i,intent:s,linkService:n});const o=[[i,-1,a]],l=e.div;if(l.append(a),e.viewport){const t=`matrix(${e.viewport.transform.join(",")})`;l.style.transform=t}"richText"!==s&&l.setAttribute("class","xfaLayer xfaFont");const c=[];for(;o.length>0;){const[e,i,a]=o.at(-1);if(i+1===e.children.length){o.pop();continue}const l=e.children[++o.at(-1)[1]];if(null===l)continue;const{name:u}=l;if("#text"===u){const e=document.createTextNode(l.value);c.push(e),a.append(e);continue}let d;if(d=l?.attributes?.xmlns?document.createElementNS(l.attributes.xmlns,u):document.createElement(u),a.append(d),l.attributes&&this.setAttributes({html:d,element:l,storage:t,intent:s,linkService:n}),l.children&&l.children.length>0)o.push([l,-1,d]);else if(l.value){const e=document.createTextNode(l.value);r.XfaText.shouldBuildText(u)&&c.push(e),d.append(e)}}for(const e of l.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))e.setAttribute("readOnly",!0);return{textDivs:c}}static update(e){const t=`matrix(${e.viewport.transform.join(",")})`;e.div.style.transform=t,e.div.hidden=!1}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TextLayerRenderTask=void 0,t.renderTextLayer=function(e){const t=new p({textContent:e.textContent,textContentStream:e.textContentStream,container:e.container,viewport:e.viewport,textDivs:e.textDivs,textContentItemsStr:e.textContentItemsStr,enhanceTextSelection:e.enhanceTextSelection});return t._render(e.timeout),t};var r=n(1),i=n(8);const s=30,a=new Map,o=/^\s+$/g;function l(e,t,n,i){const l=document.createElement("span"),c=e._enhanceTextSelection?{angle:0,canvasWidth:0,hasText:""!==t.str,hasEOL:t.hasEOL,originalTransform:null,paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0,scale:1,fontSize:0}:{angle:0,canvasWidth:0,hasText:""!==t.str,hasEOL:t.hasEOL,fontSize:0};e._textDivs.push(l);const u=r.Util.transform(e._viewport.transform,t.transform);let d=Math.atan2(u[1],u[0]);const h=n[t.fontName];h.vertical&&(d+=Math.PI/2);const p=Math.hypot(u[2],u[3]),f=p*function(e,t){const n=a.get(e);if(n)return n;t.save(),t.font=`30px ${e}`;const r=t.measureText("");let i=r.fontBoundingBoxAscent,o=Math.abs(r.fontBoundingBoxDescent);if(i){t.restore();const n=i/(i+o);return a.set(e,n),n}t.strokeStyle="red",t.clearRect(0,0,s,s),t.strokeText("g",0,0);let l=t.getImageData(0,0,s,s).data;o=0;for(let e=l.length-1-3;e>=0;e-=4)if(l[e]>0){o=Math.ceil(e/4/s);break}t.clearRect(0,0,s,s),t.strokeText("A",0,s),l=t.getImageData(0,0,s,s).data,i=0;for(let e=0,t=l.length;e<t;e+=4)if(l[e]>0){i=s-Math.floor(e/4/s);break}if(t.restore(),i){const t=i/(i+o);return a.set(e,t),t}return a.set(e,.8),.8}(h.fontFamily,i);let g,m;0===d?(g=u[4],m=u[5]-f):(g=u[4]+f*Math.sin(d),m=u[5]-f*Math.cos(d)),l.style.left=`${g}px`,l.style.top=`${m}px`,l.style.fontSize=`${p}px`,l.style.fontFamily=h.fontFamily,c.fontSize=p,l.setAttribute("role","presentation"),l.textContent=t.str,l.dir=t.dir,e._fontInspectorEnabled&&(l.dataset.fontName=t.fontName),0!==d&&(c.angle=d*(180/Math.PI));let v=!1;if(t.str.length>1||e._enhanceTextSelection&&o.test(t.str))v=!0;else if(" "!==t.str&&t.transform[0]!==t.transform[3]){const e=Math.abs(t.transform[0]),n=Math.abs(t.transform[3]);e!==n&&Math.max(e,n)/Math.min(e,n)>1.5&&(v=!0)}if(v&&(h.vertical?c.canvasWidth=t.height*e._viewport.scale:c.canvasWidth=t.width*e._viewport.scale),e._textDivProperties.set(l,c),e._textContentStream&&e._layoutText(l),e._enhanceTextSelection&&c.hasText){let n=1,i=0;0!==d&&(n=Math.cos(d),i=Math.sin(d));const s=(h.vertical?t.height:t.width)*e._viewport.scale,a=p;let o,c;0!==d?(o=[n,i,-i,n,g,m],c=r.Util.getAxialAlignedBoundingBox([0,0,s,a],o)):c=[g,m,g+s,m+a],e._bounds.push({left:c[0],top:c[1],right:c[2],bottom:c[3],div:l,size:[s,a],m:o})}}function c(e){if(e._canceled)return;const t=e._textDivs,n=e._capability,r=t.length;if(r>1e5)return e._renderingDone=!0,void n.resolve();if(!e._textContentStream)for(let n=0;n<r;n++)e._layoutText(t[n]);e._renderingDone=!0,n.resolve()}function u(e,t,n){let r=0;for(let i=0;i<n;i++){const n=e[t++];n>0&&(r=r?Math.min(n,r):n)}return r}function d(e){const t=e._bounds,n=e._viewport,i=function(e,t,n){const r=n.map((function(e,t){return{x1:e.left,y1:e.top,x2:e.right,y2:e.bottom,index:t,x1New:void 0,x2New:void 0}}));h(e,r);const i=new Array(n.length);for(const e of r){const t=e.index;i[t]={left:e.x1New,top:0,right:e.x2New,bottom:0}}n.map((function(t,n){const s=i[n],a=r[n];a.x1=t.top,a.y1=e-s.right,a.x2=t.bottom,a.y2=e-s.left,a.index=n,a.x1New=void 0,a.x2New=void 0})),h(t,r);for(const e of r){const t=e.index;i[t].top=e.x1New,i[t].bottom=e.x2New}return i}(n.width,n.height,t);for(let n=0;n<i.length;n++){const s=t[n].div,a=e._textDivProperties.get(s);if(0===a.angle){a.paddingLeft=t[n].left-i[n].left,a.paddingTop=t[n].top-i[n].top,a.paddingRight=i[n].right-t[n].right,a.paddingBottom=i[n].bottom-t[n].bottom,e._textDivProperties.set(s,a);continue}const o=i[n],l=t[n],c=l.m,d=c[0],h=c[1],p=[[0,0],[0,l.size[1]],[l.size[0],0],l.size],f=new Float64Array(64);for(let e=0,t=p.length;e<t;e++){const t=r.Util.applyTransform(p[e],c);f[e+0]=d&&(o.left-t[0])/d,f[e+4]=h&&(o.top-t[1])/h,f[e+8]=d&&(o.right-t[0])/d,f[e+12]=h&&(o.bottom-t[1])/h,f[e+16]=h&&(o.left-t[0])/-h,f[e+20]=d&&(o.top-t[1])/d,f[e+24]=h&&(o.right-t[0])/-h,f[e+28]=d&&(o.bottom-t[1])/d,f[e+32]=d&&(o.left-t[0])/-d,f[e+36]=h&&(o.top-t[1])/-h,f[e+40]=d&&(o.right-t[0])/-d,f[e+44]=h&&(o.bottom-t[1])/-h,f[e+48]=h&&(o.left-t[0])/h,f[e+52]=d&&(o.top-t[1])/-d,f[e+56]=h&&(o.right-t[0])/h,f[e+60]=d&&(o.bottom-t[1])/-d}const g=1+Math.min(Math.abs(d),Math.abs(h));a.paddingLeft=u(f,32,16)/g,a.paddingTop=u(f,48,16)/g,a.paddingRight=u(f,0,16)/g,a.paddingBottom=u(f,16,16)/g,e._textDivProperties.set(s,a)}}function h(e,t){t.sort((function(e,t){return e.x1-t.x1||e.index-t.index}));const n=[{start:-1/0,end:1/0,boundary:{x1:-1/0,y1:-1/0,x2:0,y2:1/0,index:-1,x1New:0,x2New:0}}];for(const e of t){let t=0;for(;t<n.length&&n[t].end<=e.y1;)t++;let r,i,s=n.length-1;for(;s>=0&&n[s].start>=e.y2;)s--;let a,o,l=-1/0;for(a=t;a<=s;a++){let t;r=n[a],i=r.boundary,t=i.x2>e.x1?i.index>e.index?i.x1New:e.x1:void 0===i.x2New?(i.x2+e.x1)/2:i.x2New,t>l&&(l=t)}for(e.x1New=l,a=t;a<=s;a++)r=n[a],i=r.boundary,void 0===i.x2New?i.x2>e.x1?i.index>e.index&&(i.x2New=i.x2):i.x2New=l:i.x2New>l&&(i.x2New=Math.max(l,i.x2));const c=[];let u=null;for(a=t;a<=s;a++){r=n[a],i=r.boundary;const t=i.x2>e.x2?i:e;u===t?c.at(-1).end=r.end:(c.push({start:r.start,end:r.end,boundary:t}),u=t)}for(n[t].start<e.y1&&(c[0].start=e.y1,c.unshift({start:n[t].start,end:e.y1,boundary:n[t].boundary})),e.y2<n[s].end&&(c.at(-1).end=e.y2,c.push({start:e.y2,end:n[s].end,boundary:n[s].boundary})),a=t;a<=s;a++){if(r=n[a],i=r.boundary,void 0!==i.x2New)continue;let e=!1;for(o=t-1;!e&&o>=0&&n[o].start>=i.y1;o--)e=n[o].boundary===i;for(o=s+1;!e&&o<n.length&&n[o].end<=i.y2;o++)e=n[o].boundary===i;for(o=0;!e&&o<c.length;o++)e=c[o].boundary===i;e||(i.x2New=l)}Array.prototype.splice.apply(n,[t,s-t+1,...c])}for(const t of n){const n=t.boundary;void 0===n.x2New&&(n.x2New=Math.max(e,n.x2))}}class p{constructor({textContent:e,textContentStream:t,container:n,viewport:s,textDivs:a,textContentItemsStr:o,enhanceTextSelection:l}){l&&(0,i.deprecated)("The `enhanceTextSelection` functionality will be removed in the future."),this._textContent=e,this._textContentStream=t,this._container=n,this._document=n.ownerDocument,this._viewport=s,this._textDivs=a||[],this._textContentItemsStr=o||[],this._enhanceTextSelection=!!l,this._fontInspectorEnabled=!!globalThis.FontInspector?.enabled,this._reader=null,this._layoutTextLastFontSize=null,this._layoutTextLastFontFamily=null,this._layoutTextCtx=null,this._textDivProperties=new WeakMap,this._renderingDone=!1,this._canceled=!1,this._capability=(0,r.createPromiseCapability)(),this._renderTimer=null,this._bounds=[],this._devicePixelRatio=globalThis.devicePixelRatio||1,this._capability.promise.finally((()=>{this._enhanceTextSelection||(this._textDivProperties=null),this._layoutTextCtx&&(this._layoutTextCtx.canvas.width=0,this._layoutTextCtx.canvas.height=0,this._layoutTextCtx=null)})).catch((()=>{}))}get promise(){return this._capability.promise}cancel(){this._canceled=!0,this._reader&&(this._reader.cancel(new r.AbortException("TextLayer task cancelled.")).catch((()=>{})),this._reader=null),null!==this._renderTimer&&(clearTimeout(this._renderTimer),this._renderTimer=null),this._capability.reject(new Error("TextLayer task cancelled."))}_processItems(e,t){for(let n=0,r=e.length;n<r;n++)if(void 0!==e[n].str)this._textContentItemsStr.push(e[n].str),l(this,e[n],t,this._layoutTextCtx);else if("beginMarkedContentProps"===e[n].type||"beginMarkedContent"===e[n].type){const t=this._container;this._container=document.createElement("span"),this._container.classList.add("markedContent"),null!==e[n].id&&this._container.setAttribute("id",`${e[n].id}`),t.append(this._container)}else"endMarkedContent"===e[n].type&&(this._container=this._container.parentNode)}_layoutText(e){const t=this._textDivProperties.get(e);let n="";if(0!==t.canvasWidth&&t.hasText){const{fontFamily:r}=e.style,{fontSize:i}=t;i===this._layoutTextLastFontSize&&r===this._layoutTextLastFontFamily||(this._layoutTextCtx.font=`${i*this._devicePixelRatio}px ${r}`,this._layoutTextLastFontSize=i,this._layoutTextLastFontFamily=r);const{width:s}=this._layoutTextCtx.measureText(e.textContent);if(s>0){const e=this._devicePixelRatio*t.canvasWidth/s;this._enhanceTextSelection&&(t.scale=e),n=`scaleX(${e})`}}if(0!==t.angle&&(n=`rotate(${t.angle}deg) ${n}`),n.length>0&&(this._enhanceTextSelection&&(t.originalTransform=n),e.style.transform=n),t.hasText&&this._container.append(e),t.hasEOL){const e=document.createElement("br");e.setAttribute("role","presentation"),this._container.append(e)}}_render(e=0){const t=(0,r.createPromiseCapability)();let n=Object.create(null);const i=this._document.createElement("canvas");if(i.height=i.width=s,this._layoutTextCtx=i.getContext("2d",{alpha:!1}),this._textContent){const e=this._textContent.items,n=this._textContent.styles;this._processItems(e,n),t.resolve()}else{if(!this._textContentStream)throw new Error('Neither "textContent" nor "textContentStream" parameters specified.');{const e=()=>{this._reader.read().then((({value:r,done:i})=>{i?t.resolve():(Object.assign(n,r.styles),this._processItems(r.items,n),e())}),t.reject)};this._reader=this._textContentStream.getReader(),e()}}t.promise.then((()=>{n=null,e?this._renderTimer=setTimeout((()=>{c(this),this._renderTimer=null}),e):c(this)}),this._capability.reject)}expandTextDivs(e=!1){if(!this._enhanceTextSelection||!this._renderingDone)return;null!==this._bounds&&(d(this),this._bounds=null);const t=[],n=[];for(let r=0,i=this._textDivs.length;r<i;r++){const i=this._textDivs[r],s=this._textDivProperties.get(i);s.hasText&&(e?(t.length=0,n.length=0,s.originalTransform&&t.push(s.originalTransform),s.paddingTop>0?(n.push(`${s.paddingTop}px`),t.push(`translateY(${-s.paddingTop}px)`)):n.push(0),s.paddingRight>0?n.push(s.paddingRight/s.scale+"px"):n.push(0),s.paddingBottom>0?n.push(`${s.paddingBottom}px`):n.push(0),s.paddingLeft>0?(n.push(s.paddingLeft/s.scale+"px"),t.push(`translateX(${-s.paddingLeft/s.scale}px)`)):n.push(0),i.style.padding=n.join(" "),t.length&&(i.style.transform=t.join(" "))):(i.style.padding=null,i.style.transform=s.originalTransform))}}}t.TextLayerRenderTask=p},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SVGGraphics=void 0;var r=n(8),i=n(1),s=n(3);let a=class{constructor(){(0,i.unreachable)("Not implemented: SVGGraphics")}};t.SVGGraphics=a;{const o={fontStyle:"normal",fontWeight:"normal",fillColor:"#000000"},l="http://www.w3.org/XML/1998/namespace",c="http://www.w3.org/1999/xlink",u=["butt","round","square"],d=["miter","round","bevel"],h=function(e,t="",n=!1){if(URL.createObjectURL&&"undefined"!=typeof Blob&&!n)return URL.createObjectURL(new Blob([e],{type:t}));const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";let i=`data:${t};base64,`;for(let t=0,n=e.length;t<n;t+=3){const s=255&e[t],a=255&e[t+1],o=255&e[t+2];i+=r[s>>2]+r[(3&s)<<4|a>>4]+r[t+1<n?(15&a)<<2|o>>6:64]+r[t+2<n?63&o:64]}return i},p=function(){const e=new Uint8Array([137,80,78,71,13,10,26,10]),t=new Int32Array(256);for(let e=0;e<256;e++){let n=e;for(let e=0;e<8;e++)n=1&n?3988292384^n>>1&2147483647:n>>1&2147483647;t[e]=n}function n(e,n,r,i){let s=i;const a=n.length;r[s]=a>>24&255,r[s+1]=a>>16&255,r[s+2]=a>>8&255,r[s+3]=255&a,s+=4,r[s]=255&e.charCodeAt(0),r[s+1]=255&e.charCodeAt(1),r[s+2]=255&e.charCodeAt(2),r[s+3]=255&e.charCodeAt(3),s+=4,r.set(n,s),s+=n.length;const o=function(e,n,r){let i=-1;for(let s=n;s<r;s++){const n=255&(i^e[s]);i=i>>>8^t[n]}return-1^i}(r,i+4,s);r[s]=o>>24&255,r[s+1]=o>>16&255,r[s+2]=o>>8&255,r[s+3]=255&o}function r(e){let t=e.length;const n=65535,r=Math.ceil(t/n),i=new Uint8Array(2+t+5*r+4);let s=0;i[s++]=120,i[s++]=156;let a=0;for(;t>n;)i[s++]=0,i[s++]=255,i[s++]=255,i[s++]=0,i[s++]=0,i.set(e.subarray(a,a+n),s),s+=n,a+=n,t-=n;i[s++]=1,i[s++]=255&t,i[s++]=t>>8&255,i[s++]=255&~t,i[s++]=(65535&~t)>>8&255,i.set(e.subarray(a),s),s+=e.length-a;const o=function(e,t,n){let r=1,i=0;for(let s=t;s<n;++s)r=(r+(255&e[s]))%65521,i=(i+r)%65521;return i<<16|r}(e,0,e.length);return i[s++]=o>>24&255,i[s++]=o>>16&255,i[s++]=o>>8&255,i[s++]=255&o,i}function a(t,a,o,l){const c=t.width,u=t.height;let d,p,f;const g=t.data;switch(a){case i.ImageKind.GRAYSCALE_1BPP:p=0,d=1,f=c+7>>3;break;case i.ImageKind.RGB_24BPP:p=2,d=8,f=3*c;break;case i.ImageKind.RGBA_32BPP:p=6,d=8,f=4*c;break;default:throw new Error("invalid format")}const m=new Uint8Array((1+f)*u);let v=0,y=0;for(let e=0;e<u;++e)m[v++]=0,m.set(g.subarray(y,y+f),v),y+=f,v+=f;if(a===i.ImageKind.GRAYSCALE_1BPP&&l){v=0;for(let e=0;e<u;e++){v++;for(let e=0;e<f;e++)m[v++]^=255}}const b=new Uint8Array([c>>24&255,c>>16&255,c>>8&255,255&c,u>>24&255,u>>16&255,u>>8&255,255&u,d,p,0,0,0]),_=function(e){if(!s.isNodeJS)return r(e);try{let t;t=parseInt(process.versions.node)>=8?e:Buffer.from(e);const n=require$$5.deflateSync(t,{level:9});return n instanceof Uint8Array?n:new Uint8Array(n)}catch(e){(0,i.warn)("Not compressing PNG because zlib.deflateSync is unavailable: "+e)}return r(e)}(m),w=e.length+36+b.length+_.length,E=new Uint8Array(w);let S=0;return E.set(e,S),S+=e.length,n("IHDR",b,E,S),S+=12+b.length,n("IDATA",_,E,S),S+=12+_.length,n("IEND",new Uint8Array(0),E,S),h(E,"image/png",o)}return function(e,t,n){return a(e,void 0===e.kind?i.ImageKind.GRAYSCALE_1BPP:e.kind,t,n)}}();class f{constructor(){this.fontSizeScale=1,this.fontWeight=o.fontWeight,this.fontSize=0,this.textMatrix=i.IDENTITY_MATRIX,this.fontMatrix=i.FONT_IDENTITY_MATRIX,this.leading=0,this.textRenderingMode=i.TextRenderingMode.FILL,this.textMatrixScale=1,this.x=0,this.y=0,this.lineX=0,this.lineY=0,this.charSpacing=0,this.wordSpacing=0,this.textHScale=1,this.textRise=0,this.fillColor=o.fillColor,this.strokeColor="#000000",this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.lineJoin="",this.lineCap="",this.miterLimit=0,this.dashArray=[],this.dashPhase=0,this.dependencies=[],this.activeClipUrl=null,this.clipGroup=null,this.maskId=""}clone(){return Object.create(this)}setCurrentPoint(e,t){this.x=e,this.y=t}}function g(e){let t=[];const n=[];for(const r of e)"save"!==r.fn?"restore"===r.fn?t=n.pop():t.push(r):(t.push({fnId:92,fn:"group",items:[]}),n.push(t),t=t.at(-1).items);return t}function m(e){if(Number.isInteger(e))return e.toString();const t=e.toFixed(10);let n=t.length-1;if("0"!==t[n])return t;do{n--}while("0"===t[n]);return t.substring(0,"."===t[n]?n:n+1)}function v(e){if(0===e[4]&&0===e[5]){if(0===e[1]&&0===e[2])return 1===e[0]&&1===e[3]?"":`scale(${m(e[0])} ${m(e[3])})`;if(e[0]===e[3]&&e[1]===-e[2])return`rotate(${m(180*Math.acos(e[0])/Math.PI)})`}else if(1===e[0]&&0===e[1]&&0===e[2]&&1===e[3])return`translate(${m(e[4])} ${m(e[5])})`;return`matrix(${m(e[0])} ${m(e[1])} ${m(e[2])} ${m(e[3])} ${m(e[4])} ${m(e[5])})`}let y=0,b=0,_=0;t.SVGGraphics=a=class{constructor(e,t,n=!1){(0,r.deprecated)("The SVG back-end is no longer maintained and *may* be removed in the future."),this.svgFactory=new r.DOMSVGFactory,this.current=new f,this.transformMatrix=i.IDENTITY_MATRIX,this.transformStack=[],this.extraStack=[],this.commonObjs=e,this.objs=t,this.pendingClip=null,this.pendingEOFill=!1,this.embedFonts=!1,this.embeddedFonts=Object.create(null),this.cssStyle=null,this.forceDataSchema=!!n,this._operatorIdMapping=[];for(const e in i.OPS)this._operatorIdMapping[i.OPS[e]]=e}save(){this.transformStack.push(this.transformMatrix);const e=this.current;this.extraStack.push(e),this.current=e.clone()}restore(){this.transformMatrix=this.transformStack.pop(),this.current=this.extraStack.pop(),this.pendingClip=null,this.tgrp=null}group(e){this.save(),this.executeOpTree(e),this.restore()}loadDependencies(e){const t=e.fnArray,n=e.argsArray;for(let e=0,r=t.length;e<r;e++)if(t[e]===i.OPS.dependency)for(const t of n[e]){const e=t.startsWith("g_")?this.commonObjs:this.objs,n=new Promise((n=>{e.get(t,n)}));this.current.dependencies.push(n)}return Promise.all(this.current.dependencies)}transform(e,t,n,r,s,a){const o=[e,t,n,r,s,a];this.transformMatrix=i.Util.transform(this.transformMatrix,o),this.tgrp=null}getSVG(e,t){this.viewport=t;const n=this._initialize(t);return this.loadDependencies(e).then((()=>(this.transformMatrix=i.IDENTITY_MATRIX,this.executeOpTree(this.convertOpList(e)),n)))}convertOpList(e){const t=this._operatorIdMapping,n=e.argsArray,r=e.fnArray,i=[];for(let e=0,s=r.length;e<s;e++){const s=r[e];i.push({fnId:s,fn:t[s],args:n[e]})}return g(i)}executeOpTree(e){for(const t of e){const e=t.fn,n=t.fnId,r=t.args;switch(0|n){case i.OPS.beginText:this.beginText();break;case i.OPS.dependency:break;case i.OPS.setLeading:this.setLeading(r);break;case i.OPS.setLeadingMoveText:this.setLeadingMoveText(r[0],r[1]);break;case i.OPS.setFont:this.setFont(r);break;case i.OPS.showText:case i.OPS.showSpacedText:this.showText(r[0]);break;case i.OPS.endText:this.endText();break;case i.OPS.moveText:this.moveText(r[0],r[1]);break;case i.OPS.setCharSpacing:this.setCharSpacing(r[0]);break;case i.OPS.setWordSpacing:this.setWordSpacing(r[0]);break;case i.OPS.setHScale:this.setHScale(r[0]);break;case i.OPS.setTextMatrix:this.setTextMatrix(r[0],r[1],r[2],r[3],r[4],r[5]);break;case i.OPS.setTextRise:this.setTextRise(r[0]);break;case i.OPS.setTextRenderingMode:this.setTextRenderingMode(r[0]);break;case i.OPS.setLineWidth:this.setLineWidth(r[0]);break;case i.OPS.setLineJoin:this.setLineJoin(r[0]);break;case i.OPS.setLineCap:this.setLineCap(r[0]);break;case i.OPS.setMiterLimit:this.setMiterLimit(r[0]);break;case i.OPS.setFillRGBColor:this.setFillRGBColor(r[0],r[1],r[2]);break;case i.OPS.setStrokeRGBColor:this.setStrokeRGBColor(r[0],r[1],r[2]);break;case i.OPS.setStrokeColorN:this.setStrokeColorN(r);break;case i.OPS.setFillColorN:this.setFillColorN(r);break;case i.OPS.shadingFill:this.shadingFill(r[0]);break;case i.OPS.setDash:this.setDash(r[0],r[1]);break;case i.OPS.setRenderingIntent:this.setRenderingIntent(r[0]);break;case i.OPS.setFlatness:this.setFlatness(r[0]);break;case i.OPS.setGState:this.setGState(r[0]);break;case i.OPS.fill:this.fill();break;case i.OPS.eoFill:this.eoFill();break;case i.OPS.stroke:this.stroke();break;case i.OPS.fillStroke:this.fillStroke();break;case i.OPS.eoFillStroke:this.eoFillStroke();break;case i.OPS.clip:this.clip("nonzero");break;case i.OPS.eoClip:this.clip("evenodd");break;case i.OPS.paintSolidColorImageMask:this.paintSolidColorImageMask();break;case i.OPS.paintImageXObject:this.paintImageXObject(r[0]);break;case i.OPS.paintInlineImageXObject:this.paintInlineImageXObject(r[0]);break;case i.OPS.paintImageMaskXObject:this.paintImageMaskXObject(r[0]);break;case i.OPS.paintFormXObjectBegin:this.paintFormXObjectBegin(r[0],r[1]);break;case i.OPS.paintFormXObjectEnd:this.paintFormXObjectEnd();break;case i.OPS.closePath:this.closePath();break;case i.OPS.closeStroke:this.closeStroke();break;case i.OPS.closeFillStroke:this.closeFillStroke();break;case i.OPS.closeEOFillStroke:this.closeEOFillStroke();break;case i.OPS.nextLine:this.nextLine();break;case i.OPS.transform:this.transform(r[0],r[1],r[2],r[3],r[4],r[5]);break;case i.OPS.constructPath:this.constructPath(r[0],r[1]);break;case i.OPS.endPath:this.endPath();break;case 92:this.group(t.items);break;default:(0,i.warn)(`Unimplemented operator ${e}`)}}}setWordSpacing(e){this.current.wordSpacing=e}setCharSpacing(e){this.current.charSpacing=e}nextLine(){this.moveText(0,this.current.leading)}setTextMatrix(e,t,n,r,i,s){const a=this.current;a.textMatrix=a.lineMatrix=[e,t,n,r,i,s],a.textMatrixScale=Math.hypot(e,t),a.x=a.lineX=0,a.y=a.lineY=0,a.xcoords=[],a.ycoords=[],a.tspan=this.svgFactory.createElement("svg:tspan"),a.tspan.setAttributeNS(null,"font-family",a.fontFamily),a.tspan.setAttributeNS(null,"font-size",`${m(a.fontSize)}px`),a.tspan.setAttributeNS(null,"y",m(-a.y)),a.txtElement=this.svgFactory.createElement("svg:text"),a.txtElement.append(a.tspan)}beginText(){const e=this.current;e.x=e.lineX=0,e.y=e.lineY=0,e.textMatrix=i.IDENTITY_MATRIX,e.lineMatrix=i.IDENTITY_MATRIX,e.textMatrixScale=1,e.tspan=this.svgFactory.createElement("svg:tspan"),e.txtElement=this.svgFactory.createElement("svg:text"),e.txtgrp=this.svgFactory.createElement("svg:g"),e.xcoords=[],e.ycoords=[]}moveText(e,t){const n=this.current;n.x=n.lineX+=e,n.y=n.lineY+=t,n.xcoords=[],n.ycoords=[],n.tspan=this.svgFactory.createElement("svg:tspan"),n.tspan.setAttributeNS(null,"font-family",n.fontFamily),n.tspan.setAttributeNS(null,"font-size",`${m(n.fontSize)}px`),n.tspan.setAttributeNS(null,"y",m(-n.y))}showText(e){const t=this.current,n=t.font,r=t.fontSize;if(0===r)return;const s=t.fontSizeScale,a=t.charSpacing,c=t.wordSpacing,u=t.fontDirection,d=t.textHScale*u,h=n.vertical,p=h?1:-1,f=n.defaultVMetrics,g=r*t.fontMatrix[0];let y=0;for(const i of e){if(null===i){y+=u*c;continue}if("number"==typeof i){y+=p*i*r/1e3;continue}const e=(i.isSpace?c:0)+a,o=i.fontChar;let l,d,m,v=i.width;if(h){let e;const t=i.vmetric||f;e=i.vmetric?t[1]:.5*v,e=-e*g;const n=t[2]*g;v=t?-t[0]:v,l=e/s,d=(y+n)/s}else l=y/s,d=0;(i.isInFont||n.missingFile)&&(t.xcoords.push(t.x+l),h&&t.ycoords.push(-t.y+d),t.tspan.textContent+=o),m=h?v*g-e*u:v*g+e*u,y+=m}t.tspan.setAttributeNS(null,"x",t.xcoords.map(m).join(" ")),h?t.tspan.setAttributeNS(null,"y",t.ycoords.map(m).join(" ")):t.tspan.setAttributeNS(null,"y",m(-t.y)),h?t.y-=y:t.x+=y*d,t.tspan.setAttributeNS(null,"font-family",t.fontFamily),t.tspan.setAttributeNS(null,"font-size",`${m(t.fontSize)}px`),t.fontStyle!==o.fontStyle&&t.tspan.setAttributeNS(null,"font-style",t.fontStyle),t.fontWeight!==o.fontWeight&&t.tspan.setAttributeNS(null,"font-weight",t.fontWeight);const b=t.textRenderingMode&i.TextRenderingMode.FILL_STROKE_MASK;if(b===i.TextRenderingMode.FILL||b===i.TextRenderingMode.FILL_STROKE?(t.fillColor!==o.fillColor&&t.tspan.setAttributeNS(null,"fill",t.fillColor),t.fillAlpha<1&&t.tspan.setAttributeNS(null,"fill-opacity",t.fillAlpha)):t.textRenderingMode===i.TextRenderingMode.ADD_TO_PATH?t.tspan.setAttributeNS(null,"fill","transparent"):t.tspan.setAttributeNS(null,"fill","none"),b===i.TextRenderingMode.STROKE||b===i.TextRenderingMode.FILL_STROKE){const e=1/(t.textMatrixScale||1);this._setStrokeAttributes(t.tspan,e)}let _=t.textMatrix;0!==t.textRise&&(_=_.slice(),_[5]+=t.textRise),t.txtElement.setAttributeNS(null,"transform",`${v(_)} scale(${m(d)}, -1)`),t.txtElement.setAttributeNS(l,"xml:space","preserve"),t.txtElement.append(t.tspan),t.txtgrp.append(t.txtElement),this._ensureTransformGroup().append(t.txtElement)}setLeadingMoveText(e,t){this.setLeading(-t),this.moveText(e,t)}addFontStyle(e){if(!e.data)throw new Error('addFontStyle: No font data available, ensure that the "fontExtraProperties" API parameter is set.');this.cssStyle||(this.cssStyle=this.svgFactory.createElement("svg:style"),this.cssStyle.setAttributeNS(null,"type","text/css"),this.defs.append(this.cssStyle));const t=h(e.data,e.mimetype,this.forceDataSchema);this.cssStyle.textContent+=`@font-face { font-family: "${e.loadedName}"; src: url(${t}); }\n`}setFont(e){const t=this.current,n=this.commonObjs.get(e[0]);let r=e[1];t.font=n,!this.embedFonts||n.missingFile||this.embeddedFonts[n.loadedName]||(this.addFontStyle(n),this.embeddedFonts[n.loadedName]=n),t.fontMatrix=n.fontMatrix||i.FONT_IDENTITY_MATRIX;let s="normal";n.black?s="900":n.bold&&(s="bold");const a=n.italic?"italic":"normal";r<0?(r=-r,t.fontDirection=-1):t.fontDirection=1,t.fontSize=r,t.fontFamily=n.loadedName,t.fontWeight=s,t.fontStyle=a,t.tspan=this.svgFactory.createElement("svg:tspan"),t.tspan.setAttributeNS(null,"y",m(-t.y)),t.xcoords=[],t.ycoords=[]}endText(){const e=this.current;e.textRenderingMode&i.TextRenderingMode.ADD_TO_PATH_FLAG&&e.txtElement?.hasChildNodes()&&(e.element=e.txtElement,this.clip("nonzero"),this.endPath())}setLineWidth(e){e>0&&(this.current.lineWidth=e)}setLineCap(e){this.current.lineCap=u[e]}setLineJoin(e){this.current.lineJoin=d[e]}setMiterLimit(e){this.current.miterLimit=e}setStrokeAlpha(e){this.current.strokeAlpha=e}setStrokeRGBColor(e,t,n){this.current.strokeColor=i.Util.makeHexColor(e,t,n)}setFillAlpha(e){this.current.fillAlpha=e}setFillRGBColor(e,t,n){this.current.fillColor=i.Util.makeHexColor(e,t,n),this.current.tspan=this.svgFactory.createElement("svg:tspan"),this.current.xcoords=[],this.current.ycoords=[]}setStrokeColorN(e){this.current.strokeColor=this._makeColorN_Pattern(e)}setFillColorN(e){this.current.fillColor=this._makeColorN_Pattern(e)}shadingFill(e){const t=this.viewport.width,n=this.viewport.height,r=i.Util.inverseTransform(this.transformMatrix),s=i.Util.applyTransform([0,0],r),a=i.Util.applyTransform([0,n],r),o=i.Util.applyTransform([t,0],r),l=i.Util.applyTransform([t,n],r),c=Math.min(s[0],a[0],o[0],l[0]),u=Math.min(s[1],a[1],o[1],l[1]),d=Math.max(s[0],a[0],o[0],l[0]),h=Math.max(s[1],a[1],o[1],l[1]),p=this.svgFactory.createElement("svg:rect");p.setAttributeNS(null,"x",c),p.setAttributeNS(null,"y",u),p.setAttributeNS(null,"width",d-c),p.setAttributeNS(null,"height",h-u),p.setAttributeNS(null,"fill",this._makeShadingPattern(e)),this.current.fillAlpha<1&&p.setAttributeNS(null,"fill-opacity",this.current.fillAlpha),this._ensureTransformGroup().append(p)}_makeColorN_Pattern(e){return"TilingPattern"===e[0]?this._makeTilingPattern(e):this._makeShadingPattern(e)}_makeTilingPattern(e){const t=e[1],n=e[2],r=e[3]||i.IDENTITY_MATRIX,[s,a,o,l]=e[4],c=e[5],u=e[6],d=e[7],h="shading"+_++,[p,f,g,m]=i.Util.normalizeRect([...i.Util.applyTransform([s,a],r),...i.Util.applyTransform([o,l],r)]),[v,y]=i.Util.singularValueDecompose2dScale(r),b=c*v,w=u*y,E=this.svgFactory.createElement("svg:pattern");E.setAttributeNS(null,"id",h),E.setAttributeNS(null,"patternUnits","userSpaceOnUse"),E.setAttributeNS(null,"width",b),E.setAttributeNS(null,"height",w),E.setAttributeNS(null,"x",`${p}`),E.setAttributeNS(null,"y",`${f}`);const S=this.svg,C=this.transformMatrix,A=this.current.fillColor,P=this.current.strokeColor,x=this.svgFactory.create(g-p,m-f);if(this.svg=x,this.transformMatrix=r,2===d){const e=i.Util.makeHexColor(...t);this.current.fillColor=e,this.current.strokeColor=e}return this.executeOpTree(this.convertOpList(n)),this.svg=S,this.transformMatrix=C,this.current.fillColor=A,this.current.strokeColor=P,E.append(x.childNodes[0]),this.defs.append(E),`url(#${h})`}_makeShadingPattern(e){switch("string"==typeof e&&(e=this.objs.get(e)),e[0]){case"RadialAxial":const t="shading"+_++,n=e[3];let r;switch(e[1]){case"axial":const n=e[4],i=e[5];r=this.svgFactory.createElement("svg:linearGradient"),r.setAttributeNS(null,"id",t),r.setAttributeNS(null,"gradientUnits","userSpaceOnUse"),r.setAttributeNS(null,"x1",n[0]),r.setAttributeNS(null,"y1",n[1]),r.setAttributeNS(null,"x2",i[0]),r.setAttributeNS(null,"y2",i[1]);break;case"radial":const s=e[4],a=e[5],o=e[6],l=e[7];r=this.svgFactory.createElement("svg:radialGradient"),r.setAttributeNS(null,"id",t),r.setAttributeNS(null,"gradientUnits","userSpaceOnUse"),r.setAttributeNS(null,"cx",a[0]),r.setAttributeNS(null,"cy",a[1]),r.setAttributeNS(null,"r",l),r.setAttributeNS(null,"fx",s[0]),r.setAttributeNS(null,"fy",s[1]),r.setAttributeNS(null,"fr",o);break;default:throw new Error(`Unknown RadialAxial type: ${e[1]}`)}for(const e of n){const t=this.svgFactory.createElement("svg:stop");t.setAttributeNS(null,"offset",e[0]),t.setAttributeNS(null,"stop-color",e[1]),r.append(t)}return this.defs.append(r),`url(#${t})`;case"Mesh":return(0,i.warn)("Unimplemented pattern Mesh"),null;case"Dummy":return"hotpink";default:throw new Error(`Unknown IR type: ${e[0]}`)}}setDash(e,t){this.current.dashArray=e,this.current.dashPhase=t}constructPath(e,t){const n=this.current;let r=n.x,s=n.y,a=[],o=0;for(const n of e)switch(0|n){case i.OPS.rectangle:r=t[o++],s=t[o++];const e=r+t[o++],n=s+t[o++];a.push("M",m(r),m(s),"L",m(e),m(s),"L",m(e),m(n),"L",m(r),m(n),"Z");break;case i.OPS.moveTo:r=t[o++],s=t[o++],a.push("M",m(r),m(s));break;case i.OPS.lineTo:r=t[o++],s=t[o++],a.push("L",m(r),m(s));break;case i.OPS.curveTo:r=t[o+4],s=t[o+5],a.push("C",m(t[o]),m(t[o+1]),m(t[o+2]),m(t[o+3]),m(r),m(s)),o+=6;break;case i.OPS.curveTo2:a.push("C",m(r),m(s),m(t[o]),m(t[o+1]),m(t[o+2]),m(t[o+3])),r=t[o+2],s=t[o+3],o+=4;break;case i.OPS.curveTo3:r=t[o+2],s=t[o+3],a.push("C",m(t[o]),m(t[o+1]),m(r),m(s),m(r),m(s)),o+=4;break;case i.OPS.closePath:a.push("Z")}a=a.join(" "),n.path&&e.length>0&&e[0]!==i.OPS.rectangle&&e[0]!==i.OPS.moveTo?a=n.path.getAttributeNS(null,"d")+a:(n.path=this.svgFactory.createElement("svg:path"),this._ensureTransformGroup().append(n.path)),n.path.setAttributeNS(null,"d",a),n.path.setAttributeNS(null,"fill","none"),n.element=n.path,n.setCurrentPoint(r,s)}endPath(){const e=this.current;if(e.path=null,!this.pendingClip)return;if(!e.element)return void(this.pendingClip=null);const t="clippath"+y++,n=this.svgFactory.createElement("svg:clipPath");n.setAttributeNS(null,"id",t),n.setAttributeNS(null,"transform",v(this.transformMatrix));const r=e.element.cloneNode(!0);if("evenodd"===this.pendingClip?r.setAttributeNS(null,"clip-rule","evenodd"):r.setAttributeNS(null,"clip-rule","nonzero"),this.pendingClip=null,n.append(r),this.defs.append(n),e.activeClipUrl){e.clipGroup=null;for(const e of this.extraStack)e.clipGroup=null;n.setAttributeNS(null,"clip-path",e.activeClipUrl)}e.activeClipUrl=`url(#${t})`,this.tgrp=null}clip(e){this.pendingClip=e}closePath(){const e=this.current;if(e.path){const t=`${e.path.getAttributeNS(null,"d")}Z`;e.path.setAttributeNS(null,"d",t)}}setLeading(e){this.current.leading=-e}setTextRise(e){this.current.textRise=e}setTextRenderingMode(e){this.current.textRenderingMode=e}setHScale(e){this.current.textHScale=e/100}setRenderingIntent(e){}setFlatness(e){}setGState(e){for(const[t,n]of e)switch(t){case"LW":this.setLineWidth(n);break;case"LC":this.setLineCap(n);break;case"LJ":this.setLineJoin(n);break;case"ML":this.setMiterLimit(n);break;case"D":this.setDash(n[0],n[1]);break;case"RI":this.setRenderingIntent(n);break;case"FL":this.setFlatness(n);break;case"Font":this.setFont(n);break;case"CA":this.setStrokeAlpha(n);break;case"ca":this.setFillAlpha(n);break;default:(0,i.warn)(`Unimplemented graphic state operator ${t}`)}}fill(){const e=this.current;e.element&&(e.element.setAttributeNS(null,"fill",e.fillColor),e.element.setAttributeNS(null,"fill-opacity",e.fillAlpha),this.endPath())}stroke(){const e=this.current;e.element&&(this._setStrokeAttributes(e.element),e.element.setAttributeNS(null,"fill","none"),this.endPath())}_setStrokeAttributes(e,t=1){const n=this.current;let r=n.dashArray;1!==t&&r.length>0&&(r=r.map((function(e){return t*e}))),e.setAttributeNS(null,"stroke",n.strokeColor),e.setAttributeNS(null,"stroke-opacity",n.strokeAlpha),e.setAttributeNS(null,"stroke-miterlimit",m(n.miterLimit)),e.setAttributeNS(null,"stroke-linecap",n.lineCap),e.setAttributeNS(null,"stroke-linejoin",n.lineJoin),e.setAttributeNS(null,"stroke-width",m(t*n.lineWidth)+"px"),e.setAttributeNS(null,"stroke-dasharray",r.map(m).join(" ")),e.setAttributeNS(null,"stroke-dashoffset",m(t*n.dashPhase)+"px")}eoFill(){this.current.element&&this.current.element.setAttributeNS(null,"fill-rule","evenodd"),this.fill()}fillStroke(){this.stroke(),this.fill()}eoFillStroke(){this.current.element&&this.current.element.setAttributeNS(null,"fill-rule","evenodd"),this.fillStroke()}closeStroke(){this.closePath(),this.stroke()}closeFillStroke(){this.closePath(),this.fillStroke()}closeEOFillStroke(){this.closePath(),this.eoFillStroke()}paintSolidColorImageMask(){const e=this.svgFactory.createElement("svg:rect");e.setAttributeNS(null,"x","0"),e.setAttributeNS(null,"y","0"),e.setAttributeNS(null,"width","1px"),e.setAttributeNS(null,"height","1px"),e.setAttributeNS(null,"fill",this.current.fillColor),this._ensureTransformGroup().append(e)}paintImageXObject(e){const t=e.startsWith("g_")?this.commonObjs.get(e):this.objs.get(e);t?this.paintInlineImageXObject(t):(0,i.warn)(`Dependent image with object ID ${e} is not ready yet`)}paintInlineImageXObject(e,t){const n=e.width,r=e.height,i=p(e,this.forceDataSchema,!!t),s=this.svgFactory.createElement("svg:rect");s.setAttributeNS(null,"x","0"),s.setAttributeNS(null,"y","0"),s.setAttributeNS(null,"width",m(n)),s.setAttributeNS(null,"height",m(r)),this.current.element=s,this.clip("nonzero");const a=this.svgFactory.createElement("svg:image");a.setAttributeNS(c,"xlink:href",i),a.setAttributeNS(null,"x","0"),a.setAttributeNS(null,"y",m(-r)),a.setAttributeNS(null,"width",m(n)+"px"),a.setAttributeNS(null,"height",m(r)+"px"),a.setAttributeNS(null,"transform",`scale(${m(1/n)} ${m(-1/r)})`),t?t.append(a):this._ensureTransformGroup().append(a)}paintImageMaskXObject(e){const t=this.current,n=e.width,r=e.height,i=t.fillColor;t.maskId="mask"+b++;const s=this.svgFactory.createElement("svg:mask");s.setAttributeNS(null,"id",t.maskId);const a=this.svgFactory.createElement("svg:rect");a.setAttributeNS(null,"x","0"),a.setAttributeNS(null,"y","0"),a.setAttributeNS(null,"width",m(n)),a.setAttributeNS(null,"height",m(r)),a.setAttributeNS(null,"fill",i),a.setAttributeNS(null,"mask",`url(#${t.maskId})`),this.defs.append(s),this._ensureTransformGroup().append(a),this.paintInlineImageXObject(e,s)}paintFormXObjectBegin(e,t){if(Array.isArray(e)&&6===e.length&&this.transform(e[0],e[1],e[2],e[3],e[4],e[5]),t){const e=t[2]-t[0],n=t[3]-t[1],r=this.svgFactory.createElement("svg:rect");r.setAttributeNS(null,"x",t[0]),r.setAttributeNS(null,"y",t[1]),r.setAttributeNS(null,"width",m(e)),r.setAttributeNS(null,"height",m(n)),this.current.element=r,this.clip("nonzero"),this.endPath()}}paintFormXObjectEnd(){}_initialize(e){const t=this.svgFactory.create(e.width,e.height),n=this.svgFactory.createElement("svg:defs");t.append(n),this.defs=n;const r=this.svgFactory.createElement("svg:g");return r.setAttributeNS(null,"transform",v(e.transform)),t.append(r),this.svg=r,t}_ensureClipGroup(){if(!this.current.clipGroup){const e=this.svgFactory.createElement("svg:g");e.setAttributeNS(null,"clip-path",this.current.activeClipUrl),this.svg.append(e),this.current.clipGroup=e}return this.current.clipGroup}_ensureTransformGroup(){return this.tgrp||(this.tgrp=this.svgFactory.createElement("svg:g"),this.tgrp.setAttributeNS(null,"transform",v(this.transformMatrix)),this.current.activeClipUrl?this._ensureClipGroup().append(this.tgrp):this.svg.append(this.tgrp)),this.tgrp}}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFNodeStream=void 0;var r=n(1),i=n(33);const s=require$$5,a=require$$5,o=require$$5,l=require$$5,c=/^file:\/\/\/[a-zA-Z]:\//;t.PDFNodeStream=class{constructor(e){this.source=e,this.url=function(e){const t=l.parse(e);return"file:"===t.protocol||t.host?t:/^[a-z]:[/\\]/i.test(e)?l.parse(`file:///${e}`):(t.host||(t.protocol="file:"),t)}(e.url),this.isHttp="http:"===this.url.protocol||"https:"===this.url.protocol,this.isFsUrl="file:"===this.url.protocol,this.httpHeaders=this.isHttp&&e.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return(0,r.assert)(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new g(this):new p(this),this._fullRequestReader}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const n=this.isFsUrl?new m(this,e,t):new f(this,e,t);return this._rangeRequestReaders.push(n),n}cancelAllRequests(e){this._fullRequestReader&&this._fullRequestReader.cancel(e);for(const t of this._rangeRequestReaders.slice(0))t.cancel(e)}};class u{constructor(e){this._url=e.url,this._done=!1,this._storedError=null,this.onProgress=null;const t=e.source;this._contentLength=t.length,this._loaded=0,this._filename=null,this._disableRange=t.disableRange||!1,this._rangeChunkSize=t.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._isStreamingSupported=!t.disableStream,this._isRangeSupported=!t.disableRange,this._readableStream=null,this._readCapability=(0,r.createPromiseCapability)(),this._headersCapability=(0,r.createPromiseCapability)()}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(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();return null===e?(this._readCapability=(0,r.createPromiseCapability)(),this.read()):(this._loaded+=e.length,this.onProgress&&this.onProgress({loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(e).buffer,done:!1})}cancel(e){this._readableStream?this._readableStream.destroy(e):this._error(e)}_error(e){this._storedError=e,this._readCapability.resolve()}_setReadableStream(e){this._readableStream=e,e.on("readable",(()=>{this._readCapability.resolve()})),e.on("end",(()=>{e.destroy(),this._done=!0,this._readCapability.resolve()})),e.on("error",(e=>{this._error(e)})),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new r.AbortException("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class d{constructor(e){this._url=e.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=(0,r.createPromiseCapability)();const t=e.source;this._isStreamingSupported=!t.disableStream}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();return null===e?(this._readCapability=(0,r.createPromiseCapability)(),this.read()):(this._loaded+=e.length,this.onProgress&&this.onProgress({loaded:this._loaded}),{value:new Uint8Array(e).buffer,done:!1})}cancel(e){this._readableStream?this._readableStream.destroy(e):this._error(e)}_error(e){this._storedError=e,this._readCapability.resolve()}_setReadableStream(e){this._readableStream=e,e.on("readable",(()=>{this._readCapability.resolve()})),e.on("end",(()=>{e.destroy(),this._done=!0,this._readCapability.resolve()})),e.on("error",(e=>{this._error(e)})),this._storedError&&this._readableStream.destroy(this._storedError)}}function h(e,t){return{protocol:e.protocol,auth:e.auth,host:e.hostname,port:e.port,path:e.path,method:"GET",headers:t}}class p extends u{constructor(e){super(e);const t=t=>{if(404===t.statusCode){const e=new r.MissingPDFException(`Missing PDF "${this._url}".`);return this._storedError=e,void this._headersCapability.reject(e)}this._headersCapability.resolve(),this._setReadableStream(t);const n=e=>this._readableStream.headers[e.toLowerCase()],{allowRangeRequests:s,suggestedLength:a}=(0,i.validateRangeRequestCapabilities)({getResponseHeader:n,isHttp:e.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=s,this._contentLength=a||this._contentLength,this._filename=(0,i.extractFilenameFromHeader)(n)};this._request=null,"http:"===this._url.protocol?this._request=a.request(h(this._url,e.httpHeaders),t):this._request=o.request(h(this._url,e.httpHeaders),t),this._request.on("error",(e=>{this._storedError=e,this._headersCapability.reject(e)})),this._request.end()}}class f extends d{constructor(e,t,n){super(e),this._httpHeaders={};for(const t in e.httpHeaders){const n=e.httpHeaders[t];void 0!==n&&(this._httpHeaders[t]=n)}this._httpHeaders.Range=`bytes=${t}-${n-1}`;const i=e=>{if(404!==e.statusCode)this._setReadableStream(e);else{const e=new r.MissingPDFException(`Missing PDF "${this._url}".`);this._storedError=e}};this._request=null,"http:"===this._url.protocol?this._request=a.request(h(this._url,this._httpHeaders),i):this._request=o.request(h(this._url,this._httpHeaders),i),this._request.on("error",(e=>{this._storedError=e})),this._request.end()}}class g extends u{constructor(e){super(e);let t=decodeURIComponent(this._url.path);c.test(this._url.href)&&(t=t.replace(/^\//,"")),s.lstat(t,((e,n)=>{if(e)return"ENOENT"===e.code&&(e=new r.MissingPDFException(`Missing PDF "${t}".`)),this._storedError=e,void this._headersCapability.reject(e);this._contentLength=n.size,this._setReadableStream(s.createReadStream(t)),this._headersCapability.resolve()}))}}class m extends d{constructor(e,t,n){super(e);let r=decodeURIComponent(this._url.path);c.test(this._url.href)&&(r=r.replace(/^\//,"")),this._setReadableStream(s.createReadStream(r,{start:t,end:n-1}))}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createResponseStatusError=function(e,t){return 404===e||0===e&&t.startsWith("file:")?new r.MissingPDFException('Missing PDF "'+t+'".'):new r.UnexpectedResponseException(`Unexpected server response (${e}) while retrieving PDF "${t}".`,e)},t.extractFilenameFromHeader=function(e){const t=e("Content-Disposition");if(t){let e=(0,i.getFilenameFromContentDispositionHeader)(t);if(e.includes("%"))try{e=decodeURIComponent(e)}catch(e){}if((0,s.isPdfFile)(e))return e}return null},t.validateRangeRequestCapabilities=function({getResponseHeader:e,isHttp:t,rangeChunkSize:n,disableRange:r}){const i={allowRangeRequests:!1,suggestedLength:void 0},s=parseInt(e("Content-Length"),10);return Number.isInteger(s)?(i.suggestedLength=s,s<=2*n||r||!t||"bytes"!==e("Accept-Ranges")||"identity"!==(e("Content-Encoding")||"identity")||(i.allowRangeRequests=!0),i):i},t.validateResponseStatus=function(e){return 200===e||206===e};var r=n(1),i=n(34),s=n(8)},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getFilenameFromContentDispositionHeader=function(e){let t=!0,n=i("filename\\*","i").exec(e);if(n){n=n[1];let e=o(n);return e=unescape(e),e=l(e),e=c(e),a(e)}if(n=function(e){const t=[];let n;const r=i("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;null!==(n=r.exec(e));){let[,e,r,i]=n;if(e=parseInt(e,10),e in t){if(0===e)break}else t[e]=[r,i]}const s=[];for(let e=0;e<t.length&&e in t;++e){let[n,r]=t[e];r=o(r),n&&(r=unescape(r),0===e&&(r=l(r))),s.push(r)}return s.join("")}(e),n)return a(c(n));if(n=i("filename","i").exec(e),n){n=n[1];let e=o(n);return e=c(e),a(e)}function i(e,t){return new RegExp("(?:^|;)\\s*"+e+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',t)}function s(e,n){if(e){if(!/^[\x00-\xFF]+$/.test(n))return n;try{const i=new TextDecoder(e,{fatal:!0}),s=(0,r.stringToBytes)(n);n=i.decode(s),t=!1}catch(e){}}return n}function a(e){return t&&/[\x80-\xff]/.test(e)&&(e=s("utf-8",e),t&&(e=s("iso-8859-1",e))),e}function o(e){if(e.startsWith('"')){const t=e.slice(1).split('\\"');for(let e=0;e<t.length;++e){const n=t[e].indexOf('"');-1!==n&&(t[e]=t[e].slice(0,n),t.length=e+1),t[e]=t[e].replace(/\\(.)/g,"$1")}e=t.join('"')}return e}function l(e){const t=e.indexOf("'");return-1===t?e:s(e.slice(0,t),e.slice(t+1).replace(/^[^']*'/,""))}function c(e){return!e.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(e)?e:e.replace(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,(function(e,t,n,r){if("q"===n||"Q"===n)return s(t,r=(r=r.replace(/_/g," ")).replace(/=([0-9a-fA-F]{2})/g,(function(e,t){return String.fromCharCode(parseInt(t,16))})));try{r=atob(r)}catch(e){}return s(t,r)}))}return""};var r=n(1)},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFNetworkStream=void 0;var r=n(1),i=n(33);class s{constructor(e,t={}){this.url=e,this.isHttp=/^https?:/i.test(e),this.httpHeaders=this.isHttp&&t.httpHeaders||Object.create(null),this.withCredentials=t.withCredentials||!1,this.getXhr=t.getXhr||function(){return new XMLHttpRequest},this.currXhrId=0,this.pendingRequests=Object.create(null)}requestRange(e,t,n){const r={begin:e,end:t};for(const e in n)r[e]=n[e];return this.request(r)}requestFull(e){return this.request(e)}request(e){const t=this.getXhr(),n=this.currXhrId++,r=this.pendingRequests[n]={xhr:t};t.open("GET",this.url),t.withCredentials=this.withCredentials;for(const e in this.httpHeaders){const n=this.httpHeaders[e];void 0!==n&&t.setRequestHeader(e,n)}return this.isHttp&&"begin"in e&&"end"in e?(t.setRequestHeader("Range",`bytes=${e.begin}-${e.end-1}`),r.expectedStatus=206):r.expectedStatus=200,t.responseType="arraybuffer",e.onError&&(t.onerror=function(n){e.onError(t.status)}),t.onreadystatechange=this.onStateChange.bind(this,n),t.onprogress=this.onProgress.bind(this,n),r.onHeadersReceived=e.onHeadersReceived,r.onDone=e.onDone,r.onError=e.onError,r.onProgress=e.onProgress,t.send(null),n}onProgress(e,t){const n=this.pendingRequests[e];n&&n.onProgress?.(t)}onStateChange(e,t){const n=this.pendingRequests[e];if(!n)return;const i=n.xhr;if(i.readyState>=2&&n.onHeadersReceived&&(n.onHeadersReceived(),delete n.onHeadersReceived),4!==i.readyState)return;if(!(e in this.pendingRequests))return;if(delete this.pendingRequests[e],0===i.status&&this.isHttp)return void n.onError?.(i.status);const s=i.status||200;if((200!==s||206!==n.expectedStatus)&&s!==n.expectedStatus)return void n.onError?.(i.status);const a=function(e){const t=e.response;return"string"!=typeof t?t:(0,r.stringToBytes)(t).buffer}(i);if(206===s){const e=i.getResponseHeader("Content-Range"),t=/bytes (\d+)-(\d+)\/(\d+)/.exec(e);n.onDone({begin:parseInt(t[1],10),chunk:a})}else a?n.onDone({begin:0,chunk:a}):n.onError?.(i.status)}getRequestXhr(e){return this.pendingRequests[e].xhr}isPendingRequest(e){return e in this.pendingRequests}abortRequest(e){const t=this.pendingRequests[e].xhr;delete this.pendingRequests[e],t.abort()}}t.PDFNetworkStream=class{constructor(e){this._source=e,this._manager=new s(e.url,{httpHeaders:e.httpHeaders,withCredentials:e.withCredentials}),this._rangeChunkSize=e.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(e){const t=this._rangeRequestReaders.indexOf(e);t>=0&&this._rangeRequestReaders.splice(t,1)}getFullReader(){return(0,r.assert)(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new a(this._manager,this._source),this._fullRequestReader}getRangeReader(e,t){const n=new o(this._manager,e,t);return n.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(n),n}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(const t of this._rangeRequestReaders.slice(0))t.cancel(e)}};class a{constructor(e,t){this._manager=e;const n={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=t.url,this._fullRequestId=e.requestFull(n),this._headersReceivedCapability=(0,r.createPromiseCapability)(),this._disableRange=t.disableRange||!1,this._contentLength=t.length,this._rangeChunkSize=t.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._isStreamingSupported=!1,this._isRangeSupported=!1,this._cachedChunks=[],this._requests=[],this._done=!1,this._storedError=void 0,this._filename=null,this.onProgress=null}_onHeadersReceived(){const e=this._fullRequestId,t=this._manager.getRequestXhr(e),n=e=>t.getResponseHeader(e),{allowRangeRequests:r,suggestedLength:s}=(0,i.validateRangeRequestCapabilities)({getResponseHeader:n,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});r&&(this._isRangeSupported=!0),this._contentLength=s||this._contentLength,this._filename=(0,i.extractFilenameFromHeader)(n),this._isRangeSupported&&this._manager.abortRequest(e),this._headersReceivedCapability.resolve()}_onDone(e){if(e&&(this._requests.length>0?this._requests.shift().resolve({value:e.chunk,done:!1}):this._cachedChunks.push(e.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(e){this._storedError=(0,i.createResponseStatusError)(e,this._url),this._headersReceivedCapability.reject(this._storedError);for(const e of this._requests)e.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(e){this.onProgress?.({loaded:e.loaded,total:e.lengthComputable?e.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersReceivedCapability.promise}async read(){if(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};const e=(0,r.createPromiseCapability)();return this._requests.push(e),e.promise}cancel(e){this._done=!0,this._headersReceivedCapability.reject(e);for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class o{constructor(e,t,n){this._manager=e;const r={onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=e.url,this._requestId=e.requestRange(t,n,r),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_close(){this.onClosed?.(this)}_onDone(e){const t=e.chunk;this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunk=t,this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(e){this._storedError=(0,i.createResponseStatusError)(e,this._url);for(const e of this._requests)e.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(e){this.isStreamingSupported||this.onProgress?.({loaded:e.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(null!==this._queuedChunk){const e=this._queuedChunk;return this._queuedChunk=null,{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};const e=(0,r.createPromiseCapability)();return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFFetchStream=void 0;var r=n(1),i=n(33);function s(e,t,n){return{method:"GET",headers:e,signal:n.signal,mode:"cors",credentials:t?"include":"same-origin",redirect:"follow"}}function a(e){const t=new Headers;for(const n in e){const r=e[n];void 0!==r&&t.append(n,r)}return t}t.PDFFetchStream=class{constructor(e){this.source=e,this.isHttp=/^https?:/i.test(e.url),this.httpHeaders=this.isHttp&&e.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return(0,r.assert)(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new o(this),this._fullRequestReader}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const n=new l(this,e,t);return this._rangeRequestReaders.push(n),n}cancelAllRequests(e){this._fullRequestReader&&this._fullRequestReader.cancel(e);for(const t of this._rangeRequestReaders.slice(0))t.cancel(e)}};class o{constructor(e){this._stream=e,this._reader=null,this._loaded=0,this._filename=null;const t=e.source;this._withCredentials=t.withCredentials||!1,this._contentLength=t.length,this._headersCapability=(0,r.createPromiseCapability)(),this._disableRange=t.disableRange||!1,this._rangeChunkSize=t.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!t.disableStream,this._isRangeSupported=!t.disableRange,this._headers=a(this._stream.httpHeaders);const n=t.url;fetch(n,s(this._headers,this._withCredentials,this._abortController)).then((e=>{if(!(0,i.validateResponseStatus)(e.status))throw(0,i.createResponseStatusError)(e.status,n);this._reader=e.body.getReader(),this._headersCapability.resolve();const t=t=>e.headers.get(t),{allowRangeRequests:s,suggestedLength:a}=(0,i.validateRangeRequestCapabilities)({getResponseHeader:t,isHttp:this._stream.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=s,this._contentLength=a||this._contentLength,this._filename=(0,i.extractFilenameFromHeader)(t),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new r.AbortException("Streaming is disabled."))})).catch(this._headersCapability.reject),this.onProgress=null}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(){await this._headersCapability.promise;const{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:(this._loaded+=e.byteLength,this.onProgress&&this.onProgress({loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(e).buffer,done:!1})}cancel(e){this._reader&&this._reader.cancel(e),this._abortController.abort()}}class l{constructor(e,t,n){this._stream=e,this._reader=null,this._loaded=0;const o=e.source;this._withCredentials=o.withCredentials||!1,this._readCapability=(0,r.createPromiseCapability)(),this._isStreamingSupported=!o.disableStream,this._abortController=new AbortController,this._headers=a(this._stream.httpHeaders),this._headers.append("Range",`bytes=${t}-${n-1}`);const l=o.url;fetch(l,s(this._headers,this._withCredentials,this._abortController)).then((e=>{if(!(0,i.validateResponseStatus)(e.status))throw(0,i.createResponseStatusError)(e.status,l);this._readCapability.resolve(),this._reader=e.body.getReader()})).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._readCapability.promise;const{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:(this._loaded+=e.byteLength,this.onProgress&&this.onProgress({loaded:this._loaded}),{value:new Uint8Array(e).buffer,done:!1})}cancel(e){this._reader&&this._reader.cancel(e),this._abortController.abort()}}}],__webpack_module_cache__={};function __w_pdfjs_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var n=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e](n,n.exports,__w_pdfjs_require__),n.exports}var __webpack_exports__={};return(()=>{var e=__webpack_exports__;Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"AnnotationEditorLayer",{enumerable:!0,get:function(){return i.AnnotationEditorLayer}}),Object.defineProperty(e,"AnnotationEditorParamsType",{enumerable:!0,get:function(){return t.AnnotationEditorParamsType}}),Object.defineProperty(e,"AnnotationEditorType",{enumerable:!0,get:function(){return t.AnnotationEditorType}}),Object.defineProperty(e,"AnnotationEditorUIManager",{enumerable:!0,get:function(){return s.AnnotationEditorUIManager}}),Object.defineProperty(e,"AnnotationLayer",{enumerable:!0,get:function(){return a.AnnotationLayer}}),Object.defineProperty(e,"AnnotationMode",{enumerable:!0,get:function(){return t.AnnotationMode}}),Object.defineProperty(e,"CMapCompressionType",{enumerable:!0,get:function(){return t.CMapCompressionType}}),Object.defineProperty(e,"GlobalWorkerOptions",{enumerable:!0,get:function(){return o.GlobalWorkerOptions}}),Object.defineProperty(e,"InvalidPDFException",{enumerable:!0,get:function(){return t.InvalidPDFException}}),Object.defineProperty(e,"LoopbackPort",{enumerable:!0,get:function(){return n.LoopbackPort}}),Object.defineProperty(e,"MissingPDFException",{enumerable:!0,get:function(){return t.MissingPDFException}}),Object.defineProperty(e,"OPS",{enumerable:!0,get:function(){return t.OPS}}),Object.defineProperty(e,"PDFDataRangeTransport",{enumerable:!0,get:function(){return n.PDFDataRangeTransport}}),Object.defineProperty(e,"PDFDateString",{enumerable:!0,get:function(){return r.PDFDateString}}),Object.defineProperty(e,"PDFWorker",{enumerable:!0,get:function(){return n.PDFWorker}}),Object.defineProperty(e,"PasswordResponses",{enumerable:!0,get:function(){return t.PasswordResponses}}),Object.defineProperty(e,"PermissionFlag",{enumerable:!0,get:function(){return t.PermissionFlag}}),Object.defineProperty(e,"PixelsPerInch",{enumerable:!0,get:function(){return r.PixelsPerInch}}),Object.defineProperty(e,"RenderingCancelledException",{enumerable:!0,get:function(){return r.RenderingCancelledException}}),Object.defineProperty(e,"SVGGraphics",{enumerable:!0,get:function(){return u.SVGGraphics}}),Object.defineProperty(e,"UNSUPPORTED_FEATURES",{enumerable:!0,get:function(){return t.UNSUPPORTED_FEATURES}}),Object.defineProperty(e,"UnexpectedResponseException",{enumerable:!0,get:function(){return t.UnexpectedResponseException}}),Object.defineProperty(e,"Util",{enumerable:!0,get:function(){return t.Util}}),Object.defineProperty(e,"VerbosityLevel",{enumerable:!0,get:function(){return t.VerbosityLevel}}),Object.defineProperty(e,"XfaLayer",{enumerable:!0,get:function(){return d.XfaLayer}}),Object.defineProperty(e,"build",{enumerable:!0,get:function(){return n.build}}),Object.defineProperty(e,"createPromiseCapability",{enumerable:!0,get:function(){return t.createPromiseCapability}}),Object.defineProperty(e,"createValidAbsoluteUrl",{enumerable:!0,get:function(){return t.createValidAbsoluteUrl}}),Object.defineProperty(e,"getDocument",{enumerable:!0,get:function(){return n.getDocument}}),Object.defineProperty(e,"getFilenameFromUrl",{enumerable:!0,get:function(){return r.getFilenameFromUrl}}),Object.defineProperty(e,"getPdfFilenameFromUrl",{enumerable:!0,get:function(){return r.getPdfFilenameFromUrl}}),Object.defineProperty(e,"getXfaPageViewport",{enumerable:!0,get:function(){return r.getXfaPageViewport}}),Object.defineProperty(e,"isPdfFile",{enumerable:!0,get:function(){return r.isPdfFile}}),Object.defineProperty(e,"loadScript",{enumerable:!0,get:function(){return r.loadScript}}),Object.defineProperty(e,"renderTextLayer",{enumerable:!0,get:function(){return c.renderTextLayer}}),Object.defineProperty(e,"shadow",{enumerable:!0,get:function(){return t.shadow}}),Object.defineProperty(e,"version",{enumerable:!0,get:function(){return n.version}});var t=__w_pdfjs_require__(1),n=__w_pdfjs_require__(4),r=__w_pdfjs_require__(8),i=__w_pdfjs_require__(22),s=__w_pdfjs_require__(7),a=__w_pdfjs_require__(27),o=__w_pdfjs_require__(15),l=__w_pdfjs_require__(3),c=__w_pdfjs_require__(30),u=__w_pdfjs_require__(31),d=__w_pdfjs_require__(29);if(l.isNodeJS){const{PDFNodeStream:e}=__w_pdfjs_require__(32);(0,n.setPDFNetworkStreamFactory)((t=>new e(t)))}else{const{PDFNetworkStream:e}=__w_pdfjs_require__(35),{PDFFetchStream:t}=__w_pdfjs_require__(36);(0,n.setPDFNetworkStreamFactory)((n=>(0,r.isValidFetchUrl)(n.url)?new t(n):new e(n)))}})(),__webpack_exports__})(),module.exports=factory()})(pdf);var pdfjsLib=getDefaultExportFromCjs(pdf.exports),pdf_viewer={exports:{}},factory;globalThis,factory=()=>(()=>{var e=[,(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DefaultXfaLayerFactory=t.DefaultTextLayerFactory=t.DefaultStructTreeLayerFactory=t.DefaultAnnotationLayerFactory=t.DefaultAnnotationEditorLayerFactory=void 0;var r=n(2),i=n(5),s=n(4),a=n(6),o=n(8),l=n(9),c=n(10);t.DefaultAnnotationLayerFactory=class{createAnnotationLayerBuilder({pageDiv:e,pdfPage:t,annotationStorage:n=null,imageResourcesPath:r="",renderForms:o=!0,l10n:l=s.NullL10n,enableScripting:c=!1,hasJSActionsPromise:u=null,mouseState:d=null,fieldObjectsPromise:h=null,annotationCanvasMap:p=null,accessibilityManager:f=null}){return new i.AnnotationLayerBuilder({pageDiv:e,pdfPage:t,imageResourcesPath:r,renderForms:o,linkService:new a.SimpleLinkService,l10n:l,annotationStorage:n,enableScripting:c,hasJSActionsPromise:u,fieldObjectsPromise:h,mouseState:d,annotationCanvasMap:p,accessibilityManager:f})}},t.DefaultAnnotationEditorLayerFactory=class{createAnnotationEditorLayerBuilder({uiManager:e=null,pageDiv:t,pdfPage:n,accessibilityManager:i=null,l10n:s,annotationStorage:a=null}){return new r.AnnotationEditorLayerBuilder({uiManager:e,pageDiv:t,pdfPage:n,accessibilityManager:i,l10n:s,annotationStorage:a})}},t.DefaultStructTreeLayerFactory=class{createStructTreeLayerBuilder({pdfPage:e}){return new o.StructTreeLayerBuilder({pdfPage:e})}},t.DefaultTextLayerFactory=class{createTextLayerBuilder({textLayerDiv:e,pageIndex:t,viewport:n,enhanceTextSelection:r=!1,eventBus:i,highlighter:s,accessibilityManager:a=null}){return new l.TextLayerBuilder({textLayerDiv:e,pageIndex:t,viewport:n,enhanceTextSelection:r,eventBus:i,highlighter:s,accessibilityManager:a})}},t.DefaultXfaLayerFactory=class{createXfaLayerBuilder({pageDiv:e,pdfPage:t,annotationStorage:n=null}){return new c.XfaLayerBuilder({pageDiv:e,pdfPage:t,annotationStorage:n,linkService:new a.SimpleLinkService})}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AnnotationEditorLayerBuilder=void 0;var r=n(3),i=n(4);t.AnnotationEditorLayerBuilder=class{#pe;constructor(e){this.pageDiv=e.pageDiv,this.pdfPage=e.pdfPage,this.annotationStorage=e.annotationStorage||null,this.accessibilityManager=e.accessibilityManager,this.l10n=e.l10n||i.NullL10n,this.annotationEditorLayer=null,this.div=null,this._cancelled=!1,this.#pe=e.uiManager}async render(e,t="display"){if("display"!==t)return;if(this._cancelled)return;const n=e.clone({dontFlip:!0});if(this.div)return this.annotationEditorLayer.update({viewport:n}),void this.show();this.div=document.createElement("div"),this.div.className="annotationEditorLayer",this.div.tabIndex=0,this.pageDiv.append(this.div),this.annotationEditorLayer=new r.AnnotationEditorLayer({uiManager:this.#pe,div:this.div,annotationStorage:this.annotationStorage,accessibilityManager:this.accessibilityManager,pageIndex:this.pdfPage._pageIndex,l10n:this.l10n,viewport:n});const i={viewport:n,div:this.div,annotations:null,intent:t};this.annotationEditorLayer.render(i)}cancel(){this._cancelled=!0,this.destroy()}hide(){this.div&&(this.div.hidden=!0)}show(){this.div&&(this.div.hidden=!1)}destroy(){this.div&&(this.pageDiv=null,this.annotationEditorLayer.destroy(),this.div.remove())}}},e=>{let t;t="undefined"!=typeof window&&window["pdfjs-dist/build/pdf"]?window["pdfjs-dist/build/pdf"]:pdf.exports,e.exports=t},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.NullL10n=void 0,t.fixupLangCode=function(e){return i[e?.toLowerCase()]||e},t.getL10nFallback=r;const n={of_pages:"of {{pagesCount}}",page_of_pages:"({{pageNumber}} of {{pagesCount}})",document_properties_kb:"{{size_kb}} KB ({{size_b}} bytes)",document_properties_mb:"{{size_mb}} MB ({{size_b}} bytes)",document_properties_date_string:"{{date}}, {{time}}",document_properties_page_size_unit_inches:"in",document_properties_page_size_unit_millimeters:"mm",document_properties_page_size_orientation_portrait:"portrait",document_properties_page_size_orientation_landscape:"landscape",document_properties_page_size_name_a3:"A3",document_properties_page_size_name_a4:"A4",document_properties_page_size_name_letter:"Letter",document_properties_page_size_name_legal:"Legal",document_properties_page_size_dimension_string:"{{width}} × {{height}} {{unit}} ({{orientation}})",document_properties_page_size_dimension_name_string:"{{width}} × {{height}} {{unit}} ({{name}}, {{orientation}})",document_properties_linearized_yes:"Yes",document_properties_linearized_no:"No",print_progress_percent:"{{progress}}%","toggle_sidebar.title":"Toggle Sidebar","toggle_sidebar_notification2.title":"Toggle Sidebar (document contains outline/attachments/layers)",additional_layers:"Additional Layers",page_landmark:"Page {{page}}",thumb_page_title:"Page {{page}}",thumb_page_canvas:"Thumbnail of Page {{page}}",find_reached_top:"Reached top of document, continued from bottom",find_reached_bottom:"Reached end of document, continued from top","find_match_count[one]":"{{current}} of {{total}} match","find_match_count[other]":"{{current}} of {{total}} matches","find_match_count_limit[one]":"More than {{limit}} match","find_match_count_limit[other]":"More than {{limit}} matches",find_not_found:"Phrase not found",error_version_info:"PDF.js v{{version}} (build: {{build}})",error_message:"Message: {{message}}",error_stack:"Stack: {{stack}}",error_file:"File: {{file}}",error_line:"Line: {{line}}",rendering_error:"An error occurred while rendering the page.",page_scale_width:"Page Width",page_scale_fit:"Page Fit",page_scale_auto:"Automatic Zoom",page_scale_actual:"Actual Size",page_scale_percent:"{{scale}}%",loading:"Loading…",loading_error:"An error occurred while loading the PDF.",invalid_file_error:"Invalid or corrupted PDF file.",missing_file_error:"Missing PDF file.",unexpected_response_error:"Unexpected server response.",printing_not_supported:"Warning: Printing is not fully supported by this browser.",printing_not_ready:"Warning: The PDF is not fully loaded for printing.",web_fonts_disabled:"Web fonts are disabled: unable to use embedded PDF fonts.",free_text_default_content:"Enter text…",editor_free_text_aria_label:"FreeText Editor",editor_ink_aria_label:"Ink Editor",editor_ink_canvas_aria_label:"User-created image"};function r(e,t){switch(e){case"find_match_count":e=`find_match_count[${1===t.total?"one":"other"}]`;break;case"find_match_count_limit":e=`find_match_count_limit[${1===t.limit?"one":"other"}]`}return n[e]||""}const i={en:"en-US",es:"es-ES",fy:"fy-NL",ga:"ga-IE",gu:"gu-IN",hi:"hi-IN",hy:"hy-AM",nb:"nb-NO",ne:"ne-NP",nn:"nn-NO",pa:"pa-IN",pt:"pt-PT",sv:"sv-SE",zh:"zh-CN"},s={getLanguage:async()=>"en-us",getDirection:async()=>"ltr",get:async(e,t=null,n=r(e,t))=>function(e,t){return t?e.replace(/\{\{\s*(\w+)\s*\}\}/g,((e,n)=>n in t?t[n]:"{{"+n+"}}")):e}(n,t),async translate(e){}};t.NullL10n=s},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AnnotationLayerBuilder=void 0;var r=n(3),i=n(4);t.AnnotationLayerBuilder=class{constructor({pageDiv:e,pdfPage:t,linkService:n,downloadManager:r,annotationStorage:s=null,imageResourcesPath:a="",renderForms:o=!0,l10n:l=i.NullL10n,enableScripting:c=!1,hasJSActionsPromise:u=null,fieldObjectsPromise:d=null,mouseState:h=null,annotationCanvasMap:p=null,accessibilityManager:f=null}){this.pageDiv=e,this.pdfPage=t,this.linkService=n,this.downloadManager=r,this.imageResourcesPath=a,this.renderForms=o,this.l10n=l,this.annotationStorage=s,this.enableScripting=c,this._hasJSActionsPromise=u,this._fieldObjectsPromise=d,this._mouseState=h,this._annotationCanvasMap=p,this._accessibilityManager=f,this.div=null,this._cancelled=!1}async render(e,t="display"){const[n,i=!1,s=null]=await Promise.all([this.pdfPage.getAnnotations({intent:t}),this._hasJSActionsPromise,this._fieldObjectsPromise]);if(this._cancelled||0===n.length)return;const a={viewport:e.clone({dontFlip:!0}),div:this.div,annotations:n,page:this.pdfPage,imageResourcesPath:this.imageResourcesPath,renderForms:this.renderForms,linkService:this.linkService,downloadManager:this.downloadManager,annotationStorage:this.annotationStorage,enableScripting:this.enableScripting,hasJSActions:i,fieldObjects:s,mouseState:this._mouseState,annotationCanvasMap:this._annotationCanvasMap,accessibilityManager:this._accessibilityManager};this.div?r.AnnotationLayer.update(a):(this.div=document.createElement("div"),this.div.className="annotationLayer",this.pageDiv.append(this.div),a.div=this.div,r.AnnotationLayer.render(a),this.l10n.translate(this.div))}cancel(){this._cancelled=!0}hide(){this.div&&(this.div.hidden=!0)}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SimpleLinkService=t.PDFLinkService=t.LinkTarget=void 0;var r=n(7);const i={NONE:0,SELF:1,BLANK:2,PARENT:3,TOP:4};function s(e,{url:t,target:n,rel:s,enabled:a=!0}={}){if(!t||"string"!=typeof t)throw new Error('A valid "url" parameter must provided.');const o=(0,r.removeNullCharacters)(t);a?e.href=e.title=o:(e.href="",e.title=`Disabled: ${o}`,e.onclick=()=>!1);let l="";switch(n){case i.NONE:break;case i.SELF:l="_self";break;case i.BLANK:l="_blank";break;case i.PARENT:l="_parent";break;case i.TOP:l="_top"}e.target=l,e.rel="string"==typeof s?s:"noopener noreferrer nofollow"}t.LinkTarget=i;class a{#ft=new Map;constructor({eventBus:e,externalLinkTarget:t=null,externalLinkRel:n=null,ignoreDestinationZoom:r=!1}={}){this.eventBus=e,this.externalLinkTarget=t,this.externalLinkRel=n,this.externalLinkEnabled=!0,this._ignoreDestinationZoom=r,this.baseUrl=null,this.pdfDocument=null,this.pdfViewer=null,this.pdfHistory=null}setDocument(e,t=null){this.baseUrl=t,this.pdfDocument=e,this.#ft.clear()}setViewer(e){this.pdfViewer=e}setHistory(e){this.pdfHistory=e}get pagesCount(){return this.pdfDocument?this.pdfDocument.numPages:0}get page(){return this.pdfViewer.currentPageNumber}set page(e){this.pdfViewer.currentPageNumber=e}get rotation(){return this.pdfViewer.pagesRotation}set rotation(e){this.pdfViewer.pagesRotation=e}#gt(e,t=null,n){const r=n[0];let i;if("object"==typeof r&&null!==r){if(i=this._cachedPageNumber(r),!i)return void this.pdfDocument.getPageIndex(r).then((i=>{this.cachePageRef(i+1,r),this.#gt(e,t,n)})).catch((()=>{console.error(`PDFLinkService.#goToDestinationHelper: "${r}" is not a valid page reference, for dest="${e}".`)}))}else{if(!Number.isInteger(r))return void console.error(`PDFLinkService.#goToDestinationHelper: "${r}" is not a valid destination reference, for dest="${e}".`);i=r+1}!i||i<1||i>this.pagesCount?console.error(`PDFLinkService.#goToDestinationHelper: "${i}" is not a valid page number, for dest="${e}".`):(this.pdfHistory&&(this.pdfHistory.pushCurrentPosition(),this.pdfHistory.push({namedDest:t,explicitDest:n,pageNumber:i})),this.pdfViewer.scrollPageIntoView({pageNumber:i,destArray:n,ignoreDestinationZoom:this._ignoreDestinationZoom}))}async goToDestination(e){if(!this.pdfDocument)return;let t,n;"string"==typeof e?(t=e,n=await this.pdfDocument.getDestination(e)):(t=null,n=await e),Array.isArray(n)?this.#gt(e,t,n):console.error(`PDFLinkService.goToDestination: "${n}" is not a valid destination array, for dest="${e}".`)}goToPage(e){if(!this.pdfDocument)return;const t="string"==typeof e&&this.pdfViewer.pageLabelToPageNumber(e)||0|e;Number.isInteger(t)&&t>0&&t<=this.pagesCount?(this.pdfHistory&&(this.pdfHistory.pushCurrentPosition(),this.pdfHistory.pushPage(t)),this.pdfViewer.scrollPageIntoView({pageNumber:t})):console.error(`PDFLinkService.goToPage: "${e}" is not a valid page.`)}addLinkAttributes(e,t,n=!1){s(e,{url:t,target:n?i.BLANK:this.externalLinkTarget,rel:this.externalLinkRel,enabled:this.externalLinkEnabled})}getDestinationHash(e){if("string"==typeof e){if(e.length>0)return this.getAnchorUrl("#"+escape(e))}else if(Array.isArray(e)){const t=JSON.stringify(e);if(t.length>0)return this.getAnchorUrl("#"+escape(t))}return this.getAnchorUrl("")}getAnchorUrl(e){return(this.baseUrl||"")+e}setHash(e){if(!this.pdfDocument)return;let t,n;if(e.includes("=")){const i=(0,r.parseQueryString)(e);if(i.has("search")&&this.eventBus.dispatch("findfromurlhash",{source:this,query:i.get("search").replace(/"/g,""),phraseSearch:"true"===i.get("phrase")}),i.has("page")&&(t=0|i.get("page")||1),i.has("zoom")){const e=i.get("zoom").split(","),t=e[0],r=parseFloat(t);t.includes("Fit")?"Fit"===t||"FitB"===t?n=[null,{name:t}]:"FitH"===t||"FitBH"===t||"FitV"===t||"FitBV"===t?n=[null,{name:t},e.length>1?0|e[1]:null]:"FitR"===t?5!==e.length?console.error('PDFLinkService.setHash: Not enough parameters for "FitR".'):n=[null,{name:t},0|e[1],0|e[2],0|e[3],0|e[4]]:console.error(`PDFLinkService.setHash: "${t}" is not a valid zoom value.`):n=[null,{name:"XYZ"},e.length>1?0|e[1]:null,e.length>2?0|e[2]:null,r?r/100:t]}n?this.pdfViewer.scrollPageIntoView({pageNumber:t||this.page,destArray:n,allowNegativeOffset:!0}):t&&(this.page=t),i.has("pagemode")&&this.eventBus.dispatch("pagemode",{source:this,mode:i.get("pagemode")}),i.has("nameddest")&&this.goToDestination(i.get("nameddest"))}else{n=unescape(e);try{n=JSON.parse(n),Array.isArray(n)||(n=n.toString())}catch(e){}if("string"==typeof n||a.#mt(n))return void this.goToDestination(n);console.error(`PDFLinkService.setHash: "${unescape(e)}" is not a valid destination.`)}}executeNamedAction(e){switch(e){case"GoBack":this.pdfHistory?.back();break;case"GoForward":this.pdfHistory?.forward();break;case"NextPage":this.pdfViewer.nextPage();break;case"PrevPage":this.pdfViewer.previousPage();break;case"LastPage":this.page=this.pagesCount;break;case"FirstPage":this.page=1}this.eventBus.dispatch("namedaction",{source:this,action:e})}cachePageRef(e,t){if(!t)return;const n=0===t.gen?`${t.num}R`:`${t.num}R${t.gen}`;this.#ft.set(n,e)}_cachedPageNumber(e){if(!e)return null;const t=0===e.gen?`${e.num}R`:`${e.num}R${e.gen}`;return this.#ft.get(t)||null}isPageVisible(e){return this.pdfViewer.isPageVisible(e)}isPageCached(e){return this.pdfViewer.isPageCached(e)}static#mt(e){if(!Array.isArray(e))return!1;const t=e.length;if(t<2)return!1;const n=e[0];if(!("object"==typeof n&&Number.isInteger(n.num)&&Number.isInteger(n.gen)||Number.isInteger(n)&&n>=0))return!1;const r=e[1];if("object"!=typeof r||"string"!=typeof r.name)return!1;let i=!0;switch(r.name){case"XYZ":if(5!==t)return!1;break;case"Fit":case"FitB":return 2===t;case"FitH":case"FitBH":case"FitV":case"FitBV":if(3!==t)return!1;break;case"FitR":if(6!==t)return!1;i=!1;break;default:return!1}for(let n=2;n<t;n++){const t=e[n];if(!("number"==typeof t||i&&null===t))return!1}return!0}}t.PDFLinkService=a,t.SimpleLinkService=class{constructor(){this.externalLinkEnabled=!0}get pagesCount(){return 0}get page(){return 0}set page(e){}get rotation(){return 0}set rotation(e){}async goToDestination(e){}goToPage(e){}addLinkAttributes(e,t,n=!1){s(e,{url:t,enabled:this.externalLinkEnabled})}getDestinationHash(e){return"#"}getAnchorUrl(e){return"#"}setHash(e){}executeNamedAction(e){}cachePageRef(e,t){}isPageVisible(e){return!0}isPageCached(e){return!0}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.animationStarted=t.VERTICAL_PADDING=t.UNKNOWN_SCALE=t.TextLayerMode=t.SpreadMode=t.SidebarView=t.ScrollMode=t.SCROLLBAR_PADDING=t.RenderingStates=t.RendererType=t.ProgressBar=t.PresentationModeState=t.OutputScale=t.MIN_SCALE=t.MAX_SCALE=t.MAX_AUTO_SCALE=t.DEFAULT_SCALE_VALUE=t.DEFAULT_SCALE_DELTA=t.DEFAULT_SCALE=t.AutoPrintRegExp=void 0,t.apiPageLayoutToViewerModes=function(e){let t=r.VERTICAL,n=i.NONE;switch(e){case"SinglePage":t=r.PAGE;break;case"OneColumn":break;case"TwoPageLeft":t=r.PAGE;case"TwoColumnLeft":n=i.ODD;break;case"TwoPageRight":t=r.PAGE;case"TwoColumnRight":n=i.EVEN}return{scrollMode:t,spreadMode:n}},t.apiPageModeToSidebarView=function(e){switch(e){case"UseNone":return n.NONE;case"UseThumbs":return n.THUMBS;case"UseOutlines":return n.OUTLINE;case"UseAttachments":return n.ATTACHMENTS;case"UseOC":return n.LAYERS}return n.NONE},t.approximateFraction=function(e){if(Math.floor(e)===e)return[e,1];const t=1/e;if(t>8)return[1,8];if(Math.floor(t)===t)return[1,t];const n=e>1?t:e;let r,i=0,s=1,a=1,o=1;for(;;){const e=i+a,t=s+o;if(t>8)break;n<=e/t?(a=e,o=t):(i=e,s=t)}return r=n-i/s<a/o-n?n===e?[i,s]:[s,i]:n===e?[a,o]:[o,a],r},t.backtrackBeforeAllVisibleElements=l,t.binarySearchFirstItem=o,t.docStyle=void 0,t.getActiveOrFocusedElement=function(){let e=document,t=e.activeElement||e.querySelector(":focus");for(;t?.shadowRoot;)e=t.shadowRoot,t=e.activeElement||e.querySelector(":focus");return t},t.getPageSizeInches=function({view:e,userUnit:t,rotate:n}){const[r,i,s,a]=e,o=n%180!=0,l=(s-r)/72*t,c=(a-i)/72*t;return{width:o?c:l,height:o?l:c}},t.getVisibleElements=function({scrollEl:e,views:t,sortByVisibility:n=!1,horizontal:r=!1,rtl:i=!1}){const s=e.scrollTop,a=s+e.clientHeight,c=e.scrollLeft,u=c+e.clientWidth,d=[],h=new Set,p=t.length;let f=o(t,r?function(e){const t=e.div,n=t.offsetLeft+t.clientLeft,r=n+t.clientWidth;return i?n<u:r>c}:function(e){const t=e.div;return t.offsetTop+t.clientTop+t.clientHeight>s});f>0&&f<p&&!r&&(f=l(f,t,s));let g=r?u:-1;for(let e=f;e<p;e++){const n=t[e],i=n.div,o=i.offsetLeft+i.clientLeft,l=i.offsetTop+i.clientTop,p=i.clientWidth,f=i.clientHeight,m=o+p,v=l+f;if(-1===g)v>=a&&(g=v);else if((r?o:l)>g)break;if(v<=s||l>=a||m<=c||o>=u)continue;const y=Math.max(0,s-l)+Math.max(0,v-a),b=Math.max(0,c-o)+Math.max(0,m-u),_=(p-b)/p,w=(f-y)/f*_*100|0;d.push({id:n.id,x:o,y:l,view:n,percent:w,widthPercent:100*_|0}),h.add(n.id)}const m=d[0],v=d.at(-1);return n&&d.sort((function(e,t){const n=e.percent-t.percent;return Math.abs(n)>.001?-n:e.id-t.id})),{first:m,last:v,views:d,ids:h}},t.isPortraitOrientation=function(e){return e.width<=e.height},t.isValidRotation=function(e){return Number.isInteger(e)&&e%90==0},t.isValidScrollMode=function(e){return Number.isInteger(e)&&Object.values(r).includes(e)&&e!==r.UNKNOWN},t.isValidSpreadMode=function(e){return Number.isInteger(e)&&Object.values(i).includes(e)&&e!==i.UNKNOWN},t.noContextMenuHandler=function(e){e.preventDefault()},t.normalizeWheelEventDelta=function(e){let t=c(e);return 0===e.deltaMode?t/=900:1===e.deltaMode&&(t/=30),t},t.normalizeWheelEventDirection=c,t.parseQueryString=function(e){const t=new Map;for(const[n,r]of new URLSearchParams(e))t.set(n.toLowerCase(),r);return t},t.removeNullCharacters=function(e,t=!1){return"string"!=typeof e?(console.error("The argument must be a string."),e):(t&&(e=e.replace(a," ")),e.replace(s,""))},t.roundToDivide=function(e,t){const n=e%t;return 0===n?e:Math.round(e-n+t)},t.scrollIntoView=function(e,t,n=!1){let r=e.offsetParent;if(!r)return void console.error("offsetParent is not set -- cannot scroll");let i=e.offsetTop+e.clientTop,s=e.offsetLeft+e.clientLeft;for(;r.clientHeight===r.scrollHeight&&r.clientWidth===r.scrollWidth||n&&(r.classList.contains("markedContent")||"hidden"===getComputedStyle(r).overflow);)if(i+=r.offsetTop,s+=r.offsetLeft,r=r.offsetParent,!r)return;t&&(void 0!==t.top&&(i+=t.top),void 0!==t.left&&(s+=t.left,r.scrollLeft=s)),r.scrollTop=i},t.watchScroll=function(e,t){const n=function(n){i||(i=window.requestAnimationFrame((function(){i=null;const n=e.scrollLeft,s=r.lastX;n!==s&&(r.right=n>s),r.lastX=n;const a=e.scrollTop,o=r.lastY;a!==o&&(r.down=a>o),r.lastY=a,t(r)})))},r={right:!0,down:!0,lastX:e.scrollLeft,lastY:e.scrollTop,_eventHandler:n};let i=null;return e.addEventListener("scroll",n,!0),r},t.DEFAULT_SCALE_VALUE="auto",t.DEFAULT_SCALE=1,t.DEFAULT_SCALE_DELTA=1.1,t.MIN_SCALE=.1,t.MAX_SCALE=10,t.UNKNOWN_SCALE=0,t.MAX_AUTO_SCALE=1.25,t.SCROLLBAR_PADDING=40,t.VERTICAL_PADDING=5,t.RenderingStates={INITIAL:0,RUNNING:1,PAUSED:2,FINISHED:3},t.PresentationModeState={UNKNOWN:0,NORMAL:1,CHANGING:2,FULLSCREEN:3};const n={UNKNOWN:-1,NONE:0,THUMBS:1,OUTLINE:2,ATTACHMENTS:3,LAYERS:4};t.SidebarView=n,t.RendererType={CANVAS:"canvas",SVG:"svg"},t.TextLayerMode={DISABLE:0,ENABLE:1,ENABLE_ENHANCE:2};const r={UNKNOWN:-1,VERTICAL:0,HORIZONTAL:1,WRAPPED:2,PAGE:3};t.ScrollMode=r;const i={UNKNOWN:-1,NONE:0,ODD:1,EVEN:2};t.SpreadMode=i,t.AutoPrintRegExp=/\bprint\s*\(/,t.OutputScale=class{constructor(){const e=window.devicePixelRatio||1;this.sx=e,this.sy=e}get scaled(){return 1!==this.sx||1!==this.sy}};const s=/\x00/g,a=/[\x01-\x1F]/g;function o(e,t,n=0){let r=n,i=e.length-1;if(i<0||!t(e[i]))return e.length;if(t(e[r]))return r;for(;r<i;){const n=r+i>>1;t(e[n])?i=n:r=n+1}return r}function l(e,t,n){if(e<2)return e;let r=t[e].div,i=r.offsetTop+r.clientTop;i>=n&&(r=t[e-1].div,i=r.offsetTop+r.clientTop);for(let n=e-2;n>=0&&(r=t[n].div,!(r.offsetTop+r.clientTop+r.clientHeight<=i));--n)e=n;return e}function c(e){let t=Math.hypot(e.deltaX,e.deltaY);const n=Math.atan2(e.deltaY,e.deltaX);return-.25*Math.PI<n&&n<.75*Math.PI&&(t=-t),t}const u=new Promise((function(e){window.requestAnimationFrame(e)}));t.animationStarted=u;const d=document.documentElement.style;t.docStyle=d,t.ProgressBar=class{#vt=null;#yt=0;#ee=!0;constructor(e){if(arguments.length>1)throw new Error("ProgressBar no longer accepts any additional options, please use CSS rules to modify its appearance instead.");const t=document.getElementById(e);this.#vt=t.classList}get percent(){return this.#yt}set percent(e){var t,n,r;this.#yt=(t=e,n=0,r=100,Math.min(Math.max(t,n),r)),isNaN(e)?this.#vt.add("indeterminate"):(this.#vt.remove("indeterminate"),d.setProperty("--progressBar-percent",`${this.#yt}%`))}setWidth(e){if(!e)return;const t=e.parentNode.offsetWidth-e.offsetWidth;t>0&&d.setProperty("--progressBar-end-offset",`${t}px`)}hide(){this.#ee&&(this.#ee=!1,this.#vt.add("hidden"))}show(){this.#ee||(this.#ee=!0,this.#vt.remove("hidden"))}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StructTreeLayerBuilder=void 0;const n={Document:null,DocumentFragment:null,Part:"group",Sect:"group",Div:"group",Aside:"note",NonStruct:"none",P:null,H:"heading",Title:null,FENote:"note",Sub:"group",Lbl:null,Span:null,Em:null,Strong:null,Link:"link",Annot:"note",Form:"form",Ruby:null,RB:null,RT:null,RP:null,Warichu:null,WT:null,WP:null,L:"list",LI:"listitem",LBody:null,Table:"table",TR:"row",TH:"columnheader",TD:"cell",THead:"columnheader",TBody:null,TFoot:null,Caption:null,Figure:"figure",Formula:null,Artifact:null},r=/^H(\d+)$/;t.StructTreeLayerBuilder=class{constructor({pdfPage:e}){this.pdfPage=e}render(e){return this._walk(e)}_setAttributes(e,t){void 0!==e.alt&&t.setAttribute("aria-label",e.alt),void 0!==e.id&&t.setAttribute("aria-owns",e.id),void 0!==e.lang&&t.setAttribute("lang",e.lang)}_walk(e){if(!e)return null;const t=document.createElement("span");if("role"in e){const{role:i}=e,s=i.match(r);s?(t.setAttribute("role","heading"),t.setAttribute("aria-level",s[1])):n[i]&&t.setAttribute("role",n[i])}if(this._setAttributes(e,t),e.children)if(1===e.children.length&&"id"in e.children[0])this._setAttributes(e.children[0],t);else for(const n of e.children)t.append(this._walk(n));return t}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TextLayerBuilder=void 0;var r=n(3);t.TextLayerBuilder=class{constructor({textLayerDiv:e,eventBus:t,pageIndex:n,viewport:r,highlighter:i=null,enhanceTextSelection:s=!1,accessibilityManager:a=null}){this.textLayerDiv=e,this.eventBus=t,this.textContent=null,this.textContentItemsStr=[],this.textContentStream=null,this.renderingDone=!1,this.pageNumber=n+1,this.viewport=r,this.textDivs=[],this.textLayerRenderTask=null,this.highlighter=i,this.enhanceTextSelection=s,this.accessibilityManager=a,this._bindMouse()}_finishRendering(){if(this.renderingDone=!0,!this.enhanceTextSelection){const e=document.createElement("div");e.className="endOfContent",this.textLayerDiv.append(e)}this.eventBus.dispatch("textlayerrendered",{source:this,pageNumber:this.pageNumber,numTextDivs:this.textDivs.length})}render(e=0){if(!this.textContent&&!this.textContentStream||this.renderingDone)return;this.cancel(),this.textDivs.length=0,this.highlighter?.setTextMapping(this.textDivs,this.textContentItemsStr),this.accessibilityManager?.setTextMapping(this.textDivs);const t=document.createDocumentFragment();this.textLayerRenderTask=(0,r.renderTextLayer)({textContent:this.textContent,textContentStream:this.textContentStream,container:t,viewport:this.viewport,textDivs:this.textDivs,textContentItemsStr:this.textContentItemsStr,timeout:e,enhanceTextSelection:this.enhanceTextSelection}),this.textLayerRenderTask.promise.then((()=>{this.textLayerDiv.append(t),this._finishRendering(),this.highlighter?.enable(),this.accessibilityManager?.enable()}),(function(e){}))}cancel(){this.textLayerRenderTask&&(this.textLayerRenderTask.cancel(),this.textLayerRenderTask=null),this.highlighter?.disable(),this.accessibilityManager?.disable()}setTextContentStream(e){this.cancel(),this.textContentStream=e}setTextContent(e){this.cancel(),this.textContent=e}_bindMouse(){const e=this.textLayerDiv;let t=null;e.addEventListener("mousedown",(n=>{if(this.enhanceTextSelection&&this.textLayerRenderTask)return this.textLayerRenderTask.expandTextDivs(!0),void(t&&(clearTimeout(t),t=null));const r=e.querySelector(".endOfContent");if(!r)return;let i=n.target!==e;if(i=i&&"none"!==window.getComputedStyle(r).getPropertyValue("-moz-user-select"),i){const t=e.getBoundingClientRect(),i=Math.max(0,(n.pageY-t.top)/t.height);r.style.top=(100*i).toFixed(2)+"%"}r.classList.add("active")})),e.addEventListener("mouseup",(()=>{if(this.enhanceTextSelection&&this.textLayerRenderTask)return void(t=setTimeout((()=>{this.textLayerRenderTask&&this.textLayerRenderTask.expandTextDivs(!1),t=null}),300));const n=e.querySelector(".endOfContent");n&&(n.style.top="",n.classList.remove("active"))}))}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.XfaLayerBuilder=void 0;var r=n(3);t.XfaLayerBuilder=class{constructor({pageDiv:e,pdfPage:t,annotationStorage:n=null,linkService:r,xfaHtml:i=null}){this.pageDiv=e,this.pdfPage=t,this.annotationStorage=n,this.linkService=r,this.xfaHtml=i,this.div=null,this._cancelled=!1}render(e,t="display"){if("print"===t){const n={viewport:e.clone({dontFlip:!0}),div:this.div,xfaHtml:this.xfaHtml,annotationStorage:this.annotationStorage,linkService:this.linkService,intent:t},i=document.createElement("div");this.pageDiv.append(i),n.div=i;const s=r.XfaLayer.render(n);return Promise.resolve(s)}return this.pdfPage.getXfa().then((n=>{if(this._cancelled||!n)return{textDivs:[]};const i={viewport:e.clone({dontFlip:!0}),div:this.div,xfaHtml:n,annotationStorage:this.annotationStorage,linkService:this.linkService,intent:t};return this.div?r.XfaLayer.update(i):(this.div=document.createElement("div"),this.pageDiv.append(this.div),i.div=this.div,r.XfaLayer.render(i))})).catch((e=>{console.error(e)}))}cancel(){this._cancelled=!0}hide(){this.div&&(this.div.hidden=!0)}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFViewer=t.PDFSinglePageViewer=void 0;var r=n(7),i=n(12);class s extends i.BaseViewer{}t.PDFViewer=s;class a extends i.BaseViewer{_resetView(){super._resetView(),this._scrollMode=r.ScrollMode.PAGE,this._spreadMode=r.SpreadMode.NONE}set scrollMode(e){}_updateScrollMode(){}set spreadMode(e){}_updateSpreadMode(){}}t.PDFSinglePageViewer=a},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PagesCountLimit=t.PDFPageViewBuffer=t.BaseViewer=void 0;var r=n(3),i=n(7),s=n(2),a=n(5),o=n(4),l=n(13),c=n(16),u=n(6),d=n(8),h=n(17),p=n(9),f=n(10);const g="enablePermissions",m={FORCE_SCROLL_MODE_PAGE:15e3,FORCE_LAZY_PAGE_INIT:7500,PAUSE_EAGER_PAGE_INIT:250};function v(e){return Object.values(r.AnnotationEditorType).includes(e)&&e!==r.AnnotationEditorType.DISABLE}t.PagesCountLimit=m;class y{#bt=new Set;#_t=0;constructor(e){this.#_t=e}push(e){const t=this.#bt;t.has(e)&&t.delete(e),t.add(e),t.size>this.#_t&&this.#wt()}resize(e,t=null){this.#_t=e;const n=this.#bt;if(t){const e=n.size;let r=1;for(const i of n)if(t.has(i.id)&&(n.delete(i),n.add(i)),++r>e)break}for(;n.size>this.#_t;)this.#wt()}has(e){return this.#bt.has(e)}[Symbol.iterator](){return this.#bt.keys()}#wt(){const e=this.#bt.keys().next().value;e?.destroy(),this.#bt.delete(e)}}t.PDFPageViewBuffer=y;class b{#Et=null;#St=r.AnnotationEditorType.DISABLE;#Ct=null;#At=r.AnnotationMode.ENABLE_FORMS;#Pt=!1;#xt=0;#Tt=null;#Rt=null;constructor(e){if(this.constructor===b)throw new Error("Cannot initialize BaseViewer.");const t="2.16.105";if(r.version!==t)throw new Error(`The API version "${r.version}" does not match the Viewer version "2.16.105".`);if(this.container=e.container,this.viewer=e.viewer||e.container.firstElementChild,"DIV"!==this.container?.tagName.toUpperCase()||"DIV"!==this.viewer?.tagName.toUpperCase())throw new Error("Invalid `container` and/or `viewer` option.");if(this.container.offsetParent&&"absolute"!==getComputedStyle(this.container).position)throw new Error("The `container` must be absolutely positioned.");this.eventBus=e.eventBus,this.linkService=e.linkService||new u.SimpleLinkService,this.downloadManager=e.downloadManager||null,this.findController=e.findController||null,this._scriptingManager=e.scriptingManager||null,this.removePageBorders=e.removePageBorders||!1,this.textLayerMode=e.textLayerMode??i.TextLayerMode.ENABLE,this.#At=e.annotationMode??r.AnnotationMode.ENABLE_FORMS,this.#St=e.annotationEditorMode??r.AnnotationEditorType.DISABLE,this.imageResourcesPath=e.imageResourcesPath||"",this.enablePrintAutoRotate=e.enablePrintAutoRotate||!1,this.renderer=e.renderer||i.RendererType.CANVAS,this.useOnlyCssZoom=e.useOnlyCssZoom||!1,this.maxCanvasPixels=e.maxCanvasPixels,this.l10n=e.l10n||o.NullL10n,this.#Pt=e.enablePermissions||!1,this.pageColors=e.pageColors||null,!this.pageColors||CSS.supports("color",this.pageColors.background)&&CSS.supports("color",this.pageColors.foreground)||((this.pageColors.background||this.pageColors.foreground)&&console.warn("BaseViewer: Ignoring `pageColors`-option, since the browser doesn't support the values used."),this.pageColors=null),this.defaultRenderingQueue=!e.renderingQueue,this.defaultRenderingQueue?(this.renderingQueue=new c.PDFRenderingQueue,this.renderingQueue.setViewer(this)):this.renderingQueue=e.renderingQueue,this.scroll=(0,i.watchScroll)(this.container,this._scrollUpdate.bind(this)),this.presentationModeState=i.PresentationModeState.UNKNOWN,this._onBeforeDraw=this._onAfterDraw=null,this._resetView(),this.removePageBorders&&this.viewer.classList.add("removePageBorders"),this.updateContainerHeightCss()}get pagesCount(){return this._pages.length}getPageView(e){return this._pages[e]}get pageViewsReady(){return!!this._pagesCapability.settled&&this._pages.every((function(e){return e?.pdfPage}))}get renderForms(){return this.#At===r.AnnotationMode.ENABLE_FORMS}get enableScripting(){return!!this._scriptingManager}get currentPageNumber(){return this._currentPageNumber}set currentPageNumber(e){if(!Number.isInteger(e))throw new Error("Invalid page number.");this.pdfDocument&&(this._setCurrentPageNumber(e,!0)||console.error(`currentPageNumber: "${e}" is not a valid page.`))}_setCurrentPageNumber(e,t=!1){if(this._currentPageNumber===e)return t&&this.#Mt(),!0;if(!(0<e&&e<=this.pagesCount))return!1;const n=this._currentPageNumber;return this._currentPageNumber=e,this.eventBus.dispatch("pagechanging",{source:this,pageNumber:e,pageLabel:this._pageLabels?.[e-1]??null,previous:n}),t&&this.#Mt(),!0}get currentPageLabel(){return this._pageLabels?.[this._currentPageNumber-1]??null}set currentPageLabel(e){if(!this.pdfDocument)return;let t=0|e;if(this._pageLabels){const n=this._pageLabels.indexOf(e);n>=0&&(t=n+1)}this._setCurrentPageNumber(t,!0)||console.error(`currentPageLabel: "${e}" is not a valid page.`)}get currentScale(){return this._currentScale!==i.UNKNOWN_SCALE?this._currentScale:i.DEFAULT_SCALE}set currentScale(e){if(isNaN(e))throw new Error("Invalid numeric scale.");this.pdfDocument&&this._setScale(e,!1)}get currentScaleValue(){return this._currentScaleValue}set currentScaleValue(e){this.pdfDocument&&this._setScale(e,!1)}get pagesRotation(){return this._pagesRotation}set pagesRotation(e){if(!(0,i.isValidRotation)(e))throw new Error("Invalid pages rotation angle.");if(!this.pdfDocument)return;if((e%=360)<0&&(e+=360),this._pagesRotation===e)return;this._pagesRotation=e;const t=this._currentPageNumber,n={rotation:e};for(const e of this._pages)e.update(n);this._currentScaleValue&&this._setScale(this._currentScaleValue,!0),this.eventBus.dispatch("rotationchanging",{source:this,pagesRotation:e,pageNumber:t}),this.defaultRenderingQueue&&this.update()}get firstPagePromise(){return this.pdfDocument?this._firstPageCapability.promise:null}get onePageRendered(){return this.pdfDocument?this._onePageRenderedCapability.promise:null}get pagesPromise(){return this.pdfDocument?this._pagesCapability.promise:null}#Lt(e){const t={annotationEditorMode:this.#St,annotationMode:this.#At,textLayerMode:this.textLayerMode};return e?(e.includes(r.PermissionFlag.COPY)||this.viewer.classList.add(g),e.includes(r.PermissionFlag.MODIFY_CONTENTS)||(t.annotationEditorMode=r.AnnotationEditorType.DISABLE),e.includes(r.PermissionFlag.MODIFY_ANNOTATIONS)||e.includes(r.PermissionFlag.FILL_INTERACTIVE_FORMS)||this.#At!==r.AnnotationMode.ENABLE_FORMS||(t.annotationMode=r.AnnotationMode.ENABLE),t):t}#It(){if("hidden"===document.visibilityState||!this.container.offsetParent||0===this._getVisiblePages().views.length)return Promise.resolve();const e=new Promise((e=>{this.#Rt=()=>{"hidden"===document.visibilityState&&(e(),document.removeEventListener("visibilitychange",this.#Rt),this.#Rt=null)},document.addEventListener("visibilitychange",this.#Rt)}));return Promise.race([this._onePageRenderedCapability.promise,e])}setDocument(e){if(this.pdfDocument&&(this.eventBus.dispatch("pagesdestroy",{source:this}),this._cancelRendering(),this._resetView(),this.findController&&this.findController.setDocument(null),this._scriptingManager&&this._scriptingManager.setDocument(null),this.#Ct&&(this.#Ct.destroy(),this.#Ct=null)),this.pdfDocument=e,!e)return;const t=e.isPureXfa,n=e.numPages,s=e.getPage(1),a=e.getOptionalContentConfig(),o=this.#Pt?e.getPermissions():Promise.resolve();if(n>m.FORCE_SCROLL_MODE_PAGE){console.warn("Forcing PAGE-scrolling for performance reasons, given the length of the document.");const e=this._scrollMode=i.ScrollMode.PAGE;this.eventBus.dispatch("scrollmodechanged",{source:this,mode:e})}this._pagesCapability.promise.then((()=>{this.eventBus.dispatch("pagesloaded",{source:this,pagesCount:n})}),(()=>{})),this._onBeforeDraw=e=>{const t=this._pages[e.pageNumber-1];t&&this.#Et.push(t)},this.eventBus._on("pagerender",this._onBeforeDraw),this._onAfterDraw=e=>{e.cssTransform||this._onePageRenderedCapability.settled||(this._onePageRenderedCapability.resolve({timestamp:e.timestamp}),this.eventBus._off("pagerendered",this._onAfterDraw),this._onAfterDraw=null,this.#Rt&&(document.removeEventListener("visibilitychange",this.#Rt),this.#Rt=null))},this.eventBus._on("pagerendered",this._onAfterDraw),Promise.all([s,o]).then((([s,o])=>{if(e!==this.pdfDocument)return;this._firstPageCapability.resolve(s),this._optionalContentConfigPromise=a;const{annotationEditorMode:c,annotationMode:u,textLayerMode:d}=this.#Lt(o);if(c!==r.AnnotationEditorType.DISABLE){const e=c;t?console.warn("Warning: XFA-editing is not implemented."):v(e)?(this.#Ct=new r.AnnotationEditorUIManager(this.container,this.eventBus),e!==r.AnnotationEditorType.NONE&&this.#Ct.updateMode(e)):console.error(`Invalid AnnotationEditor mode: ${e}`)}const h=this._scrollMode===i.ScrollMode.PAGE?null:this.viewer,p=this.currentScale,f=s.getViewport({scale:p*r.PixelsPerInch.PDF_TO_CSS_UNITS}),g=d===i.TextLayerMode.DISABLE||t?null:this,y=u!==r.AnnotationMode.DISABLE?this:null,b=t?this:null,_=this.#Ct?this:null;for(let e=1;e<=n;++e){const t=new l.PDFPageView({container:h,eventBus:this.eventBus,id:e,scale:p,defaultViewport:f.clone(),optionalContentConfigPromise:a,renderingQueue:this.renderingQueue,textLayerFactory:g,textLayerMode:d,annotationLayerFactory:y,annotationMode:u,xfaLayerFactory:b,annotationEditorLayerFactory:_,textHighlighterFactory:this,structTreeLayerFactory:this,imageResourcesPath:this.imageResourcesPath,renderer:this.renderer,useOnlyCssZoom:this.useOnlyCssZoom,maxCanvasPixels:this.maxCanvasPixels,pageColors:this.pageColors,l10n:this.l10n});this._pages.push(t)}const w=this._pages[0];w&&(w.setPdfPage(s),this.linkService.cachePageRef(1,s.ref)),this._scrollMode===i.ScrollMode.PAGE?this.#kt():this._spreadMode!==i.SpreadMode.NONE&&this._updateSpreadMode(),this.#It().then((async()=>{if(this.findController&&this.findController.setDocument(e),this._scriptingManager&&this._scriptingManager.setDocument(e),this.#Ct&&this.eventBus.dispatch("annotationeditormodechanged",{source:this,mode:this.#St}),e.loadingParams.disableAutoFetch||n>m.FORCE_LAZY_PAGE_INIT)return void this._pagesCapability.resolve();let t=n-1;if(t<=0)this._pagesCapability.resolve();else for(let r=2;r<=n;++r){const n=e.getPage(r).then((e=>{const n=this._pages[r-1];n.pdfPage||n.setPdfPage(e),this.linkService.cachePageRef(r,e.ref),0==--t&&this._pagesCapability.resolve()}),(e=>{console.error(`Unable to get page ${r} to initialize viewer`,e),0==--t&&this._pagesCapability.resolve()}));r%m.PAUSE_EAGER_PAGE_INIT==0&&await n}})),this.eventBus.dispatch("pagesinit",{source:this}),e.getMetadata().then((({info:t})=>{e===this.pdfDocument&&t.Language&&(this.viewer.lang=t.Language)})),this.defaultRenderingQueue&&this.update()})).catch((e=>{console.error("Unable to initialize viewer",e),this._pagesCapability.reject(e)}))}setPageLabels(e){if(this.pdfDocument){e?Array.isArray(e)&&this.pdfDocument.numPages===e.length?this._pageLabels=e:(this._pageLabels=null,console.error("setPageLabels: Invalid page labels.")):this._pageLabels=null;for(let e=0,t=this._pages.length;e<t;e++)this._pages[e].setPageLabel(this._pageLabels?.[e]??null)}}_resetView(){this._pages=[],this._currentPageNumber=1,this._currentScale=i.UNKNOWN_SCALE,this._currentScaleValue=null,this._pageLabels=null,this.#Et=new y(10),this._location=null,this._pagesRotation=0,this._optionalContentConfigPromise=null,this._firstPageCapability=(0,r.createPromiseCapability)(),this._onePageRenderedCapability=(0,r.createPromiseCapability)(),this._pagesCapability=(0,r.createPromiseCapability)(),this._scrollMode=i.ScrollMode.VERTICAL,this._previousScrollMode=i.ScrollMode.UNKNOWN,this._spreadMode=i.SpreadMode.NONE,this.#Tt={previousPageNumber:1,scrollDown:!0,pages:[]},this._onBeforeDraw&&(this.eventBus._off("pagerender",this._onBeforeDraw),this._onBeforeDraw=null),this._onAfterDraw&&(this.eventBus._off("pagerendered",this._onAfterDraw),this._onAfterDraw=null),this.#Rt&&(document.removeEventListener("visibilitychange",this.#Rt),this.#Rt=null),this.viewer.textContent="",this._updateScrollMode(),this.viewer.removeAttribute("lang"),this.viewer.classList.remove(g)}#kt(){if(this._scrollMode!==i.ScrollMode.PAGE)throw new Error("#ensurePageViewVisible: Invalid scrollMode value.");const e=this._currentPageNumber,t=this.#Tt,n=this.viewer;if(n.textContent="",t.pages.length=0,this._spreadMode!==i.SpreadMode.NONE||this.isInPresentationMode){const r=new Set,i=this._spreadMode-1;-1===i?r.add(e-1):e%2!==i?(r.add(e-1),r.add(e)):(r.add(e-2),r.add(e-1));const s=document.createElement("div");if(s.className="spread",this.isInPresentationMode){const e=document.createElement("div");e.className="dummyPage",s.append(e)}for(const e of r){const n=this._pages[e];n&&(s.append(n.div),t.pages.push(n))}n.append(s)}else{const r=this._pages[e-1];n.append(r.div),t.pages.push(r)}t.scrollDown=e>=t.previousPageNumber,t.previousPageNumber=e}_scrollUpdate(){0!==this.pagesCount&&this.update()}#Ot(e,t=null){const{div:n,id:r}=e;if(this._scrollMode===i.ScrollMode.PAGE&&(this._setCurrentPageNumber(r),this.#kt(),this.update()),!t&&!this.isInPresentationMode){const e=n.offsetLeft+n.clientLeft,r=e+n.clientWidth,{scrollLeft:s,clientWidth:a}=this.container;(this._scrollMode===i.ScrollMode.HORIZONTAL||e<s||r>s+a)&&(t={left:0,top:0})}(0,i.scrollIntoView)(n,t)}#Ft(e){return e===this._currentScale||Math.abs(e-this._currentScale)<1e-15}_setScaleUpdatePages(e,t,n=!1,s=!1){if(this._currentScaleValue=t.toString(),this.#Ft(e))return void(s&&this.eventBus.dispatch("scalechanging",{source:this,scale:e,presetValue:t}));i.docStyle.setProperty("--scale-factor",e*r.PixelsPerInch.PDF_TO_CSS_UNITS);const a={scale:e};for(const e of this._pages)e.update(a);if(this._currentScale=e,!n){let e,t=this._currentPageNumber;!this._location||this.isInPresentationMode||this.isChangingPresentationMode||(t=this._location.pageNumber,e=[null,{name:"XYZ"},this._location.left,this._location.top,null]),this.scrollPageIntoView({pageNumber:t,destArray:e,allowNegativeOffset:!0})}this.eventBus.dispatch("scalechanging",{source:this,scale:e,presetValue:s?t:void 0}),this.defaultRenderingQueue&&this.update(),this.updateContainerHeightCss()}get _pageWidthScaleFactor(){return this._spreadMode!==i.SpreadMode.NONE&&this._scrollMode!==i.ScrollMode.HORIZONTAL?2:1}_setScale(e,t=!1){let n=parseFloat(e);if(n>0)this._setScaleUpdatePages(n,e,t,!1);else{const r=this._pages[this._currentPageNumber-1];if(!r)return;let s=i.SCROLLBAR_PADDING,a=i.VERTICAL_PADDING;this.isInPresentationMode?s=a=4:this.removePageBorders?s=a=0:this._scrollMode===i.ScrollMode.HORIZONTAL&&([s,a]=[a,s]);const o=(this.container.clientWidth-s)/r.width*r.scale/this._pageWidthScaleFactor,l=(this.container.clientHeight-a)/r.height*r.scale;switch(e){case"page-actual":n=1;break;case"page-width":n=o;break;case"page-height":n=l;break;case"page-fit":n=Math.min(o,l);break;case"auto":const t=(0,i.isPortraitOrientation)(r)?o:Math.min(l,o);n=Math.min(i.MAX_AUTO_SCALE,t);break;default:return void console.error(`_setScale: "${e}" is an unknown zoom value.`)}this._setScaleUpdatePages(n,e,t,!0)}}#Mt(){const e=this._pages[this._currentPageNumber-1];this.isInPresentationMode&&this._setScale(this._currentScaleValue,!0),this.#Ot(e)}pageLabelToPageNumber(e){if(!this._pageLabels)return null;const t=this._pageLabels.indexOf(e);return t<0?null:t+1}scrollPageIntoView({pageNumber:e,destArray:t=null,allowNegativeOffset:n=!1,ignoreDestinationZoom:s=!1}){if(!this.pdfDocument)return;const a=Number.isInteger(e)&&this._pages[e-1];if(!a)return void console.error(`scrollPageIntoView: "${e}" is not a valid pageNumber parameter.`);if(this.isInPresentationMode||!t)return void this._setCurrentPageNumber(e,!0);let o,l,c=0,u=0,d=0,h=0;const p=a.rotation%180!=0,f=(p?a.height:a.width)/a.scale/r.PixelsPerInch.PDF_TO_CSS_UNITS,g=(p?a.width:a.height)/a.scale/r.PixelsPerInch.PDF_TO_CSS_UNITS;let m=0;switch(t[1].name){case"XYZ":c=t[2],u=t[3],m=t[4],c=null!==c?c:0,u=null!==u?u:g;break;case"Fit":case"FitB":m="page-fit";break;case"FitH":case"FitBH":u=t[2],m="page-width",null===u&&this._location?(c=this._location.left,u=this._location.top):("number"!=typeof u||u<0)&&(u=g);break;case"FitV":case"FitBV":c=t[2],d=f,h=g,m="page-height";break;case"FitR":c=t[2],u=t[3],d=t[4]-c,h=t[5]-u;const e=this.removePageBorders?0:i.SCROLLBAR_PADDING,n=this.removePageBorders?0:i.VERTICAL_PADDING;o=(this.container.clientWidth-e)/d/r.PixelsPerInch.PDF_TO_CSS_UNITS,l=(this.container.clientHeight-n)/h/r.PixelsPerInch.PDF_TO_CSS_UNITS,m=Math.min(Math.abs(o),Math.abs(l));break;default:return void console.error(`scrollPageIntoView: "${t[1].name}" is not a valid destination type.`)}if(s||(m&&m!==this._currentScale?this.currentScaleValue=m:this._currentScale===i.UNKNOWN_SCALE&&(this.currentScaleValue=i.DEFAULT_SCALE_VALUE)),"page-fit"===m&&!t[4])return void this.#Ot(a);const v=[a.viewport.convertToViewportPoint(c,u),a.viewport.convertToViewportPoint(c+d,u+h)];let y=Math.min(v[0][0],v[1][0]),b=Math.min(v[0][1],v[1][1]);n||(y=Math.max(y,0),b=Math.max(b,0)),this.#Ot(a,{left:y,top:b})}_updateLocation(e){const t=this._currentScale,n=this._currentScaleValue,r=parseFloat(n)===t?Math.round(1e4*t)/100:n,i=e.id,s=this._pages[i-1],a=this.container,o=s.getPagePoint(a.scrollLeft-e.x,a.scrollTop-e.y),l=Math.round(o[0]),c=Math.round(o[1]);let u=`#page=${i}`;this.isInPresentationMode||(u+=`&zoom=${r},${l},${c}`),this._location={pageNumber:i,scale:r,top:c,left:l,rotation:this._pagesRotation,pdfOpenParams:u}}update(){const e=this._getVisiblePages(),t=e.views,n=t.length;if(0===n)return;const r=Math.max(10,2*n+1);this.#Et.resize(r,e.ids),this.renderingQueue.renderHighestPriority(e);const s=this._spreadMode===i.SpreadMode.NONE&&(this._scrollMode===i.ScrollMode.PAGE||this._scrollMode===i.ScrollMode.VERTICAL),a=this._currentPageNumber;let o=!1;for(const e of t){if(e.percent<100)break;if(e.id===a&&s){o=!0;break}}this._setCurrentPageNumber(o?a:t[0].id),this._updateLocation(e.first),this.eventBus.dispatch("updateviewarea",{source:this,location:this._location})}containsElement(e){return this.container.contains(e)}focus(){this.container.focus()}get _isContainerRtl(){return"rtl"===getComputedStyle(this.container).direction}get isInPresentationMode(){return this.presentationModeState===i.PresentationModeState.FULLSCREEN}get isChangingPresentationMode(){return this.presentationModeState===i.PresentationModeState.CHANGING}get isHorizontalScrollbarEnabled(){return!this.isInPresentationMode&&this.container.scrollWidth>this.container.clientWidth}get isVerticalScrollbarEnabled(){return!this.isInPresentationMode&&this.container.scrollHeight>this.container.clientHeight}_getVisiblePages(){const e=this._scrollMode===i.ScrollMode.PAGE?this.#Tt.pages:this._pages,t=this._scrollMode===i.ScrollMode.HORIZONTAL,n=t&&this._isContainerRtl;return(0,i.getVisibleElements)({scrollEl:this.container,views:e,sortByVisibility:!0,horizontal:t,rtl:n})}isPageVisible(e){return!!this.pdfDocument&&(Number.isInteger(e)&&e>0&&e<=this.pagesCount?this._getVisiblePages().ids.has(e):(console.error(`isPageVisible: "${e}" is not a valid page.`),!1))}isPageCached(e){if(!this.pdfDocument)return!1;if(!(Number.isInteger(e)&&e>0&&e<=this.pagesCount))return console.error(`isPageCached: "${e}" is not a valid page.`),!1;const t=this._pages[e-1];return this.#Et.has(t)}cleanup(){for(const e of this._pages)e.renderingState!==i.RenderingStates.FINISHED&&e.reset()}_cancelRendering(){for(const e of this._pages)e.cancelRendering()}async#Dt(e){if(e.pdfPage)return e.pdfPage;try{const t=await this.pdfDocument.getPage(e.id);return e.pdfPage||e.setPdfPage(t),this.linkService._cachedPageNumber?.(t.ref)||this.linkService.cachePageRef(e.id,t.ref),t}catch(e){return console.error("Unable to get page for page view",e),null}}#Nt(e){if(1===e.first?.id)return!0;if(e.last?.id===this.pagesCount)return!1;switch(this._scrollMode){case i.ScrollMode.PAGE:return this.#Tt.scrollDown;case i.ScrollMode.HORIZONTAL:return this.scroll.right}return this.scroll.down}#Ut(e){for(const t of e)this._pages[t-1]?.toggleLoadingIconSpinner(!0);for(const t of this.#Et)e.has(t.id)||t.toggleLoadingIconSpinner(!1)}forceRendering(e){const t=e||this._getVisiblePages(),n=this.#Nt(t),r=this._spreadMode!==i.SpreadMode.NONE&&this._scrollMode!==i.ScrollMode.HORIZONTAL,s=this.renderingQueue.getHighestPriority(t,this._pages,n,r);return this.#Ut(t.ids),!!s&&(this.#Dt(s).then((()=>{this.renderingQueue.renderView(s)})),!0)}createTextLayerBuilder({textLayerDiv:e,pageIndex:t,viewport:n,enhanceTextSelection:r=!1,eventBus:i,highlighter:s,accessibilityManager:a=null}){return new p.TextLayerBuilder({textLayerDiv:e,eventBus:i,pageIndex:t,viewport:n,enhanceTextSelection:!this.isInPresentationMode&&r,highlighter:s,accessibilityManager:a})}createTextHighlighter({pageIndex:e,eventBus:t}){return new h.TextHighlighter({eventBus:t,pageIndex:e,findController:this.isInPresentationMode?null:this.findController})}createAnnotationLayerBuilder({pageDiv:e,pdfPage:t,annotationStorage:n=this.pdfDocument?.annotationStorage,imageResourcesPath:r="",renderForms:i=!0,l10n:s=o.NullL10n,enableScripting:l=this.enableScripting,hasJSActionsPromise:c=this.pdfDocument?.hasJSActions(),mouseState:u=this._scriptingManager?.mouseState,fieldObjectsPromise:d=this.pdfDocument?.getFieldObjects(),annotationCanvasMap:h=null,accessibilityManager:p=null}){return new a.AnnotationLayerBuilder({pageDiv:e,pdfPage:t,annotationStorage:n,imageResourcesPath:r,renderForms:i,linkService:this.linkService,downloadManager:this.downloadManager,l10n:s,enableScripting:l,hasJSActionsPromise:c,mouseState:u,fieldObjectsPromise:d,annotationCanvasMap:h,accessibilityManager:p})}createAnnotationEditorLayerBuilder({uiManager:e=this.#Ct,pageDiv:t,pdfPage:n,accessibilityManager:r=null,l10n:i,annotationStorage:a=this.pdfDocument?.annotationStorage}){return new s.AnnotationEditorLayerBuilder({uiManager:e,pageDiv:t,pdfPage:n,annotationStorage:a,accessibilityManager:r,l10n:i})}createXfaLayerBuilder({pageDiv:e,pdfPage:t,annotationStorage:n=this.pdfDocument?.annotationStorage}){return new f.XfaLayerBuilder({pageDiv:e,pdfPage:t,annotationStorage:n,linkService:this.linkService})}createStructTreeLayerBuilder({pdfPage:e}){return new d.StructTreeLayerBuilder({pdfPage:e})}get hasEqualPageSizes(){const e=this._pages[0];for(let t=1,n=this._pages.length;t<n;++t){const n=this._pages[t];if(n.width!==e.width||n.height!==e.height)return!1}return!0}getPagesOverview(){return this._pages.map((e=>{const t=e.pdfPage.getViewport({scale:1});return!this.enablePrintAutoRotate||(0,i.isPortraitOrientation)(t)?{width:t.width,height:t.height,rotation:t.rotation}:{width:t.height,height:t.width,rotation:(t.rotation-90)%360}}))}get optionalContentConfigPromise(){return this.pdfDocument?this._optionalContentConfigPromise?this._optionalContentConfigPromise:(console.error("optionalContentConfigPromise: Not initialized yet."),this.pdfDocument.getOptionalContentConfig()):Promise.resolve(null)}set optionalContentConfigPromise(e){if(!(e instanceof Promise))throw new Error(`Invalid optionalContentConfigPromise: ${e}`);if(!this.pdfDocument)return;if(!this._optionalContentConfigPromise)return;this._optionalContentConfigPromise=e;const t={optionalContentConfigPromise:e};for(const e of this._pages)e.update(t);this.update(),this.eventBus.dispatch("optionalcontentconfigchanged",{source:this,promise:e})}get scrollMode(){return this._scrollMode}set scrollMode(e){if(this._scrollMode!==e){if(!(0,i.isValidScrollMode)(e))throw new Error(`Invalid scroll mode: ${e}`);this.pagesCount>m.FORCE_SCROLL_MODE_PAGE||(this._previousScrollMode=this._scrollMode,this._scrollMode=e,this.eventBus.dispatch("scrollmodechanged",{source:this,mode:e}),this._updateScrollMode(this._currentPageNumber))}}_updateScrollMode(e=null){const t=this._scrollMode,n=this.viewer;n.classList.toggle("scrollHorizontal",t===i.ScrollMode.HORIZONTAL),n.classList.toggle("scrollWrapped",t===i.ScrollMode.WRAPPED),this.pdfDocument&&e&&(t===i.ScrollMode.PAGE?this.#kt():this._previousScrollMode===i.ScrollMode.PAGE&&this._updateSpreadMode(),this._currentScaleValue&&isNaN(this._currentScaleValue)&&this._setScale(this._currentScaleValue,!0),this._setCurrentPageNumber(e,!0),this.update())}get spreadMode(){return this._spreadMode}set spreadMode(e){if(this._spreadMode!==e){if(!(0,i.isValidSpreadMode)(e))throw new Error(`Invalid spread mode: ${e}`);this._spreadMode=e,this.eventBus.dispatch("spreadmodechanged",{source:this,mode:e}),this._updateSpreadMode(this._currentPageNumber)}}_updateSpreadMode(e=null){if(!this.pdfDocument)return;const t=this.viewer,n=this._pages;if(this._scrollMode===i.ScrollMode.PAGE)this.#kt();else if(t.textContent="",this._spreadMode===i.SpreadMode.NONE)for(const e of this._pages)t.append(e.div);else{const e=this._spreadMode-1;let r=null;for(let i=0,s=n.length;i<s;++i)null===r?(r=document.createElement("div"),r.className="spread",t.append(r)):i%2===e&&(r=r.cloneNode(!1),t.append(r)),r.append(n[i].div)}e&&(this._currentScaleValue&&isNaN(this._currentScaleValue)&&this._setScale(this._currentScaleValue,!0),this._setCurrentPageNumber(e,!0),this.update())}_getPageAdvance(e,t=!1){switch(this._scrollMode){case i.ScrollMode.WRAPPED:{const{views:n}=this._getVisiblePages(),r=new Map;for(const{id:e,y:t,percent:i,widthPercent:s}of n){if(0===i||s<100)continue;let n=r.get(t);n||r.set(t,n||=[]),n.push(e)}for(const n of r.values()){const r=n.indexOf(e);if(-1===r)continue;const i=n.length;if(1===i)break;if(t)for(let t=r-1,i=0;t>=i;t--){const r=n[t],i=n[t+1]-1;if(r<i)return e-i}else for(let t=r+1,s=i;t<s;t++){const r=n[t],i=n[t-1]+1;if(r>i)return i-e}if(t){const t=n[0];if(t<e)return e-t+1}else{const t=n[i-1];if(t>e)return t-e+1}break}break}case i.ScrollMode.HORIZONTAL:break;case i.ScrollMode.PAGE:case i.ScrollMode.VERTICAL:{if(this._spreadMode===i.SpreadMode.NONE)break;const n=this._spreadMode-1;if(t&&e%2!==n)break;if(!t&&e%2===n)break;const{views:r}=this._getVisiblePages(),s=t?e-1:e+1;for(const{id:e,percent:t,widthPercent:n}of r)if(e===s){if(t>0&&100===n)return 2;break}break}}return 1}nextPage(){const e=this._currentPageNumber,t=this.pagesCount;if(e>=t)return!1;const n=this._getPageAdvance(e,!1)||1;return this.currentPageNumber=Math.min(e+n,t),!0}previousPage(){const e=this._currentPageNumber;if(e<=1)return!1;const t=this._getPageAdvance(e,!0)||1;return this.currentPageNumber=Math.max(e-t,1),!0}increaseScale(e=1){let t=this._currentScale;do{t=(t*i.DEFAULT_SCALE_DELTA).toFixed(2),t=Math.ceil(10*t)/10,t=Math.min(i.MAX_SCALE,t)}while(--e>0&&t<i.MAX_SCALE);this.currentScaleValue=t}decreaseScale(e=1){let t=this._currentScale;do{t=(t/i.DEFAULT_SCALE_DELTA).toFixed(2),t=Math.floor(10*t)/10,t=Math.max(i.MIN_SCALE,t)}while(--e>0&&t>i.MIN_SCALE);this.currentScaleValue=t}updateContainerHeightCss(){const e=this.container.clientHeight;e!==this.#xt&&(this.#xt=e,i.docStyle.setProperty("--viewer-container-height",`${e}px`))}get annotationEditorMode(){return this.#Ct?this.#St:r.AnnotationEditorType.DISABLE}set annotationEditorMode(e){if(!this.#Ct)throw new Error("The AnnotationEditor is not enabled.");if(this.#St!==e){if(!v(e))throw new Error(`Invalid AnnotationEditor mode: ${e}`);this.pdfDocument&&(this.#St=e,this.eventBus.dispatch("annotationeditormodechanged",{source:this,mode:e}),this.#Ct.updateMode(e))}}set annotationEditorParams({type:e,value:t}){if(!this.#Ct)throw new Error("The AnnotationEditor is not enabled.");this.#Ct.updateParams(e,t)}refresh(){if(!this.pdfDocument)return;const e={};for(const t of this._pages)t.update(e);this.update()}}t.BaseViewer=b},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFPageView=void 0;var r=n(3),i=n(7),s=n(14),a=n(4),o=n(15);const l=s.compatibilityParams.maxCanvasPixels||16777216;t.PDFPageView=class{#At=r.AnnotationMode.ENABLE_FORMS;#jt={initialOptionalContent:!0,regularAnnotations:!0};constructor(e){const t=e.container,n=e.defaultViewport;this.id=e.id,this.renderingId="page"+this.id,this.pdfPage=null,this.pageLabel=null,this.rotation=0,this.scale=e.scale||i.DEFAULT_SCALE,this.viewport=n,this.pdfPageRotate=n.rotation,this._optionalContentConfigPromise=e.optionalContentConfigPromise||null,this.hasRestrictedScaling=!1,this.textLayerMode=e.textLayerMode??i.TextLayerMode.ENABLE,this.#At=e.annotationMode??r.AnnotationMode.ENABLE_FORMS,this.imageResourcesPath=e.imageResourcesPath||"",this.useOnlyCssZoom=e.useOnlyCssZoom||!1,this.maxCanvasPixels=e.maxCanvasPixels||l,this.pageColors=e.pageColors||null,this.eventBus=e.eventBus,this.renderingQueue=e.renderingQueue,this.textLayerFactory=e.textLayerFactory,this.annotationLayerFactory=e.annotationLayerFactory,this.annotationEditorLayerFactory=e.annotationEditorLayerFactory,this.xfaLayerFactory=e.xfaLayerFactory,this.textHighlighter=e.textHighlighterFactory?.createTextHighlighter({pageIndex:this.id-1,eventBus:this.eventBus}),this.structTreeLayerFactory=e.structTreeLayerFactory,this.renderer=e.renderer||i.RendererType.CANVAS,this.l10n=e.l10n||a.NullL10n,this.paintTask=null,this.paintedViewportMap=new WeakMap,this.renderingState=i.RenderingStates.INITIAL,this.resume=null,this._renderError=null,this._isStandalone=!this.renderingQueue?.hasViewer(),this._annotationCanvasMap=null,this.annotationLayer=null,this.annotationEditorLayer=null,this.textLayer=null,this.zoomLayer=null,this.xfaLayer=null,this.structTreeLayer=null;const s=document.createElement("div");if(s.className="page",s.style.width=Math.floor(this.viewport.width)+"px",s.style.height=Math.floor(this.viewport.height)+"px",s.setAttribute("data-page-number",this.id),s.setAttribute("role","region"),this.l10n.get("page_landmark",{page:this.id}).then((e=>{s.setAttribute("aria-label",e)})),this.div=s,t?.append(s),this._isStandalone){const{optionalContentConfigPromise:t}=e;t&&t.then((e=>{t===this._optionalContentConfigPromise&&(this.#jt.initialOptionalContent=e.hasInitialVisibility)}))}}setPdfPage(e){this.pdfPage=e,this.pdfPageRotate=e.rotate;const t=(this.rotation+this.pdfPageRotate)%360;this.viewport=e.getViewport({scale:this.scale*r.PixelsPerInch.PDF_TO_CSS_UNITS,rotation:t}),this.reset()}destroy(){this.reset(),this.pdfPage&&this.pdfPage.cleanup()}async _renderAnnotationLayer(){let e=null;try{await this.annotationLayer.render(this.viewport,"display")}catch(t){console.error(`_renderAnnotationLayer: "${t}".`),e=t}finally{this.eventBus.dispatch("annotationlayerrendered",{source:this,pageNumber:this.id,error:e})}}async _renderAnnotationEditorLayer(){let e=null;try{await this.annotationEditorLayer.render(this.viewport,"display")}catch(t){console.error(`_renderAnnotationEditorLayer: "${t}".`),e=t}finally{this.eventBus.dispatch("annotationeditorlayerrendered",{source:this,pageNumber:this.id,error:e})}}async _renderXfaLayer(){let e=null;try{const t=await this.xfaLayer.render(this.viewport,"display");this.textHighlighter&&this._buildXfaTextContentItems(t.textDivs)}catch(t){console.error(`_renderXfaLayer: "${t}".`),e=t}finally{this.eventBus.dispatch("xfalayerrendered",{source:this,pageNumber:this.id,error:e})}}async _buildXfaTextContentItems(e){const t=await this.pdfPage.getTextContent(),n=[];for(const e of t.items)n.push(e.str);this.textHighlighter.setTextMapping(e,n),this.textHighlighter.enable()}_resetZoomLayer(e=!1){if(!this.zoomLayer)return;const t=this.zoomLayer.firstChild;this.paintedViewportMap.delete(t),t.width=0,t.height=0,e&&this.zoomLayer.remove(),this.zoomLayer=null}reset({keepZoomLayer:e=!1,keepAnnotationLayer:t=!1,keepAnnotationEditorLayer:n=!1,keepXfaLayer:r=!1}={}){this.cancelRendering({keepAnnotationLayer:t,keepAnnotationEditorLayer:n,keepXfaLayer:r}),this.renderingState=i.RenderingStates.INITIAL;const s=this.div;s.style.width=Math.floor(this.viewport.width)+"px",s.style.height=Math.floor(this.viewport.height)+"px";const a=s.childNodes,o=e&&this.zoomLayer||null,l=t&&this.annotationLayer?.div||null,c=n&&this.annotationEditorLayer?.div||null,u=r&&this.xfaLayer?.div||null;for(let e=a.length-1;e>=0;e--){const t=a[e];switch(t){case o:case l:case c:case u:continue}t.remove()}s.removeAttribute("data-loaded"),l&&this.annotationLayer.hide(),c?this.annotationEditorLayer.hide():this.annotationEditorLayer?.destroy(),u&&this.xfaLayer.hide(),o||(this.canvas&&(this.paintedViewportMap.delete(this.canvas),this.canvas.width=0,this.canvas.height=0,delete this.canvas),this._resetZoomLayer()),this.svg&&(this.paintedViewportMap.delete(this.svg),delete this.svg),this.loadingIconDiv=document.createElement("div"),this.loadingIconDiv.className="loadingIcon notVisible",this._isStandalone&&this.toggleLoadingIconSpinner(!0),this.loadingIconDiv.setAttribute("role","img"),this.l10n.get("loading").then((e=>{this.loadingIconDiv?.setAttribute("aria-label",e)})),s.append(this.loadingIconDiv)}update({scale:e=0,rotation:t=null,optionalContentConfigPromise:n=null}){this.scale=e||this.scale,"number"==typeof t&&(this.rotation=t),n instanceof Promise&&(this._optionalContentConfigPromise=n,n.then((e=>{n===this._optionalContentConfigPromise&&(this.#jt.initialOptionalContent=e.hasInitialVisibility)})));const s=(this.rotation+this.pdfPageRotate)%360;if(this.viewport=this.viewport.clone({scale:this.scale*r.PixelsPerInch.PDF_TO_CSS_UNITS,rotation:s}),this._isStandalone&&i.docStyle.setProperty("--scale-factor",this.viewport.scale),this.svg)return this.cssTransform({target:this.svg,redrawAnnotationLayer:!0,redrawAnnotationEditorLayer:!0,redrawXfaLayer:!0}),void this.eventBus.dispatch("pagerendered",{source:this,pageNumber:this.id,cssTransform:!0,timestamp:performance.now(),error:this._renderError});let a=!1;if(this.canvas&&this.maxCanvasPixels>0){const e=this.outputScale;(Math.floor(this.viewport.width)*e.sx|0)*(Math.floor(this.viewport.height)*e.sy|0)>this.maxCanvasPixels&&(a=!0)}if(this.canvas){if(this.useOnlyCssZoom||this.hasRestrictedScaling&&a)return this.cssTransform({target:this.canvas,redrawAnnotationLayer:!0,redrawAnnotationEditorLayer:!0,redrawXfaLayer:!0}),void this.eventBus.dispatch("pagerendered",{source:this,pageNumber:this.id,cssTransform:!0,timestamp:performance.now(),error:this._renderError});this.zoomLayer||this.canvas.hidden||(this.zoomLayer=this.canvas.parentNode,this.zoomLayer.style.position="absolute")}this.zoomLayer&&this.cssTransform({target:this.zoomLayer.firstChild}),this.reset({keepZoomLayer:!0,keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0})}cancelRendering({keepAnnotationLayer:e=!1,keepAnnotationEditorLayer:t=!1,keepXfaLayer:n=!1}={}){this.paintTask&&(this.paintTask.cancel(),this.paintTask=null),this.resume=null,this.textLayer&&(this.textLayer.cancel(),this.textLayer=null),!this.annotationLayer||e&&this.annotationLayer.div||(this.annotationLayer.cancel(),this.annotationLayer=null,this._annotationCanvasMap=null),!this.annotationEditorLayer||t&&this.annotationEditorLayer.div||(this.annotationEditorLayer.cancel(),this.annotationEditorLayer=null),!this.xfaLayer||n&&this.xfaLayer.div||(this.xfaLayer.cancel(),this.xfaLayer=null,this.textHighlighter?.disable()),this._onTextLayerRendered&&(this.eventBus._off("textlayerrendered",this._onTextLayerRendered),this._onTextLayerRendered=null)}cssTransform({target:e,redrawAnnotationLayer:t=!1,redrawAnnotationEditorLayer:n=!1,redrawXfaLayer:r=!1}){const i=this.viewport.width,s=this.viewport.height,a=this.div;e.style.width=e.parentNode.style.width=a.style.width=Math.floor(i)+"px",e.style.height=e.parentNode.style.height=a.style.height=Math.floor(s)+"px";const o=this.viewport.rotation-this.paintedViewportMap.get(e).rotation,l=Math.abs(o);let c=1,u=1;if(90!==l&&270!==l||(c=s/i,u=i/s),e.style.transform=`rotate(${o}deg) scale(${c}, ${u})`,this.textLayer){const e=this.textLayer.viewport,t=this.viewport.rotation-e.rotation,n=Math.abs(t);let r=i/e.width;90!==n&&270!==n||(r=i/e.height);const s=this.textLayer.textLayerDiv;let a,o;switch(n){case 0:a=o=0;break;case 90:a=0,o="-"+s.style.height;break;case 180:a="-"+s.style.width,o="-"+s.style.height;break;case 270:a="-"+s.style.width,o=0;break;default:console.error("Bad rotation value.")}s.style.transform=`rotate(${n}deg) scale(${r}) translate(${a}, ${o})`,s.style.transformOrigin="0% 0%"}t&&this.annotationLayer&&this._renderAnnotationLayer(),n&&this.annotationEditorLayer&&this._renderAnnotationEditorLayer(),r&&this.xfaLayer&&this._renderXfaLayer()}get width(){return this.viewport.width}get height(){return this.viewport.height}getPagePoint(e,t){return this.viewport.convertToPdfPoint(e,t)}toggleLoadingIconSpinner(e=!1){this.loadingIconDiv?.classList.toggle("notVisible",!e)}draw(){this.renderingState!==i.RenderingStates.INITIAL&&(console.error("Must be in new state before drawing"),this.reset());const{div:e,pdfPage:t}=this;if(!t)return this.renderingState=i.RenderingStates.FINISHED,this.loadingIconDiv&&(this.loadingIconDiv.remove(),delete this.loadingIconDiv),Promise.reject(new Error("pdfPage is not loaded"));this.renderingState=i.RenderingStates.RUNNING;const n=document.createElement("div");n.style.width=e.style.width,n.style.height=e.style.height,n.classList.add("canvasWrapper");const s=this.annotationLayer?.div||this.annotationEditorLayer?.div;s?s.before(n):e.append(n);let a=null;if(this.textLayerMode!==i.TextLayerMode.DISABLE&&this.textLayerFactory){this._accessibilityManager||=new o.TextAccessibilityManager;const t=document.createElement("div");t.className="textLayer",t.style.width=n.style.width,t.style.height=n.style.height,s?s.before(t):e.append(t),a=this.textLayerFactory.createTextLayerBuilder({textLayerDiv:t,pageIndex:this.id-1,viewport:this.viewport,enhanceTextSelection:this.textLayerMode===i.TextLayerMode.ENABLE_ENHANCE,eventBus:this.eventBus,highlighter:this.textHighlighter,accessibilityManager:this._accessibilityManager})}this.textLayer=a,this.#At!==r.AnnotationMode.DISABLE&&this.annotationLayerFactory&&(this._annotationCanvasMap||=new Map,this.annotationLayer||=this.annotationLayerFactory.createAnnotationLayerBuilder({pageDiv:e,pdfPage:t,imageResourcesPath:this.imageResourcesPath,renderForms:this.#At===r.AnnotationMode.ENABLE_FORMS,l10n:this.l10n,annotationCanvasMap:this._annotationCanvasMap,accessibilityManager:this._accessibilityManager})),this.xfaLayer?.div&&e.append(this.xfaLayer.div);let l=null;this.renderingQueue&&(l=e=>{if(!this.renderingQueue.isHighestPriority(this))return this.renderingState=i.RenderingStates.PAUSED,void(this.resume=()=>{this.renderingState=i.RenderingStates.RUNNING,e()});e()});const c=async(e=null)=>{if(u===this.paintTask&&(this.paintTask=null),e instanceof r.RenderingCancelledException)this._renderError=null;else if(this._renderError=e,this.renderingState=i.RenderingStates.FINISHED,this.loadingIconDiv&&(this.loadingIconDiv.remove(),delete this.loadingIconDiv),this._resetZoomLayer(!0),this.#jt.regularAnnotations=!u.separateAnnots,this.eventBus.dispatch("pagerendered",{source:this,pageNumber:this.id,cssTransform:!1,timestamp:performance.now(),error:this._renderError}),e)throw e},u=this.renderer===i.RendererType.SVG?this.paintOnSvg(n):this.paintOnCanvas(n);u.onRenderContinue=l,this.paintTask=u;const d=u.promise.then((()=>c(null).then((()=>{if(a){const e=t.streamTextContent({includeMarkedContent:!0});a.setTextContentStream(e),a.render()}this.annotationLayer&&this._renderAnnotationLayer().then((()=>{this.annotationEditorLayerFactory&&(this.annotationEditorLayer||=this.annotationEditorLayerFactory.createAnnotationEditorLayerBuilder({pageDiv:e,pdfPage:t,l10n:this.l10n,accessibilityManager:this._accessibilityManager}),this._renderAnnotationEditorLayer())}))}))),(function(e){return c(e)}));return this.xfaLayerFactory&&(this.xfaLayer||=this.xfaLayerFactory.createXfaLayerBuilder({pageDiv:e,pdfPage:t}),this._renderXfaLayer()),this.structTreeLayerFactory&&this.textLayer&&this.canvas&&(this._onTextLayerRendered=e=>{e.pageNumber===this.id&&(this.eventBus._off("textlayerrendered",this._onTextLayerRendered),this._onTextLayerRendered=null,this.canvas&&this.pdfPage.getStructTree().then((e=>{if(!e)return;if(!this.canvas)return;const t=this.structTreeLayer.render(e);t.classList.add("structTree"),this.canvas.append(t)})))},this.eventBus._on("textlayerrendered",this._onTextLayerRendered),this.structTreeLayer=this.structTreeLayerFactory.createStructTreeLayerBuilder({pdfPage:t})),e.setAttribute("data-loaded",!0),this.eventBus.dispatch("pagerender",{source:this,pageNumber:this.id}),d}paintOnCanvas(e){const t=(0,r.createPromiseCapability)(),n={promise:t.promise,onRenderContinue(e){e()},cancel(){f.cancel()},get separateAnnots(){return f.separateAnnots}},s=this.viewport,a=document.createElement("canvas");a.setAttribute("role","presentation"),a.hidden=!0;let o=!0;const l=function(){o&&(a.hidden=!1,o=!1)};e.append(a),this.canvas=a;const c=a.getContext("2d",{alpha:!1}),u=this.outputScale=new i.OutputScale;if(this.useOnlyCssZoom){const e=s.clone({scale:r.PixelsPerInch.PDF_TO_CSS_UNITS});u.sx*=e.width/s.width,u.sy*=e.height/s.height}if(this.maxCanvasPixels>0){const e=s.width*s.height,t=Math.sqrt(this.maxCanvasPixels/e);u.sx>t||u.sy>t?(u.sx=t,u.sy=t,this.hasRestrictedScaling=!0):this.hasRestrictedScaling=!1}const d=(0,i.approximateFraction)(u.sx),h=(0,i.approximateFraction)(u.sy);a.width=(0,i.roundToDivide)(s.width*u.sx,d[0]),a.height=(0,i.roundToDivide)(s.height*u.sy,h[0]),a.style.width=(0,i.roundToDivide)(s.width,d[1])+"px",a.style.height=(0,i.roundToDivide)(s.height,h[1])+"px",this.paintedViewportMap.set(a,s);const p={canvasContext:c,transform:u.scaled?[u.sx,0,0,u.sy,0,0]:null,viewport:this.viewport,annotationMode:this.#At,optionalContentConfigPromise:this._optionalContentConfigPromise,annotationCanvasMap:this._annotationCanvasMap,pageColors:this.pageColors},f=this.pdfPage.render(p);return f.onContinue=function(e){l(),n.onRenderContinue?n.onRenderContinue(e):e()},f.promise.then((function(){l(),t.resolve()}),(function(e){l(),t.reject(e)})),n}paintOnSvg(e){let t=!1;const n=()=>{if(t)throw new r.RenderingCancelledException(`Rendering cancelled, page ${this.id}`,"svg")},s=this.pdfPage,a=this.viewport.clone({scale:r.PixelsPerInch.PDF_TO_CSS_UNITS});return{promise:s.getOperatorList({annotationMode:this.#At}).then((t=>(n(),new r.SVGGraphics(s.commonObjs,s.objs).getSVG(t,a).then((t=>{n(),this.svg=t,this.paintedViewportMap.set(t,a),t.style.width=e.style.width,t.style.height=e.style.height,this.renderingState=i.RenderingStates.FINISHED,e.append(t)}))))),onRenderContinue(e){e()},cancel(){t=!0},get separateAnnots(){return!1}}}setPageLabel(e){this.pageLabel="string"==typeof e?e:null,null!==this.pageLabel?this.div.setAttribute("data-page-label",this.pageLabel):this.div.removeAttribute("data-page-label")}get thumbnailCanvas(){const{initialOptionalContent:e,regularAnnotations:t}=this.#jt;return e&&t?this.canvas:null}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.compatibilityParams=t.OptionKind=t.AppOptions=void 0;const n=Object.create(null);t.compatibilityParams=n;{const e=navigator.userAgent||"",t=navigator.platform||"",r=navigator.maxTouchPoints||1,i=/Android/.test(e);(/\b(iPad|iPhone|iPod)(?=;)/.test(e)||"MacIntel"===t&&r>1||i)&&(n.maxCanvasPixels=5242880)}const r={VIEWER:2,API:4,WORKER:8,PREFERENCE:128};t.OptionKind=r;const i={annotationEditorMode:{value:-1,kind:r.VIEWER+r.PREFERENCE},annotationMode:{value:2,kind:r.VIEWER+r.PREFERENCE},cursorToolOnLoad:{value:0,kind:r.VIEWER+r.PREFERENCE},defaultZoomValue:{value:"",kind:r.VIEWER+r.PREFERENCE},disableHistory:{value:!1,kind:r.VIEWER},disablePageLabels:{value:!1,kind:r.VIEWER+r.PREFERENCE},enablePermissions:{value:!1,kind:r.VIEWER+r.PREFERENCE},enablePrintAutoRotate:{value:!0,kind:r.VIEWER+r.PREFERENCE},enableScripting:{value:!0,kind:r.VIEWER+r.PREFERENCE},externalLinkRel:{value:"noopener noreferrer nofollow",kind:r.VIEWER},externalLinkTarget:{value:0,kind:r.VIEWER+r.PREFERENCE},historyUpdateUrl:{value:!1,kind:r.VIEWER+r.PREFERENCE},ignoreDestinationZoom:{value:!1,kind:r.VIEWER+r.PREFERENCE},imageResourcesPath:{value:"./images/",kind:r.VIEWER},maxCanvasPixels:{value:16777216,kind:r.VIEWER},forcePageColors:{value:!1,kind:r.VIEWER+r.PREFERENCE},pageColorsBackground:{value:"Canvas",kind:r.VIEWER+r.PREFERENCE},pageColorsForeground:{value:"CanvasText",kind:r.VIEWER+r.PREFERENCE},pdfBugEnabled:{value:!1,kind:r.VIEWER+r.PREFERENCE},printResolution:{value:150,kind:r.VIEWER},sidebarViewOnLoad:{value:-1,kind:r.VIEWER+r.PREFERENCE},scrollModeOnLoad:{value:-1,kind:r.VIEWER+r.PREFERENCE},spreadModeOnLoad:{value:-1,kind:r.VIEWER+r.PREFERENCE},textLayerMode:{value:1,kind:r.VIEWER+r.PREFERENCE},useOnlyCssZoom:{value:!1,kind:r.VIEWER+r.PREFERENCE},viewerCssTheme:{value:0,kind:r.VIEWER+r.PREFERENCE},viewOnLoad:{value:0,kind:r.VIEWER+r.PREFERENCE},cMapPacked:{value:!0,kind:r.API},cMapUrl:{value:"../web/cmaps/",kind:r.API},disableAutoFetch:{value:!1,kind:r.API+r.PREFERENCE},disableFontFace:{value:!1,kind:r.API+r.PREFERENCE},disableRange:{value:!1,kind:r.API+r.PREFERENCE},disableStream:{value:!1,kind:r.API+r.PREFERENCE},docBaseUrl:{value:"",kind:r.API},enableXfa:{value:!0,kind:r.API+r.PREFERENCE},fontExtraProperties:{value:!1,kind:r.API},isEvalSupported:{value:!0,kind:r.API},maxImageSize:{value:-1,kind:r.API},pdfBug:{value:!1,kind:r.API},standardFontDataUrl:{value:"../web/standard_fonts/",kind:r.API},verbosity:{value:1,kind:r.API},workerPort:{value:null,kind:r.WORKER},workerSrc:{value:"../build/pdf.worker.js",kind:r.WORKER}};i.defaultUrl={value:"compressed.tracemonkey-pldi-09.pdf",kind:r.VIEWER},i.disablePreferences={value:!1,kind:r.VIEWER},i.locale={value:navigator.language||"en-US",kind:r.VIEWER},i.renderer={value:"canvas",kind:r.VIEWER+r.PREFERENCE},i.sandboxBundleSrc={value:"../build/pdf.sandbox.js",kind:r.VIEWER};const s=Object.create(null);t.AppOptions=class{constructor(){throw new Error("Cannot initialize AppOptions.")}static get(e){const t=s[e];if(void 0!==t)return t;const r=i[e];return void 0!==r?n[e]??r.value:void 0}static getAll(e=null){const t=Object.create(null);for(const a in i){const o=i[a];if(e){if(0==(e&o.kind))continue;if(e===r.PREFERENCE){const e=o.value,n=typeof e;if("boolean"===n||"string"===n||"number"===n&&Number.isInteger(e)){t[a]=e;continue}throw new Error(`Invalid type for preference: ${a}`)}}const l=s[a];t[a]=void 0!==l?l:n[a]??o.value}return t}static set(e,t){s[e]=t}static setAll(e){for(const t in e)s[t]=e[t]}static remove(e){delete s[e]}static _hasUserOptions(){return Object.keys(s).length>0}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TextAccessibilityManager=void 0;var r=n(7);class i{#$t=!1;#Ht=null;#Bt=new Map;#Vt=new Map;setTextMapping(e){this.#Ht=e}static#Wt(e,t){const n=e.getBoundingClientRect(),r=t.getBoundingClientRect();if(0===n.width&&0===n.height)return 1;if(0===r.width&&0===r.height)return-1;const i=n.y,s=n.y+n.height,a=n.y+n.height/2,o=r.y,l=r.y+r.height,c=r.y+r.height/2;return a<=o&&c>=s?-1:c<=i&&a>=l?1:n.x+n.width/2-(r.x+r.width/2)}enable(){if(this.#$t)throw new Error("TextAccessibilityManager is already enabled.");if(!this.#Ht)throw new Error("Text divs and strings have not been set.");if(this.#$t=!0,this.#Ht=this.#Ht.slice(),this.#Ht.sort(i.#Wt),this.#Bt.size>0){const e=this.#Ht;for(const[t,n]of this.#Bt)document.getElementById(t)?this.#qt(t,e[n]):this.#Bt.delete(t)}for(const[e,t]of this.#Vt)this.addPointerInTextLayer(e,t);this.#Vt.clear()}disable(){this.#$t&&(this.#Vt.clear(),this.#Ht=null,this.#$t=!1)}removePointerInTextLayer(e){if(!this.#$t)return void this.#Vt.delete(e);const t=this.#Ht;if(!t||0===t.length)return;const{id:n}=e,r=this.#Bt.get(n);if(void 0===r)return;const i=t[r];this.#Bt.delete(n);let s=i.getAttribute("aria-owns");s?.includes(n)&&(s=s.split(" ").filter((e=>e!==n)).join(" "),s?i.setAttribute("aria-owns",s):(i.removeAttribute("aria-owns"),i.setAttribute("role","presentation")))}#qt(e,t){const n=t.getAttribute("aria-owns");n?.includes(e)||t.setAttribute("aria-owns",n?`${n} ${e}`:e),t.removeAttribute("role")}addPointerInTextLayer(e,t){const{id:n}=e;if(!n)return;if(!this.#$t)return void this.#Vt.set(e,t);t&&this.removePointerInTextLayer(e);const s=this.#Ht;if(!s||0===s.length)return;const a=(0,r.binarySearchFirstItem)(s,(t=>i.#Wt(e,t)<0)),o=Math.max(0,a-1);this.#qt(n,s[o]),this.#Bt.set(n,o)}moveElementInDOM(e,t,n,s){if(this.addPointerInTextLayer(n,s),!e.hasChildNodes())return void e.append(t);const a=Array.from(e.childNodes).filter((e=>e!==t));if(0===a.length)return;const o=n||t,l=(0,r.binarySearchFirstItem)(a,(e=>i.#Wt(o,e)<0));0===l?a[0].before(t):a[l-1].after(t)}}t.TextAccessibilityManager=i},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFRenderingQueue=void 0;var r=n(3),i=n(7);t.PDFRenderingQueue=class{constructor(){this.pdfViewer=null,this.pdfThumbnailViewer=null,this.onIdle=null,this.highestPriorityPage=null,this.idleTimeout=null,this.printing=!1,this.isThumbnailViewEnabled=!1}setViewer(e){this.pdfViewer=e}setThumbnailViewer(e){this.pdfThumbnailViewer=e}isHighestPriority(e){return this.highestPriorityPage===e.renderingId}hasViewer(){return!!this.pdfViewer}renderHighestPriority(e){this.idleTimeout&&(clearTimeout(this.idleTimeout),this.idleTimeout=null),this.pdfViewer.forceRendering(e)||this.isThumbnailViewEnabled&&this.pdfThumbnailViewer?.forceRendering()||this.printing||this.onIdle&&(this.idleTimeout=setTimeout(this.onIdle.bind(this),3e4))}getHighestPriority(e,t,n,r=!1){const i=e.views,s=i.length;if(0===s)return null;for(let e=0;e<s;e++){const t=i[e].view;if(!this.isViewFinished(t))return t}const a=e.first.id,o=e.last.id;if(o-a+1>s){const r=e.ids;for(let e=1,i=o-a;e<i;e++){const i=n?a+e:o-e;if(r.has(i))continue;const s=t[i-1];if(!this.isViewFinished(s))return s}}let l=n?o:a-2,c=t[l];return c&&!this.isViewFinished(c)||r&&(l+=n?1:-1,c=t[l],c&&!this.isViewFinished(c))?c:null}isViewFinished(e){return e.renderingState===i.RenderingStates.FINISHED}renderView(e){switch(e.renderingState){case i.RenderingStates.FINISHED:return!1;case i.RenderingStates.PAUSED:this.highestPriorityPage=e.renderingId,e.resume();break;case i.RenderingStates.RUNNING:this.highestPriorityPage=e.renderingId;break;case i.RenderingStates.INITIAL:this.highestPriorityPage=e.renderingId,e.draw().finally((()=>{this.renderHighestPriority()})).catch((e=>{e instanceof r.RenderingCancelledException||console.error(`renderView: "${e}"`)}))}return!0}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TextHighlighter=void 0,t.TextHighlighter=class{constructor({findController:e,eventBus:t,pageIndex:n}){this.findController=e,this.matches=[],this.eventBus=t,this.pageIdx=n,this._onUpdateTextLayerMatches=null,this.textDivs=null,this.textContentItemsStr=null,this.enabled=!1}setTextMapping(e,t){this.textDivs=e,this.textContentItemsStr=t}enable(){if(!this.textDivs||!this.textContentItemsStr)throw new Error("Text divs and strings have not been set.");if(this.enabled)throw new Error("TextHighlighter is already enabled.");this.enabled=!0,this._onUpdateTextLayerMatches||(this._onUpdateTextLayerMatches=e=>{e.pageIndex!==this.pageIdx&&-1!==e.pageIndex||this._updateMatches()},this.eventBus._on("updatetextlayermatches",this._onUpdateTextLayerMatches)),this._updateMatches()}disable(){this.enabled&&(this.enabled=!1,this._onUpdateTextLayerMatches&&(this.eventBus._off("updatetextlayermatches",this._onUpdateTextLayerMatches),this._onUpdateTextLayerMatches=null))}_convertMatches(e,t){if(!e)return[];const{textContentItemsStr:n}=this;let r=0,i=0;const s=n.length-1,a=[];for(let o=0,l=e.length;o<l;o++){let l=e[o];for(;r!==s&&l>=i+n[r].length;)i+=n[r].length,r++;r===n.length&&console.error("Could not find a matching mapping");const c={begin:{divIdx:r,offset:l-i}};for(l+=t[o];r!==s&&l>i+n[r].length;)i+=n[r].length,r++;c.end={divIdx:r,offset:l-i},a.push(c)}return a}_renderMatches(e){if(0===e.length)return;const{findController:t,pageIdx:n}=this,{textContentItemsStr:r,textDivs:i}=this,s=n===t.selected.pageIdx,a=t.selected.matchIdx;let o=null;const l={divIdx:-1,offset:void 0};function c(e,t){const n=e.divIdx;return i[n].textContent="",u(n,0,e.offset,t)}function u(e,t,n,s){let a=i[e];if(a.nodeType===Node.TEXT_NODE){const t=document.createElement("span");a.before(t),t.append(a),i[e]=t,a=t}const o=r[e].substring(t,n),l=document.createTextNode(o);if(s){const e=document.createElement("span");return e.className=`${s} appended`,e.append(l),a.append(e),s.includes("selected")?e.offsetLeft:0}return a.append(l),0}let d=a,h=d+1;if(t.state.highlightAll)d=0,h=e.length;else if(!s)return;for(let r=d;r<h;r++){const d=e[r],h=d.begin,p=d.end,f=s&&r===a,g=f?" selected":"";let m=0;if(o&&h.divIdx===o.divIdx?u(o.divIdx,o.offset,h.offset):(null!==o&&u(o.divIdx,o.offset,l.offset),c(h)),h.divIdx===p.divIdx)m=u(h.divIdx,h.offset,p.offset,"highlight"+g);else{m=u(h.divIdx,h.offset,l.offset,"highlight begin"+g);for(let e=h.divIdx+1,t=p.divIdx;e<t;e++)i[e].className="highlight middle"+g;c(p,"highlight end"+g)}o=p,f&&t.scrollMatchIntoView({element:i[h.divIdx],selectedLeft:m,pageIndex:n,matchIndex:a})}o&&u(o.divIdx,o.offset,l.offset)}_updateMatches(){if(!this.enabled)return;const{findController:e,matches:t,pageIdx:n}=this,{textContentItemsStr:r,textDivs:i}=this;let s=-1;for(let e=0,n=t.length;e<n;e++){const n=t[e];for(let e=Math.max(s,n.begin.divIdx),t=n.end.divIdx;e<=t;e++){const t=i[e];t.textContent=r[e],t.className=""}s=n.end.divIdx+1}if(!e?.highlightMatches)return;const a=e.pageMatches[n]||null,o=e.pageMatchesLength[n]||null;this.matches=this._convertMatches(a,o),this._renderMatches(this.matches)}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DownloadManager=void 0;var r=n(3);function i(e,t){const n=document.createElement("a");if(!n.click)throw new Error('DownloadManager: "a.click()" is not supported.');n.href=e,n.target="_parent","download"in n&&(n.download=t),(document.body||document.documentElement).append(n),n.click(),n.remove()}t.DownloadManager=class{constructor(){this._openBlobUrls=new WeakMap}downloadUrl(e,t){(0,r.createValidAbsoluteUrl)(e,"http://example.com")?i(e+"#pdfjs.action=download",t):console.error(`downloadUrl - not a valid URL: ${e}`)}downloadData(e,t,n){i(URL.createObjectURL(new Blob([e],{type:n})),t)}openOrDownloadData(e,t,n){const i=(0,r.isPdfFile)(n),s=i?"application/pdf":"";if(i){let r,i=this._openBlobUrls.get(e);i||(i=URL.createObjectURL(new Blob([t],{type:s})),this._openBlobUrls.set(e,i)),r="?file="+encodeURIComponent(i+"#"+n);try{return window.open(r),!0}catch(t){console.error(`openOrDownloadData: ${t}`),URL.revokeObjectURL(i),this._openBlobUrls.delete(e)}}return this.downloadData(t,n,s),!1}download(e,t,n){i(URL.createObjectURL(e),n)}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WaitOnType=t.EventBus=t.AutomationEventBus=void 0,t.waitOnEventOrTimeout=function({target:e,name:t,delay:i=0}){return new Promise((function(s,a){if("object"!=typeof e||!t||"string"!=typeof t||!(Number.isInteger(i)&&i>=0))throw new Error("waitOnEventOrTimeout - invalid parameters.");function o(n){e instanceof r?e._off(t,l):e.removeEventListener(t,l),u&&clearTimeout(u),s(n)}const l=o.bind(null,n.EVENT);e instanceof r?e._on(t,l):e.addEventListener(t,l);const c=o.bind(null,n.TIMEOUT),u=setTimeout(c,i)}))};const n={EVENT:"event",TIMEOUT:"timeout"};t.WaitOnType=n;class r{constructor(){this._listeners=Object.create(null)}on(e,t,n=null){this._on(e,t,{external:!0,once:n?.once})}off(e,t,n=null){this._off(e,t,{external:!0,once:n?.once})}dispatch(e,t){const n=this._listeners[e];if(!n||0===n.length)return;let r;for(const{listener:i,external:s,once:a}of n.slice(0))a&&this._off(e,i),s?(r||=[]).push(i):i(t);if(r){for(const e of r)e(t);r=null}}_on(e,t,n=null){(this._listeners[e]||=[]).push({listener:t,external:!0===n?.external,once:!0===n?.once})}_off(e,t,n=null){const r=this._listeners[e];if(r)for(let e=0,n=r.length;e<n;e++)if(r[e].listener===t)return void r.splice(e,1)}}t.EventBus=r,t.AutomationEventBus=class extends r{dispatch(e,t){throw new Error("Not implemented: AutomationEventBus.dispatch")}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GenericL10n=void 0,n(21);var r=n(4);const i=document.webL10n;t.GenericL10n=class{constructor(e){this._lang=e,this._ready=new Promise(((t,n)=>{i.setLanguage((0,r.fixupLangCode)(e),(()=>{t(i)}))}))}async getLanguage(){return(await this._ready).getLanguage()}async getDirection(){return(await this._ready).getDirection()}async get(e,t=null,n=(0,r.getL10nFallback)(e,t)){return(await this._ready).get(e,t,n)}async translate(e){return(await this._ready).translate(e)}}},()=>{document.webL10n=function(e,t,n){var r={},i="",s="textContent",a="",o={},l="loading";function c(e,t,n){t=t||function(e){},n=n||function(){};var r=new XMLHttpRequest;r.open("GET",e,!0),r.overrideMimeType&&r.overrideMimeType("text/plain; charset=utf-8"),r.onreadystatechange=function(){4==r.readyState&&(200==r.status||0===r.status?t(r.responseText):n())},r.onerror=n,r.ontimeout=n;try{r.send(null)}catch(e){n()}}function u(e,t,n,a){var o=e.replace(/[^\/]*$/,"")||"./";function l(e){return e.lastIndexOf("\\")<0?e:e.replace(/\\\\/g,"\\").replace(/\\n/g,"\n").replace(/\\r/g,"\r").replace(/\\t/g,"\t").replace(/\\b/g,"\b").replace(/\\f/g,"\f").replace(/\\{/g,"{").replace(/\\}/g,"}").replace(/\\"/g,'"').replace(/\\'/g,"'")}c(e,(function(e){i+=e,function(e,n){var r={},i=/^\s*|\s*$/,s=/^\s*#|^\s*$/,a=/^\s*\[(.*)\]\s*$/,u=/^\s*@import\s+url\((.*)\)\s*$/i,d=/^([^=\s]*)\s*=\s*(.+)$/;function h(e,n,c){var h=e.replace(i,"").split(/[\r\n]+/),f="*",g=t.split("-",1)[0],m=!1,v="";!function e(){for(;;){if(!h.length)return void c();var i=h.shift();if(!s.test(i)){if(n){if(v=a.exec(i)){f=v[1].toLowerCase(),m="*"!==f&&f!==t&&f!==g;continue}if(m)continue;if(v=u.exec(i))return void p(o+v[1],e)}var y=i.match(d);y&&3==y.length&&(r[y[1]]=l(y[2]))}}}()}function p(e,t){c(e,(function(e){h(e,!1,t)}),(function(){console.warn(e+" not found."),t()}))}h(e,!0,(function(){n(r)}))}(e,(function(e){for(var t in e){var i,a,o=t.lastIndexOf(".");o>0?(i=t.substring(0,o),a=t.substring(o+1)):(i=t,a=s),r[i]||(r[i]={}),r[i][a]=e[t]}n&&n()}))}),a)}function d(e,n){e&&(e=e.toLowerCase()),n=n||function(){},r={},i="",a="",a=e;var s=t.querySelectorAll('link[type="application/l10n"]'),o=s.length;if(0!==o){var c,d,h=0;d=function(){++h>=o&&(n(),l="complete")};for(var p=0;p<o;p++)new v(s[p]).load(e,d)}else{var f=(c=t.querySelector('script[type="application/l10n"]'))?JSON.parse(c.innerHTML):null;if(f&&f.locales&&f.default_locale){if(console.log("using the embedded JSON directory, early way out"),!(r=f.locales[e])){var g=f.default_locale.toLowerCase();for(var m in f.locales){if((m=m.toLowerCase())===e){r=f.locales[e];break}m===g&&(r=f.locales[g])}}n()}else console.log("no resource to load, early way out");l="complete"}function v(e){var t=e.href;this.load=function(e,n){u(t,e,n,(function(){console.warn(t+" not found."),console.warn('"'+e+'" resource not found'),a="",n()}))}}}function h(e,t,n){var i=r[e];if(!i){if(console.warn("#"+e+" is undefined."),!n)return null;i=n}var s={};for(var a in i){var o=i[a];o=f(o=p(o,t,e,a),t,e),s[a]=o}return s}function p(e,t,n,i){var s=/\{\[\s*([a-zA-Z]+)\(([a-zA-Z]+)\)\s*\]\}/.exec(e);if(!s||!s.length)return e;var a,l=s[1],c=s[2];return t&&c in t?a=t[c]:c in r&&(a=r[c]),l in o&&(e=(0,o[l])(e,a,n,i)),e}function f(e,t,n){return e.replace(/\{\{\s*(.+?)\s*\}\}/g,(function(e,i){return t&&i in t?t[i]:i in r?r[i]:(console.log("argument {{"+i+"}} for #"+n+" is undefined."),e)}))}function g(e){var n=function(e){if(!e)return{};var t=e.getAttribute("data-l10n-id"),n=e.getAttribute("data-l10n-args"),r={};if(n)try{r=JSON.parse(n)}catch(e){console.warn("could not parse arguments for #"+t)}return{id:t,args:r}}(e);if(n.id){var r=h(n.id,n.args);if(r){if(r[s]){if(0===function(e){if(e.children)return e.children.length;if(void 0!==e.childElementCount)return e.childElementCount;for(var t=0,n=0;n<e.childNodes.length;n++)t+=1===e.nodeType?1:0;return t}(e))e[s]=r[s];else{for(var i=e.childNodes,a=!1,o=0,l=i.length;o<l;o++)3===i[o].nodeType&&/\S/.test(i[o].nodeValue)&&(a?i[o].nodeValue="":(i[o].nodeValue=r[s],a=!0));if(!a){var c=t.createTextNode(r[s]);e.prepend(c)}}delete r[s]}for(var u in r)e[u]=r[u]}else console.warn("#"+n.id+" is undefined.")}}return o.plural=function(e,t,n,i){var l=parseFloat(t);if(isNaN(l))return e;if(i!=s)return e;o._pluralRules||(o._pluralRules=function(e){function t(e,t){return-1!==t.indexOf(e)}function n(e,t,n){return t<=e&&e<=n}var r={0:function(e){return"other"},1:function(e){return n(e%100,3,10)?"few":0===e?"zero":n(e%100,11,99)?"many":2==e?"two":1==e?"one":"other"},2:function(e){return 0!==e&&e%10==0?"many":2==e?"two":1==e?"one":"other"},3:function(e){return 1==e?"one":"other"},4:function(e){return n(e,0,1)?"one":"other"},5:function(e){return n(e,0,2)&&2!=e?"one":"other"},6:function(e){return 0===e?"zero":e%10==1&&e%100!=11?"one":"other"},7:function(e){return 2==e?"two":1==e?"one":"other"},8:function(e){return n(e,3,6)?"few":n(e,7,10)?"many":2==e?"two":1==e?"one":"other"},9:function(e){return 0===e||1!=e&&n(e%100,1,19)?"few":1==e?"one":"other"},10:function(e){return n(e%10,2,9)&&!n(e%100,11,19)?"few":e%10!=1||n(e%100,11,19)?"other":"one"},11:function(e){return n(e%10,2,4)&&!n(e%100,12,14)?"few":e%10==0||n(e%10,5,9)||n(e%100,11,14)?"many":e%10==1&&e%100!=11?"one":"other"},12:function(e){return n(e,2,4)?"few":1==e?"one":"other"},13:function(e){return n(e%10,2,4)&&!n(e%100,12,14)?"few":1!=e&&n(e%10,0,1)||n(e%10,5,9)||n(e%100,12,14)?"many":1==e?"one":"other"},14:function(e){return n(e%100,3,4)?"few":e%100==2?"two":e%100==1?"one":"other"},15:function(e){return 0===e||n(e%100,2,10)?"few":n(e%100,11,19)?"many":1==e?"one":"other"},16:function(e){return e%10==1&&11!=e?"one":"other"},17:function(e){return 3==e?"few":0===e?"zero":6==e?"many":2==e?"two":1==e?"one":"other"},18:function(e){return 0===e?"zero":n(e,0,2)&&0!==e&&2!=e?"one":"other"},19:function(e){return n(e,2,10)?"few":n(e,0,1)?"one":"other"},20:function(e){return!n(e%10,3,4)&&e%10!=9||n(e%100,10,19)||n(e%100,70,79)||n(e%100,90,99)?e%1e6==0&&0!==e?"many":e%10!=2||t(e%100,[12,72,92])?e%10!=1||t(e%100,[11,71,91])?"other":"one":"two":"few"},21:function(e){return 0===e?"zero":1==e?"one":"other"},22:function(e){return n(e,0,1)||n(e,11,99)?"one":"other"},23:function(e){return n(e%10,1,2)||e%20==0?"one":"other"},24:function(e){return n(e,3,10)||n(e,13,19)?"few":t(e,[2,12])?"two":t(e,[1,11])?"one":"other"}},i={af:3,ak:4,am:4,ar:1,asa:3,az:0,be:11,bem:3,bez:3,bg:3,bh:4,bm:0,bn:3,bo:0,br:20,brx:3,bs:11,ca:3,cgg:3,chr:3,cs:12,cy:17,da:3,de:3,dv:3,dz:0,ee:3,el:3,en:3,eo:3,es:3,et:3,eu:3,fa:0,ff:5,fi:3,fil:4,fo:3,fr:5,fur:3,fy:3,ga:8,gd:24,gl:3,gsw:3,gu:3,guw:4,gv:23,ha:3,haw:3,he:2,hi:4,hr:11,hu:0,id:0,ig:0,ii:0,is:3,it:3,iu:7,ja:0,jmc:3,jv:0,ka:0,kab:5,kaj:3,kcg:3,kde:0,kea:0,kk:3,kl:3,km:0,kn:0,ko:0,ksb:3,ksh:21,ku:3,kw:7,lag:18,lb:3,lg:3,ln:4,lo:0,lt:10,lv:6,mas:3,mg:4,mk:16,ml:3,mn:3,mo:9,mr:3,ms:0,mt:15,my:0,nah:3,naq:7,nb:3,nd:3,ne:3,nl:3,nn:3,no:3,nr:3,nso:4,ny:3,nyn:3,om:3,or:3,pa:3,pap:3,pl:13,ps:3,pt:3,rm:3,ro:9,rof:3,ru:11,rwk:3,sah:0,saq:3,se:7,seh:3,ses:0,sg:0,sh:11,shi:19,sk:12,sl:14,sma:7,smi:7,smj:7,smn:7,sms:7,sn:3,so:3,sq:3,sr:11,ss:3,ssy:3,st:3,sv:3,sw:3,syr:3,ta:3,te:3,teo:3,th:0,ti:4,tig:3,tk:3,tl:4,tn:3,to:0,tr:0,ts:3,tzm:22,uk:11,ur:3,ve:3,vi:0,vun:3,wa:4,wae:3,wo:0,xh:3,xog:3,yo:0,zh:0,zu:3}[e.replace(/-.*$/,"")];return i in r?r[i]:(console.warn("plural form unknown for ["+e+"]"),function(){return"other"})}(a));var c="["+o._pluralRules(l)+"]";return 0===l&&n+"[zero]"in r?e=r[n+"[zero]"][i]:1==l&&n+"[one]"in r?e=r[n+"[one]"][i]:2==l&&n+"[two]"in r?e=r[n+"[two]"][i]:n+c in r?e=r[n+c][i]:n+"[other]"in r&&(e=r[n+"[other]"][i]),e},{get:function(e,t,n){var r,i=e.lastIndexOf("."),a=s;i>0&&(a=e.substring(i+1),e=e.substring(0,i)),n&&((r={})[a]=n);var o=h(e,t,r);return o&&a in o?o[a]:"{{"+e+"}}"},getData:function(){return r},getText:function(){return i},getLanguage:function(){return a},setLanguage:function(e,t){d(e,(function(){t&&t()}))},getDirection:function(){var e=a.split("-",1)[0];return["ar","he","fa","ps","ur"].indexOf(e)>=0?"rtl":"ltr"},translate:function(e){for(var n=function(e){return e?e.querySelectorAll("*[data-l10n-id]"):[]}(e=e||t.documentElement),r=n.length,i=0;i<r;i++)g(n[i]);g(e)},getReadyState:function(){return l},ready:function(n){n&&("complete"==l||"interactive"==l?e.setTimeout((function(){n()})):t.addEventListener&&t.addEventListener("localized",(function e(){t.removeEventListener("localized",e),n()})))}}}(window,document)},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFFindController=t.FindState=void 0;var r=n(7),i=n(3),s=n(23);const a={FOUND:0,NOT_FOUND:1,WRAPPED:2,PENDING:3};t.FindState=a;const o={"‐":"-","‘":"'","’":"'","‚":"'","‛":"'","“":'"',"”":'"',"„":'"',"‟":'"',"¼":"1/4","½":"1/2","¾":"3/4"},l=new Set([12441,12442,2381,2509,2637,2765,2893,3021,3149,3277,3387,3388,3405,3530,3642,3770,3972,4153,4154,5908,5940,6098,6752,6980,7082,7083,7154,7155,11647,43014,43052,43204,43347,43456,43766,44013,3158,3953,3954,3962,3963,3964,3965,3968,3956]),c=[...l.values()].map((e=>String.fromCharCode(e))).join(""),u=/\p{M}+/gu,d=/([.*+?^${}()|[\]\\])|(\p{P})|(\s+)|(\p{M})|(\p{L})/gu,h=/([^\p{M}])\p{M}*$/u,p=/^\p{M}*([^\p{M}])/u,f=/[\uAC00-\uD7AF\uFA6C\uFACF-\uFAD1\uFAD5-\uFAD7]+/g,g=new Map;let m=null,v=null;function y(e){const t=[];let n,r;for(;null!==(n=f.exec(e));){let{index:e}=n;for(const r of n[0]){let n=g.get(r);n||(n=r.normalize("NFD").length,g.set(r,n)),t.push([n,e++])}}if(0===t.length&&m)r=m;else if(t.length>0&&v)r=v;else{const e=`([${Object.keys(o).join("")}])|(\\p{M}+(?:-\\n)?)|(\\S-\\n)|(\\n)`;r=0===t.length?m=new RegExp(e+"|(\\u0000)","gum"):v=new RegExp(e+"|([\\u1100-\\u1112\\ud7a4-\\ud7af\\ud84a\\ud84c\\ud850\\ud854\\ud857\\ud85f])","gum")}const i=[];for(;null!==(n=u.exec(e));)i.push([n[0].length,n.index]);let s=e.normalize("NFD");const a=[[0,0]];let l=0,c=0,d=0,h=0,p=0,y=!1;return s=s.replace(r,((e,n,r,s,u,f,g)=>{if(g-=h,n){const t=o[e],n=t.length;for(let e=1;e<n;e++)a.push([g-d+e,d-e]);return d-=n-1,t}if(r){const e=r.endsWith("\n"),t=e?r.length-2:r.length;y=!0;let n=t;g+p===i[l]?.[1]&&(n-=i[l][0],++l);for(let e=1;e<=n;e++)a.push([g-1-d+e,d-e]);return d-=n,h+=n,e?(g+=t-1,a.push([g-d+1,1+d]),d+=1,h+=1,p+=1,r.slice(0,t)):r}if(s)return a.push([g-d+1,1+d]),d+=1,h+=1,p+=1,s.charAt(0);if(u)return a.push([g-d+1,d-1]),d-=1,h+=1,p+=1," ";if(g+p===t[c]?.[1]){const e=t[c][0]-1;++c;for(let t=1;t<=e;t++)a.push([g-(d-t),d-t]);d-=e,h+=e}return f})),a.push([s.length,d]),[s,a,y]}function b(e,t,n){if(!e)return[t,n];const i=t,s=t+n;let a=(0,r.binarySearchFirstItem)(e,(e=>e[0]>=i));e[a][0]>i&&--a;let o=(0,r.binarySearchFirstItem)(e,(e=>e[0]>=s),a);return e[o][0]>s&&--o,[i+e[a][1],n+e[o][1]-e[a][1]]}t.PDFFindController=class{constructor({linkService:e,eventBus:t}){this._linkService=e,this._eventBus=t,this.#zt(),t._on("find",this.#Gt.bind(this)),t._on("findbarclose",this.#Qt.bind(this))}get highlightMatches(){return this._highlightMatches}get pageMatches(){return this._pageMatches}get pageMatchesLength(){return this._pageMatchesLength}get selected(){return this._selected}get state(){return this._state}setDocument(e){this._pdfDocument&&this.#zt(),e&&(this._pdfDocument=e,this._firstPageCapability.resolve())}#Gt(e){if(!e)return;const t=this._pdfDocument,{type:n}=e;(null===this._state||this.#Xt(e))&&(this._dirtyMatch=!0),this._state=e,"highlightallchange"!==n&&this.#Kt(a.PENDING),this._firstPageCapability.promise.then((()=>{if(!this._pdfDocument||t&&this._pdfDocument!==t)return;this.#Te();const e=!this._highlightMatches,r=!!this._findTimeout;this._findTimeout&&(clearTimeout(this._findTimeout),this._findTimeout=null),n?this._dirtyMatch?this.#Yt():"again"===n?(this.#Yt(),e&&this._state.highlightAll&&this.#Jt()):"highlightallchange"===n?(r?this.#Yt():this._highlightMatches=!0,this.#Jt()):this.#Yt():this._findTimeout=setTimeout((()=>{this.#Yt(),this._findTimeout=null}),250)}))}scrollMatchIntoView({element:e=null,selectedLeft:t=0,pageIndex:n=-1,matchIndex:i=-1}){if(!this._scrollMatches||!e)return;if(-1===i||i!==this._selected.matchIdx)return;if(-1===n||n!==this._selected.pageIdx)return;this._scrollMatches=!1;const s={top:-50,left:t+-400};(0,r.scrollIntoView)(e,s,!0)}#zt(){this._highlightMatches=!1,this._scrollMatches=!1,this._pdfDocument=null,this._pageMatches=[],this._pageMatchesLength=[],this._state=null,this._selected={pageIdx:-1,matchIdx:-1},this._offset={pageIdx:null,matchIdx:null,wrapped:!1},this._extractTextPromises=[],this._pageContents=[],this._pageDiffs=[],this._hasDiacritics=[],this._matchesCountTotal=0,this._pagesToSearch=null,this._pendingFindMatches=new Set,this._resumePageIdx=null,this._dirtyMatch=!1,clearTimeout(this._findTimeout),this._findTimeout=null,this._firstPageCapability=(0,i.createPromiseCapability)()}get#Zt(){return this._state.query!==this._rawQuery&&(this._rawQuery=this._state.query,[this._normalizedQuery]=y(this._state.query)),this._normalizedQuery}#Xt(e){if(e.query!==this._state.query)return!0;switch(e.type){case"again":const e=this._selected.pageIdx+1,t=this._linkService;return e>=1&&e<=t.pagesCount&&e!==t.page&&!t.isPageVisible(e);case"highlightallchange":return!1}return!0}#en(e,t,n){let r=e.slice(0,t).match(h);if(r){const n=e.charCodeAt(t),i=r[1].charCodeAt(0);if((0,s.getCharacterType)(n)===(0,s.getCharacterType)(i))return!1}if(r=e.slice(t+n).match(p),r){const i=e.charCodeAt(t+n-1),a=r[1].charCodeAt(0);if((0,s.getCharacterType)(i)===(0,s.getCharacterType)(a))return!1}return!0}#tn(e,t,n,r){const i=[],s=[],a=this._pageDiffs[n];let o;for(;null!==(o=e.exec(r));){if(t&&!this.#en(r,o.index,o[0].length))continue;const[e,n]=b(a,o.index,o[0].length);n&&(i.push(e),s.push(n))}this._pageMatches[n]=i,this._pageMatchesLength[n]=s}#nn(e,t){const{matchDiacritics:n}=this._state;let r=!1;const i="[ ]*";return(e=e.replace(d,((e,i,s,a,o,c)=>i?`[ ]*\\${i}[ ]*`:s?`[ ]*${s}[ ]*`:a?"[ ]+":n?o||c:o?l.has(o.charCodeAt(0))?o:"":t?(r=!0,`${c}\\p{M}*`):c))).endsWith(i)&&(e=e.slice(0,e.length-i.length)),n&&t&&(r=!0,e=`${e}(?=[${c}]|[^\\p{M}]|$)`),[r,e]}#rn(e){let t=this.#Zt;if(0===t.length)return;const{caseSensitive:n,entireWord:r,phraseSearch:i}=this._state,s=this._pageContents[e],a=this._hasDiacritics[e];let o=!1;if(i)[o,t]=this.#nn(t,a);else{const e=t.match(/\S+/g);e&&(t=e.sort().reverse().map((e=>{const[t,n]=this.#nn(e,a);return o||=t,`(${n})`})).join("|"))}t=new RegExp(t,`g${o?"u":""}${n?"":"i"}`),this.#tn(t,r,e,s),this._state.highlightAll&&this.#in(e),this._resumePageIdx===e&&(this._resumePageIdx=null,this.#sn());const l=this._pageMatches[e].length;l>0&&(this._matchesCountTotal+=l,this.#an())}#Te(){if(this._extractTextPromises.length>0)return;let e=Promise.resolve();for(let t=0,n=this._linkService.pagesCount;t<n;t++){const n=(0,i.createPromiseCapability)();this._extractTextPromises[t]=n.promise,e=e.then((()=>this._pdfDocument.getPage(t+1).then((e=>e.getTextContent())).then((e=>{const r=[];for(const t of e.items)r.push(t.str),t.hasEOL&&r.push("\n");[this._pageContents[t],this._pageDiffs[t],this._hasDiacritics[t]]=y(r.join("")),n.resolve()}),(e=>{console.error(`Unable to get text content for page ${t+1}`,e),this._pageContents[t]="",this._pageDiffs[t]=null,this._hasDiacritics[t]=!1,n.resolve()}))))}}#in(e){this._scrollMatches&&this._selected.pageIdx===e&&(this._linkService.page=e+1),this._eventBus.dispatch("updatetextlayermatches",{source:this,pageIndex:e})}#Jt(){this._eventBus.dispatch("updatetextlayermatches",{source:this,pageIndex:-1})}#Yt(){const e=this._state.findPrevious,t=this._linkService.page-1,n=this._linkService.pagesCount;if(this._highlightMatches=!0,this._dirtyMatch){this._dirtyMatch=!1,this._selected.pageIdx=this._selected.matchIdx=-1,this._offset.pageIdx=t,this._offset.matchIdx=null,this._offset.wrapped=!1,this._resumePageIdx=null,this._pageMatches.length=0,this._pageMatchesLength.length=0,this._matchesCountTotal=0,this.#Jt();for(let e=0;e<n;e++)this._pendingFindMatches.has(e)||(this._pendingFindMatches.add(e),this._extractTextPromises[e].then((()=>{this._pendingFindMatches.delete(e),this.#rn(e)})))}if(""===this.#Zt)return void this.#Kt(a.FOUND);if(this._resumePageIdx)return;const r=this._offset;if(this._pagesToSearch=n,null!==r.matchIdx){const t=this._pageMatches[r.pageIdx].length;if(!e&&r.matchIdx+1<t||e&&r.matchIdx>0)return r.matchIdx=e?r.matchIdx-1:r.matchIdx+1,void this.#on(!0);this.#ln(e)}this.#sn()}#cn(e){const t=this._offset,n=e.length,r=this._state.findPrevious;return n?(t.matchIdx=r?n-1:0,this.#on(!0),!0):(this.#ln(r),!!(t.wrapped&&(t.matchIdx=null,this._pagesToSearch<0))&&(this.#on(!1),!0))}#sn(){null!==this._resumePageIdx&&console.error("There can only be one pending page.");let e=null;do{const t=this._offset.pageIdx;if(e=this._pageMatches[t],!e){this._resumePageIdx=t;break}}while(!this.#cn(e))}#ln(e){const t=this._offset,n=this._linkService.pagesCount;t.pageIdx=e?t.pageIdx-1:t.pageIdx+1,t.matchIdx=null,this._pagesToSearch--,(t.pageIdx>=n||t.pageIdx<0)&&(t.pageIdx=e?n-1:0,t.wrapped=!0)}#on(e=!1){let t=a.NOT_FOUND;const n=this._offset.wrapped;if(this._offset.wrapped=!1,e){const e=this._selected.pageIdx;this._selected.pageIdx=this._offset.pageIdx,this._selected.matchIdx=this._offset.matchIdx,t=n?a.WRAPPED:a.FOUND,-1!==e&&e!==this._selected.pageIdx&&this.#in(e)}this.#Kt(t,this._state.findPrevious),-1!==this._selected.pageIdx&&(this._scrollMatches=!0,this.#in(this._selected.pageIdx))}#Qt(e){const t=this._pdfDocument;this._firstPageCapability.promise.then((()=>{!this._pdfDocument||t&&this._pdfDocument!==t||(this._findTimeout&&(clearTimeout(this._findTimeout),this._findTimeout=null),this._resumePageIdx&&(this._resumePageIdx=null,this._dirtyMatch=!0),this.#Kt(a.FOUND),this._highlightMatches=!1,this.#Jt())}))}#un(){const{pageIdx:e,matchIdx:t}=this._selected;let n=0,r=this._matchesCountTotal;if(-1!==t){for(let t=0;t<e;t++)n+=this._pageMatches[t]?.length||0;n+=t+1}return(n<1||n>r)&&(n=r=0),{current:n,total:r}}#an(){this._eventBus.dispatch("updatefindmatchescount",{source:this,matchesCount:this.#un()})}#Kt(e,t=!1){this._eventBus.dispatch("updatefindcontrolstate",{source:this,state:e,previous:t,matchesCount:this.#un(),rawQuery:this._state?.query??null})}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CharacterType=void 0,t.getCharacterType=function(e){return function(e){return e<11904}(e)?function(e){return 0==(65408&e)}(e)?function(e){return 32===e||9===e||13===e||10===e}(e)?n.SPACE:function(e){return e>=97&&e<=122||e>=65&&e<=90}(e)||function(e){return e>=48&&e<=57}(e)||95===e?n.ALPHA_LETTER:n.PUNCT:function(e){return 3584==(65408&e)}(e)?n.THAI_LETTER:160===e?n.SPACE:n.ALPHA_LETTER:function(e){return e>=13312&&e<=40959||e>=63744&&e<=64255}(e)?n.HAN_LETTER:function(e){return e>=12448&&e<=12543}(e)?n.KATAKANA_LETTER:function(e){return e>=12352&&e<=12447}(e)?n.HIRAGANA_LETTER:function(e){return e>=65376&&e<=65439}(e)?n.HALFWIDTH_KATAKANA_LETTER:n.ALPHA_LETTER};const n={SPACE:0,ALPHA_LETTER:1,PUNCT:2,HAN_LETTER:3,KATAKANA_LETTER:4,HIRAGANA_LETTER:5,HALFWIDTH_KATAKANA_LETTER:6,THAI_LETTER:7};t.CharacterType=n},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFHistory=void 0,t.isDestArraysEqual=o,t.isDestHashesEqual=a;var r=n(7),i=n(19);function s(){return document.location.hash}function a(e,t){return"string"==typeof e&&"string"==typeof t&&(e===t||(0,r.parseQueryString)(e).get("nameddest")===t)}function o(e,t){function n(e,t){if(typeof e!=typeof t)return!1;if(Array.isArray(e)||Array.isArray(t))return!1;if(null!==e&&"object"==typeof e&&null!==t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(!n(e[r],t[r]))return!1;return!0}return e===t||Number.isNaN(e)&&Number.isNaN(t)}if(!Array.isArray(e)||!Array.isArray(t))return!1;if(e.length!==t.length)return!1;for(let r=0,i=e.length;r<i;r++)if(!n(e[r],t[r]))return!1;return!0}t.PDFHistory=class{constructor({linkService:e,eventBus:t}){this.linkService=e,this.eventBus=t,this._initialized=!1,this._fingerprint="",this.reset(),this._boundEvents=null,this.eventBus._on("pagesinit",(()=>{this._isPagesLoaded=!1,this.eventBus._on("pagesloaded",(e=>{this._isPagesLoaded=!!e.pagesCount}),{once:!0})}))}initialize({fingerprint:e,resetHistory:t=!1,updateUrl:n=!1}){if(!e||"string"!=typeof e)return void console.error('PDFHistory.initialize: The "fingerprint" must be a non-empty string.');this._initialized&&this.reset();const r=""!==this._fingerprint&&this._fingerprint!==e;this._fingerprint=e,this._updateUrl=!0===n,this._initialized=!0,this._bindEvents();const i=window.history.state;if(this._popStateInProgress=!1,this._blockHashChange=0,this._currentHash=s(),this._numPositionUpdates=0,this._uid=this._maxUid=0,this._destination=null,this._position=null,!this._isValidState(i,!0)||t){const{hash:e,page:n,rotation:i}=this._parseCurrentHash(!0);return!e||r||t?void this._pushOrReplaceState(null,!0):void this._pushOrReplaceState({hash:e,page:n,rotation:i},!0)}const a=i.destination;this._updateInternalState(a,i.uid,!0),void 0!==a.rotation&&(this._initialRotation=a.rotation),a.dest?(this._initialBookmark=JSON.stringify(a.dest),this._destination.page=null):a.hash?this._initialBookmark=a.hash:a.page&&(this._initialBookmark=`page=${a.page}`)}reset(){this._initialized&&(this._pageHide(),this._initialized=!1,this._unbindEvents()),this._updateViewareaTimeout&&(clearTimeout(this._updateViewareaTimeout),this._updateViewareaTimeout=null),this._initialBookmark=null,this._initialRotation=null}push({namedDest:e=null,explicitDest:t,pageNumber:n}){if(!this._initialized)return;if(e&&"string"!=typeof e)return void console.error(`PDFHistory.push: "${e}" is not a valid namedDest parameter.`);if(!Array.isArray(t))return void console.error(`PDFHistory.push: "${t}" is not a valid explicitDest parameter.`);if(!this._isValidPage(n)&&(null!==n||this._destination))return void console.error(`PDFHistory.push: "${n}" is not a valid pageNumber parameter.`);const r=e||JSON.stringify(t);if(!r)return;let i=!1;if(this._destination&&(a(this._destination.hash,r)||o(this._destination.dest,t))){if(this._destination.page)return;i=!0}this._popStateInProgress&&!i||(this._pushOrReplaceState({dest:t,hash:r,page:n,rotation:this.linkService.rotation},i),this._popStateInProgress||(this._popStateInProgress=!0,Promise.resolve().then((()=>{this._popStateInProgress=!1}))))}pushPage(e){this._initialized&&(this._isValidPage(e)?this._destination?.page!==e&&(this._popStateInProgress||(this._pushOrReplaceState({dest:null,hash:`page=${e}`,page:e,rotation:this.linkService.rotation}),this._popStateInProgress||(this._popStateInProgress=!0,Promise.resolve().then((()=>{this._popStateInProgress=!1}))))):console.error(`PDFHistory.pushPage: "${e}" is not a valid page number.`))}pushCurrentPosition(){this._initialized&&!this._popStateInProgress&&this._tryPushCurrentPosition()}back(){if(!this._initialized||this._popStateInProgress)return;const e=window.history.state;this._isValidState(e)&&e.uid>0&&window.history.back()}forward(){if(!this._initialized||this._popStateInProgress)return;const e=window.history.state;this._isValidState(e)&&e.uid<this._maxUid&&window.history.forward()}get popStateInProgress(){return this._initialized&&(this._popStateInProgress||this._blockHashChange>0)}get initialBookmark(){return this._initialized?this._initialBookmark:null}get initialRotation(){return this._initialized?this._initialRotation:null}_pushOrReplaceState(e,t=!1){const n=t||!this._destination,r={fingerprint:this._fingerprint,uid:n?this._uid:this._uid+1,destination:e};let i;if(this._updateInternalState(e,r.uid),this._updateUrl&&e?.hash){const t=document.location.href.split("#")[0];t.startsWith("file://")||(i=`${t}#${e.hash}`)}n?window.history.replaceState(r,"",i):window.history.pushState(r,"",i)}_tryPushCurrentPosition(e=!1){if(!this._position)return;let t=this._position;if(e&&(t=Object.assign(Object.create(null),this._position),t.temporary=!0),!this._destination)return void this._pushOrReplaceState(t);if(this._destination.temporary)return void this._pushOrReplaceState(t,!0);if(this._destination.hash===t.hash)return;if(!this._destination.page&&this._numPositionUpdates<=50)return;let n=!1;if(this._destination.page>=t.first&&this._destination.page<=t.page){if(void 0!==this._destination.dest||!this._destination.first)return;n=!0}this._pushOrReplaceState(t,n)}_isValidPage(e){return Number.isInteger(e)&&e>0&&e<=this.linkService.pagesCount}_isValidState(e,t=!1){if(!e)return!1;if(e.fingerprint!==this._fingerprint){if(!t)return!1;{if("string"!=typeof e.fingerprint||e.fingerprint.length!==this._fingerprint.length)return!1;const[t]=performance.getEntriesByType("navigation");if("reload"!==t?.type)return!1}}return!(!Number.isInteger(e.uid)||e.uid<0)&&null!==e.destination&&"object"==typeof e.destination}_updateInternalState(e,t,n=!1){this._updateViewareaTimeout&&(clearTimeout(this._updateViewareaTimeout),this._updateViewareaTimeout=null),n&&e?.temporary&&delete e.temporary,this._destination=e,this._uid=t,this._maxUid=Math.max(this._maxUid,t),this._numPositionUpdates=0}_parseCurrentHash(e=!1){const t=unescape(s()).substring(1),n=(0,r.parseQueryString)(t),i=n.get("nameddest")||"";let a=0|n.get("page");return(!this._isValidPage(a)||e&&i.length>0)&&(a=null),{hash:t,page:a,rotation:this.linkService.rotation}}_updateViewarea({location:e}){this._updateViewareaTimeout&&(clearTimeout(this._updateViewareaTimeout),this._updateViewareaTimeout=null),this._position={hash:e.pdfOpenParams.substring(1),page:this.linkService.page,first:e.pageNumber,rotation:e.rotation},this._popStateInProgress||(this._isPagesLoaded&&this._destination&&!this._destination.page&&this._numPositionUpdates++,this._updateViewareaTimeout=setTimeout((()=>{this._popStateInProgress||this._tryPushCurrentPosition(!0),this._updateViewareaTimeout=null}),1e3))}_popState({state:e}){const t=s(),n=this._currentHash!==t;if(this._currentHash=t,!e){this._uid++;const{hash:e,page:t,rotation:n}=this._parseCurrentHash();return void this._pushOrReplaceState({hash:e,page:t,rotation:n},!0)}if(!this._isValidState(e))return;this._popStateInProgress=!0,n&&(this._blockHashChange++,(0,i.waitOnEventOrTimeout)({target:window,name:"hashchange",delay:1e3}).then((()=>{this._blockHashChange--})));const a=e.destination;this._updateInternalState(a,e.uid,!0),(0,r.isValidRotation)(a.rotation)&&(this.linkService.rotation=a.rotation),a.dest?this.linkService.goToDestination(a.dest):a.hash?this.linkService.setHash(a.hash):a.page&&(this.linkService.page=a.page),Promise.resolve().then((()=>{this._popStateInProgress=!1}))}_pageHide(){this._destination&&!this._destination.temporary||this._tryPushCurrentPosition()}_bindEvents(){this._boundEvents||(this._boundEvents={updateViewarea:this._updateViewarea.bind(this),popState:this._popState.bind(this),pageHide:this._pageHide.bind(this)},this.eventBus._on("updateviewarea",this._boundEvents.updateViewarea),window.addEventListener("popstate",this._boundEvents.popState),window.addEventListener("pagehide",this._boundEvents.pageHide))}_unbindEvents(){this._boundEvents&&(this.eventBus._off("updateviewarea",this._boundEvents.updateViewarea),window.removeEventListener("popstate",this._boundEvents.popState),window.removeEventListener("pagehide",this._boundEvents.pageHide),this._boundEvents=null)}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFScriptingManager=void 0;var r=n(7),i=n(3);t.PDFScriptingManager=class{constructor({eventBus:e,sandboxBundleSrc:t=null,scriptingFactory:n=null,docPropertiesLookup:r=null}){this._pdfDocument=null,this._pdfViewer=null,this._closeCapability=null,this._destroyCapability=null,this._scripting=null,this._mouseState=Object.create(null),this._ready=!1,this._eventBus=e,this._sandboxBundleSrc=t,this._scriptingFactory=n,this._docPropertiesLookup=r,this._scriptingFactory||window.addEventListener("updatefromsandbox",(e=>{this._eventBus.dispatch("updatefromsandbox",{source:window,detail:e.detail})}))}setViewer(e){this._pdfViewer=e}async setDocument(e){if(this._pdfDocument&&await this._destroyScripting(),this._pdfDocument=e,!e)return;const[t,n,r]=await Promise.all([e.getFieldObjects(),e.getCalculationOrderIds(),e.getJSActions()]);if(t||r){if(e===this._pdfDocument){try{this._scripting=this._createScripting()}catch(e){return console.error(`PDFScriptingManager.setDocument: "${e?.message}".`),void await this._destroyScripting()}this._internalEvents.set("updatefromsandbox",(e=>{e?.source===window&&this._updateFromSandbox(e.detail)})),this._internalEvents.set("dispatcheventinsandbox",(e=>{this._scripting?.dispatchEventInSandbox(e.detail)})),this._internalEvents.set("pagechanging",(({pageNumber:e,previous:t})=>{e!==t&&(this._dispatchPageClose(t),this._dispatchPageOpen(e))})),this._internalEvents.set("pagerendered",(({pageNumber:e})=>{this._pageOpenPending.has(e)&&e===this._pdfViewer.currentPageNumber&&this._dispatchPageOpen(e)})),this._internalEvents.set("pagesdestroy",(async e=>{await this._dispatchPageClose(this._pdfViewer.currentPageNumber),await(this._scripting?.dispatchEventInSandbox({id:"doc",name:"WillClose"})),this._closeCapability?.resolve()})),this._domEvents.set("mousedown",(e=>{this._mouseState.isDown=!0})),this._domEvents.set("mouseup",(e=>{this._mouseState.isDown=!1}));for(const[e,t]of this._internalEvents)this._eventBus._on(e,t);for(const[e,t]of this._domEvents)window.addEventListener(e,t,!0);try{const i=await this._getDocProperties();if(e!==this._pdfDocument)return;await this._scripting.createSandbox({objects:t,calculationOrder:n,appInfo:{platform:navigator.platform,language:navigator.language},docInfo:{...i,actions:r}}),this._eventBus.dispatch("sandboxcreated",{source:this})}catch(e){return console.error(`PDFScriptingManager.setDocument: "${e?.message}".`),void await this._destroyScripting()}await(this._scripting?.dispatchEventInSandbox({id:"doc",name:"Open"})),await this._dispatchPageOpen(this._pdfViewer.currentPageNumber,!0),Promise.resolve().then((()=>{e===this._pdfDocument&&(this._ready=!0)}))}}else await this._destroyScripting()}async dispatchWillSave(e){return this._scripting?.dispatchEventInSandbox({id:"doc",name:"WillSave"})}async dispatchDidSave(e){return this._scripting?.dispatchEventInSandbox({id:"doc",name:"DidSave"})}async dispatchWillPrint(e){return this._scripting?.dispatchEventInSandbox({id:"doc",name:"WillPrint"})}async dispatchDidPrint(e){return this._scripting?.dispatchEventInSandbox({id:"doc",name:"DidPrint"})}get mouseState(){return this._mouseState}get destroyPromise(){return this._destroyCapability?.promise||null}get ready(){return this._ready}get _internalEvents(){return(0,i.shadow)(this,"_internalEvents",new Map)}get _domEvents(){return(0,i.shadow)(this,"_domEvents",new Map)}get _pageOpenPending(){return(0,i.shadow)(this,"_pageOpenPending",new Set)}get _visitedPages(){return(0,i.shadow)(this,"_visitedPages",new Map)}async _updateFromSandbox(e){const t=this._pdfViewer.isInPresentationMode||this._pdfViewer.isChangingPresentationMode,{id:n,siblings:i,command:s,value:a}=e;if(!n){switch(s){case"clear":console.clear();break;case"error":console.error(a);break;case"layout":if(t)return;const e=(0,r.apiPageLayoutToViewerModes)(a);this._pdfViewer.spreadMode=e.spreadMode;break;case"page-num":this._pdfViewer.currentPageNumber=a+1;break;case"print":await this._pdfViewer.pagesPromise,this._eventBus.dispatch("print",{source:this});break;case"println":console.log(a);break;case"zoom":if(t)return;this._pdfViewer.currentScaleValue=a;break;case"SaveAs":this._eventBus.dispatch("download",{source:this});break;case"FirstPage":this._pdfViewer.currentPageNumber=1;break;case"LastPage":this._pdfViewer.currentPageNumber=this._pdfViewer.pagesCount;break;case"NextPage":this._pdfViewer.nextPage();break;case"PrevPage":this._pdfViewer.previousPage();break;case"ZoomViewIn":if(t)return;this._pdfViewer.increaseScale();break;case"ZoomViewOut":if(t)return;this._pdfViewer.decreaseScale()}return}if(t&&e.focus)return;delete e.id,delete e.siblings;const o=i?[n,...i]:[n];for(const t of o){const n=document.querySelector(`[data-element-id="${t}"]`);n?n.dispatchEvent(new CustomEvent("updatefromsandbox",{detail:e})):this._pdfDocument?.annotationStorage.setValue(t,e)}}async _dispatchPageOpen(e,t=!1){const n=this._pdfDocument,s=this._visitedPages;if(t&&(this._closeCapability=(0,i.createPromiseCapability)()),!this._closeCapability)return;const a=this._pdfViewer.getPageView(e-1);if(a?.renderingState!==r.RenderingStates.FINISHED)return void this._pageOpenPending.add(e);this._pageOpenPending.delete(e);const o=(async()=>{const t=await(s.has(e)?null:a.pdfPage?.getJSActions());n===this._pdfDocument&&await(this._scripting?.dispatchEventInSandbox({id:"page",name:"PageOpen",pageNumber:e,actions:t}))})();s.set(e,o)}async _dispatchPageClose(e){const t=this._pdfDocument,n=this._visitedPages;if(!this._closeCapability)return;if(this._pageOpenPending.has(e))return;const r=n.get(e);r&&(n.set(e,null),await r,t===this._pdfDocument&&await(this._scripting?.dispatchEventInSandbox({id:"page",name:"PageClose",pageNumber:e})))}async _getDocProperties(){if(this._docPropertiesLookup)return this._docPropertiesLookup(this._pdfDocument);const{docPropertiesLookup:e}=n(26);return e(this._pdfDocument)}_createScripting(){if(this._destroyCapability=(0,i.createPromiseCapability)(),this._scripting)throw new Error("_createScripting: Scripting already exists.");if(this._scriptingFactory)return this._scriptingFactory.createScripting({sandboxBundleSrc:this._sandboxBundleSrc});const{GenericScripting:e}=n(26);return new e(this._sandboxBundleSrc)}async _destroyScripting(){if(!this._scripting)return this._pdfDocument=null,void this._destroyCapability?.resolve();this._closeCapability&&(await Promise.race([this._closeCapability.promise,new Promise((e=>{setTimeout(e,1e3)}))]).catch((e=>{})),this._closeCapability=null),this._pdfDocument=null;try{await this._scripting.destroySandbox()}catch(e){}for(const[e,t]of this._internalEvents)this._eventBus._off(e,t);this._internalEvents.clear();for(const[e,t]of this._domEvents)window.removeEventListener(e,t,!0);this._domEvents.clear(),this._pageOpenPending.clear(),this._visitedPages.clear(),this._scripting=null,delete this._mouseState.isDown,this._ready=!1,this._destroyCapability?.resolve()}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GenericScripting=void 0,t.docPropertiesLookup=async function(e){const t="".split("#")[0];let{info:n,metadata:i,contentDispositionFilename:s,contentLength:a}=await e.getMetadata();if(!a){const{length:t}=await e.getDownloadInfo();a=t}return{...n,baseURL:t,filesize:a,filename:s||(0,r.getPdfFilenameFromUrl)(""),metadata:i?.getRaw(),authors:i?.get("dc:creator"),numPages:e.numPages,URL:""}};var r=n(3);t.GenericScripting=class{constructor(e){this._ready=(0,r.loadScript)(e,!0).then((()=>window.pdfjsSandbox.QuickJSSandbox()))}async createSandbox(e){(await this._ready).create(e)}async dispatchEventInSandbox(e){const t=await this._ready;setTimeout((()=>t.dispatchEvent(e)),0)}async destroySandbox(){(await this._ready).nukeSandbox()}}}],t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var s=t[r]={exports:{}};return e[r](s,s.exports,n),s.exports}var r={};return(()=>{var e=r;Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"AnnotationLayerBuilder",{enumerable:!0,get:function(){return o.AnnotationLayerBuilder}}),Object.defineProperty(e,"DefaultAnnotationLayerFactory",{enumerable:!0,get:function(){return t.DefaultAnnotationLayerFactory}}),Object.defineProperty(e,"DefaultStructTreeLayerFactory",{enumerable:!0,get:function(){return t.DefaultStructTreeLayerFactory}}),Object.defineProperty(e,"DefaultTextLayerFactory",{enumerable:!0,get:function(){return t.DefaultTextLayerFactory}}),Object.defineProperty(e,"DefaultXfaLayerFactory",{enumerable:!0,get:function(){return t.DefaultXfaLayerFactory}}),Object.defineProperty(e,"DownloadManager",{enumerable:!0,get:function(){return l.DownloadManager}}),Object.defineProperty(e,"EventBus",{enumerable:!0,get:function(){return c.EventBus}}),Object.defineProperty(e,"GenericL10n",{enumerable:!0,get:function(){return u.GenericL10n}}),Object.defineProperty(e,"LinkTarget",{enumerable:!0,get:function(){return i.LinkTarget}}),Object.defineProperty(e,"NullL10n",{enumerable:!0,get:function(){return d.NullL10n}}),Object.defineProperty(e,"PDFFindController",{enumerable:!0,get:function(){return h.PDFFindController}}),Object.defineProperty(e,"PDFHistory",{enumerable:!0,get:function(){return p.PDFHistory}}),Object.defineProperty(e,"PDFLinkService",{enumerable:!0,get:function(){return i.PDFLinkService}}),Object.defineProperty(e,"PDFPageView",{enumerable:!0,get:function(){return f.PDFPageView}}),Object.defineProperty(e,"PDFScriptingManager",{enumerable:!0,get:function(){return g.PDFScriptingManager}}),Object.defineProperty(e,"PDFSinglePageViewer",{enumerable:!0,get:function(){return a.PDFSinglePageViewer}}),Object.defineProperty(e,"PDFViewer",{enumerable:!0,get:function(){return a.PDFViewer}}),Object.defineProperty(e,"ProgressBar",{enumerable:!0,get:function(){return s.ProgressBar}}),Object.defineProperty(e,"RenderingStates",{enumerable:!0,get:function(){return s.RenderingStates}}),Object.defineProperty(e,"ScrollMode",{enumerable:!0,get:function(){return s.ScrollMode}}),Object.defineProperty(e,"SimpleLinkService",{enumerable:!0,get:function(){return i.SimpleLinkService}}),Object.defineProperty(e,"SpreadMode",{enumerable:!0,get:function(){return s.SpreadMode}}),Object.defineProperty(e,"StructTreeLayerBuilder",{enumerable:!0,get:function(){return m.StructTreeLayerBuilder}}),Object.defineProperty(e,"TextLayerBuilder",{enumerable:!0,get:function(){return v.TextLayerBuilder}}),Object.defineProperty(e,"XfaLayerBuilder",{enumerable:!0,get:function(){return y.XfaLayerBuilder}}),Object.defineProperty(e,"parseQueryString",{enumerable:!0,get:function(){return s.parseQueryString}});var t=n(1),i=n(6),s=n(7),a=n(11),o=n(5),l=n(18),c=n(19),u=n(20),d=n(4),h=n(22),p=n(24),f=n(13),g=n(25),m=n(8),v=n(9),y=n(10)})(),r})(),pdf_viewer.exports=factory();const PdfViewer=({src:e,pdfCMapsUrl:t,pdfWorkerUrl:n})=>{const r=React.useRef(null),i=React.useRef(null),s=React.useRef(null),[a,o]=React.useState((()=>new pdf_viewer.exports.EventBus)),[l,c]=React.useState((()=>new pdf_viewer.exports.PDFLinkService({eventBus:a}))),[u,d]=React.useState((()=>new pdf_viewer.exports.PDFFindController({eventBus:a,linkService:l}))),[h,p]=React.useState(),f=t||"",g=n||"";pdfjsLib.GlobalWorkerOptions.workerSrc=g;const[m,v]=React.useState(),y=React.useCallback((e=>{v(e)}),[]);function b(e){h&&(h.currentScaleValue="number"==typeof e?e.toFixed(2):e)}function _(e){h&&(h.currentPageNumber=e)}function w(e){e.target.setSelectionRange(0,e.target.value.length)}return React.useEffect((()=>{let e=h;if(m)return!h&&a&&(e=new pdf_viewer.exports.PDFViewer({container:m,eventBus:a,linkService:l,findController:u}),l.setViewer(e),p(e),a.on("scalechanging",(function(){s.current.value=Math.round(100*e.currentScale).toFixed(0)+"%"})),a.on("pagechanging",(function(){r.current&&(r.current.value=e.currentPageNumber.toFixed(0))})),a.on("pagesinit",(function(){e.currentScaleValue="auto",r.current.value="1",i.current.innerText=e.pagesCount.toFixed(0)}))),()=>{e&&(e.cleanup(),p(null))}}),[m]),React.useEffect((()=>{if(e&&h){let t=pdfjsLib.getDocument({url:e,enableXfa:true,cMapUrl:f,cMapPacked:true});return t.promise.then((e=>{h.setDocument(e),l.setDocument(e,null)})),()=>{t&&(t.destroy(),h.setDocument(null),l.setDocument(null,null))}}}),[e,h]),React.createElement("div",{className:"wy-content-pdf","data-controller":"pdf","data-pdf-url-value":""},React.createElement("div",{className:"wy-toolbars-bottom"},React.createElement("nav",{className:"wy-toolbar wy-toolbar-center"},React.createElement("div",{className:"wy-toolbar-buttons"},React.createElement("input",{type:"text",className:"wy-input",ref:r,onChange:function(){if(h&&r.current){let e=parseInt(r.current.value);isNaN(e)?_(h.currentPageNumber):e>h.pagesCount?_(h.pagesCount):_(e<=0?1:e)}},onClick:w,"data-pdf-target":"pageNumber"}),React.createElement("span",null,"/"),React.createElement("span",{ref:i},"1")),React.createElement("div",{className:"wy-toolbar-buttons"},React.createElement("button",{className:"wy-button wy-button-icon btn-zoom-out",onClick:function(){if(h){let e=h.currentScale,t=1;do{e/=1.1,e=Math.floor(10*e)/10,e=Math.max(.2,e)}while(--t>0&&e>.2);b(e)}},title:"Zoom out"},React.createElement(UIIcon.UI,{name:"minus"})),React.createElement("input",{type:"text",className:"wy-input",ref:s,onChange:function(){if(h&&s.current){let e=parseFloat(s.current.value.replace("%",""));isNaN(e)?b(h.currentScale+1e-4):b(e/100)}},onClick:w,value:"100%","data-pdf-target":"zoomLevel"}),React.createElement("button",{className:"wy-button wy-button-icon btn-zoom-in",onClick:function(){if(console.debug("zoomIn"),h){let e=h.currentScale,t=1;do{e*=1.1,e=Math.floor(10*e)/10,e=Math.min(3,e)}while(--t>0&&e<3);b(e)}},title:"Zoom in"},React.createElement(UIIcon.UI,{name:"plus"}))),React.createElement("div",{className:"wy-toolbar-buttons"},React.createElement("button",{className:"wy-button wy-button-icon btn-fit-page",onClick:function(){b("page-width")},title:"Fit to width"},React.createElement(UIIcon.UI,{name:"fit-width"})),React.createElement("button",{className:"wy-button wy-button-icon",onClick:function(){b("page-fit")},title:"Fit to screen"},React.createElement(UIIcon.UI,{name:"fit-screen"}))))),React.createElement("div",{ref:y,className:"wy-pdf-container"},React.createElement("div",{id:"viewer",className:"pdfViewer"})))};function checkImageLoad(e){e.complete&&0!==e.naturalHeight?e.classList.contains("wy-loading")?e.decode().then((()=>{console.debug("image is loaded after delay"),e.classList.add("wy-loaded")})):(console.debug("image is instantly loaded"),e.classList.add("wy-loading","wy-loaded")):(console.debug("image is loading"),e.classList.add("wy-loading"))}function imageLoaded(e){var t=e.target;"IMG"===t.tagName&&t.classList.contains("wy-loading")&&!t.classList.contains("wy-loaded")&&(console.debug("load event"),t.classList.add("wy-loaded"))}const Image=({src:e,previewSrc:t,width:n,height:r,more:i,onClick:s})=>{let a=n/r,o=a.toPrecision(5),l=(64*a).toPrecision(5)+"px",c=(100/a).toPrecision(5)+"%",u=n+"px",d=2*n+"px";const h=React.useCallback((e=>{e&&checkImageLoad(e)}),[]);return React.createElement("a",{href:e,className:"wy-image",onClick:e=>s(e),style:{flexBasis:l,flexGrow:o,flexShrink:o,width:u,maxWidth:d}},React.createElement("div",{className:"wy-image-area",style:{paddingBottom:c}},React.createElement("img",{ref:h,src:t,onLoad:imageLoaded,alt:"",loading:"lazy",decoding:"async"}),!!i&&React.createElement("span",{className:"wy-more"},"+",i)))},ImageGrid=({children:e,limit:t=3})=>{let n=React.Children.toArray(e),r=n.length>t?n.length-t:0,i=n.slice(0,t),s=i[i.length-1];if(React.isValidElement(s)){let e={more:r};i[i.length-1]=React.cloneElement(s,e)}return React.createElement("div",{className:"wy-image-grid"},i)},getStream=e=>{if(e&&e.ok&&e.body){const t=e.body.getReader();return new ReadableStream({start(e){let n=()=>t.read().then((({done:t,value:r})=>{if(!t)return e.enqueue(r),n();e.close()}));return n()}})}},PreviewImage=({src:e,width:t,height:n})=>{const r=React.useCallback((e=>{e&&checkImageLoad(e)}),[]);return React.createElement(React.Fragment,null,t&&n?React.createElement("div",{className:"wy-content-image wy-responsive-image",style:{"--width":t,"--height":n}},React.createElement("img",{className:"wy-loading-transition",ref:r,src:e,onLoad:imageLoaded,width:t,height:n,decoding:"async"}),React.createElement(UISpinner.UI,null)):React.createElement("div",{className:"wy-content-image wy-responsive-image wy-intrinsic-image"},React.createElement("img",{ref:r,src:e,onLoad:imageLoaded,decoding:"async"})))},PreviewDocument=({src:e,client:t})=>{let n=new URL("/js/preview.worker.js",t.url).toString(),r=new URL("/js/cmaps/",t.url).toString();return React.createElement(PdfViewer,{src:e,pdfWorkerUrl:n,pdfCMapsUrl:r})};function mediaFallback(e){e.classList.contains("wy-loading")&&e.classList.add("wy-loaded"),e.classList.add("wy-error"),e.outerHTML=e.outerHTML.replace(/<(video|audio)/,"<div").replace(/(video|audio)>/,"div>")}function mediaLoaded(e){var t=e.target;"VIDEO"!==t.tagName&&"AUDIO"!==t.tagName||t.classList.contains("wy-loading")&&(console.log("loaded"),t.classList.add("wy-loaded"))}function mediaError(e){var t,n=e.target;"SOURCE"===n.tagName&&((t=n.parentNode).dataset.errors=(t.dataset.errors||0)+1,t.querySelectorAll("source").length>=t.dataset.errors&&(console.warn(t.tagName.toLowerCase()+" source error, switching to fallback"),mediaFallback(t)))}function codecError(e){var t=e.target;"VIDEO"!==t.tagName&&"AUDIO"!==t.tagName||("VIDEO"===t.tagName&&!t.videoWidth||"AUDIO"===t.tagName&&!t.duration)&&(console.warn(t.tagName.toLowerCase()+" track not available, switching to fallback"),mediaFallback(t))}const PreviewMedia=({format:e,src:t,name:n,mediaType:r})=>{const[i,s]=React.useState(),a=React.useCallback((e=>{e&&(e.classList.add("wy-loading"),s(e))}),[]);return React.useEffect((()=>{if(i)return i.addEventListener("error",mediaError,!0),i.addEventListener("loadedmetadata",mediaLoaded,!0),i.addEventListener("loadedmetadata",codecError,!0),()=>{i.pause(),i.removeAttribute("autoplay"),i.setAttribute("preload","none"),i.removeEventListener("error",mediaError,!0),i.removeEventListener("loadedmetadata",mediaLoaded,!0),i.removeEventListener("loadedmetadata",codecError,!0)}}),[i]),"video"===e?React.createElement(React.Fragment,null,React.createElement("video",{ref:a,className:"wy-content-video",controls:!0,crossOrigin:"use-credentials",autoPlay:!0},React.createElement("source",{src:t,type:r}),React.createElement(PreviewIcon,{src:t,name:n,icon:"file-video",download:!0})),React.createElement(UISpinner.UI,null)):React.createElement(React.Fragment,null,React.createElement(PreviewIcon,{src:t,name:n,icon:"file-music",download:!0},React.createElement("audio",{ref:a,className:"wy-content-audio",controls:!0,crossOrigin:"use-credentials",autoPlay:!0},React.createElement("source",{src:t,type:r}))))},PreviewText=({src:e,html:t=!1,code:n=!1})=>{const[r,i]=React.useState("");return React.useEffect((()=>{fetch(e).then(getStream).then((e=>new Response(e))).then((e=>e.text())).then((e=>{i(e)}))}),[e]),React.createElement(React.Fragment,null,t?n?React.createElement("div",{className:"wy-content-code wy-code",dangerouslySetInnerHTML:{__html:r}}):React.createElement("div",{className:"wy-document wy-light"},React.createElement("div",{className:"wy-content-html",dangerouslySetInnerHTML:{__html:r}})):n?React.createElement("div",{className:"wy-content-code"},r):React.createElement("div",{className:"wy-document wy-light"},React.createElement("pre",{className:"wy-content-text"},r)))},PreviewEmbed=({src:e,name:t,icon:n,provider:r})=>{const[i,s]=React.useState(),a=React.useCallback((e=>{e&&(e.classList.add("wy-loading"),s(e))}),[]);return React.useEffect((()=>{if(i){let e=setTimeout((function(){console.log("fallback"),i.classList.add("wy-fallback")}),2500),t=t=>{var n=t.target;"OBJECT"===n.tagName&&n.classList.contains("wy-loading")&&!n.classList.contains("wy-loaded")&&(console.log("loaded"),n.classList.add("wy-loaded"),clearTimeout(e))};return i.addEventListener("load",t,!0),()=>{i.removeEventListener("load",t,!0),clearTimeout(e)}}}),[i]),React.createElement(React.Fragment,null,React.createElement("object",{ref:a,className:"wy-content-iframe",data:e}),React.createElement(UISpinner.UI,null),React.createElement(PreviewIcon,{src:e,name:t,icon:n,provider:r,className:"wy-content-iframe-fallback"}))},PreviewIcon=({children:e,src:t,icon:n,name:r,provider:i,download:s=!1,className:a})=>React.createElement("div",{className:classNames("wy-content-icon",a)},React.createElement("div",{className:"wy-content-icon"},React.createElement(UIIcon.UI,{name:n})),React.createElement("div",{className:"wy-content-name"},i?React.createElement(React.Fragment,null,React.createElement("span",null,"No preview available. "),React.createElement("a",{href:t,target:"_blank",title:r},`Open in ${i}?`)):s?React.createElement("a",{href:t,target:"_top",download:!0},r):React.createElement("a",{href:t,target:"_blank"},r," ",React.createElement(UIIcon.UI,{name:"open-in-new",size:1}))),e),Preview=({client:e,src:t,link:n,format:r,name:i,icon:s,width:a,height:o,mediaType:l,provider:c})=>React.createElement(React.Fragment,null,"image"===r&&React.createElement(PreviewImage,{key:t,src:t,width:a,height:o}),"pdf"===r&&React.createElement(PreviewDocument,{src:t,client:e}),("video"===r||"audio"===r)&&React.createElement(PreviewMedia,{key:t,format:r,src:t,name:i,mediaType:l}),"text"===r&&React.createElement(PreviewText,{key:t,src:t}),"code"===r&&React.createElement(PreviewText,{key:t,src:t,html:!0,code:!0}),"html"===r&&React.createElement(PreviewText,{key:t,src:t,html:!0}),"embed"===r&&React.createElement(PreviewEmbed,{key:t,src:t,name:i,icon:s,provider:c}),"none"===r&&(n?React.createElement(PreviewIcon,{src:t,name:i,icon:s,provider:c}):React.createElement(PreviewIcon,{src:t,name:i,icon:s,download:!0}))),fileSizeAsString=e=>{for(var t=e,n=[" B"," KB"," MB"," GB"," TB"," PB"," EB"," ZB"," YB"],r=0;r<n.length-1&&t>=1024;)t=100*t/1024/100,r++;return t.toLocaleString()+n[r]};function getExtension(e){return e.substring(e.lastIndexOf("."),e.length)||e}function isAudio(e){switch(e){case".aac":case".aif":case".aiff":case".au":case".gsm":case".m4a":case".mid":case".midi":case".mka":case".mp3":case".oga":case".ogg":case".ra":case".ram":case".snd":case".spx":case".wav":case".wma":return!0;default:return!1}}function isImage(e){switch(e){case".ai":case".apng":case".bmp":case".emf":case".eps":case".gif":case".heic":case".ico":case".jpg":case".jpeg":case".png":case".psd":case".svg":case".tif":case".tiff":case".webp":case".wmf":return!0;default:return!1}}function isVideo(e){switch(e){case".3g2":case".asx":case".asf":case".avi":case".flv":case".mk3d":case".mkv":case".mov":case".mp4":case".mpeg":case".mpg":case".ogm":case".ogv":case".ogx":case".qt":case".rm":case".rv":case".smi":case".smil":case".swf":case".webm":case".wmv":case".xaml":return!0;default:return!1}}function isMarkdown(e){switch(e){case".markdown":case".md":return!0;default:return!1}}function isMarkup(e){switch(e){case".htm":case".html":case".xhtml":case".xml":return!0;default:return!1}}function isCode(e){if(isMarkup(e))return!0;switch(e){case".as":case".as3":case".asm":case".aspx":case".bat":case".c":case".cc":case".cmake":case".coffee":case".cpp":case".cs":case".css":case".cxx":case".diff":case".erb":case".erl":case".groovy":case".gvy":case".h":case".haml":case".hh":case".hpp":case".hxx":case".java":case".js":case".json":case".jsx":case".less":case".lst":case".m":case".make":case".ml":case".mm":case".out":case".patch":case".php":case".pl":case".plist":case".properties":case".py":case".rb":case".sass":case".scala":case".scm":case".script":case".scss":case".sh":case".sml":case".sql":case".vb":case".vi":case".vim":case".xsd":case".xsl":case".yaml":case".yml":return!0;default:return!1}}function isText(e){return!(!isCode(e)&&!isMarkdown(e))||".txt"===e}function getIcon(e,t){var n=getExtension(e);if(""===n)return{icon:"file"};if(isAudio(n))return{icon:"file-music",color:"indigo"};if(isImage(n))return{icon:"file-image",color:"cyan"};if(isVideo(n))return{icon:"file-video",color:"pink"};if(isMarkup(n))return{icon:"file-xml",color:"purple"};if(isCode(n))return{icon:"file-code",color:"purple"};if(isText(n))return{icon:"file-document"};switch(n){case".7z":case".zip":return{icon:"file-compressed",color:"orange"};case".doc":case".docm":case".docx":case".dotm":case".dotx":return{icon:"file-word",color:"native"};case".eml":case".msg":return{icon:"email",color:""};case".xls":case".xlsm":case".xlsx":case".xltx":return{icon:"file-excel",color:"native"};case".pdf":return{icon:"file-pdf",color:"native"};case".ppt":case".pptm":case".pptx":case".potx":return{icon:"file-powerpoint",color:"native"};case".pages":return{icon:"file",color:"orange"};case".numbers":return{icon:"file",color:"green"};case".keynote":return{icon:"file",color:"blue"}}return{icon:"file"}}const PreviewContext=React.createContext({openPreview:Function,closePreview:Function});function allowedKeyTarget(e){return!e.target.matches("input, textarea, select")&&!e.target.closest('[contenteditable="true"]')}const PreviewProvider=({client:e,children:t})=>{const[n,r]=React.useState(!1),[i,s]=React.useState([]),[a,o]=React.useState(),[l,c]=React.useState(),[u,d]=React.useState(),[h,p]=React.useState();React.useEffect((()=>{if(l){var e=i.map((function(e){return e.id})).indexOf(l);p(e>0?i[e-1].id:null),d(e+1<i.length?i[e+1].id:null),o(i.find((e=>e.id===l)))}}),[i,l]);const f=()=>{r(!1)};React.useEffect((()=>{if(a){const e=e=>{27===e.which?(e.stopImmediatePropagation(),f()):37===e.which?allowedKeyTarget(e)&&c(h):39===e.which&&allowedKeyTarget(e)&&c(u)};return document.addEventListener("keyup",e),()=>{document.removeEventListener("keyup",e)}}}),[a]);let g=getExtension((null==a?void 0:a.name)||""),m=getIcon((null==a?void 0:a.name)||"").icon,v=(null==a?void 0:a.preview_url)||(null==a?void 0:a.download_url)||"";return"image"===(null==a?void 0:a.preview_format)&&(".gif"===g||".svg"===g)&&(v=(null==a?void 0:a.download_url)||""),React.createElement(React.Fragment,null,React.createElement(PreviewContext.Provider,{value:{openPreview:(e,t)=>{s(e),c(t),r(!0)},closePreview:f}},t),React.createElement(UIOverlay.UI,{isOpen:n,className:"wy-dark"},React.createElement("header",{className:"wy-appbars"},React.createElement("nav",{className:"wy-appbar"},React.createElement(UIButton.UI,{onClick:f},React.createElement(UIIcon.UI,{name:"close"})),React.createElement("div",{className:"wy-appbar-text"},a&&React.createElement("span",null,a.name)),React.createElement("div",{className:"wy-appbar-buttons"},(null==a?void 0:a.application_url)?React.createElement(UIButton.UI,{onClick:()=>{window.open(`${null==a?void 0:a.application_url}`,"_top")},title:"Open in app"},React.createElement(UIIcon.UI,{name:m})):(null==a?void 0:a.external_url)?React.createElement(UIButton.UI,{onClick:()=>{window.open(`${null==a?void 0:a.external_url}`,"_blank")},title:`Open in ${a.provider}`},React.createElement(UIIcon.UI,{name:m})):React.createElement(UIButton.UI,{onClick:()=>{window.open(`${null==a?void 0:a.download_url}&d=1`,"_top")}},React.createElement(UIIcon.UI,{name:"download"}))))),React.createElement("div",{className:"wy-preview wy-scroll-y wy-scroll-x"},a&&React.createElement(React.Fragment,null,h&&React.createElement("nav",{className:"wy-nav-prev"},React.createElement(UIButton.UI,{onClick:()=>{c(h)}},React.createElement(UIIcon.UI,{name:"previous"}))),u&&React.createElement("nav",{className:"wy-nav-next"},React.createElement(UIButton.UI,{onClick:()=>{c(u)}},React.createElement(UIIcon.UI,{name:"next"}))),React.createElement(Preview,{client:e,src:v,link:a.external_url,format:a.preview_format,name:a.name,icon:m,width:a.width,height:a.height,mediaType:a.media_type,provider:a.provider})))))};var FUNC_ERROR_TEXT$1="Expected a function",NAN$1=NaN,symbolTag$1="[object Symbol]",reTrim$1=/^\s+|\s+$/g,reIsBadHex$1=/^[-+]0x[0-9a-f]+$/i,reIsBinary$1=/^0b[01]+$/i,reIsOctal$1=/^0o[0-7]+$/i,freeParseInt$1=parseInt,freeGlobal$1="object"==typeof commonjsGlobal&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,freeSelf$1="object"==typeof self&&self&&self.Object===Object&&self,root$1=freeGlobal$1||freeSelf$1||Function("return this")(),objectProto$1=Object.prototype,objectToString$1=objectProto$1.toString,nativeMax$1=Math.max,nativeMin$1=Math.min,now$1=function(){return root$1.Date.now()};function debounce$1(e,t,n){var r,i,s,a,o,l,c=0,u=!1,d=!1,h=!0;if("function"!=typeof e)throw new TypeError(FUNC_ERROR_TEXT$1);function p(t){var n=r,s=i;return r=i=void 0,c=t,a=e.apply(s,n)}function f(e){return c=e,o=setTimeout(m,t),u?p(e):a}function g(e){var n=e-l;return void 0===l||n>=t||n<0||d&&e-c>=s}function m(){var e=now$1();if(g(e))return v(e);o=setTimeout(m,function(e){var n=t-(e-l);return d?nativeMin$1(n,s-(e-c)):n}(e))}function v(e){return o=void 0,h&&r?p(e):(r=i=void 0,a)}function y(){var e=now$1(),n=g(e);if(r=arguments,i=this,l=e,n){if(void 0===o)return f(l);if(d)return o=setTimeout(m,t),p(l)}return void 0===o&&(o=setTimeout(m,t)),a}return t=toNumber$1(t)||0,isObject$2(n)&&(u=!!n.leading,s=(d="maxWait"in n)?nativeMax$1(toNumber$1(n.maxWait)||0,t):s,h="trailing"in n?!!n.trailing:h),y.cancel=function(){void 0!==o&&clearTimeout(o),c=0,r=l=i=o=void 0},y.flush=function(){return void 0===o?a:v(now$1())},y}function throttle(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new TypeError(FUNC_ERROR_TEXT$1);return isObject$2(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),debounce$1(e,t,{leading:r,maxWait:t,trailing:i})}function isObject$2(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function isObjectLike$1(e){return!!e&&"object"==typeof e}function isSymbol$1(e){return"symbol"==typeof e||isObjectLike$1(e)&&objectToString$1.call(e)==symbolTag$1}function toNumber$1(e){if("number"==typeof e)return e;if(isSymbol$1(e))return NAN$1;if(isObject$2(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=isObject$2(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(reTrim$1,"");var n=reIsBinary$1.test(e);return n||reIsOctal$1.test(e)?freeParseInt$1(e.slice(2),n?2:8):reIsBadHex$1.test(e)?NAN$1:+e}var lodash_throttle=throttle,scrollbarClassnameTarget=document.documentElement;function checkScrollbar(e){var t;for(var n in e){t=e[n].target;try{(t===document.documentElement?window.innerWidth:t.clientWidth)!==t.offsetWidth?scrollbarClassnameTarget.classList.add("wy-scrollbars"):scrollbarClassnameTarget.classList.remove("wy-scrollbars")}catch(e){console.warn("scrollbar detection failed",e)}}return scrollbarClassnameTarget.classList.contains("wy-scrollbars")}function detectScrollbars(){var e=document.getElementById("wy-scrollbar-detection");return e||((e=document.createElement("aside")).id="wy-scrollbar-detection",e.className="wy-scrollbar-detection",document.documentElement.insertBefore(e,document.body)),new Promise((t=>{new ResizeObserver((e=>{let n=checkScrollbar(e);t(n)})).observe(e)}))}function checkScrollbarAdjust(e){for(var t in e){let n=e[t].target,r=getComputedStyle(n);void 0!==n.dataset.adjustScrollbarTop&&scrollbarClassnameTarget.style.setProperty("--wy-scrollbar-adjust-top",r.height),void 0!==n.dataset.adjustScrollbarBottom&&scrollbarClassnameTarget.style.setProperty("--wy-scrollbar-adjust-bottom",r.height)}}function detectScrollbarAdjustments(){var e=new ResizeObserver(checkScrollbarAdjust);const t=()=>{if(scrollbarClassnameTarget.style.removeProperty("--wy-scrollbar-adjust-top"),scrollbarClassnameTarget.style.removeProperty("--wy-scrollbar-adjust-bottom"),e.disconnect(),scrollbarClassnameTarget.classList.contains("wy-scrollbars")){let t=document.querySelectorAll("[data-adjust-scrollbar-top], [data-adjust-scrollbar-bottom]");t&&t.forEach((t=>{checkScrollbarAdjust([{target:t}]),e.observe(t)}))}};requestAnimationFrame(t),setTimeout(t,5e3),new MutationObserver(lodash_throttle(t,100)).observe(scrollbarClassnameTarget,{childList:!0,subtree:!0})}dayjs.extend(relativeTime),dayjs.extend(utc),dayjs.extend(timezone),dayjs.extend(localizedFormat);const WeavyContext=React.createContext({client:null,options:{}}),queryClient=new QueryClient({defaultOptions:{queries:{cacheTime:864e5}}}),WeavyProvider=({children:e,client:t,options:n})=>{let r={zoomAuthenticationUrl:void 0,teamsAuthenticationUrl:void 0,enableCloudFiles:!0,enableScrollbarDetection:!0,filebrowserUrl:"https://filebrowser.weavy.io/v14/",reactions:["😍","😎","😉","😜","👍"]},i=Object.assign(Object.assign({},r),n);return i.enableScrollbarDetection&&detectScrollbars().then((()=>detectScrollbarAdjustments())),t||queryClient.clear(),React.createElement(React.Fragment,null,t&&React.createElement(QueryClientProvider,{client:queryClient},React.createElement(WeavyContext.Provider,{value:{client:t,options:i}},React.createElement(UserProvider,{client:t},React.createElement(PreviewProvider,{client:t},e)))))};function usePresence(){const{client:e}=React.useContext(WeavyContext);if(!e)throw new Error("usePresence must be used within an WeavyProvider");React.useEffect((()=>{e.subscribe(null,"online",t)}),[]);const t=e=>{Array.isArray(e)?(document.querySelectorAll(".wy-presence").forEach((function(e){e.classList.remove("wy-presence-active")})),e.forEach((function(e){document.querySelectorAll("[data-presence-id='"+e+"']").forEach((function(e){e.classList.add("wy-presence-active")}))}))):document.querySelectorAll("[data-presence-id='"+e+"']").forEach((function(e){e.classList.add("wy-presence-active")}))}}const MessengerContext=React.createContext({selectedConversationId:null,setSelectedConversationId:e=>{}}),MessengerProvider=({children:e})=>{const[t,n]=React.useState(null);usePresence();return React.createElement(React.Fragment,null,React.createElement(MessengerContext.Provider,{value:{selectedConversationId:t,setSelectedConversationId:e=>{n(e)}}},e))};function useMembers(e,t){const{client:n}=React.useContext(WeavyContext);if(!n)throw new Error("useMembers must be used within an WeavyProvider");return useQuery(["members",e],(()=>__awaiter(this,void 0,void 0,(function*(){const t=yield n.get("/api/apps/"+e+"/members");return yield t.json()}))),t)}const Typing=({children:e,id:t,context:n})=>{const[r,i]=React.useState([]),[s,a]=React.useState(""),o=React.useRef(null),{client:l}=React.useContext(WeavyContext),{user:c}=React.useContext(UserContext);React.useEffect((()=>(u(),()=>{clearTimeout(o.current)})),[r,t,n]),React.useEffect((()=>(i([]),null==l||l.subscribe(`a${t}`,"typing",d),null==l||l.subscribe(`a${t}`,"message_created",h),()=>{null==l||l.unsubscribe(`a${t}`,"typing",d),null==l||l.unsubscribe(`a${t}`,"message_created",h)})),[t]);const u=()=>{let e=r;o.current&&(clearTimeout(o.current),o.current=null);let t=Date.now();if(e.forEach((function(n,r){t-n.time>5e3&&e.splice(r,1)})),e.length){let n=Math.round((t-Math.max.apply(null,e.map((function(e){return e.time}))))/1e3)%3+1,r=".".repeat(n),i=e.map((e=>e.display_name)).sort(),s="";for(let e=0;e<i.length;e++)e>0&&(e===i.length-1?s+=" and ":s+=", "),s+=i[e];1===i.length?s+=" is typing":s+=" are typing",a(s+r),o.current=setTimeout(u,1e3)}else a("")},d=React.useCallback((e=>{var n;e.conversation.id===t&&e.actor.id!==c.id&&(n=e.actor,r.forEach((function(e,t){e.member.id===n.id&&i(r.splice(t,1))})),n.time=Date.now(),i([...r,n]))}),[t,n,r]),h=React.useCallback((e=>{e.message.app_id===t&&i([])}),[t,n,r]);return React.createElement(React.Fragment,null,""!==s&&React.createElement(React.Fragment,null,s),""===s&&React.createElement(React.Fragment,null,e))};var Typing$1=React.memo(Typing);const Dropdown=e=>{var{directionX:t="right",directionY:n="down",children:r,className:i=""}=e,s=__rest(e,["directionX","directionY","children","className"]);const[a,o]=React.useState(!1);React.useEffect((()=>{a?document.addEventListener("click",(()=>{o(!1)})):document.removeEventListener("click",(()=>{o(!1)}))}),[a]);return React.createElement("span",Object.assign({className:classNames("wy-dropdown",{"wy-dropup":"up"===n},i)},s),React.createElement(UIButton.UI,{onClick:e=>(e=>{e.stopPropagation(),o(!a)})(e),className:classNames({"wy-active":a})},React.createElement(UIIcon.UI,{name:"dots-vertical"})),React.createElement("div",{className:classNames("wy-dropdown-menu",{"wy-dropdown-menu-end":"left"===t}),hidden:!a},r))},DropdownItem=e=>{var{children:t,className:n="",onClick:r}=e,i=__rest(e,["children","className","onClick"]);return React.createElement("div",Object.assign({className:classNames("wy-dropdown-item",n),onClick:r},i),t)},UIDropdown={UI:Dropdown,Item:DropdownItem};var FUNC_ERROR_TEXT="Expected a function",NAN=NaN,symbolTag="[object Symbol]",reTrim=/^\s+|\s+$/g,reIsBadHex=/^[-+]0x[0-9a-f]+$/i,reIsBinary=/^0b[01]+$/i,reIsOctal=/^0o[0-7]+$/i,freeParseInt=parseInt,freeGlobal="object"==typeof commonjsGlobal&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,freeSelf="object"==typeof self&&self&&self.Object===Object&&self,root=freeGlobal||freeSelf||Function("return this")(),objectProto=Object.prototype,objectToString=objectProto.toString,nativeMax=Math.max,nativeMin=Math.min,now=function(){return root.Date.now()};function debounce(e,t,n){var r,i,s,a,o,l,c=0,u=!1,d=!1,h=!0;if("function"!=typeof e)throw new TypeError(FUNC_ERROR_TEXT);function p(t){var n=r,s=i;return r=i=void 0,c=t,a=e.apply(s,n)}function f(e){return c=e,o=setTimeout(m,t),u?p(e):a}function g(e){var n=e-l;return void 0===l||n>=t||n<0||d&&e-c>=s}function m(){var e=now();if(g(e))return v(e);o=setTimeout(m,function(e){var n=t-(e-l);return d?nativeMin(n,s-(e-c)):n}(e))}function v(e){return o=void 0,h&&r?p(e):(r=i=void 0,a)}function y(){var e=now(),n=g(e);if(r=arguments,i=this,l=e,n){if(void 0===o)return f(l);if(d)return o=setTimeout(m,t),p(l)}return void 0===o&&(o=setTimeout(m,t)),a}return t=toNumber(t)||0,isObject$1(n)&&(u=!!n.leading,s=(d="maxWait"in n)?nativeMax(toNumber(n.maxWait)||0,t):s,h="trailing"in n?!!n.trailing:h),y.cancel=function(){void 0!==o&&clearTimeout(o),c=0,r=l=i=o=void 0},y.flush=function(){return void 0===o?a:v(now())},y}function isObject$1(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function isObjectLike(e){return!!e&&"object"==typeof e}function isSymbol(e){return"symbol"==typeof e||isObjectLike(e)&&objectToString.call(e)==symbolTag}function toNumber(e){if("number"==typeof e)return e;if(isSymbol(e))return NAN;if(isObject$1(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=isObject$1(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(reTrim,"");var n=reIsBinary.test(e);return n||reIsOctal.test(e)?freeParseInt(e.slice(2),n?2:8):reIsBadHex.test(e)?NAN:+e}var lodash_debounce=debounce;function useDebounce(e,t){const n=React.useRef({cb:e,delay:t});return React.useEffect((()=>{n.current={cb:e,delay:t}})),React.useCallback(lodash_debounce(((...e)=>{n.current.delay===t&&n.current.cb(...e)}),t,{leading:!1,trailing:!0}),[t,lodash_debounce])}function useSearchUsers(e,t){const{client:n}=React.useContext(WeavyContext);if(!n)throw new Error("useSearchUsers must be used within an WeavyProvider");return useQuery("users",(()=>__awaiter(this,void 0,void 0,(function*(){const t=yield n.get("/api/users?q="+e+"&skip=0&top=10");return yield t.json()}))),t)}const Presence=({id:e,status:t})=>React.createElement("span",{className:classNames("wy-presence",{"wy-presence-active":"active"===t}),"data-presence-id":e}),Avatar=({id:e,src:t,name:n,presence:r,size:i=48,className:s})=>React.createElement("div",{className:classNames("wy-avatar-presence",s)},React.createElement("img",{alt:"",title:n,className:"wy-avatar",height:i,width:i,src:t}),r&&e&&React.createElement(Presence,{id:e,status:r})),SearchUsers=({handleSubmit:e,buttonTitle:t})=>{const[n,r]=React.useState(""),[i,s]=React.useState([]),{isLoading:a,isError:o,data:l,error:c,isFetching:u,refetch:d}=useSearchUsers(n,{enabled:!1}),h=useDebounce((()=>d()),250);React.useEffect(h,[n]);const p=e=>{let t=e.currentTarget.querySelector("input[type=checkbox]");t===e.target||e.target.matches("label, input[type=checkbox]")||null==t||t.click()},f=()=>{s([]),r("")};return React.createElement("div",{className:"wy-search wy-scroll-y"},React.createElement("div",{className:"wy-pane-group"},React.createElement("div",{className:"wy-search-form wy-input-group"},React.createElement("input",{className:"wy-search-input wy-input wy-input-filled",value:n,onChange:e=>r(e.target.value),name:"text",placeholder:"Search..."}),React.createElement(UIButton.UI,{type:"reset",onClick:()=>f()},React.createElement(UIIcon.UI,{name:"close-circle"})),React.createElement(UIButton.UI,null,React.createElement(UIIcon.UI,{name:"magnify"})))),React.createElement("div",{className:"wy-pane-group"},l&&(!l.data||0===l.data.length)&&React.createElement("div",{className:"wy-table-no-result"},"Your search did not match any people."),React.createElement("table",{className:"wy-table wy-table-hover wy-search-result-table"},React.createElement("tbody",null,l&&l.data&&l.data.length>0&&l.data.map((e=>{return React.createElement("tr",{key:e.id,onClick:p},React.createElement("td",{className:"wy-table-cell-icon"},React.createElement(Avatar,{src:e.avatar_url,size:24,id:e.id,presence:e.presence,name:e.display_name})),React.createElement("td",{className:"wy-table-cell-text"},React.createElement("label",{htmlFor:"chk"+e.id},e.display_name)),React.createElement("td",{className:"wy-table-cell-icon"},React.createElement("input",{type:"checkbox",id:"chk"+e.id,checked:(t=e.id,null!=i.find((e=>e.id===t))),onChange:t=>((e,t)=>{e.target.checked?s([...i,t]):s(i.filter((e=>e.id!==t.id)))})(t,e)})));var t}))))),React.createElement("div",{className:"wy-footerbars"},React.createElement("div",{className:"wy-footerbar"},React.createElement("div",{className:"wy-pane-group"},React.createElement("div",{className:"wy-buttons"},React.createElement("button",{className:"wy-button wy-button-primary",type:"button",onClick:()=>{e(i),f()},disabled:0===i.length},t))))))};function useMutateMembers(){const{client:e}=React.useContext(WeavyContext),t=useQueryClient();if(!e)throw new Error("useMutateMembers must be used within an WeavyProvider");return useMutation((({id:t,members:n})=>__awaiter(this,void 0,void 0,(function*(){return yield e.post("/api/apps/"+t+"/members/","POST",JSON.stringify(n))}))),{onSuccess:(e,n,r)=>{t.invalidateQueries("conversations"),t.invalidateQueries(["conversation",n.id]),t.invalidateQueries(["members",n.id])}})}function useConversation(e,t){const{client:n}=React.useContext(WeavyContext);if(!n)throw new Error("useConversation must be used within an WeavyProvider");return useQuery(["conversation",e],(()=>__awaiter(this,void 0,void 0,(function*(){const t=yield n.get("/api/conversations/"+e);return yield t.json()}))),t)}function useMutateConversationName(){const{client:e}=React.useContext(WeavyContext),t=useQueryClient();if(!e)throw new Error("useMutateConversationName must be used within an WeavyProvider");return useMutation((({id:t,name:n})=>__awaiter(this,void 0,void 0,(function*(){return(yield e.post("/api/apps/"+t,"PATCH",JSON.stringify({type:"ChatRoom",name:n}))).json()}))),{onSuccess:(e,n,r)=>{t.invalidateQueries("conversations"),t.invalidateQueries(["conversation",n.id])}})}function useMutateRemoveMembers(){const{client:e}=React.useContext(WeavyContext),{setSelectedConversationId:t}=React.useContext(MessengerContext),n=useQueryClient();if(!e)throw new Error("useMutateRemoveMembers must be used within an WeavyProvider");return useMutation((({id:t,members:n})=>__awaiter(this,void 0,void 0,(function*(){return yield e.post("/api/apps/"+t+"/members/"+n.join(","),"DELETE",JSON.stringify(n))}))),{onSuccess:()=>{n.invalidateQueries("conversations"),t(null)}})}function useMessages(e,t){const{client:n}=React.useContext(WeavyContext);if(!n)throw new Error("useMessages must be used within an WeavyProvider");var r=Object.assign(Object.assign({},t),{getNextPageParam:(e,t)=>{if((null==e?void 0:e.end)<(null==e?void 0:e.count))return 25*t.length},select:e=>({pages:[...e.pages].reverse(),pageParams:[...e.pageParams].reverse()})});return useInfiniteQuery(["messages",e],(t=>__awaiter(this,void 0,void 0,(function*(){var r;let i=t.pageParam||0;const s=yield n.get("/api/apps/"+e+"/messages?orderby=createdat+desc&skip="+i+"&top=25");let a=yield s.json();return a.data=(null===(r=a.data)||void 0===r?void 0:r.reverse())||[],a}))),r)}const Attachment=({previewFormat:e,url:t,previewUrl:n,mediaType:r,name:i,kind:s,size:a,provider:o,onClick:l})=>{let c=a>0?fileSizeAsString(a):null,{icon:u,color:d}=getIcon(i);return React.createElement("a",{href:n||t,className:"wy-item wy-item-hover wy-item-lg wy-attachment",target:"_blank",title:i,onClick:l?e=>l(e):void 0},React.createElement(UIIcon.UI,{name:u,color:d,size:2}),React.createElement("div",{className:"wy-item-body wy-attachment-content"},React.createElement("div",{className:"wy-item-title wy-attachment-title"},i),c&&React.createElement("div",{className:"wy-item-text wy-attachment-meta",title:c},c)))};function useMutateReaction(){const{client:e}=React.useContext(WeavyContext);if(React.useContext(UserContext),!e)throw new Error("useMutateReaction must be used within an WeavyProvider");return useMutation((({id:t,reaction:n})=>__awaiter(this,void 0,void 0,(function*(){return yield e.post("/api/messages/"+t+"/reactions/","POST",JSON.stringify({content:n}))}))))}const events=[],callbacks={};function useForceUpdate(){const[,e]=React.useState({});return React.useCallback((()=>e({})),[])}function useEvents(){const e=useForceUpdate();return{dispatch:(t,n)=>{events.push({event:t,data:n,created:Date.now()}),((t,n)=>{t&&(t.forEach((e=>e(n))),e())})(callbacks[t],n)},on:(e,t)=>(callbacks[e]?callbacks[e].push(t):callbacks[e]=[t],()=>callbacks[e]=callbacks[e].filter((e=>e!==t))),off:(e,t)=>{callbacks[e]=callbacks[e].filter((e=>e!==t))},events:events}}function useReactions(e,t){const{on:n,off:r}=useEvents(),{user:i}=React.useContext(UserContext),[s,a]=React.useState([]),o=React.useCallback((e=>[...new Map(e.map((e=>[e.content,e]))).values()].map((t=>({content:t.content,count:e.filter((e=>e.content===t.content)).length,has_reacted:e.filter((e=>e.content===t.content&&e.created_by_id===i.id)).length>0})))),[s]),l=React.useCallback((t=>{t.entity.id===e&&a((e=>[...e||[],{content:t.reaction,created_by_id:t.actor.id}]))}),[e,s]),c=React.useCallback((t=>{t.entity.id===e&&a((e=>e.filter((e=>e.created_by_id!==t.actor.id))))}),[e,s]);return React.useLayoutEffect((()=>{a(t||[])}),[t]),React.useEffect((()=>(n("reaction_added_"+e,l),n("reaction_deleted_"+e,c),()=>{r("reaction_added_"+e,l),r("reaction_deleted_"+e,c)})),[e]),{reactionsList:o(s)}}function useMutateDeleteReaction(){const{client:e}=React.useContext(WeavyContext);if(React.useContext(UserContext),!e)throw new Error("useMutateDeleteReaction must be used within an WeavyProvider");return useMutation((({id:t,reaction:n})=>__awaiter(this,void 0,void 0,(function*(){return yield e.post("/api/messages/"+t+"/reactions/","DELETE","")}))))}const ReactionsMenu=({id:e,reactions:t})=>{const{reactionsList:n}=useReactions(e,t),r=useMutateReaction(),i=useMutateDeleteReaction(),[s,a]=React.useState(!1),{options:o}=React.useContext(WeavyContext),[l,c]=React.useState(""),u=null==o?void 0:o.reactions;React.useEffect((()=>{var e=n.find((e=>e.has_reacted));c(e?e.content:"")}),[n]),React.useEffect((()=>{s?document.addEventListener("click",(()=>{a(!1)})):document.removeEventListener("click",(()=>{a(!1)}))}),[s]);const d=t=>__awaiter(void 0,void 0,void 0,(function*(){const s=n.find((e=>e.has_reacted)),o=t.target.dataset.emoji;s&&(yield i.mutateAsync({id:e,reaction:o})),s&&s.content===o||(yield r.mutateAsync({id:e,reaction:o})),a(!1)}));return React.createElement("div",{className:classNames({"wy-active":s}),style:{position:"relative"}},React.createElement(UIButton.UI,{className:"wy-reaction-menu-button",onClick:e=>{e.stopPropagation(),a(!s)}},React.createElement(UIIcon.UI,{name:"emoticon-plus",size:1.25/1.5})),React.createElement("div",{className:"wy-reaction-menu wy-dropdown-menu",style:{display:s?"block":"none",position:"absolute",top:"-3.25rem"}},React.createElement("div",{className:"wy-reaction-picker"},null==u?void 0:u.map(((e,t)=>React.createElement(UIButton.UI,{key:t,onClick:d,className:classNames("wy-button-icon wy-reaction-button",{"wy-active":l===e}),"data-emoji":e},e))))))},ReactionsList=({id:e,reactions:t})=>{const{reactionsList:n}=useReactions(e,t);let r=n.reduce(((e,t)=>e+t.count),0);return React.createElement(React.Fragment,null,!!n&&n.map(((e,t)=>React.createElement("span",{key:t,className:"wy-reaction",title:e.count.toString()},e.content))),r>1&&React.createElement("span",{className:"wy-reaction-count"},r))},SeenBy=({seenBy:e})=>React.createElement(React.Fragment,null,e&&e.length>0&&React.createElement("div",{className:"wy-readby-status"},e.map((e=>{const t=dayjs.utc(e.marked_at).tz(dayjs.tz.guess());return React.createElement(Avatar,{name:`Seen by ${e.display_name} at ${t.format("LLLL")}`,src:e.avatar_url,size:16,key:e.id})})))),MeetingCard=({meeting:e})=>React.createElement("div",{className:"wy-list"},e.ended_at&&React.createElement("div",{className:"wy-item wy-meeting"},React.createElement(UIIcon.UI,{name:"zoom",size:4,color:"#cccccc"}),React.createElement("div",{className:"wy-item-body"},React.createElement("div",{className:"wy-item-title"},"Zoom meeting"),React.createElement("div",{className:"wy-item-body"},React.createElement("div",null,"Ended ",dayjs.utc(e.ended_at).tz(dayjs.tz.guess()).fromNow()),e.recording_url&&React.createElement("div",{className:"wy-meeting-actions"},React.createElement("a",{href:e.recording_url,target:"_blank",className:"wy-button wy-button-primary"},"Play recording"))))),!e.ended_at&&React.createElement("a",{className:"wy-item wy-meeting",href:e.join_url,target:"_blank"},React.createElement(UIIcon.UI,{name:"zoom",color:"#4a8cff",size:4}),React.createElement("div",{className:"wy-item-body"},React.createElement("div",{className:"wy-item-title"},"Zoom meeting"),React.createElement("div",{className:"wy-item-body"},React.createElement("div",null,"ID: ",`${e.provider_id.substring(0,3)}-${e.provider_id.substring(3,6)}-${e.provider_id.substring(6)}`),React.createElement("div",{className:"wy-meeting-actions"},React.createElement(UIButton.UI,{className:"wy-button-primary"},"Join meeting"))))));function usePreview(e){const{openPreview:t,closePreview:n}=React.useContext(PreviewContext);return{open:n=>{t(e,n)},close:()=>{n()}}}const Message=({id:e,html:t,temp:n,me:r,avatar:i,name:s,created_at:a,created_by:o,attachments:l,meeting:c,parentId:u,reactions:d,seenBy:h,chatRoom:p})=>{const{open:f,close:g}=usePreview(l);let m=null==l?void 0:l.filter((e=>"image"===e.kind&&e.thumbnail_url)),v=null==l?void 0:l.filter((e=>"image"!==e.kind||!e.thumbnail_url));const y=dayjs.utc(a).tz(dayjs.tz.guess()),b=(e,t)=>{e.preventDefault(),f(t)};return React.createElement(React.Fragment,null,React.createElement("div",{className:classNames("wy-message",{"wy-message-me":r})},!r&&React.createElement("div",{className:"wy-message-author"},i&&React.createElement(Avatar,{src:i,size:32,name:s})),React.createElement("div",{className:"wy-message-content"},React.createElement("div",{className:"wy-message-meta"},p&&!r&&React.createElement("span",null,o," · "),React.createElement("time",{dateTime:a,title:y.format("LLLL")},y.fromNow())),React.createElement("div",{className:"wy-message-bubble"},n&&React.createElement("div",{className:"wy-content"},t),!n&&React.createElement(React.Fragment,null,m&&!!m.length&&React.createElement(ImageGrid,null,m.map((e=>React.createElement(Image,{onClick:t=>b(t,e.id),key:e.id,src:e.download_url,previewSrc:e.preview_url,width:e.width,height:e.height})))),t&&React.createElement("div",{className:"wy-content",dangerouslySetInnerHTML:{__html:t||""}}),c&&React.createElement(MeetingCard,{meeting:c}),v&&!!v.length&&React.createElement("div",{className:"wy-list-items wy-attachments"},v.map((e=>React.createElement(Attachment,{key:e.id,onClick:t=>b(t,e.id),name:e.name,previewFormat:e.kind,provider:e.provider,url:e.download_url,previewUrl:e.provider?e.external_url:e.preview_url,mediaType:e.media_type,kind:e.kind,size:e.size})))),React.createElement("div",{className:"wy-reactions-line"},React.createElement("div",{className:"wy-reactions"},React.createElement(ReactionsList,{id:e,parentId:u,reactions:d})),!n&&React.createElement(ReactionsMenu,{id:e,reactions:d})))))),React.createElement(SeenBy,{id:e,parentId:u,seenBy:h,createdAt:a}))};function createScroller(e,t){var n=getScrollParent$1(e);n.style.overflowAnchor="none";var r=n===document.documentElement?document:n;t??=()=>Promise.reject(new Error("No scroller handler function defined"));const i=new IntersectionObserver(((e,n)=>{e.forEach((function(e){e.isIntersecting&&t()}))}),{root:r,threshold:0,rootMargin:"500px"});return i.observe(e),i}function createReverseScroller(e,t){let n=!1;var r=getScrollParent$1(e);r.style.overflowAnchor="none";var i=r===document.documentElement?document:r;t??=()=>Promise.reject(new Error("No reverse scroller handler function defined"));const s=new IntersectionObserver(((e,i)=>{e.forEach((function(e){if(e.isIntersecting&&!n){n=!0;var i=getNextPositionedChild(e.target),s=r.scrollHeight,a=i.offsetTop;let o=()=>{queueMicrotask((()=>{if(s!==r.scrollHeight){let e=i.offsetTop-a;r.scrollTop+=e,requestAnimationFrame((()=>n=!1))}else queueMicrotask((()=>{if(s!==r.scrollHeight){let e=i.offsetTop-a;r.scrollTop+=e,requestAnimationFrame((()=>n=!1))}else requestAnimationFrame((()=>{let e=i.offsetTop-a;r.scrollTop+=e,requestAnimationFrame((()=>n=!1))}))}))}))},l=t();l?l.then(o):o()}}))}),{root:i,threshold:0,rootMargin:"500px"});return s.observe(e),s}function getNextPositionedChild(e){for(;e=e?.nextElementSibling;)if(!1===/absolute|sticky|fixed/.test(getComputedStyle(e).position))return e}function getScrollParent$1(e){if(e){var t=getComputedStyle(e),n="absolute"===t.position,r=/(auto|overlay|scroll)/;if("fixed"===t.position)return document.scrollingElement;for(var i=e;i=i.parentElement;)if(t=getComputedStyle(i),(!n||"static"!==t.position)&&r.test(t.overflow+t.overflowY+t.overflowX))return i}return document.scrollingElement}function getScrollParent(e,t){if(e){var n=getComputedStyle(e),r="absolute"===n.position,i=t?/(auto|scroll|overlay|hidden)/:/(auto|overlay|scroll)/;if("fixed"===n.position)return document.scrollingElement;for(var s=e;s=s.parentElement;)if(n=getComputedStyle(s),(!r||"static"!==n.position)&&i.test(n.overflow+n.overflowY+n.overflowX))return s}return document.scrollingElement}function isParentAtBottom(e,t){if(e){t??=32;let n=getScrollParent(e);return Math.abs(n.scrollTop+n.clientHeight-n.scrollHeight)<=t}return!1}function scrollParentToBottom(e,t){if(e){let n=getScrollParent(e);n.scrollTop+n.clientHeight!==n.scrollHeight&&(t?n.scrollTo({top:n.scrollHeight,left:0,behavior:"smooth"}):n.scrollTop=n.scrollHeight)}}function useFileUploader(e){const{client:t}=React.useContext(WeavyContext);if(!t)throw new Error("useFileUploader must be used within an WeavyProvider");return useMutation((({request:n})=>__awaiter(this,void 0,void 0,(function*(){const r=new FormData;r.append("blob",n.file);const i=yield t.post("/api/blobs","POST",r,"");var s=yield i.json();e(s)}))),{onError:e=>{},onSuccess:(e,t)=>{}})}const File=({id:e,name:t,className:n,icon:r})=>React.createElement(React.Fragment,null,React.createElement(UIIcon.UI,{name:r,size:1}),React.createElement("div",{className:n},t),React.createElement("input",{type:"hidden",value:e,name:"blob"}));function useMutateTyping(){const{client:e}=React.useContext(WeavyContext);if(!e)throw new Error("useMutateTyping must be used within an WeavyProvider");return useMutation((({id:t})=>__awaiter(this,void 0,void 0,(function*(){return yield e.post("/api/conversations/"+t+"/typing","PUT",JSON.stringify({}))}))),{})}function useThrottle(e,t){const n=React.useRef(e);return React.useEffect((()=>{n.current=e})),React.useCallback(lodash_throttle(((...e)=>n.current(...e)),t,{leading:!0,trailing:!1}),[t])}function useMutateMeeting(){const{client:e}=React.useContext(WeavyContext);if(useQueryClient(),!e)throw new Error("useMutateMeeting must be used within an WeavyProvider");return useMutation((({provider:t})=>__awaiter(this,void 0,void 0,(function*(){return(yield e.post("/api/meetings","POST",JSON.stringify({provider:t}))).json()}))),{onSuccess:e=>{}})}const Meetings=({onMeetingAdded:e})=>{const{options:t}=React.useContext(WeavyContext),{user:n}=React.useContext(UserContext),r=useMutateMeeting();React.useEffect((()=>(window.addEventListener("message",i),()=>{window.removeEventListener("message",i)})),[e]);const i=t=>__awaiter(void 0,void 0,void 0,(function*(){if("zoom-signed-in"===t.data.name){var n=yield r.mutateAsync({provider:"zoom"});e(n)}}));return React.createElement(React.Fragment,null,(null==t?void 0:t.zoomAuthenticationUrl)&&React.createElement(UIButton.UI,{onClick:()=>{window.open(`${null==t?void 0:t.zoomAuthenticationUrl}&state=${n.id}`,"zoomAuthWin","height=640,width=480")},title:"Add Zoom meeting"},React.createElement(UIIcon.UI,{name:"zoom"})))},Meeting=({id:e,title:t,className:n})=>React.createElement(React.Fragment,null,React.createElement(UIIcon.UI,{name:"zoom"}),React.createElement("div",{className:n},"Zoom meeting"),React.createElement("input",{type:"hidden",value:e,name:"meeting"}));function useMutateExternalBlobs(){const{client:e}=React.useContext(WeavyContext);if(useQueryClient(),!e)throw new Error("useMutateExternalBlobs must be used within an WeavyProvider");return useMutation((({blobs:t})=>__awaiter(this,void 0,void 0,(function*(){return(yield e.post("/api/blobs/external","POST",JSON.stringify(t))).json()}))),{onSuccess:e=>{}})}function S4(){return(65536*(1+Math.random())|0).toString(16).substring(1)}function isObject(e){return"[object Object]"===Object.prototype.toString.call(e)}function isPlainObject(e){var t,n;return!1!==isObject(e)&&(void 0===(t=e.constructor)||!1!==isObject(n=t.prototype)&&!1!==Object.prototype.hasOwnProperty.call(n,"isPrototypeOf"))}function eqJQuery(e,t){return e&&t&&e.jquery&&t.jquery&&e.jquery===t.jquery&&e.length===t.length&&e.length===e.filter(t).length}function eqObjects(e,t,n){if(!isPlainObject(e)||!isPlainObject(t))return!1;var r=Object.getOwnPropertyNames(e),i=Object.getOwnPropertyNames(t);if(!n&&r.length!==i.length)return!1;for(var s=0;s<r.length;s++){var a=r[s],o=e[a],l=t[a];if(o!==l&&!eqJQuery(o,l)&&!eqObjects(o,l,n))return!1}return!0}function WeavyPromiseWrapper(e){var t,n="pending",r=function(){return t};return r.promise=r.bind(r),r.state=function(){return n},(r.reset=function(){var i,s;return n="pending",t=new Promise((function(e,t){i=function(){n="resolved",e.apply(this,arguments)},s=function(){n="rejected",t.apply(this,arguments)}})),t.weavy=!0,r.resolve=function(){return i.apply(t,arguments),r},r.reject=function(){return s.apply(t,arguments),r},"function"==typeof e&&e(i,s),r})(),r.then=function(){return(t=t.then.apply(t,arguments)).weavy=!0,r},r.catch=function(){return(t=t.catch.apply(t,arguments)).weavy=!0,r},r.finally=function(){return(t=t.finally.apply(t,arguments)).weavy=!0,r},r}function WeavyPostal(e){var t=this;this.timeout=e&&e.timeout||2e3;var n=[],r=new Set,i=new Map,s=new WeakMap,a=new WeakMap,o=new WeakMap,l=new WeakMap,c=new WeavyPromiseWrapper,u=null,d=h(window.location.href);function h(e){var t=null;try{t=/^((?:https?:\/\/[^/]+)|(?:file:\/\/))\/?/.exec(e)[1]}catch(e){console.error("Unable to resolve location origin. Make sure you are using http, https or file protocol and have a valid location URL.")}return t}function p(e,t){var r=e.source===window&&e.origin===d;if(t||=s.has(e.source)&&e.origin===s.get(e.source),r||t){var i=!e.data.weavyId||!0===e.data.weavyId;t&&!e.data.windowName&&(e.data.windowName=a.get(e.source));var o=e.data.name;if("distribute"===o){if(u)return;e.data.name=e.data.distributeName}n.forEach((function(t){var n=t.name===o||"message"===t.name,r=null===t.selector,s=t.selector===e.data.weavyId,a=isPlainObject(t.selector)&&eqObjects(t.selector,e.data,!0);n&&(i||r||s||a)&&(t.handler(e,e.data),t.once&&g(t.name,t.selector,t.handler))}))}}function f(e,t,r){"function"==typeof arguments[1]&&(r=arguments[1],t=null),n.push({name:e,handler:r,selector:t})}function g(e,t,r){"function"==typeof arguments[1]&&(r=arguments[1],t=null),n=n.filter((function(n){var i=e===n.name,s=r===n.handler,a="string"==typeof t&&t===n.selector,o=isPlainObject(t)&&eqObjects(t,n.selector);return!(i&&s&&(null===t||a||o))}))}function m(e,t){if(i.has(t)){if(i.get(t).has(e)){var n=i.get(t).get(e);try{r.delete(n),a.delete(n),o.delete(n),s.delete(n)}catch(e){}}if(i.get(t).delete(e),0===i.get(t).size)try{i.delete(t)}catch(e){}}}function v(e,n,r){var i=new WeavyPromiseWrapper;null===r&&(r=void 0);var a=e===window.self,o=a?h(window.location.href):s.get(e);return a||e&&o===l.get(e)?(n.weavyMessageId||(n.weavyMessageId=S4()+S4()),queueMicrotask((()=>{console.debug("whenPostMessage",n.name,n.weavyMessageId);var s=setTimeout((function(){"pending"===i.state()&&i.reject(new Error("postMessage() receipt timed out: "+n.weavyMessageId+", "+n.name))}),t.timeout||2e3);f("message-receipt",{weavyId:n.weavyId,weavyMessageId:n.weavyMessageId},(function(){console.debug("message-receipt received",n.weavyMessageId,n.name),clearTimeout(s),i.resolve()}));try{e.postMessage(n,o,r)}catch(e){i.reject(e)}}))):i.reject(new Error("postMessage() Invalid window origin: "+o+", "+n.name)),i()}window.addEventListener("message",(function(e){if(e.data.name&&void 0!==e.data.weavyId){if(e.data.weavyMessageId&&"message-receipt"!==e.data.name&&"unready"!==e.data.name){console.debug("sending message receipt",e.data.weavyMessageId,e.data.name);try{e.source.postMessage({name:"message-receipt",weavyId:e.data.weavyId,weavyMessageId:e.data.weavyMessageId},e.origin)}catch(e){console.error("could not post back message-receipt to source")}}switch(e.data.name){case"register-child":if(o.has(e.source)||console.warn("register-child: contentwindow not pre-registered"),s.get(e.source)!==e.origin)return void console.error("register-child: "+a.get(e.source)+" has invalid origin",e.origin);try{var t=o.get(e.source),n=a.get(e.source);n&&e.source.postMessage({name:"register-window",windowName:n,weavyId:t||!0},e.origin)}catch(e){console.error("could not register frame window",t,n,e)}break;case"ready":i.has(e.data.weavyId)&&a.has(e.source)&&i.get(e.data.weavyId).get(a.get(e.source))&&(l.set(e.source,e.origin),p(e));break;case"unready":i.has(e.data.weavyId)&&p(e,!0);break;default:(e.source===window||i.size)&&p(e)}}})),this.on=f,this.one=function(e,t,r){"function"==typeof arguments[1]&&(r=arguments[1],t=null),n.push({name:e,handler:r,selector:t,once:!0})},this.off=g,this.registerContentWindow=function(e,t,n,l){try{if(!t)return void console.error("registerContentWindow() No valid contentWindow to register, must be a window and have a name.")}catch(e){console.error("registerContentWindow() cannot access contentWindowName")}e.self&&(e=e.self),n&&"true"!==n||(n=!0),i.has(n)||i.set(n,new Map),i.get(n).set(t,e),r.add(e),a.set(e,t),o.set(e,n),s.set(e,l)},this.unregisterContentWindow=m,this.unregisterAll=function(e){i.has(e)&&(i.get(e).forEach((function(t,n){m(n,e)})),i.get(e),i.delete(e))},this.postToFrame=function(e,t,n,r){if("object"==typeof n&&n.name){var s;try{s=i.get(t).get(e)}catch(n){console.error("postToFrame() Window not registered",t,e)}return n.weavyId=t,v(s,n,r)}console.error("postToFrame() Invalid message format",n)},this.postToSelf=function(e,t){if("object"==typeof e&&e.name)return e.weavyId=e.weavyId||!0,v(window.self,e,t);console.error("postToSelf() Invalid message format",e)},this.postToSource=function(e,t,n){if(e.source&&void 0!==e.data.weavyId){var r=e.source===window.self&&e.origin===d,i=s.has(e.source)&&e.origin===s.get(e.source);if(null===n&&(n=void 0),r||i){t.weavyId=e.data.weavyId;try{e.source.postMessage(t,e.origin,n)}catch(e){console.error("postToSource() Could not post message back to source")}}}},this.postToChildren=function(e,t){"object"==typeof e&&e.name?(null===t&&(t=void 0),e.distributeName=e.name,e.name="distribute",e.weavyId=e.weavyId||!0,r.forEach((function(n){if(s.get(n)===l.get(n))try{n.postMessage(e,s.get(n),t)}catch(e){console.warn("postToChildren() could not distribute message to "+a.get(n))}}))):console.error("postToChildren() Invalid message format",e)},this.whenLeader=function(){return c()},Object.defineProperty(this,"isLeader",{get:function(){return u}}),"pending"===c.state()&&(u=!0,c.resolve(u))}window.addEventListener("unhandledrejection",(function(e){e.promise.weavy&&e.preventDefault()})),WeavyPromiseWrapper.resolve=function(e){var t=WeavyPromiseWrapper();return t.resolve(e),t},WeavyPromiseWrapper.reject=function(e){var t=WeavyPromiseWrapper();return t.reject(e),t};var WeavyPostal$1=new WeavyPostal;const FileBrowser=({onFileAdded:e})=>{const{options:t}=React.useContext(WeavyContext),[n,r]=React.useState(!1),[i,s]=React.useState(!1),[a,o]=React.useState(""),l=useMutateExternalBlobs(),c=(null==t?void 0:t.filebrowserUrl)||"",u=React.useCallback((e=>{null!==e&&null!=e.contentWindow&&WeavyPostal$1.registerContentWindow(e.contentWindow.self,"weavy-filebrowser","wy-filebrowser",new URL(c).origin)}),[]);React.useEffect((()=>{var e="";try{window.location.ancestorOrigins&&0<window.location.ancestorOrigins.length?e=window.location.ancestorOrigins[window.location.ancestorOrigins.length-1]:window.top&&(e=window.top.document.location.origin)}catch(e){}if(!e)try{e=window.self.document.location.origin}catch(e){console.error("Filebrowser: Could not read current origin.")}const t=c+"?origin="+e+"&v=X&t="+Date.now().toString()+"&weavyId=wy-filebrowser";return o(t),WeavyPostal$1.on("add-external-blobs",d),WeavyPostal$1.on("request:file-browser-close",h),()=>{WeavyPostal$1.off("add-external-blobs",d),WeavyPostal$1.off("request:file-browser-close",h)}}),[e]);const d=(t,n)=>__awaiter(void 0,void 0,void 0,(function*(){var t=yield l.mutateAsync({blobs:n.blobs});e(t),p()})),h=()=>{p()},p=()=>{r(!1),s(!1)};return React.createElement(React.Fragment,null,(null==t?void 0:t.enableCloudFiles)&&React.createElement(React.Fragment,null,React.createElement(UIButton.UI,{onClick:()=>{r(!0)},title:"Add file from cloud"},React.createElement(UIIcon.UI,{name:"cloud"})),React.createElement(UIOverlay.UI,{isOpen:n,className:"wy-modal wy-panel wy-loaded"},!i&&React.createElement(UISpinner.UI,{overlay:!0}),React.createElement("iframe",{ref:u,onLoad:()=>{s(!0)},src:a,className:"wy-panel-frame",id:"weavy-filebrowser",name:"weavy-filebrowser"}))))},ConversationForm=({conversationId:e,handleInsert:t})=>{const[n,r]=React.useState(""),[i,s]=React.useState(""),[a,o]=React.useState(0),[l,c]=React.useState(1),[u,d]=React.useState(!1),h=useQueryClient(),[p,f]=React.useState([]),[g,m]=React.useState([]),[v,y]=React.useState(!1),b=useMutateTyping(),_=React.useRef(null);let w;const{mutateAsync:E,isSuccess:S}=useFileUploader((e=>{ReactDOM.flushSync((()=>{e.status&&200!==e.status?y(e.detail):f([...p,e[0]])}))}));React.useEffect((()=>{let t=h.getQueryData(["form-text",e])||"";r(t);let n=h.getQueryData(["form-attachments",e])||[];f(n)}),[e]),React.useEffect((()=>{h.setQueryData(["form-attachments",e],p)}),[p]),React.useEffect((()=>{x()}),[n]);const C=i=>{("keydown"!==i.type||"Enter"===i.key&&i.ctrlKey)&&(i.preventDefault(),i.stopPropagation(),""===n&&0===p.length&&0===g.length||(t(n,p,g),r(""),s(""),f([]),m([]),h.setQueryData(["form-text",e],""),h.setQueryData(["form-attachments",e],[])))},A=(e,t)=>{s(""),f(p.filter((t=>t.id!==e)))},P=(e,t)=>{m(g.filter((t=>t.id!==e)))},x=()=>{if(_.current&&_.current.parentNode){_.current.parentNode.dataset.replicatedValue=_.current.value}};return React.createElement("form",{className:"wy-message-form"},v&&React.createElement("div",null,v),(u||p.length>0||g.length>0)&&React.createElement("div",null,u&&React.createElement("div",null,"Now uploading (",l," of ",a,") selected files"),React.createElement("div",{className:"wy-picker-list"},p.map((e=>{let{icon:t}=getIcon(e.name);return React.createElement("div",{key:e.id,className:"wy-picker-list-item"},React.createElement(File,{id:e.id,name:e.name,className:"wy-picker-list-item-title",icon:t}),React.createElement(UIButton.UI,{onClick:A.bind(ConversationForm,e.id)},React.createElement(UIIcon.UI,{name:"close-circle"})))})),g.map((e=>React.createElement("div",{key:e.id,className:"wy-picker-list-item"},React.createElement(Meeting,{id:e.id,title:e.provider,className:"wy-picker-list-item-title"}),React.createElement(UIButton.UI,{onClick:P.bind(ConversationForm,e.id)},React.createElement(UIIcon.UI,{name:"close-circle"}))))))),React.createElement("div",{className:"wy-message-editor-inputs"},React.createElement("div",{className:"wy-message-editor-buttons"},React.createElement("input",{type:"file",ref:e=>w=e,value:i,onChange:e=>__awaiter(void 0,void 0,void 0,(function*(){y(!1),s(e.target.value),o(e.target.files.length),d(!0);for(var t=0;t<e.target.files.length;t++){c(t+1);const n=e.target.files[t];yield E({request:{file:n}})}d(!1)})),multiple:!0,hidden:!0,tabIndex:-1}),React.createElement(UIButton.UI,{title:"Upload attachment",onClick:e=>{null==w||w.click()}},React.createElement(UIIcon.UI,{name:"attachment"})),React.createElement(Meetings,{onMeetingAdded:e=>{g.length>0||m([...g,e])}}),React.createElement(FileBrowser,{onFileAdded:e=>{f([...p,...e])}})),React.createElement("div",{className:"wy-message-editor-text wy-message-editor-grow"},React.createElement("textarea",{rows:1,ref:_,className:"wy-message-editor-textfield wy-message-editor-textcontent",value:n,onChange:t=>{h.setQueryData(["form-text",e],t.target.value),r(t.target.value)},onKeyDown:C,onKeyPress:useThrottle((()=>{b.mutate({id:e})}),4e3)})),React.createElement("div",{className:"wy-message-editor-buttons"},React.createElement(UIButton.UI,{type:"button",onClick:C},React.createElement(UIIcon.UI,{color:"primary",name:"send"})))))};function useMutateRead(){const{client:e}=React.useContext(WeavyContext),t=useQueryClient();if(!e)throw new Error("useMutateUnread must be used within an WeavyProvider");return useMutation((({id:t,read:n,messageId:r})=>__awaiter(this,void 0,void 0,(function*(){const i=n?`/api/conversations/${t}/read?messageId=${r}`:`/api/conversations/${t}/read`;return(yield e.post(i,n?"PUT":"DELETE","")).json()}))),{onSuccess:()=>{t.invalidateQueries("conversations")}})}function useMutateMessage(){const{client:e}=React.useContext(WeavyContext),t=useQueryClient();if(!e)throw new Error("useMutateMessage must be used within an WeavyProvider");return useMutation((({id:t,text:n,userId:r,attachments:i,meetings:s})=>__awaiter(this,void 0,void 0,(function*(){return(yield e.post("/api/apps/"+t+"/messages","POST",JSON.stringify({text:n,blobs:i.map((e=>e.id)),meeting_id:s.length>0?s[0].id:null}))).json()}))),{onSuccess:(e,n,r)=>{var i;const s=t.getQueryData(["messages",n.id]);if(s&&s.pages){const a=null!==(i=s.pages.map(((t,n)=>(0===n&&(t.data=[...t.data.filter((e=>e.id!==r.tempId)),e]),t))))&&void 0!==i?i:[];t.setQueryData(["messages",n.id],(e=>({pages:a,pageParams:e.pageParams})))}t.invalidateQueries("conversations")},onMutate:e=>__awaiter(this,void 0,void 0,(function*(){yield t.cancelQueries(["messages",e.id]);const n=t.getQueryData(["messages",e.id]),r=Math.random();if(n&&n.pages.length>0){var i=n.pages[0];let s=[...i.data||[],{id:r,text:e.text,html:e.text,display_name:"",temp:!0,parent_id:null,created_by:{id:e.userId},created_at:(new Date).toUTCString(),attachments:[],reactions:[],reactions_count:0}];i.data=s,t.setQueryData(["messages",e.id],(e=>{let t=[i];return(null==e?void 0:e.pages.length)>1&&(t=[i,...null==e?void 0:e.pages.slice(1)]),{pages:t,pageParams:null==e?void 0:e.pageParams}}))}return{tempId:r}}))})}const Messages=({id:e,members:t,displayName:n,avatarUrl:r,lastMessageId:i,chatRoom:s})=>{var a;const{user:o}=React.useContext(UserContext),l=useQueryClient(),{client:c}=React.useContext(WeavyContext),u=React.useRef(),d=React.useRef(),[h,p]=React.useState(),{dispatch:f,on:g,events:m}=useEvents(),{isLoading:v,isError:y,data:b,error:_,fetchNextPage:w,hasNextPage:E,isFetching:S,isFetchingNextPage:C}=useMessages(e,{}),A=useMutateRead(),P=useMutateMessage();React.useLayoutEffect((()=>(e&&!v?(scrollParentToBottom(d.current),requestAnimationFrame((()=>requestAnimationFrame((()=>scrollParentToBottom(d.current))))),null==a||a.disconnect(),a=createReverseScroller(u.current,(()=>{if(E)return w().then((()=>new Promise((e=>p(e)))))}))):(null==a||a.disconnect(),a=null),()=>{null==a||a.disconnect(),a=null})),[e,v]),React.useLayoutEffect((()=>{!C&&h&&(h(),p(null))}),[b]),React.useEffect((()=>{e&&i&&A.mutate({id:e,read:!0,messageId:i})}),[e,i]),React.useEffect((()=>(e&&(null==c||c.subscribe(`a${e}`,"message_created",M),null==c||c.subscribe(`a${e}`,"conversation_marked",R),null==c||c.subscribe(`a${e}`,"reaction_added",x),null==c||c.subscribe(`a${e}`,"reaction_removed",T)),()=>{if(e){l.getQueryData(["messages",e])&&l.setQueryData(["messages",e],(e=>({pages:null==e?void 0:e.pages.slice(0,1),pageParams:[void 0]}))),null==c||c.unsubscribe(`a${e}`,"message_created",M),null==c||c.unsubscribe(`a${e}`,"conversation_marked",R),null==c||c.unsubscribe(`a${e}`,"reaction_added",x),null==c||c.unsubscribe(`a${e}`,"reaction_removed",T)}})),[e]);const x=React.useCallback((e=>{f("reaction_added_"+e.entity.id,e)}),[e]),T=React.useCallback((e=>{f("reaction_deleted_"+e.entity.id,e)}),[e]),R=t=>__awaiter(void 0,void 0,void 0,(function*(){let t=isParentAtBottom(u.current);l.invalidateQueries(["members",e]),t&&requestAnimationFrame((()=>scrollParentToBottom(u.current,!0)))})),M=React.useCallback((t=>{var n;if(t.message.app_id!==e||t.message.created_by_id===o.id)return;t.message.created_by=t.actor,A.mutate({id:e,read:!0,messageId:t.message.id});const r=l.getQueryData(["messages",e]);if(r&&r.pages){let i=isParentAtBottom(u.current);const s=null!==(n=r.pages.map(((e,n)=>(0===n&&(e.data=[...e.data,t.message]),e))))&&void 0!==n?n:[];l.setQueryData(["messages",e],(e=>({pages:s,pageParams:e.pageParams}))),i&&requestAnimationFrame((()=>requestAnimationFrame((()=>scrollParentToBottom(u.current,!0)))))}}),[e]);let L=React.createElement("div",{className:"wy-avatar-header"},r&&n&&React.createElement(Avatar,{src:r,name:n,id:e,size:128})||"",n&&React.createElement("div",{className:"wy-headline"},n)||""),I=React.createElement(UIButton.UI,{onClick:()=>w(),disabled:!E||C,className:"wy-message-readmore"},"Load more"),k=React.createElement(React.Fragment,null,React.createElement("div",{className:"wy-message-readmore",ref:u},C?"Loading more...":E?I:L),b&&t&&b.pages&&b.pages.map(((n,r)=>{var i;return React.createElement(React.Fragment,{key:b.pages.length-r},null===(i=n.data)||void 0===i?void 0:i.map((n=>React.createElement(Message,{key:n.id,id:n.id,html:n.html,temp:n.temp,me:n.created_by.id===o.id,avatar:n.created_by.avatar_url,name:n.created_by.display_name,created_at:n.created_at,created_by:n.created_by.display_name,attachments:n.attachments,meeting:n.meeting,parentId:e,reactions:n.reactions,chatRoom:s,seenBy:t.data&&t.data.length>0?t.data.filter((e=>e.marked_id===n.id&&e.id!==o.id)):[]}))))})),React.createElement("div",{ref:d}));return v&&(k=React.createElement("div",null,"Loading messages...")),React.createElement(React.Fragment,null,React.createElement("div",{id:"container",className:"wy-messages"},k),React.createElement("div",{className:"wy-footerbar wy-footerbar-sticky wy-message-editor wy-message-editor-bottom"},React.createElement(ConversationForm,{key:e,conversationId:e,handleInsert:(t,n,r)=>{P.mutate({id:e,text:t,userId:o.id,attachments:n,meetings:r},{onSuccess:t=>{A.mutate({id:e,read:!0,messageId:t.id}),requestAnimationFrame((()=>scrollParentToBottom(d.current,!0)))}}),requestAnimationFrame((()=>scrollParentToBottom(u.current,!0)))}})))},Conversation=({id:e,showBackButton:t})=>{var n;const r=useQueryClient(),{client:i}=React.useContext(WeavyContext),{selectedConversationId:s,setSelectedConversationId:a}=React.useContext(MessengerContext),{user:o}=React.useContext(UserContext),[l,c]=React.useState(!1),[u,d]=React.useState(!1),[h,p]=React.useState(""),[f,g]=React.useState(!1),m="edb400ac-839b-45a7-b2a8-6a01820d1c44";if(!i)throw new Error("Weavy Conversation component must be used within an WeavyProvider");const{isLoading:v,data:y}=useConversation(s,{enabled:null!=s}),{isLoading:b,data:_}=useMembers(s,{enabled:null!=s}),w=useMutateMembers(),E=useMutateConversationName(),S=useMutateRemoveMembers(),C=React.useCallback((e=>{e.app.id===s&&r.invalidateQueries(["conversation",s])}),[s]),A=e=>{c(e)},P=e=>{d(e)};return React.useEffect((()=>{e&&a(e)}),[e]),React.useEffect((()=>(s&&i.subscribe(`a${s}`,"app_updated",C),()=>{s&&i.unsubscribe(`a${s}`,"app_updated",C)})),[s]),React.useEffect((()=>{y&&y.type===m&&p(null==y?void 0:y.display_name),!y||y.type!==m&&"d65dd4bc-418e-403c-9f56-f9cf4da931ed"!==y.type||g(!0)}),[y]),React.createElement(React.Fragment,null,React.createElement("header",{className:"wy-appbars","data-adjust-scrollbar-top":!0},React.createElement("nav",{className:"wy-appbar"},React.createElement("div",null,t&&React.createElement(UIButton.UI,{onClick:()=>{a(null)}},React.createElement(UIIcon.UI,{name:"back"}))),s&&y&&React.createElement(React.Fragment,null,React.createElement("div",{className:"wy-appbar-text"},React.createElement(Typing$1,{id:s,context:"conversation"},y.display_name)),React.createElement(UIDropdown.UI,{directionX:"left"},React.createElement(UIDropdown.Item,{onClick:()=>P(!0)},"Details"),y.type===m&&React.createElement(React.Fragment,null,React.createElement(UIDropdown.Item,{onClick:()=>A(!0)},"Add people"),React.createElement(UIDropdown.Item,{onClick:()=>{S.mutate({id:s,members:[o.id]})}},"Leave conversation")))))),!s&&React.createElement("div",{className:"wy-avatar-header"},React.createElement(Avatar,{src:o.avatar_url,name:o.display_name,presence:o.presence,id:o.id,size:256}),React.createElement("h2",{className:"wy-title"},"Welcome ",o.name,"!"),"Create or select a conversation to get started"),s&&_&&y&&React.createElement(Messages,{id:s,chatRoom:f,members:_,displayName:null==y?void 0:y.display_name,avatarUrl:null==y?void 0:y.avatar_url,lastMessageId:null===(n=null==y?void 0:y.last_message)||void 0===n?void 0:n.id}),React.createElement(UIOverlay.UI,{isOpen:l,className:"wy-modal"},React.createElement("header",{className:"wy-appbars","data-adjust-scrollbar-top":!0},React.createElement("nav",{className:"wy-appbar"},React.createElement(UIButton.UI,{onClick:()=>A(!1)},React.createElement(UIIcon.UI,{name:"close"})),React.createElement("div",{className:"wy-appbar-text"},"Add people"))),React.createElement(SearchUsers,{handleSubmit:e=>__awaiter(void 0,void 0,void 0,(function*(){const t=e.map((e=>e.id));yield w.mutateAsync({id:s,members:t}),c(!1)})),buttonTitle:"Add selected"})),React.createElement(UIOverlay.UI,{isOpen:u,className:"wy-modal"},React.createElement("header",{className:"wy-appbars"},React.createElement("nav",{className:"wy-appbar"},React.createElement(UIButton.UI,{onClick:()=>P(!1)},React.createElement(UIIcon.UI,{name:"close"})),React.createElement("div",{className:"wy-appbar-text"},"Conversation details"))),React.createElement("div",{className:"wy-scroll-y"},y&&React.createElement("div",{className:"wy-avatar-header"},React.createElement(Avatar,{src:null==y?void 0:y.avatar_url,name:h,size:128}),(null==y?void 0:y.type)!==m&&React.createElement("h3",{className:"wy-headline"},null==y?void 0:y.display_name)),(null==y?void 0:y.type)===m&&React.createElement(React.Fragment,null,React.createElement("div",{className:"wy-pane-group"},React.createElement("input",{className:"wy-input",value:h,onChange:e=>(e=>{p(e.target.value),E.mutate({id:s,name:e.target.value})})(e)})),React.createElement("div",{className:"wy-pane-group"},React.createElement("table",{className:"wy-table wy-search-result-table"},React.createElement("tbody",null,_&&_.data&&_.data.map((e=>React.createElement("tr",{key:e.id},React.createElement("td",{className:"wy-table-cell-icon wy-search-result-table-icon"},React.createElement(Avatar,{src:e.avatar_url,name:e.display_name,id:e.id,size:24,presence:e.presence})),React.createElement("td",{className:"wy-table-cell-text"},e.display_name)))))))))))};var Conversation$1=React.memo(Conversation);function useConversations(e){const{client:t}=React.useContext(WeavyContext);if(!t)throw new Error("useConversations must be used within an WeavyProvider");return useInfiniteQuery("conversations",(e=>__awaiter(this,void 0,void 0,(function*(){let n=e.pageParam||0;const r=yield t.get("/api/conversations?contextual=false&skip="+n+"&top=25");return yield r.json()}))),Object.assign(Object.assign({},e),{getNextPageParam:(e,t)=>{if((null==e?void 0:e.end)<(null==e?void 0:e.count))return 25*t.length}}))}function useMutatePinned(){const{client:e}=React.useContext(WeavyContext),t=useQueryClient();if(!e)throw new Error("useMutatePinned must be used within an WeavyProvider");return useMutation((({id:t,pin:n})=>__awaiter(this,void 0,void 0,(function*(){return(yield e.post("/api/conversations/"+t+"/pin",n?"PUT":"DELETE","")).json()}))),{onSuccess:()=>{t.invalidateQueries("conversations")}})}const ConversationListItem=({item:e,refetchConversations:t})=>{var n,r,i,s,a,o,l;const{client:c}=React.useContext(WeavyContext),{setSelectedConversationId:u,selectedConversationId:d}=React.useContext(MessengerContext),{user:h}=React.useContext(UserContext),p=useMutateRead(),f=useMutatePinned(),g=useMutateRemoveMembers(),m=dayjs.utc(null===(n=e.last_message)||void 0===n?void 0:n.created_at).tz(dayjs.tz.guess()),v=(null===(r=e.last_message)||void 0===r?void 0:r.html)||"",y=/title=\"(:[^:\s]+:)\"/,b={};null===(i=v.match(/<img[^>]+wy-emoji.+>/g))||void 0===i||i.forEach((e=>{let t=e.match(y)[1];t&&(b[t]=e)}));const _=((null===(s=e.last_message)||void 0===s?void 0:s.text)||"").replace(/:[^:\s]*(?:::[^:\s]*)*:/gi,(e=>b[e])),w="edb400ac-839b-45a7-b2a8-6a01820d1c44",E=React.useCallback((n=>{n.app.id===e.id&&t()}),[e.id]),S=React.useCallback((n=>{n.message.app_id===e.id&&t()}),[e.id]),C=React.useCallback((n=>{n.app.id===e.id&&t()}),[e.id]);React.useEffect((()=>(null==c||c.subscribe(`a${e.id}`,"app_updated",E),null==c||c.subscribe(`a${e.id}`,"message_created",S),null==c||c.subscribe(`a${e.id}`,"member_added",C),()=>{null==c||c.unsubscribe(`a${e.id}`,"app_updated",E),null==c||c.unsubscribe(`a${e.id}`,"message_created",S),null==c||c.unsubscribe(`a${e.id}`,"member_added",C)})),[e.id]);const A=e.type!==w?e.member_ids.find((e=>e!=h.id)):null,P=t=>{t.preventDefault(),f.mutate({id:e.id,pin:!1})};return React.createElement("div",{className:classNames("wy-item wy-item-lg wy-item-hover wy-conversation",{"wy-unread":e.is_unread,"wy-active":d===e.id}),key:e.id,onClick:t=>((e,t)=>{e.defaultPrevented||(e.preventDefault(),u(t))})(t,e.id)},React.createElement(Avatar,{src:e.avatar_url,id:A||-1,presence:e.type!==w?"away":"",name:e.display_name}),React.createElement("div",{className:"wy-item-body"},React.createElement("div",{className:"wy-item-row"},React.createElement("div",{className:"wy-item-title"},e.display_name),e.last_message&&React.createElement("time",{className:"wy-meta",dateTime:e.last_message.created_at.toString(),title:m.format("LLLL")},m.fromNow())),React.createElement("div",{className:"wy-item-row"},React.createElement("div",{className:"wy-item-text"},React.createElement(Typing$1,{id:e.id,context:"listitem"},_&&React.createElement("span",{className:"wy-typing-hide",dangerouslySetInnerHTML:{__html:_}}),!_&&React.createElement("span",{className:"wy-typing-hide"},(null===(o=null===(a=e.last_message)||void 0===a?void 0:a.attachment_ids)||void 0===o?void 0:o.length)>0&&React.createElement(UIIcon.UI,{name:"attachment",size:1}),(null===(l=e.last_message)||void 0===l?void 0:l.meeting_id)&&React.createElement(UIIcon.UI,{name:"zoom",size:1})))))),React.createElement("div",{className:"wy-item-actions wy-item-actions-bottom"},e.is_pinned&&React.createElement(UIButton.UI,{onClick:P},React.createElement(UIIcon.UI,{name:"pin",size:1/1.5})),React.createElement(UIDropdown.UI,{directionX:"left"},React.createElement(React.Fragment,null,e.is_unread&&React.createElement(UIDropdown.Item,{onClick:t=>{t.preventDefault(),p.mutate({id:e.id,read:!0,messageId:e.last_message.id})}},"Mark as read"),!e.is_unread&&React.createElement(UIDropdown.Item,{onClick:t=>{t.preventDefault(),p.mutate({id:e.id,read:!1,messageId:null})}},"Mark as unread")),React.createElement(React.Fragment,null,e.is_pinned&&React.createElement(UIDropdown.Item,{onClick:P},"Unpin"),!e.is_pinned&&React.createElement(UIDropdown.Item,{onClick:t=>{t.preventDefault(),f.mutate({id:e.id,pin:!0})}},"Pin")),e.type===w&&React.createElement(UIDropdown.Item,{onClick:()=>{g.mutate({id:e.id,members:[h.id]})}},"Leave conversation"))))};function useMutateConversation(){const{client:e}=React.useContext(WeavyContext),t=useQueryClient();if(!e)throw new Error("useMutateConversation must be used within an WeavyProvider");return useMutation((({members:t})=>__awaiter(this,void 0,void 0,(function*(){return(yield e.post("/api/conversations/","POST",JSON.stringify({members:t}))).json()}))),{onSuccess:()=>{t.invalidateQueries("conversations")}})}const NewConversation=()=>{const[e,t]=React.useState(!1),n=useMutateConversation();return React.createElement(React.Fragment,null,React.createElement(UIButton.UI,{onClick:()=>{t(!0)}},React.createElement(UIIcon.UI,{name:"plus"})),React.createElement(UIOverlay.UI,{isOpen:e,className:"wy-modal"},React.createElement("header",{className:"wy-appbars","data-adjust-scrollbar-top":!0},React.createElement("nav",{className:"wy-appbar"},React.createElement(UIButton.UI,{onClick:()=>{t(!1)}},React.createElement(UIIcon.UI,{name:"close"})),React.createElement("div",{className:"wy-appbar-text"},"Create conversation"))),React.createElement(SearchUsers,{handleSubmit:e=>__awaiter(void 0,void 0,void 0,(function*(){const r=e.map((e=>e.id));yield n.mutateAsync({members:r}),t(!1)})),buttonTitle:"Next"})))};var NewConversation$1=React.memo(NewConversation);const ConversationList=()=>{const{client:e}=React.useContext(WeavyContext),{user:t}=React.useContext(UserContext),{data:n,isLoading:r,refetch:i,fetchNextPage:s,hasNextPage:a,isFetchingNextPage:o}=useConversations({}),l=React.useRef(),[c,u]=React.useState();let d;if(!e)throw new Error("Weavy ConversationList component must be used within an WeavyProvider");React.useLayoutEffect((()=>(r||(null==d||d.disconnect(),d=createScroller(l.current,(()=>{if(a)return s().then((()=>new Promise((e=>u(e)))))}))),()=>{null==d||d.disconnect(),d=null})),[r]),React.useLayoutEffect((()=>{!o&&c&&(c(),u(null))}),[n]),React.useEffect((()=>(e.subscribe(null,"app_created",h),e.subscribe(null,"member_added",h),()=>{e.unsubscribe(null,"app_created",h),e.unsubscribe(null,"member_added",h)})),[]);const h=e=>{i()};if(r)return React.createElement("div",null,"Loading Conversation list...");let p=React.createElement(UIButton.UI,{onClick:()=>s(),disabled:!a||o,className:"wy-message-readmore"},"Load more");return React.createElement(React.Fragment,null,React.createElement("header",{className:"wy-appbars","data-adjust-scrollbar-top":!0},React.createElement("nav",{className:"wy-appbar"},React.createElement(Avatar,{src:t.avatar_url,name:t.display_name,presence:t.presence,id:t.id,size:24}),React.createElement("div",null,"Messenger"),React.createElement(NewConversation$1,null))),React.createElement("div",{className:"wy-conversations"},n&&n.pages&&n.pages.map(((e,t)=>{var n;return null===(n=e.data)||void 0===n?void 0:n.map((e=>React.createElement(ConversationListItem,{key:e.id,refetchConversations:i,item:e})))})),React.createElement("div",{className:"wy-message-readmore",ref:l},o?"Loading more...":a?p:"")))},Messenger=({className:e})=>{const{client:t}=React.useContext(WeavyContext);if(!t)throw new Error("Weavy Messenger component must be used within an WeavyProvider");return React.createElement(MessengerProvider,null,React.createElement("div",{className:classNames("wy-messenger-provider",e)},React.createElement("div",{className:"wy-messenger-sidebar wy-scroll-y"},React.createElement(ConversationList,null)),React.createElement("div",{className:"wy-messenger-conversation wy-scroll-y"},React.createElement(Conversation$1,{id:null}))))};function useBadge(){const{client:e}=React.useContext(WeavyContext);if(!e)throw new Error("useBadge must be used within an WeavyProvider");return useQuery("badge",(()=>__awaiter(this,void 0,void 0,(function*(){const t=yield e.get("/api/conversations/badge");if(t.ok){return yield t.json()}return null}))))}const ConversationBadge=()=>{const{client:e}=React.useContext(WeavyContext),[t,n]=React.useState(0);if(!e)throw new Error("Weavy Badge component must be used within an WeavyProvider");const{isLoading:r,data:i,refetch:s}=useBadge(),a=e=>{s()};return React.useEffect((()=>{i&&n(i.private+i.rooms)}),[i]),React.useEffect((()=>(e.subscribe(null,"message_created",a),e.subscribe(null,"conversation_marked",a),()=>{e.unsubscribe(null,"message_created",a),e.unsubscribe(null,"conversation_marked",a)})),[]),React.createElement(React.Fragment,null,!r&&t>0&&React.createElement("span",{className:"wy-badge wy-badge-danger"},t))};function useChat(e,t){const{client:n}=React.useContext(WeavyContext);if(!n)throw new Error("useChat must be used within an WeavyProvider");return useQuery(["chat",e],(()=>__awaiter(this,void 0,void 0,(function*(){const t=yield n.get("/api/apps/"+e);return yield t.json()}))),t)}const Chat=({uid:e,className:t})=>{var n;const{client:r}=React.useContext(WeavyContext),[i,s]=React.useState(null);if(!r)throw new Error("Weavy Chat component must be used within an WeavyProvider");const{isLoading:a,data:o}=useChat(e,{}),{isLoading:l,data:c}=useMembers(i,{enabled:null!=i}),{isLoading:u,data:d}=useConversation(i,{enabled:null!=i});return React.useEffect((()=>{s(o?o.id:null)}),[o]),React.createElement("div",{className:classNames("wy-messenger-conversation wy-scroll-y",t)},React.createElement("header",{className:"wy-appbars","data-adjust-scrollbar-top":!0},React.createElement("nav",{className:"wy-appbar"},React.createElement("div",null),i&&d&&React.createElement("div",{className:"wy-appbar-text"},React.createElement(Typing$1,{id:i,context:"conversation"},d.display_name)))),!a&&!o&&React.createElement("div",null,"No chat with the contextual id ",React.createElement("strong",null,e)),i&&c&&o&&React.createElement(Messages,{id:i,chatRoom:!0,members:c,lastMessageId:null===(n=o.last_message)||void 0===n?void 0:n.id}))};exports.Button=UIButton,exports.Chat=Chat,exports.Conversation=Conversation$1,exports.ConversationBadge=ConversationBadge,exports.ConversationList=ConversationList,exports.Dropdown=UIDropdown,exports.Icon=UIIcon,exports.Messenger=Messenger,exports.MessengerContext=MessengerContext,exports.MessengerProvider=MessengerProvider,exports.Overlay=UIOverlay,exports.WeavyClient=WeavyClient,exports.WeavyContext=WeavyContext,exports.WeavyProvider=WeavyProvider;
38
+ !function(e){!function(){var t={}.hasOwnProperty;function n(){for(var e=[],r=0;r<arguments.length;r++){var i=arguments[r];if(i){var s=typeof i;if("string"===s||"number"===s)e.push(i);else if(Array.isArray(i)){if(i.length){var a=n.apply(null,i);a&&e.push(a)}}else if("object"===s)if(i.toString===Object.prototype.toString)for(var o in i)t.call(i,o)&&i[o]&&e.push(o);else e.push(i.toString())}}return e.join(" ")}e.exports?(n.default=n,e.exports=n):window.classNames=n}()}(classnames);var classNames=classnames.exports;const OverlayImpl=({children:e,className:t="",isOpen:n,style:r})=>{const[i,s]=React.useState(!1);return React.createElement(Modal,{isOpen:n,ariaHideApp:!1,onAfterOpen:()=>{s(!0)},onRequestClose:()=>{s(!1)},className:classNames("wy-panel wy-overlay wy-transition",t,{"wy-open":i}),overlayClassName:"wy-overlays wy-viewport",contentLabel:"Example Modal",style:r},e)},UIOverlay={UI:OverlayImpl};var mdiArrowLeft="M20,11V13H8L13.5,18.5L12.08,19.92L4.16,12L12.08,4.08L13.5,5.5L8,11H20Z",mdiArrowRight="M4,11V13H16L10.5,18.5L11.92,19.92L19.84,12L11.92,4.08L10.5,5.5L16,11H4Z",mdiAttachment="M7.5,18A5.5,5.5 0 0,1 2,12.5A5.5,5.5 0 0,1 7.5,7H18A4,4 0 0,1 22,11A4,4 0 0,1 18,15H9.5A2.5,2.5 0 0,1 7,12.5A2.5,2.5 0 0,1 9.5,10H17V11.5H9.5A1,1 0 0,0 8.5,12.5A1,1 0 0,0 9.5,13.5H18A2.5,2.5 0 0,0 20.5,11A2.5,2.5 0 0,0 18,8.5H7.5A4,4 0 0,0 3.5,12.5A4,4 0 0,0 7.5,16.5H17V18H7.5Z",mdiBox="M15.39,14.04V14.04C15.39,12.62 14.24,11.47 12.82,11.47C11.41,11.47 10.26,12.62 10.26,14.04V14.04C10.26,15.45 11.41,16.6 12.82,16.6C14.24,16.6 15.39,15.45 15.39,14.04M17.1,14.04C17.1,16.4 15.18,18.31 12.82,18.31C11.19,18.31 9.77,17.39 9.05,16.04C8.33,17.39 6.91,18.31 5.28,18.31C2.94,18.31 1.04,16.43 1,14.11V14.11H1V7H1V7C1,6.56 1.39,6.18 1.86,6.18C2.33,6.18 2.7,6.56 2.71,7V7H2.71V10.62C3.43,10.08 4.32,9.76 5.28,9.76C6.91,9.76 8.33,10.68 9.05,12.03C9.77,10.68 11.19,9.76 12.82,9.76C15.18,9.76 17.1,11.68 17.1,14.04V14.04M7.84,14.04V14.04C7.84,12.62 6.69,11.47 5.28,11.47C3.86,11.47 2.71,12.62 2.71,14.04V14.04C2.71,15.45 3.86,16.6 5.28,16.6C6.69,16.6 7.84,15.45 7.84,14.04M22.84,16.96V16.96C22.95,17.12 23,17.3 23,17.47C23,17.73 22.88,18 22.66,18.15C22.5,18.26 22.33,18.32 22.15,18.32C21.9,18.32 21.65,18.21 21.5,18L19.59,15.47L17.7,18V18C17.53,18.21 17.28,18.32 17.03,18.32C16.85,18.32 16.67,18.26 16.5,18.15C16.29,18 16.17,17.72 16.17,17.46C16.17,17.29 16.23,17.11 16.33,16.96V16.96H16.33V16.96L18.5,14.04L16.33,11.11V11.11H16.33V11.11C16.22,10.96 16.17,10.79 16.17,10.61C16.17,10.35 16.29,10.1 16.5,9.93C16.89,9.65 17.41,9.72 17.7,10.09V10.09L19.59,12.61L21.5,10.09C21.76,9.72 22.29,9.65 22.66,9.93C22.89,10.1 23,10.36 23,10.63C23,10.8 22.95,10.97 22.84,11.11V11.11H22.84V11.11L20.66,14.04L22.84,16.96V16.96H22.84Z",mdiClose="M19,6.41L17.59,5L12,10.59L6.41,5L5,6.41L10.59,12L5,17.59L6.41,19L12,13.41L17.59,19L19,17.59L13.41,12L19,6.41Z",mdiCloseCircle="M12,2C17.53,2 22,6.47 22,12C22,17.53 17.53,22 12,22C6.47,22 2,17.53 2,12C2,6.47 6.47,2 12,2M15.59,7L12,10.59L8.41,7L7,8.41L10.59,12L7,15.59L8.41,17L12,13.41L15.59,17L17,15.59L13.41,12L17,8.41L15.59,7Z",mdiCloud="M19.35,10.03C18.67,6.59 15.64,4 12,4C9.11,4 6.6,5.64 5.35,8.03C2.34,8.36 0,10.9 0,14A6,6 0 0,0 6,20H19A5,5 0 0,0 24,15C24,12.36 21.95,10.22 19.35,10.03Z",mdiDotsVertical="M12,16A2,2 0 0,1 14,18A2,2 0 0,1 12,20A2,2 0 0,1 10,18A2,2 0 0,1 12,16M12,10A2,2 0 0,1 14,12A2,2 0 0,1 12,14A2,2 0 0,1 10,12A2,2 0 0,1 12,10M12,4A2,2 0 0,1 14,6A2,2 0 0,1 12,8A2,2 0 0,1 10,6A2,2 0 0,1 12,4Z",mdiDownload="M5,20H19V18H5M19,9H15V3H9V9H5L12,16L19,9Z",mdiDropbox="M3 6.2L8 9.39L13 6.2L8 3L3 6.2M13 6.2L18 9.39L23 6.2L18 3L13 6.2M3 12.55L8 15.74L13 12.55L8 9.35L3 12.55M18 9.35L13 12.55L18 15.74L23 12.55L18 9.35M8.03 16.8L13.04 20L18.04 16.8L13.04 13.61L8.03 16.8Z",mdiEmail="M20,8L12,13L4,8V6L12,11L20,6M20,4H4C2.89,4 2,4.89 2,6V18A2,2 0 0,0 4,20H20A2,2 0 0,0 22,18V6C22,4.89 21.1,4 20,4Z",mdiFile="M13,9V3.5L18.5,9M6,2C4.89,2 4,2.89 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2H6Z",mdiFileCode="M13,9H18.5L13,3.5V9M6,2H14L20,8V20A2,2 0 0,1 18,22H6C4.89,22 4,21.1 4,20V4C4,2.89 4.89,2 6,2M6.12,15.5L9.86,19.24L11.28,17.83L8.95,15.5L11.28,13.17L9.86,11.76L6.12,15.5M17.28,15.5L13.54,11.76L12.12,13.17L14.45,15.5L12.12,17.83L13.54,19.24L17.28,15.5Z",mdiFileDocument="M13,9H18.5L13,3.5V9M6,2H14L20,8V20A2,2 0 0,1 18,22H6C4.89,22 4,21.1 4,20V4C4,2.89 4.89,2 6,2M15,18V16H6V18H15M18,14V12H6V14H18Z",mdiFileExcel="M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M15.8,20H14L12,16.6L10,20H8.2L11.1,15.5L8.2,11H10L12,14.4L14,11H15.8L12.9,15.5L15.8,20M13,9V3.5L18.5,9H13Z",mdiFileImage="M13,9H18.5L13,3.5V9M6,2H14L20,8V20A2,2 0 0,1 18,22H6C4.89,22 4,21.1 4,20V4C4,2.89 4.89,2 6,2M6,20H15L18,20V12L14,16L12,14L6,20M8,9A2,2 0 0,0 6,11A2,2 0 0,0 8,13A2,2 0 0,0 10,11A2,2 0 0,0 8,9Z",mdiFileMusic="M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M13,13H11V18A2,2 0 0,1 9,20A2,2 0 0,1 7,18A2,2 0 0,1 9,16C9.4,16 9.7,16.1 10,16.3V11H13V13M13,9V3.5L18.5,9H13Z",mdiFilePowerpoint="M12.6,12.3H10.6V15.5H12.7C13.3,15.5 13.6,15.3 13.9,15C14.2,14.7 14.3,14.4 14.3,13.9C14.3,13.4 14.2,13.1 13.9,12.8C13.6,12.5 13.2,12.3 12.6,12.3M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M15.2,16C14.6,16.5 14.1,16.7 12.8,16.7H10.6V20H9V11H12.8C14.1,11 14.7,11.3 15.2,11.8C15.8,12.4 16,13 16,13.9C16,14.8 15.8,15.5 15.2,16M13,9V3.5L18.5,9H13Z",mdiFileVideo="M13,9H18.5L13,3.5V9M6,2H14L20,8V20A2,2 0 0,1 18,22H6C4.89,22 4,21.1 4,20V4C4,2.89 4.89,2 6,2M17,19V13L14,15.2V13H7V19H14V16.8L17,19Z",mdiFileWord="M14,2H6A2,2 0 0,0 4,4V20A2,2 0 0,0 6,22H18A2,2 0 0,0 20,20V8L14,2M15.2,20H13.8L12,13.2L10.2,20H8.8L6.6,11H8.1L9.5,17.8L11.3,11H12.6L14.4,17.8L15.8,11H17.3L15.2,20M13,9V3.5L18.5,9H13Z",mdiFitToPage="M20,2H4C2.89,2 2,2.89 2,4V20C2,21.11 2.89,22 4,22H20C21.11,22 22,21.11 22,20V4C22,2.89 21.11,2 20,2M12,4L15,7H13V9H11V7H9M7,15L4,12L7,9V11H9V13H7M12,20L9,17H11V15H13V17H15M17,15V13H15V11H17V9L20,12",mdiFitToScreen="M17 4H20C21.1 4 22 4.9 22 6V8H20V6H17V4M4 8V6H7V4H4C2.9 4 2 4.9 2 6V8H4M20 16V18H17V20H20C21.1 20 22 19.1 22 18V16H20M7 18H4V16H2V18C2 19.1 2.9 20 4 20H7V18M18 8H6V16H18V8Z",mdiFolderZip="M20 6H12L10 4H4C2.9 4 2 4.9 2 6V18C2 19.1 2.9 20 4 20H20C21.1 20 22 19.1 22 18V8C22 6.9 21.1 6 20 6M18 12H16V14H18V16H16V18H14V16H16V14H14V12H16V10H14V8H16V10H18V12Z",mdiGoogleDrive="M7.71,3.5L1.15,15L4.58,21L11.13,9.5M9.73,15L6.3,21H19.42L22.85,15M22.28,14L15.42,2H8.58L8.57,2L15.43,14H22.28Z",mdiMagnify="M9.5,3A6.5,6.5 0 0,1 16,9.5C16,11.11 15.41,12.59 14.44,13.73L14.71,14H15.5L20.5,19L19,20.5L14,15.5V14.71L13.73,14.44C12.59,15.41 11.11,16 9.5,16A6.5,6.5 0 0,1 3,9.5A6.5,6.5 0 0,1 9.5,3M9.5,5C7,5 5,7 5,9.5C5,12 7,14 9.5,14C12,14 14,12 14,9.5C14,7 12,5 9.5,5Z",mdiMicrosoftOnedrive="M18.21 10.29Q19 10.34 19.7 10.68 20.39 11 20.9 11.57 21.41 12.12 21.71 12.83 22 13.54 22 14.34 22 15.18 21.68 15.92 21.36 16.66 20.8 17.21 20.25 17.76 19.5 18.08 18.78 18.41 17.94 18.41H7Q5.97 18.41 5.06 18 4.15 17.61 3.47 16.94 2.79 16.26 2.4 15.35 2 14.44 2 13.41 2 12.59 2.26 11.83 2.5 11.08 3 10.45 3.44 9.82 4.08 9.35 4.72 8.88 5.5 8.63 5.87 8.5 6.21 8.5 6.56 8.43 6.93 8.41H6.94Q7.37 7.75 7.95 7.23 8.5 6.71 9.2 6.34 9.87 6 10.62 5.78 11.37 5.59 12.16 5.59 13.22 5.59 14.2 5.94 15.18 6.29 16 6.91 16.8 7.53 17.37 8.39 17.95 9.26 18.21 10.29M12.16 6.84Q11.05 6.84 10.06 7.3 9.06 7.75 8.36 8.6 8.73 8.7 9.07 8.85 9.4 9 9.73 9.2L13.71 11.58L16 10.62Q16.21 10.53 16.44 10.45 16.67 10.38 16.92 10.33 16.68 9.55 16.21 8.91 15.74 8.27 15.11 7.81 14.5 7.35 13.73 7.1 13 6.84 12.16 6.84M4 15.66L12.27 12.18L9.08 10.26Q8.59 9.97 8.06 9.81 7.5 9.66 6.95 9.66 6.19 9.66 5.5 9.96 4.84 10.26 4.34 10.77 3.84 11.29 3.54 11.97 3.25 12.65 3.25 13.41 3.25 14 3.45 14.59 3.64 15.19 4 15.66M17.94 17.16Q18.41 17.16 18.84 17 19.27 16.86 19.64 16.58L13.61 13L5.03 16.59Q5.47 16.86 5.97 17 6.47 17.16 7 17.16M20.45 15.61Q20.75 15 20.75 14.34 20.75 13.7 20.5 13.17 20.26 12.65 19.85 12.28 19.43 11.91 18.88 11.71 18.32 11.5 17.7 11.5 17.35 11.5 17 11.6 16.66 11.68 16.33 11.81 16 11.93 15.67 12.08 15.35 12.23 15.04 12.37Z",mdiMinus="M19,13H5V11H19V13Z",mdiOpenInNew="M14,3V5H17.59L7.76,14.83L9.17,16.24L19,6.41V10H21V3M19,19H5V5H12V3H5C3.89,3 3,3.9 3,5V19A2,2 0 0,0 5,21H19A2,2 0 0,0 21,19V12H19V19Z",mdiPin="M16,12V4H17V2H7V4H8V12L6,14V16H11.2V22H12.8V16H18V14L16,12Z",mdiPlus="M19,13H13V19H11V13H5V11H11V5H13V11H19V13Z",mdiPlusCircleOutline="M12,20C7.59,20 4,16.41 4,12C4,7.59 7.59,4 12,4C16.41,4 20,7.59 20,12C20,16.41 16.41,20 12,20M12,2A10,10 0 0,0 2,12A10,10 0 0,0 12,22A10,10 0 0,0 22,12A10,10 0 0,0 12,2M13,7H11V11H7V13H11V17H13V13H17V11H13V7Z",mdiSend="M2,21L23,12L2,3V10L17,12L2,14V21Z",mdiVideo="M17,10.5V7A1,1 0 0,0 16,6H4A1,1 0 0,0 3,7V17A1,1 0 0,0 4,18H16A1,1 0 0,0 17,17V13.5L21,17.5V6.5L17,10.5Z",Icon$1=function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=2)}([function(e,t){e.exports=requirePropTypes()},function(e,t){e.exports=React},function(e,t,n){n.r(t);var r=n(1),i=n(0),s=function(){return(s=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},a=0,o=r.forwardRef((function(e,t){var n=e.title,i=void 0===n?null:n,o=e.description,l=void 0===o?null:o,c=e.size,u=void 0===c?null:c,d=e.color,h=void 0===d?"currentColor":d,p=e.horizontal,f=void 0===p?null:p,g=e.vertical,m=void 0===g?null:g,v=e.rotate,y=void 0===v?null:v,b=e.spin,_=void 0===b?null:b,w=e.style,E=void 0===w?{}:w,S=e.children,C=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(e,["title","description","size","color","horizontal","vertical","rotate","spin","style","children"]);a++;var A,P=null!==_&&_,x=r.Children.map(S,(function(e){var t=e;!0!==P&&(P=!0===(null===_?t.props.spin:_));var n=t.props.size;"number"==typeof u&&"number"==typeof t.props.size&&(n=t.props.size/u);var i={size:n,color:null===h?t.props.color:h,horizontal:null===f?t.props.horizontal:f,vertical:null===m?t.props.vertical:m,rotate:null===y?t.props.rotate:y,spin:null===_?t.props.spin:_,inStack:!0};return r.cloneElement(t,i)}));null!==u&&(E.width="string"==typeof u?u:1.5*u+"rem");var R,T="stack_labelledby_"+a,M="stack_describedby_"+a;if(i)A=l?T+" "+M:T;else if(R="presentation",l)throw new Error("title attribute required when description is set");return r.createElement("svg",s({ref:t,viewBox:"0 0 24 24",style:E,role:R,"aria-labelledby":A},C),i&&r.createElement("title",{id:T},i),l&&r.createElement("desc",{id:M},l),P&&r.createElement("style",null,"@keyframes spin { to { transform: rotate(360deg) } }","@keyframes spin-inverse { to { transform: rotate(-360deg) } }"),x)}));o.displayName="Stack",o.propTypes={size:i.oneOfType([i.number,i.string]),color:i.string,horizontal:i.bool,vertical:i.bool,rotate:i.number,spin:i.oneOfType([i.bool,i.number]),children:i.oneOfType([i.arrayOf(i.node),i.node]).isRequired,className:i.string,style:i.object},o.defaultProps={size:null,color:null,horizontal:null,vertical:null,rotate:null,spin:null};var l=o;n.d(t,"Icon",(function(){return d})),n.d(t,"Stack",(function(){return l}));var c=function(){return(c=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)},u=0,d=r.forwardRef((function(e,t){var n=e.path,i=e.id,s=void 0===i?++u:i,a=e.title,o=void 0===a?null:a,l=e.description,d=void 0===l?null:l,h=e.size,p=void 0===h?null:h,f=e.color,g=void 0===f?"currentColor":f,m=e.horizontal,v=void 0!==m&&m,y=e.vertical,b=void 0!==y&&y,_=e.rotate,w=void 0===_?0:_,E=e.spin,S=void 0!==E&&E,C=e.style,A=void 0===C?{}:C,P=e.inStack,x=void 0!==P&&P,R=function(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}(e,["path","id","title","description","size","color","horizontal","vertical","rotate","spin","style","inStack"]),T={},M=[];null!==p&&(x?M.push("scale("+p+")"):(A.width="string"==typeof p?p:1.5*p+"rem",A.height=A.width)),v&&M.push("scaleX(-1)"),b&&M.push("scaleY(-1)"),0!==w&&M.push("rotate("+w+"deg)"),null!==g&&(T.fill=g);var L=r.createElement("path",c({d:n,style:T},x?R:{})),I=L;M.length>0&&(A.transform=M.join(" "),A.transformOrigin="center",x&&(I=r.createElement("g",{style:A},L,r.createElement("rect",{width:"24",height:"24",fill:"transparent"}))));var k,O=I,F=!0===S||"number"!=typeof S?2:S,D=!x&&(v||b);if(F<0&&(D=!D),S&&(O=r.createElement("g",{style:{animation:"spin"+(D?"-inverse":"")+" linear "+Math.abs(F)+"s infinite",transformOrigin:"center"}},I,!(v||b||0!==w)&&r.createElement("rect",{width:"24",height:"24",fill:"transparent"}))),x)return O;var N,U="icon_labelledby_"+s,j="icon_describedby_"+s;if(o)k=d?U+" "+j:U;else if(N="presentation",d)throw new Error("title attribute required when description is set");return r.createElement("svg",c({ref:t,viewBox:"0 0 24 24",style:A,role:N,"aria-labelledby":k},R),o&&r.createElement("title",{id:U},o),d&&r.createElement("desc",{id:j},d),!x&&S&&(D?r.createElement("style",null,"@keyframes spin-inverse { to { transform: rotate(-360deg) } }"):r.createElement("style",null,"@keyframes spin { to { transform: rotate(360deg) } }")),O)}));d.displayName="Icon",d.propTypes={path:i.string.isRequired,size:i.oneOfType([i.number,i.string]),color:i.string,horizontal:i.bool,vertical:i.bool,rotate:i.number,spin:i.oneOfType([i.bool,i.number]),style:i.object,inStack:i.bool,className:i.string},d.defaultProps={size:null,color:"currentColor",horizontal:!1,vertical:!1,rotate:0,spin:!1},t.default=d}]);const iconMapping={attachment:mdiAttachment,back:mdiArrowLeft,close:mdiClose,"close-circle":mdiCloseCircle,"dots-vertical":mdiDotsVertical,download:mdiDownload,"emoticon-plus":"M 19 0 L 19 3 L 16 3 L 16 5 L 19 5 L 19 8 L 21 8 L 21 5 L 24 5 L 24 3 L 21 3 L 21 0 L 19 0 z M 12 2 C 6.5 2 2 6.5 2 12 C 2 17.5 6.5 22 12 22 C 17.5 22 22 17.5 22 12 L 20 12 C 20 16.4 16.4 20 12 20 C 7.6 20 4 16.4 4 12 C 4 7.6 7.6 4 12 4 L 12 2 z M 8.5 8 C 7.7 8 7 8.7 7 9.5 C 7 10.3 7.7 11 8.5 11 C 9.3 11 10 10.3 10 9.5 C 10 8.7 9.3 8 8.5 8 z M 15.5 8 C 14.7 8 14 8.7 14 9.5 C 14 10.3 14.7 11 15.5 11 C 16.3 11 17 10.3 17 9.5 C 17 8.7 16.3 8 15.5 8 z M 6.9 14 C 7.7 16 9.7 17.5 12 17.5 C 14.3 17.5 16.3 16 17.1 14 L 6.9 14 z","fit-screen":mdiFitToScreen,"fit-width":mdiFitToPage,magnify:mdiMagnify,minus:mdiMinus,next:mdiArrowRight,"open-in-new":mdiOpenInNew,pin:mdiPin,plus:mdiPlus,"plus-circle-outline":mdiPlusCircleOutline,previous:mdiArrowLeft,send:mdiSend,video:mdiVideo,email:mdiEmail,file:mdiFile,"file-music":mdiFileMusic,"file-image":mdiFileImage,"file-video":mdiFileVideo,"file-code":mdiFileCode,"file-xml":mdiFileCode,"file-document":mdiFileDocument,"file-word":mdiFileWord,"file-excel":mdiFileExcel,"file-pdf":mdiFileDocument,"file-powerpoint":mdiFilePowerpoint,"file-compressed":mdiFolderZip,dropbox:mdiDropbox,ondedrive:mdiMicrosoftOnedrive,box:mdiBox,"google-drive":mdiGoogleDrive,zoom:"m12 2c-5.6 0-10 4.5-10 10 0 5.6 4.5 10 10 10 5.5 0 9.9-4.5 9.9-10 .1-5.6-4.4-10-9.9-10zm2.6 13.1c0 .2-.1.3-.3.3h-6.9c-1.1 0-1.9-.8-1.9-1.9v-4.6c0-.2.1-.3.3-.3h6.9c1 0 1.9.8 1.9 1.9zm3.8.1c0 .4-.2.4-.5.2l-2.8-2.1v-2.6l2.8-2.1c.2-.2.5-.1.5.2z",cloud:mdiCloud};function getIconMapping(e){let[t]=e.split("+");return t in iconMapping?iconMapping[t]:""}function getIconOverlay(e){let[,t]=e.split("+");return t in iconMapping?iconMapping[t]:""}const Icon=e=>{var{name:t,color:n="",size:r}=e,i=__rest(e,["name","color","size"]);let s=getIconMapping(t),a=getIconOverlay(t);return React.createElement("span",Object.assign({className:"wy-icon"+(n?" wy-icon-"+n:""),style:{width:r&&1.5*r+"rem",height:r&&1.5*r+"rem"}},i),s?React.createElement(Icon$1.Icon,{color:n,path:s,size:r}):t,a&&React.createElement(Icon$1.Icon,{color:n,path:a,className:"wy-icon-overlay",size:(r||1)/2}))},UIIcon={UI:Icon},Button=e=>{var{active:t=!1,type:n="button",onClick:r,className:i="",children:s}=e,a=__rest(e,["active","type","onClick","className","children"]);let o=1===React.Children.count(s)&&React.Children.toArray(s).pop(),l=classNames("wy-button",i,{"wy-active":t,"wy-button-icon":(null==o?void 0:o.type)===UIIcon.UI});return React.createElement("button",Object.assign({type:n,className:l,onClick:r},a),s)},UIButton={UI:Button},SpinnerImpl=({spin:e=!0,size:t=24,overlay:n=!1})=>React.createElement("svg",{className:classNames("wy-spinner",{"wy-spin":e,"wy-spinner-overlay":n}),width:t,height:t,viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},React.createElement("circle",{fill:"none",cx:"12",cy:"12",r:"11",strokeLinecap:"butt",strokeWidth:"2"})),UISpinner={UI:SpinnerImpl};function commonjsRequire(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var pdf={exports:{}},_nodeResolve_empty={},_nodeResolve_empty$1=Object.freeze({__proto__:null,default:_nodeResolve_empty}),require$$5=getAugmentedNamespace(_nodeResolve_empty$1),hasRequiredPdf;function requirePdf(){return hasRequiredPdf||(hasRequiredPdf=1,function(module,exports){var factory;globalThis,factory=()=>(()=>{var __webpack_modules__=[,(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.VerbosityLevel=t.Util=t.UnknownErrorException=t.UnexpectedResponseException=t.UNSUPPORTED_FEATURES=t.TextRenderingMode=t.StreamType=t.RenderingIntentFlag=t.PermissionFlag=t.PasswordResponses=t.PasswordException=t.PageActionEventType=t.OPS=t.MissingPDFException=t.LINE_FACTOR=t.LINE_DESCENT_FACTOR=t.InvalidPDFException=t.ImageKind=t.IDENTITY_MATRIX=t.FormatError=t.FontType=t.FeatureTest=t.FONT_IDENTITY_MATRIX=t.DocumentActionEventType=t.CMapCompressionType=t.BaseException=t.AnnotationType=t.AnnotationStateModelType=t.AnnotationReviewState=t.AnnotationReplyType=t.AnnotationMode=t.AnnotationMarkedState=t.AnnotationFlag=t.AnnotationFieldFlag=t.AnnotationEditorType=t.AnnotationEditorPrefix=t.AnnotationEditorParamsType=t.AnnotationBorderStyleType=t.AnnotationActionEventType=t.AbortException=void 0,t.arrayByteLength=u,t.arraysToBytes=function(e){const t=e.length;if(1===t&&e[0]instanceof Uint8Array)return e[0];let n=0;for(let r=0;r<t;r++)n+=u(e[r]);let r=0;const i=new Uint8Array(n);for(let n=0;n<t;n++){let t=e[n];t instanceof Uint8Array||(t="string"==typeof t?c(t):new Uint8Array(t));const s=t.byteLength;i.set(t,r),r+=s}return i},t.assert=function(e,t){e||a(t)},t.bytesToString=function(e){"object"==typeof e&&null!==e&&void 0!==e.length||a("Invalid argument for bytesToString");const t=e.length,n=8192;if(t<n)return String.fromCharCode.apply(null,e);const r=[];for(let i=0;i<t;i+=n){const s=Math.min(i+n,t),a=e.subarray(i,s);r.push(String.fromCharCode.apply(null,a))}return r.join("")},t.createPromiseCapability=function(){const e=Object.create(null);let t=!1;return Object.defineProperty(e,"settled",{get:()=>t}),e.promise=new Promise((function(n,r){e.resolve=function(e){t=!0,n(e)},e.reject=function(e){t=!0,r(e)}})),e},t.createValidAbsoluteUrl=function(e,t=null,n=null){if(!e)return null;try{if(n&&"string"==typeof e){if(n.addDefaultProtocol&&e.startsWith("www.")){const t=e.match(/\./g);t&&t.length>=2&&(e=`http://${e}`)}if(n.tryConvertEncoding)try{e=f(e)}catch(e){}}const r=t?new URL(e,t):new URL(e);if(function(e){if(!e)return!1;switch(e.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}(r))return r}catch(e){}return null},t.escapeString=function(e){return e.replace(/([()\\\n\r])/g,(e=>"\n"===e?"\\n":"\r"===e?"\\r":`\\${e}`))},t.getModificationDate=function(e=new Date){return[e.getUTCFullYear().toString(),(e.getUTCMonth()+1).toString().padStart(2,"0"),e.getUTCDate().toString().padStart(2,"0"),e.getUTCHours().toString().padStart(2,"0"),e.getUTCMinutes().toString().padStart(2,"0"),e.getUTCSeconds().toString().padStart(2,"0")].join("")},t.getVerbosityLevel=function(){return i},t.info=function(e){i>=r.INFOS&&console.log(`Info: ${e}`)},t.isArrayBuffer=function(e){return"object"==typeof e&&null!==e&&void 0!==e.byteLength},t.isArrayEqual=function(e,t){if(e.length!==t.length)return!1;for(let n=0,r=e.length;n<r;n++)if(e[n]!==t[n])return!1;return!0},t.isAscii=function(e){return/^[\x00-\x7F]*$/.test(e)},t.objectFromMap=function(e){const t=Object.create(null);for(const[n,r]of e)t[n]=r;return t},t.objectSize=function(e){return Object.keys(e).length},t.setVerbosityLevel=function(e){Number.isInteger(e)&&(i=e)},t.shadow=o,t.string32=function(e){return String.fromCharCode(e>>24&255,e>>16&255,e>>8&255,255&e)},t.stringToBytes=c,t.stringToPDFString=function(e){if(e[0]>="ï"){let t;if("þ"===e[0]&&"ÿ"===e[1]?t="utf-16be":"ÿ"===e[0]&&"þ"===e[1]?t="utf-16le":"ï"===e[0]&&"»"===e[1]&&"¿"===e[2]&&(t="utf-8"),t)try{const n=new TextDecoder(t,{fatal:!0}),r=c(e);return n.decode(r)}catch(e){s(`stringToPDFString: "${e}".`)}}const t=[];for(let n=0,r=e.length;n<r;n++){const r=p[e.charCodeAt(n)];t.push(r?String.fromCharCode(r):e.charAt(n))}return t.join("")},t.stringToUTF16BEString=function(e){const t=["þÿ"];for(let n=0,r=e.length;n<r;n++){const r=e.charCodeAt(n);t.push(String.fromCharCode(r>>8&255),String.fromCharCode(255&r))}return t.join("")},t.stringToUTF8String=f,t.unreachable=a,t.utf8StringToString=function(e){return unescape(encodeURIComponent(e))},t.warn=s,n(2),t.IDENTITY_MATRIX=[1,0,0,1,0,0],t.FONT_IDENTITY_MATRIX=[.001,0,0,.001,0,0],t.LINE_FACTOR=1.35,t.LINE_DESCENT_FACTOR=.35,t.RenderingIntentFlag={ANY:1,DISPLAY:2,PRINT:4,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,OPLIST:256},t.AnnotationMode={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},t.AnnotationEditorPrefix="pdfjs_internal_editor_",t.AnnotationEditorType={DISABLE:-1,NONE:0,FREETEXT:3,INK:15},t.AnnotationEditorParamsType={FREETEXT_SIZE:1,FREETEXT_COLOR:2,FREETEXT_OPACITY:3,INK_COLOR:11,INK_THICKNESS:12,INK_OPACITY:13},t.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},t.TextRenderingMode={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_ADD_TO_PATH:4,STROKE_ADD_TO_PATH:5,FILL_STROKE_ADD_TO_PATH:6,ADD_TO_PATH:7,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},t.ImageKind={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},t.AnnotationType={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},t.AnnotationStateModelType={MARKED:"Marked",REVIEW:"Review"},t.AnnotationMarkedState={MARKED:"Marked",UNMARKED:"Unmarked"},t.AnnotationReviewState={ACCEPTED:"Accepted",REJECTED:"Rejected",CANCELLED:"Cancelled",COMPLETED:"Completed",NONE:"None"},t.AnnotationReplyType={GROUP:"Group",REPLY:"R"},t.AnnotationFlag={INVISIBLE:1,HIDDEN:2,PRINT:4,NOZOOM:8,NOROTATE:16,NOVIEW:32,READONLY:64,LOCKED:128,TOGGLENOVIEW:256,LOCKEDCONTENTS:512},t.AnnotationFieldFlag={READONLY:1,REQUIRED:2,NOEXPORT:4,MULTILINE:4096,PASSWORD:8192,NOTOGGLETOOFF:16384,RADIO:32768,PUSHBUTTON:65536,COMBO:131072,EDIT:262144,SORT:524288,FILESELECT:1048576,MULTISELECT:2097152,DONOTSPELLCHECK:4194304,DONOTSCROLL:8388608,COMB:16777216,RICHTEXT:33554432,RADIOSINUNISON:33554432,COMMITONSELCHANGE:67108864},t.AnnotationBorderStyleType={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},t.AnnotationActionEventType={E:"Mouse Enter",X:"Mouse Exit",D:"Mouse Down",U:"Mouse Up",Fo:"Focus",Bl:"Blur",PO:"PageOpen",PC:"PageClose",PV:"PageVisible",PI:"PageInvisible",K:"Keystroke",F:"Format",V:"Validate",C:"Calculate"},t.DocumentActionEventType={WC:"WillClose",WS:"WillSave",DS:"DidSave",WP:"WillPrint",DP:"DidPrint"},t.PageActionEventType={O:"PageOpen",C:"PageClose"},t.StreamType={UNKNOWN:"UNKNOWN",FLATE:"FLATE",LZW:"LZW",DCT:"DCT",JPX:"JPX",JBIG:"JBIG",A85:"A85",AHX:"AHX",CCF:"CCF",RLX:"RLX"},t.FontType={UNKNOWN:"UNKNOWN",TYPE1:"TYPE1",TYPE1STANDARD:"TYPE1STANDARD",TYPE1C:"TYPE1C",CIDFONTTYPE0:"CIDFONTTYPE0",CIDFONTTYPE0C:"CIDFONTTYPE0C",TRUETYPE:"TRUETYPE",CIDFONTTYPE2:"CIDFONTTYPE2",TYPE3:"TYPE3",OPENTYPE:"OPENTYPE",TYPE0:"TYPE0",MMTYPE1:"MMTYPE1"};const r={ERRORS:0,WARNINGS:1,INFOS:5};t.VerbosityLevel=r,t.CMapCompressionType={NONE:0,BINARY:1,STREAM:2},t.OPS={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,beginAnnotations:78,endAnnotations:79,beginAnnotation:80,endAnnotation:81,paintJpegXObject:82,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91},t.UNSUPPORTED_FEATURES={unknown:"unknown",forms:"forms",javaScript:"javaScript",signatures:"signatures",smask:"smask",shadingPattern:"shadingPattern",font:"font",errorTilingPattern:"errorTilingPattern",errorExtGState:"errorExtGState",errorXObject:"errorXObject",errorFontLoadType3:"errorFontLoadType3",errorFontState:"errorFontState",errorFontMissing:"errorFontMissing",errorFontTranslate:"errorFontTranslate",errorColorSpace:"errorColorSpace",errorOperatorList:"errorOperatorList",errorFontToUnicode:"errorFontToUnicode",errorFontLoadNative:"errorFontLoadNative",errorFontBuildPath:"errorFontBuildPath",errorFontGetPath:"errorFontGetPath",errorMarkedContent:"errorMarkedContent",errorContentSubStream:"errorContentSubStream"},t.PasswordResponses={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let i=r.WARNINGS;function s(e){i>=r.WARNINGS&&console.log(`Warning: ${e}`)}function a(e){throw new Error(e)}function o(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!1}),n}const l=function(){function e(t,n){this.constructor===e&&a("Cannot initialize BaseException."),this.message=t,this.name=n}return e.prototype=new Error,e.constructor=e,e}();function c(e){"string"!=typeof e&&a("Invalid argument for stringToBytes");const t=e.length,n=new Uint8Array(t);for(let r=0;r<t;++r)n[r]=255&e.charCodeAt(r);return n}function u(e){return void 0!==e.length?e.length:void 0!==e.byteLength?e.byteLength:void a("Invalid argument for arrayByteLength")}t.BaseException=l,t.PasswordException=class extends l{constructor(e,t){super(e,"PasswordException"),this.code=t}},t.UnknownErrorException=class extends l{constructor(e,t){super(e,"UnknownErrorException"),this.details=t}},t.InvalidPDFException=class extends l{constructor(e){super(e,"InvalidPDFException")}},t.MissingPDFException=class extends l{constructor(e){super(e,"MissingPDFException")}},t.UnexpectedResponseException=class extends l{constructor(e,t){super(e,"UnexpectedResponseException"),this.status=t}},t.FormatError=class extends l{constructor(e){super(e,"FormatError")}},t.AbortException=class extends l{constructor(e){super(e,"AbortException")}},t.FeatureTest=class{static get isLittleEndian(){return o(this,"isLittleEndian",function(){const e=new Uint8Array(4);return e[0]=1,1===new Uint32Array(e.buffer,0,1)[0]}())}static get isEvalSupported(){return o(this,"isEvalSupported",function(){try{return new Function(""),!0}catch(e){return!1}}())}static get isOffscreenCanvasSupported(){return o(this,"isOffscreenCanvasSupported","undefined"!=typeof OffscreenCanvas)}};const d=[...Array(256).keys()].map((e=>e.toString(16).padStart(2,"0")));class h{static makeHexColor(e,t,n){return`#${d[e]}${d[t]}${d[n]}`}static scaleMinMax(e,t){let n;e[0]?(e[0]<0&&(n=t[0],t[0]=t[1],t[1]=n),t[0]*=e[0],t[1]*=e[0],e[3]<0&&(n=t[2],t[2]=t[3],t[3]=n),t[2]*=e[3],t[3]*=e[3]):(n=t[0],t[0]=t[2],t[2]=n,n=t[1],t[1]=t[3],t[3]=n,e[1]<0&&(n=t[2],t[2]=t[3],t[3]=n),t[2]*=e[1],t[3]*=e[1],e[2]<0&&(n=t[0],t[0]=t[1],t[1]=n),t[0]*=e[2],t[1]*=e[2]),t[0]+=e[4],t[1]+=e[4],t[2]+=e[5],t[3]+=e[5]}static transform(e,t){return[e[0]*t[0]+e[2]*t[1],e[1]*t[0]+e[3]*t[1],e[0]*t[2]+e[2]*t[3],e[1]*t[2]+e[3]*t[3],e[0]*t[4]+e[2]*t[5]+e[4],e[1]*t[4]+e[3]*t[5]+e[5]]}static applyTransform(e,t){return[e[0]*t[0]+e[1]*t[2]+t[4],e[0]*t[1]+e[1]*t[3]+t[5]]}static applyInverseTransform(e,t){const n=t[0]*t[3]-t[1]*t[2];return[(e[0]*t[3]-e[1]*t[2]+t[2]*t[5]-t[4]*t[3])/n,(-e[0]*t[1]+e[1]*t[0]+t[4]*t[1]-t[5]*t[0])/n]}static getAxialAlignedBoundingBox(e,t){const n=h.applyTransform(e,t),r=h.applyTransform(e.slice(2,4),t),i=h.applyTransform([e[0],e[3]],t),s=h.applyTransform([e[2],e[1]],t);return[Math.min(n[0],r[0],i[0],s[0]),Math.min(n[1],r[1],i[1],s[1]),Math.max(n[0],r[0],i[0],s[0]),Math.max(n[1],r[1],i[1],s[1])]}static inverseTransform(e){const t=e[0]*e[3]-e[1]*e[2];return[e[3]/t,-e[1]/t,-e[2]/t,e[0]/t,(e[2]*e[5]-e[4]*e[3])/t,(e[4]*e[1]-e[5]*e[0])/t]}static apply3dTransform(e,t){return[e[0]*t[0]+e[1]*t[1]+e[2]*t[2],e[3]*t[0]+e[4]*t[1]+e[5]*t[2],e[6]*t[0]+e[7]*t[1]+e[8]*t[2]]}static singularValueDecompose2dScale(e){const t=[e[0],e[2],e[1],e[3]],n=e[0]*t[0]+e[1]*t[2],r=e[0]*t[1]+e[1]*t[3],i=e[2]*t[0]+e[3]*t[2],s=e[2]*t[1]+e[3]*t[3],a=(n+s)/2,o=Math.sqrt((n+s)**2-4*(n*s-i*r))/2,l=a+o||1,c=a-o||1;return[Math.sqrt(l),Math.sqrt(c)]}static normalizeRect(e){const t=e.slice(0);return e[0]>e[2]&&(t[0]=e[2],t[2]=e[0]),e[1]>e[3]&&(t[1]=e[3],t[3]=e[1]),t}static intersect(e,t){const n=Math.max(Math.min(e[0],e[2]),Math.min(t[0],t[2])),r=Math.min(Math.max(e[0],e[2]),Math.max(t[0],t[2]));if(n>r)return null;const i=Math.max(Math.min(e[1],e[3]),Math.min(t[1],t[3])),s=Math.min(Math.max(e[1],e[3]),Math.max(t[1],t[3]));return i>s?null:[n,i,r,s]}static bezierBoundingBox(e,t,n,r,i,s,a,o){const l=[],c=[[],[]];let u,d,h,p,f,g,m,v;for(let c=0;c<2;++c)if(0===c?(d=6*e-12*n+6*i,u=-3*e+9*n-9*i+3*a,h=3*n-3*e):(d=6*t-12*r+6*s,u=-3*t+9*r-9*s+3*o,h=3*r-3*t),Math.abs(u)<1e-12){if(Math.abs(d)<1e-12)continue;p=-h/d,0<p&&p<1&&l.push(p)}else m=d*d-4*h*u,v=Math.sqrt(m),m<0||(f=(-d+v)/(2*u),0<f&&f<1&&l.push(f),g=(-d-v)/(2*u),0<g&&g<1&&l.push(g));let y,b=l.length;const _=b;for(;b--;)p=l[b],y=1-p,c[0][b]=y*y*y*e+3*y*y*p*n+3*y*p*p*i+p*p*p*a,c[1][b]=y*y*y*t+3*y*y*p*r+3*y*p*p*s+p*p*p*o;return c[0][_]=e,c[1][_]=t,c[0][_+1]=a,c[1][_+1]=o,c[0].length=c[1].length=_+2,[Math.min(...c[0]),Math.min(...c[1]),Math.max(...c[0]),Math.max(...c[1])]}}t.Util=h;const p=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,728,711,710,729,733,731,730,732,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8226,8224,8225,8230,8212,8211,402,8260,8249,8250,8722,8240,8222,8220,8221,8216,8217,8218,8482,64257,64258,321,338,352,376,381,305,322,339,353,382,0,8364];function f(e){return decodeURIComponent(escape(e))}},(e,t,n)=>{n(3)},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.isNodeJS=void 0;const n=!("object"!=typeof process||process+""!="[object process]"||process.versions.nw||process.versions.electron&&process.type&&"browser"!==process.type);t.isNodeJS=n},(__unused_webpack_module,exports,__w_pdfjs_require__)=>{Object.defineProperty(exports,"__esModule",{value:!0}),exports.build=exports.RenderTask=exports.PDFWorkerUtil=exports.PDFWorker=exports.PDFPageProxy=exports.PDFDocumentProxy=exports.PDFDocumentLoadingTask=exports.PDFDataRangeTransport=exports.LoopbackPort=exports.DefaultStandardFontDataFactory=exports.DefaultCanvasFactory=exports.DefaultCMapReaderFactory=void 0,exports.getDocument=getDocument,exports.setPDFNetworkStreamFactory=setPDFNetworkStreamFactory,exports.version=void 0;var _util=__w_pdfjs_require__(1),_annotation_storage=__w_pdfjs_require__(5),_display_utils=__w_pdfjs_require__(8),_font_loader=__w_pdfjs_require__(11),_canvas=__w_pdfjs_require__(12),_worker_options=__w_pdfjs_require__(15),_is_node=__w_pdfjs_require__(3),_message_handler=__w_pdfjs_require__(16),_metadata=__w_pdfjs_require__(17),_optional_content_config=__w_pdfjs_require__(18),_transport_stream=__w_pdfjs_require__(19),_xfa_text=__w_pdfjs_require__(20);const DEFAULT_RANGE_CHUNK_SIZE=65536,RENDERING_CANCELLED_TIMEOUT=100;let DefaultCanvasFactory=_display_utils.DOMCanvasFactory;exports.DefaultCanvasFactory=DefaultCanvasFactory;let DefaultCMapReaderFactory=_display_utils.DOMCMapReaderFactory;exports.DefaultCMapReaderFactory=DefaultCMapReaderFactory;let DefaultStandardFontDataFactory=_display_utils.DOMStandardFontDataFactory,createPDFNetworkStream;if(exports.DefaultStandardFontDataFactory=DefaultStandardFontDataFactory,_is_node.isNodeJS){const{NodeCanvasFactory:e,NodeCMapReaderFactory:t,NodeStandardFontDataFactory:n}=__w_pdfjs_require__(21);exports.DefaultCanvasFactory=DefaultCanvasFactory=e,exports.DefaultCMapReaderFactory=DefaultCMapReaderFactory=t,exports.DefaultStandardFontDataFactory=DefaultStandardFontDataFactory=n}function setPDFNetworkStreamFactory(e){createPDFNetworkStream=e}function getDocument(e){const t=new PDFDocumentLoadingTask;let n;if("string"==typeof e||e instanceof URL)n={url:e};else if((0,_util.isArrayBuffer)(e))n={data:e};else if(e instanceof PDFDataRangeTransport)n={range:e};else{if("object"!=typeof e)throw new Error("Invalid parameter in getDocument, need either string, URL, TypedArray, or parameter object.");if(!e.url&&!e.data&&!e.range)throw new Error("Invalid parameter object: need either .data, .range or .url");n=e}const r=Object.create(null);let i=null,s=null;for(const e in n){const t=n[e];switch(e){case"url":if("undefined"!=typeof window)try{r[e]=new URL(t,window.location).href;continue}catch(e){(0,_util.warn)(`Cannot create valid URL: "${e}".`)}else if("string"==typeof t||t instanceof URL){r[e]=t.toString();continue}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.");case"range":i=t;continue;case"worker":s=t;continue;case"data":if(_is_node.isNodeJS&&"undefined"!=typeof Buffer&&t instanceof Buffer)r[e]=new Uint8Array(t);else{if(t instanceof Uint8Array)break;if("string"==typeof t)r[e]=(0,_util.stringToBytes)(t);else if("object"!=typeof t||null===t||isNaN(t.length)){if(!(0,_util.isArrayBuffer)(t))throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.");r[e]=new Uint8Array(t)}else r[e]=new Uint8Array(t)}continue}r[e]=t}if(r.CMapReaderFactory=r.CMapReaderFactory||DefaultCMapReaderFactory,r.StandardFontDataFactory=r.StandardFontDataFactory||DefaultStandardFontDataFactory,r.ignoreErrors=!0!==r.stopAtErrors,r.fontExtraProperties=!0===r.fontExtraProperties,r.pdfBug=!0===r.pdfBug,r.enableXfa=!0===r.enableXfa,(!Number.isInteger(r.rangeChunkSize)||r.rangeChunkSize<1)&&(r.rangeChunkSize=DEFAULT_RANGE_CHUNK_SIZE),("string"!=typeof r.docBaseUrl||(0,_display_utils.isDataScheme)(r.docBaseUrl))&&(r.docBaseUrl=null),(!Number.isInteger(r.maxImageSize)||r.maxImageSize<-1)&&(r.maxImageSize=-1),"string"!=typeof r.cMapUrl&&(r.cMapUrl=null),"string"!=typeof r.standardFontDataUrl&&(r.standardFontDataUrl=null),"boolean"!=typeof r.useWorkerFetch&&(r.useWorkerFetch=r.CMapReaderFactory===_display_utils.DOMCMapReaderFactory&&r.StandardFontDataFactory===_display_utils.DOMStandardFontDataFactory),"boolean"!=typeof r.isEvalSupported&&(r.isEvalSupported=!0),"boolean"!=typeof r.disableFontFace&&(r.disableFontFace=_is_node.isNodeJS),"boolean"!=typeof r.useSystemFonts&&(r.useSystemFonts=!_is_node.isNodeJS&&!r.disableFontFace),"object"==typeof r.ownerDocument&&null!==r.ownerDocument||(r.ownerDocument=globalThis.document),"boolean"!=typeof r.disableRange&&(r.disableRange=!1),"boolean"!=typeof r.disableStream&&(r.disableStream=!1),"boolean"!=typeof r.disableAutoFetch&&(r.disableAutoFetch=!1),(0,_util.setVerbosityLevel)(r.verbosity),!s){const e={verbosity:r.verbosity,port:_worker_options.GlobalWorkerOptions.workerPort};s=e.port?PDFWorker.fromPort(e):new PDFWorker(e),t._worker=s}const a=t.docId;return s.promise.then((function(){if(t.destroyed)throw new Error("Loading aborted");const e=_fetchDocument(s,r,i,a),n=new Promise((function(e){let t;i?t=new _transport_stream.PDFDataTransportStream({length:r.length,initialData:r.initialData,progressiveDone:r.progressiveDone,contentDispositionFilename:r.contentDispositionFilename,disableRange:r.disableRange,disableStream:r.disableStream},i):r.data||(t=createPDFNetworkStream({url:r.url,length:r.length,httpHeaders:r.httpHeaders,withCredentials:r.withCredentials,rangeChunkSize:r.rangeChunkSize,disableRange:r.disableRange,disableStream:r.disableStream})),e(t)}));return Promise.all([e,n]).then((function([e,n]){if(t.destroyed)throw new Error("Loading aborted");const i=new _message_handler.MessageHandler(a,e,s.port),o=new WorkerTransport(i,t,n,r);t._transport=o,i.send("Ready",null)}))})).catch(t._capability.reject),t}async function _fetchDocument(e,t,n,r){if(e.destroyed)throw new Error("Worker was destroyed");n&&(t.length=n.length,t.initialData=n.initialData,t.progressiveDone=n.progressiveDone,t.contentDispositionFilename=n.contentDispositionFilename);const i=await e.messageHandler.sendWithPromise("GetDocRequest",{docId:r,apiVersion:"2.16.105",source:{data:t.data,url:t.url,password:t.password,disableAutoFetch:t.disableAutoFetch,rangeChunkSize:t.rangeChunkSize,length:t.length},maxImageSize:t.maxImageSize,disableFontFace:t.disableFontFace,docBaseUrl:t.docBaseUrl,ignoreErrors:t.ignoreErrors,isEvalSupported:t.isEvalSupported,fontExtraProperties:t.fontExtraProperties,enableXfa:t.enableXfa,useSystemFonts:t.useSystemFonts,cMapUrl:t.useWorkerFetch?t.cMapUrl:null,standardFontDataUrl:t.useWorkerFetch?t.standardFontDataUrl:null});if(t.data&&(t.data=null),e.destroyed)throw new Error("Worker was destroyed");return i}class PDFDocumentLoadingTask{static#e=0;constructor(){this._capability=(0,_util.createPromiseCapability)(),this._transport=null,this._worker=null,this.docId="d"+PDFDocumentLoadingTask.#e++,this.destroyed=!1,this.onPassword=null,this.onProgress=null,this.onUnsupportedFeature=null}get promise(){return this._capability.promise}async destroy(){this.destroyed=!0,await(this._transport?.destroy()),this._transport=null,this._worker&&(this._worker.destroy(),this._worker=null)}}exports.PDFDocumentLoadingTask=PDFDocumentLoadingTask;class PDFDataRangeTransport{constructor(e,t,n=!1,r=null){this.length=e,this.initialData=t,this.progressiveDone=n,this.contentDispositionFilename=r,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=(0,_util.createPromiseCapability)()}addRangeListener(e){this._rangeListeners.push(e)}addProgressListener(e){this._progressListeners.push(e)}addProgressiveReadListener(e){this._progressiveReadListeners.push(e)}addProgressiveDoneListener(e){this._progressiveDoneListeners.push(e)}onDataRange(e,t){for(const n of this._rangeListeners)n(e,t)}onDataProgress(e,t){this._readyCapability.promise.then((()=>{for(const n of this._progressListeners)n(e,t)}))}onDataProgressiveRead(e){this._readyCapability.promise.then((()=>{for(const t of this._progressiveReadListeners)t(e)}))}onDataProgressiveDone(){this._readyCapability.promise.then((()=>{for(const e of this._progressiveDoneListeners)e()}))}transportReady(){this._readyCapability.resolve()}requestDataRange(e,t){(0,_util.unreachable)("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}exports.PDFDataRangeTransport=PDFDataRangeTransport;class PDFDocumentProxy{constructor(e,t){this._pdfInfo=e,this._transport=t,Object.defineProperty(this,"fingerprint",{get(){return(0,_display_utils.deprecated)("`PDFDocumentProxy.fingerprint`, please use `PDFDocumentProxy.fingerprints` instead."),this.fingerprints[0]}}),Object.defineProperty(this,"getStats",{value:async()=>((0,_display_utils.deprecated)("`PDFDocumentProxy.getStats`, please use the `PDFDocumentProxy.stats`-getter instead."),this.stats||{streamTypes:{},fontTypes:{}})})}get annotationStorage(){return this._transport.annotationStorage}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get stats(){return this._transport.stats}get isPureXfa(){return!!this._transport._htmlForXfa}get allXfaHtml(){return this._transport._htmlForXfa}getPage(e){return this._transport.getPage(e)}getPageIndex(e){return this._transport.getPageIndex(e)}getDestinations(){return this._transport.getDestinations()}getDestination(e){return this._transport.getDestination(e)}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()}getJavaScript(){return this._transport.getJavaScript()}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig(){return this._transport.getOptionalContentConfig()}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(e=!1){return this._transport.startCleanup(e||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}saveDocument(){return this._transport.annotationStorage.size<=0&&(0,_display_utils.deprecated)("saveDocument called while `annotationStorage` is empty, please use the getData-method instead."),this._transport.saveDocument()}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}exports.PDFDocumentProxy=PDFDocumentProxy;class PDFPageProxy{constructor(e,t,n,r,i=!1){this._pageIndex=e,this._pageInfo=t,this._ownerDocument=r,this._transport=n,this._stats=i?new _display_utils.StatTimer:null,this._pdfBug=i,this.commonObjs=n.commonObjs,this.objs=new PDFObjects,this._bitmaps=new Set,this.cleanupAfterRender=!1,this.pendingCleanup=!1,this._intentStates=new Map,this._annotationPromises=new Map,this.destroyed=!1}get pageNumber(){return this._pageIndex+1}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:e,rotation:t=this.rotate,offsetX:n=0,offsetY:r=0,dontFlip:i=!1}={}){return new _display_utils.PageViewport({viewBox:this.view,scale:e,rotation:t,offsetX:n,offsetY:r,dontFlip:i})}getAnnotations({intent:e="display"}={}){const t=this._transport.getRenderingIntent(e);let n=this._annotationPromises.get(t.cacheKey);return n||(n=this._transport.getAnnotations(this._pageIndex,t.renderingIntent),this._annotationPromises.set(t.cacheKey,n),n=n.then((e=>{for(const t of e)void 0!==t.titleObj&&Object.defineProperty(t,"title",{get:()=>((0,_display_utils.deprecated)("`title`-property on annotation, please use `titleObj` instead."),t.titleObj.str)}),void 0!==t.contentsObj&&Object.defineProperty(t,"contents",{get:()=>((0,_display_utils.deprecated)("`contents`-property on annotation, please use `contentsObj` instead."),t.contentsObj.str)});return e}))),n}getJSActions(){return this._jsActionsPromise||=this._transport.getPageJSActions(this._pageIndex)}async getXfa(){return this._transport._htmlForXfa?.children[this._pageIndex]||null}render({canvasContext:e,viewport:t,intent:n="display",annotationMode:r=_util.AnnotationMode.ENABLE,transform:i=null,imageLayer:s=null,canvasFactory:a=null,background:o=null,optionalContentConfigPromise:l=null,annotationCanvasMap:c=null,pageColors:u=null,printAnnotationStorage:d=null}){void 0!==arguments[0]?.renderInteractiveForms&&((0,_display_utils.deprecated)("render no longer accepts the `renderInteractiveForms`-option, please use the `annotationMode`-option instead."),!0===arguments[0].renderInteractiveForms&&r===_util.AnnotationMode.ENABLE&&(r=_util.AnnotationMode.ENABLE_FORMS)),void 0!==arguments[0]?.includeAnnotationStorage&&((0,_display_utils.deprecated)("render no longer accepts the `includeAnnotationStorage`-option, please use the `annotationMode`-option instead."),!0===arguments[0].includeAnnotationStorage&&r===_util.AnnotationMode.ENABLE&&(r=_util.AnnotationMode.ENABLE_STORAGE)),this._stats&&this._stats.time("Overall");const h=this._transport.getRenderingIntent(n,r,d);this.pendingCleanup=!1,l||(l=this._transport.getOptionalContentConfig());let p=this._intentStates.get(h.cacheKey);p||(p=Object.create(null),this._intentStates.set(h.cacheKey,p)),p.streamReaderCancelTimeout&&(clearTimeout(p.streamReaderCancelTimeout),p.streamReaderCancelTimeout=null);const f=a||new DefaultCanvasFactory({ownerDocument:this._ownerDocument}),g=!!(h.renderingIntent&_util.RenderingIntentFlag.PRINT);p.displayReadyCapability||(p.displayReadyCapability=(0,_util.createPromiseCapability)(),p.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats&&this._stats.time("Page Request"),this._pumpOperatorList(h));const m=e=>{p.renderTasks.delete(v),(this.cleanupAfterRender||g)&&(this.pendingCleanup=!0),this._tryCleanup(),e?(v.capability.reject(e),this._abortOperatorList({intentState:p,reason:e instanceof Error?e:new Error(e)})):v.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"))},v=new InternalRenderTask({callback:m,params:{canvasContext:e,viewport:t,transform:i,imageLayer:s,background:o},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:c,operatorList:p.operatorList,pageIndex:this._pageIndex,canvasFactory:f,useRequestAnimationFrame:!g,pdfBug:this._pdfBug,pageColors:u});(p.renderTasks||=new Set).add(v);const y=v.task;return Promise.all([p.displayReadyCapability.promise,l]).then((([e,t])=>{this.pendingCleanup?m():(this._stats&&this._stats.time("Rendering"),v.initializeGraphics({transparency:e,optionalContentConfig:t}),v.operatorListChanged())})).catch(m),y}getOperatorList({intent:e="display",annotationMode:t=_util.AnnotationMode.ENABLE,printAnnotationStorage:n=null}={}){const r=this._transport.getRenderingIntent(e,t,n,!0);let i,s=this._intentStates.get(r.cacheKey);return s||(s=Object.create(null),this._intentStates.set(r.cacheKey,s)),s.opListReadCapability||(i=Object.create(null),i.operatorListChanged=function(){s.operatorList.lastChunk&&(s.opListReadCapability.resolve(s.operatorList),s.renderTasks.delete(i))},s.opListReadCapability=(0,_util.createPromiseCapability)(),(s.renderTasks||=new Set).add(i),s.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats&&this._stats.time("Page Request"),this._pumpOperatorList(r)),s.opListReadCapability.promise}streamTextContent({disableCombineTextItems:e=!1,includeMarkedContent:t=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,combineTextItems:!0!==e,includeMarkedContent:!0===t},{highWaterMark:100,size:e=>e.items.length})}getTextContent(e={}){if(this._transport._htmlForXfa)return this.getXfa().then((e=>_xfa_text.XfaText.textContent(e)));const t=this.streamTextContent(e);return new Promise((function(e,n){const r=t.getReader(),i={items:[],styles:Object.create(null)};!function t(){r.read().then((function({value:n,done:r}){r?e(i):(Object.assign(i.styles,n.styles),i.items.push(...n.items),t())}),n)}()}))}getStructTree(){return this._structTreePromise||=this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const e=[];for(const t of this._intentStates.values())if(this._abortOperatorList({intentState:t,reason:new Error("Page was destroyed."),force:!0}),!t.opListReadCapability)for(const n of t.renderTasks)e.push(n.completed),n.cancel();this.objs.clear();for(const e of this._bitmaps)e.close();return this._bitmaps.clear(),this._annotationPromises.clear(),this._jsActionsPromise=null,this._structTreePromise=null,this.pendingCleanup=!1,Promise.all(e)}cleanup(e=!1){return this.pendingCleanup=!0,this._tryCleanup(e)}_tryCleanup(e=!1){if(!this.pendingCleanup)return!1;for(const{renderTasks:e,operatorList:t}of this._intentStates.values())if(e.size>0||!t.lastChunk)return!1;this._intentStates.clear(),this.objs.clear(),this._annotationPromises.clear(),this._jsActionsPromise=null,this._structTreePromise=null,e&&this._stats&&(this._stats=new _display_utils.StatTimer);for(const e of this._bitmaps)e.close();return this._bitmaps.clear(),this.pendingCleanup=!1,!0}_startRenderPage(e,t){const n=this._intentStates.get(t);n&&(this._stats&&this._stats.timeEnd("Page Request"),n.displayReadyCapability&&n.displayReadyCapability.resolve(e))}_renderPageChunk(e,t){for(let n=0,r=e.length;n<r;n++)t.operatorList.fnArray.push(e.fnArray[n]),t.operatorList.argsArray.push(e.argsArray[n]);t.operatorList.lastChunk=e.lastChunk,t.operatorList.separateAnnots=e.separateAnnots;for(const e of t.renderTasks)e.operatorListChanged();e.lastChunk&&this._tryCleanup()}_pumpOperatorList({renderingIntent:e,cacheKey:t,annotationStorageMap:n}){const r=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:e,cacheKey:t,annotationStorage:n}).getReader(),i=this._intentStates.get(t);i.streamReader=r;const s=()=>{r.read().then((({value:e,done:t})=>{t?i.streamReader=null:this._transport.destroyed||(this._renderPageChunk(e,i),s())}),(e=>{if(i.streamReader=null,!this._transport.destroyed){if(i.operatorList){i.operatorList.lastChunk=!0;for(const e of i.renderTasks)e.operatorListChanged();this._tryCleanup()}if(i.displayReadyCapability)i.displayReadyCapability.reject(e);else{if(!i.opListReadCapability)throw e;i.opListReadCapability.reject(e)}}}))};s()}_abortOperatorList({intentState:e,reason:t,force:n=!1}){if(e.streamReader){if(!n){if(e.renderTasks.size>0)return;if(t instanceof _display_utils.RenderingCancelledException)return void(e.streamReaderCancelTimeout=setTimeout((()=>{this._abortOperatorList({intentState:e,reason:t,force:!0}),e.streamReaderCancelTimeout=null}),RENDERING_CANCELLED_TIMEOUT))}if(e.streamReader.cancel(new _util.AbortException(t.message)).catch((()=>{})),e.streamReader=null,!this._transport.destroyed){for(const[t,n]of this._intentStates)if(n===e){this._intentStates.delete(t);break}this.cleanup()}}}get stats(){return this._stats}}exports.PDFPageProxy=PDFPageProxy;class LoopbackPort{constructor(){this._listeners=[],this._deferred=Promise.resolve()}postMessage(e,t){const n={data:structuredClone(e,t)};this._deferred.then((()=>{for(const e of this._listeners)e.call(this,n)}))}addEventListener(e,t){this._listeners.push(t)}removeEventListener(e,t){const n=this._listeners.indexOf(t);this._listeners.splice(n,1)}terminate(){this._listeners.length=0}}exports.LoopbackPort=LoopbackPort;const PDFWorkerUtil={isWorkerDisabled:!1,fallbackWorkerSrc:null,fakeWorkerId:0};if(exports.PDFWorkerUtil=PDFWorkerUtil,_is_node.isNodeJS&&"function"==typeof commonjsRequire)PDFWorkerUtil.isWorkerDisabled=!0,PDFWorkerUtil.fallbackWorkerSrc="./pdf.worker.js";else if("object"==typeof document){const e=document?.currentScript?.src;e&&(PDFWorkerUtil.fallbackWorkerSrc=e.replace(/(\.(?:min\.)?js)(\?.*)?$/i,".worker$1$2"))}PDFWorkerUtil.isSameOrigin=function(e,t){let n;try{if(n=new URL(e),!n.origin||"null"===n.origin)return!1}catch(e){return!1}const r=new URL(t,n);return n.origin===r.origin},PDFWorkerUtil.createCDNWrapper=function(e){const t=`importScripts("${e}");`;return URL.createObjectURL(new Blob([t]))};class PDFWorker{static#t=new WeakMap;constructor({name:e=null,port:t=null,verbosity:n=(0,_util.getVerbosityLevel)()}={}){if(t&&PDFWorker.#t.has(t))throw new Error("Cannot use more than one PDFWorker per port.");if(this.name=e,this.destroyed=!1,this.verbosity=n,this._readyCapability=(0,_util.createPromiseCapability)(),this._port=null,this._webWorker=null,this._messageHandler=null,t)return PDFWorker.#t.set(t,this),void this._initializeFromPort(t);this._initialize()}get promise(){return this._readyCapability.promise}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(e){this._port=e,this._messageHandler=new _message_handler.MessageHandler("main","worker",e),this._messageHandler.on("ready",(function(){})),this._readyCapability.resolve()}_initialize(){if(!PDFWorkerUtil.isWorkerDisabled&&!PDFWorker._mainThreadWorkerMessageHandler){let{workerSrc:e}=PDFWorker;try{PDFWorkerUtil.isSameOrigin(window.location.href,e)||(e=PDFWorkerUtil.createCDNWrapper(new URL(e,window.location).href));const t=new Worker(e),n=new _message_handler.MessageHandler("main","worker",t),r=()=>{t.removeEventListener("error",i),n.destroy(),t.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},i=()=>{this._webWorker||r()};t.addEventListener("error",i),n.on("test",(e=>{t.removeEventListener("error",i),this.destroyed?r():e?(this._messageHandler=n,this._port=t,this._webWorker=t,this._readyCapability.resolve(),n.send("configure",{verbosity:this.verbosity})):(this._setupFakeWorker(),n.destroy(),t.terminate())})),n.on("ready",(e=>{if(t.removeEventListener("error",i),this.destroyed)r();else try{s()}catch(e){this._setupFakeWorker()}}));const s=()=>{const e=new Uint8Array;n.send("test",e,[e.buffer])};return void s()}catch(e){(0,_util.info)("The worker has been disabled.")}}this._setupFakeWorker()}_setupFakeWorker(){PDFWorkerUtil.isWorkerDisabled||((0,_util.warn)("Setting up fake worker."),PDFWorkerUtil.isWorkerDisabled=!0),PDFWorker._setupFakeWorkerGlobal.then((e=>{if(this.destroyed)return void this._readyCapability.reject(new Error("Worker was destroyed"));const t=new LoopbackPort;this._port=t;const n="fake"+PDFWorkerUtil.fakeWorkerId++,r=new _message_handler.MessageHandler(n+"_worker",n,t);e.setup(r,t);const i=new _message_handler.MessageHandler(n,n+"_worker",t);this._messageHandler=i,this._readyCapability.resolve(),i.send("configure",{verbosity:this.verbosity})})).catch((e=>{this._readyCapability.reject(new Error(`Setting up fake worker failed: "${e.message}".`))}))}destroy(){this.destroyed=!0,this._webWorker&&(this._webWorker.terminate(),this._webWorker=null),PDFWorker.#t.delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.destroy(),this._messageHandler=null)}static fromPort(e){if(!e?.port)throw new Error("PDFWorker.fromPort - invalid method signature.");return this.#t.has(e.port)?this.#t.get(e.port):new PDFWorker(e)}static get workerSrc(){if(_worker_options.GlobalWorkerOptions.workerSrc)return _worker_options.GlobalWorkerOptions.workerSrc;if(null!==PDFWorkerUtil.fallbackWorkerSrc)return _is_node.isNodeJS||(0,_display_utils.deprecated)('No "GlobalWorkerOptions.workerSrc" specified.'),PDFWorkerUtil.fallbackWorkerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _mainThreadWorkerMessageHandler(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch(e){return null}}static get _setupFakeWorkerGlobal(){const loader=async()=>{const mainWorkerMessageHandler=this._mainThreadWorkerMessageHandler;if(mainWorkerMessageHandler)return mainWorkerMessageHandler;if(_is_node.isNodeJS&&"function"==typeof commonjsRequire){const worker=eval("require")(this.workerSrc);return worker.WorkerMessageHandler}return await(0,_display_utils.loadScript)(this.workerSrc),window.pdfjsWorker.WorkerMessageHandler};return(0,_util.shadow)(this,"_setupFakeWorkerGlobal",loader())}}exports.PDFWorker=PDFWorker,PDFWorker.getWorkerSrc=function(){return(0,_display_utils.deprecated)("`PDFWorker.getWorkerSrc()`, please use `PDFWorker.workerSrc` instead."),this.workerSrc};class WorkerTransport{#n=null;#r=new Map;#i=new Map;#s=null;constructor(e,t,n,r){this.messageHandler=e,this.loadingTask=t,this.commonObjs=new PDFObjects,this.fontLoader=new _font_loader.FontLoader({docId:t.docId,onUnsupportedFeature:this._onUnsupportedFeature.bind(this),ownerDocument:r.ownerDocument,styleElement:r.styleElement}),this._params=r,r.useWorkerFetch||(this.CMapReaderFactory=new r.CMapReaderFactory({baseUrl:r.cMapUrl,isCompressed:r.cMapPacked}),this.StandardFontDataFactory=new r.StandardFontDataFactory({baseUrl:r.standardFontDataUrl})),this.destroyed=!1,this.destroyCapability=null,this._passwordCapability=null,this._networkStream=n,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=(0,_util.createPromiseCapability)(),this.setupMessageHandler()}get annotationStorage(){return(0,_util.shadow)(this,"annotationStorage",new _annotation_storage.AnnotationStorage)}get stats(){return this.#n}getRenderingIntent(e,t=_util.AnnotationMode.ENABLE,n=null,r=!1){let i=_util.RenderingIntentFlag.DISPLAY,s=null;switch(e){case"any":i=_util.RenderingIntentFlag.ANY;break;case"display":break;case"print":i=_util.RenderingIntentFlag.PRINT;break;default:(0,_util.warn)(`getRenderingIntent - invalid intent: ${e}`)}switch(t){case _util.AnnotationMode.DISABLE:i+=_util.RenderingIntentFlag.ANNOTATIONS_DISABLE;break;case _util.AnnotationMode.ENABLE:break;case _util.AnnotationMode.ENABLE_FORMS:i+=_util.RenderingIntentFlag.ANNOTATIONS_FORMS;break;case _util.AnnotationMode.ENABLE_STORAGE:i+=_util.RenderingIntentFlag.ANNOTATIONS_STORAGE,s=(i&_util.RenderingIntentFlag.PRINT&&n instanceof _annotation_storage.PrintAnnotationStorage?n:this.annotationStorage).serializable;break;default:(0,_util.warn)(`getRenderingIntent - invalid annotationMode: ${t}`)}return r&&(i+=_util.RenderingIntentFlag.OPLIST),{renderingIntent:i,cacheKey:`${i}_${_annotation_storage.AnnotationStorage.getHash(s)}`,annotationStorageMap:s}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=(0,_util.createPromiseCapability)(),this._passwordCapability&&this._passwordCapability.reject(new Error("Worker was destroyed during onPassword callback"));const e=[];for(const t of this.#r.values())e.push(t._destroy());this.#r.clear(),this.#i.clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const t=this.messageHandler.sendWithPromise("Terminate",null);return e.push(t),Promise.all(e).then((()=>{this.commonObjs.clear(),this.fontLoader.clear(),this.#s=null,this._getFieldObjectsPromise=null,this._hasJSActionsPromise=null,this._networkStream&&this._networkStream.cancelAllRequests(new _util.AbortException("Worker was terminated.")),this.messageHandler&&(this.messageHandler.destroy(),this.messageHandler=null),this.destroyCapability.resolve()}),this.destroyCapability.reject),this.destroyCapability.promise}setupMessageHandler(){const{messageHandler:e,loadingTask:t}=this;e.on("GetReader",((e,t)=>{(0,_util.assert)(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=e=>{this._lastProgress={loaded:e.loaded,total:e.total}},t.onPull=()=>{this._fullReader.read().then((function({value:e,done:n}){n?t.close():((0,_util.assert)((0,_util.isArrayBuffer)(e),"GetReader - expected an ArrayBuffer."),t.enqueue(new Uint8Array(e),1,[e]))})).catch((e=>{t.error(e)}))},t.onCancel=e=>{this._fullReader.cancel(e),t.ready.catch((e=>{if(!this.destroyed)throw e}))}})),e.on("ReaderHeadersReady",(e=>{const n=(0,_util.createPromiseCapability)(),r=this._fullReader;return r.headersReady.then((()=>{r.isStreamingSupported&&r.isRangeSupported||(this._lastProgress&&t.onProgress?.(this._lastProgress),r.onProgress=e=>{t.onProgress?.({loaded:e.loaded,total:e.total})}),n.resolve({isStreamingSupported:r.isStreamingSupported,isRangeSupported:r.isRangeSupported,contentLength:r.contentLength})}),n.reject),n.promise})),e.on("GetRangeReader",((e,t)=>{(0,_util.assert)(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const n=this._networkStream.getRangeReader(e.begin,e.end);n?(t.onPull=()=>{n.read().then((function({value:e,done:n}){n?t.close():((0,_util.assert)((0,_util.isArrayBuffer)(e),"GetRangeReader - expected an ArrayBuffer."),t.enqueue(new Uint8Array(e),1,[e]))})).catch((e=>{t.error(e)}))},t.onCancel=e=>{n.cancel(e),t.ready.catch((e=>{if(!this.destroyed)throw e}))}):t.close()})),e.on("GetDoc",(({pdfInfo:e})=>{this._numPages=e.numPages,this._htmlForXfa=e.htmlForXfa,delete e.htmlForXfa,t._capability.resolve(new PDFDocumentProxy(e,this))})),e.on("DocException",(function(e){let n;switch(e.name){case"PasswordException":n=new _util.PasswordException(e.message,e.code);break;case"InvalidPDFException":n=new _util.InvalidPDFException(e.message);break;case"MissingPDFException":n=new _util.MissingPDFException(e.message);break;case"UnexpectedResponseException":n=new _util.UnexpectedResponseException(e.message,e.status);break;case"UnknownErrorException":n=new _util.UnknownErrorException(e.message,e.details);break;default:(0,_util.unreachable)("DocException - expected a valid Error.")}t._capability.reject(n)})),e.on("PasswordRequest",(e=>{if(this._passwordCapability=(0,_util.createPromiseCapability)(),t.onPassword){const n=e=>{e instanceof Error?this._passwordCapability.reject(e):this._passwordCapability.resolve({password:e})};try{t.onPassword(n,e.code)}catch(e){this._passwordCapability.reject(e)}}else this._passwordCapability.reject(new _util.PasswordException(e.message,e.code));return this._passwordCapability.promise})),e.on("DataLoaded",(e=>{t.onProgress?.({loaded:e.length,total:e.length}),this.downloadInfoCapability.resolve(e)})),e.on("StartRenderPage",(e=>{this.destroyed||this.#r.get(e.pageIndex)._startRenderPage(e.transparency,e.cacheKey)})),e.on("commonobj",(([t,n,r])=>{if(!this.destroyed&&!this.commonObjs.has(t))switch(n){case"Font":const i=this._params;if("error"in r){const e=r.error;(0,_util.warn)(`Error during font loading: ${e}`),this.commonObjs.resolve(t,e);break}let s=null;i.pdfBug&&globalThis.FontInspector?.enabled&&(s={registerFont(e,t){globalThis.FontInspector.fontAdded(e,t)}});const a=new _font_loader.FontFaceObject(r,{isEvalSupported:i.isEvalSupported,disableFontFace:i.disableFontFace,ignoreErrors:i.ignoreErrors,onUnsupportedFeature:this._onUnsupportedFeature.bind(this),fontRegistry:s});this.fontLoader.bind(a).catch((n=>e.sendWithPromise("FontFallback",{id:t}))).finally((()=>{!i.fontExtraProperties&&a.data&&(a.data=null),this.commonObjs.resolve(t,a)}));break;case"FontPath":case"Image":this.commonObjs.resolve(t,r);break;default:throw new Error(`Got unknown common object type ${n}`)}})),e.on("obj",(([e,t,n,r])=>{if(this.destroyed)return;const i=this.#r.get(t);if(!i.objs.has(e))switch(n){case"Image":i.objs.resolve(e,r);const t=8e6;if(r){let e;if(r.bitmap){const{bitmap:t,width:n,height:s}=r;e=n*s*4,i._bitmaps.add(t)}else e=r.data?.length||0;e>t&&(i.cleanupAfterRender=!0)}break;case"Pattern":i.objs.resolve(e,r);break;default:throw new Error(`Got unknown object type ${n}`)}})),e.on("DocProgress",(e=>{this.destroyed||t.onProgress?.({loaded:e.loaded,total:e.total})})),e.on("DocStats",(e=>{this.destroyed||(this.#n=Object.freeze({streamTypes:Object.freeze(e.streamTypes),fontTypes:Object.freeze(e.fontTypes)}))})),e.on("UnsupportedFeature",this._onUnsupportedFeature.bind(this)),e.on("FetchBuiltInCMap",(e=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.CMapReaderFactory?this.CMapReaderFactory.fetch(e):Promise.reject(new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter.")))),e.on("FetchStandardFontData",(e=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.StandardFontDataFactory?this.StandardFontDataFactory.fetch(e):Promise.reject(new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter."))))}_onUnsupportedFeature({featureId:e}){this.destroyed||this.loadingTask.onUnsupportedFeature?.(e)}getData(){return this.messageHandler.sendWithPromise("GetData",null)}getPage(e){if(!Number.isInteger(e)||e<=0||e>this._numPages)return Promise.reject(new Error("Invalid page request."));const t=e-1,n=this.#i.get(t);if(n)return n;const r=this.messageHandler.sendWithPromise("GetPage",{pageIndex:t}).then((e=>{if(this.destroyed)throw new Error("Transport destroyed");const n=new PDFPageProxy(t,e,this,this._params.ownerDocument,this._params.pdfBug);return this.#r.set(t,n),n}));return this.#i.set(t,r),r}getPageIndex(e){return"object"!=typeof e||null===e||!Number.isInteger(e.num)||e.num<0||!Number.isInteger(e.gen)||e.gen<0?Promise.reject(new Error("Invalid pageIndex request.")):this.messageHandler.sendWithPromise("GetPageIndex",{num:e.num,gen:e.gen})}getAnnotations(e,t){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:e,intent:t})}saveDocument(){return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:this.annotationStorage.serializable,filename:this._fullReader?.filename??null}).finally((()=>{this.annotationStorage.resetModified()}))}getFieldObjects(){return this._getFieldObjectsPromise||=this.messageHandler.sendWithPromise("GetFieldObjects",null)}hasJSActions(){return this._hasJSActionsPromise||=this.messageHandler.sendWithPromise("HasJSActions",null)}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(e){return"string"!=typeof e?Promise.reject(new Error("Invalid destination request.")):this.messageHandler.sendWithPromise("GetDestination",{id:e})}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)}getJavaScript(){return this.messageHandler.sendWithPromise("GetJavaScript",null)}getDocJSActions(){return this.messageHandler.sendWithPromise("GetDocJSActions",null)}getPageJSActions(e){return this.messageHandler.sendWithPromise("GetPageJSActions",{pageIndex:e})}getStructTree(e){return this.messageHandler.sendWithPromise("GetStructTree",{pageIndex:e})}getOutline(){return this.messageHandler.sendWithPromise("GetOutline",null)}getOptionalContentConfig(){return this.messageHandler.sendWithPromise("GetOptionalContentConfig",null).then((e=>new _optional_content_config.OptionalContentConfig(e)))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){return this.#s||=this.messageHandler.sendWithPromise("GetMetadata",null).then((e=>({info:e[0],metadata:e[1]?new _metadata.Metadata(e[1]):null,contentDispositionFilename:this._fullReader?.filename??null,contentLength:this._fullReader?.contentLength??null})))}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(e=!1){if(await this.messageHandler.sendWithPromise("Cleanup",null),!this.destroyed){for(const e of this.#r.values())if(!e.cleanup())throw new Error(`startCleanup: Page ${e.pageNumber} is currently rendering.`);this.commonObjs.clear(),e||this.fontLoader.clear(),this.#s=null,this._getFieldObjectsPromise=null,this._hasJSActionsPromise=null}}get loadingParams(){const e=this._params;return(0,_util.shadow)(this,"loadingParams",{disableAutoFetch:e.disableAutoFetch,enableXfa:e.enableXfa})}}class PDFObjects{#a=Object.create(null);#o(e){const t=this.#a[e];return t||(this.#a[e]={capability:(0,_util.createPromiseCapability)(),data:null})}get(e,t=null){if(t){const n=this.#o(e);return n.capability.promise.then((()=>t(n.data))),null}const n=this.#a[e];if(!n?.capability.settled)throw new Error(`Requesting object that isn't resolved yet ${e}.`);return n.data}has(e){return this.#a[e]?.capability.settled||!1}resolve(e,t=null){const n=this.#o(e);n.data=t,n.capability.resolve()}clear(){this.#a=Object.create(null)}}class RenderTask{#l=null;constructor(e){this.#l=e,this.onContinue=null}get promise(){return this.#l.capability.promise}cancel(){this.#l.cancel()}get separateAnnots(){const{separateAnnots:e}=this.#l.operatorList;if(!e)return!1;const{annotationCanvasMap:t}=this.#l;return e.form||e.canvas&&t?.size>0}}exports.RenderTask=RenderTask;class InternalRenderTask{static#c=new WeakSet;constructor({callback:e,params:t,objs:n,commonObjs:r,annotationCanvasMap:i,operatorList:s,pageIndex:a,canvasFactory:o,useRequestAnimationFrame:l=!1,pdfBug:c=!1,pageColors:u=null}){this.callback=e,this.params=t,this.objs=n,this.commonObjs=r,this.annotationCanvasMap=i,this.operatorListIdx=null,this.operatorList=s,this._pageIndex=a,this.canvasFactory=o,this._pdfBug=c,this.pageColors=u,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=!0===l&&"undefined"!=typeof window,this.cancelled=!1,this.capability=(0,_util.createPromiseCapability)(),this.task=new RenderTask(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=t.canvasContext.canvas}get completed(){return this.capability.promise.catch((function(){}))}initializeGraphics({transparency:e=!1,optionalContentConfig:t}){if(this.cancelled)return;if(this._canvas){if(InternalRenderTask.#c.has(this._canvas))throw new Error("Cannot use the same canvas during multiple render() operations. Use different canvas or ensure previous operations were cancelled or completed.");InternalRenderTask.#c.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());const{canvasContext:n,viewport:r,transform:i,imageLayer:s,background:a}=this.params;this.gfx=new _canvas.CanvasGraphics(n,this.commonObjs,this.objs,this.canvasFactory,s,t,this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:i,viewport:r,transparency:e,background:a}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback&&this.graphicsReadyCallback()}cancel(e=null){this.running=!1,this.cancelled=!0,this.gfx&&this.gfx.endDrawing(),this._canvas&&InternalRenderTask.#c.delete(this._canvas),this.callback(e||new _display_utils.RenderingCancelledException(`Rendering cancelled, page ${this._pageIndex+1}`,"canvas"))}operatorListChanged(){this.graphicsReady?(this.stepper&&this.stepper.updateOperatorList(this.operatorList),this.running||this._continue()):this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound)}_continue(){this.running=!0,this.cancelled||(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?window.requestAnimationFrame((()=>{this._nextBound().catch(this._cancelBound)})):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.operatorListIdx===this.operatorList.argsArray.length&&(this.running=!1,this.operatorList.lastChunk&&(this.gfx.endDrawing(),this._canvas&&InternalRenderTask.#c.delete(this._canvas),this.callback())))}}const version="2.16.105";exports.version=version;const build="172ccdbe5";exports.build=build},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PrintAnnotationStorage=t.AnnotationStorage=void 0;var r=n(1),i=n(6),s=n(10);class a{constructor(){this._storage=new Map,this._modified=!1,this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(e,t){const n=this._storage.get(e);return void 0===n?t:Object.assign(t,n)}getRawValue(e){return this._storage.get(e)}remove(e){if(this._storage.delete(e),0===this._storage.size&&this.resetModified(),"function"==typeof this.onAnnotationEditor){for(const e of this._storage.values())if(e instanceof i.AnnotationEditor)return;this.onAnnotationEditor(null)}}setValue(e,t){const n=this._storage.get(e);let r=!1;if(void 0!==n)for(const[e,i]of Object.entries(t))n[e]!==i&&(r=!0,n[e]=i);else r=!0,this._storage.set(e,t);r&&this.#u(),t instanceof i.AnnotationEditor&&"function"==typeof this.onAnnotationEditor&&this.onAnnotationEditor(t.constructor._type)}has(e){return this._storage.has(e)}getAll(){return this._storage.size>0?(0,r.objectFromMap)(this._storage):null}get size(){return this._storage.size}#u(){this._modified||(this._modified=!0,"function"==typeof this.onSetModified&&this.onSetModified())}resetModified(){this._modified&&(this._modified=!1,"function"==typeof this.onResetModified&&this.onResetModified())}get print(){return new o(this)}get serializable(){if(0===this._storage.size)return null;const e=new Map;for(const[t,n]of this._storage){const r=n instanceof i.AnnotationEditor?n.serialize():n;r&&e.set(t,r)}return e}static getHash(e){if(!e)return"";const t=new s.MurmurHash3_64;for(const[n,r]of e)t.update(`${n}:${JSON.stringify(r)}`);return t.hexdigest()}}t.AnnotationStorage=a;class o extends a{#d=null;constructor(e){super(),this.#d=structuredClone(e.serializable)}get print(){(0,r.unreachable)("Should not call PrintAnnotationStorage.print")}get serializable(){return this.#d}}t.PrintAnnotationStorage=o},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AnnotationEditor=void 0;var r=n(7),i=n(1);class s{#h=this.focusin.bind(this);#p=this.focusout.bind(this);#f=!1;#g=!1;#m=!1;#v=s._zIndex++;static _colorManager=new r.ColorManager;static _zIndex=1;constructor(e){this.constructor===s&&(0,i.unreachable)("Cannot initialize AnnotationEditor."),this.parent=e.parent,this.id=e.id,this.width=this.height=null,this.pageIndex=e.parent.pageIndex,this.name=e.name,this.div=null;const[t,n]=this.parent.viewportBaseDimensions;this.x=e.x/t,this.y=e.y/n,this.rotation=this.parent.viewport.rotation,this.isAttachedToDOM=!1}static get _defaultLineColor(){return(0,i.shadow)(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=this.#v}focusin(e){this.#f?this.#f=!1:this.parent.setSelected(this)}focusout(e){this.isAttachedToDOM&&(e.relatedTarget?.closest(`#${this.id}`)||(e.preventDefault(),this.parent.isMultipleSelection||this.commitOrRemove()))}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.parent.addToAnnotationStorage(this)}dragstart(e){const t=this.parent.div.getBoundingClientRect();this.startX=e.clientX-t.x,this.startY=e.clientY-t.y,e.dataTransfer.setData("text/plain",this.id),e.dataTransfer.effectAllowed="move"}setAt(e,t,n,r){const[i,s]=this.parent.viewportBaseDimensions;[n,r]=this.screenToPageTranslation(n,r),this.x=(e+n)/i,this.y=(t+r)/s,this.div.style.left=100*this.x+"%",this.div.style.top=100*this.y+"%"}translate(e,t){const[n,r]=this.parent.viewportBaseDimensions;[e,t]=this.screenToPageTranslation(e,t),this.x+=e/n,this.y+=t/r,this.div.style.left=100*this.x+"%",this.div.style.top=100*this.y+"%"}screenToPageTranslation(e,t){const{rotation:n}=this.parent.viewport;switch(n){case 90:return[t,-e];case 180:return[-e,-t];case 270:return[-t,e];default:return[e,t]}}setDims(e,t){const[n,r]=this.parent.viewportBaseDimensions;this.div.style.width=100*e/n+"%",this.div.style.height=100*t/r+"%"}getInitialTranslation(){return[0,0]}render(){this.div=document.createElement("div"),this.div.setAttribute("data-editor-rotation",(360-this.rotation)%360),this.div.className=this.name,this.div.setAttribute("id",this.id),this.div.setAttribute("tabIndex",0),this.setInForeground(),this.div.addEventListener("focusin",this.#h),this.div.addEventListener("focusout",this.#p);const[e,t]=this.getInitialTranslation();return this.translate(e,t),(0,r.bindEvents)(this,this.div,["dragstart","pointerdown"]),this.div}pointerdown(e){const t=r.KeyboardManager.platform.isMac;0!==e.button||e.ctrlKey&&t?e.preventDefault():(e.ctrlKey&&!t||e.shiftKey||e.metaKey&&t?this.parent.toggleSelected(this):this.parent.setSelected(this),this.#f=!0)}getRect(e,t){const[n,r]=this.parent.viewportBaseDimensions,[i,s]=this.parent.pageDimensions,a=i*e/n,o=s*t/r,l=this.x*i,c=this.y*s,u=this.width*i,d=this.height*s;switch(this.rotation){case 0:return[l+a,s-c-o-d,l+a+u,s-c-o];case 90:return[l+o,s-c+a,l+o+d,s-c+a+u];case 180:return[l-a-u,s-c+o,l-a,s-c+o+d];case 270:return[l-o-d,s-c-a-u,l-o,s-c-a];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(e,t){const[n,r,i,s]=e,a=i-n,o=s-r;switch(this.rotation){case 0:return[n,t-s,a,o];case 90:return[n,t-r,o,a];case 180:return[i,t-r,a,o];case 270:return[i,t-s,o,a];default:throw new Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){this.#m=!0}disableEditMode(){this.#m=!1}isInEditMode(){return this.#m}shouldGetKeyboardEvents(){return!1}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}rebuild(){this.div?.addEventListener("focusin",this.#h)}serialize(){(0,i.unreachable)("An editor must be serializable")}static deserialize(e,t){const n=new this.prototype.constructor({parent:t,id:t.getNextId()});n.rotation=e.rotation;const[r,i]=t.pageDimensions,[s,a,o,l]=n.getRectInCurrentCoords(e.rect,i);return n.x=s/r,n.y=a/i,n.width=o/r,n.height=l/i,n}remove(){this.div.removeEventListener("focusin",this.#h),this.div.removeEventListener("focusout",this.#p),this.isEmpty()||this.commit(),this.parent.remove(this)}select(){this.div?.classList.add("selectedEditor")}unselect(){this.div?.classList.remove("selectedEditor")}updateParams(e,t){}disableEditing(){}enableEditing(){}get propertiesToUpdate(){return{}}get contentDiv(){return this.div}get isEditing(){return this.#g}set isEditing(e){this.#g=e,e?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null)}}t.AnnotationEditor=s},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.KeyboardManager=t.CommandManager=t.ColorManager=t.AnnotationEditorUIManager=void 0,t.bindEvents=function(e,t,n){for(const r of n)t.addEventListener(r,e[r].bind(e))},t.opacityToHex=function(e){return Math.round(Math.min(255,Math.max(1,255*e))).toString(16).padStart(2,"0")};var r=n(1),i=n(8);class s{#y=0;getId(){return`${r.AnnotationEditorPrefix}${this.#y++}`}}class a{#b=[];#_=!1;#w;#E=-1;constructor(e=128){this.#w=e}add({cmd:e,undo:t,mustExec:n,type:r=NaN,overwriteIfSameType:i=!1,keepUndo:s=!1}){if(n&&e(),this.#_)return;const a={cmd:e,undo:t,type:r};if(-1===this.#E)return this.#b.length>0&&(this.#b.length=0),this.#E=0,void this.#b.push(a);if(i&&this.#b[this.#E].type===r)return s&&(a.undo=this.#b[this.#E].undo),void(this.#b[this.#E]=a);const o=this.#E+1;o===this.#w?this.#b.splice(0,1):(this.#E=o,o<this.#b.length&&this.#b.splice(o)),this.#b.push(a)}undo(){-1!==this.#E&&(this.#_=!0,this.#b[this.#E].undo(),this.#_=!1,this.#E-=1)}redo(){this.#E<this.#b.length-1&&(this.#E+=1,this.#_=!0,this.#b[this.#E].cmd(),this.#_=!1)}hasSomethingToUndo(){return-1!==this.#E}hasSomethingToRedo(){return this.#E<this.#b.length-1}destroy(){this.#b=null}}t.CommandManager=a;class o{constructor(e){this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const t=o.platform.isMac;for(const[n,r]of e)for(const e of n){const n=e.startsWith("mac+");t&&n?(this.callbacks.set(e.slice(4),r),this.allKeys.add(e.split("+").at(-1))):t||n||(this.callbacks.set(e,r),this.allKeys.add(e.split("+").at(-1)))}}static get platform(){const e="undefined"!=typeof navigator?navigator.platform:"";return(0,r.shadow)(this,"platform",{isWin:e.includes("Win"),isMac:e.includes("Mac")})}#S(e){e.altKey&&this.buffer.push("alt"),e.ctrlKey&&this.buffer.push("ctrl"),e.metaKey&&this.buffer.push("meta"),e.shiftKey&&this.buffer.push("shift"),this.buffer.push(e.key);const t=this.buffer.join("+");return this.buffer.length=0,t}exec(e,t){if(!this.allKeys.has(t.key))return;const n=this.callbacks.get(this.#S(t));n&&(n.bind(e)(),t.stopPropagation(),t.preventDefault())}}t.KeyboardManager=o;class l{#C=null;copy(e){e&&(Array.isArray(e)?this.#C=e.map((e=>e.serialize())):this.#C=[e.serialize()],this.#C=this.#C.filter((e=>!!e)),0===this.#C.length&&(this.#C=null))}paste(){return this.#C}isEmpty(){return null===this.#C}destroy(){this.#C=null}}class c{static _colorsMapping=new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]);get _colors(){const e=new Map([["CanvasText",null],["Canvas",null]]);return(0,i.getColorValues)(e),(0,r.shadow)(this,"_colors",e)}convert(e){const t=(0,i.getRGB)(e);if(!window.matchMedia("(forced-colors: active)").matches)return t;for(const[e,n]of this._colors)if(n.every(((e,n)=>e===t[n])))return c._colorsMapping.get(e);return t}getHexCode(e){const t=this._colors.get(e);return t?r.Util.makeHexColor(...t):e}}t.ColorManager=c;class u{#A=null;#P=new Map;#x=new Map;#R=new l;#T=new a;#M=0;#L=null;#I=null;#k=new s;#O=!1;#F=r.AnnotationEditorType.NONE;#D=new Set;#N=this.keydown.bind(this);#U=this.onEditingAction.bind(this);#j=this.onPageChanging.bind(this);#$={isEditing:!1,isEmpty:!0,hasEmptyClipboard:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1};#H=null;static _keyboardManager=new o([[["ctrl+a","mac+meta+a"],u.prototype.selectAll],[["ctrl+c","mac+meta+c"],u.prototype.copy],[["ctrl+v","mac+meta+v"],u.prototype.paste],[["ctrl+x","mac+meta+x"],u.prototype.cut],[["ctrl+z","mac+meta+z"],u.prototype.undo],[["ctrl+y","ctrl+shift+Z","mac+meta+shift+Z"],u.prototype.redo],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete"],u.prototype.delete],[["Escape","mac+Escape"],u.prototype.unselectAll]]);constructor(e,t){this.#H=e,this.#I=t,this.#I._on("editingaction",this.#U),this.#I._on("pagechanging",this.#j)}destroy(){this.#B(),this.#I._off("editingaction",this.#U),this.#I._off("pagechanging",this.#j);for(const e of this.#x.values())e.destroy();this.#x.clear(),this.#P.clear(),this.#A=null,this.#D.clear(),this.#R.destroy(),this.#T.destroy()}onPageChanging({pageNumber:e}){this.#M=e-1}focusMainContainer(){this.#H.focus()}#V(){this.#H.addEventListener("keydown",this.#N)}#B(){this.#H.removeEventListener("keydown",this.#N)}keydown(e){this.getActive()?.shouldGetKeyboardEvents()||u._keyboardManager.exec(this,e)}onEditingAction(e){["undo","redo","cut","copy","paste","delete","selectAll"].includes(e.name)&&this[e.name]()}#W(e){Object.entries(e).some((([e,t])=>this.#$[e]!==t))&&this.#I.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(this.#$,e)})}#q(e){this.#I.dispatch("annotationeditorparamschanged",{source:this,details:e})}setEditingState(e){e?(this.#V(),this.#W({isEditing:this.#F!==r.AnnotationEditorType.NONE,isEmpty:this.#z(),hasSomethingToUndo:this.#T.hasSomethingToUndo(),hasSomethingToRedo:this.#T.hasSomethingToRedo(),hasSelectedEditor:!1,hasEmptyClipboard:this.#R.isEmpty()})):(this.#B(),this.#W({isEditing:!1}))}registerEditorTypes(e){this.#L=e;for(const e of this.#L)this.#q(e.defaultPropertiesToUpdate)}getId(){return this.#k.getId()}addLayer(e){this.#x.set(e.pageIndex,e),this.#O?e.enable():e.disable()}removeLayer(e){this.#x.delete(e.pageIndex)}updateMode(e){if(this.#F=e,e===r.AnnotationEditorType.NONE)this.setEditingState(!1),this.#G();else{this.setEditingState(!0),this.#Q();for(const t of this.#x.values())t.updateMode(e)}}updateToolbar(e){e!==this.#F&&this.#I.dispatch("switchannotationeditormode",{source:this,mode:e})}updateParams(e,t){for(const n of this.#D)n.updateParams(e,t);for(const n of this.#L)n.updateDefaultParams(e,t)}#Q(){if(!this.#O){this.#O=!0;for(const e of this.#x.values())e.enable()}}#G(){if(this.unselectAll(),this.#O){this.#O=!1;for(const e of this.#x.values())e.disable()}}getEditors(e){const t=[];for(const n of this.#P.values())n.pageIndex===e&&t.push(n);return t}getEditor(e){return this.#P.get(e)}addEditor(e){this.#P.set(e.id,e)}removeEditor(e){this.#P.delete(e.id),this.unselect(e)}#X(e){const t=this.#x.get(e.pageIndex);t?t.addOrRebuild(e):this.addEditor(e)}setActiveEditor(e){this.#A!==e&&(this.#A=e,e&&this.#q(e.propertiesToUpdate))}toggleSelected(e){if(this.#D.has(e))return this.#D.delete(e),e.unselect(),void this.#W({hasSelectedEditor:this.hasSelection});this.#D.add(e),e.select(),this.#q(e.propertiesToUpdate),this.#W({hasSelectedEditor:!0})}setSelected(e){for(const t of this.#D)t!==e&&t.unselect();this.#D.clear(),this.#D.add(e),e.select(),this.#q(e.propertiesToUpdate),this.#W({hasSelectedEditor:!0})}isSelected(e){return this.#D.has(e)}unselect(e){e.unselect(),this.#D.delete(e),this.#W({hasSelectedEditor:this.hasSelection})}get hasSelection(){return 0!==this.#D.size}undo(){this.#T.undo(),this.#W({hasSomethingToUndo:this.#T.hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:this.#z()})}redo(){this.#T.redo(),this.#W({hasSomethingToUndo:!0,hasSomethingToRedo:this.#T.hasSomethingToRedo(),isEmpty:this.#z()})}addCommands(e){this.#T.add(e),this.#W({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#z()})}#z(){if(0===this.#P.size)return!0;if(1===this.#P.size)for(const e of this.#P.values())return e.isEmpty();return!1}delete(){if(this.#A&&this.#A.commitOrRemove(),!this.hasSelection)return;const e=[...this.#D];this.addCommands({cmd:()=>{for(const t of e)t.remove()},undo:()=>{for(const t of e)this.#X(t)},mustExec:!0})}copy(){if(this.#A&&this.#A.commitOrRemove(),this.hasSelection){const e=[];for(const t of this.#D)t.isEmpty()||e.push(t);if(0===e.length)return;this.#R.copy(e),this.#W({hasEmptyClipboard:!1})}}cut(){this.copy(),this.delete()}paste(){if(this.#R.isEmpty())return;this.unselectAll();const e=this.#x.get(this.#M),t=this.#R.paste().map((t=>e.deserialize(t)));this.addCommands({cmd:()=>{for(const e of t)this.#X(e);this.#K(t)},undo:()=>{for(const e of t)e.remove()},mustExec:!0})}#K(e){this.#D.clear();for(const t of e)t.isEmpty()||(this.#D.add(t),t.select());this.#W({hasSelectedEditor:!0})}selectAll(){for(const e of this.#D)e.commit();this.#K(this.#P.values())}unselectAll(){if(this.#A)this.#A.commitOrRemove();else if(0!==this.#K.size){for(const e of this.#D)e.unselect();this.#D.clear(),this.#W({hasSelectedEditor:!1})}}isActive(e){return this.#A===e}getActive(){return this.#A}getMode(){return this.#F}}t.AnnotationEditorUIManager=u},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StatTimer=t.RenderingCancelledException=t.PixelsPerInch=t.PageViewport=t.PDFDateString=t.DOMStandardFontDataFactory=t.DOMSVGFactory=t.DOMCanvasFactory=t.DOMCMapReaderFactory=t.AnnotationPrefix=void 0,t.deprecated=function(e){console.log("Deprecated API usage: "+e)},t.getColorValues=function(e){const t=document.createElement("span");t.style.visibility="hidden",document.body.append(t);for(const n of e.keys()){t.style.color=n;const r=window.getComputedStyle(t).color;e.set(n,m(r))}t.remove()},t.getCurrentTransform=function(e){const{a:t,b:n,c:r,d:i,e:s,f:a}=e.getTransform();return[t,n,r,i,s,a]},t.getCurrentTransformInverse=function(e){const{a:t,b:n,c:r,d:i,e:s,f:a}=e.getTransform().invertSelf();return[t,n,r,i,s,a]},t.getFilenameFromUrl=function(e){const t=e.indexOf("#"),n=e.indexOf("?"),r=Math.min(t>0?t:e.length,n>0?n:e.length);return e.substring(e.lastIndexOf("/",r)+1,r)},t.getPdfFilenameFromUrl=function(e,t="document.pdf"){if("string"!=typeof e)return t;if(p(e))return(0,i.warn)('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),t;const n=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,r=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/.exec(e);let s=n.exec(r[1])||n.exec(r[2])||n.exec(r[3]);if(s&&(s=s[0],s.includes("%")))try{s=n.exec(decodeURIComponent(s))[0]}catch(e){}return s||t},t.getRGB=m,t.getXfaPageViewport=function(e,{scale:t=1,rotation:n=0}){const{width:r,height:i}=e.attributes.style,s=[0,0,parseInt(r),parseInt(i)];return new d({viewBox:s,scale:t,rotation:n})},t.isDataScheme=p,t.isPdfFile=function(e){return"string"==typeof e&&/\.pdf$/i.test(e)},t.isValidFetchUrl=f,t.loadScript=function(e,t=!1){return new Promise(((n,r)=>{const i=document.createElement("script");i.src=e,i.onload=function(e){t&&i.remove(),n(e)},i.onerror=function(){r(new Error(`Cannot load script at: ${i.src}`))},(document.head||document.documentElement).append(i)}))};var r=n(9),i=n(1);t.AnnotationPrefix="pdfjs_internal_id_";class s{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=this.CSS/this.PDF}t.PixelsPerInch=s;class a extends r.BaseCanvasFactory{constructor({ownerDocument:e=globalThis.document}={}){super(),this._document=e}_createCanvas(e,t){const n=this._document.createElement("canvas");return n.width=e,n.height=t,n}}async function o(e,t=!1){if(f(e,document.baseURI)){const n=await fetch(e);if(!n.ok)throw new Error(n.statusText);return t?new Uint8Array(await n.arrayBuffer()):(0,i.stringToBytes)(await n.text())}return new Promise(((n,r)=>{const s=new XMLHttpRequest;s.open("GET",e,!0),t&&(s.responseType="arraybuffer"),s.onreadystatechange=()=>{if(s.readyState===XMLHttpRequest.DONE){if(200===s.status||0===s.status){let e;if(t&&s.response?e=new Uint8Array(s.response):!t&&s.responseText&&(e=(0,i.stringToBytes)(s.responseText)),e)return void n(e)}r(new Error(s.statusText))}},s.send(null)}))}t.DOMCanvasFactory=a;class l extends r.BaseCMapReaderFactory{_fetchData(e,t){return o(e,this.isCompressed).then((e=>({cMapData:e,compressionType:t})))}}t.DOMCMapReaderFactory=l;class c extends r.BaseStandardFontDataFactory{_fetchData(e){return o(e,!0)}}t.DOMStandardFontDataFactory=c;class u extends r.BaseSVGFactory{_createSVG(e){return document.createElementNS("http://www.w3.org/2000/svg",e)}}t.DOMSVGFactory=u;class d{constructor({viewBox:e,scale:t,rotation:n,offsetX:r=0,offsetY:i=0,dontFlip:s=!1}){this.viewBox=e,this.scale=t,this.rotation=n,this.offsetX=r,this.offsetY=i;const a=(e[2]+e[0])/2,o=(e[3]+e[1])/2;let l,c,u,d,h,p,f,g;switch((n%=360)<0&&(n+=360),n){case 180:l=-1,c=0,u=0,d=1;break;case 90:l=0,c=1,u=1,d=0;break;case 270:l=0,c=-1,u=-1,d=0;break;case 0:l=1,c=0,u=0,d=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}s&&(u=-u,d=-d),0===l?(h=Math.abs(o-e[1])*t+r,p=Math.abs(a-e[0])*t+i,f=Math.abs(e[3]-e[1])*t,g=Math.abs(e[2]-e[0])*t):(h=Math.abs(a-e[0])*t+r,p=Math.abs(o-e[1])*t+i,f=Math.abs(e[2]-e[0])*t,g=Math.abs(e[3]-e[1])*t),this.transform=[l*t,c*t,u*t,d*t,h-l*t*a-u*t*o,p-c*t*a-d*t*o],this.width=f,this.height=g}clone({scale:e=this.scale,rotation:t=this.rotation,offsetX:n=this.offsetX,offsetY:r=this.offsetY,dontFlip:i=!1}={}){return new d({viewBox:this.viewBox.slice(),scale:e,rotation:t,offsetX:n,offsetY:r,dontFlip:i})}convertToViewportPoint(e,t){return i.Util.applyTransform([e,t],this.transform)}convertToViewportRectangle(e){const t=i.Util.applyTransform([e[0],e[1]],this.transform),n=i.Util.applyTransform([e[2],e[3]],this.transform);return[t[0],t[1],n[0],n[1]]}convertToPdfPoint(e,t){return i.Util.applyInverseTransform([e,t],this.transform)}}t.PageViewport=d;class h extends i.BaseException{constructor(e,t){super(e,"RenderingCancelledException"),this.type=t}}function p(e){const t=e.length;let n=0;for(;n<t&&""===e[n].trim();)n++;return"data:"===e.substring(n,n+5).toLowerCase()}function f(e,t){try{const{protocol:n}=t?new URL(e,t):new URL(e);return"http:"===n||"https:"===n}catch(e){return!1}}let g;function m(e){if(e.startsWith("#")){const t=parseInt(e.slice(1),16);return[(16711680&t)>>16,(65280&t)>>8,255&t]}return e.startsWith("rgb(")?e.slice(4,-1).split(",").map((e=>parseInt(e))):e.startsWith("rgba(")?e.slice(5,-1).split(",").map((e=>parseInt(e))).slice(0,3):((0,i.warn)(`Not a valid color format: "${e}"`),[0,0,0])}t.RenderingCancelledException=h,t.StatTimer=class{constructor(){this.started=Object.create(null),this.times=[]}time(e){e in this.started&&(0,i.warn)(`Timer is already running for ${e}`),this.started[e]=Date.now()}timeEnd(e){e in this.started||(0,i.warn)(`Timer has not been started for ${e}`),this.times.push({name:e,start:this.started[e],end:Date.now()}),delete this.started[e]}toString(){const e=[];let t=0;for(const e of this.times){const n=e.name;n.length>t&&(t=n.length)}for(const n of this.times){const r=n.end-n.start;e.push(`${n.name.padEnd(t)} ${r}ms\n`)}return e.join("")}},t.PDFDateString=class{static toDateObject(e){if(!e||"string"!=typeof e)return null;g||(g=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));const t=g.exec(e);if(!t)return null;const n=parseInt(t[1],10);let r=parseInt(t[2],10);r=r>=1&&r<=12?r-1:0;let i=parseInt(t[3],10);i=i>=1&&i<=31?i:1;let s=parseInt(t[4],10);s=s>=0&&s<=23?s:0;let a=parseInt(t[5],10);a=a>=0&&a<=59?a:0;let o=parseInt(t[6],10);o=o>=0&&o<=59?o:0;const l=t[7]||"Z";let c=parseInt(t[8],10);c=c>=0&&c<=23?c:0;let u=parseInt(t[9],10)||0;return u=u>=0&&u<=59?u:0,"-"===l?(s+=c,a+=u):"+"===l&&(s-=c,a-=u),new Date(Date.UTC(n,r,i,s,a,o))}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.BaseStandardFontDataFactory=t.BaseSVGFactory=t.BaseCanvasFactory=t.BaseCMapReaderFactory=void 0;var r=n(1);class i{constructor(){this.constructor===i&&(0,r.unreachable)("Cannot initialize BaseCanvasFactory.")}create(e,t){if(e<=0||t<=0)throw new Error("Invalid canvas size");const n=this._createCanvas(e,t);return{canvas:n,context:n.getContext("2d")}}reset(e,t,n){if(!e.canvas)throw new Error("Canvas is not specified");if(t<=0||n<=0)throw new Error("Invalid canvas size");e.canvas.width=t,e.canvas.height=n}destroy(e){if(!e.canvas)throw new Error("Canvas is not specified");e.canvas.width=0,e.canvas.height=0,e.canvas=null,e.context=null}_createCanvas(e,t){(0,r.unreachable)("Abstract method `_createCanvas` called.")}}t.BaseCanvasFactory=i;class s{constructor({baseUrl:e=null,isCompressed:t=!1}){this.constructor===s&&(0,r.unreachable)("Cannot initialize BaseCMapReaderFactory."),this.baseUrl=e,this.isCompressed=t}async fetch({name:e}){if(!this.baseUrl)throw new Error('The CMap "baseUrl" parameter must be specified, ensure that the "cMapUrl" and "cMapPacked" API parameters are provided.');if(!e)throw new Error("CMap name must be specified.");const t=this.baseUrl+e+(this.isCompressed?".bcmap":""),n=this.isCompressed?r.CMapCompressionType.BINARY:r.CMapCompressionType.NONE;return this._fetchData(t,n).catch((e=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${t}`)}))}_fetchData(e,t){(0,r.unreachable)("Abstract method `_fetchData` called.")}}t.BaseCMapReaderFactory=s;class a{constructor({baseUrl:e=null}){this.constructor===a&&(0,r.unreachable)("Cannot initialize BaseStandardFontDataFactory."),this.baseUrl=e}async fetch({filename:e}){if(!this.baseUrl)throw new Error('The standard font "baseUrl" parameter must be specified, ensure that the "standardFontDataUrl" API parameter is provided.');if(!e)throw new Error("Font filename must be specified.");const t=`${this.baseUrl}${e}`;return this._fetchData(t).catch((e=>{throw new Error(`Unable to load font data at: ${t}`)}))}_fetchData(e){(0,r.unreachable)("Abstract method `_fetchData` called.")}}t.BaseStandardFontDataFactory=a;class o{constructor(){this.constructor===o&&(0,r.unreachable)("Cannot initialize BaseSVGFactory.")}create(e,t,n=!1){if(e<=0||t<=0)throw new Error("Invalid SVG dimensions");const r=this._createSVG("svg:svg");return r.setAttribute("version","1.1"),n||(r.setAttribute("width",`${e}px`),r.setAttribute("height",`${t}px`)),r.setAttribute("preserveAspectRatio","none"),r.setAttribute("viewBox",`0 0 ${e} ${t}`),r}createElement(e){if("string"!=typeof e)throw new Error("Invalid SVG element type");return this._createSVG(e)}_createSVG(e){(0,r.unreachable)("Abstract method `_createSVG` called.")}}t.BaseSVGFactory=o},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MurmurHash3_64=void 0;var r=n(1);const i=3285377520,s=4294901760,a=65535;t.MurmurHash3_64=class{constructor(e){this.h1=e?4294967295&e:i,this.h2=e?4294967295&e:i}update(e){let t,n;if("string"==typeof e){t=new Uint8Array(2*e.length),n=0;for(let r=0,i=e.length;r<i;r++){const i=e.charCodeAt(r);i<=255?t[n++]=i:(t[n++]=i>>>8,t[n++]=255&i)}}else{if(!(0,r.isArrayBuffer)(e))throw new Error("Wrong data format in MurmurHash3_64_update. Input must be a string or array.");t=e.slice(),n=t.byteLength}const i=n>>2,o=n-4*i,l=new Uint32Array(t.buffer,0,i);let c=0,u=0,d=this.h1,h=this.h2;const p=3432918353,f=461845907,g=11601,m=13715;for(let e=0;e<i;e++)1&e?(c=l[e],c=c*p&s|c*g&a,c=c<<15|c>>>17,c=c*f&s|c*m&a,d^=c,d=d<<13|d>>>19,d=5*d+3864292196):(u=l[e],u=u*p&s|u*g&a,u=u<<15|u>>>17,u=u*f&s|u*m&a,h^=u,h=h<<13|h>>>19,h=5*h+3864292196);switch(c=0,o){case 3:c^=t[4*i+2]<<16;case 2:c^=t[4*i+1]<<8;case 1:c^=t[4*i],c=c*p&s|c*g&a,c=c<<15|c>>>17,c=c*f&s|c*m&a,1&i?d^=c:h^=c}this.h1=d,this.h2=h}hexdigest(){let e=this.h1,t=this.h2;e^=t>>>1,e=3981806797*e&s|36045*e&a,t=4283543511*t&s|(2950163797*(t<<16|e>>>16)&s)>>>16,e^=t>>>1,e=444984403*e&s|60499*e&a,t=3301882366*t&s|(3120437893*(t<<16|e>>>16)&s)>>>16,e^=t>>>1;const n=(e>>>0).toString(16),r=(t>>>0).toString(16);return n.padStart(8,"0")+r.padStart(8,"0")}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FontLoader=t.FontFaceObject=void 0;var r=n(1);class i{constructor({docId:e,onUnsupportedFeature:t,ownerDocument:n=globalThis.document,styleElement:s=null}){this.constructor===i&&(0,r.unreachable)("Cannot initialize BaseFontLoader."),this.docId=e,this._onUnsupportedFeature=t,this._document=n,this.nativeFontFaces=[],this.styleElement=null}addNativeFontFace(e){this.nativeFontFaces.push(e),this._document.fonts.add(e)}insertRule(e){let t=this.styleElement;t||(t=this.styleElement=this._document.createElement("style"),t.id=`PDFJS_FONT_STYLE_TAG_${this.docId}`,this._document.documentElement.getElementsByTagName("head")[0].append(t));const n=t.sheet;n.insertRule(e,n.cssRules.length)}clear(){for(const e of this.nativeFontFaces)this._document.fonts.delete(e);this.nativeFontFaces.length=0,this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async bind(e){if(e.attached||e.missingFile)return;if(e.attached=!0,this.isFontLoadingAPISupported){const t=e.createNativeFontFace();if(t){this.addNativeFontFace(t);try{await t.loaded}catch(n){throw this._onUnsupportedFeature({featureId:r.UNSUPPORTED_FEATURES.errorFontLoadNative}),(0,r.warn)(`Failed to load font '${t.family}': '${n}'.`),e.disableFontFace=!0,n}}return}const t=e.createFontFaceRule();if(t){if(this.insertRule(t),this.isSyncFontLoadingSupported)return;await new Promise((n=>{const r=this._queueLoadingCallback(n);this._prepareFontLoadEvent([t],[e],r)}))}}_queueLoadingCallback(e){(0,r.unreachable)("Abstract method `_queueLoadingCallback`.")}get isFontLoadingAPISupported(){const e=!!this._document?.fonts;return(0,r.shadow)(this,"isFontLoadingAPISupported",e)}get isSyncFontLoadingSupported(){(0,r.unreachable)("Abstract method `isSyncFontLoadingSupported`.")}get _loadTestFont(){(0,r.unreachable)("Abstract method `_loadTestFont`.")}_prepareFontLoadEvent(e,t,n){(0,r.unreachable)("Abstract method `_prepareFontLoadEvent`.")}}let s;t.FontLoader=s,t.FontLoader=s=class extends i{constructor(e){super(e),this.loadingContext={requests:[],nextRequestId:0},this.loadTestFontId=0}get isSyncFontLoadingSupported(){let e=!1;return("undefined"==typeof navigator||/Mozilla\/5.0.*?rv:(\d+).*? Gecko/.exec(navigator.userAgent)?.[1]>=14)&&(e=!0),(0,r.shadow)(this,"isSyncFontLoadingSupported",e)}_queueLoadingCallback(e){const t=this.loadingContext,n={id:"pdfjs-font-loading-"+t.nextRequestId++,done:!1,complete:function(){for((0,r.assert)(!n.done,"completeRequest() cannot be called twice."),n.done=!0;t.requests.length>0&&t.requests[0].done;){const e=t.requests.shift();setTimeout(e.callback,0)}},callback:e};return t.requests.push(n),n}get _loadTestFont(){return(0,r.shadow)(this,"_loadTestFont",atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA=="))}_prepareFontLoadEvent(e,t,n){function i(e,t){return e.charCodeAt(t)<<24|e.charCodeAt(t+1)<<16|e.charCodeAt(t+2)<<8|255&e.charCodeAt(t+3)}function s(e,t,n,r){return e.substring(0,t)+r+e.substring(t+n)}let a,o;const l=this._document.createElement("canvas");l.width=1,l.height=1;const c=l.getContext("2d");let u=0;const d=`lt${Date.now()}${this.loadTestFontId++}`;let h=this._loadTestFont;h=s(h,976,d.length,d);const p=1482184792;let f=i(h,16);for(a=0,o=d.length-3;a<o;a+=4)f=f-p+i(d,a)|0;a<d.length&&(f=f-p+i(d+"XXX",a)|0),h=s(h,16,4,(0,r.string32)(f));const g=`@font-face {font-family:"${d}";src:url(data:font/opentype;base64,${btoa(h)});}`;this.insertRule(g);const m=[];for(const e of t)m.push(e.loadedName);m.push(d);const v=this._document.createElement("div");v.style.visibility="hidden",v.style.width=v.style.height="10px",v.style.position="absolute",v.style.top=v.style.left="0px";for(const e of m){const t=this._document.createElement("span");t.textContent="Hi",t.style.fontFamily=e,v.append(t)}this._document.body.append(v),function e(t,n){if(u++,u>30)return(0,r.warn)("Load test font never loaded."),void n();c.font="30px "+t,c.fillText(".",0,20),c.getImageData(0,0,1,1).data[3]>0?n():setTimeout(e.bind(null,t,n))}(d,(()=>{v.remove(),n.complete()}))}},t.FontFaceObject=class{constructor(e,{isEvalSupported:t=!0,disableFontFace:n=!1,ignoreErrors:r=!1,onUnsupportedFeature:i,fontRegistry:s=null}){this.compiledGlyphs=Object.create(null);for(const t in e)this[t]=e[t];this.isEvalSupported=!1!==t,this.disableFontFace=!0===n,this.ignoreErrors=!0===r,this._onUnsupportedFeature=i,this.fontRegistry=s}createNativeFontFace(){if(!this.data||this.disableFontFace)return null;let e;if(this.cssFontInfo){const t={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(t.style=`oblique ${this.cssFontInfo.italicAngle}deg`),e=new FontFace(this.cssFontInfo.fontFamily,this.data,t)}else e=new FontFace(this.loadedName,this.data,{});return this.fontRegistry&&this.fontRegistry.registerFont(this),e}createFontFaceRule(){if(!this.data||this.disableFontFace)return null;const e=(0,r.bytesToString)(this.data),t=`url(data:${this.mimetype};base64,${btoa(e)});`;let n;if(this.cssFontInfo){let e=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(e+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),n=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${e}src:${t}}`}else n=`@font-face {font-family:"${this.loadedName}";src:${t}}`;return this.fontRegistry&&this.fontRegistry.registerFont(this,t),n}getPathGenerator(e,t){if(void 0!==this.compiledGlyphs[t])return this.compiledGlyphs[t];let n;try{n=e.get(this.loadedName+"_path_"+t)}catch(e){if(!this.ignoreErrors)throw e;return this._onUnsupportedFeature({featureId:r.UNSUPPORTED_FEATURES.errorFontGetPath}),(0,r.warn)(`getPathGenerator - ignoring character: "${e}".`),this.compiledGlyphs[t]=function(e,t){}}if(this.isEvalSupported&&r.FeatureTest.isEvalSupported){const e=[];for(const t of n){const n=void 0!==t.args?t.args.join(","):"";e.push("c.",t.cmd,"(",n,");\n")}return this.compiledGlyphs[t]=new Function("c","size",e.join(""))}return this.compiledGlyphs[t]=function(e,t){for(const r of n)"scale"===r.cmd&&(r.args=[t,-t]),e[r.cmd].apply(e,r.args)}}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CanvasGraphics=void 0;var r=n(8),i=n(1),s=n(13),a=n(14),o=n(3);const l=4096,c=o.isNodeJS&&"undefined"==typeof Path2D?-1:1e3,u=16;class d{constructor(e){this.canvasFactory=e,this.cache=Object.create(null)}getCanvas(e,t,n){let r;return void 0!==this.cache[e]?(r=this.cache[e],this.canvasFactory.reset(r,t,n)):(r=this.canvasFactory.create(t,n),this.cache[e]=r),r}delete(e){delete this.cache[e]}clear(){for(const e in this.cache){const t=this.cache[e];this.canvasFactory.destroy(t),delete this.cache[e]}}}function h(e,t,n,i,s,a,o,l,c,u){const[d,h,p,f,g,m]=(0,r.getCurrentTransform)(e);if(0===h&&0===p){const r=o*d+g,v=Math.round(r),y=l*f+m,b=Math.round(y),_=(o+c)*d+g,w=Math.abs(Math.round(_)-v)||1,E=(l+u)*f+m,S=Math.abs(Math.round(E)-b)||1;return e.setTransform(Math.sign(d),0,0,Math.sign(f),v,b),e.drawImage(t,n,i,s,a,0,0,w,S),e.setTransform(d,h,p,f,g,m),[w,S]}if(0===d&&0===f){const r=l*p+g,v=Math.round(r),y=o*h+m,b=Math.round(y),_=(l+u)*p+g,w=Math.abs(Math.round(_)-v)||1,E=(o+c)*h+m,S=Math.abs(Math.round(E)-b)||1;return e.setTransform(0,Math.sign(h),Math.sign(p),0,v,b),e.drawImage(t,n,i,s,a,0,0,S,w),e.setTransform(d,h,p,f,g,m),[S,w]}return e.drawImage(t,n,i,s,a,o,l,c,u),[Math.hypot(d,h)*c,Math.hypot(p,f)*u]}class p{constructor(e,t){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=i.IDENTITY_MATRIX,this.textMatrixScale=1,this.fontMatrix=i.FONT_IDENTITY_MATRIX,this.leading=0,this.x=0,this.y=0,this.lineX=0,this.lineY=0,this.charSpacing=0,this.wordSpacing=0,this.textHScale=1,this.textRenderingMode=i.TextRenderingMode.FILL,this.textRise=0,this.fillColor="#000000",this.strokeColor="#000000",this.patternFill=!1,this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.activeSMask=null,this.transferMaps=null,this.startNewPathAndClipBox([0,0,e,t])}clone(){const e=Object.create(this);return e.clipBox=this.clipBox.slice(),e}setCurrentPoint(e,t){this.x=e,this.y=t}updatePathMinMax(e,t,n){[t,n]=i.Util.applyTransform([t,n],e),this.minX=Math.min(this.minX,t),this.minY=Math.min(this.minY,n),this.maxX=Math.max(this.maxX,t),this.maxY=Math.max(this.maxY,n)}updateRectMinMax(e,t){const n=i.Util.applyTransform(t,e),r=i.Util.applyTransform(t.slice(2),e);this.minX=Math.min(this.minX,n[0],r[0]),this.minY=Math.min(this.minY,n[1],r[1]),this.maxX=Math.max(this.maxX,n[0],r[0]),this.maxY=Math.max(this.maxY,n[1],r[1])}updateScalingPathMinMax(e,t){i.Util.scaleMinMax(e,t),this.minX=Math.min(this.minX,t[0]),this.maxX=Math.max(this.maxX,t[1]),this.minY=Math.min(this.minY,t[2]),this.maxY=Math.max(this.maxY,t[3])}updateCurvePathMinMax(e,t,n,r,s,a,o,l,c,u){const d=i.Util.bezierBoundingBox(t,n,r,s,a,o,l,c);if(u)return u[0]=Math.min(u[0],d[0],d[2]),u[1]=Math.max(u[1],d[0],d[2]),u[2]=Math.min(u[2],d[1],d[3]),void(u[3]=Math.max(u[3],d[1],d[3]));this.updateRectMinMax(e,d)}getPathBoundingBox(e=s.PathType.FILL,t=null){const n=[this.minX,this.minY,this.maxX,this.maxY];if(e===s.PathType.STROKE){t||(0,i.unreachable)("Stroke bounding box must include transform.");const e=i.Util.singularValueDecompose2dScale(t),r=e[0]*this.lineWidth/2,s=e[1]*this.lineWidth/2;n[0]-=r,n[1]-=s,n[2]+=r,n[3]+=s}return n}updateClipFromPath(){const e=i.Util.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(e||[0,0,0,0])}isEmptyClip(){return this.minX===1/0}startNewPathAndClipBox(e){this.clipBox=e,this.minX=1/0,this.minY=1/0,this.maxX=0,this.maxY=0}getClippedPathBoundingBox(e=s.PathType.FILL,t=null){return i.Util.intersect(this.clipBox,this.getPathBoundingBox(e,t))}}function f(e,t,n=null){if("undefined"!=typeof ImageData&&t instanceof ImageData)return void e.putImageData(t,0,0);const r=t.height,s=t.width,a=r%u,o=(r-a)/u,l=0===a?o:o+1,c=e.createImageData(s,u);let d,h=0;const p=t.data,f=c.data;let g,m,v,y,b,_,w,E;if(n)switch(n.length){case 1:b=n[0],_=n[0],w=n[0],E=n[0];break;case 4:b=n[0],_=n[1],w=n[2],E=n[3]}if(t.kind===i.ImageKind.GRAYSCALE_1BPP){const t=p.byteLength,n=new Uint32Array(f.buffer,0,f.byteLength>>2),r=n.length,y=s+7>>3;let b=4294967295,_=i.FeatureTest.isLittleEndian?4278190080:255;for(E&&255===E[0]&&0===E[255]&&([b,_]=[_,b]),g=0;g<l;g++){for(v=g<o?u:a,d=0,m=0;m<v;m++){const e=t-h;let r=0;const i=e>y?s:8*e-7,a=-8&i;let o=0,l=0;for(;r<a;r+=8)l=p[h++],n[d++]=128&l?b:_,n[d++]=64&l?b:_,n[d++]=32&l?b:_,n[d++]=16&l?b:_,n[d++]=8&l?b:_,n[d++]=4&l?b:_,n[d++]=2&l?b:_,n[d++]=1&l?b:_;for(;r<i;r++)0===o&&(l=p[h++],o=128),n[d++]=l&o?b:_,o>>=1}for(;d<r;)n[d++]=0;e.putImageData(c,0,g*u)}}else if(t.kind===i.ImageKind.RGBA_32BPP){const t=!!(b||_||w);for(m=0,y=s*u*4,g=0;g<o;g++){if(f.set(p.subarray(h,h+y)),h+=y,t)for(let e=0;e<y;e+=4)b&&(f[e+0]=b[f[e+0]]),_&&(f[e+1]=_[f[e+1]]),w&&(f[e+2]=w[f[e+2]]);e.putImageData(c,0,m),m+=u}if(g<l){if(y=s*a*4,f.set(p.subarray(h,h+y)),t)for(let e=0;e<y;e+=4)b&&(f[e+0]=b[f[e+0]]),_&&(f[e+1]=_[f[e+1]]),w&&(f[e+2]=w[f[e+2]]);e.putImageData(c,0,m)}}else{if(t.kind!==i.ImageKind.RGB_24BPP)throw new Error(`bad image kind: ${t.kind}`);{const t=!!(b||_||w);for(v=u,y=s*v,g=0;g<l;g++){for(g>=o&&(v=a,y=s*v),d=0,m=y;m--;)f[d++]=p[h++],f[d++]=p[h++],f[d++]=p[h++],f[d++]=255;if(t)for(let e=0;e<d;e+=4)b&&(f[e+0]=b[f[e+0]]),_&&(f[e+1]=_[f[e+1]]),w&&(f[e+2]=w[f[e+2]]);e.putImageData(c,0,g*u)}}}}function g(e,t){if(t.bitmap)return void e.drawImage(t.bitmap,0,0);const n=t.height,r=t.width,i=n%u,s=(n-i)/u,o=0===i?s:s+1,l=e.createImageData(r,u);let c=0;const d=t.data,h=l.data;for(let t=0;t<o;t++){const n=t<s?u:i;({srcPos:c}=(0,a.applyMaskImageData)({src:d,srcPos:c,dest:h,width:r,height:n})),e.putImageData(l,0,t*u)}}function m(e,t){const n=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font"];for(let r=0,i=n.length;r<i;r++){const i=n[r];void 0!==e[i]&&(t[i]=e[i])}void 0!==e.setLineDash&&(t.setLineDash(e.getLineDash()),t.lineDashOffset=e.lineDashOffset)}function v(e,t){e.strokeStyle=e.fillStyle=t||"#000000",e.fillRule="nonzero",e.globalAlpha=1,e.lineWidth=1,e.lineCap="butt",e.lineJoin="miter",e.miterLimit=10,e.globalCompositeOperation="source-over",e.font="10px sans-serif",void 0!==e.setLineDash&&(e.setLineDash([]),e.lineDashOffset=0)}function y(e,t,n,r){const i=e.length;for(let s=3;s<i;s+=4){const i=e[s];if(0===i)e[s-3]=t,e[s-2]=n,e[s-1]=r;else if(i<255){const a=255-i;e[s-3]=e[s-3]*i+t*a>>8,e[s-2]=e[s-2]*i+n*a>>8,e[s-1]=e[s-1]*i+r*a>>8}}}function b(e,t,n){const r=e.length;for(let i=3;i<r;i+=4){const r=n?n[e[i]]:e[i];t[i]=t[i]*r*.00392156862745098|0}}function _(e,t,n){const r=e.length;for(let i=3;i<r;i+=4){const r=77*e[i-3]+152*e[i-2]+28*e[i-1];t[i]=n?t[i]*n[r>>8]>>8:t[i]*r>>16}}function w(e,t,n,r){const i=r[0],s=r[1],a=r[2]-i,o=r[3]-s;0!==a&&0!==o&&(function(e,t,n,r,i,s,a,o,l,c,u){const d=!!s,h=d?s[0]:0,p=d?s[1]:0,f=d?s[2]:0;let g;g="Luminosity"===i?_:b;const m=Math.min(r,Math.ceil(1048576/n));for(let i=0;i<r;i+=m){const s=Math.min(m,r-i),v=e.getImageData(o-c,i+(l-u),n,s),b=t.getImageData(o,i+l,n,s);d&&y(v.data,h,p,f),g(v.data,b.data,a),t.putImageData(b,o,i+l)}}(t.context,n,a,o,t.subtype,t.backdrop,t.transferMap,i,s,t.offsetX,t.offsetY),e.save(),e.globalAlpha=1,e.globalCompositeOperation="source-over",e.setTransform(1,0,0,1,0,0),e.drawImage(n.canvas,0,0),e.restore())}function E(e,t){const n=i.Util.singularValueDecompose2dScale(e);n[0]=Math.fround(n[0]),n[1]=Math.fround(n[1]);const s=Math.fround((globalThis.devicePixelRatio||1)*r.PixelsPerInch.PDF_TO_CSS_UNITS);return void 0!==t?t:n[0]<=s||n[1]<=s}const S=["butt","round","square"],C=["miter","round","bevel"],A={},P={};class x{constructor(e,t,n,r,i,s,a,o){this.ctx=e,this.current=new p(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=t,this.objs=n,this.canvasFactory=r,this.imageLayer=i,this.groupStack=[],this.processingType3=null,this.baseTransform=null,this.baseTransformStack=[],this.groupLevel=0,this.smaskStack=[],this.smaskCounter=0,this.tempSMask=null,this.suspendedCtx=null,this.contentVisible=!0,this.markedContentStack=[],this.optionalContentConfig=s,this.cachedCanvases=new d(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=a,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.backgroundColor=o?.background||null,this.foregroundColor=o?.foreground||null,this._cachedScaleForStroking=null,this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(e,t=null){return"string"==typeof e?e.startsWith("g_")?this.commonObjs.get(e):this.objs.get(e):t}beginDrawing({transform:e,viewport:t,transparency:n=!1,background:i=null}){const s=this.ctx.canvas.width,a=this.ctx.canvas.height,o=i||"#ffffff";if(this.ctx.save(),this.foregroundColor&&this.backgroundColor){this.ctx.fillStyle=this.foregroundColor;const e=this.foregroundColor=this.ctx.fillStyle;this.ctx.fillStyle=this.backgroundColor;const t=this.backgroundColor=this.ctx.fillStyle;let n=!0,i=o;if(this.ctx.fillStyle=o,i=this.ctx.fillStyle,n="string"==typeof i&&/^#[0-9A-Fa-f]{6}$/.test(i),"#000000"===e&&"#ffffff"===t||e===t||!n)this.foregroundColor=this.backgroundColor=null;else{const[n,s,a]=(0,r.getRGB)(i),o=e=>(e/=255)<=.03928?e/12.92:((e+.055)/1.055)**2.4,l=Math.round(.2126*o(n)+.7152*o(s)+.0722*o(a));this.selectColor=(n,r,i)=>{const s=.2126*o(n)+.7152*o(r)+.0722*o(i);return Math.round(s)===l?t:e}}}if(this.ctx.fillStyle=this.backgroundColor||o,this.ctx.fillRect(0,0,s,a),this.ctx.restore(),n){const e=this.cachedCanvases.getCanvas("transparent",s,a);this.compositeCtx=this.ctx,this.transparentCanvas=e.canvas,this.ctx=e.context,this.ctx.save(),this.ctx.transform(...(0,r.getCurrentTransform)(this.compositeCtx))}this.ctx.save(),v(this.ctx,this.foregroundColor),e&&(this.ctx.transform(...e),this.outputScaleX=e[0],this.outputScaleY=e[0]),this.ctx.transform(...t.transform),this.viewportScale=t.scale,this.baseTransform=(0,r.getCurrentTransform)(this.ctx),this.imageLayer&&((0,r.deprecated)("The `imageLayer` functionality will be removed in the future."),this.imageLayer.beginLayout())}executeOperatorList(e,t,n,r){const s=e.argsArray,a=e.fnArray;let o=t||0;const l=s.length;if(l===o)return o;const c=l-o>10&&"function"==typeof n,u=c?Date.now()+15:0;let d=0;const h=this.commonObjs,p=this.objs;let f;for(;;){if(void 0!==r&&o===r.nextBreakPoint)return r.breakIt(o,n),o;if(f=a[o],f!==i.OPS.dependency)this[f].apply(this,s[o]);else for(const e of s[o]){const t=e.startsWith("g_")?h:p;if(!t.has(e))return t.get(e,n),o}if(o++,o===l)return o;if(c&&++d>10){if(Date.now()>u)return n(),o;d=0}}}#Y(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();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.transparentCanvas=null)}endDrawing(){this.#Y(),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const e of this._cachedBitmapsMap.values()){for(const t of e.values())"undefined"!=typeof HTMLCanvasElement&&t instanceof HTMLCanvasElement&&(t.width=t.height=0);e.clear()}this._cachedBitmapsMap.clear(),this.imageLayer&&this.imageLayer.endLayout()}_scaleImage(e,t){const n=e.width,r=e.height;let i,s,a=Math.max(Math.hypot(t[0],t[1]),1),o=Math.max(Math.hypot(t[2],t[3]),1),l=n,c=r,u="prescale1";for(;a>2&&l>1||o>2&&c>1;){let t=l,n=c;a>2&&l>1&&(t=Math.ceil(l/2),a/=l/t),o>2&&c>1&&(n=Math.ceil(c/2),o/=c/n),i=this.cachedCanvases.getCanvas(u,t,n),s=i.context,s.clearRect(0,0,t,n),s.drawImage(e,0,0,l,c,0,0,t,n),e=i.canvas,l=t,c=n,u="prescale1"===u?"prescale2":"prescale1"}return{img:e,paintWidth:l,paintHeight:c}}_createMaskCanvas(e){const t=this.ctx,{width:n,height:a}=e,o=this.current.fillColor,l=this.current.patternFill,c=(0,r.getCurrentTransform)(t);let u,d,p,f;if((e.bitmap||e.data)&&e.count>1){const t=e.bitmap||e.data.buffer,n=c.slice(0,4);d=JSON.stringify(l?n:[n,o]),u=this._cachedBitmapsMap.get(t),u||(u=new Map,this._cachedBitmapsMap.set(t,u));const r=u.get(d);if(r&&!l)return{canvas:r,offsetX:Math.round(Math.min(c[0],c[2])+c[4]),offsetY:Math.round(Math.min(c[1],c[3])+c[5])};p=r}p||(f=this.cachedCanvases.getCanvas("maskCanvas",n,a),g(f.context,e));let m=i.Util.transform(c,[1/n,0,0,-1/a,0,0]);m=i.Util.transform(m,[1,0,0,1,0,-a]);const v=i.Util.applyTransform([0,0],m),y=i.Util.applyTransform([n,a],m),b=i.Util.normalizeRect([v[0],v[1],y[0],y[1]]),_=Math.round(b[2]-b[0])||1,w=Math.round(b[3]-b[1])||1,S=this.cachedCanvases.getCanvas("fillCanvas",_,w),C=S.context,A=Math.min(v[0],y[0]),P=Math.min(v[1],y[1]);C.translate(-A,-P),C.transform(...m),p||(p=this._scaleImage(f.canvas,(0,r.getCurrentTransformInverse)(C)),p=p.img,u&&l&&u.set(d,p)),C.imageSmoothingEnabled=E((0,r.getCurrentTransform)(C),e.interpolate),h(C,p,0,0,p.width,p.height,0,0,n,a),C.globalCompositeOperation="source-in";const x=i.Util.transform((0,r.getCurrentTransformInverse)(C),[1,0,0,1,-A,-P]);return C.fillStyle=l?o.getPattern(t,this,x,s.PathType.FILL):o,C.fillRect(0,0,n,a),u&&!l&&(this.cachedCanvases.delete("fillCanvas"),u.set(d,S.canvas)),{canvas:S.canvas,offsetX:Math.round(A),offsetY:Math.round(P)}}setLineWidth(e){e!==this.current.lineWidth&&(this._cachedScaleForStroking=null),this.current.lineWidth=e,this.ctx.lineWidth=e}setLineCap(e){this.ctx.lineCap=S[e]}setLineJoin(e){this.ctx.lineJoin=C[e]}setMiterLimit(e){this.ctx.miterLimit=e}setDash(e,t){const n=this.ctx;void 0!==n.setLineDash&&(n.setLineDash(e),n.lineDashOffset=t)}setRenderingIntent(e){}setFlatness(e){}setGState(e){for(let t=0,n=e.length;t<n;t++){const n=e[t],r=n[0],i=n[1];switch(r){case"LW":this.setLineWidth(i);break;case"LC":this.setLineCap(i);break;case"LJ":this.setLineJoin(i);break;case"ML":this.setMiterLimit(i);break;case"D":this.setDash(i[0],i[1]);break;case"RI":this.setRenderingIntent(i);break;case"FL":this.setFlatness(i);break;case"Font":this.setFont(i[0],i[1]);break;case"CA":this.current.strokeAlpha=n[1];break;case"ca":this.current.fillAlpha=n[1],this.ctx.globalAlpha=n[1];break;case"BM":this.ctx.globalCompositeOperation=i;break;case"SMask":this.current.activeSMask=i?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.current.transferMaps=i}}}get inSMaskMode(){return!!this.suspendedCtx}checkSMaskState(){const e=this.inSMaskMode;this.current.activeSMask&&!e?this.beginSMaskMode():!this.current.activeSMask&&e&&this.endSMaskMode()}beginSMaskMode(){if(this.inSMaskMode)throw new Error("beginSMaskMode called while already in smask mode");const e=this.ctx.canvas.width,t=this.ctx.canvas.height,n="smaskGroupAt"+this.groupLevel,i=this.cachedCanvases.getCanvas(n,e,t);this.suspendedCtx=this.ctx,this.ctx=i.context;const s=this.ctx;s.setTransform(...(0,r.getCurrentTransform)(this.suspendedCtx)),m(this.suspendedCtx,s),function(e,t){if(e._removeMirroring)throw new Error("Context is already forwarding operations.");e.__originalSave=e.save,e.__originalRestore=e.restore,e.__originalRotate=e.rotate,e.__originalScale=e.scale,e.__originalTranslate=e.translate,e.__originalTransform=e.transform,e.__originalSetTransform=e.setTransform,e.__originalResetTransform=e.resetTransform,e.__originalClip=e.clip,e.__originalMoveTo=e.moveTo,e.__originalLineTo=e.lineTo,e.__originalBezierCurveTo=e.bezierCurveTo,e.__originalRect=e.rect,e.__originalClosePath=e.closePath,e.__originalBeginPath=e.beginPath,e._removeMirroring=()=>{e.save=e.__originalSave,e.restore=e.__originalRestore,e.rotate=e.__originalRotate,e.scale=e.__originalScale,e.translate=e.__originalTranslate,e.transform=e.__originalTransform,e.setTransform=e.__originalSetTransform,e.resetTransform=e.__originalResetTransform,e.clip=e.__originalClip,e.moveTo=e.__originalMoveTo,e.lineTo=e.__originalLineTo,e.bezierCurveTo=e.__originalBezierCurveTo,e.rect=e.__originalRect,e.closePath=e.__originalClosePath,e.beginPath=e.__originalBeginPath,delete e._removeMirroring},e.save=function(){t.save(),this.__originalSave()},e.restore=function(){t.restore(),this.__originalRestore()},e.translate=function(e,n){t.translate(e,n),this.__originalTranslate(e,n)},e.scale=function(e,n){t.scale(e,n),this.__originalScale(e,n)},e.transform=function(e,n,r,i,s,a){t.transform(e,n,r,i,s,a),this.__originalTransform(e,n,r,i,s,a)},e.setTransform=function(e,n,r,i,s,a){t.setTransform(e,n,r,i,s,a),this.__originalSetTransform(e,n,r,i,s,a)},e.resetTransform=function(){t.resetTransform(),this.__originalResetTransform()},e.rotate=function(e){t.rotate(e),this.__originalRotate(e)},e.clip=function(e){t.clip(e),this.__originalClip(e)},e.moveTo=function(e,n){t.moveTo(e,n),this.__originalMoveTo(e,n)},e.lineTo=function(e,n){t.lineTo(e,n),this.__originalLineTo(e,n)},e.bezierCurveTo=function(e,n,r,i,s,a){t.bezierCurveTo(e,n,r,i,s,a),this.__originalBezierCurveTo(e,n,r,i,s,a)},e.rect=function(e,n,r,i){t.rect(e,n,r,i),this.__originalRect(e,n,r,i)},e.closePath=function(){t.closePath(),this.__originalClosePath()},e.beginPath=function(){t.beginPath(),this.__originalBeginPath()}}(s,this.suspendedCtx),this.setGState([["BM","source-over"],["ca",1],["CA",1]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),m(this.ctx,this.suspendedCtx),this.ctx=this.suspendedCtx,this.suspendedCtx=null}compose(e){if(!this.current.activeSMask)return;e?(e[0]=Math.floor(e[0]),e[1]=Math.floor(e[1]),e[2]=Math.ceil(e[2]),e[3]=Math.ceil(e[3])):e=[0,0,this.ctx.canvas.width,this.ctx.canvas.height];const t=this.current.activeSMask;w(this.suspendedCtx,t,this.ctx,e),this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.ctx.canvas.width,this.ctx.canvas.height),this.ctx.restore()}save(){this.inSMaskMode?(m(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();const e=this.current;this.stateStack.push(e),this.current=e.clone()}restore(){0===this.stateStack.length&&this.inSMaskMode&&this.endSMaskMode(),0!==this.stateStack.length&&(this.current=this.stateStack.pop(),this.inSMaskMode?(this.suspendedCtx.restore(),m(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking=null,this._cachedGetSinglePixelWidth=null)}transform(e,t,n,r,i,s){this.ctx.transform(e,t,n,r,i,s),this._cachedScaleForStroking=null,this._cachedGetSinglePixelWidth=null}constructPath(e,t,n){const s=this.ctx,a=this.current;let o,l,c=a.x,u=a.y;const d=(0,r.getCurrentTransform)(s),h=0===d[0]&&0===d[3]||0===d[1]&&0===d[2],p=h?n.slice(0):null;for(let n=0,r=0,f=e.length;n<f;n++)switch(0|e[n]){case i.OPS.rectangle:c=t[r++],u=t[r++];const e=t[r++],n=t[r++],f=c+e,g=u+n;s.moveTo(c,u),0===e||0===n?s.lineTo(f,g):(s.lineTo(f,u),s.lineTo(f,g),s.lineTo(c,g)),h||a.updateRectMinMax(d,[c,u,f,g]),s.closePath();break;case i.OPS.moveTo:c=t[r++],u=t[r++],s.moveTo(c,u),h||a.updatePathMinMax(d,c,u);break;case i.OPS.lineTo:c=t[r++],u=t[r++],s.lineTo(c,u),h||a.updatePathMinMax(d,c,u);break;case i.OPS.curveTo:o=c,l=u,c=t[r+4],u=t[r+5],s.bezierCurveTo(t[r],t[r+1],t[r+2],t[r+3],c,u),a.updateCurvePathMinMax(d,o,l,t[r],t[r+1],t[r+2],t[r+3],c,u,p),r+=6;break;case i.OPS.curveTo2:o=c,l=u,s.bezierCurveTo(c,u,t[r],t[r+1],t[r+2],t[r+3]),a.updateCurvePathMinMax(d,o,l,c,u,t[r],t[r+1],t[r+2],t[r+3],p),c=t[r+2],u=t[r+3],r+=4;break;case i.OPS.curveTo3:o=c,l=u,c=t[r+2],u=t[r+3],s.bezierCurveTo(t[r],t[r+1],c,u,c,u),a.updateCurvePathMinMax(d,o,l,t[r],t[r+1],c,u,c,u,p),r+=4;break;case i.OPS.closePath:s.closePath()}h&&a.updateScalingPathMinMax(d,p),a.setCurrentPoint(c,u)}closePath(){this.ctx.closePath()}stroke(e){e=void 0===e||e;const t=this.ctx,n=this.current.strokeColor;t.globalAlpha=this.current.strokeAlpha,this.contentVisible&&("object"==typeof n&&n?.getPattern?(t.save(),t.strokeStyle=n.getPattern(t,this,(0,r.getCurrentTransformInverse)(t),s.PathType.STROKE),this.rescaleAndStroke(!1),t.restore()):this.rescaleAndStroke(!0)),e&&this.consumePath(this.current.getClippedPathBoundingBox()),t.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(e){e=void 0===e||e;const t=this.ctx,n=this.current.fillColor;let i=!1;this.current.patternFill&&(t.save(),t.fillStyle=n.getPattern(t,this,(0,r.getCurrentTransformInverse)(t),s.PathType.FILL),i=!0);const a=this.current.getClippedPathBoundingBox();this.contentVisible&&null!==a&&(this.pendingEOFill?(t.fill("evenodd"),this.pendingEOFill=!1):t.fill()),i&&t.restore(),e&&this.consumePath(a)}eoFill(){this.pendingEOFill=!0,this.fill()}fillStroke(){this.fill(!1),this.stroke(!1),this.consumePath()}eoFillStroke(){this.pendingEOFill=!0,this.fillStroke()}closeFillStroke(){this.closePath(),this.fillStroke()}closeEOFillStroke(){this.pendingEOFill=!0,this.closePath(),this.fillStroke()}endPath(){this.consumePath()}clip(){this.pendingClip=A}eoClip(){this.pendingClip=P}beginText(){this.current.textMatrix=i.IDENTITY_MATRIX,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){const e=this.pendingTextPaths,t=this.ctx;if(void 0!==e){t.save(),t.beginPath();for(const n of e)t.setTransform(...n.transform),t.translate(n.x,n.y),n.addToPath(t,n.fontSize);t.restore(),t.clip(),t.beginPath(),delete this.pendingTextPaths}else t.beginPath()}setCharSpacing(e){this.current.charSpacing=e}setWordSpacing(e){this.current.wordSpacing=e}setHScale(e){this.current.textHScale=e/100}setLeading(e){this.current.leading=-e}setFont(e,t){const n=this.commonObjs.get(e),r=this.current;if(!n)throw new Error(`Can't find font for ${e}`);if(r.fontMatrix=n.fontMatrix||i.FONT_IDENTITY_MATRIX,0!==r.fontMatrix[0]&&0!==r.fontMatrix[3]||(0,i.warn)("Invalid font matrix for font "+e),t<0?(t=-t,r.fontDirection=-1):r.fontDirection=1,this.current.font=n,this.current.fontSize=t,n.isType3Font)return;const s=n.loadedName||"sans-serif";let a="normal";n.black?a="900":n.bold&&(a="bold");const o=n.italic?"italic":"normal",l=`"${s}", ${n.fallbackName}`;let c=t;t<16?c=16:t>100&&(c=100),this.current.fontSizeScale=t/c,this.ctx.font=`${o} ${a} ${c}px ${l}`}setTextRenderingMode(e){this.current.textRenderingMode=e}setTextRise(e){this.current.textRise=e}moveText(e,t){this.current.x=this.current.lineX+=e,this.current.y=this.current.lineY+=t}setLeadingMoveText(e,t){this.setLeading(-t),this.moveText(e,t)}setTextMatrix(e,t,n,r,i,s){this.current.textMatrix=[e,t,n,r,i,s],this.current.textMatrixScale=Math.hypot(e,t),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(e,t,n,s){const a=this.ctx,o=this.current,l=o.font,c=o.textRenderingMode,u=o.fontSize/o.fontSizeScale,d=c&i.TextRenderingMode.FILL_STROKE_MASK,h=!!(c&i.TextRenderingMode.ADD_TO_PATH_FLAG),p=o.patternFill&&!l.missingFile;let f;(l.disableFontFace||h||p)&&(f=l.getPathGenerator(this.commonObjs,e)),l.disableFontFace||p?(a.save(),a.translate(t,n),a.beginPath(),f(a,u),s&&a.setTransform(...s),d!==i.TextRenderingMode.FILL&&d!==i.TextRenderingMode.FILL_STROKE||a.fill(),d!==i.TextRenderingMode.STROKE&&d!==i.TextRenderingMode.FILL_STROKE||a.stroke(),a.restore()):(d!==i.TextRenderingMode.FILL&&d!==i.TextRenderingMode.FILL_STROKE||a.fillText(e,t,n),d!==i.TextRenderingMode.STROKE&&d!==i.TextRenderingMode.FILL_STROKE||a.strokeText(e,t,n)),h&&(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:(0,r.getCurrentTransform)(a),x:t,y:n,fontSize:u,addToPath:f})}get isFontSubpixelAAEnabled(){const{context:e}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);e.scale(1.5,1),e.fillText("I",0,10);const t=e.getImageData(0,0,10,10).data;let n=!1;for(let e=3;e<t.length;e+=4)if(t[e]>0&&t[e]<255){n=!0;break}return(0,i.shadow)(this,"isFontSubpixelAAEnabled",n)}showText(e){const t=this.current,n=t.font;if(n.isType3Font)return this.showType3Text(e);const a=t.fontSize;if(0===a)return;const o=this.ctx,l=t.fontSizeScale,c=t.charSpacing,u=t.wordSpacing,d=t.fontDirection,h=t.textHScale*d,p=e.length,f=n.vertical,g=f?1:-1,m=n.defaultVMetrics,v=a*t.fontMatrix[0],y=t.textRenderingMode===i.TextRenderingMode.FILL&&!n.disableFontFace&&!t.patternFill;let b;if(o.save(),o.transform(...t.textMatrix),o.translate(t.x,t.y+t.textRise),d>0?o.scale(h,-1):o.scale(h,1),t.patternFill){o.save();const e=t.fillColor.getPattern(o,this,(0,r.getCurrentTransformInverse)(o),s.PathType.FILL);b=(0,r.getCurrentTransform)(o),o.restore(),o.fillStyle=e}let _=t.lineWidth;const w=t.textMatrixScale;if(0===w||0===_){const e=t.textRenderingMode&i.TextRenderingMode.FILL_STROKE_MASK;e!==i.TextRenderingMode.STROKE&&e!==i.TextRenderingMode.FILL_STROKE||(_=this.getSinglePixelWidth())}else _/=w;1!==l&&(o.scale(l,l),_/=l),o.lineWidth=_;let E,S=0;for(E=0;E<p;++E){const t=e[E];if("number"==typeof t){S+=g*t*a/1e3;continue}let r=!1;const i=(t.isSpace?u:0)+c,s=t.fontChar,h=t.accent;let p,_,w,C=t.width;if(f){const e=t.vmetric||m,n=-(t.vmetric?e[1]:.5*C)*v,r=e[2]*v;C=e?-e[0]:C,p=n/l,_=(S+r)/l}else p=S/l,_=0;if(n.remeasure&&C>0){const e=1e3*o.measureText(s).width/a*l;if(C<e&&this.isFontSubpixelAAEnabled){const t=C/e;r=!0,o.save(),o.scale(t,1),p/=t}else C!==e&&(p+=(C-e)/2e3*a/l)}if(this.contentVisible&&(t.isInFont||n.missingFile))if(y&&!h)o.fillText(s,p,_);else if(this.paintChar(s,p,_,b),h){const e=p+a*h.offset.x/l,t=_-a*h.offset.y/l;this.paintChar(h.fontChar,e,t,b)}w=f?C*v-i*d:C*v+i*d,S+=w,r&&o.restore()}f?t.y-=S:t.x+=S*h,o.restore(),this.compose()}showType3Text(e){const t=this.ctx,n=this.current,r=n.font,s=n.fontSize,a=n.fontDirection,o=r.vertical?1:-1,l=n.charSpacing,c=n.wordSpacing,u=n.textHScale*a,d=n.fontMatrix||i.FONT_IDENTITY_MATRIX,h=e.length;let p,f,g,m;if(n.textRenderingMode!==i.TextRenderingMode.INVISIBLE&&0!==s){for(this._cachedScaleForStroking=null,this._cachedGetSinglePixelWidth=null,t.save(),t.transform(...n.textMatrix),t.translate(n.x,n.y),t.scale(u,a),p=0;p<h;++p){if(f=e[p],"number"==typeof f){m=o*f*s/1e3,this.ctx.translate(m,0),n.x+=m*u;continue}const a=(f.isSpace?c:0)+l,h=r.charProcOperatorList[f.operatorListId];h?(this.contentVisible&&(this.processingType3=f,this.save(),t.scale(s,s),t.transform(...d),this.executeOperatorList(h),this.restore()),g=i.Util.applyTransform([f.width,0],d)[0]*s+a,t.translate(g,0),n.x+=g*u):(0,i.warn)(`Type3 character "${f.operatorListId}" is not available.`)}t.restore(),this.processingType3=null}}setCharWidth(e,t){}setCharWidthAndBounds(e,t,n,r,i,s){this.ctx.rect(n,r,i-n,s-r),this.ctx.clip(),this.endPath()}getColorN_Pattern(e){let t;if("TilingPattern"===e[0]){const n=e[1],i=this.baseTransform||(0,r.getCurrentTransform)(this.ctx),a={createCanvasGraphics:e=>new x(e,this.commonObjs,this.objs,this.canvasFactory)};t=new s.TilingPattern(e,n,this.ctx,a,i)}else t=this._getPattern(e[1],e[2]);return t}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(e,t,n){const r=this.selectColor?.(e,t,n)||i.Util.makeHexColor(e,t,n);this.ctx.strokeStyle=r,this.current.strokeColor=r}setFillRGBColor(e,t,n){const r=this.selectColor?.(e,t,n)||i.Util.makeHexColor(e,t,n);this.ctx.fillStyle=r,this.current.fillColor=r,this.current.patternFill=!1}_getPattern(e,t=null){let n;return this.cachedPatterns.has(e)?n=this.cachedPatterns.get(e):(n=(0,s.getShadingPattern)(this.objs.get(e)),this.cachedPatterns.set(e,n)),t&&(n.matrix=t),n}shadingFill(e){if(!this.contentVisible)return;const t=this.ctx;this.save();const n=this._getPattern(e);t.fillStyle=n.getPattern(t,this,(0,r.getCurrentTransformInverse)(t),s.PathType.SHADING);const a=(0,r.getCurrentTransformInverse)(t);if(a){const e=t.canvas,n=e.width,r=e.height,s=i.Util.applyTransform([0,0],a),o=i.Util.applyTransform([0,r],a),l=i.Util.applyTransform([n,0],a),c=i.Util.applyTransform([n,r],a),u=Math.min(s[0],o[0],l[0],c[0]),d=Math.min(s[1],o[1],l[1],c[1]),h=Math.max(s[0],o[0],l[0],c[0]),p=Math.max(s[1],o[1],l[1],c[1]);this.ctx.fillRect(u,d,h-u,p-d)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){(0,i.unreachable)("Should not call beginInlineImage")}beginImageData(){(0,i.unreachable)("Should not call beginImageData")}paintFormXObjectBegin(e,t){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),Array.isArray(e)&&6===e.length&&this.transform(...e),this.baseTransform=(0,r.getCurrentTransform)(this.ctx),t)){const e=t[2]-t[0],n=t[3]-t[1];this.ctx.rect(t[0],t[1],e,n),this.current.updateRectMinMax((0,r.getCurrentTransform)(this.ctx),t),this.clip(),this.endPath()}}paintFormXObjectEnd(){this.contentVisible&&(this.restore(),this.baseTransform=this.baseTransformStack.pop())}beginGroup(e){if(!this.contentVisible)return;this.save(),this.inSMaskMode&&(this.endSMaskMode(),this.current.activeSMask=null);const t=this.ctx;e.isolated||(0,i.info)("TODO: Support non-isolated groups."),e.knockout&&(0,i.warn)("Knockout groups not supported.");const n=(0,r.getCurrentTransform)(t);if(e.matrix&&t.transform(...e.matrix),!e.bbox)throw new Error("Bounding box is required.");let s=i.Util.getAxialAlignedBoundingBox(e.bbox,(0,r.getCurrentTransform)(t));const a=[0,0,t.canvas.width,t.canvas.height];s=i.Util.intersect(s,a)||[0,0,0,0];const o=Math.floor(s[0]),c=Math.floor(s[1]);let u=Math.max(Math.ceil(s[2])-o,1),d=Math.max(Math.ceil(s[3])-c,1),h=1,p=1;u>l&&(h=u/l,u=l),d>l&&(p=d/l,d=l),this.current.startNewPathAndClipBox([0,0,u,d]);let f="groupAt"+this.groupLevel;e.smask&&(f+="_smask_"+this.smaskCounter++%2);const g=this.cachedCanvases.getCanvas(f,u,d),v=g.context;v.scale(1/h,1/p),v.translate(-o,-c),v.transform(...n),e.smask?this.smaskStack.push({canvas:g.canvas,context:v,offsetX:o,offsetY:c,scaleX:h,scaleY:p,subtype:e.smask.subtype,backdrop:e.smask.backdrop,transferMap:e.smask.transferMap||null,startTransformInverse:null}):(t.setTransform(1,0,0,1,0,0),t.translate(o,c),t.scale(h,p),t.save()),m(t,v),this.ctx=v,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(t),this.groupLevel++}endGroup(e){if(!this.contentVisible)return;this.groupLevel--;const t=this.ctx,n=this.groupStack.pop();if(this.ctx=n,this.ctx.imageSmoothingEnabled=!1,e.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const e=(0,r.getCurrentTransform)(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...e);const n=i.Util.getAxialAlignedBoundingBox([0,0,t.canvas.width,t.canvas.height],e);this.ctx.drawImage(t.canvas,0,0),this.ctx.restore(),this.compose(n)}}beginAnnotation(e,t,n,s,a){if(this.#Y(),v(this.ctx,this.foregroundColor),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),Array.isArray(t)&&4===t.length){const s=t[2]-t[0],o=t[3]-t[1];if(a&&this.annotationCanvasMap){(n=n.slice())[4]-=t[0],n[5]-=t[1],(t=t.slice())[0]=t[1]=0,t[2]=s,t[3]=o;const[a,l]=i.Util.singularValueDecompose2dScale((0,r.getCurrentTransform)(this.ctx)),{viewportScale:c}=this,u=Math.ceil(s*this.outputScaleX*c),d=Math.ceil(o*this.outputScaleY*c);this.annotationCanvas=this.canvasFactory.create(u,d);const{canvas:h,context:p}=this.annotationCanvas;this.annotationCanvasMap.set(e,h),this.annotationCanvas.savedCtx=this.ctx,this.ctx=p,this.ctx.setTransform(a,0,0,-l,0,o*l),v(this.ctx,this.foregroundColor)}else v(this.ctx,this.foregroundColor),this.ctx.rect(t[0],t[1],s,o),this.ctx.clip(),this.endPath()}this.current=new p(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...n),this.transform(...s)}endAnnotation(){this.annotationCanvas&&(this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(e){if(!this.contentVisible)return;const t=e.count;(e=this.getObject(e.data,e)).count=t;const n=this.ctx,r=this.processingType3;if(r&&(void 0===r.compiled&&(r.compiled=function(e){const{width:t,height:n}=e;if(t>c||n>c)return null;const r=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),i=t+1;let s,a,o,l=new Uint8Array(i*(n+1));const u=t+7&-8;let d=new Uint8Array(u*n),h=0;for(const t of e.data){let e=128;for(;e>0;)d[h++]=t&e?0:255,e>>=1}let p=0;for(h=0,0!==d[h]&&(l[0]=1,++p),a=1;a<t;a++)d[h]!==d[h+1]&&(l[a]=d[h]?2:1,++p),h++;for(0!==d[h]&&(l[a]=2,++p),s=1;s<n;s++){h=s*u,o=s*i,d[h-u]!==d[h]&&(l[o]=d[h]?1:8,++p);let e=(d[h]?4:0)+(d[h-u]?8:0);for(a=1;a<t;a++)e=(e>>2)+(d[h+1]?4:0)+(d[h-u+1]?8:0),r[e]&&(l[o+a]=r[e],++p),h++;if(d[h-u]!==d[h]&&(l[o+a]=d[h]?2:4,++p),p>1e3)return null}for(h=u*(n-1),o=s*i,0!==d[h]&&(l[o]=8,++p),a=1;a<t;a++)d[h]!==d[h+1]&&(l[o+a]=d[h]?4:8,++p),h++;if(0!==d[h]&&(l[o+a]=4,++p),p>1e3)return null;const f=new Int32Array([0,i,-1,0,-i,0,0,0,1]),g=new Path2D;for(s=0;p&&s<=n;s++){let e=s*i;const n=e+t;for(;e<n&&!l[e];)e++;if(e===n)continue;g.moveTo(e%i,s);const r=e;let a=l[e];do{const t=f[a];do{e+=t}while(!l[e]);const n=l[e];5!==n&&10!==n?(a=n,l[e]=0):(a=n&51*a>>4,l[e]&=a>>2|a<<2),g.lineTo(e%i,e/i|0),l[e]||--p}while(r!==e);--s}return d=null,l=null,function(e){e.save(),e.scale(1/t,-1/n),e.translate(0,-n),e.fill(g),e.beginPath(),e.restore()}}(e)),r.compiled))return void r.compiled(n);const i=this._createMaskCanvas(e),s=i.canvas;n.save(),n.setTransform(1,0,0,1,0,0),n.drawImage(s,i.offsetX,i.offsetY),n.restore(),this.compose()}paintImageMaskXObjectRepeat(e,t,n=0,s=0,a,o){if(!this.contentVisible)return;e=this.getObject(e.data,e);const l=this.ctx;l.save();const c=(0,r.getCurrentTransform)(l);l.transform(t,n,s,a,0,0);const u=this._createMaskCanvas(e);l.setTransform(1,0,0,1,0,0);for(let e=0,r=o.length;e<r;e+=2){const r=i.Util.transform(c,[t,n,s,a,o[e],o[e+1]]),[d,h]=i.Util.applyTransform([0,0],r);l.drawImage(u.canvas,d,h)}l.restore(),this.compose()}paintImageMaskXObjectGroup(e){if(!this.contentVisible)return;const t=this.ctx,n=this.current.fillColor,i=this.current.patternFill;for(const a of e){const{data:e,width:o,height:l,transform:c}=a,u=this.cachedCanvases.getCanvas("maskCanvas",o,l),d=u.context;d.save(),g(d,this.getObject(e,a)),d.globalCompositeOperation="source-in",d.fillStyle=i?n.getPattern(d,this,(0,r.getCurrentTransformInverse)(t),s.PathType.FILL):n,d.fillRect(0,0,o,l),d.restore(),t.save(),t.transform(...c),t.scale(1,-1),h(t,u.canvas,0,0,o,l,0,-1,1,1),t.restore()}this.compose()}paintImageXObject(e){if(!this.contentVisible)return;const t=this.getObject(e);t?this.paintInlineImageXObject(t):(0,i.warn)("Dependent image isn't ready yet")}paintImageXObjectRepeat(e,t,n,r){if(!this.contentVisible)return;const s=this.getObject(e);if(!s)return void(0,i.warn)("Dependent image isn't ready yet");const a=s.width,o=s.height,l=[];for(let e=0,i=r.length;e<i;e+=2)l.push({transform:[t,0,0,n,r[e],r[e+1]],x:0,y:0,w:a,h:o});this.paintInlineImageXObjectGroup(s,l)}paintInlineImageXObject(e){if(!this.contentVisible)return;const t=e.width,n=e.height,s=this.ctx;let a;if(this.save(),s.scale(1/t,-1/n),"function"==typeof HTMLElement&&e instanceof HTMLElement||!e.data)a=e;else{const r=this.cachedCanvases.getCanvas("inlineImage",t,n);f(r.context,e,this.current.transferMaps),a=r.canvas}const o=this._scaleImage(a,(0,r.getCurrentTransformInverse)(s));s.imageSmoothingEnabled=E((0,r.getCurrentTransform)(s),e.interpolate);const[l,c]=h(s,o.img,0,0,o.paintWidth,o.paintHeight,0,-n,t,n);if(this.imageLayer){const[t,s]=i.Util.applyTransform([0,-n],(0,r.getCurrentTransform)(this.ctx));this.imageLayer.appendImage({imgData:e,left:t,top:s,width:l,height:c})}this.compose(),this.restore()}paintInlineImageXObjectGroup(e,t){if(!this.contentVisible)return;const n=this.ctx,s=e.width,a=e.height,o=this.cachedCanvases.getCanvas("inlineImage",s,a);f(o.context,e,this.current.transferMaps);for(const l of t){if(n.save(),n.transform(...l.transform),n.scale(1,-1),h(n,o.canvas,l.x,l.y,l.w,l.h,0,-1,1,1),this.imageLayer){const[t,n]=i.Util.applyTransform([l.x,l.y],(0,r.getCurrentTransform)(this.ctx));this.imageLayer.appendImage({imgData:e,left:t,top:n,width:s,height:a})}n.restore()}this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(e){}markPointProps(e,t){}beginMarkedContent(e){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(e,t){"OC"===e?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(t)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(e){const t=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(e);const n=this.ctx;this.pendingClip&&(t||(this.pendingClip===P?n.clip("evenodd"):n.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),n.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const e=(0,r.getCurrentTransform)(this.ctx);if(0===e[1]&&0===e[2])this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(e[0]),Math.abs(e[3]));else{const t=Math.abs(e[0]*e[3]-e[2]*e[1]),n=Math.hypot(e[0],e[2]),r=Math.hypot(e[1],e[3]);this._cachedGetSinglePixelWidth=Math.max(n,r)/t}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(!this._cachedScaleForStroking){const{lineWidth:e}=this.current,t=(0,r.getCurrentTransform)(this.ctx);let n,i;if(0===t[1]&&0===t[2]){const r=Math.abs(t[0]),s=Math.abs(t[3]);if(0===e)n=1/r,i=1/s;else{const t=r*e,a=s*e;n=t<1?1/t:1,i=a<1?1/a:1}}else{const r=Math.abs(t[0]*t[3]-t[2]*t[1]),s=Math.hypot(t[0],t[1]),a=Math.hypot(t[2],t[3]);if(0===e)n=a/r,i=s/r;else{const t=e*r;n=a>t?a/t:1,i=s>t?s/t:1}}this._cachedScaleForStroking=[n,i]}return this._cachedScaleForStroking}rescaleAndStroke(e){const{ctx:t}=this,{lineWidth:n}=this.current,[i,s]=this.getScaleForStroking();if(t.lineWidth=n||1,1===i&&1===s)return void t.stroke();let a,o,l;e&&(a=(0,r.getCurrentTransform)(t),o=t.getLineDash().slice(),l=t.lineDashOffset),t.scale(i,s);const c=Math.max(i,s);t.setLineDash(t.getLineDash().map((e=>e/c))),t.lineDashOffset/=c,t.stroke(),e&&(t.setTransform(...a),t.setLineDash(o),t.lineDashOffset=l)}isContentVisible(){for(let e=this.markedContentStack.length-1;e>=0;e--)if(!this.markedContentStack[e].visible)return!1;return!0}}t.CanvasGraphics=x;for(const e in i.OPS)void 0!==x.prototype[e]&&(x.prototype[i.OPS[e]]=x.prototype[e])},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TilingPattern=t.PathType=void 0,t.getShadingPattern=function(e){switch(e[0]){case"RadialAxial":return new c(e);case"Mesh":return new h(e);case"Dummy":return new p}throw new Error(`Unknown IR type: ${e[0]}`)};var r=n(1),i=n(8),s=n(3);const a={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function o(e,t){if(!t||s.isNodeJS)return;const n=t[2]-t[0],r=t[3]-t[1],i=new Path2D;i.rect(t[0],t[1],n,r),e.clip(i)}t.PathType=a;class l{constructor(){this.constructor===l&&(0,r.unreachable)("Cannot initialize BaseShadingPattern.")}getPattern(){(0,r.unreachable)("Abstract method `getPattern` called.")}}class c extends l{constructor(e){super(),this._type=e[1],this._bbox=e[2],this._colorStops=e[3],this._p0=e[4],this._p1=e[5],this._r0=e[6],this._r1=e[7],this.matrix=null}_createGradient(e){let t;"axial"===this._type?t=e.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):"radial"===this._type&&(t=e.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const e of this._colorStops)t.addColorStop(e[0],e[1]);return t}getPattern(e,t,n,s){let l;if(s===a.STROKE||s===a.FILL){const a=t.current.getClippedPathBoundingBox(s,(0,i.getCurrentTransform)(e))||[0,0,0,0],c=Math.ceil(a[2]-a[0])||1,u=Math.ceil(a[3]-a[1])||1,d=t.cachedCanvases.getCanvas("pattern",c,u,!0),h=d.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(-a[0],-a[1]),n=r.Util.transform(n,[1,0,0,1,a[0],a[1]]),h.transform(...t.baseTransform),this.matrix&&h.transform(...this.matrix),o(h,this._bbox),h.fillStyle=this._createGradient(h),h.fill(),l=e.createPattern(d.canvas,"no-repeat");const p=new DOMMatrix(n);try{l.setTransform(p)}catch(e){(0,r.warn)(`RadialAxialShadingPattern.getPattern: "${e?.message}".`)}}else o(e,this._bbox),l=this._createGradient(e);return l}}function u(e,t,n,r,i,s,a,o){const l=t.coords,c=t.colors,u=e.data,d=4*e.width;let h;l[n+1]>l[r+1]&&(h=n,n=r,r=h,h=s,s=a,a=h),l[r+1]>l[i+1]&&(h=r,r=i,i=h,h=a,a=o,o=h),l[n+1]>l[r+1]&&(h=n,n=r,r=h,h=s,s=a,a=h);const p=(l[n]+t.offsetX)*t.scaleX,f=(l[n+1]+t.offsetY)*t.scaleY,g=(l[r]+t.offsetX)*t.scaleX,m=(l[r+1]+t.offsetY)*t.scaleY,v=(l[i]+t.offsetX)*t.scaleX,y=(l[i+1]+t.offsetY)*t.scaleY;if(f>=y)return;const b=c[s],_=c[s+1],w=c[s+2],E=c[a],S=c[a+1],C=c[a+2],A=c[o],P=c[o+1],x=c[o+2],R=Math.round(f),T=Math.round(y);let M,L,I,k,O,F,D,N;for(let e=R;e<=T;e++){if(e<m){let t;t=e<f?0:(f-e)/(f-m),M=p-(p-g)*t,L=b-(b-E)*t,I=_-(_-S)*t,k=w-(w-C)*t}else{let t;t=e>y?1:m===y?0:(m-e)/(m-y),M=g-(g-v)*t,L=E-(E-A)*t,I=S-(S-P)*t,k=C-(C-x)*t}let t;t=e<f?0:e>y?1:(f-e)/(f-y),O=p-(p-v)*t,F=b-(b-A)*t,D=_-(_-P)*t,N=w-(w-x)*t;const n=Math.round(Math.min(M,O)),r=Math.round(Math.max(M,O));let i=d*e+4*n;for(let e=n;e<=r;e++)t=(M-e)/(M-O),t<0?t=0:t>1&&(t=1),u[i++]=L-(L-F)*t|0,u[i++]=I-(I-D)*t|0,u[i++]=k-(k-N)*t|0,u[i++]=255}}function d(e,t,n){const r=t.coords,i=t.colors;let s,a;switch(t.type){case"lattice":const o=t.verticesPerRow,l=Math.floor(r.length/o)-1,c=o-1;for(s=0;s<l;s++){let t=s*o;for(let s=0;s<c;s++,t++)u(e,n,r[t],r[t+1],r[t+o],i[t],i[t+1],i[t+o]),u(e,n,r[t+o+1],r[t+1],r[t+o],i[t+o+1],i[t+1],i[t+o])}break;case"triangles":for(s=0,a=r.length;s<a;s+=3)u(e,n,r[s],r[s+1],r[s+2],i[s],i[s+1],i[s+2]);break;default:throw new Error("illegal figure")}}class h extends l{constructor(e){super(),this._coords=e[2],this._colors=e[3],this._figures=e[4],this._bounds=e[5],this._bbox=e[7],this._background=e[8],this.matrix=null}_createMeshCanvas(e,t,n){const r=Math.floor(this._bounds[0]),i=Math.floor(this._bounds[1]),s=Math.ceil(this._bounds[2])-r,a=Math.ceil(this._bounds[3])-i,o=Math.min(Math.ceil(Math.abs(s*e[0]*1.1)),3e3),l=Math.min(Math.ceil(Math.abs(a*e[1]*1.1)),3e3),c=s/o,u=a/l,h={coords:this._coords,colors:this._colors,offsetX:-r,offsetY:-i,scaleX:1/c,scaleY:1/u},p=o+4,f=l+4,g=n.getCanvas("mesh",p,f,!1),m=g.context,v=m.createImageData(o,l);if(t){const e=v.data;for(let n=0,r=e.length;n<r;n+=4)e[n]=t[0],e[n+1]=t[1],e[n+2]=t[2],e[n+3]=255}for(const e of this._figures)d(v,e,h);return m.putImageData(v,2,2),{canvas:g.canvas,offsetX:r-2*c,offsetY:i-2*u,scaleX:c,scaleY:u}}getPattern(e,t,n,s){let l;if(o(e,this._bbox),s===a.SHADING)l=r.Util.singularValueDecompose2dScale((0,i.getCurrentTransform)(e));else if(l=r.Util.singularValueDecompose2dScale(t.baseTransform),this.matrix){const e=r.Util.singularValueDecompose2dScale(this.matrix);l=[l[0]*e[0],l[1]*e[1]]}const c=this._createMeshCanvas(l,s===a.SHADING?null:this._background,t.cachedCanvases);return s!==a.SHADING&&(e.setTransform(...t.baseTransform),this.matrix&&e.transform(...this.matrix)),e.translate(c.offsetX,c.offsetY),e.scale(c.scaleX,c.scaleY),e.createPattern(c.canvas,"no-repeat")}}class p extends l{getPattern(){return"hotpink"}}const f=1,g=2;class m{static get MAX_PATTERN_SIZE(){return(0,r.shadow)(this,"MAX_PATTERN_SIZE",3e3)}constructor(e,t,n,r,i){this.operatorList=e[2],this.matrix=e[3]||[1,0,0,1,0,0],this.bbox=e[4],this.xstep=e[5],this.ystep=e[6],this.paintType=e[7],this.tilingType=e[8],this.color=t,this.ctx=n,this.canvasGraphicsFactory=r,this.baseTransform=i}createPatternCanvas(e){const t=this.operatorList,n=this.bbox,s=this.xstep,a=this.ystep,o=this.paintType,l=this.tilingType,c=this.color,u=this.canvasGraphicsFactory;(0,r.info)("TilingType: "+l);const d=n[0],h=n[1],p=n[2],f=n[3],g=r.Util.singularValueDecompose2dScale(this.matrix),m=r.Util.singularValueDecompose2dScale(this.baseTransform),v=[g[0]*m[0],g[1]*m[1]],y=this.getSizeAndScale(s,this.ctx.canvas.width,v[0]),b=this.getSizeAndScale(a,this.ctx.canvas.height,v[1]),_=e.cachedCanvases.getCanvas("pattern",y.size,b.size,!0),w=_.context,E=u.createCanvasGraphics(w);E.groupLevel=e.groupLevel,this.setFillAndStrokeStyleToContext(E,o,c);let S=d,C=h,A=p,P=f;return d<0&&(S=0,A+=Math.abs(d)),h<0&&(C=0,P+=Math.abs(h)),w.translate(-y.scale*S,-b.scale*C),E.transform(y.scale,0,0,b.scale,0,0),w.save(),this.clipBbox(E,S,C,A,P),E.baseTransform=(0,i.getCurrentTransform)(E.ctx),E.executeOperatorList(t),E.endDrawing(),{canvas:_.canvas,scaleX:y.scale,scaleY:b.scale,offsetX:S,offsetY:C}}getSizeAndScale(e,t,n){e=Math.abs(e);const r=Math.max(m.MAX_PATTERN_SIZE,t);let i=Math.ceil(e*n);return i>=r?i=r:n=i/e,{scale:n,size:i}}clipBbox(e,t,n,r,s){const a=r-t,o=s-n;e.ctx.rect(t,n,a,o),e.current.updateRectMinMax((0,i.getCurrentTransform)(e.ctx),[t,n,r,s]),e.clip(),e.endPath()}setFillAndStrokeStyleToContext(e,t,n){const i=e.ctx,s=e.current;switch(t){case f:const e=this.ctx;i.fillStyle=e.fillStyle,i.strokeStyle=e.strokeStyle,s.fillColor=e.fillStyle,s.strokeColor=e.strokeStyle;break;case g:const a=r.Util.makeHexColor(n[0],n[1],n[2]);i.fillStyle=a,i.strokeStyle=a,s.fillColor=a,s.strokeColor=a;break;default:throw new r.FormatError(`Unsupported paint type: ${t}`)}}getPattern(e,t,n,i){let s=n;i!==a.SHADING&&(s=r.Util.transform(s,t.baseTransform),this.matrix&&(s=r.Util.transform(s,this.matrix)));const o=this.createPatternCanvas(t);let l=new DOMMatrix(s);l=l.translate(o.offsetX,o.offsetY),l=l.scale(1/o.scaleX,1/o.scaleY);const c=e.createPattern(o.canvas,"repeat");try{c.setTransform(l)}catch(e){(0,r.warn)(`TilingPattern.getPattern: "${e?.message}".`)}return c}}t.TilingPattern=m},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.applyMaskImageData=function({src:e,srcPos:t=0,dest:n,destPos:i=0,width:s,height:a,inverseDecode:o=!1}){const l=r.FeatureTest.isLittleEndian?4278190080:255,[c,u]=o?[0,l]:[l,0],d=s>>3,h=7&s,p=e.length;n=new Uint32Array(n.buffer);for(let r=0;r<a;r++){for(const r=t+d;t<r;t++){const r=t<p?e[t]:255;n[i++]=128&r?u:c,n[i++]=64&r?u:c,n[i++]=32&r?u:c,n[i++]=16&r?u:c,n[i++]=8&r?u:c,n[i++]=4&r?u:c,n[i++]=2&r?u:c,n[i++]=1&r?u:c}if(0===h)continue;const r=t<p?e[t++]:255;for(let e=0;e<h;e++)n[i++]=r&1<<7-e?u:c}return{srcPos:t,destPos:i}};var r=n(1)},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GlobalWorkerOptions=void 0;const n=Object.create(null);t.GlobalWorkerOptions=n,n.workerPort=void 0===n.workerPort?null:n.workerPort,n.workerSrc=void 0===n.workerSrc?"":n.workerSrc},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.MessageHandler=void 0;var r=n(1);const i=1,s=2,a=1,o=2,l=3,c=4,u=5,d=6,h=7,p=8;function f(e){switch(e instanceof Error||"object"==typeof e&&null!==e||(0,r.unreachable)('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),e.name){case"AbortException":return new r.AbortException(e.message);case"MissingPDFException":return new r.MissingPDFException(e.message);case"PasswordException":return new r.PasswordException(e.message,e.code);case"UnexpectedResponseException":return new r.UnexpectedResponseException(e.message,e.status);case"UnknownErrorException":return new r.UnknownErrorException(e.message,e.details);default:return new r.UnknownErrorException(e.message,e.toString())}}t.MessageHandler=class{constructor(e,t,n){this.sourceName=e,this.targetName=t,this.comObj=n,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),this._onComObjOnMessage=e=>{const t=e.data;if(t.targetName!==this.sourceName)return;if(t.stream)return void this._processStreamMessage(t);if(t.callback){const e=t.callbackId,n=this.callbackCapabilities[e];if(!n)throw new Error(`Cannot resolve callback ${e}`);if(delete this.callbackCapabilities[e],t.callback===i)n.resolve(t.data);else{if(t.callback!==s)throw new Error("Unexpected callback case");n.reject(f(t.reason))}return}const r=this.actionHandler[t.action];if(!r)throw new Error(`Unknown action from worker: ${t.action}`);if(t.callbackId){const e=this.sourceName,a=t.sourceName;new Promise((function(e){e(r(t.data))})).then((function(r){n.postMessage({sourceName:e,targetName:a,callback:i,callbackId:t.callbackId,data:r})}),(function(r){n.postMessage({sourceName:e,targetName:a,callback:s,callbackId:t.callbackId,reason:f(r)})}))}else t.streamId?this._createStreamSink(t):r(t.data)},n.addEventListener("message",this._onComObjOnMessage)}on(e,t){const n=this.actionHandler;if(n[e])throw new Error(`There is already an actionName called "${e}"`);n[e]=t}send(e,t,n){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,data:t},n)}sendWithPromise(e,t,n){const i=this.callbackId++,s=(0,r.createPromiseCapability)();this.callbackCapabilities[i]=s;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,callbackId:i,data:t},n)}catch(e){s.reject(e)}return s.promise}sendWithStream(e,t,n,i){const s=this.streamId++,o=this.sourceName,l=this.targetName,c=this.comObj;return new ReadableStream({start:n=>{const a=(0,r.createPromiseCapability)();return this.streamControllers[s]={controller:n,startCall:a,pullCall:null,cancelCall:null,isClosed:!1},c.postMessage({sourceName:o,targetName:l,action:e,streamId:s,data:t,desiredSize:n.desiredSize},i),a.promise},pull:e=>{const t=(0,r.createPromiseCapability)();return this.streamControllers[s].pullCall=t,c.postMessage({sourceName:o,targetName:l,stream:d,streamId:s,desiredSize:e.desiredSize}),t.promise},cancel:e=>{(0,r.assert)(e instanceof Error,"cancel must have a valid reason");const t=(0,r.createPromiseCapability)();return this.streamControllers[s].cancelCall=t,this.streamControllers[s].isClosed=!0,c.postMessage({sourceName:o,targetName:l,stream:a,streamId:s,reason:f(e)}),t.promise}},n)}_createStreamSink(e){const t=e.streamId,n=this.sourceName,i=e.sourceName,s=this.comObj,a=this,o=this.actionHandler[e.action],d={enqueue(e,a=1,o){if(this.isCancelled)return;const l=this.desiredSize;this.desiredSize-=a,l>0&&this.desiredSize<=0&&(this.sinkCapability=(0,r.createPromiseCapability)(),this.ready=this.sinkCapability.promise),s.postMessage({sourceName:n,targetName:i,stream:c,streamId:t,chunk:e},o)},close(){this.isCancelled||(this.isCancelled=!0,s.postMessage({sourceName:n,targetName:i,stream:l,streamId:t}),delete a.streamSinks[t])},error(e){(0,r.assert)(e instanceof Error,"error must have a valid reason"),this.isCancelled||(this.isCancelled=!0,s.postMessage({sourceName:n,targetName:i,stream:u,streamId:t,reason:f(e)}))},sinkCapability:(0,r.createPromiseCapability)(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:e.desiredSize,ready:null};d.sinkCapability.resolve(),d.ready=d.sinkCapability.promise,this.streamSinks[t]=d,new Promise((function(t){t(o(e.data,d))})).then((function(){s.postMessage({sourceName:n,targetName:i,stream:p,streamId:t,success:!0})}),(function(e){s.postMessage({sourceName:n,targetName:i,stream:p,streamId:t,reason:f(e)})}))}_processStreamMessage(e){const t=e.streamId,n=this.sourceName,i=e.sourceName,s=this.comObj,g=this.streamControllers[t],m=this.streamSinks[t];switch(e.stream){case p:e.success?g.startCall.resolve():g.startCall.reject(f(e.reason));break;case h:e.success?g.pullCall.resolve():g.pullCall.reject(f(e.reason));break;case d:if(!m){s.postMessage({sourceName:n,targetName:i,stream:h,streamId:t,success:!0});break}m.desiredSize<=0&&e.desiredSize>0&&m.sinkCapability.resolve(),m.desiredSize=e.desiredSize,new Promise((function(e){e(m.onPull&&m.onPull())})).then((function(){s.postMessage({sourceName:n,targetName:i,stream:h,streamId:t,success:!0})}),(function(e){s.postMessage({sourceName:n,targetName:i,stream:h,streamId:t,reason:f(e)})}));break;case c:if((0,r.assert)(g,"enqueue should have stream controller"),g.isClosed)break;g.controller.enqueue(e.chunk);break;case l:if((0,r.assert)(g,"close should have stream controller"),g.isClosed)break;g.isClosed=!0,g.controller.close(),this._deleteStreamController(g,t);break;case u:(0,r.assert)(g,"error should have stream controller"),g.controller.error(f(e.reason)),this._deleteStreamController(g,t);break;case o:e.success?g.cancelCall.resolve():g.cancelCall.reject(f(e.reason)),this._deleteStreamController(g,t);break;case a:if(!m)break;new Promise((function(t){t(m.onCancel&&m.onCancel(f(e.reason)))})).then((function(){s.postMessage({sourceName:n,targetName:i,stream:o,streamId:t,success:!0})}),(function(e){s.postMessage({sourceName:n,targetName:i,stream:o,streamId:t,reason:f(e)})})),m.sinkCapability.reject(f(e.reason)),m.isCancelled=!0,delete this.streamSinks[t];break;default:throw new Error("Unexpected stream case")}}async _deleteStreamController(e,t){await Promise.allSettled([e.startCall&&e.startCall.promise,e.pullCall&&e.pullCall.promise,e.cancelCall&&e.cancelCall.promise]),delete this.streamControllers[t]}destroy(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Metadata=void 0;var r=n(1);t.Metadata=class{#J;#Z;constructor({parsedData:e,rawData:t}){this.#J=e,this.#Z=t}getRaw(){return this.#Z}get(e){return this.#J.get(e)??null}getAll(){return(0,r.objectFromMap)(this.#J)}has(e){return this.#J.has(e)}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.OptionalContentConfig=void 0;var r=n(1);const i=Symbol("INTERNAL");class s{#ee=!0;constructor(e,t){this.name=e,this.intent=t}get visible(){return this.#ee}_setVisible(e,t){e!==i&&(0,r.unreachable)("Internal method `_setVisible` called."),this.#ee=t}}t.OptionalContentConfig=class{#te=!0;#ne=new Map;#re=null;#ie=null;constructor(e){if(this.name=null,this.creator=null,null!==e){this.name=e.name,this.creator=e.creator,this.#ie=e.order;for(const t of e.groups)this.#ne.set(t.id,new s(t.name,t.intent));if("OFF"===e.baseState)for(const e of this.#ne.values())e._setVisible(i,!1);for(const t of e.on)this.#ne.get(t)._setVisible(i,!0);for(const t of e.off)this.#ne.get(t)._setVisible(i,!1);this.#re=new Map;for(const[e,t]of this.#ne)this.#re.set(e,t.visible)}}#se(e){const t=e.length;if(t<2)return!0;const n=e[0];for(let i=1;i<t;i++){const t=e[i];let s;if(Array.isArray(t))s=this.#se(t);else{if(!this.#ne.has(t))return(0,r.warn)(`Optional content group not found: ${t}`),!0;s=this.#ne.get(t).visible}switch(n){case"And":if(!s)return!1;break;case"Or":if(s)return!0;break;case"Not":return!s;default:return!0}}return"And"===n}isVisible(e){if(0===this.#ne.size)return!0;if(!e)return(0,r.warn)("Optional content group not defined."),!0;if("OCG"===e.type)return this.#ne.has(e.id)?this.#ne.get(e.id).visible:((0,r.warn)(`Optional content group not found: ${e.id}`),!0);if("OCMD"===e.type){if(e.expression)return this.#se(e.expression);if(!e.policy||"AnyOn"===e.policy){for(const t of e.ids){if(!this.#ne.has(t))return(0,r.warn)(`Optional content group not found: ${t}`),!0;if(this.#ne.get(t).visible)return!0}return!1}if("AllOn"===e.policy){for(const t of e.ids){if(!this.#ne.has(t))return(0,r.warn)(`Optional content group not found: ${t}`),!0;if(!this.#ne.get(t).visible)return!1}return!0}if("AnyOff"===e.policy){for(const t of e.ids){if(!this.#ne.has(t))return(0,r.warn)(`Optional content group not found: ${t}`),!0;if(!this.#ne.get(t).visible)return!0}return!1}if("AllOff"===e.policy){for(const t of e.ids){if(!this.#ne.has(t))return(0,r.warn)(`Optional content group not found: ${t}`),!0;if(this.#ne.get(t).visible)return!1}return!0}return(0,r.warn)(`Unknown optional content policy ${e.policy}.`),!0}return(0,r.warn)(`Unknown group type ${e.type}.`),!0}setVisibility(e,t=!0){this.#ne.has(e)?(this.#ne.get(e)._setVisible(i,!!t),this.#te=null):(0,r.warn)(`Optional content group not found: ${e}`)}get hasInitialVisibility(){if(null!==this.#te)return this.#te;for(const[e,t]of this.#ne){const n=this.#re.get(e);if(t.visible!==n)return this.#te=!1}return this.#te=!0}getOrder(){return this.#ne.size?this.#ie?this.#ie.slice():[...this.#ne.keys()]:null}getGroups(){return this.#ne.size>0?(0,r.objectFromMap)(this.#ne):null}getGroup(e){return this.#ne.get(e)||null}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFDataTransportStream=void 0;var r=n(1),i=n(8);t.PDFDataTransportStream=class{constructor(e,t){(0,r.assert)(t,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.'),this._queuedChunks=[],this._progressiveDone=e.progressiveDone||!1,this._contentDispositionFilename=e.contentDispositionFilename||null;const n=e.initialData;if(n?.length>0){const e=new Uint8Array(n).buffer;this._queuedChunks.push(e)}this._pdfDataRangeTransport=t,this._isStreamingSupported=!e.disableStream,this._isRangeSupported=!e.disableRange,this._contentLength=e.length,this._fullRequestReader=null,this._rangeReaders=[],this._pdfDataRangeTransport.addRangeListener(((e,t)=>{this._onReceiveData({begin:e,chunk:t})})),this._pdfDataRangeTransport.addProgressListener(((e,t)=>{this._onProgress({loaded:e,total:t})})),this._pdfDataRangeTransport.addProgressiveReadListener((e=>{this._onReceiveData({chunk:e})})),this._pdfDataRangeTransport.addProgressiveDoneListener((()=>{this._onProgressiveDone()})),this._pdfDataRangeTransport.transportReady()}_onReceiveData(e){const t=new Uint8Array(e.chunk).buffer;if(void 0===e.begin)this._fullRequestReader?this._fullRequestReader._enqueue(t):this._queuedChunks.push(t);else{const n=this._rangeReaders.some((function(n){return n._begin===e.begin&&(n._enqueue(t),!0)}));(0,r.assert)(n,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}_onProgress(e){if(void 0===e.total){const t=this._rangeReaders[0];t?.onProgress&&t.onProgress({loaded:e.loaded})}else{const t=this._fullRequestReader;t?.onProgress&&t.onProgress({loaded:e.loaded,total:e.total})}}_onProgressiveDone(){this._fullRequestReader&&this._fullRequestReader.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(e){const t=this._rangeReaders.indexOf(e);t>=0&&this._rangeReaders.splice(t,1)}getFullReader(){(0,r.assert)(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const e=this._queuedChunks;return this._queuedChunks=null,new s(this,e,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const n=new a(this,e,t);return this._pdfDataRangeTransport.requestDataRange(e,t),this._rangeReaders.push(n),n}cancelAllRequests(e){this._fullRequestReader&&this._fullRequestReader.cancel(e);for(const t of this._rangeReaders.slice(0))t.cancel(e);this._pdfDataRangeTransport.abort()}};class s{constructor(e,t,n=!1,r=null){this._stream=e,this._done=n||!1,this._filename=(0,i.isPdfFile)(r)?r:null,this._queuedChunks=t||[],this._loaded=0;for(const e of this._queuedChunks)this._loaded+=e.byteLength;this._requests=[],this._headersReady=Promise.resolve(),e._fullRequestReader=this,this.onProgress=null}_enqueue(e){this._done||(this._requests.length>0?this._requests.shift().resolve({value:e,done:!1}):this._queuedChunks.push(e),this._loaded+=e.byteLength)}get headersReady(){return this._headersReady}get filename(){return this._filename}get isRangeSupported(){return this._stream._isRangeSupported}get isStreamingSupported(){return this._stream._isStreamingSupported}get contentLength(){return this._stream._contentLength}async read(){if(this._queuedChunks.length>0)return{value:this._queuedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const e=(0,r.createPromiseCapability)();return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class a{constructor(e,t,n){this._stream=e,this._begin=t,this._end=n,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(e){if(!this._done){if(0===this._requests.length)this._queuedChunk=e;else{this._requests.shift().resolve({value:e,done:!1});for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}this._done=!0,this._stream._removeRangeReader(this)}}get isStreamingSupported(){return!1}async read(){if(this._queuedChunk){const e=this._queuedChunk;return this._queuedChunk=null,{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};const e=(0,r.createPromiseCapability)();return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.XfaText=void 0;class n{static textContent(e){const t=[],r={items:t,styles:Object.create(null)};return function e(r){if(!r)return;let i=null;const s=r.name;if("#text"===s)i=r.value;else{if(!n.shouldBuildText(s))return;r?.attributes?.textContent?i=r.attributes.textContent:r.value&&(i=r.value)}if(null!==i&&t.push({str:i}),r.children)for(const t of r.children)e(t)}(e),r}static shouldBuildText(e){return!("textarea"===e||"input"===e||"option"===e||"select"===e)}}t.XfaText=n},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.NodeStandardFontDataFactory=t.NodeCanvasFactory=t.NodeCMapReaderFactory=void 0;var r=n(9);const i=function(e){return new Promise(((t,n)=>{require$$5.readFile(e,((e,r)=>{!e&&r?t(new Uint8Array(r)):n(new Error(e))}))}))};class s extends r.BaseCanvasFactory{_createCanvas(e,t){return require$$5.createCanvas(e,t)}}t.NodeCanvasFactory=s;class a extends r.BaseCMapReaderFactory{_fetchData(e,t){return i(e).then((e=>({cMapData:e,compressionType:t})))}}t.NodeCMapReaderFactory=a;class o extends r.BaseStandardFontDataFactory{_fetchData(e){return i(e)}}t.NodeStandardFontDataFactory=o},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AnnotationEditorLayer=void 0;var r=n(7),i=n(1),s=n(23),a=n(24);class o{#ae;#oe=!1;#le=this.pointerup.bind(this);#ce=this.pointerdown.bind(this);#ue=new Map;#de=!1;#he=!1;#pe;static _initialized=!1;constructor(e){o._initialized||(o._initialized=!0,s.FreeTextEditor.initialize(e.l10n),a.InkEditor.initialize(e.l10n),e.uiManager.registerEditorTypes([s.FreeTextEditor,a.InkEditor])),this.#pe=e.uiManager,this.annotationStorage=e.annotationStorage,this.pageIndex=e.pageIndex,this.div=e.div,this.#ae=e.accessibilityManager,this.#pe.addLayer(this)}updateToolbar(e){this.#pe.updateToolbar(e)}updateMode(e=this.#pe.getMode()){this.#fe(),e===i.AnnotationEditorType.INK?(this.addInkEditorIfNeeded(!1),this.disableClick()):this.enableClick(),this.#pe.unselectAll()}addInkEditorIfNeeded(e){if(e||this.#pe.getMode()===i.AnnotationEditorType.INK){if(!e)for(const e of this.#ue.values())if(e.isEmpty())return void e.setInBackground();this.#ge({offsetX:0,offsetY:0}).setInBackground()}}setEditingState(e){this.#pe.setEditingState(e)}addCommands(e){this.#pe.addCommands(e)}enable(){this.div.style.pointerEvents="auto";for(const e of this.#ue.values())e.enableEditing()}disable(){this.div.style.pointerEvents="none";for(const e of this.#ue.values())e.disableEditing()}setActiveEditor(e){this.#pe.getActive()!==e&&this.#pe.setActiveEditor(e)}enableClick(){this.div.addEventListener("pointerdown",this.#ce),this.div.addEventListener("pointerup",this.#le)}disableClick(){this.div.removeEventListener("pointerdown",this.#ce),this.div.removeEventListener("pointerup",this.#le)}attach(e){this.#ue.set(e.id,e)}detach(e){this.#ue.delete(e.id),this.#ae?.removePointerInTextLayer(e.contentDiv)}remove(e){this.#pe.removeEditor(e),this.detach(e),this.annotationStorage.remove(e.id),e.div.style.display="none",setTimeout((()=>{e.div.style.display="",e.div.remove(),e.isAttachedToDOM=!1,document.activeElement===document.body&&this.#pe.focusMainContainer()}),0),this.#he||this.addInkEditorIfNeeded(!1)}#me(e){e.parent!==this&&(this.attach(e),e.pageIndex=this.pageIndex,e.parent?.detach(e),e.parent=this,e.div&&e.isAttachedToDOM&&(e.div.remove(),this.div.append(e.div)))}add(e){if(this.#me(e),this.#pe.addEditor(e),this.attach(e),!e.isAttachedToDOM){const t=e.render();this.div.append(t),e.isAttachedToDOM=!0}this.moveEditorInDOM(e),e.onceAdded(),this.addToAnnotationStorage(e)}moveEditorInDOM(e){this.#ae?.moveElementInDOM(this.div,e.div,e.contentDiv,!0)}addToAnnotationStorage(e){e.isEmpty()||this.annotationStorage.has(e.id)||this.annotationStorage.setValue(e.id,e)}addOrRebuild(e){e.needsToBeRebuilt()?e.rebuild():this.add(e)}addANewEditor(e){this.addCommands({cmd:()=>{this.addOrRebuild(e)},undo:()=>{e.remove()},mustExec:!0})}addUndoableEditor(e){this.addCommands({cmd:()=>{this.addOrRebuild(e)},undo:()=>{e.remove()},mustExec:!1})}getNextId(){return this.#pe.getId()}#ve(e){switch(this.#pe.getMode()){case i.AnnotationEditorType.FREETEXT:return new s.FreeTextEditor(e);case i.AnnotationEditorType.INK:return new a.InkEditor(e)}return null}deserialize(e){switch(e.annotationType){case i.AnnotationEditorType.FREETEXT:return s.FreeTextEditor.deserialize(e,this);case i.AnnotationEditorType.INK:return a.InkEditor.deserialize(e,this)}return null}#ge(e){const t=this.getNextId(),n=this.#ve({parent:this,id:t,x:e.offsetX,y:e.offsetY});return n&&this.add(n),n}setSelected(e){this.#pe.setSelected(e)}toggleSelected(e){this.#pe.toggleSelected(e)}isSelected(e){return this.#pe.isSelected(e)}unselect(e){this.#pe.unselect(e)}pointerup(e){const t=r.KeyboardManager.platform.isMac;0!==e.button||e.ctrlKey&&t||e.target===this.div&&this.#de&&(this.#de=!1,this.#oe?this.#ge(e):this.#oe=!0)}pointerdown(e){const t=r.KeyboardManager.platform.isMac;if(0!==e.button||e.ctrlKey&&t)return;if(e.target!==this.div)return;this.#de=!0;const n=this.#pe.getActive();this.#oe=!n||n.isEmpty()}drop(e){const t=e.dataTransfer.getData("text/plain"),n=this.#pe.getEditor(t);if(!n)return;e.preventDefault(),e.dataTransfer.dropEffect="move",this.#me(n);const r=this.div.getBoundingClientRect(),i=e.clientX-r.x,s=e.clientY-r.y;n.translate(i-n.startX,s-n.startY),this.moveEditorInDOM(n),n.div.focus()}dragover(e){e.preventDefault()}destroy(){this.#pe.getActive()?.parent===this&&this.#pe.setActiveEditor(null);for(const e of this.#ue.values())this.#ae?.removePointerInTextLayer(e.contentDiv),e.isAttachedToDOM=!1,e.div.remove(),e.parent=null;this.div=null,this.#ue.clear(),this.#pe.removeLayer(this)}#fe(){this.#he=!0;for(const e of this.#ue.values())e.isEmpty()&&e.remove();this.#he=!1}render(e){this.viewport=e.viewport,(0,r.bindEvents)(this,this.div,["dragover","drop"]),this.setDimensions();for(const e of this.#pe.getEditors(this.pageIndex))this.add(e);this.updateMode()}update(e){this.viewport=e.viewport,this.setDimensions(),this.updateMode()}get scaleFactor(){return this.viewport.scale}get pageDimensions(){const[e,t,n,r]=this.viewport.viewBox;return[n-e,r-t]}get viewportBaseDimensions(){const{width:e,height:t,rotation:n}=this.viewport;return n%180==0?[e,t]:[t,e]}setDimensions(){const{width:e,height:t,rotation:n}=this.viewport,r=n%180!=0,i=Math.floor(e)+"px",s=Math.floor(t)+"px";this.div.style.width=r?s:i,this.div.style.height=r?i:s,this.div.setAttribute("data-main-rotation",n)}}t.AnnotationEditorLayer=o},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.FreeTextEditor=void 0;var r=n(1),i=n(7),s=n(6);class a extends s.AnnotationEditor{#ye=this.editorDivBlur.bind(this);#be=this.editorDivFocus.bind(this);#_e=this.editorDivKeydown.bind(this);#we;#Ee="";#Se=!1;#Ce;static _freeTextDefaultContent="";static _l10nPromise;static _internalPadding=0;static _defaultColor=null;static _defaultFontSize=10;static _keyboardManager=new i.KeyboardManager([[["ctrl+Enter","mac+meta+Enter","Escape","mac+Escape"],a.prototype.commitOrRemove]]);static _type="freetext";constructor(e){super({...e,name:"freeTextEditor"}),this.#we=e.color||a._defaultColor||s.AnnotationEditor._defaultLineColor,this.#Ce=e.fontSize||a._defaultFontSize}static initialize(e){this._l10nPromise=new Map(["free_text_default_content","editor_free_text_aria_label"].map((t=>[t,e.get(t)])));const t=getComputedStyle(document.documentElement);this._internalPadding=parseFloat(t.getPropertyValue("--freetext-padding"))}static updateDefaultParams(e,t){switch(e){case r.AnnotationEditorParamsType.FREETEXT_SIZE:a._defaultFontSize=t;break;case r.AnnotationEditorParamsType.FREETEXT_COLOR:a._defaultColor=t}}updateParams(e,t){switch(e){case r.AnnotationEditorParamsType.FREETEXT_SIZE:this.#Ae(t);break;case r.AnnotationEditorParamsType.FREETEXT_COLOR:this.#Pe(t)}}static get defaultPropertiesToUpdate(){return[[r.AnnotationEditorParamsType.FREETEXT_SIZE,a._defaultFontSize],[r.AnnotationEditorParamsType.FREETEXT_COLOR,a._defaultColor||s.AnnotationEditor._defaultLineColor]]}get propertiesToUpdate(){return[[r.AnnotationEditorParamsType.FREETEXT_SIZE,this.#Ce],[r.AnnotationEditorParamsType.FREETEXT_COLOR,this.#we]]}#Ae(e){const t=e=>{this.editorDiv.style.fontSize=`calc(${e}px * var(--scale-factor))`,this.translate(0,-(e-this.#Ce)*this.parent.scaleFactor),this.#Ce=e,this.#xe()},n=this.#Ce;this.parent.addCommands({cmd:()=>{t(e)},undo:()=>{t(n)},mustExec:!0,type:r.AnnotationEditorParamsType.FREETEXT_SIZE,overwriteIfSameType:!0,keepUndo:!0})}#Pe(e){const t=this.#we;this.parent.addCommands({cmd:()=>{this.#we=e,this.editorDiv.style.color=e},undo:()=>{this.#we=t,this.editorDiv.style.color=t},mustExec:!0,type:r.AnnotationEditorParamsType.FREETEXT_COLOR,overwriteIfSameType:!0,keepUndo:!0})}getInitialTranslation(){return[-a._internalPadding*this.parent.scaleFactor,-(a._internalPadding+this.#Ce)*this.parent.scaleFactor]}rebuild(){super.rebuild(),null!==this.div&&(this.isAttachedToDOM||this.parent.add(this))}enableEditMode(){this.isInEditMode()||(this.parent.setEditingState(!1),this.parent.updateToolbar(r.AnnotationEditorType.FREETEXT),super.enableEditMode(),this.enableEditing(),this.overlayDiv.classList.remove("enabled"),this.editorDiv.contentEditable=!0,this.div.draggable=!1,this.editorDiv.addEventListener("keydown",this.#_e),this.editorDiv.addEventListener("focus",this.#be),this.editorDiv.addEventListener("blur",this.#ye))}disableEditMode(){this.isInEditMode()&&(this.parent.setEditingState(!0),super.disableEditMode(),this.disableEditing(),this.overlayDiv.classList.add("enabled"),this.editorDiv.contentEditable=!1,this.div.draggable=!0,this.editorDiv.removeEventListener("keydown",this.#_e),this.editorDiv.removeEventListener("focus",this.#be),this.editorDiv.removeEventListener("blur",this.#ye),this.div.focus(),this.isEditing=!1)}focusin(e){super.focusin(e),e.target!==this.editorDiv&&this.editorDiv.focus()}onceAdded(){this.width||(this.enableEditMode(),this.editorDiv.focus())}isEmpty(){return!this.editorDiv||""===this.editorDiv.innerText.trim()}remove(){this.isEditing=!1,this.parent.setEditingState(!0),super.remove()}#Re(){const e=this.editorDiv.getElementsByTagName("div");if(0===e.length)return this.editorDiv.innerText;const t=[];for(let n=0,r=e.length;n<r;n++){const r=e[n].firstChild;"#text"===r?.nodeName?t.push(r.data):t.push("")}return t.join("\n")}#xe(){const[e,t]=this.parent.viewportBaseDimensions,n=this.div.getBoundingClientRect();this.width=n.width/e,this.height=n.height/t}commit(){super.commit(),this.#Se||(this.#Se=!0,this.parent.addUndoableEditor(this)),this.disableEditMode(),this.#Ee=this.#Re().trimEnd(),this.#xe()}shouldGetKeyboardEvents(){return this.isInEditMode()}dblclick(e){this.enableEditMode(),this.editorDiv.focus()}keydown(e){e.target===this.div&&"Enter"===e.key&&(this.enableEditMode(),this.editorDiv.focus())}editorDivKeydown(e){a._keyboardManager.exec(this,e)}editorDivFocus(e){this.isEditing=!0}editorDivBlur(e){this.isEditing=!1}disableEditing(){this.editorDiv.setAttribute("role","comment"),this.editorDiv.removeAttribute("aria-multiline")}enableEditing(){this.editorDiv.setAttribute("role","textbox"),this.editorDiv.setAttribute("aria-multiline",!0)}render(){if(this.div)return this.div;let e,t;this.width&&(e=this.x,t=this.y),super.render(),this.editorDiv=document.createElement("div"),this.editorDiv.className="internal",this.editorDiv.setAttribute("id",`${this.id}-editor`),this.enableEditing(),a._l10nPromise.get("editor_free_text_aria_label").then((e=>this.editorDiv?.setAttribute("aria-label",e))),a._l10nPromise.get("free_text_default_content").then((e=>this.editorDiv?.setAttribute("default-content",e))),this.editorDiv.contentEditable=!0;const{style:n}=this.editorDiv;if(n.fontSize=`calc(${this.#Ce}px * var(--scale-factor))`,n.color=this.#we,this.div.append(this.editorDiv),this.overlayDiv=document.createElement("div"),this.overlayDiv.classList.add("overlay","enabled"),this.div.append(this.overlayDiv),(0,i.bindEvents)(this,this.div,["dblclick","keydown"]),this.width){const[n,r]=this.parent.viewportBaseDimensions;this.setAt(e*n,t*r,this.width*n,this.height*r);for(const e of this.#Ee.split("\n")){const t=document.createElement("div");t.append(e?document.createTextNode(e):document.createElement("br")),this.editorDiv.append(t)}this.div.draggable=!0,this.editorDiv.contentEditable=!1}else this.div.draggable=!1,this.editorDiv.contentEditable=!0;return this.div}get contentDiv(){return this.editorDiv}static deserialize(e,t){const n=super.deserialize(e,t);return n.#Ce=e.fontSize,n.#we=r.Util.makeHexColor(...e.color),n.#Ee=e.value,n}serialize(){if(this.isEmpty())return null;const e=a._internalPadding*this.parent.scaleFactor,t=this.getRect(e,e),n=s.AnnotationEditor._colorManager.convert(getComputedStyle(this.editorDiv).color);return{annotationType:r.AnnotationEditorType.FREETEXT,color:n,fontSize:this.#Ce,value:this.#Ee,pageIndex:this.parent.pageIndex,rect:t,rotation:this.rotation}}}t.FreeTextEditor=a},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.InkEditor=void 0,Object.defineProperty(t,"fitCurve",{enumerable:!0,get:function(){return s.fitCurve}});var r=n(1),i=n(6),s=n(25),a=n(7);const o=16;class l extends i.AnnotationEditor{#Te=0;#Me=0;#Le=0;#Ie=this.canvasPointermove.bind(this);#ke=this.canvasPointerleave.bind(this);#Oe=this.canvasPointerup.bind(this);#Fe=this.canvasPointerdown.bind(this);#De=!1;#Ne=!1;#Ue=null;#je=null;#$e=0;#He=0;#Be=null;static _defaultColor=null;static _defaultOpacity=1;static _defaultThickness=1;static _l10nPromise;static _type="ink";constructor(e){super({...e,name:"inkEditor"}),this.color=e.color||null,this.thickness=e.thickness||null,this.opacity=e.opacity||null,this.paths=[],this.bezierPath2D=[],this.currentPath=[],this.scaleFactor=1,this.translationX=this.translationY=0,this.x=0,this.y=0}static initialize(e){this._l10nPromise=new Map(["editor_ink_canvas_aria_label","editor_ink_aria_label"].map((t=>[t,e.get(t)])))}static updateDefaultParams(e,t){switch(e){case r.AnnotationEditorParamsType.INK_THICKNESS:l._defaultThickness=t;break;case r.AnnotationEditorParamsType.INK_COLOR:l._defaultColor=t;break;case r.AnnotationEditorParamsType.INK_OPACITY:l._defaultOpacity=t/100}}updateParams(e,t){switch(e){case r.AnnotationEditorParamsType.INK_THICKNESS:this.#Ve(t);break;case r.AnnotationEditorParamsType.INK_COLOR:this.#Pe(t);break;case r.AnnotationEditorParamsType.INK_OPACITY:this.#We(t)}}static get defaultPropertiesToUpdate(){return[[r.AnnotationEditorParamsType.INK_THICKNESS,l._defaultThickness],[r.AnnotationEditorParamsType.INK_COLOR,l._defaultColor||i.AnnotationEditor._defaultLineColor],[r.AnnotationEditorParamsType.INK_OPACITY,Math.round(100*l._defaultOpacity)]]}get propertiesToUpdate(){return[[r.AnnotationEditorParamsType.INK_THICKNESS,this.thickness||l._defaultThickness],[r.AnnotationEditorParamsType.INK_COLOR,this.color||l._defaultColor||i.AnnotationEditor._defaultLineColor],[r.AnnotationEditorParamsType.INK_OPACITY,Math.round(100*(this.opacity??l._defaultOpacity))]]}#Ve(e){const t=this.thickness;this.parent.addCommands({cmd:()=>{this.thickness=e,this.#qe()},undo:()=>{this.thickness=t,this.#qe()},mustExec:!0,type:r.AnnotationEditorParamsType.INK_THICKNESS,overwriteIfSameType:!0,keepUndo:!0})}#Pe(e){const t=this.color;this.parent.addCommands({cmd:()=>{this.color=e,this.#ze()},undo:()=>{this.color=t,this.#ze()},mustExec:!0,type:r.AnnotationEditorParamsType.INK_COLOR,overwriteIfSameType:!0,keepUndo:!0})}#We(e){e/=100;const t=this.opacity;this.parent.addCommands({cmd:()=>{this.opacity=e,this.#ze()},undo:()=>{this.opacity=t,this.#ze()},mustExec:!0,type:r.AnnotationEditorParamsType.INK_OPACITY,overwriteIfSameType:!0,keepUndo:!0})}rebuild(){super.rebuild(),null!==this.div&&(this.canvas||(this.#Ge(),this.#Qe()),this.isAttachedToDOM||(this.parent.add(this),this.#Xe()),this.#qe())}remove(){null!==this.canvas&&(this.isEmpty()||this.commit(),this.canvas.width=this.canvas.height=0,this.canvas.remove(),this.canvas=null,this.#je.disconnect(),this.#je=null,super.remove())}enableEditMode(){this.#De||null===this.canvas||(super.enableEditMode(),this.div.draggable=!1,this.canvas.addEventListener("pointerdown",this.#Fe),this.canvas.addEventListener("pointerup",this.#Oe))}disableEditMode(){this.isInEditMode()&&null!==this.canvas&&(super.disableEditMode(),this.div.draggable=!this.isEmpty(),this.div.classList.remove("editing"),this.canvas.removeEventListener("pointerdown",this.#Fe),this.canvas.removeEventListener("pointerup",this.#Oe))}onceAdded(){this.div.draggable=!this.isEmpty()}isEmpty(){return 0===this.paths.length||1===this.paths.length&&0===this.paths[0].length}#Ke(){const{width:e,height:t,rotation:n}=this.parent.viewport;switch(n){case 90:return[0,e,e,t];case 180:return[e,t,e,t];case 270:return[t,0,e,t];default:return[0,0,e,t]}}#Ye(){this.ctx.lineWidth=this.thickness*this.parent.scaleFactor/this.scaleFactor,this.ctx.lineCap="round",this.ctx.lineJoin="round",this.ctx.miterLimit=10,this.ctx.strokeStyle=`${this.color}${(0,a.opacityToHex)(this.opacity)}`}#Je(e,t){this.isEditing=!0,this.#Ne||(this.#Ne=!0,this.#Xe(),this.thickness||=l._defaultThickness,this.color||=l._defaultColor||i.AnnotationEditor._defaultLineColor,this.opacity??=l._defaultOpacity),this.currentPath.push([e,t]),this.#Ue=null,this.#Ye(),this.ctx.beginPath(),this.ctx.moveTo(e,t),this.#Be=()=>{this.#Be&&(this.#Ue&&(this.isEmpty()?(this.ctx.setTransform(1,0,0,1,0,0),this.ctx.clearRect(0,0,this.canvas.width,this.canvas.height)):this.#ze(),this.ctx.lineTo(...this.#Ue),this.#Ue=null,this.ctx.stroke()),window.requestAnimationFrame(this.#Be))},window.requestAnimationFrame(this.#Be)}#Ze(e,t){const[n,r]=this.currentPath.at(-1);e===n&&t===r||(this.currentPath.push([e,t]),this.#Ue=[e,t])}#et(e,t){this.ctx.closePath(),this.#Be=null,e=Math.min(Math.max(e,0),this.canvas.width),t=Math.min(Math.max(t,0),this.canvas.height);const[n,r]=this.currentPath.at(-1);let i;if(e===n&&t===r||this.currentPath.push([e,t]),1!==this.currentPath.length)i=(0,s.fitCurve)(this.currentPath,30,null);else{const n=[e,t];i=[[n,n.slice(),n.slice(),n]]}const a=l.#tt(i);this.currentPath.length=0,this.parent.addCommands({cmd:()=>{this.paths.push(i),this.bezierPath2D.push(a),this.rebuild()},undo:()=>{this.paths.pop(),this.bezierPath2D.pop(),0===this.paths.length?this.remove():(this.canvas||(this.#Ge(),this.#Qe()),this.#qe())},mustExec:!0})}#ze(){if(this.isEmpty())return void this.#nt();this.#Ye();const{canvas:e,ctx:t}=this;t.setTransform(1,0,0,1,0,0),t.clearRect(0,0,e.width,e.height),this.#nt();for(const e of this.bezierPath2D)t.stroke(e)}commit(){this.#De||(super.commit(),this.isEditing=!1,this.disableEditMode(),this.setInForeground(),this.#De=!0,this.div.classList.add("disabled"),this.#qe(!0),this.parent.addInkEditorIfNeeded(!0),this.parent.moveEditorInDOM(this),this.div.focus())}focusin(e){super.focusin(e),this.enableEditMode()}canvasPointerdown(e){0===e.button&&this.isInEditMode()&&!this.#De&&(this.setInForeground(),"mouse"!==e.type&&this.div.focus(),e.stopPropagation(),this.canvas.addEventListener("pointerleave",this.#ke),this.canvas.addEventListener("pointermove",this.#Ie),this.#Je(e.offsetX,e.offsetY))}canvasPointermove(e){e.stopPropagation(),this.#Ze(e.offsetX,e.offsetY)}canvasPointerup(e){0===e.button&&this.isInEditMode()&&0!==this.currentPath.length&&(e.stopPropagation(),this.#rt(e),this.setInBackground())}canvasPointerleave(e){this.#rt(e),this.setInBackground()}#rt(e){this.#et(e.offsetX,e.offsetY),this.canvas.removeEventListener("pointerleave",this.#ke),this.canvas.removeEventListener("pointermove",this.#Ie),this.parent.addToAnnotationStorage(this)}#Ge(){this.canvas=document.createElement("canvas"),this.canvas.width=this.canvas.height=0,this.canvas.className="inkEditorCanvas",l._l10nPromise.get("editor_ink_canvas_aria_label").then((e=>this.canvas?.setAttribute("aria-label",e))),this.div.append(this.canvas),this.ctx=this.canvas.getContext("2d")}#Qe(){this.#je=new ResizeObserver((e=>{const t=e[0].contentRect;t.width&&t.height&&this.setDimensions(t.width,t.height)})),this.#je.observe(this.div)}render(){if(this.div)return this.div;let e,t;this.width&&(e=this.x,t=this.y),super.render(),l._l10nPromise.get("editor_ink_aria_label").then((e=>this.div?.setAttribute("aria-label",e)));const[n,r,i,s]=this.#Ke();if(this.setAt(n,r,0,0),this.setDims(i,s),this.#Ge(),this.width){const[n,r]=this.parent.viewportBaseDimensions;this.setAt(e*n,t*r,this.width*n,this.height*r),this.#Ne=!0,this.#Xe(),this.setDims(this.width*n,this.height*r),this.#ze(),this.#it(),this.div.classList.add("disabled")}else this.div.classList.add("editing"),this.enableEditMode();return this.#Qe(),this.div}#Xe(){if(!this.#Ne)return;const[e,t]=this.parent.viewportBaseDimensions;this.canvas.width=Math.ceil(this.width*e),this.canvas.height=Math.ceil(this.height*t),this.#nt()}setDimensions(e,t){const n=Math.round(e),r=Math.round(t);if(this.#$e===n&&this.#He===r)return;this.#$e=n,this.#He=r,this.canvas.style.visibility="hidden",this.#Te&&Math.abs(this.#Te-e/t)>.01&&(t=Math.ceil(e/this.#Te),this.setDims(e,t));const[i,s]=this.parent.viewportBaseDimensions;this.width=e/i,this.height=t/s,this.#De&&this.#st(e,t),this.#Xe(),this.#ze(),this.canvas.style.visibility="visible"}#st(e,t){const n=this.#at(),r=(e-n)/this.#Le,i=(t-n)/this.#Me;this.scaleFactor=Math.min(r,i)}#nt(){const e=this.#at()/2;this.ctx.setTransform(this.scaleFactor,0,0,this.scaleFactor,this.translationX*this.scaleFactor+e,this.translationY*this.scaleFactor+e)}static#tt(e){const t=new Path2D;for(let n=0,r=e.length;n<r;n++){const[r,i,s,a]=e[n];0===n&&t.moveTo(...r),t.bezierCurveTo(i[0],i[1],s[0],s[1],a[0],a[1])}return t}#ot(e,t,n,r){const i=[],s=this.thickness/2;let a,o;for(const l of this.paths){a=[],o=[];for(let i=0,c=l.length;i<c;i++){const[c,u,d,h]=l[i],p=e*(c[0]+t)+s,f=r-e*(c[1]+n)-s,g=e*(u[0]+t)+s,m=r-e*(u[1]+n)-s,v=e*(d[0]+t)+s,y=r-e*(d[1]+n)-s,b=e*(h[0]+t)+s,_=r-e*(h[1]+n)-s;0===i&&(a.push(p,f),o.push(p,f)),a.push(g,m,v,y,b,_),this.#lt(p,f,g,m,v,y,b,_,4,o)}i.push({bezier:a,points:o})}return i}#lt(e,t,n,r,i,s,a,o,l,c){if(this.#ct(e,t,n,r,i,s,a,o))c.push(a,o);else{for(let u=1;u<l-1;u++){const d=u/l,h=1-d;let p=d*e+h*n,f=d*t+h*r,g=d*n+h*i,m=d*r+h*s;p=d*p+h*g,f=d*f+h*m,g=d*g+h*(d*i+h*a),m=d*m+h*(d*s+h*o),p=d*p+h*g,f=d*f+h*m,c.push(p,f)}c.push(a,o)}}#ct(e,t,n,r,i,s,a,o){const l=(3*n-2*e-a)**2,c=(3*r-2*t-o)**2,u=(3*i-e-2*a)**2,d=(3*s-t-2*o)**2;return Math.max(l,u)+Math.max(c,d)<=10}#ut(){let e=1/0,t=-1/0,n=1/0,i=-1/0;for(const s of this.paths)for(const[a,o,l,c]of s){const s=r.Util.bezierBoundingBox(...a,...o,...l,...c);e=Math.min(e,s[0]),n=Math.min(n,s[1]),t=Math.max(t,s[2]),i=Math.max(i,s[3])}return[e,n,t,i]}#at(){return this.#De?Math.ceil(this.thickness*this.parent.scaleFactor):0}#qe(e=!1){if(this.isEmpty())return;if(!this.#De)return void this.#ze();const t=this.#ut(),n=this.#at();this.#Le=Math.max(o,t[2]-t[0]),this.#Me=Math.max(o,t[3]-t[1]);const r=Math.ceil(n+this.#Le*this.scaleFactor),i=Math.ceil(n+this.#Me*this.scaleFactor),[s,a]=this.parent.viewportBaseDimensions;this.width=r/s,this.height=i/a,this.#Te=r/i,this.#it();const l=this.translationX,c=this.translationY;this.translationX=-t[0],this.translationY=-t[1],this.#Xe(),this.#ze(),this.#$e=r,this.#He=i,this.setDims(r,i);const u=e?n/this.scaleFactor/2:0;this.translate(l-this.translationX-u,c-this.translationY-u)}#it(){const{style:e}=this.div;this.#Te>=1?(e.minHeight="16px",e.minWidth=`${Math.round(this.#Te*o)}px`):(e.minWidth="16px",e.minHeight=`${Math.round(o/this.#Te)}px`)}static deserialize(e,t){const n=super.deserialize(e,t);n.thickness=e.thickness,n.color=r.Util.makeHexColor(...e.color),n.opacity=e.opacity;const[i,s]=t.pageDimensions,a=n.width*i,l=n.height*s,c=t.scaleFactor,u=e.thickness/2;n.#Te=a/l,n.#De=!0,n.#$e=Math.round(a),n.#He=Math.round(l);for(const{bezier:t}of e.paths){const e=[];n.paths.push(e);let r=c*(t[0]-u),i=c*(l-t[1]-u);for(let n=2,s=t.length;n<s;n+=6){const s=c*(t[n]-u),a=c*(l-t[n+1]-u),o=c*(t[n+2]-u),d=c*(l-t[n+3]-u),h=c*(t[n+4]-u),p=c*(l-t[n+5]-u);e.push([[r,i],[s,a],[o,d],[h,p]]),r=h,i=p}const s=this.#tt(e);n.bezierPath2D.push(s)}const d=n.#ut();return n.#Le=Math.max(o,d[2]-d[0]),n.#Me=Math.max(o,d[3]-d[1]),n.#st(a,l),n}serialize(){if(this.isEmpty())return null;const e=this.getRect(0,0),t=this.rotation%180==0?e[3]-e[1]:e[2]-e[0],n=i.AnnotationEditor._colorManager.convert(this.ctx.strokeStyle);return{annotationType:r.AnnotationEditorType.INK,color:n,thickness:this.thickness,opacity:this.opacity,paths:this.#ot(this.scaleFactor/this.parent.scaleFactor,this.translationX,this.translationY,t),pageIndex:this.parent.pageIndex,rect:e,rotation:this.rotation}}}t.InkEditor=l},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.fitCurve=void 0;const r=n(26);t.fitCurve=r},e=>{function t(e,i,s,a,o){var c,u,d,h,p,f,g,m,v,y,b,_,w;if(2===e.length)return _=l.vectorLen(l.subtract(e[0],e[1]))/3,[c=[e[0],l.addArrays(e[0],l.mulItems(i,_)),l.addArrays(e[1],l.mulItems(s,_)),e[1]]];if(u=function(e){var t,n,r,i=[];return e.forEach(((e,s)=>{t=s?n+l.vectorLen(l.subtract(e,r)):0,i.push(t),n=t,r=e})),i=i.map((e=>e/n))}(e),[c,h,f]=n(e,u,u,i,s,o),0===h||h<a)return[c];if(h<a*a)for(d=u,p=h,g=f,w=0;w<20;w++){if(d=r(c,e,d),[c,h,f]=n(e,u,d,i,s,o),h<a)return[c];if(f===g){let e=h/p;if(e>.9999&&e<1.0001)break}p=h,g=f}return b=[],(m=l.subtract(e[f-1],e[f+1])).every((e=>0===e))&&(m=l.subtract(e[f-1],e[f]),[m[0],m[1]]=[-m[1],m[0]]),v=l.normalize(m),y=l.mulItems(v,-1),b=(b=b.concat(t(e.slice(0,f+1),i,v,a,o))).concat(t(e.slice(f),y,s,a,o))}function n(e,t,n,r,i,o){var u,d,h;return u=function(e,t,n,r){var i,s,a,o,u,d,h,p,f,g,m,v,y,b,_,w,E,S=e[0],C=e[e.length-1];for(i=[S,null,null,C],s=l.zeros_Xx2x2(t.length),y=0,b=t.length;y<b;y++)E=1-(w=t[y]),(a=s[y])[0]=l.mulItems(n,3*w*(E*E)),a[1]=l.mulItems(r,3*E*(w*w));for(o=[[0,0],[0,0]],u=[0,0],y=0,b=e.length;y<b;y++)w=t[y],a=s[y],o[0][0]+=l.dot(a[0],a[0]),o[0][1]+=l.dot(a[0],a[1]),o[1][0]+=l.dot(a[0],a[1]),o[1][1]+=l.dot(a[1],a[1]),_=l.subtract(e[y],c.q([S,S,C,C],w)),u[0]+=l.dot(a[0],_),u[1]+=l.dot(a[1],_);return d=o[0][0]*o[1][1]-o[1][0]*o[0][1],h=o[0][0]*u[1]-o[1][0]*u[0],p=u[0]*o[1][1]-u[1]*o[0][1],f=0===d?0:p/d,g=0===d?0:h/d,v=l.vectorLen(l.subtract(S,C)),f<(m=1e-6*v)||g<m?(i[1]=l.addArrays(S,l.mulItems(n,v/3)),i[2]=l.addArrays(C,l.mulItems(r,v/3))):(i[1]=l.addArrays(S,l.mulItems(n,f)),i[2]=l.addArrays(C,l.mulItems(r,g))),i}(e,n,r,i),[d,h]=function(e,t,n){var r,i,o,u,d,h,p,f;i=0,o=Math.floor(e.length/2);const g=s(t,10);for(d=0,h=e.length;d<h;d++)p=e[d],f=a(0,n[d],g,10),(r=(u=l.subtract(c.q(t,f),p))[0]*u[0]+u[1]*u[1])>i&&(i=r,o=d);return[i,o]}(e,u,t),o&&o({bez:u,points:e,params:t,maxErr:d,maxPoint:h}),[u,d,h]}function r(e,t,n){return n.map(((n,r)=>i(e,t[r],n)))}function i(e,t,n){var r=l.subtract(c.q(e,n),t),i=c.qprime(e,n),s=l.mulMatrix(r,i),a=l.sum(l.squareItems(i))+2*l.mulMatrix(r,c.qprimeprime(e,n));return 0===a?n:n-s/a}var s=function(e,t){for(var n,r=[0],i=e[0],s=0,a=1;a<=t;a++)n=c.q(e,a/t),s+=l.vectorLen(l.subtract(n,i)),r.push(s),i=n;return r=r.map((e=>e/s))};function a(e,t,n,r){if(t<0)return 0;if(t>1)return 1;for(var i,s,a,o,l=1;l<=r;l++)if(t<=n[l]){a=(l-1)/r,s=l/r,o=(t-(i=n[l-1]))/(n[l]-i)*(s-a)+a;break}return o}function o(e,t){return l.normalize(l.subtract(e,t))}class l{static zeros_Xx2x2(e){for(var t=[];e--;)t.push([0,0]);return t}static mulItems(e,t){return e.map((e=>e*t))}static mulMatrix(e,t){return e.reduce(((e,n,r)=>e+n*t[r]),0)}static subtract(e,t){return e.map(((e,n)=>e-t[n]))}static addArrays(e,t){return e.map(((e,n)=>e+t[n]))}static addItems(e,t){return e.map((e=>e+t))}static sum(e){return e.reduce(((e,t)=>e+t))}static dot(e,t){return l.mulMatrix(e,t)}static vectorLen(e){return Math.hypot(...e)}static divItems(e,t){return e.map((e=>e/t))}static squareItems(e){return e.map((e=>e*e))}static normalize(e){return this.divItems(e,this.vectorLen(e))}}class c{static q(e,t){var n=1-t,r=l.mulItems(e[0],n*n*n),i=l.mulItems(e[1],3*n*n*t),s=l.mulItems(e[2],3*n*t*t),a=l.mulItems(e[3],t*t*t);return l.addArrays(l.addArrays(r,i),l.addArrays(s,a))}static qprime(e,t){var n=1-t,r=l.mulItems(l.subtract(e[1],e[0]),3*n*n),i=l.mulItems(l.subtract(e[2],e[1]),6*n*t),s=l.mulItems(l.subtract(e[3],e[2]),3*t*t);return l.addArrays(l.addArrays(r,i),s)}static qprimeprime(e,t){return l.addArrays(l.mulItems(l.addArrays(l.subtract(e[2],l.mulItems(e[1],2)),e[0]),6*(1-t)),l.mulItems(l.addArrays(l.subtract(e[3],l.mulItems(e[2],2)),e[1]),6*t))}}e.exports=function(e,n,r){if(!Array.isArray(e))throw new TypeError("First argument should be an array");if(e.forEach((t=>{if(!Array.isArray(t)||t.some((e=>"number"!=typeof e))||t.length!==e[0].length)throw Error("Each point should be an array of numbers. Each point should have the same amount of numbers.")})),e=e.filter(((t,n)=>0===n||!t.every(((t,r)=>t===e[n-1][r])))),e.length<2)return[];const i=e.length,s=o(e[1],e[0]),a=o(e[i-2],e[i-1]);return t(e,s,a,n,r)},e.exports.fitCubic=t,e.exports.createTangent=o},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AnnotationLayer=void 0;var r=n(1),i=n(8),s=n(5),a=n(28),o=n(29);const l=1e3,c=new WeakSet;function u(e){return{width:e[2]-e[0],height:e[3]-e[1]}}class d{static create(e){switch(e.data.annotationType){case r.AnnotationType.LINK:return new p(e);case r.AnnotationType.TEXT:return new f(e);case r.AnnotationType.WIDGET:switch(e.data.fieldType){case"Tx":return new m(e);case"Btn":return e.data.radioButton?new y(e):e.data.checkBox?new v(e):new b(e);case"Ch":return new _(e)}return new g(e);case r.AnnotationType.POPUP:return new w(e);case r.AnnotationType.FREETEXT:return new S(e);case r.AnnotationType.LINE:return new C(e);case r.AnnotationType.SQUARE:return new A(e);case r.AnnotationType.CIRCLE:return new P(e);case r.AnnotationType.POLYLINE:return new x(e);case r.AnnotationType.CARET:return new T(e);case r.AnnotationType.INK:return new M(e);case r.AnnotationType.POLYGON:return new R(e);case r.AnnotationType.HIGHLIGHT:return new L(e);case r.AnnotationType.UNDERLINE:return new I(e);case r.AnnotationType.SQUIGGLY:return new k(e);case r.AnnotationType.STRIKEOUT:return new O(e);case r.AnnotationType.STAMP:return new F(e);case r.AnnotationType.FILEATTACHMENT:return new D(e);default:return new h(e)}}}class h{constructor(e,{isRenderable:t=!1,ignoreBorder:n=!1,createQuadrilaterals:r=!1}={}){this.isRenderable=t,this.data=e.data,this.layer=e.layer,this.page=e.page,this.viewport=e.viewport,this.linkService=e.linkService,this.downloadManager=e.downloadManager,this.imageResourcesPath=e.imageResourcesPath,this.renderForms=e.renderForms,this.svgFactory=e.svgFactory,this.annotationStorage=e.annotationStorage,this.enableScripting=e.enableScripting,this.hasJSActions=e.hasJSActions,this._fieldObjects=e.fieldObjects,this._mouseState=e.mouseState,t&&(this.container=this._createContainer(n)),r&&(this.quadrilaterals=this._createQuadrilaterals(n))}_createContainer(e=!1){const t=this.data,n=this.page,i=this.viewport,s=document.createElement("section"),{width:a,height:o}=u(t.rect),[l,c,d,h]=i.viewBox,p=d-l,f=h-c;s.setAttribute("data-annotation-id",t.id);const g=r.Util.normalizeRect([t.rect[0],n.view[3]-t.rect[1]+n.view[1],t.rect[2],n.view[3]-t.rect[3]+n.view[1]]);if(!e&&t.borderStyle.width>0){s.style.borderWidth=`${t.borderStyle.width}px`;const e=t.borderStyle.horizontalCornerRadius,n=t.borderStyle.verticalCornerRadius;if(e>0||n>0){const t=`calc(${e}px * var(--scale-factor)) / calc(${n}px * var(--scale-factor))`;s.style.borderRadius=t}else if(this instanceof y){const e=`calc(${a}px * var(--scale-factor)) / calc(${o}px * var(--scale-factor))`;s.style.borderRadius=e}switch(t.borderStyle.style){case r.AnnotationBorderStyleType.SOLID:s.style.borderStyle="solid";break;case r.AnnotationBorderStyleType.DASHED:s.style.borderStyle="dashed";break;case r.AnnotationBorderStyleType.BEVELED:(0,r.warn)("Unimplemented border style: beveled");break;case r.AnnotationBorderStyleType.INSET:(0,r.warn)("Unimplemented border style: inset");break;case r.AnnotationBorderStyleType.UNDERLINE:s.style.borderBottomStyle="solid"}const i=t.borderColor||null;i?s.style.borderColor=r.Util.makeHexColor(0|i[0],0|i[1],0|i[2]):s.style.borderWidth=0}s.style.left=100*(g[0]-l)/p+"%",s.style.top=100*(g[1]-c)/f+"%";const{rotation:m}=t;return t.hasOwnCanvas||0===m?(s.style.width=100*a/p+"%",s.style.height=100*o/f+"%"):this.setRotation(m,s),s}setRotation(e,t=this.container){const[n,r,i,s]=this.viewport.viewBox,a=i-n,o=s-r,{width:l,height:c}=u(this.data.rect);let d,h;e%180==0?(d=100*l/a,h=100*c/o):(d=100*c/a,h=100*l/o),t.style.width=`${d}%`,t.style.height=`${h}%`,t.setAttribute("data-main-rotation",(360-e)%360)}get _commonActions(){const e=(e,t,n)=>{const r=n.detail[e];n.target.style[t]=a.ColorConverters[`${r[0]}_HTML`](r.slice(1))};return(0,r.shadow)(this,"_commonActions",{display:e=>{const t=e.detail.display%2==1;this.container.style.visibility=t?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{hidden:t,print:0===e.detail.display||3===e.detail.display})},print:e=>{this.annotationStorage.setValue(this.data.id,{print:e.detail.print})},hidden:e=>{this.container.style.visibility=e.detail.hidden?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{hidden:e.detail.hidden})},focus:e=>{setTimeout((()=>e.target.focus({preventScroll:!1})),0)},userName:e=>{e.target.title=e.detail.userName},readonly:e=>{e.detail.readonly?e.target.setAttribute("readonly",""):e.target.removeAttribute("readonly")},required:e=>{this._setRequired(e.target,e.detail.required)},bgColor:t=>{e("bgColor","backgroundColor",t)},fillColor:t=>{e("fillColor","backgroundColor",t)},fgColor:t=>{e("fgColor","color",t)},textColor:t=>{e("textColor","color",t)},borderColor:t=>{e("borderColor","borderColor",t)},strokeColor:t=>{e("strokeColor","borderColor",t)},rotation:e=>{const t=e.detail.rotation;this.setRotation(t),this.annotationStorage.setValue(this.data.id,{rotation:t})}})}_dispatchEventFromSandbox(e,t){const n=this._commonActions;for(const r of Object.keys(t.detail)){const i=e[r]||n[r];i&&i(t)}}_setDefaultPropertiesFromJS(e){if(!this.enableScripting)return;const t=this.annotationStorage.getRawValue(this.data.id);if(!t)return;const n=this._commonActions;for(const[r,i]of Object.entries(t)){const s=n[r];s&&(s({detail:{[r]:i},target:e}),delete t[r])}}_createQuadrilaterals(e=!1){if(!this.data.quadPoints)return null;const t=[],n=this.data.rect;for(const n of this.data.quadPoints)this.data.rect=[n[2].x,n[2].y,n[1].x,n[1].y],t.push(this._createContainer(e));return this.data.rect=n,t}_createPopup(e,t){let n=this.container;this.quadrilaterals&&(e=e||this.quadrilaterals,n=this.quadrilaterals[0]),e||((e=document.createElement("div")).className="popupTriggerArea",n.append(e));const r=new E({container:n,trigger:e,color:t.color,titleObj:t.titleObj,modificationDate:t.modificationDate,contentsObj:t.contentsObj,richText:t.richText,hideWrapper:!0}).render();r.style.left="100%",n.append(r)}_renderQuadrilaterals(e){for(const t of this.quadrilaterals)t.className=e;return this.quadrilaterals}render(){(0,r.unreachable)("Abstract method `AnnotationElement.render` called")}_getElementsByName(e,t=null){const n=[];if(this._fieldObjects){const i=this._fieldObjects[e];if(i)for(const{page:e,id:s,exportValues:a}of i){if(-1===e)continue;if(s===t)continue;const i="string"==typeof a?a:null,o=document.querySelector(`[data-element-id="${s}"]`);!o||c.has(o)?n.push({id:s,exportValue:i,domElement:o}):(0,r.warn)(`_getElementsByName - element not allowed: ${s}`)}return n}for(const r of document.getElementsByName(e)){const{id:e,exportValue:i}=r;e!==t&&c.has(r)&&n.push({id:e,exportValue:i,domElement:r})}return n}static get platform(){const e="undefined"!=typeof navigator?navigator.platform:"";return(0,r.shadow)(this,"platform",{isWin:e.includes("Win"),isMac:e.includes("Mac")})}}class p extends h{constructor(e,t=null){super(e,{isRenderable:!0,ignoreBorder:!!t?.ignoreBorder,createQuadrilaterals:!0}),this.isTooltipOnly=e.data.isTooltipOnly}render(){const{data:e,linkService:t}=this,n=document.createElement("a");n.setAttribute("data-element-id",e.id);let r=!1;return e.url?(t.addLinkAttributes(n,e.url,e.newWindow),r=!0):e.action?(this._bindNamedAction(n,e.action),r=!0):e.dest?(this._bindLink(n,e.dest),r=!0):(e.actions&&(e.actions.Action||e.actions["Mouse Up"]||e.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(n,e),r=!0),e.resetForm?(this._bindResetFormAction(n,e.resetForm),r=!0):this.isTooltipOnly&&!r&&(this._bindLink(n,""),r=!0)),this.quadrilaterals?this._renderQuadrilaterals("linkAnnotation").map(((e,t)=>{const r=0===t?n:n.cloneNode();return e.append(r),e})):(this.container.className="linkAnnotation",r&&this.container.append(n),this.container)}_bindLink(e,t){e.href=this.linkService.getDestinationHash(t),e.onclick=()=>(t&&this.linkService.goToDestination(t),!1),(t||""===t)&&(e.className="internalLink")}_bindNamedAction(e,t){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeNamedAction(t),!1),e.className="internalLink"}_bindJSAction(e,t){e.href=this.linkService.getAnchorUrl("");const n=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const r of Object.keys(t.actions)){const i=n.get(r);i&&(e[i]=()=>(this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t.id,name:r}}),!1))}e.onclick||(e.onclick=()=>!1),e.className="internalLink"}_bindResetFormAction(e,t){const n=e.onclick;if(n||(e.href=this.linkService.getAnchorUrl("")),e.className="internalLink",!this._fieldObjects)return(0,r.warn)('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),void(n||(e.onclick=()=>!1));e.onclick=()=>{n&&n();const{fields:e,refs:i,include:s}=t,a=[];if(0!==e.length||0!==i.length){const t=new Set(i);for(const n of e){const e=this._fieldObjects[n]||[];for(const{id:n}of e)t.add(n)}for(const e of Object.values(this._fieldObjects))for(const n of e)t.has(n.id)===s&&a.push(n)}else for(const e of Object.values(this._fieldObjects))a.push(...e);const o=this.annotationStorage,l=[];for(const e of a){const{id:t}=e;switch(l.push(t),e.type){case"text":{const n=e.defaultValue||"";o.setValue(t,{value:n});break}case"checkbox":case"radiobutton":{const n=e.defaultValue===e.exportValues;o.setValue(t,{value:n});break}case"combobox":case"listbox":{const n=e.defaultValue||"";o.setValue(t,{value:n});break}default:continue}const n=document.querySelector(`[data-element-id="${t}"]`);n&&(c.has(n)?n.dispatchEvent(new Event("resetform")):(0,r.warn)(`_bindResetFormAction - element not allowed: ${t}`))}return this.enableScripting&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:l,name:"ResetForm"}}),!1}}}class f extends h{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.titleObj?.str||e.data.contentsObj?.str||e.data.richText?.str)})}render(){this.container.className="textAnnotation";const e=document.createElement("img");return e.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",e.alt="[{{type}} Annotation]",e.dataset.l10nId="text_annotation_type",e.dataset.l10nArgs=JSON.stringify({type:this.data.name}),this.data.hasPopup||this._createPopup(e,this.data),this.container.append(e),this.container}}class g extends h{render(){return this.data.alternativeText&&(this.container.title=this.data.alternativeText),this.container}_getKeyModifier(e){const{isWin:t,isMac:n}=h.platform;return t&&e.ctrlKey||n&&e.metaKey}_setEventListener(e,t,n,r){t.includes("mouse")?e.addEventListener(t,(e=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:n,value:r(e),shift:e.shiftKey,modifier:this._getKeyModifier(e)}})})):e.addEventListener(t,(e=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:n,value:r(e)}})}))}_setEventListeners(e,t,n){for(const[r,i]of t)("Action"===i||this.data.actions?.[i])&&this._setEventListener(e,r,i,n)}_setBackgroundColor(e){const t=this.data.backgroundColor||null;e.style.backgroundColor=null===t?"transparent":r.Util.makeHexColor(t[0],t[1],t[2])}_setTextStyle(e){const t=["left","center","right"],{fontColor:n}=this.data.defaultAppearanceData,i=this.data.defaultAppearanceData.fontSize||9,s=e.style;let a;if(this.data.multiLine){const e=Math.abs(this.data.rect[3]-this.data.rect[1]),t=e/(Math.round(e/(r.LINE_FACTOR*i))||1);a=Math.min(i,Math.round(t/r.LINE_FACTOR))}else{const e=Math.abs(this.data.rect[3]-this.data.rect[1]);a=Math.min(i,Math.round(e/r.LINE_FACTOR))}s.fontSize=`calc(${a}px * var(--scale-factor))`,s.color=r.Util.makeHexColor(n[0],n[1],n[2]),null!==this.data.textAlignment&&(s.textAlign=t[this.data.textAlignment])}_setRequired(e,t){t?e.setAttribute("required",!0):e.removeAttribute("required"),e.setAttribute("aria-required",t)}}class m extends g{constructor(e){super(e,{isRenderable:e.renderForms||!e.data.hasAppearance&&!!e.data.fieldValue})}setPropertyOnSiblings(e,t,n,r){const i=this.annotationStorage;for(const s of this._getElementsByName(e.name,e.id))s.domElement&&(s.domElement[t]=n),i.setValue(s.id,{[r]:n})}render(){const e=this.annotationStorage,t=this.data.id;this.container.className="textWidgetAnnotation";let n=null;if(this.renderForms){const r=e.getValue(t,{value:this.data.fieldValue});let i=r.formattedValue||r.value||"";const s=e.getValue(t,{charLimit:this.data.maxLen}).charLimit;s&&i.length>s&&(i=i.slice(0,s));const a={userValue:i,formattedValue:null,valueOnFocus:""};this.data.multiLine?(n=document.createElement("textarea"),n.textContent=i,this.data.doNotScroll&&(n.style.overflowY="hidden")):(n=document.createElement("input"),n.type="text",n.setAttribute("value",i),this.data.doNotScroll&&(n.style.overflowX="hidden")),c.add(n),n.setAttribute("data-element-id",t),n.disabled=this.data.readOnly,n.name=this.data.fieldName,n.tabIndex=l,this._setRequired(n,this.data.required),s&&(n.maxLength=s),n.addEventListener("input",(r=>{e.setValue(t,{value:r.target.value}),this.setPropertyOnSiblings(n,"value",r.target.value,"value")})),n.addEventListener("resetform",(e=>{const t=this.data.defaultFieldValue??"";n.value=a.userValue=t,a.formattedValue=null}));let o=e=>{const{formattedValue:t}=a;null!=t&&(e.target.value=t),e.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){n.addEventListener("focus",(e=>{a.userValue&&(e.target.value=a.userValue),a.valueOnFocus=e.target.value})),n.addEventListener("updatefromsandbox",(n=>{const r={value(n){a.userValue=n.detail.value??"",e.setValue(t,{value:a.userValue.toString()}),n.target.value=a.userValue},formattedValue(n){const{formattedValue:r}=n.detail;a.formattedValue=r,null!=r&&n.target!==document.activeElement&&(n.target.value=r),e.setValue(t,{formattedValue:r})},selRange(e){e.target.setSelectionRange(...e.detail.selRange)},charLimit:n=>{const{charLimit:r}=n.detail,{target:i}=n;if(0===r)return void i.removeAttribute("maxLength");i.setAttribute("maxLength",r);let s=a.userValue;!s||s.length<=r||(s=s.slice(0,r),i.value=a.userValue=s,e.setValue(t,{value:s}),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:s,willCommit:!0,commitKey:1,selStart:i.selectionStart,selEnd:i.selectionEnd}}))}};this._dispatchEventFromSandbox(r,n)})),n.addEventListener("keydown",(e=>{let n=-1;if("Escape"===e.key?n=0:"Enter"===e.key?n=2:"Tab"===e.key&&(n=3),-1===n)return;const{value:r}=e.target;a.valueOnFocus!==r&&(a.userValue=r,this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:r,willCommit:!0,commitKey:n,selStart:e.target.selectionStart,selEnd:e.target.selectionEnd}}))}));const r=o;o=null,n.addEventListener("blur",(e=>{const{value:n}=e.target;a.userValue=n,this._mouseState.isDown&&a.valueOnFocus!==n&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:n,willCommit:!0,commitKey:1,selStart:e.target.selectionStart,selEnd:e.target.selectionEnd}}),r(e)})),this.data.actions?.Keystroke&&n.addEventListener("beforeinput",(e=>{const{data:n,target:r}=e,{value:i,selectionStart:s,selectionEnd:a}=r;let o=s,l=a;switch(e.inputType){case"deleteWordBackward":{const e=i.substring(0,s).match(/\w*[^\w]*$/);e&&(o-=e[0].length);break}case"deleteWordForward":{const e=i.substring(s).match(/^[^\w]*\w*/);e&&(l+=e[0].length);break}case"deleteContentBackward":s===a&&(o-=1);break;case"deleteContentForward":s===a&&(l+=1)}e.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:i,change:n||"",willCommit:!1,selStart:o,selEnd:l}})})),this._setEventListeners(n,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(e=>e.target.value))}if(o&&n.addEventListener("blur",o),this.data.comb){const e=(this.data.rect[2]-this.data.rect[0])/s;n.classList.add("comb"),n.style.letterSpacing=`calc(${e}px * var(--scale-factor) - 1ch)`}}else n=document.createElement("div"),n.textContent=this.data.fieldValue,n.style.verticalAlign="middle",n.style.display="table-cell";return this._setTextStyle(n),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class v extends g{constructor(e){super(e,{isRenderable:e.renderForms})}render(){const e=this.annotationStorage,t=this.data,n=t.id;let r=e.getValue(n,{value:t.exportValue===t.fieldValue}).value;"string"==typeof r&&(r="Off"!==r,e.setValue(n,{value:r})),this.container.className="buttonWidgetAnnotation checkBox";const i=document.createElement("input");return c.add(i),i.setAttribute("data-element-id",n),i.disabled=t.readOnly,this._setRequired(i,this.data.required),i.type="checkbox",i.name=t.fieldName,r&&i.setAttribute("checked",!0),i.setAttribute("exportValue",t.exportValue),i.tabIndex=l,i.addEventListener("change",(r=>{const{name:i,checked:s}=r.target;for(const r of this._getElementsByName(i,n)){const n=s&&r.exportValue===t.exportValue;r.domElement&&(r.domElement.checked=n),e.setValue(r.id,{value:n})}e.setValue(n,{value:s})})),i.addEventListener("resetform",(e=>{const n=t.defaultFieldValue||"Off";e.target.checked=n===t.exportValue})),this.enableScripting&&this.hasJSActions&&(i.addEventListener("updatefromsandbox",(t=>{const r={value(t){t.target.checked="Off"!==t.detail.value,e.setValue(n,{value:t.target.checked})}};this._dispatchEventFromSandbox(r,t)})),this._setEventListeners(i,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(e=>e.target.checked))),this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class y extends g{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.className="buttonWidgetAnnotation radioButton";const e=this.annotationStorage,t=this.data,n=t.id;let r=e.getValue(n,{value:t.fieldValue===t.buttonValue}).value;"string"==typeof r&&(r=r!==t.buttonValue,e.setValue(n,{value:r}));const i=document.createElement("input");if(c.add(i),i.setAttribute("data-element-id",n),i.disabled=t.readOnly,this._setRequired(i,this.data.required),i.type="radio",i.name=t.fieldName,r&&i.setAttribute("checked",!0),i.tabIndex=l,i.addEventListener("change",(t=>{const{name:r,checked:i}=t.target;for(const t of this._getElementsByName(r,n))e.setValue(t.id,{value:!1});e.setValue(n,{value:i})})),i.addEventListener("resetform",(e=>{const n=t.defaultFieldValue;e.target.checked=null!=n&&n===t.buttonValue})),this.enableScripting&&this.hasJSActions){const r=t.buttonValue;i.addEventListener("updatefromsandbox",(t=>{const i={value:t=>{const i=r===t.detail.value;for(const r of this._getElementsByName(t.target.name)){const t=i&&r.id===n;r.domElement&&(r.domElement.checked=t),e.setValue(r.id,{value:t})}}};this._dispatchEventFromSandbox(i,t)})),this._setEventListeners(i,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],(e=>e.target.checked))}return this._setBackgroundColor(i),this._setDefaultPropertiesFromJS(i),this.container.append(i),this.container}}class b extends p{constructor(e){super(e,{ignoreBorder:e.data.hasAppearance})}render(){const e=super.render();e.className="buttonWidgetAnnotation pushButton",this.data.alternativeText&&(e.title=this.data.alternativeText);const t=e.lastChild;return this.enableScripting&&this.hasJSActions&&t&&(this._setDefaultPropertiesFromJS(t),t.addEventListener("updatefromsandbox",(e=>{this._dispatchEventFromSandbox({},e)}))),e}}class _ extends g{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.className="choiceWidgetAnnotation";const e=this.annotationStorage,t=this.data.id,n=e.getValue(t,{value:this.data.fieldValue}),r=document.createElement("select");c.add(r),r.setAttribute("data-element-id",t),r.disabled=this.data.readOnly,this._setRequired(r,this.data.required),r.name=this.data.fieldName,r.tabIndex=l;let i=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",(e=>{const t=this.data.defaultFieldValue;for(const e of r.options)e.selected=e.value===t}));for(const e of this.data.options){const t=document.createElement("option");t.textContent=e.displayValue,t.value=e.exportValue,n.value.includes(e.exportValue)&&(t.setAttribute("selected",!0),i=!1),r.append(t)}let s=null;if(i){const e=document.createElement("option");e.value=" ",e.setAttribute("hidden",!0),e.setAttribute("selected",!0),r.prepend(e),s=()=>{e.remove(),r.removeEventListener("input",s),s=null},r.addEventListener("input",s)}const a=(e,t)=>{const n=t?"value":"textContent",r=e.target.options;return e.target.multiple?Array.prototype.filter.call(r,(e=>e.selected)).map((e=>e[n])):-1===r.selectedIndex?null:r[r.selectedIndex][n]},o=e=>{const t=e.target.options;return Array.prototype.map.call(t,(e=>({displayValue:e.textContent,exportValue:e.value})))};return this.enableScripting&&this.hasJSActions?(r.addEventListener("updatefromsandbox",(n=>{const i={value(n){s?.();const i=n.detail.value,o=new Set(Array.isArray(i)?i:[i]);for(const e of r.options)e.selected=o.has(e.value);e.setValue(t,{value:a(n,!0)})},multipleSelection(e){r.multiple=!0},remove(n){const i=r.options,s=n.detail.remove;i[s].selected=!1,r.remove(s),i.length>0&&-1===Array.prototype.findIndex.call(i,(e=>e.selected))&&(i[0].selected=!0),e.setValue(t,{value:a(n,!0),items:o(n)})},clear(n){for(;0!==r.length;)r.remove(0);e.setValue(t,{value:null,items:[]})},insert(n){const{index:i,displayValue:s,exportValue:l}=n.detail.insert,c=r.children[i],u=document.createElement("option");u.textContent=s,u.value=l,c?c.before(u):r.append(u),e.setValue(t,{value:a(n,!0),items:o(n)})},items(n){const{items:i}=n.detail;for(;0!==r.length;)r.remove(0);for(const e of i){const{displayValue:t,exportValue:n}=e,i=document.createElement("option");i.textContent=t,i.value=n,r.append(i)}r.options.length>0&&(r.options[0].selected=!0),e.setValue(t,{value:a(n,!0),items:o(n)})},indices(n){const r=new Set(n.detail.indices);for(const e of n.target.options)e.selected=r.has(e.index);e.setValue(t,{value:a(n,!0)})},editable(e){e.target.disabled=!e.detail.editable}};this._dispatchEventFromSandbox(i,n)})),r.addEventListener("input",(n=>{const r=a(n,!0),i=a(n,!1);e.setValue(t,{value:r}),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:t,name:"Keystroke",value:i,changeEx:r,willCommit:!0,commitKey:1,keyDown:!1}})})),this._setEventListeners(r,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"]],(e=>e.target.checked))):r.addEventListener("input",(function(n){e.setValue(t,{value:a(n,!0)})})),this.data.combo&&this._setTextStyle(r),this._setBackgroundColor(r),this._setDefaultPropertiesFromJS(r),this.container.append(r),this.container}}class w extends h{constructor(e){super(e,{isRenderable:!!(e.data.titleObj?.str||e.data.contentsObj?.str||e.data.richText?.str)})}render(){if(this.container.className="popupAnnotation",["Line","Square","Circle","PolyLine","Polygon","Ink"].includes(this.data.parentType))return this.container;const e=`[data-annotation-id="${this.data.parentId}"]`,t=this.layer.querySelectorAll(e);if(0===t.length)return this.container;const n=new E({container:this.container,trigger:Array.from(t),color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate,contentsObj:this.data.contentsObj,richText:this.data.richText}),i=this.page,s=r.Util.normalizeRect([this.data.parentRect[0],i.view[3]-this.data.parentRect[1]+i.view[1],this.data.parentRect[2],i.view[3]-this.data.parentRect[3]+i.view[1]]),a=s[0]+this.data.parentRect[2]-this.data.parentRect[0],o=s[1],[l,c,u,d]=this.viewport.viewBox,h=u-l,p=d-c;return this.container.style.left=100*(a-l)/h+"%",this.container.style.top=100*(o-c)/p+"%",this.container.append(n.render()),this.container}}class E{constructor(e){this.container=e.container,this.trigger=e.trigger,this.color=e.color,this.titleObj=e.titleObj,this.modificationDate=e.modificationDate,this.contentsObj=e.contentsObj,this.richText=e.richText,this.hideWrapper=e.hideWrapper||!1,this.pinned=!1}render(){const e=document.createElement("div");e.className="popupWrapper",this.hideElement=this.hideWrapper?e:this.container,this.hideElement.hidden=!0;const t=document.createElement("div");t.className="popup";const n=this.color;if(n){const e=.7*(255-n[0])+n[0],i=.7*(255-n[1])+n[1],s=.7*(255-n[2])+n[2];t.style.backgroundColor=r.Util.makeHexColor(0|e,0|i,0|s)}const s=document.createElement("h1");s.dir=this.titleObj.dir,s.textContent=this.titleObj.str,t.append(s);const a=i.PDFDateString.toDateObject(this.modificationDate);if(a){const e=document.createElement("span");e.className="popupDate",e.textContent="{{date}}, {{time}}",e.dataset.l10nId="annotation_date_string",e.dataset.l10nArgs=JSON.stringify({date:a.toLocaleDateString(),time:a.toLocaleTimeString()}),t.append(e)}if(!this.richText?.str||this.contentsObj?.str&&this.contentsObj.str!==this.richText.str){const e=this._formatContents(this.contentsObj);t.append(e)}else o.XfaLayer.render({xfaHtml:this.richText.html,intent:"richText",div:t}),t.lastChild.className="richText popupContent";Array.isArray(this.trigger)||(this.trigger=[this.trigger]);for(const e of this.trigger)e.addEventListener("click",this._toggle.bind(this)),e.addEventListener("mouseover",this._show.bind(this,!1)),e.addEventListener("mouseout",this._hide.bind(this,!1));return t.addEventListener("click",this._hide.bind(this,!0)),e.append(t),e}_formatContents({str:e,dir:t}){const n=document.createElement("p");n.className="popupContent",n.dir=t;const r=e.split(/(?:\r\n?|\n)/);for(let e=0,t=r.length;e<t;++e){const i=r[e];n.append(document.createTextNode(i)),e<t-1&&n.append(document.createElement("br"))}return n}_toggle(){this.pinned?this._hide(!0):this._show(!0)}_show(e=!1){e&&(this.pinned=!0),this.hideElement.hidden&&(this.hideElement.hidden=!1,this.container.style.zIndex=parseInt(this.container.style.zIndex)+1e3)}_hide(e=!0){e&&(this.pinned=!1),this.hideElement.hidden||this.pinned||(this.hideElement.hidden=!0,this.container.style.zIndex=parseInt(this.container.style.zIndex)-1e3)}}class S extends h{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.titleObj?.str||e.data.contentsObj?.str||e.data.richText?.str),ignoreBorder:!0}),this.textContent=e.data.textContent}render(){if(this.container.className="freeTextAnnotation",this.textContent){const e=document.createElement("div");e.className="annotationTextContent",e.setAttribute("role","comment");for(const t of this.textContent){const n=document.createElement("span");n.textContent=t,e.append(n)}this.container.append(e)}return this.data.hasPopup||this._createPopup(null,this.data),this.container}}class C extends h{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.titleObj?.str||e.data.contentsObj?.str||e.data.richText?.str),ignoreBorder:!0})}render(){this.container.className="lineAnnotation";const e=this.data,{width:t,height:n}=u(e.rect),r=this.svgFactory.create(t,n,!0),i=this.svgFactory.createElement("svg:line");return i.setAttribute("x1",e.rect[2]-e.lineCoordinates[0]),i.setAttribute("y1",e.rect[3]-e.lineCoordinates[1]),i.setAttribute("x2",e.rect[2]-e.lineCoordinates[2]),i.setAttribute("y2",e.rect[3]-e.lineCoordinates[3]),i.setAttribute("stroke-width",e.borderStyle.width||1),i.setAttribute("stroke","transparent"),i.setAttribute("fill","transparent"),r.append(i),this.container.append(r),this._createPopup(i,e),this.container}}class A extends h{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.titleObj?.str||e.data.contentsObj?.str||e.data.richText?.str),ignoreBorder:!0})}render(){this.container.className="squareAnnotation";const e=this.data,{width:t,height:n}=u(e.rect),r=this.svgFactory.create(t,n,!0),i=e.borderStyle.width,s=this.svgFactory.createElement("svg:rect");return s.setAttribute("x",i/2),s.setAttribute("y",i/2),s.setAttribute("width",t-i),s.setAttribute("height",n-i),s.setAttribute("stroke-width",i||1),s.setAttribute("stroke","transparent"),s.setAttribute("fill","transparent"),r.append(s),this.container.append(r),this._createPopup(s,e),this.container}}class P extends h{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.titleObj?.str||e.data.contentsObj?.str||e.data.richText?.str),ignoreBorder:!0})}render(){this.container.className="circleAnnotation";const e=this.data,{width:t,height:n}=u(e.rect),r=this.svgFactory.create(t,n,!0),i=e.borderStyle.width,s=this.svgFactory.createElement("svg:ellipse");return s.setAttribute("cx",t/2),s.setAttribute("cy",n/2),s.setAttribute("rx",t/2-i/2),s.setAttribute("ry",n/2-i/2),s.setAttribute("stroke-width",i||1),s.setAttribute("stroke","transparent"),s.setAttribute("fill","transparent"),r.append(s),this.container.append(r),this._createPopup(s,e),this.container}}class x extends h{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.titleObj?.str||e.data.contentsObj?.str||e.data.richText?.str),ignoreBorder:!0}),this.containerClassName="polylineAnnotation",this.svgElementName="svg:polyline"}render(){this.container.className=this.containerClassName;const e=this.data,{width:t,height:n}=u(e.rect),r=this.svgFactory.create(t,n,!0);let i=[];for(const t of e.vertices){const n=t.x-e.rect[0],r=e.rect[3]-t.y;i.push(n+","+r)}i=i.join(" ");const s=this.svgFactory.createElement(this.svgElementName);return s.setAttribute("points",i),s.setAttribute("stroke-width",e.borderStyle.width||1),s.setAttribute("stroke","transparent"),s.setAttribute("fill","transparent"),r.append(s),this.container.append(r),this._createPopup(s,e),this.container}}class R extends x{constructor(e){super(e),this.containerClassName="polygonAnnotation",this.svgElementName="svg:polygon"}}class T extends h{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.titleObj?.str||e.data.contentsObj?.str||e.data.richText?.str),ignoreBorder:!0})}render(){return this.container.className="caretAnnotation",this.data.hasPopup||this._createPopup(null,this.data),this.container}}class M extends h{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.titleObj?.str||e.data.contentsObj?.str||e.data.richText?.str),ignoreBorder:!0}),this.containerClassName="inkAnnotation",this.svgElementName="svg:polyline"}render(){this.container.className=this.containerClassName;const e=this.data,{width:t,height:n}=u(e.rect),r=this.svgFactory.create(t,n,!0);for(const t of e.inkLists){let n=[];for(const r of t){const t=r.x-e.rect[0],i=e.rect[3]-r.y;n.push(`${t},${i}`)}n=n.join(" ");const i=this.svgFactory.createElement(this.svgElementName);i.setAttribute("points",n),i.setAttribute("stroke-width",e.borderStyle.width||1),i.setAttribute("stroke","transparent"),i.setAttribute("fill","transparent"),this._createPopup(i,e),r.append(i)}return this.container.append(r),this.container}}class L extends h{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.titleObj?.str||e.data.contentsObj?.str||e.data.richText?.str),ignoreBorder:!0,createQuadrilaterals:!0})}render(){return this.data.hasPopup||this._createPopup(null,this.data),this.quadrilaterals?this._renderQuadrilaterals("highlightAnnotation"):(this.container.className="highlightAnnotation",this.container)}}class I extends h{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.titleObj?.str||e.data.contentsObj?.str||e.data.richText?.str),ignoreBorder:!0,createQuadrilaterals:!0})}render(){return this.data.hasPopup||this._createPopup(null,this.data),this.quadrilaterals?this._renderQuadrilaterals("underlineAnnotation"):(this.container.className="underlineAnnotation",this.container)}}class k extends h{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.titleObj?.str||e.data.contentsObj?.str||e.data.richText?.str),ignoreBorder:!0,createQuadrilaterals:!0})}render(){return this.data.hasPopup||this._createPopup(null,this.data),this.quadrilaterals?this._renderQuadrilaterals("squigglyAnnotation"):(this.container.className="squigglyAnnotation",this.container)}}class O extends h{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.titleObj?.str||e.data.contentsObj?.str||e.data.richText?.str),ignoreBorder:!0,createQuadrilaterals:!0})}render(){return this.data.hasPopup||this._createPopup(null,this.data),this.quadrilaterals?this._renderQuadrilaterals("strikeoutAnnotation"):(this.container.className="strikeoutAnnotation",this.container)}}class F extends h{constructor(e){super(e,{isRenderable:!!(e.data.hasPopup||e.data.titleObj?.str||e.data.contentsObj?.str||e.data.richText?.str),ignoreBorder:!0})}render(){return this.container.className="stampAnnotation",this.data.hasPopup||this._createPopup(null,this.data),this.container}}class D extends h{constructor(e){super(e,{isRenderable:!0});const{filename:t,content:n}=this.data.file;this.filename=(0,i.getFilenameFromUrl)(t),this.content=n,this.linkService.eventBus?.dispatch("fileattachmentannotation",{source:this,filename:t,content:n})}render(){this.container.className="fileAttachmentAnnotation";const e=document.createElement("div");return e.className="popupTriggerArea",e.addEventListener("dblclick",this._download.bind(this)),!this.data.hasPopup&&(this.data.titleObj?.str||this.data.contentsObj?.str||this.data.richText)&&this._createPopup(e,this.data),this.container.append(e),this.container}_download(){this.downloadManager?.openOrDownloadData(this.container,this.content,this.filename)}}class N{static#dt(e,t,n,r){const s=e.firstChild||e;s.id=`${i.AnnotationPrefix}${t}`,n.append(e),r?.moveElementInDOM(n,e,s,!1)}static render(e){const{annotations:t,div:n,viewport:a,accessibilityManager:o}=e;this.#ht(n,a);let l=0;for(const c of t){if(c.annotationType!==r.AnnotationType.POPUP){const{width:e,height:t}=u(c.rect);if(e<=0||t<=0)continue}const t=d.create({data:c,layer:n,page:e.page,viewport:a,linkService:e.linkService,downloadManager:e.downloadManager,imageResourcesPath:e.imageResourcesPath||"",renderForms:!1!==e.renderForms,svgFactory:new i.DOMSVGFactory,annotationStorage:e.annotationStorage||new s.AnnotationStorage,enableScripting:e.enableScripting,hasJSActions:e.hasJSActions,fieldObjects:e.fieldObjects,mouseState:e.mouseState||{isDown:!1}});if(t.isRenderable){const e=t.render();if(c.hidden&&(e.style.visibility="hidden"),Array.isArray(e))for(const t of e)t.style.zIndex=l++,N.#dt(t,c.id,n,o);else e.style.zIndex=l++,t instanceof w?n.prepend(e):N.#dt(e,c.id,n,o)}}this.#pt(n,e.annotationCanvasMap)}static update(e){const{annotationCanvasMap:t,div:n,viewport:r}=e;this.#ht(n,r),this.#pt(n,t),n.hidden=!1}static#ht(e,{width:t,height:n,rotation:r}){const{style:i}=e,s=r%180!=0,a=Math.floor(t)+"px",o=Math.floor(n)+"px";i.width=s?o:a,i.height=s?a:o,e.setAttribute("data-main-rotation",r)}static#pt(e,t){if(t){for(const[n,r]of t){const t=e.querySelector(`[data-annotation-id="${n}"]`);if(!t)continue;const{firstChild:i}=t;i?"CANVAS"===i.nodeName?i.replaceWith(r):i.before(r):t.append(r)}t.clear()}}}t.AnnotationLayer=N},(e,t)=>{function n(e){return Math.floor(255*Math.max(0,Math.min(1,e))).toString(16).padStart(2,"0")}Object.defineProperty(t,"__esModule",{value:!0}),t.ColorConverters=void 0,t.ColorConverters=class{static CMYK_G([e,t,n,r]){return["G",1-Math.min(1,.3*e+.59*n+.11*t+r)]}static G_CMYK([e]){return["CMYK",0,0,0,1-e]}static G_RGB([e]){return["RGB",e,e,e]}static G_HTML([e]){const t=n(e);return`#${t}${t}${t}`}static RGB_G([e,t,n]){return["G",.3*e+.59*t+.11*n]}static RGB_HTML([e,t,r]){return`#${n(e)}${n(t)}${n(r)}`}static T_HTML(){return"#00000000"}static CMYK_RGB([e,t,n,r]){return["RGB",1-Math.min(1,e+r),1-Math.min(1,n+r),1-Math.min(1,t+r)]}static CMYK_HTML(e){const t=this.CMYK_RGB(e).slice(1);return this.RGB_HTML(t)}static RGB_CMYK([e,t,n]){const r=1-e,i=1-t,s=1-n;return["CMYK",r,i,s,Math.min(r,i,s)]}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.XfaLayer=void 0;var r=n(20);t.XfaLayer=class{static setupStorage(e,t,n,r,i){const s=r.getValue(t,{value:null});switch(n.name){case"textarea":if(null!==s.value&&(e.textContent=s.value),"print"===i)break;e.addEventListener("input",(e=>{r.setValue(t,{value:e.target.value})}));break;case"input":if("radio"===n.attributes.type||"checkbox"===n.attributes.type){if(s.value===n.attributes.xfaOn?e.setAttribute("checked",!0):s.value===n.attributes.xfaOff&&e.removeAttribute("checked"),"print"===i)break;e.addEventListener("change",(e=>{r.setValue(t,{value:e.target.checked?e.target.getAttribute("xfaOn"):e.target.getAttribute("xfaOff")})}))}else{if(null!==s.value&&e.setAttribute("value",s.value),"print"===i)break;e.addEventListener("input",(e=>{r.setValue(t,{value:e.target.value})}))}break;case"select":if(null!==s.value)for(const e of n.children)e.attributes.value===s.value&&(e.attributes.selected=!0);e.addEventListener("input",(e=>{const n=e.target.options,i=-1===n.selectedIndex?"":n[n.selectedIndex].value;r.setValue(t,{value:i})}))}}static setAttributes({html:e,element:t,storage:n=null,intent:r,linkService:i}){const{attributes:s}=t,a=e instanceof HTMLAnchorElement;"radio"===s.type&&(s.name=`${s.name}-${r}`);for(const[t,n]of Object.entries(s))if(null!=n)switch(t){case"class":n.length&&e.setAttribute(t,n.join(" "));break;case"dataId":break;case"id":e.setAttribute("data-element-id",n);break;case"style":Object.assign(e.style,n);break;case"textContent":e.textContent=n;break;default:(!a||"href"!==t&&"newWindow"!==t)&&e.setAttribute(t,n)}a&&i.addLinkAttributes(e,s.href,s.newWindow),n&&s.dataId&&this.setupStorage(e,s.dataId,t,n)}static render(e){const t=e.annotationStorage,n=e.linkService,i=e.xfaHtml,s=e.intent||"display",a=document.createElement(i.name);i.attributes&&this.setAttributes({html:a,element:i,intent:s,linkService:n});const o=[[i,-1,a]],l=e.div;if(l.append(a),e.viewport){const t=`matrix(${e.viewport.transform.join(",")})`;l.style.transform=t}"richText"!==s&&l.setAttribute("class","xfaLayer xfaFont");const c=[];for(;o.length>0;){const[e,i,a]=o.at(-1);if(i+1===e.children.length){o.pop();continue}const l=e.children[++o.at(-1)[1]];if(null===l)continue;const{name:u}=l;if("#text"===u){const e=document.createTextNode(l.value);c.push(e),a.append(e);continue}let d;if(d=l?.attributes?.xmlns?document.createElementNS(l.attributes.xmlns,u):document.createElement(u),a.append(d),l.attributes&&this.setAttributes({html:d,element:l,storage:t,intent:s,linkService:n}),l.children&&l.children.length>0)o.push([l,-1,d]);else if(l.value){const e=document.createTextNode(l.value);r.XfaText.shouldBuildText(u)&&c.push(e),d.append(e)}}for(const e of l.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))e.setAttribute("readOnly",!0);return{textDivs:c}}static update(e){const t=`matrix(${e.viewport.transform.join(",")})`;e.div.style.transform=t,e.div.hidden=!1}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TextLayerRenderTask=void 0,t.renderTextLayer=function(e){const t=new p({textContent:e.textContent,textContentStream:e.textContentStream,container:e.container,viewport:e.viewport,textDivs:e.textDivs,textContentItemsStr:e.textContentItemsStr,enhanceTextSelection:e.enhanceTextSelection});return t._render(e.timeout),t};var r=n(1),i=n(8);const s=30,a=new Map,o=/^\s+$/g;function l(e,t,n,i){const l=document.createElement("span"),c=e._enhanceTextSelection?{angle:0,canvasWidth:0,hasText:""!==t.str,hasEOL:t.hasEOL,originalTransform:null,paddingBottom:0,paddingLeft:0,paddingRight:0,paddingTop:0,scale:1,fontSize:0}:{angle:0,canvasWidth:0,hasText:""!==t.str,hasEOL:t.hasEOL,fontSize:0};e._textDivs.push(l);const u=r.Util.transform(e._viewport.transform,t.transform);let d=Math.atan2(u[1],u[0]);const h=n[t.fontName];h.vertical&&(d+=Math.PI/2);const p=Math.hypot(u[2],u[3]),f=p*function(e,t){const n=a.get(e);if(n)return n;t.save(),t.font=`30px ${e}`;const r=t.measureText("");let i=r.fontBoundingBoxAscent,o=Math.abs(r.fontBoundingBoxDescent);if(i){t.restore();const n=i/(i+o);return a.set(e,n),n}t.strokeStyle="red",t.clearRect(0,0,s,s),t.strokeText("g",0,0);let l=t.getImageData(0,0,s,s).data;o=0;for(let e=l.length-1-3;e>=0;e-=4)if(l[e]>0){o=Math.ceil(e/4/s);break}t.clearRect(0,0,s,s),t.strokeText("A",0,s),l=t.getImageData(0,0,s,s).data,i=0;for(let e=0,t=l.length;e<t;e+=4)if(l[e]>0){i=s-Math.floor(e/4/s);break}if(t.restore(),i){const t=i/(i+o);return a.set(e,t),t}return a.set(e,.8),.8}(h.fontFamily,i);let g,m;0===d?(g=u[4],m=u[5]-f):(g=u[4]+f*Math.sin(d),m=u[5]-f*Math.cos(d)),l.style.left=`${g}px`,l.style.top=`${m}px`,l.style.fontSize=`${p}px`,l.style.fontFamily=h.fontFamily,c.fontSize=p,l.setAttribute("role","presentation"),l.textContent=t.str,l.dir=t.dir,e._fontInspectorEnabled&&(l.dataset.fontName=t.fontName),0!==d&&(c.angle=d*(180/Math.PI));let v=!1;if(t.str.length>1||e._enhanceTextSelection&&o.test(t.str))v=!0;else if(" "!==t.str&&t.transform[0]!==t.transform[3]){const e=Math.abs(t.transform[0]),n=Math.abs(t.transform[3]);e!==n&&Math.max(e,n)/Math.min(e,n)>1.5&&(v=!0)}if(v&&(h.vertical?c.canvasWidth=t.height*e._viewport.scale:c.canvasWidth=t.width*e._viewport.scale),e._textDivProperties.set(l,c),e._textContentStream&&e._layoutText(l),e._enhanceTextSelection&&c.hasText){let n=1,i=0;0!==d&&(n=Math.cos(d),i=Math.sin(d));const s=(h.vertical?t.height:t.width)*e._viewport.scale,a=p;let o,c;0!==d?(o=[n,i,-i,n,g,m],c=r.Util.getAxialAlignedBoundingBox([0,0,s,a],o)):c=[g,m,g+s,m+a],e._bounds.push({left:c[0],top:c[1],right:c[2],bottom:c[3],div:l,size:[s,a],m:o})}}function c(e){if(e._canceled)return;const t=e._textDivs,n=e._capability,r=t.length;if(r>1e5)return e._renderingDone=!0,void n.resolve();if(!e._textContentStream)for(let n=0;n<r;n++)e._layoutText(t[n]);e._renderingDone=!0,n.resolve()}function u(e,t,n){let r=0;for(let i=0;i<n;i++){const n=e[t++];n>0&&(r=r?Math.min(n,r):n)}return r}function d(e){const t=e._bounds,n=e._viewport,i=function(e,t,n){const r=n.map((function(e,t){return{x1:e.left,y1:e.top,x2:e.right,y2:e.bottom,index:t,x1New:void 0,x2New:void 0}}));h(e,r);const i=new Array(n.length);for(const e of r){const t=e.index;i[t]={left:e.x1New,top:0,right:e.x2New,bottom:0}}n.map((function(t,n){const s=i[n],a=r[n];a.x1=t.top,a.y1=e-s.right,a.x2=t.bottom,a.y2=e-s.left,a.index=n,a.x1New=void 0,a.x2New=void 0})),h(t,r);for(const e of r){const t=e.index;i[t].top=e.x1New,i[t].bottom=e.x2New}return i}(n.width,n.height,t);for(let n=0;n<i.length;n++){const s=t[n].div,a=e._textDivProperties.get(s);if(0===a.angle){a.paddingLeft=t[n].left-i[n].left,a.paddingTop=t[n].top-i[n].top,a.paddingRight=i[n].right-t[n].right,a.paddingBottom=i[n].bottom-t[n].bottom,e._textDivProperties.set(s,a);continue}const o=i[n],l=t[n],c=l.m,d=c[0],h=c[1],p=[[0,0],[0,l.size[1]],[l.size[0],0],l.size],f=new Float64Array(64);for(let e=0,t=p.length;e<t;e++){const t=r.Util.applyTransform(p[e],c);f[e+0]=d&&(o.left-t[0])/d,f[e+4]=h&&(o.top-t[1])/h,f[e+8]=d&&(o.right-t[0])/d,f[e+12]=h&&(o.bottom-t[1])/h,f[e+16]=h&&(o.left-t[0])/-h,f[e+20]=d&&(o.top-t[1])/d,f[e+24]=h&&(o.right-t[0])/-h,f[e+28]=d&&(o.bottom-t[1])/d,f[e+32]=d&&(o.left-t[0])/-d,f[e+36]=h&&(o.top-t[1])/-h,f[e+40]=d&&(o.right-t[0])/-d,f[e+44]=h&&(o.bottom-t[1])/-h,f[e+48]=h&&(o.left-t[0])/h,f[e+52]=d&&(o.top-t[1])/-d,f[e+56]=h&&(o.right-t[0])/h,f[e+60]=d&&(o.bottom-t[1])/-d}const g=1+Math.min(Math.abs(d),Math.abs(h));a.paddingLeft=u(f,32,16)/g,a.paddingTop=u(f,48,16)/g,a.paddingRight=u(f,0,16)/g,a.paddingBottom=u(f,16,16)/g,e._textDivProperties.set(s,a)}}function h(e,t){t.sort((function(e,t){return e.x1-t.x1||e.index-t.index}));const n=[{start:-1/0,end:1/0,boundary:{x1:-1/0,y1:-1/0,x2:0,y2:1/0,index:-1,x1New:0,x2New:0}}];for(const e of t){let t=0;for(;t<n.length&&n[t].end<=e.y1;)t++;let r,i,s=n.length-1;for(;s>=0&&n[s].start>=e.y2;)s--;let a,o,l=-1/0;for(a=t;a<=s;a++){let t;r=n[a],i=r.boundary,t=i.x2>e.x1?i.index>e.index?i.x1New:e.x1:void 0===i.x2New?(i.x2+e.x1)/2:i.x2New,t>l&&(l=t)}for(e.x1New=l,a=t;a<=s;a++)r=n[a],i=r.boundary,void 0===i.x2New?i.x2>e.x1?i.index>e.index&&(i.x2New=i.x2):i.x2New=l:i.x2New>l&&(i.x2New=Math.max(l,i.x2));const c=[];let u=null;for(a=t;a<=s;a++){r=n[a],i=r.boundary;const t=i.x2>e.x2?i:e;u===t?c.at(-1).end=r.end:(c.push({start:r.start,end:r.end,boundary:t}),u=t)}for(n[t].start<e.y1&&(c[0].start=e.y1,c.unshift({start:n[t].start,end:e.y1,boundary:n[t].boundary})),e.y2<n[s].end&&(c.at(-1).end=e.y2,c.push({start:e.y2,end:n[s].end,boundary:n[s].boundary})),a=t;a<=s;a++){if(r=n[a],i=r.boundary,void 0!==i.x2New)continue;let e=!1;for(o=t-1;!e&&o>=0&&n[o].start>=i.y1;o--)e=n[o].boundary===i;for(o=s+1;!e&&o<n.length&&n[o].end<=i.y2;o++)e=n[o].boundary===i;for(o=0;!e&&o<c.length;o++)e=c[o].boundary===i;e||(i.x2New=l)}Array.prototype.splice.apply(n,[t,s-t+1,...c])}for(const t of n){const n=t.boundary;void 0===n.x2New&&(n.x2New=Math.max(e,n.x2))}}class p{constructor({textContent:e,textContentStream:t,container:n,viewport:s,textDivs:a,textContentItemsStr:o,enhanceTextSelection:l}){l&&(0,i.deprecated)("The `enhanceTextSelection` functionality will be removed in the future."),this._textContent=e,this._textContentStream=t,this._container=n,this._document=n.ownerDocument,this._viewport=s,this._textDivs=a||[],this._textContentItemsStr=o||[],this._enhanceTextSelection=!!l,this._fontInspectorEnabled=!!globalThis.FontInspector?.enabled,this._reader=null,this._layoutTextLastFontSize=null,this._layoutTextLastFontFamily=null,this._layoutTextCtx=null,this._textDivProperties=new WeakMap,this._renderingDone=!1,this._canceled=!1,this._capability=(0,r.createPromiseCapability)(),this._renderTimer=null,this._bounds=[],this._devicePixelRatio=globalThis.devicePixelRatio||1,this._capability.promise.finally((()=>{this._enhanceTextSelection||(this._textDivProperties=null),this._layoutTextCtx&&(this._layoutTextCtx.canvas.width=0,this._layoutTextCtx.canvas.height=0,this._layoutTextCtx=null)})).catch((()=>{}))}get promise(){return this._capability.promise}cancel(){this._canceled=!0,this._reader&&(this._reader.cancel(new r.AbortException("TextLayer task cancelled.")).catch((()=>{})),this._reader=null),null!==this._renderTimer&&(clearTimeout(this._renderTimer),this._renderTimer=null),this._capability.reject(new Error("TextLayer task cancelled."))}_processItems(e,t){for(let n=0,r=e.length;n<r;n++)if(void 0!==e[n].str)this._textContentItemsStr.push(e[n].str),l(this,e[n],t,this._layoutTextCtx);else if("beginMarkedContentProps"===e[n].type||"beginMarkedContent"===e[n].type){const t=this._container;this._container=document.createElement("span"),this._container.classList.add("markedContent"),null!==e[n].id&&this._container.setAttribute("id",`${e[n].id}`),t.append(this._container)}else"endMarkedContent"===e[n].type&&(this._container=this._container.parentNode)}_layoutText(e){const t=this._textDivProperties.get(e);let n="";if(0!==t.canvasWidth&&t.hasText){const{fontFamily:r}=e.style,{fontSize:i}=t;i===this._layoutTextLastFontSize&&r===this._layoutTextLastFontFamily||(this._layoutTextCtx.font=`${i*this._devicePixelRatio}px ${r}`,this._layoutTextLastFontSize=i,this._layoutTextLastFontFamily=r);const{width:s}=this._layoutTextCtx.measureText(e.textContent);if(s>0){const e=this._devicePixelRatio*t.canvasWidth/s;this._enhanceTextSelection&&(t.scale=e),n=`scaleX(${e})`}}if(0!==t.angle&&(n=`rotate(${t.angle}deg) ${n}`),n.length>0&&(this._enhanceTextSelection&&(t.originalTransform=n),e.style.transform=n),t.hasText&&this._container.append(e),t.hasEOL){const e=document.createElement("br");e.setAttribute("role","presentation"),this._container.append(e)}}_render(e=0){const t=(0,r.createPromiseCapability)();let n=Object.create(null);const i=this._document.createElement("canvas");if(i.height=i.width=s,this._layoutTextCtx=i.getContext("2d",{alpha:!1}),this._textContent){const e=this._textContent.items,n=this._textContent.styles;this._processItems(e,n),t.resolve()}else{if(!this._textContentStream)throw new Error('Neither "textContent" nor "textContentStream" parameters specified.');{const e=()=>{this._reader.read().then((({value:r,done:i})=>{i?t.resolve():(Object.assign(n,r.styles),this._processItems(r.items,n),e())}),t.reject)};this._reader=this._textContentStream.getReader(),e()}}t.promise.then((()=>{n=null,e?this._renderTimer=setTimeout((()=>{c(this),this._renderTimer=null}),e):c(this)}),this._capability.reject)}expandTextDivs(e=!1){if(!this._enhanceTextSelection||!this._renderingDone)return;null!==this._bounds&&(d(this),this._bounds=null);const t=[],n=[];for(let r=0,i=this._textDivs.length;r<i;r++){const i=this._textDivs[r],s=this._textDivProperties.get(i);s.hasText&&(e?(t.length=0,n.length=0,s.originalTransform&&t.push(s.originalTransform),s.paddingTop>0?(n.push(`${s.paddingTop}px`),t.push(`translateY(${-s.paddingTop}px)`)):n.push(0),s.paddingRight>0?n.push(s.paddingRight/s.scale+"px"):n.push(0),s.paddingBottom>0?n.push(`${s.paddingBottom}px`):n.push(0),s.paddingLeft>0?(n.push(s.paddingLeft/s.scale+"px"),t.push(`translateX(${-s.paddingLeft/s.scale}px)`)):n.push(0),i.style.padding=n.join(" "),t.length&&(i.style.transform=t.join(" "))):(i.style.padding=null,i.style.transform=s.originalTransform))}}}t.TextLayerRenderTask=p},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SVGGraphics=void 0;var r=n(8),i=n(1),s=n(3);let a=class{constructor(){(0,i.unreachable)("Not implemented: SVGGraphics")}};t.SVGGraphics=a;{const o={fontStyle:"normal",fontWeight:"normal",fillColor:"#000000"},l="http://www.w3.org/XML/1998/namespace",c="http://www.w3.org/1999/xlink",u=["butt","round","square"],d=["miter","round","bevel"],h=function(e,t="",n=!1){if(URL.createObjectURL&&"undefined"!=typeof Blob&&!n)return URL.createObjectURL(new Blob([e],{type:t}));const r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";let i=`data:${t};base64,`;for(let t=0,n=e.length;t<n;t+=3){const s=255&e[t],a=255&e[t+1],o=255&e[t+2];i+=r[s>>2]+r[(3&s)<<4|a>>4]+r[t+1<n?(15&a)<<2|o>>6:64]+r[t+2<n?63&o:64]}return i},p=function(){const e=new Uint8Array([137,80,78,71,13,10,26,10]),t=new Int32Array(256);for(let e=0;e<256;e++){let n=e;for(let e=0;e<8;e++)n=1&n?3988292384^n>>1&2147483647:n>>1&2147483647;t[e]=n}function n(e,n,r,i){let s=i;const a=n.length;r[s]=a>>24&255,r[s+1]=a>>16&255,r[s+2]=a>>8&255,r[s+3]=255&a,s+=4,r[s]=255&e.charCodeAt(0),r[s+1]=255&e.charCodeAt(1),r[s+2]=255&e.charCodeAt(2),r[s+3]=255&e.charCodeAt(3),s+=4,r.set(n,s),s+=n.length;const o=function(e,n,r){let i=-1;for(let s=n;s<r;s++){const n=255&(i^e[s]);i=i>>>8^t[n]}return-1^i}(r,i+4,s);r[s]=o>>24&255,r[s+1]=o>>16&255,r[s+2]=o>>8&255,r[s+3]=255&o}function r(e){let t=e.length;const n=65535,r=Math.ceil(t/n),i=new Uint8Array(2+t+5*r+4);let s=0;i[s++]=120,i[s++]=156;let a=0;for(;t>n;)i[s++]=0,i[s++]=255,i[s++]=255,i[s++]=0,i[s++]=0,i.set(e.subarray(a,a+n),s),s+=n,a+=n,t-=n;i[s++]=1,i[s++]=255&t,i[s++]=t>>8&255,i[s++]=255&~t,i[s++]=(65535&~t)>>8&255,i.set(e.subarray(a),s),s+=e.length-a;const o=function(e,t,n){let r=1,i=0;for(let s=t;s<n;++s)r=(r+(255&e[s]))%65521,i=(i+r)%65521;return i<<16|r}(e,0,e.length);return i[s++]=o>>24&255,i[s++]=o>>16&255,i[s++]=o>>8&255,i[s++]=255&o,i}function a(t,a,o,l){const c=t.width,u=t.height;let d,p,f;const g=t.data;switch(a){case i.ImageKind.GRAYSCALE_1BPP:p=0,d=1,f=c+7>>3;break;case i.ImageKind.RGB_24BPP:p=2,d=8,f=3*c;break;case i.ImageKind.RGBA_32BPP:p=6,d=8,f=4*c;break;default:throw new Error("invalid format")}const m=new Uint8Array((1+f)*u);let v=0,y=0;for(let e=0;e<u;++e)m[v++]=0,m.set(g.subarray(y,y+f),v),y+=f,v+=f;if(a===i.ImageKind.GRAYSCALE_1BPP&&l){v=0;for(let e=0;e<u;e++){v++;for(let e=0;e<f;e++)m[v++]^=255}}const b=new Uint8Array([c>>24&255,c>>16&255,c>>8&255,255&c,u>>24&255,u>>16&255,u>>8&255,255&u,d,p,0,0,0]),_=function(e){if(!s.isNodeJS)return r(e);try{let t;t=parseInt(process.versions.node)>=8?e:Buffer.from(e);const n=require$$5.deflateSync(t,{level:9});return n instanceof Uint8Array?n:new Uint8Array(n)}catch(e){(0,i.warn)("Not compressing PNG because zlib.deflateSync is unavailable: "+e)}return r(e)}(m),w=e.length+36+b.length+_.length,E=new Uint8Array(w);let S=0;return E.set(e,S),S+=e.length,n("IHDR",b,E,S),S+=12+b.length,n("IDATA",_,E,S),S+=12+_.length,n("IEND",new Uint8Array(0),E,S),h(E,"image/png",o)}return function(e,t,n){return a(e,void 0===e.kind?i.ImageKind.GRAYSCALE_1BPP:e.kind,t,n)}}();class f{constructor(){this.fontSizeScale=1,this.fontWeight=o.fontWeight,this.fontSize=0,this.textMatrix=i.IDENTITY_MATRIX,this.fontMatrix=i.FONT_IDENTITY_MATRIX,this.leading=0,this.textRenderingMode=i.TextRenderingMode.FILL,this.textMatrixScale=1,this.x=0,this.y=0,this.lineX=0,this.lineY=0,this.charSpacing=0,this.wordSpacing=0,this.textHScale=1,this.textRise=0,this.fillColor=o.fillColor,this.strokeColor="#000000",this.fillAlpha=1,this.strokeAlpha=1,this.lineWidth=1,this.lineJoin="",this.lineCap="",this.miterLimit=0,this.dashArray=[],this.dashPhase=0,this.dependencies=[],this.activeClipUrl=null,this.clipGroup=null,this.maskId=""}clone(){return Object.create(this)}setCurrentPoint(e,t){this.x=e,this.y=t}}function g(e){let t=[];const n=[];for(const r of e)"save"!==r.fn?"restore"===r.fn?t=n.pop():t.push(r):(t.push({fnId:92,fn:"group",items:[]}),n.push(t),t=t.at(-1).items);return t}function m(e){if(Number.isInteger(e))return e.toString();const t=e.toFixed(10);let n=t.length-1;if("0"!==t[n])return t;do{n--}while("0"===t[n]);return t.substring(0,"."===t[n]?n:n+1)}function v(e){if(0===e[4]&&0===e[5]){if(0===e[1]&&0===e[2])return 1===e[0]&&1===e[3]?"":`scale(${m(e[0])} ${m(e[3])})`;if(e[0]===e[3]&&e[1]===-e[2])return`rotate(${m(180*Math.acos(e[0])/Math.PI)})`}else if(1===e[0]&&0===e[1]&&0===e[2]&&1===e[3])return`translate(${m(e[4])} ${m(e[5])})`;return`matrix(${m(e[0])} ${m(e[1])} ${m(e[2])} ${m(e[3])} ${m(e[4])} ${m(e[5])})`}let y=0,b=0,_=0;t.SVGGraphics=a=class{constructor(e,t,n=!1){(0,r.deprecated)("The SVG back-end is no longer maintained and *may* be removed in the future."),this.svgFactory=new r.DOMSVGFactory,this.current=new f,this.transformMatrix=i.IDENTITY_MATRIX,this.transformStack=[],this.extraStack=[],this.commonObjs=e,this.objs=t,this.pendingClip=null,this.pendingEOFill=!1,this.embedFonts=!1,this.embeddedFonts=Object.create(null),this.cssStyle=null,this.forceDataSchema=!!n,this._operatorIdMapping=[];for(const e in i.OPS)this._operatorIdMapping[i.OPS[e]]=e}save(){this.transformStack.push(this.transformMatrix);const e=this.current;this.extraStack.push(e),this.current=e.clone()}restore(){this.transformMatrix=this.transformStack.pop(),this.current=this.extraStack.pop(),this.pendingClip=null,this.tgrp=null}group(e){this.save(),this.executeOpTree(e),this.restore()}loadDependencies(e){const t=e.fnArray,n=e.argsArray;for(let e=0,r=t.length;e<r;e++)if(t[e]===i.OPS.dependency)for(const t of n[e]){const e=t.startsWith("g_")?this.commonObjs:this.objs,n=new Promise((n=>{e.get(t,n)}));this.current.dependencies.push(n)}return Promise.all(this.current.dependencies)}transform(e,t,n,r,s,a){const o=[e,t,n,r,s,a];this.transformMatrix=i.Util.transform(this.transformMatrix,o),this.tgrp=null}getSVG(e,t){this.viewport=t;const n=this._initialize(t);return this.loadDependencies(e).then((()=>(this.transformMatrix=i.IDENTITY_MATRIX,this.executeOpTree(this.convertOpList(e)),n)))}convertOpList(e){const t=this._operatorIdMapping,n=e.argsArray,r=e.fnArray,i=[];for(let e=0,s=r.length;e<s;e++){const s=r[e];i.push({fnId:s,fn:t[s],args:n[e]})}return g(i)}executeOpTree(e){for(const t of e){const e=t.fn,n=t.fnId,r=t.args;switch(0|n){case i.OPS.beginText:this.beginText();break;case i.OPS.dependency:break;case i.OPS.setLeading:this.setLeading(r);break;case i.OPS.setLeadingMoveText:this.setLeadingMoveText(r[0],r[1]);break;case i.OPS.setFont:this.setFont(r);break;case i.OPS.showText:case i.OPS.showSpacedText:this.showText(r[0]);break;case i.OPS.endText:this.endText();break;case i.OPS.moveText:this.moveText(r[0],r[1]);break;case i.OPS.setCharSpacing:this.setCharSpacing(r[0]);break;case i.OPS.setWordSpacing:this.setWordSpacing(r[0]);break;case i.OPS.setHScale:this.setHScale(r[0]);break;case i.OPS.setTextMatrix:this.setTextMatrix(r[0],r[1],r[2],r[3],r[4],r[5]);break;case i.OPS.setTextRise:this.setTextRise(r[0]);break;case i.OPS.setTextRenderingMode:this.setTextRenderingMode(r[0]);break;case i.OPS.setLineWidth:this.setLineWidth(r[0]);break;case i.OPS.setLineJoin:this.setLineJoin(r[0]);break;case i.OPS.setLineCap:this.setLineCap(r[0]);break;case i.OPS.setMiterLimit:this.setMiterLimit(r[0]);break;case i.OPS.setFillRGBColor:this.setFillRGBColor(r[0],r[1],r[2]);break;case i.OPS.setStrokeRGBColor:this.setStrokeRGBColor(r[0],r[1],r[2]);break;case i.OPS.setStrokeColorN:this.setStrokeColorN(r);break;case i.OPS.setFillColorN:this.setFillColorN(r);break;case i.OPS.shadingFill:this.shadingFill(r[0]);break;case i.OPS.setDash:this.setDash(r[0],r[1]);break;case i.OPS.setRenderingIntent:this.setRenderingIntent(r[0]);break;case i.OPS.setFlatness:this.setFlatness(r[0]);break;case i.OPS.setGState:this.setGState(r[0]);break;case i.OPS.fill:this.fill();break;case i.OPS.eoFill:this.eoFill();break;case i.OPS.stroke:this.stroke();break;case i.OPS.fillStroke:this.fillStroke();break;case i.OPS.eoFillStroke:this.eoFillStroke();break;case i.OPS.clip:this.clip("nonzero");break;case i.OPS.eoClip:this.clip("evenodd");break;case i.OPS.paintSolidColorImageMask:this.paintSolidColorImageMask();break;case i.OPS.paintImageXObject:this.paintImageXObject(r[0]);break;case i.OPS.paintInlineImageXObject:this.paintInlineImageXObject(r[0]);break;case i.OPS.paintImageMaskXObject:this.paintImageMaskXObject(r[0]);break;case i.OPS.paintFormXObjectBegin:this.paintFormXObjectBegin(r[0],r[1]);break;case i.OPS.paintFormXObjectEnd:this.paintFormXObjectEnd();break;case i.OPS.closePath:this.closePath();break;case i.OPS.closeStroke:this.closeStroke();break;case i.OPS.closeFillStroke:this.closeFillStroke();break;case i.OPS.closeEOFillStroke:this.closeEOFillStroke();break;case i.OPS.nextLine:this.nextLine();break;case i.OPS.transform:this.transform(r[0],r[1],r[2],r[3],r[4],r[5]);break;case i.OPS.constructPath:this.constructPath(r[0],r[1]);break;case i.OPS.endPath:this.endPath();break;case 92:this.group(t.items);break;default:(0,i.warn)(`Unimplemented operator ${e}`)}}}setWordSpacing(e){this.current.wordSpacing=e}setCharSpacing(e){this.current.charSpacing=e}nextLine(){this.moveText(0,this.current.leading)}setTextMatrix(e,t,n,r,i,s){const a=this.current;a.textMatrix=a.lineMatrix=[e,t,n,r,i,s],a.textMatrixScale=Math.hypot(e,t),a.x=a.lineX=0,a.y=a.lineY=0,a.xcoords=[],a.ycoords=[],a.tspan=this.svgFactory.createElement("svg:tspan"),a.tspan.setAttributeNS(null,"font-family",a.fontFamily),a.tspan.setAttributeNS(null,"font-size",`${m(a.fontSize)}px`),a.tspan.setAttributeNS(null,"y",m(-a.y)),a.txtElement=this.svgFactory.createElement("svg:text"),a.txtElement.append(a.tspan)}beginText(){const e=this.current;e.x=e.lineX=0,e.y=e.lineY=0,e.textMatrix=i.IDENTITY_MATRIX,e.lineMatrix=i.IDENTITY_MATRIX,e.textMatrixScale=1,e.tspan=this.svgFactory.createElement("svg:tspan"),e.txtElement=this.svgFactory.createElement("svg:text"),e.txtgrp=this.svgFactory.createElement("svg:g"),e.xcoords=[],e.ycoords=[]}moveText(e,t){const n=this.current;n.x=n.lineX+=e,n.y=n.lineY+=t,n.xcoords=[],n.ycoords=[],n.tspan=this.svgFactory.createElement("svg:tspan"),n.tspan.setAttributeNS(null,"font-family",n.fontFamily),n.tspan.setAttributeNS(null,"font-size",`${m(n.fontSize)}px`),n.tspan.setAttributeNS(null,"y",m(-n.y))}showText(e){const t=this.current,n=t.font,r=t.fontSize;if(0===r)return;const s=t.fontSizeScale,a=t.charSpacing,c=t.wordSpacing,u=t.fontDirection,d=t.textHScale*u,h=n.vertical,p=h?1:-1,f=n.defaultVMetrics,g=r*t.fontMatrix[0];let y=0;for(const i of e){if(null===i){y+=u*c;continue}if("number"==typeof i){y+=p*i*r/1e3;continue}const e=(i.isSpace?c:0)+a,o=i.fontChar;let l,d,m,v=i.width;if(h){let e;const t=i.vmetric||f;e=i.vmetric?t[1]:.5*v,e=-e*g;const n=t[2]*g;v=t?-t[0]:v,l=e/s,d=(y+n)/s}else l=y/s,d=0;(i.isInFont||n.missingFile)&&(t.xcoords.push(t.x+l),h&&t.ycoords.push(-t.y+d),t.tspan.textContent+=o),m=h?v*g-e*u:v*g+e*u,y+=m}t.tspan.setAttributeNS(null,"x",t.xcoords.map(m).join(" ")),h?t.tspan.setAttributeNS(null,"y",t.ycoords.map(m).join(" ")):t.tspan.setAttributeNS(null,"y",m(-t.y)),h?t.y-=y:t.x+=y*d,t.tspan.setAttributeNS(null,"font-family",t.fontFamily),t.tspan.setAttributeNS(null,"font-size",`${m(t.fontSize)}px`),t.fontStyle!==o.fontStyle&&t.tspan.setAttributeNS(null,"font-style",t.fontStyle),t.fontWeight!==o.fontWeight&&t.tspan.setAttributeNS(null,"font-weight",t.fontWeight);const b=t.textRenderingMode&i.TextRenderingMode.FILL_STROKE_MASK;if(b===i.TextRenderingMode.FILL||b===i.TextRenderingMode.FILL_STROKE?(t.fillColor!==o.fillColor&&t.tspan.setAttributeNS(null,"fill",t.fillColor),t.fillAlpha<1&&t.tspan.setAttributeNS(null,"fill-opacity",t.fillAlpha)):t.textRenderingMode===i.TextRenderingMode.ADD_TO_PATH?t.tspan.setAttributeNS(null,"fill","transparent"):t.tspan.setAttributeNS(null,"fill","none"),b===i.TextRenderingMode.STROKE||b===i.TextRenderingMode.FILL_STROKE){const e=1/(t.textMatrixScale||1);this._setStrokeAttributes(t.tspan,e)}let _=t.textMatrix;0!==t.textRise&&(_=_.slice(),_[5]+=t.textRise),t.txtElement.setAttributeNS(null,"transform",`${v(_)} scale(${m(d)}, -1)`),t.txtElement.setAttributeNS(l,"xml:space","preserve"),t.txtElement.append(t.tspan),t.txtgrp.append(t.txtElement),this._ensureTransformGroup().append(t.txtElement)}setLeadingMoveText(e,t){this.setLeading(-t),this.moveText(e,t)}addFontStyle(e){if(!e.data)throw new Error('addFontStyle: No font data available, ensure that the "fontExtraProperties" API parameter is set.');this.cssStyle||(this.cssStyle=this.svgFactory.createElement("svg:style"),this.cssStyle.setAttributeNS(null,"type","text/css"),this.defs.append(this.cssStyle));const t=h(e.data,e.mimetype,this.forceDataSchema);this.cssStyle.textContent+=`@font-face { font-family: "${e.loadedName}"; src: url(${t}); }\n`}setFont(e){const t=this.current,n=this.commonObjs.get(e[0]);let r=e[1];t.font=n,!this.embedFonts||n.missingFile||this.embeddedFonts[n.loadedName]||(this.addFontStyle(n),this.embeddedFonts[n.loadedName]=n),t.fontMatrix=n.fontMatrix||i.FONT_IDENTITY_MATRIX;let s="normal";n.black?s="900":n.bold&&(s="bold");const a=n.italic?"italic":"normal";r<0?(r=-r,t.fontDirection=-1):t.fontDirection=1,t.fontSize=r,t.fontFamily=n.loadedName,t.fontWeight=s,t.fontStyle=a,t.tspan=this.svgFactory.createElement("svg:tspan"),t.tspan.setAttributeNS(null,"y",m(-t.y)),t.xcoords=[],t.ycoords=[]}endText(){const e=this.current;e.textRenderingMode&i.TextRenderingMode.ADD_TO_PATH_FLAG&&e.txtElement?.hasChildNodes()&&(e.element=e.txtElement,this.clip("nonzero"),this.endPath())}setLineWidth(e){e>0&&(this.current.lineWidth=e)}setLineCap(e){this.current.lineCap=u[e]}setLineJoin(e){this.current.lineJoin=d[e]}setMiterLimit(e){this.current.miterLimit=e}setStrokeAlpha(e){this.current.strokeAlpha=e}setStrokeRGBColor(e,t,n){this.current.strokeColor=i.Util.makeHexColor(e,t,n)}setFillAlpha(e){this.current.fillAlpha=e}setFillRGBColor(e,t,n){this.current.fillColor=i.Util.makeHexColor(e,t,n),this.current.tspan=this.svgFactory.createElement("svg:tspan"),this.current.xcoords=[],this.current.ycoords=[]}setStrokeColorN(e){this.current.strokeColor=this._makeColorN_Pattern(e)}setFillColorN(e){this.current.fillColor=this._makeColorN_Pattern(e)}shadingFill(e){const t=this.viewport.width,n=this.viewport.height,r=i.Util.inverseTransform(this.transformMatrix),s=i.Util.applyTransform([0,0],r),a=i.Util.applyTransform([0,n],r),o=i.Util.applyTransform([t,0],r),l=i.Util.applyTransform([t,n],r),c=Math.min(s[0],a[0],o[0],l[0]),u=Math.min(s[1],a[1],o[1],l[1]),d=Math.max(s[0],a[0],o[0],l[0]),h=Math.max(s[1],a[1],o[1],l[1]),p=this.svgFactory.createElement("svg:rect");p.setAttributeNS(null,"x",c),p.setAttributeNS(null,"y",u),p.setAttributeNS(null,"width",d-c),p.setAttributeNS(null,"height",h-u),p.setAttributeNS(null,"fill",this._makeShadingPattern(e)),this.current.fillAlpha<1&&p.setAttributeNS(null,"fill-opacity",this.current.fillAlpha),this._ensureTransformGroup().append(p)}_makeColorN_Pattern(e){return"TilingPattern"===e[0]?this._makeTilingPattern(e):this._makeShadingPattern(e)}_makeTilingPattern(e){const t=e[1],n=e[2],r=e[3]||i.IDENTITY_MATRIX,[s,a,o,l]=e[4],c=e[5],u=e[6],d=e[7],h="shading"+_++,[p,f,g,m]=i.Util.normalizeRect([...i.Util.applyTransform([s,a],r),...i.Util.applyTransform([o,l],r)]),[v,y]=i.Util.singularValueDecompose2dScale(r),b=c*v,w=u*y,E=this.svgFactory.createElement("svg:pattern");E.setAttributeNS(null,"id",h),E.setAttributeNS(null,"patternUnits","userSpaceOnUse"),E.setAttributeNS(null,"width",b),E.setAttributeNS(null,"height",w),E.setAttributeNS(null,"x",`${p}`),E.setAttributeNS(null,"y",`${f}`);const S=this.svg,C=this.transformMatrix,A=this.current.fillColor,P=this.current.strokeColor,x=this.svgFactory.create(g-p,m-f);if(this.svg=x,this.transformMatrix=r,2===d){const e=i.Util.makeHexColor(...t);this.current.fillColor=e,this.current.strokeColor=e}return this.executeOpTree(this.convertOpList(n)),this.svg=S,this.transformMatrix=C,this.current.fillColor=A,this.current.strokeColor=P,E.append(x.childNodes[0]),this.defs.append(E),`url(#${h})`}_makeShadingPattern(e){switch("string"==typeof e&&(e=this.objs.get(e)),e[0]){case"RadialAxial":const t="shading"+_++,n=e[3];let r;switch(e[1]){case"axial":const n=e[4],i=e[5];r=this.svgFactory.createElement("svg:linearGradient"),r.setAttributeNS(null,"id",t),r.setAttributeNS(null,"gradientUnits","userSpaceOnUse"),r.setAttributeNS(null,"x1",n[0]),r.setAttributeNS(null,"y1",n[1]),r.setAttributeNS(null,"x2",i[0]),r.setAttributeNS(null,"y2",i[1]);break;case"radial":const s=e[4],a=e[5],o=e[6],l=e[7];r=this.svgFactory.createElement("svg:radialGradient"),r.setAttributeNS(null,"id",t),r.setAttributeNS(null,"gradientUnits","userSpaceOnUse"),r.setAttributeNS(null,"cx",a[0]),r.setAttributeNS(null,"cy",a[1]),r.setAttributeNS(null,"r",l),r.setAttributeNS(null,"fx",s[0]),r.setAttributeNS(null,"fy",s[1]),r.setAttributeNS(null,"fr",o);break;default:throw new Error(`Unknown RadialAxial type: ${e[1]}`)}for(const e of n){const t=this.svgFactory.createElement("svg:stop");t.setAttributeNS(null,"offset",e[0]),t.setAttributeNS(null,"stop-color",e[1]),r.append(t)}return this.defs.append(r),`url(#${t})`;case"Mesh":return(0,i.warn)("Unimplemented pattern Mesh"),null;case"Dummy":return"hotpink";default:throw new Error(`Unknown IR type: ${e[0]}`)}}setDash(e,t){this.current.dashArray=e,this.current.dashPhase=t}constructPath(e,t){const n=this.current;let r=n.x,s=n.y,a=[],o=0;for(const n of e)switch(0|n){case i.OPS.rectangle:r=t[o++],s=t[o++];const e=r+t[o++],n=s+t[o++];a.push("M",m(r),m(s),"L",m(e),m(s),"L",m(e),m(n),"L",m(r),m(n),"Z");break;case i.OPS.moveTo:r=t[o++],s=t[o++],a.push("M",m(r),m(s));break;case i.OPS.lineTo:r=t[o++],s=t[o++],a.push("L",m(r),m(s));break;case i.OPS.curveTo:r=t[o+4],s=t[o+5],a.push("C",m(t[o]),m(t[o+1]),m(t[o+2]),m(t[o+3]),m(r),m(s)),o+=6;break;case i.OPS.curveTo2:a.push("C",m(r),m(s),m(t[o]),m(t[o+1]),m(t[o+2]),m(t[o+3])),r=t[o+2],s=t[o+3],o+=4;break;case i.OPS.curveTo3:r=t[o+2],s=t[o+3],a.push("C",m(t[o]),m(t[o+1]),m(r),m(s),m(r),m(s)),o+=4;break;case i.OPS.closePath:a.push("Z")}a=a.join(" "),n.path&&e.length>0&&e[0]!==i.OPS.rectangle&&e[0]!==i.OPS.moveTo?a=n.path.getAttributeNS(null,"d")+a:(n.path=this.svgFactory.createElement("svg:path"),this._ensureTransformGroup().append(n.path)),n.path.setAttributeNS(null,"d",a),n.path.setAttributeNS(null,"fill","none"),n.element=n.path,n.setCurrentPoint(r,s)}endPath(){const e=this.current;if(e.path=null,!this.pendingClip)return;if(!e.element)return void(this.pendingClip=null);const t="clippath"+y++,n=this.svgFactory.createElement("svg:clipPath");n.setAttributeNS(null,"id",t),n.setAttributeNS(null,"transform",v(this.transformMatrix));const r=e.element.cloneNode(!0);if("evenodd"===this.pendingClip?r.setAttributeNS(null,"clip-rule","evenodd"):r.setAttributeNS(null,"clip-rule","nonzero"),this.pendingClip=null,n.append(r),this.defs.append(n),e.activeClipUrl){e.clipGroup=null;for(const e of this.extraStack)e.clipGroup=null;n.setAttributeNS(null,"clip-path",e.activeClipUrl)}e.activeClipUrl=`url(#${t})`,this.tgrp=null}clip(e){this.pendingClip=e}closePath(){const e=this.current;if(e.path){const t=`${e.path.getAttributeNS(null,"d")}Z`;e.path.setAttributeNS(null,"d",t)}}setLeading(e){this.current.leading=-e}setTextRise(e){this.current.textRise=e}setTextRenderingMode(e){this.current.textRenderingMode=e}setHScale(e){this.current.textHScale=e/100}setRenderingIntent(e){}setFlatness(e){}setGState(e){for(const[t,n]of e)switch(t){case"LW":this.setLineWidth(n);break;case"LC":this.setLineCap(n);break;case"LJ":this.setLineJoin(n);break;case"ML":this.setMiterLimit(n);break;case"D":this.setDash(n[0],n[1]);break;case"RI":this.setRenderingIntent(n);break;case"FL":this.setFlatness(n);break;case"Font":this.setFont(n);break;case"CA":this.setStrokeAlpha(n);break;case"ca":this.setFillAlpha(n);break;default:(0,i.warn)(`Unimplemented graphic state operator ${t}`)}}fill(){const e=this.current;e.element&&(e.element.setAttributeNS(null,"fill",e.fillColor),e.element.setAttributeNS(null,"fill-opacity",e.fillAlpha),this.endPath())}stroke(){const e=this.current;e.element&&(this._setStrokeAttributes(e.element),e.element.setAttributeNS(null,"fill","none"),this.endPath())}_setStrokeAttributes(e,t=1){const n=this.current;let r=n.dashArray;1!==t&&r.length>0&&(r=r.map((function(e){return t*e}))),e.setAttributeNS(null,"stroke",n.strokeColor),e.setAttributeNS(null,"stroke-opacity",n.strokeAlpha),e.setAttributeNS(null,"stroke-miterlimit",m(n.miterLimit)),e.setAttributeNS(null,"stroke-linecap",n.lineCap),e.setAttributeNS(null,"stroke-linejoin",n.lineJoin),e.setAttributeNS(null,"stroke-width",m(t*n.lineWidth)+"px"),e.setAttributeNS(null,"stroke-dasharray",r.map(m).join(" ")),e.setAttributeNS(null,"stroke-dashoffset",m(t*n.dashPhase)+"px")}eoFill(){this.current.element&&this.current.element.setAttributeNS(null,"fill-rule","evenodd"),this.fill()}fillStroke(){this.stroke(),this.fill()}eoFillStroke(){this.current.element&&this.current.element.setAttributeNS(null,"fill-rule","evenodd"),this.fillStroke()}closeStroke(){this.closePath(),this.stroke()}closeFillStroke(){this.closePath(),this.fillStroke()}closeEOFillStroke(){this.closePath(),this.eoFillStroke()}paintSolidColorImageMask(){const e=this.svgFactory.createElement("svg:rect");e.setAttributeNS(null,"x","0"),e.setAttributeNS(null,"y","0"),e.setAttributeNS(null,"width","1px"),e.setAttributeNS(null,"height","1px"),e.setAttributeNS(null,"fill",this.current.fillColor),this._ensureTransformGroup().append(e)}paintImageXObject(e){const t=e.startsWith("g_")?this.commonObjs.get(e):this.objs.get(e);t?this.paintInlineImageXObject(t):(0,i.warn)(`Dependent image with object ID ${e} is not ready yet`)}paintInlineImageXObject(e,t){const n=e.width,r=e.height,i=p(e,this.forceDataSchema,!!t),s=this.svgFactory.createElement("svg:rect");s.setAttributeNS(null,"x","0"),s.setAttributeNS(null,"y","0"),s.setAttributeNS(null,"width",m(n)),s.setAttributeNS(null,"height",m(r)),this.current.element=s,this.clip("nonzero");const a=this.svgFactory.createElement("svg:image");a.setAttributeNS(c,"xlink:href",i),a.setAttributeNS(null,"x","0"),a.setAttributeNS(null,"y",m(-r)),a.setAttributeNS(null,"width",m(n)+"px"),a.setAttributeNS(null,"height",m(r)+"px"),a.setAttributeNS(null,"transform",`scale(${m(1/n)} ${m(-1/r)})`),t?t.append(a):this._ensureTransformGroup().append(a)}paintImageMaskXObject(e){const t=this.current,n=e.width,r=e.height,i=t.fillColor;t.maskId="mask"+b++;const s=this.svgFactory.createElement("svg:mask");s.setAttributeNS(null,"id",t.maskId);const a=this.svgFactory.createElement("svg:rect");a.setAttributeNS(null,"x","0"),a.setAttributeNS(null,"y","0"),a.setAttributeNS(null,"width",m(n)),a.setAttributeNS(null,"height",m(r)),a.setAttributeNS(null,"fill",i),a.setAttributeNS(null,"mask",`url(#${t.maskId})`),this.defs.append(s),this._ensureTransformGroup().append(a),this.paintInlineImageXObject(e,s)}paintFormXObjectBegin(e,t){if(Array.isArray(e)&&6===e.length&&this.transform(e[0],e[1],e[2],e[3],e[4],e[5]),t){const e=t[2]-t[0],n=t[3]-t[1],r=this.svgFactory.createElement("svg:rect");r.setAttributeNS(null,"x",t[0]),r.setAttributeNS(null,"y",t[1]),r.setAttributeNS(null,"width",m(e)),r.setAttributeNS(null,"height",m(n)),this.current.element=r,this.clip("nonzero"),this.endPath()}}paintFormXObjectEnd(){}_initialize(e){const t=this.svgFactory.create(e.width,e.height),n=this.svgFactory.createElement("svg:defs");t.append(n),this.defs=n;const r=this.svgFactory.createElement("svg:g");return r.setAttributeNS(null,"transform",v(e.transform)),t.append(r),this.svg=r,t}_ensureClipGroup(){if(!this.current.clipGroup){const e=this.svgFactory.createElement("svg:g");e.setAttributeNS(null,"clip-path",this.current.activeClipUrl),this.svg.append(e),this.current.clipGroup=e}return this.current.clipGroup}_ensureTransformGroup(){return this.tgrp||(this.tgrp=this.svgFactory.createElement("svg:g"),this.tgrp.setAttributeNS(null,"transform",v(this.transformMatrix)),this.current.activeClipUrl?this._ensureClipGroup().append(this.tgrp):this.svg.append(this.tgrp)),this.tgrp}}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFNodeStream=void 0;var r=n(1),i=n(33);const s=require$$5,a=require$$5,o=require$$5,l=require$$5,c=/^file:\/\/\/[a-zA-Z]:\//;t.PDFNodeStream=class{constructor(e){this.source=e,this.url=function(e){const t=l.parse(e);return"file:"===t.protocol||t.host?t:/^[a-z]:[/\\]/i.test(e)?l.parse(`file:///${e}`):(t.host||(t.protocol="file:"),t)}(e.url),this.isHttp="http:"===this.url.protocol||"https:"===this.url.protocol,this.isFsUrl="file:"===this.url.protocol,this.httpHeaders=this.isHttp&&e.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return(0,r.assert)(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new g(this):new p(this),this._fullRequestReader}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const n=this.isFsUrl?new m(this,e,t):new f(this,e,t);return this._rangeRequestReaders.push(n),n}cancelAllRequests(e){this._fullRequestReader&&this._fullRequestReader.cancel(e);for(const t of this._rangeRequestReaders.slice(0))t.cancel(e)}};class u{constructor(e){this._url=e.url,this._done=!1,this._storedError=null,this.onProgress=null;const t=e.source;this._contentLength=t.length,this._loaded=0,this._filename=null,this._disableRange=t.disableRange||!1,this._rangeChunkSize=t.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._isStreamingSupported=!t.disableStream,this._isRangeSupported=!t.disableRange,this._readableStream=null,this._readCapability=(0,r.createPromiseCapability)(),this._headersCapability=(0,r.createPromiseCapability)()}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(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();return null===e?(this._readCapability=(0,r.createPromiseCapability)(),this.read()):(this._loaded+=e.length,this.onProgress&&this.onProgress({loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(e).buffer,done:!1})}cancel(e){this._readableStream?this._readableStream.destroy(e):this._error(e)}_error(e){this._storedError=e,this._readCapability.resolve()}_setReadableStream(e){this._readableStream=e,e.on("readable",(()=>{this._readCapability.resolve()})),e.on("end",(()=>{e.destroy(),this._done=!0,this._readCapability.resolve()})),e.on("error",(e=>{this._error(e)})),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new r.AbortException("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class d{constructor(e){this._url=e.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=(0,r.createPromiseCapability)();const t=e.source;this._isStreamingSupported=!t.disableStream}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();return null===e?(this._readCapability=(0,r.createPromiseCapability)(),this.read()):(this._loaded+=e.length,this.onProgress&&this.onProgress({loaded:this._loaded}),{value:new Uint8Array(e).buffer,done:!1})}cancel(e){this._readableStream?this._readableStream.destroy(e):this._error(e)}_error(e){this._storedError=e,this._readCapability.resolve()}_setReadableStream(e){this._readableStream=e,e.on("readable",(()=>{this._readCapability.resolve()})),e.on("end",(()=>{e.destroy(),this._done=!0,this._readCapability.resolve()})),e.on("error",(e=>{this._error(e)})),this._storedError&&this._readableStream.destroy(this._storedError)}}function h(e,t){return{protocol:e.protocol,auth:e.auth,host:e.hostname,port:e.port,path:e.path,method:"GET",headers:t}}class p extends u{constructor(e){super(e);const t=t=>{if(404===t.statusCode){const e=new r.MissingPDFException(`Missing PDF "${this._url}".`);return this._storedError=e,void this._headersCapability.reject(e)}this._headersCapability.resolve(),this._setReadableStream(t);const n=e=>this._readableStream.headers[e.toLowerCase()],{allowRangeRequests:s,suggestedLength:a}=(0,i.validateRangeRequestCapabilities)({getResponseHeader:n,isHttp:e.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=s,this._contentLength=a||this._contentLength,this._filename=(0,i.extractFilenameFromHeader)(n)};this._request=null,"http:"===this._url.protocol?this._request=a.request(h(this._url,e.httpHeaders),t):this._request=o.request(h(this._url,e.httpHeaders),t),this._request.on("error",(e=>{this._storedError=e,this._headersCapability.reject(e)})),this._request.end()}}class f extends d{constructor(e,t,n){super(e),this._httpHeaders={};for(const t in e.httpHeaders){const n=e.httpHeaders[t];void 0!==n&&(this._httpHeaders[t]=n)}this._httpHeaders.Range=`bytes=${t}-${n-1}`;const i=e=>{if(404!==e.statusCode)this._setReadableStream(e);else{const e=new r.MissingPDFException(`Missing PDF "${this._url}".`);this._storedError=e}};this._request=null,"http:"===this._url.protocol?this._request=a.request(h(this._url,this._httpHeaders),i):this._request=o.request(h(this._url,this._httpHeaders),i),this._request.on("error",(e=>{this._storedError=e})),this._request.end()}}class g extends u{constructor(e){super(e);let t=decodeURIComponent(this._url.path);c.test(this._url.href)&&(t=t.replace(/^\//,"")),s.lstat(t,((e,n)=>{if(e)return"ENOENT"===e.code&&(e=new r.MissingPDFException(`Missing PDF "${t}".`)),this._storedError=e,void this._headersCapability.reject(e);this._contentLength=n.size,this._setReadableStream(s.createReadStream(t)),this._headersCapability.resolve()}))}}class m extends d{constructor(e,t,n){super(e);let r=decodeURIComponent(this._url.path);c.test(this._url.href)&&(r=r.replace(/^\//,"")),this._setReadableStream(s.createReadStream(r,{start:t,end:n-1}))}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.createResponseStatusError=function(e,t){return 404===e||0===e&&t.startsWith("file:")?new r.MissingPDFException('Missing PDF "'+t+'".'):new r.UnexpectedResponseException(`Unexpected server response (${e}) while retrieving PDF "${t}".`,e)},t.extractFilenameFromHeader=function(e){const t=e("Content-Disposition");if(t){let e=(0,i.getFilenameFromContentDispositionHeader)(t);if(e.includes("%"))try{e=decodeURIComponent(e)}catch(e){}if((0,s.isPdfFile)(e))return e}return null},t.validateRangeRequestCapabilities=function({getResponseHeader:e,isHttp:t,rangeChunkSize:n,disableRange:r}){const i={allowRangeRequests:!1,suggestedLength:void 0},s=parseInt(e("Content-Length"),10);return Number.isInteger(s)?(i.suggestedLength=s,s<=2*n||r||!t||"bytes"!==e("Accept-Ranges")||"identity"!==(e("Content-Encoding")||"identity")||(i.allowRangeRequests=!0),i):i},t.validateResponseStatus=function(e){return 200===e||206===e};var r=n(1),i=n(34),s=n(8)},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.getFilenameFromContentDispositionHeader=function(e){let t=!0,n=i("filename\\*","i").exec(e);if(n){n=n[1];let e=o(n);return e=unescape(e),e=l(e),e=c(e),a(e)}if(n=function(e){const t=[];let n;const r=i("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;null!==(n=r.exec(e));){let[,e,r,i]=n;if(e=parseInt(e,10),e in t){if(0===e)break}else t[e]=[r,i]}const s=[];for(let e=0;e<t.length&&e in t;++e){let[n,r]=t[e];r=o(r),n&&(r=unescape(r),0===e&&(r=l(r))),s.push(r)}return s.join("")}(e),n)return a(c(n));if(n=i("filename","i").exec(e),n){n=n[1];let e=o(n);return e=c(e),a(e)}function i(e,t){return new RegExp("(?:^|;)\\s*"+e+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',t)}function s(e,n){if(e){if(!/^[\x00-\xFF]+$/.test(n))return n;try{const i=new TextDecoder(e,{fatal:!0}),s=(0,r.stringToBytes)(n);n=i.decode(s),t=!1}catch(e){}}return n}function a(e){return t&&/[\x80-\xff]/.test(e)&&(e=s("utf-8",e),t&&(e=s("iso-8859-1",e))),e}function o(e){if(e.startsWith('"')){const t=e.slice(1).split('\\"');for(let e=0;e<t.length;++e){const n=t[e].indexOf('"');-1!==n&&(t[e]=t[e].slice(0,n),t.length=e+1),t[e]=t[e].replace(/\\(.)/g,"$1")}e=t.join('"')}return e}function l(e){const t=e.indexOf("'");return-1===t?e:s(e.slice(0,t),e.slice(t+1).replace(/^[^']*'/,""))}function c(e){return!e.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(e)?e:e.replace(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,(function(e,t,n,r){if("q"===n||"Q"===n)return s(t,r=(r=r.replace(/_/g," ")).replace(/=([0-9a-fA-F]{2})/g,(function(e,t){return String.fromCharCode(parseInt(t,16))})));try{r=atob(r)}catch(e){}return s(t,r)}))}return""};var r=n(1)},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFNetworkStream=void 0;var r=n(1),i=n(33);class s{constructor(e,t={}){this.url=e,this.isHttp=/^https?:/i.test(e),this.httpHeaders=this.isHttp&&t.httpHeaders||Object.create(null),this.withCredentials=t.withCredentials||!1,this.getXhr=t.getXhr||function(){return new XMLHttpRequest},this.currXhrId=0,this.pendingRequests=Object.create(null)}requestRange(e,t,n){const r={begin:e,end:t};for(const e in n)r[e]=n[e];return this.request(r)}requestFull(e){return this.request(e)}request(e){const t=this.getXhr(),n=this.currXhrId++,r=this.pendingRequests[n]={xhr:t};t.open("GET",this.url),t.withCredentials=this.withCredentials;for(const e in this.httpHeaders){const n=this.httpHeaders[e];void 0!==n&&t.setRequestHeader(e,n)}return this.isHttp&&"begin"in e&&"end"in e?(t.setRequestHeader("Range",`bytes=${e.begin}-${e.end-1}`),r.expectedStatus=206):r.expectedStatus=200,t.responseType="arraybuffer",e.onError&&(t.onerror=function(n){e.onError(t.status)}),t.onreadystatechange=this.onStateChange.bind(this,n),t.onprogress=this.onProgress.bind(this,n),r.onHeadersReceived=e.onHeadersReceived,r.onDone=e.onDone,r.onError=e.onError,r.onProgress=e.onProgress,t.send(null),n}onProgress(e,t){const n=this.pendingRequests[e];n&&n.onProgress?.(t)}onStateChange(e,t){const n=this.pendingRequests[e];if(!n)return;const i=n.xhr;if(i.readyState>=2&&n.onHeadersReceived&&(n.onHeadersReceived(),delete n.onHeadersReceived),4!==i.readyState)return;if(!(e in this.pendingRequests))return;if(delete this.pendingRequests[e],0===i.status&&this.isHttp)return void n.onError?.(i.status);const s=i.status||200;if((200!==s||206!==n.expectedStatus)&&s!==n.expectedStatus)return void n.onError?.(i.status);const a=function(e){const t=e.response;return"string"!=typeof t?t:(0,r.stringToBytes)(t).buffer}(i);if(206===s){const e=i.getResponseHeader("Content-Range"),t=/bytes (\d+)-(\d+)\/(\d+)/.exec(e);n.onDone({begin:parseInt(t[1],10),chunk:a})}else a?n.onDone({begin:0,chunk:a}):n.onError?.(i.status)}getRequestXhr(e){return this.pendingRequests[e].xhr}isPendingRequest(e){return e in this.pendingRequests}abortRequest(e){const t=this.pendingRequests[e].xhr;delete this.pendingRequests[e],t.abort()}}t.PDFNetworkStream=class{constructor(e){this._source=e,this._manager=new s(e.url,{httpHeaders:e.httpHeaders,withCredentials:e.withCredentials}),this._rangeChunkSize=e.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(e){const t=this._rangeRequestReaders.indexOf(e);t>=0&&this._rangeRequestReaders.splice(t,1)}getFullReader(){return(0,r.assert)(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new a(this._manager,this._source),this._fullRequestReader}getRangeReader(e,t){const n=new o(this._manager,e,t);return n.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(n),n}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(const t of this._rangeRequestReaders.slice(0))t.cancel(e)}};class a{constructor(e,t){this._manager=e;const n={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=t.url,this._fullRequestId=e.requestFull(n),this._headersReceivedCapability=(0,r.createPromiseCapability)(),this._disableRange=t.disableRange||!1,this._contentLength=t.length,this._rangeChunkSize=t.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._isStreamingSupported=!1,this._isRangeSupported=!1,this._cachedChunks=[],this._requests=[],this._done=!1,this._storedError=void 0,this._filename=null,this.onProgress=null}_onHeadersReceived(){const e=this._fullRequestId,t=this._manager.getRequestXhr(e),n=e=>t.getResponseHeader(e),{allowRangeRequests:r,suggestedLength:s}=(0,i.validateRangeRequestCapabilities)({getResponseHeader:n,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});r&&(this._isRangeSupported=!0),this._contentLength=s||this._contentLength,this._filename=(0,i.extractFilenameFromHeader)(n),this._isRangeSupported&&this._manager.abortRequest(e),this._headersReceivedCapability.resolve()}_onDone(e){if(e&&(this._requests.length>0?this._requests.shift().resolve({value:e.chunk,done:!1}):this._cachedChunks.push(e.chunk)),this._done=!0,!(this._cachedChunks.length>0)){for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(e){this._storedError=(0,i.createResponseStatusError)(e,this._url),this._headersReceivedCapability.reject(this._storedError);for(const e of this._requests)e.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(e){this.onProgress?.({loaded:e.loaded,total:e.lengthComputable?e.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersReceivedCapability.promise}async read(){if(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};const e=(0,r.createPromiseCapability)();return this._requests.push(e),e.promise}cancel(e){this._done=!0,this._headersReceivedCapability.reject(e);for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class o{constructor(e,t,n){this._manager=e;const r={onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=e.url,this._requestId=e.requestRange(t,n,r),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_close(){this.onClosed?.(this)}_onDone(e){const t=e.chunk;this._requests.length>0?this._requests.shift().resolve({value:t,done:!1}):this._queuedChunk=t,this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(e){this._storedError=(0,i.createResponseStatusError)(e,this._url);for(const e of this._requests)e.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(e){this.isStreamingSupported||this.onProgress?.({loaded:e.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(null!==this._queuedChunk){const e=this._queuedChunk;return this._queuedChunk=null,{value:e,done:!1}}if(this._done)return{value:void 0,done:!0};const e=(0,r.createPromiseCapability)();return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(const e of this._requests)e.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFFetchStream=void 0;var r=n(1),i=n(33);function s(e,t,n){return{method:"GET",headers:e,signal:n.signal,mode:"cors",credentials:t?"include":"same-origin",redirect:"follow"}}function a(e){const t=new Headers;for(const n in e){const r=e[n];void 0!==r&&t.append(n,r)}return t}t.PDFFetchStream=class{constructor(e){this.source=e,this.isHttp=/^https?:/i.test(e.url),this.httpHeaders=this.isHttp&&e.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return(0,r.assert)(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new o(this),this._fullRequestReader}getRangeReader(e,t){if(t<=this._progressiveDataLength)return null;const n=new l(this,e,t);return this._rangeRequestReaders.push(n),n}cancelAllRequests(e){this._fullRequestReader&&this._fullRequestReader.cancel(e);for(const t of this._rangeRequestReaders.slice(0))t.cancel(e)}};class o{constructor(e){this._stream=e,this._reader=null,this._loaded=0,this._filename=null;const t=e.source;this._withCredentials=t.withCredentials||!1,this._contentLength=t.length,this._headersCapability=(0,r.createPromiseCapability)(),this._disableRange=t.disableRange||!1,this._rangeChunkSize=t.rangeChunkSize,this._rangeChunkSize||this._disableRange||(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!t.disableStream,this._isRangeSupported=!t.disableRange,this._headers=a(this._stream.httpHeaders);const n=t.url;fetch(n,s(this._headers,this._withCredentials,this._abortController)).then((e=>{if(!(0,i.validateResponseStatus)(e.status))throw(0,i.createResponseStatusError)(e.status,n);this._reader=e.body.getReader(),this._headersCapability.resolve();const t=t=>e.headers.get(t),{allowRangeRequests:s,suggestedLength:a}=(0,i.validateRangeRequestCapabilities)({getResponseHeader:t,isHttp:this._stream.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=s,this._contentLength=a||this._contentLength,this._filename=(0,i.extractFilenameFromHeader)(t),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new r.AbortException("Streaming is disabled."))})).catch(this._headersCapability.reject),this.onProgress=null}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(){await this._headersCapability.promise;const{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:(this._loaded+=e.byteLength,this.onProgress&&this.onProgress({loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(e).buffer,done:!1})}cancel(e){this._reader&&this._reader.cancel(e),this._abortController.abort()}}class l{constructor(e,t,n){this._stream=e,this._reader=null,this._loaded=0;const o=e.source;this._withCredentials=o.withCredentials||!1,this._readCapability=(0,r.createPromiseCapability)(),this._isStreamingSupported=!o.disableStream,this._abortController=new AbortController,this._headers=a(this._stream.httpHeaders),this._headers.append("Range",`bytes=${t}-${n-1}`);const l=o.url;fetch(l,s(this._headers,this._withCredentials,this._abortController)).then((e=>{if(!(0,i.validateResponseStatus)(e.status))throw(0,i.createResponseStatusError)(e.status,l);this._readCapability.resolve(),this._reader=e.body.getReader()})).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._readCapability.promise;const{value:e,done:t}=await this._reader.read();return t?{value:e,done:t}:(this._loaded+=e.byteLength,this.onProgress&&this.onProgress({loaded:this._loaded}),{value:new Uint8Array(e).buffer,done:!1})}cancel(e){this._reader&&this._reader.cancel(e),this._abortController.abort()}}}],__webpack_module_cache__={};function __w_pdfjs_require__(e){var t=__webpack_module_cache__[e];if(void 0!==t)return t.exports;var n=__webpack_module_cache__[e]={exports:{}};return __webpack_modules__[e](n,n.exports,__w_pdfjs_require__),n.exports}var __webpack_exports__={};return(()=>{var e=__webpack_exports__;Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"AnnotationEditorLayer",{enumerable:!0,get:function(){return i.AnnotationEditorLayer}}),Object.defineProperty(e,"AnnotationEditorParamsType",{enumerable:!0,get:function(){return t.AnnotationEditorParamsType}}),Object.defineProperty(e,"AnnotationEditorType",{enumerable:!0,get:function(){return t.AnnotationEditorType}}),Object.defineProperty(e,"AnnotationEditorUIManager",{enumerable:!0,get:function(){return s.AnnotationEditorUIManager}}),Object.defineProperty(e,"AnnotationLayer",{enumerable:!0,get:function(){return a.AnnotationLayer}}),Object.defineProperty(e,"AnnotationMode",{enumerable:!0,get:function(){return t.AnnotationMode}}),Object.defineProperty(e,"CMapCompressionType",{enumerable:!0,get:function(){return t.CMapCompressionType}}),Object.defineProperty(e,"GlobalWorkerOptions",{enumerable:!0,get:function(){return o.GlobalWorkerOptions}}),Object.defineProperty(e,"InvalidPDFException",{enumerable:!0,get:function(){return t.InvalidPDFException}}),Object.defineProperty(e,"LoopbackPort",{enumerable:!0,get:function(){return n.LoopbackPort}}),Object.defineProperty(e,"MissingPDFException",{enumerable:!0,get:function(){return t.MissingPDFException}}),Object.defineProperty(e,"OPS",{enumerable:!0,get:function(){return t.OPS}}),Object.defineProperty(e,"PDFDataRangeTransport",{enumerable:!0,get:function(){return n.PDFDataRangeTransport}}),Object.defineProperty(e,"PDFDateString",{enumerable:!0,get:function(){return r.PDFDateString}}),Object.defineProperty(e,"PDFWorker",{enumerable:!0,get:function(){return n.PDFWorker}}),Object.defineProperty(e,"PasswordResponses",{enumerable:!0,get:function(){return t.PasswordResponses}}),Object.defineProperty(e,"PermissionFlag",{enumerable:!0,get:function(){return t.PermissionFlag}}),Object.defineProperty(e,"PixelsPerInch",{enumerable:!0,get:function(){return r.PixelsPerInch}}),Object.defineProperty(e,"RenderingCancelledException",{enumerable:!0,get:function(){return r.RenderingCancelledException}}),Object.defineProperty(e,"SVGGraphics",{enumerable:!0,get:function(){return u.SVGGraphics}}),Object.defineProperty(e,"UNSUPPORTED_FEATURES",{enumerable:!0,get:function(){return t.UNSUPPORTED_FEATURES}}),Object.defineProperty(e,"UnexpectedResponseException",{enumerable:!0,get:function(){return t.UnexpectedResponseException}}),Object.defineProperty(e,"Util",{enumerable:!0,get:function(){return t.Util}}),Object.defineProperty(e,"VerbosityLevel",{enumerable:!0,get:function(){return t.VerbosityLevel}}),Object.defineProperty(e,"XfaLayer",{enumerable:!0,get:function(){return d.XfaLayer}}),Object.defineProperty(e,"build",{enumerable:!0,get:function(){return n.build}}),Object.defineProperty(e,"createPromiseCapability",{enumerable:!0,get:function(){return t.createPromiseCapability}}),Object.defineProperty(e,"createValidAbsoluteUrl",{enumerable:!0,get:function(){return t.createValidAbsoluteUrl}}),Object.defineProperty(e,"getDocument",{enumerable:!0,get:function(){return n.getDocument}}),Object.defineProperty(e,"getFilenameFromUrl",{enumerable:!0,get:function(){return r.getFilenameFromUrl}}),Object.defineProperty(e,"getPdfFilenameFromUrl",{enumerable:!0,get:function(){return r.getPdfFilenameFromUrl}}),Object.defineProperty(e,"getXfaPageViewport",{enumerable:!0,get:function(){return r.getXfaPageViewport}}),Object.defineProperty(e,"isPdfFile",{enumerable:!0,get:function(){return r.isPdfFile}}),Object.defineProperty(e,"loadScript",{enumerable:!0,get:function(){return r.loadScript}}),Object.defineProperty(e,"renderTextLayer",{enumerable:!0,get:function(){return c.renderTextLayer}}),Object.defineProperty(e,"shadow",{enumerable:!0,get:function(){return t.shadow}}),Object.defineProperty(e,"version",{enumerable:!0,get:function(){return n.version}});var t=__w_pdfjs_require__(1),n=__w_pdfjs_require__(4),r=__w_pdfjs_require__(8),i=__w_pdfjs_require__(22),s=__w_pdfjs_require__(7),a=__w_pdfjs_require__(27),o=__w_pdfjs_require__(15),l=__w_pdfjs_require__(3),c=__w_pdfjs_require__(30),u=__w_pdfjs_require__(31),d=__w_pdfjs_require__(29);if(l.isNodeJS){const{PDFNodeStream:e}=__w_pdfjs_require__(32);(0,n.setPDFNetworkStreamFactory)((t=>new e(t)))}else{const{PDFNetworkStream:e}=__w_pdfjs_require__(35),{PDFFetchStream:t}=__w_pdfjs_require__(36);(0,n.setPDFNetworkStreamFactory)((n=>(0,r.isValidFetchUrl)(n.url)?new t(n):new e(n)))}})(),__webpack_exports__})(),module.exports=factory()}(pdf)),pdf.exports}var pdfExports=requirePdf(),pdf_viewer={exports:{}},factory;globalThis,factory=()=>(()=>{var e=[,(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DefaultXfaLayerFactory=t.DefaultTextLayerFactory=t.DefaultStructTreeLayerFactory=t.DefaultAnnotationLayerFactory=t.DefaultAnnotationEditorLayerFactory=void 0;var r=n(2),i=n(5),s=n(4),a=n(6),o=n(8),l=n(9),c=n(10);t.DefaultAnnotationLayerFactory=class{createAnnotationLayerBuilder({pageDiv:e,pdfPage:t,annotationStorage:n=null,imageResourcesPath:r="",renderForms:o=!0,l10n:l=s.NullL10n,enableScripting:c=!1,hasJSActionsPromise:u=null,mouseState:d=null,fieldObjectsPromise:h=null,annotationCanvasMap:p=null,accessibilityManager:f=null}){return new i.AnnotationLayerBuilder({pageDiv:e,pdfPage:t,imageResourcesPath:r,renderForms:o,linkService:new a.SimpleLinkService,l10n:l,annotationStorage:n,enableScripting:c,hasJSActionsPromise:u,fieldObjectsPromise:h,mouseState:d,annotationCanvasMap:p,accessibilityManager:f})}},t.DefaultAnnotationEditorLayerFactory=class{createAnnotationEditorLayerBuilder({uiManager:e=null,pageDiv:t,pdfPage:n,accessibilityManager:i=null,l10n:s,annotationStorage:a=null}){return new r.AnnotationEditorLayerBuilder({uiManager:e,pageDiv:t,pdfPage:n,accessibilityManager:i,l10n:s,annotationStorage:a})}},t.DefaultStructTreeLayerFactory=class{createStructTreeLayerBuilder({pdfPage:e}){return new o.StructTreeLayerBuilder({pdfPage:e})}},t.DefaultTextLayerFactory=class{createTextLayerBuilder({textLayerDiv:e,pageIndex:t,viewport:n,enhanceTextSelection:r=!1,eventBus:i,highlighter:s,accessibilityManager:a=null}){return new l.TextLayerBuilder({textLayerDiv:e,pageIndex:t,viewport:n,enhanceTextSelection:r,eventBus:i,highlighter:s,accessibilityManager:a})}},t.DefaultXfaLayerFactory=class{createXfaLayerBuilder({pageDiv:e,pdfPage:t,annotationStorage:n=null}){return new c.XfaLayerBuilder({pageDiv:e,pdfPage:t,annotationStorage:n,linkService:new a.SimpleLinkService})}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AnnotationEditorLayerBuilder=void 0;var r=n(3),i=n(4);t.AnnotationEditorLayerBuilder=class{#pe;constructor(e){this.pageDiv=e.pageDiv,this.pdfPage=e.pdfPage,this.annotationStorage=e.annotationStorage||null,this.accessibilityManager=e.accessibilityManager,this.l10n=e.l10n||i.NullL10n,this.annotationEditorLayer=null,this.div=null,this._cancelled=!1,this.#pe=e.uiManager}async render(e,t="display"){if("display"!==t)return;if(this._cancelled)return;const n=e.clone({dontFlip:!0});if(this.div)return this.annotationEditorLayer.update({viewport:n}),void this.show();this.div=document.createElement("div"),this.div.className="annotationEditorLayer",this.div.tabIndex=0,this.pageDiv.append(this.div),this.annotationEditorLayer=new r.AnnotationEditorLayer({uiManager:this.#pe,div:this.div,annotationStorage:this.annotationStorage,accessibilityManager:this.accessibilityManager,pageIndex:this.pdfPage._pageIndex,l10n:this.l10n,viewport:n});const i={viewport:n,div:this.div,annotations:null,intent:t};this.annotationEditorLayer.render(i)}cancel(){this._cancelled=!0,this.destroy()}hide(){this.div&&(this.div.hidden=!0)}show(){this.div&&(this.div.hidden=!1)}destroy(){this.div&&(this.pageDiv=null,this.annotationEditorLayer.destroy(),this.div.remove())}}},e=>{let t;t="undefined"!=typeof window&&window["pdfjs-dist/build/pdf"]?window["pdfjs-dist/build/pdf"]:requirePdf(),e.exports=t},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.NullL10n=void 0,t.fixupLangCode=function(e){return i[e?.toLowerCase()]||e},t.getL10nFallback=r;const n={of_pages:"of {{pagesCount}}",page_of_pages:"({{pageNumber}} of {{pagesCount}})",document_properties_kb:"{{size_kb}} KB ({{size_b}} bytes)",document_properties_mb:"{{size_mb}} MB ({{size_b}} bytes)",document_properties_date_string:"{{date}}, {{time}}",document_properties_page_size_unit_inches:"in",document_properties_page_size_unit_millimeters:"mm",document_properties_page_size_orientation_portrait:"portrait",document_properties_page_size_orientation_landscape:"landscape",document_properties_page_size_name_a3:"A3",document_properties_page_size_name_a4:"A4",document_properties_page_size_name_letter:"Letter",document_properties_page_size_name_legal:"Legal",document_properties_page_size_dimension_string:"{{width}} × {{height}} {{unit}} ({{orientation}})",document_properties_page_size_dimension_name_string:"{{width}} × {{height}} {{unit}} ({{name}}, {{orientation}})",document_properties_linearized_yes:"Yes",document_properties_linearized_no:"No",print_progress_percent:"{{progress}}%","toggle_sidebar.title":"Toggle Sidebar","toggle_sidebar_notification2.title":"Toggle Sidebar (document contains outline/attachments/layers)",additional_layers:"Additional Layers",page_landmark:"Page {{page}}",thumb_page_title:"Page {{page}}",thumb_page_canvas:"Thumbnail of Page {{page}}",find_reached_top:"Reached top of document, continued from bottom",find_reached_bottom:"Reached end of document, continued from top","find_match_count[one]":"{{current}} of {{total}} match","find_match_count[other]":"{{current}} of {{total}} matches","find_match_count_limit[one]":"More than {{limit}} match","find_match_count_limit[other]":"More than {{limit}} matches",find_not_found:"Phrase not found",error_version_info:"PDF.js v{{version}} (build: {{build}})",error_message:"Message: {{message}}",error_stack:"Stack: {{stack}}",error_file:"File: {{file}}",error_line:"Line: {{line}}",rendering_error:"An error occurred while rendering the page.",page_scale_width:"Page Width",page_scale_fit:"Page Fit",page_scale_auto:"Automatic Zoom",page_scale_actual:"Actual Size",page_scale_percent:"{{scale}}%",loading:"Loading…",loading_error:"An error occurred while loading the PDF.",invalid_file_error:"Invalid or corrupted PDF file.",missing_file_error:"Missing PDF file.",unexpected_response_error:"Unexpected server response.",printing_not_supported:"Warning: Printing is not fully supported by this browser.",printing_not_ready:"Warning: The PDF is not fully loaded for printing.",web_fonts_disabled:"Web fonts are disabled: unable to use embedded PDF fonts.",free_text_default_content:"Enter text…",editor_free_text_aria_label:"FreeText Editor",editor_ink_aria_label:"Ink Editor",editor_ink_canvas_aria_label:"User-created image"};function r(e,t){switch(e){case"find_match_count":e=`find_match_count[${1===t.total?"one":"other"}]`;break;case"find_match_count_limit":e=`find_match_count_limit[${1===t.limit?"one":"other"}]`}return n[e]||""}const i={en:"en-US",es:"es-ES",fy:"fy-NL",ga:"ga-IE",gu:"gu-IN",hi:"hi-IN",hy:"hy-AM",nb:"nb-NO",ne:"ne-NP",nn:"nn-NO",pa:"pa-IN",pt:"pt-PT",sv:"sv-SE",zh:"zh-CN"},s={getLanguage:async()=>"en-us",getDirection:async()=>"ltr",get:async(e,t=null,n=r(e,t))=>function(e,t){return t?e.replace(/\{\{\s*(\w+)\s*\}\}/g,((e,n)=>n in t?t[n]:"{{"+n+"}}")):e}(n,t),async translate(e){}};t.NullL10n=s},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.AnnotationLayerBuilder=void 0;var r=n(3),i=n(4);t.AnnotationLayerBuilder=class{constructor({pageDiv:e,pdfPage:t,linkService:n,downloadManager:r,annotationStorage:s=null,imageResourcesPath:a="",renderForms:o=!0,l10n:l=i.NullL10n,enableScripting:c=!1,hasJSActionsPromise:u=null,fieldObjectsPromise:d=null,mouseState:h=null,annotationCanvasMap:p=null,accessibilityManager:f=null}){this.pageDiv=e,this.pdfPage=t,this.linkService=n,this.downloadManager=r,this.imageResourcesPath=a,this.renderForms=o,this.l10n=l,this.annotationStorage=s,this.enableScripting=c,this._hasJSActionsPromise=u,this._fieldObjectsPromise=d,this._mouseState=h,this._annotationCanvasMap=p,this._accessibilityManager=f,this.div=null,this._cancelled=!1}async render(e,t="display"){const[n,i=!1,s=null]=await Promise.all([this.pdfPage.getAnnotations({intent:t}),this._hasJSActionsPromise,this._fieldObjectsPromise]);if(this._cancelled||0===n.length)return;const a={viewport:e.clone({dontFlip:!0}),div:this.div,annotations:n,page:this.pdfPage,imageResourcesPath:this.imageResourcesPath,renderForms:this.renderForms,linkService:this.linkService,downloadManager:this.downloadManager,annotationStorage:this.annotationStorage,enableScripting:this.enableScripting,hasJSActions:i,fieldObjects:s,mouseState:this._mouseState,annotationCanvasMap:this._annotationCanvasMap,accessibilityManager:this._accessibilityManager};this.div?r.AnnotationLayer.update(a):(this.div=document.createElement("div"),this.div.className="annotationLayer",this.pageDiv.append(this.div),a.div=this.div,r.AnnotationLayer.render(a),this.l10n.translate(this.div))}cancel(){this._cancelled=!0}hide(){this.div&&(this.div.hidden=!0)}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.SimpleLinkService=t.PDFLinkService=t.LinkTarget=void 0;var r=n(7);const i={NONE:0,SELF:1,BLANK:2,PARENT:3,TOP:4};function s(e,{url:t,target:n,rel:s,enabled:a=!0}={}){if(!t||"string"!=typeof t)throw new Error('A valid "url" parameter must provided.');const o=(0,r.removeNullCharacters)(t);a?e.href=e.title=o:(e.href="",e.title=`Disabled: ${o}`,e.onclick=()=>!1);let l="";switch(n){case i.NONE:break;case i.SELF:l="_self";break;case i.BLANK:l="_blank";break;case i.PARENT:l="_parent";break;case i.TOP:l="_top"}e.target=l,e.rel="string"==typeof s?s:"noopener noreferrer nofollow"}t.LinkTarget=i;class a{#ft=new Map;constructor({eventBus:e,externalLinkTarget:t=null,externalLinkRel:n=null,ignoreDestinationZoom:r=!1}={}){this.eventBus=e,this.externalLinkTarget=t,this.externalLinkRel=n,this.externalLinkEnabled=!0,this._ignoreDestinationZoom=r,this.baseUrl=null,this.pdfDocument=null,this.pdfViewer=null,this.pdfHistory=null}setDocument(e,t=null){this.baseUrl=t,this.pdfDocument=e,this.#ft.clear()}setViewer(e){this.pdfViewer=e}setHistory(e){this.pdfHistory=e}get pagesCount(){return this.pdfDocument?this.pdfDocument.numPages:0}get page(){return this.pdfViewer.currentPageNumber}set page(e){this.pdfViewer.currentPageNumber=e}get rotation(){return this.pdfViewer.pagesRotation}set rotation(e){this.pdfViewer.pagesRotation=e}#gt(e,t=null,n){const r=n[0];let i;if("object"==typeof r&&null!==r){if(i=this._cachedPageNumber(r),!i)return void this.pdfDocument.getPageIndex(r).then((i=>{this.cachePageRef(i+1,r),this.#gt(e,t,n)})).catch((()=>{console.error(`PDFLinkService.#goToDestinationHelper: "${r}" is not a valid page reference, for dest="${e}".`)}))}else{if(!Number.isInteger(r))return void console.error(`PDFLinkService.#goToDestinationHelper: "${r}" is not a valid destination reference, for dest="${e}".`);i=r+1}!i||i<1||i>this.pagesCount?console.error(`PDFLinkService.#goToDestinationHelper: "${i}" is not a valid page number, for dest="${e}".`):(this.pdfHistory&&(this.pdfHistory.pushCurrentPosition(),this.pdfHistory.push({namedDest:t,explicitDest:n,pageNumber:i})),this.pdfViewer.scrollPageIntoView({pageNumber:i,destArray:n,ignoreDestinationZoom:this._ignoreDestinationZoom}))}async goToDestination(e){if(!this.pdfDocument)return;let t,n;"string"==typeof e?(t=e,n=await this.pdfDocument.getDestination(e)):(t=null,n=await e),Array.isArray(n)?this.#gt(e,t,n):console.error(`PDFLinkService.goToDestination: "${n}" is not a valid destination array, for dest="${e}".`)}goToPage(e){if(!this.pdfDocument)return;const t="string"==typeof e&&this.pdfViewer.pageLabelToPageNumber(e)||0|e;Number.isInteger(t)&&t>0&&t<=this.pagesCount?(this.pdfHistory&&(this.pdfHistory.pushCurrentPosition(),this.pdfHistory.pushPage(t)),this.pdfViewer.scrollPageIntoView({pageNumber:t})):console.error(`PDFLinkService.goToPage: "${e}" is not a valid page.`)}addLinkAttributes(e,t,n=!1){s(e,{url:t,target:n?i.BLANK:this.externalLinkTarget,rel:this.externalLinkRel,enabled:this.externalLinkEnabled})}getDestinationHash(e){if("string"==typeof e){if(e.length>0)return this.getAnchorUrl("#"+escape(e))}else if(Array.isArray(e)){const t=JSON.stringify(e);if(t.length>0)return this.getAnchorUrl("#"+escape(t))}return this.getAnchorUrl("")}getAnchorUrl(e){return(this.baseUrl||"")+e}setHash(e){if(!this.pdfDocument)return;let t,n;if(e.includes("=")){const i=(0,r.parseQueryString)(e);if(i.has("search")&&this.eventBus.dispatch("findfromurlhash",{source:this,query:i.get("search").replace(/"/g,""),phraseSearch:"true"===i.get("phrase")}),i.has("page")&&(t=0|i.get("page")||1),i.has("zoom")){const e=i.get("zoom").split(","),t=e[0],r=parseFloat(t);t.includes("Fit")?"Fit"===t||"FitB"===t?n=[null,{name:t}]:"FitH"===t||"FitBH"===t||"FitV"===t||"FitBV"===t?n=[null,{name:t},e.length>1?0|e[1]:null]:"FitR"===t?5!==e.length?console.error('PDFLinkService.setHash: Not enough parameters for "FitR".'):n=[null,{name:t},0|e[1],0|e[2],0|e[3],0|e[4]]:console.error(`PDFLinkService.setHash: "${t}" is not a valid zoom value.`):n=[null,{name:"XYZ"},e.length>1?0|e[1]:null,e.length>2?0|e[2]:null,r?r/100:t]}n?this.pdfViewer.scrollPageIntoView({pageNumber:t||this.page,destArray:n,allowNegativeOffset:!0}):t&&(this.page=t),i.has("pagemode")&&this.eventBus.dispatch("pagemode",{source:this,mode:i.get("pagemode")}),i.has("nameddest")&&this.goToDestination(i.get("nameddest"))}else{n=unescape(e);try{n=JSON.parse(n),Array.isArray(n)||(n=n.toString())}catch(e){}if("string"==typeof n||a.#mt(n))return void this.goToDestination(n);console.error(`PDFLinkService.setHash: "${unescape(e)}" is not a valid destination.`)}}executeNamedAction(e){switch(e){case"GoBack":this.pdfHistory?.back();break;case"GoForward":this.pdfHistory?.forward();break;case"NextPage":this.pdfViewer.nextPage();break;case"PrevPage":this.pdfViewer.previousPage();break;case"LastPage":this.page=this.pagesCount;break;case"FirstPage":this.page=1}this.eventBus.dispatch("namedaction",{source:this,action:e})}cachePageRef(e,t){if(!t)return;const n=0===t.gen?`${t.num}R`:`${t.num}R${t.gen}`;this.#ft.set(n,e)}_cachedPageNumber(e){if(!e)return null;const t=0===e.gen?`${e.num}R`:`${e.num}R${e.gen}`;return this.#ft.get(t)||null}isPageVisible(e){return this.pdfViewer.isPageVisible(e)}isPageCached(e){return this.pdfViewer.isPageCached(e)}static#mt(e){if(!Array.isArray(e))return!1;const t=e.length;if(t<2)return!1;const n=e[0];if(!("object"==typeof n&&Number.isInteger(n.num)&&Number.isInteger(n.gen)||Number.isInteger(n)&&n>=0))return!1;const r=e[1];if("object"!=typeof r||"string"!=typeof r.name)return!1;let i=!0;switch(r.name){case"XYZ":if(5!==t)return!1;break;case"Fit":case"FitB":return 2===t;case"FitH":case"FitBH":case"FitV":case"FitBV":if(3!==t)return!1;break;case"FitR":if(6!==t)return!1;i=!1;break;default:return!1}for(let n=2;n<t;n++){const t=e[n];if(!("number"==typeof t||i&&null===t))return!1}return!0}}t.PDFLinkService=a,t.SimpleLinkService=class{constructor(){this.externalLinkEnabled=!0}get pagesCount(){return 0}get page(){return 0}set page(e){}get rotation(){return 0}set rotation(e){}async goToDestination(e){}goToPage(e){}addLinkAttributes(e,t,n=!1){s(e,{url:t,enabled:this.externalLinkEnabled})}getDestinationHash(e){return"#"}getAnchorUrl(e){return"#"}setHash(e){}executeNamedAction(e){}cachePageRef(e,t){}isPageVisible(e){return!0}isPageCached(e){return!0}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.animationStarted=t.VERTICAL_PADDING=t.UNKNOWN_SCALE=t.TextLayerMode=t.SpreadMode=t.SidebarView=t.ScrollMode=t.SCROLLBAR_PADDING=t.RenderingStates=t.RendererType=t.ProgressBar=t.PresentationModeState=t.OutputScale=t.MIN_SCALE=t.MAX_SCALE=t.MAX_AUTO_SCALE=t.DEFAULT_SCALE_VALUE=t.DEFAULT_SCALE_DELTA=t.DEFAULT_SCALE=t.AutoPrintRegExp=void 0,t.apiPageLayoutToViewerModes=function(e){let t=r.VERTICAL,n=i.NONE;switch(e){case"SinglePage":t=r.PAGE;break;case"OneColumn":break;case"TwoPageLeft":t=r.PAGE;case"TwoColumnLeft":n=i.ODD;break;case"TwoPageRight":t=r.PAGE;case"TwoColumnRight":n=i.EVEN}return{scrollMode:t,spreadMode:n}},t.apiPageModeToSidebarView=function(e){switch(e){case"UseNone":return n.NONE;case"UseThumbs":return n.THUMBS;case"UseOutlines":return n.OUTLINE;case"UseAttachments":return n.ATTACHMENTS;case"UseOC":return n.LAYERS}return n.NONE},t.approximateFraction=function(e){if(Math.floor(e)===e)return[e,1];const t=1/e;if(t>8)return[1,8];if(Math.floor(t)===t)return[1,t];const n=e>1?t:e;let r,i=0,s=1,a=1,o=1;for(;;){const e=i+a,t=s+o;if(t>8)break;n<=e/t?(a=e,o=t):(i=e,s=t)}return r=n-i/s<a/o-n?n===e?[i,s]:[s,i]:n===e?[a,o]:[o,a],r},t.backtrackBeforeAllVisibleElements=l,t.binarySearchFirstItem=o,t.docStyle=void 0,t.getActiveOrFocusedElement=function(){let e=document,t=e.activeElement||e.querySelector(":focus");for(;t?.shadowRoot;)e=t.shadowRoot,t=e.activeElement||e.querySelector(":focus");return t},t.getPageSizeInches=function({view:e,userUnit:t,rotate:n}){const[r,i,s,a]=e,o=n%180!=0,l=(s-r)/72*t,c=(a-i)/72*t;return{width:o?c:l,height:o?l:c}},t.getVisibleElements=function({scrollEl:e,views:t,sortByVisibility:n=!1,horizontal:r=!1,rtl:i=!1}){const s=e.scrollTop,a=s+e.clientHeight,c=e.scrollLeft,u=c+e.clientWidth,d=[],h=new Set,p=t.length;let f=o(t,r?function(e){const t=e.div,n=t.offsetLeft+t.clientLeft,r=n+t.clientWidth;return i?n<u:r>c}:function(e){const t=e.div;return t.offsetTop+t.clientTop+t.clientHeight>s});f>0&&f<p&&!r&&(f=l(f,t,s));let g=r?u:-1;for(let e=f;e<p;e++){const n=t[e],i=n.div,o=i.offsetLeft+i.clientLeft,l=i.offsetTop+i.clientTop,p=i.clientWidth,f=i.clientHeight,m=o+p,v=l+f;if(-1===g)v>=a&&(g=v);else if((r?o:l)>g)break;if(v<=s||l>=a||m<=c||o>=u)continue;const y=Math.max(0,s-l)+Math.max(0,v-a),b=Math.max(0,c-o)+Math.max(0,m-u),_=(p-b)/p,w=(f-y)/f*_*100|0;d.push({id:n.id,x:o,y:l,view:n,percent:w,widthPercent:100*_|0}),h.add(n.id)}const m=d[0],v=d.at(-1);return n&&d.sort((function(e,t){const n=e.percent-t.percent;return Math.abs(n)>.001?-n:e.id-t.id})),{first:m,last:v,views:d,ids:h}},t.isPortraitOrientation=function(e){return e.width<=e.height},t.isValidRotation=function(e){return Number.isInteger(e)&&e%90==0},t.isValidScrollMode=function(e){return Number.isInteger(e)&&Object.values(r).includes(e)&&e!==r.UNKNOWN},t.isValidSpreadMode=function(e){return Number.isInteger(e)&&Object.values(i).includes(e)&&e!==i.UNKNOWN},t.noContextMenuHandler=function(e){e.preventDefault()},t.normalizeWheelEventDelta=function(e){let t=c(e);return 0===e.deltaMode?t/=900:1===e.deltaMode&&(t/=30),t},t.normalizeWheelEventDirection=c,t.parseQueryString=function(e){const t=new Map;for(const[n,r]of new URLSearchParams(e))t.set(n.toLowerCase(),r);return t},t.removeNullCharacters=function(e,t=!1){return"string"!=typeof e?(console.error("The argument must be a string."),e):(t&&(e=e.replace(a," ")),e.replace(s,""))},t.roundToDivide=function(e,t){const n=e%t;return 0===n?e:Math.round(e-n+t)},t.scrollIntoView=function(e,t,n=!1){let r=e.offsetParent;if(!r)return void console.error("offsetParent is not set -- cannot scroll");let i=e.offsetTop+e.clientTop,s=e.offsetLeft+e.clientLeft;for(;r.clientHeight===r.scrollHeight&&r.clientWidth===r.scrollWidth||n&&(r.classList.contains("markedContent")||"hidden"===getComputedStyle(r).overflow);)if(i+=r.offsetTop,s+=r.offsetLeft,r=r.offsetParent,!r)return;t&&(void 0!==t.top&&(i+=t.top),void 0!==t.left&&(s+=t.left,r.scrollLeft=s)),r.scrollTop=i},t.watchScroll=function(e,t){const n=function(n){i||(i=window.requestAnimationFrame((function(){i=null;const n=e.scrollLeft,s=r.lastX;n!==s&&(r.right=n>s),r.lastX=n;const a=e.scrollTop,o=r.lastY;a!==o&&(r.down=a>o),r.lastY=a,t(r)})))},r={right:!0,down:!0,lastX:e.scrollLeft,lastY:e.scrollTop,_eventHandler:n};let i=null;return e.addEventListener("scroll",n,!0),r},t.DEFAULT_SCALE_VALUE="auto",t.DEFAULT_SCALE=1,t.DEFAULT_SCALE_DELTA=1.1,t.MIN_SCALE=.1,t.MAX_SCALE=10,t.UNKNOWN_SCALE=0,t.MAX_AUTO_SCALE=1.25,t.SCROLLBAR_PADDING=40,t.VERTICAL_PADDING=5,t.RenderingStates={INITIAL:0,RUNNING:1,PAUSED:2,FINISHED:3},t.PresentationModeState={UNKNOWN:0,NORMAL:1,CHANGING:2,FULLSCREEN:3};const n={UNKNOWN:-1,NONE:0,THUMBS:1,OUTLINE:2,ATTACHMENTS:3,LAYERS:4};t.SidebarView=n,t.RendererType={CANVAS:"canvas",SVG:"svg"},t.TextLayerMode={DISABLE:0,ENABLE:1,ENABLE_ENHANCE:2};const r={UNKNOWN:-1,VERTICAL:0,HORIZONTAL:1,WRAPPED:2,PAGE:3};t.ScrollMode=r;const i={UNKNOWN:-1,NONE:0,ODD:1,EVEN:2};t.SpreadMode=i,t.AutoPrintRegExp=/\bprint\s*\(/,t.OutputScale=class{constructor(){const e=window.devicePixelRatio||1;this.sx=e,this.sy=e}get scaled(){return 1!==this.sx||1!==this.sy}};const s=/\x00/g,a=/[\x01-\x1F]/g;function o(e,t,n=0){let r=n,i=e.length-1;if(i<0||!t(e[i]))return e.length;if(t(e[r]))return r;for(;r<i;){const n=r+i>>1;t(e[n])?i=n:r=n+1}return r}function l(e,t,n){if(e<2)return e;let r=t[e].div,i=r.offsetTop+r.clientTop;i>=n&&(r=t[e-1].div,i=r.offsetTop+r.clientTop);for(let n=e-2;n>=0&&(r=t[n].div,!(r.offsetTop+r.clientTop+r.clientHeight<=i));--n)e=n;return e}function c(e){let t=Math.hypot(e.deltaX,e.deltaY);const n=Math.atan2(e.deltaY,e.deltaX);return-.25*Math.PI<n&&n<.75*Math.PI&&(t=-t),t}const u=new Promise((function(e){window.requestAnimationFrame(e)}));t.animationStarted=u;const d=document.documentElement.style;t.docStyle=d,t.ProgressBar=class{#vt=null;#yt=0;#ee=!0;constructor(e){if(arguments.length>1)throw new Error("ProgressBar no longer accepts any additional options, please use CSS rules to modify its appearance instead.");const t=document.getElementById(e);this.#vt=t.classList}get percent(){return this.#yt}set percent(e){var t,n,r;this.#yt=(t=e,n=0,r=100,Math.min(Math.max(t,n),r)),isNaN(e)?this.#vt.add("indeterminate"):(this.#vt.remove("indeterminate"),d.setProperty("--progressBar-percent",`${this.#yt}%`))}setWidth(e){if(!e)return;const t=e.parentNode.offsetWidth-e.offsetWidth;t>0&&d.setProperty("--progressBar-end-offset",`${t}px`)}hide(){this.#ee&&(this.#ee=!1,this.#vt.add("hidden"))}show(){this.#ee||(this.#ee=!0,this.#vt.remove("hidden"))}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.StructTreeLayerBuilder=void 0;const n={Document:null,DocumentFragment:null,Part:"group",Sect:"group",Div:"group",Aside:"note",NonStruct:"none",P:null,H:"heading",Title:null,FENote:"note",Sub:"group",Lbl:null,Span:null,Em:null,Strong:null,Link:"link",Annot:"note",Form:"form",Ruby:null,RB:null,RT:null,RP:null,Warichu:null,WT:null,WP:null,L:"list",LI:"listitem",LBody:null,Table:"table",TR:"row",TH:"columnheader",TD:"cell",THead:"columnheader",TBody:null,TFoot:null,Caption:null,Figure:"figure",Formula:null,Artifact:null},r=/^H(\d+)$/;t.StructTreeLayerBuilder=class{constructor({pdfPage:e}){this.pdfPage=e}render(e){return this._walk(e)}_setAttributes(e,t){void 0!==e.alt&&t.setAttribute("aria-label",e.alt),void 0!==e.id&&t.setAttribute("aria-owns",e.id),void 0!==e.lang&&t.setAttribute("lang",e.lang)}_walk(e){if(!e)return null;const t=document.createElement("span");if("role"in e){const{role:i}=e,s=i.match(r);s?(t.setAttribute("role","heading"),t.setAttribute("aria-level",s[1])):n[i]&&t.setAttribute("role",n[i])}if(this._setAttributes(e,t),e.children)if(1===e.children.length&&"id"in e.children[0])this._setAttributes(e.children[0],t);else for(const n of e.children)t.append(this._walk(n));return t}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TextLayerBuilder=void 0;var r=n(3);t.TextLayerBuilder=class{constructor({textLayerDiv:e,eventBus:t,pageIndex:n,viewport:r,highlighter:i=null,enhanceTextSelection:s=!1,accessibilityManager:a=null}){this.textLayerDiv=e,this.eventBus=t,this.textContent=null,this.textContentItemsStr=[],this.textContentStream=null,this.renderingDone=!1,this.pageNumber=n+1,this.viewport=r,this.textDivs=[],this.textLayerRenderTask=null,this.highlighter=i,this.enhanceTextSelection=s,this.accessibilityManager=a,this._bindMouse()}_finishRendering(){if(this.renderingDone=!0,!this.enhanceTextSelection){const e=document.createElement("div");e.className="endOfContent",this.textLayerDiv.append(e)}this.eventBus.dispatch("textlayerrendered",{source:this,pageNumber:this.pageNumber,numTextDivs:this.textDivs.length})}render(e=0){if(!this.textContent&&!this.textContentStream||this.renderingDone)return;this.cancel(),this.textDivs.length=0,this.highlighter?.setTextMapping(this.textDivs,this.textContentItemsStr),this.accessibilityManager?.setTextMapping(this.textDivs);const t=document.createDocumentFragment();this.textLayerRenderTask=(0,r.renderTextLayer)({textContent:this.textContent,textContentStream:this.textContentStream,container:t,viewport:this.viewport,textDivs:this.textDivs,textContentItemsStr:this.textContentItemsStr,timeout:e,enhanceTextSelection:this.enhanceTextSelection}),this.textLayerRenderTask.promise.then((()=>{this.textLayerDiv.append(t),this._finishRendering(),this.highlighter?.enable(),this.accessibilityManager?.enable()}),(function(e){}))}cancel(){this.textLayerRenderTask&&(this.textLayerRenderTask.cancel(),this.textLayerRenderTask=null),this.highlighter?.disable(),this.accessibilityManager?.disable()}setTextContentStream(e){this.cancel(),this.textContentStream=e}setTextContent(e){this.cancel(),this.textContent=e}_bindMouse(){const e=this.textLayerDiv;let t=null;e.addEventListener("mousedown",(n=>{if(this.enhanceTextSelection&&this.textLayerRenderTask)return this.textLayerRenderTask.expandTextDivs(!0),void(t&&(clearTimeout(t),t=null));const r=e.querySelector(".endOfContent");if(!r)return;let i=n.target!==e;if(i=i&&"none"!==window.getComputedStyle(r).getPropertyValue("-moz-user-select"),i){const t=e.getBoundingClientRect(),i=Math.max(0,(n.pageY-t.top)/t.height);r.style.top=(100*i).toFixed(2)+"%"}r.classList.add("active")})),e.addEventListener("mouseup",(()=>{if(this.enhanceTextSelection&&this.textLayerRenderTask)return void(t=setTimeout((()=>{this.textLayerRenderTask&&this.textLayerRenderTask.expandTextDivs(!1),t=null}),300));const n=e.querySelector(".endOfContent");n&&(n.style.top="",n.classList.remove("active"))}))}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.XfaLayerBuilder=void 0;var r=n(3);t.XfaLayerBuilder=class{constructor({pageDiv:e,pdfPage:t,annotationStorage:n=null,linkService:r,xfaHtml:i=null}){this.pageDiv=e,this.pdfPage=t,this.annotationStorage=n,this.linkService=r,this.xfaHtml=i,this.div=null,this._cancelled=!1}render(e,t="display"){if("print"===t){const n={viewport:e.clone({dontFlip:!0}),div:this.div,xfaHtml:this.xfaHtml,annotationStorage:this.annotationStorage,linkService:this.linkService,intent:t},i=document.createElement("div");this.pageDiv.append(i),n.div=i;const s=r.XfaLayer.render(n);return Promise.resolve(s)}return this.pdfPage.getXfa().then((n=>{if(this._cancelled||!n)return{textDivs:[]};const i={viewport:e.clone({dontFlip:!0}),div:this.div,xfaHtml:n,annotationStorage:this.annotationStorage,linkService:this.linkService,intent:t};return this.div?r.XfaLayer.update(i):(this.div=document.createElement("div"),this.pageDiv.append(this.div),i.div=this.div,r.XfaLayer.render(i))})).catch((e=>{console.error(e)}))}cancel(){this._cancelled=!0}hide(){this.div&&(this.div.hidden=!0)}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFViewer=t.PDFSinglePageViewer=void 0;var r=n(7),i=n(12);class s extends i.BaseViewer{}t.PDFViewer=s;class a extends i.BaseViewer{_resetView(){super._resetView(),this._scrollMode=r.ScrollMode.PAGE,this._spreadMode=r.SpreadMode.NONE}set scrollMode(e){}_updateScrollMode(){}set spreadMode(e){}_updateSpreadMode(){}}t.PDFSinglePageViewer=a},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PagesCountLimit=t.PDFPageViewBuffer=t.BaseViewer=void 0;var r=n(3),i=n(7),s=n(2),a=n(5),o=n(4),l=n(13),c=n(16),u=n(6),d=n(8),h=n(17),p=n(9),f=n(10);const g="enablePermissions",m={FORCE_SCROLL_MODE_PAGE:15e3,FORCE_LAZY_PAGE_INIT:7500,PAUSE_EAGER_PAGE_INIT:250};function v(e){return Object.values(r.AnnotationEditorType).includes(e)&&e!==r.AnnotationEditorType.DISABLE}t.PagesCountLimit=m;class y{#bt=new Set;#_t=0;constructor(e){this.#_t=e}push(e){const t=this.#bt;t.has(e)&&t.delete(e),t.add(e),t.size>this.#_t&&this.#wt()}resize(e,t=null){this.#_t=e;const n=this.#bt;if(t){const e=n.size;let r=1;for(const i of n)if(t.has(i.id)&&(n.delete(i),n.add(i)),++r>e)break}for(;n.size>this.#_t;)this.#wt()}has(e){return this.#bt.has(e)}[Symbol.iterator](){return this.#bt.keys()}#wt(){const e=this.#bt.keys().next().value;e?.destroy(),this.#bt.delete(e)}}t.PDFPageViewBuffer=y;class b{#Et=null;#St=r.AnnotationEditorType.DISABLE;#Ct=null;#At=r.AnnotationMode.ENABLE_FORMS;#Pt=!1;#xt=0;#Rt=null;#Tt=null;constructor(e){if(this.constructor===b)throw new Error("Cannot initialize BaseViewer.");const t="2.16.105";if(r.version!==t)throw new Error(`The API version "${r.version}" does not match the Viewer version "2.16.105".`);if(this.container=e.container,this.viewer=e.viewer||e.container.firstElementChild,"DIV"!==this.container?.tagName.toUpperCase()||"DIV"!==this.viewer?.tagName.toUpperCase())throw new Error("Invalid `container` and/or `viewer` option.");if(this.container.offsetParent&&"absolute"!==getComputedStyle(this.container).position)throw new Error("The `container` must be absolutely positioned.");this.eventBus=e.eventBus,this.linkService=e.linkService||new u.SimpleLinkService,this.downloadManager=e.downloadManager||null,this.findController=e.findController||null,this._scriptingManager=e.scriptingManager||null,this.removePageBorders=e.removePageBorders||!1,this.textLayerMode=e.textLayerMode??i.TextLayerMode.ENABLE,this.#At=e.annotationMode??r.AnnotationMode.ENABLE_FORMS,this.#St=e.annotationEditorMode??r.AnnotationEditorType.DISABLE,this.imageResourcesPath=e.imageResourcesPath||"",this.enablePrintAutoRotate=e.enablePrintAutoRotate||!1,this.renderer=e.renderer||i.RendererType.CANVAS,this.useOnlyCssZoom=e.useOnlyCssZoom||!1,this.maxCanvasPixels=e.maxCanvasPixels,this.l10n=e.l10n||o.NullL10n,this.#Pt=e.enablePermissions||!1,this.pageColors=e.pageColors||null,!this.pageColors||CSS.supports("color",this.pageColors.background)&&CSS.supports("color",this.pageColors.foreground)||((this.pageColors.background||this.pageColors.foreground)&&console.warn("BaseViewer: Ignoring `pageColors`-option, since the browser doesn't support the values used."),this.pageColors=null),this.defaultRenderingQueue=!e.renderingQueue,this.defaultRenderingQueue?(this.renderingQueue=new c.PDFRenderingQueue,this.renderingQueue.setViewer(this)):this.renderingQueue=e.renderingQueue,this.scroll=(0,i.watchScroll)(this.container,this._scrollUpdate.bind(this)),this.presentationModeState=i.PresentationModeState.UNKNOWN,this._onBeforeDraw=this._onAfterDraw=null,this._resetView(),this.removePageBorders&&this.viewer.classList.add("removePageBorders"),this.updateContainerHeightCss()}get pagesCount(){return this._pages.length}getPageView(e){return this._pages[e]}get pageViewsReady(){return!!this._pagesCapability.settled&&this._pages.every((function(e){return e?.pdfPage}))}get renderForms(){return this.#At===r.AnnotationMode.ENABLE_FORMS}get enableScripting(){return!!this._scriptingManager}get currentPageNumber(){return this._currentPageNumber}set currentPageNumber(e){if(!Number.isInteger(e))throw new Error("Invalid page number.");this.pdfDocument&&(this._setCurrentPageNumber(e,!0)||console.error(`currentPageNumber: "${e}" is not a valid page.`))}_setCurrentPageNumber(e,t=!1){if(this._currentPageNumber===e)return t&&this.#Mt(),!0;if(!(0<e&&e<=this.pagesCount))return!1;const n=this._currentPageNumber;return this._currentPageNumber=e,this.eventBus.dispatch("pagechanging",{source:this,pageNumber:e,pageLabel:this._pageLabels?.[e-1]??null,previous:n}),t&&this.#Mt(),!0}get currentPageLabel(){return this._pageLabels?.[this._currentPageNumber-1]??null}set currentPageLabel(e){if(!this.pdfDocument)return;let t=0|e;if(this._pageLabels){const n=this._pageLabels.indexOf(e);n>=0&&(t=n+1)}this._setCurrentPageNumber(t,!0)||console.error(`currentPageLabel: "${e}" is not a valid page.`)}get currentScale(){return this._currentScale!==i.UNKNOWN_SCALE?this._currentScale:i.DEFAULT_SCALE}set currentScale(e){if(isNaN(e))throw new Error("Invalid numeric scale.");this.pdfDocument&&this._setScale(e,!1)}get currentScaleValue(){return this._currentScaleValue}set currentScaleValue(e){this.pdfDocument&&this._setScale(e,!1)}get pagesRotation(){return this._pagesRotation}set pagesRotation(e){if(!(0,i.isValidRotation)(e))throw new Error("Invalid pages rotation angle.");if(!this.pdfDocument)return;if((e%=360)<0&&(e+=360),this._pagesRotation===e)return;this._pagesRotation=e;const t=this._currentPageNumber,n={rotation:e};for(const e of this._pages)e.update(n);this._currentScaleValue&&this._setScale(this._currentScaleValue,!0),this.eventBus.dispatch("rotationchanging",{source:this,pagesRotation:e,pageNumber:t}),this.defaultRenderingQueue&&this.update()}get firstPagePromise(){return this.pdfDocument?this._firstPageCapability.promise:null}get onePageRendered(){return this.pdfDocument?this._onePageRenderedCapability.promise:null}get pagesPromise(){return this.pdfDocument?this._pagesCapability.promise:null}#Lt(e){const t={annotationEditorMode:this.#St,annotationMode:this.#At,textLayerMode:this.textLayerMode};return e?(e.includes(r.PermissionFlag.COPY)||this.viewer.classList.add(g),e.includes(r.PermissionFlag.MODIFY_CONTENTS)||(t.annotationEditorMode=r.AnnotationEditorType.DISABLE),e.includes(r.PermissionFlag.MODIFY_ANNOTATIONS)||e.includes(r.PermissionFlag.FILL_INTERACTIVE_FORMS)||this.#At!==r.AnnotationMode.ENABLE_FORMS||(t.annotationMode=r.AnnotationMode.ENABLE),t):t}#It(){if("hidden"===document.visibilityState||!this.container.offsetParent||0===this._getVisiblePages().views.length)return Promise.resolve();const e=new Promise((e=>{this.#Tt=()=>{"hidden"===document.visibilityState&&(e(),document.removeEventListener("visibilitychange",this.#Tt),this.#Tt=null)},document.addEventListener("visibilitychange",this.#Tt)}));return Promise.race([this._onePageRenderedCapability.promise,e])}setDocument(e){if(this.pdfDocument&&(this.eventBus.dispatch("pagesdestroy",{source:this}),this._cancelRendering(),this._resetView(),this.findController&&this.findController.setDocument(null),this._scriptingManager&&this._scriptingManager.setDocument(null),this.#Ct&&(this.#Ct.destroy(),this.#Ct=null)),this.pdfDocument=e,!e)return;const t=e.isPureXfa,n=e.numPages,s=e.getPage(1),a=e.getOptionalContentConfig(),o=this.#Pt?e.getPermissions():Promise.resolve();if(n>m.FORCE_SCROLL_MODE_PAGE){console.warn("Forcing PAGE-scrolling for performance reasons, given the length of the document.");const e=this._scrollMode=i.ScrollMode.PAGE;this.eventBus.dispatch("scrollmodechanged",{source:this,mode:e})}this._pagesCapability.promise.then((()=>{this.eventBus.dispatch("pagesloaded",{source:this,pagesCount:n})}),(()=>{})),this._onBeforeDraw=e=>{const t=this._pages[e.pageNumber-1];t&&this.#Et.push(t)},this.eventBus._on("pagerender",this._onBeforeDraw),this._onAfterDraw=e=>{e.cssTransform||this._onePageRenderedCapability.settled||(this._onePageRenderedCapability.resolve({timestamp:e.timestamp}),this.eventBus._off("pagerendered",this._onAfterDraw),this._onAfterDraw=null,this.#Tt&&(document.removeEventListener("visibilitychange",this.#Tt),this.#Tt=null))},this.eventBus._on("pagerendered",this._onAfterDraw),Promise.all([s,o]).then((([s,o])=>{if(e!==this.pdfDocument)return;this._firstPageCapability.resolve(s),this._optionalContentConfigPromise=a;const{annotationEditorMode:c,annotationMode:u,textLayerMode:d}=this.#Lt(o);if(c!==r.AnnotationEditorType.DISABLE){const e=c;t?console.warn("Warning: XFA-editing is not implemented."):v(e)?(this.#Ct=new r.AnnotationEditorUIManager(this.container,this.eventBus),e!==r.AnnotationEditorType.NONE&&this.#Ct.updateMode(e)):console.error(`Invalid AnnotationEditor mode: ${e}`)}const h=this._scrollMode===i.ScrollMode.PAGE?null:this.viewer,p=this.currentScale,f=s.getViewport({scale:p*r.PixelsPerInch.PDF_TO_CSS_UNITS}),g=d===i.TextLayerMode.DISABLE||t?null:this,y=u!==r.AnnotationMode.DISABLE?this:null,b=t?this:null,_=this.#Ct?this:null;for(let e=1;e<=n;++e){const t=new l.PDFPageView({container:h,eventBus:this.eventBus,id:e,scale:p,defaultViewport:f.clone(),optionalContentConfigPromise:a,renderingQueue:this.renderingQueue,textLayerFactory:g,textLayerMode:d,annotationLayerFactory:y,annotationMode:u,xfaLayerFactory:b,annotationEditorLayerFactory:_,textHighlighterFactory:this,structTreeLayerFactory:this,imageResourcesPath:this.imageResourcesPath,renderer:this.renderer,useOnlyCssZoom:this.useOnlyCssZoom,maxCanvasPixels:this.maxCanvasPixels,pageColors:this.pageColors,l10n:this.l10n});this._pages.push(t)}const w=this._pages[0];w&&(w.setPdfPage(s),this.linkService.cachePageRef(1,s.ref)),this._scrollMode===i.ScrollMode.PAGE?this.#kt():this._spreadMode!==i.SpreadMode.NONE&&this._updateSpreadMode(),this.#It().then((async()=>{if(this.findController&&this.findController.setDocument(e),this._scriptingManager&&this._scriptingManager.setDocument(e),this.#Ct&&this.eventBus.dispatch("annotationeditormodechanged",{source:this,mode:this.#St}),e.loadingParams.disableAutoFetch||n>m.FORCE_LAZY_PAGE_INIT)return void this._pagesCapability.resolve();let t=n-1;if(t<=0)this._pagesCapability.resolve();else for(let r=2;r<=n;++r){const n=e.getPage(r).then((e=>{const n=this._pages[r-1];n.pdfPage||n.setPdfPage(e),this.linkService.cachePageRef(r,e.ref),0==--t&&this._pagesCapability.resolve()}),(e=>{console.error(`Unable to get page ${r} to initialize viewer`,e),0==--t&&this._pagesCapability.resolve()}));r%m.PAUSE_EAGER_PAGE_INIT==0&&await n}})),this.eventBus.dispatch("pagesinit",{source:this}),e.getMetadata().then((({info:t})=>{e===this.pdfDocument&&t.Language&&(this.viewer.lang=t.Language)})),this.defaultRenderingQueue&&this.update()})).catch((e=>{console.error("Unable to initialize viewer",e),this._pagesCapability.reject(e)}))}setPageLabels(e){if(this.pdfDocument){e?Array.isArray(e)&&this.pdfDocument.numPages===e.length?this._pageLabels=e:(this._pageLabels=null,console.error("setPageLabels: Invalid page labels.")):this._pageLabels=null;for(let e=0,t=this._pages.length;e<t;e++)this._pages[e].setPageLabel(this._pageLabels?.[e]??null)}}_resetView(){this._pages=[],this._currentPageNumber=1,this._currentScale=i.UNKNOWN_SCALE,this._currentScaleValue=null,this._pageLabels=null,this.#Et=new y(10),this._location=null,this._pagesRotation=0,this._optionalContentConfigPromise=null,this._firstPageCapability=(0,r.createPromiseCapability)(),this._onePageRenderedCapability=(0,r.createPromiseCapability)(),this._pagesCapability=(0,r.createPromiseCapability)(),this._scrollMode=i.ScrollMode.VERTICAL,this._previousScrollMode=i.ScrollMode.UNKNOWN,this._spreadMode=i.SpreadMode.NONE,this.#Rt={previousPageNumber:1,scrollDown:!0,pages:[]},this._onBeforeDraw&&(this.eventBus._off("pagerender",this._onBeforeDraw),this._onBeforeDraw=null),this._onAfterDraw&&(this.eventBus._off("pagerendered",this._onAfterDraw),this._onAfterDraw=null),this.#Tt&&(document.removeEventListener("visibilitychange",this.#Tt),this.#Tt=null),this.viewer.textContent="",this._updateScrollMode(),this.viewer.removeAttribute("lang"),this.viewer.classList.remove(g)}#kt(){if(this._scrollMode!==i.ScrollMode.PAGE)throw new Error("#ensurePageViewVisible: Invalid scrollMode value.");const e=this._currentPageNumber,t=this.#Rt,n=this.viewer;if(n.textContent="",t.pages.length=0,this._spreadMode!==i.SpreadMode.NONE||this.isInPresentationMode){const r=new Set,i=this._spreadMode-1;-1===i?r.add(e-1):e%2!==i?(r.add(e-1),r.add(e)):(r.add(e-2),r.add(e-1));const s=document.createElement("div");if(s.className="spread",this.isInPresentationMode){const e=document.createElement("div");e.className="dummyPage",s.append(e)}for(const e of r){const n=this._pages[e];n&&(s.append(n.div),t.pages.push(n))}n.append(s)}else{const r=this._pages[e-1];n.append(r.div),t.pages.push(r)}t.scrollDown=e>=t.previousPageNumber,t.previousPageNumber=e}_scrollUpdate(){0!==this.pagesCount&&this.update()}#Ot(e,t=null){const{div:n,id:r}=e;if(this._scrollMode===i.ScrollMode.PAGE&&(this._setCurrentPageNumber(r),this.#kt(),this.update()),!t&&!this.isInPresentationMode){const e=n.offsetLeft+n.clientLeft,r=e+n.clientWidth,{scrollLeft:s,clientWidth:a}=this.container;(this._scrollMode===i.ScrollMode.HORIZONTAL||e<s||r>s+a)&&(t={left:0,top:0})}(0,i.scrollIntoView)(n,t)}#Ft(e){return e===this._currentScale||Math.abs(e-this._currentScale)<1e-15}_setScaleUpdatePages(e,t,n=!1,s=!1){if(this._currentScaleValue=t.toString(),this.#Ft(e))return void(s&&this.eventBus.dispatch("scalechanging",{source:this,scale:e,presetValue:t}));i.docStyle.setProperty("--scale-factor",e*r.PixelsPerInch.PDF_TO_CSS_UNITS);const a={scale:e};for(const e of this._pages)e.update(a);if(this._currentScale=e,!n){let e,t=this._currentPageNumber;!this._location||this.isInPresentationMode||this.isChangingPresentationMode||(t=this._location.pageNumber,e=[null,{name:"XYZ"},this._location.left,this._location.top,null]),this.scrollPageIntoView({pageNumber:t,destArray:e,allowNegativeOffset:!0})}this.eventBus.dispatch("scalechanging",{source:this,scale:e,presetValue:s?t:void 0}),this.defaultRenderingQueue&&this.update(),this.updateContainerHeightCss()}get _pageWidthScaleFactor(){return this._spreadMode!==i.SpreadMode.NONE&&this._scrollMode!==i.ScrollMode.HORIZONTAL?2:1}_setScale(e,t=!1){let n=parseFloat(e);if(n>0)this._setScaleUpdatePages(n,e,t,!1);else{const r=this._pages[this._currentPageNumber-1];if(!r)return;let s=i.SCROLLBAR_PADDING,a=i.VERTICAL_PADDING;this.isInPresentationMode?s=a=4:this.removePageBorders?s=a=0:this._scrollMode===i.ScrollMode.HORIZONTAL&&([s,a]=[a,s]);const o=(this.container.clientWidth-s)/r.width*r.scale/this._pageWidthScaleFactor,l=(this.container.clientHeight-a)/r.height*r.scale;switch(e){case"page-actual":n=1;break;case"page-width":n=o;break;case"page-height":n=l;break;case"page-fit":n=Math.min(o,l);break;case"auto":const t=(0,i.isPortraitOrientation)(r)?o:Math.min(l,o);n=Math.min(i.MAX_AUTO_SCALE,t);break;default:return void console.error(`_setScale: "${e}" is an unknown zoom value.`)}this._setScaleUpdatePages(n,e,t,!0)}}#Mt(){const e=this._pages[this._currentPageNumber-1];this.isInPresentationMode&&this._setScale(this._currentScaleValue,!0),this.#Ot(e)}pageLabelToPageNumber(e){if(!this._pageLabels)return null;const t=this._pageLabels.indexOf(e);return t<0?null:t+1}scrollPageIntoView({pageNumber:e,destArray:t=null,allowNegativeOffset:n=!1,ignoreDestinationZoom:s=!1}){if(!this.pdfDocument)return;const a=Number.isInteger(e)&&this._pages[e-1];if(!a)return void console.error(`scrollPageIntoView: "${e}" is not a valid pageNumber parameter.`);if(this.isInPresentationMode||!t)return void this._setCurrentPageNumber(e,!0);let o,l,c=0,u=0,d=0,h=0;const p=a.rotation%180!=0,f=(p?a.height:a.width)/a.scale/r.PixelsPerInch.PDF_TO_CSS_UNITS,g=(p?a.width:a.height)/a.scale/r.PixelsPerInch.PDF_TO_CSS_UNITS;let m=0;switch(t[1].name){case"XYZ":c=t[2],u=t[3],m=t[4],c=null!==c?c:0,u=null!==u?u:g;break;case"Fit":case"FitB":m="page-fit";break;case"FitH":case"FitBH":u=t[2],m="page-width",null===u&&this._location?(c=this._location.left,u=this._location.top):("number"!=typeof u||u<0)&&(u=g);break;case"FitV":case"FitBV":c=t[2],d=f,h=g,m="page-height";break;case"FitR":c=t[2],u=t[3],d=t[4]-c,h=t[5]-u;const e=this.removePageBorders?0:i.SCROLLBAR_PADDING,n=this.removePageBorders?0:i.VERTICAL_PADDING;o=(this.container.clientWidth-e)/d/r.PixelsPerInch.PDF_TO_CSS_UNITS,l=(this.container.clientHeight-n)/h/r.PixelsPerInch.PDF_TO_CSS_UNITS,m=Math.min(Math.abs(o),Math.abs(l));break;default:return void console.error(`scrollPageIntoView: "${t[1].name}" is not a valid destination type.`)}if(s||(m&&m!==this._currentScale?this.currentScaleValue=m:this._currentScale===i.UNKNOWN_SCALE&&(this.currentScaleValue=i.DEFAULT_SCALE_VALUE)),"page-fit"===m&&!t[4])return void this.#Ot(a);const v=[a.viewport.convertToViewportPoint(c,u),a.viewport.convertToViewportPoint(c+d,u+h)];let y=Math.min(v[0][0],v[1][0]),b=Math.min(v[0][1],v[1][1]);n||(y=Math.max(y,0),b=Math.max(b,0)),this.#Ot(a,{left:y,top:b})}_updateLocation(e){const t=this._currentScale,n=this._currentScaleValue,r=parseFloat(n)===t?Math.round(1e4*t)/100:n,i=e.id,s=this._pages[i-1],a=this.container,o=s.getPagePoint(a.scrollLeft-e.x,a.scrollTop-e.y),l=Math.round(o[0]),c=Math.round(o[1]);let u=`#page=${i}`;this.isInPresentationMode||(u+=`&zoom=${r},${l},${c}`),this._location={pageNumber:i,scale:r,top:c,left:l,rotation:this._pagesRotation,pdfOpenParams:u}}update(){const e=this._getVisiblePages(),t=e.views,n=t.length;if(0===n)return;const r=Math.max(10,2*n+1);this.#Et.resize(r,e.ids),this.renderingQueue.renderHighestPriority(e);const s=this._spreadMode===i.SpreadMode.NONE&&(this._scrollMode===i.ScrollMode.PAGE||this._scrollMode===i.ScrollMode.VERTICAL),a=this._currentPageNumber;let o=!1;for(const e of t){if(e.percent<100)break;if(e.id===a&&s){o=!0;break}}this._setCurrentPageNumber(o?a:t[0].id),this._updateLocation(e.first),this.eventBus.dispatch("updateviewarea",{source:this,location:this._location})}containsElement(e){return this.container.contains(e)}focus(){this.container.focus()}get _isContainerRtl(){return"rtl"===getComputedStyle(this.container).direction}get isInPresentationMode(){return this.presentationModeState===i.PresentationModeState.FULLSCREEN}get isChangingPresentationMode(){return this.presentationModeState===i.PresentationModeState.CHANGING}get isHorizontalScrollbarEnabled(){return!this.isInPresentationMode&&this.container.scrollWidth>this.container.clientWidth}get isVerticalScrollbarEnabled(){return!this.isInPresentationMode&&this.container.scrollHeight>this.container.clientHeight}_getVisiblePages(){const e=this._scrollMode===i.ScrollMode.PAGE?this.#Rt.pages:this._pages,t=this._scrollMode===i.ScrollMode.HORIZONTAL,n=t&&this._isContainerRtl;return(0,i.getVisibleElements)({scrollEl:this.container,views:e,sortByVisibility:!0,horizontal:t,rtl:n})}isPageVisible(e){return!!this.pdfDocument&&(Number.isInteger(e)&&e>0&&e<=this.pagesCount?this._getVisiblePages().ids.has(e):(console.error(`isPageVisible: "${e}" is not a valid page.`),!1))}isPageCached(e){if(!this.pdfDocument)return!1;if(!(Number.isInteger(e)&&e>0&&e<=this.pagesCount))return console.error(`isPageCached: "${e}" is not a valid page.`),!1;const t=this._pages[e-1];return this.#Et.has(t)}cleanup(){for(const e of this._pages)e.renderingState!==i.RenderingStates.FINISHED&&e.reset()}_cancelRendering(){for(const e of this._pages)e.cancelRendering()}async#Dt(e){if(e.pdfPage)return e.pdfPage;try{const t=await this.pdfDocument.getPage(e.id);return e.pdfPage||e.setPdfPage(t),this.linkService._cachedPageNumber?.(t.ref)||this.linkService.cachePageRef(e.id,t.ref),t}catch(e){return console.error("Unable to get page for page view",e),null}}#Nt(e){if(1===e.first?.id)return!0;if(e.last?.id===this.pagesCount)return!1;switch(this._scrollMode){case i.ScrollMode.PAGE:return this.#Rt.scrollDown;case i.ScrollMode.HORIZONTAL:return this.scroll.right}return this.scroll.down}#Ut(e){for(const t of e)this._pages[t-1]?.toggleLoadingIconSpinner(!0);for(const t of this.#Et)e.has(t.id)||t.toggleLoadingIconSpinner(!1)}forceRendering(e){const t=e||this._getVisiblePages(),n=this.#Nt(t),r=this._spreadMode!==i.SpreadMode.NONE&&this._scrollMode!==i.ScrollMode.HORIZONTAL,s=this.renderingQueue.getHighestPriority(t,this._pages,n,r);return this.#Ut(t.ids),!!s&&(this.#Dt(s).then((()=>{this.renderingQueue.renderView(s)})),!0)}createTextLayerBuilder({textLayerDiv:e,pageIndex:t,viewport:n,enhanceTextSelection:r=!1,eventBus:i,highlighter:s,accessibilityManager:a=null}){return new p.TextLayerBuilder({textLayerDiv:e,eventBus:i,pageIndex:t,viewport:n,enhanceTextSelection:!this.isInPresentationMode&&r,highlighter:s,accessibilityManager:a})}createTextHighlighter({pageIndex:e,eventBus:t}){return new h.TextHighlighter({eventBus:t,pageIndex:e,findController:this.isInPresentationMode?null:this.findController})}createAnnotationLayerBuilder({pageDiv:e,pdfPage:t,annotationStorage:n=this.pdfDocument?.annotationStorage,imageResourcesPath:r="",renderForms:i=!0,l10n:s=o.NullL10n,enableScripting:l=this.enableScripting,hasJSActionsPromise:c=this.pdfDocument?.hasJSActions(),mouseState:u=this._scriptingManager?.mouseState,fieldObjectsPromise:d=this.pdfDocument?.getFieldObjects(),annotationCanvasMap:h=null,accessibilityManager:p=null}){return new a.AnnotationLayerBuilder({pageDiv:e,pdfPage:t,annotationStorage:n,imageResourcesPath:r,renderForms:i,linkService:this.linkService,downloadManager:this.downloadManager,l10n:s,enableScripting:l,hasJSActionsPromise:c,mouseState:u,fieldObjectsPromise:d,annotationCanvasMap:h,accessibilityManager:p})}createAnnotationEditorLayerBuilder({uiManager:e=this.#Ct,pageDiv:t,pdfPage:n,accessibilityManager:r=null,l10n:i,annotationStorage:a=this.pdfDocument?.annotationStorage}){return new s.AnnotationEditorLayerBuilder({uiManager:e,pageDiv:t,pdfPage:n,annotationStorage:a,accessibilityManager:r,l10n:i})}createXfaLayerBuilder({pageDiv:e,pdfPage:t,annotationStorage:n=this.pdfDocument?.annotationStorage}){return new f.XfaLayerBuilder({pageDiv:e,pdfPage:t,annotationStorage:n,linkService:this.linkService})}createStructTreeLayerBuilder({pdfPage:e}){return new d.StructTreeLayerBuilder({pdfPage:e})}get hasEqualPageSizes(){const e=this._pages[0];for(let t=1,n=this._pages.length;t<n;++t){const n=this._pages[t];if(n.width!==e.width||n.height!==e.height)return!1}return!0}getPagesOverview(){return this._pages.map((e=>{const t=e.pdfPage.getViewport({scale:1});return!this.enablePrintAutoRotate||(0,i.isPortraitOrientation)(t)?{width:t.width,height:t.height,rotation:t.rotation}:{width:t.height,height:t.width,rotation:(t.rotation-90)%360}}))}get optionalContentConfigPromise(){return this.pdfDocument?this._optionalContentConfigPromise?this._optionalContentConfigPromise:(console.error("optionalContentConfigPromise: Not initialized yet."),this.pdfDocument.getOptionalContentConfig()):Promise.resolve(null)}set optionalContentConfigPromise(e){if(!(e instanceof Promise))throw new Error(`Invalid optionalContentConfigPromise: ${e}`);if(!this.pdfDocument)return;if(!this._optionalContentConfigPromise)return;this._optionalContentConfigPromise=e;const t={optionalContentConfigPromise:e};for(const e of this._pages)e.update(t);this.update(),this.eventBus.dispatch("optionalcontentconfigchanged",{source:this,promise:e})}get scrollMode(){return this._scrollMode}set scrollMode(e){if(this._scrollMode!==e){if(!(0,i.isValidScrollMode)(e))throw new Error(`Invalid scroll mode: ${e}`);this.pagesCount>m.FORCE_SCROLL_MODE_PAGE||(this._previousScrollMode=this._scrollMode,this._scrollMode=e,this.eventBus.dispatch("scrollmodechanged",{source:this,mode:e}),this._updateScrollMode(this._currentPageNumber))}}_updateScrollMode(e=null){const t=this._scrollMode,n=this.viewer;n.classList.toggle("scrollHorizontal",t===i.ScrollMode.HORIZONTAL),n.classList.toggle("scrollWrapped",t===i.ScrollMode.WRAPPED),this.pdfDocument&&e&&(t===i.ScrollMode.PAGE?this.#kt():this._previousScrollMode===i.ScrollMode.PAGE&&this._updateSpreadMode(),this._currentScaleValue&&isNaN(this._currentScaleValue)&&this._setScale(this._currentScaleValue,!0),this._setCurrentPageNumber(e,!0),this.update())}get spreadMode(){return this._spreadMode}set spreadMode(e){if(this._spreadMode!==e){if(!(0,i.isValidSpreadMode)(e))throw new Error(`Invalid spread mode: ${e}`);this._spreadMode=e,this.eventBus.dispatch("spreadmodechanged",{source:this,mode:e}),this._updateSpreadMode(this._currentPageNumber)}}_updateSpreadMode(e=null){if(!this.pdfDocument)return;const t=this.viewer,n=this._pages;if(this._scrollMode===i.ScrollMode.PAGE)this.#kt();else if(t.textContent="",this._spreadMode===i.SpreadMode.NONE)for(const e of this._pages)t.append(e.div);else{const e=this._spreadMode-1;let r=null;for(let i=0,s=n.length;i<s;++i)null===r?(r=document.createElement("div"),r.className="spread",t.append(r)):i%2===e&&(r=r.cloneNode(!1),t.append(r)),r.append(n[i].div)}e&&(this._currentScaleValue&&isNaN(this._currentScaleValue)&&this._setScale(this._currentScaleValue,!0),this._setCurrentPageNumber(e,!0),this.update())}_getPageAdvance(e,t=!1){switch(this._scrollMode){case i.ScrollMode.WRAPPED:{const{views:n}=this._getVisiblePages(),r=new Map;for(const{id:e,y:t,percent:i,widthPercent:s}of n){if(0===i||s<100)continue;let n=r.get(t);n||r.set(t,n||=[]),n.push(e)}for(const n of r.values()){const r=n.indexOf(e);if(-1===r)continue;const i=n.length;if(1===i)break;if(t)for(let t=r-1,i=0;t>=i;t--){const r=n[t],i=n[t+1]-1;if(r<i)return e-i}else for(let t=r+1,s=i;t<s;t++){const r=n[t],i=n[t-1]+1;if(r>i)return i-e}if(t){const t=n[0];if(t<e)return e-t+1}else{const t=n[i-1];if(t>e)return t-e+1}break}break}case i.ScrollMode.HORIZONTAL:break;case i.ScrollMode.PAGE:case i.ScrollMode.VERTICAL:{if(this._spreadMode===i.SpreadMode.NONE)break;const n=this._spreadMode-1;if(t&&e%2!==n)break;if(!t&&e%2===n)break;const{views:r}=this._getVisiblePages(),s=t?e-1:e+1;for(const{id:e,percent:t,widthPercent:n}of r)if(e===s){if(t>0&&100===n)return 2;break}break}}return 1}nextPage(){const e=this._currentPageNumber,t=this.pagesCount;if(e>=t)return!1;const n=this._getPageAdvance(e,!1)||1;return this.currentPageNumber=Math.min(e+n,t),!0}previousPage(){const e=this._currentPageNumber;if(e<=1)return!1;const t=this._getPageAdvance(e,!0)||1;return this.currentPageNumber=Math.max(e-t,1),!0}increaseScale(e=1){let t=this._currentScale;do{t=(t*i.DEFAULT_SCALE_DELTA).toFixed(2),t=Math.ceil(10*t)/10,t=Math.min(i.MAX_SCALE,t)}while(--e>0&&t<i.MAX_SCALE);this.currentScaleValue=t}decreaseScale(e=1){let t=this._currentScale;do{t=(t/i.DEFAULT_SCALE_DELTA).toFixed(2),t=Math.floor(10*t)/10,t=Math.max(i.MIN_SCALE,t)}while(--e>0&&t>i.MIN_SCALE);this.currentScaleValue=t}updateContainerHeightCss(){const e=this.container.clientHeight;e!==this.#xt&&(this.#xt=e,i.docStyle.setProperty("--viewer-container-height",`${e}px`))}get annotationEditorMode(){return this.#Ct?this.#St:r.AnnotationEditorType.DISABLE}set annotationEditorMode(e){if(!this.#Ct)throw new Error("The AnnotationEditor is not enabled.");if(this.#St!==e){if(!v(e))throw new Error(`Invalid AnnotationEditor mode: ${e}`);this.pdfDocument&&(this.#St=e,this.eventBus.dispatch("annotationeditormodechanged",{source:this,mode:e}),this.#Ct.updateMode(e))}}set annotationEditorParams({type:e,value:t}){if(!this.#Ct)throw new Error("The AnnotationEditor is not enabled.");this.#Ct.updateParams(e,t)}refresh(){if(!this.pdfDocument)return;const e={};for(const t of this._pages)t.update(e);this.update()}}t.BaseViewer=b},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFPageView=void 0;var r=n(3),i=n(7),s=n(14),a=n(4),o=n(15);const l=s.compatibilityParams.maxCanvasPixels||16777216;t.PDFPageView=class{#At=r.AnnotationMode.ENABLE_FORMS;#jt={initialOptionalContent:!0,regularAnnotations:!0};constructor(e){const t=e.container,n=e.defaultViewport;this.id=e.id,this.renderingId="page"+this.id,this.pdfPage=null,this.pageLabel=null,this.rotation=0,this.scale=e.scale||i.DEFAULT_SCALE,this.viewport=n,this.pdfPageRotate=n.rotation,this._optionalContentConfigPromise=e.optionalContentConfigPromise||null,this.hasRestrictedScaling=!1,this.textLayerMode=e.textLayerMode??i.TextLayerMode.ENABLE,this.#At=e.annotationMode??r.AnnotationMode.ENABLE_FORMS,this.imageResourcesPath=e.imageResourcesPath||"",this.useOnlyCssZoom=e.useOnlyCssZoom||!1,this.maxCanvasPixels=e.maxCanvasPixels||l,this.pageColors=e.pageColors||null,this.eventBus=e.eventBus,this.renderingQueue=e.renderingQueue,this.textLayerFactory=e.textLayerFactory,this.annotationLayerFactory=e.annotationLayerFactory,this.annotationEditorLayerFactory=e.annotationEditorLayerFactory,this.xfaLayerFactory=e.xfaLayerFactory,this.textHighlighter=e.textHighlighterFactory?.createTextHighlighter({pageIndex:this.id-1,eventBus:this.eventBus}),this.structTreeLayerFactory=e.structTreeLayerFactory,this.renderer=e.renderer||i.RendererType.CANVAS,this.l10n=e.l10n||a.NullL10n,this.paintTask=null,this.paintedViewportMap=new WeakMap,this.renderingState=i.RenderingStates.INITIAL,this.resume=null,this._renderError=null,this._isStandalone=!this.renderingQueue?.hasViewer(),this._annotationCanvasMap=null,this.annotationLayer=null,this.annotationEditorLayer=null,this.textLayer=null,this.zoomLayer=null,this.xfaLayer=null,this.structTreeLayer=null;const s=document.createElement("div");if(s.className="page",s.style.width=Math.floor(this.viewport.width)+"px",s.style.height=Math.floor(this.viewport.height)+"px",s.setAttribute("data-page-number",this.id),s.setAttribute("role","region"),this.l10n.get("page_landmark",{page:this.id}).then((e=>{s.setAttribute("aria-label",e)})),this.div=s,t?.append(s),this._isStandalone){const{optionalContentConfigPromise:t}=e;t&&t.then((e=>{t===this._optionalContentConfigPromise&&(this.#jt.initialOptionalContent=e.hasInitialVisibility)}))}}setPdfPage(e){this.pdfPage=e,this.pdfPageRotate=e.rotate;const t=(this.rotation+this.pdfPageRotate)%360;this.viewport=e.getViewport({scale:this.scale*r.PixelsPerInch.PDF_TO_CSS_UNITS,rotation:t}),this.reset()}destroy(){this.reset(),this.pdfPage&&this.pdfPage.cleanup()}async _renderAnnotationLayer(){let e=null;try{await this.annotationLayer.render(this.viewport,"display")}catch(t){console.error(`_renderAnnotationLayer: "${t}".`),e=t}finally{this.eventBus.dispatch("annotationlayerrendered",{source:this,pageNumber:this.id,error:e})}}async _renderAnnotationEditorLayer(){let e=null;try{await this.annotationEditorLayer.render(this.viewport,"display")}catch(t){console.error(`_renderAnnotationEditorLayer: "${t}".`),e=t}finally{this.eventBus.dispatch("annotationeditorlayerrendered",{source:this,pageNumber:this.id,error:e})}}async _renderXfaLayer(){let e=null;try{const t=await this.xfaLayer.render(this.viewport,"display");this.textHighlighter&&this._buildXfaTextContentItems(t.textDivs)}catch(t){console.error(`_renderXfaLayer: "${t}".`),e=t}finally{this.eventBus.dispatch("xfalayerrendered",{source:this,pageNumber:this.id,error:e})}}async _buildXfaTextContentItems(e){const t=await this.pdfPage.getTextContent(),n=[];for(const e of t.items)n.push(e.str);this.textHighlighter.setTextMapping(e,n),this.textHighlighter.enable()}_resetZoomLayer(e=!1){if(!this.zoomLayer)return;const t=this.zoomLayer.firstChild;this.paintedViewportMap.delete(t),t.width=0,t.height=0,e&&this.zoomLayer.remove(),this.zoomLayer=null}reset({keepZoomLayer:e=!1,keepAnnotationLayer:t=!1,keepAnnotationEditorLayer:n=!1,keepXfaLayer:r=!1}={}){this.cancelRendering({keepAnnotationLayer:t,keepAnnotationEditorLayer:n,keepXfaLayer:r}),this.renderingState=i.RenderingStates.INITIAL;const s=this.div;s.style.width=Math.floor(this.viewport.width)+"px",s.style.height=Math.floor(this.viewport.height)+"px";const a=s.childNodes,o=e&&this.zoomLayer||null,l=t&&this.annotationLayer?.div||null,c=n&&this.annotationEditorLayer?.div||null,u=r&&this.xfaLayer?.div||null;for(let e=a.length-1;e>=0;e--){const t=a[e];switch(t){case o:case l:case c:case u:continue}t.remove()}s.removeAttribute("data-loaded"),l&&this.annotationLayer.hide(),c?this.annotationEditorLayer.hide():this.annotationEditorLayer?.destroy(),u&&this.xfaLayer.hide(),o||(this.canvas&&(this.paintedViewportMap.delete(this.canvas),this.canvas.width=0,this.canvas.height=0,delete this.canvas),this._resetZoomLayer()),this.svg&&(this.paintedViewportMap.delete(this.svg),delete this.svg),this.loadingIconDiv=document.createElement("div"),this.loadingIconDiv.className="loadingIcon notVisible",this._isStandalone&&this.toggleLoadingIconSpinner(!0),this.loadingIconDiv.setAttribute("role","img"),this.l10n.get("loading").then((e=>{this.loadingIconDiv?.setAttribute("aria-label",e)})),s.append(this.loadingIconDiv)}update({scale:e=0,rotation:t=null,optionalContentConfigPromise:n=null}){this.scale=e||this.scale,"number"==typeof t&&(this.rotation=t),n instanceof Promise&&(this._optionalContentConfigPromise=n,n.then((e=>{n===this._optionalContentConfigPromise&&(this.#jt.initialOptionalContent=e.hasInitialVisibility)})));const s=(this.rotation+this.pdfPageRotate)%360;if(this.viewport=this.viewport.clone({scale:this.scale*r.PixelsPerInch.PDF_TO_CSS_UNITS,rotation:s}),this._isStandalone&&i.docStyle.setProperty("--scale-factor",this.viewport.scale),this.svg)return this.cssTransform({target:this.svg,redrawAnnotationLayer:!0,redrawAnnotationEditorLayer:!0,redrawXfaLayer:!0}),void this.eventBus.dispatch("pagerendered",{source:this,pageNumber:this.id,cssTransform:!0,timestamp:performance.now(),error:this._renderError});let a=!1;if(this.canvas&&this.maxCanvasPixels>0){const e=this.outputScale;(Math.floor(this.viewport.width)*e.sx|0)*(Math.floor(this.viewport.height)*e.sy|0)>this.maxCanvasPixels&&(a=!0)}if(this.canvas){if(this.useOnlyCssZoom||this.hasRestrictedScaling&&a)return this.cssTransform({target:this.canvas,redrawAnnotationLayer:!0,redrawAnnotationEditorLayer:!0,redrawXfaLayer:!0}),void this.eventBus.dispatch("pagerendered",{source:this,pageNumber:this.id,cssTransform:!0,timestamp:performance.now(),error:this._renderError});this.zoomLayer||this.canvas.hidden||(this.zoomLayer=this.canvas.parentNode,this.zoomLayer.style.position="absolute")}this.zoomLayer&&this.cssTransform({target:this.zoomLayer.firstChild}),this.reset({keepZoomLayer:!0,keepAnnotationLayer:!0,keepAnnotationEditorLayer:!0,keepXfaLayer:!0})}cancelRendering({keepAnnotationLayer:e=!1,keepAnnotationEditorLayer:t=!1,keepXfaLayer:n=!1}={}){this.paintTask&&(this.paintTask.cancel(),this.paintTask=null),this.resume=null,this.textLayer&&(this.textLayer.cancel(),this.textLayer=null),!this.annotationLayer||e&&this.annotationLayer.div||(this.annotationLayer.cancel(),this.annotationLayer=null,this._annotationCanvasMap=null),!this.annotationEditorLayer||t&&this.annotationEditorLayer.div||(this.annotationEditorLayer.cancel(),this.annotationEditorLayer=null),!this.xfaLayer||n&&this.xfaLayer.div||(this.xfaLayer.cancel(),this.xfaLayer=null,this.textHighlighter?.disable()),this._onTextLayerRendered&&(this.eventBus._off("textlayerrendered",this._onTextLayerRendered),this._onTextLayerRendered=null)}cssTransform({target:e,redrawAnnotationLayer:t=!1,redrawAnnotationEditorLayer:n=!1,redrawXfaLayer:r=!1}){const i=this.viewport.width,s=this.viewport.height,a=this.div;e.style.width=e.parentNode.style.width=a.style.width=Math.floor(i)+"px",e.style.height=e.parentNode.style.height=a.style.height=Math.floor(s)+"px";const o=this.viewport.rotation-this.paintedViewportMap.get(e).rotation,l=Math.abs(o);let c=1,u=1;if(90!==l&&270!==l||(c=s/i,u=i/s),e.style.transform=`rotate(${o}deg) scale(${c}, ${u})`,this.textLayer){const e=this.textLayer.viewport,t=this.viewport.rotation-e.rotation,n=Math.abs(t);let r=i/e.width;90!==n&&270!==n||(r=i/e.height);const s=this.textLayer.textLayerDiv;let a,o;switch(n){case 0:a=o=0;break;case 90:a=0,o="-"+s.style.height;break;case 180:a="-"+s.style.width,o="-"+s.style.height;break;case 270:a="-"+s.style.width,o=0;break;default:console.error("Bad rotation value.")}s.style.transform=`rotate(${n}deg) scale(${r}) translate(${a}, ${o})`,s.style.transformOrigin="0% 0%"}t&&this.annotationLayer&&this._renderAnnotationLayer(),n&&this.annotationEditorLayer&&this._renderAnnotationEditorLayer(),r&&this.xfaLayer&&this._renderXfaLayer()}get width(){return this.viewport.width}get height(){return this.viewport.height}getPagePoint(e,t){return this.viewport.convertToPdfPoint(e,t)}toggleLoadingIconSpinner(e=!1){this.loadingIconDiv?.classList.toggle("notVisible",!e)}draw(){this.renderingState!==i.RenderingStates.INITIAL&&(console.error("Must be in new state before drawing"),this.reset());const{div:e,pdfPage:t}=this;if(!t)return this.renderingState=i.RenderingStates.FINISHED,this.loadingIconDiv&&(this.loadingIconDiv.remove(),delete this.loadingIconDiv),Promise.reject(new Error("pdfPage is not loaded"));this.renderingState=i.RenderingStates.RUNNING;const n=document.createElement("div");n.style.width=e.style.width,n.style.height=e.style.height,n.classList.add("canvasWrapper");const s=this.annotationLayer?.div||this.annotationEditorLayer?.div;s?s.before(n):e.append(n);let a=null;if(this.textLayerMode!==i.TextLayerMode.DISABLE&&this.textLayerFactory){this._accessibilityManager||=new o.TextAccessibilityManager;const t=document.createElement("div");t.className="textLayer",t.style.width=n.style.width,t.style.height=n.style.height,s?s.before(t):e.append(t),a=this.textLayerFactory.createTextLayerBuilder({textLayerDiv:t,pageIndex:this.id-1,viewport:this.viewport,enhanceTextSelection:this.textLayerMode===i.TextLayerMode.ENABLE_ENHANCE,eventBus:this.eventBus,highlighter:this.textHighlighter,accessibilityManager:this._accessibilityManager})}this.textLayer=a,this.#At!==r.AnnotationMode.DISABLE&&this.annotationLayerFactory&&(this._annotationCanvasMap||=new Map,this.annotationLayer||=this.annotationLayerFactory.createAnnotationLayerBuilder({pageDiv:e,pdfPage:t,imageResourcesPath:this.imageResourcesPath,renderForms:this.#At===r.AnnotationMode.ENABLE_FORMS,l10n:this.l10n,annotationCanvasMap:this._annotationCanvasMap,accessibilityManager:this._accessibilityManager})),this.xfaLayer?.div&&e.append(this.xfaLayer.div);let l=null;this.renderingQueue&&(l=e=>{if(!this.renderingQueue.isHighestPriority(this))return this.renderingState=i.RenderingStates.PAUSED,void(this.resume=()=>{this.renderingState=i.RenderingStates.RUNNING,e()});e()});const c=async(e=null)=>{if(u===this.paintTask&&(this.paintTask=null),e instanceof r.RenderingCancelledException)this._renderError=null;else if(this._renderError=e,this.renderingState=i.RenderingStates.FINISHED,this.loadingIconDiv&&(this.loadingIconDiv.remove(),delete this.loadingIconDiv),this._resetZoomLayer(!0),this.#jt.regularAnnotations=!u.separateAnnots,this.eventBus.dispatch("pagerendered",{source:this,pageNumber:this.id,cssTransform:!1,timestamp:performance.now(),error:this._renderError}),e)throw e},u=this.renderer===i.RendererType.SVG?this.paintOnSvg(n):this.paintOnCanvas(n);u.onRenderContinue=l,this.paintTask=u;const d=u.promise.then((()=>c(null).then((()=>{if(a){const e=t.streamTextContent({includeMarkedContent:!0});a.setTextContentStream(e),a.render()}this.annotationLayer&&this._renderAnnotationLayer().then((()=>{this.annotationEditorLayerFactory&&(this.annotationEditorLayer||=this.annotationEditorLayerFactory.createAnnotationEditorLayerBuilder({pageDiv:e,pdfPage:t,l10n:this.l10n,accessibilityManager:this._accessibilityManager}),this._renderAnnotationEditorLayer())}))}))),(function(e){return c(e)}));return this.xfaLayerFactory&&(this.xfaLayer||=this.xfaLayerFactory.createXfaLayerBuilder({pageDiv:e,pdfPage:t}),this._renderXfaLayer()),this.structTreeLayerFactory&&this.textLayer&&this.canvas&&(this._onTextLayerRendered=e=>{e.pageNumber===this.id&&(this.eventBus._off("textlayerrendered",this._onTextLayerRendered),this._onTextLayerRendered=null,this.canvas&&this.pdfPage.getStructTree().then((e=>{if(!e)return;if(!this.canvas)return;const t=this.structTreeLayer.render(e);t.classList.add("structTree"),this.canvas.append(t)})))},this.eventBus._on("textlayerrendered",this._onTextLayerRendered),this.structTreeLayer=this.structTreeLayerFactory.createStructTreeLayerBuilder({pdfPage:t})),e.setAttribute("data-loaded",!0),this.eventBus.dispatch("pagerender",{source:this,pageNumber:this.id}),d}paintOnCanvas(e){const t=(0,r.createPromiseCapability)(),n={promise:t.promise,onRenderContinue(e){e()},cancel(){f.cancel()},get separateAnnots(){return f.separateAnnots}},s=this.viewport,a=document.createElement("canvas");a.setAttribute("role","presentation"),a.hidden=!0;let o=!0;const l=function(){o&&(a.hidden=!1,o=!1)};e.append(a),this.canvas=a;const c=a.getContext("2d",{alpha:!1}),u=this.outputScale=new i.OutputScale;if(this.useOnlyCssZoom){const e=s.clone({scale:r.PixelsPerInch.PDF_TO_CSS_UNITS});u.sx*=e.width/s.width,u.sy*=e.height/s.height}if(this.maxCanvasPixels>0){const e=s.width*s.height,t=Math.sqrt(this.maxCanvasPixels/e);u.sx>t||u.sy>t?(u.sx=t,u.sy=t,this.hasRestrictedScaling=!0):this.hasRestrictedScaling=!1}const d=(0,i.approximateFraction)(u.sx),h=(0,i.approximateFraction)(u.sy);a.width=(0,i.roundToDivide)(s.width*u.sx,d[0]),a.height=(0,i.roundToDivide)(s.height*u.sy,h[0]),a.style.width=(0,i.roundToDivide)(s.width,d[1])+"px",a.style.height=(0,i.roundToDivide)(s.height,h[1])+"px",this.paintedViewportMap.set(a,s);const p={canvasContext:c,transform:u.scaled?[u.sx,0,0,u.sy,0,0]:null,viewport:this.viewport,annotationMode:this.#At,optionalContentConfigPromise:this._optionalContentConfigPromise,annotationCanvasMap:this._annotationCanvasMap,pageColors:this.pageColors},f=this.pdfPage.render(p);return f.onContinue=function(e){l(),n.onRenderContinue?n.onRenderContinue(e):e()},f.promise.then((function(){l(),t.resolve()}),(function(e){l(),t.reject(e)})),n}paintOnSvg(e){let t=!1;const n=()=>{if(t)throw new r.RenderingCancelledException(`Rendering cancelled, page ${this.id}`,"svg")},s=this.pdfPage,a=this.viewport.clone({scale:r.PixelsPerInch.PDF_TO_CSS_UNITS});return{promise:s.getOperatorList({annotationMode:this.#At}).then((t=>(n(),new r.SVGGraphics(s.commonObjs,s.objs).getSVG(t,a).then((t=>{n(),this.svg=t,this.paintedViewportMap.set(t,a),t.style.width=e.style.width,t.style.height=e.style.height,this.renderingState=i.RenderingStates.FINISHED,e.append(t)}))))),onRenderContinue(e){e()},cancel(){t=!0},get separateAnnots(){return!1}}}setPageLabel(e){this.pageLabel="string"==typeof e?e:null,null!==this.pageLabel?this.div.setAttribute("data-page-label",this.pageLabel):this.div.removeAttribute("data-page-label")}get thumbnailCanvas(){const{initialOptionalContent:e,regularAnnotations:t}=this.#jt;return e&&t?this.canvas:null}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.compatibilityParams=t.OptionKind=t.AppOptions=void 0;const n=Object.create(null);t.compatibilityParams=n;{const e=navigator.userAgent||"",t=navigator.platform||"",r=navigator.maxTouchPoints||1,i=/Android/.test(e);(/\b(iPad|iPhone|iPod)(?=;)/.test(e)||"MacIntel"===t&&r>1||i)&&(n.maxCanvasPixels=5242880)}const r={VIEWER:2,API:4,WORKER:8,PREFERENCE:128};t.OptionKind=r;const i={annotationEditorMode:{value:-1,kind:r.VIEWER+r.PREFERENCE},annotationMode:{value:2,kind:r.VIEWER+r.PREFERENCE},cursorToolOnLoad:{value:0,kind:r.VIEWER+r.PREFERENCE},defaultZoomValue:{value:"",kind:r.VIEWER+r.PREFERENCE},disableHistory:{value:!1,kind:r.VIEWER},disablePageLabels:{value:!1,kind:r.VIEWER+r.PREFERENCE},enablePermissions:{value:!1,kind:r.VIEWER+r.PREFERENCE},enablePrintAutoRotate:{value:!0,kind:r.VIEWER+r.PREFERENCE},enableScripting:{value:!0,kind:r.VIEWER+r.PREFERENCE},externalLinkRel:{value:"noopener noreferrer nofollow",kind:r.VIEWER},externalLinkTarget:{value:0,kind:r.VIEWER+r.PREFERENCE},historyUpdateUrl:{value:!1,kind:r.VIEWER+r.PREFERENCE},ignoreDestinationZoom:{value:!1,kind:r.VIEWER+r.PREFERENCE},imageResourcesPath:{value:"./images/",kind:r.VIEWER},maxCanvasPixels:{value:16777216,kind:r.VIEWER},forcePageColors:{value:!1,kind:r.VIEWER+r.PREFERENCE},pageColorsBackground:{value:"Canvas",kind:r.VIEWER+r.PREFERENCE},pageColorsForeground:{value:"CanvasText",kind:r.VIEWER+r.PREFERENCE},pdfBugEnabled:{value:!1,kind:r.VIEWER+r.PREFERENCE},printResolution:{value:150,kind:r.VIEWER},sidebarViewOnLoad:{value:-1,kind:r.VIEWER+r.PREFERENCE},scrollModeOnLoad:{value:-1,kind:r.VIEWER+r.PREFERENCE},spreadModeOnLoad:{value:-1,kind:r.VIEWER+r.PREFERENCE},textLayerMode:{value:1,kind:r.VIEWER+r.PREFERENCE},useOnlyCssZoom:{value:!1,kind:r.VIEWER+r.PREFERENCE},viewerCssTheme:{value:0,kind:r.VIEWER+r.PREFERENCE},viewOnLoad:{value:0,kind:r.VIEWER+r.PREFERENCE},cMapPacked:{value:!0,kind:r.API},cMapUrl:{value:"../web/cmaps/",kind:r.API},disableAutoFetch:{value:!1,kind:r.API+r.PREFERENCE},disableFontFace:{value:!1,kind:r.API+r.PREFERENCE},disableRange:{value:!1,kind:r.API+r.PREFERENCE},disableStream:{value:!1,kind:r.API+r.PREFERENCE},docBaseUrl:{value:"",kind:r.API},enableXfa:{value:!0,kind:r.API+r.PREFERENCE},fontExtraProperties:{value:!1,kind:r.API},isEvalSupported:{value:!0,kind:r.API},maxImageSize:{value:-1,kind:r.API},pdfBug:{value:!1,kind:r.API},standardFontDataUrl:{value:"../web/standard_fonts/",kind:r.API},verbosity:{value:1,kind:r.API},workerPort:{value:null,kind:r.WORKER},workerSrc:{value:"../build/pdf.worker.js",kind:r.WORKER}};i.defaultUrl={value:"compressed.tracemonkey-pldi-09.pdf",kind:r.VIEWER},i.disablePreferences={value:!1,kind:r.VIEWER},i.locale={value:navigator.language||"en-US",kind:r.VIEWER},i.renderer={value:"canvas",kind:r.VIEWER+r.PREFERENCE},i.sandboxBundleSrc={value:"../build/pdf.sandbox.js",kind:r.VIEWER};const s=Object.create(null);t.AppOptions=class{constructor(){throw new Error("Cannot initialize AppOptions.")}static get(e){const t=s[e];if(void 0!==t)return t;const r=i[e];return void 0!==r?n[e]??r.value:void 0}static getAll(e=null){const t=Object.create(null);for(const a in i){const o=i[a];if(e){if(0==(e&o.kind))continue;if(e===r.PREFERENCE){const e=o.value,n=typeof e;if("boolean"===n||"string"===n||"number"===n&&Number.isInteger(e)){t[a]=e;continue}throw new Error(`Invalid type for preference: ${a}`)}}const l=s[a];t[a]=void 0!==l?l:n[a]??o.value}return t}static set(e,t){s[e]=t}static setAll(e){for(const t in e)s[t]=e[t]}static remove(e){delete s[e]}static _hasUserOptions(){return Object.keys(s).length>0}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TextAccessibilityManager=void 0;var r=n(7);class i{#$t=!1;#Ht=null;#Bt=new Map;#Vt=new Map;setTextMapping(e){this.#Ht=e}static#Wt(e,t){const n=e.getBoundingClientRect(),r=t.getBoundingClientRect();if(0===n.width&&0===n.height)return 1;if(0===r.width&&0===r.height)return-1;const i=n.y,s=n.y+n.height,a=n.y+n.height/2,o=r.y,l=r.y+r.height,c=r.y+r.height/2;return a<=o&&c>=s?-1:c<=i&&a>=l?1:n.x+n.width/2-(r.x+r.width/2)}enable(){if(this.#$t)throw new Error("TextAccessibilityManager is already enabled.");if(!this.#Ht)throw new Error("Text divs and strings have not been set.");if(this.#$t=!0,this.#Ht=this.#Ht.slice(),this.#Ht.sort(i.#Wt),this.#Bt.size>0){const e=this.#Ht;for(const[t,n]of this.#Bt)document.getElementById(t)?this.#qt(t,e[n]):this.#Bt.delete(t)}for(const[e,t]of this.#Vt)this.addPointerInTextLayer(e,t);this.#Vt.clear()}disable(){this.#$t&&(this.#Vt.clear(),this.#Ht=null,this.#$t=!1)}removePointerInTextLayer(e){if(!this.#$t)return void this.#Vt.delete(e);const t=this.#Ht;if(!t||0===t.length)return;const{id:n}=e,r=this.#Bt.get(n);if(void 0===r)return;const i=t[r];this.#Bt.delete(n);let s=i.getAttribute("aria-owns");s?.includes(n)&&(s=s.split(" ").filter((e=>e!==n)).join(" "),s?i.setAttribute("aria-owns",s):(i.removeAttribute("aria-owns"),i.setAttribute("role","presentation")))}#qt(e,t){const n=t.getAttribute("aria-owns");n?.includes(e)||t.setAttribute("aria-owns",n?`${n} ${e}`:e),t.removeAttribute("role")}addPointerInTextLayer(e,t){const{id:n}=e;if(!n)return;if(!this.#$t)return void this.#Vt.set(e,t);t&&this.removePointerInTextLayer(e);const s=this.#Ht;if(!s||0===s.length)return;const a=(0,r.binarySearchFirstItem)(s,(t=>i.#Wt(e,t)<0)),o=Math.max(0,a-1);this.#qt(n,s[o]),this.#Bt.set(n,o)}moveElementInDOM(e,t,n,s){if(this.addPointerInTextLayer(n,s),!e.hasChildNodes())return void e.append(t);const a=Array.from(e.childNodes).filter((e=>e!==t));if(0===a.length)return;const o=n||t,l=(0,r.binarySearchFirstItem)(a,(e=>i.#Wt(o,e)<0));0===l?a[0].before(t):a[l-1].after(t)}}t.TextAccessibilityManager=i},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFRenderingQueue=void 0;var r=n(3),i=n(7);t.PDFRenderingQueue=class{constructor(){this.pdfViewer=null,this.pdfThumbnailViewer=null,this.onIdle=null,this.highestPriorityPage=null,this.idleTimeout=null,this.printing=!1,this.isThumbnailViewEnabled=!1}setViewer(e){this.pdfViewer=e}setThumbnailViewer(e){this.pdfThumbnailViewer=e}isHighestPriority(e){return this.highestPriorityPage===e.renderingId}hasViewer(){return!!this.pdfViewer}renderHighestPriority(e){this.idleTimeout&&(clearTimeout(this.idleTimeout),this.idleTimeout=null),this.pdfViewer.forceRendering(e)||this.isThumbnailViewEnabled&&this.pdfThumbnailViewer?.forceRendering()||this.printing||this.onIdle&&(this.idleTimeout=setTimeout(this.onIdle.bind(this),3e4))}getHighestPriority(e,t,n,r=!1){const i=e.views,s=i.length;if(0===s)return null;for(let e=0;e<s;e++){const t=i[e].view;if(!this.isViewFinished(t))return t}const a=e.first.id,o=e.last.id;if(o-a+1>s){const r=e.ids;for(let e=1,i=o-a;e<i;e++){const i=n?a+e:o-e;if(r.has(i))continue;const s=t[i-1];if(!this.isViewFinished(s))return s}}let l=n?o:a-2,c=t[l];return c&&!this.isViewFinished(c)||r&&(l+=n?1:-1,c=t[l],c&&!this.isViewFinished(c))?c:null}isViewFinished(e){return e.renderingState===i.RenderingStates.FINISHED}renderView(e){switch(e.renderingState){case i.RenderingStates.FINISHED:return!1;case i.RenderingStates.PAUSED:this.highestPriorityPage=e.renderingId,e.resume();break;case i.RenderingStates.RUNNING:this.highestPriorityPage=e.renderingId;break;case i.RenderingStates.INITIAL:this.highestPriorityPage=e.renderingId,e.draw().finally((()=>{this.renderHighestPriority()})).catch((e=>{e instanceof r.RenderingCancelledException||console.error(`renderView: "${e}"`)}))}return!0}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.TextHighlighter=void 0,t.TextHighlighter=class{constructor({findController:e,eventBus:t,pageIndex:n}){this.findController=e,this.matches=[],this.eventBus=t,this.pageIdx=n,this._onUpdateTextLayerMatches=null,this.textDivs=null,this.textContentItemsStr=null,this.enabled=!1}setTextMapping(e,t){this.textDivs=e,this.textContentItemsStr=t}enable(){if(!this.textDivs||!this.textContentItemsStr)throw new Error("Text divs and strings have not been set.");if(this.enabled)throw new Error("TextHighlighter is already enabled.");this.enabled=!0,this._onUpdateTextLayerMatches||(this._onUpdateTextLayerMatches=e=>{e.pageIndex!==this.pageIdx&&-1!==e.pageIndex||this._updateMatches()},this.eventBus._on("updatetextlayermatches",this._onUpdateTextLayerMatches)),this._updateMatches()}disable(){this.enabled&&(this.enabled=!1,this._onUpdateTextLayerMatches&&(this.eventBus._off("updatetextlayermatches",this._onUpdateTextLayerMatches),this._onUpdateTextLayerMatches=null))}_convertMatches(e,t){if(!e)return[];const{textContentItemsStr:n}=this;let r=0,i=0;const s=n.length-1,a=[];for(let o=0,l=e.length;o<l;o++){let l=e[o];for(;r!==s&&l>=i+n[r].length;)i+=n[r].length,r++;r===n.length&&console.error("Could not find a matching mapping");const c={begin:{divIdx:r,offset:l-i}};for(l+=t[o];r!==s&&l>i+n[r].length;)i+=n[r].length,r++;c.end={divIdx:r,offset:l-i},a.push(c)}return a}_renderMatches(e){if(0===e.length)return;const{findController:t,pageIdx:n}=this,{textContentItemsStr:r,textDivs:i}=this,s=n===t.selected.pageIdx,a=t.selected.matchIdx;let o=null;const l={divIdx:-1,offset:void 0};function c(e,t){const n=e.divIdx;return i[n].textContent="",u(n,0,e.offset,t)}function u(e,t,n,s){let a=i[e];if(a.nodeType===Node.TEXT_NODE){const t=document.createElement("span");a.before(t),t.append(a),i[e]=t,a=t}const o=r[e].substring(t,n),l=document.createTextNode(o);if(s){const e=document.createElement("span");return e.className=`${s} appended`,e.append(l),a.append(e),s.includes("selected")?e.offsetLeft:0}return a.append(l),0}let d=a,h=d+1;if(t.state.highlightAll)d=0,h=e.length;else if(!s)return;for(let r=d;r<h;r++){const d=e[r],h=d.begin,p=d.end,f=s&&r===a,g=f?" selected":"";let m=0;if(o&&h.divIdx===o.divIdx?u(o.divIdx,o.offset,h.offset):(null!==o&&u(o.divIdx,o.offset,l.offset),c(h)),h.divIdx===p.divIdx)m=u(h.divIdx,h.offset,p.offset,"highlight"+g);else{m=u(h.divIdx,h.offset,l.offset,"highlight begin"+g);for(let e=h.divIdx+1,t=p.divIdx;e<t;e++)i[e].className="highlight middle"+g;c(p,"highlight end"+g)}o=p,f&&t.scrollMatchIntoView({element:i[h.divIdx],selectedLeft:m,pageIndex:n,matchIndex:a})}o&&u(o.divIdx,o.offset,l.offset)}_updateMatches(){if(!this.enabled)return;const{findController:e,matches:t,pageIdx:n}=this,{textContentItemsStr:r,textDivs:i}=this;let s=-1;for(let e=0,n=t.length;e<n;e++){const n=t[e];for(let e=Math.max(s,n.begin.divIdx),t=n.end.divIdx;e<=t;e++){const t=i[e];t.textContent=r[e],t.className=""}s=n.end.divIdx+1}if(!e?.highlightMatches)return;const a=e.pageMatches[n]||null,o=e.pageMatchesLength[n]||null;this.matches=this._convertMatches(a,o),this._renderMatches(this.matches)}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.DownloadManager=void 0;var r=n(3);function i(e,t){const n=document.createElement("a");if(!n.click)throw new Error('DownloadManager: "a.click()" is not supported.');n.href=e,n.target="_parent","download"in n&&(n.download=t),(document.body||document.documentElement).append(n),n.click(),n.remove()}t.DownloadManager=class{constructor(){this._openBlobUrls=new WeakMap}downloadUrl(e,t){(0,r.createValidAbsoluteUrl)(e,"http://example.com")?i(e+"#pdfjs.action=download",t):console.error(`downloadUrl - not a valid URL: ${e}`)}downloadData(e,t,n){i(URL.createObjectURL(new Blob([e],{type:n})),t)}openOrDownloadData(e,t,n){const i=(0,r.isPdfFile)(n),s=i?"application/pdf":"";if(i){let r,i=this._openBlobUrls.get(e);i||(i=URL.createObjectURL(new Blob([t],{type:s})),this._openBlobUrls.set(e,i)),r="?file="+encodeURIComponent(i+"#"+n);try{return window.open(r),!0}catch(t){console.error(`openOrDownloadData: ${t}`),URL.revokeObjectURL(i),this._openBlobUrls.delete(e)}}return this.downloadData(t,n,s),!1}download(e,t,n){i(URL.createObjectURL(e),n)}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.WaitOnType=t.EventBus=t.AutomationEventBus=void 0,t.waitOnEventOrTimeout=function({target:e,name:t,delay:i=0}){return new Promise((function(s,a){if("object"!=typeof e||!t||"string"!=typeof t||!(Number.isInteger(i)&&i>=0))throw new Error("waitOnEventOrTimeout - invalid parameters.");function o(n){e instanceof r?e._off(t,l):e.removeEventListener(t,l),u&&clearTimeout(u),s(n)}const l=o.bind(null,n.EVENT);e instanceof r?e._on(t,l):e.addEventListener(t,l);const c=o.bind(null,n.TIMEOUT),u=setTimeout(c,i)}))};const n={EVENT:"event",TIMEOUT:"timeout"};t.WaitOnType=n;class r{constructor(){this._listeners=Object.create(null)}on(e,t,n=null){this._on(e,t,{external:!0,once:n?.once})}off(e,t,n=null){this._off(e,t,{external:!0,once:n?.once})}dispatch(e,t){const n=this._listeners[e];if(!n||0===n.length)return;let r;for(const{listener:i,external:s,once:a}of n.slice(0))a&&this._off(e,i),s?(r||=[]).push(i):i(t);if(r){for(const e of r)e(t);r=null}}_on(e,t,n=null){(this._listeners[e]||=[]).push({listener:t,external:!0===n?.external,once:!0===n?.once})}_off(e,t,n=null){const r=this._listeners[e];if(r)for(let e=0,n=r.length;e<n;e++)if(r[e].listener===t)return void r.splice(e,1)}}t.EventBus=r,t.AutomationEventBus=class extends r{dispatch(e,t){throw new Error("Not implemented: AutomationEventBus.dispatch")}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GenericL10n=void 0,n(21);var r=n(4);const i=document.webL10n;t.GenericL10n=class{constructor(e){this._lang=e,this._ready=new Promise(((t,n)=>{i.setLanguage((0,r.fixupLangCode)(e),(()=>{t(i)}))}))}async getLanguage(){return(await this._ready).getLanguage()}async getDirection(){return(await this._ready).getDirection()}async get(e,t=null,n=(0,r.getL10nFallback)(e,t)){return(await this._ready).get(e,t,n)}async translate(e){return(await this._ready).translate(e)}}},()=>{document.webL10n=function(e,t,n){var r={},i="",s="textContent",a="",o={},l="loading";function c(e,t,n){t=t||function(e){},n=n||function(){};var r=new XMLHttpRequest;r.open("GET",e,!0),r.overrideMimeType&&r.overrideMimeType("text/plain; charset=utf-8"),r.onreadystatechange=function(){4==r.readyState&&(200==r.status||0===r.status?t(r.responseText):n())},r.onerror=n,r.ontimeout=n;try{r.send(null)}catch(e){n()}}function u(e,t,n,a){var o=e.replace(/[^\/]*$/,"")||"./";function l(e){return e.lastIndexOf("\\")<0?e:e.replace(/\\\\/g,"\\").replace(/\\n/g,"\n").replace(/\\r/g,"\r").replace(/\\t/g,"\t").replace(/\\b/g,"\b").replace(/\\f/g,"\f").replace(/\\{/g,"{").replace(/\\}/g,"}").replace(/\\"/g,'"').replace(/\\'/g,"'")}c(e,(function(e){i+=e,function(e,n){var r={},i=/^\s*|\s*$/,s=/^\s*#|^\s*$/,a=/^\s*\[(.*)\]\s*$/,u=/^\s*@import\s+url\((.*)\)\s*$/i,d=/^([^=\s]*)\s*=\s*(.+)$/;function h(e,n,c){var h=e.replace(i,"").split(/[\r\n]+/),f="*",g=t.split("-",1)[0],m=!1,v="";!function e(){for(;;){if(!h.length)return void c();var i=h.shift();if(!s.test(i)){if(n){if(v=a.exec(i)){f=v[1].toLowerCase(),m="*"!==f&&f!==t&&f!==g;continue}if(m)continue;if(v=u.exec(i))return void p(o+v[1],e)}var y=i.match(d);y&&3==y.length&&(r[y[1]]=l(y[2]))}}}()}function p(e,t){c(e,(function(e){h(e,!1,t)}),(function(){console.warn(e+" not found."),t()}))}h(e,!0,(function(){n(r)}))}(e,(function(e){for(var t in e){var i,a,o=t.lastIndexOf(".");o>0?(i=t.substring(0,o),a=t.substring(o+1)):(i=t,a=s),r[i]||(r[i]={}),r[i][a]=e[t]}n&&n()}))}),a)}function d(e,n){e&&(e=e.toLowerCase()),n=n||function(){},r={},i="",a="",a=e;var s=t.querySelectorAll('link[type="application/l10n"]'),o=s.length;if(0!==o){var c,d,h=0;d=function(){++h>=o&&(n(),l="complete")};for(var p=0;p<o;p++)new v(s[p]).load(e,d)}else{var f=(c=t.querySelector('script[type="application/l10n"]'))?JSON.parse(c.innerHTML):null;if(f&&f.locales&&f.default_locale){if(console.log("using the embedded JSON directory, early way out"),!(r=f.locales[e])){var g=f.default_locale.toLowerCase();for(var m in f.locales){if((m=m.toLowerCase())===e){r=f.locales[e];break}m===g&&(r=f.locales[g])}}n()}else console.log("no resource to load, early way out");l="complete"}function v(e){var t=e.href;this.load=function(e,n){u(t,e,n,(function(){console.warn(t+" not found."),console.warn('"'+e+'" resource not found'),a="",n()}))}}}function h(e,t,n){var i=r[e];if(!i){if(console.warn("#"+e+" is undefined."),!n)return null;i=n}var s={};for(var a in i){var o=i[a];o=f(o=p(o,t,e,a),t,e),s[a]=o}return s}function p(e,t,n,i){var s=/\{\[\s*([a-zA-Z]+)\(([a-zA-Z]+)\)\s*\]\}/.exec(e);if(!s||!s.length)return e;var a,l=s[1],c=s[2];return t&&c in t?a=t[c]:c in r&&(a=r[c]),l in o&&(e=(0,o[l])(e,a,n,i)),e}function f(e,t,n){return e.replace(/\{\{\s*(.+?)\s*\}\}/g,(function(e,i){return t&&i in t?t[i]:i in r?r[i]:(console.log("argument {{"+i+"}} for #"+n+" is undefined."),e)}))}function g(e){var n=function(e){if(!e)return{};var t=e.getAttribute("data-l10n-id"),n=e.getAttribute("data-l10n-args"),r={};if(n)try{r=JSON.parse(n)}catch(e){console.warn("could not parse arguments for #"+t)}return{id:t,args:r}}(e);if(n.id){var r=h(n.id,n.args);if(r){if(r[s]){if(0===function(e){if(e.children)return e.children.length;if(void 0!==e.childElementCount)return e.childElementCount;for(var t=0,n=0;n<e.childNodes.length;n++)t+=1===e.nodeType?1:0;return t}(e))e[s]=r[s];else{for(var i=e.childNodes,a=!1,o=0,l=i.length;o<l;o++)3===i[o].nodeType&&/\S/.test(i[o].nodeValue)&&(a?i[o].nodeValue="":(i[o].nodeValue=r[s],a=!0));if(!a){var c=t.createTextNode(r[s]);e.prepend(c)}}delete r[s]}for(var u in r)e[u]=r[u]}else console.warn("#"+n.id+" is undefined.")}}return o.plural=function(e,t,n,i){var l=parseFloat(t);if(isNaN(l))return e;if(i!=s)return e;o._pluralRules||(o._pluralRules=function(e){function t(e,t){return-1!==t.indexOf(e)}function n(e,t,n){return t<=e&&e<=n}var r={0:function(e){return"other"},1:function(e){return n(e%100,3,10)?"few":0===e?"zero":n(e%100,11,99)?"many":2==e?"two":1==e?"one":"other"},2:function(e){return 0!==e&&e%10==0?"many":2==e?"two":1==e?"one":"other"},3:function(e){return 1==e?"one":"other"},4:function(e){return n(e,0,1)?"one":"other"},5:function(e){return n(e,0,2)&&2!=e?"one":"other"},6:function(e){return 0===e?"zero":e%10==1&&e%100!=11?"one":"other"},7:function(e){return 2==e?"two":1==e?"one":"other"},8:function(e){return n(e,3,6)?"few":n(e,7,10)?"many":2==e?"two":1==e?"one":"other"},9:function(e){return 0===e||1!=e&&n(e%100,1,19)?"few":1==e?"one":"other"},10:function(e){return n(e%10,2,9)&&!n(e%100,11,19)?"few":e%10!=1||n(e%100,11,19)?"other":"one"},11:function(e){return n(e%10,2,4)&&!n(e%100,12,14)?"few":e%10==0||n(e%10,5,9)||n(e%100,11,14)?"many":e%10==1&&e%100!=11?"one":"other"},12:function(e){return n(e,2,4)?"few":1==e?"one":"other"},13:function(e){return n(e%10,2,4)&&!n(e%100,12,14)?"few":1!=e&&n(e%10,0,1)||n(e%10,5,9)||n(e%100,12,14)?"many":1==e?"one":"other"},14:function(e){return n(e%100,3,4)?"few":e%100==2?"two":e%100==1?"one":"other"},15:function(e){return 0===e||n(e%100,2,10)?"few":n(e%100,11,19)?"many":1==e?"one":"other"},16:function(e){return e%10==1&&11!=e?"one":"other"},17:function(e){return 3==e?"few":0===e?"zero":6==e?"many":2==e?"two":1==e?"one":"other"},18:function(e){return 0===e?"zero":n(e,0,2)&&0!==e&&2!=e?"one":"other"},19:function(e){return n(e,2,10)?"few":n(e,0,1)?"one":"other"},20:function(e){return!n(e%10,3,4)&&e%10!=9||n(e%100,10,19)||n(e%100,70,79)||n(e%100,90,99)?e%1e6==0&&0!==e?"many":e%10!=2||t(e%100,[12,72,92])?e%10!=1||t(e%100,[11,71,91])?"other":"one":"two":"few"},21:function(e){return 0===e?"zero":1==e?"one":"other"},22:function(e){return n(e,0,1)||n(e,11,99)?"one":"other"},23:function(e){return n(e%10,1,2)||e%20==0?"one":"other"},24:function(e){return n(e,3,10)||n(e,13,19)?"few":t(e,[2,12])?"two":t(e,[1,11])?"one":"other"}},i={af:3,ak:4,am:4,ar:1,asa:3,az:0,be:11,bem:3,bez:3,bg:3,bh:4,bm:0,bn:3,bo:0,br:20,brx:3,bs:11,ca:3,cgg:3,chr:3,cs:12,cy:17,da:3,de:3,dv:3,dz:0,ee:3,el:3,en:3,eo:3,es:3,et:3,eu:3,fa:0,ff:5,fi:3,fil:4,fo:3,fr:5,fur:3,fy:3,ga:8,gd:24,gl:3,gsw:3,gu:3,guw:4,gv:23,ha:3,haw:3,he:2,hi:4,hr:11,hu:0,id:0,ig:0,ii:0,is:3,it:3,iu:7,ja:0,jmc:3,jv:0,ka:0,kab:5,kaj:3,kcg:3,kde:0,kea:0,kk:3,kl:3,km:0,kn:0,ko:0,ksb:3,ksh:21,ku:3,kw:7,lag:18,lb:3,lg:3,ln:4,lo:0,lt:10,lv:6,mas:3,mg:4,mk:16,ml:3,mn:3,mo:9,mr:3,ms:0,mt:15,my:0,nah:3,naq:7,nb:3,nd:3,ne:3,nl:3,nn:3,no:3,nr:3,nso:4,ny:3,nyn:3,om:3,or:3,pa:3,pap:3,pl:13,ps:3,pt:3,rm:3,ro:9,rof:3,ru:11,rwk:3,sah:0,saq:3,se:7,seh:3,ses:0,sg:0,sh:11,shi:19,sk:12,sl:14,sma:7,smi:7,smj:7,smn:7,sms:7,sn:3,so:3,sq:3,sr:11,ss:3,ssy:3,st:3,sv:3,sw:3,syr:3,ta:3,te:3,teo:3,th:0,ti:4,tig:3,tk:3,tl:4,tn:3,to:0,tr:0,ts:3,tzm:22,uk:11,ur:3,ve:3,vi:0,vun:3,wa:4,wae:3,wo:0,xh:3,xog:3,yo:0,zh:0,zu:3}[e.replace(/-.*$/,"")];return i in r?r[i]:(console.warn("plural form unknown for ["+e+"]"),function(){return"other"})}(a));var c="["+o._pluralRules(l)+"]";return 0===l&&n+"[zero]"in r?e=r[n+"[zero]"][i]:1==l&&n+"[one]"in r?e=r[n+"[one]"][i]:2==l&&n+"[two]"in r?e=r[n+"[two]"][i]:n+c in r?e=r[n+c][i]:n+"[other]"in r&&(e=r[n+"[other]"][i]),e},{get:function(e,t,n){var r,i=e.lastIndexOf("."),a=s;i>0&&(a=e.substring(i+1),e=e.substring(0,i)),n&&((r={})[a]=n);var o=h(e,t,r);return o&&a in o?o[a]:"{{"+e+"}}"},getData:function(){return r},getText:function(){return i},getLanguage:function(){return a},setLanguage:function(e,t){d(e,(function(){t&&t()}))},getDirection:function(){var e=a.split("-",1)[0];return["ar","he","fa","ps","ur"].indexOf(e)>=0?"rtl":"ltr"},translate:function(e){for(var n=function(e){return e?e.querySelectorAll("*[data-l10n-id]"):[]}(e=e||t.documentElement),r=n.length,i=0;i<r;i++)g(n[i]);g(e)},getReadyState:function(){return l},ready:function(n){n&&("complete"==l||"interactive"==l?e.setTimeout((function(){n()})):t.addEventListener&&t.addEventListener("localized",(function e(){t.removeEventListener("localized",e),n()})))}}}(window,document)},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFFindController=t.FindState=void 0;var r=n(7),i=n(3),s=n(23);const a={FOUND:0,NOT_FOUND:1,WRAPPED:2,PENDING:3};t.FindState=a;const o={"‐":"-","‘":"'","’":"'","‚":"'","‛":"'","“":'"',"”":'"',"„":'"',"‟":'"',"¼":"1/4","½":"1/2","¾":"3/4"},l=new Set([12441,12442,2381,2509,2637,2765,2893,3021,3149,3277,3387,3388,3405,3530,3642,3770,3972,4153,4154,5908,5940,6098,6752,6980,7082,7083,7154,7155,11647,43014,43052,43204,43347,43456,43766,44013,3158,3953,3954,3962,3963,3964,3965,3968,3956]),c=[...l.values()].map((e=>String.fromCharCode(e))).join(""),u=/\p{M}+/gu,d=/([.*+?^${}()|[\]\\])|(\p{P})|(\s+)|(\p{M})|(\p{L})/gu,h=/([^\p{M}])\p{M}*$/u,p=/^\p{M}*([^\p{M}])/u,f=/[\uAC00-\uD7AF\uFA6C\uFACF-\uFAD1\uFAD5-\uFAD7]+/g,g=new Map;let m=null,v=null;function y(e){const t=[];let n,r;for(;null!==(n=f.exec(e));){let{index:e}=n;for(const r of n[0]){let n=g.get(r);n||(n=r.normalize("NFD").length,g.set(r,n)),t.push([n,e++])}}if(0===t.length&&m)r=m;else if(t.length>0&&v)r=v;else{const e=`([${Object.keys(o).join("")}])|(\\p{M}+(?:-\\n)?)|(\\S-\\n)|(\\n)`;r=0===t.length?m=new RegExp(e+"|(\\u0000)","gum"):v=new RegExp(e+"|([\\u1100-\\u1112\\ud7a4-\\ud7af\\ud84a\\ud84c\\ud850\\ud854\\ud857\\ud85f])","gum")}const i=[];for(;null!==(n=u.exec(e));)i.push([n[0].length,n.index]);let s=e.normalize("NFD");const a=[[0,0]];let l=0,c=0,d=0,h=0,p=0,y=!1;return s=s.replace(r,((e,n,r,s,u,f,g)=>{if(g-=h,n){const t=o[e],n=t.length;for(let e=1;e<n;e++)a.push([g-d+e,d-e]);return d-=n-1,t}if(r){const e=r.endsWith("\n"),t=e?r.length-2:r.length;y=!0;let n=t;g+p===i[l]?.[1]&&(n-=i[l][0],++l);for(let e=1;e<=n;e++)a.push([g-1-d+e,d-e]);return d-=n,h+=n,e?(g+=t-1,a.push([g-d+1,1+d]),d+=1,h+=1,p+=1,r.slice(0,t)):r}if(s)return a.push([g-d+1,1+d]),d+=1,h+=1,p+=1,s.charAt(0);if(u)return a.push([g-d+1,d-1]),d-=1,h+=1,p+=1," ";if(g+p===t[c]?.[1]){const e=t[c][0]-1;++c;for(let t=1;t<=e;t++)a.push([g-(d-t),d-t]);d-=e,h+=e}return f})),a.push([s.length,d]),[s,a,y]}function b(e,t,n){if(!e)return[t,n];const i=t,s=t+n;let a=(0,r.binarySearchFirstItem)(e,(e=>e[0]>=i));e[a][0]>i&&--a;let o=(0,r.binarySearchFirstItem)(e,(e=>e[0]>=s),a);return e[o][0]>s&&--o,[i+e[a][1],n+e[o][1]-e[a][1]]}t.PDFFindController=class{constructor({linkService:e,eventBus:t}){this._linkService=e,this._eventBus=t,this.#zt(),t._on("find",this.#Gt.bind(this)),t._on("findbarclose",this.#Qt.bind(this))}get highlightMatches(){return this._highlightMatches}get pageMatches(){return this._pageMatches}get pageMatchesLength(){return this._pageMatchesLength}get selected(){return this._selected}get state(){return this._state}setDocument(e){this._pdfDocument&&this.#zt(),e&&(this._pdfDocument=e,this._firstPageCapability.resolve())}#Gt(e){if(!e)return;const t=this._pdfDocument,{type:n}=e;(null===this._state||this.#Xt(e))&&(this._dirtyMatch=!0),this._state=e,"highlightallchange"!==n&&this.#Kt(a.PENDING),this._firstPageCapability.promise.then((()=>{if(!this._pdfDocument||t&&this._pdfDocument!==t)return;this.#Re();const e=!this._highlightMatches,r=!!this._findTimeout;this._findTimeout&&(clearTimeout(this._findTimeout),this._findTimeout=null),n?this._dirtyMatch?this.#Yt():"again"===n?(this.#Yt(),e&&this._state.highlightAll&&this.#Jt()):"highlightallchange"===n?(r?this.#Yt():this._highlightMatches=!0,this.#Jt()):this.#Yt():this._findTimeout=setTimeout((()=>{this.#Yt(),this._findTimeout=null}),250)}))}scrollMatchIntoView({element:e=null,selectedLeft:t=0,pageIndex:n=-1,matchIndex:i=-1}){if(!this._scrollMatches||!e)return;if(-1===i||i!==this._selected.matchIdx)return;if(-1===n||n!==this._selected.pageIdx)return;this._scrollMatches=!1;const s={top:-50,left:t+-400};(0,r.scrollIntoView)(e,s,!0)}#zt(){this._highlightMatches=!1,this._scrollMatches=!1,this._pdfDocument=null,this._pageMatches=[],this._pageMatchesLength=[],this._state=null,this._selected={pageIdx:-1,matchIdx:-1},this._offset={pageIdx:null,matchIdx:null,wrapped:!1},this._extractTextPromises=[],this._pageContents=[],this._pageDiffs=[],this._hasDiacritics=[],this._matchesCountTotal=0,this._pagesToSearch=null,this._pendingFindMatches=new Set,this._resumePageIdx=null,this._dirtyMatch=!1,clearTimeout(this._findTimeout),this._findTimeout=null,this._firstPageCapability=(0,i.createPromiseCapability)()}get#Zt(){return this._state.query!==this._rawQuery&&(this._rawQuery=this._state.query,[this._normalizedQuery]=y(this._state.query)),this._normalizedQuery}#Xt(e){if(e.query!==this._state.query)return!0;switch(e.type){case"again":const e=this._selected.pageIdx+1,t=this._linkService;return e>=1&&e<=t.pagesCount&&e!==t.page&&!t.isPageVisible(e);case"highlightallchange":return!1}return!0}#en(e,t,n){let r=e.slice(0,t).match(h);if(r){const n=e.charCodeAt(t),i=r[1].charCodeAt(0);if((0,s.getCharacterType)(n)===(0,s.getCharacterType)(i))return!1}if(r=e.slice(t+n).match(p),r){const i=e.charCodeAt(t+n-1),a=r[1].charCodeAt(0);if((0,s.getCharacterType)(i)===(0,s.getCharacterType)(a))return!1}return!0}#tn(e,t,n,r){const i=[],s=[],a=this._pageDiffs[n];let o;for(;null!==(o=e.exec(r));){if(t&&!this.#en(r,o.index,o[0].length))continue;const[e,n]=b(a,o.index,o[0].length);n&&(i.push(e),s.push(n))}this._pageMatches[n]=i,this._pageMatchesLength[n]=s}#nn(e,t){const{matchDiacritics:n}=this._state;let r=!1;const i="[ ]*";return(e=e.replace(d,((e,i,s,a,o,c)=>i?`[ ]*\\${i}[ ]*`:s?`[ ]*${s}[ ]*`:a?"[ ]+":n?o||c:o?l.has(o.charCodeAt(0))?o:"":t?(r=!0,`${c}\\p{M}*`):c))).endsWith(i)&&(e=e.slice(0,e.length-i.length)),n&&t&&(r=!0,e=`${e}(?=[${c}]|[^\\p{M}]|$)`),[r,e]}#rn(e){let t=this.#Zt;if(0===t.length)return;const{caseSensitive:n,entireWord:r,phraseSearch:i}=this._state,s=this._pageContents[e],a=this._hasDiacritics[e];let o=!1;if(i)[o,t]=this.#nn(t,a);else{const e=t.match(/\S+/g);e&&(t=e.sort().reverse().map((e=>{const[t,n]=this.#nn(e,a);return o||=t,`(${n})`})).join("|"))}t=new RegExp(t,`g${o?"u":""}${n?"":"i"}`),this.#tn(t,r,e,s),this._state.highlightAll&&this.#in(e),this._resumePageIdx===e&&(this._resumePageIdx=null,this.#sn());const l=this._pageMatches[e].length;l>0&&(this._matchesCountTotal+=l,this.#an())}#Re(){if(this._extractTextPromises.length>0)return;let e=Promise.resolve();for(let t=0,n=this._linkService.pagesCount;t<n;t++){const n=(0,i.createPromiseCapability)();this._extractTextPromises[t]=n.promise,e=e.then((()=>this._pdfDocument.getPage(t+1).then((e=>e.getTextContent())).then((e=>{const r=[];for(const t of e.items)r.push(t.str),t.hasEOL&&r.push("\n");[this._pageContents[t],this._pageDiffs[t],this._hasDiacritics[t]]=y(r.join("")),n.resolve()}),(e=>{console.error(`Unable to get text content for page ${t+1}`,e),this._pageContents[t]="",this._pageDiffs[t]=null,this._hasDiacritics[t]=!1,n.resolve()}))))}}#in(e){this._scrollMatches&&this._selected.pageIdx===e&&(this._linkService.page=e+1),this._eventBus.dispatch("updatetextlayermatches",{source:this,pageIndex:e})}#Jt(){this._eventBus.dispatch("updatetextlayermatches",{source:this,pageIndex:-1})}#Yt(){const e=this._state.findPrevious,t=this._linkService.page-1,n=this._linkService.pagesCount;if(this._highlightMatches=!0,this._dirtyMatch){this._dirtyMatch=!1,this._selected.pageIdx=this._selected.matchIdx=-1,this._offset.pageIdx=t,this._offset.matchIdx=null,this._offset.wrapped=!1,this._resumePageIdx=null,this._pageMatches.length=0,this._pageMatchesLength.length=0,this._matchesCountTotal=0,this.#Jt();for(let e=0;e<n;e++)this._pendingFindMatches.has(e)||(this._pendingFindMatches.add(e),this._extractTextPromises[e].then((()=>{this._pendingFindMatches.delete(e),this.#rn(e)})))}if(""===this.#Zt)return void this.#Kt(a.FOUND);if(this._resumePageIdx)return;const r=this._offset;if(this._pagesToSearch=n,null!==r.matchIdx){const t=this._pageMatches[r.pageIdx].length;if(!e&&r.matchIdx+1<t||e&&r.matchIdx>0)return r.matchIdx=e?r.matchIdx-1:r.matchIdx+1,void this.#on(!0);this.#ln(e)}this.#sn()}#cn(e){const t=this._offset,n=e.length,r=this._state.findPrevious;return n?(t.matchIdx=r?n-1:0,this.#on(!0),!0):(this.#ln(r),!!(t.wrapped&&(t.matchIdx=null,this._pagesToSearch<0))&&(this.#on(!1),!0))}#sn(){null!==this._resumePageIdx&&console.error("There can only be one pending page.");let e=null;do{const t=this._offset.pageIdx;if(e=this._pageMatches[t],!e){this._resumePageIdx=t;break}}while(!this.#cn(e))}#ln(e){const t=this._offset,n=this._linkService.pagesCount;t.pageIdx=e?t.pageIdx-1:t.pageIdx+1,t.matchIdx=null,this._pagesToSearch--,(t.pageIdx>=n||t.pageIdx<0)&&(t.pageIdx=e?n-1:0,t.wrapped=!0)}#on(e=!1){let t=a.NOT_FOUND;const n=this._offset.wrapped;if(this._offset.wrapped=!1,e){const e=this._selected.pageIdx;this._selected.pageIdx=this._offset.pageIdx,this._selected.matchIdx=this._offset.matchIdx,t=n?a.WRAPPED:a.FOUND,-1!==e&&e!==this._selected.pageIdx&&this.#in(e)}this.#Kt(t,this._state.findPrevious),-1!==this._selected.pageIdx&&(this._scrollMatches=!0,this.#in(this._selected.pageIdx))}#Qt(e){const t=this._pdfDocument;this._firstPageCapability.promise.then((()=>{!this._pdfDocument||t&&this._pdfDocument!==t||(this._findTimeout&&(clearTimeout(this._findTimeout),this._findTimeout=null),this._resumePageIdx&&(this._resumePageIdx=null,this._dirtyMatch=!0),this.#Kt(a.FOUND),this._highlightMatches=!1,this.#Jt())}))}#un(){const{pageIdx:e,matchIdx:t}=this._selected;let n=0,r=this._matchesCountTotal;if(-1!==t){for(let t=0;t<e;t++)n+=this._pageMatches[t]?.length||0;n+=t+1}return(n<1||n>r)&&(n=r=0),{current:n,total:r}}#an(){this._eventBus.dispatch("updatefindmatchescount",{source:this,matchesCount:this.#un()})}#Kt(e,t=!1){this._eventBus.dispatch("updatefindcontrolstate",{source:this,state:e,previous:t,matchesCount:this.#un(),rawQuery:this._state?.query??null})}}},(e,t)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.CharacterType=void 0,t.getCharacterType=function(e){return function(e){return e<11904}(e)?function(e){return 0==(65408&e)}(e)?function(e){return 32===e||9===e||13===e||10===e}(e)?n.SPACE:function(e){return e>=97&&e<=122||e>=65&&e<=90}(e)||function(e){return e>=48&&e<=57}(e)||95===e?n.ALPHA_LETTER:n.PUNCT:function(e){return 3584==(65408&e)}(e)?n.THAI_LETTER:160===e?n.SPACE:n.ALPHA_LETTER:function(e){return e>=13312&&e<=40959||e>=63744&&e<=64255}(e)?n.HAN_LETTER:function(e){return e>=12448&&e<=12543}(e)?n.KATAKANA_LETTER:function(e){return e>=12352&&e<=12447}(e)?n.HIRAGANA_LETTER:function(e){return e>=65376&&e<=65439}(e)?n.HALFWIDTH_KATAKANA_LETTER:n.ALPHA_LETTER};const n={SPACE:0,ALPHA_LETTER:1,PUNCT:2,HAN_LETTER:3,KATAKANA_LETTER:4,HIRAGANA_LETTER:5,HALFWIDTH_KATAKANA_LETTER:6,THAI_LETTER:7};t.CharacterType=n},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFHistory=void 0,t.isDestArraysEqual=o,t.isDestHashesEqual=a;var r=n(7),i=n(19);function s(){return document.location.hash}function a(e,t){return"string"==typeof e&&"string"==typeof t&&(e===t||(0,r.parseQueryString)(e).get("nameddest")===t)}function o(e,t){function n(e,t){if(typeof e!=typeof t)return!1;if(Array.isArray(e)||Array.isArray(t))return!1;if(null!==e&&"object"==typeof e&&null!==t){if(Object.keys(e).length!==Object.keys(t).length)return!1;for(const r in e)if(!n(e[r],t[r]))return!1;return!0}return e===t||Number.isNaN(e)&&Number.isNaN(t)}if(!Array.isArray(e)||!Array.isArray(t))return!1;if(e.length!==t.length)return!1;for(let r=0,i=e.length;r<i;r++)if(!n(e[r],t[r]))return!1;return!0}t.PDFHistory=class{constructor({linkService:e,eventBus:t}){this.linkService=e,this.eventBus=t,this._initialized=!1,this._fingerprint="",this.reset(),this._boundEvents=null,this.eventBus._on("pagesinit",(()=>{this._isPagesLoaded=!1,this.eventBus._on("pagesloaded",(e=>{this._isPagesLoaded=!!e.pagesCount}),{once:!0})}))}initialize({fingerprint:e,resetHistory:t=!1,updateUrl:n=!1}){if(!e||"string"!=typeof e)return void console.error('PDFHistory.initialize: The "fingerprint" must be a non-empty string.');this._initialized&&this.reset();const r=""!==this._fingerprint&&this._fingerprint!==e;this._fingerprint=e,this._updateUrl=!0===n,this._initialized=!0,this._bindEvents();const i=window.history.state;if(this._popStateInProgress=!1,this._blockHashChange=0,this._currentHash=s(),this._numPositionUpdates=0,this._uid=this._maxUid=0,this._destination=null,this._position=null,!this._isValidState(i,!0)||t){const{hash:e,page:n,rotation:i}=this._parseCurrentHash(!0);return!e||r||t?void this._pushOrReplaceState(null,!0):void this._pushOrReplaceState({hash:e,page:n,rotation:i},!0)}const a=i.destination;this._updateInternalState(a,i.uid,!0),void 0!==a.rotation&&(this._initialRotation=a.rotation),a.dest?(this._initialBookmark=JSON.stringify(a.dest),this._destination.page=null):a.hash?this._initialBookmark=a.hash:a.page&&(this._initialBookmark=`page=${a.page}`)}reset(){this._initialized&&(this._pageHide(),this._initialized=!1,this._unbindEvents()),this._updateViewareaTimeout&&(clearTimeout(this._updateViewareaTimeout),this._updateViewareaTimeout=null),this._initialBookmark=null,this._initialRotation=null}push({namedDest:e=null,explicitDest:t,pageNumber:n}){if(!this._initialized)return;if(e&&"string"!=typeof e)return void console.error(`PDFHistory.push: "${e}" is not a valid namedDest parameter.`);if(!Array.isArray(t))return void console.error(`PDFHistory.push: "${t}" is not a valid explicitDest parameter.`);if(!this._isValidPage(n)&&(null!==n||this._destination))return void console.error(`PDFHistory.push: "${n}" is not a valid pageNumber parameter.`);const r=e||JSON.stringify(t);if(!r)return;let i=!1;if(this._destination&&(a(this._destination.hash,r)||o(this._destination.dest,t))){if(this._destination.page)return;i=!0}this._popStateInProgress&&!i||(this._pushOrReplaceState({dest:t,hash:r,page:n,rotation:this.linkService.rotation},i),this._popStateInProgress||(this._popStateInProgress=!0,Promise.resolve().then((()=>{this._popStateInProgress=!1}))))}pushPage(e){this._initialized&&(this._isValidPage(e)?this._destination?.page!==e&&(this._popStateInProgress||(this._pushOrReplaceState({dest:null,hash:`page=${e}`,page:e,rotation:this.linkService.rotation}),this._popStateInProgress||(this._popStateInProgress=!0,Promise.resolve().then((()=>{this._popStateInProgress=!1}))))):console.error(`PDFHistory.pushPage: "${e}" is not a valid page number.`))}pushCurrentPosition(){this._initialized&&!this._popStateInProgress&&this._tryPushCurrentPosition()}back(){if(!this._initialized||this._popStateInProgress)return;const e=window.history.state;this._isValidState(e)&&e.uid>0&&window.history.back()}forward(){if(!this._initialized||this._popStateInProgress)return;const e=window.history.state;this._isValidState(e)&&e.uid<this._maxUid&&window.history.forward()}get popStateInProgress(){return this._initialized&&(this._popStateInProgress||this._blockHashChange>0)}get initialBookmark(){return this._initialized?this._initialBookmark:null}get initialRotation(){return this._initialized?this._initialRotation:null}_pushOrReplaceState(e,t=!1){const n=t||!this._destination,r={fingerprint:this._fingerprint,uid:n?this._uid:this._uid+1,destination:e};let i;if(this._updateInternalState(e,r.uid),this._updateUrl&&e?.hash){const t=document.location.href.split("#")[0];t.startsWith("file://")||(i=`${t}#${e.hash}`)}n?window.history.replaceState(r,"",i):window.history.pushState(r,"",i)}_tryPushCurrentPosition(e=!1){if(!this._position)return;let t=this._position;if(e&&(t=Object.assign(Object.create(null),this._position),t.temporary=!0),!this._destination)return void this._pushOrReplaceState(t);if(this._destination.temporary)return void this._pushOrReplaceState(t,!0);if(this._destination.hash===t.hash)return;if(!this._destination.page&&this._numPositionUpdates<=50)return;let n=!1;if(this._destination.page>=t.first&&this._destination.page<=t.page){if(void 0!==this._destination.dest||!this._destination.first)return;n=!0}this._pushOrReplaceState(t,n)}_isValidPage(e){return Number.isInteger(e)&&e>0&&e<=this.linkService.pagesCount}_isValidState(e,t=!1){if(!e)return!1;if(e.fingerprint!==this._fingerprint){if(!t)return!1;{if("string"!=typeof e.fingerprint||e.fingerprint.length!==this._fingerprint.length)return!1;const[t]=performance.getEntriesByType("navigation");if("reload"!==t?.type)return!1}}return!(!Number.isInteger(e.uid)||e.uid<0)&&null!==e.destination&&"object"==typeof e.destination}_updateInternalState(e,t,n=!1){this._updateViewareaTimeout&&(clearTimeout(this._updateViewareaTimeout),this._updateViewareaTimeout=null),n&&e?.temporary&&delete e.temporary,this._destination=e,this._uid=t,this._maxUid=Math.max(this._maxUid,t),this._numPositionUpdates=0}_parseCurrentHash(e=!1){const t=unescape(s()).substring(1),n=(0,r.parseQueryString)(t),i=n.get("nameddest")||"";let a=0|n.get("page");return(!this._isValidPage(a)||e&&i.length>0)&&(a=null),{hash:t,page:a,rotation:this.linkService.rotation}}_updateViewarea({location:e}){this._updateViewareaTimeout&&(clearTimeout(this._updateViewareaTimeout),this._updateViewareaTimeout=null),this._position={hash:e.pdfOpenParams.substring(1),page:this.linkService.page,first:e.pageNumber,rotation:e.rotation},this._popStateInProgress||(this._isPagesLoaded&&this._destination&&!this._destination.page&&this._numPositionUpdates++,this._updateViewareaTimeout=setTimeout((()=>{this._popStateInProgress||this._tryPushCurrentPosition(!0),this._updateViewareaTimeout=null}),1e3))}_popState({state:e}){const t=s(),n=this._currentHash!==t;if(this._currentHash=t,!e){this._uid++;const{hash:e,page:t,rotation:n}=this._parseCurrentHash();return void this._pushOrReplaceState({hash:e,page:t,rotation:n},!0)}if(!this._isValidState(e))return;this._popStateInProgress=!0,n&&(this._blockHashChange++,(0,i.waitOnEventOrTimeout)({target:window,name:"hashchange",delay:1e3}).then((()=>{this._blockHashChange--})));const a=e.destination;this._updateInternalState(a,e.uid,!0),(0,r.isValidRotation)(a.rotation)&&(this.linkService.rotation=a.rotation),a.dest?this.linkService.goToDestination(a.dest):a.hash?this.linkService.setHash(a.hash):a.page&&(this.linkService.page=a.page),Promise.resolve().then((()=>{this._popStateInProgress=!1}))}_pageHide(){this._destination&&!this._destination.temporary||this._tryPushCurrentPosition()}_bindEvents(){this._boundEvents||(this._boundEvents={updateViewarea:this._updateViewarea.bind(this),popState:this._popState.bind(this),pageHide:this._pageHide.bind(this)},this.eventBus._on("updateviewarea",this._boundEvents.updateViewarea),window.addEventListener("popstate",this._boundEvents.popState),window.addEventListener("pagehide",this._boundEvents.pageHide))}_unbindEvents(){this._boundEvents&&(this.eventBus._off("updateviewarea",this._boundEvents.updateViewarea),window.removeEventListener("popstate",this._boundEvents.popState),window.removeEventListener("pagehide",this._boundEvents.pageHide),this._boundEvents=null)}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.PDFScriptingManager=void 0;var r=n(7),i=n(3);t.PDFScriptingManager=class{constructor({eventBus:e,sandboxBundleSrc:t=null,scriptingFactory:n=null,docPropertiesLookup:r=null}){this._pdfDocument=null,this._pdfViewer=null,this._closeCapability=null,this._destroyCapability=null,this._scripting=null,this._mouseState=Object.create(null),this._ready=!1,this._eventBus=e,this._sandboxBundleSrc=t,this._scriptingFactory=n,this._docPropertiesLookup=r,this._scriptingFactory||window.addEventListener("updatefromsandbox",(e=>{this._eventBus.dispatch("updatefromsandbox",{source:window,detail:e.detail})}))}setViewer(e){this._pdfViewer=e}async setDocument(e){if(this._pdfDocument&&await this._destroyScripting(),this._pdfDocument=e,!e)return;const[t,n,r]=await Promise.all([e.getFieldObjects(),e.getCalculationOrderIds(),e.getJSActions()]);if(t||r){if(e===this._pdfDocument){try{this._scripting=this._createScripting()}catch(e){return console.error(`PDFScriptingManager.setDocument: "${e?.message}".`),void await this._destroyScripting()}this._internalEvents.set("updatefromsandbox",(e=>{e?.source===window&&this._updateFromSandbox(e.detail)})),this._internalEvents.set("dispatcheventinsandbox",(e=>{this._scripting?.dispatchEventInSandbox(e.detail)})),this._internalEvents.set("pagechanging",(({pageNumber:e,previous:t})=>{e!==t&&(this._dispatchPageClose(t),this._dispatchPageOpen(e))})),this._internalEvents.set("pagerendered",(({pageNumber:e})=>{this._pageOpenPending.has(e)&&e===this._pdfViewer.currentPageNumber&&this._dispatchPageOpen(e)})),this._internalEvents.set("pagesdestroy",(async e=>{await this._dispatchPageClose(this._pdfViewer.currentPageNumber),await(this._scripting?.dispatchEventInSandbox({id:"doc",name:"WillClose"})),this._closeCapability?.resolve()})),this._domEvents.set("mousedown",(e=>{this._mouseState.isDown=!0})),this._domEvents.set("mouseup",(e=>{this._mouseState.isDown=!1}));for(const[e,t]of this._internalEvents)this._eventBus._on(e,t);for(const[e,t]of this._domEvents)window.addEventListener(e,t,!0);try{const i=await this._getDocProperties();if(e!==this._pdfDocument)return;await this._scripting.createSandbox({objects:t,calculationOrder:n,appInfo:{platform:navigator.platform,language:navigator.language},docInfo:{...i,actions:r}}),this._eventBus.dispatch("sandboxcreated",{source:this})}catch(e){return console.error(`PDFScriptingManager.setDocument: "${e?.message}".`),void await this._destroyScripting()}await(this._scripting?.dispatchEventInSandbox({id:"doc",name:"Open"})),await this._dispatchPageOpen(this._pdfViewer.currentPageNumber,!0),Promise.resolve().then((()=>{e===this._pdfDocument&&(this._ready=!0)}))}}else await this._destroyScripting()}async dispatchWillSave(e){return this._scripting?.dispatchEventInSandbox({id:"doc",name:"WillSave"})}async dispatchDidSave(e){return this._scripting?.dispatchEventInSandbox({id:"doc",name:"DidSave"})}async dispatchWillPrint(e){return this._scripting?.dispatchEventInSandbox({id:"doc",name:"WillPrint"})}async dispatchDidPrint(e){return this._scripting?.dispatchEventInSandbox({id:"doc",name:"DidPrint"})}get mouseState(){return this._mouseState}get destroyPromise(){return this._destroyCapability?.promise||null}get ready(){return this._ready}get _internalEvents(){return(0,i.shadow)(this,"_internalEvents",new Map)}get _domEvents(){return(0,i.shadow)(this,"_domEvents",new Map)}get _pageOpenPending(){return(0,i.shadow)(this,"_pageOpenPending",new Set)}get _visitedPages(){return(0,i.shadow)(this,"_visitedPages",new Map)}async _updateFromSandbox(e){const t=this._pdfViewer.isInPresentationMode||this._pdfViewer.isChangingPresentationMode,{id:n,siblings:i,command:s,value:a}=e;if(!n){switch(s){case"clear":console.clear();break;case"error":console.error(a);break;case"layout":if(t)return;const e=(0,r.apiPageLayoutToViewerModes)(a);this._pdfViewer.spreadMode=e.spreadMode;break;case"page-num":this._pdfViewer.currentPageNumber=a+1;break;case"print":await this._pdfViewer.pagesPromise,this._eventBus.dispatch("print",{source:this});break;case"println":console.log(a);break;case"zoom":if(t)return;this._pdfViewer.currentScaleValue=a;break;case"SaveAs":this._eventBus.dispatch("download",{source:this});break;case"FirstPage":this._pdfViewer.currentPageNumber=1;break;case"LastPage":this._pdfViewer.currentPageNumber=this._pdfViewer.pagesCount;break;case"NextPage":this._pdfViewer.nextPage();break;case"PrevPage":this._pdfViewer.previousPage();break;case"ZoomViewIn":if(t)return;this._pdfViewer.increaseScale();break;case"ZoomViewOut":if(t)return;this._pdfViewer.decreaseScale()}return}if(t&&e.focus)return;delete e.id,delete e.siblings;const o=i?[n,...i]:[n];for(const t of o){const n=document.querySelector(`[data-element-id="${t}"]`);n?n.dispatchEvent(new CustomEvent("updatefromsandbox",{detail:e})):this._pdfDocument?.annotationStorage.setValue(t,e)}}async _dispatchPageOpen(e,t=!1){const n=this._pdfDocument,s=this._visitedPages;if(t&&(this._closeCapability=(0,i.createPromiseCapability)()),!this._closeCapability)return;const a=this._pdfViewer.getPageView(e-1);if(a?.renderingState!==r.RenderingStates.FINISHED)return void this._pageOpenPending.add(e);this._pageOpenPending.delete(e);const o=(async()=>{const t=await(s.has(e)?null:a.pdfPage?.getJSActions());n===this._pdfDocument&&await(this._scripting?.dispatchEventInSandbox({id:"page",name:"PageOpen",pageNumber:e,actions:t}))})();s.set(e,o)}async _dispatchPageClose(e){const t=this._pdfDocument,n=this._visitedPages;if(!this._closeCapability)return;if(this._pageOpenPending.has(e))return;const r=n.get(e);r&&(n.set(e,null),await r,t===this._pdfDocument&&await(this._scripting?.dispatchEventInSandbox({id:"page",name:"PageClose",pageNumber:e})))}async _getDocProperties(){if(this._docPropertiesLookup)return this._docPropertiesLookup(this._pdfDocument);const{docPropertiesLookup:e}=n(26);return e(this._pdfDocument)}_createScripting(){if(this._destroyCapability=(0,i.createPromiseCapability)(),this._scripting)throw new Error("_createScripting: Scripting already exists.");if(this._scriptingFactory)return this._scriptingFactory.createScripting({sandboxBundleSrc:this._sandboxBundleSrc});const{GenericScripting:e}=n(26);return new e(this._sandboxBundleSrc)}async _destroyScripting(){if(!this._scripting)return this._pdfDocument=null,void this._destroyCapability?.resolve();this._closeCapability&&(await Promise.race([this._closeCapability.promise,new Promise((e=>{setTimeout(e,1e3)}))]).catch((e=>{})),this._closeCapability=null),this._pdfDocument=null;try{await this._scripting.destroySandbox()}catch(e){}for(const[e,t]of this._internalEvents)this._eventBus._off(e,t);this._internalEvents.clear();for(const[e,t]of this._domEvents)window.removeEventListener(e,t,!0);this._domEvents.clear(),this._pageOpenPending.clear(),this._visitedPages.clear(),this._scripting=null,delete this._mouseState.isDown,this._ready=!1,this._destroyCapability?.resolve()}}},(e,t,n)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.GenericScripting=void 0,t.docPropertiesLookup=async function(e){const t="".split("#")[0];let{info:n,metadata:i,contentDispositionFilename:s,contentLength:a}=await e.getMetadata();if(!a){const{length:t}=await e.getDownloadInfo();a=t}return{...n,baseURL:t,filesize:a,filename:s||(0,r.getPdfFilenameFromUrl)(""),metadata:i?.getRaw(),authors:i?.get("dc:creator"),numPages:e.numPages,URL:""}};var r=n(3);t.GenericScripting=class{constructor(e){this._ready=(0,r.loadScript)(e,!0).then((()=>window.pdfjsSandbox.QuickJSSandbox()))}async createSandbox(e){(await this._ready).create(e)}async dispatchEventInSandbox(e){const t=await this._ready;setTimeout((()=>t.dispatchEvent(e)),0)}async destroySandbox(){(await this._ready).nukeSandbox()}}}],t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var s=t[r]={exports:{}};return e[r](s,s.exports,n),s.exports}var r={};return(()=>{var e=r;Object.defineProperty(e,"__esModule",{value:!0}),Object.defineProperty(e,"AnnotationLayerBuilder",{enumerable:!0,get:function(){return o.AnnotationLayerBuilder}}),Object.defineProperty(e,"DefaultAnnotationLayerFactory",{enumerable:!0,get:function(){return t.DefaultAnnotationLayerFactory}}),Object.defineProperty(e,"DefaultStructTreeLayerFactory",{enumerable:!0,get:function(){return t.DefaultStructTreeLayerFactory}}),Object.defineProperty(e,"DefaultTextLayerFactory",{enumerable:!0,get:function(){return t.DefaultTextLayerFactory}}),Object.defineProperty(e,"DefaultXfaLayerFactory",{enumerable:!0,get:function(){return t.DefaultXfaLayerFactory}}),Object.defineProperty(e,"DownloadManager",{enumerable:!0,get:function(){return l.DownloadManager}}),Object.defineProperty(e,"EventBus",{enumerable:!0,get:function(){return c.EventBus}}),Object.defineProperty(e,"GenericL10n",{enumerable:!0,get:function(){return u.GenericL10n}}),Object.defineProperty(e,"LinkTarget",{enumerable:!0,get:function(){return i.LinkTarget}}),Object.defineProperty(e,"NullL10n",{enumerable:!0,get:function(){return d.NullL10n}}),Object.defineProperty(e,"PDFFindController",{enumerable:!0,get:function(){return h.PDFFindController}}),Object.defineProperty(e,"PDFHistory",{enumerable:!0,get:function(){return p.PDFHistory}}),Object.defineProperty(e,"PDFLinkService",{enumerable:!0,get:function(){return i.PDFLinkService}}),Object.defineProperty(e,"PDFPageView",{enumerable:!0,get:function(){return f.PDFPageView}}),Object.defineProperty(e,"PDFScriptingManager",{enumerable:!0,get:function(){return g.PDFScriptingManager}}),Object.defineProperty(e,"PDFSinglePageViewer",{enumerable:!0,get:function(){return a.PDFSinglePageViewer}}),Object.defineProperty(e,"PDFViewer",{enumerable:!0,get:function(){return a.PDFViewer}}),Object.defineProperty(e,"ProgressBar",{enumerable:!0,get:function(){return s.ProgressBar}}),Object.defineProperty(e,"RenderingStates",{enumerable:!0,get:function(){return s.RenderingStates}}),Object.defineProperty(e,"ScrollMode",{enumerable:!0,get:function(){return s.ScrollMode}}),Object.defineProperty(e,"SimpleLinkService",{enumerable:!0,get:function(){return i.SimpleLinkService}}),Object.defineProperty(e,"SpreadMode",{enumerable:!0,get:function(){return s.SpreadMode}}),Object.defineProperty(e,"StructTreeLayerBuilder",{enumerable:!0,get:function(){return m.StructTreeLayerBuilder}}),Object.defineProperty(e,"TextLayerBuilder",{enumerable:!0,get:function(){return v.TextLayerBuilder}}),Object.defineProperty(e,"XfaLayerBuilder",{enumerable:!0,get:function(){return y.XfaLayerBuilder}}),Object.defineProperty(e,"parseQueryString",{enumerable:!0,get:function(){return s.parseQueryString}});var t=n(1),i=n(6),s=n(7),a=n(11),o=n(5),l=n(18),c=n(19),u=n(20),d=n(4),h=n(22),p=n(24),f=n(13),g=n(25),m=n(8),v=n(9),y=n(10)})(),r})(),pdf_viewer.exports=factory();const PdfViewer=({src:e,pdfCMapsUrl:t,pdfWorkerUrl:n})=>{const r=React.useRef(null),i=React.useRef(null),s=React.useRef(null),[a,o]=React.useState((()=>new pdf_viewer.exports.EventBus)),[l,c]=React.useState((()=>new pdf_viewer.exports.PDFLinkService({eventBus:a}))),[u,d]=React.useState((()=>new pdf_viewer.exports.PDFFindController({eventBus:a,linkService:l}))),[h,p]=React.useState(),f=t||"",g=n||"";pdfExports.GlobalWorkerOptions.workerSrc=g;const[m,v]=React.useState(),y=React.useCallback((e=>{v(e)}),[]);function b(e){h&&(h.currentScaleValue="number"==typeof e?e.toFixed(2):e)}function _(e){h&&(h.currentPageNumber=e)}function w(e){e.target.setSelectionRange(0,e.target.value.length)}return React.useEffect((()=>{let e=h;if(m)return!h&&a&&(e=new pdf_viewer.exports.PDFViewer({container:m,eventBus:a,linkService:l,findController:u}),l.setViewer(e),p(e),a.on("scalechanging",(function(){s.current.value=Math.round(100*e.currentScale).toFixed(0)+"%"})),a.on("pagechanging",(function(){r.current&&(r.current.value=e.currentPageNumber.toFixed(0))})),a.on("pagesinit",(function(){e.currentScaleValue="auto",r.current.value="1",i.current.innerText=e.pagesCount.toFixed(0)}))),()=>{e&&(e.cleanup(),p(null))}}),[m]),React.useEffect((()=>{if(e&&h){let t=pdfExports.getDocument({url:e,enableXfa:true,cMapUrl:f,cMapPacked:true});return t.promise.then((e=>{h.setDocument(e),l.setDocument(e,null)})),()=>{t&&(t.destroy(),h.setDocument(null),l.setDocument(null,null))}}}),[e,h]),React.createElement("div",{className:"wy-content-pdf","data-controller":"pdf","data-pdf-url-value":""},React.createElement("div",{className:"wy-toolbars-bottom"},React.createElement("nav",{className:"wy-toolbar wy-toolbar-center"},React.createElement("div",{className:"wy-toolbar-buttons"},React.createElement("input",{type:"text",className:"wy-input",ref:r,onChange:function(){if(h&&r.current){let e=parseInt(r.current.value);isNaN(e)?_(h.currentPageNumber):e>h.pagesCount?_(h.pagesCount):_(e<=0?1:e)}},onClick:w,"data-pdf-target":"pageNumber"}),React.createElement("span",null,"/"),React.createElement("span",{ref:i},"1")),React.createElement("div",{className:"wy-toolbar-buttons"},React.createElement("button",{className:"wy-button wy-button-icon btn-zoom-out",onClick:function(){if(h){let e=h.currentScale,t=1;do{e/=1.1,e=Math.floor(10*e)/10,e=Math.max(.2,e)}while(--t>0&&e>.2);b(e)}},title:"Zoom out"},React.createElement(UIIcon.UI,{name:"minus"})),React.createElement("input",{type:"text",className:"wy-input",ref:s,onChange:function(){if(h&&s.current){let e=parseFloat(s.current.value.replace("%",""));isNaN(e)?b(h.currentScale+1e-4):b(e/100)}},onClick:w,value:"100%","data-pdf-target":"zoomLevel"}),React.createElement("button",{className:"wy-button wy-button-icon btn-zoom-in",onClick:function(){if(console.debug("zoomIn"),h){let e=h.currentScale,t=1;do{e*=1.1,e=Math.floor(10*e)/10,e=Math.min(3,e)}while(--t>0&&e<3);b(e)}},title:"Zoom in"},React.createElement(UIIcon.UI,{name:"plus"}))),React.createElement("div",{className:"wy-toolbar-buttons"},React.createElement("button",{className:"wy-button wy-button-icon btn-fit-page",onClick:function(){b("page-width")},title:"Fit to width"},React.createElement(UIIcon.UI,{name:"fit-width"})),React.createElement("button",{className:"wy-button wy-button-icon",onClick:function(){b("page-fit")},title:"Fit to screen"},React.createElement(UIIcon.UI,{name:"fit-screen"}))))),React.createElement("div",{ref:y,className:"wy-pdf-container"},React.createElement("div",{id:"viewer",className:"pdfViewer"})))};function checkImageLoad(e){e.complete&&0!==e.naturalHeight?e.classList.contains("wy-loading")?e.decode().then((()=>{console.debug("image is loaded after delay"),e.classList.add("wy-loaded")})):(console.debug("image is instantly loaded"),e.classList.add("wy-loading","wy-loaded")):(console.debug("image is loading"),e.classList.add("wy-loading"))}function imageLoaded(e){var t=e.target;"IMG"===t.tagName&&t.classList.contains("wy-loading")&&!t.classList.contains("wy-loaded")&&(console.debug("load event"),t.classList.add("wy-loaded"))}const Image=({src:e,previewSrc:t,width:n,height:r,more:i,onClick:s})=>{let a=n/r,o=a.toPrecision(5),l=(64*a).toPrecision(5)+"px",c=(100/a).toPrecision(5)+"%",u=n+"px",d=2*n+"px";const h=React.useCallback((e=>{e&&checkImageLoad(e)}),[]);return React.createElement("a",{href:e,className:"wy-image",onClick:e=>s(e),style:{flexBasis:l,flexGrow:o,flexShrink:o,width:u,maxWidth:d}},React.createElement("div",{className:"wy-image-area",style:{paddingBottom:c}},React.createElement("img",{ref:h,src:t,onLoad:imageLoaded,alt:"",loading:"lazy",decoding:"async"}),!!i&&React.createElement("span",{className:"wy-more"},"+",i)))},ImageGrid=({children:e,limit:t=3})=>{let n=React.Children.toArray(e),r=n.length>t?n.length-t:0,i=n.slice(0,t),s=i[i.length-1];if(React.isValidElement(s)){let e={more:r};i[i.length-1]=React.cloneElement(s,e)}return React.createElement("div",{className:"wy-image-grid"},i)},getStream=e=>{if(e&&e.ok&&e.body){const t=e.body.getReader();return new ReadableStream({start(e){let n=()=>t.read().then((({done:t,value:r})=>{if(!t)return e.enqueue(r),n();e.close()}));return n()}})}},PreviewImage=({src:e,width:t,height:n})=>{const r=React.useCallback((e=>{e&&checkImageLoad(e)}),[]);return React.createElement(React.Fragment,null,t&&n?React.createElement("div",{className:"wy-content-image wy-responsive-image",style:{"--width":t,"--height":n}},React.createElement("img",{className:"wy-loading-transition",ref:r,src:e,onLoad:imageLoaded,width:t,height:n,decoding:"async"}),React.createElement(UISpinner.UI,null)):React.createElement("div",{className:"wy-content-image wy-responsive-image wy-intrinsic-image"},React.createElement("img",{ref:r,src:e,onLoad:imageLoaded,decoding:"async"})))},PreviewDocument=({src:e,client:t})=>{let n=new URL("/js/preview.worker.js",t.url).toString(),r=new URL("/js/cmaps/",t.url).toString();return React.createElement(PdfViewer,{src:e,pdfWorkerUrl:n,pdfCMapsUrl:r})};function mediaFallback(e){e.classList.contains("wy-loading")&&e.classList.add("wy-loaded"),e.classList.add("wy-error"),e.outerHTML=e.outerHTML.replace(/<(video|audio)/,"<div").replace(/(video|audio)>/,"div>")}function mediaLoaded(e){var t=e.target;"VIDEO"!==t.tagName&&"AUDIO"!==t.tagName||t.classList.contains("wy-loading")&&(console.log("loaded"),t.classList.add("wy-loaded"))}function mediaError(e){var t,n=e.target;"SOURCE"===n.tagName&&((t=n.parentNode).dataset.errors=(t.dataset.errors||0)+1,t.querySelectorAll("source").length>=t.dataset.errors&&(console.warn(t.tagName.toLowerCase()+" source error, switching to fallback"),mediaFallback(t)))}function codecError(e){var t=e.target;"VIDEO"!==t.tagName&&"AUDIO"!==t.tagName||("VIDEO"===t.tagName&&!t.videoWidth||"AUDIO"===t.tagName&&!t.duration)&&(console.warn(t.tagName.toLowerCase()+" track not available, switching to fallback"),mediaFallback(t))}const PreviewMedia=({format:e,src:t,name:n,mediaType:r})=>{const[i,s]=React.useState(),a=React.useCallback((e=>{e&&(e.classList.add("wy-loading"),s(e))}),[]);return React.useEffect((()=>{if(i)return i.addEventListener("error",mediaError,!0),i.addEventListener("loadedmetadata",mediaLoaded,!0),i.addEventListener("loadedmetadata",codecError,!0),()=>{i.pause(),i.removeAttribute("autoplay"),i.setAttribute("preload","none"),i.removeEventListener("error",mediaError,!0),i.removeEventListener("loadedmetadata",mediaLoaded,!0),i.removeEventListener("loadedmetadata",codecError,!0)}}),[i]),"video"===e?React.createElement(React.Fragment,null,React.createElement("video",{ref:a,className:"wy-content-video",controls:!0,crossOrigin:"use-credentials",autoPlay:!0},React.createElement("source",{src:t,type:r}),React.createElement(PreviewIcon,{src:t,name:n,icon:"file-video",download:!0})),React.createElement(UISpinner.UI,null)):React.createElement(React.Fragment,null,React.createElement(PreviewIcon,{src:t,name:n,icon:"file-music",download:!0},React.createElement("audio",{ref:a,className:"wy-content-audio",controls:!0,crossOrigin:"use-credentials",autoPlay:!0},React.createElement("source",{src:t,type:r}))))},PreviewText=({src:e,html:t=!1,code:n=!1})=>{const[r,i]=React.useState("");return React.useEffect((()=>{fetch(e).then(getStream).then((e=>new Response(e))).then((e=>e.text())).then((e=>{i(e)}))}),[e]),React.createElement(React.Fragment,null,t?n?React.createElement("div",{className:"wy-content-code wy-code",dangerouslySetInnerHTML:{__html:r}}):React.createElement("div",{className:"wy-document wy-light"},React.createElement("div",{className:"wy-content-html",dangerouslySetInnerHTML:{__html:r}})):n?React.createElement("div",{className:"wy-content-code"},r):React.createElement("div",{className:"wy-document wy-light"},React.createElement("pre",{className:"wy-content-text"},r)))},PreviewEmbed=({src:e,name:t,icon:n,provider:r})=>{const[i,s]=React.useState(),a=React.useCallback((e=>{e&&(e.classList.add("wy-loading"),s(e))}),[]);return React.useEffect((()=>{if(i){let e=setTimeout((function(){console.log("fallback"),i.classList.add("wy-fallback")}),2500),t=t=>{var n=t.target;"OBJECT"===n.tagName&&n.classList.contains("wy-loading")&&!n.classList.contains("wy-loaded")&&(console.log("loaded"),n.classList.add("wy-loaded"),clearTimeout(e))};return i.addEventListener("load",t,!0),()=>{i.removeEventListener("load",t,!0),clearTimeout(e)}}}),[i]),React.createElement(React.Fragment,null,React.createElement("object",{ref:a,className:"wy-content-iframe",data:e}),React.createElement(UISpinner.UI,null),React.createElement(PreviewIcon,{src:e,name:t,icon:n,provider:r,className:"wy-content-iframe-fallback"}))},PreviewIcon=({children:e,src:t,icon:n,name:r,provider:i,download:s=!1,className:a})=>React.createElement("div",{className:classNames("wy-content-icon",a)},React.createElement("div",{className:"wy-content-icon"},React.createElement(UIIcon.UI,{name:n})),React.createElement("div",{className:"wy-content-name"},i?React.createElement(React.Fragment,null,React.createElement("span",null,"No preview available. "),React.createElement("a",{href:t,target:"_blank",title:r},`Open in ${i}?`)):s?React.createElement("a",{href:t,target:"_top",download:!0},r):React.createElement("a",{href:t,target:"_blank"},r," ",React.createElement(UIIcon.UI,{name:"open-in-new",size:1}))),e),Preview=({client:e,src:t,link:n,format:r,name:i,icon:s,width:a,height:o,mediaType:l,provider:c})=>React.createElement(React.Fragment,null,"image"===r&&React.createElement(PreviewImage,{key:t,src:t,width:a,height:o}),"pdf"===r&&React.createElement(PreviewDocument,{src:t,client:e}),("video"===r||"audio"===r)&&React.createElement(PreviewMedia,{key:t,format:r,src:t,name:i,mediaType:l}),"text"===r&&React.createElement(PreviewText,{key:t,src:t}),"code"===r&&React.createElement(PreviewText,{key:t,src:t,html:!0,code:!0}),"html"===r&&React.createElement(PreviewText,{key:t,src:t,html:!0}),"embed"===r&&React.createElement(PreviewEmbed,{key:t,src:t,name:i,icon:s,provider:c}),"none"===r&&(n?React.createElement(PreviewIcon,{src:t,name:i,icon:s,provider:c}):React.createElement(PreviewIcon,{src:t,name:i,icon:s,download:!0}))),fileSizeAsString=e=>{for(var t=e,n=[" B"," KB"," MB"," GB"," TB"," PB"," EB"," ZB"," YB"],r=0;r<n.length-1&&t>=1024;)t=100*t/1024/100,r++;return t.toLocaleString()+n[r]};function getExtension(e){return e.substring(e.lastIndexOf("."),e.length)||e}function isAudio(e){switch(e){case".aac":case".aif":case".aiff":case".au":case".gsm":case".m4a":case".mid":case".midi":case".mka":case".mp3":case".oga":case".ogg":case".ra":case".ram":case".snd":case".spx":case".wav":case".wma":return!0;default:return!1}}function isImage(e){switch(e){case".ai":case".apng":case".bmp":case".emf":case".eps":case".gif":case".heic":case".ico":case".jpg":case".jpeg":case".png":case".psd":case".svg":case".tif":case".tiff":case".webp":case".wmf":return!0;default:return!1}}function isVideo(e){switch(e){case".3g2":case".asx":case".asf":case".avi":case".flv":case".mk3d":case".mkv":case".mov":case".mp4":case".mpeg":case".mpg":case".ogm":case".ogv":case".ogx":case".qt":case".rm":case".rv":case".smi":case".smil":case".swf":case".webm":case".wmv":case".xaml":return!0;default:return!1}}function isMarkdown(e){switch(e){case".markdown":case".md":return!0;default:return!1}}function isMarkup(e){switch(e){case".htm":case".html":case".xhtml":case".xml":return!0;default:return!1}}function isCode(e){if(isMarkup(e))return!0;switch(e){case".as":case".as3":case".asm":case".aspx":case".bat":case".c":case".cc":case".cmake":case".coffee":case".cpp":case".cs":case".css":case".cxx":case".diff":case".erb":case".erl":case".groovy":case".gvy":case".h":case".haml":case".hh":case".hpp":case".hxx":case".java":case".js":case".json":case".jsx":case".less":case".lst":case".m":case".make":case".ml":case".mm":case".out":case".patch":case".php":case".pl":case".plist":case".properties":case".py":case".rb":case".sass":case".scala":case".scm":case".script":case".scss":case".sh":case".sml":case".sql":case".vb":case".vi":case".vim":case".xsd":case".xsl":case".yaml":case".yml":return!0;default:return!1}}function isText(e){return!(!isCode(e)&&!isMarkdown(e))||".txt"===e}function getIcon(e,t){var n=getExtension(e);if(""===n)return{icon:"file"};if(isAudio(n))return{icon:"file-music",color:"indigo"};if(isImage(n))return{icon:"file-image",color:"cyan"};if(isVideo(n))return{icon:"file-video",color:"pink"};if(isMarkup(n))return{icon:"file-xml",color:"purple"};if(isCode(n))return{icon:"file-code",color:"purple"};if(isText(n))return{icon:"file-document"};switch(n){case".7z":case".zip":return{icon:"file-compressed",color:"orange"};case".doc":case".docm":case".docx":case".dotm":case".dotx":return{icon:"file-word",color:"native"};case".eml":case".msg":return{icon:"email",color:""};case".xls":case".xlsm":case".xlsx":case".xltx":return{icon:"file-excel",color:"native"};case".pdf":return{icon:"file-pdf",color:"native"};case".ppt":case".pptm":case".pptx":case".potx":return{icon:"file-powerpoint",color:"native"};case".pages":return{icon:"file",color:"orange"};case".numbers":return{icon:"file",color:"green"};case".keynote":return{icon:"file",color:"blue"}}return{icon:"file"}}const PreviewContext=React.createContext({openPreview:Function,closePreview:Function});function allowedKeyTarget(e){return!e.target.matches("input, textarea, select")&&!e.target.closest('[contenteditable="true"]')}const PreviewProvider=({client:e,children:t})=>{const[n,r]=React.useState(!1),[i,s]=React.useState([]),[a,o]=React.useState(),[l,c]=React.useState(),[u,d]=React.useState(),[h,p]=React.useState();React.useEffect((()=>{if(l){var e=i.map((function(e){return e.id})).indexOf(l);p(e>0?i[e-1].id:null),d(e+1<i.length?i[e+1].id:null),o(i.find((e=>e.id===l)))}}),[i,l]);const f=()=>{r(!1)};React.useEffect((()=>{if(a){const e=e=>{27===e.which?(e.stopImmediatePropagation(),f()):37===e.which?allowedKeyTarget(e)&&c(h):39===e.which&&allowedKeyTarget(e)&&c(u)};return document.addEventListener("keyup",e),()=>{document.removeEventListener("keyup",e)}}}),[a]);let g=getExtension((null==a?void 0:a.name)||""),m=getIcon((null==a?void 0:a.name)||"").icon,v=(null==a?void 0:a.preview_url)||(null==a?void 0:a.download_url)||"";return"image"===(null==a?void 0:a.preview_format)&&(".gif"===g||".svg"===g)&&(v=(null==a?void 0:a.download_url)||""),React.createElement(React.Fragment,null,React.createElement(PreviewContext.Provider,{value:{openPreview:(e,t)=>{s(e),c(t),r(!0)},closePreview:f}},t),React.createElement(UIOverlay.UI,{isOpen:n,className:"wy-dark"},React.createElement("header",{className:"wy-appbars"},React.createElement("nav",{className:"wy-appbar"},React.createElement(UIButton.UI,{onClick:f},React.createElement(UIIcon.UI,{name:"close"})),React.createElement("div",{className:"wy-appbar-text"},a&&React.createElement("span",null,a.name)),React.createElement("div",{className:"wy-appbar-buttons"},(null==a?void 0:a.application_url)?React.createElement(UIButton.UI,{onClick:()=>{window.open(`${null==a?void 0:a.application_url}`,"_top")},title:"Open in app"},React.createElement(UIIcon.UI,{name:m})):(null==a?void 0:a.external_url)?React.createElement(UIButton.UI,{onClick:()=>{window.open(`${null==a?void 0:a.external_url}`,"_blank")},title:`Open in ${a.provider}`},React.createElement(UIIcon.UI,{name:m})):React.createElement(UIButton.UI,{onClick:()=>{window.open(`${null==a?void 0:a.download_url}&d=1`,"_top")}},React.createElement(UIIcon.UI,{name:"download"}))))),React.createElement("div",{className:"wy-preview wy-scroll-y wy-scroll-x"},a&&React.createElement(React.Fragment,null,h&&React.createElement("nav",{className:"wy-nav-prev"},React.createElement(UIButton.UI,{onClick:()=>{c(h)}},React.createElement(UIIcon.UI,{name:"previous"}))),u&&React.createElement("nav",{className:"wy-nav-next"},React.createElement(UIButton.UI,{onClick:()=>{c(u)}},React.createElement(UIIcon.UI,{name:"next"}))),React.createElement(Preview,{client:e,src:v,link:a.external_url,format:a.preview_format,name:a.name,icon:m,width:a.width,height:a.height,mediaType:a.media_type,provider:a.provider})))))};var FUNC_ERROR_TEXT$1="Expected a function",NAN$1=NaN,symbolTag$1="[object Symbol]",reTrim$1=/^\s+|\s+$/g,reIsBadHex$1=/^[-+]0x[0-9a-f]+$/i,reIsBinary$1=/^0b[01]+$/i,reIsOctal$1=/^0o[0-7]+$/i,freeParseInt$1=parseInt,freeGlobal$1="object"==typeof commonjsGlobal&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,freeSelf$1="object"==typeof self&&self&&self.Object===Object&&self,root$1=freeGlobal$1||freeSelf$1||Function("return this")(),objectProto$1=Object.prototype,objectToString$1=objectProto$1.toString,nativeMax$1=Math.max,nativeMin$1=Math.min,now$1=function(){return root$1.Date.now()};function debounce$1(e,t,n){var r,i,s,a,o,l,c=0,u=!1,d=!1,h=!0;if("function"!=typeof e)throw new TypeError(FUNC_ERROR_TEXT$1);function p(t){var n=r,s=i;return r=i=void 0,c=t,a=e.apply(s,n)}function f(e){return c=e,o=setTimeout(m,t),u?p(e):a}function g(e){var n=e-l;return void 0===l||n>=t||n<0||d&&e-c>=s}function m(){var e=now$1();if(g(e))return v(e);o=setTimeout(m,function(e){var n=t-(e-l);return d?nativeMin$1(n,s-(e-c)):n}(e))}function v(e){return o=void 0,h&&r?p(e):(r=i=void 0,a)}function y(){var e=now$1(),n=g(e);if(r=arguments,i=this,l=e,n){if(void 0===o)return f(l);if(d)return o=setTimeout(m,t),p(l)}return void 0===o&&(o=setTimeout(m,t)),a}return t=toNumber$1(t)||0,isObject$2(n)&&(u=!!n.leading,s=(d="maxWait"in n)?nativeMax$1(toNumber$1(n.maxWait)||0,t):s,h="trailing"in n?!!n.trailing:h),y.cancel=function(){void 0!==o&&clearTimeout(o),c=0,r=l=i=o=void 0},y.flush=function(){return void 0===o?a:v(now$1())},y}function throttle(e,t,n){var r=!0,i=!0;if("function"!=typeof e)throw new TypeError(FUNC_ERROR_TEXT$1);return isObject$2(n)&&(r="leading"in n?!!n.leading:r,i="trailing"in n?!!n.trailing:i),debounce$1(e,t,{leading:r,maxWait:t,trailing:i})}function isObject$2(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function isObjectLike$1(e){return!!e&&"object"==typeof e}function isSymbol$1(e){return"symbol"==typeof e||isObjectLike$1(e)&&objectToString$1.call(e)==symbolTag$1}function toNumber$1(e){if("number"==typeof e)return e;if(isSymbol$1(e))return NAN$1;if(isObject$2(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=isObject$2(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(reTrim$1,"");var n=reIsBinary$1.test(e);return n||reIsOctal$1.test(e)?freeParseInt$1(e.slice(2),n?2:8):reIsBadHex$1.test(e)?NAN$1:+e}var lodash_throttle=throttle,scrollbarClassnameTarget=document.documentElement;function checkScrollbar(e){var t;for(var n in e){t=e[n].target;try{(t===document.documentElement?window.innerWidth:t.clientWidth)!==t.offsetWidth?scrollbarClassnameTarget.classList.add("wy-scrollbars"):scrollbarClassnameTarget.classList.remove("wy-scrollbars")}catch(e){console.warn("scrollbar detection failed",e)}}return scrollbarClassnameTarget.classList.contains("wy-scrollbars")}function detectScrollbars(){var e=document.getElementById("wy-scrollbar-detection");return e||((e=document.createElement("aside")).id="wy-scrollbar-detection",e.className="wy-scrollbar-detection",document.documentElement.insertBefore(e,document.body)),new Promise((t=>{new ResizeObserver((e=>{let n=checkScrollbar(e);t(n)})).observe(e)}))}function checkScrollbarAdjust(e){for(var t in e){let n=e[t].target,r=getComputedStyle(n);void 0!==n.dataset.adjustScrollbarTop&&scrollbarClassnameTarget.style.setProperty("--wy-scrollbar-adjust-top",r.height),void 0!==n.dataset.adjustScrollbarBottom&&scrollbarClassnameTarget.style.setProperty("--wy-scrollbar-adjust-bottom",r.height)}}function detectScrollbarAdjustments(){var e=new ResizeObserver(checkScrollbarAdjust);const t=()=>{if(scrollbarClassnameTarget.style.removeProperty("--wy-scrollbar-adjust-top"),scrollbarClassnameTarget.style.removeProperty("--wy-scrollbar-adjust-bottom"),e.disconnect(),scrollbarClassnameTarget.classList.contains("wy-scrollbars")){let t=document.querySelectorAll("[data-adjust-scrollbar-top], [data-adjust-scrollbar-bottom]");t&&t.forEach((t=>{checkScrollbarAdjust([{target:t}]),e.observe(t)}))}};requestAnimationFrame(t),setTimeout(t,5e3),new MutationObserver(lodash_throttle(t,100)).observe(scrollbarClassnameTarget,{childList:!0,subtree:!0})}dayjs.extend(relativeTime),dayjs.extend(utc),dayjs.extend(timezone),dayjs.extend(localizedFormat);const WeavyContext=React.createContext({client:null,options:{}}),queryClient=new QueryClient({defaultOptions:{queries:{cacheTime:864e5}}}),WeavyProvider=({children:e,client:t,options:n})=>{let r={zoomAuthenticationUrl:void 0,teamsAuthenticationUrl:void 0,enableCloudFiles:!0,enableScrollbarDetection:!0,filebrowserUrl:"https://filebrowser.weavy.io/v14/",reactions:["😍","😎","😉","😜","👍"]},i=Object.assign(Object.assign({},r),n);return i.enableScrollbarDetection&&detectScrollbars().then((()=>detectScrollbarAdjustments())),t||queryClient.clear(),React.createElement(React.Fragment,null,t&&React.createElement(QueryClientProvider,{client:queryClient},React.createElement(WeavyContext.Provider,{value:{client:t,options:i}},React.createElement(UserProvider,{client:t},React.createElement(PreviewProvider,{client:t},e)))))};function usePresence(){const{client:e}=React.useContext(WeavyContext);if(!e)throw new Error("usePresence must be used within an WeavyProvider");React.useEffect((()=>{e.subscribe(null,"online",t)}),[]);const t=e=>{Array.isArray(e)?(document.querySelectorAll(".wy-presence").forEach((function(e){e.classList.remove("wy-presence-active")})),e.forEach((function(e){document.querySelectorAll("[data-presence-id='"+e+"']").forEach((function(e){e.classList.add("wy-presence-active")}))}))):document.querySelectorAll("[data-presence-id='"+e+"']").forEach((function(e){e.classList.add("wy-presence-active")}))}}const MessengerContext=React.createContext({selectedConversationId:null,setSelectedConversationId:e=>{}}),MessengerProvider=({children:e})=>{const[t,n]=React.useState(null);usePresence();return React.createElement(React.Fragment,null,React.createElement(MessengerContext.Provider,{value:{selectedConversationId:t,setSelectedConversationId:e=>{n(e)}}},e))};function useMembers(e,t){const{client:n}=React.useContext(WeavyContext);if(!n)throw new Error("useMembers must be used within an WeavyProvider");return useQuery(["members",e],(()=>__awaiter(this,void 0,void 0,(function*(){const t=yield n.get("/api/apps/"+e+"/members");return yield t.json()}))),t)}const Typing=({children:e,id:t,context:n})=>{const[r,i]=React.useState([]),[s,a]=React.useState(""),o=React.useRef(null),{client:l}=React.useContext(WeavyContext),{user:c}=React.useContext(UserContext);React.useEffect((()=>(u(),()=>{clearTimeout(o.current)})),[r,t,n]),React.useEffect((()=>(i([]),null==l||l.subscribe(`a${t}`,"typing",d),null==l||l.subscribe(`a${t}`,"message_created",h),()=>{null==l||l.unsubscribe(`a${t}`,"typing",d),null==l||l.unsubscribe(`a${t}`,"message_created",h)})),[t]);const u=()=>{let e=r;o.current&&(clearTimeout(o.current),o.current=null);let t=Date.now();if(e.forEach((function(n,r){t-n.time>5e3&&e.splice(r,1)})),e.length){let n=Math.round((t-Math.max.apply(null,e.map((function(e){return e.time}))))/1e3)%3+1,r=".".repeat(n),i=e.map((e=>e.display_name)).sort(),s="";for(let e=0;e<i.length;e++)e>0&&(e===i.length-1?s+=" and ":s+=", "),s+=i[e];1===i.length?s+=" is typing":s+=" are typing",a(s+r),o.current=setTimeout(u,1e3)}else a("")},d=React.useCallback((e=>{var n;e.conversation.id===t&&e.actor.id!==c.id&&(n=e.actor,r.forEach((function(e,t){e.member.id===n.id&&i(r.splice(t,1))})),n.time=Date.now(),i([...r,n]))}),[t,n,r]),h=React.useCallback((e=>{e.message.app_id===t&&i([])}),[t,n,r]);return React.createElement(React.Fragment,null,""!==s&&React.createElement(React.Fragment,null,s),""===s&&React.createElement(React.Fragment,null,e))};var Typing$1=React.memo(Typing);const Dropdown=e=>{var{directionX:t="right",directionY:n="down",children:r,className:i=""}=e,s=__rest(e,["directionX","directionY","children","className"]);const[a,o]=React.useState(!1);React.useEffect((()=>{a?document.addEventListener("click",(()=>{o(!1)})):document.removeEventListener("click",(()=>{o(!1)}))}),[a]);return React.createElement("span",Object.assign({className:classNames("wy-dropdown",{"wy-dropup":"up"===n},i)},s),React.createElement(UIButton.UI,{onClick:e=>(e=>{e.stopPropagation(),o(!a)})(e),className:classNames({"wy-active":a})},React.createElement(UIIcon.UI,{name:"dots-vertical"})),React.createElement("div",{className:classNames("wy-dropdown-menu",{"wy-dropdown-menu-end":"left"===t}),hidden:!a},r))},DropdownItem=e=>{var{children:t,className:n="",onClick:r}=e,i=__rest(e,["children","className","onClick"]);return React.createElement("div",Object.assign({className:classNames("wy-dropdown-item",n),onClick:r},i),t)},UIDropdown={UI:Dropdown,Item:DropdownItem};var FUNC_ERROR_TEXT="Expected a function",NAN=NaN,symbolTag="[object Symbol]",reTrim=/^\s+|\s+$/g,reIsBadHex=/^[-+]0x[0-9a-f]+$/i,reIsBinary=/^0b[01]+$/i,reIsOctal=/^0o[0-7]+$/i,freeParseInt=parseInt,freeGlobal="object"==typeof commonjsGlobal&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,freeSelf="object"==typeof self&&self&&self.Object===Object&&self,root=freeGlobal||freeSelf||Function("return this")(),objectProto=Object.prototype,objectToString=objectProto.toString,nativeMax=Math.max,nativeMin=Math.min,now=function(){return root.Date.now()};function debounce(e,t,n){var r,i,s,a,o,l,c=0,u=!1,d=!1,h=!0;if("function"!=typeof e)throw new TypeError(FUNC_ERROR_TEXT);function p(t){var n=r,s=i;return r=i=void 0,c=t,a=e.apply(s,n)}function f(e){return c=e,o=setTimeout(m,t),u?p(e):a}function g(e){var n=e-l;return void 0===l||n>=t||n<0||d&&e-c>=s}function m(){var e=now();if(g(e))return v(e);o=setTimeout(m,function(e){var n=t-(e-l);return d?nativeMin(n,s-(e-c)):n}(e))}function v(e){return o=void 0,h&&r?p(e):(r=i=void 0,a)}function y(){var e=now(),n=g(e);if(r=arguments,i=this,l=e,n){if(void 0===o)return f(l);if(d)return o=setTimeout(m,t),p(l)}return void 0===o&&(o=setTimeout(m,t)),a}return t=toNumber(t)||0,isObject$1(n)&&(u=!!n.leading,s=(d="maxWait"in n)?nativeMax(toNumber(n.maxWait)||0,t):s,h="trailing"in n?!!n.trailing:h),y.cancel=function(){void 0!==o&&clearTimeout(o),c=0,r=l=i=o=void 0},y.flush=function(){return void 0===o?a:v(now())},y}function isObject$1(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function isObjectLike(e){return!!e&&"object"==typeof e}function isSymbol(e){return"symbol"==typeof e||isObjectLike(e)&&objectToString.call(e)==symbolTag}function toNumber(e){if("number"==typeof e)return e;if(isSymbol(e))return NAN;if(isObject$1(e)){var t="function"==typeof e.valueOf?e.valueOf():e;e=isObject$1(t)?t+"":t}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(reTrim,"");var n=reIsBinary.test(e);return n||reIsOctal.test(e)?freeParseInt(e.slice(2),n?2:8):reIsBadHex.test(e)?NAN:+e}var lodash_debounce=debounce;function useDebounce(e,t){const n=React.useRef({cb:e,delay:t});return React.useEffect((()=>{n.current={cb:e,delay:t}})),React.useCallback(lodash_debounce(((...e)=>{n.current.delay===t&&n.current.cb(...e)}),t,{leading:!1,trailing:!0}),[t,lodash_debounce])}function useSearchUsers(e,t){const{client:n}=React.useContext(WeavyContext);if(!n)throw new Error("useSearchUsers must be used within an WeavyProvider");return useQuery("users",(()=>__awaiter(this,void 0,void 0,(function*(){const t=yield n.get("/api/users?q="+e+"&skip=0&top=10");return yield t.json()}))),t)}const Presence=({id:e,status:t})=>React.createElement("span",{className:classNames("wy-presence",{"wy-presence-active":"active"===t}),"data-presence-id":e}),Avatar=({id:e,src:t,name:n,presence:r,size:i=48,className:s})=>React.createElement("div",{className:classNames("wy-avatar-presence",s)},React.createElement("img",{alt:"",title:n,className:"wy-avatar",height:i,width:i,src:t}),r&&e&&React.createElement(Presence,{id:e,status:r})),SearchUsers=({handleSubmit:e,buttonTitle:t})=>{const[n,r]=React.useState(""),[i,s]=React.useState([]),{isLoading:a,isError:o,data:l,error:c,isFetching:u,refetch:d}=useSearchUsers(n,{enabled:!1}),h=useDebounce((()=>d()),250);React.useEffect(h,[n]);const p=e=>{let t=e.currentTarget.querySelector("input[type=checkbox]");t===e.target||e.target.matches("label, input[type=checkbox]")||null==t||t.click()},f=()=>{s([]),r("")};return React.createElement("div",{className:"wy-search wy-scroll-y"},React.createElement("div",{className:"wy-pane-group"},React.createElement("div",{className:"wy-search-form wy-input-group"},React.createElement("input",{className:"wy-search-input wy-input wy-input-filled",value:n,onChange:e=>r(e.target.value),name:"text",placeholder:"Search..."}),React.createElement(UIButton.UI,{type:"reset",onClick:()=>f()},React.createElement(UIIcon.UI,{name:"close-circle"})),React.createElement(UIButton.UI,null,React.createElement(UIIcon.UI,{name:"magnify"})))),React.createElement("div",{className:"wy-pane-group"},l&&(!l.data||0===l.data.length)&&React.createElement("div",{className:"wy-table-no-result"},"Your search did not match any people."),React.createElement("table",{className:"wy-table wy-table-hover wy-search-result-table"},React.createElement("tbody",null,l&&l.data&&l.data.length>0&&l.data.map((e=>{return React.createElement("tr",{key:e.id,onClick:p},React.createElement("td",{className:"wy-table-cell-icon"},React.createElement(Avatar,{src:e.avatar_url,size:24,id:e.id,presence:e.presence,name:e.display_name})),React.createElement("td",{className:"wy-table-cell-text"},React.createElement("label",{htmlFor:"chk"+e.id},e.display_name)),React.createElement("td",{className:"wy-table-cell-icon"},React.createElement("input",{type:"checkbox",id:"chk"+e.id,checked:(t=e.id,null!=i.find((e=>e.id===t))),onChange:t=>((e,t)=>{e.target.checked?s([...i,t]):s(i.filter((e=>e.id!==t.id)))})(t,e)})));var t}))))),React.createElement("div",{className:"wy-footerbars"},React.createElement("div",{className:"wy-footerbar"},React.createElement("div",{className:"wy-pane-group"},React.createElement("div",{className:"wy-buttons"},React.createElement("button",{className:"wy-button wy-button-primary",type:"button",onClick:()=>{e(i),f()},disabled:0===i.length},t))))))};function useMutateMembers(){const{client:e}=React.useContext(WeavyContext),t=useQueryClient();if(!e)throw new Error("useMutateMembers must be used within an WeavyProvider");return useMutation((({id:t,members:n})=>__awaiter(this,void 0,void 0,(function*(){return yield e.post("/api/apps/"+t+"/members/","POST",JSON.stringify(n))}))),{onSuccess:(e,n,r)=>{t.invalidateQueries("conversations"),t.invalidateQueries(["conversation",n.id]),t.invalidateQueries(["members",n.id])}})}function useConversation(e,t){const{client:n}=React.useContext(WeavyContext);if(!n)throw new Error("useConversation must be used within an WeavyProvider");return useQuery(["conversation",e],(()=>__awaiter(this,void 0,void 0,(function*(){const t=yield n.get("/api/conversations/"+e);return yield t.json()}))),t)}function useMutateConversationName(){const{client:e}=React.useContext(WeavyContext),t=useQueryClient();if(!e)throw new Error("useMutateConversationName must be used within an WeavyProvider");return useMutation((({id:t,name:n})=>__awaiter(this,void 0,void 0,(function*(){return(yield e.post("/api/apps/"+t,"PATCH",JSON.stringify({type:"ChatRoom",name:n}))).json()}))),{onSuccess:(e,n,r)=>{t.invalidateQueries("conversations"),t.invalidateQueries(["conversation",n.id])}})}function useMutateRemoveMembers(){const{client:e}=React.useContext(WeavyContext),{setSelectedConversationId:t}=React.useContext(MessengerContext),n=useQueryClient();if(!e)throw new Error("useMutateRemoveMembers must be used within an WeavyProvider");return useMutation((({id:t,members:n})=>__awaiter(this,void 0,void 0,(function*(){return yield e.post("/api/apps/"+t+"/members/"+n.join(","),"DELETE",JSON.stringify(n))}))),{onSuccess:()=>{n.invalidateQueries("conversations"),t(null)}})}function useMessages(e,t){const{client:n}=React.useContext(WeavyContext);if(!n)throw new Error("useMessages must be used within an WeavyProvider");var r=Object.assign(Object.assign({},t),{getNextPageParam:(e,t)=>{if((null==e?void 0:e.end)<(null==e?void 0:e.count))return 25*t.length},select:e=>({pages:[...e.pages].reverse(),pageParams:[...e.pageParams].reverse()})});return useInfiniteQuery(["messages",e],(t=>__awaiter(this,void 0,void 0,(function*(){var r;let i=t.pageParam||0;const s=yield n.get("/api/apps/"+e+"/messages?orderby=createdat+desc&skip="+i+"&top=25");let a=yield s.json();return a.data=(null===(r=a.data)||void 0===r?void 0:r.reverse())||[],a}))),r)}const Attachment=({previewFormat:e,url:t,previewUrl:n,mediaType:r,name:i,kind:s,size:a,provider:o,onClick:l})=>{let c=a>0?fileSizeAsString(a):null,{icon:u,color:d}=getIcon(i);return React.createElement("a",{href:n||t,className:"wy-item wy-item-hover wy-item-lg wy-attachment",target:"_blank",title:i,onClick:l?e=>l(e):void 0},React.createElement(UIIcon.UI,{name:u,color:d,size:2}),React.createElement("div",{className:"wy-item-body wy-attachment-content"},React.createElement("div",{className:"wy-item-title wy-attachment-title"},i),c&&React.createElement("div",{className:"wy-item-text wy-attachment-meta",title:c},c)))};function useMutateReaction(){const{client:e}=React.useContext(WeavyContext);if(React.useContext(UserContext),!e)throw new Error("useMutateReaction must be used within an WeavyProvider");return useMutation((({id:t,reaction:n})=>__awaiter(this,void 0,void 0,(function*(){return yield e.post("/api/messages/"+t+"/reactions/","POST",JSON.stringify({content:n}))}))))}const events=[],callbacks={};function useForceUpdate(){const[,e]=React.useState({});return React.useCallback((()=>e({})),[])}function useEvents(){const e=useForceUpdate();return{dispatch:(t,n)=>{events.push({event:t,data:n,created:Date.now()}),((t,n)=>{t&&(t.forEach((e=>e(n))),e())})(callbacks[t],n)},on:(e,t)=>(callbacks[e]?callbacks[e].push(t):callbacks[e]=[t],()=>callbacks[e]=callbacks[e].filter((e=>e!==t))),off:(e,t)=>{callbacks[e]=callbacks[e].filter((e=>e!==t))},events:events}}function useReactions(e,t){const{on:n,off:r}=useEvents(),{user:i}=React.useContext(UserContext),[s,a]=React.useState([]),o=React.useCallback((e=>[...new Map(e.map((e=>[e.content,e]))).values()].map((t=>({content:t.content,count:e.filter((e=>e.content===t.content)).length,has_reacted:e.filter((e=>e.content===t.content&&e.created_by_id===i.id)).length>0})))),[s]),l=React.useCallback((t=>{t.entity.id===e&&a((e=>[...e||[],{content:t.reaction,created_by_id:t.actor.id}]))}),[e,s]),c=React.useCallback((t=>{t.entity.id===e&&a((e=>e.filter((e=>e.created_by_id!==t.actor.id))))}),[e,s]);return React.useLayoutEffect((()=>{a(t||[])}),[t]),React.useEffect((()=>(n("reaction_added_"+e,l),n("reaction_deleted_"+e,c),()=>{r("reaction_added_"+e,l),r("reaction_deleted_"+e,c)})),[e]),{reactionsList:o(s)}}function useMutateDeleteReaction(){const{client:e}=React.useContext(WeavyContext);if(React.useContext(UserContext),!e)throw new Error("useMutateDeleteReaction must be used within an WeavyProvider");return useMutation((({id:t,reaction:n})=>__awaiter(this,void 0,void 0,(function*(){return yield e.post("/api/messages/"+t+"/reactions/","DELETE","")}))))}const ReactionsMenu=({id:e,reactions:t})=>{const{reactionsList:n}=useReactions(e,t),r=useMutateReaction(),i=useMutateDeleteReaction(),[s,a]=React.useState(!1),{options:o}=React.useContext(WeavyContext),[l,c]=React.useState(""),u=null==o?void 0:o.reactions;React.useEffect((()=>{var e=n.find((e=>e.has_reacted));c(e?e.content:"")}),[n]),React.useEffect((()=>{s?document.addEventListener("click",(()=>{a(!1)})):document.removeEventListener("click",(()=>{a(!1)}))}),[s]);const d=t=>__awaiter(void 0,void 0,void 0,(function*(){const s=n.find((e=>e.has_reacted)),o=t.target.dataset.emoji;s&&(yield i.mutateAsync({id:e,reaction:o})),s&&s.content===o||(yield r.mutateAsync({id:e,reaction:o})),a(!1)}));return React.createElement("div",{className:classNames({"wy-active":s}),style:{position:"relative"}},React.createElement(UIButton.UI,{className:"wy-reaction-menu-button",onClick:e=>{e.stopPropagation(),a(!s)}},React.createElement(UIIcon.UI,{name:"emoticon-plus",size:1.25/1.5})),React.createElement("div",{className:"wy-reaction-menu wy-dropdown-menu",style:{display:s?"block":"none",position:"absolute",top:"-3.25rem"}},React.createElement("div",{className:"wy-reaction-picker"},null==u?void 0:u.map(((e,t)=>React.createElement(UIButton.UI,{key:t,onClick:d,className:classNames("wy-button-icon wy-reaction-button",{"wy-active":l===e}),"data-emoji":e},e))))))},ReactionsList=({id:e,reactions:t})=>{const{reactionsList:n}=useReactions(e,t);let r=n.reduce(((e,t)=>e+t.count),0);return React.createElement(React.Fragment,null,!!n&&n.map(((e,t)=>React.createElement("span",{key:t,className:"wy-reaction",title:e.count.toString()},e.content))),r>1&&React.createElement("span",{className:"wy-reaction-count"},r))},SeenBy=({seenBy:e})=>React.createElement(React.Fragment,null,e&&e.length>0&&React.createElement("div",{className:"wy-readby-status"},e.map((e=>{const t=dayjs.utc(e.marked_at).tz(dayjs.tz.guess());return React.createElement(Avatar,{name:`Seen by ${e.display_name} at ${t.format("LLLL")}`,src:e.avatar_url,size:16,key:e.id})})))),MeetingCard=({meeting:e})=>React.createElement("div",{className:"wy-list"},e.ended_at&&React.createElement("div",{className:"wy-item wy-meeting"},React.createElement(UIIcon.UI,{name:"zoom",size:4,color:"#cccccc"}),React.createElement("div",{className:"wy-item-body"},React.createElement("div",{className:"wy-item-title"},"Zoom meeting"),React.createElement("div",{className:"wy-item-body"},React.createElement("div",null,"Ended ",dayjs.utc(e.ended_at).tz(dayjs.tz.guess()).fromNow()),e.recording_url&&React.createElement("div",{className:"wy-meeting-actions"},React.createElement("a",{href:e.recording_url,target:"_blank",className:"wy-button wy-button-primary"},"Play recording"))))),!e.ended_at&&React.createElement("a",{className:"wy-item wy-meeting",href:e.join_url,target:"_blank"},React.createElement(UIIcon.UI,{name:"zoom",color:"#4a8cff",size:4}),React.createElement("div",{className:"wy-item-body"},React.createElement("div",{className:"wy-item-title"},"Zoom meeting"),React.createElement("div",{className:"wy-item-body"},React.createElement("div",null,"ID: ",`${e.provider_id.substring(0,3)}-${e.provider_id.substring(3,6)}-${e.provider_id.substring(6)}`),React.createElement("div",{className:"wy-meeting-actions"},React.createElement(UIButton.UI,{className:"wy-button-primary"},"Join meeting"))))));function usePreview(e){const{openPreview:t,closePreview:n}=React.useContext(PreviewContext);return{open:n=>{t(e,n)},close:()=>{n()}}}const Message=({id:e,html:t,temp:n,me:r,avatar:i,name:s,created_at:a,created_by:o,attachments:l,meeting:c,parentId:u,reactions:d,seenBy:h,chatRoom:p})=>{const{open:f,close:g}=usePreview(l);let m=null==l?void 0:l.filter((e=>"image"===e.kind&&e.thumbnail_url)),v=null==l?void 0:l.filter((e=>"image"!==e.kind||!e.thumbnail_url));const y=dayjs.utc(a).tz(dayjs.tz.guess()),b=(e,t)=>{e.preventDefault(),f(t)};return React.createElement(React.Fragment,null,React.createElement("div",{className:classNames("wy-message",{"wy-message-me":r})},!r&&React.createElement("div",{className:"wy-message-author"},i&&React.createElement(Avatar,{src:i,size:32,name:s})),React.createElement("div",{className:"wy-message-content"},React.createElement("div",{className:"wy-message-meta"},p&&!r&&React.createElement("span",null,o," · "),React.createElement("time",{dateTime:a,title:y.format("LLLL")},y.fromNow())),React.createElement("div",{className:"wy-message-bubble"},n&&React.createElement("div",{className:"wy-content"},t),!n&&React.createElement(React.Fragment,null,m&&!!m.length&&React.createElement(ImageGrid,null,m.map((e=>React.createElement(Image,{onClick:t=>b(t,e.id),key:e.id,src:e.download_url,previewSrc:e.preview_url,width:e.width,height:e.height})))),t&&React.createElement("div",{className:"wy-content",dangerouslySetInnerHTML:{__html:t||""}}),c&&React.createElement(MeetingCard,{meeting:c}),v&&!!v.length&&React.createElement("div",{className:"wy-list-items wy-attachments"},v.map((e=>React.createElement(Attachment,{key:e.id,onClick:t=>b(t,e.id),name:e.name,previewFormat:e.kind,provider:e.provider,url:e.download_url,previewUrl:e.provider?e.external_url:e.preview_url,mediaType:e.media_type,kind:e.kind,size:e.size})))),React.createElement("div",{className:"wy-reactions-line"},React.createElement("div",{className:"wy-reactions"},React.createElement(ReactionsList,{id:e,parentId:u,reactions:d})),!n&&React.createElement(ReactionsMenu,{id:e,reactions:d})))))),React.createElement(SeenBy,{id:e,parentId:u,seenBy:h,createdAt:a}))};function createScroller(e,t){var n=getScrollParent$1(e);n.style.overflowAnchor="none";var r=n===document.documentElement?document:n;t??=()=>Promise.reject(new Error("No scroller handler function defined"));const i=new IntersectionObserver(((e,n)=>{e.forEach((function(e){e.isIntersecting&&t()}))}),{root:r,threshold:0,rootMargin:"500px"});return i.observe(e),i}function createReverseScroller(e,t){let n=!1;var r=getScrollParent$1(e);r.style.overflowAnchor="none";var i=r===document.documentElement?document:r;t??=()=>Promise.reject(new Error("No reverse scroller handler function defined"));const s=new IntersectionObserver(((e,i)=>{e.forEach((function(e){if(e.isIntersecting&&!n){n=!0;var i=getNextPositionedChild(e.target),s=r.scrollHeight,a=i.offsetTop;let o=()=>{queueMicrotask((()=>{if(s!==r.scrollHeight){let e=i.offsetTop-a;r.scrollTop+=e,requestAnimationFrame((()=>n=!1))}else queueMicrotask((()=>{if(s!==r.scrollHeight){let e=i.offsetTop-a;r.scrollTop+=e,requestAnimationFrame((()=>n=!1))}else requestAnimationFrame((()=>{let e=i.offsetTop-a;r.scrollTop+=e,requestAnimationFrame((()=>n=!1))}))}))}))},l=t();l?l.then(o):o()}}))}),{root:i,threshold:0,rootMargin:"500px"});return s.observe(e),s}function getNextPositionedChild(e){for(;e=e?.nextElementSibling;)if(!1===/absolute|sticky|fixed/.test(getComputedStyle(e).position))return e}function getScrollParent$1(e){if(e){var t=getComputedStyle(e),n="absolute"===t.position,r=/(auto|overlay|scroll)/;if("fixed"===t.position)return document.scrollingElement;for(var i=e;i=i.parentElement;)if(t=getComputedStyle(i),(!n||"static"!==t.position)&&r.test(t.overflow+t.overflowY+t.overflowX))return i}return document.scrollingElement}function getScrollParent(e,t){if(e){var n=getComputedStyle(e),r="absolute"===n.position,i=t?/(auto|scroll|overlay|hidden)/:/(auto|overlay|scroll)/;if("fixed"===n.position)return document.scrollingElement;for(var s=e;s=s.parentElement;)if(n=getComputedStyle(s),(!r||"static"!==n.position)&&i.test(n.overflow+n.overflowY+n.overflowX))return s}return document.scrollingElement}function isParentAtBottom(e,t){if(e){t??=32;let n=getScrollParent(e);return Math.abs(n.scrollTop+n.clientHeight-n.scrollHeight)<=t}return!1}function scrollParentToBottom(e,t){if(e){let n=getScrollParent(e);n.scrollTop+n.clientHeight!==n.scrollHeight&&(t?n.scrollTo({top:n.scrollHeight,left:0,behavior:"smooth"}):n.scrollTop=n.scrollHeight)}}function useFileUploader(e){const{client:t}=React.useContext(WeavyContext);if(!t)throw new Error("useFileUploader must be used within an WeavyProvider");return useMutation((({request:n})=>__awaiter(this,void 0,void 0,(function*(){const r=new FormData;r.append("blob",n.file);const i=yield t.post("/api/blobs","POST",r,"");var s=yield i.json();e(s)}))),{onError:e=>{},onSuccess:(e,t)=>{}})}const File=({id:e,name:t,className:n,icon:r})=>React.createElement(React.Fragment,null,React.createElement(UIIcon.UI,{name:r,size:1}),React.createElement("div",{className:n},t),React.createElement("input",{type:"hidden",value:e,name:"blob"}));function useMutateTyping(){const{client:e}=React.useContext(WeavyContext);if(!e)throw new Error("useMutateTyping must be used within an WeavyProvider");return useMutation((({id:t})=>__awaiter(this,void 0,void 0,(function*(){return yield e.post("/api/conversations/"+t+"/typing","PUT",JSON.stringify({}))}))),{})}function useThrottle(e,t){const n=React.useRef(e);return React.useEffect((()=>{n.current=e})),React.useCallback(lodash_throttle(((...e)=>n.current(...e)),t,{leading:!0,trailing:!1}),[t])}function useMutateMeeting(){const{client:e}=React.useContext(WeavyContext);if(useQueryClient(),!e)throw new Error("useMutateMeeting must be used within an WeavyProvider");return useMutation((({provider:t})=>__awaiter(this,void 0,void 0,(function*(){return(yield e.post("/api/meetings","POST",JSON.stringify({provider:t}))).json()}))),{onSuccess:e=>{}})}const Meetings=({onMeetingAdded:e})=>{const{options:t}=React.useContext(WeavyContext),{user:n}=React.useContext(UserContext),r=useMutateMeeting();React.useEffect((()=>(window.addEventListener("message",i),()=>{window.removeEventListener("message",i)})),[e]);const i=t=>__awaiter(void 0,void 0,void 0,(function*(){if("zoom-signed-in"===t.data.name){var n=yield r.mutateAsync({provider:"zoom"});e(n)}}));return React.createElement(React.Fragment,null,(null==t?void 0:t.zoomAuthenticationUrl)&&React.createElement(UIButton.UI,{onClick:()=>{window.open(`${null==t?void 0:t.zoomAuthenticationUrl}&state=${n.id}`,"zoomAuthWin","height=640,width=480")},title:"Add Zoom meeting"},React.createElement(UIIcon.UI,{name:"zoom"})))},Meeting=({id:e,title:t,className:n})=>React.createElement(React.Fragment,null,React.createElement(UIIcon.UI,{name:"zoom"}),React.createElement("div",{className:n},"Zoom meeting"),React.createElement("input",{type:"hidden",value:e,name:"meeting"}));function useMutateExternalBlobs(){const{client:e}=React.useContext(WeavyContext);if(useQueryClient(),!e)throw new Error("useMutateExternalBlobs must be used within an WeavyProvider");return useMutation((({blobs:t})=>__awaiter(this,void 0,void 0,(function*(){return(yield e.post("/api/blobs/external","POST",JSON.stringify(t))).json()}))),{onSuccess:e=>{}})}function S4(){return(65536*(1+Math.random())|0).toString(16).substring(1)}function isObject(e){return"[object Object]"===Object.prototype.toString.call(e)}function isPlainObject(e){var t,n;return!1!==isObject(e)&&(void 0===(t=e.constructor)||!1!==isObject(n=t.prototype)&&!1!==Object.prototype.hasOwnProperty.call(n,"isPrototypeOf"))}function eqJQuery(e,t){return e&&t&&e.jquery&&t.jquery&&e.jquery===t.jquery&&e.length===t.length&&e.length===e.filter(t).length}function eqObjects(e,t,n){if(!isPlainObject(e)||!isPlainObject(t))return!1;var r=Object.getOwnPropertyNames(e),i=Object.getOwnPropertyNames(t);if(!n&&r.length!==i.length)return!1;for(var s=0;s<r.length;s++){var a=r[s],o=e[a],l=t[a];if(o!==l&&!eqJQuery(o,l)&&!eqObjects(o,l,n))return!1}return!0}function WeavyPromiseWrapper(e){var t,n="pending",r=function(){return t};return r.promise=r.bind(r),r.state=function(){return n},(r.reset=function(){var i,s;return n="pending",t=new Promise((function(e,t){i=function(){n="resolved",e.apply(this,arguments)},s=function(){n="rejected",t.apply(this,arguments)}})),t.weavy=!0,r.resolve=function(){return i.apply(t,arguments),r},r.reject=function(){return s.apply(t,arguments),r},"function"==typeof e&&e(i,s),r})(),r.then=function(){return(t=t.then.apply(t,arguments)).weavy=!0,r},r.catch=function(){return(t=t.catch.apply(t,arguments)).weavy=!0,r},r.finally=function(){return(t=t.finally.apply(t,arguments)).weavy=!0,r},r}function WeavyPostal(e){var t=this;this.timeout=e&&e.timeout||2e3;var n=[],r=new Set,i=new Map,s=new WeakMap,a=new WeakMap,o=new WeakMap,l=new WeakMap,c=new WeavyPromiseWrapper,u=null,d=h(window.location.href);function h(e){var t=null;try{t=/^((?:https?:\/\/[^/]+)|(?:file:\/\/))\/?/.exec(e)[1]}catch(e){console.error("Unable to resolve location origin. Make sure you are using http, https or file protocol and have a valid location URL.")}return t}function p(e,t){var r=e.source===window&&e.origin===d;if(t||=s.has(e.source)&&e.origin===s.get(e.source),r||t){var i=!e.data.weavyId||!0===e.data.weavyId;t&&!e.data.windowName&&(e.data.windowName=a.get(e.source));var o=e.data.name;if("distribute"===o){if(u)return;e.data.name=e.data.distributeName}n.forEach((function(t){var n=t.name===o||"message"===t.name,r=null===t.selector,s=t.selector===e.data.weavyId,a=isPlainObject(t.selector)&&eqObjects(t.selector,e.data,!0);n&&(i||r||s||a)&&(t.handler(e,e.data),t.once&&g(t.name,t.selector,t.handler))}))}}function f(e,t,r){"function"==typeof arguments[1]&&(r=arguments[1],t=null),n.push({name:e,handler:r,selector:t})}function g(e,t,r){"function"==typeof arguments[1]&&(r=arguments[1],t=null),n=n.filter((function(n){var i=e===n.name,s=r===n.handler,a="string"==typeof t&&t===n.selector,o=isPlainObject(t)&&eqObjects(t,n.selector);return!(i&&s&&(null===t||a||o))}))}function m(e,t){if(i.has(t)){if(i.get(t).has(e)){var n=i.get(t).get(e);try{r.delete(n),a.delete(n),o.delete(n),s.delete(n)}catch(e){}}if(i.get(t).delete(e),0===i.get(t).size)try{i.delete(t)}catch(e){}}}function v(e,n,r){var i=new WeavyPromiseWrapper;null===r&&(r=void 0);var a=e===window.self,o=a?h(window.location.href):s.get(e);return a||e&&o===l.get(e)?(n.weavyMessageId||(n.weavyMessageId=S4()+S4()),queueMicrotask((()=>{console.debug("whenPostMessage",n.name,n.weavyMessageId);var s=setTimeout((function(){"pending"===i.state()&&i.reject(new Error("postMessage() receipt timed out: "+n.weavyMessageId+", "+n.name))}),t.timeout||2e3);f("message-receipt",{weavyId:n.weavyId,weavyMessageId:n.weavyMessageId},(function(){console.debug("message-receipt received",n.weavyMessageId,n.name),clearTimeout(s),i.resolve()}));try{e.postMessage(n,o,r)}catch(e){i.reject(e)}}))):i.reject(new Error("postMessage() Invalid window origin: "+o+", "+n.name)),i()}window.addEventListener("message",(function(e){if(e.data.name&&void 0!==e.data.weavyId){if(e.data.weavyMessageId&&"message-receipt"!==e.data.name&&"unready"!==e.data.name){console.debug("sending message receipt",e.data.weavyMessageId,e.data.name);try{e.source.postMessage({name:"message-receipt",weavyId:e.data.weavyId,weavyMessageId:e.data.weavyMessageId},e.origin)}catch(e){console.error("could not post back message-receipt to source")}}switch(e.data.name){case"register-child":if(o.has(e.source)||console.warn("register-child: contentwindow not pre-registered"),s.get(e.source)!==e.origin)return void console.error("register-child: "+a.get(e.source)+" has invalid origin",e.origin);try{var t=o.get(e.source),n=a.get(e.source);n&&e.source.postMessage({name:"register-window",windowName:n,weavyId:t||!0},e.origin)}catch(e){console.error("could not register frame window",t,n,e)}break;case"ready":i.has(e.data.weavyId)&&a.has(e.source)&&i.get(e.data.weavyId).get(a.get(e.source))&&(l.set(e.source,e.origin),p(e));break;case"unready":i.has(e.data.weavyId)&&p(e,!0);break;default:(e.source===window||i.size)&&p(e)}}})),this.on=f,this.one=function(e,t,r){"function"==typeof arguments[1]&&(r=arguments[1],t=null),n.push({name:e,handler:r,selector:t,once:!0})},this.off=g,this.registerContentWindow=function(e,t,n,l){try{if(!t)return void console.error("registerContentWindow() No valid contentWindow to register, must be a window and have a name.")}catch(e){console.error("registerContentWindow() cannot access contentWindowName")}e.self&&(e=e.self),n&&"true"!==n||(n=!0),i.has(n)||i.set(n,new Map),i.get(n).set(t,e),r.add(e),a.set(e,t),o.set(e,n),s.set(e,l)},this.unregisterContentWindow=m,this.unregisterAll=function(e){i.has(e)&&(i.get(e).forEach((function(t,n){m(n,e)})),i.get(e),i.delete(e))},this.postToFrame=function(e,t,n,r){if("object"==typeof n&&n.name){var s;try{s=i.get(t).get(e)}catch(n){console.error("postToFrame() Window not registered",t,e)}return n.weavyId=t,v(s,n,r)}console.error("postToFrame() Invalid message format",n)},this.postToSelf=function(e,t){if("object"==typeof e&&e.name)return e.weavyId=e.weavyId||!0,v(window.self,e,t);console.error("postToSelf() Invalid message format",e)},this.postToSource=function(e,t,n){if(e.source&&void 0!==e.data.weavyId){var r=e.source===window.self&&e.origin===d,i=s.has(e.source)&&e.origin===s.get(e.source);if(null===n&&(n=void 0),r||i){t.weavyId=e.data.weavyId;try{e.source.postMessage(t,e.origin,n)}catch(e){console.error("postToSource() Could not post message back to source")}}}},this.postToChildren=function(e,t){"object"==typeof e&&e.name?(null===t&&(t=void 0),e.distributeName=e.name,e.name="distribute",e.weavyId=e.weavyId||!0,r.forEach((function(n){if(s.get(n)===l.get(n))try{n.postMessage(e,s.get(n),t)}catch(e){console.warn("postToChildren() could not distribute message to "+a.get(n))}}))):console.error("postToChildren() Invalid message format",e)},this.whenLeader=function(){return c()},Object.defineProperty(this,"isLeader",{get:function(){return u}}),"pending"===c.state()&&(u=!0,c.resolve(u))}window.addEventListener("unhandledrejection",(function(e){e.promise.weavy&&e.preventDefault()})),WeavyPromiseWrapper.resolve=function(e){var t=WeavyPromiseWrapper();return t.resolve(e),t},WeavyPromiseWrapper.reject=function(e){var t=WeavyPromiseWrapper();return t.reject(e),t};var WeavyPostal$1=new WeavyPostal;const FileBrowser=({onFileAdded:e})=>{const{options:t}=React.useContext(WeavyContext),[n,r]=React.useState(!1),[i,s]=React.useState(!1),[a,o]=React.useState(""),l=useMutateExternalBlobs(),c=(null==t?void 0:t.filebrowserUrl)||"",u=React.useCallback((e=>{null!==e&&null!=e.contentWindow&&WeavyPostal$1.registerContentWindow(e.contentWindow.self,"weavy-filebrowser","wy-filebrowser",new URL(c).origin)}),[]);React.useEffect((()=>{var e="";try{window.location.ancestorOrigins&&0<window.location.ancestorOrigins.length?e=window.location.ancestorOrigins[window.location.ancestorOrigins.length-1]:window.top&&(e=window.top.document.location.origin)}catch(e){}if(!e)try{e=window.self.document.location.origin}catch(e){console.error("Filebrowser: Could not read current origin.")}const t=c+"?origin="+e+"&v=X&t="+Date.now().toString()+"&weavyId=wy-filebrowser";return o(t),WeavyPostal$1.on("add-external-blobs",d),WeavyPostal$1.on("request:file-browser-close",h),()=>{WeavyPostal$1.off("add-external-blobs",d),WeavyPostal$1.off("request:file-browser-close",h)}}),[e]);const d=(t,n)=>__awaiter(void 0,void 0,void 0,(function*(){var t=yield l.mutateAsync({blobs:n.blobs});e(t),p()})),h=()=>{p()},p=()=>{r(!1),s(!1)};return React.createElement(React.Fragment,null,(null==t?void 0:t.enableCloudFiles)&&React.createElement(React.Fragment,null,React.createElement(UIButton.UI,{onClick:()=>{r(!0)},title:"Add file from cloud"},React.createElement(UIIcon.UI,{name:"cloud"})),React.createElement(UIOverlay.UI,{isOpen:n,className:"wy-modal wy-panel wy-loaded"},!i&&React.createElement(UISpinner.UI,{overlay:!0}),React.createElement("iframe",{ref:u,onLoad:()=>{s(!0)},src:a,className:"wy-panel-frame",id:"weavy-filebrowser",name:"weavy-filebrowser"}))))},ConversationForm=({conversationId:e,handleInsert:t})=>{const[n,r]=React.useState(""),[i,s]=React.useState(""),[a,o]=React.useState(0),[l,c]=React.useState(1),[u,d]=React.useState(!1),h=useQueryClient(),[p,f]=React.useState([]),[g,m]=React.useState([]),[v,y]=React.useState(!1),b=useMutateTyping(),_=React.useRef(null);let w;const{mutateAsync:E,isSuccess:S}=useFileUploader((e=>{ReactDOM.flushSync((()=>{e.status&&200!==e.status?y(e.detail):f([...p,e[0]])}))}));React.useEffect((()=>{let t=h.getQueryData(["form-text",e])||"";r(t);let n=h.getQueryData(["form-attachments",e])||[];f(n)}),[e]),React.useEffect((()=>{h.setQueryData(["form-attachments",e],p)}),[p]),React.useEffect((()=>{x()}),[n]);const C=i=>{("keydown"!==i.type||"Enter"===i.key&&i.ctrlKey)&&(i.preventDefault(),i.stopPropagation(),""===n&&0===p.length&&0===g.length||(t(n,p,g),r(""),s(""),f([]),m([]),h.setQueryData(["form-text",e],""),h.setQueryData(["form-attachments",e],[])))},A=(e,t)=>{s(""),f(p.filter((t=>t.id!==e)))},P=(e,t)=>{m(g.filter((t=>t.id!==e)))},x=()=>{if(_.current&&_.current.parentNode){_.current.parentNode.dataset.replicatedValue=_.current.value}};return React.createElement("form",{className:"wy-message-form"},v&&React.createElement("div",null,v),(u||p.length>0||g.length>0)&&React.createElement("div",null,u&&React.createElement("div",null,"Now uploading (",l," of ",a,") selected files"),React.createElement("div",{className:"wy-picker-list"},p.map((e=>{let{icon:t}=getIcon(e.name);return React.createElement("div",{key:e.id,className:"wy-picker-list-item"},React.createElement(File,{id:e.id,name:e.name,className:"wy-picker-list-item-title",icon:t}),React.createElement(UIButton.UI,{onClick:A.bind(ConversationForm,e.id)},React.createElement(UIIcon.UI,{name:"close-circle"})))})),g.map((e=>React.createElement("div",{key:e.id,className:"wy-picker-list-item"},React.createElement(Meeting,{id:e.id,title:e.provider,className:"wy-picker-list-item-title"}),React.createElement(UIButton.UI,{onClick:P.bind(ConversationForm,e.id)},React.createElement(UIIcon.UI,{name:"close-circle"}))))))),React.createElement("div",{className:"wy-message-editor-inputs"},React.createElement("div",{className:"wy-message-editor-buttons"},React.createElement("input",{type:"file",ref:e=>w=e,value:i,onChange:e=>__awaiter(void 0,void 0,void 0,(function*(){y(!1),s(e.target.value),o(e.target.files.length),d(!0);for(var t=0;t<e.target.files.length;t++){c(t+1);const n=e.target.files[t];yield E({request:{file:n}})}d(!1)})),multiple:!0,hidden:!0,tabIndex:-1}),React.createElement(UIButton.UI,{title:"Upload attachment",onClick:e=>{null==w||w.click()}},React.createElement(UIIcon.UI,{name:"attachment"})),React.createElement(Meetings,{onMeetingAdded:e=>{g.length>0||m([...g,e])}}),React.createElement(FileBrowser,{onFileAdded:e=>{f([...p,...e])}})),React.createElement("div",{className:"wy-message-editor-text wy-message-editor-grow"},React.createElement("textarea",{rows:1,ref:_,className:"wy-message-editor-textfield wy-message-editor-textcontent",value:n,onChange:t=>{h.setQueryData(["form-text",e],t.target.value),r(t.target.value)},onKeyDown:C,onKeyPress:useThrottle((()=>{b.mutate({id:e})}),4e3)})),React.createElement("div",{className:"wy-message-editor-buttons"},React.createElement(UIButton.UI,{type:"button",onClick:C},React.createElement(UIIcon.UI,{color:"primary",name:"send"})))))};function useMutateRead(){const{client:e}=React.useContext(WeavyContext),t=useQueryClient();if(!e)throw new Error("useMutateUnread must be used within an WeavyProvider");return useMutation((({id:t,read:n,messageId:r})=>__awaiter(this,void 0,void 0,(function*(){const i=n?`/api/conversations/${t}/read?messageId=${r}`:`/api/conversations/${t}/read`;return(yield e.post(i,n?"PUT":"DELETE","")).json()}))),{onSuccess:()=>{t.invalidateQueries("conversations")}})}function useMutateMessage(){const{client:e}=React.useContext(WeavyContext),t=useQueryClient();if(!e)throw new Error("useMutateMessage must be used within an WeavyProvider");return useMutation((({id:t,text:n,userId:r,attachments:i,meetings:s})=>__awaiter(this,void 0,void 0,(function*(){return(yield e.post("/api/apps/"+t+"/messages","POST",JSON.stringify({text:n,blobs:i.map((e=>e.id)),meeting_id:s.length>0?s[0].id:null}))).json()}))),{onSuccess:(e,n,r)=>{var i;const s=t.getQueryData(["messages",n.id]);if(s&&s.pages){const a=null!==(i=s.pages.map(((t,n)=>(0===n&&(t.data=[...t.data.filter((e=>e.id!==r.tempId)),e]),t))))&&void 0!==i?i:[];t.setQueryData(["messages",n.id],(e=>({pages:a,pageParams:e.pageParams})))}t.invalidateQueries("conversations")},onMutate:e=>__awaiter(this,void 0,void 0,(function*(){yield t.cancelQueries(["messages",e.id]);const n=t.getQueryData(["messages",e.id]),r=Math.random();if(n&&n.pages.length>0){var i=n.pages[0];let s=[...i.data||[],{id:r,text:e.text,html:e.text,display_name:"",temp:!0,parent_id:null,created_by:{id:e.userId},created_at:(new Date).toUTCString(),attachments:[],reactions:[],reactions_count:0}];i.data=s,t.setQueryData(["messages",e.id],(e=>{let t=[i];return(null==e?void 0:e.pages.length)>1&&(t=[i,...null==e?void 0:e.pages.slice(1)]),{pages:t,pageParams:null==e?void 0:e.pageParams}}))}return{tempId:r}}))})}const Messages=({id:e,members:t,displayName:n,avatarUrl:r,lastMessageId:i,chatRoom:s})=>{var a;const{user:o}=React.useContext(UserContext),l=useQueryClient(),{client:c}=React.useContext(WeavyContext),u=React.useRef(),d=React.useRef(),[h,p]=React.useState(),{dispatch:f,on:g,events:m}=useEvents(),{isLoading:v,isError:y,data:b,error:_,fetchNextPage:w,hasNextPage:E,isFetching:S,isFetchingNextPage:C}=useMessages(e,{}),A=useMutateRead(),P=useMutateMessage();React.useLayoutEffect((()=>(e&&!v?(scrollParentToBottom(d.current),requestAnimationFrame((()=>requestAnimationFrame((()=>scrollParentToBottom(d.current))))),null==a||a.disconnect(),a=createReverseScroller(u.current,(()=>{if(E)return w().then((()=>new Promise((e=>p(e)))))}))):(null==a||a.disconnect(),a=null),()=>{null==a||a.disconnect(),a=null})),[e,v]),React.useLayoutEffect((()=>{!C&&h&&(h(),p(null))}),[b]),React.useEffect((()=>{e&&i&&A.mutate({id:e,read:!0,messageId:i})}),[e,i]),React.useEffect((()=>(e&&(null==c||c.subscribe(`a${e}`,"message_created",M),null==c||c.subscribe(`a${e}`,"conversation_marked",T),null==c||c.subscribe(`a${e}`,"reaction_added",x),null==c||c.subscribe(`a${e}`,"reaction_removed",R)),()=>{if(e){l.getQueryData(["messages",e])&&l.setQueryData(["messages",e],(e=>({pages:null==e?void 0:e.pages.slice(0,1),pageParams:[void 0]}))),null==c||c.unsubscribe(`a${e}`,"message_created",M),null==c||c.unsubscribe(`a${e}`,"conversation_marked",T),null==c||c.unsubscribe(`a${e}`,"reaction_added",x),null==c||c.unsubscribe(`a${e}`,"reaction_removed",R)}})),[e]);const x=React.useCallback((e=>{f("reaction_added_"+e.entity.id,e)}),[e]),R=React.useCallback((e=>{f("reaction_deleted_"+e.entity.id,e)}),[e]),T=t=>__awaiter(void 0,void 0,void 0,(function*(){let t=isParentAtBottom(u.current);l.invalidateQueries(["members",e]),t&&requestAnimationFrame((()=>scrollParentToBottom(u.current,!0)))})),M=React.useCallback((t=>{var n;if(t.message.app_id!==e||t.message.created_by_id===o.id)return;t.message.created_by=t.actor,A.mutate({id:e,read:!0,messageId:t.message.id});const r=l.getQueryData(["messages",e]);if(r&&r.pages){let i=isParentAtBottom(u.current);const s=null!==(n=r.pages.map(((e,n)=>(0===n&&(e.data=[...e.data,t.message]),e))))&&void 0!==n?n:[];l.setQueryData(["messages",e],(e=>({pages:s,pageParams:e.pageParams}))),i&&requestAnimationFrame((()=>requestAnimationFrame((()=>scrollParentToBottom(u.current,!0)))))}}),[e]);let L=React.createElement("div",{className:"wy-avatar-header"},r&&n&&React.createElement(Avatar,{src:r,name:n,id:e,size:128})||"",n&&React.createElement("div",{className:"wy-headline"},n)||""),I=React.createElement(UIButton.UI,{onClick:()=>w(),disabled:!E||C,className:"wy-message-readmore"},"Load more"),k=React.createElement(React.Fragment,null,React.createElement("div",{className:"wy-message-readmore",ref:u},C?"Loading more...":E?I:L),b&&t&&b.pages&&b.pages.map(((n,r)=>{var i;return React.createElement(React.Fragment,{key:b.pages.length-r},null===(i=n.data)||void 0===i?void 0:i.map((n=>React.createElement(Message,{key:n.id,id:n.id,html:n.html,temp:n.temp,me:n.created_by.id===o.id,avatar:n.created_by.avatar_url,name:n.created_by.display_name,created_at:n.created_at,created_by:n.created_by.display_name,attachments:n.attachments,meeting:n.meeting,parentId:e,reactions:n.reactions,chatRoom:s,seenBy:t.data&&t.data.length>0?t.data.filter((e=>e.marked_id===n.id&&e.id!==o.id)):[]}))))})),React.createElement("div",{ref:d}));return v&&(k=React.createElement("div",null,"Loading messages...")),React.createElement(React.Fragment,null,React.createElement("div",{id:"container",className:"wy-messages"},k),React.createElement("div",{className:"wy-footerbar wy-footerbar-sticky wy-message-editor wy-message-editor-bottom"},React.createElement(ConversationForm,{key:e,conversationId:e,handleInsert:(t,n,r)=>{P.mutate({id:e,text:t,userId:o.id,attachments:n,meetings:r},{onSuccess:t=>{A.mutate({id:e,read:!0,messageId:t.id}),requestAnimationFrame((()=>scrollParentToBottom(d.current,!0)))}}),requestAnimationFrame((()=>scrollParentToBottom(u.current,!0)))}})))},Conversation=({id:e,showBackButton:t})=>{var n;const r=useQueryClient(),{client:i}=React.useContext(WeavyContext),{selectedConversationId:s,setSelectedConversationId:a}=React.useContext(MessengerContext),{user:o}=React.useContext(UserContext),[l,c]=React.useState(!1),[u,d]=React.useState(!1),[h,p]=React.useState(""),[f,g]=React.useState(!1),m="edb400ac-839b-45a7-b2a8-6a01820d1c44";if(!i)throw new Error("Weavy Conversation component must be used within an WeavyProvider");const{isLoading:v,data:y}=useConversation(s,{enabled:null!=s}),{isLoading:b,data:_}=useMembers(s,{enabled:null!=s}),w=useMutateMembers(),E=useMutateConversationName(),S=useMutateRemoveMembers(),C=React.useCallback((e=>{e.app.id===s&&r.invalidateQueries(["conversation",s])}),[s]),A=e=>{c(e)},P=e=>{d(e)};return React.useEffect((()=>{e&&a(e)}),[e]),React.useEffect((()=>(s&&i.subscribe(`a${s}`,"app_updated",C),()=>{s&&i.unsubscribe(`a${s}`,"app_updated",C)})),[s]),React.useEffect((()=>{y&&y.type===m&&p(null==y?void 0:y.display_name),!y||y.type!==m&&"d65dd4bc-418e-403c-9f56-f9cf4da931ed"!==y.type||g(!0)}),[y]),React.createElement(React.Fragment,null,React.createElement("header",{className:"wy-appbars","data-adjust-scrollbar-top":!0},React.createElement("nav",{className:"wy-appbar"},React.createElement("div",null,t&&React.createElement(UIButton.UI,{onClick:()=>{a(null)}},React.createElement(UIIcon.UI,{name:"back"}))),s&&y&&React.createElement(React.Fragment,null,React.createElement("div",{className:"wy-appbar-text"},React.createElement(Typing$1,{id:s,context:"conversation"},y.display_name)),React.createElement(UIDropdown.UI,{directionX:"left"},React.createElement(UIDropdown.Item,{onClick:()=>P(!0)},"Details"),y.type===m&&React.createElement(React.Fragment,null,React.createElement(UIDropdown.Item,{onClick:()=>A(!0)},"Add people"),React.createElement(UIDropdown.Item,{onClick:()=>{S.mutate({id:s,members:[o.id]})}},"Leave conversation")))))),!s&&React.createElement("div",{className:"wy-avatar-header"},React.createElement(Avatar,{src:o.avatar_url,name:o.display_name,presence:o.presence,id:o.id,size:256}),React.createElement("h2",{className:"wy-title"},"Welcome ",o.name,"!"),"Create or select a conversation to get started"),s&&_&&y&&React.createElement(Messages,{id:s,chatRoom:f,members:_,displayName:null==y?void 0:y.display_name,avatarUrl:null==y?void 0:y.avatar_url,lastMessageId:null===(n=null==y?void 0:y.last_message)||void 0===n?void 0:n.id}),React.createElement(UIOverlay.UI,{isOpen:l,className:"wy-modal"},React.createElement("header",{className:"wy-appbars","data-adjust-scrollbar-top":!0},React.createElement("nav",{className:"wy-appbar"},React.createElement(UIButton.UI,{onClick:()=>A(!1)},React.createElement(UIIcon.UI,{name:"close"})),React.createElement("div",{className:"wy-appbar-text"},"Add people"))),React.createElement(SearchUsers,{handleSubmit:e=>__awaiter(void 0,void 0,void 0,(function*(){const t=e.map((e=>e.id));yield w.mutateAsync({id:s,members:t}),c(!1)})),buttonTitle:"Add selected"})),React.createElement(UIOverlay.UI,{isOpen:u,className:"wy-modal"},React.createElement("header",{className:"wy-appbars"},React.createElement("nav",{className:"wy-appbar"},React.createElement(UIButton.UI,{onClick:()=>P(!1)},React.createElement(UIIcon.UI,{name:"close"})),React.createElement("div",{className:"wy-appbar-text"},"Conversation details"))),React.createElement("div",{className:"wy-scroll-y"},y&&React.createElement("div",{className:"wy-avatar-header"},React.createElement(Avatar,{src:null==y?void 0:y.avatar_url,name:h,size:128}),(null==y?void 0:y.type)!==m&&React.createElement("h3",{className:"wy-headline"},null==y?void 0:y.display_name)),(null==y?void 0:y.type)===m&&React.createElement(React.Fragment,null,React.createElement("div",{className:"wy-pane-group"},React.createElement("input",{className:"wy-input",value:h,onChange:e=>(e=>{p(e.target.value),E.mutate({id:s,name:e.target.value})})(e)})),React.createElement("div",{className:"wy-pane-group"},React.createElement("table",{className:"wy-table wy-search-result-table"},React.createElement("tbody",null,_&&_.data&&_.data.map((e=>React.createElement("tr",{key:e.id},React.createElement("td",{className:"wy-table-cell-icon wy-search-result-table-icon"},React.createElement(Avatar,{src:e.avatar_url,name:e.display_name,id:e.id,size:24,presence:e.presence})),React.createElement("td",{className:"wy-table-cell-text"},e.display_name)))))))))))};var Conversation$1=React.memo(Conversation);function useConversations(e){const{client:t}=React.useContext(WeavyContext);if(!t)throw new Error("useConversations must be used within an WeavyProvider");return useInfiniteQuery("conversations",(e=>__awaiter(this,void 0,void 0,(function*(){let n=e.pageParam||0;const r=yield t.get("/api/conversations?contextual=false&skip="+n+"&top=25");return yield r.json()}))),Object.assign(Object.assign({},e),{getNextPageParam:(e,t)=>{if((null==e?void 0:e.end)<(null==e?void 0:e.count))return 25*t.length}}))}function useMutatePinned(){const{client:e}=React.useContext(WeavyContext),t=useQueryClient();if(!e)throw new Error("useMutatePinned must be used within an WeavyProvider");return useMutation((({id:t,pin:n})=>__awaiter(this,void 0,void 0,(function*(){return(yield e.post("/api/conversations/"+t+"/pin",n?"PUT":"DELETE","")).json()}))),{onSuccess:()=>{t.invalidateQueries("conversations")}})}const ConversationListItem=({item:e,refetchConversations:t})=>{var n,r,i,s,a,o,l;const{client:c}=React.useContext(WeavyContext),{setSelectedConversationId:u,selectedConversationId:d}=React.useContext(MessengerContext),{user:h}=React.useContext(UserContext),p=useMutateRead(),f=useMutatePinned(),g=useMutateRemoveMembers(),m=dayjs.utc(null===(n=e.last_message)||void 0===n?void 0:n.created_at).tz(dayjs.tz.guess()),v=(null===(r=e.last_message)||void 0===r?void 0:r.html)||"",y=/title=\"(:[^:\s]+:)\"/,b={};null===(i=v.match(/<img[^>]+wy-emoji.+>/g))||void 0===i||i.forEach((e=>{let t=e.match(y)[1];t&&(b[t]=e)}));const _=((null===(s=e.last_message)||void 0===s?void 0:s.text)||"").replace(/:[^:\s]*(?:::[^:\s]*)*:/gi,(e=>b[e])),w="edb400ac-839b-45a7-b2a8-6a01820d1c44",E=React.useCallback((n=>{n.app.id===e.id&&t()}),[e.id]),S=React.useCallback((n=>{n.message.app_id===e.id&&t()}),[e.id]),C=React.useCallback((n=>{n.app.id===e.id&&t()}),[e.id]);React.useEffect((()=>(null==c||c.subscribe(`a${e.id}`,"app_updated",E),null==c||c.subscribe(`a${e.id}`,"message_created",S),null==c||c.subscribe(`a${e.id}`,"member_added",C),()=>{null==c||c.unsubscribe(`a${e.id}`,"app_updated",E),null==c||c.unsubscribe(`a${e.id}`,"message_created",S),null==c||c.unsubscribe(`a${e.id}`,"member_added",C)})),[e.id]);const A=e.type!==w?e.member_ids.find((e=>e!=h.id)):null,P=t=>{t.preventDefault(),f.mutate({id:e.id,pin:!1})};return React.createElement("div",{className:classNames("wy-item wy-item-lg wy-item-hover wy-conversation",{"wy-unread":e.is_unread,"wy-active":d===e.id}),key:e.id,onClick:t=>((e,t)=>{e.defaultPrevented||(e.preventDefault(),u(t))})(t,e.id)},React.createElement(Avatar,{src:e.avatar_url,id:A||-1,presence:e.type!==w?"away":"",name:e.display_name}),React.createElement("div",{className:"wy-item-body"},React.createElement("div",{className:"wy-item-row"},React.createElement("div",{className:"wy-item-title"},e.display_name),e.last_message&&React.createElement("time",{className:"wy-meta",dateTime:e.last_message.created_at.toString(),title:m.format("LLLL")},m.fromNow())),React.createElement("div",{className:"wy-item-row"},React.createElement("div",{className:"wy-item-text"},React.createElement(Typing$1,{id:e.id,context:"listitem"},_&&React.createElement("span",{className:"wy-typing-hide",dangerouslySetInnerHTML:{__html:_}}),!_&&React.createElement("span",{className:"wy-typing-hide"},(null===(o=null===(a=e.last_message)||void 0===a?void 0:a.attachment_ids)||void 0===o?void 0:o.length)>0&&React.createElement(UIIcon.UI,{name:"attachment",size:1}),(null===(l=e.last_message)||void 0===l?void 0:l.meeting_id)&&React.createElement(UIIcon.UI,{name:"zoom",size:1})))))),React.createElement("div",{className:"wy-item-actions wy-item-actions-bottom"},e.is_pinned&&React.createElement(UIButton.UI,{onClick:P},React.createElement(UIIcon.UI,{name:"pin",size:1/1.5})),React.createElement(UIDropdown.UI,{directionX:"left"},React.createElement(React.Fragment,null,e.is_unread&&React.createElement(UIDropdown.Item,{onClick:t=>{t.preventDefault(),p.mutate({id:e.id,read:!0,messageId:e.last_message.id})}},"Mark as read"),!e.is_unread&&React.createElement(UIDropdown.Item,{onClick:t=>{t.preventDefault(),p.mutate({id:e.id,read:!1,messageId:null})}},"Mark as unread")),React.createElement(React.Fragment,null,e.is_pinned&&React.createElement(UIDropdown.Item,{onClick:P},"Unpin"),!e.is_pinned&&React.createElement(UIDropdown.Item,{onClick:t=>{t.preventDefault(),f.mutate({id:e.id,pin:!0})}},"Pin")),e.type===w&&React.createElement(UIDropdown.Item,{onClick:()=>{g.mutate({id:e.id,members:[h.id]})}},"Leave conversation"))))};function useMutateConversation(){const{client:e}=React.useContext(WeavyContext),t=useQueryClient();if(!e)throw new Error("useMutateConversation must be used within an WeavyProvider");return useMutation((({members:t})=>__awaiter(this,void 0,void 0,(function*(){return(yield e.post("/api/conversations/","POST",JSON.stringify({members:t}))).json()}))),{onSuccess:()=>{t.invalidateQueries("conversations")}})}const NewConversation=()=>{const[e,t]=React.useState(!1),n=useMutateConversation();return React.createElement(React.Fragment,null,React.createElement(UIButton.UI,{onClick:()=>{t(!0)}},React.createElement(UIIcon.UI,{name:"plus"})),React.createElement(UIOverlay.UI,{isOpen:e,className:"wy-modal"},React.createElement("header",{className:"wy-appbars","data-adjust-scrollbar-top":!0},React.createElement("nav",{className:"wy-appbar"},React.createElement(UIButton.UI,{onClick:()=>{t(!1)}},React.createElement(UIIcon.UI,{name:"close"})),React.createElement("div",{className:"wy-appbar-text"},"Create conversation"))),React.createElement(SearchUsers,{handleSubmit:e=>__awaiter(void 0,void 0,void 0,(function*(){const r=e.map((e=>e.id));yield n.mutateAsync({members:r}),t(!1)})),buttonTitle:"Next"})))};var NewConversation$1=React.memo(NewConversation);const ConversationList=()=>{const{client:e}=React.useContext(WeavyContext),{user:t}=React.useContext(UserContext),{data:n,isLoading:r,refetch:i,fetchNextPage:s,hasNextPage:a,isFetchingNextPage:o}=useConversations({}),l=React.useRef(),[c,u]=React.useState();let d;if(!e)throw new Error("Weavy ConversationList component must be used within an WeavyProvider");React.useLayoutEffect((()=>(r||(null==d||d.disconnect(),d=createScroller(l.current,(()=>{if(a)return s().then((()=>new Promise((e=>u(e)))))}))),()=>{null==d||d.disconnect(),d=null})),[r]),React.useLayoutEffect((()=>{!o&&c&&(c(),u(null))}),[n]),React.useEffect((()=>(e.subscribe(null,"app_created",h),e.subscribe(null,"member_added",h),()=>{e.unsubscribe(null,"app_created",h),e.unsubscribe(null,"member_added",h)})),[]);const h=e=>{i()};if(r)return React.createElement("div",null,"Loading Conversation list...");let p=React.createElement(UIButton.UI,{onClick:()=>s(),disabled:!a||o,className:"wy-message-readmore"},"Load more");return React.createElement(React.Fragment,null,React.createElement("header",{className:"wy-appbars","data-adjust-scrollbar-top":!0},React.createElement("nav",{className:"wy-appbar"},React.createElement(Avatar,{src:t.avatar_url,name:t.display_name,presence:t.presence,id:t.id,size:24}),React.createElement("div",null,"Messenger"),React.createElement(NewConversation$1,null))),React.createElement("div",{className:"wy-conversations"},n&&n.pages&&n.pages.map(((e,t)=>{var n;return null===(n=e.data)||void 0===n?void 0:n.map((e=>React.createElement(ConversationListItem,{key:e.id,refetchConversations:i,item:e})))})),React.createElement("div",{className:"wy-message-readmore",ref:l},o?"Loading more...":a?p:"")))},Messenger=({className:e})=>{const{client:t}=React.useContext(WeavyContext);if(!t)throw new Error("Weavy Messenger component must be used within an WeavyProvider");return React.createElement(MessengerProvider,null,React.createElement("div",{className:classNames("wy-messenger-provider",e)},React.createElement("div",{className:"wy-messenger-sidebar wy-scroll-y"},React.createElement(ConversationList,null)),React.createElement("div",{className:"wy-messenger-conversation wy-scroll-y"},React.createElement(Conversation$1,{id:null}))))};function useBadge(){const{client:e}=React.useContext(WeavyContext);if(!e)throw new Error("useBadge must be used within an WeavyProvider");return useQuery("badge",(()=>__awaiter(this,void 0,void 0,(function*(){const t=yield e.get("/api/conversations/badge");if(t.ok){return yield t.json()}return null}))))}const ConversationBadge=()=>{const{client:e}=React.useContext(WeavyContext),[t,n]=React.useState(0);if(!e)throw new Error("Weavy Badge component must be used within an WeavyProvider");const{isLoading:r,data:i,refetch:s}=useBadge(),a=e=>{s()};return React.useEffect((()=>{i&&n(i.private+i.rooms)}),[i]),React.useEffect((()=>(e.subscribe(null,"message_created",a),e.subscribe(null,"conversation_marked",a),()=>{e.unsubscribe(null,"message_created",a),e.unsubscribe(null,"conversation_marked",a)})),[]),React.createElement(React.Fragment,null,!r&&t>0&&React.createElement("span",{className:"wy-badge wy-badge-danger"},t))};function useChat(e,t){const{client:n}=React.useContext(WeavyContext);if(!n)throw new Error("useChat must be used within an WeavyProvider");return useQuery(["chat",e],(()=>__awaiter(this,void 0,void 0,(function*(){const t=yield n.get("/api/apps/"+e);return yield t.json()}))),t)}const Chat=({uid:e,className:t})=>{var n;const{client:r}=React.useContext(WeavyContext),[i,s]=React.useState(null);if(!r)throw new Error("Weavy Chat component must be used within an WeavyProvider");const{isLoading:a,data:o}=useChat(e,{}),{isLoading:l,data:c}=useMembers(i,{enabled:null!=i}),{isLoading:u,data:d}=useConversation(i,{enabled:null!=i});return React.useEffect((()=>{s(o?o.id:null)}),[o]),React.createElement("div",{className:classNames("wy-messenger-conversation wy-scroll-y",t)},React.createElement("header",{className:"wy-appbars","data-adjust-scrollbar-top":!0},React.createElement("nav",{className:"wy-appbar"},React.createElement("div",null),i&&d&&React.createElement("div",{className:"wy-appbar-text"},React.createElement(Typing$1,{id:i,context:"conversation"},d.display_name)))),!a&&!o&&React.createElement("div",null,"No chat with the contextual id ",React.createElement("strong",null,e)),i&&c&&o&&React.createElement(Messages,{id:i,chatRoom:!0,members:c,lastMessageId:null===(n=o.last_message)||void 0===n?void 0:n.id}))};exports.Button=UIButton,exports.Chat=Chat,exports.Conversation=Conversation$1,exports.ConversationBadge=ConversationBadge,exports.ConversationList=ConversationList,exports.Dropdown=UIDropdown,exports.Icon=UIIcon,exports.Messenger=Messenger,exports.MessengerContext=MessengerContext,exports.MessengerProvider=MessengerProvider,exports.Overlay=UIOverlay,exports.WeavyClient=WeavyClient,exports.WeavyContext=WeavyContext,exports.WeavyProvider=WeavyProvider;
61
39
  //# sourceMappingURL=index.js.map