@bimdata/viewer 2.6.0-beta.10 → 2.6.0-beta.11

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.
@@ -1625,7 +1625,7 @@ Fragment shader:
1625
1625
  --bimdata-local-context-width: ${r.width}px;
1626
1626
  --bimdata-local-context-center-width: ${r.centerWidth}px;
1627
1627
  --bimdata-local-context-resolution: ${r.resolution};
1628
- `),onMouseenter:e[0]||(e[0]=(...u)=>r.onMouseEnter&&r.onMouseEnter(...u)),onMouseleave:e[1]||(e[1]=(...u)=>r.onMouseLeave&&r.onMouseLeave(...u))},[F(n,{ref:"modalManagerTemplateRef"},null,512),b("div",dbi,[r.windowPlugins.leftSidePanel?(x(),W(a,{key:0,plugin:r.windowPlugins.leftSidePanel},null,8,["plugin"])):pe("",!0),b("div",Abi,[(x(!0),U(pt,null,jt(r.windowPlugins.free,u=>(x(),W(l,{key:u.name,class:fe({"window-container__content__center__viewer":u.isViewer}),plugin:u},null,8,["class","plugin"]))),128)),F(c,{position:"left",plugins:r.windowPlugins.leftButtonColumn},null,8,["plugins"]),F(c,{position:"right",plugins:r.windowPlugins.rightButtonColumn},null,8,["plugins"])]),r.windowPlugins.rightSidePanel?(x(),W(a,{key:1,plugin:r.windowPlugins.rightSidePanel},null,8,["plugin"])):pe("",!0)]),r.loading?(x(),U("div",ubi,[r.spinner&&r.spinner.component?(x(),W(ro(r.spinner.component),GA(Ma({key:0},r.spinner.props)),null,16)):(x(),W(d,{key:1,size:"20px",border:"3px"}))])):pe("",!0),r.layoutSettingsDisplayed?(x(),U("div",hbi,[F(A)])):pe("",!0)],36)}const gbi=V(cbi,[["render",pbi]]);let fbi=class{constructor(t=!0){const e=nwi(MX,null,{resizable:t});e.registerContent("default",gbi),this.settings=ka({edit:!1,swap:!1,full:!1}),this.areas=e}get resizable(){return this.areas.resizable}set resizable(t){this.areas.resizable=t}apply(t=null){this.areas.layout=t?swi(t):null}copy(t,e=!0){return awi(this.areas.layout,t,e)}open({ratio:t,direction:e,insertAfter:i,windowName:r=null,windowState:o=null,localContextId:s=null}={}){const n=r?{options:{windowName:r,windowState:o}}:null;return s===null?this.areas.splitLayout(t,e,i,n):this.areas.split(s,t,e,i,n)}swap(t,e){return this.areas.swap(t,e)}close(t){return this.areas.delete(t)}compare(t,e){var i,r;if(!t&&!e)return!0;if(!t||!e)return!1;if(typeof t=="string"&&typeof e=="string")return t===e;if(typeof t=="string"||typeof e=="string")return!1;if(t.windowName&&e.windowName){if(t.windowName!==e.windowName)return!1;const o=new Set((i=t.windowState)==null?void 0:i.modelIds),s=new Set((r=e.windowState)==null?void 0:r.modelIds);return o.size===s.size&&[...o].every(n=>s.has(n))}return t.windowName||e.windowName||t.direction!==e.direction||t.children.length!==e.children.length?!1:t.children.every((o,s)=>this.compare(o,e.children[s]))}};const mbi="@bimdata/viewer",vbi="module",Cbi="2.6.0-beta.10",ybi="A customizable BIM viewer.",Ibi=["bim","viewer","bimdata","ifc","bcf"],wbi="./index.d.ts",bbi="BIMData.io",Bbi="https://developers.bimdata.io/viewer/index.html",Ebi={email:"support@bimdata.io"},kbi=["last 2 chrome version","last 2 firefox version"],xbi="dist/bimdata-viewer.esm.min.js",Qbi="dist/bimdata-viewer.esm.min.js",Mbi={dev:"vite -c build/vite.config.dev.js",build:"node scripts/build.mjs","build:prod":"vite build -c build/vite.config.prod.js && esbuild dist/bimdata-viewer.esm.min.js --minify --outfile=dist/bimdata-viewer.esm.min.js --allow-overwrite","build:offline":"vite build -c build/vite.config.offline.js && esbuild dist/bimdata-viewer.offline.esm.min.js --minify --outfile=dist/bimdata-viewer.offline.esm.min.js --allow-overwrite","build:runtime":"vite build -c build/vite.config.runtime.js && esbuild dist/bimdata-viewer.runtime.esm.min.js --minify --outfile=dist/bimdata-viewer.runtime.esm.min.js --allow-overwrite","build:split":"vite build -c build/vite.config.split.js && esbuild dist/bimdata-viewer.split.esm.min.js --minify --outfile=dist/bimdata-viewer.split.esm.min.js --allow-overwrite","build:umd":"vite build -c build/vite.config.umd.js && esbuild dist/bimdata-viewer.umd.cjs --minify --outfile=dist/bimdata-viewer.umd.min.cjs","cy:run":"cypress run","cy:open":"cypress open",prebuild:"rm -rf dist",prepublishOnly:"npm run build","semantic-release":"semantic-release",serve:"http-server -c-1 --silent",test:"npm run test:unit & npm run build & npm run test:e2e","test:unit":"jest","test:e2e":"start-server-and-test 'npm run serve -- -p 8080' http://localhost:8080 cy:run","test:e2e-dev":"start-server-and-test 'npm run serve -- -p 8080' http://localhost:8080 cy:open",version:"echo $npm_package_version",ts:"tsc"},Sbi=["dist/*","types/*","CHANGELOG.md","README.md","package.json","package-lock.json","index.d.ts"],Dbi={"@babel/preset-env":"^7.25.4","@bimdata/2d-engine":"2.5.1","@bimdata/areas-next":"0.1.15","@bimdata/bcf-components":"6.4.3","@bimdata/components":"1.6.6","@bimdata/design-system":"2.2.1-beta.1","@bimdata/typescript-fetch-api-client":"10.15.0","@eslint/eslintrc":"^3.1.0","@eslint/js":"^9.11.1","@rollup/plugin-alias":"5.1.1","@rollup/plugin-babel":"^6.0.4","@rollup/plugin-commonjs":"^28.0.0","@rollup/plugin-image":"^3.0.3","@rollup/plugin-replace":"^6.0.1","@semantic-release/changelog":"^6.0.3","@semantic-release/commit-analyzer":"^13.0.0","@semantic-release/git":"^10.0.1","@semantic-release/github":"^11.0.0","@semantic-release/npm":"^12.0.1","@semantic-release/release-notes-generator":"^14.0.1","@vitejs/plugin-vue":"5.1.4","@vue/vue3-jest":"^29.2.6","@xeokit/xeokit-sdk":"git+https://git@github.com/Amoki/xeokit-sdk.git#f81ebaeda39e03d96f75785b257378e420416e0d","@zip.js/zip.js":"^2.7.52",async:"^3.2.6",autoprefixer:"^10.4.20","babel-core":"^7.0.0-bridge.0","babel-jest":"^29.7.0","conventional-changelog-eslint":"^6.0.0",cypress:"^13.15.0",esbuild:"^0.24.0",eslint:"9.11.1","eslint-config-prettier":"9.1.0","eslint-plugin-cypress":"3.5.0","eslint-plugin-jest":"28.8.3","eslint-plugin-prettier":"5.2.1","eslint-plugin-vue":"9.28.0","form-data":"^4.0.0",globals:"^15.9.0",html2canvas:"1.4.1","http-server":"^14.1.1",jest:"^29.7.0","jest-environment-jsdom":"^29.7.0","jest-extended":"^4.0.2",jspdf:"^2.5.2",lodash:"^4.17.21","node-fetch":"^3.3.2","pdfjs-dist":"^4.6.82",postcss:"^8.4.47",prettier:"^3.3.3",querystring:"^0.2.1","sass-embedded":"^1.79.3","semantic-release":"^24.1.1",sinon:"^19.0.2","start-server-and-test":"^2.0.8",vite:"5.4.8","vite-plugin-css-injected-by-js":"^3.5.1",vue:"3.5.9","vue-eslint-parser":"^9.4.3","vue-i18n":"^10.0.3"},Pbi={name:mbi,type:vbi,version:Cbi,description:ybi,keywords:Ibi,types:wbi,author:bbi,homepage:Bbi,bugs:Ebi,browserslist:kbi,main:xbi,module:Qbi,scripts:Mbi,files:Sbi,devDependencies:Dbi};class Rbi{constructor({plugins:e,api:i,ui:r,locale:o="fr"}){this.pluginManager=new yCi(e),this.windowManager=new wCi,this.windowManager.registerAndAddPluginsToWindows([...this.pluginManager.registeredPlugins.values()]),this.api=new aIi(i),this.globalContext=new Eke(this),this.state=bIi(this),this.shortcutManager=w7e(this.state),this.uiSettings=r||{},this.i18n=new bke(o),this._contextMenu=null,this.layout=new fbi(this.uiSettings.resizable!==!1),this.localContext=null,window.$viewer=this}get version(){return Pbi.version}get locale(){return this.i18n.locale}get contextMenu(){return this._contextMenu||y7e}set contextMenu(e){this._contextMenu=e}get registeredWindows(){return[...this.windowManager.registeredWindows.keys()]}get registeredPlugins(){return[...this.pluginManager.registeredPlugins.keys()]}get pluginsCfg(){return this.pluginManager.cfg}registerPlugin(e){this.pluginManager.registerPlugin(e),this.windowManager.registerAndAddPluginsToWindows([e])}}function Lbi(t,e={}){e.backgroundColor&&(t.style.setProperty("--bimdata-viewer-background-color",e.backgroundColor),e.backgroundColor==="transparent"&&t.style.setProperty("--areas-separator-color","transparent")),e.colorPrimary&&t.style.setProperty("--color-primary",e.colorPrimary),e.colorPrimaryLighter&&t.style.setProperty("--color-primary-lighter",e.colorPrimaryLighter),e.colorPrimaryLight&&t.style.setProperty("--color-primary-light",e.colorPrimaryLight),e.colorPrimaryDark&&t.style.setProperty("--color-primary-dark",e.colorPrimaryDark),e.colorSecondary&&t.style.setProperty("--color-secondary",e.colorSecondary),e.colorSecondaryLighter&&t.style.setProperty("--color-secondary-lighter",e.colorSecondaryLighter),e.colorSecondaryLight&&t.style.setProperty("--color-secondary-light",e.colorSecondaryLight),e.colorSecondaryDark&&t.style.setProperty("--color-secondary-dark",e.colorSecondaryDark),e.colorSilverLight&&t.style.setProperty("--color-silver-light",e.colorSilverLight),e.colorSilver&&t.style.setProperty("--color-silver",e.colorSilver),e.colorSilverDark&&t.style.setProperty("--color-silver-dark",e.colorSilverDark),e.colorGraniteLight&&t.style.setProperty("--color-granite-light",e.colorGraniteLight),e.colorGranite&&t.style.setProperty("--color-granite",e.colorGranite),e.colorSuccess&&t.style.setProperty("--color-success",e.colorSuccess),e.colorSuccessLighter&&t.style.setProperty("--color-success-Lighter",e.colorSuccessLighter),e.colorSuccessLight&&t.style.setProperty("--color-success-Light",e.colorSuccessLight),e.colorSuccessDark&&t.style.setProperty("--color-success-Dark",e.colorSuccessDark),e.colorWarning&&t.style.setProperty("--color-warning",e.colorWarning),e.colorWarningLighter&&t.style.setProperty("--color-warning-Lighter",e.colorWarningLighter),e.colorWarningLight&&t.style.setProperty("--color-warning-Light",e.colorWarningLight),e.colorWarningDark&&t.style.setProperty("--color-warning-Dark",e.colorWarningDark),e.colorHigh&&t.style.setProperty("--color-high",e.colorHigh),e.colorHighLighter&&t.style.setProperty("--color-high-lighter",e.colorHighLighter),e.colorHighLight&&t.style.setProperty("--color-high-light",e.colorHighLight),e.colorHighDark&&t.style.setProperty("--color-high-dark",e.colorHighDark),e.colorText&&t.style.setProperty("--color-text",e.colorText),(!e.backgroundColor||e.backgroundColor!=="transparent")&&t.style.setProperty("--areas-separator-color","rgba(216, 216, 216, 1)"),e.headerHeight!=null&&t.style.setProperty("--bimdata-viewer-header-height",e.headerHeight),t.style.setProperty("--areas-background-color","transparent")}const Fbi=Object.freeze({25:"GUEST",50:"USER",100:"ADMIN"}),uv=Object.freeze({READ:"read",WRITE:"write"});function tve(t){const e={};return t.forEach(i=>{const[r,o]=i.split(":");e[r]?e[r].push(o):e[r]=[o]}),e}const Tbi={token_scopes:[],usable_scopes:[],user_role:25};function ive(t=Tbi){var e,i,r,o,s,n;const a=tve(t.token_scopes),l=tve(t.usable_scopes);return{...Kie(t),tokenScopes:a,usableScopes:l,userRole:Fbi[t.user_role],user:t.user?Kie(t.user):null,hasBcfReadPermission:((e=l.bcf)==null?void 0:e.includes(uv.READ))??!1,hasBcfWritePermission:((i=l.bcf)==null?void 0:i.includes(uv.WRITE))??!1,hasModelReadPermission:((r=l.model)==null?void 0:r.includes(uv.READ))??!1,hasModelWritePermission:((o=l.model)==null?void 0:o.includes(uv.WRITE))??!1,hasDocReadPermission:((s=l.document)==null?void 0:s.includes(uv.READ))??!1,hasDocWritePermission:((n=l.document)==null?void 0:n.includes(uv.WRITE))??!1}}const Nbi={BcfFilters:{filtersButton:"Filter",filtersTitle:"Filter",priorityLabel:"Priorit\xE4t",statusLabel:"Status",assignedToLabel:"Zugewiesen an",creatorsLabel:"Erstellt von",tagsLabel:"Tags",resetButton:"Zur\xFCcksetzen",searchButton:"Suchen",undefined:"Nicht definiert",datePlaceholder:"Erstellungsdatum"},BcfSettings:{goBackButton:"Zur\xFCck",title:"BCF-Parameter",text:"Erstellen, f\xFCllen und listen Sie die BCF-Einstellungen auf, die Sie f\xFCr dieses Projekt haben m\xF6chten.",validateButton:"Die BCF-Parameter anerkennen"},BcfStatistics:{emptyText:"F\xFCgen Sie Fragen hinzu, um zugeh\xF6rige Statistiken hier anzuzeigen.",issues:"Probleme",extension:{Priority:"Priorit\xE4t",PriorityNotDefined:"Keine Priorit\xE4t",PriorityTitle:"Priorit\xE4ten",Status:"Status",StatusNotDefined:"Kein Status",StatusTitle:"Status"}},BcfTopicCard:{priority:"Priorit\xE4t:",noPriority:"Keine",assignedTo:"Zugewiesen an :",elements:"Elemente",notSpecified:"Nicht definiert",see:"Anzeigen"},BcfTopicCreationCard:{text:"Ein neues BCF-Thema erstellen",createBcfSideTitle:"Ein Problem melden"},BcfTopicForm:{dragDropImageText:"Bitte w\xE4hlen Sie eine Datei aus.",addObjectButton:"Objekt",addAnnotationButton:"Annotation",annotationButtonTooltip:"Zu diesem Thema gibt es derzeit keine Ansichten.",addPictureButton:"F\xFCgen Sie ein Bild hinzu.",titlePlaceholder:"Titel *",titleErrorMessage:"Titel fehlt",typeLabel:"Typ",priorityLabel:"Priorit\xE4t",statusLabel:"Status",stageLabel:"Phase",assignedToLabel:"Zugewiesen an",dueDateLabel:"F\xE4lligkeitsdatum (TT.MM.JJJJ)",descriptionLabel:"Beschreibung",labelsLabel:"Tags",createButton:"Best\xE4tigen",updateButton:"\xC4nderungen \xFCbernehmen",modalText:"Sie sind dabei, die Bearbeitung der Ausgabe {Name} zu beenden, aber es gibt noch ungespeicherte \xC4nderungen.",cancelButton:"\xC4nderungen verwerfen",continueButton:"\xC4nderungen fortsetzen",createTitle:"Ein Problem melden",dragDropImageTextTablet:"Foto machen",takeSnapshot:"Mach einen Schnappschuss",importFile:"Eine Datei importieren",searchPlaceholder:"Suchen",emptySearch:"kein Ergebnis"},BcfTopicOverview:{openViewer:"Im Viewer \xF6ffnen",openViewerNoModels:"Es sind keine Vorlagen zur Ansicht bereit",elements:"{count} Elemente",noElements:"kein Element",type:"Typ",noTypeSpecified:"Kein Typ angegeben",description:"Beschreibung",noDescriptionProvided:"Keine Beschreibung angegeben",assignedTo:"Zugeteilt an",notAssigned:"Nicht zugewiesen",dueDate:"F\xE4lligkeitsdatum",noDueDate:"Kein F\xE4lligkeitsdatum",informations:"Informationen",status:"Status",noStatusSpecified:"Kein Status angegeben",stage:"Phase",noStageProvided:"Keine Phase angegeben",priority:"Priorit\xE4t",priorityNotDefined:"Nicht definiert",tags:"Tags",noTags:"Keine Tags",commentButton:"Ein Kommentar ver\xF6ffentlichen",deleteText:"Sie l\xF6schen jetzt {Name}",deleteBcfButton:"Dieses BCF l\xF6schen",keepBcfButton:"Dieses BCF beibehalten",author:"Autor"},BcfTopicsTable:{headers:{index:"#",priority:"Priorit\xE4t",status:"Status",title:"Titel",creator:"Autor",date:"Datum"}},BcfTopicActionsCell:{seeButton:"Anzeigen"},BcfTopicComments:{commentButton:"Ein Kommentar verfassen",commentLabel:"Ein Kommentar verfassen",commentText:"Kommentar",cancelButton:"Abbrechen",publishButton:"Ver\xF6ffentlichen",commentsText:"Kommentare",deleteCommentText:"Diesen Kommentar l\xF6schen?",deleteButton:"L\xF6schen",takeSnapshot:"Mach einen Schnappschuss"},BcfTopicPriorityCell:{noPriority:"Keine"},SettingCard:{addButton:"ein Element hinzuf\xFCgen",cancelButton:"Abbrechen",validateButton:"Best\xE4tigen",deleteExtensionText:"Diesen Parameter l\xF6schen",deleteButton:"L\xF6schen",title:{Priority:"Priorit\xE4ten",Label:"Tags",Status:"Status",Type:"Typen",Stage:"Phasen"},input:{Priority:"Eine neue Priorit\xE4t hinzuf\xFCgen",Label:"Ein neues Etikett hinzuf\xFCgen",Status:"Einen neuen Status hinzuf\xFCgen",Type:"Einen neuen Typ hinzuf\xFCgen",Stage:"Eine neue Phase hinzuf\xFCgen"},text:{Priority:"Liste der Priorit\xE4ten",Label:"Liste von Tags",Status:"Liste der Status",Type:"Liste der Typen",Stage:"Liste der Phasen"}}},Ubi={BcfComponents:Nbi},Obi={BcfFilters:{filtersButton:"Filters",filtersTitle:"Filters",priorityLabel:"Priority",statusLabel:"Status",assignedToLabel:"Assigned to",creatorsLabel:"Created by",tagsLabel:"Tags",resetButton:"Reset",searchButton:"Search",undefined:"Not defined",datePlaceholder:"Creation date"},BcfSettings:{goBackButton:"Back",title:"BCF Settings",text:"Create, enter in, and list the BCF settings you would like to have for this project",validateButton:"Validate BCF settings"},BcfStatistics:{emptyText:"Add BCF Topics to start to have some stats here.",issues:"issues",extension:{Priority:"Priority",PriorityNotDefined:"No priority",PriorityTitle:"Priorities",Status:"Status",StatusNotDefined:"No status",StatusTitle:"Status"}},BcfTopicCard:{priority:"Priority: ",noPriority:"None",assignedTo:"Assigned to: ",elements:"Elements",notSpecified:"Not specified",see:"See"},BcfTopicCreationCard:{text:"Create a new BCF topic",createBcfSideTitle:"Report a problem"},BcfTopicForm:{dragDropImageText:"Please select a file",addObjectButton:"Object",addAnnotationButton:"Annotation",annotationButtonTooltip:"This topic has no viewpoint",addPictureButton:"Add a picture",titlePlaceholder:"Title *",titleErrorMessage:"Missing title",typeLabel:"Type",priorityLabel:"Priority",statusLabel:"Status",stageLabel:"Stage",assignedToLabel:"Assigned to",dueDateLabel:"Due date",descriptionLabel:"Description",labelsLabel:"Tags",createButton:"Validate",updateButton:"Modify this BCF",modalText:"You are about to quit editing issue {name} but there are unsaved changes.",cancelButton:"Discard changes",continueButton:"Continue editing",createTitle:"Report a problem",dragDropImageTextTablet:"Take a picture",takeSnapshot:"Take a snapshot",importFile:"Import a file",searchPlaceholder:"Search",emptySearch:"No result"},BcfTopicOverview:{openViewer:"Open in viewer",openViewerNoModels:"No model to open",elements:"{count} Elements",noElements:"No element",type:"Type",noTypeSpecified:"No type specified",description:"Description",noDescriptionProvided:"No description provided",assignedTo:"Assigned to",notAssigned:"Not assigned",dueDate:"Due date",noDueDate:"No due date",informations:"Informations",status:"Status",noStatusSpecified:"No status specified",stage:"Stage",noStageProvided:"No stage provided",priority:"Priority",priorityNotDefined:"Not defined",tags:"Tags",noTags:"No tags",commentButton:"Post a comment",deleteText:"You are about to delete {name}",deleteBcfButton:"Delete this BCF",keepBcfButton:"Keep this BCF",author:"Author"},BcfTopicsTable:{headers:{index:"#",priority:"Priority",status:"Status",title:"Title",creator:"Author",date:"Date"}},BcfTopicActionsCell:{seeButton:"See"},BcfTopicComments:{commentButton:"Post a comment",commentLabel:"Post a comment",commentText:"Comment",cancelButton:"Cancel",publishButton:"Publish",commentsText:"Comments",deleteCommentText:"Delete this comment ?",deleteButton:"Delete",takeSnapshot:"Take a snapshot"},BcfTopicPriorityCell:{noPriority:"None"},SettingCard:{addButton:"add an element",cancelButton:"Cancel",validateButton:"Validate",deleteExtensionText:"Remove this setting",deleteButton:"Delete",title:{Priority:"Priorities",Label:"Labels",Status:"Status",Type:"Types",Stage:"Stages"},input:{Priority:"Add a new priority",Label:"Add a new label",Status:"Add new status",Type:"Add a new type",Stage:"Add a new stage"},text:{Priority:"Priority list",Label:"Labels list",Status:"Status list",Type:"Type list",Stage:"Stage list"}}},Hbi={BcfComponents:Obi},Gbi={BcfFilters:{filtersButton:"Filtros",filtersTitle:"Filtros",priorityLabel:"Prioridad",statusLabel:"Estado",assignedToLabel:"Asignado a",creatorsLabel:"Creado por",tagsLabel:"Etiquetas:",resetButton:"Restablecer",searchButton:"Buscar en",undefined:"No definido",datePlaceholder:"Fecha de creaci\xF3n"},BcfSettings:{goBackButton:"Volver",title:"Par\xE1metros del BCF",text:"Cree, rellene y enumere los par\xE1metros del BCF que desea tener en este proyecto",validateButton:"Validar los par\xE1metros del BCF"},BcfStatistics:{emptyText:"A\xF1ada preguntas para ver las estad\xEDsticas asociadas aqu\xED.",issues:"problemas",extension:{Priority:"Prioridad",PriorityNotDefined:"Sin prioridad",PriorityTitle:"Prioridades",Status:"Estado",StatusNotDefined:"Sin estado",StatusTitle:"Estatutos"}},BcfTopicCard:{priority:"Prioridad :",noPriority:"Sin",assignedTo:"Asignado a :",elements:"Elementos",notSpecified:"No definido",see:"Ver"},BcfTopicCreationCard:{text:"Crear un nuevo tema BCF",createBcfSideTitle:"Informar de un problema"},BcfTopicForm:{dragDropImageText:"Seleccione un archivo",addObjectButton:"Objeto",addAnnotationButton:"Anotaci\xF3n",annotationButtonTooltip:"Actualmente este tema no posee ning\xFAn punto de vista",addPictureButton:"A\xF1adir una imagen",titlePlaceholder:"T\xEDtulo *",titleErrorMessage:"Falta el t\xEDtulo",typeLabel:"Tipo",priorityLabel:"Prioridad",statusLabel:"Estado",stageLabel:"Fase",assignedToLabel:"Asignado a",dueDateLabel:"Fecha de vencimiento (DD/MM/AAAA)",descriptionLabel:"Descripci\xF3n",labelsLabel:"Etiquetas",createButton:"Validar",updateButton:"Modificar este BCF",modalText:"Est\xE1 a punto de salir de la edici\xF3n del problema de {name} pero hay cambios sin guardar.",cancelButton:"Cancelar los cambios",continueButton:"Continuar con los cambios",createTitle:"Informar de un problema",dragDropImageTextTablet:"Tomar una fotograf\xEDa",takeSnapshot:"Tomar un snapshot",importFile:"Importar un archivo",searchPlaceholder:"Buscar",emptySearch:"No hay resultados"},BcfTopicOverview:{openViewer:"Abrir en el visor",openViewerNoModels:"No hay ning\xFAn modelo listo para la visualizaci\xF3n",elements:"{count} Elementos",noElements:"Ning\xFAn elemento",type:"Tipo",noTypeSpecified:"No se especifica el tipo",description:"Descripci\xF3n",noDescriptionProvided:"No hay descripci\xF3n",assignedTo:"Asignado a",notAssigned:"No asignado",dueDate:"Plazo",noDueDate:"Sin fecha de vencimiento",informations:"Informaci\xF3n",status:"Estado",noStatusSpecified:"No se especifica el estado",stage:"Fase",noStageProvided:"No se indica ninguna fase",priority:"Prioridad",priorityNotDefined:"No definido",tags:"Etiquetas",noTags:"Sin etiquetas",commentButton:"Publicar un comentario",deleteText:"Est\xE1s a punto de borrar {name}",deleteBcfButton:"Borrar este BCF",keepBcfButton:"Mantenga este BCF",author:"Autor"},BcfTopicsTable:{headers:{index:"#",priority:"Prioridad",status:"Estado",title:"T\xEDtulo",creator:"Autor",date:"Fecha"}},BcfTopicActionsCell:{seeButton:"Ver"},BcfTopicComments:{commentButton:"Publicar un comentario",commentLabel:"Publicar un comentario",commentText:"Comentario",cancelButton:"Cancelar",publishButton:"Publicar",commentsText:"comentarios",deleteCommentText:"\xBFBorrar este comentario?",deleteButton:"Borrar",takeSnapshot:"Tomar un snapshot"},BcfTopicPriorityCell:{noPriority:"Sin"},SettingCard:{addButton:"a\xF1adir un elemento",cancelButton:"Cancelar",validateButton:"Validar",deleteExtensionText:"Borrar esta configuraci\xF3n",deleteButton:"Borrar",title:{Priority:"Prioridades",Label:"Etiquetas:",Status:"Estatutos",Type:"Tipos",Stage:"Fases"},input:{Priority:"A\xF1adir una nueva prioridad",Label:"A\xF1adir una nueva etiqueta",Status:"A\xF1adir un nuevo estado",Type:"A\xF1adir un nuevo tipo",Stage:"A\xF1adir una nueva fase"},text:{Priority:"Lista de prioridades",Label:"Lista de etiquetas",Status:"Lista de estatutos",Type:"Lista de tipos",Stage:"Lista de fases"}}},jbi={BcfComponents:Gbi},Vbi={BcfFilters:{filtersButton:"Filtres",filtersTitle:"Filtres",priorityLabel:"Priorit\xE9",statusLabel:"Statut",assignedToLabel:"Assign\xE9 \xE0",creatorsLabel:"Cr\xE9\xE9 par",tagsLabel:"Tags",resetButton:"R\xE9initialiser",searchButton:"Rechercher",undefined:"Non d\xE9fini",datePlaceholder:"Date de cr\xE9ation"},BcfSettings:{goBackButton:"Retour",title:"Param\xE8tres BCF",text:"Cr\xE9ez, renseignez et listez les param\xE8tres BCF que vous souhaitez avoir sur ce projet",validateButton:"Valider les param\xE8tres BCF"},BcfStatistics:{emptyText:"Ajoutez des questions pour voir les statistiques associ\xE9es ici.",issues:"probl\xE8mes",extension:{Priority:"Priorit\xE9",PriorityNotDefined:"Aucune priorit\xE9",PriorityTitle:"Priorit\xE9s",Status:"Statut",StatusNotDefined:"Aucun statut",StatusTitle:"Statuts"}},BcfTopicCard:{priority:"Priorit\xE9 : ",noPriority:"Aucune",assignedTo:"Assign\xE9 \xE0 : ",elements:"{n} \xC9lements",notSpecified:"Non d\xE9fini",see:"Voir"},BcfTopicCreationCard:{text:"Cr\xE9er un nouveau topic BCF",createBcfSideTitle:"Signaler un probl\xE8me"},BcfTopicForm:{dragDropImageText:"Veuillez s\xE9lectionner un fichier",addObjectButton:"Objet",addAnnotationButton:"Annotation",annotationButtonTooltip:"Ce topic ne poss\xE8de actuellement aucun point de vue",addPictureButton:"Ajouter une image",titlePlaceholder:"Titre *",titleErrorMessage:"Titre manquant",typeLabel:"Type",priorityLabel:"Priorit\xE9",statusLabel:"Statut",stageLabel:"Phase",assignedToLabel:"Assign\xE9 \xE0",dueDateLabel:"Date d'\xE9ch\xE9ance",descriptionLabel:"Description",labelsLabel:"Tags",createButton:"Valider",updateButton:"Modifier ce BCF",modalText:"Vous \xEAtes sur le point de quitter l'\xE9dition de l'issue {name} mais il y'a des modifications non enregistr\xE9es.",cancelButton:"Annuler les modifications",continueButton:"Continuer les modifications",createTitle:"Signaler un probl\xE8me",dragDropImageTextTablet:"Prendre une photo",takeSnapshot:"Prendre un snapshot",importFile:"Importer un fichier",searchPlaceholder:"Rechercher",emptySearch:"Pas de r\xE9sultat"},BcfTopicOverview:{openViewer:"Ouvrir dans le viewer",openViewerNoModels:"Il n'y a aucun mod\xE8le pr\xEAt pour une visualisation",elements:"{count} \xC9lements",noElements:"Aucun \xE9l\xE9ment concern\xE9",type:"Type",noTypeSpecified:"Pas de type sp\xE9cifi\xE9",description:"Description",noDescriptionProvided:"Pas de description renseign\xE9e",assignedTo:"Assign\xE9 \xE0",notAssigned:"Non assign\xE9",dueDate:"\xC9ch\xE9ance",noDueDate:"Pas de date d'\xE9ch\xE9ance",informations:"Informations",status:"Statut",noStatusSpecified:"Pas de statut sp\xE9cifi\xE9",stage:"Phase",noStageProvided:"Pas de phase renseign\xE9e",priority:"Priorit\xE9",priorityNotDefined:"Non d\xE9fini",tags:"Tags",noTags:"Pas de tags",commentButton:"Poster un commentaire",deleteText:"Vous \xEAtes sur le point de supprimer {name}",deleteBcfButton:"Supprimer ce BCF",keepBcfButton:"Conserver ce BCF",author:"Auteur"},BcfTopicsTable:{headers:{index:"#",priority:"Priorit\xE9",status:"Statut",title:"Titre",creator:"Auteur",date:"Date"}},BcfTopicActionsCell:{seeButton:"Voir"},BcfTopicComments:{commentButton:"Poster un commentaire",commentLabel:"Poster un commentaire",commentText:"Commentaire",cancelButton:"Annuler",publishButton:"Publier",commentsText:"commentaires",deleteCommentText:"Supprimer ce commentaire ?",deleteButton:"Supprimer",takeSnapshot:"Prendre un snapshot"},BcfTopicPriorityCell:{noPriority:"Aucune"},SettingCard:{addButton:"ajouter un \xE9l\xE9ment",cancelButton:"Annuler",validateButton:"Valider",deleteExtensionText:"Supprimmer ce param\xE8tre",deleteButton:"Supprimer",title:{Priority:"Priorit\xE9s",Label:"Tags",Status:"Statuts",Type:"Types",Stage:"Phases"},input:{Priority:"Ajouter une nouvelle priorit\xE9",Label:"Ajouter un nouveau label",Status:"Ajouter un nouveau statut",Type:"Ajouter un nouveau type",Stage:"Ajouter une nouvelle phase"},text:{Priority:"Liste des priorit\xE9s",Label:"Liste des tags",Status:"Liste des statuts",Type:"Liste des types",Stage:"Liste des phases"}}},qbi={BcfComponents:Vbi},_bi={BcfFilters:{filtersButton:"Filtri",filtersTitle:"Filtri",priorityLabel:"Priorit\xE0",statusLabel:"Stato",datePlaceholder:"Data di creazione",assignedToLabel:"Assegnato a",creatorsLabel:"Creato da",tagsLabel:"Etichette",resetButton:"Ripristina",searchButton:"Cerca",undefined:"Non definito"},BcfSettings:{goBackButton:"Indietro",title:"Parametri BCF",text:"Creare, notificare e elencare i parametri BCF che si desidera avere su questo progetto",validateButton:"Conferma i parametri BCF"},BcfStatistics:{emptyText:"Aggiungi delle domande per vedere le statistiche associate qui.",issues:"problemi",extension:{Priority:"Priorit\xE0",PriorityNotDefined:"Nessuna priorit\xE0",PriorityTitle:"Priorit\xE0",Status:"Stato",StatusNotDefined:"Nessuno stato",StatusTitle:"Stati"}},BcfTopicCard:{priority:"Priorit\xE0:",noPriority:"Nessuno",assignedTo:"Assegnato a:",elements:"Elementi",noElements:"0 elementi",notSpecified:"Non definito",see:"Visualizza"},BcfTopicCreationCard:{text:"Crea un nuovo topic BCF",createBcfSideTitle:"Segnala un problema"},BcfTopicForm:{dragDropImageText:"Selezionare un file",addObjectButton:"Oggetto",addAnnotationButton:"Annotazione",annotationButtonTooltip:"Attualmente questo argomento non presenta alcun punto di vista",addPictureButton:"Aggiungere un'immagine",titlePlaceholder:"Titolo *",titleErrorMessage:"Titolo mancante",typeLabel:"Tipo",priorityLabel:"Priorit\xE0",statusLabel:"Stato",stageLabel:"Fase",assignedToLabel:"Assegnato a",dueDateLabel:"Data di scadenza",descriptionLabel:"Descrizione",labelsLabel:"Tag",createButton:"Conferma",updateButton:"Modificare questo BCF",modalText:"State per abbandonare la modifica di {name} ma ci sono modifiche non salvate.",cancelButton:"Annullare le modifiche",continueButton:"Continuare le modifiche",createTitle:"Segnala un problema"},BcfTopicOverview:{openViewer:"Apri nel visualizzatore",openViewerNoModels:"Non esistono modelli pronti per la visualizzazione",elements:"{count} Elementi",noElements:"Nessun elemento",type:"Tipo",noTypeSpecified:"Nessun tipo specificato",description:"Descrizione",noDescriptionProvided:"Nessuna descrizione inserita",assignedTo:"Assegnato a",notAssigned:"Non assegnato",dueDate:"Scadenza",noDueDate:"Nessuna data di scadenza",informations:"Informazioni",status:"Stato",noStatusSpecified:"Nessuno stato specificato",stage:"Fase",noStageProvided:"Nessuna fase inserita",priority:"Priorit\xE0",priorityNotDefined:"Non definita",tags:"Etichette",noTags:"Nessuna etichetta",commentButton:"Pubblica un commento",deleteText:"Stai per eliminare {name}",deleteBcfButton:"Elimina questo BCF",keepBcfButton:"Conserva questo BCF",author:"Autore"},BcfTopicsTable:{headers:{index:"#",priority:"Priorit\xE0",status:"Stato",title:"Titolo",creator:"Autore",date:"Data"}},BcfTopicActionsCell:{seeButton:"Visualizza"},BcfTopicComments:{commentButton:"Pubblica un commento",commentLabel:"Pubblica un commento",commentText:"Commento",cancelButton:"Annulla",publishButton:"Pubblica",commentsText:"commenti",deleteCommentText:"Eliminare questo commento?",deleteButton:"Elimina"},BcfTopicPriorityCell:{noPriority:"Nessuno"},SettingCard:{addButton:"aggiungi un elemento",cancelButton:"Annulla",validateButton:"Conferma",deleteExtensionText:"Elimina questo parametro",deleteButton:"Elimina",title:{Priority:"Priorit\xE0",Label:"Etichette",Status:"Stati",Type:"Tipi",Stage:"Fasi"},input:{Priority:"Aggiungi una nuova priorit\xE0",Label:"Aggiungi una nuova etichetta",Status:"Aggiungi un nuovo stato",Type:"Aggiungi un nuovo tipo",Stage:"Aggiungi una nuova fase"},text:{Priority:"Elenco delle priorit\xE0",Label:"Elenco delle etichette",Status:"Elenco degli stati",Type:"Elenco dei tipi",Stage:"Elenco delle fasi"}}},zbi={BcfComponents:_bi},Kbi={de:Ubi,en:Hbi,es:jbi,fr:qbi,it:zbi},Jbi=({apiClient:t,fetchUsers:e,i18nPlugin:i}={})=>({install(r){t?Gr.setup({apiClient:t,fetchUsers:e}):console.error("[BCF Components Plugin] No api client provided. You must provide an api client for the components to work properly."),i?Object.entries(Kbi).forEach(([o,s])=>{i.global.mergeLocaleMessage(o,s)}):console.warn("[BCF Components Plugin] No i18n instance provided. You should either provide an i18n instance or define your own translations in order have text displayed properly."),Object.entries(_De).forEach(([o,s])=>{r.component(o,s)})}}),Ybi={title:"Building Maker",back:"Zur\xFCck",list:{text:"Erstellen und bearbeiten Sie die Etagen und laden Sie anschlie\xDFend Ihre PDFs herunter.",createButton:"Neues Projekt",updateButton:"Umbenennen",deleteButton:"L\xF6schen"},form:{text:"Erstellen und bearbeiten Sie die Etagen und laden Sie anschlie\xDFend Ihre PDFs herunter.",input:"Name des Geb\xE4udes",error:"Ung\xFCltiger Name",createButton:"Erstellen",updateButton:"Best\xE4tigen"},view:{addStoreyButton:"Etage",addFileButton:"Grundriss",closeButton:"Fertigstellen",submitFilesButton:"Best\xE4tigen"},storeyForm:{title:"Neue Etage",input:"Name",error:"Ung\xFCltiger Name",cancelButton:"Abbrechen",submitButton:"Best\xE4tigen"}},Wbi={creationFormTitle:"Ordner erstellen",renameFormPlaceholder:"Datei- / Ordnernam",nameInputPlaceholder:"Ordnername",emptyFolder:"Dieser Ordner ist leer",newFolderSuccess:"Neuer Ordner erstellt",renameFolderSuccess:"Umbenannter Ordner",deleteFolderSuccess:"Ordner gel\xF6scht",newFileSuccess:"Datei hinzugef\xFCgt",renameFileSuccess:"Umbenannte Datei",deleteFileSuccess:"Datei gel\xF6scht",nameInputErrorMessage:"Ung\xFCltiger name",cancel:"Abbrechen",submit:"Best\xE4tigen",buttonText:"Neuer Ordner",addFileButtonText:"Datei laden",rename:"Umbenennen",view:"Sehen",download:"Herunterladen",delete:"L\xF6schen",deleteTitle:"Dateien l\xF6schen",deleteDetail:"Sie sind im Begriff, die folgenden Dateien / Ordner endg\xFCltig zu l\xF6schen"},Zbi={BuildingMaker:Ybi,FileManager:Wbi},Xbi={title:"Building",back:"Back",list:{text:"Create and edit the layers, then download your PDFs.",createButton:"New project",updateButton:"Rename",deleteButton:"Delete"},form:{text:"Create and edit the layers, then download your PDFs.",input:"Building name",error:"Invalid",createButton:"Create",updateButton:"Confirm"},view:{addStoreyButton:"Storey",addFileButton:"Plan",closeButton:"Finish",submitFilesButton:"Validate"},storeyForm:{title:"New storey",input:"Name",error:"Invalid name",cancelButton:"Cancel",submitButton:"Validate"}},$bi={creationFormTitle:"Create folder",renameFormPlaceholder:"Folder/File name",nameInputPlaceholder:"Folder name",emptyFolder:"This folder is empty",newFolderSuccess:"New folder created",renameFolderSuccess:"Folder renamed",deleteFolderSuccess:"Folder deleted",newFileSuccess:"File added",renameFileSuccess:"File renamed",deleteFileSuccess:"File deleted",nameInputErrorMessage:"Invalid name",cancel:"Cancel",submit:"Submit",buttonText:"New folder",addFileButtonText:"Upload a file",rename:"Rename",view:"View",download:"Download",delete:"Delete",deleteTitle:"Deleting Files",deleteDetail:"You are about to permanently delete the following files / folders",dmsRoot:"Root of the project's DMS",validate:"Validate",back:"Back",pdfPageSelectorTitle:"Select a page"},eBi={title:"Meta-Building Structure",tab:{structure:"Structure",zones:"Zones",equipments:"Equipments"},StoreySelector:{placeholder:"Select a storey"},StructureView:{search:"Search"}},tBi={title:"Photosphere Building"},iBi={BuildingMaker:Xbi,FileManager:$bi,MetaBuildingStructure:eBi,PhotosphereBuilding:tBi},rBi={title:"Building Maker",back:"Vuelta",list:{text:"Cree y edite los pisos despu\xE9s cargue los PDF.",createButton:"Nuevo proyecto",updateButton:"Renombrar",deleteButton:"Suprimir"},form:{text:"Cree y edite los pisos despu\xE9s cargue los PDF.",input:"Nombre del edificio",error:"Nombre no v\xE1lido",createButton:"Crear",updateButton:"Validar"},view:{addStoreyButton:"Piso",addFileButton:"Plano",closeButton:"Terminar",submitFilesButton:"Validar"},storeyForm:{title:"Nuevo piso",input:"Nombre",error:"Nombre no v\xE1lido",cancelButton:"Anular",submitButton:"Validar"}},oBi={creationFormTitle:"Crear un archivo",renameFormPlaceholder:"Nombre de archivo / carpeta",nameInputPlaceholder:"Nombre de la carpeta",emptyFolder:"Esta carpeta est\xE1 vac\xEDa",newFolderSuccess:"Nueva carpeta creada",renameFolderSuccess:"Carpeta renombrada",deleteFolderSuccess:"Carpeta eliminada",newFileSuccess:"Archivo agregado",renameFileSuccess:"Archivo renombrado",deleteFileSuccess:"Archivo eliminado",nameInputErrorMessage:"Nombre inv\xE1lida",cancel:"Cancelar",submit:"Validar",buttonText:"Carpeta nueva",addFileButtonText:"Cargar un archivo",rename:"Renombrar",view:"Ver",download:"Descargar",delete:"Borrar",deleteTitle:"Eliminar archivos",deleteDetail:"Est\xE1 a punto de eliminar permanentemente los siguientes archivos / carpetas"},nBi={BuildingMaker:rBi,FileManager:oBi},sBi={title:"Building Maker",back:"Retour",list:{text:"Cr\xE9ez et \xE9ditez les \xE9tages puis t\xE9l\xE9chagez vos PDF.",createButton:"Nouveau projet",updateButton:"Renommer",deleteButton:"Supprimer"},form:{text:"Cr\xE9ez et \xE9ditez les \xE9tages puis t\xE9l\xE9chagez vos PDF.",input:"Nom du b\xE2timent",error:"Nom invalide",createButton:"Cr\xE9er",updateButton:"Valider"},view:{addStoreyButton:"\xC9tage",addFileButton:"Plan",closeButton:"Terminer",submitFilesButton:"Valider"},storeyForm:{title:"Nouvel \xE9tage",input:"Nom",error:"Nom invalide",cancelButton:"Annuler",submitButton:"Valider"}},aBi={creationFormTitle:"Cr\xE9er un dossier",renameFormPlaceholder:"Nom du fichier/dosier",nameInputPlaceholder:"Nom du dossier",emptyFolder:"Ce dossier est vide",newFolderSuccess:"Nouveau dossier cr\xE9\xE9",renameFolderSuccess:"Dossier renomm\xE9",deleteFolderSuccess:"Dossier supprim\xE9",newFileSuccess:"Fichier ajout\xE9",renameFileSuccess:"Fichier renomm\xE9",deleteFileSuccess:"Fichier supprim\xE9",nameInputErrorMessage:"Nom invalide",cancel:"Annuler",submit:"Valider",buttonText:"Nouveau dossier",addFileButtonText:"Charger un fichier",rename:"Renommer",view:"Voir",download:"T\xE9l\xE9charger",delete:"Supprimer",deleteTitle:"Supression de fichiers",deleteDetail:"Vous \xEAtes sur le point de supprimer d\xE9finitivement les fichiers/dossiers suivants",dmsRoot:"Racine de la GED du projet",validate:"Valider",back:"Retour",pdfPageSelectorTitle:"S\xE9lectionner une page"},lBi={title:"Structure M\xE9ta-Building",tab:{structure:"Structure",zones:"Zones",equipments:"Equipements"},StoreySelector:{placeholder:"S\xE9lectionner un \xE9tage"},StructureView:{search:"Rechercher"}},cBi={title:"Photosph\xE8re Building"},dBi={BuildingMaker:sBi,FileManager:aBi,MetaBuildingStructure:lBi,PhotosphereBuilding:cBi},ABi={title:"Building Maker",back:"Reso",list:{text:"Crea e modifica i piani e poi scarica i tuoi PDF.",createButton:"Nuovo progetto",updateButton:"Rinominare",deleteButton:"Eliminare"},form:{text:"Crea e modifica i piani e poi scarica i tuoi PDF.",input:"Nome della costruzione",error:"Nome non corretto",createButton:"Creare",updateButton:"Convalidare"},view:{addStoreyButton:"Piano",addFileButton:"Progetto",closeButton:"Finire",submitFilesButton:"Convalidare"},storeyForm:{title:"Nuovo piano",input:"Nome",error:"Nome non corretto",cancelButton:"Annullare",submitButton:"Convalidare"}},uBi={creationFormTitle:"Crea una cartella",renameFormPlaceholder:"Nome file/cartella",nameInputPlaceholder:"Nome della cartella",emptyFolder:"Questa cartella \xE8 vuota",newFolderSuccess:"Nuova cartella creata",renameFolderSuccess:"Cartella rinominata",deleteFolderSuccess:"Cartella eliminata",newFileSuccess:"File aggiunto",renameFileSuccess:"File rinominato",deleteFileSuccess:"File cancellato",nameInputErrorMessage:"Nome non valido",cancel:"Annulla",submit:"Invia",buttonText:"Nuova cartella",addFileButtonText:"Carica un file",rename:"Rinominare",view:"Vedere",download:"Scaricare",delete:"Cancellare",deleteTitle:"Eliminazione di file",deleteDetail:"Stai per eliminare definitivamente i seguenti file/cartelle"},hBi={BuildingMaker:ABi,FileManager:uBi},pBi={de:Zbi,en:iBi,es:nBi,fr:dBi,it:hBi},gBi=({i18nPlugin:t}={})=>({install(e){t?Object.entries(pBi).forEach(([i,r])=>{t.global.mergeLocaleMessage(i,r)}):console.warn("[BIMData Components Plugin] No i18n instance provided. You should either provide an i18n instance or define your own translations in order have text displayed properly."),Object.entries(yui).forEach(([i,r])=>{e.component(i,r)})}}),fBi={beforeMount(t,e){if(typeof e.value!="function")throw Error(`click away directive needs function, got ${typeof e.value}`);t.clickAwayHandler=i=>{(i.path||i.composedPath&&i.composedPath()).find(r=>r===t)||e.value()},window.addEventListener("mousedown",t.clickAwayHandler,!0)},unmounted(t){window.removeEventListener("mousedown",t.clickAwayHandler,!0),delete t.clickAwayHandler}},mBi=Object.freeze(Object.defineProperty({__proto__:null,BIMDataClickAway:Rd,BIMDataClickInputAway:fBi},Symbol.toStringTag,{value:"Module"})),vBi=t=>({install(e){Object.entries(xct).forEach(([i,r])=>{e.component(i,r)}),Object.entries(mBi).forEach(([i,r])=>e.directive(i.split("BIMData")[1],r))}}),CBi={name:"LiWrapper",render(){return Oo("li",this.$slots.default())}};function yBi(t,e){var i=new Set([]);return t.forEach(r=>{e.has(r)||i.add(r)}),i}const tA=fs("id"),IBi=({contextMenu:t,objects:e=[],state:i=t.$viewer.state,pictos:r})=>[{name:"selectAll",get group(){return t.groupPositions.select},position:1,get label(){return t.$t("context_menu.select_all")},get picto(){return r.get(this.name)},execute:()=>i.selectObjects(e.filter(bd(Ji("visible"),V0("selected"))).map(tA)),predicate:()=>e.some(bd(Ji("visible"),V0("selected")))},{name:"deselectAll",get group(){return t.groupPositions.select},position:2,get label(){return t.$t("context_menu.deselect_all")},get picto(){return r.get(this.name)},execute:()=>i.deselectObjects(e.filter(Ji("selected")).map(tA)),predicate:()=>e.some(Ji("selected"))},{name:"selectSimilar",get group(){return t.groupPositions.select},position:3,get label(){return t.$t("context_menu.select_similar")},get picto(){return r.get(this.name)},execute(){const o=e.filter(s=>s.visible&&s.type===this.selectedObject.type&&s.id!==this.selectedObject.id).map(tA);i.selectObjects(o)},selectedObject:null,predicate(){const o=e.filter(bd(Ji("visible"),Ji("selected")));return o.length===1&&o[0].type!==void 0?(this.selectedObject=o[0],!0):(this.selectedObject=null,!1)}},{name:"reverseSelection",get label(){return t.$t("context_menu.reverse_selection")},get group(){return t.groupPositions.select},position:4,execute:()=>{const o=new Set(e.filter(Ji("selected")).map(tA)),s=new Set(e.filter(Ji("visible")).map(tA));i.selectObjects(Array.from(yBi(s,o)),{exclusive:!0})},predicate:()=>e.some(bd(V0("selected"),Ji("visible")))&&e.some(bd(Ji("selected"),Ji("visible")))},{name:"showAll",get group(){return t.groupPositions.visibility},position:1,get label(){return t.$t("context_menu.show_all")},get picto(){return r.get(this.name)},execute:()=>i.showObjects(e.filter(V0("visible")).map(tA)),predicate:()=>e.some(V0("visible"))},{name:"hide",get group(){return t.groupPositions.visibility},position:2,get label(){return t.$t("context_menu.hide")},get picto(){return r.get(this.name)},objectsToHide:null,execute(){const o=this.objectsToHide.filter(Ji("selected"));o.length>0&&i.deselectObjects(o.map(tA)),i.hideObjects(this.objectsToHide.map(tA))},predicate(){return this.objectsToHide=e.filter(bd(Ji("selected"),Ji("visible"))),this.objectsToHide.length>0}},{name:"hideAll",get group(){return t.groupPositions.visibility},position:3,get label(){return t.$t("context_menu.hide_all")},execute:()=>{const o=e.filter(Ji("visible"));o.some(Ji("selected"))&&i.deselectObjects(o.filter(Ji("selected")).map(tA)),i.hideObjects(o.map(tA))},predicate:()=>e.some(Ji("visible"))}].filter(o=>o.predicate()),wBi={components:{LiWrapper:CBi},inject:["$viewer"],data(){return{defaultPrevented:!1,displayed:!1,top:null,bottom:null,left:null,width:200,nextCommandId:1,currentCommands:[],contextCommands:[],registeredCommands:[],groupPositions:{select:10,visibility:20},asyncPredicateRunning:!1}},computed:{position(){return{top:this.top?this.top+"px":"unset",bottom:this.bottom?this.bottom+"px":"unset",left:this.left+"px",width:this.width+"px"}}},watch:{displayed(t){t?document.addEventListener("keydown",this.onKeyDown):document.removeEventListener("keydown",this.onKeyDown)}},created(){this.$viewer.contextMenu=this,this.asyncPredicates=new Set},methods:{onKeyDown(t){t.key==="Escape"&&this.away()},setPosition(t){const e=(document.fullscreenElement?document.fullscreenElement:this.$parent.$el).getBoundingClientRect();this.left=t.clientX-e.left,this.top=t.clientY-e.top,this.left+this.width>e.width&&(this.left=this.left-this.width),t.clientY>e.top+e.height/2?(this.bottom=e.height-this.top,this.top=null):this.bottom=null},typeCheckCommand(t={}){let e=null;if((!t.execute||typeof t.execute!="function")&!t.component&&(e="Cannot register context menu command. A command must have an execute function or a component property."),t.label||(e="Cannot register context menu command. A command must have a label."),e)throw console.error(e),new Error(e);return t.id=this.nextCommandId++,t},open(t){this.currentCommands=[],this.setPosition(t),this.originEvent=t,t.preventDefault(),this.setCurrentCommands(),this.groupCurrentCommands(),this.defaultPrevented=!1,this.displayed=!0,document.fullscreenElement?(this.$el.parentElement.removeChild(this.$el),this.adoptiveParent=document.fullscreenElement,this.adoptiveParent.appendChild(this.$el)):this.adoptiveParent&&this.adoptiveParent!==this.$viewer.globalContext.el&&(this.adoptiveParent.removeChild(this.$el),this.$viewer.globalContext.el.appendChild(this.$el),this.adoptiveParent=null)},setCurrentCommands(){this.asyncPredicates.clear(),this.asyncPredicateRunning=!1,this.defaultPrevented||this.registeredCommands.forEach(async t=>{if(typeof t.predicate=="function"){const e=t.predicate(this.$viewer.globalContext.activeLocalContext);if(e===!0)this.currentCommands.push(t);else if(typeof e?.then=="function"){this.asyncPredicates.add(e),this.asyncPredicateRunning=!0;const i=await e;this.asyncPredicates.has(e)&&(this.asyncPredicates.delete(e),this.asyncPredicateRunning=this.asyncPredicates.size>0,i===!0&&this.currentCommands.push(t))}}else this.currentCommands.push(t)}),this.currentCommands.push(...this.contextCommands),this.contextCommands=[]},getDefaultCommands({objects:t=[],state:e=this.$viewer.state,context:i=null}){const r=new Map;return i&&this.$viewer.shortcutManager.getShortcuts(i).forEach(o=>r.set(o.name,o.key)),IBi({contextMenu:this,objects:t,state:e,pictos:r})},executeCommand(t){if(t.execute&&(t.execute(this.originEvent),this.displayed=!1),t.component&&!t.menu)throw new Error("Command with component property must have a `menu` property")},away(){this.displayed=!1},groupCurrentCommands(){const t=new Map;this.currentCommands.forEach(i=>{(i.group===null||i.group===void 0)&&(i.group=0),t.has(i.group)?t.get(i.group).push(i):t.set(i.group,[i])}),t.forEach(i=>i.sort((r,o)=>(r.position=r.position||0,o.position=o.position||0,r.position-o.position)));const e=[...t.keys()].sort((i,r)=>i-r).map(i=>t.get(i)).flat();this.currentCommands=e},isGroupIntersection(t){if(t===0)return!1;const e=this.currentCommands[t-1],i=this.currentCommands[t];return e.group<i.group},registerContextCommand(t){const e=this.typeCheckCommand(t);return this.contextCommands.push(e),t.id},registerCommand(t){const e=this.typeCheckCommand(t);return this.registeredCommands.push(e),t.id},unregisterCommand(t){return this.registeredCommands.find(e=>e.id===t)?(this.registeredCommands=this.registeredCommands.filter(e=>e.id!==t),!0):!1},preventDefault(){this.defaultPrevented=!0}}},bBi={key:0,class:"separator"},BBi={class:"menu-text"},EBi={key:1,class:"menu-picto"},kBi={key:0,class:"context-menu__spinner"};function xBi(t,e,i,r,o,s){const n=P("BIMDataIconChevron"),a=P("LiWrapper"),l=P("BIMDataSpinner"),c=Ni("click-away");return o.displayed&&(o.currentCommands.length||o.asyncPredicateRunning)?Et((x(),U("ul",{key:0,class:"bimdata-list context-menu",style:ge(s.position)},[(x(!0),U(pt,null,jt(o.currentCommands,(d,A)=>(x(),W(a,{key:d.label,class:"context-menu__element",onClick:u=>s.executeCommand(d)},{default:j(()=>[s.isGroupIntersection(A)?(x(),U("div",bBi)):pe("",!0),b("div",BBi,z(d.label),1),!d.component&&d.picto?(x(),U("span",EBi,z(d.picto),1)):d.component?(x(),W(n,{key:2,size:"xxs",class:"fill-primary"})):pe("",!0)]),_:2},1032,["onClick"]))),128)),o.asyncPredicateRunning?(x(),U("li",kBi,[F(l)])):pe("",!0)],4)),[[c,s.away]]):pe("",!0)}const QBi=V(wBi,[["render",xBi],["__scopeId","data-v-5b87d4a3"]]),MBi={name:"ViewerHeader",inject:["$viewer"],props:{visible:{type:Boolean,default:!0}},setup(){const t=St("$viewer"),e=ka(new Map),i=o=>{if(!o.name)throw new TypeError("[Viewer Header] Content must have a name");if(e.has(o.name))throw new Error(`[Viewer Header] Content with name ${o.name} already exists`);e.set(o.name,o)},r=o=>e.has(o)?(e.delete(o),!0):!1;return{logo:t.uiSettings.bimdataLogo!==!1,version:t.uiSettings.version!==!1?t.version:null,headerContent:e,headerRightContentComponents:lt(()=>Array.from(e.values()).filter(o=>o.position==="right").sort((o,s)=>o.order-s.order).map(o=>o.component)),headerLeftContentComponents:lt(()=>Array.from(e.values()).filter(o=>o.position==="left").sort((o,s)=>o.order-s.order).map(o=>o.component)),addContent:i,removeContent:r}}},SBi={class:"viewer-header"},DBi={class:"viewer-header__content"},PBi={class:"viewer-header__content__left"},RBi={class:"viewer-header__content__right"},LBi={key:0,class:"m-l-6 flex items-center"},FBi={key:1,class:"viewer-header__version"};function TBi(t,e,i,r,o,s){const n=P("BIMDataIllustration");return Et((x(),U("div",SBi,[b("div",DBi,[b("div",PBi,[(x(!0),U(pt,null,jt(r.headerLeftContentComponents,a=>(x(),W(ro(a),{key:a.name}))),128))]),b("div",RBi,[(x(!0),U(pt,null,jt(r.headerRightContentComponents,a=>(x(),W(ro(a),{key:a.name}))),128))])]),r.logo||r.version?(x(),U("div",LBi,[r.logo?(x(),W(n,{key:0,name:"logo",width:"30px",height:"30px"})):pe("",!0),r.version?(x(),U("div",FBi,z(r.version),1)):pe("",!0)])):pe("",!0)],512)),[[ni,i.visible]])}const NBi=V(MBi,[["render",TBi],["__scopeId","data-v-5c9ea6b6"]]),UBi={emits:["resize"],setup(t,{emit:e}){return{onResizerMousedown:i=>{i.preventDefault();let r=i.clientX;const o=n=>{n.preventDefault();const a=n.clientX-r;r=n.clientX,e("resize",a)},s=n=>{n.preventDefault(),window.removeEventListener("mousemove",o),window.removeEventListener("mouseup",s)};window.addEventListener("mousemove",o),window.addEventListener("mouseup",s)}}}},OBi={class:"bimdata-separator"};function HBi(t,e,i,r,o,s){return x(),U("div",OBi,[e[1]||(e[1]=b("div",{class:"bimdata-separator__line"},null,-1)),b("div",{class:"bimdata-separator__resizer",onMousedown:e[0]||(e[0]=(...n)=>r.onResizerMousedown&&r.onResizerMousedown(...n))},null,32)])}const GBi=V(UBi,[["render",HBi],["__scopeId","data-v-79a3b3af"]]),jBi={components:{Separator:GBi},props:{position:{type:String,required:!0,validator(t){return["left","right"].includes(t)}},sidePanel:{type:Object,required:!0,validator(t){if(t.width&&(typeof t.width!="number"||t.width<0))return console.error(`[GlobalSidePanel] sidePanel.width must be a strictly positive number, received ${typeof t.width}`),!1;const e=typeof t?.component=="object";return e||console.error("[GlobalSidePanel] sidePanel must have a component property"),e}}},setup(t){const e=Le(null),i=Le(t.sidePanel.width??400),r=(o,s=1)=>{const n=i.value+o*s;i.value=Math.max(0,n)};return Dt(()=>t.sidePanel,()=>{Object.defineProperty(t.sidePanel,"width",{get(){return i.value},set(o){if(typeof o!="number"||o<=0){console.error(`[GlobalSidePanel] sidePanel.width must be a strictly positive number, received ${typeof o}`);return}i.value=o}}),Object.defineProperty(t.sidePanel,"componentInstance",{get(){return e.value},enumerable:!0})},{immediate:!0}),{componentInstance:e,width:i,onResize:r}}},VBi={class:"bimdata-global-side-panel__component"};function qBi(t,e,i,r,o,s){const n=P("Separator");return x(),U("div",{class:"bimdata-global-side-panel",style:ge(`width: ${r.width}px`)},[i.sidePanel.resizable&&i.position==="right"?(x(),W(n,{key:0,onResize:e[0]||(e[0]=a=>r.onResize(a,-1))})):pe("",!0),b("div",VBi,[(x(),W(ro(i.sidePanel.component),{ref:"componentInstance"},null,512))]),i.sidePanel.resizable&&i.position==="left"?(x(),W(n,{key:1,onResize:e[1]||(e[1]=a=>r.onResize(a))})):pe("",!0)],4)}const _Bi=V(jBi,[["render",qBi],["__scopeId","data-v-82d0d4cb"]]),zBi={name:"BimdataViewer",components:{ContextMenu:QBi,ViewerHeader:NBi,ModalManager:X3e,GlobalSidePanel:_Bi},setup(){const t=St("$viewer"),{globalContext:e,shortcutManager:i}=t;Sr(()=>{i&&i.destroy(),e.hub.clear()}),ar(()=>{t.pluginManager.runPluginsScripts(t)});const r=lt(()=>{var h;return t.uiSettings.bimdataLogo!==!1&&(e.localContexts.length!==1||((h=e.localContexts[0].window)==null?void 0:h.logoAndVersion))}),o=lt(()=>{var h;return t.uiSettings.version!==!1&&(e.localContexts.length!==1||(h=e.localContexts[0].window)!=null&&h.logoAndVersion)?t.version:null}),s=lt(()=>e.leftSidePanel),n=lt(()=>e.rightSidePanel),a=lt(()=>{var h;const g=t.uiSettings.header!==!1,p=e.localContexts.length===1&&((h=e.localContexts[0].window)==null?void 0:h.header)===!1,m=!!(s.value||n.value);return g&&(!p||m)}),l=t.uiSettings.contextMenu!==!1,c=Le(null);function d(h){l&&c.value.open(h)}function A(){t.shortcutManager.active=!0}function u(){t.shortcutManager.active=!1}return{Layout:t.layout.areas.component,onContextMenu:d,onMouseenter:A,onMouseleave:u,isHeaderVisible:a,viewerTemplateRef:e.templateRef,modalManagerTemplateRef:e.modalManagerTemplateRef,headerTemplateRef:e.headerTemplateRef,contextMenuTemplateRef:c,contextMenuEnabled:l,bimdataLogoOnSingleWindow:r,viewerVersionOnSingleWindow:o,version:t.version,loading:lt(()=>e.loading),spinner:lt(()=>e.spinner),leftSidePanel:s,rightSidePanel:n}}},KBi={key:1,class:"global-spinner",style:{"z-index":"3"}},JBi={key:2,class:"viewer__logo"},YBi={key:1,class:"version m-t-6"};function WBi(t,e,i,r,o,s){const n=P("ModalManager"),a=P("ContextMenu"),l=P("ViewerHeader"),c=P("GlobalSidePanel"),d=P("BIMDataSpinner"),A=P("BIMDataIllustration");return x(),U("div",{id:"bimdata-viewer",ref:"viewerTemplateRef",class:"bimdata-viewer bimdata-scrollbar",onContextmenu:e[0]||(e[0]=(...u)=>r.onContextMenu&&r.onContextMenu(...u)),onMouseenter:e[1]||(e[1]=(...u)=>r.onMouseenter&&r.onMouseenter(...u)),onMouseleave:e[2]||(e[2]=(...u)=>r.onMouseleave&&r.onMouseleave(...u))},[F(n,{ref:"modalManagerTemplateRef"},null,512),r.contextMenuEnabled?(x(),W(a,{key:0,ref:"contextMenuTemplateRef"},null,512)):pe("",!0),F(l,{ref:"headerTemplateRef",visible:r.isHeaderVisible},null,8,["visible"]),b("div",{class:"bimdata-viewer__content",style:ge(r.isHeaderVisible?"height: calc(100% - var(--bimdata-viewer-header-height, 40px))":"height: 100%")},[r.leftSidePanel?(x(),W(c,{key:0,"side-panel":r.leftSidePanel,position:"left"},null,8,["side-panel"])):pe("",!0),(x(),W(ro(r.Layout),{style:"height: 100%; flex-grow: 1;"})),r.rightSidePanel?(x(),W(c,{key:1,"side-panel":r.rightSidePanel,position:"right"},null,8,["side-panel"])):pe("",!0)],4),r.loading?(x(),U("div",KBi,[r.spinner&&r.spinner.component?(x(),W(ro(r.spinner.component),GA(Ma({key:0},r.spinner.props)),null,16)):(x(),W(d,{key:1,size:"40px",border:"5px"}))])):pe("",!0),!r.isHeaderVisible&&(r.bimdataLogoOnSingleWindow||r.viewerVersionOnSingleWindow)?(x(),U("div",JBi,[r.bimdataLogoOnSingleWindow?(x(),W(A,{key:0,name:"logo"})):pe("",!0),r.viewerVersionOnSingleWindow?(x(),U("div",YBi,z(r.version),1)):pe("",!0)])):pe("",!0)],544)}const ZBi=V(zBi,[["render",WBi]]),XBi=["src"],$Bi={class:"bimdata-models__header"},eEi={key:0,class:"bimdata-models__header__loader"},tEi={class:"bimdata-models__header__picto"},iEi={class:"bimdata-models__header__name"},rEi={key:0,class:"bimdata-models__header__name--empty"},oEi={key:1,class:"bimdata-models__header__name--empty"},nEi={key:3},sEi=["onMousemove","onClick"],rve={__name:"Models",props:{preview:{type:Boolean,default:!1},windowPositioning:{type:Boolean,default:!0},customFilter:{type:Function,default:null},width:{type:String,default:"350px"}},setup(t){const e=t,i=St("$viewer"),r=Le(),o=Le(0),s=Le(0),n=Le(),a=Hr([]),l=Le(!1),c=lt(()=>i.localContext.loadedModels),d=lt(()=>i.localContext.loadedModelIds),A=lt(()=>i.localContext.loadingModelIds),u=lt(()=>i.localContext.multiModel),h=lt(()=>(e.customFilter?a.value.filter(e.customFilter):a.value).map(B=>c.value.find(E=>{var k;return((k=E.document)==null?void 0:k.head_id)!=null&&E.document.head_id===B.document.id})??B)),g=B=>d.value.includes(B),p=B=>A.value.includes(B),m=lt(()=>{var B;const{x:E,y:k}=((B=n.value)==null?void 0:B.getBoundingClientRect())??{x:0,y:0};return`top:${s.value-k}px; left:${o.value-E}px;`}),f=B=>{!u.value&&g(B.id)||A.value.length>0||(i.localContext.loadedModelIds.includes(B.id)?i.localContext.unloadModels([B.id]):i.localContext.loadModels([B.id]))},v=B=>{switch(B){case"C":return"success";case"E":return"failed";case"P":case"I":return"sandglass"}},C=(B,E)=>{B!=null&&B.viewer_360_file&&(o.value=E.clientX,s.value=E.clientY),r.value=B?.viewer_360_file},y=async B=>{l.value=!0;try{return(await i.api.apiClient.modelApi.getModels(i.api.cloudId,i.api.projectId,void 0,void 0,B)).filter(E=>i.state.models.some(k=>k.archived)||!E.archived).sort($h("updated_at",!1))}catch(E){console.error("[Models] Cannot get project models. Error: ",E)}finally{l.value=!1}return[]},I=B=>{var E;return((E=B.children)==null?void 0:E.some(k=>g(k.id)))??!1};return y(i.localContext.modelTypes).then(B=>{a.value=B}),(B,E)=>{const k=P("BIMDataSpinner"),Q=P("BIMDataIconModel3D"),S=P("BIMDataTextbox"),D=P("BIMDataCheckbox"),R=P("BIMDataRadio"),N=P("BIMDataIcon"),H=P("BIMDataDropdownList");return x(),U("div",{ref_key:"templateRef",ref:n,class:fe(["bimdata-models",{"bimdata-models--window-positioning":t.windowPositioning}])},[r.value?(x(),U("div",{key:0,class:"bimdata-models__preview",style:ge(m.value)},[b("img",{src:r.value},null,8,XBi)],4)):pe("",!0),F(H,{style:ge(`--bimdata-models-width: ${t.width};`),width:t.width,list:h.value,"element-key":"id","per-page":40,loading:l.value,class:"bimdata-models__list",disabled:h.value.length===0,onElementClick:f},{header:j(({isOpen:q})=>[b("div",$Bi,[l.value||A.value.length>0?(x(),U("div",eEi,[F(k)])):(x(),U(pt,{key:1},[b("div",tEi,[F(Q)]),b("div",{class:fe(["bimdata-models__header__number bimdata-info-length",{"bimdata-models__header__number--empty":d.value.length===0}])},[b("span",null,z(d.value.length),1)],2),b("div",iEi,[h.value.length===0?(x(),U("span",rEi,z(B.$t("model.no_model")),1)):d.value.length===0?(x(),U("span",oEi,z(B.$t("model.no_loaded_model")),1)):d.value.length===1?(x(),W(S,{key:2,text:c.value[0].name,tooltip:!q},null,8,["text","tooltip"])):d.value.length>1?(x(),U("span",nEi,z(B.$t("model.selected_models")),1)):pe("",!0)])],64))])]),element:j(({element:q,close:O})=>[b("div",{class:"bimdata-models__model",onMousemove:G=>t.preview&&C(q,G),onMouseout:E[0]||(E[0]=G=>t.preview&&C()),onClick:()=>{!u.value&&!g(q.id)&&O()}},[u.value?(x(),W(D,{key:0,"model-value":g(q.id)||I(q),disabled:q.status!=="C"||A.value.length>0},null,8,["model-value","disabled"])):(x(),W(R,{key:1,"model-value":g(q.id)||I(q),disabled:q.status!=="C"||A.value.length>0},null,8,["model-value","disabled"])),F(N,{margin:"0 calc(var(--spacing-unit) / 2)",name:v(q.status),size:"xs",class:fe({"fill-success":q.status==="C","fill-high":q.status==="E"})},null,8,["name","class"]),F(S,{class:fe({"bimdata-models__model__name":!0,"bimdata-models__model__name--disabled":q.status!=="C"||A.value.length>0}),text:q.name,width:`calc(100% -
1628
+ `),onMouseenter:e[0]||(e[0]=(...u)=>r.onMouseEnter&&r.onMouseEnter(...u)),onMouseleave:e[1]||(e[1]=(...u)=>r.onMouseLeave&&r.onMouseLeave(...u))},[F(n,{ref:"modalManagerTemplateRef"},null,512),b("div",dbi,[r.windowPlugins.leftSidePanel?(x(),W(a,{key:0,plugin:r.windowPlugins.leftSidePanel},null,8,["plugin"])):pe("",!0),b("div",Abi,[(x(!0),U(pt,null,jt(r.windowPlugins.free,u=>(x(),W(l,{key:u.name,class:fe({"window-container__content__center__viewer":u.isViewer}),plugin:u},null,8,["class","plugin"]))),128)),F(c,{position:"left",plugins:r.windowPlugins.leftButtonColumn},null,8,["plugins"]),F(c,{position:"right",plugins:r.windowPlugins.rightButtonColumn},null,8,["plugins"])]),r.windowPlugins.rightSidePanel?(x(),W(a,{key:1,plugin:r.windowPlugins.rightSidePanel},null,8,["plugin"])):pe("",!0)]),r.loading?(x(),U("div",ubi,[r.spinner&&r.spinner.component?(x(),W(ro(r.spinner.component),GA(Ma({key:0},r.spinner.props)),null,16)):(x(),W(d,{key:1,size:"20px",border:"3px"}))])):pe("",!0),r.layoutSettingsDisplayed?(x(),U("div",hbi,[F(A)])):pe("",!0)],36)}const gbi=V(cbi,[["render",pbi]]);let fbi=class{constructor(t=!0){const e=nwi(MX,null,{resizable:t});e.registerContent("default",gbi),this.settings=ka({edit:!1,swap:!1,full:!1}),this.areas=e}get resizable(){return this.areas.resizable}set resizable(t){this.areas.resizable=t}apply(t=null){this.areas.layout=t?swi(t):null}copy(t,e=!0){return awi(this.areas.layout,t,e)}open({ratio:t,direction:e,insertAfter:i,windowName:r=null,windowState:o=null,localContextId:s=null}={}){const n=r?{options:{windowName:r,windowState:o}}:null;return s===null?this.areas.splitLayout(t,e,i,n):this.areas.split(s,t,e,i,n)}swap(t,e){return this.areas.swap(t,e)}close(t){return this.areas.delete(t)}compare(t,e){var i,r;if(!t&&!e)return!0;if(!t||!e)return!1;if(typeof t=="string"&&typeof e=="string")return t===e;if(typeof t=="string"||typeof e=="string")return!1;if(t.windowName&&e.windowName){if(t.windowName!==e.windowName)return!1;const o=new Set((i=t.windowState)==null?void 0:i.modelIds),s=new Set((r=e.windowState)==null?void 0:r.modelIds);return o.size===s.size&&[...o].every(n=>s.has(n))}return t.windowName||e.windowName||t.direction!==e.direction||t.children.length!==e.children.length?!1:t.children.every((o,s)=>this.compare(o,e.children[s]))}};const mbi="@bimdata/viewer",vbi="module",Cbi="2.6.0-beta.11",ybi="A customizable BIM viewer.",Ibi=["bim","viewer","bimdata","ifc","bcf"],wbi="./index.d.ts",bbi="BIMData.io",Bbi="https://developers.bimdata.io/viewer/index.html",Ebi={email:"support@bimdata.io"},kbi=["last 2 chrome version","last 2 firefox version"],xbi="dist/bimdata-viewer.esm.min.js",Qbi="dist/bimdata-viewer.esm.min.js",Mbi={dev:"vite -c build/vite.config.dev.js",build:"node scripts/build.mjs","build:prod":"vite build -c build/vite.config.prod.js && esbuild dist/bimdata-viewer.esm.min.js --minify --outfile=dist/bimdata-viewer.esm.min.js --allow-overwrite","build:offline":"vite build -c build/vite.config.offline.js && esbuild dist/bimdata-viewer.offline.esm.min.js --minify --outfile=dist/bimdata-viewer.offline.esm.min.js --allow-overwrite","build:runtime":"vite build -c build/vite.config.runtime.js && esbuild dist/bimdata-viewer.runtime.esm.min.js --minify --outfile=dist/bimdata-viewer.runtime.esm.min.js --allow-overwrite","build:split":"vite build -c build/vite.config.split.js && esbuild dist/bimdata-viewer.split.esm.min.js --minify --outfile=dist/bimdata-viewer.split.esm.min.js --allow-overwrite","build:umd":"vite build -c build/vite.config.umd.js && esbuild dist/bimdata-viewer.umd.cjs --minify --outfile=dist/bimdata-viewer.umd.min.cjs","cy:run":"cypress run","cy:open":"cypress open",prebuild:"rm -rf dist",prepublishOnly:"npm run build","semantic-release":"semantic-release",serve:"http-server -c-1 --silent",test:"npm run test:unit & npm run build & npm run test:e2e","test:unit":"jest","test:e2e":"start-server-and-test 'npm run serve -- -p 8080' http://localhost:8080 cy:run","test:e2e-dev":"start-server-and-test 'npm run serve -- -p 8080' http://localhost:8080 cy:open",version:"echo $npm_package_version",ts:"tsc"},Sbi=["dist/*","types/*","CHANGELOG.md","README.md","package.json","package-lock.json","index.d.ts"],Dbi={"@babel/preset-env":"^7.25.4","@bimdata/2d-engine":"2.5.1","@bimdata/areas-next":"0.1.15","@bimdata/bcf-components":"6.4.3","@bimdata/components":"1.6.6","@bimdata/design-system":"2.2.1-beta.1","@bimdata/typescript-fetch-api-client":"10.15.0","@eslint/eslintrc":"^3.1.0","@eslint/js":"^9.11.1","@rollup/plugin-alias":"5.1.1","@rollup/plugin-babel":"^6.0.4","@rollup/plugin-commonjs":"^28.0.0","@rollup/plugin-image":"^3.0.3","@rollup/plugin-replace":"^6.0.1","@semantic-release/changelog":"^6.0.3","@semantic-release/commit-analyzer":"^13.0.0","@semantic-release/git":"^10.0.1","@semantic-release/github":"^11.0.0","@semantic-release/npm":"^12.0.1","@semantic-release/release-notes-generator":"^14.0.1","@vitejs/plugin-vue":"5.1.4","@vue/vue3-jest":"^29.2.6","@xeokit/xeokit-sdk":"git+https://git@github.com/Amoki/xeokit-sdk.git#f81ebaeda39e03d96f75785b257378e420416e0d","@zip.js/zip.js":"^2.7.52",async:"^3.2.6",autoprefixer:"^10.4.20","babel-core":"^7.0.0-bridge.0","babel-jest":"^29.7.0","conventional-changelog-eslint":"^6.0.0",cypress:"^13.15.0",esbuild:"^0.24.0",eslint:"9.11.1","eslint-config-prettier":"9.1.0","eslint-plugin-cypress":"3.5.0","eslint-plugin-jest":"28.8.3","eslint-plugin-prettier":"5.2.1","eslint-plugin-vue":"9.28.0","form-data":"^4.0.0",globals:"^15.9.0",html2canvas:"1.4.1","http-server":"^14.1.1",jest:"^29.7.0","jest-environment-jsdom":"^29.7.0","jest-extended":"^4.0.2",jspdf:"^2.5.2",lodash:"^4.17.21","node-fetch":"^3.3.2","pdfjs-dist":"^4.6.82",postcss:"^8.4.47",prettier:"^3.3.3",querystring:"^0.2.1","sass-embedded":"^1.79.3","semantic-release":"^24.1.1",sinon:"^19.0.2","start-server-and-test":"^2.0.8",vite:"5.4.8","vite-plugin-css-injected-by-js":"^3.5.1",vue:"3.5.9","vue-eslint-parser":"^9.4.3","vue-i18n":"^10.0.3"},Pbi={name:mbi,type:vbi,version:Cbi,description:ybi,keywords:Ibi,types:wbi,author:bbi,homepage:Bbi,bugs:Ebi,browserslist:kbi,main:xbi,module:Qbi,scripts:Mbi,files:Sbi,devDependencies:Dbi};class Rbi{constructor({plugins:e,api:i,ui:r,locale:o="fr"}){this.pluginManager=new yCi(e),this.windowManager=new wCi,this.windowManager.registerAndAddPluginsToWindows([...this.pluginManager.registeredPlugins.values()]),this.api=new aIi(i),this.globalContext=new Eke(this),this.state=bIi(this),this.shortcutManager=w7e(this.state),this.uiSettings=r||{},this.i18n=new bke(o),this._contextMenu=null,this.layout=new fbi(this.uiSettings.resizable!==!1),this.localContext=null,window.$viewer=this}get version(){return Pbi.version}get locale(){return this.i18n.locale}get contextMenu(){return this._contextMenu||y7e}set contextMenu(e){this._contextMenu=e}get registeredWindows(){return[...this.windowManager.registeredWindows.keys()]}get registeredPlugins(){return[...this.pluginManager.registeredPlugins.keys()]}get pluginsCfg(){return this.pluginManager.cfg}registerPlugin(e){this.pluginManager.registerPlugin(e),this.windowManager.registerAndAddPluginsToWindows([e])}}function Lbi(t,e={}){e.backgroundColor&&(t.style.setProperty("--bimdata-viewer-background-color",e.backgroundColor),e.backgroundColor==="transparent"&&t.style.setProperty("--areas-separator-color","transparent")),e.colorPrimary&&t.style.setProperty("--color-primary",e.colorPrimary),e.colorPrimaryLighter&&t.style.setProperty("--color-primary-lighter",e.colorPrimaryLighter),e.colorPrimaryLight&&t.style.setProperty("--color-primary-light",e.colorPrimaryLight),e.colorPrimaryDark&&t.style.setProperty("--color-primary-dark",e.colorPrimaryDark),e.colorSecondary&&t.style.setProperty("--color-secondary",e.colorSecondary),e.colorSecondaryLighter&&t.style.setProperty("--color-secondary-lighter",e.colorSecondaryLighter),e.colorSecondaryLight&&t.style.setProperty("--color-secondary-light",e.colorSecondaryLight),e.colorSecondaryDark&&t.style.setProperty("--color-secondary-dark",e.colorSecondaryDark),e.colorSilverLight&&t.style.setProperty("--color-silver-light",e.colorSilverLight),e.colorSilver&&t.style.setProperty("--color-silver",e.colorSilver),e.colorSilverDark&&t.style.setProperty("--color-silver-dark",e.colorSilverDark),e.colorGraniteLight&&t.style.setProperty("--color-granite-light",e.colorGraniteLight),e.colorGranite&&t.style.setProperty("--color-granite",e.colorGranite),e.colorSuccess&&t.style.setProperty("--color-success",e.colorSuccess),e.colorSuccessLighter&&t.style.setProperty("--color-success-Lighter",e.colorSuccessLighter),e.colorSuccessLight&&t.style.setProperty("--color-success-Light",e.colorSuccessLight),e.colorSuccessDark&&t.style.setProperty("--color-success-Dark",e.colorSuccessDark),e.colorWarning&&t.style.setProperty("--color-warning",e.colorWarning),e.colorWarningLighter&&t.style.setProperty("--color-warning-Lighter",e.colorWarningLighter),e.colorWarningLight&&t.style.setProperty("--color-warning-Light",e.colorWarningLight),e.colorWarningDark&&t.style.setProperty("--color-warning-Dark",e.colorWarningDark),e.colorHigh&&t.style.setProperty("--color-high",e.colorHigh),e.colorHighLighter&&t.style.setProperty("--color-high-lighter",e.colorHighLighter),e.colorHighLight&&t.style.setProperty("--color-high-light",e.colorHighLight),e.colorHighDark&&t.style.setProperty("--color-high-dark",e.colorHighDark),e.colorText&&t.style.setProperty("--color-text",e.colorText),(!e.backgroundColor||e.backgroundColor!=="transparent")&&t.style.setProperty("--areas-separator-color","rgba(216, 216, 216, 1)"),e.headerHeight!=null&&t.style.setProperty("--bimdata-viewer-header-height",e.headerHeight),t.style.setProperty("--areas-background-color","transparent")}const Fbi=Object.freeze({25:"GUEST",50:"USER",100:"ADMIN"}),uv=Object.freeze({READ:"read",WRITE:"write"});function tve(t){const e={};return t.forEach(i=>{const[r,o]=i.split(":");e[r]?e[r].push(o):e[r]=[o]}),e}const Tbi={token_scopes:[],usable_scopes:[],user_role:25};function ive(t=Tbi){var e,i,r,o,s,n;const a=tve(t.token_scopes),l=tve(t.usable_scopes);return{...Kie(t),tokenScopes:a,usableScopes:l,userRole:Fbi[t.user_role],user:t.user?Kie(t.user):null,hasBcfReadPermission:((e=l.bcf)==null?void 0:e.includes(uv.READ))??!1,hasBcfWritePermission:((i=l.bcf)==null?void 0:i.includes(uv.WRITE))??!1,hasModelReadPermission:((r=l.model)==null?void 0:r.includes(uv.READ))??!1,hasModelWritePermission:((o=l.model)==null?void 0:o.includes(uv.WRITE))??!1,hasDocReadPermission:((s=l.document)==null?void 0:s.includes(uv.READ))??!1,hasDocWritePermission:((n=l.document)==null?void 0:n.includes(uv.WRITE))??!1}}const Nbi={BcfFilters:{filtersButton:"Filter",filtersTitle:"Filter",priorityLabel:"Priorit\xE4t",statusLabel:"Status",assignedToLabel:"Zugewiesen an",creatorsLabel:"Erstellt von",tagsLabel:"Tags",resetButton:"Zur\xFCcksetzen",searchButton:"Suchen",undefined:"Nicht definiert",datePlaceholder:"Erstellungsdatum"},BcfSettings:{goBackButton:"Zur\xFCck",title:"BCF-Parameter",text:"Erstellen, f\xFCllen und listen Sie die BCF-Einstellungen auf, die Sie f\xFCr dieses Projekt haben m\xF6chten.",validateButton:"Die BCF-Parameter anerkennen"},BcfStatistics:{emptyText:"F\xFCgen Sie Fragen hinzu, um zugeh\xF6rige Statistiken hier anzuzeigen.",issues:"Probleme",extension:{Priority:"Priorit\xE4t",PriorityNotDefined:"Keine Priorit\xE4t",PriorityTitle:"Priorit\xE4ten",Status:"Status",StatusNotDefined:"Kein Status",StatusTitle:"Status"}},BcfTopicCard:{priority:"Priorit\xE4t:",noPriority:"Keine",assignedTo:"Zugewiesen an :",elements:"Elemente",notSpecified:"Nicht definiert",see:"Anzeigen"},BcfTopicCreationCard:{text:"Ein neues BCF-Thema erstellen",createBcfSideTitle:"Ein Problem melden"},BcfTopicForm:{dragDropImageText:"Bitte w\xE4hlen Sie eine Datei aus.",addObjectButton:"Objekt",addAnnotationButton:"Annotation",annotationButtonTooltip:"Zu diesem Thema gibt es derzeit keine Ansichten.",addPictureButton:"F\xFCgen Sie ein Bild hinzu.",titlePlaceholder:"Titel *",titleErrorMessage:"Titel fehlt",typeLabel:"Typ",priorityLabel:"Priorit\xE4t",statusLabel:"Status",stageLabel:"Phase",assignedToLabel:"Zugewiesen an",dueDateLabel:"F\xE4lligkeitsdatum (TT.MM.JJJJ)",descriptionLabel:"Beschreibung",labelsLabel:"Tags",createButton:"Best\xE4tigen",updateButton:"\xC4nderungen \xFCbernehmen",modalText:"Sie sind dabei, die Bearbeitung der Ausgabe {Name} zu beenden, aber es gibt noch ungespeicherte \xC4nderungen.",cancelButton:"\xC4nderungen verwerfen",continueButton:"\xC4nderungen fortsetzen",createTitle:"Ein Problem melden",dragDropImageTextTablet:"Foto machen",takeSnapshot:"Mach einen Schnappschuss",importFile:"Eine Datei importieren",searchPlaceholder:"Suchen",emptySearch:"kein Ergebnis"},BcfTopicOverview:{openViewer:"Im Viewer \xF6ffnen",openViewerNoModels:"Es sind keine Vorlagen zur Ansicht bereit",elements:"{count} Elemente",noElements:"kein Element",type:"Typ",noTypeSpecified:"Kein Typ angegeben",description:"Beschreibung",noDescriptionProvided:"Keine Beschreibung angegeben",assignedTo:"Zugeteilt an",notAssigned:"Nicht zugewiesen",dueDate:"F\xE4lligkeitsdatum",noDueDate:"Kein F\xE4lligkeitsdatum",informations:"Informationen",status:"Status",noStatusSpecified:"Kein Status angegeben",stage:"Phase",noStageProvided:"Keine Phase angegeben",priority:"Priorit\xE4t",priorityNotDefined:"Nicht definiert",tags:"Tags",noTags:"Keine Tags",commentButton:"Ein Kommentar ver\xF6ffentlichen",deleteText:"Sie l\xF6schen jetzt {Name}",deleteBcfButton:"Dieses BCF l\xF6schen",keepBcfButton:"Dieses BCF beibehalten",author:"Autor"},BcfTopicsTable:{headers:{index:"#",priority:"Priorit\xE4t",status:"Status",title:"Titel",creator:"Autor",date:"Datum"}},BcfTopicActionsCell:{seeButton:"Anzeigen"},BcfTopicComments:{commentButton:"Ein Kommentar verfassen",commentLabel:"Ein Kommentar verfassen",commentText:"Kommentar",cancelButton:"Abbrechen",publishButton:"Ver\xF6ffentlichen",commentsText:"Kommentare",deleteCommentText:"Diesen Kommentar l\xF6schen?",deleteButton:"L\xF6schen",takeSnapshot:"Mach einen Schnappschuss"},BcfTopicPriorityCell:{noPriority:"Keine"},SettingCard:{addButton:"ein Element hinzuf\xFCgen",cancelButton:"Abbrechen",validateButton:"Best\xE4tigen",deleteExtensionText:"Diesen Parameter l\xF6schen",deleteButton:"L\xF6schen",title:{Priority:"Priorit\xE4ten",Label:"Tags",Status:"Status",Type:"Typen",Stage:"Phasen"},input:{Priority:"Eine neue Priorit\xE4t hinzuf\xFCgen",Label:"Ein neues Etikett hinzuf\xFCgen",Status:"Einen neuen Status hinzuf\xFCgen",Type:"Einen neuen Typ hinzuf\xFCgen",Stage:"Eine neue Phase hinzuf\xFCgen"},text:{Priority:"Liste der Priorit\xE4ten",Label:"Liste von Tags",Status:"Liste der Status",Type:"Liste der Typen",Stage:"Liste der Phasen"}}},Ubi={BcfComponents:Nbi},Obi={BcfFilters:{filtersButton:"Filters",filtersTitle:"Filters",priorityLabel:"Priority",statusLabel:"Status",assignedToLabel:"Assigned to",creatorsLabel:"Created by",tagsLabel:"Tags",resetButton:"Reset",searchButton:"Search",undefined:"Not defined",datePlaceholder:"Creation date"},BcfSettings:{goBackButton:"Back",title:"BCF Settings",text:"Create, enter in, and list the BCF settings you would like to have for this project",validateButton:"Validate BCF settings"},BcfStatistics:{emptyText:"Add BCF Topics to start to have some stats here.",issues:"issues",extension:{Priority:"Priority",PriorityNotDefined:"No priority",PriorityTitle:"Priorities",Status:"Status",StatusNotDefined:"No status",StatusTitle:"Status"}},BcfTopicCard:{priority:"Priority: ",noPriority:"None",assignedTo:"Assigned to: ",elements:"Elements",notSpecified:"Not specified",see:"See"},BcfTopicCreationCard:{text:"Create a new BCF topic",createBcfSideTitle:"Report a problem"},BcfTopicForm:{dragDropImageText:"Please select a file",addObjectButton:"Object",addAnnotationButton:"Annotation",annotationButtonTooltip:"This topic has no viewpoint",addPictureButton:"Add a picture",titlePlaceholder:"Title *",titleErrorMessage:"Missing title",typeLabel:"Type",priorityLabel:"Priority",statusLabel:"Status",stageLabel:"Stage",assignedToLabel:"Assigned to",dueDateLabel:"Due date",descriptionLabel:"Description",labelsLabel:"Tags",createButton:"Validate",updateButton:"Modify this BCF",modalText:"You are about to quit editing issue {name} but there are unsaved changes.",cancelButton:"Discard changes",continueButton:"Continue editing",createTitle:"Report a problem",dragDropImageTextTablet:"Take a picture",takeSnapshot:"Take a snapshot",importFile:"Import a file",searchPlaceholder:"Search",emptySearch:"No result"},BcfTopicOverview:{openViewer:"Open in viewer",openViewerNoModels:"No model to open",elements:"{count} Elements",noElements:"No element",type:"Type",noTypeSpecified:"No type specified",description:"Description",noDescriptionProvided:"No description provided",assignedTo:"Assigned to",notAssigned:"Not assigned",dueDate:"Due date",noDueDate:"No due date",informations:"Informations",status:"Status",noStatusSpecified:"No status specified",stage:"Stage",noStageProvided:"No stage provided",priority:"Priority",priorityNotDefined:"Not defined",tags:"Tags",noTags:"No tags",commentButton:"Post a comment",deleteText:"You are about to delete {name}",deleteBcfButton:"Delete this BCF",keepBcfButton:"Keep this BCF",author:"Author"},BcfTopicsTable:{headers:{index:"#",priority:"Priority",status:"Status",title:"Title",creator:"Author",date:"Date"}},BcfTopicActionsCell:{seeButton:"See"},BcfTopicComments:{commentButton:"Post a comment",commentLabel:"Post a comment",commentText:"Comment",cancelButton:"Cancel",publishButton:"Publish",commentsText:"Comments",deleteCommentText:"Delete this comment ?",deleteButton:"Delete",takeSnapshot:"Take a snapshot"},BcfTopicPriorityCell:{noPriority:"None"},SettingCard:{addButton:"add an element",cancelButton:"Cancel",validateButton:"Validate",deleteExtensionText:"Remove this setting",deleteButton:"Delete",title:{Priority:"Priorities",Label:"Labels",Status:"Status",Type:"Types",Stage:"Stages"},input:{Priority:"Add a new priority",Label:"Add a new label",Status:"Add new status",Type:"Add a new type",Stage:"Add a new stage"},text:{Priority:"Priority list",Label:"Labels list",Status:"Status list",Type:"Type list",Stage:"Stage list"}}},Hbi={BcfComponents:Obi},Gbi={BcfFilters:{filtersButton:"Filtros",filtersTitle:"Filtros",priorityLabel:"Prioridad",statusLabel:"Estado",assignedToLabel:"Asignado a",creatorsLabel:"Creado por",tagsLabel:"Etiquetas:",resetButton:"Restablecer",searchButton:"Buscar en",undefined:"No definido",datePlaceholder:"Fecha de creaci\xF3n"},BcfSettings:{goBackButton:"Volver",title:"Par\xE1metros del BCF",text:"Cree, rellene y enumere los par\xE1metros del BCF que desea tener en este proyecto",validateButton:"Validar los par\xE1metros del BCF"},BcfStatistics:{emptyText:"A\xF1ada preguntas para ver las estad\xEDsticas asociadas aqu\xED.",issues:"problemas",extension:{Priority:"Prioridad",PriorityNotDefined:"Sin prioridad",PriorityTitle:"Prioridades",Status:"Estado",StatusNotDefined:"Sin estado",StatusTitle:"Estatutos"}},BcfTopicCard:{priority:"Prioridad :",noPriority:"Sin",assignedTo:"Asignado a :",elements:"Elementos",notSpecified:"No definido",see:"Ver"},BcfTopicCreationCard:{text:"Crear un nuevo tema BCF",createBcfSideTitle:"Informar de un problema"},BcfTopicForm:{dragDropImageText:"Seleccione un archivo",addObjectButton:"Objeto",addAnnotationButton:"Anotaci\xF3n",annotationButtonTooltip:"Actualmente este tema no posee ning\xFAn punto de vista",addPictureButton:"A\xF1adir una imagen",titlePlaceholder:"T\xEDtulo *",titleErrorMessage:"Falta el t\xEDtulo",typeLabel:"Tipo",priorityLabel:"Prioridad",statusLabel:"Estado",stageLabel:"Fase",assignedToLabel:"Asignado a",dueDateLabel:"Fecha de vencimiento (DD/MM/AAAA)",descriptionLabel:"Descripci\xF3n",labelsLabel:"Etiquetas",createButton:"Validar",updateButton:"Modificar este BCF",modalText:"Est\xE1 a punto de salir de la edici\xF3n del problema de {name} pero hay cambios sin guardar.",cancelButton:"Cancelar los cambios",continueButton:"Continuar con los cambios",createTitle:"Informar de un problema",dragDropImageTextTablet:"Tomar una fotograf\xEDa",takeSnapshot:"Tomar un snapshot",importFile:"Importar un archivo",searchPlaceholder:"Buscar",emptySearch:"No hay resultados"},BcfTopicOverview:{openViewer:"Abrir en el visor",openViewerNoModels:"No hay ning\xFAn modelo listo para la visualizaci\xF3n",elements:"{count} Elementos",noElements:"Ning\xFAn elemento",type:"Tipo",noTypeSpecified:"No se especifica el tipo",description:"Descripci\xF3n",noDescriptionProvided:"No hay descripci\xF3n",assignedTo:"Asignado a",notAssigned:"No asignado",dueDate:"Plazo",noDueDate:"Sin fecha de vencimiento",informations:"Informaci\xF3n",status:"Estado",noStatusSpecified:"No se especifica el estado",stage:"Fase",noStageProvided:"No se indica ninguna fase",priority:"Prioridad",priorityNotDefined:"No definido",tags:"Etiquetas",noTags:"Sin etiquetas",commentButton:"Publicar un comentario",deleteText:"Est\xE1s a punto de borrar {name}",deleteBcfButton:"Borrar este BCF",keepBcfButton:"Mantenga este BCF",author:"Autor"},BcfTopicsTable:{headers:{index:"#",priority:"Prioridad",status:"Estado",title:"T\xEDtulo",creator:"Autor",date:"Fecha"}},BcfTopicActionsCell:{seeButton:"Ver"},BcfTopicComments:{commentButton:"Publicar un comentario",commentLabel:"Publicar un comentario",commentText:"Comentario",cancelButton:"Cancelar",publishButton:"Publicar",commentsText:"comentarios",deleteCommentText:"\xBFBorrar este comentario?",deleteButton:"Borrar",takeSnapshot:"Tomar un snapshot"},BcfTopicPriorityCell:{noPriority:"Sin"},SettingCard:{addButton:"a\xF1adir un elemento",cancelButton:"Cancelar",validateButton:"Validar",deleteExtensionText:"Borrar esta configuraci\xF3n",deleteButton:"Borrar",title:{Priority:"Prioridades",Label:"Etiquetas:",Status:"Estatutos",Type:"Tipos",Stage:"Fases"},input:{Priority:"A\xF1adir una nueva prioridad",Label:"A\xF1adir una nueva etiqueta",Status:"A\xF1adir un nuevo estado",Type:"A\xF1adir un nuevo tipo",Stage:"A\xF1adir una nueva fase"},text:{Priority:"Lista de prioridades",Label:"Lista de etiquetas",Status:"Lista de estatutos",Type:"Lista de tipos",Stage:"Lista de fases"}}},jbi={BcfComponents:Gbi},Vbi={BcfFilters:{filtersButton:"Filtres",filtersTitle:"Filtres",priorityLabel:"Priorit\xE9",statusLabel:"Statut",assignedToLabel:"Assign\xE9 \xE0",creatorsLabel:"Cr\xE9\xE9 par",tagsLabel:"Tags",resetButton:"R\xE9initialiser",searchButton:"Rechercher",undefined:"Non d\xE9fini",datePlaceholder:"Date de cr\xE9ation"},BcfSettings:{goBackButton:"Retour",title:"Param\xE8tres BCF",text:"Cr\xE9ez, renseignez et listez les param\xE8tres BCF que vous souhaitez avoir sur ce projet",validateButton:"Valider les param\xE8tres BCF"},BcfStatistics:{emptyText:"Ajoutez des questions pour voir les statistiques associ\xE9es ici.",issues:"probl\xE8mes",extension:{Priority:"Priorit\xE9",PriorityNotDefined:"Aucune priorit\xE9",PriorityTitle:"Priorit\xE9s",Status:"Statut",StatusNotDefined:"Aucun statut",StatusTitle:"Statuts"}},BcfTopicCard:{priority:"Priorit\xE9 : ",noPriority:"Aucune",assignedTo:"Assign\xE9 \xE0 : ",elements:"{n} \xC9lements",notSpecified:"Non d\xE9fini",see:"Voir"},BcfTopicCreationCard:{text:"Cr\xE9er un nouveau topic BCF",createBcfSideTitle:"Signaler un probl\xE8me"},BcfTopicForm:{dragDropImageText:"Veuillez s\xE9lectionner un fichier",addObjectButton:"Objet",addAnnotationButton:"Annotation",annotationButtonTooltip:"Ce topic ne poss\xE8de actuellement aucun point de vue",addPictureButton:"Ajouter une image",titlePlaceholder:"Titre *",titleErrorMessage:"Titre manquant",typeLabel:"Type",priorityLabel:"Priorit\xE9",statusLabel:"Statut",stageLabel:"Phase",assignedToLabel:"Assign\xE9 \xE0",dueDateLabel:"Date d'\xE9ch\xE9ance",descriptionLabel:"Description",labelsLabel:"Tags",createButton:"Valider",updateButton:"Modifier ce BCF",modalText:"Vous \xEAtes sur le point de quitter l'\xE9dition de l'issue {name} mais il y'a des modifications non enregistr\xE9es.",cancelButton:"Annuler les modifications",continueButton:"Continuer les modifications",createTitle:"Signaler un probl\xE8me",dragDropImageTextTablet:"Prendre une photo",takeSnapshot:"Prendre un snapshot",importFile:"Importer un fichier",searchPlaceholder:"Rechercher",emptySearch:"Pas de r\xE9sultat"},BcfTopicOverview:{openViewer:"Ouvrir dans le viewer",openViewerNoModels:"Il n'y a aucun mod\xE8le pr\xEAt pour une visualisation",elements:"{count} \xC9lements",noElements:"Aucun \xE9l\xE9ment concern\xE9",type:"Type",noTypeSpecified:"Pas de type sp\xE9cifi\xE9",description:"Description",noDescriptionProvided:"Pas de description renseign\xE9e",assignedTo:"Assign\xE9 \xE0",notAssigned:"Non assign\xE9",dueDate:"\xC9ch\xE9ance",noDueDate:"Pas de date d'\xE9ch\xE9ance",informations:"Informations",status:"Statut",noStatusSpecified:"Pas de statut sp\xE9cifi\xE9",stage:"Phase",noStageProvided:"Pas de phase renseign\xE9e",priority:"Priorit\xE9",priorityNotDefined:"Non d\xE9fini",tags:"Tags",noTags:"Pas de tags",commentButton:"Poster un commentaire",deleteText:"Vous \xEAtes sur le point de supprimer {name}",deleteBcfButton:"Supprimer ce BCF",keepBcfButton:"Conserver ce BCF",author:"Auteur"},BcfTopicsTable:{headers:{index:"#",priority:"Priorit\xE9",status:"Statut",title:"Titre",creator:"Auteur",date:"Date"}},BcfTopicActionsCell:{seeButton:"Voir"},BcfTopicComments:{commentButton:"Poster un commentaire",commentLabel:"Poster un commentaire",commentText:"Commentaire",cancelButton:"Annuler",publishButton:"Publier",commentsText:"commentaires",deleteCommentText:"Supprimer ce commentaire ?",deleteButton:"Supprimer",takeSnapshot:"Prendre un snapshot"},BcfTopicPriorityCell:{noPriority:"Aucune"},SettingCard:{addButton:"ajouter un \xE9l\xE9ment",cancelButton:"Annuler",validateButton:"Valider",deleteExtensionText:"Supprimmer ce param\xE8tre",deleteButton:"Supprimer",title:{Priority:"Priorit\xE9s",Label:"Tags",Status:"Statuts",Type:"Types",Stage:"Phases"},input:{Priority:"Ajouter une nouvelle priorit\xE9",Label:"Ajouter un nouveau label",Status:"Ajouter un nouveau statut",Type:"Ajouter un nouveau type",Stage:"Ajouter une nouvelle phase"},text:{Priority:"Liste des priorit\xE9s",Label:"Liste des tags",Status:"Liste des statuts",Type:"Liste des types",Stage:"Liste des phases"}}},qbi={BcfComponents:Vbi},_bi={BcfFilters:{filtersButton:"Filtri",filtersTitle:"Filtri",priorityLabel:"Priorit\xE0",statusLabel:"Stato",datePlaceholder:"Data di creazione",assignedToLabel:"Assegnato a",creatorsLabel:"Creato da",tagsLabel:"Etichette",resetButton:"Ripristina",searchButton:"Cerca",undefined:"Non definito"},BcfSettings:{goBackButton:"Indietro",title:"Parametri BCF",text:"Creare, notificare e elencare i parametri BCF che si desidera avere su questo progetto",validateButton:"Conferma i parametri BCF"},BcfStatistics:{emptyText:"Aggiungi delle domande per vedere le statistiche associate qui.",issues:"problemi",extension:{Priority:"Priorit\xE0",PriorityNotDefined:"Nessuna priorit\xE0",PriorityTitle:"Priorit\xE0",Status:"Stato",StatusNotDefined:"Nessuno stato",StatusTitle:"Stati"}},BcfTopicCard:{priority:"Priorit\xE0:",noPriority:"Nessuno",assignedTo:"Assegnato a:",elements:"Elementi",noElements:"0 elementi",notSpecified:"Non definito",see:"Visualizza"},BcfTopicCreationCard:{text:"Crea un nuovo topic BCF",createBcfSideTitle:"Segnala un problema"},BcfTopicForm:{dragDropImageText:"Selezionare un file",addObjectButton:"Oggetto",addAnnotationButton:"Annotazione",annotationButtonTooltip:"Attualmente questo argomento non presenta alcun punto di vista",addPictureButton:"Aggiungere un'immagine",titlePlaceholder:"Titolo *",titleErrorMessage:"Titolo mancante",typeLabel:"Tipo",priorityLabel:"Priorit\xE0",statusLabel:"Stato",stageLabel:"Fase",assignedToLabel:"Assegnato a",dueDateLabel:"Data di scadenza",descriptionLabel:"Descrizione",labelsLabel:"Tag",createButton:"Conferma",updateButton:"Modificare questo BCF",modalText:"State per abbandonare la modifica di {name} ma ci sono modifiche non salvate.",cancelButton:"Annullare le modifiche",continueButton:"Continuare le modifiche",createTitle:"Segnala un problema"},BcfTopicOverview:{openViewer:"Apri nel visualizzatore",openViewerNoModels:"Non esistono modelli pronti per la visualizzazione",elements:"{count} Elementi",noElements:"Nessun elemento",type:"Tipo",noTypeSpecified:"Nessun tipo specificato",description:"Descrizione",noDescriptionProvided:"Nessuna descrizione inserita",assignedTo:"Assegnato a",notAssigned:"Non assegnato",dueDate:"Scadenza",noDueDate:"Nessuna data di scadenza",informations:"Informazioni",status:"Stato",noStatusSpecified:"Nessuno stato specificato",stage:"Fase",noStageProvided:"Nessuna fase inserita",priority:"Priorit\xE0",priorityNotDefined:"Non definita",tags:"Etichette",noTags:"Nessuna etichetta",commentButton:"Pubblica un commento",deleteText:"Stai per eliminare {name}",deleteBcfButton:"Elimina questo BCF",keepBcfButton:"Conserva questo BCF",author:"Autore"},BcfTopicsTable:{headers:{index:"#",priority:"Priorit\xE0",status:"Stato",title:"Titolo",creator:"Autore",date:"Data"}},BcfTopicActionsCell:{seeButton:"Visualizza"},BcfTopicComments:{commentButton:"Pubblica un commento",commentLabel:"Pubblica un commento",commentText:"Commento",cancelButton:"Annulla",publishButton:"Pubblica",commentsText:"commenti",deleteCommentText:"Eliminare questo commento?",deleteButton:"Elimina"},BcfTopicPriorityCell:{noPriority:"Nessuno"},SettingCard:{addButton:"aggiungi un elemento",cancelButton:"Annulla",validateButton:"Conferma",deleteExtensionText:"Elimina questo parametro",deleteButton:"Elimina",title:{Priority:"Priorit\xE0",Label:"Etichette",Status:"Stati",Type:"Tipi",Stage:"Fasi"},input:{Priority:"Aggiungi una nuova priorit\xE0",Label:"Aggiungi una nuova etichetta",Status:"Aggiungi un nuovo stato",Type:"Aggiungi un nuovo tipo",Stage:"Aggiungi una nuova fase"},text:{Priority:"Elenco delle priorit\xE0",Label:"Elenco delle etichette",Status:"Elenco degli stati",Type:"Elenco dei tipi",Stage:"Elenco delle fasi"}}},zbi={BcfComponents:_bi},Kbi={de:Ubi,en:Hbi,es:jbi,fr:qbi,it:zbi},Jbi=({apiClient:t,fetchUsers:e,i18nPlugin:i}={})=>({install(r){t?Gr.setup({apiClient:t,fetchUsers:e}):console.error("[BCF Components Plugin] No api client provided. You must provide an api client for the components to work properly."),i?Object.entries(Kbi).forEach(([o,s])=>{i.global.mergeLocaleMessage(o,s)}):console.warn("[BCF Components Plugin] No i18n instance provided. You should either provide an i18n instance or define your own translations in order have text displayed properly."),Object.entries(_De).forEach(([o,s])=>{r.component(o,s)})}}),Ybi={title:"Building Maker",back:"Zur\xFCck",list:{text:"Erstellen und bearbeiten Sie die Etagen und laden Sie anschlie\xDFend Ihre PDFs herunter.",createButton:"Neues Projekt",updateButton:"Umbenennen",deleteButton:"L\xF6schen"},form:{text:"Erstellen und bearbeiten Sie die Etagen und laden Sie anschlie\xDFend Ihre PDFs herunter.",input:"Name des Geb\xE4udes",error:"Ung\xFCltiger Name",createButton:"Erstellen",updateButton:"Best\xE4tigen"},view:{addStoreyButton:"Etage",addFileButton:"Grundriss",closeButton:"Fertigstellen",submitFilesButton:"Best\xE4tigen"},storeyForm:{title:"Neue Etage",input:"Name",error:"Ung\xFCltiger Name",cancelButton:"Abbrechen",submitButton:"Best\xE4tigen"}},Wbi={creationFormTitle:"Ordner erstellen",renameFormPlaceholder:"Datei- / Ordnernam",nameInputPlaceholder:"Ordnername",emptyFolder:"Dieser Ordner ist leer",newFolderSuccess:"Neuer Ordner erstellt",renameFolderSuccess:"Umbenannter Ordner",deleteFolderSuccess:"Ordner gel\xF6scht",newFileSuccess:"Datei hinzugef\xFCgt",renameFileSuccess:"Umbenannte Datei",deleteFileSuccess:"Datei gel\xF6scht",nameInputErrorMessage:"Ung\xFCltiger name",cancel:"Abbrechen",submit:"Best\xE4tigen",buttonText:"Neuer Ordner",addFileButtonText:"Datei laden",rename:"Umbenennen",view:"Sehen",download:"Herunterladen",delete:"L\xF6schen",deleteTitle:"Dateien l\xF6schen",deleteDetail:"Sie sind im Begriff, die folgenden Dateien / Ordner endg\xFCltig zu l\xF6schen"},Zbi={BuildingMaker:Ybi,FileManager:Wbi},Xbi={title:"Building",back:"Back",list:{text:"Create and edit the layers, then download your PDFs.",createButton:"New project",updateButton:"Rename",deleteButton:"Delete"},form:{text:"Create and edit the layers, then download your PDFs.",input:"Building name",error:"Invalid",createButton:"Create",updateButton:"Confirm"},view:{addStoreyButton:"Storey",addFileButton:"Plan",closeButton:"Finish",submitFilesButton:"Validate"},storeyForm:{title:"New storey",input:"Name",error:"Invalid name",cancelButton:"Cancel",submitButton:"Validate"}},$bi={creationFormTitle:"Create folder",renameFormPlaceholder:"Folder/File name",nameInputPlaceholder:"Folder name",emptyFolder:"This folder is empty",newFolderSuccess:"New folder created",renameFolderSuccess:"Folder renamed",deleteFolderSuccess:"Folder deleted",newFileSuccess:"File added",renameFileSuccess:"File renamed",deleteFileSuccess:"File deleted",nameInputErrorMessage:"Invalid name",cancel:"Cancel",submit:"Submit",buttonText:"New folder",addFileButtonText:"Upload a file",rename:"Rename",view:"View",download:"Download",delete:"Delete",deleteTitle:"Deleting Files",deleteDetail:"You are about to permanently delete the following files / folders",dmsRoot:"Root of the project's DMS",validate:"Validate",back:"Back",pdfPageSelectorTitle:"Select a page"},eBi={title:"Meta-Building Structure",tab:{structure:"Structure",zones:"Zones",equipments:"Equipments"},StoreySelector:{placeholder:"Select a storey"},StructureView:{search:"Search"}},tBi={title:"Photosphere Building"},iBi={BuildingMaker:Xbi,FileManager:$bi,MetaBuildingStructure:eBi,PhotosphereBuilding:tBi},rBi={title:"Building Maker",back:"Vuelta",list:{text:"Cree y edite los pisos despu\xE9s cargue los PDF.",createButton:"Nuevo proyecto",updateButton:"Renombrar",deleteButton:"Suprimir"},form:{text:"Cree y edite los pisos despu\xE9s cargue los PDF.",input:"Nombre del edificio",error:"Nombre no v\xE1lido",createButton:"Crear",updateButton:"Validar"},view:{addStoreyButton:"Piso",addFileButton:"Plano",closeButton:"Terminar",submitFilesButton:"Validar"},storeyForm:{title:"Nuevo piso",input:"Nombre",error:"Nombre no v\xE1lido",cancelButton:"Anular",submitButton:"Validar"}},oBi={creationFormTitle:"Crear un archivo",renameFormPlaceholder:"Nombre de archivo / carpeta",nameInputPlaceholder:"Nombre de la carpeta",emptyFolder:"Esta carpeta est\xE1 vac\xEDa",newFolderSuccess:"Nueva carpeta creada",renameFolderSuccess:"Carpeta renombrada",deleteFolderSuccess:"Carpeta eliminada",newFileSuccess:"Archivo agregado",renameFileSuccess:"Archivo renombrado",deleteFileSuccess:"Archivo eliminado",nameInputErrorMessage:"Nombre inv\xE1lida",cancel:"Cancelar",submit:"Validar",buttonText:"Carpeta nueva",addFileButtonText:"Cargar un archivo",rename:"Renombrar",view:"Ver",download:"Descargar",delete:"Borrar",deleteTitle:"Eliminar archivos",deleteDetail:"Est\xE1 a punto de eliminar permanentemente los siguientes archivos / carpetas"},nBi={BuildingMaker:rBi,FileManager:oBi},sBi={title:"Building Maker",back:"Retour",list:{text:"Cr\xE9ez et \xE9ditez les \xE9tages puis t\xE9l\xE9chagez vos PDF.",createButton:"Nouveau projet",updateButton:"Renommer",deleteButton:"Supprimer"},form:{text:"Cr\xE9ez et \xE9ditez les \xE9tages puis t\xE9l\xE9chagez vos PDF.",input:"Nom du b\xE2timent",error:"Nom invalide",createButton:"Cr\xE9er",updateButton:"Valider"},view:{addStoreyButton:"\xC9tage",addFileButton:"Plan",closeButton:"Terminer",submitFilesButton:"Valider"},storeyForm:{title:"Nouvel \xE9tage",input:"Nom",error:"Nom invalide",cancelButton:"Annuler",submitButton:"Valider"}},aBi={creationFormTitle:"Cr\xE9er un dossier",renameFormPlaceholder:"Nom du fichier/dosier",nameInputPlaceholder:"Nom du dossier",emptyFolder:"Ce dossier est vide",newFolderSuccess:"Nouveau dossier cr\xE9\xE9",renameFolderSuccess:"Dossier renomm\xE9",deleteFolderSuccess:"Dossier supprim\xE9",newFileSuccess:"Fichier ajout\xE9",renameFileSuccess:"Fichier renomm\xE9",deleteFileSuccess:"Fichier supprim\xE9",nameInputErrorMessage:"Nom invalide",cancel:"Annuler",submit:"Valider",buttonText:"Nouveau dossier",addFileButtonText:"Charger un fichier",rename:"Renommer",view:"Voir",download:"T\xE9l\xE9charger",delete:"Supprimer",deleteTitle:"Supression de fichiers",deleteDetail:"Vous \xEAtes sur le point de supprimer d\xE9finitivement les fichiers/dossiers suivants",dmsRoot:"Racine de la GED du projet",validate:"Valider",back:"Retour",pdfPageSelectorTitle:"S\xE9lectionner une page"},lBi={title:"Structure M\xE9ta-Building",tab:{structure:"Structure",zones:"Zones",equipments:"Equipements"},StoreySelector:{placeholder:"S\xE9lectionner un \xE9tage"},StructureView:{search:"Rechercher"}},cBi={title:"Photosph\xE8re Building"},dBi={BuildingMaker:sBi,FileManager:aBi,MetaBuildingStructure:lBi,PhotosphereBuilding:cBi},ABi={title:"Building Maker",back:"Reso",list:{text:"Crea e modifica i piani e poi scarica i tuoi PDF.",createButton:"Nuovo progetto",updateButton:"Rinominare",deleteButton:"Eliminare"},form:{text:"Crea e modifica i piani e poi scarica i tuoi PDF.",input:"Nome della costruzione",error:"Nome non corretto",createButton:"Creare",updateButton:"Convalidare"},view:{addStoreyButton:"Piano",addFileButton:"Progetto",closeButton:"Finire",submitFilesButton:"Convalidare"},storeyForm:{title:"Nuovo piano",input:"Nome",error:"Nome non corretto",cancelButton:"Annullare",submitButton:"Convalidare"}},uBi={creationFormTitle:"Crea una cartella",renameFormPlaceholder:"Nome file/cartella",nameInputPlaceholder:"Nome della cartella",emptyFolder:"Questa cartella \xE8 vuota",newFolderSuccess:"Nuova cartella creata",renameFolderSuccess:"Cartella rinominata",deleteFolderSuccess:"Cartella eliminata",newFileSuccess:"File aggiunto",renameFileSuccess:"File rinominato",deleteFileSuccess:"File cancellato",nameInputErrorMessage:"Nome non valido",cancel:"Annulla",submit:"Invia",buttonText:"Nuova cartella",addFileButtonText:"Carica un file",rename:"Rinominare",view:"Vedere",download:"Scaricare",delete:"Cancellare",deleteTitle:"Eliminazione di file",deleteDetail:"Stai per eliminare definitivamente i seguenti file/cartelle"},hBi={BuildingMaker:ABi,FileManager:uBi},pBi={de:Zbi,en:iBi,es:nBi,fr:dBi,it:hBi},gBi=({i18nPlugin:t}={})=>({install(e){t?Object.entries(pBi).forEach(([i,r])=>{t.global.mergeLocaleMessage(i,r)}):console.warn("[BIMData Components Plugin] No i18n instance provided. You should either provide an i18n instance or define your own translations in order have text displayed properly."),Object.entries(yui).forEach(([i,r])=>{e.component(i,r)})}}),fBi={beforeMount(t,e){if(typeof e.value!="function")throw Error(`click away directive needs function, got ${typeof e.value}`);t.clickAwayHandler=i=>{(i.path||i.composedPath&&i.composedPath()).find(r=>r===t)||e.value()},window.addEventListener("mousedown",t.clickAwayHandler,!0)},unmounted(t){window.removeEventListener("mousedown",t.clickAwayHandler,!0),delete t.clickAwayHandler}},mBi=Object.freeze(Object.defineProperty({__proto__:null,BIMDataClickAway:Rd,BIMDataClickInputAway:fBi},Symbol.toStringTag,{value:"Module"})),vBi=t=>({install(e){Object.entries(xct).forEach(([i,r])=>{e.component(i,r)}),Object.entries(mBi).forEach(([i,r])=>e.directive(i.split("BIMData")[1],r))}}),CBi={name:"LiWrapper",render(){return Oo("li",this.$slots.default())}};function yBi(t,e){var i=new Set([]);return t.forEach(r=>{e.has(r)||i.add(r)}),i}const tA=fs("id"),IBi=({contextMenu:t,objects:e=[],state:i=t.$viewer.state,pictos:r})=>[{name:"selectAll",get group(){return t.groupPositions.select},position:1,get label(){return t.$t("context_menu.select_all")},get picto(){return r.get(this.name)},execute:()=>i.selectObjects(e.filter(bd(Ji("visible"),V0("selected"))).map(tA)),predicate:()=>e.some(bd(Ji("visible"),V0("selected")))},{name:"deselectAll",get group(){return t.groupPositions.select},position:2,get label(){return t.$t("context_menu.deselect_all")},get picto(){return r.get(this.name)},execute:()=>i.deselectObjects(e.filter(Ji("selected")).map(tA)),predicate:()=>e.some(Ji("selected"))},{name:"selectSimilar",get group(){return t.groupPositions.select},position:3,get label(){return t.$t("context_menu.select_similar")},get picto(){return r.get(this.name)},execute(){const o=e.filter(s=>s.visible&&s.type===this.selectedObject.type&&s.id!==this.selectedObject.id).map(tA);i.selectObjects(o)},selectedObject:null,predicate(){const o=e.filter(bd(Ji("visible"),Ji("selected")));return o.length===1&&o[0].type!==void 0?(this.selectedObject=o[0],!0):(this.selectedObject=null,!1)}},{name:"reverseSelection",get label(){return t.$t("context_menu.reverse_selection")},get group(){return t.groupPositions.select},position:4,execute:()=>{const o=new Set(e.filter(Ji("selected")).map(tA)),s=new Set(e.filter(Ji("visible")).map(tA));i.selectObjects(Array.from(yBi(s,o)),{exclusive:!0})},predicate:()=>e.some(bd(V0("selected"),Ji("visible")))&&e.some(bd(Ji("selected"),Ji("visible")))},{name:"showAll",get group(){return t.groupPositions.visibility},position:1,get label(){return t.$t("context_menu.show_all")},get picto(){return r.get(this.name)},execute:()=>i.showObjects(e.filter(V0("visible")).map(tA)),predicate:()=>e.some(V0("visible"))},{name:"hide",get group(){return t.groupPositions.visibility},position:2,get label(){return t.$t("context_menu.hide")},get picto(){return r.get(this.name)},objectsToHide:null,execute(){const o=this.objectsToHide.filter(Ji("selected"));o.length>0&&i.deselectObjects(o.map(tA)),i.hideObjects(this.objectsToHide.map(tA))},predicate(){return this.objectsToHide=e.filter(bd(Ji("selected"),Ji("visible"))),this.objectsToHide.length>0}},{name:"hideAll",get group(){return t.groupPositions.visibility},position:3,get label(){return t.$t("context_menu.hide_all")},execute:()=>{const o=e.filter(Ji("visible"));o.some(Ji("selected"))&&i.deselectObjects(o.filter(Ji("selected")).map(tA)),i.hideObjects(o.map(tA))},predicate:()=>e.some(Ji("visible"))}].filter(o=>o.predicate()),wBi={components:{LiWrapper:CBi},inject:["$viewer"],data(){return{defaultPrevented:!1,displayed:!1,top:null,bottom:null,left:null,width:200,nextCommandId:1,currentCommands:[],contextCommands:[],registeredCommands:[],groupPositions:{select:10,visibility:20},asyncPredicateRunning:!1}},computed:{position(){return{top:this.top?this.top+"px":"unset",bottom:this.bottom?this.bottom+"px":"unset",left:this.left+"px",width:this.width+"px"}}},watch:{displayed(t){t?document.addEventListener("keydown",this.onKeyDown):document.removeEventListener("keydown",this.onKeyDown)}},created(){this.$viewer.contextMenu=this,this.asyncPredicates=new Set},methods:{onKeyDown(t){t.key==="Escape"&&this.away()},setPosition(t){const e=(document.fullscreenElement?document.fullscreenElement:this.$parent.$el).getBoundingClientRect();this.left=t.clientX-e.left,this.top=t.clientY-e.top,this.left+this.width>e.width&&(this.left=this.left-this.width),t.clientY>e.top+e.height/2?(this.bottom=e.height-this.top,this.top=null):this.bottom=null},typeCheckCommand(t={}){let e=null;if((!t.execute||typeof t.execute!="function")&!t.component&&(e="Cannot register context menu command. A command must have an execute function or a component property."),t.label||(e="Cannot register context menu command. A command must have a label."),e)throw console.error(e),new Error(e);return t.id=this.nextCommandId++,t},open(t){this.currentCommands=[],this.setPosition(t),this.originEvent=t,t.preventDefault(),this.setCurrentCommands(),this.groupCurrentCommands(),this.defaultPrevented=!1,this.displayed=!0,document.fullscreenElement?(this.$el.parentElement.removeChild(this.$el),this.adoptiveParent=document.fullscreenElement,this.adoptiveParent.appendChild(this.$el)):this.adoptiveParent&&this.adoptiveParent!==this.$viewer.globalContext.el&&(this.adoptiveParent.removeChild(this.$el),this.$viewer.globalContext.el.appendChild(this.$el),this.adoptiveParent=null)},setCurrentCommands(){this.asyncPredicates.clear(),this.asyncPredicateRunning=!1,this.defaultPrevented||this.registeredCommands.forEach(async t=>{if(typeof t.predicate=="function"){const e=t.predicate(this.$viewer.globalContext.activeLocalContext);if(e===!0)this.currentCommands.push(t);else if(typeof e?.then=="function"){this.asyncPredicates.add(e),this.asyncPredicateRunning=!0;const i=await e;this.asyncPredicates.has(e)&&(this.asyncPredicates.delete(e),this.asyncPredicateRunning=this.asyncPredicates.size>0,i===!0&&this.currentCommands.push(t))}}else this.currentCommands.push(t)}),this.currentCommands.push(...this.contextCommands),this.contextCommands=[]},getDefaultCommands({objects:t=[],state:e=this.$viewer.state,context:i=null}){const r=new Map;return i&&this.$viewer.shortcutManager.getShortcuts(i).forEach(o=>r.set(o.name,o.key)),IBi({contextMenu:this,objects:t,state:e,pictos:r})},executeCommand(t){if(t.execute&&(t.execute(this.originEvent),this.displayed=!1),t.component&&!t.menu)throw new Error("Command with component property must have a `menu` property")},away(){this.displayed=!1},groupCurrentCommands(){const t=new Map;this.currentCommands.forEach(i=>{(i.group===null||i.group===void 0)&&(i.group=0),t.has(i.group)?t.get(i.group).push(i):t.set(i.group,[i])}),t.forEach(i=>i.sort((r,o)=>(r.position=r.position||0,o.position=o.position||0,r.position-o.position)));const e=[...t.keys()].sort((i,r)=>i-r).map(i=>t.get(i)).flat();this.currentCommands=e},isGroupIntersection(t){if(t===0)return!1;const e=this.currentCommands[t-1],i=this.currentCommands[t];return e.group<i.group},registerContextCommand(t){const e=this.typeCheckCommand(t);return this.contextCommands.push(e),t.id},registerCommand(t){const e=this.typeCheckCommand(t);return this.registeredCommands.push(e),t.id},unregisterCommand(t){return this.registeredCommands.find(e=>e.id===t)?(this.registeredCommands=this.registeredCommands.filter(e=>e.id!==t),!0):!1},preventDefault(){this.defaultPrevented=!0}}},bBi={key:0,class:"separator"},BBi={class:"menu-text"},EBi={key:1,class:"menu-picto"},kBi={key:0,class:"context-menu__spinner"};function xBi(t,e,i,r,o,s){const n=P("BIMDataIconChevron"),a=P("LiWrapper"),l=P("BIMDataSpinner"),c=Ni("click-away");return o.displayed&&(o.currentCommands.length||o.asyncPredicateRunning)?Et((x(),U("ul",{key:0,class:"bimdata-list context-menu",style:ge(s.position)},[(x(!0),U(pt,null,jt(o.currentCommands,(d,A)=>(x(),W(a,{key:d.label,class:"context-menu__element",onClick:u=>s.executeCommand(d)},{default:j(()=>[s.isGroupIntersection(A)?(x(),U("div",bBi)):pe("",!0),b("div",BBi,z(d.label),1),!d.component&&d.picto?(x(),U("span",EBi,z(d.picto),1)):d.component?(x(),W(n,{key:2,size:"xxs",class:"fill-primary"})):pe("",!0)]),_:2},1032,["onClick"]))),128)),o.asyncPredicateRunning?(x(),U("li",kBi,[F(l)])):pe("",!0)],4)),[[c,s.away]]):pe("",!0)}const QBi=V(wBi,[["render",xBi],["__scopeId","data-v-5b87d4a3"]]),MBi={name:"ViewerHeader",inject:["$viewer"],props:{visible:{type:Boolean,default:!0}},setup(){const t=St("$viewer"),e=ka(new Map),i=o=>{if(!o.name)throw new TypeError("[Viewer Header] Content must have a name");if(e.has(o.name))throw new Error(`[Viewer Header] Content with name ${o.name} already exists`);e.set(o.name,o)},r=o=>e.has(o)?(e.delete(o),!0):!1;return{logo:t.uiSettings.bimdataLogo!==!1,version:t.uiSettings.version!==!1?t.version:null,headerContent:e,headerRightContentComponents:lt(()=>Array.from(e.values()).filter(o=>o.position==="right").sort((o,s)=>o.order-s.order).map(o=>o.component)),headerLeftContentComponents:lt(()=>Array.from(e.values()).filter(o=>o.position==="left").sort((o,s)=>o.order-s.order).map(o=>o.component)),addContent:i,removeContent:r}}},SBi={class:"viewer-header"},DBi={class:"viewer-header__content"},PBi={class:"viewer-header__content__left"},RBi={class:"viewer-header__content__right"},LBi={key:0,class:"m-l-6 flex items-center"},FBi={key:1,class:"viewer-header__version"};function TBi(t,e,i,r,o,s){const n=P("BIMDataIllustration");return Et((x(),U("div",SBi,[b("div",DBi,[b("div",PBi,[(x(!0),U(pt,null,jt(r.headerLeftContentComponents,a=>(x(),W(ro(a),{key:a.name}))),128))]),b("div",RBi,[(x(!0),U(pt,null,jt(r.headerRightContentComponents,a=>(x(),W(ro(a),{key:a.name}))),128))])]),r.logo||r.version?(x(),U("div",LBi,[r.logo?(x(),W(n,{key:0,name:"logo",width:"30px",height:"30px"})):pe("",!0),r.version?(x(),U("div",FBi,z(r.version),1)):pe("",!0)])):pe("",!0)],512)),[[ni,i.visible]])}const NBi=V(MBi,[["render",TBi],["__scopeId","data-v-5c9ea6b6"]]),UBi={emits:["resize"],setup(t,{emit:e}){return{onResizerMousedown:i=>{i.preventDefault();let r=i.clientX;const o=n=>{n.preventDefault();const a=n.clientX-r;r=n.clientX,e("resize",a)},s=n=>{n.preventDefault(),window.removeEventListener("mousemove",o),window.removeEventListener("mouseup",s)};window.addEventListener("mousemove",o),window.addEventListener("mouseup",s)}}}},OBi={class:"bimdata-separator"};function HBi(t,e,i,r,o,s){return x(),U("div",OBi,[e[1]||(e[1]=b("div",{class:"bimdata-separator__line"},null,-1)),b("div",{class:"bimdata-separator__resizer",onMousedown:e[0]||(e[0]=(...n)=>r.onResizerMousedown&&r.onResizerMousedown(...n))},null,32)])}const GBi=V(UBi,[["render",HBi],["__scopeId","data-v-79a3b3af"]]),jBi={components:{Separator:GBi},props:{position:{type:String,required:!0,validator(t){return["left","right"].includes(t)}},sidePanel:{type:Object,required:!0,validator(t){if(t.width&&(typeof t.width!="number"||t.width<0))return console.error(`[GlobalSidePanel] sidePanel.width must be a strictly positive number, received ${typeof t.width}`),!1;const e=typeof t?.component=="object";return e||console.error("[GlobalSidePanel] sidePanel must have a component property"),e}}},setup(t){const e=Le(null),i=Le(t.sidePanel.width??400),r=(o,s=1)=>{const n=i.value+o*s;i.value=Math.max(0,n)};return Dt(()=>t.sidePanel,()=>{Object.defineProperty(t.sidePanel,"width",{get(){return i.value},set(o){if(typeof o!="number"||o<=0){console.error(`[GlobalSidePanel] sidePanel.width must be a strictly positive number, received ${typeof o}`);return}i.value=o}}),Object.defineProperty(t.sidePanel,"componentInstance",{get(){return e.value},enumerable:!0})},{immediate:!0}),{componentInstance:e,width:i,onResize:r}}},VBi={class:"bimdata-global-side-panel__component"};function qBi(t,e,i,r,o,s){const n=P("Separator");return x(),U("div",{class:"bimdata-global-side-panel",style:ge(`width: ${r.width}px`)},[i.sidePanel.resizable&&i.position==="right"?(x(),W(n,{key:0,onResize:e[0]||(e[0]=a=>r.onResize(a,-1))})):pe("",!0),b("div",VBi,[(x(),W(ro(i.sidePanel.component),{ref:"componentInstance"},null,512))]),i.sidePanel.resizable&&i.position==="left"?(x(),W(n,{key:1,onResize:e[1]||(e[1]=a=>r.onResize(a))})):pe("",!0)],4)}const _Bi=V(jBi,[["render",qBi],["__scopeId","data-v-82d0d4cb"]]),zBi={name:"BimdataViewer",components:{ContextMenu:QBi,ViewerHeader:NBi,ModalManager:X3e,GlobalSidePanel:_Bi},setup(){const t=St("$viewer"),{globalContext:e,shortcutManager:i}=t;Sr(()=>{i&&i.destroy(),e.hub.clear()}),ar(()=>{t.pluginManager.runPluginsScripts(t)});const r=lt(()=>{var h;return t.uiSettings.bimdataLogo!==!1&&(e.localContexts.length!==1||((h=e.localContexts[0].window)==null?void 0:h.logoAndVersion))}),o=lt(()=>{var h;return t.uiSettings.version!==!1&&(e.localContexts.length!==1||(h=e.localContexts[0].window)!=null&&h.logoAndVersion)?t.version:null}),s=lt(()=>e.leftSidePanel),n=lt(()=>e.rightSidePanel),a=lt(()=>{var h;const g=t.uiSettings.header!==!1,p=e.localContexts.length===1&&((h=e.localContexts[0].window)==null?void 0:h.header)===!1,m=!!(s.value||n.value);return g&&(!p||m)}),l=t.uiSettings.contextMenu!==!1,c=Le(null);function d(h){l&&c.value.open(h)}function A(){t.shortcutManager.active=!0}function u(){t.shortcutManager.active=!1}return{Layout:t.layout.areas.component,onContextMenu:d,onMouseenter:A,onMouseleave:u,isHeaderVisible:a,viewerTemplateRef:e.templateRef,modalManagerTemplateRef:e.modalManagerTemplateRef,headerTemplateRef:e.headerTemplateRef,contextMenuTemplateRef:c,contextMenuEnabled:l,bimdataLogoOnSingleWindow:r,viewerVersionOnSingleWindow:o,version:t.version,loading:lt(()=>e.loading),spinner:lt(()=>e.spinner),leftSidePanel:s,rightSidePanel:n}}},KBi={key:1,class:"global-spinner",style:{"z-index":"3"}},JBi={key:2,class:"viewer__logo"},YBi={key:1,class:"version m-t-6"};function WBi(t,e,i,r,o,s){const n=P("ModalManager"),a=P("ContextMenu"),l=P("ViewerHeader"),c=P("GlobalSidePanel"),d=P("BIMDataSpinner"),A=P("BIMDataIllustration");return x(),U("div",{id:"bimdata-viewer",ref:"viewerTemplateRef",class:"bimdata-viewer bimdata-scrollbar",onContextmenu:e[0]||(e[0]=(...u)=>r.onContextMenu&&r.onContextMenu(...u)),onMouseenter:e[1]||(e[1]=(...u)=>r.onMouseenter&&r.onMouseenter(...u)),onMouseleave:e[2]||(e[2]=(...u)=>r.onMouseleave&&r.onMouseleave(...u))},[F(n,{ref:"modalManagerTemplateRef"},null,512),r.contextMenuEnabled?(x(),W(a,{key:0,ref:"contextMenuTemplateRef"},null,512)):pe("",!0),F(l,{ref:"headerTemplateRef",visible:r.isHeaderVisible},null,8,["visible"]),b("div",{class:"bimdata-viewer__content",style:ge(r.isHeaderVisible?"height: calc(100% - var(--bimdata-viewer-header-height, 40px))":"height: 100%")},[r.leftSidePanel?(x(),W(c,{key:0,"side-panel":r.leftSidePanel,position:"left"},null,8,["side-panel"])):pe("",!0),(x(),W(ro(r.Layout),{style:"height: 100%; flex-grow: 1;"})),r.rightSidePanel?(x(),W(c,{key:1,"side-panel":r.rightSidePanel,position:"right"},null,8,["side-panel"])):pe("",!0)],4),r.loading?(x(),U("div",KBi,[r.spinner&&r.spinner.component?(x(),W(ro(r.spinner.component),GA(Ma({key:0},r.spinner.props)),null,16)):(x(),W(d,{key:1,size:"40px",border:"5px"}))])):pe("",!0),!r.isHeaderVisible&&(r.bimdataLogoOnSingleWindow||r.viewerVersionOnSingleWindow)?(x(),U("div",JBi,[r.bimdataLogoOnSingleWindow?(x(),W(A,{key:0,name:"logo"})):pe("",!0),r.viewerVersionOnSingleWindow?(x(),U("div",YBi,z(r.version),1)):pe("",!0)])):pe("",!0)],544)}const ZBi=V(zBi,[["render",WBi]]),XBi=["src"],$Bi={class:"bimdata-models__header"},eEi={key:0,class:"bimdata-models__header__loader"},tEi={class:"bimdata-models__header__picto"},iEi={class:"bimdata-models__header__name"},rEi={key:0,class:"bimdata-models__header__name--empty"},oEi={key:1,class:"bimdata-models__header__name--empty"},nEi={key:3},sEi=["onMousemove","onClick"],rve={__name:"Models",props:{preview:{type:Boolean,default:!1},windowPositioning:{type:Boolean,default:!0},customFilter:{type:Function,default:null},width:{type:String,default:"350px"}},setup(t){const e=t,i=St("$viewer"),r=Le(),o=Le(0),s=Le(0),n=Le(),a=Hr([]),l=Le(!1),c=lt(()=>i.localContext.loadedModels),d=lt(()=>i.localContext.loadedModelIds),A=lt(()=>i.localContext.loadingModelIds),u=lt(()=>i.localContext.multiModel),h=lt(()=>(e.customFilter?a.value.filter(e.customFilter):a.value).map(B=>c.value.find(E=>{var k;return((k=E.document)==null?void 0:k.head_id)!=null&&E.document.head_id===B.document.id})??B)),g=B=>d.value.includes(B),p=B=>A.value.includes(B),m=lt(()=>{var B;const{x:E,y:k}=((B=n.value)==null?void 0:B.getBoundingClientRect())??{x:0,y:0};return`top:${s.value-k}px; left:${o.value-E}px;`}),f=B=>{!u.value&&g(B.id)||A.value.length>0||(i.localContext.loadedModelIds.includes(B.id)?i.localContext.unloadModels([B.id]):i.localContext.loadModels([B.id]))},v=B=>{switch(B){case"C":return"success";case"E":return"failed";case"P":case"I":return"sandglass"}},C=(B,E)=>{B!=null&&B.viewer_360_file&&(o.value=E.clientX,s.value=E.clientY),r.value=B?.viewer_360_file},y=async B=>{l.value=!0;try{return(await i.api.apiClient.modelApi.getModels(i.api.cloudId,i.api.projectId,void 0,void 0,B)).filter(E=>i.state.models.some(k=>k.archived)||!E.archived).sort($h("updated_at",!1))}catch(E){console.error("[Models] Cannot get project models. Error: ",E)}finally{l.value=!1}return[]},I=B=>{var E;return((E=B.children)==null?void 0:E.some(k=>g(k.id)))??!1};return y(i.localContext.modelTypes).then(B=>{a.value=B}),(B,E)=>{const k=P("BIMDataSpinner"),Q=P("BIMDataIconModel3D"),S=P("BIMDataTextbox"),D=P("BIMDataCheckbox"),R=P("BIMDataRadio"),N=P("BIMDataIcon"),H=P("BIMDataDropdownList");return x(),U("div",{ref_key:"templateRef",ref:n,class:fe(["bimdata-models",{"bimdata-models--window-positioning":t.windowPositioning}])},[r.value?(x(),U("div",{key:0,class:"bimdata-models__preview",style:ge(m.value)},[b("img",{src:r.value},null,8,XBi)],4)):pe("",!0),F(H,{style:ge(`--bimdata-models-width: ${t.width};`),width:t.width,list:h.value,"element-key":"id","per-page":40,loading:l.value,class:"bimdata-models__list",disabled:h.value.length===0,onElementClick:f},{header:j(({isOpen:q})=>[b("div",$Bi,[l.value||A.value.length>0?(x(),U("div",eEi,[F(k)])):(x(),U(pt,{key:1},[b("div",tEi,[F(Q)]),b("div",{class:fe(["bimdata-models__header__number bimdata-info-length",{"bimdata-models__header__number--empty":d.value.length===0}])},[b("span",null,z(d.value.length),1)],2),b("div",iEi,[h.value.length===0?(x(),U("span",rEi,z(B.$t("model.no_model")),1)):d.value.length===0?(x(),U("span",oEi,z(B.$t("model.no_loaded_model")),1)):d.value.length===1?(x(),W(S,{key:2,text:c.value[0].name,tooltip:!q},null,8,["text","tooltip"])):d.value.length>1?(x(),U("span",nEi,z(B.$t("model.selected_models")),1)):pe("",!0)])],64))])]),element:j(({element:q,close:O})=>[b("div",{class:"bimdata-models__model",onMousemove:G=>t.preview&&C(q,G),onMouseout:E[0]||(E[0]=G=>t.preview&&C()),onClick:()=>{!u.value&&!g(q.id)&&O()}},[u.value?(x(),W(D,{key:0,"model-value":g(q.id)||I(q),disabled:q.status!=="C"||A.value.length>0},null,8,["model-value","disabled"])):(x(),W(R,{key:1,"model-value":g(q.id)||I(q),disabled:q.status!=="C"||A.value.length>0},null,8,["model-value","disabled"])),F(N,{margin:"0 calc(var(--spacing-unit) / 2)",name:v(q.status),size:"xs",class:fe({"fill-success":q.status==="C","fill-high":q.status==="E"})},null,8,["name","class"]),F(S,{class:fe({"bimdata-models__model__name":!0,"bimdata-models__model__name--disabled":q.status!=="C"||A.value.length>0}),text:q.name,width:`calc(100% -
1629
1629
  ${u.value?13:23}px - 2 * 6px - 16px)`},null,8,["class","text","width"]),q.document&&!q.document.is_head_version?(x(),W(N,{key:2,name:"versioning",fill:"",color:"default",size:"xs",margin:"0 0 0 6px"})):pe("",!0)],40,sEi),p(q.id)?(x(),W(k,{key:0,class:"bimdata-models__model__spinner"})):pe("",!0)]),_:1},8,["style","width","list","loading","disabled"])],2)}}},aEi={data(){return{shown:!1}},mounted(){setTimeout(()=>{this.shown=!0},500)}};function lEi(t,e,i,r,o,s){const n=P("BIMDataIllustration");return x(),U("div",{class:"bimdata__no-model",style:ge({"--no-model--opacity":o.shown?1:0})},[F(n,{name:"emptyViewer",x:"90",y:"90"}),b("span",null,z(t.$t("model.select_model")),1)],4)}const ove=V(aEi,[["render",lEi],["__scopeId","data-v-5ffd9bc0"]]);window.BIMDataViewerVue=MX;class cEi{constructor(e={}){var i,r;const{api:o={},ui:s}=e;this.uiCfg=s,o.apiUrl||(console.info("[BIMData Viewer] INFO - Viewer config - `apiUrl` not set, use 'https://api.bimdata.io' by default."),o.apiUrl="https://api.bimdata.io"),o.archiveUrl||(console.info("[BIMData Viewer] INFO - Viewer config - `archiveUrl` not set, use 'https://archive.bimdata.io' by default."),o.archiveUrl="https://archive.bimdata.io"),o.pdfBackendUrl||(console.info("[BIMData Viewer] INFO - Viewer config - `pdfBackendUrl` not set, use 'https://pdf-backend.bimdata.io' by default."),o.pdfBackendUrl="https://pdf-backend.bimdata.io"),o.ifcIds&&(console.warn("[BIMData Viewer] DEPRECATED - Viewer config - please use the `modelIds` property instead of `ifcIds`."),o.modelIds===void 0&&(o.modelIds=o.ifcIds)),o.modelIds||(o.modelIds=[]),(i=o.offline)!=null&&i.dataFile&&(o.offline.data=o.offline.dataFile),this.$viewer=new Rbi(e),(r=o.offline)!=null&&r.enabled?this.$viewer.api.enableOfflineMode(o.offline.data,o.offline.options).then(()=>this.state.loadModels(o.modelIds)):(this.$viewer.globalContext.loadingProcessStart(),this.state.loadModels(o.modelIds).finally(()=>this.$viewer.globalContext.loadingProcessEnd())),this.vueApp=null}get state(){return this.$viewer.state}get api(){return this.$viewer.api}async mount(e,i="3d"){var r;const{$viewer:o}=this;await o.api.ready;try{const A=await o.api.apiClient.collaborationApi.checkProjectAccess(o.api.cloudId,o.api.projectId);o.api.permissions=ive(A)}catch{o.api.permissions=ive()}const s=this.api.accessToken,{i18n:n}=o;n.registerTranslations(o.pluginManager.pluginTranslations),o.layout.apply(i);const a={i18n:n.i18nVuePlugin,data(){return{accessToken:s}},render(){return Oo(ZBi,{style:"height: 100%"})}},l=K5(a).use(n.i18nVuePlugin).use(vBi()).use(gBi({i18nPlugin:n.i18nVuePlugin})).use(Jbi({apiClient:o.api.apiClient,i18nPlugin:n.i18nVuePlugin}));l.provide("$viewer",o),l.component("BIMDataModelLoader",rve),l.component("BIMDataNoModelWindowPlaceHolder",ove),l.component("BIMDataStoreySelector",LU),l.component("ModelsLoader",rve),l.component("NoModelWindowPlaceHolder",ove);const c=e instanceof HTMLElement?e:document.querySelector(e);c&&(c.style.height="100%");const d=l.mount(e);return d.$viewer=o,Lbi(d.$el,(r=this.uiCfg)==null?void 0:r.style),typeof window<"u"&&(window.bimdataViewer=d),this.vueApp=l,d}destroy(){var e;(e=this.vueApp)==null||e.unmount()}setLocale(e){if(!_X.includes(e))throw new Error(`Viewer available locales are ${_X.join(", ")}.`);this.$viewer.i18n.locale=e}registerPlugin(e){this.$viewer.registerPlugin(e)}registerWindow(e){return this.$viewer.windowManager.registerWindow(e)}unregisterWindow(e){return this.$viewer.windowManager.unregisterWindow(e)}setAccessToken(e){this.api.accessToken=e}async loadModels(e){this.$viewer.globalContext.loadingProcessStart();const i=await this.state.loadModels(e);return this.$viewer.globalContext.loadingProcessEnd(),i}loadIfcs(e){return console.warn("[BIMData Viewer] DEPRECATED - Viewer - please use the loadModels method instead of loadIfcs."),this.loadModels(e)}}const nve=(t={})=>new cEi(t);window.makeBIMDataViewer=nve;var F7={};F7.d=(t,e)=>{for(var i in e)F7.o(e,i)&&!F7.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},F7.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e);var Si=globalThis.pdfjsLib={};F7.d(Si,{AbortException:()=>Dg,AnnotationEditorLayer:()=>yxi,AnnotationEditorParamsType:()=>Bi,AnnotationEditorType:()=>Zi,AnnotationEditorUIManager:()=>Z7,AnnotationLayer:()=>gxi,AnnotationMode:()=>q1,CMapCompressionType:()=>Kj,ColorPicker:()=>a5e,DOMSVGFactory:()=>rV,DrawLayer:()=>Ixi,FeatureTest:()=>_a,GlobalWorkerOptions:()=>t0,ImageKind:()=>LQ,InvalidPDFException:()=>ave,MissingPDFException:()=>Sg,OPS:()=>id,PDFDataRangeTransport:()=>x4e,PDFDateString:()=>Cve,PDFWorker:()=>jM,PasswordResponses:()=>hEi,PermissionFlag:()=>uEi,PixelsPerInch:()=>pv,RenderingCancelledException:()=>oV,TextLayer:()=>zV,UnexpectedResponseException:()=>UQ,Util:()=>ti,VerbosityLevel:()=>FQ,XfaLayer:()=>P4e,build:()=>Jki,createValidAbsoluteUrl:()=>mEi,fetchData:()=>qQ,getDocument:()=>Nki,getFilenameFromUrl:()=>QEi,getPdfFilenameFromUrl:()=>MEi,getXfaPageViewport:()=>SEi,isDataScheme:()=>_Q,isPdfFile:()=>nV,noContextMenu:()=>ac,normalizeUnicode:()=>bEi,setLayerDimensions:()=>Lg,shadow:()=>or,version:()=>Kki});const Ss=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser"),sve=[1,0,0,1,0,0],_j=[.001,0,0,.001,0,0],dEi=1e7,zj=1.35,xl={ANY:1,DISPLAY:2,PRINT:4,SAVE:8,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},q1={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},AEi="pdfjs_internal_editor_",Zi={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15},Bi={RESIZE:1,CREATE:2,FREETEXT_SIZE:11,FREETEXT_COLOR:12,FREETEXT_OPACITY:13,INK_COLOR:21,INK_THICKNESS:22,INK_OPACITY:23,HIGHLIGHT_COLOR:31,HIGHLIGHT_DEFAULT_COLOR:32,HIGHLIGHT_THICKNESS:33,HIGHLIGHT_FREE:34,HIGHLIGHT_SHOW_ALL:35},uEi={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},Ds={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},LQ={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},Cn={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},T7={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},FQ={ERRORS:0,WARNINGS:1,INFOS:5},Kj={NONE:0,BINARY:1},id={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotation:80,endAnnotation:81,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91,setStrokeTransparent:92,setFillTransparent:93},hEi={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let TQ=FQ.WARNINGS;function pEi(t){Number.isInteger(t)&&(TQ=t)}function gEi(){return TQ}function NQ(t){TQ>=FQ.INFOS&&console.log(`Info: ${t}`)}function Hi(t){TQ>=FQ.WARNINGS&&console.log(`Warning: ${t}`)}function nn(t){throw new Error(t)}function yn(t,e){t||nn(e)}function fEi(t){switch(t?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function mEi(t,e=null,i=null){if(!t)return null;try{if(i&&typeof t=="string"){if(i.addDefaultProtocol&&t.startsWith("www.")){const o=t.match(/\./g);o?.length>=2&&(t=`http://${t}`)}if(i.tryConvertEncoding)try{t=wEi(t)}catch{}}const r=e?new URL(t,e):new URL(t);if(fEi(r))return r}catch{}return null}function or(t,e,i,r=!1){return Object.defineProperty(t,e,{value:i,enumerable:!r,configurable:!0,writable:!1}),i}const _1=function(){function t(e,i){this.message=e,this.name=i}return t.prototype=new Error,t.constructor=t,t}();let Jj=class extends _1{constructor(t,e){super(t,"PasswordException"),this.code=e}},Yj=class extends _1{constructor(t,e){super(t,"UnknownErrorException"),this.details=e}},ave=class extends _1{constructor(t){super(t,"InvalidPDFException")}},Sg=class extends _1{constructor(t){super(t,"MissingPDFException")}},UQ=class extends _1{constructor(t,e){super(t,"UnexpectedResponseException"),this.status=e}},vEi=class extends _1{constructor(t){super(t,"FormatError")}},Dg=class extends _1{constructor(t){super(t,"AbortException")}};function lve(t){(typeof t!="object"||t?.length===void 0)&&nn("Invalid argument for bytesToString");const e=t.length,i=8192;if(e<i)return String.fromCharCode.apply(null,t);const r=[];for(let o=0;o<e;o+=i){const s=Math.min(o+i,e),n=t.subarray(o,s);r.push(String.fromCharCode.apply(null,n))}return r.join("")}function OQ(t){typeof t!="string"&&nn("Invalid argument for stringToBytes");const e=t.length,i=new Uint8Array(e);for(let r=0;r<e;++r)i[r]=t.charCodeAt(r)&255;return i}function CEi(t){return String.fromCharCode(t>>24&255,t>>16&255,t>>8&255,t&255)}function Wj(t){const e=Object.create(null);for(const[i,r]of t)e[i]=r;return e}function yEi(){const t=new Uint8Array(4);return t[0]=1,new Uint32Array(t.buffer,0,1)[0]===1}function IEi(){try{return new Function(""),!0}catch{return!1}}class _a{static get isLittleEndian(){return or(this,"isLittleEndian",yEi())}static get isEvalSupported(){return or(this,"isEvalSupported",IEi())}static get isOffscreenCanvasSupported(){return or(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get platform(){return typeof navigator<"u"&&typeof navigator?.platform=="string"?or(this,"platform",{isMac:navigator.platform.includes("Mac")}):or(this,"platform",{isMac:!1})}static get isCSSRoundSupported(){var e,i;return or(this,"isCSSRoundSupported",(i=(e=globalThis.CSS)==null?void 0:e.supports)==null?void 0:i.call(e,"width: round(1.5px, 1px)"))}}const Zj=Array.from(Array(256).keys(),t=>t.toString(16).padStart(2,"0"));var Pg,Xj,HQ,$j;let ti=(Xj=class{static makeHexColor(t,e,i){return`#${Zj[t]}${Zj[e]}${Zj[i]}`}static scaleMinMax(t,e){let i;t[0]?(t[0]<0&&(i=e[0],e[0]=e[2],e[2]=i),e[0]*=t[0],e[2]*=t[0],t[3]<0&&(i=e[1],e[1]=e[3],e[3]=i),e[1]*=t[3],e[3]*=t[3]):(i=e[0],e[0]=e[1],e[1]=i,i=e[2],e[2]=e[3],e[3]=i,t[1]<0&&(i=e[1],e[1]=e[3],e[3]=i),e[1]*=t[1],e[3]*=t[1],t[2]<0&&(i=e[0],e[0]=e[2],e[2]=i),e[0]*=t[2],e[2]*=t[2]),e[0]+=t[4],e[1]+=t[5],e[2]+=t[4],e[3]+=t[5]}static transform(t,e){return[t[0]*e[0]+t[2]*e[1],t[1]*e[0]+t[3]*e[1],t[0]*e[2]+t[2]*e[3],t[1]*e[2]+t[3]*e[3],t[0]*e[4]+t[2]*e[5]+t[4],t[1]*e[4]+t[3]*e[5]+t[5]]}static applyTransform(t,e){const i=t[0]*e[0]+t[1]*e[2]+e[4],r=t[0]*e[1]+t[1]*e[3]+e[5];return[i,r]}static applyInverseTransform(t,e){const i=e[0]*e[3]-e[1]*e[2],r=(t[0]*e[3]-t[1]*e[2]+e[2]*e[5]-e[4]*e[3])/i,o=(-t[0]*e[1]+t[1]*e[0]+e[4]*e[1]-e[5]*e[0])/i;return[r,o]}static getAxialAlignedBoundingBox(t,e){const i=this.applyTransform(t,e),r=this.applyTransform(t.slice(2,4),e),o=this.applyTransform([t[0],t[3]],e),s=this.applyTransform([t[2],t[1]],e);return[Math.min(i[0],r[0],o[0],s[0]),Math.min(i[1],r[1],o[1],s[1]),Math.max(i[0],r[0],o[0],s[0]),Math.max(i[1],r[1],o[1],s[1])]}static inverseTransform(t){const e=t[0]*t[3]-t[1]*t[2];return[t[3]/e,-t[1]/e,-t[2]/e,t[0]/e,(t[2]*t[5]-t[4]*t[3])/e,(t[4]*t[1]-t[5]*t[0])/e]}static singularValueDecompose2dScale(t){const e=[t[0],t[2],t[1],t[3]],i=t[0]*e[0]+t[1]*e[2],r=t[0]*e[1]+t[1]*e[3],o=t[2]*e[0]+t[3]*e[2],s=t[2]*e[1]+t[3]*e[3],n=(i+s)/2,a=Math.sqrt((i+s)**2-4*(i*s-o*r))/2,l=n+a||1,c=n-a||1;return[Math.sqrt(l),Math.sqrt(c)]}static normalizeRect(t){const e=t.slice(0);return t[0]>t[2]&&(e[0]=t[2],e[2]=t[0]),t[1]>t[3]&&(e[1]=t[3],e[3]=t[1]),e}static intersect(t,e){const i=Math.max(Math.min(t[0],t[2]),Math.min(e[0],e[2])),r=Math.min(Math.max(t[0],t[2]),Math.max(e[0],e[2]));if(i>r)return null;const o=Math.max(Math.min(t[1],t[3]),Math.min(e[1],e[3])),s=Math.min(Math.max(t[1],t[3]),Math.max(e[1],e[3]));return o>s?null:[i,o,r,s]}static bezierBoundingBox(t,e,i,r,o,s,n,a,l){return l?(l[0]=Math.min(l[0],t,n),l[1]=Math.min(l[1],e,a),l[2]=Math.max(l[2],t,n),l[3]=Math.max(l[3],e,a)):l=[Math.min(t,n),Math.min(e,a),Math.max(t,n),Math.max(e,a)],$(this,Pg,$j).call(this,t,i,o,n,e,r,s,a,3*(-t+3*(i-o)+n),6*(t-2*i+o),3*(i-t),l),$(this,Pg,$j).call(this,t,i,o,n,e,r,s,a,3*(-e+3*(r-s)+a),6*(e-2*r+s),3*(r-e),l),l}},Pg=new WeakSet,HQ=function(t,e,i,r,o,s,n,a,l,c){if(l<=0||l>=1)return;const d=1-l,A=l*l,u=A*l,h=d*(d*(d*t+3*l*e)+3*A*i)+u*r,g=d*(d*(d*o+3*l*s)+3*A*n)+u*a;c[0]=Math.min(c[0],h),c[1]=Math.min(c[1],g),c[2]=Math.max(c[2],h),c[3]=Math.max(c[3],g)},$j=function(t,e,i,r,o,s,n,a,l,c,d,A){if(Math.abs(l)<1e-12){Math.abs(c)>=1e-12&&$(this,Pg,HQ).call(this,t,e,i,r,o,s,n,a,-d/c,A);return}const u=c**2-4*d*l;if(u<0)return;const h=Math.sqrt(u),g=2*l;$(this,Pg,HQ).call(this,t,e,i,r,o,s,n,a,(-c+h)/g,A),$(this,Pg,HQ).call(this,t,e,i,r,o,s,n,a,(-c-h)/g,A)},ce(Xj,Pg),Xj);function wEi(t){return decodeURIComponent(escape(t))}let eV=null,cve=null;function bEi(t){return eV||(eV=/([\u00a0\u00b5\u037e\u0eb3\u2000-\u200a\u202f\u2126\ufb00-\ufb04\ufb06\ufb20-\ufb36\ufb38-\ufb3c\ufb3e\ufb40-\ufb41\ufb43-\ufb44\ufb46-\ufba1\ufba4-\ufba9\ufbae-\ufbb1\ufbd3-\ufbdc\ufbde-\ufbe7\ufbea-\ufbf8\ufbfc-\ufbfd\ufc00-\ufc5d\ufc64-\ufcf1\ufcf5-\ufd3d\ufd88\ufdf4\ufdfa-\ufdfb\ufe71\ufe77\ufe79\ufe7b\ufe7d]+)|(\ufb05+)/gu,cve=new Map([["\uFB05","\u017Ft"]])),t.replaceAll(eV,(e,i,r)=>i?i.normalize("NFKC"):cve.get(r))}function BEi(){if(typeof crypto<"u"&&typeof(crypto==null?void 0:crypto.randomUUID)=="function")return crypto.randomUUID();const t=new Uint8Array(32);if(typeof crypto<"u"&&typeof(crypto==null?void 0:crypto.getRandomValues)=="function")crypto.getRandomValues(t);else for(let e=0;e<32;e++)t[e]=Math.floor(Math.random()*255);return lve(t)}const dve="pdfjs_internal_id_",Mu={BEZIER_CURVE_TO:0,MOVE_TO:1,LINE_TO:2,QUADRATIC_CURVE_TO:3,RESTORE:4,SAVE:5,SCALE:6,TRANSFORM:7,TRANSLATE:8};class Ave{addFilter(e){return"none"}addHCMFilter(e,i){return"none"}addAlphaFilter(e){return"none"}addLuminosityFilter(e){return"none"}addHighlightHCMFilter(e,i,r,o,s){return"none"}destroy(e=!1){}}var GQ;class uve{constructor({enableHWA:e=!1}={}){ce(this,GQ,!1),ie(this,GQ,e)}create(e,i){if(e<=0||i<=0)throw new Error("Invalid canvas size");const r=this._createCanvas(e,i);return{canvas:r,context:r.getContext("2d",{willReadFrequently:!M(this,GQ)})}}reset(e,i,r){if(!e.canvas)throw new Error("Canvas is not specified");if(i<=0||r<=0)throw new Error("Invalid canvas size");e.canvas.width=i,e.canvas.height=r}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,i){nn("Abstract method `_createCanvas` called.")}}GQ=new WeakMap;class hve{constructor({baseUrl:e=null,isCompressed:i=!0}){this.baseUrl=e,this.isCompressed=i}async fetch({name:e}){if(!this.baseUrl)throw new Error("Ensure that the `cMapUrl` and `cMapPacked` API parameters are provided.");if(!e)throw new Error("CMap name must be specified.");const i=this.baseUrl+e+(this.isCompressed?".bcmap":""),r=this.isCompressed?Kj.BINARY:Kj.NONE;return this._fetchData(i,r).catch(o=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${i}`)})}_fetchData(e,i){nn("Abstract method `_fetchData` called.")}}class pve{constructor({baseUrl:e=null}){this.baseUrl=e}async fetch({filename:e}){if(!this.baseUrl)throw new Error("Ensure that the `standardFontDataUrl` API parameter is provided.");if(!e)throw new Error("Font filename must be specified.");const i=`${this.baseUrl}${e}`;return this._fetchData(i).catch(r=>{throw new Error(`Unable to load font data at: ${i}`)})}_fetchData(e){nn("Abstract method `_fetchData` called.")}}class EEi{create(e,i,r=!1){if(e<=0||i<=0)throw new Error("Invalid SVG dimensions");const o=this._createSVG("svg:svg");return o.setAttribute("version","1.1"),r||(o.setAttribute("width",`${e}px`),o.setAttribute("height",`${i}px`)),o.setAttribute("preserveAspectRatio","none"),o.setAttribute("viewBox",`0 0 ${e} ${i}`),o}createElement(e){if(typeof e!="string")throw new Error("Invalid SVG element type");return this._createSVG(e)}_createSVG(e){nn("Abstract method `_createSVG` called.")}}const Su="http://www.w3.org/2000/svg",hv=class{};ei(hv,"CSS",96),ei(hv,"PDF",72),ei(hv,"PDF_TO_CSS_UNITS",hv.CSS/hv.PDF);let pv=hv;var gv,Rg,Du,z1,Aa,jQ,fv,oi,Ps,mv,vv,VQ,Cv,gve,tV,yv,N7,U7,iV,O7;class kEi extends Ave{constructor({docId:e,ownerDocument:i=globalThis.document}={}){super(),ce(this,oi),ce(this,gv),ce(this,Rg),ce(this,Du),ce(this,z1),ce(this,Aa),ce(this,jQ),ce(this,fv,0),ie(this,z1,e),ie(this,Aa,i)}addFilter(e){if(!e)return"none";let i=M(this,oi,Ps).get(e);if(i)return i;const[r,o,s]=$(this,oi,VQ).call(this,e),n=e.length===1?r:`${r}${o}${s}`;if(i=M(this,oi,Ps).get(n),i)return M(this,oi,Ps).set(e,i),i;const a=`g_${M(this,z1)}_transfer_map_${ol(this,fv)._++}`,l=$(this,oi,Cv).call(this,a);M(this,oi,Ps).set(e,l),M(this,oi,Ps).set(n,l);const c=$(this,oi,yv).call(this,a);return $(this,oi,U7).call(this,r,o,s,c),l}addHCMFilter(e,i){var r;const o=`${e}-${i}`,s="base";let n=M(this,oi,mv).get(s);if(n?.key===o||(n?((r=n.filter)==null||r.remove(),n.key=o,n.url="none",n.filter=null):(n={key:o,url:"none",filter:null},M(this,oi,mv).set(s,n)),!e||!i))return n.url;const a=$(this,oi,O7).call(this,e);e=ti.makeHexColor(...a);const l=$(this,oi,O7).call(this,i);if(i=ti.makeHexColor(...l),M(this,oi,vv).style.color="",e==="#000000"&&i==="#ffffff"||e===i)return n.url;const c=new Array(256);for(let g=0;g<=255;g++){const p=g/255;c[g]=p<=.03928?p/12.92:((p+.055)/1.055)**2.4}const d=c.join(","),A=`g_${M(this,z1)}_hcm_filter`,u=n.filter=$(this,oi,yv).call(this,A);$(this,oi,U7).call(this,d,d,d,u),$(this,oi,tV).call(this,u);const h=(g,p)=>{const m=a[g]/255,f=l[g]/255,v=new Array(p+1);for(let C=0;C<=p;C++)v[C]=m+C/p*(f-m);return v.join(",")};return $(this,oi,U7).call(this,h(0,5),h(1,5),h(2,5),u),n.url=$(this,oi,Cv).call(this,A),n.url}addAlphaFilter(e){let i=M(this,oi,Ps).get(e);if(i)return i;const[r]=$(this,oi,VQ).call(this,[e]),o=`alpha_${r}`;if(i=M(this,oi,Ps).get(o),i)return M(this,oi,Ps).set(e,i),i;const s=`g_${M(this,z1)}_alpha_map_${ol(this,fv)._++}`,n=$(this,oi,Cv).call(this,s);M(this,oi,Ps).set(e,n),M(this,oi,Ps).set(o,n);const a=$(this,oi,yv).call(this,s);return $(this,oi,iV).call(this,r,a),n}addLuminosityFilter(e){let i=M(this,oi,Ps).get(e||"luminosity");if(i)return i;let r,o;if(e?([r]=$(this,oi,VQ).call(this,[e]),o=`luminosity_${r}`):o="luminosity",i=M(this,oi,Ps).get(o),i)return M(this,oi,Ps).set(e,i),i;const s=`g_${M(this,z1)}_luminosity_map_${ol(this,fv)._++}`,n=$(this,oi,Cv).call(this,s);M(this,oi,Ps).set(e,n),M(this,oi,Ps).set(o,n);const a=$(this,oi,yv).call(this,s);return $(this,oi,gve).call(this,a),e&&$(this,oi,iV).call(this,r,a),n}addHighlightHCMFilter(e,i,r,o,s){var n;const a=`${i}-${r}-${o}-${s}`;let l=M(this,oi,mv).get(e);if(l?.key===a||(l?((n=l.filter)==null||n.remove(),l.key=a,l.url="none",l.filter=null):(l={key:a,url:"none",filter:null},M(this,oi,mv).set(e,l)),!i||!r))return l.url;const[c,d]=[i,r].map($(this,oi,O7).bind(this));let A=Math.round(.2126*c[0]+.7152*c[1]+.0722*c[2]),u=Math.round(.2126*d[0]+.7152*d[1]+.0722*d[2]),[h,g]=[o,s].map($(this,oi,O7).bind(this));u<A&&([A,u,h,g]=[u,A,g,h]),M(this,oi,vv).style.color="";const p=(v,C,y)=>{const I=new Array(256),B=(u-A)/y,E=v/255,k=(C-v)/(255*y);let Q=0;for(let S=0;S<=y;S++){const D=Math.round(A+S*B),R=E+S*k;for(let N=Q;N<=D;N++)I[N]=R;Q=D+1}for(let S=Q;S<256;S++)I[S]=I[Q-1];return I.join(",")},m=`g_${M(this,z1)}_hcm_${e}_filter`,f=l.filter=$(this,oi,yv).call(this,m);return $(this,oi,tV).call(this,f),$(this,oi,U7).call(this,p(h[0],g[0],5),p(h[1],g[1],5),p(h[2],g[2],5),f),l.url=$(this,oi,Cv).call(this,m),l.url}destroy(e=!1){e&&M(this,oi,mv).size!==0||(M(this,Du)&&(M(this,Du).parentNode.parentNode.remove(),ie(this,Du,null)),M(this,Rg)&&(M(this,Rg).clear(),ie(this,Rg,null)),ie(this,fv,0))}}gv=new WeakMap,Rg=new WeakMap,Du=new WeakMap,z1=new WeakMap,Aa=new WeakMap,jQ=new WeakMap,fv=new WeakMap,oi=new WeakSet,Ps=function(){return M(this,Rg)||ie(this,Rg,new Map)},mv=function(){return M(this,jQ)||ie(this,jQ,new Map)},vv=function(){if(!M(this,Du)){const t=M(this,Aa).createElement("div"),{style:e}=t;e.visibility="hidden",e.contain="strict",e.width=e.height=0,e.position="absolute",e.top=e.left=0,e.zIndex=-1;const i=M(this,Aa).createElementNS(Su,"svg");i.setAttribute("width",0),i.setAttribute("height",0),ie(this,Du,M(this,Aa).createElementNS(Su,"defs")),t.append(i),i.append(M(this,Du)),M(this,Aa).body.append(t)}return M(this,Du)},VQ=function(t){if(t.length===1){const a=t[0],l=new Array(256);for(let d=0;d<256;d++)l[d]=a[d]/255;const c=l.join(",");return[c,c,c]}const[e,i,r]=t,o=new Array(256),s=new Array(256),n=new Array(256);for(let a=0;a<256;a++)o[a]=e[a]/255,s[a]=i[a]/255,n[a]=r[a]/255;return[o.join(","),s.join(","),n.join(",")]},Cv=function(t){if(M(this,gv)===void 0){ie(this,gv,"");const e=M(this,Aa).URL;e!==M(this,Aa).baseURI&&(_Q(e)?Hi('#createUrl: ignore "data:"-URL for performance reasons.'):ie(this,gv,e.split("#",1)[0]))}return`url(${M(this,gv)}#${t})`},gve=function(t){const e=M(this,Aa).createElementNS(Su,"feColorMatrix");e.setAttribute("type","matrix"),e.setAttribute("values","0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.3 0.59 0.11 0 0"),t.append(e)},tV=function(t){const e=M(this,Aa).createElementNS(Su,"feColorMatrix");e.setAttribute("type","matrix"),e.setAttribute("values","0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0.2126 0.7152 0.0722 0 0 0 0 0 1 0"),t.append(e)},yv=function(t){const e=M(this,Aa).createElementNS(Su,"filter");return e.setAttribute("color-interpolation-filters","sRGB"),e.setAttribute("id",t),M(this,oi,vv).append(e),e},N7=function(t,e,i){const r=M(this,Aa).createElementNS(Su,e);r.setAttribute("type","discrete"),r.setAttribute("tableValues",i),t.append(r)},U7=function(t,e,i,r){const o=M(this,Aa).createElementNS(Su,"feComponentTransfer");r.append(o),$(this,oi,N7).call(this,o,"feFuncR",t),$(this,oi,N7).call(this,o,"feFuncG",e),$(this,oi,N7).call(this,o,"feFuncB",i)},iV=function(t,e){const i=M(this,Aa).createElementNS(Su,"feComponentTransfer");e.append(i),$(this,oi,N7).call(this,i,"feFuncA",t)},O7=function(t){return M(this,oi,vv).style.color=t,aV(getComputedStyle(M(this,oi,vv)).getPropertyValue("color"))};class xEi extends uve{constructor({ownerDocument:e=globalThis.document,enableHWA:i=!1}={}){super({enableHWA:i}),this._document=e}_createCanvas(e,i){const r=this._document.createElement("canvas");return r.width=e,r.height=i,r}}async function qQ(t,e="text"){if(H7(t,document.baseURI)){const i=await fetch(t);if(!i.ok)throw new Error(i.statusText);switch(e){case"arraybuffer":return i.arrayBuffer();case"blob":return i.blob();case"json":return i.json()}return i.text()}return new Promise((i,r)=>{const o=new XMLHttpRequest;o.open("GET",t,!0),o.responseType=e,o.onreadystatechange=()=>{if(o.readyState===XMLHttpRequest.DONE){if(o.status===200||o.status===0){switch(e){case"arraybuffer":case"blob":case"json":i(o.response);return}i(o.responseText);return}r(new Error(o.statusText))}},o.send(null)})}class fve extends hve{_fetchData(e,i){return qQ(e,this.isCompressed?"arraybuffer":"text").then(r=>({cMapData:r instanceof ArrayBuffer?new Uint8Array(r):OQ(r),compressionType:i}))}}class mve extends pve{_fetchData(e){return qQ(e,"arraybuffer").then(i=>new Uint8Array(i))}}class rV extends EEi{_createSVG(e){return document.createElementNS(Su,e)}}class nw{constructor({viewBox:e,scale:i,rotation:r,offsetX:o=0,offsetY:s=0,dontFlip:n=!1}){this.viewBox=e,this.scale=i,this.rotation=r,this.offsetX=o,this.offsetY=s;const a=(e[2]+e[0])/2,l=(e[3]+e[1])/2;let c,d,A,u;switch(r%=360,r<0&&(r+=360),r){case 180:c=-1,d=0,A=0,u=1;break;case 90:c=0,d=1,A=1,u=0;break;case 270:c=0,d=-1,A=-1,u=0;break;case 0:c=1,d=0,A=0,u=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}n&&(A=-A,u=-u);let h,g,p,m;c===0?(h=Math.abs(l-e[1])*i+o,g=Math.abs(a-e[0])*i+s,p=(e[3]-e[1])*i,m=(e[2]-e[0])*i):(h=Math.abs(a-e[0])*i+o,g=Math.abs(l-e[1])*i+s,p=(e[2]-e[0])*i,m=(e[3]-e[1])*i),this.transform=[c*i,d*i,A*i,u*i,h-c*i*a-A*i*l,g-d*i*a-u*i*l],this.width=p,this.height=m}get rawDims(){const{viewBox:e}=this;return or(this,"rawDims",{pageWidth:e[2]-e[0],pageHeight:e[3]-e[1],pageX:e[0],pageY:e[1]})}clone({scale:e=this.scale,rotation:i=this.rotation,offsetX:r=this.offsetX,offsetY:o=this.offsetY,dontFlip:s=!1}={}){return new nw({viewBox:this.viewBox.slice(),scale:e,rotation:i,offsetX:r,offsetY:o,dontFlip:s})}convertToViewportPoint(e,i){return ti.applyTransform([e,i],this.transform)}convertToViewportRectangle(e){const i=ti.applyTransform([e[0],e[1]],this.transform),r=ti.applyTransform([e[2],e[3]],this.transform);return[i[0],i[1],r[0],r[1]]}convertToPdfPoint(e,i){return ti.applyInverseTransform([e,i],this.transform)}}class oV extends _1{constructor(e,i=0){super(e,"RenderingCancelledException"),this.extraDelay=i}}function _Q(t){const e=t.length;let i=0;for(;i<e&&t[i].trim()==="";)i++;return t.substring(i,i+5).toLowerCase()==="data:"}function nV(t){return typeof t=="string"&&/\.pdf$/i.test(t)}function QEi(t){return[t]=t.split(/[#?]/,1),t.substring(t.lastIndexOf("/")+1)}function MEi(t,e="document.pdf"){if(typeof t!="string")return e;if(_Q(t))return Hi('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),e;const i=/^(?:(?:[^:]+:)?\/\/[^/]+)?([^?#]*)(\?[^#]*)?(#.*)?$/,r=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i,o=i.exec(t);let s=r.exec(o[1])||r.exec(o[2])||r.exec(o[3]);if(s&&(s=s[0],s.includes("%")))try{s=r.exec(decodeURIComponent(s))[0]}catch{}return s||e}class vve{constructor(){ei(this,"started",Object.create(null)),ei(this,"times",[])}time(e){e in this.started&&Hi(`Timer is already running for ${e}`),this.started[e]=Date.now()}timeEnd(e){e in this.started||Hi(`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 i=0;for(const{name:r}of this.times)i=Math.max(r.length,i);for(const{name:r,start:o,end:s}of this.times)e.push(`${r.padEnd(i)} ${s-o}ms
1630
1630
  `);return e.join("")}}function H7(t,e){try{const{protocol:i}=e?new URL(t,e):new URL(t);return i==="http:"||i==="https:"}catch{return!1}}function ac(t){t.preventDefault()}let sV;class Cve{static toDateObject(e){if(!e||typeof e!="string")return null;sV||(sV=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?"));const i=sV.exec(e);if(!i)return null;const r=parseInt(i[1],10);let o=parseInt(i[2],10);o=o>=1&&o<=12?o-1:0;let s=parseInt(i[3],10);s=s>=1&&s<=31?s:1;let n=parseInt(i[4],10);n=n>=0&&n<=23?n:0;let a=parseInt(i[5],10);a=a>=0&&a<=59?a:0;let l=parseInt(i[6],10);l=l>=0&&l<=59?l:0;const c=i[7]||"Z";let d=parseInt(i[8],10);d=d>=0&&d<=23?d:0;let A=parseInt(i[9],10)||0;return A=A>=0&&A<=59?A:0,c==="-"?(n+=d,a+=A):c==="+"&&(n-=d,a-=A),new Date(Date.UTC(r,o,s,n,a,l))}}function SEi(t,{scale:e=1,rotation:i=0}){const{width:r,height:o}=t.attributes.style,s=[0,0,parseInt(r),parseInt(o)];return new nw({viewBox:s,scale:e,rotation:i})}function aV(t){if(t.startsWith("#")){const e=parseInt(t.slice(1),16);return[(e&16711680)>>16,(e&65280)>>8,e&255]}return t.startsWith("rgb(")?t.slice(4,-1).split(",").map(e=>parseInt(e)):t.startsWith("rgba(")?t.slice(5,-1).split(",").map(e=>parseInt(e)).slice(0,3):(Hi(`Not a valid color format: "${t}"`),[0,0,0])}function DEi(t){const e=document.createElement("span");e.style.visibility="hidden",document.body.append(e);for(const i of t.keys()){e.style.color=i;const r=window.getComputedStyle(e).color;t.set(i,aV(r))}e.remove()}function Io(t){const{a:e,b:i,c:r,d:o,e:s,f:n}=t.getTransform();return[e,i,r,o,s,n]}function Pu(t){const{a:e,b:i,c:r,d:o,e:s,f:n}=t.getTransform().invertSelf();return[e,i,r,o,s,n]}function Lg(t,e,i=!1,r=!0){if(e instanceof nw){const{pageWidth:o,pageHeight:s}=e.rawDims,{style:n}=t,a=_a.isCSSRoundSupported,l=`var(--scale-factor) * ${o}px`,c=`var(--scale-factor) * ${s}px`,d=a?`round(${l}, 1px)`:`calc(${l})`,A=a?`round(${c}, 1px)`:`calc(${c})`;!i||e.rotation%180===0?(n.width=d,n.height=A):(n.width=A,n.height=d)}r&&t.setAttribute("data-main-rotation",e.rotation)}var Iv,wv,iA,bv,zQ,G7,lV,yve,rA,Ive,wve,KQ,bve,cV;const JQ=class mP{constructor(e){ce(this,rA),ce(this,Iv,null),ce(this,wv,null),ce(this,iA),ce(this,bv,null),ce(this,zQ,null),ie(this,iA,e),M(mP,G7)||ie(mP,G7,Object.freeze({freetext:"pdfjs-editor-remove-freetext-button",highlight:"pdfjs-editor-remove-highlight-button",ink:"pdfjs-editor-remove-ink-button",stamp:"pdfjs-editor-remove-stamp-button"}))}render(){const e=ie(this,Iv,document.createElement("div"));e.className="editToolbar",e.setAttribute("role","toolbar");const i=M(this,iA)._uiManager._signal;e.addEventListener("contextmenu",ac,{signal:i}),e.addEventListener("pointerdown",$(mP,lV,yve),{signal:i});const r=ie(this,bv,document.createElement("div"));r.className="buttons",e.append(r);const o=M(this,iA).toolbarPosition;if(o){const{style:s}=e,n=M(this,iA)._uiManager.direction==="ltr"?1-o[0]:o[0];s.insetInlineEnd=`${100*n}%`,s.top=`calc(${100*o[1]}% + var(--editor-toolbar-vert-offset))`}return $(this,rA,bve).call(this),e}hide(){var e;M(this,Iv).classList.add("hidden"),(e=M(this,wv))==null||e.hideDropdown()}show(){var e;M(this,Iv).classList.remove("hidden"),(e=M(this,zQ))==null||e.shown()}async addAltText(e){const i=await e.render();$(this,rA,KQ).call(this,i),M(this,bv).prepend(i,M(this,rA,cV)),ie(this,zQ,e)}addColorPicker(e){ie(this,wv,e);const i=e.renderButton();$(this,rA,KQ).call(this,i),M(this,bv).prepend(i,M(this,rA,cV))}remove(){var e;M(this,Iv).remove(),(e=M(this,wv))==null||e.destroy(),ie(this,wv,null)}};Iv=new WeakMap,wv=new WeakMap,iA=new WeakMap,bv=new WeakMap,zQ=new WeakMap,G7=new WeakMap,lV=new WeakSet,yve=function(t){t.stopPropagation()},rA=new WeakSet,Ive=function(t){M(this,iA)._focusEventsAllowed=!1,t.preventDefault(),t.stopPropagation()},wve=function(t){M(this,iA)._focusEventsAllowed=!0,t.preventDefault(),t.stopPropagation()},KQ=function(t){const e=M(this,iA)._uiManager._signal;t.addEventListener("focusin",$(this,rA,Ive).bind(this),{capture:!0,signal:e}),t.addEventListener("focusout",$(this,rA,wve).bind(this),{capture:!0,signal:e}),t.addEventListener("contextmenu",ac,{signal:e})},bve=function(){const{editorType:t,_uiManager:e}=M(this,iA),i=document.createElement("button");i.className="delete",i.tabIndex=0,i.setAttribute("data-l10n-id",M(JQ,G7)[t]),$(this,rA,KQ).call(this,i),i.addEventListener("click",r=>{e.delete()},{signal:e._signal}),M(this,bv).append(i)},cV=function(){const t=document.createElement("div");return t.className="divider",t},ce(JQ,lV),ce(JQ,G7,null);let PEi=JQ;var YQ,Fg,Bv,j7,Bve,Eve,kve;class REi{constructor(e){ce(this,j7),ce(this,YQ,null),ce(this,Fg,null),ce(this,Bv),ie(this,Bv,e)}show(e,i,r){const[o,s]=$(this,j7,Eve).call(this,i,r),{style:n}=M(this,Fg)||ie(this,Fg,$(this,j7,Bve).call(this));e.append(M(this,Fg)),n.insetInlineEnd=`${100*o}%`,n.top=`calc(${100*s}% + var(--editor-toolbar-vert-offset))`}hide(){M(this,Fg).remove()}}YQ=new WeakMap,Fg=new WeakMap,Bv=new WeakMap,j7=new WeakSet,Bve=function(){const t=ie(this,Fg,document.createElement("div"));t.className="editToolbar",t.setAttribute("role","toolbar"),t.addEventListener("contextmenu",ac,{signal:M(this,Bv)._signal});const e=ie(this,YQ,document.createElement("div"));return e.className="buttons",t.append(e),$(this,j7,kve).call(this),t},Eve=function(t,e){let i=0,r=0;for(const o of t){const s=o.y+o.height;if(s<i)continue;const n=o.x+(e?o.width:0);if(s>i){r=n,i=s;continue}e?n>r&&(r=n):n<r&&(r=n)}return[e?1-r:r,i]},kve=function(){const t=document.createElement("button");t.className="highlightButton",t.tabIndex=0,t.setAttribute("data-l10n-id","pdfjs-highlight-floating-button1");const e=document.createElement("span");t.append(e),e.className="visuallyHidden",e.setAttribute("data-l10n-id","pdfjs-highlight-floating-button-label");const i=M(this,Bv)._signal;t.addEventListener("contextmenu",ac,{signal:i}),t.addEventListener("click",()=>{M(this,Bv).highlightSelection("floating_button")},{signal:i}),M(this,YQ).append(t)};function WQ(t,e,i){for(const r of i)e.addEventListener(r,t[r].bind(t))}function LEi(t){return Math.round(Math.min(255,Math.max(1,255*t))).toString(16).padStart(2,"0")}var dV;class FEi{constructor(){ce(this,dV,0)}get id(){return`${AEi}${ol(this,dV)._++}`}}dV=new WeakMap;var ZQ,AV,za,XQ,uV;const xve=class{constructor(){ce(this,XQ),ce(this,ZQ,BEi()),ce(this,AV,0),ce(this,za,null)}static get _isSVGFittingCanvas(){const e='data:image/svg+xml;charset=UTF-8,<svg viewBox="0 0 1 1" width="1" height="1" xmlns="http://www.w3.org/2000/svg"><rect width="1" height="1" style="fill:red;"/></svg>',i=new OffscreenCanvas(1,3).getContext("2d",{willReadFrequently:!0}),r=new Image;r.src=e;const o=r.decode().then(()=>(i.drawImage(r,0,0,1,1,0,0,1,3),new Uint32Array(i.getImageData(0,0,1,1).data.buffer)[0]===0));return or(this,"_isSVGFittingCanvas",o)}async getFromFile(e){const{lastModified:i,name:r,size:o,type:s}=e;return $(this,XQ,uV).call(this,`${i}_${r}_${o}_${s}`,e)}async getFromUrl(e){return $(this,XQ,uV).call(this,e,e)}async getFromId(e){M(this,za)||ie(this,za,new Map);const i=M(this,za).get(e);return i?i.bitmap?(i.refCounter+=1,i):i.file?this.getFromFile(i.file):this.getFromUrl(i.url):null}getSvgUrl(e){const i=M(this,za).get(e);return i!=null&&i.isSvg?i.svgUrl:null}deleteId(e){M(this,za)||ie(this,za,new Map);const i=M(this,za).get(e);i&&(i.refCounter-=1,i.refCounter===0&&(i.bitmap=null))}isValidId(e){return e.startsWith(`image_${M(this,ZQ)}_`)}};ZQ=new WeakMap,AV=new WeakMap,za=new WeakMap,XQ=new WeakSet,uV=async function(t,e){M(this,za)||ie(this,za,new Map);let i=M(this,za).get(t);if(i===null)return null;if(i!=null&&i.bitmap)return i.refCounter+=1,i;try{i||(i={bitmap:null,id:`image_${M(this,ZQ)}_${ol(this,AV)._++}`,refCounter:0,isSvg:!1});let r;if(typeof e=="string"?(i.url=e,r=await qQ(e,"blob")):r=i.file=e,r.type==="image/svg+xml"){const o=xve._isSVGFittingCanvas,s=new FileReader,n=new Image,a=new Promise((l,c)=>{n.onload=()=>{i.bitmap=n,i.isSvg=!0,l()},s.onload=async()=>{const d=i.svgUrl=s.result;n.src=await o?`${d}#svgView(preserveAspectRatio(none))`:d},n.onerror=s.onerror=c});s.readAsDataURL(r),await a}else i.bitmap=await createImageBitmap(r);i.refCounter=1}catch(r){console.error(r),i=null}return M(this,za).set(t,i),i&&M(this,za).set(i.id,i),i};let TEi=xve;var rs,Tg,$Q,In;class NEi{constructor(e=128){ce(this,rs,[]),ce(this,Tg,!1),ce(this,$Q),ce(this,In,-1),ie(this,$Q,e)}add({cmd:e,undo:i,post:r,mustExec:o,type:s=NaN,overwriteIfSameType:n=!1,keepUndo:a=!1}){if(o&&e(),M(this,Tg))return;const l={cmd:e,undo:i,post:r,type:s};if(M(this,In)===-1){M(this,rs).length>0&&(M(this,rs).length=0),ie(this,In,0),M(this,rs).push(l);return}if(n&&M(this,rs)[M(this,In)].type===s){a&&(l.undo=M(this,rs)[M(this,In)].undo),M(this,rs)[M(this,In)]=l;return}const c=M(this,In)+1;c===M(this,$Q)?M(this,rs).splice(0,1):(ie(this,In,c),c<M(this,rs).length&&M(this,rs).splice(c)),M(this,rs).push(l)}undo(){if(M(this,In)===-1)return;ie(this,Tg,!0);const{undo:e,post:i}=M(this,rs)[M(this,In)];e(),i?.(),ie(this,Tg,!1),ie(this,In,M(this,In)-1)}redo(){if(M(this,In)<M(this,rs).length-1){ie(this,In,M(this,In)+1),ie(this,Tg,!0);const{cmd:e,post:i}=M(this,rs)[M(this,In)];e(),i?.(),ie(this,Tg,!1)}}hasSomethingToUndo(){return M(this,In)!==-1}hasSomethingToRedo(){return M(this,In)<M(this,rs).length-1}destroy(){ie(this,rs,null)}}rs=new WeakMap,Tg=new WeakMap,$Q=new WeakMap,In=new WeakMap;var hV,Qve;class V7{constructor(e){ce(this,hV),this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:i}=_a.platform;for(const[r,o,s={}]of e)for(const n of r){const a=n.startsWith("mac+");i&&a?(this.callbacks.set(n.slice(4),{callback:o,options:s}),this.allKeys.add(n.split("+").at(-1))):!i&&!a&&(this.callbacks.set(n,{callback:o,options:s}),this.allKeys.add(n.split("+").at(-1)))}}exec(e,i){if(!this.allKeys.has(i.key))return;const r=this.callbacks.get($(this,hV,Qve).call(this,i));if(!r)return;const{callback:o,options:{bubbles:s=!1,args:n=[],checker:a=null}}=r;a&&!a(e,i)||(o.bind(e,...n,i)(),s||(i.stopPropagation(),i.preventDefault()))}}hV=new WeakSet,Qve=function(t){t.altKey&&this.buffer.push("alt"),t.ctrlKey&&this.buffer.push("ctrl"),t.metaKey&&this.buffer.push("meta"),t.shiftKey&&this.buffer.push("shift"),this.buffer.push(t.key);const e=this.buffer.join("+");return this.buffer.length=0,e};const Mve=class xCe{get _colors(){const e=new Map([["CanvasText",null],["Canvas",null]]);return DEi(e),or(this,"_colors",e)}convert(e){const i=aV(e);if(!window.matchMedia("(forced-colors: active)").matches)return i;for(const[r,o]of this._colors)if(o.every((s,n)=>s===i[n]))return xCe._colorsMapping.get(r);return i}getHexCode(e){const i=this._colors.get(e);return i?ti.makeHexColor(...i):e}};ei(Mve,"_colorsMapping",new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]));let UEi=Mve;var q7,lc,Un,Rs,_7,K1,Ev,oA,Ng,z7,kv,Ru,nA,xv,eM,tM,K7,iM,Lu,Ug,J7,Og,sA,pV,Hg,rM,Gg,Qv,oM,nM,os,Fr,J1,Mv,Y7,sM,jg,Fu,Y1,aM,li,lM,gV,Sve,Dve,cM,Pve,Rve,Lve,fV,Fve,mV,vV,Tve,ua,W1,Nve,Uve,CV,Ove,W7,yV;const IV=class Fz{constructor(e,i,r,o,s,n,a,l,c,d,A){ce(this,li),ce(this,q7,new AbortController),ce(this,lc,null),ce(this,Un,new Map),ce(this,Rs,new Map),ce(this,_7,null),ce(this,K1,null),ce(this,Ev,null),ce(this,oA,new NEi),ce(this,Ng,null),ce(this,z7,0),ce(this,kv,new Set),ce(this,Ru,null),ce(this,nA,null),ce(this,xv,new Set),ce(this,eM,!1),ce(this,tM,!1),ce(this,K7,!1),ce(this,iM,null),ce(this,Lu,null),ce(this,Ug,null),ce(this,J7,null),ce(this,Og,!1),ce(this,sA,null),ce(this,pV,new FEi),ce(this,Hg,!1),ce(this,rM,!1),ce(this,Gg,null),ce(this,Qv,null),ce(this,oM,null),ce(this,nM,null),ce(this,os,Zi.NONE),ce(this,Fr,new Set),ce(this,J1,null),ce(this,Mv,null),ce(this,Y7,null),ce(this,sM,{isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1}),ce(this,jg,[0,0]),ce(this,Fu,null),ce(this,Y1,null),ce(this,aM,null);const u=this._signal=M(this,q7).signal;ie(this,Y1,e),ie(this,aM,i),ie(this,_7,r),this._eventBus=o,o._on("editingaction",this.onEditingAction.bind(this),{signal:u}),o._on("pagechanging",this.onPageChanging.bind(this),{signal:u}),o._on("scalechanging",this.onScaleChanging.bind(this),{signal:u}),o._on("rotationchanging",this.onRotationChanging.bind(this),{signal:u}),o._on("setpreference",this.onSetPreference.bind(this),{signal:u}),o._on("switchannotationeditorparams",h=>this.updateParams(h.type,h.value),{signal:u}),$(this,li,Pve).call(this),$(this,li,Tve).call(this),$(this,li,fV).call(this),ie(this,K1,s.annotationStorage),ie(this,iM,s.filterFactory),ie(this,Mv,n),ie(this,J7,a||null),ie(this,eM,l),ie(this,tM,c),ie(this,K7,d),ie(this,nM,A||null),this.viewParameters={realScale:pv.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1}static get _keyboardManager(){const e=Fz.prototype,i=n=>M(n,Y1).contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&n.hasSomethingToControl(),r=(n,{target:a})=>{if(a instanceof HTMLInputElement){const{type:l}=a;return l!=="text"&&l!=="number"}return!0},o=this.TRANSLATE_SMALL,s=this.TRANSLATE_BIG;return or(this,"_keyboardManager",new V7([[["ctrl+a","mac+meta+a"],e.selectAll,{checker:r}],[["ctrl+z","mac+meta+z"],e.undo,{checker:r}],[["ctrl+y","ctrl+shift+z","mac+meta+shift+z","ctrl+shift+Z","mac+meta+shift+Z"],e.redo,{checker:r}],[["Backspace","alt+Backspace","ctrl+Backspace","shift+Backspace","mac+Backspace","mac+alt+Backspace","mac+ctrl+Backspace","Delete","ctrl+Delete","shift+Delete","mac+Delete"],e.delete,{checker:r}],[["Enter","mac+Enter"],e.addNewEditorFromKeyboard,{checker:(n,{target:a})=>!(a instanceof HTMLButtonElement)&&M(n,Y1).contains(a)&&!n.isEnterHandled}],[[" ","mac+ "],e.addNewEditorFromKeyboard,{checker:(n,{target:a})=>!(a instanceof HTMLButtonElement)&&M(n,Y1).contains(document.activeElement)}],[["Escape","mac+Escape"],e.unselectAll],[["ArrowLeft","mac+ArrowLeft"],e.translateSelectedEditors,{args:[-o,0],checker:i}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e.translateSelectedEditors,{args:[-s,0],checker:i}],[["ArrowRight","mac+ArrowRight"],e.translateSelectedEditors,{args:[o,0],checker:i}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e.translateSelectedEditors,{args:[s,0],checker:i}],[["ArrowUp","mac+ArrowUp"],e.translateSelectedEditors,{args:[0,-o],checker:i}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e.translateSelectedEditors,{args:[0,-s],checker:i}],[["ArrowDown","mac+ArrowDown"],e.translateSelectedEditors,{args:[0,o],checker:i}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e.translateSelectedEditors,{args:[0,s],checker:i}]]))}destroy(){var e,i,r;(e=M(this,q7))==null||e.abort(),ie(this,q7,null),this._signal=null;for(const o of M(this,Rs).values())o.destroy();M(this,Rs).clear(),M(this,Un).clear(),M(this,xv).clear(),ie(this,lc,null),M(this,Fr).clear(),M(this,oA).destroy(),(i=M(this,_7))==null||i.destroy(),(r=M(this,sA))==null||r.hide(),ie(this,sA,null),M(this,Lu)&&(clearTimeout(M(this,Lu)),ie(this,Lu,null)),M(this,Fu)&&(clearTimeout(M(this,Fu)),ie(this,Fu,null))}combinedSignal(e){return AbortSignal.any([this._signal,e.signal])}get mlManager(){return M(this,nM)}get useNewAltTextFlow(){return M(this,tM)}get useNewAltTextWhenAddingImage(){return M(this,K7)}get hcmFilter(){return or(this,"hcmFilter",M(this,Mv)?M(this,iM).addHCMFilter(M(this,Mv).foreground,M(this,Mv).background):"none")}get direction(){return or(this,"direction",getComputedStyle(M(this,Y1)).direction)}get highlightColors(){return or(this,"highlightColors",M(this,J7)?new Map(M(this,J7).split(",").map(e=>e.split("=").map(i=>i.trim()))):null)}get highlightColorNames(){return or(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,e=>e.reverse())):null)}setMainHighlightColorPicker(e){ie(this,oM,e)}editAltText(e,i=!1){var r;(r=M(this,_7))==null||r.editAltText(this,e,i)}switchToMode(e,i){this._eventBus.on("annotationeditormodechanged",i,{once:!0,signal:this._signal}),this._eventBus.dispatch("showannotationeditorui",{source:this,mode:e})}setPreference(e,i){this._eventBus.dispatch("setpreference",{source:this,name:e,value:i})}onSetPreference({name:e,value:i}){switch(e){case"enableNewAltTextWhenAddingImage":ie(this,K7,i);break}}onPageChanging({pageNumber:e}){ie(this,z7,e-1)}focusMainContainer(){M(this,Y1).focus()}findParent(e,i){for(const r of M(this,Rs).values()){const{x:o,y:s,width:n,height:a}=r.div.getBoundingClientRect();if(e>=o&&e<=o+n&&i>=s&&i<=s+a)return r}return null}disableUserSelect(e=!1){M(this,aM).classList.toggle("noUserSelect",e)}addShouldRescale(e){M(this,xv).add(e)}removeShouldRescale(e){M(this,xv).delete(e)}onScaleChanging({scale:e}){this.commitOrRemove(),this.viewParameters.realScale=e*pv.PDF_TO_CSS_UNITS;for(const i of M(this,xv))i.onScaleChanging()}onRotationChanging({pagesRotation:e}){this.commitOrRemove(),this.viewParameters.rotation=e}highlightSelection(e=""){const i=document.getSelection();if(!i||i.isCollapsed)return;const{anchorNode:r,anchorOffset:o,focusNode:s,focusOffset:n}=i,a=i.toString(),l=$(this,li,lM).call(this,i).closest(".textLayer"),c=this.getSelectionBoxes(l);if(!c)return;i.empty();const d=$(this,li,gV).call(this,l),A=M(this,os)===Zi.NONE,u=()=>{d?.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:e,boxes:c,anchorNode:r,anchorOffset:o,focusNode:s,focusOffset:n,text:a}),A&&this.showAllEditors("highlight",!0,!0)};if(A){this.switchToMode(Zi.HIGHLIGHT,u);return}u()}addToAnnotationStorage(e){!e.isEmpty()&&M(this,K1)&&!M(this,K1).has(e.id)&&M(this,K1).setValue(e.id,e)}blur(){if(this.isShiftKeyDown=!1,M(this,Og)&&(ie(this,Og,!1),$(this,li,cM).call(this,"main_toolbar")),!this.hasSelection)return;const{activeElement:e}=document;for(const i of M(this,Fr))if(i.div.contains(e)){ie(this,Qv,[i,e]),i._focusEventsAllowed=!1;break}}focus(){if(!M(this,Qv))return;const[e,i]=M(this,Qv);ie(this,Qv,null),i.addEventListener("focusin",()=>{e._focusEventsAllowed=!0},{once:!0,signal:this._signal}),i.focus()}addEditListeners(){$(this,li,fV).call(this),$(this,li,mV).call(this)}removeEditListeners(){$(this,li,Fve).call(this),$(this,li,vV).call(this)}dragOver(e){for(const{type:i}of e.dataTransfer.items)for(const r of M(this,nA))if(r.isHandlingMimeForPasting(i)){e.dataTransfer.dropEffect="copy",e.preventDefault();return}}drop(e){for(const i of e.dataTransfer.items)for(const r of M(this,nA))if(r.isHandlingMimeForPasting(i.type)){r.paste(i,this.currentLayer),e.preventDefault();return}}copy(e){var i;if(e.preventDefault(),(i=M(this,lc))==null||i.commitOrRemove(),!this.hasSelection)return;const r=[];for(const o of M(this,Fr)){const s=o.serialize(!0);s&&r.push(s)}r.length!==0&&e.clipboardData.setData("application/pdfjs",JSON.stringify(r))}cut(e){this.copy(e),this.delete()}paste(e){e.preventDefault();const{clipboardData:i}=e;for(const s of i.items)for(const n of M(this,nA))if(n.isHandlingMimeForPasting(s.type)){n.paste(s,this.currentLayer);return}let r=i.getData("application/pdfjs");if(!r)return;try{r=JSON.parse(r)}catch(s){Hi(`paste: "${s.message}".`);return}if(!Array.isArray(r))return;this.unselectAll();const o=this.currentLayer;try{const s=[];for(const l of r){const c=o.deserialize(l);if(!c)return;s.push(c)}const n=()=>{for(const l of s)$(this,li,CV).call(this,l);$(this,li,yV).call(this,s)},a=()=>{for(const l of s)l.remove()};this.addCommands({cmd:n,undo:a,mustExec:!0})}catch(s){Hi(`paste: "${s.message}".`)}}keydown(e){!this.isShiftKeyDown&&e.key==="Shift"&&(this.isShiftKeyDown=!0),M(this,os)!==Zi.NONE&&!this.isEditorHandlingKeyboard&&Fz._keyboardManager.exec(this,e)}keyup(e){this.isShiftKeyDown&&e.key==="Shift"&&(this.isShiftKeyDown=!1,M(this,Og)&&(ie(this,Og,!1),$(this,li,cM).call(this,"main_toolbar")))}onEditingAction({name:e}){switch(e){case"undo":case"redo":case"delete":case"selectAll":this[e]();break;case"highlightSelection":this.highlightSelection("context_menu");break}}setEditingState(e){e?($(this,li,Rve).call(this),$(this,li,mV).call(this),$(this,li,ua).call(this,{isEditing:M(this,os)!==Zi.NONE,isEmpty:$(this,li,W7).call(this),hasSomethingToUndo:M(this,oA).hasSomethingToUndo(),hasSomethingToRedo:M(this,oA).hasSomethingToRedo(),hasSelectedEditor:!1})):($(this,li,Lve).call(this),$(this,li,vV).call(this),$(this,li,ua).call(this,{isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(e){if(!M(this,nA)){ie(this,nA,e);for(const i of M(this,nA))$(this,li,W1).call(this,i.defaultPropertiesToUpdate)}}getId(){return M(this,pV).id}get currentLayer(){return M(this,Rs).get(M(this,z7))}getLayer(e){return M(this,Rs).get(e)}get currentPageIndex(){return M(this,z7)}addLayer(e){M(this,Rs).set(e.pageIndex,e),M(this,Hg)?e.enable():e.disable()}removeLayer(e){M(this,Rs).delete(e.pageIndex)}updateMode(e,i=null,r=!1){if(M(this,os)!==e){if(ie(this,os,e),e===Zi.NONE){this.setEditingState(!1),$(this,li,Uve).call(this);return}this.setEditingState(!0),$(this,li,Nve).call(this),this.unselectAll();for(const o of M(this,Rs).values())o.updateMode(e);if(!i&&r){this.addNewEditorFromKeyboard();return}if(i){for(const o of M(this,Un).values())if(o.annotationElementId===i){this.setSelected(o),o.enterInEditMode();break}}}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(e){e!==M(this,os)&&this._eventBus.dispatch("switchannotationeditormode",{source:this,mode:e})}updateParams(e,i){var r;if(M(this,nA)){switch(e){case Bi.CREATE:this.currentLayer.addNewEditor();return;case Bi.HIGHLIGHT_DEFAULT_COLOR:(r=M(this,oM))==null||r.updateColor(i);break;case Bi.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(M(this,Y7)||ie(this,Y7,new Map)).set(e,i),this.showAllEditors("highlight",i);break}for(const o of M(this,Fr))o.updateParams(e,i);for(const o of M(this,nA))o.updateDefaultParams(e,i)}}showAllEditors(e,i,r=!1){var o;for(const s of M(this,Un).values())s.editorType===e&&s.show(i);(((o=M(this,Y7))==null?void 0:o.get(Bi.HIGHLIGHT_SHOW_ALL))??!0)!==i&&$(this,li,W1).call(this,[[Bi.HIGHLIGHT_SHOW_ALL,i]])}enableWaiting(e=!1){if(M(this,rM)!==e){ie(this,rM,e);for(const i of M(this,Rs).values())e?i.disableClick():i.enableClick(),i.div.classList.toggle("waiting",e)}}getEditors(e){const i=[];for(const r of M(this,Un).values())r.pageIndex===e&&i.push(r);return i}getEditor(e){return M(this,Un).get(e)}addEditor(e){M(this,Un).set(e.id,e)}removeEditor(e){var i;e.div.contains(document.activeElement)&&(M(this,Lu)&&clearTimeout(M(this,Lu)),ie(this,Lu,setTimeout(()=>{this.focusMainContainer(),ie(this,Lu,null)},0))),M(this,Un).delete(e.id),this.unselect(e),(!e.annotationElementId||!M(this,kv).has(e.annotationElementId))&&((i=M(this,K1))==null||i.remove(e.id))}addDeletedAnnotationElement(e){M(this,kv).add(e.annotationElementId),this.addChangedExistingAnnotation(e),e.deleted=!0}isDeletedAnnotationElement(e){return M(this,kv).has(e)}removeDeletedAnnotationElement(e){M(this,kv).delete(e.annotationElementId),this.removeChangedExistingAnnotation(e),e.deleted=!1}setActiveEditor(e){M(this,lc)!==e&&(ie(this,lc,e),e&&$(this,li,W1).call(this,e.propertiesToUpdate))}updateUI(e){M(this,li,Ove)===e&&$(this,li,W1).call(this,e.propertiesToUpdate)}toggleSelected(e){if(M(this,Fr).has(e)){M(this,Fr).delete(e),e.unselect(),$(this,li,ua).call(this,{hasSelectedEditor:this.hasSelection});return}M(this,Fr).add(e),e.select(),$(this,li,W1).call(this,e.propertiesToUpdate),$(this,li,ua).call(this,{hasSelectedEditor:!0})}setSelected(e){for(const i of M(this,Fr))i!==e&&i.unselect();M(this,Fr).clear(),M(this,Fr).add(e),e.select(),$(this,li,W1).call(this,e.propertiesToUpdate),$(this,li,ua).call(this,{hasSelectedEditor:!0})}isSelected(e){return M(this,Fr).has(e)}get firstSelectedEditor(){return M(this,Fr).values().next().value}unselect(e){e.unselect(),M(this,Fr).delete(e),$(this,li,ua).call(this,{hasSelectedEditor:this.hasSelection})}get hasSelection(){return M(this,Fr).size!==0}get isEnterHandled(){return M(this,Fr).size===1&&this.firstSelectedEditor.isEnterHandled}undo(){M(this,oA).undo(),$(this,li,ua).call(this,{hasSomethingToUndo:M(this,oA).hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:$(this,li,W7).call(this)})}redo(){M(this,oA).redo(),$(this,li,ua).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:M(this,oA).hasSomethingToRedo(),isEmpty:$(this,li,W7).call(this)})}addCommands(e){M(this,oA).add(e),$(this,li,ua).call(this,{hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:$(this,li,W7).call(this)})}delete(){if(this.commitOrRemove(),!this.hasSelection)return;const e=[...M(this,Fr)],i=()=>{for(const o of e)o.remove()},r=()=>{for(const o of e)$(this,li,CV).call(this,o)};this.addCommands({cmd:i,undo:r,mustExec:!0})}commitOrRemove(){var e;(e=M(this,lc))==null||e.commitOrRemove()}hasSomethingToControl(){return M(this,lc)||this.hasSelection}selectAll(){for(const e of M(this,Fr))e.commit();$(this,li,yV).call(this,M(this,Un).values())}unselectAll(){if(!(M(this,lc)&&(M(this,lc).commitOrRemove(),M(this,os)!==Zi.NONE))&&this.hasSelection){for(const e of M(this,Fr))e.unselect();M(this,Fr).clear(),$(this,li,ua).call(this,{hasSelectedEditor:!1})}}translateSelectedEditors(e,i,r=!1){if(r||this.commitOrRemove(),!this.hasSelection)return;M(this,jg)[0]+=e,M(this,jg)[1]+=i;const[o,s]=M(this,jg),n=[...M(this,Fr)];M(this,Fu)&&clearTimeout(M(this,Fu)),ie(this,Fu,setTimeout(()=>{ie(this,Fu,null),M(this,jg)[0]=M(this,jg)[1]=0,this.addCommands({cmd:()=>{for(const l of n)M(this,Un).has(l.id)&&l.translateInPage(o,s)},undo:()=>{for(const l of n)M(this,Un).has(l.id)&&l.translateInPage(-o,-s)},mustExec:!1})},1e3));for(const l of n)l.translateInPage(e,i)}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),ie(this,Ru,new Map);for(const e of M(this,Fr))M(this,Ru).set(e,{savedX:e.x,savedY:e.y,savedPageIndex:e.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!M(this,Ru))return!1;this.disableUserSelect(!1);const e=M(this,Ru);ie(this,Ru,null);let i=!1;for(const[{x:o,y:s,pageIndex:n},a]of e)a.newX=o,a.newY=s,a.newPageIndex=n,i||(i=o!==a.savedX||s!==a.savedY||n!==a.savedPageIndex);if(!i)return!1;const r=(o,s,n,a)=>{if(M(this,Un).has(o.id)){const l=M(this,Rs).get(a);l?o._setParentAndPosition(l,s,n):(o.pageIndex=a,o.x=s,o.y=n)}};return this.addCommands({cmd:()=>{for(const[o,{newX:s,newY:n,newPageIndex:a}]of e)r(o,s,n,a)},undo:()=>{for(const[o,{savedX:s,savedY:n,savedPageIndex:a}]of e)r(o,s,n,a)},mustExec:!0}),!0}dragSelectedEditors(e,i){if(M(this,Ru))for(const r of M(this,Ru).keys())r.drag(e,i)}rebuild(e){if(e.parent===null){const i=this.getLayer(e.pageIndex);i?(i.changeParent(e),i.addOrRebuild(e)):(this.addEditor(e),this.addToAnnotationStorage(e),e.rebuild())}else e.parent.addOrRebuild(e)}get isEditorHandlingKeyboard(){var e;return((e=this.getActive())==null?void 0:e.shouldGetKeyboardEvents())||M(this,Fr).size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(e){return M(this,lc)===e}getActive(){return M(this,lc)}getMode(){return M(this,os)}get imageManager(){return or(this,"imageManager",new TEi)}getSelectionBoxes(e){if(!e)return null;const i=document.getSelection();for(let c=0,d=i.rangeCount;c<d;c++)if(!e.contains(i.getRangeAt(c).commonAncestorContainer))return null;const{x:r,y:o,width:s,height:n}=e.getBoundingClientRect();let a;switch(e.getAttribute("data-main-rotation")){case"90":a=(c,d,A,u)=>({x:(d-o)/n,y:1-(c+A-r)/s,width:u/n,height:A/s});break;case"180":a=(c,d,A,u)=>({x:1-(c+A-r)/s,y:1-(d+u-o)/n,width:A/s,height:u/n});break;case"270":a=(c,d,A,u)=>({x:1-(d+u-o)/n,y:(c-r)/s,width:u/n,height:A/s});break;default:a=(c,d,A,u)=>({x:(c-r)/s,y:(d-o)/n,width:A/s,height:u/n});break}const l=[];for(let c=0,d=i.rangeCount;c<d;c++){const A=i.getRangeAt(c);if(!A.collapsed)for(const{x:u,y:h,width:g,height:p}of A.getClientRects())g===0||p===0||l.push(a(u,h,g,p))}return l.length===0?null:l}addChangedExistingAnnotation({annotationElementId:e,id:i}){(M(this,Ev)||ie(this,Ev,new Map)).set(e,i)}removeChangedExistingAnnotation({annotationElementId:e}){var i;(i=M(this,Ev))==null||i.delete(e)}renderAnnotationElement(e){var i;const r=(i=M(this,Ev))==null?void 0:i.get(e.data.id);if(!r)return;const o=M(this,K1).getRawValue(r);o&&(M(this,os)===Zi.NONE&&!o.hasBeenModified||o.renderAnnotationElement(e))}};q7=new WeakMap,lc=new WeakMap,Un=new WeakMap,Rs=new WeakMap,_7=new WeakMap,K1=new WeakMap,Ev=new WeakMap,oA=new WeakMap,Ng=new WeakMap,z7=new WeakMap,kv=new WeakMap,Ru=new WeakMap,nA=new WeakMap,xv=new WeakMap,eM=new WeakMap,tM=new WeakMap,K7=new WeakMap,iM=new WeakMap,Lu=new WeakMap,Ug=new WeakMap,J7=new WeakMap,Og=new WeakMap,sA=new WeakMap,pV=new WeakMap,Hg=new WeakMap,rM=new WeakMap,Gg=new WeakMap,Qv=new WeakMap,oM=new WeakMap,nM=new WeakMap,os=new WeakMap,Fr=new WeakMap,J1=new WeakMap,Mv=new WeakMap,Y7=new WeakMap,sM=new WeakMap,jg=new WeakMap,Fu=new WeakMap,Y1=new WeakMap,aM=new WeakMap,li=new WeakSet,lM=function({anchorNode:t}){return t.nodeType===Node.TEXT_NODE?t.parentElement:t},gV=function(t){const{currentLayer:e}=this;if(e.hasTextLayer(t))return e;for(const i of M(this,Rs).values())if(i.hasTextLayer(t))return i;return null},Sve=function(){const t=document.getSelection();if(!t||t.isCollapsed)return;const e=$(this,li,lM).call(this,t).closest(".textLayer"),i=this.getSelectionBoxes(e);i&&(M(this,sA)||ie(this,sA,new REi(this)),M(this,sA).show(e,i,this.direction==="ltr"))},Dve=function(){var t,e,i;const r=document.getSelection();if(!r||r.isCollapsed){M(this,J1)&&((t=M(this,sA))==null||t.hide(),ie(this,J1,null),$(this,li,ua).call(this,{hasSelectedText:!1}));return}const{anchorNode:o}=r;if(o===M(this,J1))return;const s=$(this,li,lM).call(this,r).closest(".textLayer");if(!s){M(this,J1)&&((e=M(this,sA))==null||e.hide(),ie(this,J1,null),$(this,li,ua).call(this,{hasSelectedText:!1}));return}if((i=M(this,sA))==null||i.hide(),ie(this,J1,o),$(this,li,ua).call(this,{hasSelectedText:!0}),!(M(this,os)!==Zi.HIGHLIGHT&&M(this,os)!==Zi.NONE)&&(M(this,os)===Zi.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),ie(this,Og,this.isShiftKeyDown),!this.isShiftKeyDown)){const n=M(this,os)===Zi.HIGHLIGHT?$(this,li,gV).call(this,s):null;n?.toggleDrawing();const a=new AbortController,l=this.combinedSignal(a),c=d=>{d.type==="pointerup"&&d.button!==0||(a.abort(),n?.toggleDrawing(!0),d.type==="pointerup"&&$(this,li,cM).call(this,"main_toolbar"))};window.addEventListener("pointerup",c,{signal:l}),window.addEventListener("blur",c,{signal:l})}},cM=function(t=""){M(this,os)===Zi.HIGHLIGHT?this.highlightSelection(t):M(this,eM)&&$(this,li,Sve).call(this)},Pve=function(){document.addEventListener("selectionchange",$(this,li,Dve).bind(this),{signal:this._signal})},Rve=function(){if(M(this,Ug))return;ie(this,Ug,new AbortController);const t=this.combinedSignal(M(this,Ug));window.addEventListener("focus",this.focus.bind(this),{signal:t}),window.addEventListener("blur",this.blur.bind(this),{signal:t})},Lve=function(){var t;(t=M(this,Ug))==null||t.abort(),ie(this,Ug,null)},fV=function(){if(M(this,Gg))return;ie(this,Gg,new AbortController);const t=this.combinedSignal(M(this,Gg));window.addEventListener("keydown",this.keydown.bind(this),{signal:t}),window.addEventListener("keyup",this.keyup.bind(this),{signal:t})},Fve=function(){var t;(t=M(this,Gg))==null||t.abort(),ie(this,Gg,null)},mV=function(){if(M(this,Ng))return;ie(this,Ng,new AbortController);const t=this.combinedSignal(M(this,Ng));document.addEventListener("copy",this.copy.bind(this),{signal:t}),document.addEventListener("cut",this.cut.bind(this),{signal:t}),document.addEventListener("paste",this.paste.bind(this),{signal:t})},vV=function(){var t;(t=M(this,Ng))==null||t.abort(),ie(this,Ng,null)},Tve=function(){const t=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:t}),document.addEventListener("drop",this.drop.bind(this),{signal:t})},ua=function(t){Object.entries(t).some(([e,i])=>M(this,sM)[e]!==i)&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(M(this,sM),t)}),M(this,os)===Zi.HIGHLIGHT&&t.hasSelectedEditor===!1&&$(this,li,W1).call(this,[[Bi.HIGHLIGHT_FREE,!0]]))},W1=function(t){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:t})},Nve=function(){if(!M(this,Hg)){ie(this,Hg,!0);for(const t of M(this,Rs).values())t.enable();for(const t of M(this,Un).values())t.enable()}},Uve=function(){if(this.unselectAll(),M(this,Hg)){ie(this,Hg,!1);for(const t of M(this,Rs).values())t.disable();for(const t of M(this,Un).values())t.disable()}},CV=function(t){const e=M(this,Rs).get(t.pageIndex);e?e.addOrRebuild(t):(this.addEditor(t),this.addToAnnotationStorage(t))},Ove=function(){let t=null;for(t of M(this,Fr));return t},W7=function(){if(M(this,Un).size===0)return!0;if(M(this,Un).size===1)for(const t of M(this,Un).values())return t.isEmpty();return!1},yV=function(t){for(const e of M(this,Fr))e.unselect();M(this,Fr).clear();for(const e of t)e.isEmpty()||(M(this,Fr).add(e),e.select());$(this,li,ua).call(this,{hasSelectedEditor:this.hasSelection})},ei(IV,"TRANSLATE_SMALL",1),ei(IV,"TRANSLATE_BIG",10);let Z7=IV;var ns,Tu,aA,Nu,cc,X7,Uu,Ql,Z1,Sv,Ou,X1,dM,AM;const $7=class s5{constructor(e){ce(this,X1),ce(this,ns,null),ce(this,Tu,!1),ce(this,aA,null),ce(this,Nu,null),ce(this,cc,null),ce(this,X7,!1),ce(this,Uu,null),ce(this,Ql,null),ce(this,Z1,null),ce(this,Sv,null),ce(this,Ou,!1),ie(this,Ql,e),ie(this,Ou,e._uiManager.useNewAltTextFlow)}static initialize(e){s5._l10nPromise||(s5._l10nPromise=e)}async render(){const e=ie(this,aA,document.createElement("button"));e.className="altText";let i;M(this,Ou)?(e.classList.add("new"),i=await s5._l10nPromise.get("pdfjs-editor-new-alt-text-missing-button-label")):i=await s5._l10nPromise.get("pdfjs-editor-alt-text-button-label"),e.textContent=i,e.setAttribute("aria-label",i),e.tabIndex="0";const r=M(this,Ql)._uiManager._signal;e.addEventListener("contextmenu",ac,{signal:r}),e.addEventListener("pointerdown",s=>s.stopPropagation(),{signal:r});const o=s=>{s.preventDefault(),M(this,Ql)._uiManager.editAltText(M(this,Ql)),M(this,Ou)&&M(this,Ql)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:M(this,X1,dM)}})};return e.addEventListener("click",o,{capture:!0,signal:r}),e.addEventListener("keydown",s=>{s.target===e&&s.key==="Enter"&&(ie(this,X7,!0),o(s))},{signal:r}),await $(this,X1,AM).call(this),e}finish(){M(this,aA)&&(M(this,aA).focus({focusVisible:M(this,X7)}),ie(this,X7,!1))}isEmpty(){return M(this,Ou)?M(this,ns)===null:!M(this,ns)&&!M(this,Tu)}hasData(){return M(this,Ou)?M(this,ns)!==null||!!M(this,Z1):this.isEmpty()}get guessedText(){return M(this,Z1)}async setGuessedText(e){M(this,ns)===null&&(ie(this,Z1,e),ie(this,Sv,await s5._l10nPromise.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer")({generatedAltText:e})),$(this,X1,AM).call(this))}toggleAltTextBadge(e=!1){var i;if(!M(this,Ou)||M(this,ns)){(i=M(this,Uu))==null||i.remove(),ie(this,Uu,null);return}if(!M(this,Uu)){const r=ie(this,Uu,document.createElement("div"));r.className="noAltTextBadge",M(this,Ql).div.append(r)}M(this,Uu).classList.toggle("hidden",!e)}serialize(e){let i=M(this,ns);return!e&&M(this,Z1)===i&&(i=M(this,Sv)),{altText:i,decorative:M(this,Tu),guessedText:M(this,Z1),textWithDisclaimer:M(this,Sv)}}get data(){return{altText:M(this,ns),decorative:M(this,Tu)}}set data({altText:e,decorative:i,guessedText:r,textWithDisclaimer:o,cancel:s=!1}){r&&(ie(this,Z1,r),ie(this,Sv,o)),!(M(this,ns)===e&&M(this,Tu)===i)&&(s||(ie(this,ns,e),ie(this,Tu,i)),$(this,X1,AM).call(this))}toggle(e=!1){M(this,aA)&&(!e&&M(this,cc)&&(clearTimeout(M(this,cc)),ie(this,cc,null)),M(this,aA).disabled=!e)}shown(){M(this,Ql)._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:M(this,X1,dM)}})}destroy(){var e,i;(e=M(this,aA))==null||e.remove(),ie(this,aA,null),ie(this,Nu,null),(i=M(this,Uu))==null||i.remove(),ie(this,Uu,null)}};ns=new WeakMap,Tu=new WeakMap,aA=new WeakMap,Nu=new WeakMap,cc=new WeakMap,X7=new WeakMap,Uu=new WeakMap,Ql=new WeakMap,Z1=new WeakMap,Sv=new WeakMap,Ou=new WeakMap,X1=new WeakSet,dM=function(){return M(this,ns)&&"added"||M(this,ns)===null&&this.guessedText&&"review"||"missing"},AM=async function(){var t,e;const i=M(this,aA);if(!i)return;if(M(this,Ou)){const s=M(this,X1,dM),n=s==="review"?"to-review":s;if(i.classList.toggle("done",!!M(this,ns)),$7._l10nPromise.get(`pdfjs-editor-new-alt-text-${n}-button-label`).then(a=>{i.setAttribute("aria-label",a);for(const l of i.childNodes)if(l.nodeType===Node.TEXT_NODE){l.textContent=a;break}}),!M(this,ns)){(t=M(this,Nu))==null||t.remove();return}}else{if(!M(this,ns)&&!M(this,Tu)){i.classList.remove("done"),(e=M(this,Nu))==null||e.remove();return}i.classList.add("done"),$7._l10nPromise.get("pdfjs-editor-alt-text-edit-button-label").then(s=>{i.setAttribute("aria-label",s)})}let r=M(this,Nu);if(!r){ie(this,Nu,r=document.createElement("span")),r.className="tooltip",r.setAttribute("role","tooltip");const s=r.id=`alt-text-tooltip-${M(this,Ql).id}`;i.setAttribute("aria-describedby",s);const n=100,a=M(this,Ql)._uiManager._signal;a.addEventListener("abort",()=>{clearTimeout(M(this,cc)),ie(this,cc,null)},{once:!0}),i.addEventListener("mouseenter",()=>{ie(this,cc,setTimeout(()=>{ie(this,cc,null),M(this,Nu).classList.add("show"),M(this,Ql)._reportTelemetry({action:"alt_text_tooltip"})},n))},{signal:a}),i.addEventListener("mouseleave",()=>{var l;M(this,cc)&&(clearTimeout(M(this,cc)),ie(this,cc,null)),(l=M(this,Nu))==null||l.classList.remove("show")},{signal:a})}r.innerText=M(this,Tu)?await $7._l10nPromise.get("pdfjs-editor-alt-text-decorative-tooltip"):M(this,ns),r.parentNode||i.append(r);const o=M(this,Ql).getImageForAltText();o?.setAttribute("aria-describedby",r.id)},ei($7,"_l10nPromise",null);let Hve=$7;var Dv,lA,Do,ey,Pv,Ls,Rv,Vg,uM,Lv,Hu,hM,Fv,$1,Gu,ty,iy,dc,pM,wV,_r,bV,gM,BV,EV,Gve,jve,kV,xV,QV,Vve,MV,qve,_ve,zve,SV,ry;const rd=class _n{constructor(e){ce(this,_r),ce(this,Dv,null),ce(this,lA,null),ce(this,Do,null),ce(this,ey,!1),ce(this,Pv,!1),ce(this,Ls,null),ce(this,Rv,null),ce(this,Vg,null),ce(this,uM,""),ce(this,Lv,!1),ce(this,Hu,null),ce(this,hM,!1),ce(this,Fv,!1),ce(this,$1,!1),ce(this,Gu,null),ce(this,ty,0),ce(this,iy,0),ce(this,dc,null),ei(this,"_editToolbar",null),ei(this,"_initialOptions",Object.create(null)),ei(this,"_isVisible",!0),ei(this,"_uiManager",null),ei(this,"_focusEventsAllowed",!0),ce(this,pM,!1),ce(this,wV,_n._zIndex++),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,this._uiManager=e.uiManager,this.annotationElementId=null,this._willKeepAspectRatio=!1,this._initialOptions.isCentered=e.isCentered,this._structTreeParentId=null;const{rotation:i,rawDims:{pageWidth:r,pageHeight:o,pageX:s,pageY:n}}=this.parent.viewport;this.rotation=i,this.pageRotation=(360+i-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[r,o],this.pageTranslation=[s,n];const[a,l]=this.parentDimensions;this.x=e.x/a,this.y=e.y/l,this.isAttachedToDOM=!1,this.deleted=!1}static get _resizerKeyboardManager(){const e=_n.prototype._resizeWithKeyboard,i=Z7.TRANSLATE_SMALL,r=Z7.TRANSLATE_BIG;return or(this,"_resizerKeyboardManager",new V7([[["ArrowLeft","mac+ArrowLeft"],e,{args:[-i,0]}],[["ctrl+ArrowLeft","mac+shift+ArrowLeft"],e,{args:[-r,0]}],[["ArrowRight","mac+ArrowRight"],e,{args:[i,0]}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e,{args:[r,0]}],[["ArrowUp","mac+ArrowUp"],e,{args:[0,-i]}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e,{args:[0,-r]}],[["ArrowDown","mac+ArrowDown"],e,{args:[0,i]}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e,{args:[0,r]}],[["Escape","mac+Escape"],_n.prototype._stopResizingWithKeyboard]]))}get editorType(){return Object.getPrototypeOf(this).constructor._type}static get _defaultLineColor(){return or(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(e){const i=new OEi({id:e.parent.getNextId(),parent:e.parent,uiManager:e._uiManager});i.annotationElementId=e.annotationElementId,i.deleted=!0,i._uiManager.addToAnnotationStorage(i)}static initialize(e,i,r){if(_n._l10nResizer||(_n._l10nResizer=Object.freeze({topLeft:"pdfjs-editor-resizer-top-left",topMiddle:"pdfjs-editor-resizer-top-middle",topRight:"pdfjs-editor-resizer-top-right",middleRight:"pdfjs-editor-resizer-middle-right",bottomRight:"pdfjs-editor-resizer-bottom-right",bottomMiddle:"pdfjs-editor-resizer-bottom-middle",bottomLeft:"pdfjs-editor-resizer-bottom-left",middleLeft:"pdfjs-editor-resizer-middle-left"})),_n._l10nPromise||(_n._l10nPromise=new Map([...["pdfjs-editor-alt-text-button-label","pdfjs-editor-alt-text-edit-button-label","pdfjs-editor-alt-text-decorative-tooltip","pdfjs-editor-new-alt-text-added-button-label","pdfjs-editor-new-alt-text-missing-button-label","pdfjs-editor-new-alt-text-to-review-button-label"].map(s=>[s,e.get(s)]),...["pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer"].map(s=>[s,e.get.bind(e,s)])])),r!=null&&r.strings)for(const s of r.strings)_n._l10nPromise.set(s,e.get(s));if(_n._borderLineWidth!==-1)return;const o=getComputedStyle(document.documentElement);_n._borderLineWidth=parseFloat(o.getPropertyValue("--outline-width"))||0}static updateDefaultParams(e,i){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(e){return!1}static paste(e,i){nn("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return M(this,pM)}set _isDraggable(e){var i;ie(this,pM,e),(i=this.div)==null||i.classList.toggle("draggable",e)}get isEnterHandled(){return!0}center(){const[e,i]=this.pageDimensions;switch(this.parentRotation){case 90:this.x-=this.height*i/(e*2),this.y+=this.width*e/(i*2);break;case 180:this.x+=this.width/2,this.y+=this.height/2;break;case 270:this.x+=this.height*i/(e*2),this.y-=this.width*e/(i*2);break;default:this.x-=this.width/2,this.y-=this.height/2;break}this.fixAndSetPosition()}addCommands(e){this._uiManager.addCommands(e)}get currentLayer(){return this._uiManager.currentLayer}setInBackground(){this.div.style.zIndex=0}setInForeground(){this.div.style.zIndex=M(this,wV)}setParent(e){e!==null?(this.pageIndex=e.pageIndex,this.pageDimensions=e.pageDimensions):$(this,_r,ry).call(this),this.parent=e}focusin(e){this._focusEventsAllowed&&(M(this,Lv)?ie(this,Lv,!1):this.parent.setSelected(this))}focusout(e){var i;if(!this._focusEventsAllowed||!this.isAttachedToDOM)return;const r=e.relatedTarget;r!=null&&r.closest(`#${this.id}`)||(e.preventDefault(),(i=this.parent)!=null&&i.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(e,i,r,o){const[s,n]=this.parentDimensions;[r,o]=this.screenToPageTranslation(r,o),this.x=(e+r)/s,this.y=(i+o)/n,this.fixAndSetPosition()}translate(e,i){$(this,_r,bV).call(this,this.parentDimensions,e,i)}translateInPage(e,i){M(this,Hu)||ie(this,Hu,[this.x,this.y]),$(this,_r,bV).call(this,this.pageDimensions,e,i),this.div.scrollIntoView({block:"nearest"})}drag(e,i){M(this,Hu)||ie(this,Hu,[this.x,this.y]);const[r,o]=this.parentDimensions;if(this.x+=e/r,this.y+=i/o,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:c,y:d}=this.div.getBoundingClientRect();this.parent.findNewParent(this,c,d)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:s,y:n}=this;const[a,l]=this.getBaseTranslation();s+=a,n+=l,this.div.style.left=`${(100*s).toFixed(2)}%`,this.div.style.top=`${(100*n).toFixed(2)}%`,this.div.scrollIntoView({block:"nearest"})}get _hasBeenMoved(){return!!M(this,Hu)&&(M(this,Hu)[0]!==this.x||M(this,Hu)[1]!==this.y)}getBaseTranslation(){const[e,i]=this.parentDimensions,{_borderLineWidth:r}=_n,o=r/e,s=r/i;switch(this.rotation){case 90:return[-o,s];case 180:return[o,s];case 270:return[o,-s];default:return[-o,-s]}}get _mustFixPosition(){return!0}fixAndSetPosition(e=this.rotation){const[i,r]=this.pageDimensions;let{x:o,y:s,width:n,height:a}=this;if(n*=i,a*=r,o*=i,s*=r,this._mustFixPosition)switch(e){case 0:o=Math.max(0,Math.min(i-n,o)),s=Math.max(0,Math.min(r-a,s));break;case 90:o=Math.max(0,Math.min(i-a,o)),s=Math.min(r,Math.max(n,s));break;case 180:o=Math.min(i,Math.max(n,o)),s=Math.min(r,Math.max(a,s));break;case 270:o=Math.min(i,Math.max(a,o)),s=Math.max(0,Math.min(r-n,s));break}this.x=o/=i,this.y=s/=r;const[l,c]=this.getBaseTranslation();o+=l,s+=c;const{style:d}=this.div;d.left=`${(100*o).toFixed(2)}%`,d.top=`${(100*s).toFixed(2)}%`,this.moveInDOM()}screenToPageTranslation(e,i){var r;return $(r=_n,gM,BV).call(r,e,i,this.parentRotation)}pageTranslationToScreen(e,i){var r;return $(r=_n,gM,BV).call(r,e,i,360-this.parentRotation)}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{parentScale:e,pageDimensions:[i,r]}=this,o=i*e,s=r*e;return _a.isCSSRoundSupported?[Math.round(o),Math.round(s)]:[o,s]}setDims(e,i){const[r,o]=this.parentDimensions;this.div.style.width=`${(100*e/r).toFixed(2)}%`,M(this,Pv)||(this.div.style.height=`${(100*i/o).toFixed(2)}%`)}fixDims(){const{style:e}=this.div,{height:i,width:r}=e,o=r.endsWith("%"),s=!M(this,Pv)&&i.endsWith("%");if(o&&s)return;const[n,a]=this.parentDimensions;o||(e.width=`${(100*parseFloat(r)/n).toFixed(2)}%`),!M(this,Pv)&&!s&&(e.height=`${(100*parseFloat(i)/a).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}altTextFinish(){var e;(e=M(this,Do))==null||e.finish()}async addEditToolbar(){return this._editToolbar||M(this,Fv)?this._editToolbar:(this._editToolbar=new PEi(this),this.div.append(this._editToolbar.render()),M(this,Do)&&await this._editToolbar.addAltText(M(this,Do)),this._editToolbar)}removeEditToolbar(){var e;this._editToolbar&&(this._editToolbar.remove(),this._editToolbar=null,(e=M(this,Do))==null||e.destroy())}getClientDimensions(){return this.div.getBoundingClientRect()}async addAltTextButton(){M(this,Do)||(Hve.initialize(_n._l10nPromise),ie(this,Do,new Hve(this)),M(this,Dv)&&(M(this,Do).data=M(this,Dv),ie(this,Dv,null)),await this.addEditToolbar())}get altTextData(){var e;return(e=M(this,Do))==null?void 0:e.data}set altTextData(e){M(this,Do)&&(M(this,Do).data=e)}get guessedAltText(){var e;return(e=M(this,Do))==null?void 0:e.guessedText}async setGuessedAltText(e){var i;await((i=M(this,Do))==null?void 0:i.setGuessedText(e))}serializeAltText(e){var i;return(i=M(this,Do))==null?void 0:i.serialize(e)}hasAltText(){return!!M(this,Do)&&!M(this,Do).isEmpty()}hasAltTextData(){var e;return((e=M(this,Do))==null?void 0:e.hasData())??!1}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.tabIndex=M(this,ey)?-1:0,this._isVisible||this.div.classList.add("hidden"),this.setInForeground(),$(this,_r,MV).call(this);const[e,i]=this.parentDimensions;this.parentRotation%180!==0&&(this.div.style.maxWidth=`${(100*i/e).toFixed(2)}%`,this.div.style.maxHeight=`${(100*e/i).toFixed(2)}%`);const[r,o]=this.getInitialTranslation();return this.translate(r,o),WQ(this,this.div,["pointerdown"]),this.div}pointerdown(e){const{isMac:i}=_a.platform;if(e.button!==0||e.ctrlKey&&i){e.preventDefault();return}if(ie(this,Lv,!0),this._isDraggable){$(this,_r,Vve).call(this,e);return}$(this,_r,QV).call(this,e)}moveInDOM(){M(this,Gu)&&clearTimeout(M(this,Gu)),ie(this,Gu,setTimeout(()=>{var e;ie(this,Gu,null),(e=this.parent)==null||e.moveEditorInDOM(this)},0))}_setParentAndPosition(e,i,r){e.changeParent(this),this.x=i,this.y=r,this.fixAndSetPosition()}getRect(e,i,r=this.rotation){const o=this.parentScale,[s,n]=this.pageDimensions,[a,l]=this.pageTranslation,c=e/o,d=i/o,A=this.x*s,u=this.y*n,h=this.width*s,g=this.height*n;switch(r){case 0:return[A+c+a,n-u-d-g+l,A+c+h+a,n-u-d+l];case 90:return[A+d+a,n-u+c+l,A+d+g+a,n-u+c+h+l];case 180:return[A-c-h+a,n-u+d+l,A-c+a,n-u+d+g+l];case 270:return[A-d-g+a,n-u-c-h+l,A-d+a,n-u-c+l];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(e,i){const[r,o,s,n]=e,a=s-r,l=n-o;switch(this.rotation){case 0:return[r,i-n,a,l];case 90:return[r,i-o,l,a];case 180:return[s,i-o,a,l];case 270:return[s,i-n,l,a];default:throw new Error("Invalid rotation")}}onceAdded(){}isEmpty(){return!1}enableEditMode(){ie(this,Fv,!0)}disableEditMode(){ie(this,Fv,!1)}isInEditMode(){return M(this,Fv)}shouldGetKeyboardEvents(){return M(this,$1)}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}rebuild(){$(this,_r,MV).call(this)}rotate(e){}serialize(e=!1,i=null){nn("An editor must be serializable")}static deserialize(e,i,r){const o=new this.prototype.constructor({parent:i,id:i.getNextId(),uiManager:r});o.rotation=e.rotation,ie(o,Dv,e.accessibilityData);const[s,n]=o.pageDimensions,[a,l,c,d]=o.getRectInCurrentCoords(e.rect,n);return o.x=a/s,o.y=l/n,o.width=c/s,o.height=d/n,o}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){var e;if((e=M(this,Vg))==null||e.abort(),ie(this,Vg,null),this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),M(this,Gu)&&(clearTimeout(M(this,Gu)),ie(this,Gu,null)),$(this,_r,ry).call(this),this.removeEditToolbar(),M(this,dc)){for(const i of M(this,dc).values())clearTimeout(i);ie(this,dc,null)}this.parent=null}get isResizable(){return!1}makeResizable(){this.isResizable&&($(this,_r,Gve).call(this),M(this,Ls).classList.remove("hidden"),WQ(this,this.div,["keydown"]))}get toolbarPosition(){return null}keydown(e){if(!this.isResizable||e.target!==this.div||e.key!=="Enter")return;this._uiManager.setSelected(this),ie(this,Rv,{savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height});const i=M(this,Ls).children;if(!M(this,lA)){ie(this,lA,Array.from(i));const n=$(this,_r,qve).bind(this),a=$(this,_r,_ve).bind(this),l=this._uiManager._signal;for(const c of M(this,lA)){const d=c.getAttribute("data-resizer-name");c.setAttribute("role","spinbutton"),c.addEventListener("keydown",n,{signal:l}),c.addEventListener("blur",a,{signal:l}),c.addEventListener("focus",$(this,_r,zve).bind(this,d),{signal:l}),c.setAttribute("data-l10n-id",_n._l10nResizer[d])}}const r=M(this,lA)[0];let o=0;for(const n of i){if(n===r)break;o++}const s=(360-this.rotation+this.parentRotation)%360/90*(M(this,lA).length/4);if(s!==o){if(s<o)for(let a=0;a<o-s;a++)M(this,Ls).append(M(this,Ls).firstChild);else if(s>o)for(let a=0;a<s-o;a++)M(this,Ls).firstChild.before(M(this,Ls).lastChild);let n=0;for(const a of i){const l=M(this,lA)[n++].getAttribute("data-resizer-name");a.setAttribute("data-l10n-id",_n._l10nResizer[l])}}$(this,_r,SV).call(this,0),ie(this,$1,!0),M(this,Ls).firstChild.focus({focusVisible:!0}),e.preventDefault(),e.stopImmediatePropagation()}_resizeWithKeyboard(e,i){M(this,$1)&&$(this,_r,xV).call(this,M(this,uM),{movementX:e,movementY:i})}_stopResizingWithKeyboard(){$(this,_r,ry).call(this),this.div.focus()}select(){var e,i,r;if(this.makeResizable(),(e=this.div)==null||e.classList.add("selectedEditor"),!this._editToolbar){this.addEditToolbar().then(()=>{var o,s;(o=this.div)!=null&&o.classList.contains("selectedEditor")&&((s=this._editToolbar)==null||s.show())});return}(i=this._editToolbar)==null||i.show(),(r=M(this,Do))==null||r.toggleAltTextBadge(!1)}unselect(){var e,i,r,o,s;(e=M(this,Ls))==null||e.classList.add("hidden"),(i=this.div)==null||i.classList.remove("selectedEditor"),(r=this.div)!=null&&r.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),(o=this._editToolbar)==null||o.hide(),(s=M(this,Do))==null||s.toggleAltTextBadge(!0)}updateParams(e,i){}disableEditing(){}enableEditing(){}enterInEditMode(){}getImageForAltText(){return null}get contentDiv(){return this.div}get isEditing(){return M(this,hM)}set isEditing(e){ie(this,hM,e),this.parent&&(e?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(e,i){ie(this,Pv,!0);const r=e/i,{style:o}=this.div;o.aspectRatio=r,o.height="auto"}static get MIN_SIZE(){return 16}static canCreateNewEmptyEditor(){return!0}get telemetryInitialData(){return{action:"added"}}get telemetryFinalData(){return null}_reportTelemetry(e,i=!1){if(i){M(this,dc)||ie(this,dc,new Map);const{action:r}=e;let o=M(this,dc).get(r);o&&clearTimeout(o),o=setTimeout(()=>{this._reportTelemetry(e),M(this,dc).delete(r),M(this,dc).size===0&&ie(this,dc,null)},_n._telemetryTimeout),M(this,dc).set(r,o);return}e.type||(e.type=this.editorType),this._uiManager._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:e}})}show(e=this._isVisible){this.div.classList.toggle("hidden",!e),this._isVisible=e}enable(){this.div&&(this.div.tabIndex=0),ie(this,ey,!1)}disable(){this.div&&(this.div.tabIndex=-1),ie(this,ey,!0)}renderAnnotationElement(e){let i=e.container.querySelector(".annotationContent");if(!i)i=document.createElement("div"),i.classList.add("annotationContent",this.editorType),e.container.prepend(i);else if(i.nodeName==="CANVAS"){const r=i;i=document.createElement("div"),i.classList.add("annotationContent",this.editorType),r.before(i)}return i}resetAnnotationElement(e){const{firstChild:i}=e.container;i.nodeName==="DIV"&&i.classList.contains("annotationContent")&&i.remove()}};Dv=new WeakMap,lA=new WeakMap,Do=new WeakMap,ey=new WeakMap,Pv=new WeakMap,Ls=new WeakMap,Rv=new WeakMap,Vg=new WeakMap,uM=new WeakMap,Lv=new WeakMap,Hu=new WeakMap,hM=new WeakMap,Fv=new WeakMap,$1=new WeakMap,Gu=new WeakMap,ty=new WeakMap,iy=new WeakMap,dc=new WeakMap,pM=new WeakMap,wV=new WeakMap,_r=new WeakSet,bV=function([t,e],i,r){[i,r]=this.screenToPageTranslation(i,r),this.x+=i/t,this.y+=r/e,this.fixAndSetPosition()},gM=new WeakSet,BV=function(t,e,i){switch(i){case 90:return[e,-t];case 180:return[-t,-e];case 270:return[-e,t];default:return[t,e]}},EV=function(t){switch(t){case 90:{const[e,i]=this.pageDimensions;return[0,-e/i,i/e,0]}case 180:return[-1,0,0,-1];case 270:{const[e,i]=this.pageDimensions;return[0,e/i,-i/e,0]}default:return[1,0,0,1]}},Gve=function(){if(M(this,Ls))return;ie(this,Ls,document.createElement("div")),M(this,Ls).classList.add("resizers");const t=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],e=this._uiManager._signal;for(const i of t){const r=document.createElement("div");M(this,Ls).append(r),r.classList.add("resizer",i),r.setAttribute("data-resizer-name",i),r.addEventListener("pointerdown",$(this,_r,jve).bind(this,i),{signal:e}),r.addEventListener("contextmenu",ac,{signal:e}),r.tabIndex=-1}this.div.prepend(M(this,Ls))},jve=function(t,e){var i;e.preventDefault();const{isMac:r}=_a.platform;if(e.button!==0||e.ctrlKey&&r)return;(i=M(this,Do))==null||i.toggle(!1);const o=this._isDraggable;this._isDraggable=!1;const s=new AbortController,n=this._uiManager.combinedSignal(s);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",$(this,_r,xV).bind(this,t),{passive:!0,capture:!0,signal:n}),window.addEventListener("contextmenu",ac,{signal:n});const a=this.x,l=this.y,c=this.width,d=this.height,A=this.parent.div.style.cursor,u=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(e.target).cursor;const h=()=>{var g;s.abort(),this.parent.togglePointerEvents(!0),(g=M(this,Do))==null||g.toggle(!0),this._isDraggable=o,this.parent.div.style.cursor=A,this.div.style.cursor=u,$(this,_r,kV).call(this,a,l,c,d)};window.addEventListener("pointerup",h,{signal:n}),window.addEventListener("blur",h,{signal:n})},kV=function(t,e,i,r){const o=this.x,s=this.y,n=this.width,a=this.height;o===t&&s===e&&n===i&&a===r||this.addCommands({cmd:()=>{this.width=n,this.height=a,this.x=o,this.y=s;const[l,c]=this.parentDimensions;this.setDims(l*n,c*a),this.fixAndSetPosition()},undo:()=>{this.width=i,this.height=r,this.x=t,this.y=e;const[l,c]=this.parentDimensions;this.setDims(l*i,c*r),this.fixAndSetPosition()},mustExec:!0})},xV=function(t,e){const[i,r]=this.parentDimensions,o=this.x,s=this.y,n=this.width,a=this.height,l=rd.MIN_SIZE/i,c=rd.MIN_SIZE/r,d=O=>Math.round(O*1e4)/1e4,A=$(this,_r,EV).call(this,this.rotation),u=(O,G)=>[A[0]*O+A[2]*G,A[1]*O+A[3]*G],h=$(this,_r,EV).call(this,360-this.rotation),g=(O,G)=>[h[0]*O+h[2]*G,h[1]*O+h[3]*G];let p,m,f=!1,v=!1;switch(t){case"topLeft":f=!0,p=(O,G)=>[0,0],m=(O,G)=>[O,G];break;case"topMiddle":p=(O,G)=>[O/2,0],m=(O,G)=>[O/2,G];break;case"topRight":f=!0,p=(O,G)=>[O,0],m=(O,G)=>[0,G];break;case"middleRight":v=!0,p=(O,G)=>[O,G/2],m=(O,G)=>[0,G/2];break;case"bottomRight":f=!0,p=(O,G)=>[O,G],m=(O,G)=>[0,0];break;case"bottomMiddle":p=(O,G)=>[O/2,G],m=(O,G)=>[O/2,0];break;case"bottomLeft":f=!0,p=(O,G)=>[0,G],m=(O,G)=>[O,0];break;case"middleLeft":v=!0,p=(O,G)=>[0,G/2],m=(O,G)=>[O,G/2];break}const C=p(n,a),y=m(n,a);let I=u(...y);const B=d(o+I[0]),E=d(s+I[1]);let k=1,Q=1,[S,D]=this.screenToPageTranslation(e.movementX,e.movementY);if([S,D]=g(S/i,D/r),f){const O=Math.hypot(n,a);k=Q=Math.max(Math.min(Math.hypot(y[0]-C[0]-S,y[1]-C[1]-D)/O,1/n,1/a),l/n,c/a)}else v?k=Math.max(l,Math.min(1,Math.abs(y[0]-C[0]-S)))/n:Q=Math.max(c,Math.min(1,Math.abs(y[1]-C[1]-D)))/a;const R=d(n*k),N=d(a*Q);I=u(...m(R,N));const H=B-I[0],q=E-I[1];this.width=R,this.height=N,this.x=H,this.y=q,this.setDims(i*R,r*N),this.fixAndSetPosition()},QV=function(t){const{isMac:e}=_a.platform;t.ctrlKey&&!e||t.shiftKey||t.metaKey&&e?this.parent.toggleSelected(this):this.parent.setSelected(this)},Vve=function(t){const e=this._uiManager.isSelected(this);this._uiManager.setUpDragSession();const i=new AbortController,r=this._uiManager.combinedSignal(i);if(e){this.div.classList.add("moving"),ie(this,ty,t.clientX),ie(this,iy,t.clientY);const s=n=>{const{clientX:a,clientY:l}=n,[c,d]=this.screenToPageTranslation(a-M(this,ty),l-M(this,iy));ie(this,ty,a),ie(this,iy,l),this._uiManager.dragSelectedEditors(c,d)};window.addEventListener("pointermove",s,{passive:!0,capture:!0,signal:r})}const o=()=>{i.abort(),e&&this.div.classList.remove("moving"),ie(this,Lv,!1),this._uiManager.endDragSession()||$(this,_r,QV).call(this,t)};window.addEventListener("pointerup",o,{signal:r}),window.addEventListener("blur",o,{signal:r})},MV=function(){if(M(this,Vg)||!this.div)return;ie(this,Vg,new AbortController);const t=this._uiManager.combinedSignal(M(this,Vg));this.div.addEventListener("focusin",this.focusin.bind(this),{signal:t}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:t})},qve=function(t){rd._resizerKeyboardManager.exec(this,t)},_ve=function(t){var e;M(this,$1)&&((e=t.relatedTarget)==null?void 0:e.parentNode)!==M(this,Ls)&&$(this,_r,ry).call(this)},zve=function(t){ie(this,uM,M(this,$1)?t:"")},SV=function(t){if(M(this,lA))for(const e of M(this,lA))e.tabIndex=t},ry=function(){if(ie(this,$1,!1),$(this,_r,SV).call(this,-1),M(this,Rv)){const{savedX:t,savedY:e,savedWidth:i,savedHeight:r}=M(this,Rv);$(this,_r,kV).call(this,t,e,i,r),ie(this,Rv,null)}},ce(rd,gM),ei(rd,"_l10nPromise",null),ei(rd,"_l10nResizer",null),ei(rd,"_borderLineWidth",-1),ei(rd,"_colorManager",new UEi),ei(rd,"_zIndex",1),ei(rd,"_telemetryTimeout",1e3);let Tr=rd;class OEi extends Tr{constructor(e){super(e),this.annotationElementId=e.annotationElementId,this.deleted=!0}serialize(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex}}}const Kve=3285377520,Ac=4294901760,cA=65535;let Jve=class{constructor(t){this.h1=t?t&4294967295:Kve,this.h2=t?t&4294967295:Kve}update(t){let e,i;if(typeof t=="string"){e=new Uint8Array(t.length*2),i=0;for(let g=0,p=t.length;g<p;g++){const m=t.charCodeAt(g);m<=255?e[i++]=m:(e[i++]=m>>>8,e[i++]=m&255)}}else if(ArrayBuffer.isView(t))e=t.slice(),i=e.byteLength;else throw new Error("Invalid data format, must be a string or TypedArray.");const r=i>>2,o=i-r*4,s=new Uint32Array(e.buffer,0,r);let n=0,a=0,l=this.h1,c=this.h2;const d=3432918353,A=461845907,u=d&cA,h=A&cA;for(let g=0;g<r;g++)g&1?(n=s[g],n=n*d&Ac|n*u&cA,n=n<<15|n>>>17,n=n*A&Ac|n*h&cA,l^=n,l=l<<13|l>>>19,l=l*5+3864292196):(a=s[g],a=a*d&Ac|a*u&cA,a=a<<15|a>>>17,a=a*A&Ac|a*h&cA,c^=a,c=c<<13|c>>>19,c=c*5+3864292196);switch(n=0,o){case 3:n^=e[r*4+2]<<16;case 2:n^=e[r*4+1]<<8;case 1:n^=e[r*4],n=n*d&Ac|n*u&cA,n=n<<15|n>>>17,n=n*A&Ac|n*h&cA,r&1?l^=n:c^=n}this.h1=l,this.h2=c}hexdigest(){let t=this.h1,e=this.h2;return t^=e>>>1,t=t*3981806797&Ac|t*36045&cA,e=e*4283543511&Ac|((e<<16|t>>>16)*2950163797&Ac)>>>16,t^=e>>>1,t=t*444984403&Ac|t*60499&cA,e=e*3301882366&Ac|((e<<16|t>>>16)*3120437893&Ac)>>>16,t^=e>>>1,(t>>>0).toString(16).padStart(8,"0")+(e>>>0).toString(16).padStart(8,"0")}};const DV=Object.freeze({map:null,hash:"",transfer:void 0});var Tv,Nv,ss,PV,Yve;class RV{constructor(){ce(this,PV),ce(this,Tv,!1),ce(this,Nv,null),ce(this,ss,new Map),this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(e,i){const r=M(this,ss).get(e);return r===void 0?i:Object.assign(i,r)}getRawValue(e){return M(this,ss).get(e)}remove(e){if(M(this,ss).delete(e),M(this,ss).size===0&&this.resetModified(),typeof this.onAnnotationEditor=="function"){for(const i of M(this,ss).values())if(i instanceof Tr)return;this.onAnnotationEditor(null)}}setValue(e,i){const r=M(this,ss).get(e);let o=!1;if(r!==void 0)for(const[s,n]of Object.entries(i))r[s]!==n&&(o=!0,r[s]=n);else o=!0,M(this,ss).set(e,i);o&&$(this,PV,Yve).call(this),i instanceof Tr&&typeof this.onAnnotationEditor=="function"&&this.onAnnotationEditor(i.constructor._type)}has(e){return M(this,ss).has(e)}getAll(){return M(this,ss).size>0?Wj(M(this,ss)):null}setAll(e){for(const[i,r]of Object.entries(e))this.setValue(i,r)}get size(){return M(this,ss).size}resetModified(){M(this,Tv)&&(ie(this,Tv,!1),typeof this.onResetModified=="function"&&this.onResetModified())}get print(){return new Wve(this)}get serializable(){if(M(this,ss).size===0)return DV;const e=new Map,i=new Jve,r=[],o=Object.create(null);let s=!1;for(const[n,a]of M(this,ss)){const l=a instanceof Tr?a.serialize(!1,o):a;l&&(e.set(n,l),i.update(`${n}:${JSON.stringify(l)}`),s||(s=!!l.bitmap))}if(s)for(const n of e.values())n.bitmap&&r.push(n.bitmap);return e.size>0?{map:e,hash:i.hexdigest(),transfer:r}:DV}get editorStats(){let e=null;const i=new Map;for(const r of M(this,ss).values()){if(!(r instanceof Tr))continue;const o=r.telemetryFinalData;if(!o)continue;const{type:s}=o;i.has(s)||i.set(s,Object.getPrototypeOf(r).constructor),e||(e=Object.create(null));const n=e[s]||(e[s]=new Map);for(const[a,l]of Object.entries(o)){if(a==="type")continue;let c=n.get(a);c||(c=new Map,n.set(a,c));const d=c.get(l)??0;c.set(l,d+1)}}for(const[r,o]of i)e[r]=o.computeTelemetryFinalData(e[r]);return e}resetModifiedIds(){ie(this,Nv,null)}get modifiedIds(){if(M(this,Nv))return M(this,Nv);const e=[];for(const i of M(this,ss).values())!(i instanceof Tr)||!i.annotationElementId||!i.serialize()||e.push(i.annotationElementId);return ie(this,Nv,{ids:new Set(e),hash:e.join(",")})}}Tv=new WeakMap,Nv=new WeakMap,ss=new WeakMap,PV=new WeakSet,Yve=function(){M(this,Tv)||(ie(this,Tv,!0),typeof this.onSetModified=="function"&&this.onSetModified())};var fM;class Wve extends RV{constructor(e){super(),ce(this,fM);const{map:i,hash:r,transfer:o}=e.serializable,s=structuredClone(i,o?{transfer:o}:null);ie(this,fM,{map:s,hash:r,transfer:o})}get print(){nn("Should not call PrintAnnotationStorage.print")}get serializable(){return M(this,fM)}get modifiedIds(){return or(this,"modifiedIds",{ids:new Set,hash:""})}}fM=new WeakMap;var oy;class HEi{constructor({ownerDocument:e=globalThis.document,styleElement:i=null}){ce(this,oy,new Set),this._document=e,this.nativeFontFaces=new Set,this.styleElement=null,this.loadingRequests=[],this.loadTestFontId=0}addNativeFontFace(e){this.nativeFontFaces.add(e),this._document.fonts.add(e)}removeNativeFontFace(e){this.nativeFontFaces.delete(e),this._document.fonts.delete(e)}insertRule(e){this.styleElement||(this.styleElement=this._document.createElement("style"),this._document.documentElement.getElementsByTagName("head")[0].append(this.styleElement));const i=this.styleElement.sheet;i.insertRule(e,i.cssRules.length)}clear(){for(const e of this.nativeFontFaces)this._document.fonts.delete(e);this.nativeFontFaces.clear(),M(this,oy).clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:e,_inspectFont:i}){if(!(!e||M(this,oy).has(e.loadedName))){if(yn(!this.disableFontFace,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:r,src:o,style:s}=e,n=new FontFace(r,o,s);this.addNativeFontFace(n);try{await n.load(),M(this,oy).add(r),i?.(e)}catch{Hi(`Cannot load system font: ${e.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(n)}return}nn("Not implemented: loadSystemFont without the Font Loading API.")}}async bind(e){if(e.attached||e.missingFile&&!e.systemFontInfo)return;if(e.attached=!0,e.systemFontInfo){await this.loadSystemFont(e);return}if(this.isFontLoadingAPISupported){const r=e.createNativeFontFace();if(r){this.addNativeFontFace(r);try{await r.loaded}catch(o){throw Hi(`Failed to load font '${r.family}': '${o}'.`),e.disableFontFace=!0,o}}return}const i=e.createFontFaceRule();if(i){if(this.insertRule(i),this.isSyncFontLoadingSupported)return;await new Promise(r=>{const o=this._queueLoadingCallback(r);this._prepareFontLoadEvent(e,o)})}}get isFontLoadingAPISupported(){var e;const i=!!((e=this._document)!=null&&e.fonts);return or(this,"isFontLoadingAPISupported",i)}get isSyncFontLoadingSupported(){let e=!1;return(Ss||typeof navigator<"u"&&typeof navigator?.userAgent=="string"&&/Mozilla\/5.0.*?rv:\d+.*? Gecko/.test(navigator.userAgent))&&(e=!0),or(this,"isSyncFontLoadingSupported",e)}_queueLoadingCallback(e){function i(){for(yn(!o.done,"completeRequest() cannot be called twice."),o.done=!0;r.length>0&&r[0].done;){const s=r.shift();setTimeout(s.callback,0)}}const{loadingRequests:r}=this,o={done:!1,complete:i,callback:e};return r.push(o),o}get _loadTestFont(){const e=atob("T1RUTwALAIAAAwAwQ0ZGIDHtZg4AAAOYAAAAgUZGVE1lkzZwAAAEHAAAABxHREVGABQAFQAABDgAAAAeT1MvMlYNYwkAAAEgAAAAYGNtYXABDQLUAAACNAAAAUJoZWFk/xVFDQAAALwAAAA2aGhlYQdkA+oAAAD0AAAAJGhtdHgD6AAAAAAEWAAAAAZtYXhwAAJQAAAAARgAAAAGbmFtZVjmdH4AAAGAAAAAsXBvc3T/hgAzAAADeAAAACAAAQAAAAEAALZRFsRfDzz1AAsD6AAAAADOBOTLAAAAAM4KHDwAAAAAA+gDIQAAAAgAAgAAAAAAAAABAAADIQAAAFoD6AAAAAAD6AABAAAAAAAAAAAAAAAAAAAAAQAAUAAAAgAAAAQD6AH0AAUAAAKKArwAAACMAooCvAAAAeAAMQECAAACAAYJAAAAAAAAAAAAAQAAAAAAAAAAAAAAAFBmRWQAwAAuAC4DIP84AFoDIQAAAAAAAQAAAAAAAAAAACAAIAABAAAADgCuAAEAAAAAAAAAAQAAAAEAAAAAAAEAAQAAAAEAAAAAAAIAAQAAAAEAAAAAAAMAAQAAAAEAAAAAAAQAAQAAAAEAAAAAAAUAAQAAAAEAAAAAAAYAAQAAAAMAAQQJAAAAAgABAAMAAQQJAAEAAgABAAMAAQQJAAIAAgABAAMAAQQJAAMAAgABAAMAAQQJAAQAAgABAAMAAQQJAAUAAgABAAMAAQQJAAYAAgABWABYAAAAAAAAAwAAAAMAAAAcAAEAAAAAADwAAwABAAAAHAAEACAAAAAEAAQAAQAAAC7//wAAAC7////TAAEAAAAAAAABBgAAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAMAAAAAAAD/gwAyAAAAAQAAAAAAAAAAAAAAAAAAAAABAAQEAAEBAQJYAAEBASH4DwD4GwHEAvgcA/gXBIwMAYuL+nz5tQXkD5j3CBLnEQACAQEBIVhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYAAABAQAADwACAQEEE/t3Dov6fAH6fAT+fPp8+nwHDosMCvm1Cvm1DAz6fBQAAAAAAAABAAAAAMmJbzEAAAAAzgTjFQAAAADOBOQpAAEAAAAAAAAADAAUAAQAAAABAAAAAgABAAAAAAAAAAAD6AAAAAAAAA==");return or(this,"_loadTestFont",e)}_prepareFontLoadEvent(e,i){function r(C,y){return C.charCodeAt(y)<<24|C.charCodeAt(y+1)<<16|C.charCodeAt(y+2)<<8|C.charCodeAt(y+3)&255}function o(C,y,I,B){const E=C.substring(0,y),k=C.substring(y+I);return E+B+k}let s,n;const a=this._document.createElement("canvas");a.width=1,a.height=1;const l=a.getContext("2d");let c=0;function d(C,y){if(++c>30){Hi("Load test font never loaded."),y();return}if(l.font="30px "+C,l.fillText(".",0,20),l.getImageData(0,0,1,1).data[3]>0){y();return}setTimeout(d.bind(null,C,y))}const A=`lt${Date.now()}${this.loadTestFontId++}`;let u=this._loadTestFont;u=o(u,976,A.length,A);const h=16,g=1482184792;let p=r(u,h);for(s=0,n=A.length-3;s<n;s+=4)p=p-g+r(A,s)|0;s<A.length&&(p=p-g+r(A+"XXX",s)|0),u=o(u,h,4,CEi(p));const m=`url(data:font/opentype;base64,${btoa(u)});`,f=`@font-face {font-family:"${A}";src:${m}}`;this.insertRule(f);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 C of[e.loadedName,A]){const y=this._document.createElement("span");y.textContent="Hi",y.style.fontFamily=C,v.append(y)}this._document.body.append(v),d(A,()=>{v.remove(),i.complete()})}}oy=new WeakMap;class GEi{constructor(e,{disableFontFace:i=!1,inspectFont:r=null}){this.compiledGlyphs=Object.create(null);for(const o in e)this[o]=e[o];this.disableFontFace=i===!0,this._inspectFont=r}createNativeFontFace(){var e;if(!this.data||this.disableFontFace)return null;let i;if(!this.cssFontInfo)i=new FontFace(this.loadedName,this.data,{});else{const r={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(r.style=`oblique ${this.cssFontInfo.italicAngle}deg`),i=new FontFace(this.cssFontInfo.fontFamily,this.data,r)}return(e=this._inspectFont)==null||e.call(this,this),i}createFontFaceRule(){var e;if(!this.data||this.disableFontFace)return null;const i=lve(this.data),r=`url(data:${this.mimetype};base64,${btoa(i)});`;let o;if(!this.cssFontInfo)o=`@font-face {font-family:"${this.loadedName}";src:${r}}`;else{let s=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(s+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),o=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${s}src:${r}}`}return(e=this._inspectFont)==null||e.call(this,this,r),o}getPathGenerator(e,i){if(this.compiledGlyphs[i]!==void 0)return this.compiledGlyphs[i];let r;try{r=e.get(this.loadedName+"_path_"+i)}catch(s){Hi(`getPathGenerator - ignoring character: "${s}".`)}if(!Array.isArray(r)||r.length===0)return this.compiledGlyphs[i]=function(s,n){};const o=[];for(let s=0,n=r.length;s<n;)switch(r[s++]){case Mu.BEZIER_CURVE_TO:{const[a,l,c,d,A,u]=r.slice(s,s+6);o.push(h=>h.bezierCurveTo(a,l,c,d,A,u)),s+=6}break;case Mu.MOVE_TO:{const[a,l]=r.slice(s,s+2);o.push(c=>c.moveTo(a,l)),s+=2}break;case Mu.LINE_TO:{const[a,l]=r.slice(s,s+2);o.push(c=>c.lineTo(a,l)),s+=2}break;case Mu.QUADRATIC_CURVE_TO:{const[a,l,c,d]=r.slice(s,s+4);o.push(A=>A.quadraticCurveTo(a,l,c,d)),s+=4}break;case Mu.RESTORE:o.push(a=>a.restore());break;case Mu.SAVE:o.push(a=>a.save());break;case Mu.SCALE:yn(o.length===2,"Scale command is only valid at the third position.");break;case Mu.TRANSFORM:{const[a,l,c,d,A,u]=r.slice(s,s+6);o.push(h=>h.transform(a,l,c,d,A,u)),s+=6}break;case Mu.TRANSLATE:{const[a,l]=r.slice(s,s+2);o.push(c=>c.translate(a,l)),s+=2}break}return this.compiledGlyphs[i]=function(s,n){o[0](s),o[1](s),s.scale(n,-n);for(let a=2,l=o.length;a<l;a++)o[a](s)}}}if(Ss){var LV=Promise.withResolvers(),mM=null;(async()=>{const t=await Promise.resolve().then(()=>fx),e=await Promise.resolve().then(()=>fx),i=await Promise.resolve().then(()=>fx),r=await Promise.resolve().then(()=>fx);let o,s;return new Map(Object.entries({fs:t,http:e,https:i,url:r,canvas:o,path2d:s}))})().then(t=>{mM=t,LV.resolve()},t=>{Hi(`loadPackages: ${t}`),mM=new Map,LV.resolve()})}class e0{static get promise(){return LV.promise}static get(e){return mM?.get(e)}}const Zve=function(t){return e0.get("fs").promises.readFile(t).then(e=>new Uint8Array(e))};class jEi extends Ave{}class VEi extends uve{_createCanvas(e,i){return e0.get("canvas").createCanvas(e,i)}}class qEi extends hve{_fetchData(e,i){return Zve(e).then(r=>({cMapData:r,compressionType:i}))}}class _Ei extends pve{_fetchData(e){return Zve(e)}}const ha={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function FV(t,e){if(!e)return;const i=e[2]-e[0],r=e[3]-e[1],o=new Path2D;o.rect(e[0],e[1],i,r),t.clip(o)}class TV{getPattern(){nn("Abstract method `getPattern` called.")}}class zEi extends TV{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 i;this._type==="axial"?i=e.createLinearGradient(this._p0[0],this._p0[1],this._p1[0],this._p1[1]):this._type==="radial"&&(i=e.createRadialGradient(this._p0[0],this._p0[1],this._r0,this._p1[0],this._p1[1],this._r1));for(const r of this._colorStops)i.addColorStop(r[0],r[1]);return i}getPattern(e,i,r,o){let s;if(o===ha.STROKE||o===ha.FILL){const n=i.current.getClippedPathBoundingBox(o,Io(e))||[0,0,0,0],a=Math.ceil(n[2]-n[0])||1,l=Math.ceil(n[3]-n[1])||1,c=i.cachedCanvases.getCanvas("pattern",a,l,!0),d=c.context;d.clearRect(0,0,d.canvas.width,d.canvas.height),d.beginPath(),d.rect(0,0,d.canvas.width,d.canvas.height),d.translate(-n[0],-n[1]),r=ti.transform(r,[1,0,0,1,n[0],n[1]]),d.transform(...i.baseTransform),this.matrix&&d.transform(...this.matrix),FV(d,this._bbox),d.fillStyle=this._createGradient(d),d.fill(),s=e.createPattern(c.canvas,"no-repeat");const A=new DOMMatrix(r);s.setTransform(A)}else FV(e,this._bbox),s=this._createGradient(e);return s}}function NV(t,e,i,r,o,s,n,a){const l=e.coords,c=e.colors,d=t.data,A=t.width*4;let u;l[i+1]>l[r+1]&&(u=i,i=r,r=u,u=s,s=n,n=u),l[r+1]>l[o+1]&&(u=r,r=o,o=u,u=n,n=a,a=u),l[i+1]>l[r+1]&&(u=i,i=r,r=u,u=s,s=n,n=u);const h=(l[i]+e.offsetX)*e.scaleX,g=(l[i+1]+e.offsetY)*e.scaleY,p=(l[r]+e.offsetX)*e.scaleX,m=(l[r+1]+e.offsetY)*e.scaleY,f=(l[o]+e.offsetX)*e.scaleX,v=(l[o+1]+e.offsetY)*e.scaleY;if(g>=v)return;const C=c[s],y=c[s+1],I=c[s+2],B=c[n],E=c[n+1],k=c[n+2],Q=c[a],S=c[a+1],D=c[a+2],R=Math.round(g),N=Math.round(v);let H,q,O,G,Z,ae,ue,ke;for(let se=R;se<=N;se++){if(se<m){const X=se<g?0:(g-se)/(g-m);H=h-(h-p)*X,q=C-(C-B)*X,O=y-(y-E)*X,G=I-(I-k)*X}else{let X;se>v?X=1:m===v?X=0:X=(m-se)/(m-v),H=p-(p-f)*X,q=B-(B-Q)*X,O=E-(E-S)*X,G=k-(k-D)*X}let me;se<g?me=0:se>v?me=1:me=(g-se)/(g-v),Z=h-(h-f)*me,ae=C-(C-Q)*me,ue=y-(y-S)*me,ke=I-(I-D)*me;const qe=Math.round(Math.min(H,Z)),Ne=Math.round(Math.max(H,Z));let De=A*se+qe*4;for(let X=qe;X<=Ne;X++)me=(H-X)/(H-Z),me<0?me=0:me>1&&(me=1),d[De++]=q-(q-ae)*me|0,d[De++]=O-(O-ue)*me|0,d[De++]=G-(G-ke)*me|0,d[De++]=255}}function KEi(t,e,i){const r=e.coords,o=e.colors;let s,n;switch(e.type){case"lattice":const a=e.verticesPerRow,l=Math.floor(r.length/a)-1,c=a-1;for(s=0;s<l;s++){let d=s*a;for(let A=0;A<c;A++,d++)NV(t,i,r[d],r[d+1],r[d+a],o[d],o[d+1],o[d+a]),NV(t,i,r[d+a+1],r[d+1],r[d+a],o[d+a+1],o[d+1],o[d+a])}break;case"triangles":for(s=0,n=r.length;s<n;s+=3)NV(t,i,r[s],r[s+1],r[s+2],o[s],o[s+1],o[s+2]);break;default:throw new Error("illegal figure")}}class JEi extends TV{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,i,r){const o=Math.floor(this._bounds[0]),s=Math.floor(this._bounds[1]),n=Math.ceil(this._bounds[2])-o,a=Math.ceil(this._bounds[3])-s,l=Math.min(Math.ceil(Math.abs(n*e[0]*1.1)),3e3),c=Math.min(Math.ceil(Math.abs(a*e[1]*1.1)),3e3),d=n/l,A=a/c,u={coords:this._coords,colors:this._colors,offsetX:-o,offsetY:-s,scaleX:1/d,scaleY:1/A},h=l+2*2,g=c+2*2,p=r.getCanvas("mesh",h,g,!1),m=p.context,f=m.createImageData(l,c);if(i){const v=f.data;for(let C=0,y=v.length;C<y;C+=4)v[C]=i[0],v[C+1]=i[1],v[C+2]=i[2],v[C+3]=255}for(const v of this._figures)KEi(f,v,u);return m.putImageData(f,2,2),{canvas:p.canvas,offsetX:o-2*d,offsetY:s-2*A,scaleX:d,scaleY:A}}getPattern(e,i,r,o){FV(e,this._bbox);let s;if(o===ha.SHADING)s=ti.singularValueDecompose2dScale(Io(e));else if(s=ti.singularValueDecompose2dScale(i.baseTransform),this.matrix){const a=ti.singularValueDecompose2dScale(this.matrix);s=[s[0]*a[0],s[1]*a[1]]}const n=this._createMeshCanvas(s,o===ha.SHADING?null:this._background,i.cachedCanvases);return o!==ha.SHADING&&(e.setTransform(...i.baseTransform),this.matrix&&e.transform(...this.matrix)),e.translate(n.offsetX,n.offsetY),e.scale(n.scaleX,n.scaleY),e.createPattern(n.canvas,"no-repeat")}}class YEi extends TV{getPattern(){return"hotpink"}}function WEi(t){switch(t[0]){case"RadialAxial":return new zEi(t);case"Mesh":return new JEi(t);case"Dummy":return new YEi}throw new Error(`Unknown IR type: ${t[0]}`)}const Xve={COLORED:1,UNCOLORED:2},$ve=class QCe{constructor(e,i,r,o,s){this.operatorList=e[2],this.matrix=e[3],this.bbox=e[4],this.xstep=e[5],this.ystep=e[6],this.paintType=e[7],this.tilingType=e[8],this.color=i,this.ctx=r,this.canvasGraphicsFactory=o,this.baseTransform=s}createPatternCanvas(e){const i=this.operatorList,r=this.bbox,o=this.xstep,s=this.ystep,n=this.paintType,a=this.tilingType,l=this.color,c=this.canvasGraphicsFactory;NQ("TilingType: "+a);const d=r[0],A=r[1],u=r[2],h=r[3],g=ti.singularValueDecompose2dScale(this.matrix),p=ti.singularValueDecompose2dScale(this.baseTransform),m=[g[0]*p[0],g[1]*p[1]],f=this.getSizeAndScale(o,this.ctx.canvas.width,m[0]),v=this.getSizeAndScale(s,this.ctx.canvas.height,m[1]),C=e.cachedCanvases.getCanvas("pattern",f.size,v.size,!0),y=C.context,I=c.createCanvasGraphics(y);I.groupLevel=e.groupLevel,this.setFillAndStrokeStyleToContext(I,n,l);let B=d,E=A,k=u,Q=h;return d<0&&(B=0,k+=Math.abs(d)),A<0&&(E=0,Q+=Math.abs(A)),y.translate(-(f.scale*B),-(v.scale*E)),I.transform(f.scale,0,0,v.scale,0,0),y.save(),this.clipBbox(I,B,E,k,Q),I.baseTransform=Io(I.ctx),I.executeOperatorList(i),I.endDrawing(),{canvas:C.canvas,scaleX:f.scale,scaleY:v.scale,offsetX:B,offsetY:E}}getSizeAndScale(e,i,r){e=Math.abs(e);const o=Math.max(QCe.MAX_PATTERN_SIZE,i);let s=Math.ceil(e*r);return s>=o?s=o:r=s/e,{scale:r,size:s}}clipBbox(e,i,r,o,s){const n=o-i,a=s-r;e.ctx.rect(i,r,n,a),e.current.updateRectMinMax(Io(e.ctx),[i,r,o,s]),e.clip(),e.endPath()}setFillAndStrokeStyleToContext(e,i,r){const o=e.ctx,s=e.current;switch(i){case Xve.COLORED:const n=this.ctx;o.fillStyle=n.fillStyle,o.strokeStyle=n.strokeStyle,s.fillColor=n.fillStyle,s.strokeColor=n.strokeStyle;break;case Xve.UNCOLORED:const a=ti.makeHexColor(r[0],r[1],r[2]);o.fillStyle=a,o.strokeStyle=a,s.fillColor=a,s.strokeColor=a;break;default:throw new vEi(`Unsupported paint type: ${i}`)}}getPattern(e,i,r,o){let s=r;o!==ha.SHADING&&(s=ti.transform(s,i.baseTransform),this.matrix&&(s=ti.transform(s,this.matrix)));const n=this.createPatternCanvas(i);let a=new DOMMatrix(s);a=a.translate(n.offsetX,n.offsetY),a=a.scale(1/n.scaleX,1/n.scaleY);const l=e.createPattern(n.canvas,"repeat");return l.setTransform(a),l}};ei($ve,"MAX_PATTERN_SIZE",3e3);let ZEi=$ve;function XEi({src:t,srcPos:e=0,dest:i,width:r,height:o,nonBlackColor:s=4294967295,inverseDecode:n=!1}){const a=_a.isLittleEndian?4278190080:255,[l,c]=n?[s,a]:[a,s],d=r>>3,A=r&7,u=t.length;i=new Uint32Array(i.buffer);let h=0;for(let g=0;g<o;g++){for(const m=e+d;e<m;e++){const f=e<u?t[e]:255;i[h++]=f&128?c:l,i[h++]=f&64?c:l,i[h++]=f&32?c:l,i[h++]=f&16?c:l,i[h++]=f&8?c:l,i[h++]=f&4?c:l,i[h++]=f&2?c:l,i[h++]=f&1?c:l}if(A===0)continue;const p=e<u?t[e++]:255;for(let m=0;m<A;m++)i[h++]=p&1<<7-m?c:l}return{srcPos:e,destPos:h}}const e4e=16,t4e=100,$Ei=15,i4e=10,r4e=1e3,Ka=16;function eki(t,e){if(t._removeMirroring)throw new Error("Context is already forwarding operations.");t.__originalSave=t.save,t.__originalRestore=t.restore,t.__originalRotate=t.rotate,t.__originalScale=t.scale,t.__originalTranslate=t.translate,t.__originalTransform=t.transform,t.__originalSetTransform=t.setTransform,t.__originalResetTransform=t.resetTransform,t.__originalClip=t.clip,t.__originalMoveTo=t.moveTo,t.__originalLineTo=t.lineTo,t.__originalBezierCurveTo=t.bezierCurveTo,t.__originalRect=t.rect,t.__originalClosePath=t.closePath,t.__originalBeginPath=t.beginPath,t._removeMirroring=()=>{t.save=t.__originalSave,t.restore=t.__originalRestore,t.rotate=t.__originalRotate,t.scale=t.__originalScale,t.translate=t.__originalTranslate,t.transform=t.__originalTransform,t.setTransform=t.__originalSetTransform,t.resetTransform=t.__originalResetTransform,t.clip=t.__originalClip,t.moveTo=t.__originalMoveTo,t.lineTo=t.__originalLineTo,t.bezierCurveTo=t.__originalBezierCurveTo,t.rect=t.__originalRect,t.closePath=t.__originalClosePath,t.beginPath=t.__originalBeginPath,delete t._removeMirroring},t.save=function(){e.save(),this.__originalSave()},t.restore=function(){e.restore(),this.__originalRestore()},t.translate=function(i,r){e.translate(i,r),this.__originalTranslate(i,r)},t.scale=function(i,r){e.scale(i,r),this.__originalScale(i,r)},t.transform=function(i,r,o,s,n,a){e.transform(i,r,o,s,n,a),this.__originalTransform(i,r,o,s,n,a)},t.setTransform=function(i,r,o,s,n,a){e.setTransform(i,r,o,s,n,a),this.__originalSetTransform(i,r,o,s,n,a)},t.resetTransform=function(){e.resetTransform(),this.__originalResetTransform()},t.rotate=function(i){e.rotate(i),this.__originalRotate(i)},t.clip=function(i){e.clip(i),this.__originalClip(i)},t.moveTo=function(i,r){e.moveTo(i,r),this.__originalMoveTo(i,r)},t.lineTo=function(i,r){e.lineTo(i,r),this.__originalLineTo(i,r)},t.bezierCurveTo=function(i,r,o,s,n,a){e.bezierCurveTo(i,r,o,s,n,a),this.__originalBezierCurveTo(i,r,o,s,n,a)},t.rect=function(i,r,o,s){e.rect(i,r,o,s),this.__originalRect(i,r,o,s)},t.closePath=function(){e.closePath(),this.__originalClosePath()},t.beginPath=function(){e.beginPath(),this.__originalBeginPath()}}class tki{constructor(e){this.canvasFactory=e,this.cache=Object.create(null)}getCanvas(e,i,r){let o;return this.cache[e]!==void 0?(o=this.cache[e],this.canvasFactory.reset(o,i,r)):(o=this.canvasFactory.create(i,r),this.cache[e]=o),o}delete(e){delete this.cache[e]}clear(){for(const e in this.cache){const i=this.cache[e];this.canvasFactory.destroy(i),delete this.cache[e]}}}function vM(t,e,i,r,o,s,n,a,l,c){const[d,A,u,h,g,p]=Io(t);if(A===0&&u===0){const v=n*d+g,C=Math.round(v),y=a*h+p,I=Math.round(y),B=(n+l)*d+g,E=Math.abs(Math.round(B)-C)||1,k=(a+c)*h+p,Q=Math.abs(Math.round(k)-I)||1;return t.setTransform(Math.sign(d),0,0,Math.sign(h),C,I),t.drawImage(e,i,r,o,s,0,0,E,Q),t.setTransform(d,A,u,h,g,p),[E,Q]}if(d===0&&h===0){const v=a*u+g,C=Math.round(v),y=n*A+p,I=Math.round(y),B=(a+c)*u+g,E=Math.abs(Math.round(B)-C)||1,k=(n+l)*A+p,Q=Math.abs(Math.round(k)-I)||1;return t.setTransform(0,Math.sign(A),Math.sign(u),0,C,I),t.drawImage(e,i,r,o,s,0,0,Q,E),t.setTransform(d,A,u,h,g,p),[Q,E]}t.drawImage(e,i,r,o,s,n,a,l,c);const m=Math.hypot(d,A),f=Math.hypot(u,h);return[m*l,f*c]}function iki(t){const{width:e,height:i}=t;if(e>r4e||i>r4e)return null;const r=1e3,o=new Uint8Array([0,2,4,0,1,0,5,4,8,10,0,8,0,2,1,0]),s=e+1;let n=new Uint8Array(s*(i+1)),a,l,c;const d=e+7&-8;let A=new Uint8Array(d*i),u=0;for(const m of t.data){let f=128;for(;f>0;)A[u++]=m&f?0:255,f>>=1}let h=0;for(u=0,A[u]!==0&&(n[0]=1,++h),l=1;l<e;l++)A[u]!==A[u+1]&&(n[l]=A[u]?2:1,++h),u++;for(A[u]!==0&&(n[l]=2,++h),a=1;a<i;a++){u=a*d,c=a*s,A[u-d]!==A[u]&&(n[c]=A[u]?1:8,++h);let m=(A[u]?4:0)+(A[u-d]?8:0);for(l=1;l<e;l++)m=(m>>2)+(A[u+1]?4:0)+(A[u-d+1]?8:0),o[m]&&(n[c+l]=o[m],++h),u++;if(A[u-d]!==A[u]&&(n[c+l]=A[u]?2:4,++h),h>r)return null}for(u=d*(i-1),c=a*s,A[u]!==0&&(n[c]=8,++h),l=1;l<e;l++)A[u]!==A[u+1]&&(n[c+l]=A[u]?4:8,++h),u++;if(A[u]!==0&&(n[c+l]=4,++h),h>r)return null;const g=new Int32Array([0,s,-1,0,-s,0,0,0,1]),p=new Path2D;for(a=0;h&&a<=i;a++){let m=a*s;const f=m+e;for(;m<f&&!n[m];)m++;if(m===f)continue;p.moveTo(m%s,a);const v=m;let C=n[m];do{const y=g[C];do m+=y;while(!n[m]);const I=n[m];I!==5&&I!==10?(C=I,n[m]=0):(C=I&51*C>>4,n[m]&=C>>2|C<<2),p.lineTo(m%s,m/s|0),n[m]||--h}while(v!==m);--a}return A=null,n=null,function(m){m.save(),m.scale(1/e,-1/i),m.translate(0,-i),m.fill(p),m.beginPath(),m.restore()}}class o4e{constructor(e,i){this.alphaIsShape=!1,this.fontSize=0,this.fontSizeScale=1,this.textMatrix=sve,this.textMatrixScale=1,this.fontMatrix=_j,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=Ds.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="none",this.startNewPathAndClipBox([0,0,e,i])}clone(){const e=Object.create(this);return e.clipBox=this.clipBox.slice(),e}setCurrentPoint(e,i){this.x=e,this.y=i}updatePathMinMax(e,i,r){[i,r]=ti.applyTransform([i,r],e),this.minX=Math.min(this.minX,i),this.minY=Math.min(this.minY,r),this.maxX=Math.max(this.maxX,i),this.maxY=Math.max(this.maxY,r)}updateRectMinMax(e,i){const r=ti.applyTransform(i,e),o=ti.applyTransform(i.slice(2),e),s=ti.applyTransform([i[0],i[3]],e),n=ti.applyTransform([i[2],i[1]],e);this.minX=Math.min(this.minX,r[0],o[0],s[0],n[0]),this.minY=Math.min(this.minY,r[1],o[1],s[1],n[1]),this.maxX=Math.max(this.maxX,r[0],o[0],s[0],n[0]),this.maxY=Math.max(this.maxY,r[1],o[1],s[1],n[1])}updateScalingPathMinMax(e,i){ti.scaleMinMax(e,i),this.minX=Math.min(this.minX,i[0]),this.minY=Math.min(this.minY,i[1]),this.maxX=Math.max(this.maxX,i[2]),this.maxY=Math.max(this.maxY,i[3])}updateCurvePathMinMax(e,i,r,o,s,n,a,l,c,d){const A=ti.bezierBoundingBox(i,r,o,s,n,a,l,c,d);d||this.updateRectMinMax(e,A)}getPathBoundingBox(e=ha.FILL,i=null){const r=[this.minX,this.minY,this.maxX,this.maxY];if(e===ha.STROKE){i||nn("Stroke bounding box must include transform.");const o=ti.singularValueDecompose2dScale(i),s=o[0]*this.lineWidth/2,n=o[1]*this.lineWidth/2;r[0]-=s,r[1]-=n,r[2]+=s,r[3]+=n}return r}updateClipFromPath(){const e=ti.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=ha.FILL,i=null){return ti.intersect(this.clipBox,this.getPathBoundingBox(e,i))}}function n4e(t,e){if(typeof ImageData<"u"&&e instanceof ImageData){t.putImageData(e,0,0);return}const i=e.height,r=e.width,o=i%Ka,s=(i-o)/Ka,n=o===0?s:s+1,a=t.createImageData(r,Ka);let l=0,c;const d=e.data,A=a.data;let u,h,g,p;if(e.kind===LQ.GRAYSCALE_1BPP){const m=d.byteLength,f=new Uint32Array(A.buffer,0,A.byteLength>>2),v=f.length,C=r+7>>3,y=4294967295,I=_a.isLittleEndian?4278190080:255;for(u=0;u<n;u++){for(g=u<s?Ka:o,c=0,h=0;h<g;h++){const B=m-l;let E=0;const k=B>C?r:B*8-7,Q=k&-8;let S=0,D=0;for(;E<Q;E+=8)D=d[l++],f[c++]=D&128?y:I,f[c++]=D&64?y:I,f[c++]=D&32?y:I,f[c++]=D&16?y:I,f[c++]=D&8?y:I,f[c++]=D&4?y:I,f[c++]=D&2?y:I,f[c++]=D&1?y:I;for(;E<k;E++)S===0&&(D=d[l++],S=128),f[c++]=D&S?y:I,S>>=1}for(;c<v;)f[c++]=0;t.putImageData(a,0,u*Ka)}}else if(e.kind===LQ.RGBA_32BPP){for(h=0,p=r*Ka*4,u=0;u<s;u++)A.set(d.subarray(l,l+p)),l+=p,t.putImageData(a,0,h),h+=Ka;u<n&&(p=r*o*4,A.set(d.subarray(l,l+p)),t.putImageData(a,0,h))}else if(e.kind===LQ.RGB_24BPP)for(g=Ka,p=r*g,u=0;u<n;u++){for(u>=s&&(g=o,p=r*g),c=0,h=p;h--;)A[c++]=d[l++],A[c++]=d[l++],A[c++]=d[l++],A[c++]=255;t.putImageData(a,0,u*Ka)}else throw new Error(`bad image kind: ${e.kind}`)}function s4e(t,e){if(e.bitmap){t.drawImage(e.bitmap,0,0);return}const i=e.height,r=e.width,o=i%Ka,s=(i-o)/Ka,n=o===0?s:s+1,a=t.createImageData(r,Ka);let l=0;const c=e.data,d=a.data;for(let A=0;A<n;A++){const u=A<s?Ka:o;({srcPos:l}=XEi({src:c,srcPos:l,dest:d,width:r,height:u,nonBlackColor:0})),t.putImageData(a,0,A*Ka)}}function ny(t,e){const i=["strokeStyle","fillStyle","fillRule","globalAlpha","lineWidth","lineCap","lineJoin","miterLimit","globalCompositeOperation","font","filter"];for(const r of i)t[r]!==void 0&&(e[r]=t[r]);t.setLineDash!==void 0&&(e.setLineDash(t.getLineDash()),e.lineDashOffset=t.lineDashOffset)}function CM(t){if(t.strokeStyle=t.fillStyle="#000000",t.fillRule="nonzero",t.globalAlpha=1,t.lineWidth=1,t.lineCap="butt",t.lineJoin="miter",t.miterLimit=10,t.globalCompositeOperation="source-over",t.font="10px sans-serif",t.setLineDash!==void 0&&(t.setLineDash([]),t.lineDashOffset=0),!Ss){const{filter:e}=t;e!=="none"&&e!==""&&(t.filter="none")}}function a4e(t,e){if(e)return!0;const i=ti.singularValueDecompose2dScale(t);i[0]=Math.fround(i[0]),i[1]=Math.fround(i[1]);const r=Math.fround((globalThis.devicePixelRatio||1)*pv.PDF_TO_CSS_UNITS);return i[0]<=r&&i[1]<=r}const rki=["butt","round","square"],oki=["miter","round","bevel"],nki={},l4e={};var Uv,UV,OV;const ski=class MCe{constructor(e,i,r,o,s,{optionalContentConfig:n,markedContentStack:a=null},l,c){ce(this,Uv),this.ctx=e,this.current=new o4e(this.ctx.canvas.width,this.ctx.canvas.height),this.stateStack=[],this.pendingClip=null,this.pendingEOFill=!1,this.res=null,this.xobjs=null,this.commonObjs=i,this.objs=r,this.canvasFactory=o,this.filterFactory=s,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=a||[],this.optionalContentConfig=n,this.cachedCanvases=new tki(this.canvasFactory),this.cachedPatterns=new Map,this.annotationCanvasMap=l,this.viewportScale=1,this.outputScaleX=1,this.outputScaleY=1,this.pageColors=c,this._cachedScaleForStroking=[-1,0],this._cachedGetSinglePixelWidth=null,this._cachedBitmapsMap=new Map}getObject(e,i=null){return typeof e=="string"?e.startsWith("g_")?this.commonObjs.get(e):this.objs.get(e):i}beginDrawing({transform:e,viewport:i,transparency:r=!1,background:o=null}){const s=this.ctx.canvas.width,n=this.ctx.canvas.height,a=this.ctx.fillStyle;if(this.ctx.fillStyle=o||"#ffffff",this.ctx.fillRect(0,0,s,n),this.ctx.fillStyle=a,r){const l=this.cachedCanvases.getCanvas("transparent",s,n);this.compositeCtx=this.ctx,this.transparentCanvas=l.canvas,this.ctx=l.context,this.ctx.save(),this.ctx.transform(...Io(this.compositeCtx))}this.ctx.save(),CM(this.ctx),e&&(this.ctx.transform(...e),this.outputScaleX=e[0],this.outputScaleY=e[0]),this.ctx.transform(...i.transform),this.viewportScale=i.scale,this.baseTransform=Io(this.ctx)}executeOperatorList(e,i,r,o){const s=e.argsArray,n=e.fnArray;let a=i||0;const l=s.length;if(l===a)return a;const c=l-a>i4e&&typeof r=="function",d=c?Date.now()+$Ei:0;let A=0;const u=this.commonObjs,h=this.objs;let g;for(;;){if(o!==void 0&&a===o.nextBreakPoint)return o.breakIt(a,r),a;if(g=n[a],g!==id.dependency)this[g].apply(this,s[a]);else for(const p of s[a]){const m=p.startsWith("g_")?u:h;if(!m.has(p))return m.get(p,r),a}if(a++,a===l)return a;if(c&&++A>i4e){if(Date.now()>d)return r(),a;A=0}}}endDrawing(){$(this,Uv,UV).call(this),this.cachedCanvases.clear(),this.cachedPatterns.clear();for(const e of this._cachedBitmapsMap.values()){for(const i of e.values())typeof HTMLCanvasElement<"u"&&i instanceof HTMLCanvasElement&&(i.width=i.height=0);e.clear()}this._cachedBitmapsMap.clear(),$(this,Uv,OV).call(this)}_scaleImage(e,i){const r=e.width,o=e.height;let s=Math.max(Math.hypot(i[0],i[1]),1),n=Math.max(Math.hypot(i[2],i[3]),1),a=r,l=o,c="prescale1",d,A;for(;s>2&&a>1||n>2&&l>1;){let u=a,h=l;s>2&&a>1&&(u=a>=16384?Math.floor(a/2)-1||1:Math.ceil(a/2),s/=a/u),n>2&&l>1&&(h=l>=16384?Math.floor(l/2)-1||1:Math.ceil(l)/2,n/=l/h),d=this.cachedCanvases.getCanvas(c,u,h),A=d.context,A.clearRect(0,0,u,h),A.drawImage(e,0,0,a,l,0,0,u,h),e=d.canvas,a=u,l=h,c=c==="prescale1"?"prescale2":"prescale1"}return{img:e,paintWidth:a,paintHeight:l}}_createMaskCanvas(e){const i=this.ctx,{width:r,height:o}=e,s=this.current.fillColor,n=this.current.patternFill,a=Io(i);let l,c,d,A;if((e.bitmap||e.data)&&e.count>1){const k=e.bitmap||e.data.buffer;c=JSON.stringify(n?a:[a.slice(0,4),s]),l=this._cachedBitmapsMap.get(k),l||(l=new Map,this._cachedBitmapsMap.set(k,l));const Q=l.get(c);if(Q&&!n){const S=Math.round(Math.min(a[0],a[2])+a[4]),D=Math.round(Math.min(a[1],a[3])+a[5]);return{canvas:Q,offsetX:S,offsetY:D}}d=Q}d||(A=this.cachedCanvases.getCanvas("maskCanvas",r,o),s4e(A.context,e));let u=ti.transform(a,[1/r,0,0,-1/o,0,0]);u=ti.transform(u,[1,0,0,1,0,-o]);const[h,g,p,m]=ti.getAxialAlignedBoundingBox([0,0,r,o],u),f=Math.round(p-h)||1,v=Math.round(m-g)||1,C=this.cachedCanvases.getCanvas("fillCanvas",f,v),y=C.context,I=h,B=g;y.translate(-I,-B),y.transform(...u),d||(d=this._scaleImage(A.canvas,Pu(y)),d=d.img,l&&n&&l.set(c,d)),y.imageSmoothingEnabled=a4e(Io(y),e.interpolate),vM(y,d,0,0,d.width,d.height,0,0,r,o),y.globalCompositeOperation="source-in";const E=ti.transform(Pu(y),[1,0,0,1,-I,-B]);return y.fillStyle=n?s.getPattern(i,this,E,ha.FILL):s,y.fillRect(0,0,r,o),l&&!n&&(this.cachedCanvases.delete("fillCanvas"),l.set(c,C.canvas)),{canvas:C.canvas,offsetX:Math.round(I),offsetY:Math.round(B)}}setLineWidth(e){e!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=e,this.ctx.lineWidth=e}setLineCap(e){this.ctx.lineCap=rki[e]}setLineJoin(e){this.ctx.lineJoin=oki[e]}setMiterLimit(e){this.ctx.miterLimit=e}setDash(e,i){const r=this.ctx;r.setLineDash!==void 0&&(r.setLineDash(e),r.lineDashOffset=i)}setRenderingIntent(e){}setFlatness(e){}setGState(e){for(const[i,r]of e)switch(i){case"LW":this.setLineWidth(r);break;case"LC":this.setLineCap(r);break;case"LJ":this.setLineJoin(r);break;case"ML":this.setMiterLimit(r);break;case"D":this.setDash(r[0],r[1]);break;case"RI":this.setRenderingIntent(r);break;case"FL":this.setFlatness(r);break;case"Font":this.setFont(r[0],r[1]);break;case"CA":this.current.strokeAlpha=r;break;case"ca":this.current.fillAlpha=r,this.ctx.globalAlpha=r;break;case"BM":this.ctx.globalCompositeOperation=r;break;case"SMask":this.current.activeSMask=r?this.tempSMask:null,this.tempSMask=null,this.checkSMaskState();break;case"TR":this.ctx.filter=this.current.transferMaps=this.filterFactory.addFilter(r);break}}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,i=this.ctx.canvas.height,r="smaskGroupAt"+this.groupLevel,o=this.cachedCanvases.getCanvas(r,e,i);this.suspendedCtx=this.ctx,this.ctx=o.context;const s=this.ctx;s.setTransform(...Io(this.suspendedCtx)),ny(this.suspendedCtx,s),eki(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(),ny(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 i=this.current.activeSMask,r=this.suspendedCtx;this.composeSMask(r,i,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()}composeSMask(e,i,r,o){const s=o[0],n=o[1],a=o[2]-s,l=o[3]-n;a===0||l===0||(this.genericComposeSMask(i.context,r,a,l,i.subtype,i.backdrop,i.transferMap,s,n,i.offsetX,i.offsetY),e.save(),e.globalAlpha=1,e.globalCompositeOperation="source-over",e.setTransform(1,0,0,1,0,0),e.drawImage(r.canvas,0,0),e.restore())}genericComposeSMask(e,i,r,o,s,n,a,l,c,d,A){let u=e.canvas,h=l-d,g=c-A;if(n){if(h<0||g<0||h+r>u.width||g+o>u.height){const m=this.cachedCanvases.getCanvas("maskExtension",r,o),f=m.context;f.drawImage(u,-h,-g),n.some(v=>v!==0)&&(f.globalCompositeOperation="destination-atop",f.fillStyle=ti.makeHexColor(...n),f.fillRect(0,0,r,o),f.globalCompositeOperation="source-over"),u=m.canvas,h=g=0}else if(n.some(m=>m!==0)){e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0);const m=new Path2D;m.rect(h,g,r,o),e.clip(m),e.globalCompositeOperation="destination-atop",e.fillStyle=ti.makeHexColor(...n),e.fillRect(h,g,r,o),e.restore()}}i.save(),i.globalAlpha=1,i.setTransform(1,0,0,1,0,0),s==="Alpha"&&a?i.filter=this.filterFactory.addAlphaFilter(a):s==="Luminosity"&&(i.filter=this.filterFactory.addLuminosityFilter(a));const p=new Path2D;p.rect(l,c,r,o),i.clip(p),i.globalCompositeOperation="destination-in",i.drawImage(u,h,g,r,o,l,c,r,o),i.restore()}save(){this.inSMaskMode?(ny(this.ctx,this.suspendedCtx),this.suspendedCtx.save()):this.ctx.save();const e=this.current;this.stateStack.push(e),this.current=e.clone()}restore(){this.stateStack.length===0&&this.inSMaskMode&&this.endSMaskMode(),this.stateStack.length!==0&&(this.current=this.stateStack.pop(),this.inSMaskMode?(this.suspendedCtx.restore(),ny(this.suspendedCtx,this.ctx)):this.ctx.restore(),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null)}transform(e,i,r,o,s,n){this.ctx.transform(e,i,r,o,s,n),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(e,i,r){const o=this.ctx,s=this.current;let n=s.x,a=s.y,l,c;const d=Io(o),A=d[0]===0&&d[3]===0||d[1]===0&&d[2]===0,u=A?r.slice(0):null;for(let h=0,g=0,p=e.length;h<p;h++)switch(e[h]|0){case id.rectangle:n=i[g++],a=i[g++];const m=i[g++],f=i[g++],v=n+m,C=a+f;o.moveTo(n,a),m===0||f===0?o.lineTo(v,C):(o.lineTo(v,a),o.lineTo(v,C),o.lineTo(n,C)),A||s.updateRectMinMax(d,[n,a,v,C]),o.closePath();break;case id.moveTo:n=i[g++],a=i[g++],o.moveTo(n,a),A||s.updatePathMinMax(d,n,a);break;case id.lineTo:n=i[g++],a=i[g++],o.lineTo(n,a),A||s.updatePathMinMax(d,n,a);break;case id.curveTo:l=n,c=a,n=i[g+4],a=i[g+5],o.bezierCurveTo(i[g],i[g+1],i[g+2],i[g+3],n,a),s.updateCurvePathMinMax(d,l,c,i[g],i[g+1],i[g+2],i[g+3],n,a,u),g+=6;break;case id.curveTo2:l=n,c=a,o.bezierCurveTo(n,a,i[g],i[g+1],i[g+2],i[g+3]),s.updateCurvePathMinMax(d,l,c,n,a,i[g],i[g+1],i[g+2],i[g+3],u),n=i[g+2],a=i[g+3],g+=4;break;case id.curveTo3:l=n,c=a,n=i[g+2],a=i[g+3],o.bezierCurveTo(i[g],i[g+1],n,a,n,a),s.updateCurvePathMinMax(d,l,c,i[g],i[g+1],n,a,n,a,u),g+=4;break;case id.closePath:o.closePath();break}A&&s.updateScalingPathMinMax(d,u),s.setCurrentPoint(n,a)}closePath(){this.ctx.closePath()}stroke(e=!0){const i=this.ctx,r=this.current.strokeColor;i.globalAlpha=this.current.strokeAlpha,this.contentVisible&&(typeof r=="object"&&r!=null&&r.getPattern?(i.save(),i.strokeStyle=r.getPattern(i,this,Pu(i),ha.STROKE),this.rescaleAndStroke(!1),i.restore()):this.rescaleAndStroke(!0)),e&&this.consumePath(this.current.getClippedPathBoundingBox()),i.globalAlpha=this.current.fillAlpha}closeStroke(){this.closePath(),this.stroke()}fill(e=!0){const i=this.ctx,r=this.current.fillColor,o=this.current.patternFill;let s=!1;o&&(i.save(),i.fillStyle=r.getPattern(i,this,Pu(i),ha.FILL),s=!0);const n=this.current.getClippedPathBoundingBox();this.contentVisible&&n!==null&&(this.pendingEOFill?(i.fill("evenodd"),this.pendingEOFill=!1):i.fill()),s&&i.restore(),e&&this.consumePath(n)}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=nki}eoClip(){this.pendingClip=l4e}beginText(){this.current.textMatrix=sve,this.current.textMatrixScale=1,this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}endText(){const e=this.pendingTextPaths,i=this.ctx;if(e===void 0){i.beginPath();return}i.save(),i.beginPath();for(const r of e)i.setTransform(...r.transform),i.translate(r.x,r.y),r.addToPath(i,r.fontSize);i.restore(),i.clip(),i.beginPath(),delete this.pendingTextPaths}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,i){var r;const o=this.commonObjs.get(e),s=this.current;if(!o)throw new Error(`Can't find font for ${e}`);if(s.fontMatrix=o.fontMatrix||_j,(s.fontMatrix[0]===0||s.fontMatrix[3]===0)&&Hi("Invalid font matrix for font "+e),i<0?(i=-i,s.fontDirection=-1):s.fontDirection=1,this.current.font=o,this.current.fontSize=i,o.isType3Font)return;const n=o.loadedName||"sans-serif",a=((r=o.systemFontInfo)==null?void 0:r.css)||`"${n}", ${o.fallbackName}`;let l="normal";o.black?l="900":o.bold&&(l="bold");const c=o.italic?"italic":"normal";let d=i;i<e4e?d=e4e:i>t4e&&(d=t4e),this.current.fontSizeScale=i/d,this.ctx.font=`${c} ${l} ${d}px ${a}`}setTextRenderingMode(e){this.current.textRenderingMode=e}setTextRise(e){this.current.textRise=e}moveText(e,i){this.current.x=this.current.lineX+=e,this.current.y=this.current.lineY+=i}setLeadingMoveText(e,i){this.setLeading(-i),this.moveText(e,i)}setTextMatrix(e,i,r,o,s,n){this.current.textMatrix=[e,i,r,o,s,n],this.current.textMatrixScale=Math.hypot(e,i),this.current.x=this.current.lineX=0,this.current.y=this.current.lineY=0}nextLine(){this.moveText(0,this.current.leading)}paintChar(e,i,r,o){const s=this.ctx,n=this.current,a=n.font,l=n.textRenderingMode,c=n.fontSize/n.fontSizeScale,d=l&Ds.FILL_STROKE_MASK,A=!!(l&Ds.ADD_TO_PATH_FLAG),u=n.patternFill&&!a.missingFile;let h;(a.disableFontFace||A||u)&&(h=a.getPathGenerator(this.commonObjs,e)),a.disableFontFace||u?(s.save(),s.translate(i,r),s.beginPath(),h(s,c),o&&s.setTransform(...o),(d===Ds.FILL||d===Ds.FILL_STROKE)&&s.fill(),(d===Ds.STROKE||d===Ds.FILL_STROKE)&&s.stroke(),s.restore()):((d===Ds.FILL||d===Ds.FILL_STROKE)&&s.fillText(e,i,r),(d===Ds.STROKE||d===Ds.FILL_STROKE)&&s.strokeText(e,i,r)),A&&(this.pendingTextPaths||(this.pendingTextPaths=[])).push({transform:Io(s),x:i,y:r,fontSize:c,addToPath:h})}get isFontSubpixelAAEnabled(){const{context:e}=this.cachedCanvases.getCanvas("isFontSubpixelAAEnabled",10,10);e.scale(1.5,1),e.fillText("I",0,10);const i=e.getImageData(0,0,10,10).data;let r=!1;for(let o=3;o<i.length;o+=4)if(i[o]>0&&i[o]<255){r=!0;break}return or(this,"isFontSubpixelAAEnabled",r)}showText(e){const i=this.current,r=i.font;if(r.isType3Font)return this.showType3Text(e);const o=i.fontSize;if(o===0)return;const s=this.ctx,n=i.fontSizeScale,a=i.charSpacing,l=i.wordSpacing,c=i.fontDirection,d=i.textHScale*c,A=e.length,u=r.vertical,h=u?1:-1,g=r.defaultVMetrics,p=o*i.fontMatrix[0],m=i.textRenderingMode===Ds.FILL&&!r.disableFontFace&&!i.patternFill;s.save(),s.transform(...i.textMatrix),s.translate(i.x,i.y+i.textRise),c>0?s.scale(d,-1):s.scale(d,1);let f;if(i.patternFill){s.save();const B=i.fillColor.getPattern(s,this,Pu(s),ha.FILL);f=Io(s),s.restore(),s.fillStyle=B}let v=i.lineWidth;const C=i.textMatrixScale;if(C===0||v===0){const B=i.textRenderingMode&Ds.FILL_STROKE_MASK;(B===Ds.STROKE||B===Ds.FILL_STROKE)&&(v=this.getSinglePixelWidth())}else v/=C;if(n!==1&&(s.scale(n,n),v/=n),s.lineWidth=v,r.isInvalidPDFjsFont){const B=[];let E=0;for(const k of e)B.push(k.unicode),E+=k.width;s.fillText(B.join(""),0,0),i.x+=E*p*d,s.restore(),this.compose();return}let y=0,I;for(I=0;I<A;++I){const B=e[I];if(typeof B=="number"){y+=h*B*o/1e3;continue}let E=!1;const k=(B.isSpace?l:0)+a,Q=B.fontChar,S=B.accent;let D,R,N=B.width;if(u){const q=B.vmetric||g,O=-(B.vmetric?q[1]:N*.5)*p,G=q[2]*p;N=q?-q[0]:N,D=O/n,R=(y+G)/n}else D=y/n,R=0;if(r.remeasure&&N>0){const q=s.measureText(Q).width*1e3/o*n;if(N<q&&this.isFontSubpixelAAEnabled){const O=N/q;E=!0,s.save(),s.scale(O,1),D/=O}else N!==q&&(D+=(N-q)/2e3*o/n)}if(this.contentVisible&&(B.isInFont||r.missingFile)){if(m&&!S)s.fillText(Q,D,R);else if(this.paintChar(Q,D,R,f),S){const q=D+o*S.offset.x/n,O=R-o*S.offset.y/n;this.paintChar(S.fontChar,q,O,f)}}const H=u?N*p-k*c:N*p+k*c;y+=H,E&&s.restore()}u?i.y-=y:i.x+=y*d,s.restore(),this.compose()}showType3Text(e){const i=this.ctx,r=this.current,o=r.font,s=r.fontSize,n=r.fontDirection,a=o.vertical?1:-1,l=r.charSpacing,c=r.wordSpacing,d=r.textHScale*n,A=r.fontMatrix||_j,u=e.length,h=r.textRenderingMode===Ds.INVISIBLE;let g,p,m,f;if(!(h||s===0)){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,i.save(),i.transform(...r.textMatrix),i.translate(r.x,r.y),i.scale(d,n),g=0;g<u;++g){if(p=e[g],typeof p=="number"){f=a*p*s/1e3,this.ctx.translate(f,0),r.x+=f*d;continue}const v=(p.isSpace?c:0)+l,C=o.charProcOperatorList[p.operatorListId];if(!C){Hi(`Type3 character "${p.operatorListId}" is not available.`);continue}this.contentVisible&&(this.processingType3=p,this.save(),i.scale(s,s),i.transform(...A),this.executeOperatorList(C),this.restore()),m=ti.applyTransform([p.width,0],A)[0]*s+v,i.translate(m,0),r.x+=m*d}i.restore(),this.processingType3=null}}setCharWidth(e,i){}setCharWidthAndBounds(e,i,r,o,s,n){this.ctx.rect(r,o,s-r,n-o),this.ctx.clip(),this.endPath()}getColorN_Pattern(e){let i;if(e[0]==="TilingPattern"){const r=e[1],o=this.baseTransform||Io(this.ctx),s={createCanvasGraphics:n=>new MCe(n,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};i=new ZEi(e,r,this.ctx,s,o)}else i=this._getPattern(e[1],e[2]);return i}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments)}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(e,i,r){this.ctx.strokeStyle=this.current.strokeColor=ti.makeHexColor(e,i,r)}setStrokeTransparent(){this.ctx.strokeStyle=this.current.strokeColor="transparent"}setFillRGBColor(e,i,r){this.ctx.fillStyle=this.current.fillColor=ti.makeHexColor(e,i,r),this.current.patternFill=!1}setFillTransparent(){this.ctx.fillStyle=this.current.fillColor="transparent",this.current.patternFill=!1}_getPattern(e,i=null){let r;return this.cachedPatterns.has(e)?r=this.cachedPatterns.get(e):(r=WEi(this.getObject(e)),this.cachedPatterns.set(e,r)),i&&(r.matrix=i),r}shadingFill(e){if(!this.contentVisible)return;const i=this.ctx;this.save();const r=this._getPattern(e);i.fillStyle=r.getPattern(i,this,Pu(i),ha.SHADING);const o=Pu(i);if(o){const{width:s,height:n}=i.canvas,[a,l,c,d]=ti.getAxialAlignedBoundingBox([0,0,s,n],o);this.ctx.fillRect(a,l,c-a,d-l)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){nn("Should not call beginInlineImage")}beginImageData(){nn("Should not call beginImageData")}paintFormXObjectBegin(e,i){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),e&&this.transform(...e),this.baseTransform=Io(this.ctx),i)){const r=i[2]-i[0],o=i[3]-i[1];this.ctx.rect(i[0],i[1],r,o),this.current.updateRectMinMax(Io(this.ctx),i),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 i=this.ctx;e.isolated||NQ("TODO: Support non-isolated groups."),e.knockout&&Hi("Knockout groups not supported.");const r=Io(i);if(e.matrix&&i.transform(...e.matrix),!e.bbox)throw new Error("Bounding box is required.");let o=ti.getAxialAlignedBoundingBox(e.bbox,Io(i));const s=[0,0,i.canvas.width,i.canvas.height];o=ti.intersect(o,s)||[0,0,0,0];const n=Math.floor(o[0]),a=Math.floor(o[1]),l=Math.max(Math.ceil(o[2])-n,1),c=Math.max(Math.ceil(o[3])-a,1);this.current.startNewPathAndClipBox([0,0,l,c]);let d="groupAt"+this.groupLevel;e.smask&&(d+="_smask_"+this.smaskCounter++%2);const A=this.cachedCanvases.getCanvas(d,l,c),u=A.context;u.translate(-n,-a),u.transform(...r),e.smask?this.smaskStack.push({canvas:A.canvas,context:u,offsetX:n,offsetY:a,subtype:e.smask.subtype,backdrop:e.smask.backdrop,transferMap:e.smask.transferMap||null,startTransformInverse:null}):(i.setTransform(1,0,0,1,0,0),i.translate(n,a),i.save()),ny(i,u),this.ctx=u,this.setGState([["BM","source-over"],["ca",1],["CA",1]]),this.groupStack.push(i),this.groupLevel++}endGroup(e){if(!this.contentVisible)return;this.groupLevel--;const i=this.ctx,r=this.groupStack.pop();if(this.ctx=r,this.ctx.imageSmoothingEnabled=!1,e.smask)this.tempSMask=this.smaskStack.pop(),this.restore();else{this.ctx.restore();const o=Io(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...o);const s=ti.getAxialAlignedBoundingBox([0,0,i.canvas.width,i.canvas.height],o);this.ctx.drawImage(i.canvas,0,0),this.ctx.restore(),this.compose(s)}}beginAnnotation(e,i,r,o,s){if($(this,Uv,UV).call(this),CM(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),i){const n=i[2]-i[0],a=i[3]-i[1];if(s&&this.annotationCanvasMap){r=r.slice(),r[4]-=i[0],r[5]-=i[1],i=i.slice(),i[0]=i[1]=0,i[2]=n,i[3]=a;const[l,c]=ti.singularValueDecompose2dScale(Io(this.ctx)),{viewportScale:d}=this,A=Math.ceil(n*this.outputScaleX*d),u=Math.ceil(a*this.outputScaleY*d);this.annotationCanvas=this.canvasFactory.create(A,u);const{canvas:h,context:g}=this.annotationCanvas;this.annotationCanvasMap.set(e,h),this.annotationCanvas.savedCtx=this.ctx,this.ctx=g,this.ctx.save(),this.ctx.setTransform(l,0,0,-c,0,a*c),CM(this.ctx)}else CM(this.ctx),this.ctx.rect(i[0],i[1],n,a),this.ctx.clip(),this.endPath()}this.current=new o4e(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...r),this.transform(...o)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),$(this,Uv,OV).call(this),this.ctx=this.annotationCanvas.savedCtx,delete this.annotationCanvas.savedCtx,delete this.annotationCanvas)}paintImageMaskXObject(e){if(!this.contentVisible)return;const i=e.count;e=this.getObject(e.data,e),e.count=i;const r=this.ctx,o=this.processingType3;if(o&&(o.compiled===void 0&&(o.compiled=iki(e)),o.compiled)){o.compiled(r);return}const s=this._createMaskCanvas(e),n=s.canvas;r.save(),r.setTransform(1,0,0,1,0,0),r.drawImage(n,s.offsetX,s.offsetY),r.restore(),this.compose()}paintImageMaskXObjectRepeat(e,i,r=0,o=0,s,n){if(!this.contentVisible)return;e=this.getObject(e.data,e);const a=this.ctx;a.save();const l=Io(a);a.transform(i,r,o,s,0,0);const c=this._createMaskCanvas(e);a.setTransform(1,0,0,1,c.offsetX-l[4],c.offsetY-l[5]);for(let d=0,A=n.length;d<A;d+=2){const u=ti.transform(l,[i,r,o,s,n[d],n[d+1]]),[h,g]=ti.applyTransform([0,0],u);a.drawImage(c.canvas,h,g)}a.restore(),this.compose()}paintImageMaskXObjectGroup(e){if(!this.contentVisible)return;const i=this.ctx,r=this.current.fillColor,o=this.current.patternFill;for(const s of e){const{data:n,width:a,height:l,transform:c}=s,d=this.cachedCanvases.getCanvas("maskCanvas",a,l),A=d.context;A.save();const u=this.getObject(n,s);s4e(A,u),A.globalCompositeOperation="source-in",A.fillStyle=o?r.getPattern(A,this,Pu(i),ha.FILL):r,A.fillRect(0,0,a,l),A.restore(),i.save(),i.transform(...c),i.scale(1,-1),vM(i,d.canvas,0,0,a,l,0,-1,1,1),i.restore()}this.compose()}paintImageXObject(e){if(!this.contentVisible)return;const i=this.getObject(e);if(!i){Hi("Dependent image isn't ready yet");return}this.paintInlineImageXObject(i)}paintImageXObjectRepeat(e,i,r,o){if(!this.contentVisible)return;const s=this.getObject(e);if(!s){Hi("Dependent image isn't ready yet");return}const n=s.width,a=s.height,l=[];for(let c=0,d=o.length;c<d;c+=2)l.push({transform:[i,0,0,r,o[c],o[c+1]],x:0,y:0,w:n,h:a});this.paintInlineImageXObjectGroup(s,l)}applyTransferMapsToCanvas(e){return this.current.transferMaps!=="none"&&(e.filter=this.current.transferMaps,e.drawImage(e.canvas,0,0),e.filter="none"),e.canvas}applyTransferMapsToBitmap(e){if(this.current.transferMaps==="none")return e.bitmap;const{bitmap:i,width:r,height:o}=e,s=this.cachedCanvases.getCanvas("inlineImage",r,o),n=s.context;return n.filter=this.current.transferMaps,n.drawImage(i,0,0),n.filter="none",s.canvas}paintInlineImageXObject(e){if(!this.contentVisible)return;const i=e.width,r=e.height,o=this.ctx;if(this.save(),!Ss){const{filter:a}=o;a!=="none"&&a!==""&&(o.filter="none")}o.scale(1/i,-1/r);let s;if(e.bitmap)s=this.applyTransferMapsToBitmap(e);else if(typeof HTMLElement=="function"&&e instanceof HTMLElement||!e.data)s=e;else{const a=this.cachedCanvases.getCanvas("inlineImage",i,r).context;n4e(a,e),s=this.applyTransferMapsToCanvas(a)}const n=this._scaleImage(s,Pu(o));o.imageSmoothingEnabled=a4e(Io(o),e.interpolate),vM(o,n.img,0,0,n.paintWidth,n.paintHeight,0,-r,i,r),this.compose(),this.restore()}paintInlineImageXObjectGroup(e,i){if(!this.contentVisible)return;const r=this.ctx;let o;if(e.bitmap)o=e.bitmap;else{const s=e.width,n=e.height,a=this.cachedCanvases.getCanvas("inlineImage",s,n).context;n4e(a,e),o=this.applyTransferMapsToCanvas(a)}for(const s of i)r.save(),r.transform(...s.transform),r.scale(1,-1),vM(r,o,s.x,s.y,s.w,s.h,0,-1,1,1),r.restore();this.compose()}paintSolidColorImageMask(){this.contentVisible&&(this.ctx.fillRect(0,0,1,1),this.compose())}markPoint(e){}markPointProps(e,i){}beginMarkedContent(e){this.markedContentStack.push({visible:!0})}beginMarkedContentProps(e,i){e==="OC"?this.markedContentStack.push({visible:this.optionalContentConfig.isVisible(i)}):this.markedContentStack.push({visible:!0}),this.contentVisible=this.isContentVisible()}endMarkedContent(){this.markedContentStack.pop(),this.contentVisible=this.isContentVisible()}beginCompat(){}endCompat(){}consumePath(e){const i=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(e);const r=this.ctx;this.pendingClip&&(i||(this.pendingClip===l4e?r.clip("evenodd"):r.clip()),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox),r.beginPath()}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const e=Io(this.ctx);if(e[1]===0&&e[2]===0)this._cachedGetSinglePixelWidth=1/Math.min(Math.abs(e[0]),Math.abs(e[3]));else{const i=Math.abs(e[0]*e[3]-e[2]*e[1]),r=Math.hypot(e[0],e[2]),o=Math.hypot(e[1],e[3]);this._cachedGetSinglePixelWidth=Math.max(r,o)/i}}return this._cachedGetSinglePixelWidth}getScaleForStroking(){if(this._cachedScaleForStroking[0]===-1){const{lineWidth:e}=this.current,{a:i,b:r,c:o,d:s}=this.ctx.getTransform();let n,a;if(r===0&&o===0){const l=Math.abs(i),c=Math.abs(s);if(l===c)if(e===0)n=a=1/l;else{const d=l*e;n=a=d<1?1/d:1}else if(e===0)n=1/l,a=1/c;else{const d=l*e,A=c*e;n=d<1?1/d:1,a=A<1?1/A:1}}else{const l=Math.abs(i*s-r*o),c=Math.hypot(i,r),d=Math.hypot(o,s);if(e===0)n=d/l,a=c/l;else{const A=e*l;n=d>A?d/A:1,a=c>A?c/A:1}}this._cachedScaleForStroking[0]=n,this._cachedScaleForStroking[1]=a}return this._cachedScaleForStroking}rescaleAndStroke(e){const{ctx:i}=this,{lineWidth:r}=this.current,[o,s]=this.getScaleForStroking();if(i.lineWidth=r||1,o===1&&s===1){i.stroke();return}const n=i.getLineDash();if(e&&i.save(),i.scale(o,s),n.length>0){const a=Math.max(o,s);i.setLineDash(n.map(l=>l/a)),i.lineDashOffset/=a}i.stroke(),e&&i.restore()}isContentVisible(){for(let e=this.markedContentStack.length-1;e>=0;e--)if(!this.markedContentStack[e].visible)return!1;return!0}};Uv=new WeakSet,UV=function(){for(;this.stateStack.length||this.inSMaskMode;)this.restore();this.current.activeSMask=null,this.ctx.restore(),this.transparentCanvas&&(this.ctx=this.compositeCtx,this.ctx.save(),this.ctx.setTransform(1,0,0,1,0,0),this.ctx.drawImage(this.transparentCanvas,0,0),this.ctx.restore(),this.transparentCanvas=null)},OV=function(){if(this.pageColors){const t=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(t!=="none"){const e=this.ctx.filter;this.ctx.filter=t,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=e}}};let yM=ski;for(const t in id)yM.prototype[t]!==void 0&&(yM.prototype[id[t]]=yM.prototype[t]);var IM,wM;class t0{static get workerPort(){return M(this,IM)}static set workerPort(e){if(!(typeof Worker<"u"&&e instanceof Worker)&&e!==null)throw new Error("Invalid `workerPort` type.");ie(this,IM,e)}static get workerSrc(){return M(this,wM)}static set workerSrc(e){if(typeof e!="string")throw new Error("Invalid `workerSrc` type.");ie(this,wM,e)}}IM=new WeakMap,wM=new WeakMap,ce(t0,IM,null),ce(t0,wM,"");const bM={UNKNOWN:0,DATA:1,ERROR:2},sn={UNKNOWN:0,CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function Ml(t){switch(t instanceof Error||typeof t=="object"&&t!==null||nn('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),t.name){case"AbortException":return new Dg(t.message);case"MissingPDFException":return new Sg(t.message);case"PasswordException":return new Jj(t.message,t.code);case"UnexpectedResponseException":return new UQ(t.message,t.status);case"UnknownErrorException":return new Yj(t.message,t.details);default:return new Yj(t.message,t.toString())}}var qg,c4e,d4e,BM,A4e;let sy=(A4e=class{constructor(t,e,i){ce(this,qg),this.sourceName=t,this.targetName=e,this.comObj=i,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),this._onComObjOnMessage=r=>{const o=r.data;if(o.targetName!==this.sourceName)return;if(o.stream){$(this,qg,d4e).call(this,o);return}if(o.callback){const n=o.callbackId,a=this.callbackCapabilities[n];if(!a)throw new Error(`Cannot resolve callback ${n}`);if(delete this.callbackCapabilities[n],o.callback===bM.DATA)a.resolve(o.data);else if(o.callback===bM.ERROR)a.reject(Ml(o.reason));else throw new Error("Unexpected callback case");return}const s=this.actionHandler[o.action];if(!s)throw new Error(`Unknown action from worker: ${o.action}`);if(o.callbackId){const n=this.sourceName,a=o.sourceName;new Promise(function(l){l(s(o.data))}).then(function(l){i.postMessage({sourceName:n,targetName:a,callback:bM.DATA,callbackId:o.callbackId,data:l})},function(l){i.postMessage({sourceName:n,targetName:a,callback:bM.ERROR,callbackId:o.callbackId,reason:Ml(l)})});return}if(o.streamId){$(this,qg,c4e).call(this,o);return}s(o.data)},i.addEventListener("message",this._onComObjOnMessage)}on(t,e){const i=this.actionHandler;if(i[t])throw new Error(`There is already an actionName called "${t}"`);i[t]=e}send(t,e,i){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,data:e},i)}sendWithPromise(t,e,i){const r=this.callbackId++,o=Promise.withResolvers();this.callbackCapabilities[r]=o;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:t,callbackId:r,data:e},i)}catch(s){o.reject(s)}return o.promise}sendWithStream(t,e,i,r){const o=this.streamId++,s=this.sourceName,n=this.targetName,a=this.comObj;return new ReadableStream({start:l=>{const c=Promise.withResolvers();return this.streamControllers[o]={controller:l,startCall:c,pullCall:null,cancelCall:null,isClosed:!1},a.postMessage({sourceName:s,targetName:n,action:t,streamId:o,data:e,desiredSize:l.desiredSize},r),c.promise},pull:l=>{const c=Promise.withResolvers();return this.streamControllers[o].pullCall=c,a.postMessage({sourceName:s,targetName:n,stream:sn.PULL,streamId:o,desiredSize:l.desiredSize}),c.promise},cancel:l=>{yn(l instanceof Error,"cancel must have a valid reason");const c=Promise.withResolvers();return this.streamControllers[o].cancelCall=c,this.streamControllers[o].isClosed=!0,a.postMessage({sourceName:s,targetName:n,stream:sn.CANCEL,streamId:o,reason:Ml(l)}),c.promise}},i)}destroy(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}},qg=new WeakSet,c4e=function(t){const e=t.streamId,i=this.sourceName,r=t.sourceName,o=this.comObj,s=this,n=this.actionHandler[t.action],a={enqueue(l,c=1,d){if(this.isCancelled)return;const A=this.desiredSize;this.desiredSize-=c,A>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),o.postMessage({sourceName:i,targetName:r,stream:sn.ENQUEUE,streamId:e,chunk:l},d)},close(){this.isCancelled||(this.isCancelled=!0,o.postMessage({sourceName:i,targetName:r,stream:sn.CLOSE,streamId:e}),delete s.streamSinks[e])},error(l){yn(l instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,o.postMessage({sourceName:i,targetName:r,stream:sn.ERROR,streamId:e,reason:Ml(l)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:t.desiredSize,ready:null};a.sinkCapability.resolve(),a.ready=a.sinkCapability.promise,this.streamSinks[e]=a,new Promise(function(l){l(n(t.data,a))}).then(function(){o.postMessage({sourceName:i,targetName:r,stream:sn.START_COMPLETE,streamId:e,success:!0})},function(l){o.postMessage({sourceName:i,targetName:r,stream:sn.START_COMPLETE,streamId:e,reason:Ml(l)})})},d4e=function(t){const e=t.streamId,i=this.sourceName,r=t.sourceName,o=this.comObj,s=this.streamControllers[e],n=this.streamSinks[e];switch(t.stream){case sn.START_COMPLETE:t.success?s.startCall.resolve():s.startCall.reject(Ml(t.reason));break;case sn.PULL_COMPLETE:t.success?s.pullCall.resolve():s.pullCall.reject(Ml(t.reason));break;case sn.PULL:if(!n){o.postMessage({sourceName:i,targetName:r,stream:sn.PULL_COMPLETE,streamId:e,success:!0});break}n.desiredSize<=0&&t.desiredSize>0&&n.sinkCapability.resolve(),n.desiredSize=t.desiredSize,new Promise(function(a){var l;a((l=n.onPull)==null?void 0:l.call(n))}).then(function(){o.postMessage({sourceName:i,targetName:r,stream:sn.PULL_COMPLETE,streamId:e,success:!0})},function(a){o.postMessage({sourceName:i,targetName:r,stream:sn.PULL_COMPLETE,streamId:e,reason:Ml(a)})});break;case sn.ENQUEUE:if(yn(s,"enqueue should have stream controller"),s.isClosed)break;s.controller.enqueue(t.chunk);break;case sn.CLOSE:if(yn(s,"close should have stream controller"),s.isClosed)break;s.isClosed=!0,s.controller.close(),$(this,qg,BM).call(this,s,e);break;case sn.ERROR:yn(s,"error should have stream controller"),s.controller.error(Ml(t.reason)),$(this,qg,BM).call(this,s,e);break;case sn.CANCEL_COMPLETE:t.success?s.cancelCall.resolve():s.cancelCall.reject(Ml(t.reason)),$(this,qg,BM).call(this,s,e);break;case sn.CANCEL:if(!n)break;new Promise(function(a){var l;a((l=n.onCancel)==null?void 0:l.call(n,Ml(t.reason)))}).then(function(){o.postMessage({sourceName:i,targetName:r,stream:sn.CANCEL_COMPLETE,streamId:e,success:!0})},function(a){o.postMessage({sourceName:i,targetName:r,stream:sn.CANCEL_COMPLETE,streamId:e,reason:Ml(a)})}),n.sinkCapability.reject(Ml(t.reason)),n.isCancelled=!0,delete this.streamSinks[e];break;default:throw new Error("Unexpected stream case")}},BM=async function(t,e){var i,r,o;await Promise.allSettled([(i=t.startCall)==null?void 0:i.promise,(r=t.pullCall)==null?void 0:r.promise,(o=t.cancelCall)==null?void 0:o.promise]),delete this.streamControllers[e]},A4e);var Ov,EM;class aki{constructor({parsedData:e,rawData:i}){ce(this,Ov),ce(this,EM),ie(this,Ov,e),ie(this,EM,i)}getRaw(){return M(this,EM)}get(e){return M(this,Ov).get(e)??null}getAll(){return Wj(M(this,Ov))}has(e){return M(this,Ov).has(e)}}Ov=new WeakMap,EM=new WeakMap;const i0=Symbol("INTERNAL");var kM,xM,QM,ay;class lki{constructor(e,{name:i,intent:r,usage:o}){ce(this,kM,!1),ce(this,xM,!1),ce(this,QM,!1),ce(this,ay,!0),ie(this,kM,!!(e&xl.DISPLAY)),ie(this,xM,!!(e&xl.PRINT)),this.name=i,this.intent=r,this.usage=o}get visible(){if(M(this,QM))return M(this,ay);if(!M(this,ay))return!1;const{print:e,view:i}=this.usage;return M(this,kM)?i?.viewState!=="OFF":M(this,xM)?e?.printState!=="OFF":!0}_setVisible(e,i,r=!1){e!==i0&&nn("Internal method `_setVisible` called."),ie(this,QM,r),ie(this,ay,i)}}kM=new WeakMap,xM=new WeakMap,QM=new WeakMap,ay=new WeakMap;var _g,Nr,ly,cy,MM,HV;class cki{constructor(e,i=xl.DISPLAY){if(ce(this,MM),ce(this,_g,null),ce(this,Nr,new Map),ce(this,ly,null),ce(this,cy,null),this.renderingIntent=i,this.name=null,this.creator=null,e!==null){this.name=e.name,this.creator=e.creator,ie(this,cy,e.order);for(const r of e.groups)M(this,Nr).set(r.id,new lki(i,r));if(e.baseState==="OFF")for(const r of M(this,Nr).values())r._setVisible(i0,!1);for(const r of e.on)M(this,Nr).get(r)._setVisible(i0,!0);for(const r of e.off)M(this,Nr).get(r)._setVisible(i0,!1);ie(this,ly,this.getHash())}}isVisible(e){if(M(this,Nr).size===0)return!0;if(!e)return NQ("Optional content group not defined."),!0;if(e.type==="OCG")return M(this,Nr).has(e.id)?M(this,Nr).get(e.id).visible:(Hi(`Optional content group not found: ${e.id}`),!0);if(e.type==="OCMD"){if(e.expression)return $(this,MM,HV).call(this,e.expression);if(!e.policy||e.policy==="AnyOn"){for(const i of e.ids){if(!M(this,Nr).has(i))return Hi(`Optional content group not found: ${i}`),!0;if(M(this,Nr).get(i).visible)return!0}return!1}else if(e.policy==="AllOn"){for(const i of e.ids){if(!M(this,Nr).has(i))return Hi(`Optional content group not found: ${i}`),!0;if(!M(this,Nr).get(i).visible)return!1}return!0}else if(e.policy==="AnyOff"){for(const i of e.ids){if(!M(this,Nr).has(i))return Hi(`Optional content group not found: ${i}`),!0;if(!M(this,Nr).get(i).visible)return!0}return!1}else if(e.policy==="AllOff"){for(const i of e.ids){if(!M(this,Nr).has(i))return Hi(`Optional content group not found: ${i}`),!0;if(M(this,Nr).get(i).visible)return!1}return!0}return Hi(`Unknown optional content policy ${e.policy}.`),!0}return Hi(`Unknown group type ${e.type}.`),!0}setVisibility(e,i=!0){const r=M(this,Nr).get(e);if(!r){Hi(`Optional content group not found: ${e}`);return}r._setVisible(i0,!!i,!0),ie(this,_g,null)}setOCGState({state:e,preserveRB:i}){let r;for(const o of e){switch(o){case"ON":case"OFF":case"Toggle":r=o;continue}const s=M(this,Nr).get(o);if(s)switch(r){case"ON":s._setVisible(i0,!0);break;case"OFF":s._setVisible(i0,!1);break;case"Toggle":s._setVisible(i0,!s.visible);break}}ie(this,_g,null)}get hasInitialVisibility(){return M(this,ly)===null||this.getHash()===M(this,ly)}getOrder(){return M(this,Nr).size?M(this,cy)?M(this,cy).slice():[...M(this,Nr).keys()]:null}getGroups(){return M(this,Nr).size>0?Wj(M(this,Nr)):null}getGroup(e){return M(this,Nr).get(e)||null}getHash(){if(M(this,_g)!==null)return M(this,_g);const e=new Jve;for(const[i,r]of M(this,Nr))e.update(`${i}:${r.visible}`);return ie(this,_g,e.hexdigest())}}_g=new WeakMap,Nr=new WeakMap,ly=new WeakMap,cy=new WeakMap,MM=new WeakSet,HV=function(t){const e=t.length;if(e<2)return!0;const i=t[0];for(let r=1;r<e;r++){const o=t[r];let s;if(Array.isArray(o))s=$(this,MM,HV).call(this,o);else if(M(this,Nr).has(o))s=M(this,Nr).get(o).visible;else return Hi(`Optional content group not found: ${o}`),!0;switch(i){case"And":if(!s)return!1;break;case"Or":if(s)return!0;break;case"Not":return!s;default:return!0}}return i==="And"};class dki{constructor(e,{disableRange:i=!1,disableStream:r=!1}){yn(e,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');const{length:o,initialData:s,progressiveDone:n,contentDispositionFilename:a}=e;if(this._queuedChunks=[],this._progressiveDone=n,this._contentDispositionFilename=a,s?.length>0){const l=s instanceof Uint8Array&&s.byteLength===s.buffer.byteLength?s.buffer:new Uint8Array(s).buffer;this._queuedChunks.push(l)}this._pdfDataRangeTransport=e,this._isStreamingSupported=!r,this._isRangeSupported=!i,this._contentLength=o,this._fullRequestReader=null,this._rangeReaders=[],e.addRangeListener((l,c)=>{this._onReceiveData({begin:l,chunk:c})}),e.addProgressListener((l,c)=>{this._onProgress({loaded:l,total:c})}),e.addProgressiveReadListener(l=>{this._onReceiveData({chunk:l})}),e.addProgressiveDoneListener(()=>{this._onProgressiveDone()}),e.transportReady()}_onReceiveData({begin:e,chunk:i}){const r=i instanceof Uint8Array&&i.byteLength===i.buffer.byteLength?i.buffer:new Uint8Array(i).buffer;if(e===void 0)this._fullRequestReader?this._fullRequestReader._enqueue(r):this._queuedChunks.push(r);else{const o=this._rangeReaders.some(function(s){return s._begin!==e?!1:(s._enqueue(r),!0)});yn(o,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){var e;return((e=this._fullRequestReader)==null?void 0:e._loaded)??0}_onProgress(e){var i,r,o,s;e.total===void 0?(r=(i=this._rangeReaders[0])==null?void 0:i.onProgress)==null||r.call(i,{loaded:e.loaded}):(s=(o=this._fullRequestReader)==null?void 0:o.onProgress)==null||s.call(o,{loaded:e.loaded,total:e.total})}_onProgressiveDone(){var e;(e=this._fullRequestReader)==null||e.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(e){const i=this._rangeReaders.indexOf(e);i>=0&&this._rangeReaders.splice(i,1)}getFullReader(){yn(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const e=this._queuedChunks;return this._queuedChunks=null,new Aki(this,e,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(e,i){if(i<=this._progressiveDataLength)return null;const r=new uki(this,e,i);return this._pdfDataRangeTransport.requestDataRange(e,i),this._rangeReaders.push(r),r}cancelAllRequests(e){var i;(i=this._fullRequestReader)==null||i.cancel(e);for(const r of this._rangeReaders.slice(0))r.cancel(e);this._pdfDataRangeTransport.abort()}}class Aki{constructor(e,i,r=!1,o=null){this._stream=e,this._done=r||!1,this._filename=nV(o)?o:null,this._queuedChunks=i||[],this._loaded=0;for(const s of this._queuedChunks)this._loaded+=s.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=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(const i of this._requests)i.resolve({value:void 0,done:!0});this._requests.length=0}progressiveDone(){this._done||(this._done=!0)}}class uki{constructor(e,i,r){this._stream=e,this._begin=i,this._end=r,this._queuedChunk=null,this._requests=[],this._done=!1,this.onProgress=null}_enqueue(e){if(!this._done){if(this._requests.length===0)this._queuedChunk=e;else{this._requests.shift().resolve({value:e,done:!1});for(const i of this._requests)i.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 i=this._queuedChunk;return this._queuedChunk=null,{value:i,done:!1}}if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(const i of this._requests)i.resolve({value:void 0,done:!0});this._requests.length=0,this._stream._removeRangeReader(this)}}function hki(t){let e=!0,i=r("filename\\*","i").exec(t);if(i){i=i[1];let d=a(i);return d=unescape(d),d=l(d),d=c(d),s(d)}if(i=n(t),i){const d=c(i);return s(d)}if(i=r("filename","i").exec(t),i){i=i[1];let d=a(i);return d=c(d),s(d)}function r(d,A){return new RegExp("(?:^|;)\\s*"+d+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',A)}function o(d,A){if(d){if(!/^[\x00-\xFF]+$/.test(A))return A;try{const u=new TextDecoder(d,{fatal:!0}),h=OQ(A);A=u.decode(h),e=!1}catch{}}return A}function s(d){return e&&/[\x80-\xff]/.test(d)&&(d=o("utf-8",d),e&&(d=o("iso-8859-1",d))),d}function n(d){const A=[];let u;const h=r("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(u=h.exec(d))!==null;){let[,p,m,f]=u;if(p=parseInt(p,10),p in A){if(p===0)break;continue}A[p]=[m,f]}const g=[];for(let p=0;p<A.length&&p in A;++p){let[m,f]=A[p];f=a(f),m&&(f=unescape(f),p===0&&(f=l(f))),g.push(f)}return g.join("")}function a(d){if(d.startsWith('"')){const A=d.slice(1).split('\\"');for(let u=0;u<A.length;++u){const h=A[u].indexOf('"');h!==-1&&(A[u]=A[u].slice(0,h),A.length=u+1),A[u]=A[u].replaceAll(/\\(.)/g,"$1")}d=A.join('"')}return d}function l(d){const A=d.indexOf("'");if(A===-1)return d;const u=d.slice(0,A),h=d.slice(A+1).replace(/^[^']*'/,"");return o(u,h)}function c(d){return!d.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(d)?d:d.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(A,u,h,g){if(h==="q"||h==="Q")return g=g.replaceAll("_"," "),g=g.replaceAll(/=([0-9a-fA-F]{2})/g,function(p,m){return String.fromCharCode(parseInt(m,16))}),o(u,g);try{g=atob(g)}catch{}return o(u,g)})}return""}function GV({getResponseHeader:t,isHttp:e,rangeChunkSize:i,disableRange:r}){const o={allowRangeRequests:!1,suggestedLength:void 0},s=parseInt(t("Content-Length"),10);return!Number.isInteger(s)||(o.suggestedLength=s,s<=2*i)||r||!e||t("Accept-Ranges")!=="bytes"||(t("Content-Encoding")||"identity")!=="identity"||(o.allowRangeRequests=!0),o}function jV(t){const e=t("Content-Disposition");if(e){let i=hki(e);if(i.includes("%"))try{i=decodeURIComponent(i)}catch{}if(nV(i))return i}return null}function SM(t,e){return t===404||t===0&&e.startsWith("file:")?new Sg('Missing PDF "'+e+'".'):new UQ(`Unexpected server response (${t}) while retrieving PDF "${e}".`,t)}function u4e(t){return t===200||t===206}function h4e(t,e,i){return{method:"GET",headers:t,signal:i.signal,mode:"cors",credentials:e?"include":"same-origin",redirect:"follow"}}function p4e(t){const e=new Headers;for(const i in t){const r=t[i];r!==void 0&&e.append(i,r)}return e}function g4e(t){return t instanceof Uint8Array?t.buffer:t instanceof ArrayBuffer?t:(Hi(`getArrayBuffer - unexpected data format: ${t}`),new Uint8Array(t).buffer)}class f4e{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(){var e;return((e=this._fullRequestReader)==null?void 0:e._loaded)??0}getFullReader(){return yn(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new pki(this),this._fullRequestReader}getRangeReader(e,i){if(i<=this._progressiveDataLength)return null;const r=new gki(this,e,i);return this._rangeRequestReaders.push(r),r}cancelAllRequests(e){var i;(i=this._fullRequestReader)==null||i.cancel(e);for(const r of this._rangeRequestReaders.slice(0))r.cancel(e)}}class pki{constructor(e){this._stream=e,this._reader=null,this._loaded=0,this._filename=null;const i=e.source;this._withCredentials=i.withCredentials||!1,this._contentLength=i.length,this._headersCapability=Promise.withResolvers(),this._disableRange=i.disableRange||!1,this._rangeChunkSize=i.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._abortController=new AbortController,this._isStreamingSupported=!i.disableStream,this._isRangeSupported=!i.disableRange,this._headers=p4e(this._stream.httpHeaders);const r=i.url;fetch(r,h4e(this._headers,this._withCredentials,this._abortController)).then(o=>{if(!u4e(o.status))throw SM(o.status,r);this._reader=o.body.getReader(),this._headersCapability.resolve();const s=l=>o.headers.get(l),{allowRangeRequests:n,suggestedLength:a}=GV({getResponseHeader:s,isHttp:this._stream.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=n,this._contentLength=a||this._contentLength,this._filename=jV(s),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new Dg("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(){var e;await this._headersCapability.promise;const{value:i,done:r}=await this._reader.read();return r?{value:i,done:r}:(this._loaded+=i.byteLength,(e=this.onProgress)==null||e.call(this,{loaded:this._loaded,total:this._contentLength}),{value:g4e(i),done:!1})}cancel(e){var i;(i=this._reader)==null||i.cancel(e),this._abortController.abort()}}class gki{constructor(e,i,r){this._stream=e,this._reader=null,this._loaded=0;const o=e.source;this._withCredentials=o.withCredentials||!1,this._readCapability=Promise.withResolvers(),this._isStreamingSupported=!o.disableStream,this._abortController=new AbortController,this._headers=p4e(this._stream.httpHeaders),this._headers.append("Range",`bytes=${i}-${r-1}`);const s=o.url;fetch(s,h4e(this._headers,this._withCredentials,this._abortController)).then(n=>{if(!u4e(n.status))throw SM(n.status,s);this._readCapability.resolve(),this._reader=n.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){var e;await this._readCapability.promise;const{value:i,done:r}=await this._reader.read();return r?{value:i,done:r}:(this._loaded+=i.byteLength,(e=this.onProgress)==null||e.call(this,{loaded:this._loaded}),{value:g4e(i),done:!1})}cancel(e){var i;(i=this._reader)==null||i.cancel(e),this._abortController.abort()}}const VV=200,qV=206;function fki(t){const e=t.response;return typeof e!="string"?e:OQ(e).buffer}class mki{constructor(e,i={}){this.url=e,this.isHttp=/^https?:/i.test(e),this.httpHeaders=this.isHttp&&i.httpHeaders||Object.create(null),this.withCredentials=i.withCredentials||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}requestRange(e,i,r){const o={begin:e,end:i};for(const s in r)o[s]=r[s];return this.request(o)}requestFull(e){return this.request(e)}request(e){const i=new XMLHttpRequest,r=this.currXhrId++,o=this.pendingRequests[r]={xhr:i};i.open("GET",this.url),i.withCredentials=this.withCredentials;for(const s in this.httpHeaders){const n=this.httpHeaders[s];n!==void 0&&i.setRequestHeader(s,n)}return this.isHttp&&"begin"in e&&"end"in e?(i.setRequestHeader("Range",`bytes=${e.begin}-${e.end-1}`),o.expectedStatus=qV):o.expectedStatus=VV,i.responseType="arraybuffer",e.onError&&(i.onerror=function(s){e.onError(i.status)}),i.onreadystatechange=this.onStateChange.bind(this,r),i.onprogress=this.onProgress.bind(this,r),o.onHeadersReceived=e.onHeadersReceived,o.onDone=e.onDone,o.onError=e.onError,o.onProgress=e.onProgress,i.send(null),r}onProgress(e,i){var r;const o=this.pendingRequests[e];o&&((r=o.onProgress)==null||r.call(o,i))}onStateChange(e,i){var r,o,s;const n=this.pendingRequests[e];if(!n)return;const a=n.xhr;if(a.readyState>=2&&n.onHeadersReceived&&(n.onHeadersReceived(),delete n.onHeadersReceived),a.readyState!==4||!(e in this.pendingRequests))return;if(delete this.pendingRequests[e],a.status===0&&this.isHttp){(r=n.onError)==null||r.call(n,a.status);return}const l=a.status||VV;if(!(l===VV&&n.expectedStatus===qV)&&l!==n.expectedStatus){(o=n.onError)==null||o.call(n,a.status);return}const c=fki(a);if(l===qV){const d=a.getResponseHeader("Content-Range"),A=/bytes (\d+)-(\d+)\/(\d+)/.exec(d);n.onDone({begin:parseInt(A[1],10),chunk:c})}else c?n.onDone({begin:0,chunk:c}):(s=n.onError)==null||s.call(n,a.status)}getRequestXhr(e){return this.pendingRequests[e].xhr}isPendingRequest(e){return e in this.pendingRequests}abortRequest(e){const i=this.pendingRequests[e].xhr;delete this.pendingRequests[e],i.abort()}}class vki{constructor(e){this._source=e,this._manager=new mki(e.url,{httpHeaders:e.httpHeaders,withCredentials:e.withCredentials}),this._rangeChunkSize=e.rangeChunkSize,this._fullRequestReader=null,this._rangeRequestReaders=[]}_onRangeRequestReaderClosed(e){const i=this._rangeRequestReaders.indexOf(e);i>=0&&this._rangeRequestReaders.splice(i,1)}getFullReader(){return yn(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new Cki(this._manager,this._source),this._fullRequestReader}getRangeReader(e,i){const r=new yki(this._manager,e,i);return r.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(r),r}cancelAllRequests(e){var i;(i=this._fullRequestReader)==null||i.cancel(e);for(const r of this._rangeRequestReaders.slice(0))r.cancel(e)}}class Cki{constructor(e,i){this._manager=e;const r={onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=i.url,this._fullRequestId=e.requestFull(r),this._headersReceivedCapability=Promise.withResolvers(),this._disableRange=i.disableRange||!1,this._contentLength=i.length,this._rangeChunkSize=i.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,i=this._manager.getRequestXhr(e),r=n=>i.getResponseHeader(n),{allowRangeRequests:o,suggestedLength:s}=GV({getResponseHeader:r,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});o&&(this._isRangeSupported=!0),this._contentLength=s||this._contentLength,this._filename=jV(r),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 i of this._requests)i.resolve({value:void 0,done:!0});this._requests.length=0}}_onError(e){this._storedError=SM(e,this._url),this._headersReceivedCapability.reject(this._storedError);for(const i of this._requests)i.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(e){var i;(i=this.onProgress)==null||i.call(this,{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=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0,this._headersReceivedCapability.reject(e);for(const i of this._requests)i.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._fullRequestId)&&this._manager.abortRequest(this._fullRequestId),this._fullRequestReader=null}}class yki{constructor(e,i,r){this._manager=e;const o={onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)};this._url=e.url,this._requestId=e.requestRange(i,r,o),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_close(){var e;(e=this.onClosed)==null||e.call(this,this)}_onDone(e){const i=e.chunk;this._requests.length>0?this._requests.shift().resolve({value:i,done:!1}):this._queuedChunk=i,this._done=!0;for(const r of this._requests)r.resolve({value:void 0,done:!0});this._requests.length=0,this._close()}_onError(e){this._storedError=SM(e,this._url);for(const i of this._requests)i.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(e){var i;this.isStreamingSupported||(i=this.onProgress)==null||i.call(this,{loaded:e.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(this._queuedChunk!==null){const i=this._queuedChunk;return this._queuedChunk=null,{value:i,done:!1}}if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0;for(const i of this._requests)i.resolve({value:void 0,done:!0});this._requests.length=0,this._manager.isPendingRequest(this._requestId)&&this._manager.abortRequest(this._requestId),this._close()}}const Iki=/^[a-z][a-z0-9\-+.]+:/i;function wki(t){if(Iki.test(t))return new URL(t);const e=e0.get("url");return new URL(e.pathToFileURL(t))}function m4e(t,e,i){return t.protocol==="http:"?e0.get("http").request(t,{headers:e},i):e0.get("https").request(t,{headers:e},i)}class bki{constructor(e){this.source=e,this.url=wki(e.url),this.isHttp=this.url.protocol==="http:"||this.url.protocol==="https:",this.isFsUrl=this.url.protocol==="file:",this.httpHeaders=this.isHttp&&e.httpHeaders||{},this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){var e;return((e=this._fullRequestReader)==null?void 0:e._loaded)??0}getFullReader(){return yn(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=this.isFsUrl?new kki(this):new Bki(this),this._fullRequestReader}getRangeReader(e,i){if(i<=this._progressiveDataLength)return null;const r=this.isFsUrl?new xki(this,e,i):new Eki(this,e,i);return this._rangeRequestReaders.push(r),r}cancelAllRequests(e){var i;(i=this._fullRequestReader)==null||i.cancel(e);for(const r of this._rangeRequestReaders.slice(0))r.cancel(e)}}class v4e{constructor(e){this._url=e.url,this._done=!1,this._storedError=null,this.onProgress=null;const i=e.source;this._contentLength=i.length,this._loaded=0,this._filename=null,this._disableRange=i.disableRange||!1,this._rangeChunkSize=i.rangeChunkSize,!this._rangeChunkSize&&!this._disableRange&&(this._disableRange=!0),this._isStreamingSupported=!i.disableStream,this._isRangeSupported=!i.disableRange,this._readableStream=null,this._readCapability=Promise.withResolvers(),this._headersCapability=Promise.withResolvers()}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(){var e;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const i=this._readableStream.read();return i===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=i.length,(e=this.onProgress)==null||e.call(this,{loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(i).buffer,done:!1})}cancel(e){if(!this._readableStream){this._error(e);return}this._readableStream.destroy(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",i=>{this._error(i)}),!this._isStreamingSupported&&this._isRangeSupported&&this._error(new Dg("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class C4e{constructor(e){this._url=e.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=Promise.withResolvers();const i=e.source;this._isStreamingSupported=!i.disableStream}get isStreamingSupported(){return this._isStreamingSupported}async read(){var e;if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const i=this._readableStream.read();return i===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=i.length,(e=this.onProgress)==null||e.call(this,{loaded:this._loaded}),{value:new Uint8Array(i).buffer,done:!1})}cancel(e){if(!this._readableStream){this._error(e);return}this._readableStream.destroy(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",i=>{this._error(i)}),this._storedError&&this._readableStream.destroy(this._storedError)}}class Bki extends v4e{constructor(e){super(e);const i=r=>{if(r.statusCode===404){const a=new Sg(`Missing PDF "${this._url}".`);this._storedError=a,this._headersCapability.reject(a);return}this._headersCapability.resolve(),this._setReadableStream(r);const o=a=>this._readableStream.headers[a.toLowerCase()],{allowRangeRequests:s,suggestedLength:n}=GV({getResponseHeader:o,isHttp:e.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=s,this._contentLength=n||this._contentLength,this._filename=jV(o)};this._request=m4e(this._url,e.httpHeaders,i),this._request.on("error",r=>{this._storedError=r,this._headersCapability.reject(r)}),this._request.end()}}class Eki extends C4e{constructor(e,i,r){super(e),this._httpHeaders={};for(const s in e.httpHeaders){const n=e.httpHeaders[s];n!==void 0&&(this._httpHeaders[s]=n)}this._httpHeaders.Range=`bytes=${i}-${r-1}`;const o=s=>{if(s.statusCode===404){const n=new Sg(`Missing PDF "${this._url}".`);this._storedError=n;return}this._setReadableStream(s)};this._request=m4e(this._url,this._httpHeaders,o),this._request.on("error",s=>{this._storedError=s}),this._request.end()}}class kki extends v4e{constructor(e){super(e);const i=e0.get("fs");i.promises.lstat(this._url).then(r=>{this._contentLength=r.size,this._setReadableStream(i.createReadStream(this._url)),this._headersCapability.resolve()},r=>{r.code==="ENOENT"&&(r=new Sg(`Missing PDF "${this._url}".`)),this._storedError=r,this._headersCapability.reject(r)})}}class xki extends C4e{constructor(e,i,r){super(e);const o=e0.get("fs");this._setReadableStream(o.createReadStream(this._url,{start:i,end:r-1}))}}const Qki=1e5,Ja=30,Mki=.8;var y4e,zg,Sl,DM,PM,Kg,r0,RM,LM,Hv,dy,Ay,Jg,uy,FM,hy,Gv,TM,NM,jv,Vv,Yg,py,qv,I4e,w4e,_V,Wg,UM,b4e,B4e;const od=class ZI{constructor({textContentSource:e,container:i,viewport:r}){ce(this,qv),ce(this,zg,Promise.withResolvers()),ce(this,Sl,null),ce(this,DM,!1),ce(this,PM,!!((y4e=globalThis.FontInspector)!=null&&y4e.enabled)),ce(this,Kg,null),ce(this,r0,null),ce(this,RM,0),ce(this,LM,0),ce(this,Hv,null),ce(this,dy,null),ce(this,Ay,0),ce(this,Jg,0),ce(this,uy,Object.create(null)),ce(this,FM,[]),ce(this,hy,null),ce(this,Gv,[]),ce(this,TM,new WeakMap),ce(this,NM,null);var o;if(e instanceof ReadableStream)ie(this,hy,e);else if(typeof e=="object")ie(this,hy,new ReadableStream({start(c){c.enqueue(e),c.close()}}));else throw new Error('No "textContentSource" parameter specified.');ie(this,Sl,ie(this,dy,i)),ie(this,Jg,r.scale*(globalThis.devicePixelRatio||1)),ie(this,Ay,r.rotation),ie(this,r0,{prevFontSize:null,prevFontFamily:null,div:null,properties:null,ctx:null});const{pageWidth:s,pageHeight:n,pageX:a,pageY:l}=r.rawDims;ie(this,NM,[1,0,0,-1,-a,l+n]),ie(this,LM,s),ie(this,RM,n),$(o=ZI,Wg,b4e).call(o),Lg(i,r),M(this,zg).promise.catch(()=>{}).then(()=>{M(ZI,py).delete(this),ie(this,r0,null),ie(this,uy,null)})}render(){const e=()=>{M(this,Hv).read().then(({value:i,done:r})=>{if(r){M(this,zg).resolve();return}M(this,Kg)??ie(this,Kg,i.lang),Object.assign(M(this,uy),i.styles),$(this,qv,I4e).call(this,i.items),e()},M(this,zg).reject)};return ie(this,Hv,M(this,hy).getReader()),M(ZI,py).add(this),e(),M(this,zg).promise}update({viewport:e,onBefore:i=null}){var r;const o=e.scale*(globalThis.devicePixelRatio||1),s=e.rotation;if(s!==M(this,Ay)&&(i?.(),ie(this,Ay,s),Lg(M(this,dy),{rotation:s})),o!==M(this,Jg)){i?.(),ie(this,Jg,o);const n={prevFontSize:null,prevFontFamily:null,div:null,properties:null,ctx:$(r=ZI,Wg,UM).call(r,M(this,Kg))};for(const a of M(this,Gv))n.properties=M(this,TM).get(a),n.div=a,$(this,qv,_V).call(this,n)}}cancel(){var e;const i=new Dg("TextLayer task cancelled.");(e=M(this,Hv))==null||e.cancel(i).catch(()=>{}),ie(this,Hv,null),M(this,zg).reject(i)}get textDivs(){return M(this,Gv)}get textContentItemsStr(){return M(this,FM)}static cleanup(){if(!(M(this,py).size>0)){M(this,jv).clear();for(const{canvas:e}of M(this,Vv).values())e.remove();M(this,Vv).clear()}}};zg=new WeakMap,Sl=new WeakMap,DM=new WeakMap,PM=new WeakMap,Kg=new WeakMap,r0=new WeakMap,RM=new WeakMap,LM=new WeakMap,Hv=new WeakMap,dy=new WeakMap,Ay=new WeakMap,Jg=new WeakMap,uy=new WeakMap,FM=new WeakMap,hy=new WeakMap,Gv=new WeakMap,TM=new WeakMap,NM=new WeakMap,jv=new WeakMap,Vv=new WeakMap,Yg=new WeakMap,py=new WeakMap,qv=new WeakSet,I4e=function(t){var e,i;if(M(this,DM))return;(i=M(this,r0)).ctx??(i.ctx=$(e=od,Wg,UM).call(e,M(this,Kg)));const r=M(this,Gv),o=M(this,FM);for(const s of t){if(r.length>Qki){Hi("Ignoring additional textDivs for performance reasons."),ie(this,DM,!0);return}if(s.str===void 0){if(s.type==="beginMarkedContentProps"||s.type==="beginMarkedContent"){const n=M(this,Sl);ie(this,Sl,document.createElement("span")),M(this,Sl).classList.add("markedContent"),s.id!==null&&M(this,Sl).setAttribute("id",`${s.id}`),n.append(M(this,Sl))}else s.type==="endMarkedContent"&&ie(this,Sl,M(this,Sl).parentNode);continue}o.push(s.str),$(this,qv,w4e).call(this,s)}},w4e=function(t){var e;const i=document.createElement("span"),r={angle:0,canvasWidth:0,hasText:t.str!=="",hasEOL:t.hasEOL,fontSize:0};M(this,Gv).push(i);const o=ti.transform(M(this,NM),t.transform);let s=Math.atan2(o[1],o[0]);const n=M(this,uy)[t.fontName];n.vertical&&(s+=Math.PI/2);const a=M(this,PM)&&n.fontSubstitution||n.fontFamily,l=Math.hypot(o[2],o[3]),c=l*$(e=od,Wg,B4e).call(e,a,M(this,Kg));let d,A;s===0?(d=o[4],A=o[5]-c):(d=o[4]+c*Math.sin(s),A=o[5]-c*Math.cos(s));const u="calc(var(--scale-factor)*",h=i.style;M(this,Sl)===M(this,dy)?(h.left=`${(100*d/M(this,LM)).toFixed(2)}%`,h.top=`${(100*A/M(this,RM)).toFixed(2)}%`):(h.left=`${u}${d.toFixed(2)}px)`,h.top=`${u}${A.toFixed(2)}px)`),h.fontSize=`${u}${(M(od,Yg)*l).toFixed(2)}px)`,h.fontFamily=a,r.fontSize=l,i.setAttribute("role","presentation"),i.textContent=t.str,i.dir=t.dir,M(this,PM)&&(i.dataset.fontName=n.fontSubstitutionLoadedName||t.fontName),s!==0&&(r.angle=s*(180/Math.PI));let g=!1;if(t.str.length>1)g=!0;else if(t.str!==" "&&t.transform[0]!==t.transform[3]){const p=Math.abs(t.transform[0]),m=Math.abs(t.transform[3]);p!==m&&Math.max(p,m)/Math.min(p,m)>1.5&&(g=!0)}if(g&&(r.canvasWidth=n.vertical?t.height:t.width),M(this,TM).set(i,r),M(this,r0).div=i,M(this,r0).properties=r,$(this,qv,_V).call(this,M(this,r0)),r.hasText&&M(this,Sl).append(i),r.hasEOL){const p=document.createElement("br");p.setAttribute("role","presentation"),M(this,Sl).append(p)}},_V=function(t){const{div:e,properties:i,ctx:r,prevFontSize:o,prevFontFamily:s}=t,{style:n}=e;let a="";if(M(od,Yg)>1&&(a=`scale(${1/M(od,Yg)})`),i.canvasWidth!==0&&i.hasText){const{fontFamily:l}=n,{canvasWidth:c,fontSize:d}=i;(o!==d||s!==l)&&(r.font=`${d*M(this,Jg)}px ${l}`,t.prevFontSize=d,t.prevFontFamily=l);const{width:A}=r.measureText(e.textContent);A>0&&(a=`scaleX(${c*M(this,Jg)/A}) ${a}`)}i.angle!==0&&(a=`rotate(${i.angle}deg) ${a}`),a.length>0&&(n.transform=a)},Wg=new WeakSet,UM=function(t=null){let e=M(this,Vv).get(t||(t=""));if(!e){const i=document.createElement("canvas");i.className="hiddenCanvasElement",i.lang=t,document.body.append(i),e=i.getContext("2d",{alpha:!1,willReadFrequently:!0}),M(this,Vv).set(t,e)}return e},b4e=function(){if(M(this,Yg)!==null)return;const t=document.createElement("div");t.style.opacity=0,t.style.lineHeight=1,t.style.fontSize="1px",t.style.position="absolute",t.textContent="X",document.body.append(t),ie(this,Yg,t.getBoundingClientRect().height),t.remove()},B4e=function(t,e){const i=M(this,jv).get(t);if(i)return i;const r=$(this,Wg,UM).call(this,e),o=r.font;r.canvas.width=r.canvas.height=Ja,r.font=`${Ja}px ${t}`;const s=r.measureText("");let n=s.fontBoundingBoxAscent,a=Math.abs(s.fontBoundingBoxDescent);if(n){const d=n/(n+a);return M(this,jv).set(t,d),r.canvas.width=r.canvas.height=0,r.font=o,d}r.strokeStyle="red",r.clearRect(0,0,Ja,Ja),r.strokeText("g",0,0);let l=r.getImageData(0,0,Ja,Ja).data;a=0;for(let d=l.length-1-3;d>=0;d-=4)if(l[d]>0){a=Math.ceil(d/4/Ja);break}r.clearRect(0,0,Ja,Ja),r.strokeText("A",0,Ja),l=r.getImageData(0,0,Ja,Ja).data,n=0;for(let d=0,A=l.length;d<A;d+=4)if(l[d]>0){n=Ja-Math.floor(d/4/Ja);break}r.canvas.width=r.canvas.height=0,r.font=o;const c=n?n/(n+a):Mki;return M(this,jv).set(t,c),c},ce(od,Wg),ce(od,jv,new Map),ce(od,Vv,new Map),ce(od,Yg,null),ce(od,py,new Set);let zV=od;class sw{static textContent(e){const i=[],r={items:i,styles:Object.create(null)};function o(s){var n;if(!s)return;let a=null;const l=s.name;if(l==="#text")a=s.value;else if(sw.shouldBuildText(l))(n=s?.attributes)!=null&&n.textContent?a=s.attributes.textContent:s.value&&(a=s.value);else return;if(a!==null&&i.push({str:a}),!!s.children)for(const c of s.children)o(c)}return o(e),r}static shouldBuildText(e){return!(e==="textarea"||e==="input"||e==="option"||e==="select")}}const Ski=65536,Dki=100,Pki=5e3,Rki=Ss?VEi:xEi,Lki=Ss?qEi:fve,Fki=Ss?jEi:kEi,Tki=Ss?_Ei:mve;function Nki(t={}){typeof t=="string"||t instanceof URL?t={url:t}:(t instanceof ArrayBuffer||ArrayBuffer.isView(t))&&(t={data:t});const e=new Hki,{docId:i}=e,r=t.url?Uki(t.url):null,o=t.data?Oki(t.data):null,s=t.httpHeaders||null,n=t.withCredentials===!0,a=t.password??null,l=t.range instanceof x4e?t.range:null,c=Number.isInteger(t.rangeChunkSize)&&t.rangeChunkSize>0?t.rangeChunkSize:Ski;let d=t.worker instanceof jM?t.worker:null;const A=t.verbosity,u=typeof t.docBaseUrl=="string"&&!_Q(t.docBaseUrl)?t.docBaseUrl:null,h=typeof t.cMapUrl=="string"?t.cMapUrl:null,g=t.cMapPacked!==!1,p=t.CMapReaderFactory||Lki,m=typeof t.standardFontDataUrl=="string"?t.standardFontDataUrl:null,f=t.StandardFontDataFactory||Tki,v=t.stopAtErrors!==!0,C=Number.isInteger(t.maxImageSize)&&t.maxImageSize>-1?t.maxImageSize:-1,y=t.isEvalSupported!==!1,I=typeof t.isOffscreenCanvasSupported=="boolean"?t.isOffscreenCanvasSupported:!Ss,B=Number.isInteger(t.canvasMaxAreaInBytes)?t.canvasMaxAreaInBytes:-1,E=typeof t.disableFontFace=="boolean"?t.disableFontFace:Ss,k=t.fontExtraProperties===!0,Q=t.enableXfa===!0,S=t.ownerDocument||globalThis.document,D=t.disableRange===!0,R=t.disableStream===!0,N=t.disableAutoFetch===!0,H=t.pdfBug===!0,q=t.enableHWA===!0,O=l?l.length:t.length??NaN,G=typeof t.useSystemFonts=="boolean"?t.useSystemFonts:!Ss&&!E,Z=typeof t.useWorkerFetch=="boolean"?t.useWorkerFetch:p===fve&&f===mve&&h&&m&&H7(h,document.baseURI)&&H7(m,document.baseURI),ae=t.canvasFactory||new Rki({ownerDocument:S,enableHWA:q}),ue=t.filterFactory||new Fki({docId:i,ownerDocument:S}),ke=null;pEi(A);const se={canvasFactory:ae,filterFactory:ue};if(Z||(se.cMapReaderFactory=new p({baseUrl:h,isCompressed:g}),se.standardFontDataFactory=new f({baseUrl:m})),!d){const Ne={verbosity:A,port:t0.workerPort};d=Ne.port?jM.fromPort(Ne):new jM(Ne),e._worker=d}const me={docId:i,apiVersion:"4.6.82",data:o,password:a,disableAutoFetch:N,rangeChunkSize:c,length:O,docBaseUrl:u,enableXfa:Q,evaluatorOptions:{maxImageSize:C,disableFontFace:E,ignoreErrors:v,isEvalSupported:y,isOffscreenCanvasSupported:I,canvasMaxAreaInBytes:B,fontExtraProperties:k,useSystemFonts:G,cMapUrl:Z?h:null,standardFontDataUrl:Z?m:null}},qe={disableFontFace:E,fontExtraProperties:k,ownerDocument:S,pdfBug:H,styleElement:ke,loadingParams:{disableAutoFetch:N,enableXfa:Q}};return d.promise.then(function(){if(e.destroyed)throw new Error("Loading aborted");if(d.destroyed)throw new Error("Worker was destroyed");const Ne=d.messageHandler.sendWithPromise("GetDocRequest",me,o?[o.buffer]:null);let De;if(l)De=new dki(l,{disableRange:D,disableStream:R});else if(!o){if(!r)throw new Error("getDocument - no `url` parameter provided.");De=(X=>Ss?function(){return typeof fetch<"u"&&typeof Response<"u"&&"body"in Response.prototype}()&&H7(X.url)?new f4e(X):new bki(X):H7(X.url)?new f4e(X):new vki(X))({url:r,length:O,httpHeaders:s,withCredentials:n,rangeChunkSize:c,disableRange:D,disableStream:R})}return Ne.then(X=>{if(e.destroyed)throw new Error("Loading aborted");if(d.destroyed)throw new Error("Worker was destroyed");const oe=new sy(i,X,d.port),ne=new qki(oe,e,De,qe,se);e._transport=ne,oe.send("Ready",null)})}).catch(e._capability.reject),e}function Uki(t){if(t instanceof URL)return t.href;try{return new URL(t,window.location).href}catch{if(Ss&&typeof t=="string")return t}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function Oki(t){if(Ss&&typeof Buffer<"u"&&t instanceof Buffer)throw new Error("Please provide binary data as `Uint8Array`, rather than `Buffer`.");if(t instanceof Uint8Array&&t.byteLength===t.buffer.byteLength)return t;if(typeof t=="string")return OQ(t);if(t instanceof ArrayBuffer||ArrayBuffer.isView(t)||typeof t=="object"&&!isNaN(t?.length))return new Uint8Array(t);throw new Error("Invalid PDF binary data: either TypedArray, string, or array-like object is expected in the data property.")}function E4e(t){return typeof t=="object"&&Number.isInteger(t?.num)&&t.num>=0&&Number.isInteger(t?.gen)&&t.gen>=0}var KV;const k4e=class SCe{constructor(){this._capability=Promise.withResolvers(),this._transport=null,this._worker=null,this.docId=`d${ol(SCe,KV)._++}`,this.destroyed=!1,this.onPassword=null,this.onProgress=null}get promise(){return this._capability.promise}async destroy(){var e,i,r;this.destroyed=!0;try{(e=this._worker)!=null&&e.port&&(this._worker._pendingDestroy=!0),await((i=this._transport)==null?void 0:i.destroy())}catch(o){throw(r=this._worker)!=null&&r.port&&delete this._worker._pendingDestroy,o}this._transport=null,this._worker&&(this._worker.destroy(),this._worker=null)}};KV=new WeakMap,ce(k4e,KV,0);let Hki=k4e;class x4e{constructor(e,i,r=!1,o=null){this.length=e,this.initialData=i,this.progressiveDone=r,this.contentDispositionFilename=o,this._rangeListeners=[],this._progressListeners=[],this._progressiveReadListeners=[],this._progressiveDoneListeners=[],this._readyCapability=Promise.withResolvers()}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,i){for(const r of this._rangeListeners)r(e,i)}onDataProgress(e,i){this._readyCapability.promise.then(()=>{for(const r of this._progressListeners)r(e,i)})}onDataProgressiveRead(e){this._readyCapability.promise.then(()=>{for(const i of this._progressiveReadListeners)i(e)})}onDataProgressiveDone(){this._readyCapability.promise.then(()=>{for(const e of this._progressiveDoneListeners)e()})}transportReady(){this._readyCapability.resolve()}requestDataRange(e,i){nn("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}class Gki{constructor(e,i){this._pdfInfo=e,this._transport=i}get annotationStorage(){return this._transport.annotationStorage}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return or(this,"isPureXfa",!!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()}getJSActions(){return this._transport.getDocJSActions()}getOutline(){return this._transport.getOutline()}getOptionalContentConfig({intent:e="display"}={}){const{renderingIntent:i}=this._transport.getRenderingIntent(e);return this._transport.getOptionalContentConfig(i)}getPermissions(){return this._transport.getPermissions()}getMetadata(){return this._transport.getMetadata()}getMarkInfo(){return this._transport.getMarkInfo()}getData(){return this._transport.getData()}saveDocument(){return this._transport.saveDocument()}getDownloadInfo(){return this._transport.downloadInfoCapability.promise}cleanup(e=!1){return this._transport.startCleanup(e||this.isPureXfa)}destroy(){return this.loadingTask.destroy()}cachedPageNumber(e){return this._transport.cachedPageNumber(e)}get loadingParams(){return this._transport.loadingParams}get loadingTask(){return this._transport.loadingTask}getFieldObjects(){return this._transport.getFieldObjects()}hasJSActions(){return this._transport.hasJSActions()}getCalculationOrderIds(){return this._transport.getCalculationOrderIds()}}var Zg,o0,dA,_v,OM;class jki{constructor(e,i,r,o=!1){ce(this,dA),ce(this,Zg,null),ce(this,o0,!1),this._pageIndex=e,this._pageInfo=i,this._transport=r,this._stats=o?new vve:null,this._pdfBug=o,this.commonObjs=r.commonObjs,this.objs=new Q4e,this._maybeCleanupAfterRender=!1,this._intentStates=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:i=this.rotate,offsetX:r=0,offsetY:o=0,dontFlip:s=!1}={}){return new nw({viewBox:this.view,scale:e,rotation:i,offsetX:r,offsetY:o,dontFlip:s})}getAnnotations({intent:e="display"}={}){const{renderingIntent:i}=this._transport.getRenderingIntent(e);return this._transport.getAnnotations(this._pageIndex,i)}getJSActions(){return this._transport.getPageJSActions(this._pageIndex)}get filterFactory(){return this._transport.filterFactory}get isPureXfa(){return or(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){var e;return((e=this._transport._htmlForXfa)==null?void 0:e.children[this._pageIndex])||null}render({canvasContext:e,viewport:i,intent:r="display",annotationMode:o=q1.ENABLE,transform:s=null,background:n=null,optionalContentConfigPromise:a=null,annotationCanvasMap:l=null,pageColors:c=null,printAnnotationStorage:d=null,isEditing:A=!1}){var u,h;(u=this._stats)==null||u.time("Overall");const g=this._transport.getRenderingIntent(r,o,d,A),{renderingIntent:p,cacheKey:m}=g;ie(this,o0,!1),$(this,dA,OM).call(this),a||(a=this._transport.getOptionalContentConfig(p));let f=this._intentStates.get(m);f||(f=Object.create(null),this._intentStates.set(m,f)),f.streamReaderCancelTimeout&&(clearTimeout(f.streamReaderCancelTimeout),f.streamReaderCancelTimeout=null);const v=!!(p&xl.PRINT);f.displayReadyCapability||(f.displayReadyCapability=Promise.withResolvers(),f.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(h=this._stats)==null||h.time("Page Request"),this._pumpOperatorList(g));const C=B=>{var E;f.renderTasks.delete(y),(this._maybeCleanupAfterRender||v)&&ie(this,o0,!0),$(this,dA,_v).call(this,!v),B?(y.capability.reject(B),this._abortOperatorList({intentState:f,reason:B instanceof Error?B:new Error(B)})):y.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),(E=globalThis.Stats)!=null&&E.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},y=new zki({callback:C,params:{canvasContext:e,viewport:i,transform:s,background:n},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:l,operatorList:f.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!v,pdfBug:this._pdfBug,pageColors:c});(f.renderTasks||(f.renderTasks=new Set)).add(y);const I=y.task;return Promise.all([f.displayReadyCapability.promise,a]).then(([B,E])=>{var k;if(this.destroyed){C();return}if((k=this._stats)==null||k.time("Rendering"),!(E.renderingIntent&p))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");y.initializeGraphics({transparency:B,optionalContentConfig:E}),y.operatorListChanged()}).catch(C),I}getOperatorList({intent:e="display",annotationMode:i=q1.ENABLE,printAnnotationStorage:r=null,isEditing:o=!1}={}){var s;function n(){l.operatorList.lastChunk&&(l.opListReadCapability.resolve(l.operatorList),l.renderTasks.delete(c))}const a=this._transport.getRenderingIntent(e,i,r,o,!0);let l=this._intentStates.get(a.cacheKey);l||(l=Object.create(null),this._intentStates.set(a.cacheKey,l));let c;return l.opListReadCapability||(c=Object.create(null),c.operatorListChanged=n,l.opListReadCapability=Promise.withResolvers(),(l.renderTasks||(l.renderTasks=new Set)).add(c),l.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},(s=this._stats)==null||s.time("Page Request"),this._pumpOperatorList(a)),l.opListReadCapability.promise}streamTextContent({includeMarkedContent:e=!1,disableNormalization:i=!1}={}){return this._transport.messageHandler.sendWithStream("GetTextContent",{pageIndex:this._pageIndex,includeMarkedContent:e===!0,disableNormalization:i===!0},{highWaterMark:100,size(r){return r.items.length}})}getTextContent(e={}){if(this._transport._htmlForXfa)return this.getXfa().then(r=>sw.textContent(r));const i=this.streamTextContent(e);return new Promise(function(r,o){function s(){n.read().then(function({value:l,done:c}){if(c){r(a);return}a.lang??(a.lang=l.lang),Object.assign(a.styles,l.styles),a.items.push(...l.items),s()},o)}const n=i.getReader(),a={items:[],styles:Object.create(null),lang:null};s()})}getStructTree(){return this._transport.getStructTree(this._pageIndex)}_destroy(){this.destroyed=!0;const e=[];for(const i of this._intentStates.values())if(this._abortOperatorList({intentState:i,reason:new Error("Page was destroyed."),force:!0}),!i.opListReadCapability)for(const r of i.renderTasks)e.push(r.completed),r.cancel();return this.objs.clear(),ie(this,o0,!1),$(this,dA,OM).call(this),Promise.all(e)}cleanup(e=!1){ie(this,o0,!0);const i=$(this,dA,_v).call(this,!1);return e&&i&&this._stats&&(this._stats=new vve),i}_startRenderPage(e,i){var r,o;const s=this._intentStates.get(i);s&&((r=this._stats)==null||r.timeEnd("Page Request"),(o=s.displayReadyCapability)==null||o.resolve(e))}_renderPageChunk(e,i){for(let r=0,o=e.length;r<o;r++)i.operatorList.fnArray.push(e.fnArray[r]),i.operatorList.argsArray.push(e.argsArray[r]);i.operatorList.lastChunk=e.lastChunk,i.operatorList.separateAnnots=e.separateAnnots;for(const r of i.renderTasks)r.operatorListChanged();e.lastChunk&&$(this,dA,_v).call(this,!0)}_pumpOperatorList({renderingIntent:e,cacheKey:i,annotationStorageSerializable:r,modifiedIds:o}){const{map:s,transfer:n}=r,a=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:e,cacheKey:i,annotationStorage:s,modifiedIds:o},n).getReader(),l=this._intentStates.get(i);l.streamReader=a;const c=()=>{a.read().then(({value:d,done:A})=>{if(A){l.streamReader=null;return}this._transport.destroyed||(this._renderPageChunk(d,l),c())},d=>{if(l.streamReader=null,!this._transport.destroyed){if(l.operatorList){l.operatorList.lastChunk=!0;for(const A of l.renderTasks)A.operatorListChanged();$(this,dA,_v).call(this,!0)}if(l.displayReadyCapability)l.displayReadyCapability.reject(d);else if(l.opListReadCapability)l.opListReadCapability.reject(d);else throw d}})};c()}_abortOperatorList({intentState:e,reason:i,force:r=!1}){if(e.streamReader){if(e.streamReaderCancelTimeout&&(clearTimeout(e.streamReaderCancelTimeout),e.streamReaderCancelTimeout=null),!r){if(e.renderTasks.size>0)return;if(i instanceof oV){let o=Dki;i.extraDelay>0&&i.extraDelay<1e3&&(o+=i.extraDelay),e.streamReaderCancelTimeout=setTimeout(()=>{e.streamReaderCancelTimeout=null,this._abortOperatorList({intentState:e,reason:i,force:!0})},o);return}}if(e.streamReader.cancel(new Dg(i.message)).catch(()=>{}),e.streamReader=null,!this._transport.destroyed){for(const[o,s]of this._intentStates)if(s===e){this._intentStates.delete(o);break}this.cleanup()}}}get stats(){return this._stats}}Zg=new WeakMap,o0=new WeakMap,dA=new WeakSet,_v=function(t=!1){if($(this,dA,OM).call(this),!M(this,o0)||this.destroyed)return!1;if(t)return ie(this,Zg,setTimeout(()=>{ie(this,Zg,null),$(this,dA,_v).call(this,!1)},Pki)),!1;for(const{renderTasks:e,operatorList:i}of this._intentStates.values())if(e.size>0||!i.lastChunk)return!1;return this._intentStates.clear(),this.objs.clear(),ie(this,o0,!1),!0},OM=function(){M(this,Zg)&&(clearTimeout(M(this,Zg)),ie(this,Zg,null))};var zv,JV;class Vki{constructor(){ce(this,zv,new Set),ce(this,JV,Promise.resolve())}postMessage(e,i){const r={data:structuredClone(e,i?{transfer:i}:null)};M(this,JV).then(()=>{for(const o of M(this,zv))o.call(this,r)})}addEventListener(e,i){M(this,zv).add(i)}removeEventListener(e,i){M(this,zv).delete(i)}terminate(){M(this,zv).clear()}}zv=new WeakMap,JV=new WeakMap;var YV,Kv,Xg,gy,HM,fy,GM;const n0=class ba{constructor({name:e=null,port:i=null,verbosity:r=gEi()}={}){ce(this,gy);var o;if(this.name=e,this.destroyed=!1,this.verbosity=r,this._readyCapability=Promise.withResolvers(),this._port=null,this._webWorker=null,this._messageHandler=null,i){if((o=M(ba,Xg))!=null&&o.has(i))throw new Error("Cannot use more than one PDFWorker per port.");(M(ba,Xg)||ie(ba,Xg,new WeakMap)).set(i,this),this._initializeFromPort(i);return}this._initialize()}get promise(){return Ss?Promise.all([e0.promise,this._readyCapability.promise]):this._readyCapability.promise}get port(){return this._port}get messageHandler(){return this._messageHandler}_initializeFromPort(e){this._port=e,this._messageHandler=new sy("main","worker",e),this._messageHandler.on("ready",function(){}),$(this,gy,HM).call(this)}_initialize(){if(M(ba,Kv)||M(ba,fy,GM)){this._setupFakeWorker();return}let{workerSrc:e}=ba;try{ba._isSameOrigin(window.location.href,e)||(e=ba._createCDNWrapper(new URL(e,window.location).href));const i=new Worker(e,{type:"module"}),r=new sy("main","worker",i),o=()=>{s.abort(),r.destroy(),i.terminate(),this.destroyed?this._readyCapability.reject(new Error("Worker was destroyed")):this._setupFakeWorker()},s=new AbortController;i.addEventListener("error",()=>{this._webWorker||o()},{signal:s.signal}),r.on("test",a=>{if(s.abort(),this.destroyed||!a){o();return}this._messageHandler=r,this._port=i,this._webWorker=i,$(this,gy,HM).call(this)}),r.on("ready",a=>{if(s.abort(),this.destroyed){o();return}try{n()}catch{this._setupFakeWorker()}});const n=()=>{const a=new Uint8Array;r.send("test",a,[a.buffer])};n();return}catch{NQ("The worker has been disabled.")}this._setupFakeWorker()}_setupFakeWorker(){M(ba,Kv)||(Hi("Setting up fake worker."),ie(ba,Kv,!0)),ba._setupFakeWorkerGlobal.then(e=>{if(this.destroyed){this._readyCapability.reject(new Error("Worker was destroyed"));return}const i=new Vki;this._port=i;const r=`fake${ol(ba,YV)._++}`,o=new sy(r+"_worker",r,i);e.setup(o,i),this._messageHandler=new sy(r,r+"_worker",i),$(this,gy,HM).call(this)}).catch(e=>{this._readyCapability.reject(new Error(`Setting up fake worker failed: "${e.message}".`))})}destroy(){var e;this.destroyed=!0,this._webWorker&&(this._webWorker.terminate(),this._webWorker=null),(e=M(ba,Xg))==null||e.delete(this._port),this._port=null,this._messageHandler&&(this._messageHandler.destroy(),this._messageHandler=null)}static fromPort(e){var i;if(!(e!=null&&e.port))throw new Error("PDFWorker.fromPort - invalid method signature.");const r=(i=M(this,Xg))==null?void 0:i.get(e.port);if(r){if(r._pendingDestroy)throw new Error("PDFWorker.fromPort - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return r}return new ba(e)}static get workerSrc(){if(t0.workerSrc)return t0.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return or(this,"_setupFakeWorkerGlobal",(async()=>M(this,fy,GM)?M(this,fy,GM):(await import(this.workerSrc)).WorkerMessageHandler)())}};YV=new WeakMap,Kv=new WeakMap,Xg=new WeakMap,gy=new WeakSet,HM=function(){this._readyCapability.resolve(),this._messageHandler.send("configure",{verbosity:this.verbosity})},fy=new WeakSet,GM=function(){var t;try{return((t=globalThis.pdfjsWorker)==null?void 0:t.WorkerMessageHandler)||null}catch{return null}},ce(n0,fy),ce(n0,YV,0),ce(n0,Kv,!1),ce(n0,Xg),Ss&&(ie(n0,Kv,!0),t0.workerSrc||(t0.workerSrc="./pdf.worker.mjs")),n0._isSameOrigin=(t,e)=>{let i;try{if(i=new URL(t),!i.origin||i.origin==="null")return!1}catch{return!1}const r=new URL(e,i);return i.origin===r.origin},n0._createCDNWrapper=t=>{const e=`await import("${t}");`;return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))};let jM=n0;var s0,ju,my,vy,Vu,Jv,Cy;class qki{constructor(e,i,r,o,s){ce(this,Jv),ce(this,s0,new Map),ce(this,ju,new Map),ce(this,my,new Map),ce(this,vy,new Map),ce(this,Vu,null),this.messageHandler=e,this.loadingTask=i,this.commonObjs=new Q4e,this.fontLoader=new HEi({ownerDocument:o.ownerDocument,styleElement:o.styleElement}),this.loadingParams=o.loadingParams,this._params=o,this.canvasFactory=s.canvasFactory,this.filterFactory=s.filterFactory,this.cMapReaderFactory=s.cMapReaderFactory,this.standardFontDataFactory=s.standardFontDataFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=r,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.setupMessageHandler()}get annotationStorage(){return or(this,"annotationStorage",new RV)}getRenderingIntent(e,i=q1.ENABLE,r=null,o=!1,s=!1){let n=xl.DISPLAY,a=DV;switch(e){case"any":n=xl.ANY;break;case"display":break;case"print":n=xl.PRINT;break;default:Hi(`getRenderingIntent - invalid intent: ${e}`)}const l=n&xl.PRINT&&r instanceof Wve?r:this.annotationStorage;switch(i){case q1.DISABLE:n+=xl.ANNOTATIONS_DISABLE;break;case q1.ENABLE:break;case q1.ENABLE_FORMS:n+=xl.ANNOTATIONS_FORMS;break;case q1.ENABLE_STORAGE:n+=xl.ANNOTATIONS_STORAGE,a=l.serializable;break;default:Hi(`getRenderingIntent - invalid annotationMode: ${i}`)}o&&(n+=xl.IS_EDITING),s&&(n+=xl.OPLIST);const{ids:c,hash:d}=l.modifiedIds,A=[n,a.hash,d];return{renderingIntent:n,cacheKey:A.join("_"),annotationStorageSerializable:a,modifiedIds:c}}destroy(){var e;if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),(e=M(this,Vu))==null||e.reject(new Error("Worker was destroyed during onPassword callback"));const i=[];for(const o of M(this,ju).values())i.push(o._destroy());M(this,ju).clear(),M(this,my).clear(),M(this,vy).clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const r=this.messageHandler.sendWithPromise("Terminate",null);return i.push(r),Promise.all(i).then(()=>{var o;this.commonObjs.clear(),this.fontLoader.clear(),M(this,s0).clear(),this.filterFactory.destroy(),zV.cleanup(),(o=this._networkStream)==null||o.cancelAllRequests(new Dg("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:i}=this;e.on("GetReader",(r,o)=>{yn(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=s=>{this._lastProgress={loaded:s.loaded,total:s.total}},o.onPull=()=>{this._fullReader.read().then(function({value:s,done:n}){if(n){o.close();return}yn(s instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),o.enqueue(new Uint8Array(s),1,[s])}).catch(s=>{o.error(s)})},o.onCancel=s=>{this._fullReader.cancel(s),o.ready.catch(n=>{if(!this.destroyed)throw n})}}),e.on("ReaderHeadersReady",r=>{const o=Promise.withResolvers(),s=this._fullReader;return s.headersReady.then(()=>{var n;(!s.isStreamingSupported||!s.isRangeSupported)&&(this._lastProgress&&((n=i.onProgress)==null||n.call(i,this._lastProgress)),s.onProgress=a=>{var l;(l=i.onProgress)==null||l.call(i,{loaded:a.loaded,total:a.total})}),o.resolve({isStreamingSupported:s.isStreamingSupported,isRangeSupported:s.isRangeSupported,contentLength:s.contentLength})},o.reject),o.promise}),e.on("GetRangeReader",(r,o)=>{yn(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const s=this._networkStream.getRangeReader(r.begin,r.end);if(!s){o.close();return}o.onPull=()=>{s.read().then(function({value:n,done:a}){if(a){o.close();return}yn(n instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),o.enqueue(new Uint8Array(n),1,[n])}).catch(n=>{o.error(n)})},o.onCancel=n=>{s.cancel(n),o.ready.catch(a=>{if(!this.destroyed)throw a})}}),e.on("GetDoc",({pdfInfo:r})=>{this._numPages=r.numPages,this._htmlForXfa=r.htmlForXfa,delete r.htmlForXfa,i._capability.resolve(new Gki(r,this))}),e.on("DocException",function(r){let o;switch(r.name){case"PasswordException":o=new Jj(r.message,r.code);break;case"InvalidPDFException":o=new ave(r.message);break;case"MissingPDFException":o=new Sg(r.message);break;case"UnexpectedResponseException":o=new UQ(r.message,r.status);break;case"UnknownErrorException":o=new Yj(r.message,r.details);break;default:nn("DocException - expected a valid Error.")}i._capability.reject(o)}),e.on("PasswordRequest",r=>{if(ie(this,Vu,Promise.withResolvers()),i.onPassword){const o=s=>{s instanceof Error?M(this,Vu).reject(s):M(this,Vu).resolve({password:s})};try{i.onPassword(o,r.code)}catch(s){M(this,Vu).reject(s)}}else M(this,Vu).reject(new Jj(r.message,r.code));return M(this,Vu).promise}),e.on("DataLoaded",r=>{var o;(o=i.onProgress)==null||o.call(i,{loaded:r.length,total:r.length}),this.downloadInfoCapability.resolve(r)}),e.on("StartRenderPage",r=>{this.destroyed||M(this,ju).get(r.pageIndex)._startRenderPage(r.transparency,r.cacheKey)}),e.on("commonobj",([r,o,s])=>{var n;if(this.destroyed||this.commonObjs.has(r))return null;switch(o){case"Font":const{disableFontFace:a,fontExtraProperties:l,pdfBug:c}=this._params;if("error"in s){const h=s.error;Hi(`Error during font loading: ${h}`),this.commonObjs.resolve(r,h);break}const d=c&&(n=globalThis.FontInspector)!=null&&n.enabled?(h,g)=>globalThis.FontInspector.fontAdded(h,g):null,A=new GEi(s,{disableFontFace:a,inspectFont:d});this.fontLoader.bind(A).catch(()=>e.sendWithPromise("FontFallback",{id:r})).finally(()=>{!l&&A.data&&(A.data=null),this.commonObjs.resolve(r,A)});break;case"CopyLocalImage":const{imageRef:u}=s;yn(u,"The imageRef must be defined.");for(const h of M(this,ju).values())for(const[,g]of h.objs)if(g?.ref===u)return g.dataLen?(this.commonObjs.resolve(r,structuredClone(g)),g.dataLen):null;break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(r,s);break;default:throw new Error(`Got unknown common object type ${o}`)}return null}),e.on("obj",([r,o,s,n])=>{var a;if(this.destroyed)return;const l=M(this,ju).get(o);if(!l.objs.has(r)){if(l._intentStates.size===0){(a=n?.bitmap)==null||a.close();return}switch(s){case"Image":l.objs.resolve(r,n),n?.dataLen>dEi&&(l._maybeCleanupAfterRender=!0);break;case"Pattern":l.objs.resolve(r,n);break;default:throw new Error(`Got unknown object type ${s}`)}}}),e.on("DocProgress",r=>{var o;this.destroyed||(o=i.onProgress)==null||o.call(i,{loaded:r.loaded,total:r.total})}),e.on("FetchBuiltInCMap",r=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.cMapReaderFactory?this.cMapReaderFactory.fetch(r):Promise.reject(new Error("CMapReaderFactory not initialized, see the `useWorkerFetch` parameter."))),e.on("FetchStandardFontData",r=>this.destroyed?Promise.reject(new Error("Worker was destroyed.")):this.standardFontDataFactory?this.standardFontDataFactory.fetch(r):Promise.reject(new Error("StandardFontDataFactory not initialized, see the `useWorkerFetch` parameter.")))}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){var e;this.annotationStorage.size<=0&&Hi("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:i,transfer:r}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:i,filename:((e=this._fullReader)==null?void 0:e.filename)??null},r).finally(()=>{this.annotationStorage.resetModified()})}getPage(e){if(!Number.isInteger(e)||e<=0||e>this._numPages)return Promise.reject(new Error("Invalid page request."));const i=e-1,r=M(this,my).get(i);if(r)return r;const o=this.messageHandler.sendWithPromise("GetPage",{pageIndex:i}).then(s=>{if(this.destroyed)throw new Error("Transport destroyed");s.refStr&&M(this,vy).set(s.refStr,e);const n=new jki(i,s,this,this._params.pdfBug);return M(this,ju).set(i,n),n});return M(this,my).set(i,o),o}getPageIndex(e){return E4e(e)?this.messageHandler.sendWithPromise("GetPageIndex",{num:e.num,gen:e.gen}):Promise.reject(new Error("Invalid pageIndex request."))}getAnnotations(e,i){return this.messageHandler.sendWithPromise("GetAnnotations",{pageIndex:e,intent:i})}getFieldObjects(){return $(this,Jv,Cy).call(this,"GetFieldObjects")}hasJSActions(){return $(this,Jv,Cy).call(this,"HasJSActions")}getCalculationOrderIds(){return this.messageHandler.sendWithPromise("GetCalculationOrderIds",null)}getDestinations(){return this.messageHandler.sendWithPromise("GetDestinations",null)}getDestination(e){return typeof e!="string"?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)}getDocJSActions(){return $(this,Jv,Cy).call(this,"GetDocJSActions")}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(e){return $(this,Jv,Cy).call(this,"GetOptionalContentConfig").then(i=>new cki(i,e))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const e="GetMetadata",i=M(this,s0).get(e);if(i)return i;const r=this.messageHandler.sendWithPromise(e,null).then(o=>{var s,n;return{info:o[0],metadata:o[1]?new aki(o[1]):null,contentDispositionFilename:((s=this._fullReader)==null?void 0:s.filename)??null,contentLength:((n=this._fullReader)==null?void 0:n.contentLength)??null}});return M(this,s0).set(e,r),r}getMarkInfo(){return this.messageHandler.sendWithPromise("GetMarkInfo",null)}async startCleanup(e=!1){if(!this.destroyed){await this.messageHandler.sendWithPromise("Cleanup",null);for(const i of M(this,ju).values())if(!i.cleanup())throw new Error(`startCleanup: Page ${i.pageNumber} is currently rendering.`);this.commonObjs.clear(),e||this.fontLoader.clear(),M(this,s0).clear(),this.filterFactory.destroy(!0),zV.cleanup()}}cachedPageNumber(e){if(!E4e(e))return null;const i=e.gen===0?`${e.num}R`:`${e.num}R${e.gen}`;return M(this,vy).get(i)??null}}s0=new WeakMap,ju=new WeakMap,my=new WeakMap,vy=new WeakMap,Vu=new WeakMap,Jv=new WeakSet,Cy=function(t,e=null){const i=M(this,s0).get(t);if(i)return i;const r=this.messageHandler.sendWithPromise(t,e);return M(this,s0).set(t,r),r};const VM=Symbol("INITIAL_DATA");var AA,qM,WV;class Q4e{constructor(){ce(this,qM),ce(this,AA,Object.create(null))}get(e,i=null){if(i){const o=$(this,qM,WV).call(this,e);return o.promise.then(()=>i(o.data)),null}const r=M(this,AA)[e];if(!r||r.data===VM)throw new Error(`Requesting object that isn't resolved yet ${e}.`);return r.data}has(e){const i=M(this,AA)[e];return!!i&&i.data!==VM}resolve(e,i=null){const r=$(this,qM,WV).call(this,e);r.data=i,r.resolve()}clear(){var e;for(const i in M(this,AA)){const{data:r}=M(this,AA)[i];(e=r?.bitmap)==null||e.close()}ie(this,AA,Object.create(null))}*[Symbol.iterator](){for(const e in M(this,AA)){const{data:i}=M(this,AA)[e];i!==VM&&(yield[e,i])}}}AA=new WeakMap,qM=new WeakSet,WV=function(t){var e;return(e=M(this,AA))[t]||(e[t]={...Promise.withResolvers(),data:VM})};var $g;class _ki{constructor(e){ce(this,$g,null),ie(this,$g,e),this.onContinue=null}get promise(){return M(this,$g).capability.promise}cancel(e=0){M(this,$g).cancel(null,e)}get separateAnnots(){const{separateAnnots:e}=M(this,$g).operatorList;if(!e)return!1;const{annotationCanvasMap:i}=M(this,$g);return e.form||e.canvas&&i?.size>0}}$g=new WeakMap;var ef,Yv;const M4e=class XI{constructor({callback:e,params:i,objs:r,commonObjs:o,annotationCanvasMap:s,operatorList:n,pageIndex:a,canvasFactory:l,filterFactory:c,useRequestAnimationFrame:d=!1,pdfBug:A=!1,pageColors:u=null}){ce(this,ef,null),this.callback=e,this.params=i,this.objs=r,this.commonObjs=o,this.annotationCanvasMap=s,this.operatorListIdx=null,this.operatorList=n,this._pageIndex=a,this.canvasFactory=l,this.filterFactory=c,this._pdfBug=A,this.pageColors=u,this.running=!1,this.graphicsReadyCallback=null,this.graphicsReady=!1,this._useRequestAnimationFrame=d===!0&&typeof window<"u",this.cancelled=!1,this.capability=Promise.withResolvers(),this.task=new _ki(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=i.canvasContext.canvas}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:e=!1,optionalContentConfig:i}){var r,o;if(this.cancelled)return;if(this._canvas){if(M(XI,Yv).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.");M(XI,Yv).add(this._canvas)}this._pdfBug&&(r=globalThis.StepperManager)!=null&&r.enabled&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{canvasContext:s,viewport:n,transform:a,background:l}=this.params;this.gfx=new yM(s,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:i},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:a,viewport:n,transparency:e,background:l}),this.operatorListIdx=0,this.graphicsReady=!0,(o=this.graphicsReadyCallback)==null||o.call(this)}cancel(e=null,i=0){var r;this.running=!1,this.cancelled=!0,(r=this.gfx)==null||r.endDrawing(),M(this,ef)&&(window.cancelAnimationFrame(M(this,ef)),ie(this,ef,null)),M(XI,Yv).delete(this._canvas),this.callback(e||new oV(`Rendering cancelled, page ${this._pageIndex+1}`,i))}operatorListChanged(){var e;if(!this.graphicsReady){this.graphicsReadyCallback||(this.graphicsReadyCallback=this._continueBound);return}(e=this.stepper)==null||e.updateOperatorList(this.operatorList),!this.running&&this._continue()}_continue(){this.running=!0,!this.cancelled&&(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?ie(this,ef,window.requestAnimationFrame(()=>{ie(this,ef,null),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(),M(XI,Yv).delete(this._canvas),this.callback())))}};ef=new WeakMap,Yv=new WeakMap,ce(M4e,Yv,new WeakSet);let zki=M4e;const Kki="4.6.82",Jki="9b541910f";function S4e(t){return Math.floor(Math.max(0,Math.min(1,t))*255).toString(16).padStart(2,"0")}function yy(t){return Math.max(0,Math.min(255,255*t))}class D4e{static CMYK_G([e,i,r,o]){return["G",1-Math.min(1,.3*e+.59*r+.11*i+o)]}static G_CMYK([e]){return["CMYK",0,0,0,1-e]}static G_RGB([e]){return["RGB",e,e,e]}static G_rgb([e]){return e=yy(e),[e,e,e]}static G_HTML([e]){const i=S4e(e);return`#${i}${i}${i}`}static RGB_G([e,i,r]){return["G",.3*e+.59*i+.11*r]}static RGB_rgb(e){return e.map(yy)}static RGB_HTML(e){return`#${e.map(S4e).join("")}`}static T_HTML(){return"#00000000"}static T_rgb(){return[null]}static CMYK_RGB([e,i,r,o]){return["RGB",1-Math.min(1,e+o),1-Math.min(1,r+o),1-Math.min(1,i+o)]}static CMYK_rgb([e,i,r,o]){return[yy(1-Math.min(1,e+o)),yy(1-Math.min(1,r+o)),yy(1-Math.min(1,i+o))]}static CMYK_HTML(e){const i=this.CMYK_RGB(e).slice(1);return this.RGB_HTML(i)}static RGB_CMYK([e,i,r]){const o=1-e,s=1-i,n=1-r,a=Math.min(o,s,n);return["CMYK",o,s,n,a]}}class P4e{static setupStorage(e,i,r,o,s){const n=o.getValue(i,{value:null});switch(r.name){case"textarea":if(n.value!==null&&(e.textContent=n.value),s==="print")break;e.addEventListener("input",a=>{o.setValue(i,{value:a.target.value})});break;case"input":if(r.attributes.type==="radio"||r.attributes.type==="checkbox"){if(n.value===r.attributes.xfaOn?e.setAttribute("checked",!0):n.value===r.attributes.xfaOff&&e.removeAttribute("checked"),s==="print")break;e.addEventListener("change",a=>{o.setValue(i,{value:a.target.checked?a.target.getAttribute("xfaOn"):a.target.getAttribute("xfaOff")})})}else{if(n.value!==null&&e.setAttribute("value",n.value),s==="print")break;e.addEventListener("input",a=>{o.setValue(i,{value:a.target.value})})}break;case"select":if(n.value!==null){e.setAttribute("value",n.value);for(const a of r.children)a.attributes.value===n.value?a.attributes.selected=!0:a.attributes.hasOwnProperty("selected")&&delete a.attributes.selected}e.addEventListener("input",a=>{const l=a.target.options,c=l.selectedIndex===-1?"":l[l.selectedIndex].value;o.setValue(i,{value:c})});break}}static setAttributes({html:e,element:i,storage:r=null,intent:o,linkService:s}){const{attributes:n}=i,a=e instanceof HTMLAnchorElement;n.type==="radio"&&(n.name=`${n.name}-${o}`);for(const[l,c]of Object.entries(n))if(c!=null)switch(l){case"class":c.length&&e.setAttribute(l,c.join(" "));break;case"dataId":break;case"id":e.setAttribute("data-element-id",c);break;case"style":Object.assign(e.style,c);break;case"textContent":e.textContent=c;break;default:(!a||l!=="href"&&l!=="newWindow")&&e.setAttribute(l,c)}a&&s.addLinkAttributes(e,n.href,n.newWindow),r&&n.dataId&&this.setupStorage(e,n.dataId,i,r)}static render(e){var i,r;const o=e.annotationStorage,s=e.linkService,n=e.xfaHtml,a=e.intent||"display",l=document.createElement(n.name);n.attributes&&this.setAttributes({html:l,element:n,intent:a,linkService:s});const c=a!=="richText",d=e.div;if(d.append(l),e.viewport){const h=`matrix(${e.viewport.transform.join(",")})`;d.style.transform=h}c&&d.setAttribute("class","xfaLayer xfaFont");const A=[];if(n.children.length===0){if(n.value){const h=document.createTextNode(n.value);l.append(h),c&&sw.shouldBuildText(n.name)&&A.push(h)}return{textDivs:A}}const u=[[n,-1,l]];for(;u.length>0;){const[h,g,p]=u.at(-1);if(g+1===h.children.length){u.pop();continue}const m=h.children[++u.at(-1)[1]];if(m===null)continue;const{name:f}=m;if(f==="#text"){const C=document.createTextNode(m.value);A.push(C),p.append(C);continue}const v=(i=m?.attributes)!=null&&i.xmlns?document.createElementNS(m.attributes.xmlns,f):document.createElement(f);if(p.append(v),m.attributes&&this.setAttributes({html:v,element:m,storage:o,intent:a,linkService:s}),((r=m.children)==null?void 0:r.length)>0)u.push([m,-1,v]);else if(m.value){const C=document.createTextNode(m.value);c&&sw.shouldBuildText(f)&&A.push(C),v.append(C)}}for(const h of d.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))h.setAttribute("readOnly",!0);return{textDivs:A}}static update(e){const i=`matrix(${e.viewport.transform.join(",")})`;e.div.style.transform=i,e.div.hidden=!1}}const Iy=1e3,Yki=9,tf=new WeakSet;function qu(t){return{width:t[2]-t[0],height:t[3]-t[1]}}class Wki{static create(e){switch(e.data.annotationType){case Cn.LINK:return new F4e(e);case Cn.TEXT:return new Xki(e);case Cn.WIDGET:switch(e.data.fieldType){case"Tx":return new $ki(e);case"Btn":return e.data.radioButton?new T4e(e):e.data.checkBox?new txi(e):new ixi(e);case"Ch":return new rxi(e);case"Sig":return new exi(e)}return new nf(e);case Cn.POPUP:return new XV(e);case Cn.FREETEXT:return new G4e(e);case Cn.LINE:return new nxi(e);case Cn.SQUARE:return new sxi(e);case Cn.CIRCLE:return new axi(e);case Cn.POLYLINE:return new j4e(e);case Cn.CARET:return new cxi(e);case Cn.INK:return new V4e(e);case Cn.POLYGON:return new lxi(e);case Cn.HIGHLIGHT:return new dxi(e);case Cn.UNDERLINE:return new Axi(e);case Cn.SQUIGGLY:return new uxi(e);case Cn.STRIKEOUT:return new hxi(e);case Cn.STAMP:return new q4e(e);case Cn.FILEATTACHMENT:return new pxi(e);default:return new wn(e)}}}var rf,wy,by,_M,ZV;const Zki=class DCe{constructor(e,{isRenderable:i=!1,ignoreBorder:r=!1,createQuadrilaterals:o=!1}={}){ce(this,_M),ce(this,rf,null),ce(this,wy,!1),ce(this,by,null),this.isRenderable=i,this.data=e.data,this.layer=e.layer,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.parent=e.parent,i&&(this.container=this._createContainer(r)),o&&this._createQuadrilaterals()}static _hasPopupData({titleObj:e,contentsObj:i,richText:r}){return!!(e!=null&&e.str||i!=null&&i.str||r!=null&&r.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return DCe._hasPopupData(this.data)}updateEdited(e){var i;if(!this.container)return;M(this,rf)||ie(this,rf,{rect:this.data.rect.slice(0)});const{rect:r}=e;r&&$(this,_M,ZV).call(this,r),(i=M(this,by))==null||i.popup.updateEdited(e)}resetEdited(){var e;M(this,rf)&&($(this,_M,ZV).call(this,M(this,rf).rect),(e=M(this,by))==null||e.popup.resetEdited(),ie(this,rf,null))}_createContainer(e){const{data:i,parent:{page:r,viewport:o}}=this,s=document.createElement("section");s.setAttribute("data-annotation-id",i.id),this instanceof nf||(s.tabIndex=Iy);const{style:n}=s;if(n.zIndex=this.parent.zIndex++,i.popupRef&&s.setAttribute("aria-haspopup","dialog"),i.alternativeText&&(s.title=i.alternativeText),i.noRotate&&s.classList.add("norotate"),!i.rect||this instanceof XV){const{rotation:p}=i;return!i.hasOwnCanvas&&p!==0&&this.setRotation(p,s),s}const{width:a,height:l}=qu(i.rect);if(!e&&i.borderStyle.width>0){n.borderWidth=`${i.borderStyle.width}px`;const p=i.borderStyle.horizontalCornerRadius,m=i.borderStyle.verticalCornerRadius;if(p>0||m>0){const v=`calc(${p}px * var(--scale-factor)) / calc(${m}px * var(--scale-factor))`;n.borderRadius=v}else if(this instanceof T4e){const v=`calc(${a}px * var(--scale-factor)) / calc(${l}px * var(--scale-factor))`;n.borderRadius=v}switch(i.borderStyle.style){case T7.SOLID:n.borderStyle="solid";break;case T7.DASHED:n.borderStyle="dashed";break;case T7.BEVELED:Hi("Unimplemented border style: beveled");break;case T7.INSET:Hi("Unimplemented border style: inset");break;case T7.UNDERLINE:n.borderBottomStyle="solid";break}const f=i.borderColor||null;f?(ie(this,wy,!0),n.borderColor=ti.makeHexColor(f[0]|0,f[1]|0,f[2]|0)):n.borderWidth=0}const c=ti.normalizeRect([i.rect[0],r.view[3]-i.rect[1]+r.view[1],i.rect[2],r.view[3]-i.rect[3]+r.view[1]]),{pageWidth:d,pageHeight:A,pageX:u,pageY:h}=o.rawDims;n.left=`${100*(c[0]-u)/d}%`,n.top=`${100*(c[1]-h)/A}%`;const{rotation:g}=i;return i.hasOwnCanvas||g===0?(n.width=`${100*a/d}%`,n.height=`${100*l/A}%`):this.setRotation(g,s),s}setRotation(e,i=this.container){if(!this.data.rect)return;const{pageWidth:r,pageHeight:o}=this.parent.viewport.rawDims,{width:s,height:n}=qu(this.data.rect);let a,l;e%180===0?(a=100*s/r,l=100*n/o):(a=100*n/r,l=100*s/o),i.style.width=`${a}%`,i.style.height=`${l}%`,i.setAttribute("data-main-rotation",(360-e)%360)}get _commonActions(){const e=(i,r,o)=>{const s=o.detail[i],n=s[0],a=s.slice(1);o.target.style[r]=D4e[`${n}_HTML`](a),this.annotationStorage.setValue(this.data.id,{[r]:D4e[`${n}_rgb`](a)})};return or(this,"_commonActions",{display:i=>{const{display:r}=i.detail,o=r%2===1;this.container.style.visibility=o?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noView:o,noPrint:r===1||r===2})},print:i=>{this.annotationStorage.setValue(this.data.id,{noPrint:!i.detail.print})},hidden:i=>{const{hidden:r}=i.detail;this.container.style.visibility=r?"hidden":"visible",this.annotationStorage.setValue(this.data.id,{noPrint:r,noView:r})},focus:i=>{setTimeout(()=>i.target.focus({preventScroll:!1}),0)},userName:i=>{i.target.title=i.detail.userName},readonly:i=>{i.target.disabled=i.detail.readonly},required:i=>{this._setRequired(i.target,i.detail.required)},bgColor:i=>{e("bgColor","backgroundColor",i)},fillColor:i=>{e("fillColor","backgroundColor",i)},fgColor:i=>{e("fgColor","color",i)},textColor:i=>{e("textColor","color",i)},borderColor:i=>{e("borderColor","borderColor",i)},strokeColor:i=>{e("strokeColor","borderColor",i)},rotation:i=>{const r=i.detail.rotation;this.setRotation(r),this.annotationStorage.setValue(this.data.id,{rotation:r})}})}_dispatchEventFromSandbox(e,i){const r=this._commonActions;for(const o of Object.keys(i.detail)){const s=e[o]||r[o];s?.(i)}}_setDefaultPropertiesFromJS(e){if(!this.enableScripting)return;const i=this.annotationStorage.getRawValue(this.data.id);if(!i)return;const r=this._commonActions;for(const[o,s]of Object.entries(i)){const n=r[o];if(n){const a={detail:{[o]:s},target:e};n(a),delete i[o]}}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:e}=this.data;if(!e)return;const[i,r,o,s]=this.data.rect.map(p=>Math.fround(p));if(e.length===8){const[p,m,f,v]=e.subarray(2,6);if(o===p&&s===m&&i===f&&r===v)return}const{style:n}=this.container;let a;if(M(this,wy)){const{borderColor:p,borderWidth:m}=n;n.borderWidth=0,a=["url('data:image/svg+xml;utf8,",'<svg xmlns="http://www.w3.org/2000/svg"',' preserveAspectRatio="none" viewBox="0 0 1 1">',`<g fill="transparent" stroke="${p}" stroke-width="${m}">`],this.container.classList.add("hasBorder")}const l=o-i,c=s-r,{svgFactory:d}=this,A=d.createElement("svg");A.classList.add("quadrilateralsContainer"),A.setAttribute("width",0),A.setAttribute("height",0);const u=d.createElement("defs");A.append(u);const h=d.createElement("clipPath"),g=`clippath_${this.data.id}`;h.setAttribute("id",g),h.setAttribute("clipPathUnits","objectBoundingBox"),u.append(h);for(let p=2,m=e.length;p<m;p+=8){const f=e[p],v=e[p+1],C=e[p+2],y=e[p+3],I=d.createElement("rect"),B=(C-i)/l,E=(s-v)/c,k=(f-C)/l,Q=(v-y)/c;I.setAttribute("x",B),I.setAttribute("y",E),I.setAttribute("width",k),I.setAttribute("height",Q),h.append(I),a?.push(`<rect vector-effect="non-scaling-stroke" x="${B}" y="${E}" width="${k}" height="${Q}"/>`)}M(this,wy)&&(a.push("</g></svg>')"),n.backgroundImage=a.join("")),this.container.append(A),this.container.style.clipPath=`url(#${g})`}_createPopup(){const{container:e,data:i}=this;e.setAttribute("aria-haspopup","dialog");const r=ie(this,by,new XV({data:{color:i.color,titleObj:i.titleObj,modificationDate:i.modificationDate,contentsObj:i.contentsObj,richText:i.richText,parentRect:i.rect,borderStyle:0,id:`popup_${i.id}`,rotation:i.rotation},parent:this.parent,elements:[this]}));this.parent.div.append(r.render())}render(){nn("Abstract method `AnnotationElement.render` called")}_getElementsByName(e,i=null){const r=[];if(this._fieldObjects){const o=this._fieldObjects[e];if(o)for(const{page:s,id:n,exportValues:a}of o){if(s===-1||n===i)continue;const l=typeof a=="string"?a:null,c=document.querySelector(`[data-element-id="${n}"]`);if(c&&!tf.has(c)){Hi(`_getElementsByName - element not allowed: ${n}`);continue}r.push({id:n,exportValue:l,domElement:c})}return r}for(const o of document.getElementsByName(e)){const{exportValue:s}=o,n=o.getAttribute("data-element-id");n!==i&&tf.has(o)&&r.push({id:n,exportValue:s,domElement:o})}return r}show(){var e;this.container&&(this.container.hidden=!1),(e=this.popup)==null||e.maybeShow()}hide(){var e;this.container&&(this.container.hidden=!0),(e=this.popup)==null||e.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){const e=this.getElementsToTriggerPopup();if(Array.isArray(e))for(const i of e)i.classList.add("highlightArea");else e.classList.add("highlightArea")}_editOnDoubleClick(){if(!this._isEditable)return;const{annotationEditorType:e,data:{id:i}}=this;this.container.addEventListener("dblclick",()=>{var r;(r=this.linkService.eventBus)==null||r.dispatch("switchannotationeditormode",{source:this,mode:e,editId:i})})}};rf=new WeakMap,wy=new WeakMap,by=new WeakMap,_M=new WeakSet,ZV=function(t){const{container:{style:e},data:{rect:i,rotation:r},parent:{viewport:{rawDims:{pageWidth:o,pageHeight:s,pageX:n,pageY:a}}}}=this;i?.splice(0,4,...t);const{width:l,height:c}=qu(t);e.left=`${100*(t[0]-n)/o}%`,e.top=`${100*(s-t[3]+a)/s}%`,r===0?(e.width=`${100*l/o}%`,e.height=`${100*c/s}%`):this.setRotation(r)};let wn=Zki;var uA,of,R4e,L4e;class F4e extends wn{constructor(e,i=null){super(e,{isRenderable:!0,ignoreBorder:!!(i!=null&&i.ignoreBorder),createQuadrilaterals:!0}),ce(this,uA),this.isTooltipOnly=e.data.isTooltipOnly}render(){const{data:e,linkService:i}=this,r=document.createElement("a");r.setAttribute("data-element-id",e.id);let o=!1;return e.url?(i.addLinkAttributes(r,e.url,e.newWindow),o=!0):e.action?(this._bindNamedAction(r,e.action),o=!0):e.attachment?($(this,uA,R4e).call(this,r,e.attachment,e.attachmentDest),o=!0):e.setOCGState?($(this,uA,L4e).call(this,r,e.setOCGState),o=!0):e.dest?(this._bindLink(r,e.dest),o=!0):(e.actions&&(e.actions.Action||e.actions["Mouse Up"]||e.actions["Mouse Down"])&&this.enableScripting&&this.hasJSActions&&(this._bindJSAction(r,e),o=!0),e.resetForm?(this._bindResetFormAction(r,e.resetForm),o=!0):this.isTooltipOnly&&!o&&(this._bindLink(r,""),o=!0)),this.container.classList.add("linkAnnotation"),o&&this.container.append(r),this.container}_bindLink(e,i){e.href=this.linkService.getDestinationHash(i),e.onclick=()=>(i&&this.linkService.goToDestination(i),!1),(i||i==="")&&$(this,uA,of).call(this)}_bindNamedAction(e,i){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeNamedAction(i),!1),$(this,uA,of).call(this)}_bindJSAction(e,i){e.href=this.linkService.getAnchorUrl("");const r=new Map([["Action","onclick"],["Mouse Up","onmouseup"],["Mouse Down","onmousedown"]]);for(const o of Object.keys(i.actions)){const s=r.get(o);s&&(e[s]=()=>{var n;return(n=this.linkService.eventBus)==null||n.dispatch("dispatcheventinsandbox",{source:this,detail:{id:i.id,name:o}}),!1})}e.onclick||(e.onclick=()=>!1),$(this,uA,of).call(this)}_bindResetFormAction(e,i){const r=e.onclick;if(r||(e.href=this.linkService.getAnchorUrl("")),$(this,uA,of).call(this),!this._fieldObjects){Hi('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),r||(e.onclick=()=>!1);return}e.onclick=()=>{var o;r?.();const{fields:s,refs:n,include:a}=i,l=[];if(s.length!==0||n.length!==0){const A=new Set(n);for(const u of s){const h=this._fieldObjects[u]||[];for(const{id:g}of h)A.add(g)}for(const u of Object.values(this._fieldObjects))for(const h of u)A.has(h.id)===a&&l.push(h)}else for(const A of Object.values(this._fieldObjects))l.push(...A);const c=this.annotationStorage,d=[];for(const A of l){const{id:u}=A;switch(d.push(u),A.type){case"text":{const g=A.defaultValue||"";c.setValue(u,{value:g});break}case"checkbox":case"radiobutton":{const g=A.defaultValue===A.exportValues;c.setValue(u,{value:g});break}case"combobox":case"listbox":{const g=A.defaultValue||"";c.setValue(u,{value:g});break}default:continue}const h=document.querySelector(`[data-element-id="${u}"]`);if(h){if(!tf.has(h)){Hi(`_bindResetFormAction - element not allowed: ${u}`);continue}}else continue;h.dispatchEvent(new Event("resetform"))}return this.enableScripting&&((o=this.linkService.eventBus)==null||o.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:d,name:"ResetForm"}})),!1}}}uA=new WeakSet,of=function(){this.container.setAttribute("data-internal-link","")},R4e=function(t,e,i=null){t.href=this.linkService.getAnchorUrl(""),e.description&&(t.title=e.description),t.onclick=()=>{var r;return(r=this.downloadManager)==null||r.openOrDownloadData(e.content,e.filename,i),!1},$(this,uA,of).call(this)},L4e=function(t,e){t.href=this.linkService.getAnchorUrl(""),t.onclick=()=>(this.linkService.executeSetOCGState(e),!1),$(this,uA,of).call(this)};class Xki extends wn{constructor(e){super(e,{isRenderable:!0})}render(){this.container.classList.add("textAnnotation");const e=document.createElement("img");return e.src=this.imageResourcesPath+"annotation-"+this.data.name.toLowerCase()+".svg",e.setAttribute("data-l10n-id","pdfjs-text-annotation-type"),e.setAttribute("data-l10n-args",JSON.stringify({type:this.data.name})),!this.data.popupRef&&this.hasPopupData&&this._createPopup(),this.container.append(e),this.container}}class nf extends wn{render(){return this.container}showElementAndHideCanvas(e){var i;this.data.hasOwnCanvas&&(((i=e.previousSibling)==null?void 0:i.nodeName)==="CANVAS"&&(e.previousSibling.hidden=!0),e.hidden=!1)}_getKeyModifier(e){return _a.platform.isMac?e.metaKey:e.ctrlKey}_setEventListener(e,i,r,o,s){r.includes("mouse")?e.addEventListener(r,n=>{var a;(a=this.linkService.eventBus)==null||a.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:o,value:s(n),shift:n.shiftKey,modifier:this._getKeyModifier(n)}})}):e.addEventListener(r,n=>{var a;if(r==="blur"){if(!i.focused||!n.relatedTarget)return;i.focused=!1}else if(r==="focus"){if(i.focused)return;i.focused=!0}s&&((a=this.linkService.eventBus)==null||a.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:o,value:s(n)}}))})}_setEventListeners(e,i,r,o){var s,n,a;for(const[l,c]of r)(c==="Action"||(s=this.data.actions)!=null&&s[c])&&((c==="Focus"||c==="Blur")&&(i||(i={focused:!1})),this._setEventListener(e,i,l,c,o),c==="Focus"&&!((n=this.data.actions)!=null&&n.Blur)?this._setEventListener(e,i,"blur","Blur",null):c==="Blur"&&!((a=this.data.actions)!=null&&a.Focus)&&this._setEventListener(e,i,"focus","Focus",null))}_setBackgroundColor(e){const i=this.data.backgroundColor||null;e.style.backgroundColor=i===null?"transparent":ti.makeHexColor(i[0],i[1],i[2])}_setTextStyle(e){const i=["left","center","right"],{fontColor:r}=this.data.defaultAppearanceData,o=this.data.defaultAppearanceData.fontSize||Yki,s=e.style;let n;const a=2,l=c=>Math.round(10*c)/10;if(this.data.multiLine){const c=Math.abs(this.data.rect[3]-this.data.rect[1]-a),d=Math.round(c/(zj*o))||1,A=c/d;n=Math.min(o,l(A/zj))}else{const c=Math.abs(this.data.rect[3]-this.data.rect[1]-a);n=Math.min(o,l(c/zj))}s.fontSize=`calc(${n}px * var(--scale-factor))`,s.color=ti.makeHexColor(r[0],r[1],r[2]),this.data.textAlignment!==null&&(s.textAlign=i[this.data.textAlignment])}_setRequired(e,i){i?e.setAttribute("required",!0):e.removeAttribute("required"),e.setAttribute("aria-required",i)}}class $ki extends nf{constructor(e){const i=e.renderForms||e.data.hasOwnCanvas||!e.data.hasAppearance&&!!e.data.fieldValue;super(e,{isRenderable:i})}setPropertyOnSiblings(e,i,r,o){const s=this.annotationStorage;for(const n of this._getElementsByName(e.name,e.id))n.domElement&&(n.domElement[i]=r),s.setValue(n.id,{[o]:r})}render(){var e,i;const r=this.annotationStorage,o=this.data.id;this.container.classList.add("textWidgetAnnotation");let s=null;if(this.renderForms){const n=r.getValue(o,{value:this.data.fieldValue});let a=n.value||"";const l=r.getValue(o,{charLimit:this.data.maxLen}).charLimit;l&&a.length>l&&(a=a.slice(0,l));let c=n.formattedValue||((e=this.data.textContent)==null?void 0:e.join(`
1631
1631
  `))||null;c&&this.data.comb&&(c=c.replaceAll(/\s+/g,""));const d={userValue:a,formattedValue:c,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(s=document.createElement("textarea"),s.textContent=c??a,this.data.doNotScroll&&(s.style.overflowY="hidden")):(s=document.createElement("input"),s.type="text",s.setAttribute("value",c??a),this.data.doNotScroll&&(s.style.overflowX="hidden")),this.data.hasOwnCanvas&&(s.hidden=!0),tf.add(s),s.setAttribute("data-element-id",o),s.disabled=this.data.readOnly,s.name=this.data.fieldName,s.tabIndex=Iy,this._setRequired(s,this.data.required),l&&(s.maxLength=l),s.addEventListener("input",u=>{r.setValue(o,{value:u.target.value}),this.setPropertyOnSiblings(s,"value",u.target.value,"value"),d.formattedValue=null}),s.addEventListener("resetform",u=>{const h=this.data.defaultFieldValue??"";s.value=d.userValue=h,d.formattedValue=null});let A=u=>{const{formattedValue:h}=d;h!=null&&(u.target.value=h),u.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){s.addEventListener("focus",h=>{var g;if(d.focused)return;const{target:p}=h;d.userValue&&(p.value=d.userValue),d.lastCommittedValue=p.value,d.commitKey=1,(g=this.data.actions)!=null&&g.Focus||(d.focused=!0)}),s.addEventListener("updatefromsandbox",h=>{this.showElementAndHideCanvas(h.target);const g={value(p){d.userValue=p.detail.value??"",r.setValue(o,{value:d.userValue.toString()}),p.target.value=d.userValue},formattedValue(p){const{formattedValue:m}=p.detail;d.formattedValue=m,m!=null&&p.target!==document.activeElement&&(p.target.value=m),r.setValue(o,{formattedValue:m})},selRange(p){p.target.setSelectionRange(...p.detail.selRange)},charLimit:p=>{var m;const{charLimit:f}=p.detail,{target:v}=p;if(f===0){v.removeAttribute("maxLength");return}v.setAttribute("maxLength",f);let C=d.userValue;!C||C.length<=f||(C=C.slice(0,f),v.value=d.userValue=C,r.setValue(o,{value:C}),(m=this.linkService.eventBus)==null||m.dispatch("dispatcheventinsandbox",{source:this,detail:{id:o,name:"Keystroke",value:C,willCommit:!0,commitKey:1,selStart:v.selectionStart,selEnd:v.selectionEnd}}))}};this._dispatchEventFromSandbox(g,h)}),s.addEventListener("keydown",h=>{var g;d.commitKey=1;let p=-1;if(h.key==="Escape"?p=0:h.key==="Enter"&&!this.data.multiLine?p=2:h.key==="Tab"&&(d.commitKey=3),p===-1)return;const{value:m}=h.target;d.lastCommittedValue!==m&&(d.lastCommittedValue=m,d.userValue=m,(g=this.linkService.eventBus)==null||g.dispatch("dispatcheventinsandbox",{source:this,detail:{id:o,name:"Keystroke",value:m,willCommit:!0,commitKey:p,selStart:h.target.selectionStart,selEnd:h.target.selectionEnd}}))});const u=A;A=null,s.addEventListener("blur",h=>{var g,p;if(!d.focused||!h.relatedTarget)return;(g=this.data.actions)!=null&&g.Blur||(d.focused=!1);const{value:m}=h.target;d.userValue=m,d.lastCommittedValue!==m&&((p=this.linkService.eventBus)==null||p.dispatch("dispatcheventinsandbox",{source:this,detail:{id:o,name:"Keystroke",value:m,willCommit:!0,commitKey:d.commitKey,selStart:h.target.selectionStart,selEnd:h.target.selectionEnd}})),u(h)}),(i=this.data.actions)!=null&&i.Keystroke&&s.addEventListener("beforeinput",h=>{var g;d.lastCommittedValue=null;const{data:p,target:m}=h,{value:f,selectionStart:v,selectionEnd:C}=m;let y=v,I=C;switch(h.inputType){case"deleteWordBackward":{const B=f.substring(0,v).match(/\w*[^\w]*$/);B&&(y-=B[0].length);break}case"deleteWordForward":{const B=f.substring(v).match(/^[^\w]*\w*/);B&&(I+=B[0].length);break}case"deleteContentBackward":v===C&&(y-=1);break;case"deleteContentForward":v===C&&(I+=1);break}h.preventDefault(),(g=this.linkService.eventBus)==null||g.dispatch("dispatcheventinsandbox",{source:this,detail:{id:o,name:"Keystroke",value:f,change:p||"",willCommit:!1,selStart:y,selEnd:I}})}),this._setEventListeners(s,d,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],h=>h.target.value)}if(A&&s.addEventListener("blur",A),this.data.comb){const u=(this.data.rect[2]-this.data.rect[0])/l;s.classList.add("comb"),s.style.letterSpacing=`calc(${u}px * var(--scale-factor) - 1ch)`}}else s=document.createElement("div"),s.textContent=this.data.fieldValue,s.style.verticalAlign="middle",s.style.display="table-cell",this.data.hasOwnCanvas&&(s.hidden=!0);return this._setTextStyle(s),this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class exi extends nf{constructor(e){super(e,{isRenderable:!!e.data.hasOwnCanvas})}}class txi extends nf{constructor(e){super(e,{isRenderable:e.renderForms})}render(){const e=this.annotationStorage,i=this.data,r=i.id;let o=e.getValue(r,{value:i.exportValue===i.fieldValue}).value;typeof o=="string"&&(o=o!=="Off",e.setValue(r,{value:o})),this.container.classList.add("buttonWidgetAnnotation","checkBox");const s=document.createElement("input");return tf.add(s),s.setAttribute("data-element-id",r),s.disabled=i.readOnly,this._setRequired(s,this.data.required),s.type="checkbox",s.name=i.fieldName,o&&s.setAttribute("checked",!0),s.setAttribute("exportValue",i.exportValue),s.tabIndex=Iy,s.addEventListener("change",n=>{const{name:a,checked:l}=n.target;for(const c of this._getElementsByName(a,r)){const d=l&&c.exportValue===i.exportValue;c.domElement&&(c.domElement.checked=d),e.setValue(c.id,{value:d})}e.setValue(r,{value:l})}),s.addEventListener("resetform",n=>{const a=i.defaultFieldValue||"Off";n.target.checked=a===i.exportValue}),this.enableScripting&&this.hasJSActions&&(s.addEventListener("updatefromsandbox",n=>{const a={value(l){l.target.checked=l.detail.value!=="Off",e.setValue(r,{value:l.target.checked})}};this._dispatchEventFromSandbox(a,n)}),this._setEventListeners(s,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],n=>n.target.checked)),this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class T4e extends nf{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("buttonWidgetAnnotation","radioButton");const e=this.annotationStorage,i=this.data,r=i.id;let o=e.getValue(r,{value:i.fieldValue===i.buttonValue}).value;if(typeof o=="string"&&(o=o!==i.buttonValue,e.setValue(r,{value:o})),o)for(const n of this._getElementsByName(i.fieldName,r))e.setValue(n.id,{value:!1});const s=document.createElement("input");if(tf.add(s),s.setAttribute("data-element-id",r),s.disabled=i.readOnly,this._setRequired(s,this.data.required),s.type="radio",s.name=i.fieldName,o&&s.setAttribute("checked",!0),s.tabIndex=Iy,s.addEventListener("change",n=>{const{name:a,checked:l}=n.target;for(const c of this._getElementsByName(a,r))e.setValue(c.id,{value:!1});e.setValue(r,{value:l})}),s.addEventListener("resetform",n=>{const a=i.defaultFieldValue;n.target.checked=a!=null&&a===i.buttonValue}),this.enableScripting&&this.hasJSActions){const n=i.buttonValue;s.addEventListener("updatefromsandbox",a=>{const l={value:c=>{const d=n===c.detail.value;for(const A of this._getElementsByName(c.target.name)){const u=d&&A.id===r;A.domElement&&(A.domElement.checked=u),e.setValue(A.id,{value:u})}}};this._dispatchEventFromSandbox(l,a)}),this._setEventListeners(s,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],a=>a.target.checked)}return this._setBackgroundColor(s),this._setDefaultPropertiesFromJS(s),this.container.append(s),this.container}}class ixi extends F4e{constructor(e){super(e,{ignoreBorder:e.data.hasAppearance})}render(){const e=super.render();e.classList.add("buttonWidgetAnnotation","pushButton");const i=e.lastChild;return this.enableScripting&&this.hasJSActions&&i&&(this._setDefaultPropertiesFromJS(i),i.addEventListener("updatefromsandbox",r=>{this._dispatchEventFromSandbox({},r)})),e}}class rxi extends nf{constructor(e){super(e,{isRenderable:e.renderForms})}render(){this.container.classList.add("choiceWidgetAnnotation");const e=this.annotationStorage,i=this.data.id,r=e.getValue(i,{value:this.data.fieldValue}),o=document.createElement("select");tf.add(o),o.setAttribute("data-element-id",i),o.disabled=this.data.readOnly,this._setRequired(o,this.data.required),o.name=this.data.fieldName,o.tabIndex=Iy;let s=this.data.combo&&this.data.options.length>0;this.data.combo||(o.size=this.data.options.length,this.data.multiSelect&&(o.multiple=!0)),o.addEventListener("resetform",d=>{const A=this.data.defaultFieldValue;for(const u of o.options)u.selected=u.value===A});for(const d of this.data.options){const A=document.createElement("option");A.textContent=d.displayValue,A.value=d.exportValue,r.value.includes(d.exportValue)&&(A.setAttribute("selected",!0),s=!1),o.append(A)}let n=null;if(s){const d=document.createElement("option");d.value=" ",d.setAttribute("hidden",!0),d.setAttribute("selected",!0),o.prepend(d),n=()=>{d.remove(),o.removeEventListener("input",n),n=null},o.addEventListener("input",n)}const a=d=>{const A=d?"value":"textContent",{options:u,multiple:h}=o;return h?Array.prototype.filter.call(u,g=>g.selected).map(g=>g[A]):u.selectedIndex===-1?null:u[u.selectedIndex][A]};let l=a(!1);const c=d=>{const A=d.target.options;return Array.prototype.map.call(A,u=>({displayValue:u.textContent,exportValue:u.value}))};return this.enableScripting&&this.hasJSActions?(o.addEventListener("updatefromsandbox",d=>{const A={value(u){n?.();const h=u.detail.value,g=new Set(Array.isArray(h)?h:[h]);for(const p of o.options)p.selected=g.has(p.value);e.setValue(i,{value:a(!0)}),l=a(!1)},multipleSelection(u){o.multiple=!0},remove(u){const h=o.options,g=u.detail.remove;h[g].selected=!1,o.remove(g),h.length>0&&Array.prototype.findIndex.call(h,p=>p.selected)===-1&&(h[0].selected=!0),e.setValue(i,{value:a(!0),items:c(u)}),l=a(!1)},clear(u){for(;o.length!==0;)o.remove(0);e.setValue(i,{value:null,items:[]}),l=a(!1)},insert(u){const{index:h,displayValue:g,exportValue:p}=u.detail.insert,m=o.children[h],f=document.createElement("option");f.textContent=g,f.value=p,m?m.before(f):o.append(f),e.setValue(i,{value:a(!0),items:c(u)}),l=a(!1)},items(u){const{items:h}=u.detail;for(;o.length!==0;)o.remove(0);for(const g of h){const{displayValue:p,exportValue:m}=g,f=document.createElement("option");f.textContent=p,f.value=m,o.append(f)}o.options.length>0&&(o.options[0].selected=!0),e.setValue(i,{value:a(!0),items:c(u)}),l=a(!1)},indices(u){const h=new Set(u.detail.indices);for(const g of u.target.options)g.selected=h.has(g.index);e.setValue(i,{value:a(!0)}),l=a(!1)},editable(u){u.target.disabled=!u.detail.editable}};this._dispatchEventFromSandbox(A,d)}),o.addEventListener("input",d=>{var A;const u=a(!0),h=a(!1);e.setValue(i,{value:u}),d.preventDefault(),(A=this.linkService.eventBus)==null||A.dispatch("dispatcheventinsandbox",{source:this,detail:{id:i,name:"Keystroke",value:l,change:h,changeEx:u,willCommit:!1,commitKey:1,keyDown:!1}})}),this._setEventListeners(o,null,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"],["input","Action"],["input","Validate"]],d=>d.target.value)):o.addEventListener("input",function(d){e.setValue(i,{value:a(!0)})}),this.data.combo&&this._setTextStyle(o),this._setBackgroundColor(o),this._setDefaultPropertiesFromJS(o),this.container.append(o),this.container}}class XV extends wn{constructor(e){const{data:i,elements:r}=e;super(e,{isRenderable:wn._hasPopupData(i)}),this.elements=r,this.popup=null}render(){this.container.classList.add("popupAnnotation");const e=this.popup=new oxi({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate,contentsObj:this.data.contentsObj,richText:this.data.richText,rect:this.data.rect,parentRect:this.data.parentRect||null,parent:this.parent,elements:this.elements,open:this.data.open}),i=[];for(const r of this.elements)r.popup=e,i.push(r.data.id),r.addHighlightArea();return this.container.setAttribute("aria-controls",i.map(r=>`${dve}${r}`).join(",")),this.container}}var By,$V,eq,Ey,Wv,zo,a0,ky,zM,KM,xy,l0,hA,c0,JM,d0,YM,sf,Zv,bn,WM,tq,N4e,U4e,O4e,H4e,ZM,XM,iq;class oxi{constructor({container:e,color:i,elements:r,titleObj:o,modificationDate:s,contentsObj:n,richText:a,parent:l,rect:c,parentRect:d,open:A}){ce(this,bn),ce(this,By,$(this,bn,O4e).bind(this)),ce(this,$V,$(this,bn,iq).bind(this)),ce(this,eq,$(this,bn,XM).bind(this)),ce(this,Ey,$(this,bn,ZM).bind(this)),ce(this,Wv,null),ce(this,zo,null),ce(this,a0,null),ce(this,ky,null),ce(this,zM,null),ce(this,KM,null),ce(this,xy,null),ce(this,l0,!1),ce(this,hA,null),ce(this,c0,null),ce(this,JM,null),ce(this,d0,null),ce(this,YM,null),ce(this,sf,null),ce(this,Zv,!1);var u;ie(this,zo,e),ie(this,YM,o),ie(this,a0,n),ie(this,d0,a),ie(this,KM,l),ie(this,Wv,i),ie(this,JM,c),ie(this,xy,d),ie(this,zM,r),ie(this,ky,Cve.toDateObject(s)),this.trigger=r.flatMap(h=>h.getElementsToTriggerPopup());for(const h of this.trigger)h.addEventListener("click",M(this,Ey)),h.addEventListener("mouseenter",M(this,eq)),h.addEventListener("mouseleave",M(this,$V)),h.classList.add("popupTriggerArea");for(const h of r)(u=h.container)==null||u.addEventListener("keydown",M(this,By));M(this,zo).hidden=!0,A&&$(this,bn,ZM).call(this)}render(){if(M(this,hA))return;const e=ie(this,hA,document.createElement("div"));if(e.className="popup",M(this,Wv)){const s=e.style.outlineColor=ti.makeHexColor(...M(this,Wv));CSS.supports("background-color","color-mix(in srgb, red 30%, white)")?e.style.backgroundColor=`color-mix(in srgb, ${s} 30%, white)`:e.style.backgroundColor=ti.makeHexColor(...M(this,Wv).map(n=>Math.floor(.7*(255-n)+n)))}const i=document.createElement("span");i.className="header";const r=document.createElement("h1");if(i.append(r),{dir:r.dir,str:r.textContent}=M(this,YM),e.append(i),M(this,ky)){const s=document.createElement("span");s.classList.add("popupDate"),s.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),s.setAttribute("data-l10n-args",JSON.stringify({dateObj:M(this,ky).valueOf()})),i.append(s)}const o=M(this,bn,WM);if(o)P4e.render({xfaHtml:o,intent:"richText",div:e}),e.lastChild.classList.add("richText","popupContent");else{const s=this._formatContents(M(this,a0));e.append(s)}M(this,zo).append(e)}_formatContents({str:e,dir:i}){const r=document.createElement("p");r.classList.add("popupContent"),r.dir=i;const o=e.split(/(?:\r\n?|\n)/);for(let s=0,n=o.length;s<n;++s){const a=o[s];r.append(document.createTextNode(a)),s<n-1&&r.append(document.createElement("br"))}return r}updateEdited({rect:e,popupContent:i}){var r;M(this,sf)||ie(this,sf,{contentsObj:M(this,a0),richText:M(this,d0)}),e&&ie(this,c0,null),i&&(ie(this,d0,$(this,bn,U4e).call(this,i)),ie(this,a0,null)),(r=M(this,hA))==null||r.remove(),ie(this,hA,null)}resetEdited(){var e;M(this,sf)&&({contentsObj:ol(this,a0)._,richText:ol(this,d0)._}=M(this,sf),ie(this,sf,null),(e=M(this,hA))==null||e.remove(),ie(this,hA,null),ie(this,c0,null))}forceHide(){ie(this,Zv,this.isVisible),M(this,Zv)&&(M(this,zo).hidden=!0)}maybeShow(){M(this,Zv)&&(M(this,hA)||$(this,bn,XM).call(this),ie(this,Zv,!1),M(this,zo).hidden=!1)}get isVisible(){return M(this,zo).hidden===!1}}By=new WeakMap,$V=new WeakMap,eq=new WeakMap,Ey=new WeakMap,Wv=new WeakMap,zo=new WeakMap,a0=new WeakMap,ky=new WeakMap,zM=new WeakMap,KM=new WeakMap,xy=new WeakMap,l0=new WeakMap,hA=new WeakMap,c0=new WeakMap,JM=new WeakMap,d0=new WeakMap,YM=new WeakMap,sf=new WeakMap,Zv=new WeakMap,bn=new WeakSet,WM=function(){const t=M(this,d0),e=M(this,a0);return t!=null&&t.str&&(!(e!=null&&e.str)||e.str===t.str)&&M(this,d0).html||null},tq=function(){var t,e,i;return((i=(e=(t=M(this,bn,WM))==null?void 0:t.attributes)==null?void 0:e.style)==null?void 0:i.fontSize)||0},N4e=function(){var t,e,i;return((i=(e=(t=M(this,bn,WM))==null?void 0:t.attributes)==null?void 0:e.style)==null?void 0:i.color)||null},U4e=function(t){const e=[],i={str:t,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:e}]}},r={style:{color:M(this,bn,N4e),fontSize:M(this,bn,tq)?`calc(${M(this,bn,tq)}px * var(--scale-factor))`:""}};for(const o of t.split(`
@@ -1688,4 +1688,4 @@ startxref
1688
1688
  `),u=new Te(i);if(u.set("FormType",1),u.set("Subtype",Ze.get("Form")),u.set("Type",Ze.get("XObject")),u.set("BBox",s),u.set("Length",A.length),l!==1){const g=new Te(i),p=new Te(i),m=new Te(i);m.set("CA",l),m.set("Type",Ze.get("ExtGState")),p.set("R0",m),g.set("ExtGState",p),u.set("Resources",g)}const h=new Ll(A);return h.dict=u,h}static async createNewAppearanceStreamForHighlight(e,i,r){const{color:o,rect:s,outlines:{outline:n},opacity:a}=e,l=[`${ch(o,!0)}`,"/R0 gs"];l.push(`${sr(n[4])} ${sr(n[5])} m`);for(let p=6,m=n.length;p<m;p+=6)if(isNaN(n[p])||n[p]===null)l.push(`${sr(n[p+4])} ${sr(n[p+5])} l`);else{const f=n.slice(p,p+6).map(sr).join(" ");l.push(`${f} c`)}l.push("h f");const c=l.join(`
1689
1689
  `),d=new Te(i);d.set("FormType",1),d.set("Subtype",Ze.get("Form")),d.set("Type",Ze.get("XObject")),d.set("BBox",s),d.set("Length",c.length);const A=new Te(i),u=new Te(i);A.set("ExtGState",u),d.set("Resources",A);const h=new Te(i);u.set("R0",h),h.set("BM",Ze.get("Multiply")),a!==1&&(h.set("ca",a),h.set("Type",Ze.get("ExtGState")));const g=new Ll(c);return g.dict=d,g}}class Dz extends rl{constructor(e){var i;super(e);const{dict:r,xref:o}=e;if(this.data.annotationType=jn.HIGHLIGHT,this.data.quadPoints=KI(r,null)){const s=(i=this.appearance)==null?void 0:i.dict.get("Resources");if(!this.appearance||!(s!=null&&s.has("ExtGState"))){this.appearance&&Qe("HighlightAnnotation - ignoring built-in appearance stream.");const n=this.color?il(this.color):[1,1,0],a=r.get("CA");this._setDefaultAppearance({xref:o,fillColor:n,blendMode:"Multiply",fillAlpha:a,pointsCallback:(l,c)=>(l.push(`${c[0]} ${c[1]} m`,`${c[2]} ${c[3]} l`,`${c[6]} ${c[7]} l`,`${c[4]} ${c[5]} l`,"f"),[c[0],c[2],c[7],c[3]])})}}else this.data.popupRef=null}static createNewDict(e,i,{apRef:r,ap:o}){const{color:s,opacity:n,rect:a,rotation:l,user:c,quadPoints:d}=e,A=new Te(i);if(A.set("Type",Ze.get("Annot")),A.set("Subtype",Ze.get("Highlight")),A.set("CreationDate",`D:${I0()}`),A.set("Rect",a),A.set("F",4),A.set("Border",[0,0,0]),A.set("Rotate",l),A.set("QuadPoints",d),A.set("C",Array.from(s,u=>u/255)),A.set("CA",n),c&&A.set("T",yA(c)),r||o){const u=new Te(i);A.set("AP",u),u.set("N",r||o)}return A}static async createNewAppearanceStream(e,i,r){const{color:o,rect:s,outlines:n,opacity:a}=e,l=[`${ch(o,!0)}`,"/R0 gs"],c=[];for(const m of n){c.length=0,c.push(`${sr(m[0])} ${sr(m[1])} m`);for(let f=2,v=m.length;f<v;f+=2)c.push(`${sr(m[f])} ${sr(m[f+1])} l`);c.push("h"),l.push(c.join(`
1690
1690
  `))}l.push("f*");const d=l.join(`
1691
- `),A=new Te(i);A.set("FormType",1),A.set("Subtype",Ze.get("Form")),A.set("Type",Ze.get("XObject")),A.set("BBox",s),A.set("Length",d.length);const u=new Te(i),h=new Te(i);u.set("ExtGState",h),A.set("Resources",u);const g=new Te(i);h.set("R0",g),g.set("BM",Ze.get("Multiply")),a!==1&&(g.set("ca",a),g.set("Type",Ze.get("ExtGState")));const p=new Ll(d);return p.dict=A,p}}class iUi extends rl{constructor(e){super(e);const{dict:i,xref:r}=e;if(this.data.annotationType=jn.UNDERLINE,this.data.quadPoints=KI(i,null)){if(!this.appearance){const o=this.color?il(this.color):[0,0,0],s=i.get("CA");this._setDefaultAppearance({xref:r,extra:"[] 0 d 0.571 w",strokeColor:o,strokeAlpha:s,pointsCallback:(n,a)=>(n.push(`${a[4]} ${a[5]+1.3} m`,`${a[6]} ${a[7]+1.3} l`,"S"),[a[0],a[2],a[7],a[3]])})}}else this.data.popupRef=null}}class rUi extends rl{constructor(e){super(e);const{dict:i,xref:r}=e;if(this.data.annotationType=jn.SQUIGGLY,this.data.quadPoints=KI(i,null)){if(!this.appearance){const o=this.color?il(this.color):[0,0,0],s=i.get("CA");this._setDefaultAppearance({xref:r,extra:"[] 0 d 1 w",strokeColor:o,strokeAlpha:s,pointsCallback:(n,a)=>{const l=(a[1]-a[5])/6;let c=l,d=a[4];const A=a[5],u=a[6];n.push(`${d} ${A+c} m`);do d+=2,c=c===0?l:0,n.push(`${d} ${A+c} l`);while(d<u);return n.push("S"),[a[4],u,A-2*l,A+2*l]}})}}else this.data.popupRef=null}}class oUi extends rl{constructor(e){super(e);const{dict:i,xref:r}=e;if(this.data.annotationType=jn.STRIKEOUT,this.data.quadPoints=KI(i,null)){if(!this.appearance){const o=this.color?il(this.color):[0,0,0],s=i.get("CA");this._setDefaultAppearance({xref:r,extra:"[] 0 d 1 w",strokeColor:o,strokeAlpha:s,pointsCallback:(n,a)=>(n.push(`${(a[0]+a[4])/2} ${(a[1]+a[5])/2} m`,`${(a[2]+a[6])/2} ${(a[3]+a[7])/2} l`,"S"),[a[0],a[2],a[7],a[3]])})}}else this.data.popupRef=null}}class uP extends rl{constructor(e){super(e),this.data.annotationType=jn.STAMP,this.data.hasOwnCanvas=this.data.noRotate,this.data.noHTML=!1}static async createImage(e,i){const{width:r,height:o}=e,s=new OffscreenCanvas(r,o),n=s.getContext("2d",{alpha:!0});n.drawImage(e,0,0);const a=n.getImageData(0,0,r,o).data,l=new Uint32Array(a.buffer),c=l.some(ih.isLittleEndian?p=>p>>>24!==255:p=>(p&255)!==255);c&&(n.fillStyle="white",n.fillRect(0,0,r,o),n.drawImage(e,0,0));const d=s.convertToBlob({type:"image/jpeg",quality:1}).then(p=>p.arrayBuffer()),A=Ze.get("XObject"),u=Ze.get("Image"),h=new Te(i);h.set("Type",A),h.set("Subtype",u),h.set("BitsPerComponent",8),h.set("ColorSpace",Ze.get("DeviceRGB")),h.set("Filter",Ze.get("DCTDecode")),h.set("BBox",[0,0,r,o]),h.set("Width",r),h.set("Height",o);let g=null;if(c){const p=new Uint8Array(l.length);if(ih.isLittleEndian)for(let f=0,v=l.length;f<v;f++)p[f]=l[f]>>>24;else for(let f=0,v=l.length;f<v;f++)p[f]=l[f]&255;const m=new Te(i);m.set("Type",A),m.set("Subtype",u),m.set("BitsPerComponent",8),m.set("ColorSpace",Ze.get("DeviceGray")),m.set("Width",r),m.set("Height",o),g=new fo(p,0,0,m)}return{imageStream:new fo(await d,0,0,h),smaskStream:g,width:r,height:o}}static createNewDict(e,i,{apRef:r,ap:o}){const{rect:s,rotation:n,user:a}=e,l=new Te(i);if(l.set("Type",Ze.get("Annot")),l.set("Subtype",Ze.get("Stamp")),l.set("CreationDate",`D:${I0()}`),l.set("Rect",s),l.set("F",4),l.set("Border",[0,0,0]),l.set("Rotate",n),a&&l.set("T",yA(a)),r||o){const c=new Te(i);l.set("AP",c),r?c.set("N",r):c.set("N",o)}return l}static async createNewAppearanceStream(e,i,r){const{rotation:o}=e,{imageRef:s,width:n,height:a}=r.image,l=new Te(i),c=new Te(i);l.set("XObject",c),c.set("Im0",s);const d=`q ${n} 0 0 ${a} 0 0 cm /Im0 Do Q`,A=new Te(i);if(A.set("FormType",1),A.set("Subtype",Ze.get("Form")),A.set("Type",Ze.get("XObject")),A.set("BBox",[0,0,n,a]),A.set("Resources",l),o){const h=eD(o,n,a);A.set("Matrix",h)}const u=new Ll(d);return u.dict=A,u}}class nUi extends rl{constructor(e){super(e);const{dict:i,xref:r}=e,o=new q_(i.get("FS"),r);this.data.annotationType=jn.FILEATTACHMENT,this.data.hasOwnCanvas=this.data.noRotate,this.data.noHTML=!1,this.data.file=o.serializable;const s=i.get("Name");this.data.name=s instanceof Ze?Gi(s.name):"PushPin";const n=i.get("ca");this.data.fillAlpha=typeof n=="number"&&n>=0&&n<=1?n:null}}function lCe(t){try{return oI(t)}catch(e){return Qe(`UTF-8 decoding failed: "${e}".`),t}}class sUi extends GD{constructor(e){super(e),this.node=null}onEndElement(e){const i=super.onEndElement(e);if(i&&e==="xfa:datasets")throw this.node=i,new Error("Aborting DatasetXMLParser.")}}class aUi{constructor(e){if(e.datasets)this.node=new GD({hasAttributes:!0}).parseFromString(e.datasets).documentElement;else{const i=new sUi({hasAttributes:!0});try{i.parseFromString(e["xdp:xdp"])}catch{}this.node=i.node}}getValue(e){if(!this.node||!e)return"";const i=this.node.searchNode(Y5e(e),0);if(!i)return"";const r=i.firstChild;return r?.nodeName==="value"?i.children.map(o=>lCe(o.textContent)):lCe(i.textContent)}}var WI;class lUi{constructor(e,i){ce(this,WI,null),this.stream=e,this.pdfManager=i,this.entries=[],this._xrefStms=new Set,this._cacheMap=new Map,this._pendingRefs=new Bn,this._newPersistentRefNum=null,this._newTemporaryRefNum=null,this._persistentRefsCache=null}getNewPersistentRef(e){this._newPersistentRefNum===null&&(this._newPersistentRefNum=this.entries.length||1);const i=this._newPersistentRefNum++;return this._cacheMap.set(i,e),bt.get(i,0)}getNewTemporaryRef(){if(this._newTemporaryRefNum===null&&(this._newTemporaryRefNum=this.entries.length||1,this._newPersistentRefNum)){this._persistentRefsCache=new Map;for(let e=this._newTemporaryRefNum;e<this._newPersistentRefNum;e++)this._persistentRefsCache.set(e,this._cacheMap.get(e)),this._cacheMap.delete(e)}return bt.get(this._newTemporaryRefNum++,0)}resetNewTemporaryRef(){if(this._newTemporaryRefNum=null,this._persistentRefsCache)for(const[e,i]of this._persistentRefsCache)this._cacheMap.set(e,i);this._persistentRefsCache=null}setStartXRef(e){this.startXRefQueue=[e]}parse(e=!1){let i;e?(Qe("Indexing all PDF objects"),i=this.indexObjects()):i=this.readXRef(),i.assignXref(this),this.trailer=i;let r;try{r=i.get("Encrypt")}catch(s){if(s instanceof zr)throw s;Qe(`XRef.parse - Invalid "Encrypt" reference: "${s}".`)}if(r instanceof Te){const s=i.get("ID"),n=s!=null&&s.length?s[0]:"";r.suppressEncryption=!0,this.encrypt=new GDi(r,n,this.pdfManager.password)}let o;try{o=i.get("Root")}catch(s){if(s instanceof zr)throw s;Qe(`XRef.parse - Invalid "Root" reference: "${s}".`)}if(o instanceof Te)try{if(o.get("Pages")instanceof Te){this.root=o;return}}catch(s){if(s instanceof zr)throw s;Qe(`XRef.parse - Invalid "Pages" reference: "${s}".`)}throw e?new YS("Invalid Root reference."):new b4}processXRefTable(e){"tableState"in this||(this.tableState={entryNum:0,streamPos:e.lexer.stream.pos,parserBuf1:e.buf1,parserBuf2:e.buf2});const i=this.readXRefTable(e);if(!En(i,"trailer"))throw new it("Invalid XRef table: could not find trailer dictionary");let r=e.getObj();if(!(r instanceof Te)&&r.dict&&(r=r.dict),!(r instanceof Te))throw new it("Invalid XRef table: could not parse trailer dictionary");return delete this.tableState,r}readXRefTable(e){const i=e.lexer.stream,r=this.tableState;i.pos=r.streamPos,e.buf1=r.parserBuf1,e.buf2=r.parserBuf2;let o;for(;;){if(!("firstEntryNum"in r)||!("entryCount"in r)){if(En(o=e.getObj(),"trailer"))break;r.firstEntryNum=o,r.entryCount=e.getObj()}let s=r.firstEntryNum;const n=r.entryCount;if(!Number.isInteger(s)||!Number.isInteger(n))throw new it("Invalid XRef table: wrong types in subsection header");for(let a=r.entryNum;a<n;a++){r.streamPos=i.pos,r.entryNum=a,r.parserBuf1=e.buf1,r.parserBuf2=e.buf2;const l={};l.offset=e.getObj(),l.gen=e.getObj();const c=e.getObj();if(c instanceof Wo)switch(c.cmd){case"f":l.free=!0;break;case"n":l.uncompressed=!0;break}if(!Number.isInteger(l.offset)||!Number.isInteger(l.gen)||!(l.free||l.uncompressed))throw new it(`Invalid entry in XRef subsection: ${s}, ${n}`);a===0&&l.free&&s===1&&(s=0),this.entries[a+s]||(this.entries[a+s]=l)}r.entryNum=0,r.streamPos=i.pos,r.parserBuf1=e.buf1,r.parserBuf2=e.buf2,delete r.firstEntryNum,delete r.entryCount}if(this.entries[0]&&!this.entries[0].free)throw new it("Invalid XRef table: unexpected first object");return o}processXRefStream(e){if(!("streamState"in this)){const i=e.dict,r=i.get("W");let o=i.get("Index");o||(o=[0,i.get("Size")]),this.streamState={entryRanges:o,byteWidths:r,entryNum:0,streamPos:e.pos}}return this.readXRefStream(e),delete this.streamState,e.dict}readXRefStream(e){const i=this.streamState;e.pos=i.streamPos;const[r,o,s]=i.byteWidths,n=i.entryRanges;for(;n.length>0;){const[a,l]=n;if(!Number.isInteger(a)||!Number.isInteger(l))throw new it(`Invalid XRef range fields: ${a}, ${l}`);if(!Number.isInteger(r)||!Number.isInteger(o)||!Number.isInteger(s))throw new it(`Invalid XRef entry fields length: ${a}, ${l}`);for(let c=i.entryNum;c<l;++c){i.entryNum=c,i.streamPos=e.pos;let d=0,A=0,u=0;for(let g=0;g<r;++g){const p=e.getByte();if(p===-1)throw new it("Invalid XRef byteWidths 'type'.");d=d<<8|p}r===0&&(d=1);for(let g=0;g<o;++g){const p=e.getByte();if(p===-1)throw new it("Invalid XRef byteWidths 'offset'.");A=A<<8|p}for(let g=0;g<s;++g){const p=e.getByte();if(p===-1)throw new it("Invalid XRef byteWidths 'generation'.");u=u<<8|p}const h={};switch(h.offset=A,h.gen=u,d){case 0:h.free=!0;break;case 1:h.uncompressed=!0;break;case 2:break;default:throw new it(`Invalid XRef entry type: ${d}`)}this.entries[a+c]||(this.entries[a+c]=h)}i.entryNum=0,i.streamPos=e.pos,n.splice(0,2)}}indexObjects(){function e(y,I){let B="",E=y[I];for(;E!==10&&E!==13&&E!==60&&!(++I>=y.length);)B+=String.fromCharCode(E),E=y[I];return B}function i(y,I,B){const E=B.length,k=y.length;let Q=0;for(;I<k;){let S=0;for(;S<E&&y[I+S]===B[S];)++S;if(S>=E)break;I++,Q++}return Q}const r=/\b(endobj|\d+\s+\d+\s+obj|xref|trailer\s*<<)\b/g,o=/\b(startxref|\d+\s+\d+\s+obj)\b/g,s=/^(\d+)\s+(\d+)\s+obj\b/,n=new Uint8Array([116,114,97,105,108,101,114]),a=new Uint8Array([115,116,97,114,116,120,114,101,102]),l=new Uint8Array([47,88,82,101,102]);this.entries.length=0,this._cacheMap.clear();const c=this.stream;c.pos=0;const d=c.getBytes(),A=Xa(d),u=d.length;let h=c.start;const g=[],p=[];for(;h<u;){let y=d[h];if(y===9||y===10||y===13||y===32){++h;continue}if(y===37){do{if(++h,h>=u)break;y=d[h]}while(y!==10&&y!==13);continue}const I=e(d,h);let B;if(I.startsWith("xref")&&(I.length===4||/\s/.test(I[4])))h+=i(d,h,n),g.push(h),h+=i(d,h,a);else if(B=s.exec(I)){const E=B[1]|0,k=B[2]|0,Q=h+I.length;let S,D=!1;if(!this.entries[E])D=!0;else if(this.entries[E].gen===k)try{new x0({lexer:new Ad(c.makeSubStream(Q))}).getObj(),D=!0}catch(q){q instanceof Oq?Qe(`indexObjects -- checking object (${I}): "${q}".`):D=!0}D&&(this.entries[E]={offset:h-c.start,gen:k,uncompressed:!0}),r.lastIndex=Q;const R=r.exec(A);R?(S=r.lastIndex+1-h,R[1]!=="endobj"&&(Qe(`indexObjects: Found "${R[1]}" inside of another "obj", caused by missing "endobj" -- trying to recover.`),S-=R[1].length+1)):S=u-h;const N=d.subarray(h,h+S),H=i(N,0,l);H<S&&N[H+5]<64&&(p.push(h-c.start),this._xrefStms.add(h-c.start)),h+=S}else if(I.startsWith("trailer")&&(I.length===7||/\s/.test(I[7]))){g.push(h);const E=h+I.length;let k;o.lastIndex=E;const Q=o.exec(A);Q?(k=o.lastIndex+1-h,Q[1]!=="startxref"&&(Qe(`indexObjects: Found "${Q[1]}" after "trailer", caused by missing "startxref" -- trying to recover.`),k-=Q[1].length+1)):k=u-h,h+=k}else h+=I.length+1}for(const y of p)this.startXRefQueue.push(y),this.readXRef(!0);const m=[];let f=!1;for(const y of g){c.pos=y;const I=new x0({lexer:new Ad(c),xref:this,allowStreams:!0,recoveryMode:!0}),B=I.getObj();if(!En(B,"trailer"))continue;const E=I.getObj();E instanceof Te&&(m.push(E),E.has("Encrypt")&&(f=!0))}let v,C;for(const y of[...m,"genFallback",...m]){if(y==="genFallback"){if(!C)break;this._generationFallback=!0;continue}let I=!1;try{const B=y.get("Root");if(!(B instanceof Te))continue;const E=B.get("Pages");if(!(E instanceof Te))continue;const k=E.get("Count");Number.isInteger(k)&&(I=!0)}catch(B){C=B;continue}if(I&&(!f||y.has("Encrypt"))&&y.has("ID"))return y;v=y}if(v)return v;if(this.topDict)return this.topDict;throw new YS("Invalid PDF structure.")}readXRef(e=!1){const i=this.stream,r=new Set;for(;this.startXRefQueue.length;){try{const o=this.startXRefQueue[0];if(r.has(o)){Qe("readXRef - skipping XRef table since it was already parsed."),this.startXRefQueue.shift();continue}r.add(o),i.pos=o+i.start;const s=new x0({lexer:new Ad(i),xref:this,allowStreams:!0});let n=s.getObj(),a;if(En(n,"xref"))a=this.processXRefTable(s),this.topDict||(this.topDict=a),n=a.get("XRefStm"),Number.isInteger(n)&&!this._xrefStms.has(n)&&(this._xrefStms.add(n),this.startXRefQueue.push(n),M(this,WI)??ie(this,WI,n));else if(Number.isInteger(n)){if(!Number.isInteger(s.getObj())||!En(s.getObj(),"obj")||!((n=s.getObj())instanceof Ii))throw new it("Invalid XRef stream");if(a=this.processXRefStream(n),this.topDict||(this.topDict=a),!a)throw new it("Failed to read XRef stream")}else throw new it("Invalid XRef stream header");n=a.get("Prev"),Number.isInteger(n)?this.startXRefQueue.push(n):n instanceof bt&&this.startXRefQueue.push(n.num)}catch(o){if(o instanceof zr)throw o;yi("(while reading XRef): "+o)}this.startXRefQueue.shift()}if(this.topDict)return this.topDict;if(!e)throw new b4}get lastXRefStreamPos(){return M(this,WI)??(this._xrefStms.size>0?Math.max(...this._xrefStms):null)}getEntry(e){const i=this.entries[e];return i&&!i.free&&i.offset?i:null}fetchIfRef(e,i=!1){return e instanceof bt?this.fetch(e,i):e}fetch(e,i=!1){if(!(e instanceof bt))throw new Error("ref object is not a reference");const r=e.num,o=this._cacheMap.get(r);if(o!==void 0)return o instanceof Te&&!o.objId&&(o.objId=e.toString()),o;let s=this.getEntry(r);if(s===null)return this._cacheMap.set(r,s),s;if(this._pendingRefs.has(e))return this._pendingRefs.remove(e),Qe(`Ignoring circular reference: ${e}.`),Txi;this._pendingRefs.put(e);try{s=s.uncompressed?this.fetchUncompressed(e,s,i):this.fetchCompressed(e,s,i),this._pendingRefs.remove(e)}catch(n){throw this._pendingRefs.remove(e),n}return s instanceof Te?s.objId=e.toString():s instanceof Ii&&(s.dict.objId=e.toString()),s}fetchUncompressed(e,i,r=!1){const o=e.gen;let s=e.num;if(i.gen!==o){const A=`Inconsistent generation in XRef: ${e}`;if(this._generationFallback&&i.gen<o)return Qe(A),this.fetchUncompressed(bt.get(s,i.gen),i,r);throw new w0(A)}const n=this.stream.makeSubStream(i.offset+this.stream.start),a=new x0({lexer:new Ad(n),xref:this,allowStreams:!0}),l=a.getObj(),c=a.getObj(),d=a.getObj();if(l!==s||c!==o||!(d instanceof Wo))throw new w0(`Bad (uncompressed) XRef entry: ${e}`);if(d.cmd!=="obj"){if(d.cmd.startsWith("obj")&&(s=parseInt(d.cmd.substring(3),10),!Number.isNaN(s)))return s;throw new w0(`Bad (uncompressed) XRef entry: ${e}`)}return i=this.encrypt&&!r?a.getObj(this.encrypt.createCipherTransform(s,o)):a.getObj(),i instanceof Ii||this._cacheMap.set(s,i),i}fetchCompressed(e,i,r=!1){const o=i.offset,s=this.fetch(bt.get(o,0));if(!(s instanceof Ii))throw new it("bad ObjStm stream");const n=s.dict.get("First"),a=s.dict.get("N");if(!Number.isInteger(n)||!Number.isInteger(a))throw new it("invalid first and n parameters for ObjStm stream");let l=new x0({lexer:new Ad(s),xref:this,allowStreams:!0});const c=new Array(a),d=new Array(a);for(let h=0;h<a;++h){const g=l.getObj();if(!Number.isInteger(g))throw new it(`invalid object number in the ObjStm stream: ${g}`);const p=l.getObj();if(!Number.isInteger(p))throw new it(`invalid object offset in the ObjStm stream: ${p}`);c[h]=g,d[h]=p}const A=(s.start||0)+n,u=new Array(a);for(let h=0;h<a;++h){const g=h<a-1?d[h+1]-d[h]:void 0;if(g<0)throw new it("Invalid offset in the ObjStm stream.");l=new x0({lexer:new Ad(s.makeSubStream(A+d[h],g,s.dict)),xref:this,allowStreams:!0});const p=l.getObj();if(u[h]=p,p instanceof Ii)continue;const m=c[h],f=this.entries[m];f&&f.offset===o&&f.gen===h&&this._cacheMap.set(m,p)}if(i=u[i.gen],i===void 0)throw new w0(`Bad (compressed) XRef entry: ${e}`);return i}async fetchIfRefAsync(e,i){return e instanceof bt?this.fetchAsync(e,i):e}async fetchAsync(e,i){try{return this.fetch(e,i)}catch(r){if(!(r instanceof zr))throw r;return await this.pdfManager.requestRange(r.begin,r.end),this.fetchAsync(e,i)}}getCatalogObj(){return this.root}}WI=new WeakMap;const cUi=1,dUi=[0,0,612,792];var hP,Pz;class cCe{constructor({pdfManager:e,xref:i,pageIndex:r,pageDict:o,ref:s,globalIdFactory:n,fontCache:a,builtInCMapCache:l,standardFontDataCache:c,globalImageCache:d,systemFontCache:A,nonBlendModesSet:u,xfaFactory:h}){ce(this,hP),this.pdfManager=e,this.pageIndex=r,this.pageDict=o,this.xref=i,this.ref=s,this.fontCache=a,this.builtInCMapCache=l,this.standardFontDataCache=c,this.globalImageCache=d,this.systemFontCache=A,this.nonBlendModesSet=u,this.evaluatorOptions=e.evaluatorOptions,this.resourcesPromise=null,this.xfaFactory=h;const g={obj:0};this._localIdFactory=class extends n{static createObjId(){return`p${r}_${++g.obj}`}static getPageObjId(){return`p${s.toString()}`}}}_getInheritableProperty(e,i=!1){const r=Cc({dict:this.pageDict,key:e,getArray:i,stopWhenFound:!1});return Array.isArray(r)?r.length===1||!(r[0]instanceof Te)?r[0]:Te.merge({xref:this.xref,dictArray:r}):r}get content(){return this.pageDict.getArray("Contents")}get resources(){const e=this._getInheritableProperty("Resources");return yt(this,"resources",e instanceof Te?e:Te.empty)}_getBoundingBox(e){if(this.xfaData)return this.xfaData.bbox;const i=rh(this._getInheritableProperty(e,!0),null);if(i){if(i[2]-i[0]>0&&i[3]-i[1]>0)return i;Qe(`Empty, or invalid, /${e} entry.`)}return null}get mediaBox(){return yt(this,"mediaBox",this._getBoundingBox("MediaBox")||dUi)}get cropBox(){return yt(this,"cropBox",this._getBoundingBox("CropBox")||this.mediaBox)}get userUnit(){let e=this.pageDict.get("UserUnit");return(typeof e!="number"||e<=0)&&(e=cUi),yt(this,"userUnit",e)}get view(){const{cropBox:e,mediaBox:i}=this;if(e!==i&&!w4(e,i)){const r=Po.intersect(e,i);if(r&&r[2]-r[0]>0&&r[3]-r[1]>0)return yt(this,"view",r);Qe("Empty /CropBox and /MediaBox intersection.")}return yt(this,"view",i)}get rotate(){let e=this._getInheritableProperty("Rotate")||0;return e%90!==0?e=0:e>=360?e%=360:e<0&&(e=(e%360+360)%360),yt(this,"rotate",e)}_onSubStreamError(e,i){if(this.evaluatorOptions.ignoreErrors){Qe(`getContentStream - ignoring sub-stream (${i}): "${e}".`);return}throw e}getContentStream(){return this.pdfManager.ensure(this,"content").then(e=>e instanceof Ii?e:Array.isArray(e)?new aQi(e,this._onSubStreamError.bind(this)):new tD)}get xfaData(){return yt(this,"xfaData",this.xfaFactory?{bbox:this.xfaFactory.getBoundingBox(this.pageIndex)}:null)}async saveNewAnnotations(e,i,r,o){if(this.xfaFactory)throw new Error("XFA: Cannot save new annotations.");const s=new DA({xref:this.xref,handler:e,pageIndex:this.pageIndex,idFactory:this._localIdFactory,fontCache:this.fontCache,builtInCMapCache:this.builtInCMapCache,standardFontDataCache:this.standardFontDataCache,globalImageCache:this.globalImageCache,systemFontCache:this.systemFontCache,options:this.evaluatorOptions}),n=new dd,a=new Bn;$(this,hP,Pz).call(this,r,n,a);const l=this.pageDict,c=this.annotations.filter(g=>!(g instanceof bt&&n.has(g))),d=await O0.saveNewAnnotations(s,i,r,o);for(const{ref:g}of d.annotations)g instanceof bt&&!a.has(g)&&c.push(g);const A=l.get("Annots");l.set("Annots",c);const u=[];await Ia(this.ref,l,u,this.xref),A&&l.set("Annots",A);const h=d.dependencies;h.push({ref:this.ref,data:u.join("")},...d.annotations);for(const g of n)h.push({ref:g,data:null});return h}save(e,i,r){const o=new DA({xref:this.xref,handler:e,pageIndex:this.pageIndex,idFactory:this._localIdFactory,fontCache:this.fontCache,builtInCMapCache:this.builtInCMapCache,standardFontDataCache:this.standardFontDataCache,globalImageCache:this.globalImageCache,systemFontCache:this.systemFontCache,options:this.evaluatorOptions});return this._parsedAnnotations.then(function(s){const n=[];for(const a of s)a.mustBePrinted(r)&&n.push(a.save(o,i,r).catch(function(l){return Qe(`save - ignoring annotation data during "${i.name}" task: "${l}".`),null}));return Promise.all(n).then(function(a){return a.filter(l=>!!l)})})}loadResources(e){return this.resourcesPromise||(this.resourcesPromise=this.pdfManager.ensure(this,"resources")),this.resourcesPromise.then(()=>new KD(this.resources,e,this.xref).load())}getOperatorList({handler:e,sink:i,task:r,intent:o,cacheKey:s,annotationStorage:n=null,modifiedIds:a=null}){const l=this.getContentStream(),c=this.loadResources(["ColorSpace","ExtGState","Font","Pattern","Properties","Shading","XObject"]),d=new DA({xref:this.xref,handler:e,pageIndex:this.pageIndex,idFactory:this._localIdFactory,fontCache:this.fontCache,builtInCMapCache:this.builtInCMapCache,standardFontDataCache:this.standardFontDataCache,globalImageCache:this.globalImageCache,systemFontCache:this.systemFontCache,options:this.evaluatorOptions}),A=this.xfaFactory?null:Z5e(n),u=A?.get(this.pageIndex);let h=Promise.resolve(null),g=null;if(u){const m=this.pdfManager.ensureDoc("annotationGlobals");let f;const v=new Set;for(const{bitmapId:y,bitmap:I}of u)y&&!I&&!v.has(y)&&v.add(y);const{isOffscreenCanvasSupported:C}=this.evaluatorOptions;if(v.size>0){const y=u.slice();for(const[I,B]of n)I.startsWith(T5e)&&B.bitmap&&v.has(B.bitmapId)&&y.push(B);f=O0.generateImages(y,this.xref,C)}else f=O0.generateImages(u,this.xref,C);g=new Bn,$(this,hP,Pz).call(this,u,g,null),h=m.then(y=>y?O0.printNewAnnotations(y,d,r,u,f):null)}const p=Promise.all([l,c]).then(([m])=>{const f=new Ec(o,i);return e.send("StartRenderPage",{transparency:d.hasBlendModes(this.resources,this.nonBlendModesSet),pageIndex:this.pageIndex,cacheKey:s}),d.getOperatorList({stream:m,task:r,resources:this.resources,operatorList:f}).then(function(){return f})});return Promise.all([p,this._parsedAnnotations,h]).then(function([m,f,v]){if(v){f=f.filter(Q=>!(Q.ref&&g.has(Q.ref)));for(let Q=0,S=v.length;Q<S;Q++){const D=v[Q];if(D.refToReplace){const R=f.findIndex(N=>N.ref&&ZS(N.ref,D.refToReplace));R>=0&&(f.splice(R,1,D),v.splice(Q--,1),S--)}}f=f.concat(v)}if(f.length===0||o&pa.ANNOTATIONS_DISABLE)return m.flush(!0),{length:m.totalLength};const C=!!(o&pa.ANNOTATIONS_FORMS),y=!!(o&pa.IS_EDITING),I=!!(o&pa.ANY),B=!!(o&pa.DISPLAY),E=!!(o&pa.PRINT),k=[];for(const Q of f)(I||B&&Q.mustBeViewed(n,C)&&Q.mustBeViewedWhenEditing(y,a)||E&&Q.mustBePrinted(n))&&k.push(Q.getOperatorList(d,r,o,n).catch(function(S){return Qe(`getOperatorList - ignoring annotation data during "${r.name}" task: "${S}".`),{opList:null,separateForm:!1,separateCanvas:!1}}));return Promise.all(k).then(function(Q){let S=!1,D=!1;for(const{opList:R,separateForm:N,separateCanvas:H}of Q)m.addOpList(R),S||(S=N),D||(D=H);return m.flush(!0,{form:S,canvas:D}),{length:m.totalLength}})})}async extractTextContent({handler:e,task:i,includeMarkedContent:r,disableNormalization:o,sink:s}){const n=this.getContentStream(),a=this.loadResources(["ExtGState","Font","Properties","XObject"]),l=this.pdfManager.ensureCatalog("lang"),[c,,d]=await Promise.all([n,a,l]);return new DA({xref:this.xref,handler:e,pageIndex:this.pageIndex,idFactory:this._localIdFactory,fontCache:this.fontCache,builtInCMapCache:this.builtInCMapCache,standardFontDataCache:this.standardFontDataCache,globalImageCache:this.globalImageCache,systemFontCache:this.systemFontCache,options:this.evaluatorOptions}).getTextContent({stream:c,task:i,resources:this.resources,includeMarkedContent:r,disableNormalization:o,sink:s,viewBox:this.view,lang:d})}async getStructTree(){const e=await this.pdfManager.ensureCatalog("structTreeRoot");return e?(await this._parsedAnnotations,(await this.pdfManager.ensure(this,"_parseStructTree",[e])).serializable):null}_parseStructTree(e){const i=new ZDi(e,this.pageDict);return i.parse(this.ref),i}async getAnnotationsData(e,i,r){const o=await this._parsedAnnotations;if(o.length===0)return o;const s=[],n=[];let a;const l=!!(r&pa.ANY),c=!!(r&pa.DISPLAY),d=!!(r&pa.PRINT);for(const A of o){const u=l||c&&A.viewable;(u||d&&A.printable)&&s.push(A.data),A.hasTextContent&&u&&(a||(a=new DA({xref:this.xref,handler:e,pageIndex:this.pageIndex,idFactory:this._localIdFactory,fontCache:this.fontCache,builtInCMapCache:this.builtInCMapCache,standardFontDataCache:this.standardFontDataCache,globalImageCache:this.globalImageCache,systemFontCache:this.systemFontCache,options:this.evaluatorOptions})),n.push(A.extractTextContent(a,i,[-1/0,-1/0,1/0,1/0]).catch(function(h){Qe(`getAnnotationsData - ignoring textContent during "${i.name}" task: "${h}".`)})))}return await Promise.all(n),s}get annotations(){const e=this._getInheritableProperty("Annots");return yt(this,"annotations",Array.isArray(e)?e:[])}get _parsedAnnotations(){const e=this.pdfManager.ensure(this,"annotations").then(async i=>{if(i.length===0)return i;const r=await this.pdfManager.ensureDoc("annotationGlobals");if(!r)return[];const o=[];for(const l of i)o.push(O0.create(this.xref,l,r,this._localIdFactory,!1,this.ref).catch(function(c){return Qe(`_parsedAnnotations: "${c}".`),null}));const s=[];let n,a;for(const l of await Promise.all(o))if(l){if(l instanceof yd){(a||(a=[])).push(l);continue}if(l instanceof nCe){(n||(n=[])).push(l);continue}s.push(l)}return a&&s.push(...a),n&&s.push(...n),s});return yt(this,"_parsedAnnotations",e)}get jsActions(){const e=$S(this.xref,this.pageDict,xxi);return yt(this,"jsActions",e)}}hP=new WeakSet,Pz=function(t,e,i){for(const r of t)if(r.id){const o=bt.fromString(r.id);if(!o){Qe(`A non-linked annotation cannot be modified: ${r.id}`);continue}if(r.deleted){e.put(o,o);continue}i?.put(o),r.ref=o,delete r.id}};const dCe=new Uint8Array([37,80,68,70,45]),ACe=new Uint8Array([115,116,97,114,116,120,114,101,102]),AUi=new Uint8Array([101,110,100,111,98,106]),uCe=1024,uUi="\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";function Rz(t,e,i=1024,r=!1){const o=e.length,s=t.peekBytes(i),n=s.length-o;if(n<=0)return!1;if(r){const a=o-1;let l=s.length-1;for(;l>=a;){let c=0;for(;c<o&&s[l-c]===e[a-c];)c++;if(c>=o)return t.pos+=l-a,!0;l--}}else{let a=0;for(;a<=n;){let l=0;for(;l<o&&s[a+l]===e[l];)l++;if(l>=o)return t.pos+=a,!0;a++}}return!1}var pP,Lz;class hCe{constructor(e,i){if(ce(this,pP),i.length<=0)throw new YS("The PDF file is empty, i.e. its size is zero bytes.");this.pdfManager=e,this.stream=i,this.xref=new lUi(i,e),this._pagePromises=new Map,this._version=null;const r={font:0};this._globalIdFactory=class{static getDocId(){return`g_${e.docId}`}static createFontId(){return`f${++r.font}`}static createObjId(){Li("Abstract method `createObjId` called.")}static getPageObjId(){Li("Abstract method `getPageObjId` called.")}}}parse(e){this.xref.parse(e),this.catalog=new $_(this.pdfManager,this.xref)}get linearization(){let e=null;try{e=XQi.create(this.stream)}catch(i){if(i instanceof zr)throw i;yi(i)}return yt(this,"linearization",e)}get startXRef(){const e=this.stream;let i=0;if(this.linearization){if(e.reset(),Rz(e,AUi)){e.skip(6);let r=e.peekByte();for(;Pl(r);)e.pos++,r=e.peekByte();i=e.pos-e.start}}else{const r=ACe.length;let o=!1,s=e.end;for(;!o&&s>0;)s-=1024-r,s<0&&(s=0),e.pos=s,o=Rz(e,ACe,1024,!0);if(o){e.skip(9);let n;do n=e.getByte();while(Pl(n));let a="";for(;n>=32&&n<=57;)a+=String.fromCharCode(n),n=e.getByte();i=parseInt(a,10),isNaN(i)&&(i=0)}}return yt(this,"startXRef",i)}checkHeader(){const e=this.stream;if(e.reset(),!Rz(e,dCe))return;e.moveStart(),e.skip(dCe.length);let i="",r;for(;(r=e.getByte())>32&&i.length<7;)i+=String.fromCharCode(r);K5e.test(i)?this._version=i:Qe(`Invalid PDF header version: ${i}`)}parseStartXRef(){this.xref.setStartXRef(this.startXRef)}get numPages(){let e=0;return this.catalog.hasActualNumPages?e=this.catalog.numPages:this.xfaFactory?e=this.xfaFactory.getNumPages():this.linearization?e=this.linearization.numPages:e=this.catalog.numPages,yt(this,"numPages",e)}_hasOnlyDocumentSignatures(e,i=0){return Array.isArray(e)?e.every(r=>{if(r=this.xref.fetchIfRef(r),!(r instanceof Te))return!1;if(r.has("Kids"))return++i>10?(Qe("_hasOnlyDocumentSignatures: maximum recursion depth reached"),!1):this._hasOnlyDocumentSignatures(r.get("Kids"),i);const o=Jo(r.get("FT"),"Sig"),s=r.get("Rect"),n=Array.isArray(s)&&s.every(a=>a===0);return o&&n}):!1}get _xfaStreams(){const e=this.catalog.acroForm;if(!e)return null;const i=e.get("XFA"),r={"xdp:xdp":"",template:"",datasets:"",config:"",connectionSet:"",localeSet:"",stylesheet:"","/xdp:xdp":""};if(i instanceof Ii&&!i.isEmpty)return r["xdp:xdp"]=i,r;if(!Array.isArray(i)||i.length===0)return null;for(let o=0,s=i.length;o<s;o+=2){let n;if(o===0?n="xdp:xdp":o===s-2?n="/xdp:xdp":n=i[o],!r.hasOwnProperty(n))continue;const a=this.xref.fetchIfRef(i[o+1]);!(a instanceof Ii)||a.isEmpty||(r[n]=a)}return r}get xfaDatasets(){const e=this._xfaStreams;if(!e)return yt(this,"xfaDatasets",null);for(const i of["datasets","xdp:xdp"]){const r=e[i];if(r)try{const o=oI(r.getString()),s={[i]:o};return yt(this,"xfaDatasets",new aUi(s))}catch{Qe("XFA - Invalid utf-8 string.");break}}return yt(this,"xfaDatasets",null)}get xfaData(){const e=this._xfaStreams;if(!e)return null;const i=Object.create(null);for(const[r,o]of Object.entries(e))if(o)try{i[r]=oI(o.getString())}catch{return Qe("XFA - Invalid utf-8 string."),null}return i}get xfaFactory(){let e;return this.pdfManager.enableXfa&&this.catalog.needsRendering&&this.formInfo.hasXfa&&!this.formInfo.hasAcroForm&&(e=this.xfaData),yt(this,"xfaFactory",e?new uw(e):null)}get isPureXfa(){return this.xfaFactory?this.xfaFactory.isValid():!1}get htmlForXfa(){return this.xfaFactory?this.xfaFactory.getPages():null}async loadXfaImages(){const e=await this.pdfManager.ensureCatalog("xfaImages");if(!e)return;const i=e.getKeys();await new KD(e,i,this.xref).load();const r=new Map;for(const o of i){const s=e.get(o);s instanceof Ii&&r.set(o,s.getBytes())}this.xfaFactory.setImages(r)}async loadXfaFonts(e,i){const r=await this.pdfManager.ensureCatalog("acroForm");if(!r)return;const o=await r.getAsync("DR");if(!(o instanceof Te))return;await new KD(o,["Font"],this.xref).load();const s=o.get("Font");if(!(s instanceof Te))return;const n=Object.assign(Object.create(null),this.pdfManager.evaluatorOptions);n.useSystemFonts=!1;const a=new DA({xref:this.xref,handler:e,pageIndex:-1,idFactory:this._globalIdFactory,fontCache:this.catalog.fontCache,builtInCMapCache:this.catalog.builtInCMapCache,standardFontDataCache:this.catalog.standardFontDataCache,options:n}),l=new Ec,c=[],d={get font(){return c.at(-1)},set font(p){c.push(p)},clone(){return this}},A=new Map;s.forEach((p,m)=>{A.set(p,m)});const u=[];for(const[p,m]of A){const f=m.get("FontDescriptor");if(!(f instanceof Te))continue;let v=f.get("FontFamily");v=v.replaceAll(/[ ]+(\d)/g,"$1");const C=f.get("FontWeight"),y=-f.get("ItalicAngle"),I={fontFamily:v,fontWeight:C,italicAngle:y};jxi(I)&&u.push(a.handleSetFont(o,[Ze.get(p),1],null,l,i,d,null,I).catch(function(B){return Qe(`loadXfaFonts: "${B}".`),null}))}await Promise.all(u);const h=this.xfaFactory.setFonts(c);if(!h)return;n.ignoreErrors=!0,u.length=0,c.length=0;const g=new Set;for(const p of h)R_(`${p}-Regular`)||g.add(p);g.size&&h.push("PdfJS-Fallback");for(const p of h)if(!g.has(p))for(const m of[{name:"Regular",fontWeight:400,italicAngle:0},{name:"Bold",fontWeight:700,italicAngle:0},{name:"Italic",fontWeight:400,italicAngle:12},{name:"BoldItalic",fontWeight:700,italicAngle:12}]){const f=`${p}-${m.name}`,v=u9e(f);u.push(a.handleSetFont(o,[Ze.get(f),1],null,l,i,d,v,{fontFamily:p,fontWeight:m.fontWeight,italicAngle:m.italicAngle}).catch(function(C){return Qe(`loadXfaFonts: "${C}".`),null}))}await Promise.all(u),this.xfaFactory.appendFonts(c,g)}async serializeXfaData(e){return this.xfaFactory?this.xfaFactory.serializeData(e):null}get version(){return this.catalog.version||this._version}get formInfo(){const e={hasFields:!1,hasAcroForm:!1,hasXfa:!1,hasSignatures:!1},i=this.catalog.acroForm;if(!i)return yt(this,"formInfo",e);try{const r=i.get("Fields"),o=Array.isArray(r)&&r.length>0;e.hasFields=o;const s=i.get("XFA");e.hasXfa=Array.isArray(s)&&s.length>0||s instanceof Ii&&!s.isEmpty;const n=!!(i.get("SigFlags")&1),a=n&&this._hasOnlyDocumentSignatures(r);e.hasAcroForm=o&&!a,e.hasSignatures=n}catch(r){if(r instanceof zr)throw r;Qe(`Cannot fetch form information: "${r}".`)}return yt(this,"formInfo",e)}get documentInfo(){const e={PDFFormatVersion:this.version,Language:this.catalog.lang,EncryptFilterName:this.xref.encrypt?this.xref.encrypt.filterName:null,IsLinearized:!!this.linearization,IsAcroFormPresent:this.formInfo.hasAcroForm,IsXFAPresent:this.formInfo.hasXfa,IsCollectionPresent:!!this.catalog.collection,IsSignaturesPresent:this.formInfo.hasSignatures};let i;try{i=this.xref.trailer.get("Info")}catch(r){if(r instanceof zr)throw r;yi("The document information dictionary is invalid.")}if(!(i instanceof Te))return yt(this,"documentInfo",e);for(const r of i.getKeys()){const o=i.get(r);switch(r){case"Title":case"Author":case"Subject":case"Keywords":case"Creator":case"Producer":case"CreationDate":case"ModDate":if(typeof o=="string"){e[r]=Gi(o);continue}break;case"Trapped":if(o instanceof Ze){e[r]=o;continue}break;default:let s;switch(typeof o){case"string":s=Gi(o);break;case"number":case"boolean":s=o;break;default:o instanceof Ze&&(s=o);break}if(s===void 0){Qe(`Bad value, for custom key "${r}", in Info: ${o}.`);continue}e.Custom||(e.Custom=Object.create(null)),e.Custom[r]=s;continue}Qe(`Bad value, for key "${r}", in Info: ${o}.`)}return yt(this,"documentInfo",e)}get fingerprints(){function e(n){return typeof n=="string"&&n.length>0&&n!==uUi}function i(n){const a=[];for(const l of n){const c=l.toString(16);a.push(c.padStart(2,"0"))}return a.join("")}const r=this.xref.trailer.get("ID");let o,s;return Array.isArray(r)&&e(r[0])?(o=cs(r[0]),r[1]!==r[0]&&e(r[1])&&(s=cs(r[1]))):o=D0(this.stream.getByteRange(0,uCe),0,uCe),yt(this,"fingerprints",[i(o),s?i(s):null])}async _getLinearizationPage(e){const{catalog:i,linearization:r,xref:o}=this,s=bt.get(r.objectNumberFirst,0);try{const n=await o.fetchAsync(s);if(n instanceof Te){let a=n.getRaw("Type");if(a instanceof bt&&(a=await o.fetchAsync(a)),Jo(a,"Page")||!n.has("Type")&&!n.has("Kids")&&n.has("Contents"))return i.pageKidsCountCache.has(s)||i.pageKidsCountCache.put(s,1),i.pageIndexCache.has(s)||i.pageIndexCache.put(s,0),[n,s]}throw new it("The Linearization dictionary doesn't point to a valid Page dictionary.")}catch(n){return Qe(`_getLinearizationPage: "${n.message}".`),i.getPageDict(e)}}getPage(e){const i=this._pagePromises.get(e);if(i)return i;const{catalog:r,linearization:o,xfaFactory:s}=this;let n;return s?n=Promise.resolve([Te.empty,null]):o?.pageFirst===e?n=this._getLinearizationPage(e):n=r.getPageDict(e),n=n.then(([a,l])=>new cCe({pdfManager:this.pdfManager,xref:this.xref,pageIndex:e,pageDict:a,ref:l,globalIdFactory:this._globalIdFactory,fontCache:r.fontCache,builtInCMapCache:r.builtInCMapCache,standardFontDataCache:r.standardFontDataCache,globalImageCache:r.globalImageCache,systemFontCache:r.systemFontCache,nonBlendModesSet:r.nonBlendModesSet,xfaFactory:s})),this._pagePromises.set(e,n),n}async checkFirstPage(e=!1){if(!e)try{await this.getPage(0)}catch(i){if(i instanceof w0)throw this._pagePromises.delete(0),await this.cleanup(),new b4}}async checkLastPage(e=!1){const{catalog:i,pdfManager:r}=this;i.setActualNumPages();let o;try{if(await Promise.all([r.ensureDoc("xfaFactory"),r.ensureDoc("linearization"),r.ensureCatalog("numPages")]),this.xfaFactory)return;if(this.linearization?o=this.linearization.numPages:o=i.numPages,Number.isInteger(o)){if(o<=1)return}else throw new it("Page count is not an integer.");await this.getPage(o-1)}catch(s){if(this._pagePromises.delete(o-1),await this.cleanup(),s instanceof w0&&!e)throw new b4;Qe(`checkLastPage - invalid /Pages tree /Count: ${o}.`);let n;try{n=await i.getAllPageDicts(e)}catch(a){if(a instanceof w0&&!e)throw new b4;i.setActualNumPages(1);return}for(const[a,[l,c]]of n){let d;l instanceof Error?(d=Promise.reject(l),d.catch(()=>{})):d=Promise.resolve(new cCe({pdfManager:r,xref:this.xref,pageIndex:a,pageDict:l,ref:c,globalIdFactory:this._globalIdFactory,fontCache:i.fontCache,builtInCMapCache:i.builtInCMapCache,standardFontDataCache:i.standardFontDataCache,globalImageCache:i.globalImageCache,systemFontCache:i.systemFontCache,nonBlendModesSet:i.nonBlendModesSet,xfaFactory:null})),this._pagePromises.set(a,d)}i.setActualNumPages(n.size)}}fontFallback(e,i){return this.catalog.fontFallback(e,i)}async cleanup(e=!1){return this.catalog?this.catalog.cleanup(e):V_()}get fieldObjects(){if(!this.formInfo.hasFields)return yt(this,"fieldObjects",Promise.resolve(null));const e=Promise.all([this.pdfManager.ensureDoc("annotationGlobals"),this.pdfManager.ensureCatalog("acroForm")]).then(async([i,r])=>{if(!i)return null;const o=new Bn,s=Object.create(null),n=new Map;for(const l of await r.getAsync("Fields"))await $(this,pP,Lz).call(this,"",l,n,i,o);const a=[];for(const[l,c]of n)a.push(Promise.all(c).then(d=>{d=d.filter(A=>!!A),d.length>0&&(s[l]=d)}));return await Promise.all(a),s});return yt(this,"fieldObjects",e)}get hasJSActions(){const e=this.pdfManager.ensureDoc("_parseHasJSActions");return yt(this,"hasJSActions",e)}async _parseHasJSActions(){const[e,i]=await Promise.all([this.pdfManager.ensureCatalog("jsActions"),this.pdfManager.ensureDoc("fieldObjects")]);return e?!0:i?Object.values(i).some(r=>r.some(o=>o.actions!==null)):!1}get calculationOrderIds(){const e=this.catalog.acroForm;if(!(e!=null&&e.has("CO")))return yt(this,"calculationOrderIds",null);const i=e.get("CO");if(!Array.isArray(i)||i.length===0)return yt(this,"calculationOrderIds",null);const r=[];for(const o of i)o instanceof bt&&r.push(o.toString());return r.length===0?yt(this,"calculationOrderIds",null):yt(this,"calculationOrderIds",r)}get annotationGlobals(){return yt(this,"annotationGlobals",O0.createGlobals(this.pdfManager))}}pP=new WeakSet,Lz=async function(t,e,i,r,o){const{xref:s}=this;if(!(e instanceof bt)||o.has(e))return;o.put(e);const n=await s.fetchAsync(e);if(!(n instanceof Te))return;if(n.has("T")){const l=Gi(await n.getAsync("T"));t=t===""?l:`${t}.${l}`}else{let l=n;for(;;){if(l=l.getRaw("Parent"),l instanceof bt){if(o.has(l))break;l=await s.fetchAsync(l)}if(!(l instanceof Te))break;if(l.has("T")){const c=Gi(await l.getAsync("T"));t=t===""?c:`${t}.${c}`;break}}}if(i.has(t)||i.set(t,[]),i.get(t).push(O0.create(s,e,r,null,!0,null).then(l=>l?.getFieldObject()).catch(function(l){return Qe(`#collectFieldObjects: "${l}".`),null})),!n.has("Kids"))return;const a=await n.getAsync("Kids");if(Array.isArray(a))for(const l of a)await $(this,pP,Lz).call(this,t,l,i,r,o)};function hUi(t){if(t){const e=zS(t);if(e)return e.href;Qe(`Invalid absolute docBaseUrl: "${t}".`)}return null}class pCe{constructor(e){var i;this._docBaseUrl=hUi(e.docBaseUrl),this._docId=e.docId,this._password=e.password,this.enableXfa=e.enableXfa,(i=e.evaluatorOptions).isOffscreenCanvasSupported&&(i.isOffscreenCanvasSupported=ih.isOffscreenCanvasSupported),this.evaluatorOptions=Object.freeze(e.evaluatorOptions)}get docId(){return this._docId}get password(){return this._password}get docBaseUrl(){return this._docBaseUrl}get catalog(){return this.pdfDocument.catalog}ensureDoc(e,i){return this.ensure(this.pdfDocument,e,i)}ensureXRef(e,i){return this.ensure(this.pdfDocument.xref,e,i)}ensureCatalog(e,i){return this.ensure(this.pdfDocument.catalog,e,i)}getPage(e){return this.pdfDocument.getPage(e)}fontFallback(e,i){return this.pdfDocument.fontFallback(e,i)}loadXfaFonts(e,i){return this.pdfDocument.loadXfaFonts(e,i)}loadXfaImages(){return this.pdfDocument.loadXfaImages()}serializeXfaData(e){return this.pdfDocument.serializeXfaData(e)}cleanup(e=!1){return this.pdfDocument.cleanup(e)}async ensure(e,i,r){Li("Abstract method `ensure` called")}requestRange(e,i){Li("Abstract method `requestRange` called")}requestLoadedStream(e=!1){Li("Abstract method `requestLoadedStream` called")}sendProgressiveData(e){Li("Abstract method `sendProgressiveData` called")}updatePassword(e){this._password=e}terminate(e){Li("Abstract method `terminate` called")}}class gCe extends pCe{constructor(e){super(e);const i=new fo(e.source);this.pdfDocument=new hCe(this,i),this._loadedStreamPromise=Promise.resolve(i)}async ensure(e,i,r){const o=e[i];return typeof o=="function"?o.apply(e,r):o}requestRange(e,i){return Promise.resolve()}requestLoadedStream(e=!1){return this._loadedStreamPromise}terminate(e){}}class pUi extends pCe{constructor(e){super(e),this.streamManager=new zxi(e.source,{msgHandler:e.handler,length:e.length,disableAutoFetch:e.disableAutoFetch,rangeChunkSize:e.rangeChunkSize}),this.pdfDocument=new hCe(this,this.streamManager.getStream())}async ensure(e,i,r){try{const o=e[i];return typeof o=="function"?o.apply(e,r):o}catch(o){if(!(o instanceof zr))throw o;return await this.requestRange(o.begin,o.end),this.ensure(e,i,r)}}requestRange(e,i){return this.streamManager.requestRange(e,i)}requestLoadedStream(e=!1){return this.streamManager.requestAllChunks(e)}sendProgressiveData(e){this.streamManager.onReceiveData({chunk:e})}terminate(e){this.streamManager.abort(e)}}const gP={UNKNOWN:0,DATA:1,ERROR:2},An={UNKNOWN:0,CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function Nl(t){switch(t instanceof Error||typeof t=="object"&&t!==null||Li('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),t.name){case"AbortException":return new ma(t.message);case"MissingPDFException":return new G5e(t.message);case"PasswordException":return new KS(t.message,t.code);case"UnexpectedResponseException":return new j5e(t.message,t.status);case"UnknownErrorException":return new JS(t.message,t.details);default:return new JS(t.message,t.toString())}}var Vf,fCe,mCe,fP;class vCe{constructor(e,i,r){ce(this,Vf),this.sourceName=e,this.targetName=i,this.comObj=r,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=o=>{const s=o.data;if(s.targetName!==this.sourceName)return;if(s.stream){$(this,Vf,mCe).call(this,s);return}if(s.callback){const a=s.callbackId,l=this.callbackCapabilities[a];if(!l)throw new Error(`Cannot resolve callback ${a}`);if(delete this.callbackCapabilities[a],s.callback===gP.DATA)l.resolve(s.data);else if(s.callback===gP.ERROR)l.reject(Nl(s.reason));else throw new Error("Unexpected callback case");return}const n=this.actionHandler[s.action];if(!n)throw new Error(`Unknown action from worker: ${s.action}`);if(s.callbackId){const a=this.sourceName,l=s.sourceName;new Promise(function(c){c(n(s.data))}).then(function(c){r.postMessage({sourceName:a,targetName:l,callback:gP.DATA,callbackId:s.callbackId,data:c})},function(c){r.postMessage({sourceName:a,targetName:l,callback:gP.ERROR,callbackId:s.callbackId,reason:Nl(c)})});return}if(s.streamId){$(this,Vf,fCe).call(this,s);return}n(s.data)},r.addEventListener("message",this._onComObjOnMessage)}on(e,i){const r=this.actionHandler;if(r[e])throw new Error(`There is already an actionName called "${e}"`);r[e]=i}send(e,i,r){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,data:i},r)}sendWithPromise(e,i,r){const o=this.callbackId++,s=Promise.withResolvers();this.callbackCapabilities[o]=s;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,callbackId:o,data:i},r)}catch(n){s.reject(n)}return s.promise}sendWithStream(e,i,r,o){const s=this.streamId++,n=this.sourceName,a=this.targetName,l=this.comObj;return new ReadableStream({start:c=>{const d=Promise.withResolvers();return this.streamControllers[s]={controller:c,startCall:d,pullCall:null,cancelCall:null,isClosed:!1},l.postMessage({sourceName:n,targetName:a,action:e,streamId:s,data:i,desiredSize:c.desiredSize},o),d.promise},pull:c=>{const d=Promise.withResolvers();return this.streamControllers[s].pullCall=d,l.postMessage({sourceName:n,targetName:a,stream:An.PULL,streamId:s,desiredSize:c.desiredSize}),d.promise},cancel:c=>{fa(c instanceof Error,"cancel must have a valid reason");const d=Promise.withResolvers();return this.streamControllers[s].cancelCall=d,this.streamControllers[s].isClosed=!0,l.postMessage({sourceName:n,targetName:a,stream:An.CANCEL,streamId:s,reason:Nl(c)}),d.promise}},r)}destroy(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}}Vf=new WeakSet,fCe=function(t){const e=t.streamId,i=this.sourceName,r=t.sourceName,o=this.comObj,s=this,n=this.actionHandler[t.action],a={enqueue(l,c=1,d){if(this.isCancelled)return;const A=this.desiredSize;this.desiredSize-=c,A>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),o.postMessage({sourceName:i,targetName:r,stream:An.ENQUEUE,streamId:e,chunk:l},d)},close(){this.isCancelled||(this.isCancelled=!0,o.postMessage({sourceName:i,targetName:r,stream:An.CLOSE,streamId:e}),delete s.streamSinks[e])},error(l){fa(l instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,o.postMessage({sourceName:i,targetName:r,stream:An.ERROR,streamId:e,reason:Nl(l)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:t.desiredSize,ready:null};a.sinkCapability.resolve(),a.ready=a.sinkCapability.promise,this.streamSinks[e]=a,new Promise(function(l){l(n(t.data,a))}).then(function(){o.postMessage({sourceName:i,targetName:r,stream:An.START_COMPLETE,streamId:e,success:!0})},function(l){o.postMessage({sourceName:i,targetName:r,stream:An.START_COMPLETE,streamId:e,reason:Nl(l)})})},mCe=function(t){const e=t.streamId,i=this.sourceName,r=t.sourceName,o=this.comObj,s=this.streamControllers[e],n=this.streamSinks[e];switch(t.stream){case An.START_COMPLETE:t.success?s.startCall.resolve():s.startCall.reject(Nl(t.reason));break;case An.PULL_COMPLETE:t.success?s.pullCall.resolve():s.pullCall.reject(Nl(t.reason));break;case An.PULL:if(!n){o.postMessage({sourceName:i,targetName:r,stream:An.PULL_COMPLETE,streamId:e,success:!0});break}n.desiredSize<=0&&t.desiredSize>0&&n.sinkCapability.resolve(),n.desiredSize=t.desiredSize,new Promise(function(a){var l;a((l=n.onPull)==null?void 0:l.call(n))}).then(function(){o.postMessage({sourceName:i,targetName:r,stream:An.PULL_COMPLETE,streamId:e,success:!0})},function(a){o.postMessage({sourceName:i,targetName:r,stream:An.PULL_COMPLETE,streamId:e,reason:Nl(a)})});break;case An.ENQUEUE:if(fa(s,"enqueue should have stream controller"),s.isClosed)break;s.controller.enqueue(t.chunk);break;case An.CLOSE:if(fa(s,"close should have stream controller"),s.isClosed)break;s.isClosed=!0,s.controller.close(),$(this,Vf,fP).call(this,s,e);break;case An.ERROR:fa(s,"error should have stream controller"),s.controller.error(Nl(t.reason)),$(this,Vf,fP).call(this,s,e);break;case An.CANCEL_COMPLETE:t.success?s.cancelCall.resolve():s.cancelCall.reject(Nl(t.reason)),$(this,Vf,fP).call(this,s,e);break;case An.CANCEL:if(!n)break;new Promise(function(a){var l;a((l=n.onCancel)==null?void 0:l.call(n,Nl(t.reason)))}).then(function(){o.postMessage({sourceName:i,targetName:r,stream:An.CANCEL_COMPLETE,streamId:e,success:!0})},function(a){o.postMessage({sourceName:i,targetName:r,stream:An.CANCEL_COMPLETE,streamId:e,reason:Nl(a)})}),n.sinkCapability.reject(Nl(t.reason)),n.isCancelled=!0,delete this.streamSinks[e];break;default:throw new Error("Unexpected stream case")}},fP=async function(t,e){var i,r,o;await Promise.allSettled([(i=t.startCall)==null?void 0:i.promise,(r=t.pullCall)==null?void 0:r.promise,(o=t.cancelCall)==null?void 0:o.promise]),delete this.streamControllers[e]};class gUi{constructor(e){this._msgHandler=e,this._contentLength=null,this._fullRequestReader=null,this._rangeRequestReaders=[]}getFullReader(){return fa(!this._fullRequestReader,"PDFWorkerStream.getFullReader can only be called once."),this._fullRequestReader=new fUi(this._msgHandler),this._fullRequestReader}getRangeReader(e,i){const r=new mUi(e,i,this._msgHandler);return this._rangeRequestReaders.push(r),r}cancelAllRequests(e){var i;(i=this._fullRequestReader)==null||i.cancel(e);for(const r of this._rangeRequestReaders.slice(0))r.cancel(e)}}class fUi{constructor(e){this._msgHandler=e,this.onProgress=null,this._contentLength=null,this._isRangeSupported=!1,this._isStreamingSupported=!1;const i=this._msgHandler.sendWithStream("GetReader");this._reader=i.getReader(),this._headersReady=this._msgHandler.sendWithPromise("ReaderHeadersReady").then(r=>{this._isStreamingSupported=r.isStreamingSupported,this._isRangeSupported=r.isRangeSupported,this._contentLength=r.contentLength})}get headersReady(){return this._headersReady}get contentLength(){return this._contentLength}get isStreamingSupported(){return this._isStreamingSupported}get isRangeSupported(){return this._isRangeSupported}async read(){const{value:e,done:i}=await this._reader.read();return i?{value:void 0,done:!0}:{value:e.buffer,done:!1}}cancel(e){this._reader.cancel(e)}}class mUi{constructor(e,i,r){this._msgHandler=r,this.onProgress=null;const o=this._msgHandler.sendWithStream("GetRangeReader",{begin:e,end:i});this._reader=o.getReader()}get isStreamingSupported(){return!1}async read(){const{value:e,done:i}=await this._reader.read();return i?{value:void 0,done:!0}:{value:e.buffer,done:!1}}cancel(e){this._reader.cancel(e)}}class qf{constructor(e){this.name=e,this.terminated=!1,this._capability=Promise.withResolvers()}get finished(){return this._capability.promise}finish(){this._capability.resolve()}terminate(){this.terminated=!0}ensureNotTerminated(){if(this.terminated)throw new Error("Worker task was terminated")}}class gw{static setup(e,i){let r=!1;e.on("test",function(o){r||(r=!0,e.send("test",o instanceof Uint8Array))}),e.on("configure",function(o){Qxi(o.verbosity)}),e.on("GetDocRequest",function(o){return gw.createDocumentHandler(o,i)})}static createDocumentHandler(e,i){let r,o=!1,s=null;const n=new Set,a=Mxi(),{docId:l,apiVersion:c}=e,d="4.6.82";if(c!==d)throw new Error(`The API version "${c}" does not match the Worker version "${d}".`);const A=[];for(const y in[])A.push(y);if(A.length)throw new Error("The `Array.prototype` contains unexpected enumerable properties: "+A.join(", ")+"; thus breaking e.g. `for...in` iteration of `Array`s.");const u=l+"_worker";let h=new vCe(u,l,i);function g(){if(o)throw new Error("Worker was terminated")}function p(y){n.add(y)}function m(y){y.finish(),n.delete(y)}async function f(y){await r.ensureDoc("checkHeader"),await r.ensureDoc("parseStartXRef"),await r.ensureDoc("parse",[y]),await r.ensureDoc("checkFirstPage",[y]),await r.ensureDoc("checkLastPage",[y]);const I=await r.ensureDoc("isPureXfa");if(I){const Q=new qf("loadXfaFonts");p(Q),await Promise.all([r.loadXfaFonts(h,Q).catch(S=>{}).then(()=>m(Q)),r.loadXfaImages()])}const[B,E]=await Promise.all([r.ensureDoc("numPages"),r.ensureDoc("fingerprints")]),k=I?await r.ensureDoc("htmlForXfa"):null;return{numPages:B,fingerprints:E,htmlForXfa:k}}function v({data:y,password:I,disableAutoFetch:B,rangeChunkSize:E,length:k,docBaseUrl:Q,enableXfa:S,evaluatorOptions:D}){const R={source:null,disableAutoFetch:B,docBaseUrl:Q,docId:l,enableXfa:S,evaluatorOptions:D,handler:h,length:k,password:I,rangeChunkSize:E},N=Promise.withResolvers();let H;if(y){try{R.source=y,H=new gCe(R),N.resolve(H)}catch(ue){N.reject(ue)}return N.promise}let q,O=[];try{q=new gUi(h)}catch(ue){return N.reject(ue),N.promise}const G=q.getFullReader();G.headersReady.then(function(){if(G.isRangeSupported){R.source=q,R.length=G.contentLength,R.disableAutoFetch||(R.disableAutoFetch=G.isStreamingSupported),H=new pUi(R);for(const ue of O)H.sendProgressiveData(ue);O=[],N.resolve(H),s=null}}).catch(function(ue){N.reject(ue),s=null});let Z=0;const ae=function(){const ue=J5e(O);k&&ue.length!==k&&Qe("reported HTTP length is different from actual");try{R.source=ue,H=new gCe(R),N.resolve(H)}catch(ke){N.reject(ke)}O=[]};return new Promise(function(ue,ke){const se=function({value:me,done:qe}){try{if(g(),qe){H||ae(),s=null;return}Z+=me.byteLength,G.isStreamingSupported||h.send("DocProgress",{loaded:Z,total:Math.max(Z,G.contentLength||0)}),H?H.sendProgressiveData(me):O.push(me),G.read().then(se,ke)}catch(Ne){ke(Ne)}};G.read().then(se,ke)}).catch(function(ue){N.reject(ue),s=null}),s=function(ue){q.cancelAllRequests(ue)},N.promise}function C(y){function I(k){g(),h.send("GetDoc",{pdfInfo:k})}function B(k){if(g(),k instanceof KS){const Q=new qf(`PasswordException: response ${k.code}`);p(Q),h.sendWithPromise("PasswordRequest",k).then(function({password:S}){m(Q),r.updatePassword(S),E()}).catch(function(){m(Q),h.send("DocException",k)})}else k instanceof YS||k instanceof G5e||k instanceof j5e||k instanceof JS?h.send("DocException",k):h.send("DocException",new JS(k.message,k.toString()))}function E(){g(),f(!1).then(I,function(k){if(g(),!(k instanceof b4)){B(k);return}r.requestLoadedStream().then(function(){g(),f(!0).then(I,B)})})}g(),v(y).then(function(k){if(o)throw k.terminate(new ma("Worker was terminated.")),new Error("Worker was terminated");r=k,r.requestLoadedStream(!0).then(Q=>{h.send("DataLoaded",{length:Q.bytes.byteLength})})}).then(E,B)}return h.on("GetPage",function(y){return r.getPage(y.pageIndex).then(function(I){return Promise.all([r.ensure(I,"rotate"),r.ensure(I,"ref"),r.ensure(I,"userUnit"),r.ensure(I,"view")]).then(function([B,E,k,Q]){return{rotate:B,ref:E,refStr:E?.toString()??null,userUnit:k,view:Q}})})}),h.on("GetPageIndex",function(y){const I=bt.get(y.num,y.gen);return r.ensureCatalog("getPageIndex",[I])}),h.on("GetDestinations",function(y){return r.ensureCatalog("destinations")}),h.on("GetDestination",function(y){return r.ensureCatalog("getDestination",[y.id])}),h.on("GetPageLabels",function(y){return r.ensureCatalog("pageLabels")}),h.on("GetPageLayout",function(y){return r.ensureCatalog("pageLayout")}),h.on("GetPageMode",function(y){return r.ensureCatalog("pageMode")}),h.on("GetViewerPreferences",function(y){return r.ensureCatalog("viewerPreferences")}),h.on("GetOpenAction",function(y){return r.ensureCatalog("openAction")}),h.on("GetAttachments",function(y){return r.ensureCatalog("attachments")}),h.on("GetDocJSActions",function(y){return r.ensureCatalog("jsActions")}),h.on("GetPageJSActions",function({pageIndex:y}){return r.getPage(y).then(function(I){return r.ensure(I,"jsActions")})}),h.on("GetOutline",function(y){return r.ensureCatalog("documentOutline")}),h.on("GetOptionalContentConfig",function(y){return r.ensureCatalog("optionalContentConfig")}),h.on("GetPermissions",function(y){return r.ensureCatalog("permissions")}),h.on("GetMetadata",function(y){return Promise.all([r.ensureDoc("documentInfo"),r.ensureCatalog("metadata")])}),h.on("GetMarkInfo",function(y){return r.ensureCatalog("markInfo")}),h.on("GetData",function(y){return r.requestLoadedStream().then(function(I){return I.bytes})}),h.on("GetAnnotations",function({pageIndex:y,intent:I}){return r.getPage(y).then(function(B){const E=new qf(`GetAnnotations: page ${y}`);return p(E),B.getAnnotationsData(h,E,I).then(k=>(m(E),k),k=>{throw m(E),k})})}),h.on("GetFieldObjects",function(y){return r.ensureDoc("fieldObjects")}),h.on("HasJSActions",function(y){return r.ensureDoc("hasJSActions")}),h.on("GetCalculationOrderIds",function(y){return r.ensureDoc("calculationOrderIds")}),h.on("SaveDocument",async function({isPureXfa:y,numPages:I,annotationStorage:B,filename:E}){const k=[r.requestLoadedStream(),r.ensureCatalog("acroForm"),r.ensureCatalog("acroFormRef"),r.ensureDoc("startXRef"),r.ensureDoc("xref"),r.ensureDoc("linearization"),r.ensureCatalog("structTreeRoot")],Q=[],S=y?null:Z5e(B),[D,R,N,H,q,O,G]=await Promise.all(k),Z=q.trailer.getRaw("Root")||null;let ae;if(S){G?await G.canUpdateStructTree({pdfManager:r,xref:q,newAnnotationsByPage:S})&&(ae=G):await Z_.canCreateStructureTree({catalogRef:Z,pdfManager:r,newAnnotationsByPage:S})&&(ae=null);const oe=O0.generateImages(B.values(),q,r.evaluatorOptions.isOffscreenCanvasSupported),ne=ae===void 0?Q:[];for(const[he,Se]of S)ne.push(r.getPage(he).then(Me=>{const K=new qf(`Save (editor): page ${he}`);return Me.saveNewAnnotations(h,K,Se,oe).finally(function(){m(K)})}));ae===null?Q.push(Promise.all(ne).then(async he=>(await Z_.createStructureTree({newAnnotationsByPage:S,xref:q,catalogRef:Z,pdfManager:r,newRefs:he}),he))):ae&&Q.push(Promise.all(ne).then(async he=>(await ae.updateStructureTree({newAnnotationsByPage:S,pdfManager:r,newRefs:he}),he)))}if(y)Q.push(r.serializeXfaData(B));else for(let oe=0;oe<I;oe++)Q.push(r.getPage(oe).then(function(ne){const he=new qf(`Save: page ${oe}`);return ne.save(h,he,B).finally(function(){m(he)})}));const ue=await Promise.all(Q);let ke=[],se=null;if(y){if(se=ue[0],!se)return D.bytes}else if(ke=ue.flat(2),ke.length===0)return D.bytes;const me=N&&R instanceof Te&&ke.some(oe=>oe.needAppearances),qe=R instanceof Te&&R.get("XFA")||null;let Ne=null,De=!1;if(Array.isArray(qe)){for(let oe=0,ne=qe.length;oe<ne;oe+=2)qe[oe]==="datasets"&&(Ne=qe[oe+1],De=!0);Ne===null&&(Ne=q.getNewTemporaryRef())}else qe&&Qe("Unsupported XFA type.");let X=Object.create(null);if(q.trailer){const oe=Object.create(null),ne=q.trailer.get("Info")||null;ne instanceof Te&&ne.forEach((he,Se)=>{typeof Se=="string"&&(oe[he]=Gi(Se))}),X={rootRef:Z,encryptRef:q.trailer.getRaw("Encrypt")||null,newRef:q.getNewTemporaryRef(),infoRef:q.trailer.getRaw("Info")||null,info:oe,fileIds:q.trailer.get("ID")||null,startXRef:O?H:q.lastXRefStreamPos??H,filename:E}}return YDi({originalData:D.bytes,xrefInfo:X,newRefs:ke,xref:q,hasXfa:!!qe,xfaDatasetsRef:Ne,hasXfaDatasetsEntry:De,needAppearances:me,acroFormRef:N,acroForm:R,xfaData:se,useXrefStream:z5e(q.topDict,"XRef")}).finally(()=>{q.resetNewTemporaryRef()})}),h.on("GetOperatorList",function(y,I){const B=y.pageIndex;r.getPage(B).then(function(E){const k=new qf(`GetOperatorList: page ${B}`);p(k);const Q=a>=rI.INFOS?Date.now():0;E.getOperatorList({handler:h,sink:I,task:k,intent:y.intent,cacheKey:y.cacheKey,annotationStorage:y.annotationStorage,modifiedIds:y.modifiedIds}).then(function(S){m(k),Q&&yi(`page=${B+1} - getOperatorList: time=${Date.now()-Q}ms, len=${S.length}`),I.close()},function(S){m(k),!k.terminated&&I.error(S)})})}),h.on("GetTextContent",function(y,I){const{pageIndex:B,includeMarkedContent:E,disableNormalization:k}=y;r.getPage(B).then(function(Q){const S=new qf("GetTextContent: page "+B);p(S);const D=a>=rI.INFOS?Date.now():0;Q.extractTextContent({handler:h,task:S,sink:I,includeMarkedContent:E,disableNormalization:k}).then(function(){m(S),D&&yi(`page=${B+1} - getTextContent: time=${Date.now()-D}ms`),I.close()},function(R){m(S),!S.terminated&&I.error(R)})})}),h.on("GetStructTree",function(y){return r.getPage(y.pageIndex).then(function(I){return r.ensure(I,"getStructTree")})}),h.on("FontFallback",function(y){return r.fontFallback(y.id,h)}),h.on("Cleanup",function(y){return r.cleanup(!0)}),h.on("Terminate",function(y){o=!0;const I=[];if(r){r.terminate(new ma("Worker was terminated."));const B=r.cleanup();I.push(B),r=null}else V_();s&&s(new ma("Worker was terminated."));for(const B of n)I.push(B.finished),B.terminate();return Promise.all(I).then(function(){h.destroy(),h=null})}),h.on("Ready",function(y){C(e),e=null}),u}static initializeFromPort(e){const i=new vCe("worker","main",e);gw.setup(i,e),i.send("ready",null)}}function vUi(t){return typeof t.postMessage=="function"&&"onmessage"in t}typeof window>"u"&&!Bxi&&typeof self<"u"&&vUi(self)&&gw.initializeFromPort(self),L5e.WorkerMessageHandler,wxi.workerSrc=import.meta.url+"pdfjs-dist/build/pdf.worker.mjs";const CUi=4;async function yUi(t,e=1){const i=await(await bxi(t).promise).getPage(e),r=i.getViewport({scale:CUi}),{width:o,height:s}=r,n=document.createElement("canvas");n.width=o,n.height=s;const a={canvasContext:n.getContext("2d"),background:"rgba(0,0,0,0)",viewport:r};return await i.render(a).promise,n.toDataURL()}const IUi=Object.freeze(Object.defineProperty({__proto__:null,readPDFToDataURL:yUi},Symbol.toStringTag,{value:"Module"}));export{nve as default};
1691
+ `),A=new Te(i);A.set("FormType",1),A.set("Subtype",Ze.get("Form")),A.set("Type",Ze.get("XObject")),A.set("BBox",s),A.set("Length",d.length);const u=new Te(i),h=new Te(i);u.set("ExtGState",h),A.set("Resources",u);const g=new Te(i);h.set("R0",g),g.set("BM",Ze.get("Multiply")),a!==1&&(g.set("ca",a),g.set("Type",Ze.get("ExtGState")));const p=new Ll(d);return p.dict=A,p}}class iUi extends rl{constructor(e){super(e);const{dict:i,xref:r}=e;if(this.data.annotationType=jn.UNDERLINE,this.data.quadPoints=KI(i,null)){if(!this.appearance){const o=this.color?il(this.color):[0,0,0],s=i.get("CA");this._setDefaultAppearance({xref:r,extra:"[] 0 d 0.571 w",strokeColor:o,strokeAlpha:s,pointsCallback:(n,a)=>(n.push(`${a[4]} ${a[5]+1.3} m`,`${a[6]} ${a[7]+1.3} l`,"S"),[a[0],a[2],a[7],a[3]])})}}else this.data.popupRef=null}}class rUi extends rl{constructor(e){super(e);const{dict:i,xref:r}=e;if(this.data.annotationType=jn.SQUIGGLY,this.data.quadPoints=KI(i,null)){if(!this.appearance){const o=this.color?il(this.color):[0,0,0],s=i.get("CA");this._setDefaultAppearance({xref:r,extra:"[] 0 d 1 w",strokeColor:o,strokeAlpha:s,pointsCallback:(n,a)=>{const l=(a[1]-a[5])/6;let c=l,d=a[4];const A=a[5],u=a[6];n.push(`${d} ${A+c} m`);do d+=2,c=c===0?l:0,n.push(`${d} ${A+c} l`);while(d<u);return n.push("S"),[a[4],u,A-2*l,A+2*l]}})}}else this.data.popupRef=null}}class oUi extends rl{constructor(e){super(e);const{dict:i,xref:r}=e;if(this.data.annotationType=jn.STRIKEOUT,this.data.quadPoints=KI(i,null)){if(!this.appearance){const o=this.color?il(this.color):[0,0,0],s=i.get("CA");this._setDefaultAppearance({xref:r,extra:"[] 0 d 1 w",strokeColor:o,strokeAlpha:s,pointsCallback:(n,a)=>(n.push(`${(a[0]+a[4])/2} ${(a[1]+a[5])/2} m`,`${(a[2]+a[6])/2} ${(a[3]+a[7])/2} l`,"S"),[a[0],a[2],a[7],a[3]])})}}else this.data.popupRef=null}}class uP extends rl{constructor(e){super(e),this.data.annotationType=jn.STAMP,this.data.hasOwnCanvas=this.data.noRotate,this.data.noHTML=!1}static async createImage(e,i){const{width:r,height:o}=e,s=new OffscreenCanvas(r,o),n=s.getContext("2d",{alpha:!0});n.drawImage(e,0,0);const a=n.getImageData(0,0,r,o).data,l=new Uint32Array(a.buffer),c=l.some(ih.isLittleEndian?p=>p>>>24!==255:p=>(p&255)!==255);c&&(n.fillStyle="white",n.fillRect(0,0,r,o),n.drawImage(e,0,0));const d=s.convertToBlob({type:"image/jpeg",quality:1}).then(p=>p.arrayBuffer()),A=Ze.get("XObject"),u=Ze.get("Image"),h=new Te(i);h.set("Type",A),h.set("Subtype",u),h.set("BitsPerComponent",8),h.set("ColorSpace",Ze.get("DeviceRGB")),h.set("Filter",Ze.get("DCTDecode")),h.set("BBox",[0,0,r,o]),h.set("Width",r),h.set("Height",o);let g=null;if(c){const p=new Uint8Array(l.length);if(ih.isLittleEndian)for(let f=0,v=l.length;f<v;f++)p[f]=l[f]>>>24;else for(let f=0,v=l.length;f<v;f++)p[f]=l[f]&255;const m=new Te(i);m.set("Type",A),m.set("Subtype",u),m.set("BitsPerComponent",8),m.set("ColorSpace",Ze.get("DeviceGray")),m.set("Width",r),m.set("Height",o),g=new fo(p,0,0,m)}return{imageStream:new fo(await d,0,0,h),smaskStream:g,width:r,height:o}}static createNewDict(e,i,{apRef:r,ap:o}){const{rect:s,rotation:n,user:a}=e,l=new Te(i);if(l.set("Type",Ze.get("Annot")),l.set("Subtype",Ze.get("Stamp")),l.set("CreationDate",`D:${I0()}`),l.set("Rect",s),l.set("F",4),l.set("Border",[0,0,0]),l.set("Rotate",n),a&&l.set("T",yA(a)),r||o){const c=new Te(i);l.set("AP",c),r?c.set("N",r):c.set("N",o)}return l}static async createNewAppearanceStream(e,i,r){const{rotation:o}=e,{imageRef:s,width:n,height:a}=r.image,l=new Te(i),c=new Te(i);l.set("XObject",c),c.set("Im0",s);const d=`q ${n} 0 0 ${a} 0 0 cm /Im0 Do Q`,A=new Te(i);if(A.set("FormType",1),A.set("Subtype",Ze.get("Form")),A.set("Type",Ze.get("XObject")),A.set("BBox",[0,0,n,a]),A.set("Resources",l),o){const h=eD(o,n,a);A.set("Matrix",h)}const u=new Ll(d);return u.dict=A,u}}class nUi extends rl{constructor(e){super(e);const{dict:i,xref:r}=e,o=new q_(i.get("FS"),r);this.data.annotationType=jn.FILEATTACHMENT,this.data.hasOwnCanvas=this.data.noRotate,this.data.noHTML=!1,this.data.file=o.serializable;const s=i.get("Name");this.data.name=s instanceof Ze?Gi(s.name):"PushPin";const n=i.get("ca");this.data.fillAlpha=typeof n=="number"&&n>=0&&n<=1?n:null}}function lCe(t){try{return oI(t)}catch(e){return Qe(`UTF-8 decoding failed: "${e}".`),t}}class sUi extends GD{constructor(e){super(e),this.node=null}onEndElement(e){const i=super.onEndElement(e);if(i&&e==="xfa:datasets")throw this.node=i,new Error("Aborting DatasetXMLParser.")}}class aUi{constructor(e){if(e.datasets)this.node=new GD({hasAttributes:!0}).parseFromString(e.datasets).documentElement;else{const i=new sUi({hasAttributes:!0});try{i.parseFromString(e["xdp:xdp"])}catch{}this.node=i.node}}getValue(e){if(!this.node||!e)return"";const i=this.node.searchNode(Y5e(e),0);if(!i)return"";const r=i.firstChild;return r?.nodeName==="value"?i.children.map(o=>lCe(o.textContent)):lCe(i.textContent)}}var WI;class lUi{constructor(e,i){ce(this,WI,null),this.stream=e,this.pdfManager=i,this.entries=[],this._xrefStms=new Set,this._cacheMap=new Map,this._pendingRefs=new Bn,this._newPersistentRefNum=null,this._newTemporaryRefNum=null,this._persistentRefsCache=null}getNewPersistentRef(e){this._newPersistentRefNum===null&&(this._newPersistentRefNum=this.entries.length||1);const i=this._newPersistentRefNum++;return this._cacheMap.set(i,e),bt.get(i,0)}getNewTemporaryRef(){if(this._newTemporaryRefNum===null&&(this._newTemporaryRefNum=this.entries.length||1,this._newPersistentRefNum)){this._persistentRefsCache=new Map;for(let e=this._newTemporaryRefNum;e<this._newPersistentRefNum;e++)this._persistentRefsCache.set(e,this._cacheMap.get(e)),this._cacheMap.delete(e)}return bt.get(this._newTemporaryRefNum++,0)}resetNewTemporaryRef(){if(this._newTemporaryRefNum=null,this._persistentRefsCache)for(const[e,i]of this._persistentRefsCache)this._cacheMap.set(e,i);this._persistentRefsCache=null}setStartXRef(e){this.startXRefQueue=[e]}parse(e=!1){let i;e?(Qe("Indexing all PDF objects"),i=this.indexObjects()):i=this.readXRef(),i.assignXref(this),this.trailer=i;let r;try{r=i.get("Encrypt")}catch(s){if(s instanceof zr)throw s;Qe(`XRef.parse - Invalid "Encrypt" reference: "${s}".`)}if(r instanceof Te){const s=i.get("ID"),n=s!=null&&s.length?s[0]:"";r.suppressEncryption=!0,this.encrypt=new GDi(r,n,this.pdfManager.password)}let o;try{o=i.get("Root")}catch(s){if(s instanceof zr)throw s;Qe(`XRef.parse - Invalid "Root" reference: "${s}".`)}if(o instanceof Te)try{if(o.get("Pages")instanceof Te){this.root=o;return}}catch(s){if(s instanceof zr)throw s;Qe(`XRef.parse - Invalid "Pages" reference: "${s}".`)}throw e?new YS("Invalid Root reference."):new b4}processXRefTable(e){"tableState"in this||(this.tableState={entryNum:0,streamPos:e.lexer.stream.pos,parserBuf1:e.buf1,parserBuf2:e.buf2});const i=this.readXRefTable(e);if(!En(i,"trailer"))throw new it("Invalid XRef table: could not find trailer dictionary");let r=e.getObj();if(!(r instanceof Te)&&r.dict&&(r=r.dict),!(r instanceof Te))throw new it("Invalid XRef table: could not parse trailer dictionary");return delete this.tableState,r}readXRefTable(e){const i=e.lexer.stream,r=this.tableState;i.pos=r.streamPos,e.buf1=r.parserBuf1,e.buf2=r.parserBuf2;let o;for(;;){if(!("firstEntryNum"in r)||!("entryCount"in r)){if(En(o=e.getObj(),"trailer"))break;r.firstEntryNum=o,r.entryCount=e.getObj()}let s=r.firstEntryNum;const n=r.entryCount;if(!Number.isInteger(s)||!Number.isInteger(n))throw new it("Invalid XRef table: wrong types in subsection header");for(let a=r.entryNum;a<n;a++){r.streamPos=i.pos,r.entryNum=a,r.parserBuf1=e.buf1,r.parserBuf2=e.buf2;const l={};l.offset=e.getObj(),l.gen=e.getObj();const c=e.getObj();if(c instanceof Wo)switch(c.cmd){case"f":l.free=!0;break;case"n":l.uncompressed=!0;break}if(!Number.isInteger(l.offset)||!Number.isInteger(l.gen)||!(l.free||l.uncompressed))throw new it(`Invalid entry in XRef subsection: ${s}, ${n}`);a===0&&l.free&&s===1&&(s=0),this.entries[a+s]||(this.entries[a+s]=l)}r.entryNum=0,r.streamPos=i.pos,r.parserBuf1=e.buf1,r.parserBuf2=e.buf2,delete r.firstEntryNum,delete r.entryCount}if(this.entries[0]&&!this.entries[0].free)throw new it("Invalid XRef table: unexpected first object");return o}processXRefStream(e){if(!("streamState"in this)){const i=e.dict,r=i.get("W");let o=i.get("Index");o||(o=[0,i.get("Size")]),this.streamState={entryRanges:o,byteWidths:r,entryNum:0,streamPos:e.pos}}return this.readXRefStream(e),delete this.streamState,e.dict}readXRefStream(e){const i=this.streamState;e.pos=i.streamPos;const[r,o,s]=i.byteWidths,n=i.entryRanges;for(;n.length>0;){const[a,l]=n;if(!Number.isInteger(a)||!Number.isInteger(l))throw new it(`Invalid XRef range fields: ${a}, ${l}`);if(!Number.isInteger(r)||!Number.isInteger(o)||!Number.isInteger(s))throw new it(`Invalid XRef entry fields length: ${a}, ${l}`);for(let c=i.entryNum;c<l;++c){i.entryNum=c,i.streamPos=e.pos;let d=0,A=0,u=0;for(let g=0;g<r;++g){const p=e.getByte();if(p===-1)throw new it("Invalid XRef byteWidths 'type'.");d=d<<8|p}r===0&&(d=1);for(let g=0;g<o;++g){const p=e.getByte();if(p===-1)throw new it("Invalid XRef byteWidths 'offset'.");A=A<<8|p}for(let g=0;g<s;++g){const p=e.getByte();if(p===-1)throw new it("Invalid XRef byteWidths 'generation'.");u=u<<8|p}const h={};switch(h.offset=A,h.gen=u,d){case 0:h.free=!0;break;case 1:h.uncompressed=!0;break;case 2:break;default:throw new it(`Invalid XRef entry type: ${d}`)}this.entries[a+c]||(this.entries[a+c]=h)}i.entryNum=0,i.streamPos=e.pos,n.splice(0,2)}}indexObjects(){function e(y,I){let B="",E=y[I];for(;E!==10&&E!==13&&E!==60&&!(++I>=y.length);)B+=String.fromCharCode(E),E=y[I];return B}function i(y,I,B){const E=B.length,k=y.length;let Q=0;for(;I<k;){let S=0;for(;S<E&&y[I+S]===B[S];)++S;if(S>=E)break;I++,Q++}return Q}const r=/\b(endobj|\d+\s+\d+\s+obj|xref|trailer\s*<<)\b/g,o=/\b(startxref|\d+\s+\d+\s+obj)\b/g,s=/^(\d+)\s+(\d+)\s+obj\b/,n=new Uint8Array([116,114,97,105,108,101,114]),a=new Uint8Array([115,116,97,114,116,120,114,101,102]),l=new Uint8Array([47,88,82,101,102]);this.entries.length=0,this._cacheMap.clear();const c=this.stream;c.pos=0;const d=c.getBytes(),A=Xa(d),u=d.length;let h=c.start;const g=[],p=[];for(;h<u;){let y=d[h];if(y===9||y===10||y===13||y===32){++h;continue}if(y===37){do{if(++h,h>=u)break;y=d[h]}while(y!==10&&y!==13);continue}const I=e(d,h);let B;if(I.startsWith("xref")&&(I.length===4||/\s/.test(I[4])))h+=i(d,h,n),g.push(h),h+=i(d,h,a);else if(B=s.exec(I)){const E=B[1]|0,k=B[2]|0,Q=h+I.length;let S,D=!1;if(!this.entries[E])D=!0;else if(this.entries[E].gen===k)try{new x0({lexer:new Ad(c.makeSubStream(Q))}).getObj(),D=!0}catch(q){q instanceof Oq?Qe(`indexObjects -- checking object (${I}): "${q}".`):D=!0}D&&(this.entries[E]={offset:h-c.start,gen:k,uncompressed:!0}),r.lastIndex=Q;const R=r.exec(A);R?(S=r.lastIndex+1-h,R[1]!=="endobj"&&(Qe(`indexObjects: Found "${R[1]}" inside of another "obj", caused by missing "endobj" -- trying to recover.`),S-=R[1].length+1)):S=u-h;const N=d.subarray(h,h+S),H=i(N,0,l);H<S&&N[H+5]<64&&(p.push(h-c.start),this._xrefStms.add(h-c.start)),h+=S}else if(I.startsWith("trailer")&&(I.length===7||/\s/.test(I[7]))){g.push(h);const E=h+I.length;let k;o.lastIndex=E;const Q=o.exec(A);Q?(k=o.lastIndex+1-h,Q[1]!=="startxref"&&(Qe(`indexObjects: Found "${Q[1]}" after "trailer", caused by missing "startxref" -- trying to recover.`),k-=Q[1].length+1)):k=u-h,h+=k}else h+=I.length+1}for(const y of p)this.startXRefQueue.push(y),this.readXRef(!0);const m=[];let f=!1;for(const y of g){c.pos=y;const I=new x0({lexer:new Ad(c),xref:this,allowStreams:!0,recoveryMode:!0}),B=I.getObj();if(!En(B,"trailer"))continue;const E=I.getObj();E instanceof Te&&(m.push(E),E.has("Encrypt")&&(f=!0))}let v,C;for(const y of[...m,"genFallback",...m]){if(y==="genFallback"){if(!C)break;this._generationFallback=!0;continue}let I=!1;try{const B=y.get("Root");if(!(B instanceof Te))continue;const E=B.get("Pages");if(!(E instanceof Te))continue;const k=E.get("Count");Number.isInteger(k)&&(I=!0)}catch(B){C=B;continue}if(I&&(!f||y.has("Encrypt"))&&y.has("ID"))return y;v=y}if(v)return v;if(this.topDict)return this.topDict;throw new YS("Invalid PDF structure.")}readXRef(e=!1){const i=this.stream,r=new Set;for(;this.startXRefQueue.length;){try{const o=this.startXRefQueue[0];if(r.has(o)){Qe("readXRef - skipping XRef table since it was already parsed."),this.startXRefQueue.shift();continue}r.add(o),i.pos=o+i.start;const s=new x0({lexer:new Ad(i),xref:this,allowStreams:!0});let n=s.getObj(),a;if(En(n,"xref"))a=this.processXRefTable(s),this.topDict||(this.topDict=a),n=a.get("XRefStm"),Number.isInteger(n)&&!this._xrefStms.has(n)&&(this._xrefStms.add(n),this.startXRefQueue.push(n),M(this,WI)??ie(this,WI,n));else if(Number.isInteger(n)){if(!Number.isInteger(s.getObj())||!En(s.getObj(),"obj")||!((n=s.getObj())instanceof Ii))throw new it("Invalid XRef stream");if(a=this.processXRefStream(n),this.topDict||(this.topDict=a),!a)throw new it("Failed to read XRef stream")}else throw new it("Invalid XRef stream header");n=a.get("Prev"),Number.isInteger(n)?this.startXRefQueue.push(n):n instanceof bt&&this.startXRefQueue.push(n.num)}catch(o){if(o instanceof zr)throw o;yi("(while reading XRef): "+o)}this.startXRefQueue.shift()}if(this.topDict)return this.topDict;if(!e)throw new b4}get lastXRefStreamPos(){return M(this,WI)??(this._xrefStms.size>0?Math.max(...this._xrefStms):null)}getEntry(e){const i=this.entries[e];return i&&!i.free&&i.offset?i:null}fetchIfRef(e,i=!1){return e instanceof bt?this.fetch(e,i):e}fetch(e,i=!1){if(!(e instanceof bt))throw new Error("ref object is not a reference");const r=e.num,o=this._cacheMap.get(r);if(o!==void 0)return o instanceof Te&&!o.objId&&(o.objId=e.toString()),o;let s=this.getEntry(r);if(s===null)return this._cacheMap.set(r,s),s;if(this._pendingRefs.has(e))return this._pendingRefs.remove(e),Qe(`Ignoring circular reference: ${e}.`),Txi;this._pendingRefs.put(e);try{s=s.uncompressed?this.fetchUncompressed(e,s,i):this.fetchCompressed(e,s,i),this._pendingRefs.remove(e)}catch(n){throw this._pendingRefs.remove(e),n}return s instanceof Te?s.objId=e.toString():s instanceof Ii&&(s.dict.objId=e.toString()),s}fetchUncompressed(e,i,r=!1){const o=e.gen;let s=e.num;if(i.gen!==o){const A=`Inconsistent generation in XRef: ${e}`;if(this._generationFallback&&i.gen<o)return Qe(A),this.fetchUncompressed(bt.get(s,i.gen),i,r);throw new w0(A)}const n=this.stream.makeSubStream(i.offset+this.stream.start),a=new x0({lexer:new Ad(n),xref:this,allowStreams:!0}),l=a.getObj(),c=a.getObj(),d=a.getObj();if(l!==s||c!==o||!(d instanceof Wo))throw new w0(`Bad (uncompressed) XRef entry: ${e}`);if(d.cmd!=="obj"){if(d.cmd.startsWith("obj")&&(s=parseInt(d.cmd.substring(3),10),!Number.isNaN(s)))return s;throw new w0(`Bad (uncompressed) XRef entry: ${e}`)}return i=this.encrypt&&!r?a.getObj(this.encrypt.createCipherTransform(s,o)):a.getObj(),i instanceof Ii||this._cacheMap.set(s,i),i}fetchCompressed(e,i,r=!1){const o=i.offset,s=this.fetch(bt.get(o,0));if(!(s instanceof Ii))throw new it("bad ObjStm stream");const n=s.dict.get("First"),a=s.dict.get("N");if(!Number.isInteger(n)||!Number.isInteger(a))throw new it("invalid first and n parameters for ObjStm stream");let l=new x0({lexer:new Ad(s),xref:this,allowStreams:!0});const c=new Array(a),d=new Array(a);for(let h=0;h<a;++h){const g=l.getObj();if(!Number.isInteger(g))throw new it(`invalid object number in the ObjStm stream: ${g}`);const p=l.getObj();if(!Number.isInteger(p))throw new it(`invalid object offset in the ObjStm stream: ${p}`);c[h]=g,d[h]=p}const A=(s.start||0)+n,u=new Array(a);for(let h=0;h<a;++h){const g=h<a-1?d[h+1]-d[h]:void 0;if(g<0)throw new it("Invalid offset in the ObjStm stream.");l=new x0({lexer:new Ad(s.makeSubStream(A+d[h],g,s.dict)),xref:this,allowStreams:!0});const p=l.getObj();if(u[h]=p,p instanceof Ii)continue;const m=c[h],f=this.entries[m];f&&f.offset===o&&f.gen===h&&this._cacheMap.set(m,p)}if(i=u[i.gen],i===void 0)throw new w0(`Bad (compressed) XRef entry: ${e}`);return i}async fetchIfRefAsync(e,i){return e instanceof bt?this.fetchAsync(e,i):e}async fetchAsync(e,i){try{return this.fetch(e,i)}catch(r){if(!(r instanceof zr))throw r;return await this.pdfManager.requestRange(r.begin,r.end),this.fetchAsync(e,i)}}getCatalogObj(){return this.root}}WI=new WeakMap;const cUi=1,dUi=[0,0,612,792];var hP,Pz;class cCe{constructor({pdfManager:e,xref:i,pageIndex:r,pageDict:o,ref:s,globalIdFactory:n,fontCache:a,builtInCMapCache:l,standardFontDataCache:c,globalImageCache:d,systemFontCache:A,nonBlendModesSet:u,xfaFactory:h}){ce(this,hP),this.pdfManager=e,this.pageIndex=r,this.pageDict=o,this.xref=i,this.ref=s,this.fontCache=a,this.builtInCMapCache=l,this.standardFontDataCache=c,this.globalImageCache=d,this.systemFontCache=A,this.nonBlendModesSet=u,this.evaluatorOptions=e.evaluatorOptions,this.resourcesPromise=null,this.xfaFactory=h;const g={obj:0};this._localIdFactory=class extends n{static createObjId(){return`p${r}_${++g.obj}`}static getPageObjId(){return`p${s.toString()}`}}}_getInheritableProperty(e,i=!1){const r=Cc({dict:this.pageDict,key:e,getArray:i,stopWhenFound:!1});return Array.isArray(r)?r.length===1||!(r[0]instanceof Te)?r[0]:Te.merge({xref:this.xref,dictArray:r}):r}get content(){return this.pageDict.getArray("Contents")}get resources(){const e=this._getInheritableProperty("Resources");return yt(this,"resources",e instanceof Te?e:Te.empty)}_getBoundingBox(e){if(this.xfaData)return this.xfaData.bbox;const i=rh(this._getInheritableProperty(e,!0),null);if(i){if(i[2]-i[0]>0&&i[3]-i[1]>0)return i;Qe(`Empty, or invalid, /${e} entry.`)}return null}get mediaBox(){return yt(this,"mediaBox",this._getBoundingBox("MediaBox")||dUi)}get cropBox(){return yt(this,"cropBox",this._getBoundingBox("CropBox")||this.mediaBox)}get userUnit(){let e=this.pageDict.get("UserUnit");return(typeof e!="number"||e<=0)&&(e=cUi),yt(this,"userUnit",e)}get view(){const{cropBox:e,mediaBox:i}=this;if(e!==i&&!w4(e,i)){const r=Po.intersect(e,i);if(r&&r[2]-r[0]>0&&r[3]-r[1]>0)return yt(this,"view",r);Qe("Empty /CropBox and /MediaBox intersection.")}return yt(this,"view",i)}get rotate(){let e=this._getInheritableProperty("Rotate")||0;return e%90!==0?e=0:e>=360?e%=360:e<0&&(e=(e%360+360)%360),yt(this,"rotate",e)}_onSubStreamError(e,i){if(this.evaluatorOptions.ignoreErrors){Qe(`getContentStream - ignoring sub-stream (${i}): "${e}".`);return}throw e}getContentStream(){return this.pdfManager.ensure(this,"content").then(e=>e instanceof Ii?e:Array.isArray(e)?new aQi(e,this._onSubStreamError.bind(this)):new tD)}get xfaData(){return yt(this,"xfaData",this.xfaFactory?{bbox:this.xfaFactory.getBoundingBox(this.pageIndex)}:null)}async saveNewAnnotations(e,i,r,o){if(this.xfaFactory)throw new Error("XFA: Cannot save new annotations.");const s=new DA({xref:this.xref,handler:e,pageIndex:this.pageIndex,idFactory:this._localIdFactory,fontCache:this.fontCache,builtInCMapCache:this.builtInCMapCache,standardFontDataCache:this.standardFontDataCache,globalImageCache:this.globalImageCache,systemFontCache:this.systemFontCache,options:this.evaluatorOptions}),n=new dd,a=new Bn;$(this,hP,Pz).call(this,r,n,a);const l=this.pageDict,c=this.annotations.filter(g=>!(g instanceof bt&&n.has(g))),d=await O0.saveNewAnnotations(s,i,r,o);for(const{ref:g}of d.annotations)g instanceof bt&&!a.has(g)&&c.push(g);const A=l.get("Annots");l.set("Annots",c);const u=[];await Ia(this.ref,l,u,this.xref),A&&l.set("Annots",A);const h=d.dependencies;h.push({ref:this.ref,data:u.join("")},...d.annotations);for(const g of n)h.push({ref:g,data:null});return h}save(e,i,r){const o=new DA({xref:this.xref,handler:e,pageIndex:this.pageIndex,idFactory:this._localIdFactory,fontCache:this.fontCache,builtInCMapCache:this.builtInCMapCache,standardFontDataCache:this.standardFontDataCache,globalImageCache:this.globalImageCache,systemFontCache:this.systemFontCache,options:this.evaluatorOptions});return this._parsedAnnotations.then(function(s){const n=[];for(const a of s)a.mustBePrinted(r)&&n.push(a.save(o,i,r).catch(function(l){return Qe(`save - ignoring annotation data during "${i.name}" task: "${l}".`),null}));return Promise.all(n).then(function(a){return a.filter(l=>!!l)})})}loadResources(e){return this.resourcesPromise||(this.resourcesPromise=this.pdfManager.ensure(this,"resources")),this.resourcesPromise.then(()=>new KD(this.resources,e,this.xref).load())}getOperatorList({handler:e,sink:i,task:r,intent:o,cacheKey:s,annotationStorage:n=null,modifiedIds:a=null}){const l=this.getContentStream(),c=this.loadResources(["ColorSpace","ExtGState","Font","Pattern","Properties","Shading","XObject"]),d=new DA({xref:this.xref,handler:e,pageIndex:this.pageIndex,idFactory:this._localIdFactory,fontCache:this.fontCache,builtInCMapCache:this.builtInCMapCache,standardFontDataCache:this.standardFontDataCache,globalImageCache:this.globalImageCache,systemFontCache:this.systemFontCache,options:this.evaluatorOptions}),A=this.xfaFactory?null:Z5e(n),u=A?.get(this.pageIndex);let h=Promise.resolve(null),g=null;if(u){const m=this.pdfManager.ensureDoc("annotationGlobals");let f;const v=new Set;for(const{bitmapId:y,bitmap:I}of u)y&&!I&&!v.has(y)&&v.add(y);const{isOffscreenCanvasSupported:C}=this.evaluatorOptions;if(v.size>0){const y=u.slice();for(const[I,B]of n)I.startsWith(T5e)&&B.bitmap&&v.has(B.bitmapId)&&y.push(B);f=O0.generateImages(y,this.xref,C)}else f=O0.generateImages(u,this.xref,C);g=new Bn,$(this,hP,Pz).call(this,u,g,null),h=m.then(y=>y?O0.printNewAnnotations(y,d,r,u,f):null)}const p=Promise.all([l,c]).then(([m])=>{const f=new Ec(o,i);return e.send("StartRenderPage",{transparency:d.hasBlendModes(this.resources,this.nonBlendModesSet),pageIndex:this.pageIndex,cacheKey:s}),d.getOperatorList({stream:m,task:r,resources:this.resources,operatorList:f}).then(function(){return f})});return Promise.all([p,this._parsedAnnotations,h]).then(function([m,f,v]){if(v){f=f.filter(Q=>!(Q.ref&&g.has(Q.ref)));for(let Q=0,S=v.length;Q<S;Q++){const D=v[Q];if(D.refToReplace){const R=f.findIndex(N=>N.ref&&ZS(N.ref,D.refToReplace));R>=0&&(f.splice(R,1,D),v.splice(Q--,1),S--)}}f=f.concat(v)}if(f.length===0||o&pa.ANNOTATIONS_DISABLE)return m.flush(!0),{length:m.totalLength};const C=!!(o&pa.ANNOTATIONS_FORMS),y=!!(o&pa.IS_EDITING),I=!!(o&pa.ANY),B=!!(o&pa.DISPLAY),E=!!(o&pa.PRINT),k=[];for(const Q of f)(I||B&&Q.mustBeViewed(n,C)&&Q.mustBeViewedWhenEditing(y,a)||E&&Q.mustBePrinted(n))&&k.push(Q.getOperatorList(d,r,o,n).catch(function(S){return Qe(`getOperatorList - ignoring annotation data during "${r.name}" task: "${S}".`),{opList:null,separateForm:!1,separateCanvas:!1}}));return Promise.all(k).then(function(Q){let S=!1,D=!1;for(const{opList:R,separateForm:N,separateCanvas:H}of Q)m.addOpList(R),S||(S=N),D||(D=H);return m.flush(!0,{form:S,canvas:D}),{length:m.totalLength}})})}async extractTextContent({handler:e,task:i,includeMarkedContent:r,disableNormalization:o,sink:s}){const n=this.getContentStream(),a=this.loadResources(["ExtGState","Font","Properties","XObject"]),l=this.pdfManager.ensureCatalog("lang"),[c,,d]=await Promise.all([n,a,l]);return new DA({xref:this.xref,handler:e,pageIndex:this.pageIndex,idFactory:this._localIdFactory,fontCache:this.fontCache,builtInCMapCache:this.builtInCMapCache,standardFontDataCache:this.standardFontDataCache,globalImageCache:this.globalImageCache,systemFontCache:this.systemFontCache,options:this.evaluatorOptions}).getTextContent({stream:c,task:i,resources:this.resources,includeMarkedContent:r,disableNormalization:o,sink:s,viewBox:this.view,lang:d})}async getStructTree(){const e=await this.pdfManager.ensureCatalog("structTreeRoot");return e?(await this._parsedAnnotations,(await this.pdfManager.ensure(this,"_parseStructTree",[e])).serializable):null}_parseStructTree(e){const i=new ZDi(e,this.pageDict);return i.parse(this.ref),i}async getAnnotationsData(e,i,r){const o=await this._parsedAnnotations;if(o.length===0)return o;const s=[],n=[];let a;const l=!!(r&pa.ANY),c=!!(r&pa.DISPLAY),d=!!(r&pa.PRINT);for(const A of o){const u=l||c&&A.viewable;(u||d&&A.printable)&&s.push(A.data),A.hasTextContent&&u&&(a||(a=new DA({xref:this.xref,handler:e,pageIndex:this.pageIndex,idFactory:this._localIdFactory,fontCache:this.fontCache,builtInCMapCache:this.builtInCMapCache,standardFontDataCache:this.standardFontDataCache,globalImageCache:this.globalImageCache,systemFontCache:this.systemFontCache,options:this.evaluatorOptions})),n.push(A.extractTextContent(a,i,[-1/0,-1/0,1/0,1/0]).catch(function(h){Qe(`getAnnotationsData - ignoring textContent during "${i.name}" task: "${h}".`)})))}return await Promise.all(n),s}get annotations(){const e=this._getInheritableProperty("Annots");return yt(this,"annotations",Array.isArray(e)?e:[])}get _parsedAnnotations(){const e=this.pdfManager.ensure(this,"annotations").then(async i=>{if(i.length===0)return i;const r=await this.pdfManager.ensureDoc("annotationGlobals");if(!r)return[];const o=[];for(const l of i)o.push(O0.create(this.xref,l,r,this._localIdFactory,!1,this.ref).catch(function(c){return Qe(`_parsedAnnotations: "${c}".`),null}));const s=[];let n,a;for(const l of await Promise.all(o))if(l){if(l instanceof yd){(a||(a=[])).push(l);continue}if(l instanceof nCe){(n||(n=[])).push(l);continue}s.push(l)}return a&&s.push(...a),n&&s.push(...n),s});return yt(this,"_parsedAnnotations",e)}get jsActions(){const e=$S(this.xref,this.pageDict,xxi);return yt(this,"jsActions",e)}}hP=new WeakSet,Pz=function(t,e,i){for(const r of t)if(r.id){const o=bt.fromString(r.id);if(!o){Qe(`A non-linked annotation cannot be modified: ${r.id}`);continue}if(r.deleted){e.put(o,o);continue}i?.put(o),r.ref=o,delete r.id}};const dCe=new Uint8Array([37,80,68,70,45]),ACe=new Uint8Array([115,116,97,114,116,120,114,101,102]),AUi=new Uint8Array([101,110,100,111,98,106]),uCe=1024,uUi="\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0";function Rz(t,e,i=1024,r=!1){const o=e.length,s=t.peekBytes(i),n=s.length-o;if(n<=0)return!1;if(r){const a=o-1;let l=s.length-1;for(;l>=a;){let c=0;for(;c<o&&s[l-c]===e[a-c];)c++;if(c>=o)return t.pos+=l-a,!0;l--}}else{let a=0;for(;a<=n;){let l=0;for(;l<o&&s[a+l]===e[l];)l++;if(l>=o)return t.pos+=a,!0;a++}}return!1}var pP,Lz;class hCe{constructor(e,i){if(ce(this,pP),i.length<=0)throw new YS("The PDF file is empty, i.e. its size is zero bytes.");this.pdfManager=e,this.stream=i,this.xref=new lUi(i,e),this._pagePromises=new Map,this._version=null;const r={font:0};this._globalIdFactory=class{static getDocId(){return`g_${e.docId}`}static createFontId(){return`f${++r.font}`}static createObjId(){Li("Abstract method `createObjId` called.")}static getPageObjId(){Li("Abstract method `getPageObjId` called.")}}}parse(e){this.xref.parse(e),this.catalog=new $_(this.pdfManager,this.xref)}get linearization(){let e=null;try{e=XQi.create(this.stream)}catch(i){if(i instanceof zr)throw i;yi(i)}return yt(this,"linearization",e)}get startXRef(){const e=this.stream;let i=0;if(this.linearization){if(e.reset(),Rz(e,AUi)){e.skip(6);let r=e.peekByte();for(;Pl(r);)e.pos++,r=e.peekByte();i=e.pos-e.start}}else{const r=ACe.length;let o=!1,s=e.end;for(;!o&&s>0;)s-=1024-r,s<0&&(s=0),e.pos=s,o=Rz(e,ACe,1024,!0);if(o){e.skip(9);let n;do n=e.getByte();while(Pl(n));let a="";for(;n>=32&&n<=57;)a+=String.fromCharCode(n),n=e.getByte();i=parseInt(a,10),isNaN(i)&&(i=0)}}return yt(this,"startXRef",i)}checkHeader(){const e=this.stream;if(e.reset(),!Rz(e,dCe))return;e.moveStart(),e.skip(dCe.length);let i="",r;for(;(r=e.getByte())>32&&i.length<7;)i+=String.fromCharCode(r);K5e.test(i)?this._version=i:Qe(`Invalid PDF header version: ${i}`)}parseStartXRef(){this.xref.setStartXRef(this.startXRef)}get numPages(){let e=0;return this.catalog.hasActualNumPages?e=this.catalog.numPages:this.xfaFactory?e=this.xfaFactory.getNumPages():this.linearization?e=this.linearization.numPages:e=this.catalog.numPages,yt(this,"numPages",e)}_hasOnlyDocumentSignatures(e,i=0){return Array.isArray(e)?e.every(r=>{if(r=this.xref.fetchIfRef(r),!(r instanceof Te))return!1;if(r.has("Kids"))return++i>10?(Qe("_hasOnlyDocumentSignatures: maximum recursion depth reached"),!1):this._hasOnlyDocumentSignatures(r.get("Kids"),i);const o=Jo(r.get("FT"),"Sig"),s=r.get("Rect"),n=Array.isArray(s)&&s.every(a=>a===0);return o&&n}):!1}get _xfaStreams(){const e=this.catalog.acroForm;if(!e)return null;const i=e.get("XFA"),r={"xdp:xdp":"",template:"",datasets:"",config:"",connectionSet:"",localeSet:"",stylesheet:"","/xdp:xdp":""};if(i instanceof Ii&&!i.isEmpty)return r["xdp:xdp"]=i,r;if(!Array.isArray(i)||i.length===0)return null;for(let o=0,s=i.length;o<s;o+=2){let n;if(o===0?n="xdp:xdp":o===s-2?n="/xdp:xdp":n=i[o],!r.hasOwnProperty(n))continue;const a=this.xref.fetchIfRef(i[o+1]);!(a instanceof Ii)||a.isEmpty||(r[n]=a)}return r}get xfaDatasets(){const e=this._xfaStreams;if(!e)return yt(this,"xfaDatasets",null);for(const i of["datasets","xdp:xdp"]){const r=e[i];if(r)try{const o=oI(r.getString()),s={[i]:o};return yt(this,"xfaDatasets",new aUi(s))}catch{Qe("XFA - Invalid utf-8 string.");break}}return yt(this,"xfaDatasets",null)}get xfaData(){const e=this._xfaStreams;if(!e)return null;const i=Object.create(null);for(const[r,o]of Object.entries(e))if(o)try{i[r]=oI(o.getString())}catch{return Qe("XFA - Invalid utf-8 string."),null}return i}get xfaFactory(){let e;return this.pdfManager.enableXfa&&this.catalog.needsRendering&&this.formInfo.hasXfa&&!this.formInfo.hasAcroForm&&(e=this.xfaData),yt(this,"xfaFactory",e?new uw(e):null)}get isPureXfa(){return this.xfaFactory?this.xfaFactory.isValid():!1}get htmlForXfa(){return this.xfaFactory?this.xfaFactory.getPages():null}async loadXfaImages(){const e=await this.pdfManager.ensureCatalog("xfaImages");if(!e)return;const i=e.getKeys();await new KD(e,i,this.xref).load();const r=new Map;for(const o of i){const s=e.get(o);s instanceof Ii&&r.set(o,s.getBytes())}this.xfaFactory.setImages(r)}async loadXfaFonts(e,i){const r=await this.pdfManager.ensureCatalog("acroForm");if(!r)return;const o=await r.getAsync("DR");if(!(o instanceof Te))return;await new KD(o,["Font"],this.xref).load();const s=o.get("Font");if(!(s instanceof Te))return;const n=Object.assign(Object.create(null),this.pdfManager.evaluatorOptions);n.useSystemFonts=!1;const a=new DA({xref:this.xref,handler:e,pageIndex:-1,idFactory:this._globalIdFactory,fontCache:this.catalog.fontCache,builtInCMapCache:this.catalog.builtInCMapCache,standardFontDataCache:this.catalog.standardFontDataCache,options:n}),l=new Ec,c=[],d={get font(){return c.at(-1)},set font(p){c.push(p)},clone(){return this}},A=new Map;s.forEach((p,m)=>{A.set(p,m)});const u=[];for(const[p,m]of A){const f=m.get("FontDescriptor");if(!(f instanceof Te))continue;let v=f.get("FontFamily");v=v.replaceAll(/[ ]+(\d)/g,"$1");const C=f.get("FontWeight"),y=-f.get("ItalicAngle"),I={fontFamily:v,fontWeight:C,italicAngle:y};jxi(I)&&u.push(a.handleSetFont(o,[Ze.get(p),1],null,l,i,d,null,I).catch(function(B){return Qe(`loadXfaFonts: "${B}".`),null}))}await Promise.all(u);const h=this.xfaFactory.setFonts(c);if(!h)return;n.ignoreErrors=!0,u.length=0,c.length=0;const g=new Set;for(const p of h)R_(`${p}-Regular`)||g.add(p);g.size&&h.push("PdfJS-Fallback");for(const p of h)if(!g.has(p))for(const m of[{name:"Regular",fontWeight:400,italicAngle:0},{name:"Bold",fontWeight:700,italicAngle:0},{name:"Italic",fontWeight:400,italicAngle:12},{name:"BoldItalic",fontWeight:700,italicAngle:12}]){const f=`${p}-${m.name}`,v=u9e(f);u.push(a.handleSetFont(o,[Ze.get(f),1],null,l,i,d,v,{fontFamily:p,fontWeight:m.fontWeight,italicAngle:m.italicAngle}).catch(function(C){return Qe(`loadXfaFonts: "${C}".`),null}))}await Promise.all(u),this.xfaFactory.appendFonts(c,g)}async serializeXfaData(e){return this.xfaFactory?this.xfaFactory.serializeData(e):null}get version(){return this.catalog.version||this._version}get formInfo(){const e={hasFields:!1,hasAcroForm:!1,hasXfa:!1,hasSignatures:!1},i=this.catalog.acroForm;if(!i)return yt(this,"formInfo",e);try{const r=i.get("Fields"),o=Array.isArray(r)&&r.length>0;e.hasFields=o;const s=i.get("XFA");e.hasXfa=Array.isArray(s)&&s.length>0||s instanceof Ii&&!s.isEmpty;const n=!!(i.get("SigFlags")&1),a=n&&this._hasOnlyDocumentSignatures(r);e.hasAcroForm=o&&!a,e.hasSignatures=n}catch(r){if(r instanceof zr)throw r;Qe(`Cannot fetch form information: "${r}".`)}return yt(this,"formInfo",e)}get documentInfo(){const e={PDFFormatVersion:this.version,Language:this.catalog.lang,EncryptFilterName:this.xref.encrypt?this.xref.encrypt.filterName:null,IsLinearized:!!this.linearization,IsAcroFormPresent:this.formInfo.hasAcroForm,IsXFAPresent:this.formInfo.hasXfa,IsCollectionPresent:!!this.catalog.collection,IsSignaturesPresent:this.formInfo.hasSignatures};let i;try{i=this.xref.trailer.get("Info")}catch(r){if(r instanceof zr)throw r;yi("The document information dictionary is invalid.")}if(!(i instanceof Te))return yt(this,"documentInfo",e);for(const r of i.getKeys()){const o=i.get(r);switch(r){case"Title":case"Author":case"Subject":case"Keywords":case"Creator":case"Producer":case"CreationDate":case"ModDate":if(typeof o=="string"){e[r]=Gi(o);continue}break;case"Trapped":if(o instanceof Ze){e[r]=o;continue}break;default:let s;switch(typeof o){case"string":s=Gi(o);break;case"number":case"boolean":s=o;break;default:o instanceof Ze&&(s=o);break}if(s===void 0){Qe(`Bad value, for custom key "${r}", in Info: ${o}.`);continue}e.Custom||(e.Custom=Object.create(null)),e.Custom[r]=s;continue}Qe(`Bad value, for key "${r}", in Info: ${o}.`)}return yt(this,"documentInfo",e)}get fingerprints(){function e(n){return typeof n=="string"&&n.length>0&&n!==uUi}function i(n){const a=[];for(const l of n){const c=l.toString(16);a.push(c.padStart(2,"0"))}return a.join("")}const r=this.xref.trailer.get("ID");let o,s;return Array.isArray(r)&&e(r[0])?(o=cs(r[0]),r[1]!==r[0]&&e(r[1])&&(s=cs(r[1]))):o=D0(this.stream.getByteRange(0,uCe),0,uCe),yt(this,"fingerprints",[i(o),s?i(s):null])}async _getLinearizationPage(e){const{catalog:i,linearization:r,xref:o}=this,s=bt.get(r.objectNumberFirst,0);try{const n=await o.fetchAsync(s);if(n instanceof Te){let a=n.getRaw("Type");if(a instanceof bt&&(a=await o.fetchAsync(a)),Jo(a,"Page")||!n.has("Type")&&!n.has("Kids")&&n.has("Contents"))return i.pageKidsCountCache.has(s)||i.pageKidsCountCache.put(s,1),i.pageIndexCache.has(s)||i.pageIndexCache.put(s,0),[n,s]}throw new it("The Linearization dictionary doesn't point to a valid Page dictionary.")}catch(n){return Qe(`_getLinearizationPage: "${n.message}".`),i.getPageDict(e)}}getPage(e){const i=this._pagePromises.get(e);if(i)return i;const{catalog:r,linearization:o,xfaFactory:s}=this;let n;return s?n=Promise.resolve([Te.empty,null]):o?.pageFirst===e?n=this._getLinearizationPage(e):n=r.getPageDict(e),n=n.then(([a,l])=>new cCe({pdfManager:this.pdfManager,xref:this.xref,pageIndex:e,pageDict:a,ref:l,globalIdFactory:this._globalIdFactory,fontCache:r.fontCache,builtInCMapCache:r.builtInCMapCache,standardFontDataCache:r.standardFontDataCache,globalImageCache:r.globalImageCache,systemFontCache:r.systemFontCache,nonBlendModesSet:r.nonBlendModesSet,xfaFactory:s})),this._pagePromises.set(e,n),n}async checkFirstPage(e=!1){if(!e)try{await this.getPage(0)}catch(i){if(i instanceof w0)throw this._pagePromises.delete(0),await this.cleanup(),new b4}}async checkLastPage(e=!1){const{catalog:i,pdfManager:r}=this;i.setActualNumPages();let o;try{if(await Promise.all([r.ensureDoc("xfaFactory"),r.ensureDoc("linearization"),r.ensureCatalog("numPages")]),this.xfaFactory)return;if(this.linearization?o=this.linearization.numPages:o=i.numPages,Number.isInteger(o)){if(o<=1)return}else throw new it("Page count is not an integer.");await this.getPage(o-1)}catch(s){if(this._pagePromises.delete(o-1),await this.cleanup(),s instanceof w0&&!e)throw new b4;Qe(`checkLastPage - invalid /Pages tree /Count: ${o}.`);let n;try{n=await i.getAllPageDicts(e)}catch(a){if(a instanceof w0&&!e)throw new b4;i.setActualNumPages(1);return}for(const[a,[l,c]]of n){let d;l instanceof Error?(d=Promise.reject(l),d.catch(()=>{})):d=Promise.resolve(new cCe({pdfManager:r,xref:this.xref,pageIndex:a,pageDict:l,ref:c,globalIdFactory:this._globalIdFactory,fontCache:i.fontCache,builtInCMapCache:i.builtInCMapCache,standardFontDataCache:i.standardFontDataCache,globalImageCache:i.globalImageCache,systemFontCache:i.systemFontCache,nonBlendModesSet:i.nonBlendModesSet,xfaFactory:null})),this._pagePromises.set(a,d)}i.setActualNumPages(n.size)}}fontFallback(e,i){return this.catalog.fontFallback(e,i)}async cleanup(e=!1){return this.catalog?this.catalog.cleanup(e):V_()}get fieldObjects(){if(!this.formInfo.hasFields)return yt(this,"fieldObjects",Promise.resolve(null));const e=Promise.all([this.pdfManager.ensureDoc("annotationGlobals"),this.pdfManager.ensureCatalog("acroForm")]).then(async([i,r])=>{if(!i)return null;const o=new Bn,s=Object.create(null),n=new Map;for(const l of await r.getAsync("Fields"))await $(this,pP,Lz).call(this,"",l,n,i,o);const a=[];for(const[l,c]of n)a.push(Promise.all(c).then(d=>{d=d.filter(A=>!!A),d.length>0&&(s[l]=d)}));return await Promise.all(a),s});return yt(this,"fieldObjects",e)}get hasJSActions(){const e=this.pdfManager.ensureDoc("_parseHasJSActions");return yt(this,"hasJSActions",e)}async _parseHasJSActions(){const[e,i]=await Promise.all([this.pdfManager.ensureCatalog("jsActions"),this.pdfManager.ensureDoc("fieldObjects")]);return e?!0:i?Object.values(i).some(r=>r.some(o=>o.actions!==null)):!1}get calculationOrderIds(){const e=this.catalog.acroForm;if(!(e!=null&&e.has("CO")))return yt(this,"calculationOrderIds",null);const i=e.get("CO");if(!Array.isArray(i)||i.length===0)return yt(this,"calculationOrderIds",null);const r=[];for(const o of i)o instanceof bt&&r.push(o.toString());return r.length===0?yt(this,"calculationOrderIds",null):yt(this,"calculationOrderIds",r)}get annotationGlobals(){return yt(this,"annotationGlobals",O0.createGlobals(this.pdfManager))}}pP=new WeakSet,Lz=async function(t,e,i,r,o){const{xref:s}=this;if(!(e instanceof bt)||o.has(e))return;o.put(e);const n=await s.fetchAsync(e);if(!(n instanceof Te))return;if(n.has("T")){const l=Gi(await n.getAsync("T"));t=t===""?l:`${t}.${l}`}else{let l=n;for(;;){if(l=l.getRaw("Parent"),l instanceof bt){if(o.has(l))break;l=await s.fetchAsync(l)}if(!(l instanceof Te))break;if(l.has("T")){const c=Gi(await l.getAsync("T"));t=t===""?c:`${t}.${c}`;break}}}if(i.has(t)||i.set(t,[]),i.get(t).push(O0.create(s,e,r,null,!0,null).then(l=>l?.getFieldObject()).catch(function(l){return Qe(`#collectFieldObjects: "${l}".`),null})),!n.has("Kids"))return;const a=await n.getAsync("Kids");if(Array.isArray(a))for(const l of a)await $(this,pP,Lz).call(this,t,l,i,r,o)};function hUi(t){if(t){const e=zS(t);if(e)return e.href;Qe(`Invalid absolute docBaseUrl: "${t}".`)}return null}class pCe{constructor(e){var i;this._docBaseUrl=hUi(e.docBaseUrl),this._docId=e.docId,this._password=e.password,this.enableXfa=e.enableXfa,(i=e.evaluatorOptions).isOffscreenCanvasSupported&&(i.isOffscreenCanvasSupported=ih.isOffscreenCanvasSupported),this.evaluatorOptions=Object.freeze(e.evaluatorOptions)}get docId(){return this._docId}get password(){return this._password}get docBaseUrl(){return this._docBaseUrl}get catalog(){return this.pdfDocument.catalog}ensureDoc(e,i){return this.ensure(this.pdfDocument,e,i)}ensureXRef(e,i){return this.ensure(this.pdfDocument.xref,e,i)}ensureCatalog(e,i){return this.ensure(this.pdfDocument.catalog,e,i)}getPage(e){return this.pdfDocument.getPage(e)}fontFallback(e,i){return this.pdfDocument.fontFallback(e,i)}loadXfaFonts(e,i){return this.pdfDocument.loadXfaFonts(e,i)}loadXfaImages(){return this.pdfDocument.loadXfaImages()}serializeXfaData(e){return this.pdfDocument.serializeXfaData(e)}cleanup(e=!1){return this.pdfDocument.cleanup(e)}async ensure(e,i,r){Li("Abstract method `ensure` called")}requestRange(e,i){Li("Abstract method `requestRange` called")}requestLoadedStream(e=!1){Li("Abstract method `requestLoadedStream` called")}sendProgressiveData(e){Li("Abstract method `sendProgressiveData` called")}updatePassword(e){this._password=e}terminate(e){Li("Abstract method `terminate` called")}}class gCe extends pCe{constructor(e){super(e);const i=new fo(e.source);this.pdfDocument=new hCe(this,i),this._loadedStreamPromise=Promise.resolve(i)}async ensure(e,i,r){const o=e[i];return typeof o=="function"?o.apply(e,r):o}requestRange(e,i){return Promise.resolve()}requestLoadedStream(e=!1){return this._loadedStreamPromise}terminate(e){}}class pUi extends pCe{constructor(e){super(e),this.streamManager=new zxi(e.source,{msgHandler:e.handler,length:e.length,disableAutoFetch:e.disableAutoFetch,rangeChunkSize:e.rangeChunkSize}),this.pdfDocument=new hCe(this,this.streamManager.getStream())}async ensure(e,i,r){try{const o=e[i];return typeof o=="function"?o.apply(e,r):o}catch(o){if(!(o instanceof zr))throw o;return await this.requestRange(o.begin,o.end),this.ensure(e,i,r)}}requestRange(e,i){return this.streamManager.requestRange(e,i)}requestLoadedStream(e=!1){return this.streamManager.requestAllChunks(e)}sendProgressiveData(e){this.streamManager.onReceiveData({chunk:e})}terminate(e){this.streamManager.abort(e)}}const gP={UNKNOWN:0,DATA:1,ERROR:2},An={UNKNOWN:0,CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function Nl(t){switch(t instanceof Error||typeof t=="object"&&t!==null||Li('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),t.name){case"AbortException":return new ma(t.message);case"MissingPDFException":return new G5e(t.message);case"PasswordException":return new KS(t.message,t.code);case"UnexpectedResponseException":return new j5e(t.message,t.status);case"UnknownErrorException":return new JS(t.message,t.details);default:return new JS(t.message,t.toString())}}var Vf,fCe,mCe,fP;class vCe{constructor(e,i,r){ce(this,Vf),this.sourceName=e,this.targetName=i,this.comObj=r,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=o=>{const s=o.data;if(s.targetName!==this.sourceName)return;if(s.stream){$(this,Vf,mCe).call(this,s);return}if(s.callback){const a=s.callbackId,l=this.callbackCapabilities[a];if(!l)throw new Error(`Cannot resolve callback ${a}`);if(delete this.callbackCapabilities[a],s.callback===gP.DATA)l.resolve(s.data);else if(s.callback===gP.ERROR)l.reject(Nl(s.reason));else throw new Error("Unexpected callback case");return}const n=this.actionHandler[s.action];if(!n)throw new Error(`Unknown action from worker: ${s.action}`);if(s.callbackId){const a=this.sourceName,l=s.sourceName;new Promise(function(c){c(n(s.data))}).then(function(c){r.postMessage({sourceName:a,targetName:l,callback:gP.DATA,callbackId:s.callbackId,data:c})},function(c){r.postMessage({sourceName:a,targetName:l,callback:gP.ERROR,callbackId:s.callbackId,reason:Nl(c)})});return}if(s.streamId){$(this,Vf,fCe).call(this,s);return}n(s.data)},r.addEventListener("message",this._onComObjOnMessage)}on(e,i){const r=this.actionHandler;if(r[e])throw new Error(`There is already an actionName called "${e}"`);r[e]=i}send(e,i,r){this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,data:i},r)}sendWithPromise(e,i,r){const o=this.callbackId++,s=Promise.withResolvers();this.callbackCapabilities[o]=s;try{this.comObj.postMessage({sourceName:this.sourceName,targetName:this.targetName,action:e,callbackId:o,data:i},r)}catch(n){s.reject(n)}return s.promise}sendWithStream(e,i,r,o){const s=this.streamId++,n=this.sourceName,a=this.targetName,l=this.comObj;return new ReadableStream({start:c=>{const d=Promise.withResolvers();return this.streamControllers[s]={controller:c,startCall:d,pullCall:null,cancelCall:null,isClosed:!1},l.postMessage({sourceName:n,targetName:a,action:e,streamId:s,data:i,desiredSize:c.desiredSize},o),d.promise},pull:c=>{const d=Promise.withResolvers();return this.streamControllers[s].pullCall=d,l.postMessage({sourceName:n,targetName:a,stream:An.PULL,streamId:s,desiredSize:c.desiredSize}),d.promise},cancel:c=>{fa(c instanceof Error,"cancel must have a valid reason");const d=Promise.withResolvers();return this.streamControllers[s].cancelCall=d,this.streamControllers[s].isClosed=!0,l.postMessage({sourceName:n,targetName:a,stream:An.CANCEL,streamId:s,reason:Nl(c)}),d.promise}},r)}destroy(){this.comObj.removeEventListener("message",this._onComObjOnMessage)}}Vf=new WeakSet,fCe=function(t){const e=t.streamId,i=this.sourceName,r=t.sourceName,o=this.comObj,s=this,n=this.actionHandler[t.action],a={enqueue(l,c=1,d){if(this.isCancelled)return;const A=this.desiredSize;this.desiredSize-=c,A>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),o.postMessage({sourceName:i,targetName:r,stream:An.ENQUEUE,streamId:e,chunk:l},d)},close(){this.isCancelled||(this.isCancelled=!0,o.postMessage({sourceName:i,targetName:r,stream:An.CLOSE,streamId:e}),delete s.streamSinks[e])},error(l){fa(l instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,o.postMessage({sourceName:i,targetName:r,stream:An.ERROR,streamId:e,reason:Nl(l)}))},sinkCapability:Promise.withResolvers(),onPull:null,onCancel:null,isCancelled:!1,desiredSize:t.desiredSize,ready:null};a.sinkCapability.resolve(),a.ready=a.sinkCapability.promise,this.streamSinks[e]=a,new Promise(function(l){l(n(t.data,a))}).then(function(){o.postMessage({sourceName:i,targetName:r,stream:An.START_COMPLETE,streamId:e,success:!0})},function(l){o.postMessage({sourceName:i,targetName:r,stream:An.START_COMPLETE,streamId:e,reason:Nl(l)})})},mCe=function(t){const e=t.streamId,i=this.sourceName,r=t.sourceName,o=this.comObj,s=this.streamControllers[e],n=this.streamSinks[e];switch(t.stream){case An.START_COMPLETE:t.success?s.startCall.resolve():s.startCall.reject(Nl(t.reason));break;case An.PULL_COMPLETE:t.success?s.pullCall.resolve():s.pullCall.reject(Nl(t.reason));break;case An.PULL:if(!n){o.postMessage({sourceName:i,targetName:r,stream:An.PULL_COMPLETE,streamId:e,success:!0});break}n.desiredSize<=0&&t.desiredSize>0&&n.sinkCapability.resolve(),n.desiredSize=t.desiredSize,new Promise(function(a){var l;a((l=n.onPull)==null?void 0:l.call(n))}).then(function(){o.postMessage({sourceName:i,targetName:r,stream:An.PULL_COMPLETE,streamId:e,success:!0})},function(a){o.postMessage({sourceName:i,targetName:r,stream:An.PULL_COMPLETE,streamId:e,reason:Nl(a)})});break;case An.ENQUEUE:if(fa(s,"enqueue should have stream controller"),s.isClosed)break;s.controller.enqueue(t.chunk);break;case An.CLOSE:if(fa(s,"close should have stream controller"),s.isClosed)break;s.isClosed=!0,s.controller.close(),$(this,Vf,fP).call(this,s,e);break;case An.ERROR:fa(s,"error should have stream controller"),s.controller.error(Nl(t.reason)),$(this,Vf,fP).call(this,s,e);break;case An.CANCEL_COMPLETE:t.success?s.cancelCall.resolve():s.cancelCall.reject(Nl(t.reason)),$(this,Vf,fP).call(this,s,e);break;case An.CANCEL:if(!n)break;new Promise(function(a){var l;a((l=n.onCancel)==null?void 0:l.call(n,Nl(t.reason)))}).then(function(){o.postMessage({sourceName:i,targetName:r,stream:An.CANCEL_COMPLETE,streamId:e,success:!0})},function(a){o.postMessage({sourceName:i,targetName:r,stream:An.CANCEL_COMPLETE,streamId:e,reason:Nl(a)})}),n.sinkCapability.reject(Nl(t.reason)),n.isCancelled=!0,delete this.streamSinks[e];break;default:throw new Error("Unexpected stream case")}},fP=async function(t,e){var i,r,o;await Promise.allSettled([(i=t.startCall)==null?void 0:i.promise,(r=t.pullCall)==null?void 0:r.promise,(o=t.cancelCall)==null?void 0:o.promise]),delete this.streamControllers[e]};class gUi{constructor(e){this._msgHandler=e,this._contentLength=null,this._fullRequestReader=null,this._rangeRequestReaders=[]}getFullReader(){return fa(!this._fullRequestReader,"PDFWorkerStream.getFullReader can only be called once."),this._fullRequestReader=new fUi(this._msgHandler),this._fullRequestReader}getRangeReader(e,i){const r=new mUi(e,i,this._msgHandler);return this._rangeRequestReaders.push(r),r}cancelAllRequests(e){var i;(i=this._fullRequestReader)==null||i.cancel(e);for(const r of this._rangeRequestReaders.slice(0))r.cancel(e)}}class fUi{constructor(e){this._msgHandler=e,this.onProgress=null,this._contentLength=null,this._isRangeSupported=!1,this._isStreamingSupported=!1;const i=this._msgHandler.sendWithStream("GetReader");this._reader=i.getReader(),this._headersReady=this._msgHandler.sendWithPromise("ReaderHeadersReady").then(r=>{this._isStreamingSupported=r.isStreamingSupported,this._isRangeSupported=r.isRangeSupported,this._contentLength=r.contentLength})}get headersReady(){return this._headersReady}get contentLength(){return this._contentLength}get isStreamingSupported(){return this._isStreamingSupported}get isRangeSupported(){return this._isRangeSupported}async read(){const{value:e,done:i}=await this._reader.read();return i?{value:void 0,done:!0}:{value:e.buffer,done:!1}}cancel(e){this._reader.cancel(e)}}class mUi{constructor(e,i,r){this._msgHandler=r,this.onProgress=null;const o=this._msgHandler.sendWithStream("GetRangeReader",{begin:e,end:i});this._reader=o.getReader()}get isStreamingSupported(){return!1}async read(){const{value:e,done:i}=await this._reader.read();return i?{value:void 0,done:!0}:{value:e.buffer,done:!1}}cancel(e){this._reader.cancel(e)}}class qf{constructor(e){this.name=e,this.terminated=!1,this._capability=Promise.withResolvers()}get finished(){return this._capability.promise}finish(){this._capability.resolve()}terminate(){this.terminated=!0}ensureNotTerminated(){if(this.terminated)throw new Error("Worker task was terminated")}}class gw{static setup(e,i){let r=!1;e.on("test",function(o){r||(r=!0,e.send("test",o instanceof Uint8Array))}),e.on("configure",function(o){Qxi(o.verbosity)}),e.on("GetDocRequest",function(o){return gw.createDocumentHandler(o,i)})}static createDocumentHandler(e,i){let r,o=!1,s=null;const n=new Set,a=Mxi(),{docId:l,apiVersion:c}=e,d="4.6.82";if(c!==d)throw new Error(`The API version "${c}" does not match the Worker version "${d}".`);const A=[];for(const y in[])A.push(y);if(A.length)throw new Error("The `Array.prototype` contains unexpected enumerable properties: "+A.join(", ")+"; thus breaking e.g. `for...in` iteration of `Array`s.");const u=l+"_worker";let h=new vCe(u,l,i);function g(){if(o)throw new Error("Worker was terminated")}function p(y){n.add(y)}function m(y){y.finish(),n.delete(y)}async function f(y){await r.ensureDoc("checkHeader"),await r.ensureDoc("parseStartXRef"),await r.ensureDoc("parse",[y]),await r.ensureDoc("checkFirstPage",[y]),await r.ensureDoc("checkLastPage",[y]);const I=await r.ensureDoc("isPureXfa");if(I){const Q=new qf("loadXfaFonts");p(Q),await Promise.all([r.loadXfaFonts(h,Q).catch(S=>{}).then(()=>m(Q)),r.loadXfaImages()])}const[B,E]=await Promise.all([r.ensureDoc("numPages"),r.ensureDoc("fingerprints")]),k=I?await r.ensureDoc("htmlForXfa"):null;return{numPages:B,fingerprints:E,htmlForXfa:k}}function v({data:y,password:I,disableAutoFetch:B,rangeChunkSize:E,length:k,docBaseUrl:Q,enableXfa:S,evaluatorOptions:D}){const R={source:null,disableAutoFetch:B,docBaseUrl:Q,docId:l,enableXfa:S,evaluatorOptions:D,handler:h,length:k,password:I,rangeChunkSize:E},N=Promise.withResolvers();let H;if(y){try{R.source=y,H=new gCe(R),N.resolve(H)}catch(ue){N.reject(ue)}return N.promise}let q,O=[];try{q=new gUi(h)}catch(ue){return N.reject(ue),N.promise}const G=q.getFullReader();G.headersReady.then(function(){if(G.isRangeSupported){R.source=q,R.length=G.contentLength,R.disableAutoFetch||(R.disableAutoFetch=G.isStreamingSupported),H=new pUi(R);for(const ue of O)H.sendProgressiveData(ue);O=[],N.resolve(H),s=null}}).catch(function(ue){N.reject(ue),s=null});let Z=0;const ae=function(){const ue=J5e(O);k&&ue.length!==k&&Qe("reported HTTP length is different from actual");try{R.source=ue,H=new gCe(R),N.resolve(H)}catch(ke){N.reject(ke)}O=[]};return new Promise(function(ue,ke){const se=function({value:me,done:qe}){try{if(g(),qe){H||ae(),s=null;return}Z+=me.byteLength,G.isStreamingSupported||h.send("DocProgress",{loaded:Z,total:Math.max(Z,G.contentLength||0)}),H?H.sendProgressiveData(me):O.push(me),G.read().then(se,ke)}catch(Ne){ke(Ne)}};G.read().then(se,ke)}).catch(function(ue){N.reject(ue),s=null}),s=function(ue){q.cancelAllRequests(ue)},N.promise}function C(y){function I(k){g(),h.send("GetDoc",{pdfInfo:k})}function B(k){if(g(),k instanceof KS){const Q=new qf(`PasswordException: response ${k.code}`);p(Q),h.sendWithPromise("PasswordRequest",k).then(function({password:S}){m(Q),r.updatePassword(S),E()}).catch(function(){m(Q),h.send("DocException",k)})}else k instanceof YS||k instanceof G5e||k instanceof j5e||k instanceof JS?h.send("DocException",k):h.send("DocException",new JS(k.message,k.toString()))}function E(){g(),f(!1).then(I,function(k){if(g(),!(k instanceof b4)){B(k);return}r.requestLoadedStream().then(function(){g(),f(!0).then(I,B)})})}g(),v(y).then(function(k){if(o)throw k.terminate(new ma("Worker was terminated.")),new Error("Worker was terminated");r=k,r.requestLoadedStream(!0).then(Q=>{h.send("DataLoaded",{length:Q.bytes.byteLength})})}).then(E,B)}return h.on("GetPage",function(y){return r.getPage(y.pageIndex).then(function(I){return Promise.all([r.ensure(I,"rotate"),r.ensure(I,"ref"),r.ensure(I,"userUnit"),r.ensure(I,"view")]).then(function([B,E,k,Q]){return{rotate:B,ref:E,refStr:E?.toString()??null,userUnit:k,view:Q}})})}),h.on("GetPageIndex",function(y){const I=bt.get(y.num,y.gen);return r.ensureCatalog("getPageIndex",[I])}),h.on("GetDestinations",function(y){return r.ensureCatalog("destinations")}),h.on("GetDestination",function(y){return r.ensureCatalog("getDestination",[y.id])}),h.on("GetPageLabels",function(y){return r.ensureCatalog("pageLabels")}),h.on("GetPageLayout",function(y){return r.ensureCatalog("pageLayout")}),h.on("GetPageMode",function(y){return r.ensureCatalog("pageMode")}),h.on("GetViewerPreferences",function(y){return r.ensureCatalog("viewerPreferences")}),h.on("GetOpenAction",function(y){return r.ensureCatalog("openAction")}),h.on("GetAttachments",function(y){return r.ensureCatalog("attachments")}),h.on("GetDocJSActions",function(y){return r.ensureCatalog("jsActions")}),h.on("GetPageJSActions",function({pageIndex:y}){return r.getPage(y).then(function(I){return r.ensure(I,"jsActions")})}),h.on("GetOutline",function(y){return r.ensureCatalog("documentOutline")}),h.on("GetOptionalContentConfig",function(y){return r.ensureCatalog("optionalContentConfig")}),h.on("GetPermissions",function(y){return r.ensureCatalog("permissions")}),h.on("GetMetadata",function(y){return Promise.all([r.ensureDoc("documentInfo"),r.ensureCatalog("metadata")])}),h.on("GetMarkInfo",function(y){return r.ensureCatalog("markInfo")}),h.on("GetData",function(y){return r.requestLoadedStream().then(function(I){return I.bytes})}),h.on("GetAnnotations",function({pageIndex:y,intent:I}){return r.getPage(y).then(function(B){const E=new qf(`GetAnnotations: page ${y}`);return p(E),B.getAnnotationsData(h,E,I).then(k=>(m(E),k),k=>{throw m(E),k})})}),h.on("GetFieldObjects",function(y){return r.ensureDoc("fieldObjects")}),h.on("HasJSActions",function(y){return r.ensureDoc("hasJSActions")}),h.on("GetCalculationOrderIds",function(y){return r.ensureDoc("calculationOrderIds")}),h.on("SaveDocument",async function({isPureXfa:y,numPages:I,annotationStorage:B,filename:E}){const k=[r.requestLoadedStream(),r.ensureCatalog("acroForm"),r.ensureCatalog("acroFormRef"),r.ensureDoc("startXRef"),r.ensureDoc("xref"),r.ensureDoc("linearization"),r.ensureCatalog("structTreeRoot")],Q=[],S=y?null:Z5e(B),[D,R,N,H,q,O,G]=await Promise.all(k),Z=q.trailer.getRaw("Root")||null;let ae;if(S){G?await G.canUpdateStructTree({pdfManager:r,xref:q,newAnnotationsByPage:S})&&(ae=G):await Z_.canCreateStructureTree({catalogRef:Z,pdfManager:r,newAnnotationsByPage:S})&&(ae=null);const oe=O0.generateImages(B.values(),q,r.evaluatorOptions.isOffscreenCanvasSupported),ne=ae===void 0?Q:[];for(const[he,Se]of S)ne.push(r.getPage(he).then(Me=>{const K=new qf(`Save (editor): page ${he}`);return Me.saveNewAnnotations(h,K,Se,oe).finally(function(){m(K)})}));ae===null?Q.push(Promise.all(ne).then(async he=>(await Z_.createStructureTree({newAnnotationsByPage:S,xref:q,catalogRef:Z,pdfManager:r,newRefs:he}),he))):ae&&Q.push(Promise.all(ne).then(async he=>(await ae.updateStructureTree({newAnnotationsByPage:S,pdfManager:r,newRefs:he}),he)))}if(y)Q.push(r.serializeXfaData(B));else for(let oe=0;oe<I;oe++)Q.push(r.getPage(oe).then(function(ne){const he=new qf(`Save: page ${oe}`);return ne.save(h,he,B).finally(function(){m(he)})}));const ue=await Promise.all(Q);let ke=[],se=null;if(y){if(se=ue[0],!se)return D.bytes}else if(ke=ue.flat(2),ke.length===0)return D.bytes;const me=N&&R instanceof Te&&ke.some(oe=>oe.needAppearances),qe=R instanceof Te&&R.get("XFA")||null;let Ne=null,De=!1;if(Array.isArray(qe)){for(let oe=0,ne=qe.length;oe<ne;oe+=2)qe[oe]==="datasets"&&(Ne=qe[oe+1],De=!0);Ne===null&&(Ne=q.getNewTemporaryRef())}else qe&&Qe("Unsupported XFA type.");let X=Object.create(null);if(q.trailer){const oe=Object.create(null),ne=q.trailer.get("Info")||null;ne instanceof Te&&ne.forEach((he,Se)=>{typeof Se=="string"&&(oe[he]=Gi(Se))}),X={rootRef:Z,encryptRef:q.trailer.getRaw("Encrypt")||null,newRef:q.getNewTemporaryRef(),infoRef:q.trailer.getRaw("Info")||null,info:oe,fileIds:q.trailer.get("ID")||null,startXRef:O?H:q.lastXRefStreamPos??H,filename:E}}return YDi({originalData:D.bytes,xrefInfo:X,newRefs:ke,xref:q,hasXfa:!!qe,xfaDatasetsRef:Ne,hasXfaDatasetsEntry:De,needAppearances:me,acroFormRef:N,acroForm:R,xfaData:se,useXrefStream:z5e(q.topDict,"XRef")}).finally(()=>{q.resetNewTemporaryRef()})}),h.on("GetOperatorList",function(y,I){const B=y.pageIndex;r.getPage(B).then(function(E){const k=new qf(`GetOperatorList: page ${B}`);p(k);const Q=a>=rI.INFOS?Date.now():0;E.getOperatorList({handler:h,sink:I,task:k,intent:y.intent,cacheKey:y.cacheKey,annotationStorage:y.annotationStorage,modifiedIds:y.modifiedIds}).then(function(S){m(k),Q&&yi(`page=${B+1} - getOperatorList: time=${Date.now()-Q}ms, len=${S.length}`),I.close()},function(S){m(k),!k.terminated&&I.error(S)})})}),h.on("GetTextContent",function(y,I){const{pageIndex:B,includeMarkedContent:E,disableNormalization:k}=y;r.getPage(B).then(function(Q){const S=new qf("GetTextContent: page "+B);p(S);const D=a>=rI.INFOS?Date.now():0;Q.extractTextContent({handler:h,task:S,sink:I,includeMarkedContent:E,disableNormalization:k}).then(function(){m(S),D&&yi(`page=${B+1} - getTextContent: time=${Date.now()-D}ms`),I.close()},function(R){m(S),!S.terminated&&I.error(R)})})}),h.on("GetStructTree",function(y){return r.getPage(y.pageIndex).then(function(I){return r.ensure(I,"getStructTree")})}),h.on("FontFallback",function(y){return r.fontFallback(y.id,h)}),h.on("Cleanup",function(y){return r.cleanup(!0)}),h.on("Terminate",function(y){o=!0;const I=[];if(r){r.terminate(new ma("Worker was terminated."));const B=r.cleanup();I.push(B),r=null}else V_();s&&s(new ma("Worker was terminated."));for(const B of n)I.push(B.finished),B.terminate();return Promise.all(I).then(function(){h.destroy(),h=null})}),h.on("Ready",function(y){C(e),e=null}),u}static initializeFromPort(e){const i=new vCe("worker","main",e);gw.setup(i,e),i.send("ready",null)}}function vUi(t){return typeof t.postMessage=="function"&&"onmessage"in t}typeof window>"u"&&!Bxi&&typeof self<"u"&&vUi(self)&&gw.initializeFromPort(self),L5e.WorkerMessageHandler,wxi.workerSrc=import.meta.url+"pdfjs-dist/build/pdf.worker.mjs";const CUi=4;async function yUi(t,e=1){const i=await(await bxi(t).promise).getPage(e),r=i.getViewport({scale:CUi}),{width:o,height:s}=r,n=document.createElement("canvas");n.width=o,n.height=s;const a={canvasContext:n.getContext("2d"),background:"rgba(255, 255, 255, 1)",viewport:r};return await i.render(a).promise,n.toDataURL()}const IUi=Object.freeze(Object.defineProperty({__proto__:null,readPDFToDataURL:yUi},Symbol.toStringTag,{value:"Module"}));export{nve as default};