@bimdata/viewer 2.12.2-beta.2 → 2.12.2
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.
|
@@ -5522,7 +5522,7 @@ void main() {
|
|
|
5522
5522
|
--bimdata-local-context-width: ${r.width}px;
|
|
5523
5523
|
--bimdata-local-context-center-width: ${r.centerWidth}px;
|
|
5524
5524
|
--bimdata-local-context-resolution: ${r.resolution};
|
|
5525
|
-
`),onMouseenter:e[0]||(e[0]=(...h)=>r.onMouseEnter&&r.onMouseEnter(...h)),onMouseleave:e[1]||(e[1]=(...h)=>r.onMouseLeave&&r.onMouseLeave(...h))},[D(s,{ref:"modalManagerTemplateRef"},null,512),C("div",$Pi,[r.windowPlugins.leftSidePanel?(I(),X(a,{key:0,plugin:r.windowPlugins.leftSidePanel},null,8,["plugin"])):ve("",!0),C("div",eEi,[(I(!0),F(bt,null,qt(r.windowPlugins.free,h=>(I(),X(l,{key:h.name,class:we({"window-container__content__center__viewer":h.isViewer}),plugin:h},null,8,["class","plugin"]))),128)),D(c,{position:"left",plugins:r.windowPlugins.leftButtonColumn},null,8,["plugins"]),D(c,{position:"right",plugins:r.windowPlugins.rightButtonColumn},null,8,["plugins"])]),r.windowPlugins.rightSidePanel?(I(),X(a,{key:1,plugin:r.windowPlugins.rightSidePanel},null,8,["plugin"])):ve("",!0)]),r.loading?(I(),F("div",tEi,[r.spinner&&r.spinner.component?(I(),X(Po(r.spinner.component),mc(Ca({key:0},r.spinner.props)),null,16)):(I(),X(d,{key:1,size:"20px",border:"3px"}))])):ve("",!0),r.layoutSettingsDisplayed?(I(),F("div",iEi,[D(u)])):ve("",!0)],36)}const oEi=q(YPi,[["render",rEi],["__scopeId","data-v-3ed35f9c"]]);let nEi=class{constructor(t=!0){const e=QMi(aY,null,{resizable:t});e.registerContent("default",oEi),this.settings=ta({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?KMi(t):null}copy(t,e=!0){return WMi(this.areas.layout,t,e)}open({ratio:t,direction:e,insertAfter:i,windowName:r=null,windowState:o=null,localContextId:n=null}={}){const s=r?{options:{windowName:r,windowState:o}}:null;return n===null?this.areas.splitLayout(t,e,i,s):this.areas.split(n,t,e,i,s)}swap(t,e){return this.areas.swap(t,e)}close(t){return this.areas.delete(t)}compare(t,e){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 i=new Set(t.windowState?.modelIds),r=new Set(e.windowState?.modelIds);return i.size===r.size&&[...i].every(o=>r.has(o))}return t.windowName||e.windowName||t.direction!==e.direction||t.children.length!==e.children.length?!1:t.children.every((i,r)=>this.compare(i,e.children[r]))}};const sEi="2.12.2-beta.2",aEi={version:sEi};class lEi{constructor({plugins:e,api:i,ui:r,locale:o="fr"}){this.pluginManager=new _wi(e),this.windowManager=new Fwi,this.windowManager.registerAndAddPluginsToWindows([...this.pluginManager.registeredPlugins.values()]),this.api=new eMi(i),this.globalContext=new BIe(this),this.state=uMi(this),this.shortcutManager=yCe(this.state),this.uiSettings=r||{},this.i18n=new EIe(o),this._contextMenu=null,this.layout=new nEi(this.uiSettings.resizable!==!1),this._darkTheme=Pe(r?.darkTheme??!1),this.localContext=null,window.$viewer=this}get darkTheme(){return this._darkTheme.value}set darkTheme(e){this._darkTheme.value=e}get version(){return aEi.version}get locale(){return this.i18n.locale}get contextMenu(){return this._contextMenu||vCe}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 cEi(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 dEi=Object.freeze({25:"GUEST",50:"USER",100:"ADMIN"}),D5=Object.freeze({READ:"read",WRITE:"write"});function w9e(t){const e={};return t.forEach(i=>{const[r,o]=i.split(":");e[r]?e[r].push(o):e[r]=[o]}),e}const uEi={token_scopes:[],usable_scopes:[],user_role:25};function x9e(t=uEi){const e=w9e(t.token_scopes),i=w9e(t.usable_scopes);return{...ore(t),tokenScopes:e,usableScopes:i,userRole:dEi[t.user_role],user:t.user?ore(t.user):null,hasBcfReadPermission:i.bcf?.includes(D5.READ)??!1,hasBcfWritePermission:i.bcf?.includes(D5.WRITE)??!1,hasModelReadPermission:i.model?.includes(D5.READ)??!1,hasModelWritePermission:i.model?.includes(D5.WRITE)??!1,hasDocReadPermission:i.document?.includes(D5.READ)??!1,hasDocWritePermission:i.document?.includes(D5.WRITE)??!1}}const hEi={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"}}},pEi={BcfComponents:hEi},fEi={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"}}},gEi={BcfComponents:fEi},mEi={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"}}},AEi={BcfComponents:mEi},vEi={BcfFilters:{filtersButton:"Filtres",filtersTitle:"Filtres",priorityLabel:"Priorit\xE9",statusLabel:"Statut",stageLabel:"Phase",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"}}},bEi={BcfComponents:vEi},yEi={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"}}},wEi={BcfComponents:yEi},xEi={de:pEi,en:gEi,es:AEi,fr:bEi,it:wEi},CEi=({apiClient:t,fetchUsers:e,i18nPlugin:i}={})=>({install(r){t?lo.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(xEi).forEach(([o,n])=>{i.global.mergeLocaleMessage(o,n)}):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(ZLe).forEach(([o,n])=>{r.component(o,n)})}}),kEi={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",addPlanButton:"Grundriss",closeButton:"Fertigstellen",submitFilesButton:"Best\xE4tigen"},storeyForm:{title:"Neue Etage",input:"Name",error:"Ung\xFCltiger Name",cancelButton:"Abbrechen",submitButton:"Best\xE4tigen"}},MEi={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"},PEi={BuildingMaker:kEi,FileManager:MEi},EEi={t:{back:"Back",cancel:"Cancel",create:"Create",delete:"Delete",download:"Download",finish:"Finish",rename:"Rename",search:"Search",see:"View",storey:"Storey",validate:"Validate"}},SEi={title:"Building Maker",list:{text:"Create and edit storeys, then download your PDFs.",new:"New project"},form:{input:"Building name",error:"Invalid"},view:{addStorey:"Add Storey",addFile:"Add File",addPlan:"Add Plan"},storeyForm:{title:"New storey",input:"Name",error:"Invalid name"}},BEi={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",buttonText:"New folder",addFileButtonText:"Upload a file",deleteTitle:"Deleting Files",deleteDetail:"You are about to permanently delete the following files / folders",dmsRoot:"Root of the project's DMS",pdfPageSelectorTitle:"Select a page"},IEi={title:"Meta-Building Structure",tab:{structure:"Structure",zones:"Zones",equipments:"Equipments"},StoreySelector:{placeholder:"Select a storey"}},TEi={title:"Photosphere Building"},REi={BIMDataComponents:EEi,BuildingMaker:SEi,FileManager:BEi,MetaBuildingStructure:IEi,PhotosphereBuilding:TEi},DEi={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",addPlanButton:"Plano",closeButton:"Terminar",submitFilesButton:"Validar"},storeyForm:{title:"Nuevo piso",input:"Nombre",error:"Nombre no v\xE1lido",cancelButton:"Anular",submitButton:"Validar"}},_Ei={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"},LEi={BuildingMaker:DEi,FileManager:_Ei},FEi={t:{back:"Retour",cancel:"Annuler",create:"Cr\xE9er",delete:"Supprimer",download:"T\xE9l\xE9charger",finish:"Terminer",rename:"Renommer",search:"Rechercher",see:"Voir",storey:"\xC9tage",validate:"Valider"}},OEi={title:"Building Maker",list:{text:"Cr\xE9ez et \xE9ditez les \xE9tages puis t\xE9l\xE9chagez vos PDF.",new:"Nouveau projet"},form:{input:"Nom du b\xE2timent",error:"Nom invalide"},view:{addStorey:"Ajouter un \xC9tage",addFile:"Ajouter un fichier",addPlan:"Ajouter un plan"},storeyForm:{title:"Nouvel \xE9tage",input:"Nom",error:"Nom invalide"}},NEi={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",buttonText:"Nouveau dossier",addFileButtonText:"Charger un fichier",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",pdfPageSelectorTitle:"S\xE9lectionner une page"},UEi={title:"Structure M\xE9ta-Building",tab:{structure:"Structure",zones:"Zones",equipments:"\xC9quipements"},StoreySelector:{placeholder:"S\xE9lectionner un \xE9tage"}},jEi={title:"Photosph\xE8re Building"},HEi={BIMDataComponents:FEi,BuildingMaker:OEi,FileManager:NEi,MetaBuildingStructure:UEi,PhotosphereBuilding:jEi},VEi={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",addPlanButton:"Mappa",closeButton:"Finire",submitFilesButton:"Convalidare"},storeyForm:{title:"Nuovo piano",input:"Nome",error:"Nome non corretto",cancelButton:"Annullare",submitButton:"Convalidare"}},zEi={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"},qEi={BuildingMaker:VEi,FileManager:zEi},GEi={de:PEi,en:REi,es:LEi,fr:HEi,it:qEi},QEi=({i18nPlugin:t}={})=>({install(e){t?Object.entries(GEi).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(Gui).forEach(([i,r])=>{e.component(i,r)})}}),KEi={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}},WEi=Object.freeze(Object.defineProperty({__proto__:null,BIMDataClickAway:ru,BIMDataClickInputAway:KEi},Symbol.toStringTag,{value:"Module"})),ZEi=t=>({install(e){Object.entries(H1t).forEach(([i,r])=>{e.component(i,r)}),Object.entries(WEi).forEach(([i,r])=>e.directive(i.split("BIMData")[1],r))}}),JEi={name:"LiWrapper",render(){return gn("li",this.$slots.default())}};function XEi(t,e){var i=new Set([]);return t.forEach(r=>{e.has(r)||i.add(r)}),i}const Iu=Ys("id"),YEi=({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(qd(Cr("visible"),R0("selected"))).map(Iu)),predicate:()=>e.some(qd(Cr("visible"),R0("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(Cr("selected")).map(Iu)),predicate:()=>e.some(Cr("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(n=>n.visible&&n.type===this.selectedObject.type&&n.id!==this.selectedObject.id).map(Iu);i.selectObjects(o)},selectedObject:null,predicate(){const o=e.filter(qd(Cr("visible"),Cr("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(Cr("selected")).map(Iu)),n=new Set(e.filter(Cr("visible")).map(Iu));i.selectObjects(Array.from(XEi(n,o)),{exclusive:!0})},predicate:()=>e.some(qd(R0("selected"),Cr("visible")))&&e.some(qd(Cr("selected"),Cr("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(R0("visible")).map(Iu)),predicate:()=>e.some(R0("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(Cr("selected"));o.length>0&&i.deselectObjects(o.map(Iu)),i.hideObjects(this.objectsToHide.map(Iu))},predicate(){return this.objectsToHide=e.filter(qd(Cr("selected"),Cr("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(Cr("visible"));o.some(Cr("selected"))&&i.deselectObjects(o.filter(Cr("selected")).map(Iu)),i.hideObjects(o.map(Iu))},predicate:()=>e.some(Cr("visible"))}].filter(o=>o.predicate()),$Ei={components:{LiWrapper:JEi},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)),YEi({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}}},eSi={key:0,class:"separator"},tSi={class:"menu-text"},iSi={key:1,class:"menu-picto"},rSi={key:0,class:"context-menu__spinner"};function oSi(t,e,i,r,o,n){const s=R("BIMDataIconChevron"),a=R("LiWrapper"),l=R("BIMDataSpinner"),c=Xi("click-away");return o.displayed&&(o.currentCommands.length||o.asyncPredicateRunning)?Lt((I(),F("ul",{key:0,class:"bimdata-list context-menu",style:ke(n.position)},[(I(!0),F(bt,null,qt(o.currentCommands,(d,u)=>(I(),X(a,{key:d.label,class:"context-menu__element",onClick:h=>n.executeCommand(d)},{default:V(()=>[n.isGroupIntersection(u)?(I(),F("div",eSi)):ve("",!0),C("div",tSi,Z(d.label),1),!d.component&&d.picto?(I(),F("span",iSi,Z(d.picto),1)):d.component?(I(),X(s,{key:2,size:"xxs",class:"fill-primary"})):ve("",!0)]),_:2},1032,["onClick"]))),128)),o.asyncPredicateRunning?(I(),F("li",rSi,[D(l)])):ve("",!0)],4)),[[c,n.away]]):ve("",!0)}const nSi=q($Ei,[["render",oSi],["__scopeId","data-v-5b87d4a3"]]),sSi={name:"ViewerHeader",inject:["$viewer"],props:{visible:{type:Boolean,default:!0}},setup(){const t=Mt("$viewer"),e=ta(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:We(()=>Array.from(e.values()).filter(o=>o.position==="right").sort((o,n)=>o.order-n.order).map(o=>o.component)),headerLeftContentComponents:We(()=>Array.from(e.values()).filter(o=>o.position==="left").sort((o,n)=>o.order-n.order).map(o=>o.component)),addContent:i,removeContent:r}}},aSi={class:"viewer-header"},lSi={class:"viewer-header__content"},cSi={class:"viewer-header__content__left"},dSi={class:"viewer-header__content__right"},uSi={key:0,class:"m-l-6 flex items-center"},hSi={key:1,class:"viewer-header__version"};function pSi(t,e,i,r,o,n){const s=R("BIMDataIllustration");return Lt((I(),F("div",aSi,[C("div",lSi,[C("div",cSi,[(I(!0),F(bt,null,qt(r.headerLeftContentComponents,a=>(I(),X(Po(a),{key:a.name}))),128))]),C("div",dSi,[(I(!0),F(bt,null,qt(r.headerRightContentComponents,a=>(I(),X(Po(a),{key:a.name}))),128))])]),r.logo||r.version?(I(),F("div",uSi,[r.logo?(I(),X(s,{key:0,name:"logo",width:"30px",height:"30px"})):ve("",!0),r.version?(I(),F("div",hSi,Z(r.version),1)):ve("",!0)])):ve("",!0)],512)),[[hi,i.visible]])}const fSi=q(sSi,[["render",pSi],["__scopeId","data-v-5c9ea6b6"]]),gSi={emits:["resize"],setup(t,{emit:e}){return{onResizerMousedown:i=>{i.preventDefault();let r=i.clientX;const o=s=>{s.preventDefault();const a=s.clientX-r;r=s.clientX,e("resize",a)},n=s=>{s.preventDefault(),window.removeEventListener("mousemove",o),window.removeEventListener("mouseup",n)};window.addEventListener("mousemove",o),window.addEventListener("mouseup",n)}}}},mSi={class:"bimdata-separator"};function ASi(t,e,i,r,o,n){return I(),F("div",mSi,[e[1]||(e[1]=C("div",{class:"bimdata-separator__line"},null,-1)),C("div",{class:"bimdata-separator__resizer",onMousedown:e[0]||(e[0]=(...s)=>r.onResizerMousedown&&r.onResizerMousedown(...s))},null,32)])}const vSi=q(gSi,[["render",ASi],["__scopeId","data-v-79a3b3af"]]),bSi={components:{Separator:vSi},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=Pe(null),i=Pe(t.sidePanel.width??400),r=(o,n=1)=>{const s=i.value+o*n;i.value=Math.max(0,s)};return Et(()=>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}}},ySi={class:"bimdata-global-side-panel__component"};function wSi(t,e,i,r,o,n){const s=R("Separator");return I(),F("div",{class:"bimdata-global-side-panel",style:ke(`width: ${r.width}px`)},[i.sidePanel.resizable&&i.position==="right"?(I(),X(s,{key:0,onResize:e[0]||(e[0]=a=>r.onResize(a,-1))})):ve("",!0),C("div",ySi,[(I(),X(Po(i.sidePanel.component),{ref:"componentInstance"},null,512))]),i.sidePanel.resizable&&i.position==="left"?(I(),X(s,{key:1,onResize:e[1]||(e[1]=a=>r.onResize(a))})):ve("",!0)],4)}const xSi=q(bSi,[["render",wSi],["__scopeId","data-v-82d0d4cb"]]),CSi={name:"BimdataViewer",components:{ContextMenu:nSi,ViewerHeader:fSi,ModalManager:v9e,GlobalSidePanel:xSi},setup(){const t=Mt("$viewer"),{globalContext:e,shortcutManager:i}=t;Gr(()=>{i&&i.destroy(),e.hub.clear()}),lr(()=>{t.pluginManager.runPluginsScripts(t)});const r=We(()=>t.uiSettings.bimdataLogo!==!1&&(e.localContexts.length!==1||e.localContexts[0].window?.logoAndVersion)),o=We(()=>t.uiSettings.version!==!1&&(e.localContexts.length!==1||e.localContexts[0].window?.logoAndVersion)?t.version:null),n=We(()=>e.leftSidePanel),s=We(()=>e.rightSidePanel),a=We(()=>{const p=t.uiSettings.header!==!1,g=e.localContexts.length===1&&e.localContexts[0].window?.header===!1,f=!!(n.value||s.value);return p&&(!g||f)}),l=t.uiSettings.contextMenu!==!1,c=Pe(null);function d(p){l&&c.value.open(p)}function u(){t.shortcutManager.active=!0}function h(){t.shortcutManager.active=!1}return{Layout:t.layout.areas.component,onContextMenu:d,onMouseenter:u,onMouseleave:h,isHeaderVisible:a,viewerTemplateRef:e.templateRef,modalManagerTemplateRef:e.modalManagerTemplateRef,headerTemplateRef:e.headerTemplateRef,contextMenuTemplateRef:c,contextMenuEnabled:l,bimdataLogoOnSingleWindow:r,viewerVersionOnSingleWindow:o,version:t.version,loading:We(()=>e.loading),spinner:We(()=>e.spinner),leftSidePanel:n,rightSidePanel:s}}},kSi={key:1,class:"bimdata-context-loading-overlay",style:{"z-index":"3"}},MSi={key:2,class:"viewer__logo"},PSi={key:1,class:"version m-t-6"};function ESi(t,e,i,r,o,n){const s=R("ModalManager"),a=R("ContextMenu"),l=R("ViewerHeader"),c=R("GlobalSidePanel"),d=R("BIMDataSpinner"),u=R("BIMDataIllustration");return I(),F("div",{id:"bimdata-viewer",ref:"viewerTemplateRef",class:"bimdata-viewer bimdata-design-system bimdata-scrollbar",onContextmenu:e[0]||(e[0]=(...h)=>r.onContextMenu&&r.onContextMenu(...h)),onMouseenter:e[1]||(e[1]=(...h)=>r.onMouseenter&&r.onMouseenter(...h)),onMouseleave:e[2]||(e[2]=(...h)=>r.onMouseleave&&r.onMouseleave(...h))},[D(s,{ref:"modalManagerTemplateRef"},null,512),r.contextMenuEnabled?(I(),X(a,{key:0,ref:"contextMenuTemplateRef"},null,512)):ve("",!0),D(l,{ref:"headerTemplateRef",visible:r.isHeaderVisible},null,8,["visible"]),C("div",{class:"bimdata-viewer__content",style:ke(r.isHeaderVisible?"height: calc(100% - var(--bimdata-viewer-header-height, 40px))":"height: 100%")},[r.leftSidePanel?(I(),X(c,{key:0,"side-panel":r.leftSidePanel,position:"left"},null,8,["side-panel"])):ve("",!0),(I(),X(Po(r.Layout),{style:"height: 100%; flex-grow: 1;"})),r.rightSidePanel?(I(),X(c,{key:1,"side-panel":r.rightSidePanel,position:"right"},null,8,["side-panel"])):ve("",!0)],4),r.loading?(I(),F("div",kSi,[r.spinner&&r.spinner.component?(I(),X(Po(r.spinner.component),mc(Ca({key:0},r.spinner.props)),null,16)):(I(),X(d,{key:1,size:"40px",border:"5px"}))])):ve("",!0),!r.isHeaderVisible&&(r.bimdataLogoOnSingleWindow||r.viewerVersionOnSingleWindow)?(I(),F("div",MSi,[r.bimdataLogoOnSingleWindow?(I(),X(u,{key:0,name:"logo"})):ve("",!0),r.viewerVersionOnSingleWindow?(I(),F("div",PSi,Z(r.version),1)):ve("",!0)])):ve("",!0)],544)}const SSi=q(CSi,[["render",ESi],["__scopeId","data-v-0c1c941a"]]),BSi=["src"],ISi={class:"bimdata-models__header"},TSi={key:0,class:"bimdata-models__header__loader"},RSi={class:"bimdata-models__header__picto"},DSi={class:"bimdata-models__header__name"},_Si={key:0,class:"bimdata-models__header__name--empty"},LSi={key:1,class:"bimdata-models__header__name--empty"},FSi={key:3},OSi=["onMousemove","onClick"],NSi={__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=Mt("$viewer"),r=Pe(),o=Pe(0),n=Pe(0),s=Pe(),a=mr([]),l=Pe(!1),c=We(()=>i.localContext.loadedModels),d=We(()=>i.localContext.loadedModelIds),u=We(()=>i.localContext.loadingModelIds),h=We(()=>i.localContext.multiModel),p=We(()=>(e.customFilter?a.value.filter(e.customFilter):a.value).map(x=>c.value.find(M=>M.document?.head_id!=null&&M.document.head_id===x.document.id)??x)),g=x=>d.value.includes(x),f=x=>u.value.includes(x),A=We(()=>{const{x,y:M}=s.value?.getBoundingClientRect()??{x:0,y:0};return`top:${n.value-M}px; left:${o.value-x}px;`}),m=x=>{!h.value&&g(x.id)||u.value.length>0||(i.localContext.loadedModelIds.includes(x.id)?i.localContext.unloadModels([x.id]):i.localContext.loadModels([x.id]))},v=x=>{switch(x){case"C":return"success";case"E":return"failed";case"P":case"I":return"sandglass"}},y=(x,M)=>{x?.viewer_360_file&&(o.value=M.clientX,n.value=M.clientY),r.value=x?.viewer_360_file},b=async x=>{l.value=!0;try{return(await i.api.apiClient.modelApi.getModels(i.api.cloudId,i.api.projectId,void 0,void 0,x)).filter(M=>i.state.models.some(P=>P.archived)||!M.archived).sort(au("updated_at",!1))}catch(M){console.error("[Models] Cannot get project models. Error: ",M)}finally{l.value=!1}return[]},w=x=>x.children?.some(M=>g(M.id))??!1;return b(i.localContext.modelTypes).then(x=>{a.value=x}),(x,M)=>{const P=R("BIMDataSpinner"),E=R("BIMDataIconModel3D"),S=R("BIMDataTextbox"),B=R("BIMDataCheckbox"),T=R("BIMDataRadio"),_=R("BIMDataIcon"),U=R("BIMDataDropdownList");return I(),F("div",{ref_key:"templateRef",ref:s,class:we(["bimdata-models",{"bimdata-models--window-positioning":t.windowPositioning}])},[r.value?(I(),F("div",{key:0,class:"bimdata-models__preview",style:ke(A.value)},[C("img",{src:r.value},null,8,BSi)],4)):ve("",!0),D(U,{style:ke(`--bimdata-models-width: ${t.width};`),width:t.width,list:p.value,"element-key":"id","per-page":40,loading:l.value,class:"bimdata-models__list",disabled:p.value.length===0,onElementClick:m},{header:V(({isOpen:H})=>[C("div",ISi,[l.value||u.value.length>0?(I(),F("div",TSi,[D(P)])):(I(),F(bt,{key:1},[C("div",RSi,[D(E)]),C("div",{class:we(["bimdata-models__header__number bimdata-info-length",{"bimdata-models__header__number--empty":d.value.length===0}])},[C("span",null,Z(d.value.length),1)],2),C("div",DSi,[p.value.length===0?(I(),F("span",_Si,Z(x.$t("model.no_model")),1)):d.value.length===0?(I(),F("span",LSi,Z(x.$t("model.no_loaded_model")),1)):d.value.length===1?(I(),X(S,{key:2,text:c.value[0].name,tooltip:!H},null,8,["text","tooltip"])):d.value.length>1?(I(),F("span",FSi,Z(x.$t("model.selected_models")),1)):ve("",!0)])],64))])]),element:V(({element:H,close:N})=>[C("div",{class:"bimdata-models__model",onMousemove:z=>t.preview&&y(H,z),onMouseout:M[0]||(M[0]=z=>t.preview&&y()),onClick:()=>{!h.value&&!g(H.id)&&N()}},[h.value?(I(),X(B,{key:0,"model-value":g(H.id)||w(H),disabled:H.status!=="C"||u.value.length>0},null,8,["model-value","disabled"])):(I(),X(T,{key:1,"model-value":g(H.id)||w(H),disabled:H.status!=="C"||u.value.length>0},null,8,["model-value","disabled"])),D(_,{margin:"0 calc(var(--spacing-unit) / 2)",name:v(H.status),size:"xs",class:we({"fill-success":H.status==="C","fill-high":H.status==="E"})},null,8,["name","class"]),D(S,{class:we({"bimdata-models__model__name":!0,"bimdata-models__model__name--disabled":H.status!=="C"||u.value.length>0}),text:H.name,width:`calc(100% -
|
|
5525
|
+
`),onMouseenter:e[0]||(e[0]=(...h)=>r.onMouseEnter&&r.onMouseEnter(...h)),onMouseleave:e[1]||(e[1]=(...h)=>r.onMouseLeave&&r.onMouseLeave(...h))},[D(s,{ref:"modalManagerTemplateRef"},null,512),C("div",$Pi,[r.windowPlugins.leftSidePanel?(I(),X(a,{key:0,plugin:r.windowPlugins.leftSidePanel},null,8,["plugin"])):ve("",!0),C("div",eEi,[(I(!0),F(bt,null,qt(r.windowPlugins.free,h=>(I(),X(l,{key:h.name,class:we({"window-container__content__center__viewer":h.isViewer}),plugin:h},null,8,["class","plugin"]))),128)),D(c,{position:"left",plugins:r.windowPlugins.leftButtonColumn},null,8,["plugins"]),D(c,{position:"right",plugins:r.windowPlugins.rightButtonColumn},null,8,["plugins"])]),r.windowPlugins.rightSidePanel?(I(),X(a,{key:1,plugin:r.windowPlugins.rightSidePanel},null,8,["plugin"])):ve("",!0)]),r.loading?(I(),F("div",tEi,[r.spinner&&r.spinner.component?(I(),X(Po(r.spinner.component),mc(Ca({key:0},r.spinner.props)),null,16)):(I(),X(d,{key:1,size:"20px",border:"3px"}))])):ve("",!0),r.layoutSettingsDisplayed?(I(),F("div",iEi,[D(u)])):ve("",!0)],36)}const oEi=q(YPi,[["render",rEi],["__scopeId","data-v-3ed35f9c"]]);let nEi=class{constructor(t=!0){const e=QMi(aY,null,{resizable:t});e.registerContent("default",oEi),this.settings=ta({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?KMi(t):null}copy(t,e=!0){return WMi(this.areas.layout,t,e)}open({ratio:t,direction:e,insertAfter:i,windowName:r=null,windowState:o=null,localContextId:n=null}={}){const s=r?{options:{windowName:r,windowState:o}}:null;return n===null?this.areas.splitLayout(t,e,i,s):this.areas.split(n,t,e,i,s)}swap(t,e){return this.areas.swap(t,e)}close(t){return this.areas.delete(t)}compare(t,e){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 i=new Set(t.windowState?.modelIds),r=new Set(e.windowState?.modelIds);return i.size===r.size&&[...i].every(o=>r.has(o))}return t.windowName||e.windowName||t.direction!==e.direction||t.children.length!==e.children.length?!1:t.children.every((i,r)=>this.compare(i,e.children[r]))}};const sEi="2.12.2",aEi={version:sEi};class lEi{constructor({plugins:e,api:i,ui:r,locale:o="fr"}){this.pluginManager=new _wi(e),this.windowManager=new Fwi,this.windowManager.registerAndAddPluginsToWindows([...this.pluginManager.registeredPlugins.values()]),this.api=new eMi(i),this.globalContext=new BIe(this),this.state=uMi(this),this.shortcutManager=yCe(this.state),this.uiSettings=r||{},this.i18n=new EIe(o),this._contextMenu=null,this.layout=new nEi(this.uiSettings.resizable!==!1),this._darkTheme=Pe(r?.darkTheme??!1),this.localContext=null,window.$viewer=this}get darkTheme(){return this._darkTheme.value}set darkTheme(e){this._darkTheme.value=e}get version(){return aEi.version}get locale(){return this.i18n.locale}get contextMenu(){return this._contextMenu||vCe}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 cEi(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 dEi=Object.freeze({25:"GUEST",50:"USER",100:"ADMIN"}),D5=Object.freeze({READ:"read",WRITE:"write"});function w9e(t){const e={};return t.forEach(i=>{const[r,o]=i.split(":");e[r]?e[r].push(o):e[r]=[o]}),e}const uEi={token_scopes:[],usable_scopes:[],user_role:25};function x9e(t=uEi){const e=w9e(t.token_scopes),i=w9e(t.usable_scopes);return{...ore(t),tokenScopes:e,usableScopes:i,userRole:dEi[t.user_role],user:t.user?ore(t.user):null,hasBcfReadPermission:i.bcf?.includes(D5.READ)??!1,hasBcfWritePermission:i.bcf?.includes(D5.WRITE)??!1,hasModelReadPermission:i.model?.includes(D5.READ)??!1,hasModelWritePermission:i.model?.includes(D5.WRITE)??!1,hasDocReadPermission:i.document?.includes(D5.READ)??!1,hasDocWritePermission:i.document?.includes(D5.WRITE)??!1}}const hEi={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"}}},pEi={BcfComponents:hEi},fEi={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"}}},gEi={BcfComponents:fEi},mEi={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"}}},AEi={BcfComponents:mEi},vEi={BcfFilters:{filtersButton:"Filtres",filtersTitle:"Filtres",priorityLabel:"Priorit\xE9",statusLabel:"Statut",stageLabel:"Phase",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"}}},bEi={BcfComponents:vEi},yEi={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"}}},wEi={BcfComponents:yEi},xEi={de:pEi,en:gEi,es:AEi,fr:bEi,it:wEi},CEi=({apiClient:t,fetchUsers:e,i18nPlugin:i}={})=>({install(r){t?lo.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(xEi).forEach(([o,n])=>{i.global.mergeLocaleMessage(o,n)}):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(ZLe).forEach(([o,n])=>{r.component(o,n)})}}),kEi={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",addPlanButton:"Grundriss",closeButton:"Fertigstellen",submitFilesButton:"Best\xE4tigen"},storeyForm:{title:"Neue Etage",input:"Name",error:"Ung\xFCltiger Name",cancelButton:"Abbrechen",submitButton:"Best\xE4tigen"}},MEi={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"},PEi={BuildingMaker:kEi,FileManager:MEi},EEi={t:{back:"Back",cancel:"Cancel",create:"Create",delete:"Delete",download:"Download",finish:"Finish",rename:"Rename",search:"Search",see:"View",storey:"Storey",validate:"Validate"}},SEi={title:"Building Maker",list:{text:"Create and edit storeys, then download your PDFs.",new:"New project"},form:{input:"Building name",error:"Invalid"},view:{addStorey:"Add Storey",addFile:"Add File",addPlan:"Add Plan"},storeyForm:{title:"New storey",input:"Name",error:"Invalid name"}},BEi={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",buttonText:"New folder",addFileButtonText:"Upload a file",deleteTitle:"Deleting Files",deleteDetail:"You are about to permanently delete the following files / folders",dmsRoot:"Root of the project's DMS",pdfPageSelectorTitle:"Select a page"},IEi={title:"Meta-Building Structure",tab:{structure:"Structure",zones:"Zones",equipments:"Equipments"},StoreySelector:{placeholder:"Select a storey"}},TEi={title:"Photosphere Building"},REi={BIMDataComponents:EEi,BuildingMaker:SEi,FileManager:BEi,MetaBuildingStructure:IEi,PhotosphereBuilding:TEi},DEi={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",addPlanButton:"Plano",closeButton:"Terminar",submitFilesButton:"Validar"},storeyForm:{title:"Nuevo piso",input:"Nombre",error:"Nombre no v\xE1lido",cancelButton:"Anular",submitButton:"Validar"}},_Ei={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"},LEi={BuildingMaker:DEi,FileManager:_Ei},FEi={t:{back:"Retour",cancel:"Annuler",create:"Cr\xE9er",delete:"Supprimer",download:"T\xE9l\xE9charger",finish:"Terminer",rename:"Renommer",search:"Rechercher",see:"Voir",storey:"\xC9tage",validate:"Valider"}},OEi={title:"Building Maker",list:{text:"Cr\xE9ez et \xE9ditez les \xE9tages puis t\xE9l\xE9chagez vos PDF.",new:"Nouveau projet"},form:{input:"Nom du b\xE2timent",error:"Nom invalide"},view:{addStorey:"Ajouter un \xC9tage",addFile:"Ajouter un fichier",addPlan:"Ajouter un plan"},storeyForm:{title:"Nouvel \xE9tage",input:"Nom",error:"Nom invalide"}},NEi={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",buttonText:"Nouveau dossier",addFileButtonText:"Charger un fichier",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",pdfPageSelectorTitle:"S\xE9lectionner une page"},UEi={title:"Structure M\xE9ta-Building",tab:{structure:"Structure",zones:"Zones",equipments:"\xC9quipements"},StoreySelector:{placeholder:"S\xE9lectionner un \xE9tage"}},jEi={title:"Photosph\xE8re Building"},HEi={BIMDataComponents:FEi,BuildingMaker:OEi,FileManager:NEi,MetaBuildingStructure:UEi,PhotosphereBuilding:jEi},VEi={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",addPlanButton:"Mappa",closeButton:"Finire",submitFilesButton:"Convalidare"},storeyForm:{title:"Nuovo piano",input:"Nome",error:"Nome non corretto",cancelButton:"Annullare",submitButton:"Convalidare"}},zEi={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"},qEi={BuildingMaker:VEi,FileManager:zEi},GEi={de:PEi,en:REi,es:LEi,fr:HEi,it:qEi},QEi=({i18nPlugin:t}={})=>({install(e){t?Object.entries(GEi).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(Gui).forEach(([i,r])=>{e.component(i,r)})}}),KEi={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}},WEi=Object.freeze(Object.defineProperty({__proto__:null,BIMDataClickAway:ru,BIMDataClickInputAway:KEi},Symbol.toStringTag,{value:"Module"})),ZEi=t=>({install(e){Object.entries(H1t).forEach(([i,r])=>{e.component(i,r)}),Object.entries(WEi).forEach(([i,r])=>e.directive(i.split("BIMData")[1],r))}}),JEi={name:"LiWrapper",render(){return gn("li",this.$slots.default())}};function XEi(t,e){var i=new Set([]);return t.forEach(r=>{e.has(r)||i.add(r)}),i}const Iu=Ys("id"),YEi=({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(qd(Cr("visible"),R0("selected"))).map(Iu)),predicate:()=>e.some(qd(Cr("visible"),R0("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(Cr("selected")).map(Iu)),predicate:()=>e.some(Cr("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(n=>n.visible&&n.type===this.selectedObject.type&&n.id!==this.selectedObject.id).map(Iu);i.selectObjects(o)},selectedObject:null,predicate(){const o=e.filter(qd(Cr("visible"),Cr("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(Cr("selected")).map(Iu)),n=new Set(e.filter(Cr("visible")).map(Iu));i.selectObjects(Array.from(XEi(n,o)),{exclusive:!0})},predicate:()=>e.some(qd(R0("selected"),Cr("visible")))&&e.some(qd(Cr("selected"),Cr("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(R0("visible")).map(Iu)),predicate:()=>e.some(R0("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(Cr("selected"));o.length>0&&i.deselectObjects(o.map(Iu)),i.hideObjects(this.objectsToHide.map(Iu))},predicate(){return this.objectsToHide=e.filter(qd(Cr("selected"),Cr("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(Cr("visible"));o.some(Cr("selected"))&&i.deselectObjects(o.filter(Cr("selected")).map(Iu)),i.hideObjects(o.map(Iu))},predicate:()=>e.some(Cr("visible"))}].filter(o=>o.predicate()),$Ei={components:{LiWrapper:JEi},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)),YEi({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}}},eSi={key:0,class:"separator"},tSi={class:"menu-text"},iSi={key:1,class:"menu-picto"},rSi={key:0,class:"context-menu__spinner"};function oSi(t,e,i,r,o,n){const s=R("BIMDataIconChevron"),a=R("LiWrapper"),l=R("BIMDataSpinner"),c=Xi("click-away");return o.displayed&&(o.currentCommands.length||o.asyncPredicateRunning)?Lt((I(),F("ul",{key:0,class:"bimdata-list context-menu",style:ke(n.position)},[(I(!0),F(bt,null,qt(o.currentCommands,(d,u)=>(I(),X(a,{key:d.label,class:"context-menu__element",onClick:h=>n.executeCommand(d)},{default:V(()=>[n.isGroupIntersection(u)?(I(),F("div",eSi)):ve("",!0),C("div",tSi,Z(d.label),1),!d.component&&d.picto?(I(),F("span",iSi,Z(d.picto),1)):d.component?(I(),X(s,{key:2,size:"xxs",class:"fill-primary"})):ve("",!0)]),_:2},1032,["onClick"]))),128)),o.asyncPredicateRunning?(I(),F("li",rSi,[D(l)])):ve("",!0)],4)),[[c,n.away]]):ve("",!0)}const nSi=q($Ei,[["render",oSi],["__scopeId","data-v-5b87d4a3"]]),sSi={name:"ViewerHeader",inject:["$viewer"],props:{visible:{type:Boolean,default:!0}},setup(){const t=Mt("$viewer"),e=ta(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:We(()=>Array.from(e.values()).filter(o=>o.position==="right").sort((o,n)=>o.order-n.order).map(o=>o.component)),headerLeftContentComponents:We(()=>Array.from(e.values()).filter(o=>o.position==="left").sort((o,n)=>o.order-n.order).map(o=>o.component)),addContent:i,removeContent:r}}},aSi={class:"viewer-header"},lSi={class:"viewer-header__content"},cSi={class:"viewer-header__content__left"},dSi={class:"viewer-header__content__right"},uSi={key:0,class:"m-l-6 flex items-center"},hSi={key:1,class:"viewer-header__version"};function pSi(t,e,i,r,o,n){const s=R("BIMDataIllustration");return Lt((I(),F("div",aSi,[C("div",lSi,[C("div",cSi,[(I(!0),F(bt,null,qt(r.headerLeftContentComponents,a=>(I(),X(Po(a),{key:a.name}))),128))]),C("div",dSi,[(I(!0),F(bt,null,qt(r.headerRightContentComponents,a=>(I(),X(Po(a),{key:a.name}))),128))])]),r.logo||r.version?(I(),F("div",uSi,[r.logo?(I(),X(s,{key:0,name:"logo",width:"30px",height:"30px"})):ve("",!0),r.version?(I(),F("div",hSi,Z(r.version),1)):ve("",!0)])):ve("",!0)],512)),[[hi,i.visible]])}const fSi=q(sSi,[["render",pSi],["__scopeId","data-v-5c9ea6b6"]]),gSi={emits:["resize"],setup(t,{emit:e}){return{onResizerMousedown:i=>{i.preventDefault();let r=i.clientX;const o=s=>{s.preventDefault();const a=s.clientX-r;r=s.clientX,e("resize",a)},n=s=>{s.preventDefault(),window.removeEventListener("mousemove",o),window.removeEventListener("mouseup",n)};window.addEventListener("mousemove",o),window.addEventListener("mouseup",n)}}}},mSi={class:"bimdata-separator"};function ASi(t,e,i,r,o,n){return I(),F("div",mSi,[e[1]||(e[1]=C("div",{class:"bimdata-separator__line"},null,-1)),C("div",{class:"bimdata-separator__resizer",onMousedown:e[0]||(e[0]=(...s)=>r.onResizerMousedown&&r.onResizerMousedown(...s))},null,32)])}const vSi=q(gSi,[["render",ASi],["__scopeId","data-v-79a3b3af"]]),bSi={components:{Separator:vSi},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=Pe(null),i=Pe(t.sidePanel.width??400),r=(o,n=1)=>{const s=i.value+o*n;i.value=Math.max(0,s)};return Et(()=>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}}},ySi={class:"bimdata-global-side-panel__component"};function wSi(t,e,i,r,o,n){const s=R("Separator");return I(),F("div",{class:"bimdata-global-side-panel",style:ke(`width: ${r.width}px`)},[i.sidePanel.resizable&&i.position==="right"?(I(),X(s,{key:0,onResize:e[0]||(e[0]=a=>r.onResize(a,-1))})):ve("",!0),C("div",ySi,[(I(),X(Po(i.sidePanel.component),{ref:"componentInstance"},null,512))]),i.sidePanel.resizable&&i.position==="left"?(I(),X(s,{key:1,onResize:e[1]||(e[1]=a=>r.onResize(a))})):ve("",!0)],4)}const xSi=q(bSi,[["render",wSi],["__scopeId","data-v-82d0d4cb"]]),CSi={name:"BimdataViewer",components:{ContextMenu:nSi,ViewerHeader:fSi,ModalManager:v9e,GlobalSidePanel:xSi},setup(){const t=Mt("$viewer"),{globalContext:e,shortcutManager:i}=t;Gr(()=>{i&&i.destroy(),e.hub.clear()}),lr(()=>{t.pluginManager.runPluginsScripts(t)});const r=We(()=>t.uiSettings.bimdataLogo!==!1&&(e.localContexts.length!==1||e.localContexts[0].window?.logoAndVersion)),o=We(()=>t.uiSettings.version!==!1&&(e.localContexts.length!==1||e.localContexts[0].window?.logoAndVersion)?t.version:null),n=We(()=>e.leftSidePanel),s=We(()=>e.rightSidePanel),a=We(()=>{const p=t.uiSettings.header!==!1,g=e.localContexts.length===1&&e.localContexts[0].window?.header===!1,f=!!(n.value||s.value);return p&&(!g||f)}),l=t.uiSettings.contextMenu!==!1,c=Pe(null);function d(p){l&&c.value.open(p)}function u(){t.shortcutManager.active=!0}function h(){t.shortcutManager.active=!1}return{Layout:t.layout.areas.component,onContextMenu:d,onMouseenter:u,onMouseleave:h,isHeaderVisible:a,viewerTemplateRef:e.templateRef,modalManagerTemplateRef:e.modalManagerTemplateRef,headerTemplateRef:e.headerTemplateRef,contextMenuTemplateRef:c,contextMenuEnabled:l,bimdataLogoOnSingleWindow:r,viewerVersionOnSingleWindow:o,version:t.version,loading:We(()=>e.loading),spinner:We(()=>e.spinner),leftSidePanel:n,rightSidePanel:s}}},kSi={key:1,class:"bimdata-context-loading-overlay",style:{"z-index":"3"}},MSi={key:2,class:"viewer__logo"},PSi={key:1,class:"version m-t-6"};function ESi(t,e,i,r,o,n){const s=R("ModalManager"),a=R("ContextMenu"),l=R("ViewerHeader"),c=R("GlobalSidePanel"),d=R("BIMDataSpinner"),u=R("BIMDataIllustration");return I(),F("div",{id:"bimdata-viewer",ref:"viewerTemplateRef",class:"bimdata-viewer bimdata-design-system bimdata-scrollbar",onContextmenu:e[0]||(e[0]=(...h)=>r.onContextMenu&&r.onContextMenu(...h)),onMouseenter:e[1]||(e[1]=(...h)=>r.onMouseenter&&r.onMouseenter(...h)),onMouseleave:e[2]||(e[2]=(...h)=>r.onMouseleave&&r.onMouseleave(...h))},[D(s,{ref:"modalManagerTemplateRef"},null,512),r.contextMenuEnabled?(I(),X(a,{key:0,ref:"contextMenuTemplateRef"},null,512)):ve("",!0),D(l,{ref:"headerTemplateRef",visible:r.isHeaderVisible},null,8,["visible"]),C("div",{class:"bimdata-viewer__content",style:ke(r.isHeaderVisible?"height: calc(100% - var(--bimdata-viewer-header-height, 40px))":"height: 100%")},[r.leftSidePanel?(I(),X(c,{key:0,"side-panel":r.leftSidePanel,position:"left"},null,8,["side-panel"])):ve("",!0),(I(),X(Po(r.Layout),{style:"height: 100%; flex-grow: 1;"})),r.rightSidePanel?(I(),X(c,{key:1,"side-panel":r.rightSidePanel,position:"right"},null,8,["side-panel"])):ve("",!0)],4),r.loading?(I(),F("div",kSi,[r.spinner&&r.spinner.component?(I(),X(Po(r.spinner.component),mc(Ca({key:0},r.spinner.props)),null,16)):(I(),X(d,{key:1,size:"40px",border:"5px"}))])):ve("",!0),!r.isHeaderVisible&&(r.bimdataLogoOnSingleWindow||r.viewerVersionOnSingleWindow)?(I(),F("div",MSi,[r.bimdataLogoOnSingleWindow?(I(),X(u,{key:0,name:"logo"})):ve("",!0),r.viewerVersionOnSingleWindow?(I(),F("div",PSi,Z(r.version),1)):ve("",!0)])):ve("",!0)],544)}const SSi=q(CSi,[["render",ESi],["__scopeId","data-v-0c1c941a"]]),BSi=["src"],ISi={class:"bimdata-models__header"},TSi={key:0,class:"bimdata-models__header__loader"},RSi={class:"bimdata-models__header__picto"},DSi={class:"bimdata-models__header__name"},_Si={key:0,class:"bimdata-models__header__name--empty"},LSi={key:1,class:"bimdata-models__header__name--empty"},FSi={key:3},OSi=["onMousemove","onClick"],NSi={__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=Mt("$viewer"),r=Pe(),o=Pe(0),n=Pe(0),s=Pe(),a=mr([]),l=Pe(!1),c=We(()=>i.localContext.loadedModels),d=We(()=>i.localContext.loadedModelIds),u=We(()=>i.localContext.loadingModelIds),h=We(()=>i.localContext.multiModel),p=We(()=>(e.customFilter?a.value.filter(e.customFilter):a.value).map(x=>c.value.find(M=>M.document?.head_id!=null&&M.document.head_id===x.document.id)??x)),g=x=>d.value.includes(x),f=x=>u.value.includes(x),A=We(()=>{const{x,y:M}=s.value?.getBoundingClientRect()??{x:0,y:0};return`top:${n.value-M}px; left:${o.value-x}px;`}),m=x=>{!h.value&&g(x.id)||u.value.length>0||(i.localContext.loadedModelIds.includes(x.id)?i.localContext.unloadModels([x.id]):i.localContext.loadModels([x.id]))},v=x=>{switch(x){case"C":return"success";case"E":return"failed";case"P":case"I":return"sandglass"}},y=(x,M)=>{x?.viewer_360_file&&(o.value=M.clientX,n.value=M.clientY),r.value=x?.viewer_360_file},b=async x=>{l.value=!0;try{return(await i.api.apiClient.modelApi.getModels(i.api.cloudId,i.api.projectId,void 0,void 0,x)).filter(M=>i.state.models.some(P=>P.archived)||!M.archived).sort(au("updated_at",!1))}catch(M){console.error("[Models] Cannot get project models. Error: ",M)}finally{l.value=!1}return[]},w=x=>x.children?.some(M=>g(M.id))??!1;return b(i.localContext.modelTypes).then(x=>{a.value=x}),(x,M)=>{const P=R("BIMDataSpinner"),E=R("BIMDataIconModel3D"),S=R("BIMDataTextbox"),B=R("BIMDataCheckbox"),T=R("BIMDataRadio"),_=R("BIMDataIcon"),U=R("BIMDataDropdownList");return I(),F("div",{ref_key:"templateRef",ref:s,class:we(["bimdata-models",{"bimdata-models--window-positioning":t.windowPositioning}])},[r.value?(I(),F("div",{key:0,class:"bimdata-models__preview",style:ke(A.value)},[C("img",{src:r.value},null,8,BSi)],4)):ve("",!0),D(U,{style:ke(`--bimdata-models-width: ${t.width};`),width:t.width,list:p.value,"element-key":"id","per-page":40,loading:l.value,class:"bimdata-models__list",disabled:p.value.length===0,onElementClick:m},{header:V(({isOpen:H})=>[C("div",ISi,[l.value||u.value.length>0?(I(),F("div",TSi,[D(P)])):(I(),F(bt,{key:1},[C("div",RSi,[D(E)]),C("div",{class:we(["bimdata-models__header__number bimdata-info-length",{"bimdata-models__header__number--empty":d.value.length===0}])},[C("span",null,Z(d.value.length),1)],2),C("div",DSi,[p.value.length===0?(I(),F("span",_Si,Z(x.$t("model.no_model")),1)):d.value.length===0?(I(),F("span",LSi,Z(x.$t("model.no_loaded_model")),1)):d.value.length===1?(I(),X(S,{key:2,text:c.value[0].name,tooltip:!H},null,8,["text","tooltip"])):d.value.length>1?(I(),F("span",FSi,Z(x.$t("model.selected_models")),1)):ve("",!0)])],64))])]),element:V(({element:H,close:N})=>[C("div",{class:"bimdata-models__model",onMousemove:z=>t.preview&&y(H,z),onMouseout:M[0]||(M[0]=z=>t.preview&&y()),onClick:()=>{!h.value&&!g(H.id)&&N()}},[h.value?(I(),X(B,{key:0,"model-value":g(H.id)||w(H),disabled:H.status!=="C"||u.value.length>0},null,8,["model-value","disabled"])):(I(),X(T,{key:1,"model-value":g(H.id)||w(H),disabled:H.status!=="C"||u.value.length>0},null,8,["model-value","disabled"])),D(_,{margin:"0 calc(var(--spacing-unit) / 2)",name:v(H.status),size:"xs",class:we({"fill-success":H.status==="C","fill-high":H.status==="E"})},null,8,["name","class"]),D(S,{class:we({"bimdata-models__model__name":!0,"bimdata-models__model__name--disabled":H.status!=="C"||u.value.length>0}),text:H.name,width:`calc(100% -
|
|
5526
5526
|
${h.value?13:23}px - 2 * 6px - 16px)`},null,8,["class","text","width"]),H.document&&!H.document.is_head_version?(I(),X(_,{key:2,name:"versioning",fill:"",color:"default",size:"xs",margin:"0 0 0 6px"})):ve("",!0)],40,OSi),f(H.id)?(I(),X(P,{key:0,class:"bimdata-models__model__spinner"})):ve("",!0)]),_:1},8,["style","width","list","loading","disabled"])],2)}}},C9e=q(NSi,[["__scopeId","data-v-34c2cf79"]]),USi="data:image/svg+xml,%3csvg%20width='16'%20height='21'%20viewBox='0%200%2016%2021'%20fill='none'%20xmlns='http://www.w3.org/2000/svg'%3e%3cpath%20fill-rule='evenodd'%20clip-rule='evenodd'%20d='M7.47193%202.76644C7.65699%202.84439%207.77716%203.02565%207.777%203.22661L7.77339%207.94624C7.77318%208.22238%207.54916%208.44655%207.27301%208.44693L2.4192%208.45366C2.21569%208.45394%202.03258%208.33085%201.95617%208.1424C1.87975%207.95394%201.92528%207.73773%202.07129%207.59566L6.92872%202.86931C7.0729%202.72902%207.28688%202.6885%207.47193%202.76644ZM3.65141%207.45195L6.77378%207.44762L6.7761%204.41157L3.65141%207.45195ZM5.81657%200.893911L6.02338%200.893274L13.3879%200.870595C14.679%200.866619%2015.7208%201.91642%2015.722%203.20083L15.2221%203.20237L15.722%203.20052L15.722%203.20083L15.745%2017.8999L15.745%2017.9002C15.7462%2019.1846%2014.7063%2020.2408%2013.4153%2020.2448L2.35929%2020.2788C1.07114%2020.2828%200.0171799%2019.2362%200.0159721%2017.9486L0.00563138%206.92409L0.00543684%206.71668L0.152103%206.56972L5.67032%201.04045L5.81657%200.893911ZM6.23113%201.89264L1.00582%207.12841L1.01597%2017.9455C1.01666%2018.6791%201.62068%2019.2811%202.35835%2019.2788L13.4143%2019.2448C14.1484%2019.2425%2014.7456%2018.6402%2014.745%2017.9035C14.745%2017.9034%2014.745%2017.9033%2014.745%2017.9033L14.722%203.20423L14.722%203.20391C14.7213%202.46716%2014.123%201.86833%2013.3888%201.87059L6.23113%201.89264Z'%20fill='%232F374A'/%3e%3c/svg%3e",jSi=["src"],HSi={key:0,class:"bimdata-multi-model-loader__header-container"},VSi={key:0,class:"bimdata-multi-model-loader__header__loader"},zSi={class:"bimdata-multi-model-loader__header__picto"},qSi=["src"],GSi={class:"bimdata-multi-model-loader__header__name"},QSi={key:0,class:"bimdata-multi-model-loader__header__name--empty"},KSi={key:1,class:"bimdata-multi-model-loader__header__name--empty"},WSi={key:3},ZSi={key:1,class:"bimdata-multi-model-loader__main"},JSi=["onMousemove","onClick"],XSi={__name:"BIMDataMultiModelLoader",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=Mt("$viewer"),r=Pe(),o=Pe(0),n=Pe(0),s=Pe(),a=mr([]),l=Pe(!1),c=Pe(!0),d=T=>{T.key==="Escape"?c.value=!0:T.key==="Enter"&&P()};Et(c,T=>{T?(window.removeEventListener("keydown",d),y.clear(),v.clear(),r.value=null):window.addEventListener("keydown",d)});const u=We(()=>i.localContext.loadedModels),h=We(()=>i.localContext.loadedModelIds),p=We(()=>i.localContext.loadingModelIds),g=We(()=>i.localContext.multiModel),f=We(()=>(e.customFilter?a.value.filter(e.customFilter):a.value).map(T=>u.value.find(_=>_.document?.head_id!=null&&_.document.head_id===T.document.id)??T)),A=T=>h.value.includes(T),m=T=>p.value.includes(T),v=ta(new Set),y=ta(new Set),b=T=>T.children?.some(_=>A(_.id))??!1,w=T=>(A(T.id)||b(T)||v.has(T))&&!y.has(T),x=We(()=>{const{x:T,y:_}=s.value.getBoundingClientRect();return`top:${n.value-_}px; left:${o.value-T}px;`}),M=T=>{T.status==="C"&&(!g.value&&A(T.id)||(A(T.id)?y.has(T)?y.delete(T):y.add(T):v.has(T)?v.delete(T):v.add(T)))},P=()=>{v.size>0&&i.localContext.loadModels(Array.from(v).map(T=>T.id)),y.size>0&&i.localContext.unloadModels(Array.from(y).map(T=>T.id)),c.value=!0},E=T=>{switch(T){case"C":return"success";case"E":return"failed";case"P":case"I":return"sandglass"}},S=T=>T.document&&!T.document.is_head_version,B=(T,_)=>{!e.preview||c.value||(T?.viewer_360_file&&(o.value=_.clientX,n.value=_.clientY),r.value=T?.viewer_360_file)};return(async T=>{l.value=!0;try{return(await i.api.apiClient.modelApi.getModels(i.api.cloudId,i.api.projectId,void 0,void 0,T)).filter(_=>i.state.models.some(U=>U.archived)||!_.archived).sort(au("updated_at",!1))}catch(_){console.error("[Models] Cannot get project models. Error: ",_)}finally{l.value=!1}return[]})(i.localContext.modelTypes).then(T=>{a.value=T}),(T,_)=>{const U=R("BIMDataSpinner"),H=R("BIMDataTextbox"),N=R("BIMDataIconChevron"),z=R("BIMDataButton"),G=R("BIMDataIconFileIfcPolychrome"),$=R("BIMDataCheckbox"),ae=R("BIMDataRadio"),le=R("BIMDataIcon"),me=R("BIMDataPaginatedList"),Ee=Xi("click-away");return I(),F("div",{ref_key:"templateRef",ref:s,class:we(["bimdata-multi-model-loader",{"bimdata-multi-model-loader--window-positioning":t.windowPositioning}])},[r.value?(I(),F("div",{key:0,class:"bimdata-multi-model-loader__preview",style:ke(x.value)},[C("img",{src:r.value},null,8,jSi)],4)):ve("",!0),D(tr,{name:"fade",mode:"out-in"},{default:V(()=>[c.value?(I(),F("div",HSi,[Pt(T.$slots,"left",{},void 0,!0),C("div",{class:"bimdata-multi-model-loader__header",onClick:_[0]||(_[0]=ie=>c.value=!1)},[l.value||p.value.length>0?(I(),F("div",VSi,[D(U)])):(I(),F(bt,{key:1},[C("div",zSi,[C("img",{src:kt(USi),alt:"file icon"},null,8,qSi)]),C("div",{class:we(["bimdata-multi-model-loader__header__number bimdata-info-length",{"bimdata-multi-model-loader__header__number--empty":h.value.length===0}])},[C("span",null,Z(h.value.length),1)],2),C("div",GSi,[f.value.length===0?(I(),F("span",QSi,Z(T.$t("model.no_model")),1)):h.value.length===0?(I(),F("span",KSi,Z(T.$t("model.no_loaded_model")),1)):h.value.length===1?(I(),X(H,{key:2,text:u.value[0].name,tooltip:c.value,width:"233px"},null,8,["text","tooltip"])):h.value.length>1?(I(),F("span",WSi,Z(T.$t("model.selected_models")),1)):ve("",!0)]),D(z,{color:"default",icon:"",radius:"",fill:"",width:"21px",height:"21px"},{default:V(()=>[D(N,{size:"xxxs"})]),_:1})],64))]),Pt(T.$slots,"right",{},void 0,!0)])):Lt((I(),F("div",ZSi,[D(me,{list:f.value,"per-page":10},{element:V(({element:ie})=>[C("div",{class:we(["bimdata-multi-model-loader__main__model",{"bimdata-multi-model-loader__main__model--disabled":ie.status!=="C"}]),onMousemove:se=>B(ie,se),onMouseout:_[1]||(_[1]=se=>B()),onClick:se=>M(ie)},[D(G,{fill:"",color:"default",size:"xs"}),g.value?(I(),X($,{key:0,"model-value":w(ie),disabled:ie.status!=="C"},null,8,["model-value","disabled"])):(I(),X(ae,{key:1,"model-value":w(ie),disabled:ie.status!=="C"},null,8,["model-value","disabled"])),D(H,{class:we({"bimdata-multi-model-loader__main__model__name":!0,"bimdata-multi-model-loader__main__model__name--disabled":ie.status!=="C"}),text:ie.name,width:S(ie)?"333px":"363px"},null,8,["class","text","width"]),S(ie)?(I(),X(le,{key:2,name:"versioning",fill:"",color:"default",size:"xs",margin:"0 0 0 6px"})):ve("",!0),m(ie.id)?(I(),X(U,{key:3,class:"bimdata-multi-model-loader__main__model__spinner"})):(I(),X(le,{key:4,name:E(ie.status),size:"xs",class:we({"fill-success":ie.status==="C","fill-high":ie.status==="E"})},null,8,["name","class"]))],42,JSi)]),_:1},8,["list"]),D(z,{class:"bimdata-multi-model-loader__main__validate",width:"93px",color:"primary",fill:"",radius:"",disabled:kt(v).size===0&&kt(y).size===0,onClick:P},{default:V(()=>[ct(Z(T.$t("global.validate")),1)]),_:1},8,["disabled"])])),[[Ee,()=>c.value=!0]])]),_:3})],2)}}},YSi=q(XSi,[["__scopeId","data-v-44e6af66"]]),$Si={data(){return{shown:!1}},mounted(){setTimeout(()=>{this.shown=!0},500)}};function eBi(t,e,i,r,o,n){const s=R("BIMDataIllustration");return I(),F("div",{class:"bimdata__no-model",style:ke({"--no-model--opacity":o.shown?1:0})},[D(s,{name:"emptyViewer",x:"90",y:"90"}),C("span",null,Z(t.$t("model.select_model")),1)],4)}const k9e=q($Si,[["render",eBi],["__scopeId","data-v-5ffd9bc0"]]);window.BIMDataViewerVue=aY;class tBi{constructor(e={}){const{api:i={},ui:r}=e;this.uiCfg=r,i.apiUrl||(console.info("[BIMData Viewer] INFO - Viewer config - `apiUrl` not set, use 'https://api.bimdata.io' by default."),i.apiUrl="https://api.bimdata.io"),i.archiveUrl||(console.info("[BIMData Viewer] INFO - Viewer config - `archiveUrl` not set, use 'https://archive.bimdata.io' by default."),i.archiveUrl="https://archive.bimdata.io"),i.pdfBackendUrl||(console.info("[BIMData Viewer] INFO - Viewer config - `pdfBackendUrl` not set, use 'https://pdf-backend.bimdata.io' by default."),i.pdfBackendUrl="https://pdf-backend.bimdata.io"),i.ifcIds&&(console.warn("[BIMData Viewer] DEPRECATED - Viewer config - please use the `modelIds` property instead of `ifcIds`."),i.modelIds===void 0&&(i.modelIds=i.ifcIds)),i.modelIds||(i.modelIds=[]),i.offline?.dataFile&&(i.offline.data=i.offline.dataFile),this.$viewer=new lEi(e),i.offline?.enabled?this.$viewer.api.enableOfflineMode(i.offline.data,i.offline.options).then(()=>this.state.loadModels(i.modelIds)):(this.$viewer.globalContext.loadingProcessStart(),this.state.loadModels(i.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"){const{$viewer:r}=this;await r.api.ready;try{const d=await r.api.apiClient.collaborationApi.checkProjectAccess(r.api.cloudId,r.api.projectId);r.api.permissions=x9e(d)}catch{r.api.permissions=x9e()}const o=this.api.accessToken,{i18n:n}=r;n.registerTranslations(r.pluginManager.pluginTranslations),r.layout.apply(i);const s={i18n:n.i18nVuePlugin,data(){return{accessToken:o}},render(){return gn(SSi,{style:"height: 100%"})}},a=i8(s).use(n.i18nVuePlugin).use(ZEi()).use(QEi({i18nPlugin:n.i18nVuePlugin})).use(CEi({apiClient:r.api.apiClient,i18nPlugin:n.i18nVuePlugin}));a.provide("$viewer",r),a.provide("BIMDATA_DESIGN_SYSTEM_DARK_THEME",We(()=>r.darkTheme)),a.component("BIMDataModelLoader",C9e),a.component("BIMDataMultiModelLoader",YSi),a.component("BIMDataNoModelWindowPlaceHolder",k9e),a.component("BIMDataStoreySelector",lF),a.component("ModelsLoader",C9e),a.component("NoModelWindowPlaceHolder",k9e);const l=e instanceof HTMLElement?e:document.querySelector(e);l&&(l.style.height="100%");const c=a.mount(e);return c.$viewer=r,cEi(c.$el,this.uiCfg?.style),typeof window<"u"&&(window.bimdataViewer=c),this.vueApp=a,c}destroy(){this.vueApp?.unmount()}setLocale(e){if(!CY.includes(e))throw new Error(`Viewer available locales are ${CY.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 M9e=(t={})=>new tBi(t);window.makeBIMDataViewer=M9e;const Ua=typeof process=="object"&&process+""=="[object process]"&&!process.versions.nw&&!(process.versions.electron&&process.type&&process.type!=="browser"),$z=[.001,0,0,.001,0,0],eq=1.35,nc={ANY:1,DISPLAY:2,PRINT:4,ANNOTATIONS_FORMS:16,ANNOTATIONS_STORAGE:32,ANNOTATIONS_DISABLE:64,IS_EDITING:128,OPLIST:256},i0={DISABLE:0,ENABLE:1,ENABLE_FORMS:2,ENABLE_STORAGE:3},P9e="pdfjs_internal_editor_",Qi={DISABLE:-1,NONE:0,FREETEXT:3,HIGHLIGHT:9,STAMP:13,INK:15,SIGNATURE:101,COMMENT:102},Mr={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_THICKNESS:32,HIGHLIGHT_FREE:33,HIGHLIGHT_SHOW_ALL:34,DRAW_STEP:41},iBi={PRINT:4,MODIFY_CONTENTS:8,COPY:16,MODIFY_ANNOTATIONS:32,FILL_INTERACTIVE_FORMS:256,COPY_FOR_ACCESSIBILITY:512,ASSEMBLE:1024,PRINT_HIGH_QUALITY:2048},fa={FILL:0,STROKE:1,FILL_STROKE:2,INVISIBLE:3,FILL_STROKE_MASK:3,ADD_TO_PATH_FLAG:4},XE={GRAYSCALE_1BPP:1,RGB_24BPP:2,RGBA_32BPP:3},Dn={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},_5={SOLID:1,DASHED:2,BEVELED:3,INSET:4,UNDERLINE:5},YE={ERRORS:0,WARNINGS:1,INFOS:5},$E={dependency:1,setLineWidth:2,setLineCap:3,setLineJoin:4,setMiterLimit:5,setDash:6,setRenderingIntent:7,setFlatness:8,setGState:9,save:10,restore:11,transform:12,moveTo:13,lineTo:14,curveTo:15,curveTo2:16,curveTo3:17,closePath:18,rectangle:19,stroke:20,closeStroke:21,fill:22,eoFill:23,fillStroke:24,eoFillStroke:25,closeFillStroke:26,closeEOFillStroke:27,endPath:28,clip:29,eoClip:30,beginText:31,endText:32,setCharSpacing:33,setWordSpacing:34,setHScale:35,setLeading:36,setFont:37,setTextRenderingMode:38,setTextRise:39,moveText:40,setLeadingMoveText:41,setTextMatrix:42,nextLine:43,showText:44,showSpacedText:45,nextLineShowText:46,nextLineSetSpacingShowText:47,setCharWidth:48,setCharWidthAndBounds:49,setStrokeColorSpace:50,setFillColorSpace:51,setStrokeColor:52,setStrokeColorN:53,setFillColor:54,setFillColorN:55,setStrokeGray:56,setFillGray:57,setStrokeRGBColor:58,setFillRGBColor:59,setStrokeCMYKColor:60,setFillCMYKColor:61,shadingFill:62,beginInlineImage:63,beginImageData:64,endInlineImage:65,paintXObject:66,markPoint:67,markPointProps:68,beginMarkedContent:69,beginMarkedContentProps:70,endMarkedContent:71,beginCompat:72,endCompat:73,paintFormXObjectBegin:74,paintFormXObjectEnd:75,beginGroup:76,endGroup:77,beginAnnotation:80,endAnnotation:81,paintImageMaskXObject:83,paintImageMaskXObjectGroup:84,paintImageXObject:85,paintInlineImageXObject:86,paintInlineImageXObjectGroup:87,paintImageXObjectRepeat:88,paintImageMaskXObjectRepeat:89,paintSolidColorImageMask:90,constructPath:91,setStrokeTransparent:92,setFillTransparent:93,rawFillPath:94},eS={moveTo:0,lineTo:1,curveTo:2,closePath:3},rBi={NEED_PASSWORD:1,INCORRECT_PASSWORD:2};let tS=YE.WARNINGS;function oBi(t){Number.isInteger(t)&&(tS=t)}function nBi(){return tS}function iS(t){tS>=YE.INFOS&&console.log(`Info: ${t}`)}function Ki(t){tS>=YE.WARNINGS&&console.log(`Warning: ${t}`)}function mo(t){throw new Error(t)}function _n(t,e){t||mo(e)}function sBi(t){switch(t?.protocol){case"http:":case"https:":case"ftp:":case"mailto:":case"tel:":return!0;default:return!1}}function E9e(t,e=null,i=null){if(!t)return null;if(i&&typeof t=="string"&&(i.addDefaultProtocol&&t.startsWith("www.")&&t.match(/\./g)?.length>=2&&(t=`http://${t}`),i.tryConvertEncoding))try{t=uBi(t)}catch{}const r=e?URL.parse(t,e):URL.parse(t);return sBi(r)?r:null}function S9e(t,e,i=!1){const r=URL.parse(t);return r?(r.hash=e,r.href):i&&E9e(t,"http://example.com")?t.split("#",1)[0]+`${e?`#${e}`:""}`:""}function cr(t,e,i,r=!1){return Object.defineProperty(t,e,{value:i,enumerable:!r,configurable:!0,writable:!1}),i}const o2=(function(){function t(e,i){this.message=e,this.name=i}return t.prototype=new Error,t.constructor=t,t})();let B9e=class extends o2{constructor(t,e){super(t,"PasswordException"),this.code=e}},tq=class extends o2{constructor(t,e){super(t,"UnknownErrorException"),this.details=e}},iq=class extends o2{constructor(t){super(t,"InvalidPDFException")}},rS=class extends o2{constructor(t,e,i){super(t,"ResponseException"),this.status=e,this.missing=i}},aBi=class extends o2{constructor(t){super(t,"FormatError")}},r0=class extends o2{constructor(t){super(t,"AbortException")}};function I9e(t){(typeof t!="object"||t?.length===void 0)&&mo("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 n=Math.min(o+i,e),s=t.subarray(o,n);r.push(String.fromCharCode.apply(null,s))}return r.join("")}function sb(t){typeof t!="string"&&mo("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 lBi(t){return String.fromCharCode(t>>24&255,t>>16&255,t>>8&255,t&255)}function cBi(){const t=new Uint8Array(4);return t[0]=1,new Uint32Array(t.buffer,0,1)[0]===1}function dBi(){try{return new Function(""),!0}catch{return!1}}class Us{static get isLittleEndian(){return cr(this,"isLittleEndian",cBi())}static get isEvalSupported(){return cr(this,"isEvalSupported",dBi())}static get isOffscreenCanvasSupported(){return cr(this,"isOffscreenCanvasSupported",typeof OffscreenCanvas<"u")}static get isImageDecoderSupported(){return cr(this,"isImageDecoderSupported",typeof ImageDecoder<"u")}static get platform(){const{platform:e,userAgent:i}=navigator;return cr(this,"platform",{isAndroid:i.includes("Android"),isLinux:e.includes("Linux"),isMac:e.includes("Mac"),isWindows:e.includes("Win"),isFirefox:i.includes("Firefox")})}static get isCSSRoundSupported(){return cr(this,"isCSSRoundSupported",globalThis.CSS?.supports?.("width: round(1.5px, 1px)"))}}const rq=Array.from(Array(256).keys(),t=>t.toString(16).padStart(2,"0"));let bi=class{static makeHexColor(t,e,i){return`#${rq[t]}${rq[e]}${rq[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,i=0){const r=t[i],o=t[i+1];t[i]=r*e[0]+o*e[2]+e[4],t[i+1]=r*e[1]+o*e[3]+e[5]}static applyTransformToBezier(t,e,i=0){const r=e[0],o=e[1],n=e[2],s=e[3],a=e[4],l=e[5];for(let c=0;c<6;c+=2){const d=t[i+c],u=t[i+c+1];t[i+c]=d*r+u*n+a,t[i+c+1]=d*o+u*s+l}}static applyInverseTransform(t,e){const i=t[0],r=t[1],o=e[0]*e[3]-e[1]*e[2];t[0]=(i*e[3]-r*e[2]+e[2]*e[5]-e[4]*e[3])/o,t[1]=(-i*e[1]+r*e[0]+e[4]*e[1]-e[5]*e[0])/o}static axialAlignedBoundingBox(t,e,i){const r=e[0],o=e[1],n=e[2],s=e[3],a=e[4],l=e[5],c=t[0],d=t[1],u=t[2],h=t[3];let p=r*c+a,g=p,f=r*u+a,A=f,m=s*d+l,v=m,y=s*h+l,b=y;if(o!==0||n!==0){const w=o*c,x=o*u,M=n*d,P=n*h;p+=M,A+=M,f+=P,g+=P,m+=w,b+=w,y+=x,v+=x}i[0]=Math.min(i[0],p,f,g,A),i[1]=Math.min(i[1],m,y,v,b),i[2]=Math.max(i[2],p,f,g,A),i[3]=Math.max(i[3],m,y,v,b)}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,e){const i=t[0],r=t[1],o=t[2],n=t[3],s=i**2+r**2,a=i*o+r*n,l=o**2+n**2,c=(s+l)/2,d=Math.sqrt(c**2-(s*l-a**2));e[0]=Math.sqrt(c+d||1),e[1]=Math.sqrt(c-d||1)}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])),n=Math.min(Math.max(t[1],t[3]),Math.max(e[1],e[3]));return o>n?null:[i,o,r,n]}static pointBoundingBox(t,e,i){i[0]=Math.min(i[0],t),i[1]=Math.min(i[1],e),i[2]=Math.max(i[2],t),i[3]=Math.max(i[3],e)}static rectBoundingBox(t,e,i,r,o){o[0]=Math.min(o[0],t,i),o[1]=Math.min(o[1],e,r),o[2]=Math.max(o[2],t,i),o[3]=Math.max(o[3],e,r)}static#e(t,e,i,r,o,n,s,a,l,c){if(l<=0||l>=1)return;const d=1-l,u=l*l,h=u*l,p=d*(d*(d*t+3*l*e)+3*u*i)+h*r,g=d*(d*(d*o+3*l*n)+3*u*s)+h*a;c[0]=Math.min(c[0],p),c[1]=Math.min(c[1],g),c[2]=Math.max(c[2],p),c[3]=Math.max(c[3],g)}static#t(t,e,i,r,o,n,s,a,l,c,d,u){if(Math.abs(l)<1e-12){Math.abs(c)>=1e-12&&this.#e(t,e,i,r,o,n,s,a,-d/c,u);return}const h=c**2-4*d*l;if(h<0)return;const p=Math.sqrt(h),g=2*l;this.#e(t,e,i,r,o,n,s,a,(-c+p)/g,u),this.#e(t,e,i,r,o,n,s,a,(-c-p)/g,u)}static bezierBoundingBox(t,e,i,r,o,n,s,a,l){l[0]=Math.min(l[0],t,s),l[1]=Math.min(l[1],e,a),l[2]=Math.max(l[2],t,s),l[3]=Math.max(l[3],e,a),this.#t(t,i,o,s,e,r,n,a,3*(-t+3*(i-o)+s),6*(t-2*i+o),3*(i-t),l),this.#t(t,i,o,s,e,r,n,a,3*(-e+3*(r-n)+a),6*(e-2*r+n),3*(r-e),l)}};function uBi(t){return decodeURIComponent(escape(t))}let oq=null,T9e=null;function hBi(t){return oq||(oq=/([\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,T9e=new Map([["\uFB05","\u017Ft"]])),t.replaceAll(oq,(e,i,r)=>i?i.normalize("NFKC"):T9e.get(r))}function R9e(){if(typeof crypto.randomUUID=="function")return crypto.randomUUID();const t=new Uint8Array(32);return crypto.getRandomValues(t),I9e(t)}const nq="pdfjs_internal_id_";function pBi(t,e,i){if(!Array.isArray(i)||i.length<2)return!1;const[r,o,...n]=i;if(!t(r)&&!Number.isInteger(r)||!e(o))return!1;const s=n.length;let a=!0;switch(o.name){case"XYZ":if(s<2||s>3)return!1;break;case"Fit":case"FitB":return s===0;case"FitH":case"FitBH":case"FitV":case"FitBV":if(s>1)return!1;break;case"FitR":if(s!==4)return!1;a=!1;break;default:return!1}for(const l of n)if(!(typeof l=="number"||a&&l===null))return!1;return!0}function ja(t,e,i){return Math.min(Math.max(t,e),i)}function D9e(t){return Uint8Array.prototype.toBase64?t.toBase64():btoa(I9e(t))}function fBi(t){return Uint8Array.fromBase64?Uint8Array.fromBase64(t):sb(atob(t))}typeof Promise.try!="function"&&(Promise.try=function(t,...e){return new Promise(i=>{i(t(...e))})}),typeof Math.sumPrecise!="function"&&(Math.sumPrecise=function(t){return t.reduce((e,i)=>e+i,0)});const c1="http://www.w3.org/2000/svg";class L5{static CSS=96;static PDF=72;static PDF_TO_CSS_UNITS=this.CSS/this.PDF}async function ab(t,e="text"){if(lb(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 ky{constructor({viewBox:e,userUnit:i,scale:r,rotation:o,offsetX:n=0,offsetY:s=0,dontFlip:a=!1}){this.viewBox=e,this.userUnit=i,this.scale=r,this.rotation=o,this.offsetX=n,this.offsetY=s,r*=i;const l=(e[2]+e[0])/2,c=(e[3]+e[1])/2;let d,u,h,p;switch(o%=360,o<0&&(o+=360),o){case 180:d=-1,u=0,h=0,p=1;break;case 90:d=0,u=1,h=1,p=0;break;case 270:d=0,u=-1,h=-1,p=0;break;case 0:d=1,u=0,h=0,p=-1;break;default:throw new Error("PageViewport: Invalid rotation, must be a multiple of 90 degrees.")}a&&(h=-h,p=-p);let g,f,A,m;d===0?(g=Math.abs(c-e[1])*r+n,f=Math.abs(l-e[0])*r+s,A=(e[3]-e[1])*r,m=(e[2]-e[0])*r):(g=Math.abs(l-e[0])*r+n,f=Math.abs(c-e[1])*r+s,A=(e[2]-e[0])*r,m=(e[3]-e[1])*r),this.transform=[d*r,u*r,h*r,p*r,g-d*r*l-h*r*c,f-u*r*l-p*r*c],this.width=A,this.height=m}get rawDims(){const e=this.viewBox;return cr(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:n=!1}={}){return new ky({viewBox:this.viewBox.slice(),userUnit:this.userUnit,scale:e,rotation:i,offsetX:r,offsetY:o,dontFlip:n})}convertToViewportPoint(e,i){const r=[e,i];return bi.applyTransform(r,this.transform),r}convertToViewportRectangle(e){const i=[e[0],e[1]];bi.applyTransform(i,this.transform);const r=[e[2],e[3]];return bi.applyTransform(r,this.transform),[i[0],i[1],r[0],r[1]]}convertToPdfPoint(e,i){const r=[e,i];return bi.applyInverseTransform(r,this.transform),r}}class sq extends o2{constructor(e,i=0){super(e,"RenderingCancelledException"),this.extraDelay=i}}function oS(t){const e=t.length;let i=0;for(;i<e&&t[i].trim()==="";)i++;return t.substring(i,i+5).toLowerCase()==="data:"}function aq(t){return typeof t=="string"&&/\.pdf$/i.test(t)}function gBi(t){return[t]=t.split(/[#?]/,1),t.substring(t.lastIndexOf("/")+1)}function mBi(t,e="document.pdf"){if(typeof t!="string")return e;if(oS(t))return Ki('getPdfFilenameFromUrl: ignore "data:"-URL for performance reasons.'),e;const i=(s=>{try{return new URL(s)}catch{try{return new URL(decodeURIComponent(s))}catch{try{return new URL(s,"https://foo.bar")}catch{try{return new URL(decodeURIComponent(s),"https://foo.bar")}catch{return null}}}}})(t);if(!i)return e;const r=s=>{try{let a=decodeURIComponent(s);return a.includes("/")?(a=a.split("/").at(-1),a.test(/^\.pdf$/i)?a:s):a}catch{return s}},o=/\.pdf$/i,n=i.pathname.split("/").at(-1);if(o.test(n))return r(n);if(i.searchParams.size>0){const s=Array.from(i.searchParams.values()).reverse();for(const l of s)if(o.test(l))return r(l);const a=Array.from(i.searchParams.keys()).reverse();for(const l of a)if(o.test(l))return r(l)}if(i.hash){const s=/[^/?#=]+\.pdf\b(?!.*\.pdf\b)/i.exec(i.hash);if(s)return r(s[0])}return e}class _9e{started=Object.create(null);times=[];time(e){e in this.started&&Ki(`Timer is already running for ${e}`),this.started[e]=Date.now()}timeEnd(e){e in this.started||Ki(`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:n}of this.times)e.push(`${r.padEnd(i)} ${n-o}ms
|
|
5527
5527
|
`);return e.join("")}}function lb(t,e){const i=e?URL.parse(t,e):URL.parse(t);return i?.protocol==="http:"||i?.protocol==="https:"}function Uc(t){t.preventDefault()}function Ln(t){t.preventDefault(),t.stopPropagation()}function ABi(t){console.log("Deprecated API usage: "+t)}class lq{static#e;static toDateObject(e){if(e instanceof Date)return e;if(!e||typeof e!="string")return null;this.#e||=new RegExp("^D:(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?([Z|+|-])?(\\d{2})?'?(\\d{2})?'?");const i=this.#e.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 n=parseInt(i[3],10);n=n>=1&&n<=31?n:1;let s=parseInt(i[4],10);s=s>=0&&s<=23?s: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 u=parseInt(i[9],10)||0;return u=u>=0&&u<=59?u:0,c==="-"?(s+=d,a+=u):c==="+"&&(s-=d,a-=u),new Date(Date.UTC(r,o,n,s,a,l))}}function vBi(t,{scale:e=1,rotation:i=0}){const{width:r,height:o}=t.attributes.style,n=[0,0,parseInt(r),parseInt(o)];return new ky({viewBox:n,userUnit:1,scale:e,rotation:i})}function nS(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):(Ki(`Not a valid color format: "${t}"`),[0,0,0])}function bBi(t){const e=document.createElement("span");e.style.visibility="hidden",e.style.colorScheme="only light",document.body.append(e);for(const i of t.keys()){e.style.color=i;const r=window.getComputedStyle(e).color;t.set(i,nS(r))}e.remove()}function Xo(t){const{a:e,b:i,c:r,d:o,e:n,f:s}=t.getTransform();return[e,i,r,o,n,s]}function Tu(t){const{a:e,b:i,c:r,d:o,e:n,f:s}=t.getTransform().invertSelf();return[e,i,r,o,n,s]}function n2(t,e,i=!1,r=!0){if(e instanceof ky){const{pageWidth:o,pageHeight:n}=e.rawDims,{style:s}=t,a=Us.isCSSRoundSupported,l=`var(--total-scale-factor) * ${o}px`,c=`var(--total-scale-factor) * ${n}px`,d=a?`round(down, ${l}, var(--scale-round-x))`:`calc(${l})`,u=a?`round(down, ${c}, var(--scale-round-y))`:`calc(${c})`;!i||e.rotation%180===0?(s.width=d,s.height=u):(s.width=u,s.height=d)}r&&t.setAttribute("data-main-rotation",e.rotation)}class Ku{constructor(){const{pixelRatio:e}=Ku;this.sx=e,this.sy=e}get scaled(){return this.sx!==1||this.sy!==1}get symmetric(){return this.sx===this.sy}limitCanvas(e,i,r,o,n=-1){let s=1/0,a=1/0,l=1/0;r=Ku.capPixels(r,n),r>0&&(s=Math.sqrt(r/(e*i))),o!==-1&&(a=o/e,l=o/i);const c=Math.min(s,a,l);return this.sx>c||this.sy>c?(this.sx=c,this.sy=c,!0):!1}static get pixelRatio(){return globalThis.devicePixelRatio||1}static capPixels(e,i){if(i>=0){const r=Math.ceil(window.screen.availWidth*window.screen.availHeight*this.pixelRatio**2*(1+i/100));return e>0?Math.min(e,r):r}return e}}const cq=["image/apng","image/avif","image/bmp","image/gif","image/jpeg","image/png","image/svg+xml","image/webp","image/x-icon"];class My{#e=null;#t=null;#i;#r=null;#n=null;#o=null;#s=null;static#a=null;constructor(e){this.#i=e,My.#a||=Object.freeze({freetext:"pdfjs-editor-remove-freetext-button",highlight:"pdfjs-editor-remove-highlight-button",ink:"pdfjs-editor-remove-ink-button",stamp:"pdfjs-editor-remove-stamp-button",signature:"pdfjs-editor-remove-signature-button"})}render(){const e=this.#e=document.createElement("div");e.classList.add("editToolbar","hidden"),e.setAttribute("role","toolbar");const i=this.#i._uiManager._signal;e.addEventListener("contextmenu",Uc,{signal:i}),e.addEventListener("pointerdown",My.#l,{signal:i});const r=this.#r=document.createElement("div");r.className="buttons",e.append(r);const o=this.#i.toolbarPosition;if(o){const{style:n}=e,s=this.#i._uiManager.direction==="ltr"?1-o[0]:o[0];n.insetInlineEnd=`${100*s}%`,n.top=`calc(${100*o[1]}% + var(--editor-toolbar-vert-offset))`}return e}get div(){return this.#e}static#l(e){e.stopPropagation()}#c(e){this.#i._focusEventsAllowed=!1,Ln(e)}#h(e){this.#i._focusEventsAllowed=!0,Ln(e)}#d(e){const i=this.#i._uiManager._signal;e.addEventListener("focusin",this.#c.bind(this),{capture:!0,signal:i}),e.addEventListener("focusout",this.#h.bind(this),{capture:!0,signal:i}),e.addEventListener("contextmenu",Uc,{signal:i})}hide(){this.#e.classList.add("hidden"),this.#t?.hideDropdown()}show(){this.#e.classList.remove("hidden"),this.#n?.shown(),this.#o?.shown()}addDeleteButton(){const{editorType:e,_uiManager:i}=this.#i,r=document.createElement("button");r.className="delete",r.tabIndex=0,r.setAttribute("data-l10n-id",My.#a[e]),this.#d(r),r.addEventListener("click",o=>{i.delete()},{signal:i._signal}),this.#r.append(r)}get#p(){const e=document.createElement("div");return e.className="divider",e}async addAltText(e){const i=await e.render();this.#d(i),this.#r.append(i,this.#p),this.#n=e}addComment(e){if(this.#o)return;const i=e.render();i&&(this.#d(i),this.#r.prepend(i,this.#p),this.#o=e,e.toolbar=this)}addColorPicker(e){if(this.#t)return;this.#t=e;const i=e.renderButton();this.#d(i),this.#r.append(i,this.#p)}async addEditSignatureButton(e){const i=this.#s=await e.renderEditButton(this.#i);this.#d(i),this.#r.append(i,this.#p)}async addButton(e,i){switch(e){case"colorPicker":this.addColorPicker(i);break;case"altText":await this.addAltText(i);break;case"editSignature":await this.addEditSignatureButton(i);break;case"delete":this.addDeleteButton();break;case"comment":this.addComment(i);break}}updateEditSignatureButton(e){this.#s&&(this.#s.title=e)}remove(){this.#e.remove(),this.#t?.destroy(),this.#t=null}}class yBi{#e=null;#t=null;#i;constructor(e){this.#i=e}#r(){const e=this.#t=document.createElement("div");e.className="editToolbar",e.setAttribute("role","toolbar"),e.addEventListener("contextmenu",Uc,{signal:this.#i._signal});const i=this.#e=document.createElement("div");return i.className="buttons",e.append(i),this.#o(),e}#n(e,i){let r=0,o=0;for(const n of e){const s=n.y+n.height;if(s<r)continue;const a=n.x+(i?n.width:0);if(s>r){o=a,r=s;continue}i?a>o&&(o=a):a<o&&(o=a)}return[i?1-o:o,r]}show(e,i,r){const[o,n]=this.#n(i,r),{style:s}=this.#t||=this.#r();e.append(this.#t),s.insetInlineEnd=`${100*o}%`,s.top=`calc(${100*n}% + var(--editor-toolbar-vert-offset))`}hide(){this.#t.remove()}#o(){const e=document.createElement("button");e.className="highlightButton",e.tabIndex=0,e.setAttribute("data-l10n-id","pdfjs-highlight-floating-button1");const i=document.createElement("span");e.append(i),i.className="visuallyHidden",i.setAttribute("data-l10n-id","pdfjs-highlight-floating-button-label");const r=this.#i._signal;e.addEventListener("contextmenu",Uc,{signal:r}),e.addEventListener("click",()=>{this.#i.highlightSelection("floating_button")},{signal:r}),this.#e.append(e)}}function L9e(t,e,i){for(const r of i)e.addEventListener(r,t[r].bind(t))}class wBi{#e=0;get id(){return`${P9e}${this.#e++}`}}class yQ{#e=R9e();#t=0;#i=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 cr(this,"_isSVGFittingCanvas",o)}async#r(e,i){this.#i||=new Map;let r=this.#i.get(e);if(r===null)return null;if(r?.bitmap)return r.refCounter+=1,r;try{r||={bitmap:null,id:`image_${this.#e}_${this.#t++}`,refCounter:0,isSvg:!1};let o;if(typeof i=="string"?(r.url=i,o=await ab(i,"blob")):i instanceof File?o=r.file=i:i instanceof Blob&&(o=i),o.type==="image/svg+xml"){const n=yQ._isSVGFittingCanvas,s=new FileReader,a=new Image,l=new Promise((c,d)=>{a.onload=()=>{r.bitmap=a,r.isSvg=!0,c()},s.onload=async()=>{const u=r.svgUrl=s.result;a.src=await n?`${u}#svgView(preserveAspectRatio(none))`:u},a.onerror=s.onerror=d});s.readAsDataURL(o),await l}else r.bitmap=await createImageBitmap(o);r.refCounter=1}catch(o){Ki(o),r=null}return this.#i.set(e,r),r&&this.#i.set(r.id,r),r}async getFromFile(e){const{lastModified:i,name:r,size:o,type:n}=e;return this.#r(`${i}_${r}_${o}_${n}`,e)}async getFromUrl(e){return this.#r(e,e)}async getFromBlob(e,i){const r=await i;return this.#r(e,r)}async getFromId(e){this.#i||=new Map;const i=this.#i.get(e);if(!i)return null;if(i.bitmap)return i.refCounter+=1,i;if(i.file)return this.getFromFile(i.file);if(i.blobPromise){const{blobPromise:r}=i;return delete i.blobPromise,this.getFromBlob(i.id,r)}return this.getFromUrl(i.url)}getFromCanvas(e,i){this.#i||=new Map;let r=this.#i.get(e);if(r?.bitmap)return r.refCounter+=1,r;const o=new OffscreenCanvas(i.width,i.height);return o.getContext("2d").drawImage(i,0,0),r={bitmap:o.transferToImageBitmap(),id:`image_${this.#e}_${this.#t++}`,refCounter:1,isSvg:!1},this.#i.set(e,r),this.#i.set(r.id,r),r}getSvgUrl(e){const i=this.#i.get(e);return i?.isSvg?i.svgUrl:null}deleteId(e){this.#i||=new Map;const i=this.#i.get(e);if(!i||(i.refCounter-=1,i.refCounter!==0))return;const{bitmap:r}=i;if(!i.url&&!i.file){const o=new OffscreenCanvas(r.width,r.height);o.getContext("bitmaprenderer").transferFromImageBitmap(r),i.blobPromise=o.convertToBlob()}r.close?.(),i.bitmap=null}isValidId(e){return e.startsWith(`image_${this.#e}_`)}}class xBi{#e=[];#t=!1;#i;#r=-1;constructor(e=128){this.#i=e}add({cmd:e,undo:i,post:r,mustExec:o,type:n=NaN,overwriteIfSameType:s=!1,keepUndo:a=!1}){if(o&&e(),this.#t)return;const l={cmd:e,undo:i,post:r,type:n};if(this.#r===-1){this.#e.length>0&&(this.#e.length=0),this.#r=0,this.#e.push(l);return}if(s&&this.#e[this.#r].type===n){a&&(l.undo=this.#e[this.#r].undo),this.#e[this.#r]=l;return}const c=this.#r+1;c===this.#i?this.#e.splice(0,1):(this.#r=c,c<this.#e.length&&this.#e.splice(c)),this.#e.push(l)}undo(){if(this.#r===-1)return;this.#t=!0;const{undo:e,post:i}=this.#e[this.#r];e(),i?.(),this.#t=!1,this.#r-=1}redo(){if(this.#r<this.#e.length-1){this.#r+=1,this.#t=!0;const{cmd:e,post:i}=this.#e[this.#r];e(),i?.(),this.#t=!1}}hasSomethingToUndo(){return this.#r!==-1}hasSomethingToRedo(){return this.#r<this.#e.length-1}cleanType(e){if(this.#r!==-1){for(let i=this.#r;i>=0;i--)if(this.#e[i].type!==e){this.#e.splice(i+1,this.#r-i),this.#r=i;return}this.#e.length=0,this.#r=-1}}destroy(){this.#e=null}}class cb{constructor(e){this.buffer=[],this.callbacks=new Map,this.allKeys=new Set;const{isMac:i}=Us.platform;for(const[r,o,n={}]of e)for(const s of r){const a=s.startsWith("mac+");i&&a?(this.callbacks.set(s.slice(4),{callback:o,options:n}),this.allKeys.add(s.split("+").at(-1))):!i&&!a&&(this.callbacks.set(s,{callback:o,options:n}),this.allKeys.add(s.split("+").at(-1)))}}#e(e){e.altKey&&this.buffer.push("alt"),e.ctrlKey&&this.buffer.push("ctrl"),e.metaKey&&this.buffer.push("meta"),e.shiftKey&&this.buffer.push("shift"),this.buffer.push(e.key);const i=this.buffer.join("+");return this.buffer.length=0,i}exec(e,i){if(!this.allKeys.has(i.key))return;const r=this.callbacks.get(this.#e(i));if(!r)return;const{callback:o,options:{bubbles:n=!1,args:s=[],checker:a=null}}=r;a&&!a(e,i)||(o.bind(e,...s,i)(),n||Ln(i))}}class wQ{static _colorsMapping=new Map([["CanvasText",[0,0,0]],["Canvas",[255,255,255]]]);get _colors(){const e=new Map([["CanvasText",null],["Canvas",null]]);return bBi(e),cr(this,"_colors",e)}convert(e){const i=nS(e);if(!window.matchMedia("(forced-colors: active)").matches)return i;for(const[r,o]of this._colors)if(o.every((n,s)=>n===i[s]))return wQ._colorsMapping.get(r);return i}getHexCode(e){const i=this._colors.get(e);return i?bi.makeHexColor(...i):e}}class k0{#e=new AbortController;#t=null;#i=new Map;#r=new Map;#n=null;#o=null;#s=null;#a=new xBi;#l=null;#c=null;#h=null;#d=0;#p=new Set;#m=null;#f=null;#u=new Set;_editorUndoBar=null;#g=!1;#b=!1;#A=!1;#w=null;#x=null;#v=null;#k=null;#B=!1;#C=null;#I=new wBi;#S=!1;#E=!1;#P=null;#R=null;#O=null;#D=null;#H=null;#M=Qi.NONE;#y=new Set;#N=null;#U=null;#V=null;#G=null;#Q={isEditing:!1,isEmpty:!0,hasSomethingToUndo:!1,hasSomethingToRedo:!1,hasSelectedEditor:!1,hasSelectedText:!1};#z=[0,0];#_=null;#L=null;#q=null;#J=null;#F=null;static TRANSLATE_SMALL=1;static TRANSLATE_BIG=10;static get _keyboardManager(){const e=k0.prototype,i=s=>s.#L.contains(document.activeElement)&&document.activeElement.tagName!=="BUTTON"&&s.hasSomethingToControl(),r=(s,{target:a})=>{if(a instanceof HTMLInputElement){const{type:l}=a;return l!=="text"&&l!=="number"}return!0},o=this.TRANSLATE_SMALL,n=this.TRANSLATE_BIG;return cr(this,"_keyboardManager",new cb([[["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:(s,{target:a})=>!(a instanceof HTMLButtonElement)&&s.#L.contains(a)&&!s.isEnterHandled}],[[" ","mac+ "],e.addNewEditorFromKeyboard,{checker:(s,{target:a})=>!(a instanceof HTMLButtonElement)&&s.#L.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:[-n,0],checker:i}],[["ArrowRight","mac+ArrowRight"],e.translateSelectedEditors,{args:[o,0],checker:i}],[["ctrl+ArrowRight","mac+shift+ArrowRight"],e.translateSelectedEditors,{args:[n,0],checker:i}],[["ArrowUp","mac+ArrowUp"],e.translateSelectedEditors,{args:[0,-o],checker:i}],[["ctrl+ArrowUp","mac+shift+ArrowUp"],e.translateSelectedEditors,{args:[0,-n],checker:i}],[["ArrowDown","mac+ArrowDown"],e.translateSelectedEditors,{args:[0,o],checker:i}],[["ctrl+ArrowDown","mac+shift+ArrowDown"],e.translateSelectedEditors,{args:[0,n],checker:i}]]))}constructor(e,i,r,o,n,s,a,l,c,d,u,h,p,g,f,A){const m=this._signal=this.#e.signal;this.#L=e,this.#q=i,this.#J=r,this.#n=o,this.#l=n,this.#U=s,this._eventBus=a,a._on("editingaction",this.onEditingAction.bind(this),{signal:m}),a._on("pagechanging",this.onPageChanging.bind(this),{signal:m}),a._on("scalechanging",this.onScaleChanging.bind(this),{signal:m}),a._on("rotationchanging",this.onRotationChanging.bind(this),{signal:m}),a._on("setpreference",this.onSetPreference.bind(this),{signal:m}),a._on("switchannotationeditorparams",v=>this.updateParams(v.type,v.value),{signal:m}),this.#ne(),this.#ce(),this.#Y(),this.#o=l.annotationStorage,this.#w=l.filterFactory,this.#V=c,this.#k=d||null,this.#g=u,this.#b=h,this.#A=p,this.#H=g||null,this.viewParameters={realScale:L5.PDF_TO_CSS_UNITS,rotation:0},this.isShiftKeyDown=!1,this._editorUndoBar=f||null,this._supportsPinchToZoom=A!==!1}destroy(){this.#F?.resolve(),this.#F=null,this.#e?.abort(),this.#e=null,this._signal=null;for(const e of this.#r.values())e.destroy();this.#r.clear(),this.#i.clear(),this.#u.clear(),this.#D?.clear(),this.#t=null,this.#y.clear(),this.#a.destroy(),this.#n?.destroy(),this.#l?.destroy(),this.#U?.destroy(),this.#C?.hide(),this.#C=null,this.#O?.destroy(),this.#O=null,this.#x&&(clearTimeout(this.#x),this.#x=null),this.#_&&(clearTimeout(this.#_),this.#_=null),this._editorUndoBar?.destroy()}combinedSignal(e){return AbortSignal.any([this._signal,e.signal])}get mlManager(){return this.#H}get useNewAltTextFlow(){return this.#b}get useNewAltTextWhenAddingImage(){return this.#A}get hcmFilter(){return cr(this,"hcmFilter",this.#V?this.#w.addHCMFilter(this.#V.foreground,this.#V.background):"none")}get direction(){return cr(this,"direction",getComputedStyle(this.#L).direction)}get _highlightColors(){return cr(this,"_highlightColors",this.#k?new Map(this.#k.split(",").map(e=>(e=e.split("=").map(i=>i.trim()),e[1]=e[1].toUpperCase(),e))):null)}get highlightColors(){const{_highlightColors:e}=this;if(!e)return cr(this,"highlightColors",null);const i=new Map,r=!!this.#V;for(const[o,n]of e){const s=o.endsWith("_HCM");if(r&&s){i.set(o.replace("_HCM",""),n);continue}!r&&!s&&i.set(o,n)}return cr(this,"highlightColors",i)}get highlightColorNames(){return cr(this,"highlightColorNames",this.highlightColors?new Map(Array.from(this.highlightColors,e=>e.reverse())):null)}getNonHCMColor(e){if(!this._highlightColors)return e;const i=this.highlightColorNames.get(e);return this._highlightColors.get(i)||e}getNonHCMColorName(e){return this.highlightColorNames.get(e)||e}setCurrentDrawingSession(e){e?(this.unselectAll(),this.disableUserSelect(!0)):this.disableUserSelect(!1),this.#h=e}setMainHighlightColorPicker(e){this.#O=e}editAltText(e,i=!1){this.#n?.editAltText(this,e,i)}hasCommentManager(){return!!this.#l}editComment(e,i){this.#l?.open(this,e,i)}getSignature(e){this.#U?.getSignature({uiManager:this,editor:e})}get signatureManager(){return this.#U}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":this.#A=i;break}}onPageChanging({pageNumber:e}){this.#d=e-1}focusMainContainer(){this.#L.focus()}findParent(e,i){for(const r of this.#r.values()){const{x:o,y:n,width:s,height:a}=r.div.getBoundingClientRect();if(e>=o&&e<=o+s&&i>=n&&i<=n+a)return r}return null}disableUserSelect(e=!1){this.#q.classList.toggle("noUserSelect",e)}addShouldRescale(e){this.#u.add(e)}removeShouldRescale(e){this.#u.delete(e)}onScaleChanging({scale:e}){this.commitOrRemove(),this.viewParameters.realScale=e*L5.PDF_TO_CSS_UNITS;for(const i of this.#u)i.onScaleChanging();this.#h?.onScaleChanging()}onRotationChanging({pagesRotation:e}){this.commitOrRemove(),this.viewParameters.rotation=e}#W({anchorNode:e}){return e.nodeType===Node.TEXT_NODE?e.parentElement:e}#X(e){const{currentLayer:i}=this;if(i.hasTextLayer(e))return i;for(const r of this.#r.values())if(r.hasTextLayer(e))return r;return null}highlightSelection(e=""){const i=document.getSelection();if(!i||i.isCollapsed)return;const{anchorNode:r,anchorOffset:o,focusNode:n,focusOffset:s}=i,a=i.toString(),l=this.#W(i).closest(".textLayer"),c=this.getSelectionBoxes(l);if(!c)return;i.empty();const d=this.#X(l),u=this.#M===Qi.NONE,h=()=>{d?.createAndAddNewEditor({x:0,y:0},!1,{methodOfCreation:e,boxes:c,anchorNode:r,anchorOffset:o,focusNode:n,focusOffset:s,text:a}),u&&this.showAllEditors("highlight",!0,!0)};if(u){this.switchToMode(Qi.HIGHLIGHT,h);return}h()}#re(){const e=document.getSelection();if(!e||e.isCollapsed)return;const i=this.#W(e).closest(".textLayer"),r=this.getSelectionBoxes(i);r&&(this.#C||=new yBi(this),this.#C.show(i,r,this.direction==="ltr"))}addToAnnotationStorage(e){!e.isEmpty()&&this.#o&&!this.#o.has(e.id)&&this.#o.setValue(e.id,e)}a11yAlert(e,i=null){const r=this.#J;r&&(r.setAttribute("data-l10n-id",e),i?r.setAttribute("data-l10n-args",JSON.stringify(i)):r.removeAttribute("data-l10n-args"))}#oe(){const e=document.getSelection();if(!e||e.isCollapsed){this.#N&&(this.#C?.hide(),this.#N=null,this.#T({hasSelectedText:!1}));return}const{anchorNode:i}=e;if(i===this.#N)return;const r=this.#W(e).closest(".textLayer");if(!r){this.#N&&(this.#C?.hide(),this.#N=null,this.#T({hasSelectedText:!1}));return}if(this.#C?.hide(),this.#N=i,this.#T({hasSelectedText:!0}),!(this.#M!==Qi.HIGHLIGHT&&this.#M!==Qi.NONE)&&(this.#M===Qi.HIGHLIGHT&&this.showAllEditors("highlight",!0,!0),this.#B=this.isShiftKeyDown,!this.isShiftKeyDown)){const o=this.#M===Qi.HIGHLIGHT?this.#X(r):null;o?.toggleDrawing();const n=new AbortController,s=this.combinedSignal(n),a=l=>{l.type==="pointerup"&&l.button!==0||(n.abort(),o?.toggleDrawing(!0),l.type==="pointerup"&&this.#Z("main_toolbar"))};window.addEventListener("pointerup",a,{signal:s}),window.addEventListener("blur",a,{signal:s})}}#Z(e=""){this.#M===Qi.HIGHLIGHT?this.highlightSelection(e):this.#g&&this.#re()}#ne(){document.addEventListener("selectionchange",this.#oe.bind(this),{signal:this._signal})}#se(){if(this.#v)return;this.#v=new AbortController;const e=this.combinedSignal(this.#v);window.addEventListener("focus",this.focus.bind(this),{signal:e}),window.addEventListener("blur",this.blur.bind(this),{signal:e})}#ae(){this.#v?.abort(),this.#v=null}blur(){if(this.isShiftKeyDown=!1,this.#B&&(this.#B=!1,this.#Z("main_toolbar")),!this.hasSelection)return;const{activeElement:e}=document;for(const i of this.#y)if(i.div.contains(e)){this.#R=[i,e],i._focusEventsAllowed=!1;break}}focus(){if(!this.#R)return;const[e,i]=this.#R;this.#R=null,i.addEventListener("focusin",()=>{e._focusEventsAllowed=!0},{once:!0,signal:this._signal}),i.focus()}#Y(){if(this.#P)return;this.#P=new AbortController;const e=this.combinedSignal(this.#P);window.addEventListener("keydown",this.keydown.bind(this),{signal:e}),window.addEventListener("keyup",this.keyup.bind(this),{signal:e})}#le(){this.#P?.abort(),this.#P=null}#$(){if(this.#c)return;this.#c=new AbortController;const e=this.combinedSignal(this.#c);document.addEventListener("copy",this.copy.bind(this),{signal:e}),document.addEventListener("cut",this.cut.bind(this),{signal:e}),document.addEventListener("paste",this.paste.bind(this),{signal:e})}#ee(){this.#c?.abort(),this.#c=null}#ce(){const e=this._signal;document.addEventListener("dragover",this.dragOver.bind(this),{signal:e}),document.addEventListener("drop",this.drop.bind(this),{signal:e})}addEditListeners(){this.#Y(),this.#$()}removeEditListeners(){this.#le(),this.#ee()}dragOver(e){for(const{type:i}of e.dataTransfer.items)for(const r of this.#f)if(r.isHandlingMimeForPasting(i)){e.dataTransfer.dropEffect="copy",e.preventDefault();return}}drop(e){for(const i of e.dataTransfer.items)for(const r of this.#f)if(r.isHandlingMimeForPasting(i.type)){r.paste(i,this.currentLayer),e.preventDefault();return}}copy(e){if(e.preventDefault(),this.#t?.commitOrRemove(),!this.hasSelection)return;const i=[];for(const r of this.#y){const o=r.serialize(!0);o&&i.push(o)}i.length!==0&&e.clipboardData.setData("application/pdfjs",JSON.stringify(i))}cut(e){this.copy(e),this.delete()}async paste(e){e.preventDefault();const{clipboardData:i}=e;for(const n of i.items)for(const s of this.#f)if(s.isHandlingMimeForPasting(n.type)){s.paste(n,this.currentLayer);return}let r=i.getData("application/pdfjs");if(!r)return;try{r=JSON.parse(r)}catch(n){Ki(`paste: "${n.message}".`);return}if(!Array.isArray(r))return;this.unselectAll();const o=this.currentLayer;try{const n=[];for(const l of r){const c=await o.deserialize(l);if(!c)return;n.push(c)}const s=()=>{for(const l of n)this.#te(l);this.#ie(n)},a=()=>{for(const l of n)l.remove()};this.addCommands({cmd:s,undo:a,mustExec:!0})}catch(n){Ki(`paste: "${n.message}".`)}}keydown(e){!this.isShiftKeyDown&&e.key==="Shift"&&(this.isShiftKeyDown=!0),this.#M!==Qi.NONE&&!this.isEditorHandlingKeyboard&&k0._keyboardManager.exec(this,e)}keyup(e){this.isShiftKeyDown&&e.key==="Shift"&&(this.isShiftKeyDown=!1,this.#B&&(this.#B=!1,this.#Z("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}}#T(e){Object.entries(e).some(([i,r])=>this.#Q[i]!==r)&&(this._eventBus.dispatch("annotationeditorstateschanged",{source:this,details:Object.assign(this.#Q,e)}),this.#M===Qi.HIGHLIGHT&&e.hasSelectedEditor===!1&&this.#j([[Mr.HIGHLIGHT_FREE,!0]]))}#j(e){this._eventBus.dispatch("annotationeditorparamschanged",{source:this,details:e})}setEditingState(e){e?(this.#se(),this.#$(),this.#T({isEditing:this.#M!==Qi.NONE,isEmpty:this.#K(),hasSomethingToUndo:this.#a.hasSomethingToUndo(),hasSomethingToRedo:this.#a.hasSomethingToRedo(),hasSelectedEditor:!1})):(this.#ae(),this.#ee(),this.#T({isEditing:!1}),this.disableUserSelect(!1))}registerEditorTypes(e){if(!this.#f){this.#f=e;for(const i of this.#f)this.#j(i.defaultPropertiesToUpdate)}}getId(){return this.#I.id}get currentLayer(){return this.#r.get(this.#d)}getLayer(e){return this.#r.get(e)}get currentPageIndex(){return this.#d}addLayer(e){this.#r.set(e.pageIndex,e),this.#S?e.enable():e.disable()}removeLayer(e){this.#r.delete(e.pageIndex)}async updateMode(e,i=null,r=!1,o=!1,n=!1){if(this.#M!==e&&!(this.#F&&(await this.#F.promise,!this.#F))){if(this.#F=Promise.withResolvers(),this.#h?.commitOrRemove(),this.#M=e,e===Qi.NONE){this.setEditingState(!1),this.#ue(),this._editorUndoBar?.hide(),this.#F.resolve();return}e===Qi.SIGNATURE&&await this.#U?.loadSignatures(),this.setEditingState(!0),await this.#de(),this.unselectAll();for(const s of this.#r.values())s.updateMode(e);if(!i){r&&this.addNewEditorFromKeyboard(),this.#F.resolve();return}for(const s of this.#i.values())s.annotationElementId===i||s.id===i?(this.setSelected(s),n?s.editComment():o&&s.enterInEditMode()):s.unselect();this.#F.resolve()}}addNewEditorFromKeyboard(){this.currentLayer.canCreateNewEmptyEditor()&&this.currentLayer.addNewEditor()}updateToolbar(e){e.mode!==this.#M&&this._eventBus.dispatch("switchannotationeditormode",{source:this,...e})}updateParams(e,i){if(this.#f){switch(e){case Mr.CREATE:this.currentLayer.addNewEditor(i);return;case Mr.HIGHLIGHT_SHOW_ALL:this._eventBus.dispatch("reporttelemetry",{source:this,details:{type:"editing",data:{type:"highlight",action:"toggle_visibility"}}}),(this.#G||=new Map).set(e,i),this.showAllEditors("highlight",i);break}if(this.hasSelection)for(const r of this.#y)r.updateParams(e,i);else for(const r of this.#f)r.updateDefaultParams(e,i)}}showAllEditors(e,i,r=!1){for(const o of this.#i.values())o.editorType===e&&o.show(i);(this.#G?.get(Mr.HIGHLIGHT_SHOW_ALL)??!0)!==i&&this.#j([[Mr.HIGHLIGHT_SHOW_ALL,i]])}enableWaiting(e=!1){if(this.#E!==e){this.#E=e;for(const i of this.#r.values())e?i.disableClick():i.enableClick(),i.div.classList.toggle("waiting",e)}}async#de(){if(!this.#S){this.#S=!0;const e=[];for(const i of this.#r.values())e.push(i.enable());await Promise.all(e);for(const i of this.#i.values())i.enable()}}#ue(){if(this.unselectAll(),this.#S){this.#S=!1;for(const e of this.#r.values())e.disable();for(const e of this.#i.values())e.disable()}}getEditors(e){const i=[];for(const r of this.#i.values())r.pageIndex===e&&i.push(r);return i}getEditor(e){return this.#i.get(e)}addEditor(e){this.#i.set(e.id,e)}removeEditor(e){e.div.contains(document.activeElement)&&(this.#x&&clearTimeout(this.#x),this.#x=setTimeout(()=>{this.focusMainContainer(),this.#x=null},0)),this.#i.delete(e.id),e.annotationElementId&&this.#D?.delete(e.annotationElementId),this.unselect(e),(!e.annotationElementId||!this.#p.has(e.annotationElementId))&&this.#o?.remove(e.id)}addDeletedAnnotationElement(e){this.#p.add(e.annotationElementId),this.addChangedExistingAnnotation(e),e.deleted=!0}isDeletedAnnotationElement(e){return this.#p.has(e)}removeDeletedAnnotationElement(e){this.#p.delete(e.annotationElementId),this.removeChangedExistingAnnotation(e),e.deleted=!1}#te(e){const i=this.#r.get(e.pageIndex);i?i.addOrRebuild(e):(this.addEditor(e),this.addToAnnotationStorage(e))}setActiveEditor(e){this.#t!==e&&(this.#t=e,e&&this.#j(e.propertiesToUpdate))}get#he(){let e=null;for(e of this.#y);return e}updateUI(e){this.#he===e&&this.#j(e.propertiesToUpdate)}updateUIForDefaultProperties(e){this.#j(e.defaultPropertiesToUpdate)}toggleSelected(e){if(this.#y.has(e)){this.#y.delete(e),e.unselect(),this.#T({hasSelectedEditor:this.hasSelection});return}this.#y.add(e),e.select(),this.#j(e.propertiesToUpdate),this.#T({hasSelectedEditor:!0})}setSelected(e){this.updateToolbar({mode:e.mode,editId:e.id}),this.#h?.commitOrRemove();for(const i of this.#y)i!==e&&i.unselect();this.#y.clear(),this.#y.add(e),e.select(),this.#j(e.propertiesToUpdate),this.#T({hasSelectedEditor:!0})}isSelected(e){return this.#y.has(e)}get firstSelectedEditor(){return this.#y.values().next().value}unselect(e){e.unselect(),this.#y.delete(e),this.#T({hasSelectedEditor:this.hasSelection})}get hasSelection(){return this.#y.size!==0}get isEnterHandled(){return this.#y.size===1&&this.firstSelectedEditor.isEnterHandled}undo(){this.#a.undo(),this.#T({hasSomethingToUndo:this.#a.hasSomethingToUndo(),hasSomethingToRedo:!0,isEmpty:this.#K()}),this._editorUndoBar?.hide()}redo(){this.#a.redo(),this.#T({hasSomethingToUndo:!0,hasSomethingToRedo:this.#a.hasSomethingToRedo(),isEmpty:this.#K()})}addCommands(e){this.#a.add(e),this.#T({hasSomethingToUndo:!0,hasSomethingToRedo:!1,isEmpty:this.#K()})}cleanUndoStack(e){this.#a.cleanType(e)}#K(){if(this.#i.size===0)return!0;if(this.#i.size===1)for(const e of this.#i.values())return e.isEmpty();return!1}delete(){this.commitOrRemove();const e=this.currentLayer?.endDrawingSession(!0);if(!this.hasSelection&&!e)return;const i=e?[e]:[...this.#y],r=()=>{this._editorUndoBar?.show(o,i.length===1?i[0].editorType:i.length);for(const n of i)n.remove()},o=()=>{for(const n of i)this.#te(n)};this.addCommands({cmd:r,undo:o,mustExec:!0})}commitOrRemove(){this.#t?.commitOrRemove()}hasSomethingToControl(){return this.#t||this.hasSelection}#ie(e){for(const i of this.#y)i.unselect();this.#y.clear();for(const i of e)i.isEmpty()||(this.#y.add(i),i.select());this.#T({hasSelectedEditor:this.hasSelection})}selectAll(){for(const e of this.#y)e.commit();this.#ie(this.#i.values())}unselectAll(){if(!(this.#t&&(this.#t.commitOrRemove(),this.#M!==Qi.NONE))&&!this.#h?.commitOrRemove()&&this.hasSelection){for(const e of this.#y)e.unselect();this.#y.clear(),this.#T({hasSelectedEditor:!1})}}translateSelectedEditors(e,i,r=!1){if(r||this.commitOrRemove(),!this.hasSelection)return;this.#z[0]+=e,this.#z[1]+=i;const[o,n]=this.#z,s=[...this.#y],a=1e3;this.#_&&clearTimeout(this.#_),this.#_=setTimeout(()=>{this.#_=null,this.#z[0]=this.#z[1]=0,this.addCommands({cmd:()=>{for(const l of s)this.#i.has(l.id)&&(l.translateInPage(o,n),l.translationDone())},undo:()=>{for(const l of s)this.#i.has(l.id)&&(l.translateInPage(-o,-n),l.translationDone())},mustExec:!1})},a);for(const l of s)l.translateInPage(e,i),l.translationDone()}setUpDragSession(){if(this.hasSelection){this.disableUserSelect(!0),this.#m=new Map;for(const e of this.#y)this.#m.set(e,{savedX:e.x,savedY:e.y,savedPageIndex:e.pageIndex,newX:0,newY:0,newPageIndex:-1})}}endDragSession(){if(!this.#m)return!1;this.disableUserSelect(!1);const e=this.#m;this.#m=null;let i=!1;for(const[{x:o,y:n,pageIndex:s},a]of e)a.newX=o,a.newY=n,a.newPageIndex=s,i||=o!==a.savedX||n!==a.savedY||s!==a.savedPageIndex;if(!i)return!1;const r=(o,n,s,a)=>{if(this.#i.has(o.id)){const l=this.#r.get(a);l?o._setParentAndPosition(l,n,s):(o.pageIndex=a,o.x=n,o.y=s)}};return this.addCommands({cmd:()=>{for(const[o,{newX:n,newY:s,newPageIndex:a}]of e)r(o,n,s,a)},undo:()=>{for(const[o,{savedX:n,savedY:s,savedPageIndex:a}]of e)r(o,n,s,a)},mustExec:!0}),!0}dragSelectedEditors(e,i){if(this.#m)for(const r of this.#m.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(){return this.getActive()?.shouldGetKeyboardEvents()||this.#y.size===1&&this.firstSelectedEditor.shouldGetKeyboardEvents()}isActive(e){return this.#t===e}getActive(){return this.#t}getMode(){return this.#M}get imageManager(){return cr(this,"imageManager",new yQ)}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:n,height:s}=e.getBoundingClientRect();let a;switch(e.getAttribute("data-main-rotation")){case"90":a=(c,d,u,h)=>({x:(d-o)/s,y:1-(c+u-r)/n,width:h/s,height:u/n});break;case"180":a=(c,d,u,h)=>({x:1-(c+u-r)/n,y:1-(d+h-o)/s,width:u/n,height:h/s});break;case"270":a=(c,d,u,h)=>({x:1-(d+h-o)/s,y:(c-r)/n,width:h/s,height:u/n});break;default:a=(c,d,u,h)=>({x:(c-r)/n,y:(d-o)/s,width:u/n,height:h/s});break}const l=[];for(let c=0,d=i.rangeCount;c<d;c++){const u=i.getRangeAt(c);if(!u.collapsed)for(const{x:h,y:p,width:g,height:f}of u.getClientRects())g===0||f===0||l.push(a(h,p,g,f))}return l.length===0?null:l}addChangedExistingAnnotation({annotationElementId:e,id:i}){(this.#s||=new Map).set(e,i)}removeChangedExistingAnnotation({annotationElementId:e}){this.#s?.delete(e)}renderAnnotationElement(e){const i=this.#s?.get(e.data.id);if(!i)return;const r=this.#o.getRawValue(i);r&&(this.#M===Qi.NONE&&!r.hasBeenModified||r.renderAnnotationElement(e))}setMissingCanvas(e,i,r){const o=this.#D?.get(e);o&&(o.setCanvas(i,r),this.#D.delete(e))}addMissingCanvas(e,i){(this.#D||=new Map).set(e,i)}}class Wu{#e=null;#t=!1;#i=null;#r=null;#n=null;#o=null;#s=!1;#a=null;#l=null;#c=null;#h=null;#d=!1;static#p=null;static _l10n=null;constructor(e){this.#l=e,this.#d=e._uiManager.useNewAltTextFlow,Wu.#p||=Object.freeze({added:"pdfjs-editor-new-alt-text-added-button","added-label":"pdfjs-editor-new-alt-text-added-button-label",missing:"pdfjs-editor-new-alt-text-missing-button","missing-label":"pdfjs-editor-new-alt-text-missing-button-label",review:"pdfjs-editor-new-alt-text-to-review-button","review-label":"pdfjs-editor-new-alt-text-to-review-button-label"})}static initialize(e){Wu._l10n??=e}async render(){const e=this.#i=document.createElement("button");e.className="altText",e.tabIndex="0";const i=this.#r=document.createElement("span");e.append(i),this.#d?(e.classList.add("new"),e.setAttribute("data-l10n-id",Wu.#p.missing),i.setAttribute("data-l10n-id",Wu.#p["missing-label"])):(e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button"),i.setAttribute("data-l10n-id","pdfjs-editor-alt-text-button-label"));const r=this.#l._uiManager._signal;e.addEventListener("contextmenu",Uc,{signal:r}),e.addEventListener("pointerdown",n=>n.stopPropagation(),{signal:r});const o=n=>{n.preventDefault(),this.#l._uiManager.editAltText(this.#l),this.#d&&this.#l._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_clicked",data:{label:this.#m}})};return e.addEventListener("click",o,{capture:!0,signal:r}),e.addEventListener("keydown",n=>{n.target===e&&n.key==="Enter"&&(this.#s=!0,o(n))},{signal:r}),await this.#f(),e}get#m(){return this.#e&&"added"||this.#e===null&&this.guessedText&&"review"||"missing"}finish(){this.#i&&(this.#i.focus({focusVisible:this.#s}),this.#s=!1)}isEmpty(){return this.#d?this.#e===null:!this.#e&&!this.#t}hasData(){return this.#d?this.#e!==null||!!this.#c:this.isEmpty()}get guessedText(){return this.#c}async setGuessedText(e){this.#e===null&&(this.#c=e,this.#h=await Wu._l10n.get("pdfjs-editor-new-alt-text-generated-alt-text-with-disclaimer",{generatedAltText:e}),this.#f())}toggleAltTextBadge(e=!1){if(!this.#d||this.#e){this.#a?.remove(),this.#a=null;return}if(!this.#a){const i=this.#a=document.createElement("div");i.className="noAltTextBadge",this.#l.div.append(i)}this.#a.classList.toggle("hidden",!e)}serialize(e){let i=this.#e;return!e&&this.#c===i&&(i=this.#h),{altText:i,decorative:this.#t,guessedText:this.#c,textWithDisclaimer:this.#h}}get data(){return{altText:this.#e,decorative:this.#t}}set data({altText:e,decorative:i,guessedText:r,textWithDisclaimer:o,cancel:n=!1}){r&&(this.#c=r,this.#h=o),!(this.#e===e&&this.#t===i)&&(n||(this.#e=e,this.#t=i),this.#f())}toggle(e=!1){this.#i&&(!e&&this.#o&&(clearTimeout(this.#o),this.#o=null),this.#i.disabled=!e)}shown(){this.#l._reportTelemetry({action:"pdfjs.image.alt_text.image_status_label_displayed",data:{label:this.#m}})}destroy(){this.#i?.remove(),this.#i=null,this.#r=null,this.#n=null,this.#a?.remove(),this.#a=null}async#f(){const e=this.#i;if(!e)return;if(this.#d){if(e.classList.toggle("done",!!this.#e),e.setAttribute("data-l10n-id",Wu.#p[this.#m]),this.#r?.setAttribute("data-l10n-id",Wu.#p[`${this.#m}-label`]),!this.#e){this.#n?.remove();return}}else{if(!this.#e&&!this.#t){e.classList.remove("done"),this.#n?.remove();return}e.classList.add("done"),e.setAttribute("data-l10n-id","pdfjs-editor-alt-text-edit-button")}let i=this.#n;if(!i){this.#n=i=document.createElement("span"),i.className="tooltip",i.setAttribute("role","tooltip"),i.id=`alt-text-tooltip-${this.#l.id}`;const r=100,o=this.#l._uiManager._signal;o.addEventListener("abort",()=>{clearTimeout(this.#o),this.#o=null},{once:!0}),e.addEventListener("mouseenter",()=>{this.#o=setTimeout(()=>{this.#o=null,this.#n.classList.add("show"),this.#l._reportTelemetry({action:"alt_text_tooltip"})},r)},{signal:o}),e.addEventListener("mouseleave",()=>{this.#o&&(clearTimeout(this.#o),this.#o=null),this.#n?.classList.remove("show")},{signal:o})}this.#t?i.setAttribute("data-l10n-id","pdfjs-editor-alt-text-decorative-tooltip"):(i.removeAttribute("data-l10n-id"),i.textContent=this.#e),i.parentNode||e.append(i),this.#l.getElementForAltText()?.setAttribute("aria-describedby",i.id)}}class sS{#e=null;#t=!1;#i=null;#r=null;#n=null;#o=null;#s=!1;constructor(e){this.#i=e,this.toolbar=null}render(){if(!this.#i._uiManager.hasCommentManager())return null;const e=this.#e=document.createElement("button");e.className="comment",e.tabIndex="0",e.setAttribute("data-l10n-id","pdfjs-editor-edit-comment-button");const i=this.#i._uiManager._signal;e.addEventListener("contextmenu",Uc,{signal:i}),e.addEventListener("pointerdown",o=>o.stopPropagation(),{signal:i});const r=o=>{o.preventDefault(),this.edit()};return e.addEventListener("click",r,{capture:!0,signal:i}),e.addEventListener("keydown",o=>{o.target===e&&o.key==="Enter"&&(this.#t=!0,r(o))},{signal:i}),e}edit(){const{bottom:e,left:i,right:r}=this.#i.getClientDimensions(),o={top:e};this.#i._uiManager.direction==="ltr"?o.right=r:o.left=i,this.#i._uiManager.editComment(this.#i,o)}finish(){this.#e&&(this.#e.focus({focusVisible:this.#t}),this.#t=!1)}isDeleted(){return this.#s||this.#n===""}hasBeenEdited(){return this.isDeleted()||this.#n!==this.#r}serialize(){return this.data}get data(){return{text:this.#n,date:this.#o,deleted:this.#s}}set data(e){if(e===null){this.#n="",this.#s=!0;return}this.#n=e,this.#o=new Date,this.#s=!1}setInitialText(e){this.#r=e,this.data=e}toggle(e=!1){this.#e&&(this.#e.disabled=!e)}shown(){}destroy(){this.#e?.remove(),this.#e=null,this.#n="",this.#o=null,this.#i=null,this.#t=!1,this.#s=!1}}class BB{#e;#t=!1;#i=null;#r;#n;#o;#s;#a=null;#l;#c=null;#h;#d=null;constructor({container:e,isPinchingDisabled:i=null,isPinchingStopped:r=null,onPinchStart:o=null,onPinching:n=null,onPinchEnd:s=null,signal:a}){this.#e=e,this.#i=r,this.#r=i,this.#n=o,this.#o=n,this.#s=s,this.#h=new AbortController,this.#l=AbortSignal.any([a,this.#h.signal]),e.addEventListener("touchstart",this.#p.bind(this),{passive:!1,signal:this.#l})}get MIN_TOUCH_DISTANCE_TO_PINCH(){return 35/Ku.pixelRatio}#p(e){if(this.#r?.())return;if(e.touches.length===1){if(this.#a)return;const o=this.#a=new AbortController,n=AbortSignal.any([this.#l,o.signal]),s=this.#e,a={capture:!0,signal:n,passive:!1},l=c=>{c.pointerType==="touch"&&(this.#a?.abort(),this.#a=null)};s.addEventListener("pointerdown",c=>{c.pointerType==="touch"&&(Ln(c),l(c))},a),s.addEventListener("pointerup",l,a),s.addEventListener("pointercancel",l,a);return}if(!this.#d){this.#d=new AbortController;const o=AbortSignal.any([this.#l,this.#d.signal]),n=this.#e,s={signal:o,capture:!1,passive:!1};n.addEventListener("touchmove",this.#m.bind(this),s);const a=this.#f.bind(this);n.addEventListener("touchend",a,s),n.addEventListener("touchcancel",a,s),s.capture=!0,n.addEventListener("pointerdown",Ln,s),n.addEventListener("pointermove",Ln,s),n.addEventListener("pointercancel",Ln,s),n.addEventListener("pointerup",Ln,s),this.#n?.()}if(Ln(e),e.touches.length!==2||this.#i?.()){this.#c=null;return}let[i,r]=e.touches;i.identifier>r.identifier&&([i,r]=[r,i]),this.#c={touch0X:i.screenX,touch0Y:i.screenY,touch1X:r.screenX,touch1Y:r.screenY}}#m(e){if(!this.#c||e.touches.length!==2)return;Ln(e);let[i,r]=e.touches;i.identifier>r.identifier&&([i,r]=[r,i]);const{screenX:o,screenY:n}=i,{screenX:s,screenY:a}=r,l=this.#c,{touch0X:c,touch0Y:d,touch1X:u,touch1Y:h}=l,p=u-c,g=h-d,f=s-o,A=a-n,m=Math.hypot(f,A)||1,v=Math.hypot(p,g)||1;if(!this.#t&&Math.abs(v-m)<=BB.MIN_TOUCH_DISTANCE_TO_PINCH)return;if(l.touch0X=o,l.touch0Y=n,l.touch1X=s,l.touch1Y=a,!this.#t){this.#t=!0;return}const y=[(o+s)/2,(n+a)/2];this.#o?.(y,v,m)}#f(e){e.touches.length>=2||(this.#d&&(this.#d.abort(),this.#d=null,this.#s?.()),this.#c&&(Ln(e),this.#c=null,this.#t=!1))}destroy(){this.#h?.abort(),this.#h=null,this.#a?.abort(),this.#a=null}}class xi{#e=null;#t=null;#i=null;#r=null;#n=!1;#o=null;#s="";#a=!1;#l=null;#c=null;#h=null;#d=null;#p="";#m=!1;#f=null;#u=!1;#g=!1;#b=!1;#A=null;#w=0;#x=0;#v=null;#k=null;isSelected=!1;_isCopy=!1;_editToolbar=null;_initialOptions=Object.create(null);_initialData=null;_isVisible=!0;_uiManager=null;_focusEventsAllowed=!0;static _l10n=null;static _l10nResizer=null;#B=!1;#C=xi._zIndex++;static _borderLineWidth=-1;static _colorManager=new wQ;static _zIndex=1;static _telemetryTimeout=1e3;static get _resizerKeyboardManager(){const e=xi.prototype._resizeWithKeyboard,i=k0.TRANSLATE_SMALL,r=k0.TRANSLATE_BIG;return cr(this,"_resizerKeyboardManager",new cb([[["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"],xi.prototype._stopResizingWithKeyboard]]))}constructor(e){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,this.annotationElementId=e.annotationElementId||null;const{rotation:i,rawDims:{pageWidth:r,pageHeight:o,pageX:n,pageY:s}}=this.parent.viewport;this.rotation=i,this.pageRotation=(360+i-this._uiManager.viewParameters.rotation)%360,this.pageDimensions=[r,o],this.pageTranslation=[n,s];const[a,l]=this.parentDimensions;this.x=e.x/a,this.y=e.y/l,this.isAttachedToDOM=!1,this.deleted=!1}get editorType(){return Object.getPrototypeOf(this).constructor._type}get mode(){return Object.getPrototypeOf(this).constructor._editorType}static get isDrawer(){return!1}static get _defaultLineColor(){return cr(this,"_defaultLineColor",this._colorManager.getHexCode("CanvasText"))}static deleteAnnotationElement(e){const i=new CBi({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){if(xi._l10n??=e,xi._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"}),xi._borderLineWidth!==-1)return;const r=getComputedStyle(document.documentElement);xi._borderLineWidth=parseFloat(r.getPropertyValue("--outline-width"))||0}static updateDefaultParams(e,i){}static get defaultPropertiesToUpdate(){return[]}static isHandlingMimeForPasting(e){return!1}static paste(e,i){mo("Not implemented")}get propertiesToUpdate(){return[]}get _isDraggable(){return this.#B}set _isDraggable(e){this.#B=e,this.div?.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=this.#C}setParent(e){e!==null?(this.pageIndex=e.pageIndex,this.pageDimensions=e.pageDimensions):this.#q(),this.parent=e}focusin(e){this._focusEventsAllowed&&(this.#m?this.#m=!1:this.parent.setSelected(this))}focusout(e){!this._focusEventsAllowed||!this.isAttachedToDOM||e.relatedTarget?.closest(`#${this.id}`)||(e.preventDefault(),this.parent?.isMultipleSelection||this.commitOrRemove())}commitOrRemove(){this.isEmpty()?this.remove():this.commit()}commit(){this.isInEditMode()&&this.addToAnnotationStorage()}addToAnnotationStorage(){this._uiManager.addToAnnotationStorage(this)}setAt(e,i,r,o){const[n,s]=this.parentDimensions;[r,o]=this.screenToPageTranslation(r,o),this.x=(e+r)/n,this.y=(i+o)/s,this.fixAndSetPosition()}_moveAfterPaste(e,i){const[r,o]=this.parentDimensions;this.setAt(e*r,i*o,this.width*r,this.height*o),this._onTranslated()}#I([e,i],r,o){[r,o]=this.screenToPageTranslation(r,o),this.x+=r/e,this.y+=o/i,this._onTranslating(this.x,this.y),this.fixAndSetPosition()}translate(e,i){this.#I(this.parentDimensions,e,i)}translateInPage(e,i){this.#f||=[this.x,this.y,this.width,this.height],this.#I(this.pageDimensions,e,i),this.div.scrollIntoView({block:"nearest"})}translationDone(){this._onTranslated(this.x,this.y)}drag(e,i){this.#f||=[this.x,this.y,this.width,this.height];const{div:r,parentDimensions:[o,n]}=this;if(this.x+=e/o,this.y+=i/n,this.parent&&(this.x<0||this.x>1||this.y<0||this.y>1)){const{x:u,y:h}=this.div.getBoundingClientRect();this.parent.findNewParent(this,u,h)&&(this.x-=Math.floor(this.x),this.y-=Math.floor(this.y))}let{x:s,y:a}=this;const[l,c]=this.getBaseTranslation();s+=l,a+=c;const{style:d}=r;d.left=`${(100*s).toFixed(2)}%`,d.top=`${(100*a).toFixed(2)}%`,this._onTranslating(s,a),r.scrollIntoView({block:"nearest"})}_onTranslating(e,i){}_onTranslated(e,i){}get _hasBeenMoved(){return!!this.#f&&(this.#f[0]!==this.x||this.#f[1]!==this.y)}get _hasBeenResized(){return!!this.#f&&(this.#f[2]!==this.width||this.#f[3]!==this.height)}getBaseTranslation(){const[e,i]=this.parentDimensions,{_borderLineWidth:r}=xi,o=r/e,n=r/i;switch(this.rotation){case 90:return[-o,n];case 180:return[o,n];case 270:return[o,-n];default:return[-o,-n]}}get _mustFixPosition(){return!0}fixAndSetPosition(e=this.rotation){const{div:{style:i},pageDimensions:[r,o]}=this;let{x:n,y:s,width:a,height:l}=this;if(a*=r,l*=o,n*=r,s*=o,this._mustFixPosition)switch(e){case 0:n=ja(n,0,r-a),s=ja(s,0,o-l);break;case 90:n=ja(n,0,r-l),s=ja(s,a,o);break;case 180:n=ja(n,a,r),s=ja(s,l,o);break;case 270:n=ja(n,l,r),s=ja(s,0,o-a);break}this.x=n/=r,this.y=s/=o;const[c,d]=this.getBaseTranslation();n+=c,s+=d,i.left=`${(100*n).toFixed(2)}%`,i.top=`${(100*s).toFixed(2)}%`,this.moveInDOM()}static#S(e,i,r){switch(r){case 90:return[i,-e];case 180:return[-e,-i];case 270:return[-i,e];default:return[e,i]}}screenToPageTranslation(e,i){return xi.#S(e,i,this.parentRotation)}pageTranslationToScreen(e,i){return xi.#S(e,i,360-this.parentRotation)}#E(e){switch(e){case 90:{const[i,r]=this.pageDimensions;return[0,-i/r,r/i,0]}case 180:return[-1,0,0,-1];case 270:{const[i,r]=this.pageDimensions;return[0,i/r,-r/i,0]}default:return[1,0,0,1]}}get parentScale(){return this._uiManager.viewParameters.realScale}get parentRotation(){return(this._uiManager.viewParameters.rotation+this.pageRotation)%360}get parentDimensions(){const{parentScale:e,pageDimensions:[i,r]}=this;return[i*e,r*e]}setDims(e,i){const[r,o]=this.parentDimensions,{style:n}=this.div;n.width=`${(100*e/r).toFixed(2)}%`,this.#a||(n.height=`${(100*i/o).toFixed(2)}%`)}fixDims(){const{style:e}=this.div,{height:i,width:r}=e,o=r.endsWith("%"),n=!this.#a&&i.endsWith("%");if(o&&n)return;const[s,a]=this.parentDimensions;o||(e.width=`${(100*parseFloat(r)/s).toFixed(2)}%`),!this.#a&&!n&&(e.height=`${(100*parseFloat(i)/a).toFixed(2)}%`)}getInitialTranslation(){return[0,0]}#P(){if(this.#l)return;this.#l=document.createElement("div"),this.#l.classList.add("resizers");const e=this._willKeepAspectRatio?["topLeft","topRight","bottomRight","bottomLeft"]:["topLeft","topMiddle","topRight","middleRight","bottomRight","bottomMiddle","bottomLeft","middleLeft"],i=this._uiManager._signal;for(const r of e){const o=document.createElement("div");this.#l.append(o),o.classList.add("resizer",r),o.setAttribute("data-resizer-name",r),o.addEventListener("pointerdown",this.#R.bind(this,r),{signal:i}),o.addEventListener("contextmenu",Uc,{signal:i}),o.tabIndex=-1}this.div.prepend(this.#l)}#R(e,i){i.preventDefault();const{isMac:r}=Us.platform;if(i.button!==0||i.ctrlKey&&r)return;this.#i?.toggle(!1);const o=this._isDraggable;this._isDraggable=!1,this.#c=[i.screenX,i.screenY];const n=new AbortController,s=this._uiManager.combinedSignal(n);this.parent.togglePointerEvents(!1),window.addEventListener("pointermove",this.#H.bind(this,e),{passive:!0,capture:!0,signal:s}),window.addEventListener("touchmove",Ln,{passive:!1,signal:s}),window.addEventListener("contextmenu",Uc,{signal:s}),this.#h={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};const a=this.parent.div.style.cursor,l=this.div.style.cursor;this.div.style.cursor=this.parent.div.style.cursor=window.getComputedStyle(i.target).cursor;const c=()=>{n.abort(),this.parent.togglePointerEvents(!0),this.#i?.toggle(!0),this._isDraggable=o,this.parent.div.style.cursor=a,this.div.style.cursor=l,this.#D()};window.addEventListener("pointerup",c,{signal:s}),window.addEventListener("blur",c,{signal:s})}#O(e,i,r,o){this.width=r,this.height=o,this.x=e,this.y=i;const[n,s]=this.parentDimensions;this.setDims(n*r,s*o),this.fixAndSetPosition(),this._onResized()}_onResized(){}#D(){if(!this.#h)return;const{savedX:e,savedY:i,savedWidth:r,savedHeight:o}=this.#h;this.#h=null;const n=this.x,s=this.y,a=this.width,l=this.height;n===e&&s===i&&a===r&&l===o||this.addCommands({cmd:this.#O.bind(this,n,s,a,l),undo:this.#O.bind(this,e,i,r,o),mustExec:!0})}static _round(e){return Math.round(e*1e4)/1e4}#H(e,i){const[r,o]=this.parentDimensions,n=this.x,s=this.y,a=this.width,l=this.height,c=xi.MIN_SIZE/r,d=xi.MIN_SIZE/o,u=this.#E(this.rotation),h=(N,z)=>[u[0]*N+u[2]*z,u[1]*N+u[3]*z],p=this.#E(360-this.rotation),g=(N,z)=>[p[0]*N+p[2]*z,p[1]*N+p[3]*z];let f,A,m=!1,v=!1;switch(e){case"topLeft":m=!0,f=(N,z)=>[0,0],A=(N,z)=>[N,z];break;case"topMiddle":f=(N,z)=>[N/2,0],A=(N,z)=>[N/2,z];break;case"topRight":m=!0,f=(N,z)=>[N,0],A=(N,z)=>[0,z];break;case"middleRight":v=!0,f=(N,z)=>[N,z/2],A=(N,z)=>[0,z/2];break;case"bottomRight":m=!0,f=(N,z)=>[N,z],A=(N,z)=>[0,0];break;case"bottomMiddle":f=(N,z)=>[N/2,z],A=(N,z)=>[N/2,0];break;case"bottomLeft":m=!0,f=(N,z)=>[0,z],A=(N,z)=>[N,0];break;case"middleLeft":v=!0,f=(N,z)=>[0,z/2],A=(N,z)=>[N,z/2];break}const y=f(a,l),b=A(a,l);let w=h(...b);const x=xi._round(n+w[0]),M=xi._round(s+w[1]);let P=1,E=1,S,B;if(i.fromKeyboard)({deltaX:S,deltaY:B}=i);else{const{screenX:N,screenY:z}=i,[G,$]=this.#c;[S,B]=this.screenToPageTranslation(N-G,z-$),this.#c[0]=N,this.#c[1]=z}if([S,B]=g(S/r,B/o),m){const N=Math.hypot(a,l);P=E=Math.max(Math.min(Math.hypot(b[0]-y[0]-S,b[1]-y[1]-B)/N,1/a,1/l),c/a,d/l)}else v?P=ja(Math.abs(b[0]-y[0]-S),c,1)/a:E=ja(Math.abs(b[1]-y[1]-B),d,1)/l;const T=xi._round(a*P),_=xi._round(l*E);w=h(...A(T,_));const U=x-w[0],H=M-w[1];this.#f||=[this.x,this.y,this.width,this.height],this.width=T,this.height=_,this.x=U,this.y=H,this.setDims(r*T,o*_),this.fixAndSetPosition(),this._onResizing()}_onResizing(){}altTextFinish(){this.#i?.finish()}get toolbarButtons(){return null}async addEditToolbar(){if(this._editToolbar||this.#g)return this._editToolbar;this._editToolbar=new My(this),this.div.append(this._editToolbar.render()),this._editToolbar.addButton("comment",this.addCommentButton());const{toolbarButtons:e}=this;if(e)for(const[i,r]of e)await this._editToolbar.addButton(i,r);return this._editToolbar.addButton("delete"),this._editToolbar}removeEditToolbar(){this._editToolbar&&(this._editToolbar.remove(),this._editToolbar=null,this.#i?.destroy())}addContainer(e){const i=this._editToolbar?.div;i?i.before(e):this.div.append(e)}getClientDimensions(){return this.div.getBoundingClientRect()}createAltText(){return this.#i||(Wu.initialize(xi._l10n),this.#i=new Wu(this),this.#e&&(this.#i.data=this.#e,this.#e=null)),this.#i}get altTextData(){return this.#i?.data}set altTextData(e){this.#i&&(this.#i.data=e)}get guessedAltText(){return this.#i?.guessedText}async setGuessedAltText(e){await this.#i?.setGuessedText(e)}serializeAltText(e){return this.#i?.serialize(e)}hasAltText(){return!!this.#i&&!this.#i.isEmpty()}hasAltTextData(){return this.#i?.hasData()??!1}addCommentButton(){return this.#r?this.#r:this.#r=new sS(this)}get commentColor(){return null}get comment(){const e=this.#r;return{text:e.data.text,date:e.data.date,deleted:e.isDeleted(),color:this.commentColor}}set comment(e){this.#r||(this.#r=new sS(this)),this.#r.data=e}setCommentData(e){this.#r||(this.#r=new sS(this)),this.#r.setInitialText(e)}get hasEditedComment(){return this.#r?.hasBeenEdited()}async editComment(){this.#r||(this.#r=new sS(this)),this.#r.edit()}addComment(e){this.hasEditedComment&&(e.popup={contents:this.comment.text,deleted:this.comment.deleted})}render(){const e=this.div=document.createElement("div");e.setAttribute("data-editor-rotation",(360-this.rotation)%360),e.className=this.name,e.setAttribute("id",this.id),e.tabIndex=this.#n?-1:0,e.setAttribute("role","application"),this.defaultL10nId&&e.setAttribute("data-l10n-id",this.defaultL10nId),this._isVisible||e.classList.add("hidden"),this.setInForeground(),this.#G();const[i,r]=this.parentDimensions;this.parentRotation%180!==0&&(e.style.maxWidth=`${(100*r/i).toFixed(2)}%`,e.style.maxHeight=`${(100*i/r).toFixed(2)}%`);const[o,n]=this.getInitialTranslation();return this.translate(o,n),L9e(this,e,["keydown","pointerdown","dblclick"]),this.isResizable&&this._uiManager._supportsPinchToZoom&&(this.#k||=new BB({container:e,isPinchingDisabled:()=>!this.isSelected,onPinchStart:this.#M.bind(this),onPinching:this.#y.bind(this),onPinchEnd:this.#N.bind(this),signal:this._uiManager._signal})),this._uiManager._editorUndoBar?.hide(),e}#M(){this.#h={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height},this.#i?.toggle(!1),this.parent.togglePointerEvents(!1)}#y(e,i,r){let o=.7*(r/i)+1-.7;if(o===1)return;const n=this.#E(this.rotation),s=(w,x)=>[n[0]*w+n[2]*x,n[1]*w+n[3]*x],[a,l]=this.parentDimensions,c=this.x,d=this.y,u=this.width,h=this.height,p=xi.MIN_SIZE/a,g=xi.MIN_SIZE/l;o=Math.max(Math.min(o,1/u,1/h),p/u,g/h);const f=xi._round(u*o),A=xi._round(h*o);if(f===u&&A===h)return;this.#f||=[c,d,u,h];const m=s(u/2,h/2),v=xi._round(c+m[0]),y=xi._round(d+m[1]),b=s(f/2,A/2);this.x=v-b[0],this.y=y-b[1],this.width=f,this.height=A,this.setDims(a*f,l*A),this.fixAndSetPosition(),this._onResizing()}#N(){this.#i?.toggle(!0),this.parent.togglePointerEvents(!0),this.#D()}pointerdown(e){const{isMac:i}=Us.platform;if(e.button!==0||e.ctrlKey&&i){e.preventDefault();return}if(this.#m=!0,this._isDraggable){this.#V(e);return}this.#U(e)}#U(e){const{isMac:i}=Us.platform;e.ctrlKey&&!i||e.shiftKey||e.metaKey&&i?this.parent.toggleSelected(this):this.parent.setSelected(this)}#V(e){const{isSelected:i}=this;this._uiManager.setUpDragSession();let r=!1;const o=new AbortController,n=this._uiManager.combinedSignal(o),s={capture:!0,passive:!1,signal:n},a=c=>{o.abort(),this.#o=null,this.#m=!1,this._uiManager.endDragSession()||this.#U(c),r&&this._onStopDragging()};i&&(this.#w=e.clientX,this.#x=e.clientY,this.#o=e.pointerId,this.#s=e.pointerType,window.addEventListener("pointermove",c=>{r||(r=!0,this._onStartDragging());const{clientX:d,clientY:u,pointerId:h}=c;if(h!==this.#o){Ln(c);return}const[p,g]=this.screenToPageTranslation(d-this.#w,u-this.#x);this.#w=d,this.#x=u,this._uiManager.dragSelectedEditors(p,g)},s),window.addEventListener("touchmove",Ln,s),window.addEventListener("pointerdown",c=>{c.pointerType===this.#s&&(this.#k||c.isPrimary)&&a(c),Ln(c)},s));const l=c=>{if(!this.#o||this.#o===c.pointerId){a(c);return}Ln(c)};window.addEventListener("pointerup",l,{signal:n}),window.addEventListener("blur",l,{signal:n})}_onStartDragging(){}_onStopDragging(){}moveInDOM(){this.#A&&clearTimeout(this.#A),this.#A=setTimeout(()=>{this.#A=null,this.parent?.moveEditorInDOM(this)},0)}_setParentAndPosition(e,i,r){e.changeParent(this),this.x=i,this.y=r,this.fixAndSetPosition(),this._onTranslated()}getRect(e,i,r=this.rotation){const o=this.parentScale,[n,s]=this.pageDimensions,[a,l]=this.pageTranslation,c=e/o,d=i/o,u=this.x*n,h=this.y*s,p=this.width*n,g=this.height*s;switch(r){case 0:return[u+c+a,s-h-d-g+l,u+c+p+a,s-h-d+l];case 90:return[u+d+a,s-h+c+l,u+d+g+a,s-h+c+p+l];case 180:return[u-c-p+a,s-h+d+l,u-c+a,s-h+d+g+l];case 270:return[u-d-g+a,s-h-c-p+l,u-d+a,s-h-c+l];default:throw new Error("Invalid rotation")}}getRectInCurrentCoords(e,i){const[r,o,n,s]=e,a=n-r,l=s-o;switch(this.rotation){case 0:return[r,i-s,a,l];case 90:return[r,i-o,l,a];case 180:return[n,i-o,a,l];case 270:return[n,i-s,l,a];default:throw new Error("Invalid rotation")}}onceAdded(e){}isEmpty(){return!1}enableEditMode(){return this.isInEditMode()?!1:(this.parent.setEditingState(!1),this.#g=!0,!0)}disableEditMode(){return this.isInEditMode()?(this.parent.setEditingState(!0),this.#g=!1,!0):!1}isInEditMode(){return this.#g}shouldGetKeyboardEvents(){return this.#b}needsToBeRebuilt(){return this.div&&!this.isAttachedToDOM}get isOnScreen(){const{top:e,left:i,bottom:r,right:o}=this.getClientDimensions(),{innerHeight:n,innerWidth:s}=window;return i<s&&o>0&&e<n&&r>0}#G(){if(this.#d||!this.div)return;this.#d=new AbortController;const e=this._uiManager.combinedSignal(this.#d);this.div.addEventListener("focusin",this.focusin.bind(this),{signal:e}),this.div.addEventListener("focusout",this.focusout.bind(this),{signal:e})}rebuild(){this.#G()}rotate(e){}resize(){}serializeDeleted(){return{id:this.annotationElementId,deleted:!0,pageIndex:this.pageIndex,popupRef:this._initialData?.popupRef||""}}serialize(e=!1,i=null){mo("An editor must be serializable")}static async deserialize(e,i,r){const o=new this.prototype.constructor({parent:i,id:i.getNextId(),uiManager:r,annotationElementId:e.annotationElementId});o.rotation=e.rotation,o.#e=e.accessibilityData,o._isCopy=e.isCopy||!1;const[n,s]=o.pageDimensions,[a,l,c,d]=o.getRectInCurrentCoords(e.rect,s);return o.x=a/n,o.y=l/s,o.width=c/n,o.height=d/s,o}get hasBeenModified(){return!!this.annotationElementId&&(this.deleted||this.serialize()!==null)}remove(){if(this.#d?.abort(),this.#d=null,this.isEmpty()||this.commit(),this.parent?this.parent.remove(this):this._uiManager.removeEditor(this),this.#A&&(clearTimeout(this.#A),this.#A=null),this.#q(),this.removeEditToolbar(),this.#v){for(const e of this.#v.values())clearTimeout(e);this.#v=null}this.parent=null,this.#k?.destroy(),this.#k=null}get isResizable(){return!1}makeResizable(){this.isResizable&&(this.#P(),this.#l.classList.remove("hidden"))}get toolbarPosition(){return null}keydown(e){if(!this.isResizable||e.target!==this.div||e.key!=="Enter")return;this._uiManager.setSelected(this),this.#h={savedX:this.x,savedY:this.y,savedWidth:this.width,savedHeight:this.height};const i=this.#l.children;if(!this.#t){this.#t=Array.from(i);const s=this.#Q.bind(this),a=this.#z.bind(this),l=this._uiManager._signal;for(const c of this.#t){const d=c.getAttribute("data-resizer-name");c.setAttribute("role","spinbutton"),c.addEventListener("keydown",s,{signal:l}),c.addEventListener("blur",a,{signal:l}),c.addEventListener("focus",this.#_.bind(this,d),{signal:l}),c.setAttribute("data-l10n-id",xi._l10nResizer[d])}}const r=this.#t[0];let o=0;for(const s of i){if(s===r)break;o++}const n=(360-this.rotation+this.parentRotation)%360/90*(this.#t.length/4);if(n!==o){if(n<o)for(let a=0;a<o-n;a++)this.#l.append(this.#l.firstChild);else if(n>o)for(let a=0;a<n-o;a++)this.#l.firstChild.before(this.#l.lastChild);let s=0;for(const a of i){const l=this.#t[s++].getAttribute("data-resizer-name");a.setAttribute("data-l10n-id",xi._l10nResizer[l])}}this.#L(0),this.#b=!0,this.#l.firstChild.focus({focusVisible:!0}),e.preventDefault(),e.stopImmediatePropagation()}#Q(e){xi._resizerKeyboardManager.exec(this,e)}#z(e){this.#b&&e.relatedTarget?.parentNode!==this.#l&&this.#q()}#_(e){this.#p=this.#b?e:""}#L(e){if(this.#t)for(const i of this.#t)i.tabIndex=e}_resizeWithKeyboard(e,i){this.#b&&this.#H(this.#p,{deltaX:e,deltaY:i,fromKeyboard:!0})}#q(){this.#b=!1,this.#L(-1),this.#D()}_stopResizingWithKeyboard(){this.#q(),this.div.focus()}select(){if(!(this.isSelected&&this._editToolbar)){if(this.isSelected=!0,this.makeResizable(),this.div?.classList.add("selectedEditor"),!this._editToolbar){this.addEditToolbar().then(()=>{this.div?.classList.contains("selectedEditor")&&this._editToolbar?.show()});return}this._editToolbar?.show(),this.#i?.toggleAltTextBadge(!1)}}unselect(){this.isSelected&&(this.isSelected=!1,this.#l?.classList.add("hidden"),this.div?.classList.remove("selectedEditor"),this.div?.contains(document.activeElement)&&this._uiManager.currentLayer.div.focus({preventScroll:!0}),this._editToolbar?.hide(),this.#i?.toggleAltTextBadge(!0))}updateParams(e,i){}disableEditing(){}enableEditing(){}get canChangeContent(){return!1}enterInEditMode(){this.canChangeContent&&(this.enableEditMode(),this.div.focus())}dblclick(e){this.enterInEditMode(),this.parent.updateToolbar({mode:this.constructor._editorType,editId:this.id})}getElementForAltText(){return this.div}get contentDiv(){return this.div}get isEditing(){return this.#u}set isEditing(e){this.#u=e,this.parent&&(e?(this.parent.setSelected(this),this.parent.setActiveEditor(this)):this.parent.setActiveEditor(null))}setAspectRatio(e,i){this.#a=!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){this.#v||=new Map;const{action:r}=e;let o=this.#v.get(r);o&&clearTimeout(o),o=setTimeout(()=>{this._reportTelemetry(e),this.#v.delete(r),this.#v.size===0&&(this.#v=null)},xi._telemetryTimeout),this.#v.set(r,o);return}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),this.#n=!1}disable(){this.div&&(this.div.tabIndex=-1),this.#n=!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()}}class CBi extends xi{constructor(e){super(e),this.annotationElementId=e.annotationElementId,this.deleted=!0}serialize(){return this.serializeDeleted()}}const F9e=3285377520,jc=4294901760,Ru=65535;let O9e=class{constructor(t){this.h1=t?t&4294967295:F9e,this.h2=t?t&4294967295:F9e}update(t){let e,i;if(typeof t=="string"){e=new Uint8Array(t.length*2),i=0;for(let g=0,f=t.length;g<f;g++){const A=t.charCodeAt(g);A<=255?e[i++]=A:(e[i++]=A>>>8,e[i++]=A&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,n=new Uint32Array(e.buffer,0,r);let s=0,a=0,l=this.h1,c=this.h2;const d=3432918353,u=461845907,h=d&Ru,p=u&Ru;for(let g=0;g<r;g++)g&1?(s=n[g],s=s*d&jc|s*h&Ru,s=s<<15|s>>>17,s=s*u&jc|s*p&Ru,l^=s,l=l<<13|l>>>19,l=l*5+3864292196):(a=n[g],a=a*d&jc|a*h&Ru,a=a<<15|a>>>17,a=a*u&jc|a*p&Ru,c^=a,c=c<<13|c>>>19,c=c*5+3864292196);switch(s=0,o){case 3:s^=e[r*4+2]<<16;case 2:s^=e[r*4+1]<<8;case 1:s^=e[r*4],s=s*d&jc|s*h&Ru,s=s<<15|s>>>17,s=s*u&jc|s*p&Ru,r&1?l^=s:c^=s}this.h1=l,this.h2=c}hexdigest(){let t=this.h1,e=this.h2;return t^=e>>>1,t=t*3981806797&jc|t*36045&Ru,e=e*4283543511&jc|((e<<16|t>>>16)*2950163797&jc)>>>16,t^=e>>>1,t=t*444984403&jc|t*60499&Ru,e=e*3301882366&jc|((e<<16|t>>>16)*3120437893&jc)>>>16,t^=e>>>1,(t>>>0).toString(16).padStart(8,"0")+(e>>>0).toString(16).padStart(8,"0")}};const dq=Object.freeze({map:null,hash:"",transfer:void 0});class uq{#e=!1;#t=null;#i=new Map;constructor(){this.onSetModified=null,this.onResetModified=null,this.onAnnotationEditor=null}getValue(e,i){const r=this.#i.get(e);return r===void 0?i:Object.assign(i,r)}getRawValue(e){return this.#i.get(e)}remove(e){if(this.#i.delete(e),this.#i.size===0&&this.resetModified(),typeof this.onAnnotationEditor=="function"){for(const i of this.#i.values())if(i instanceof xi)return;this.onAnnotationEditor(null)}}setValue(e,i){const r=this.#i.get(e);let o=!1;if(r!==void 0)for(const[n,s]of Object.entries(i))r[n]!==s&&(o=!0,r[n]=s);else o=!0,this.#i.set(e,i);o&&this.#r(),i instanceof xi&&typeof this.onAnnotationEditor=="function"&&this.onAnnotationEditor(i.constructor._type)}has(e){return this.#i.has(e)}get size(){return this.#i.size}#r(){this.#e||(this.#e=!0,typeof this.onSetModified=="function"&&this.onSetModified())}resetModified(){this.#e&&(this.#e=!1,typeof this.onResetModified=="function"&&this.onResetModified())}get print(){return new N9e(this)}get serializable(){if(this.#i.size===0)return dq;const e=new Map,i=new O9e,r=[],o=Object.create(null);let n=!1;for(const[s,a]of this.#i){const l=a instanceof xi?a.serialize(!1,o):a;l&&(e.set(s,l),i.update(`${s}:${JSON.stringify(l)}`),n||=!!l.bitmap)}if(n)for(const s of e.values())s.bitmap&&r.push(s.bitmap);return e.size>0?{map:e,hash:i.hexdigest(),transfer:r}:dq}get editorStats(){let e=null;const i=new Map;for(const r of this.#i.values()){if(!(r instanceof xi))continue;const o=r.telemetryFinalData;if(!o)continue;const{type:n}=o;i.has(n)||i.set(n,Object.getPrototypeOf(r).constructor),e||=Object.create(null);const s=e[n]||=new Map;for(const[a,l]of Object.entries(o)){if(a==="type")continue;let c=s.get(a);c||(c=new Map,s.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(){this.#t=null}get modifiedIds(){if(this.#t)return this.#t;const e=[];for(const i of this.#i.values())!(i instanceof xi)||!i.annotationElementId||!i.serialize()||e.push(i.annotationElementId);return this.#t={ids:new Set(e),hash:e.join(",")}}[Symbol.iterator](){return this.#i.entries()}}class N9e extends uq{#e;constructor(e){super();const{map:i,hash:r,transfer:o}=e.serializable,n=structuredClone(i,o?{transfer:o}:null);this.#e={map:n,hash:r,transfer:o}}get print(){mo("Should not call PrintAnnotationStorage.print")}get serializable(){return this.#e}get modifiedIds(){return cr(this,"modifiedIds",{ids:new Set,hash:""})}}class kBi{#e=new Set;constructor({ownerDocument:e=globalThis.document,styleElement:i=null}){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(),this.#e.clear(),this.styleElement&&(this.styleElement.remove(),this.styleElement=null)}async loadSystemFont({systemFontInfo:e,disableFontFace:i,_inspectFont:r}){if(!(!e||this.#e.has(e.loadedName))){if(_n(!i,"loadSystemFont shouldn't be called when `disableFontFace` is set."),this.isFontLoadingAPISupported){const{loadedName:o,src:n,style:s}=e,a=new FontFace(o,n,s);this.addNativeFontFace(a);try{await a.load(),this.#e.add(o),r?.(e)}catch{Ki(`Cannot load system font: ${e.baseFontName}, installing it could help to improve PDF rendering.`),this.removeNativeFontFace(a)}return}mo("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 Ki(`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(){const e=!!this._document?.fonts;return cr(this,"isFontLoadingAPISupported",e)}get isSyncFontLoadingSupported(){return cr(this,"isSyncFontLoadingSupported",Ua||Us.platform.isFirefox)}_queueLoadingCallback(e){function i(){for(_n(!o.done,"completeRequest() cannot be called twice."),o.done=!0;r.length>0&&r[0].done;){const n=r.shift();setTimeout(n.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 cr(this,"_loadTestFont",e)}_prepareFontLoadEvent(e,i){function r(y,b){return y.charCodeAt(b)<<24|y.charCodeAt(b+1)<<16|y.charCodeAt(b+2)<<8|y.charCodeAt(b+3)&255}function o(y,b,w,x){const M=y.substring(0,b),P=y.substring(b+w);return M+x+P}let n,s;const a=this._document.createElement("canvas");a.width=1,a.height=1;const l=a.getContext("2d");let c=0;function d(y,b){if(++c>30){Ki("Load test font never loaded."),b();return}if(l.font="30px "+y,l.fillText(".",0,20),l.getImageData(0,0,1,1).data[3]>0){b();return}setTimeout(d.bind(null,y,b))}const u=`lt${Date.now()}${this.loadTestFontId++}`;let h=this._loadTestFont;h=o(h,976,u.length,u);const p=16,g=1482184792;let f=r(h,p);for(n=0,s=u.length-3;n<s;n+=4)f=f-g+r(u,n)|0;n<u.length&&(f=f-g+r(u+"XXX",n)|0),h=o(h,p,4,lBi(f));const A=`url(data:font/opentype;base64,${btoa(h)});`,m=`@font-face {font-family:"${u}";src:${A}}`;this.insertRule(m);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 y of[e.loadedName,u]){const b=this._document.createElement("span");b.textContent="Hi",b.style.fontFamily=y,v.append(b)}this._document.body.append(v),d(u,()=>{v.remove(),i.complete()})}}class MBi{constructor(e,i=null){this.compiledGlyphs=Object.create(null);for(const r in e)this[r]=e[r];this._inspectFont=i}createNativeFontFace(){if(!this.data||this.disableFontFace)return null;let e;if(!this.cssFontInfo)e=new FontFace(this.loadedName,this.data,{});else{const i={weight:this.cssFontInfo.fontWeight};this.cssFontInfo.italicAngle&&(i.style=`oblique ${this.cssFontInfo.italicAngle}deg`),e=new FontFace(this.cssFontInfo.fontFamily,this.data,i)}return this._inspectFont?.(this),e}createFontFaceRule(){if(!this.data||this.disableFontFace)return null;const e=`url(data:${this.mimetype};base64,${D9e(this.data)});`;let i;if(!this.cssFontInfo)i=`@font-face {font-family:"${this.loadedName}";src:${e}}`;else{let r=`font-weight: ${this.cssFontInfo.fontWeight};`;this.cssFontInfo.italicAngle&&(r+=`font-style: oblique ${this.cssFontInfo.italicAngle}deg;`),i=`@font-face {font-family:"${this.cssFontInfo.fontFamily}";${r}src:${e}}`}return this._inspectFont?.(this,e),i}getPathGenerator(e,i){if(this.compiledGlyphs[i]!==void 0)return this.compiledGlyphs[i];const r=this.loadedName+"_path_"+i;let o;try{o=e.get(r)}catch(s){Ki(`getPathGenerator - ignoring character: "${s}".`)}const n=new Path2D(o||"");return this.fontExtraProperties||e.delete(r),this.compiledGlyphs[i]=n}}function PBi(t){if(t instanceof URL)return t.href;if(typeof t=="string"){if(Ua)return t;const e=URL.parse(t,window.location);if(e)return e.href}throw new Error("Invalid PDF url data: either string or URL-object is expected in the url property.")}function EBi(t){if(Ua&&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 sb(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 aS(t){if(typeof t!="string")return null;if(t.endsWith("/"))return t;throw new Error(`Invalid factory url: "${t}" must include trailing slash.`)}const hq=t=>typeof t=="object"&&Number.isInteger(t?.num)&&t.num>=0&&Number.isInteger(t?.gen)&&t.gen>=0,SBi=t=>typeof t=="object"&&typeof t?.name=="string",BBi=pBi.bind(null,hq,SBi);class IBi{#e=new Map;#t=Promise.resolve();postMessage(e,i){const r={data:structuredClone(e,i?{transfer:i}:null)};this.#t.then(()=>{for(const[o]of this.#e)o.call(this,r)})}addEventListener(e,i,r=null){let o=null;if(r?.signal instanceof AbortSignal){const{signal:n}=r;if(n.aborted){Ki("LoopbackPort - cannot use an `aborted` signal.");return}const s=()=>this.removeEventListener(e,i);o=()=>n.removeEventListener("abort",s),n.addEventListener("abort",s)}this.#e.set(i,o)}removeEventListener(e,i){this.#e.get(i)?.(),this.#e.delete(i)}terminate(){for(const[,e]of this.#e)e?.();this.#e.clear()}}const lS={DATA:1,ERROR:2},Fn={CANCEL:1,CANCEL_COMPLETE:2,CLOSE:3,ENQUEUE:4,ERROR:5,PULL:6,PULL_COMPLETE:7,START_COMPLETE:8};function U9e(){}function xl(t){if(t instanceof r0||t instanceof iq||t instanceof B9e||t instanceof rS||t instanceof tq)return t;switch(t instanceof Error||typeof t=="object"&&t!==null||mo('wrapReason: Expected "reason" to be a (possibly cloned) Error.'),t.name){case"AbortException":return new r0(t.message);case"InvalidPDFException":return new iq(t.message);case"PasswordException":return new B9e(t.message,t.code);case"ResponseException":return new rS(t.message,t.status,t.missing);case"UnknownErrorException":return new tq(t.message,t.details)}return new tq(t.message,t.toString())}let db=class{#e=new AbortController;constructor(t,e,i){this.sourceName=t,this.targetName=e,this.comObj=i,this.callbackId=1,this.streamId=1,this.streamSinks=Object.create(null),this.streamControllers=Object.create(null),this.callbackCapabilities=Object.create(null),this.actionHandler=Object.create(null),i.addEventListener("message",this.#t.bind(this),{signal:this.#e.signal})}#t({data:t}){if(t.targetName!==this.sourceName)return;if(t.stream){this.#r(t);return}if(t.callback){const i=t.callbackId,r=this.callbackCapabilities[i];if(!r)throw new Error(`Cannot resolve callback ${i}`);if(delete this.callbackCapabilities[i],t.callback===lS.DATA)r.resolve(t.data);else if(t.callback===lS.ERROR)r.reject(xl(t.reason));else throw new Error("Unexpected callback case");return}const e=this.actionHandler[t.action];if(!e)throw new Error(`Unknown action from worker: ${t.action}`);if(t.callbackId){const i=this.sourceName,r=t.sourceName,o=this.comObj;Promise.try(e,t.data).then(function(n){o.postMessage({sourceName:i,targetName:r,callback:lS.DATA,callbackId:t.callbackId,data:n})},function(n){o.postMessage({sourceName:i,targetName:r,callback:lS.ERROR,callbackId:t.callbackId,reason:xl(n)})});return}if(t.streamId){this.#i(t);return}e(t.data)}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(n){o.reject(n)}return o.promise}sendWithStream(t,e,i,r){const o=this.streamId++,n=this.sourceName,s=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:n,targetName:s,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:n,targetName:s,stream:Fn.PULL,streamId:o,desiredSize:l.desiredSize}),c.promise},cancel:l=>{_n(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:n,targetName:s,stream:Fn.CANCEL,streamId:o,reason:xl(l)}),c.promise}},i)}#i(t){const e=t.streamId,i=this.sourceName,r=t.sourceName,o=this.comObj,n=this,s=this.actionHandler[t.action],a={enqueue(l,c=1,d){if(this.isCancelled)return;const u=this.desiredSize;this.desiredSize-=c,u>0&&this.desiredSize<=0&&(this.sinkCapability=Promise.withResolvers(),this.ready=this.sinkCapability.promise),o.postMessage({sourceName:i,targetName:r,stream:Fn.ENQUEUE,streamId:e,chunk:l},d)},close(){this.isCancelled||(this.isCancelled=!0,o.postMessage({sourceName:i,targetName:r,stream:Fn.CLOSE,streamId:e}),delete n.streamSinks[e])},error(l){_n(l instanceof Error,"error must have a valid reason"),!this.isCancelled&&(this.isCancelled=!0,o.postMessage({sourceName:i,targetName:r,stream:Fn.ERROR,streamId:e,reason:xl(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,Promise.try(s,t.data,a).then(function(){o.postMessage({sourceName:i,targetName:r,stream:Fn.START_COMPLETE,streamId:e,success:!0})},function(l){o.postMessage({sourceName:i,targetName:r,stream:Fn.START_COMPLETE,streamId:e,reason:xl(l)})})}#r(t){const e=t.streamId,i=this.sourceName,r=t.sourceName,o=this.comObj,n=this.streamControllers[e],s=this.streamSinks[e];switch(t.stream){case Fn.START_COMPLETE:t.success?n.startCall.resolve():n.startCall.reject(xl(t.reason));break;case Fn.PULL_COMPLETE:t.success?n.pullCall.resolve():n.pullCall.reject(xl(t.reason));break;case Fn.PULL:if(!s){o.postMessage({sourceName:i,targetName:r,stream:Fn.PULL_COMPLETE,streamId:e,success:!0});break}s.desiredSize<=0&&t.desiredSize>0&&s.sinkCapability.resolve(),s.desiredSize=t.desiredSize,Promise.try(s.onPull||U9e).then(function(){o.postMessage({sourceName:i,targetName:r,stream:Fn.PULL_COMPLETE,streamId:e,success:!0})},function(l){o.postMessage({sourceName:i,targetName:r,stream:Fn.PULL_COMPLETE,streamId:e,reason:xl(l)})});break;case Fn.ENQUEUE:if(_n(n,"enqueue should have stream controller"),n.isClosed)break;n.controller.enqueue(t.chunk);break;case Fn.CLOSE:if(_n(n,"close should have stream controller"),n.isClosed)break;n.isClosed=!0,n.controller.close(),this.#n(n,e);break;case Fn.ERROR:_n(n,"error should have stream controller"),n.controller.error(xl(t.reason)),this.#n(n,e);break;case Fn.CANCEL_COMPLETE:t.success?n.cancelCall.resolve():n.cancelCall.reject(xl(t.reason)),this.#n(n,e);break;case Fn.CANCEL:if(!s)break;const a=xl(t.reason);Promise.try(s.onCancel||U9e,a).then(function(){o.postMessage({sourceName:i,targetName:r,stream:Fn.CANCEL_COMPLETE,streamId:e,success:!0})},function(l){o.postMessage({sourceName:i,targetName:r,stream:Fn.CANCEL_COMPLETE,streamId:e,reason:xl(l)})}),s.sinkCapability.reject(a),s.isCancelled=!0,delete this.streamSinks[e];break;default:throw new Error("Unexpected stream case")}}async#n(t,e){await Promise.allSettled([t.startCall?.promise,t.pullCall?.promise,t.cancelCall?.promise]),delete this.streamControllers[e]}destroy(){this.#e?.abort(),this.#e=null}};class j9e{#e=!1;constructor({enableHWA:e=!1}){this.#e=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:!this.#e})}}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){mo("Abstract method `_createCanvas` called.")}}class TBi extends j9e{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}}class H9e{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":"");return this._fetch(i).then(r=>({cMapData:r,isCompressed:this.isCompressed})).catch(r=>{throw new Error(`Unable to load ${this.isCompressed?"binary ":""}CMap at: ${i}`)})}async _fetch(e){mo("Abstract method `_fetch` called.")}}class V9e extends H9e{async _fetch(e){const i=await ab(e,this.isCompressed?"arraybuffer":"text");return i instanceof ArrayBuffer?new Uint8Array(i):sb(i)}}class z9e{addFilter(e){return"none"}addHCMFilter(e,i){return"none"}addAlphaFilter(e){return"none"}addLuminosityFilter(e){return"none"}addHighlightHCMFilter(e,i,r,o,n){return"none"}destroy(e=!1){}}class RBi extends z9e{#e;#t;#i;#r;#n;#o;#s=0;constructor({docId:e,ownerDocument:i=globalThis.document}){super(),this.#r=e,this.#n=i}get#a(){return this.#t||=new Map}get#l(){return this.#o||=new Map}get#c(){if(!this.#i){const e=this.#n.createElement("div"),{style:i}=e;i.visibility="hidden",i.contain="strict",i.width=i.height=0,i.position="absolute",i.top=i.left=0,i.zIndex=-1;const r=this.#n.createElementNS(c1,"svg");r.setAttribute("width",0),r.setAttribute("height",0),this.#i=this.#n.createElementNS(c1,"defs"),e.append(r),r.append(this.#i),this.#n.body.append(e)}return this.#i}#h(e){if(e.length===1){const l=e[0],c=new Array(256);for(let u=0;u<256;u++)c[u]=l[u]/255;const d=c.join(",");return[d,d,d]}const[i,r,o]=e,n=new Array(256),s=new Array(256),a=new Array(256);for(let l=0;l<256;l++)n[l]=i[l]/255,s[l]=r[l]/255,a[l]=o[l]/255;return[n.join(","),s.join(","),a.join(",")]}#d(e){if(this.#e===void 0){this.#e="";const i=this.#n.URL;i!==this.#n.baseURI&&(oS(i)?Ki('#createUrl: ignore "data:"-URL for performance reasons.'):this.#e=S9e(i,""))}return`url(${this.#e}#${e})`}addFilter(e){if(!e)return"none";let i=this.#a.get(e);if(i)return i;const[r,o,n]=this.#h(e),s=e.length===1?r:`${r}${o}${n}`;if(i=this.#a.get(s),i)return this.#a.set(e,i),i;const a=`g_${this.#r}_transfer_map_${this.#s++}`,l=this.#d(a);this.#a.set(e,l),this.#a.set(s,l);const c=this.#f(a);return this.#g(r,o,n,c),l}addHCMFilter(e,i){const r=`${e}-${i}`,o="base";let n=this.#l.get(o);if(n?.key===r||(n?(n.filter?.remove(),n.key=r,n.url="none",n.filter=null):(n={key:r,url:"none",filter:null},this.#l.set(o,n)),!e||!i))return n.url;const s=this.#A(e);e=bi.makeHexColor(...s);const a=this.#A(i);if(i=bi.makeHexColor(...a),this.#c.style.color="",e==="#000000"&&i==="#ffffff"||e===i)return n.url;const l=new Array(256);for(let p=0;p<=255;p++){const g=p/255;l[p]=g<=.03928?g/12.92:((g+.055)/1.055)**2.4}const c=l.join(","),d=`g_${this.#r}_hcm_filter`,u=n.filter=this.#f(d);this.#g(c,c,c,u),this.#m(u);const h=(p,g)=>{const f=s[p]/255,A=a[p]/255,m=new Array(g+1);for(let v=0;v<=g;v++)m[v]=f+v/g*(A-f);return m.join(",")};return this.#g(h(0,5),h(1,5),h(2,5),u),n.url=this.#d(d),n.url}addAlphaFilter(e){let i=this.#a.get(e);if(i)return i;const[r]=this.#h([e]),o=`alpha_${r}`;if(i=this.#a.get(o),i)return this.#a.set(e,i),i;const n=`g_${this.#r}_alpha_map_${this.#s++}`,s=this.#d(n);this.#a.set(e,s),this.#a.set(o,s);const a=this.#f(n);return this.#b(r,a),s}addLuminosityFilter(e){let i=this.#a.get(e||"luminosity");if(i)return i;let r,o;if(e?([r]=this.#h([e]),o=`luminosity_${r}`):o="luminosity",i=this.#a.get(o),i)return this.#a.set(e,i),i;const n=`g_${this.#r}_luminosity_map_${this.#s++}`,s=this.#d(n);this.#a.set(e,s),this.#a.set(o,s);const a=this.#f(n);return this.#p(a),e&&this.#b(r,a),s}addHighlightHCMFilter(e,i,r,o,n){const s=`${i}-${r}-${o}-${n}`;let a=this.#l.get(e);if(a?.key===s||(a?(a.filter?.remove(),a.key=s,a.url="none",a.filter=null):(a={key:s,url:"none",filter:null},this.#l.set(e,a)),!i||!r))return a.url;const[l,c]=[i,r].map(this.#A.bind(this));let d=Math.round(.2126*l[0]+.7152*l[1]+.0722*l[2]),u=Math.round(.2126*c[0]+.7152*c[1]+.0722*c[2]),[h,p]=[o,n].map(this.#A.bind(this));u<d&&([d,u,h,p]=[u,d,p,h]),this.#c.style.color="";const g=(m,v,y)=>{const b=new Array(256),w=(u-d)/y,x=m/255,M=(v-m)/(255*y);let P=0;for(let E=0;E<=y;E++){const S=Math.round(d+E*w),B=x+E*M;for(let T=P;T<=S;T++)b[T]=B;P=S+1}for(let E=P;E<256;E++)b[E]=b[P-1];return b.join(",")},f=`g_${this.#r}_hcm_${e}_filter`,A=a.filter=this.#f(f);return this.#m(A),this.#g(g(h[0],p[0],5),g(h[1],p[1],5),g(h[2],p[2],5),A),a.url=this.#d(f),a.url}destroy(e=!1){e&&this.#o?.size||(this.#i?.parentNode.parentNode.remove(),this.#i=null,this.#t?.clear(),this.#t=null,this.#o?.clear(),this.#o=null,this.#s=0)}#p(e){const i=this.#n.createElementNS(c1,"feColorMatrix");i.setAttribute("type","matrix"),i.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"),e.append(i)}#m(e){const i=this.#n.createElementNS(c1,"feColorMatrix");i.setAttribute("type","matrix"),i.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"),e.append(i)}#f(e){const i=this.#n.createElementNS(c1,"filter");return i.setAttribute("color-interpolation-filters","sRGB"),i.setAttribute("id",e),this.#c.append(i),i}#u(e,i,r){const o=this.#n.createElementNS(c1,i);o.setAttribute("type","discrete"),o.setAttribute("tableValues",r),e.append(o)}#g(e,i,r,o){const n=this.#n.createElementNS(c1,"feComponentTransfer");o.append(n),this.#u(n,"feFuncR",e),this.#u(n,"feFuncG",i),this.#u(n,"feFuncB",r)}#b(e,i){const r=this.#n.createElementNS(c1,"feComponentTransfer");i.append(r),this.#u(r,"feFuncA",e)}#A(e){return this.#c.style.color=e,nS(getComputedStyle(this.#c).getPropertyValue("color"))}}class q9e{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._fetch(i).catch(r=>{throw new Error(`Unable to load font data at: ${i}`)})}async _fetch(e){mo("Abstract method `_fetch` called.")}}class G9e extends q9e{async _fetch(e){const i=await ab(e,"arraybuffer");return new Uint8Array(i)}}class Q9e{constructor({baseUrl:e=null}){this.baseUrl=e}async fetch({filename:e}){if(!this.baseUrl)throw new Error("Ensure that the `wasmUrl` API parameter is provided.");if(!e)throw new Error("Wasm filename must be specified.");const i=`${this.baseUrl}${e}`;return this._fetch(i).catch(r=>{throw new Error(`Unable to load wasm data at: ${i}`)})}async _fetch(e){mo("Abstract method `_fetch` called.")}}class K9e extends Q9e{async _fetch(e){const i=await ab(e,"arraybuffer");return new Uint8Array(i)}}Ua&&Ki("Please use the `legacy` build in Node.js environments.");async function pq(t){const e=await process.getBuiltinModule("fs").promises.readFile(t);return new Uint8Array(e)}class DBi extends z9e{}class _Bi extends j9e{_createCanvas(e,i){return process.getBuiltinModule("module").createRequire(import.meta.url)("@napi-rs/canvas").createCanvas(e,i)}}class LBi extends H9e{async _fetch(e){return pq(e)}}class FBi extends q9e{async _fetch(e){return pq(e)}}class OBi extends Q9e{async _fetch(e){return pq(e)}}const js={FILL:"Fill",STROKE:"Stroke",SHADING:"Shading"};function fq(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 gq{isModifyingCurrentTransform(){return!1}getPattern(){mo("Abstract method `getPattern` called.")}}class NBi extends gq{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 n;if(o===js.STROKE||o===js.FILL){const s=i.current.getClippedPathBoundingBox(o,Xo(e))||[0,0,0,0],a=Math.ceil(s[2]-s[0])||1,l=Math.ceil(s[3]-s[1])||1,c=i.cachedCanvases.getCanvas("pattern",a,l),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(-s[0],-s[1]),r=bi.transform(r,[1,0,0,1,s[0],s[1]]),d.transform(...i.baseTransform),this.matrix&&d.transform(...this.matrix),fq(d,this._bbox),d.fillStyle=this._createGradient(d),d.fill(),n=e.createPattern(c.canvas,"no-repeat");const u=new DOMMatrix(r);n.setTransform(u)}else fq(e,this._bbox),n=this._createGradient(e);return n}}function mq(t,e,i,r,o,n,s,a){const l=e.coords,c=e.colors,d=t.data,u=t.width*4;let h;l[i+1]>l[r+1]&&(h=i,i=r,r=h,h=n,n=s,s=h),l[r+1]>l[o+1]&&(h=r,r=o,o=h,h=s,s=a,a=h),l[i+1]>l[r+1]&&(h=i,i=r,r=h,h=n,n=s,s=h);const p=(l[i]+e.offsetX)*e.scaleX,g=(l[i+1]+e.offsetY)*e.scaleY,f=(l[r]+e.offsetX)*e.scaleX,A=(l[r+1]+e.offsetY)*e.scaleY,m=(l[o]+e.offsetX)*e.scaleX,v=(l[o+1]+e.offsetY)*e.scaleY;if(g>=v)return;const y=c[n],b=c[n+1],w=c[n+2],x=c[s],M=c[s+1],P=c[s+2],E=c[a],S=c[a+1],B=c[a+2],T=Math.round(g),_=Math.round(v);let U,H,N,z,G,$,ae,le;for(let me=T;me<=_;me++){if(me<A){const Y=me<g?0:(g-me)/(g-A);U=p-(p-f)*Y,H=y-(y-x)*Y,N=b-(b-M)*Y,z=w-(w-P)*Y}else{let Y;me>v?Y=1:A===v?Y=0:Y=(A-me)/(A-v),U=f-(f-m)*Y,H=x-(x-E)*Y,N=M-(M-S)*Y,z=P-(P-B)*Y}let Ee;me<g?Ee=0:me>v?Ee=1:Ee=(g-me)/(g-v),G=p-(p-m)*Ee,$=y-(y-E)*Ee,ae=b-(b-S)*Ee,le=w-(w-B)*Ee;const ie=Math.round(Math.min(U,G)),se=Math.round(Math.max(U,G));let re=u*me+ie*4;for(let Y=ie;Y<=se;Y++)Ee=(U-Y)/(U-G),Ee<0?Ee=0:Ee>1&&(Ee=1),d[re++]=H-(H-$)*Ee|0,d[re++]=N-(N-ae)*Ee|0,d[re++]=z-(z-le)*Ee|0,d[re++]=255}}function UBi(t,e,i){const r=e.coords,o=e.colors;let n,s;switch(e.type){case"lattice":const a=e.verticesPerRow,l=Math.floor(r.length/a)-1,c=a-1;for(n=0;n<l;n++){let d=n*a;for(let u=0;u<c;u++,d++)mq(t,i,r[d],r[d+1],r[d+a],o[d],o[d+1],o[d+a]),mq(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(n=0,s=r.length;n<s;n+=3)mq(t,i,r[n],r[n+1],r[n+2],o[n],o[n+1],o[n+2]);break;default:throw new Error("illegal figure")}}class jBi extends gq{constructor(e){super(),this._coords=e[2],this._colors=e[3],this._figures=e[4],this._bounds=e[5],this._bbox=e[6],this._background=e[7],this.matrix=null}_createMeshCanvas(e,i,r){const o=Math.floor(this._bounds[0]),n=Math.floor(this._bounds[1]),s=Math.ceil(this._bounds[2])-o,a=Math.ceil(this._bounds[3])-n,l=Math.min(Math.ceil(Math.abs(s*e[0]*1.1)),3e3),c=Math.min(Math.ceil(Math.abs(a*e[1]*1.1)),3e3),d=s/l,u=a/c,h={coords:this._coords,colors:this._colors,offsetX:-o,offsetY:-n,scaleX:1/d,scaleY:1/u},p=l+4,g=c+4,f=r.getCanvas("mesh",p,g),A=f.context,m=A.createImageData(l,c);if(i){const v=m.data;for(let y=0,b=v.length;y<b;y+=4)v[y]=i[0],v[y+1]=i[1],v[y+2]=i[2],v[y+3]=255}for(const v of this._figures)UBi(m,v,h);return A.putImageData(m,2,2),{canvas:f.canvas,offsetX:o-2*d,offsetY:n-2*u,scaleX:d,scaleY:u}}isModifyingCurrentTransform(){return!0}getPattern(e,i,r,o){fq(e,this._bbox);const n=new Float32Array(2);if(o===js.SHADING)bi.singularValueDecompose2dScale(Xo(e),n);else if(this.matrix){bi.singularValueDecompose2dScale(this.matrix,n);const[a,l]=n;bi.singularValueDecompose2dScale(i.baseTransform,n),n[0]*=a,n[1]*=l}else bi.singularValueDecompose2dScale(i.baseTransform,n);const s=this._createMeshCanvas(n,o===js.SHADING?null:this._background,i.cachedCanvases);return o!==js.SHADING&&(e.setTransform(...i.baseTransform),this.matrix&&e.transform(...this.matrix)),e.translate(s.offsetX,s.offsetY),e.scale(s.scaleX,s.scaleY),e.createPattern(s.canvas,"no-repeat")}}class HBi extends gq{getPattern(){return"hotpink"}}function VBi(t){switch(t[0]){case"RadialAxial":return new NBi(t);case"Mesh":return new jBi(t);case"Dummy":return new HBi}throw new Error(`Unknown IR type: ${t[0]}`)}const W9e={COLORED:1,UNCOLORED:2};class xQ{static MAX_PATTERN_SIZE=3e3;constructor(e,i,r,o){this.color=e[1],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.ctx=i,this.canvasGraphicsFactory=r,this.baseTransform=o}createPatternCanvas(e){const{bbox:i,operatorList:r,paintType:o,tilingType:n,color:s,canvasGraphicsFactory:a}=this;let{xstep:l,ystep:c}=this;l=Math.abs(l),c=Math.abs(c),iS("TilingType: "+n);const d=i[0],u=i[1],h=i[2],p=i[3],g=h-d,f=p-u,A=new Float32Array(2);bi.singularValueDecompose2dScale(this.matrix,A);const[m,v]=A;bi.singularValueDecompose2dScale(this.baseTransform,A);const y=m*A[0],b=v*A[1];let w=g,x=f,M=!1,P=!1;const E=Math.ceil(l*y),S=Math.ceil(c*b),B=Math.ceil(g*y),T=Math.ceil(f*b);E>=B?w=l:M=!0,S>=T?x=c:P=!0;const _=this.getSizeAndScale(w,this.ctx.canvas.width,y),U=this.getSizeAndScale(x,this.ctx.canvas.height,b),H=e.cachedCanvases.getCanvas("pattern",_.size,U.size),N=H.context,z=a.createCanvasGraphics(N);if(z.groupLevel=e.groupLevel,this.setFillAndStrokeStyleToContext(z,o,s),N.translate(-_.scale*d,-U.scale*u),z.transform(_.scale,0,0,U.scale,0,0),N.save(),this.clipBbox(z,d,u,h,p),z.baseTransform=Xo(z.ctx),z.executeOperatorList(r),z.endDrawing(),N.restore(),M||P){const G=H.canvas;M&&(w=l),P&&(x=c);const $=this.getSizeAndScale(w,this.ctx.canvas.width,y),ae=this.getSizeAndScale(x,this.ctx.canvas.height,b),le=$.size,me=ae.size,Ee=e.cachedCanvases.getCanvas("pattern-workaround",le,me),ie=Ee.context,se=M?Math.floor(g/l):0,re=P?Math.floor(f/c):0;for(let Y=0;Y<=se;Y++)for(let ce=0;ce<=re;ce++)ie.drawImage(G,le*Y,me*ce,le,me,0,0,le,me);return{canvas:Ee.canvas,scaleX:$.scale,scaleY:ae.scale,offsetX:d,offsetY:u}}return{canvas:H.canvas,scaleX:_.scale,scaleY:U.scale,offsetX:d,offsetY:u}}getSizeAndScale(e,i,r){const o=Math.max(xQ.MAX_PATTERN_SIZE,i);let n=Math.ceil(e*r);return n>=o?n=o:r=n/e,{scale:r,size:n}}clipBbox(e,i,r,o,n){const s=o-i,a=n-r;e.ctx.rect(i,r,s,a),bi.axialAlignedBoundingBox([i,r,o,n],Xo(e.ctx),e.current.minMax),e.clip(),e.endPath()}setFillAndStrokeStyleToContext(e,i,r){const o=e.ctx,n=e.current;switch(i){case W9e.COLORED:const{fillStyle:s,strokeStyle:a}=this.ctx;o.fillStyle=n.fillColor=s,o.strokeStyle=n.strokeColor=a;break;case W9e.UNCOLORED:o.fillStyle=o.strokeStyle=r,n.fillColor=n.strokeColor=r;break;default:throw new aBi(`Unsupported paint type: ${i}`)}}isModifyingCurrentTransform(){return!1}getPattern(e,i,r,o){let n=r;o!==js.SHADING&&(n=bi.transform(n,i.baseTransform),this.matrix&&(n=bi.transform(n,this.matrix)));const s=this.createPatternCanvas(i);let a=new DOMMatrix(n);a=a.translate(s.offsetX,s.offsetY),a=a.scale(1/s.scaleX,1/s.scaleY);const l=e.createPattern(s.canvas,"repeat");return l.setTransform(a),l}}function zBi({src:t,srcPos:e=0,dest:i,width:r,height:o,nonBlackColor:n=4294967295,inverseDecode:s=!1}){const a=Us.isLittleEndian?4278190080:255,[l,c]=s?[n,a]:[a,n],d=r>>3,u=r&7,h=t.length;i=new Uint32Array(i.buffer);let p=0;for(let g=0;g<o;g++){for(const A=e+d;e<A;e++){const m=e<h?t[e]:255;i[p++]=m&128?c:l,i[p++]=m&64?c:l,i[p++]=m&32?c:l,i[p++]=m&16?c:l,i[p++]=m&8?c:l,i[p++]=m&4?c:l,i[p++]=m&2?c:l,i[p++]=m&1?c:l}if(u===0)continue;const f=e<h?t[e++]:255;for(let A=0;A<u;A++)i[p++]=f&1<<7-A?c:l}return{srcPos:e,destPos:p}}const Z9e=16,J9e=100,qBi=15,X9e=10,Cl=16,Aq=new DOMMatrix,sc=new Float32Array(2),F5=new Float32Array([1/0,1/0,-1/0,-1/0]);function GBi(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,n,s,a){e.transform(i,r,o,n,s,a),this.__originalTransform(i,r,o,n,s,a)},t.setTransform=function(i,r,o,n,s,a){e.setTransform(i,r,o,n,s,a),this.__originalSetTransform(i,r,o,n,s,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,n,s,a){e.bezierCurveTo(i,r,o,n,s,a),this.__originalBezierCurveTo(i,r,o,n,s,a)},t.rect=function(i,r,o,n){e.rect(i,r,o,n),this.__originalRect(i,r,o,n)},t.closePath=function(){e.closePath(),this.__originalClosePath()},t.beginPath=function(){e.beginPath(),this.__originalBeginPath()}}class QBi{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 cS(t,e,i,r,o,n,s,a,l,c){const[d,u,h,p,g,f]=Xo(t);if(u===0&&h===0){const v=s*d+g,y=Math.round(v),b=a*p+f,w=Math.round(b),x=(s+l)*d+g,M=Math.abs(Math.round(x)-y)||1,P=(a+c)*p+f,E=Math.abs(Math.round(P)-w)||1;return t.setTransform(Math.sign(d),0,0,Math.sign(p),y,w),t.drawImage(e,i,r,o,n,0,0,M,E),t.setTransform(d,u,h,p,g,f),[M,E]}if(d===0&&p===0){const v=a*h+g,y=Math.round(v),b=s*u+f,w=Math.round(b),x=(a+c)*h+g,M=Math.abs(Math.round(x)-y)||1,P=(s+l)*u+f,E=Math.abs(Math.round(P)-w)||1;return t.setTransform(0,Math.sign(u),Math.sign(h),0,y,w),t.drawImage(e,i,r,o,n,0,0,E,M),t.setTransform(d,u,h,p,g,f),[E,M]}t.drawImage(e,i,r,o,n,s,a,l,c);const A=Math.hypot(d,u),m=Math.hypot(h,p);return[A*l,m*c]}class Y9e{alphaIsShape=!1;fontSize=0;fontSizeScale=1;textMatrix=null;textMatrixScale=1;fontMatrix=$z;leading=0;x=0;y=0;lineX=0;lineY=0;charSpacing=0;wordSpacing=0;textHScale=1;textRenderingMode=fa.FILL;textRise=0;fillColor="#000000";strokeColor="#000000";patternFill=!1;patternStroke=!1;fillAlpha=1;strokeAlpha=1;lineWidth=1;activeSMask=null;transferMaps="none";constructor(e,i){this.clipBox=new Float32Array([0,0,e,i]),this.minMax=F5.slice()}clone(){const e=Object.create(this);return e.clipBox=this.clipBox.slice(),e.minMax=this.minMax.slice(),e}getPathBoundingBox(e=js.FILL,i=null){const r=this.minMax.slice();if(e===js.STROKE){i||mo("Stroke bounding box must include transform."),bi.singularValueDecompose2dScale(i,sc);const o=sc[0]*this.lineWidth/2,n=sc[1]*this.lineWidth/2;r[0]-=o,r[1]-=n,r[2]+=o,r[3]+=n}return r}updateClipFromPath(){const e=bi.intersect(this.clipBox,this.getPathBoundingBox());this.startNewPathAndClipBox(e||[0,0,0,0])}isEmptyClip(){return this.minMax[0]===1/0}startNewPathAndClipBox(e){this.clipBox.set(e,0),this.minMax.set(F5,0)}getClippedPathBoundingBox(e=js.FILL,i=null){return bi.intersect(this.clipBox,this.getPathBoundingBox(e,i))}}function $9e(t,e){if(e instanceof ImageData){t.putImageData(e,0,0);return}const i=e.height,r=e.width,o=i%Cl,n=(i-o)/Cl,s=o===0?n:n+1,a=t.createImageData(r,Cl);let l=0,c;const d=e.data,u=a.data;let h,p,g,f;if(e.kind===XE.GRAYSCALE_1BPP){const A=d.byteLength,m=new Uint32Array(u.buffer,0,u.byteLength>>2),v=m.length,y=r+7>>3,b=4294967295,w=Us.isLittleEndian?4278190080:255;for(h=0;h<s;h++){for(g=h<n?Cl:o,c=0,p=0;p<g;p++){const x=A-l;let M=0;const P=x>y?r:x*8-7,E=P&-8;let S=0,B=0;for(;M<E;M+=8)B=d[l++],m[c++]=B&128?b:w,m[c++]=B&64?b:w,m[c++]=B&32?b:w,m[c++]=B&16?b:w,m[c++]=B&8?b:w,m[c++]=B&4?b:w,m[c++]=B&2?b:w,m[c++]=B&1?b:w;for(;M<P;M++)S===0&&(B=d[l++],S=128),m[c++]=B&S?b:w,S>>=1}for(;c<v;)m[c++]=0;t.putImageData(a,0,h*Cl)}}else if(e.kind===XE.RGBA_32BPP){for(p=0,f=r*Cl*4,h=0;h<n;h++)u.set(d.subarray(l,l+f)),l+=f,t.putImageData(a,0,p),p+=Cl;h<s&&(f=r*o*4,u.set(d.subarray(l,l+f)),t.putImageData(a,0,p))}else if(e.kind===XE.RGB_24BPP)for(g=Cl,f=r*g,h=0;h<s;h++){for(h>=n&&(g=o,f=r*g),c=0,p=f;p--;)u[c++]=d[l++],u[c++]=d[l++],u[c++]=d[l++],u[c++]=255;t.putImageData(a,0,h*Cl)}else throw new Error(`bad image kind: ${e.kind}`)}function e7e(t,e){if(e.bitmap){t.drawImage(e.bitmap,0,0);return}const i=e.height,r=e.width,o=i%Cl,n=(i-o)/Cl,s=o===0?n:n+1,a=t.createImageData(r,Cl);let l=0;const c=e.data,d=a.data;for(let u=0;u<s;u++){const h=u<n?Cl:o;({srcPos:l}=zBi({src:c,srcPos:l,dest:d,width:r,height:h,nonBlackColor:0})),t.putImageData(a,0,u*Cl)}}function ub(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 dS(t){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);const{filter:e}=t;e!=="none"&&e!==""&&(t.filter="none")}function t7e(t,e){if(e)return!0;bi.singularValueDecompose2dScale(t,sc);const i=Math.fround(Ku.pixelRatio*L5.PDF_TO_CSS_UNITS);return sc[0]<=i&&sc[1]<=i}const KBi=["butt","round","square"],WBi=["miter","round","bevel"],ZBi={},i7e={};class m6{constructor(e,i,r,o,n,{optionalContentConfig:s,markedContentStack:a=null},l,c){this.ctx=e,this.current=new Y9e(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=n,this.groupStack=[],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=s,this.cachedCanvases=new QBi(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 n=this.ctx.canvas.width,s=this.ctx.canvas.height,a=this.ctx.fillStyle;if(this.ctx.fillStyle=o||"#ffffff",this.ctx.fillRect(0,0,n,s),this.ctx.fillStyle=a,r){const l=this.cachedCanvases.getCanvas("transparent",n,s);this.compositeCtx=this.ctx,this.transparentCanvas=l.canvas,this.ctx=l.context,this.ctx.save(),this.ctx.transform(...Xo(this.compositeCtx))}this.ctx.save(),dS(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=Xo(this.ctx)}executeOperatorList(e,i,r,o){const n=e.argsArray,s=e.fnArray;let a=i||0;const l=n.length;if(l===a)return a;const c=l-a>X9e&&typeof r=="function",d=c?Date.now()+qBi:0;let u=0;const h=this.commonObjs,p=this.objs;let g;for(;;){if(o!==void 0&&a===o.nextBreakPoint)return o.breakIt(a,r),a;if(g=s[a],g!==$E.dependency)this[g].apply(this,n[a]);else for(const f of n[a]){const A=f.startsWith("g_")?h:p;if(!A.has(f))return A.get(f,r),a}if(a++,a===l)return a;if(c&&++u>X9e){if(Date.now()>d)return r(),a;u=0}}}#e(){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)}endDrawing(){this.#e(),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.#t()}#t(){if(this.pageColors){const e=this.filterFactory.addHCMFilter(this.pageColors.foreground,this.pageColors.background);if(e!=="none"){const i=this.ctx.filter;this.ctx.filter=e,this.ctx.drawImage(this.ctx.canvas,0,0),this.ctx.filter=i}}}_scaleImage(e,i){const r=e.width??e.displayWidth,o=e.height??e.displayHeight;let n=Math.max(Math.hypot(i[0],i[1]),1),s=Math.max(Math.hypot(i[2],i[3]),1),a=r,l=o,c="prescale1",d,u;for(;n>2&&a>1||s>2&&l>1;){let h=a,p=l;n>2&&a>1&&(h=a>=16384?Math.floor(a/2)-1||1:Math.ceil(a/2),n/=a/h),s>2&&l>1&&(p=l>=16384?Math.floor(l/2)-1||1:Math.ceil(l)/2,s/=l/p),d=this.cachedCanvases.getCanvas(c,h,p),u=d.context,u.clearRect(0,0,h,p),u.drawImage(e,0,0,a,l,0,0,h,p),e=d.canvas,a=h,l=p,c=c==="prescale1"?"prescale2":"prescale1"}return{img:e,paintWidth:a,paintHeight:l}}_createMaskCanvas(e){const i=this.ctx,{width:r,height:o}=e,n=this.current.fillColor,s=this.current.patternFill,a=Xo(i);let l,c,d,u;if((e.bitmap||e.data)&&e.count>1){const E=e.bitmap||e.data.buffer;c=JSON.stringify(s?a:[a.slice(0,4),n]),l=this._cachedBitmapsMap.get(E),l||(l=new Map,this._cachedBitmapsMap.set(E,l));const S=l.get(c);if(S&&!s){const B=Math.round(Math.min(a[0],a[2])+a[4]),T=Math.round(Math.min(a[1],a[3])+a[5]);return{canvas:S,offsetX:B,offsetY:T}}d=S}d||(u=this.cachedCanvases.getCanvas("maskCanvas",r,o),e7e(u.context,e));let h=bi.transform(a,[1/r,0,0,-1/o,0,0]);h=bi.transform(h,[1,0,0,1,0,-o]);const p=F5.slice();bi.axialAlignedBoundingBox([0,0,r,o],h,p);const[g,f,A,m]=p,v=Math.round(A-g)||1,y=Math.round(m-f)||1,b=this.cachedCanvases.getCanvas("fillCanvas",v,y),w=b.context,x=g,M=f;w.translate(-x,-M),w.transform(...h),d||(d=this._scaleImage(u.canvas,Tu(w)),d=d.img,l&&s&&l.set(c,d)),w.imageSmoothingEnabled=t7e(Xo(w),e.interpolate),cS(w,d,0,0,d.width,d.height,0,0,r,o),w.globalCompositeOperation="source-in";const P=bi.transform(Tu(w),[1,0,0,1,-x,-M]);return w.fillStyle=s?n.getPattern(i,this,P,js.FILL):n,w.fillRect(0,0,r,o),l&&!s&&(this.cachedCanvases.delete("fillCanvas"),l.set(c,b.canvas)),{canvas:b.canvas,offsetX:Math.round(x),offsetY:Math.round(M)}}setLineWidth(e){e!==this.current.lineWidth&&(this._cachedScaleForStroking[0]=-1),this.current.lineWidth=e,this.ctx.lineWidth=e}setLineCap(e){this.ctx.lineCap=KBi[e]}setLineJoin(e){this.ctx.lineJoin=WBi[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.ctx.globalAlpha=this.current.fillAlpha=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;const n=this.ctx=o.context;n.setTransform(this.suspendedCtx.getTransform()),ub(this.suspendedCtx,n),GBi(n,this.suspendedCtx),this.setGState([["BM","source-over"]])}endSMaskMode(){if(!this.inSMaskMode)throw new Error("endSMaskMode called while not in smask mode");this.ctx._removeMirroring(),ub(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 n=o[0],s=o[1],a=o[2]-n,l=o[3]-s;a===0||l===0||(this.genericComposeSMask(i.context,r,a,l,i.subtype,i.backdrop,i.transferMap,n,s,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,n,s,a,l,c,d,u){let h=e.canvas,p=l-d,g=c-u;if(s)if(p<0||g<0||p+r>h.width||g+o>h.height){const A=this.cachedCanvases.getCanvas("maskExtension",r,o),m=A.context;m.drawImage(h,-p,-g),m.globalCompositeOperation="destination-atop",m.fillStyle=s,m.fillRect(0,0,r,o),m.globalCompositeOperation="source-over",h=A.canvas,p=g=0}else{e.save(),e.globalAlpha=1,e.setTransform(1,0,0,1,0,0);const A=new Path2D;A.rect(p,g,r,o),e.clip(A),e.globalCompositeOperation="destination-atop",e.fillStyle=s,e.fillRect(p,g,r,o),e.restore()}i.save(),i.globalAlpha=1,i.setTransform(1,0,0,1,0,0),n==="Alpha"&&a?i.filter=this.filterFactory.addAlphaFilter(a):n==="Luminosity"&&(i.filter=this.filterFactory.addLuminosityFilter(a));const f=new Path2D;f.rect(l,c,r,o),i.clip(f),i.globalCompositeOperation="destination-in",i.drawImage(h,p,g,r,o,l,c,r,o),i.restore()}save(){this.inSMaskMode&&ub(this.ctx,this.suspendedCtx),this.ctx.save();const e=this.current;this.stateStack.push(e),this.current=e.clone()}restore(){if(this.stateStack.length===0){this.inSMaskMode&&this.endSMaskMode();return}this.current=this.stateStack.pop(),this.ctx.restore(),this.inSMaskMode&&ub(this.suspendedCtx,this.ctx),this.checkSMaskState(),this.pendingClip=null,this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}transform(e,i,r,o,n,s){this.ctx.transform(e,i,r,o,n,s),this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null}constructPath(e,i,r){let[o]=i;if(!r){o||=i[0]=new Path2D,this[e](o);return}if(!(o instanceof Path2D)){const n=i[0]=new Path2D;for(let s=0,a=o.length;s<a;)switch(o[s++]){case eS.moveTo:n.moveTo(o[s++],o[s++]);break;case eS.lineTo:n.lineTo(o[s++],o[s++]);break;case eS.curveTo:n.bezierCurveTo(o[s++],o[s++],o[s++],o[s++],o[s++],o[s++]);break;case eS.closePath:n.closePath();break;default:Ki(`Unrecognized drawing path operator: ${o[s-1]}`);break}o=n}bi.axialAlignedBoundingBox(r,Xo(this.ctx),this.current.minMax),this[e](o)}closePath(){this.ctx.closePath()}stroke(e,i=!0){const r=this.ctx,o=this.current.strokeColor;if(r.globalAlpha=this.current.strokeAlpha,this.contentVisible)if(typeof o=="object"&&o?.getPattern){const n=o.isModifyingCurrentTransform()?r.getTransform():null;if(r.save(),r.strokeStyle=o.getPattern(r,this,Tu(r),js.STROKE),n){const s=new Path2D;s.addPath(e,r.getTransform().invertSelf().multiplySelf(n)),e=s}this.rescaleAndStroke(e,!1),r.restore()}else this.rescaleAndStroke(e,!0);i&&this.consumePath(e,this.current.getClippedPathBoundingBox(js.STROKE,Xo(this.ctx))),r.globalAlpha=this.current.fillAlpha}closeStroke(e){this.stroke(e)}fill(e,i=!0){const r=this.ctx,o=this.current.fillColor,n=this.current.patternFill;let s=!1;if(n){const l=o.isModifyingCurrentTransform()?r.getTransform():null;if(r.save(),r.fillStyle=o.getPattern(r,this,Tu(r),js.FILL),l){const c=new Path2D;c.addPath(e,r.getTransform().invertSelf().multiplySelf(l)),e=c}s=!0}const a=this.current.getClippedPathBoundingBox();this.contentVisible&&a!==null&&(this.pendingEOFill?(r.fill(e,"evenodd"),this.pendingEOFill=!1):r.fill(e)),s&&r.restore(),i&&this.consumePath(e,a)}eoFill(e){this.pendingEOFill=!0,this.fill(e)}fillStroke(e){this.fill(e,!1),this.stroke(e,!1),this.consumePath(e)}eoFillStroke(e){this.pendingEOFill=!0,this.fillStroke(e)}closeFillStroke(e){this.fillStroke(e)}closeEOFillStroke(e){this.pendingEOFill=!0,this.fillStroke(e)}endPath(e){this.consumePath(e)}rawFillPath(e){this.ctx.fill(e)}clip(){this.pendingClip=ZBi}eoClip(){this.pendingClip=i7e}beginText(){this.current.textMatrix=null,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)return;const r=new Path2D,o=i.getTransform().invertSelf();for(const{transform:n,x:s,y:a,fontSize:l,path:c}of e)c&&r.addPath(c,new DOMMatrix(n).preMultiplySelf(o).translate(s,a).scale(l,-l));i.clip(r),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){const r=this.commonObjs.get(e),o=this.current;if(!r)throw new Error(`Can't find font for ${e}`);if(o.fontMatrix=r.fontMatrix||$z,(o.fontMatrix[0]===0||o.fontMatrix[3]===0)&&Ki("Invalid font matrix for font "+e),i<0?(i=-i,o.fontDirection=-1):o.fontDirection=1,this.current.font=r,this.current.fontSize=i,r.isType3Font)return;const n=r.loadedName||"sans-serif",s=r.systemFontInfo?.css||`"${n}", ${r.fallbackName}`;let a="normal";r.black?a="900":r.bold&&(a="bold");const l=r.italic?"italic":"normal";let c=i;i<Z9e?c=Z9e:i>J9e&&(c=J9e),this.current.fontSizeScale=i/c,this.ctx.font=`${l} ${a} ${c}px ${s}`}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){const{current:i}=this;i.textMatrix=e,i.textMatrixScale=Math.hypot(e[0],e[1]),i.x=i.lineX=0,i.y=i.lineY=0}nextLine(){this.moveText(0,this.current.leading)}#i(e,i,r){const o=new Path2D;return o.addPath(e,new DOMMatrix(r).invertSelf().multiplySelf(i)),o}paintChar(e,i,r,o,n){const s=this.ctx,a=this.current,l=a.font,c=a.textRenderingMode,d=a.fontSize/a.fontSizeScale,u=c&fa.FILL_STROKE_MASK,h=!!(c&fa.ADD_TO_PATH_FLAG),p=a.patternFill&&!l.missingFile,g=a.patternStroke&&!l.missingFile;let f;if((l.disableFontFace||h||p||g)&&!l.missingFile&&(f=l.getPathGenerator(this.commonObjs,e)),f&&(l.disableFontFace||p||g)){s.save(),s.translate(i,r),s.scale(d,-d);let A;if((u===fa.FILL||u===fa.FILL_STROKE)&&(o?(A=s.getTransform(),s.setTransform(...o),s.fill(this.#i(f,A,o))):s.fill(f)),u===fa.STROKE||u===fa.FILL_STROKE)if(n){A||=s.getTransform(),s.setTransform(...n);const{a:m,b:v,c:y,d:b}=A,w=bi.inverseTransform(n),x=bi.transform([m,v,y,b,0,0],w);bi.singularValueDecompose2dScale(x,sc),s.lineWidth*=Math.max(sc[0],sc[1])/d,s.stroke(this.#i(f,A,n))}else s.lineWidth/=d,s.stroke(f);s.restore()}else(u===fa.FILL||u===fa.FILL_STROKE)&&s.fillText(e,i,r),(u===fa.STROKE||u===fa.FILL_STROKE)&&s.strokeText(e,i,r);h&&(this.pendingTextPaths||=[]).push({transform:Xo(s),x:i,y:r,fontSize:d,path:f})}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 cr(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 n=this.ctx,s=i.fontSizeScale,a=i.charSpacing,l=i.wordSpacing,c=i.fontDirection,d=i.textHScale*c,u=e.length,h=r.vertical,p=h?1:-1,g=r.defaultVMetrics,f=o*i.fontMatrix[0],A=i.textRenderingMode===fa.FILL&&!r.disableFontFace&&!i.patternFill;n.save(),i.textMatrix&&n.transform(...i.textMatrix),n.translate(i.x,i.y+i.textRise),c>0?n.scale(d,-1):n.scale(d,1);let m,v;if(i.patternFill){n.save();const M=i.fillColor.getPattern(n,this,Tu(n),js.FILL);m=Xo(n),n.restore(),n.fillStyle=M}if(i.patternStroke){n.save();const M=i.strokeColor.getPattern(n,this,Tu(n),js.STROKE);v=Xo(n),n.restore(),n.strokeStyle=M}let y=i.lineWidth;const b=i.textMatrixScale;if(b===0||y===0){const M=i.textRenderingMode&fa.FILL_STROKE_MASK;(M===fa.STROKE||M===fa.FILL_STROKE)&&(y=this.getSinglePixelWidth())}else y/=b;if(s!==1&&(n.scale(s,s),y/=s),n.lineWidth=y,r.isInvalidPDFjsFont){const M=[];let P=0;for(const E of e)M.push(E.unicode),P+=E.width;n.fillText(M.join(""),0,0),i.x+=P*f*d,n.restore(),this.compose();return}let w=0,x;for(x=0;x<u;++x){const M=e[x];if(typeof M=="number"){w+=p*M*o/1e3;continue}let P=!1;const E=(M.isSpace?l:0)+a,S=M.fontChar,B=M.accent;let T,_,U=M.width;if(h){const N=M.vmetric||g,z=-(M.vmetric?N[1]:U*.5)*f,G=N[2]*f;U=N?-N[0]:U,T=z/s,_=(w+G)/s}else T=w/s,_=0;if(r.remeasure&&U>0){const N=n.measureText(S).width*1e3/o*s;if(U<N&&this.isFontSubpixelAAEnabled){const z=U/N;P=!0,n.save(),n.scale(z,1),T/=z}else U!==N&&(T+=(U-N)/2e3*o/s)}if(this.contentVisible&&(M.isInFont||r.missingFile)){if(A&&!B)n.fillText(S,T,_);else if(this.paintChar(S,T,_,m,v),B){const N=T+o*B.offset.x/s,z=_-o*B.offset.y/s;this.paintChar(B.fontChar,N,z,m,v)}}const H=h?U*f-E*c:U*f+E*c;w+=H,P&&n.restore()}h?i.y-=w:i.x+=w*d,n.restore(),this.compose()}showType3Text(e){const i=this.ctx,r=this.current,o=r.font,n=r.fontSize,s=r.fontDirection,a=o.vertical?1:-1,l=r.charSpacing,c=r.wordSpacing,d=r.textHScale*s,u=r.fontMatrix||$z,h=e.length,p=r.textRenderingMode===fa.INVISIBLE;let g,f,A,m;if(!(p||n===0)){for(this._cachedScaleForStroking[0]=-1,this._cachedGetSinglePixelWidth=null,i.save(),r.textMatrix&&i.transform(...r.textMatrix),i.translate(r.x,r.y+r.textRise),i.scale(d,s),g=0;g<h;++g){if(f=e[g],typeof f=="number"){m=a*f*n/1e3,this.ctx.translate(m,0),r.x+=m*d;continue}const v=(f.isSpace?c:0)+l,y=o.charProcOperatorList[f.operatorListId];y?this.contentVisible&&(this.save(),i.scale(n,n),i.transform(...u),this.executeOperatorList(y),this.restore()):Ki(`Type3 character "${f.operatorListId}" is not available.`);const b=[f.width,0];bi.applyTransform(b,u),A=b[0]*n+v,i.translate(A,0),r.x+=A*d}i.restore()}}setCharWidth(e,i){}setCharWidthAndBounds(e,i,r,o,n,s){const a=new Path2D;a.rect(r,o,n-r,s-o),this.ctx.clip(a),this.endPath()}getColorN_Pattern(e){let i;if(e[0]==="TilingPattern"){const r=this.baseTransform||Xo(this.ctx),o={createCanvasGraphics:n=>new m6(n,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:this.optionalContentConfig,markedContentStack:this.markedContentStack})};i=new xQ(e,this.ctx,o,r)}else i=this._getPattern(e[1],e[2]);return i}setStrokeColorN(){this.current.strokeColor=this.getColorN_Pattern(arguments),this.current.patternStroke=!0}setFillColorN(){this.current.fillColor=this.getColorN_Pattern(arguments),this.current.patternFill=!0}setStrokeRGBColor(e){this.ctx.strokeStyle=this.current.strokeColor=e,this.current.patternStroke=!1}setStrokeTransparent(){this.ctx.strokeStyle=this.current.strokeColor="transparent",this.current.patternStroke=!1}setFillRGBColor(e){this.ctx.fillStyle=this.current.fillColor=e,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=VBi(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,Tu(i),js.SHADING);const o=Tu(i);if(o){const{width:n,height:s}=i.canvas,a=F5.slice();bi.axialAlignedBoundingBox([0,0,n,s],o,a);const[l,c,d,u]=a;this.ctx.fillRect(l,c,d-l,u-c)}else this.ctx.fillRect(-1e10,-1e10,2e10,2e10);this.compose(this.current.getClippedPathBoundingBox()),this.restore()}beginInlineImage(){mo("Should not call beginInlineImage")}beginImageData(){mo("Should not call beginImageData")}paintFormXObjectBegin(e,i){if(this.contentVisible&&(this.save(),this.baseTransformStack.push(this.baseTransform),e&&this.transform(...e),this.baseTransform=Xo(this.ctx),i)){bi.axialAlignedBoundingBox(i,this.baseTransform,this.current.minMax);const[r,o,n,s]=i,a=new Path2D;a.rect(r,o,n-r,s-o),this.ctx.clip(a),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||iS("TODO: Support non-isolated groups."),e.knockout&&Ki("Knockout groups not supported.");const r=Xo(i);if(e.matrix&&i.transform(...e.matrix),!e.bbox)throw new Error("Bounding box is required.");let o=F5.slice();bi.axialAlignedBoundingBox(e.bbox,Xo(i),o);const n=[0,0,i.canvas.width,i.canvas.height];o=bi.intersect(o,n)||[0,0,0,0];const s=Math.floor(o[0]),a=Math.floor(o[1]),l=Math.max(Math.ceil(o[2])-s,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 u=this.cachedCanvases.getCanvas(d,l,c),h=u.context;h.translate(-s,-a),h.transform(...r);let p=new Path2D;const[g,f,A,m]=e.bbox;if(p.rect(g,f,A-g,m-f),e.matrix){const v=new Path2D;v.addPath(p,new DOMMatrix(e.matrix)),p=v}h.clip(p),e.smask?this.smaskStack.push({canvas:u.canvas,context:h,offsetX:s,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(s,a),i.save()),ub(i,h),this.ctx=h,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=Xo(this.ctx);this.restore(),this.ctx.save(),this.ctx.setTransform(...o);const n=F5.slice();bi.axialAlignedBoundingBox([0,0,i.canvas.width,i.canvas.height],o,n),this.ctx.drawImage(i.canvas,0,0),this.ctx.restore(),this.compose(n)}}beginAnnotation(e,i,r,o,n){if(this.#e(),dS(this.ctx),this.ctx.save(),this.save(),this.baseTransform&&this.ctx.setTransform(...this.baseTransform),i){const s=i[2]-i[0],a=i[3]-i[1];if(n&&this.annotationCanvasMap){r=r.slice(),r[4]-=i[0],r[5]-=i[1],i=i.slice(),i[0]=i[1]=0,i[2]=s,i[3]=a,bi.singularValueDecompose2dScale(Xo(this.ctx),sc);const{viewportScale:l}=this,c=Math.ceil(s*this.outputScaleX*l),d=Math.ceil(a*this.outputScaleY*l);this.annotationCanvas=this.canvasFactory.create(c,d);const{canvas:u,context:h}=this.annotationCanvas;this.annotationCanvasMap.set(e,u),this.annotationCanvas.savedCtx=this.ctx,this.ctx=h,this.ctx.save(),this.ctx.setTransform(sc[0],0,0,-sc[1],0,a*sc[1]),dS(this.ctx)}else{dS(this.ctx),this.endPath();const l=new Path2D;l.rect(i[0],i[1],s,a),this.ctx.clip(l)}}this.current=new Y9e(this.ctx.canvas.width,this.ctx.canvas.height),this.transform(...r),this.transform(...o)}endAnnotation(){this.annotationCanvas&&(this.ctx.restore(),this.#t(),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._createMaskCanvas(e),n=o.canvas;r.save(),r.setTransform(1,0,0,1,0,0),r.drawImage(n,o.offsetX,o.offsetY),r.restore(),this.compose()}paintImageMaskXObjectRepeat(e,i,r=0,o=0,n,s){if(!this.contentVisible)return;e=this.getObject(e.data,e);const a=this.ctx;a.save();const l=Xo(a);a.transform(i,r,o,n,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,u=s.length;d<u;d+=2){const h=bi.transform(l,[i,r,o,n,s[d],s[d+1]]);a.drawImage(c.canvas,h[4],h[5])}a.restore(),this.compose()}paintImageMaskXObjectGroup(e){if(!this.contentVisible)return;const i=this.ctx,r=this.current.fillColor,o=this.current.patternFill;for(const n of e){const{data:s,width:a,height:l,transform:c}=n,d=this.cachedCanvases.getCanvas("maskCanvas",a,l),u=d.context;u.save();const h=this.getObject(s,n);e7e(u,h),u.globalCompositeOperation="source-in",u.fillStyle=o?r.getPattern(u,this,Tu(i),js.FILL):r,u.fillRect(0,0,a,l),u.restore(),i.save(),i.transform(...c),i.scale(1,-1),cS(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){Ki("Dependent image isn't ready yet");return}this.paintInlineImageXObject(i)}paintImageXObjectRepeat(e,i,r,o){if(!this.contentVisible)return;const n=this.getObject(e);if(!n){Ki("Dependent image isn't ready yet");return}const s=n.width,a=n.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:s,h:a});this.paintInlineImageXObjectGroup(n,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,n=this.cachedCanvases.getCanvas("inlineImage",r,o),s=n.context;return s.filter=this.current.transferMaps,s.drawImage(i,0,0),s.filter="none",n.canvas}paintInlineImageXObject(e){if(!this.contentVisible)return;const i=e.width,r=e.height,o=this.ctx;this.save();const{filter:n}=o;n!=="none"&&n!==""&&(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 l=this.cachedCanvases.getCanvas("inlineImage",i,r).context;$9e(l,e),s=this.applyTransferMapsToCanvas(l)}const a=this._scaleImage(s,Tu(o));o.imageSmoothingEnabled=t7e(Xo(o),e.interpolate),cS(o,a.img,0,0,a.paintWidth,a.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 n=e.width,s=e.height,a=this.cachedCanvases.getCanvas("inlineImage",n,s).context;$9e(a,e),o=this.applyTransferMapsToCanvas(a)}for(const n of i)r.save(),r.transform(...n.transform),r.scale(1,-1),cS(r,o,n.x,n.y,n.w,n.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,i){const r=this.current.isEmptyClip();this.pendingClip&&this.current.updateClipFromPath(),this.pendingClip||this.compose(i);const o=this.ctx;this.pendingClip&&(r||(this.pendingClip===i7e?o.clip(e,"evenodd"):o.clip(e)),this.pendingClip=null),this.current.startNewPathAndClipBox(this.current.clipBox)}getSinglePixelWidth(){if(!this._cachedGetSinglePixelWidth){const e=Xo(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:n}=this.ctx.getTransform();let s,a;if(r===0&&o===0){const l=Math.abs(i),c=Math.abs(n);if(l===c)if(e===0)s=a=1/l;else{const d=l*e;s=a=d<1?1/d:1}else if(e===0)s=1/l,a=1/c;else{const d=l*e,u=c*e;s=d<1?1/d:1,a=u<1?1/u:1}}else{const l=Math.abs(i*n-r*o),c=Math.hypot(i,r),d=Math.hypot(o,n);if(e===0)s=d/l,a=c/l;else{const u=e*l;s=d>u?d/u:1,a=c>u?c/u:1}}this._cachedScaleForStroking[0]=s,this._cachedScaleForStroking[1]=a}return this._cachedScaleForStroking}rescaleAndStroke(e,i){const{ctx:r,current:{lineWidth:o}}=this,[n,s]=this.getScaleForStroking();if(n===s){r.lineWidth=(o||1)*n,r.stroke(e);return}const a=r.getLineDash();i&&r.save(),r.scale(n,s),Aq.a=1/n,Aq.d=1/s;const l=new Path2D;if(l.addPath(e,Aq),a.length>0){const c=Math.max(n,s);r.setLineDash(a.map(d=>d/c)),r.lineDashOffset/=c}r.lineWidth=o||1,r.stroke(l),i&&r.restore()}isContentVisible(){for(let e=this.markedContentStack.length-1;e>=0;e--)if(!this.markedContentStack[e].visible)return!1;return!0}}for(const t in $E)m6.prototype[t]!==void 0&&(m6.prototype[$E[t]]=m6.prototype[t]);class O5{static#e=null;static#t="";static get workerPort(){return this.#e}static set workerPort(e){if(!(typeof Worker<"u"&&e instanceof Worker)&&e!==null)throw new Error("Invalid `workerPort` type.");this.#e=e}static get workerSrc(){return this.#t}static set workerSrc(e){if(typeof e!="string")throw new Error("Invalid `workerSrc` type.");this.#t=e}}class JBi{#e;#t;constructor({parsedData:e,rawData:i}){this.#e=e,this.#t=i}getRaw(){return this.#t}get(e){return this.#e.get(e)??null}[Symbol.iterator](){return this.#e.entries()}}const N5=Symbol("INTERNAL");class XBi{#e=!1;#t=!1;#i=!1;#r=!0;constructor(e,{name:i,intent:r,usage:o,rbGroups:n}){this.#e=!!(e&nc.DISPLAY),this.#t=!!(e&nc.PRINT),this.name=i,this.intent=r,this.usage=o,this.rbGroups=n}get visible(){if(this.#i)return this.#r;if(!this.#r)return!1;const{print:e,view:i}=this.usage;return this.#e?i?.viewState!=="OFF":this.#t?e?.printState!=="OFF":!0}_setVisible(e,i,r=!1){e!==N5&&mo("Internal method `_setVisible` called."),this.#i=r,this.#r=i}}class YBi{#e=null;#t=new Map;#i=null;#r=null;constructor(e,i=nc.DISPLAY){if(this.renderingIntent=i,this.name=null,this.creator=null,e!==null){this.name=e.name,this.creator=e.creator,this.#r=e.order;for(const r of e.groups)this.#t.set(r.id,new XBi(i,r));if(e.baseState==="OFF")for(const r of this.#t.values())r._setVisible(N5,!1);for(const r of e.on)this.#t.get(r)._setVisible(N5,!0);for(const r of e.off)this.#t.get(r)._setVisible(N5,!1);this.#i=this.getHash()}}#n(e){const i=e.length;if(i<2)return!0;const r=e[0];for(let o=1;o<i;o++){const n=e[o];let s;if(Array.isArray(n))s=this.#n(n);else if(this.#t.has(n))s=this.#t.get(n).visible;else return Ki(`Optional content group not found: ${n}`),!0;switch(r){case"And":if(!s)return!1;break;case"Or":if(s)return!0;break;case"Not":return!s;default:return!0}}return r==="And"}isVisible(e){if(this.#t.size===0)return!0;if(!e)return iS("Optional content group not defined."),!0;if(e.type==="OCG")return this.#t.has(e.id)?this.#t.get(e.id).visible:(Ki(`Optional content group not found: ${e.id}`),!0);if(e.type==="OCMD"){if(e.expression)return this.#n(e.expression);if(!e.policy||e.policy==="AnyOn"){for(const i of e.ids){if(!this.#t.has(i))return Ki(`Optional content group not found: ${i}`),!0;if(this.#t.get(i).visible)return!0}return!1}else if(e.policy==="AllOn"){for(const i of e.ids){if(!this.#t.has(i))return Ki(`Optional content group not found: ${i}`),!0;if(!this.#t.get(i).visible)return!1}return!0}else if(e.policy==="AnyOff"){for(const i of e.ids){if(!this.#t.has(i))return Ki(`Optional content group not found: ${i}`),!0;if(!this.#t.get(i).visible)return!0}return!1}else if(e.policy==="AllOff"){for(const i of e.ids){if(!this.#t.has(i))return Ki(`Optional content group not found: ${i}`),!0;if(this.#t.get(i).visible)return!1}return!0}return Ki(`Unknown optional content policy ${e.policy}.`),!0}return Ki(`Unknown group type ${e.type}.`),!0}setVisibility(e,i=!0,r=!0){const o=this.#t.get(e);if(!o){Ki(`Optional content group not found: ${e}`);return}if(r&&i&&o.rbGroups.length)for(const n of o.rbGroups)for(const s of n)s!==e&&this.#t.get(s)?._setVisible(N5,!1,!0);o._setVisible(N5,!!i,!0),this.#e=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 n=this.#t.get(o);if(n)switch(r){case"ON":this.setVisibility(o,!0,i);break;case"OFF":this.setVisibility(o,!1,i);break;case"Toggle":this.setVisibility(o,!n.visible,i);break}}this.#e=null}get hasInitialVisibility(){return this.#i===null||this.getHash()===this.#i}getOrder(){return this.#t.size?this.#r?this.#r.slice():[...this.#t.keys()]:null}getGroup(e){return this.#t.get(e)||null}getHash(){if(this.#e!==null)return this.#e;const e=new O9e;for(const[i,r]of this.#t)e.update(`${i}:${r.visible}`);return this.#e=e.hexdigest()}[Symbol.iterator](){return this.#t.entries()}}class $Bi{constructor(e,{disableRange:i=!1,disableStream:r=!1}){_n(e,'PDFDataTransportStream - missing required "pdfDataRangeTransport" argument.');const{length:o,initialData:n,progressiveDone:s,contentDispositionFilename:a}=e;if(this._queuedChunks=[],this._progressiveDone=s,this._contentDispositionFilename=a,n?.length>0){const l=n instanceof Uint8Array&&n.byteLength===n.buffer.byteLength?n.buffer:new Uint8Array(n).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(n){return n._begin!==e?!1:(n._enqueue(r),!0)});_n(o,"_onReceiveData - no `PDFDataTransportStreamRangeReader` instance found.")}}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}_onProgress(e){e.total===void 0?this._rangeReaders[0]?.onProgress?.({loaded:e.loaded}):this._fullRequestReader?.onProgress?.({loaded:e.loaded,total:e.total})}_onProgressiveDone(){this._fullRequestReader?.progressiveDone(),this._progressiveDone=!0}_removeRangeReader(e){const i=this._rangeReaders.indexOf(e);i>=0&&this._rangeReaders.splice(i,1)}getFullReader(){_n(!this._fullRequestReader,"PDFDataTransportStream.getFullReader can only be called once.");const e=this._queuedChunks;return this._queuedChunks=null,new eIi(this,e,this._progressiveDone,this._contentDispositionFilename)}getRangeReader(e,i){if(i<=this._progressiveDataLength)return null;const r=new tIi(this,e,i);return this._pdfDataRangeTransport.requestDataRange(e,i),this._rangeReaders.push(r),r}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(const i of this._rangeReaders.slice(0))i.cancel(e);this._pdfDataRangeTransport.abort()}}class eIi{constructor(e,i,r=!1,o=null){this._stream=e,this._done=r||!1,this._filename=aq(o)?o:null,this._queuedChunks=i||[],this._loaded=0;for(const n of this._queuedChunks)this._loaded+=n.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 tIi{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 iIi(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),n(d)}if(i=s(t),i){const d=c(i);return n(d)}if(i=r("filename","i").exec(t),i){i=i[1];let d=a(i);return d=c(d),n(d)}function r(d,u){return new RegExp("(?:^|;)\\s*"+d+'\\s*=\\s*([^";\\s][^;\\s]*|"(?:[^"\\\\]|\\\\"?)+"?)',u)}function o(d,u){if(d){if(!/^[\x00-\xFF]+$/.test(u))return u;try{const h=new TextDecoder(d,{fatal:!0}),p=sb(u);u=h.decode(p),e=!1}catch{}}return u}function n(d){return e&&/[\x80-\xff]/.test(d)&&(d=o("utf-8",d),e&&(d=o("iso-8859-1",d))),d}function s(d){const u=[];let h;const p=r("filename\\*((?!0\\d)\\d+)(\\*?)","ig");for(;(h=p.exec(d))!==null;){let[,f,A,m]=h;if(f=parseInt(f,10),f in u){if(f===0)break;continue}u[f]=[A,m]}const g=[];for(let f=0;f<u.length&&f in u;++f){let[A,m]=u[f];m=a(m),A&&(m=unescape(m),f===0&&(m=l(m))),g.push(m)}return g.join("")}function a(d){if(d.startsWith('"')){const u=d.slice(1).split('\\"');for(let h=0;h<u.length;++h){const p=u[h].indexOf('"');p!==-1&&(u[h]=u[h].slice(0,p),u.length=h+1),u[h]=u[h].replaceAll(/\\(.)/g,"$1")}d=u.join('"')}return d}function l(d){const u=d.indexOf("'");if(u===-1)return d;const h=d.slice(0,u),p=d.slice(u+1).replace(/^[^']*'/,"");return o(h,p)}function c(d){return!d.startsWith("=?")||/[\x00-\x19\x80-\xff]/.test(d)?d:d.replaceAll(/=\?([\w-]*)\?([QqBb])\?((?:[^?]|\?(?!=))*)\?=/g,function(u,h,p,g){if(p==="q"||p==="Q")return g=g.replaceAll("_"," "),g=g.replaceAll(/=([0-9a-fA-F]{2})/g,function(f,A){return String.fromCharCode(parseInt(A,16))}),o(h,g);try{g=atob(g)}catch{}return o(h,g)})}return""}function r7e(t,e){const i=new Headers;if(!t||!e||typeof e!="object")return i;for(const r in e){const o=e[r];o!==void 0&&i.append(r,o)}return i}function uS(t){return URL.parse(t)?.origin??null}function o7e({responseHeaders:t,isHttp:e,rangeChunkSize:i,disableRange:r}){const o={allowRangeRequests:!1,suggestedLength:void 0},n=parseInt(t.get("Content-Length"),10);return!Number.isInteger(n)||(o.suggestedLength=n,n<=2*i)||r||!e||t.get("Accept-Ranges")!=="bytes"||(t.get("Content-Encoding")||"identity")!=="identity"||(o.allowRangeRequests=!0),o}function n7e(t){const e=t.get("Content-Disposition");if(e){let i=iIi(e);if(i.includes("%"))try{i=decodeURIComponent(i)}catch{}if(aq(i))return i}return null}function hb(t,e){return new rS(`Unexpected server response (${t}) while retrieving PDF "${e}".`,t,t===404||t===0&&e.startsWith("file:"))}function s7e(t){return t===200||t===206}function a7e(t,e,i){return{method:"GET",headers:t,signal:i.signal,mode:"cors",credentials:e?"include":"same-origin",redirect:"follow"}}function l7e(t){return t instanceof Uint8Array?t.buffer:t instanceof ArrayBuffer?t:(Ki(`getArrayBuffer - unexpected data format: ${t}`),new Uint8Array(t).buffer)}class rIi{_responseOrigin=null;constructor(e){this.source=e,this.isHttp=/^https?:/i.test(e.url),this.headers=r7e(this.isHttp,e.httpHeaders),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return _n(!this._fullRequestReader,"PDFFetchStream.getFullReader can only be called once."),this._fullRequestReader=new oIi(this),this._fullRequestReader}getRangeReader(e,i){if(i<=this._progressiveDataLength)return null;const r=new nIi(this,e,i);return this._rangeRequestReaders.push(r),r}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(const i of this._rangeRequestReaders.slice(0))i.cancel(e)}}class oIi{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;const r=new Headers(e.headers),o=i.url;fetch(o,a7e(r,this._withCredentials,this._abortController)).then(n=>{if(e._responseOrigin=uS(n.url),!s7e(n.status))throw hb(n.status,o);this._reader=n.body.getReader(),this._headersCapability.resolve();const s=n.headers,{allowRangeRequests:a,suggestedLength:l}=o7e({responseHeaders:s,isHttp:e.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});this._isRangeSupported=a,this._contentLength=l||this._contentLength,this._filename=n7e(s),!this._isStreamingSupported&&this._isRangeSupported&&this.cancel(new r0("Streaming is disabled."))}).catch(this._headersCapability.reject),this.onProgress=null}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._headersCapability.promise;const{value:e,done:i}=await this._reader.read();return i?{value:e,done:i}:(this._loaded+=e.byteLength,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:l7e(e),done:!1})}cancel(e){this._reader?.cancel(e),this._abortController.abort()}}class nIi{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;const n=new Headers(e.headers);n.append("Range",`bytes=${i}-${r-1}`);const s=o.url;fetch(s,a7e(n,this._withCredentials,this._abortController)).then(a=>{const l=uS(a.url);if(l!==e._responseOrigin)throw new Error(`Expected range response-origin "${l}" to match "${e._responseOrigin}".`);if(!s7e(a.status))throw hb(a.status,s);this._readCapability.resolve(),this._reader=a.body.getReader()}).catch(this._readCapability.reject),this.onProgress=null}get isStreamingSupported(){return this._isStreamingSupported}async read(){await this._readCapability.promise;const{value:e,done:i}=await this._reader.read();return i?{value:e,done:i}:(this._loaded+=e.byteLength,this.onProgress?.({loaded:this._loaded}),{value:l7e(e),done:!1})}cancel(e){this._reader?.cancel(e),this._abortController.abort()}}const vq=200,bq=206;function sIi(t){const e=t.response;return typeof e!="string"?e:sb(e).buffer}class aIi{_responseOrigin=null;constructor({url:e,httpHeaders:i,withCredentials:r}){this.url=e,this.isHttp=/^https?:/i.test(e),this.headers=r7e(this.isHttp,i),this.withCredentials=r||!1,this.currXhrId=0,this.pendingRequests=Object.create(null)}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[n,s]of this.headers)i.setRequestHeader(n,s);return this.isHttp&&"begin"in e&&"end"in e?(i.setRequestHeader("Range",`bytes=${e.begin}-${e.end-1}`),o.expectedStatus=bq):o.expectedStatus=vq,i.responseType="arraybuffer",_n(e.onError,"Expected `onError` callback to be provided."),i.onerror=()=>{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){const r=this.pendingRequests[e];r&&r.onProgress?.(i)}onStateChange(e,i){const r=this.pendingRequests[e];if(!r)return;const o=r.xhr;if(o.readyState>=2&&r.onHeadersReceived&&(r.onHeadersReceived(),delete r.onHeadersReceived),o.readyState!==4||!(e in this.pendingRequests))return;if(delete this.pendingRequests[e],o.status===0&&this.isHttp){r.onError(o.status);return}const n=o.status||vq;if(!(n===vq&&r.expectedStatus===bq)&&n!==r.expectedStatus){r.onError(o.status);return}const s=sIi(o);if(n===bq){const a=o.getResponseHeader("Content-Range"),l=/bytes (\d+)-(\d+)\/(\d+)/.exec(a);l?r.onDone({begin:parseInt(l[1],10),chunk:s}):(Ki('Missing or invalid "Content-Range" header.'),r.onError(0))}else s?r.onDone({begin:0,chunk:s}):r.onError(o.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 lIi{constructor(e){this._source=e,this._manager=new aIi(e),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 _n(!this._fullRequestReader,"PDFNetworkStream.getFullReader can only be called once."),this._fullRequestReader=new cIi(this._manager,this._source),this._fullRequestReader}getRangeReader(e,i){const r=new dIi(this._manager,e,i);return r.onClosed=this._onRangeRequestReaderClosed.bind(this),this._rangeRequestReaders.push(r),r}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(const i of this._rangeRequestReaders.slice(0))i.cancel(e)}}class cIi{constructor(e,i){this._manager=e,this._url=i.url,this._fullRequestId=e.request({onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)}),this._headersCapability=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);this._manager._responseOrigin=uS(i.responseURL);const r=i.getAllResponseHeaders(),o=new Headers(r?r.trimStart().replace(/[^\S ]+$/,"").split(/[\r\n]+/).map(a=>{const[l,...c]=a.split(": ");return[l,c.join(": ")]}):[]),{allowRangeRequests:n,suggestedLength:s}=o7e({responseHeaders:o,isHttp:this._manager.isHttp,rangeChunkSize:this._rangeChunkSize,disableRange:this._disableRange});n&&(this._isRangeSupported=!0),this._contentLength=s||this._contentLength,this._filename=n7e(o),this._isRangeSupported&&this._manager.abortRequest(e),this._headersCapability.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=hb(e,this._url),this._headersCapability.reject(this._storedError);for(const i of this._requests)i.reject(this._storedError);this._requests.length=0,this._cachedChunks.length=0}_onProgress(e){this.onProgress?.({loaded:e.loaded,total:e.lengthComputable?e.total:this._contentLength})}get filename(){return this._filename}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}get contentLength(){return this._contentLength}get headersReady(){return this._headersCapability.promise}async read(){if(await this._headersCapability.promise,this._storedError)throw this._storedError;if(this._cachedChunks.length>0)return{value:this._cachedChunks.shift(),done:!1};if(this._done)return{value:void 0,done:!0};const e=Promise.withResolvers();return this._requests.push(e),e.promise}cancel(e){this._done=!0,this._headersCapability.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 dIi{constructor(e,i,r){this._manager=e,this._url=e.url,this._requestId=e.request({begin:i,end:r,onHeadersReceived:this._onHeadersReceived.bind(this),onDone:this._onDone.bind(this),onError:this._onError.bind(this),onProgress:this._onProgress.bind(this)}),this._requests=[],this._queuedChunk=null,this._done=!1,this._storedError=void 0,this.onProgress=null,this.onClosed=null}_onHeadersReceived(){const e=uS(this._manager.getRequestXhr(this._requestId)?.responseURL);e!==this._manager._responseOrigin&&(this._storedError=new Error(`Expected range response-origin "${e}" to match "${this._manager._responseOrigin}".`),this._onError(0))}_close(){this.onClosed?.(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??=hb(e,this._url);for(const i of this._requests)i.reject(this._storedError);this._requests.length=0,this._queuedChunk=null}_onProgress(e){this.isStreamingSupported||this.onProgress?.({loaded:e.loaded})}get isStreamingSupported(){return!1}async read(){if(this._storedError)throw this._storedError;if(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 uIi=/^[a-z][a-z0-9\-+.]+:/i;function hIi(t){if(uIi.test(t))return new URL(t);const e=process.getBuiltinModule("url");return new URL(e.pathToFileURL(t))}class pIi{constructor(e){this.source=e,this.url=hIi(e.url),_n(this.url.protocol==="file:","PDFNodeStream only supports file:// URLs."),this._fullRequestReader=null,this._rangeRequestReaders=[]}get _progressiveDataLength(){return this._fullRequestReader?._loaded??0}getFullReader(){return _n(!this._fullRequestReader,"PDFNodeStream.getFullReader can only be called once."),this._fullRequestReader=new fIi(this),this._fullRequestReader}getRangeReader(e,i){if(i<=this._progressiveDataLength)return null;const r=new gIi(this,e,i);return this._rangeRequestReaders.push(r),r}cancelAllRequests(e){this._fullRequestReader?.cancel(e);for(const i of this._rangeRequestReaders.slice(0))i.cancel(e)}}class fIi{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();const r=process.getBuiltinModule("fs");r.promises.lstat(this._url).then(o=>{this._contentLength=o.size,this._setReadableStream(r.createReadStream(this._url)),this._headersCapability.resolve()},o=>{o.code==="ENOENT"&&(o=hb(0,this._url.href)),this._storedError=o,this._headersCapability.reject(o)})}get headersReady(){return this._headersCapability.promise}get filename(){return this._filename}get contentLength(){return this._contentLength}get isRangeSupported(){return this._isRangeSupported}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();return e===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=e.length,this.onProgress?.({loaded:this._loaded,total:this._contentLength}),{value:new Uint8Array(e).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 r0("streaming is disabled")),this._storedError&&this._readableStream.destroy(this._storedError)}}class gIi{constructor(e,i,r){this._url=e.url,this._done=!1,this._storedError=null,this.onProgress=null,this._loaded=0,this._readableStream=null,this._readCapability=Promise.withResolvers();const o=e.source;this._isStreamingSupported=!o.disableStream;const n=process.getBuiltinModule("fs");this._setReadableStream(n.createReadStream(this._url,{start:i,end:r-1}))}get isStreamingSupported(){return this._isStreamingSupported}async read(){if(await this._readCapability.promise,this._done)return{value:void 0,done:!0};if(this._storedError)throw this._storedError;const e=this._readableStream.read();return e===null?(this._readCapability=Promise.withResolvers(),this.read()):(this._loaded+=e.length,this.onProgress?.({loaded:this._loaded}),{value:new Uint8Array(e).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)}}const pb=Symbol("INITIAL_DATA");class c7e{#e=Object.create(null);#t(e){return this.#e[e]||={...Promise.withResolvers(),data:pb}}get(e,i=null){if(i){const o=this.#t(e);return o.promise.then(()=>i(o.data)),null}const r=this.#e[e];if(!r||r.data===pb)throw new Error(`Requesting object that isn't resolved yet ${e}.`);return r.data}has(e){const i=this.#e[e];return!!i&&i.data!==pb}delete(e){const i=this.#e[e];return!i||i.data===pb?!1:(delete this.#e[e],!0)}resolve(e,i=null){const r=this.#t(e);r.data=i,r.resolve()}clear(){for(const e in this.#e){const{data:i}=this.#e[e];i?.bitmap?.close()}this.#e=Object.create(null)}*[Symbol.iterator](){for(const e in this.#e){const{data:i}=this.#e[e];i!==pb&&(yield[e,i])}}}const mIi=1e5,d7e=30;class Ya{#e=Promise.withResolvers();#t=null;#i=!1;#r=!!globalThis.FontInspector?.enabled;#n=null;#o=null;#s=0;#a=0;#l=null;#c=null;#h=0;#d=0;#p=Object.create(null);#m=[];#f=null;#u=[];#g=new WeakMap;#b=null;static#A=new Map;static#w=new Map;static#x=new WeakMap;static#v=null;static#k=new Set;constructor({textContentSource:e,container:i,viewport:r}){if(e instanceof ReadableStream)this.#f=e;else if(typeof e=="object")this.#f=new ReadableStream({start(l){l.enqueue(e),l.close()}});else throw new Error('No "textContentSource" parameter specified.');this.#t=this.#c=i,this.#d=r.scale*Ku.pixelRatio,this.#h=r.rotation,this.#o={div:null,properties:null,ctx:null};const{pageWidth:o,pageHeight:n,pageX:s,pageY:a}=r.rawDims;this.#b=[1,0,0,-1,-s,a+n],this.#a=o,this.#s=n,Ya.#P(),n2(i,r),this.#e.promise.finally(()=>{Ya.#k.delete(this),this.#o=null,this.#p=null}).catch(()=>{})}static get fontFamilyMap(){const{isWindows:e,isFirefox:i}=Us.platform;return cr(this,"fontFamilyMap",new Map([["sans-serif",`${e&&i?"Calibri, ":""}sans-serif`],["monospace",`${e&&i?"Lucida Console, ":""}monospace`]]))}render(){const e=()=>{this.#l.read().then(({value:i,done:r})=>{if(r){this.#e.resolve();return}this.#n??=i.lang,Object.assign(this.#p,i.styles),this.#B(i.items),e()},this.#e.reject)};return this.#l=this.#f.getReader(),Ya.#k.add(this),e(),this.#e.promise}update({viewport:e,onBefore:i=null}){const r=e.scale*Ku.pixelRatio,o=e.rotation;if(o!==this.#h&&(i?.(),this.#h=o,n2(this.#c,{rotation:o})),r!==this.#d){i?.(),this.#d=r;const n={div:null,properties:null,ctx:Ya.#S(this.#n)};for(const s of this.#u)n.properties=this.#g.get(s),n.div=s,this.#I(n)}}cancel(){const e=new r0("TextLayer task cancelled.");this.#l?.cancel(e).catch(()=>{}),this.#l=null,this.#e.reject(e)}get textDivs(){return this.#u}get textContentItemsStr(){return this.#m}#B(e){if(this.#i)return;this.#o.ctx??=Ya.#S(this.#n);const i=this.#u,r=this.#m;for(const o of e){if(i.length>mIi){Ki("Ignoring additional textDivs for performance reasons."),this.#i=!0;return}if(o.str===void 0){if(o.type==="beginMarkedContentProps"||o.type==="beginMarkedContent"){const n=this.#t;this.#t=document.createElement("span"),this.#t.classList.add("markedContent"),o.id&&this.#t.setAttribute("id",`${o.id}`),n.append(this.#t)}else o.type==="endMarkedContent"&&(this.#t=this.#t.parentNode);continue}r.push(o.str),this.#C(o)}}#C(e){const i=document.createElement("span"),r={angle:0,canvasWidth:0,hasText:e.str!=="",hasEOL:e.hasEOL,fontSize:0};this.#u.push(i);const o=bi.transform(this.#b,e.transform);let n=Math.atan2(o[1],o[0]);const s=this.#p[e.fontName];s.vertical&&(n+=Math.PI/2);let a=this.#r&&s.fontSubstitution||s.fontFamily;a=Ya.fontFamilyMap.get(a)||a;const l=Math.hypot(o[2],o[3]),c=l*Ya.#R(a,s,this.#n);let d,u;n===0?(d=o[4],u=o[5]-c):(d=o[4]+c*Math.sin(n),u=o[5]-c*Math.cos(n));const h="calc(var(--total-scale-factor) *",p=i.style;this.#t===this.#c?(p.left=`${(100*d/this.#a).toFixed(2)}%`,p.top=`${(100*u/this.#s).toFixed(2)}%`):(p.left=`${h}${d.toFixed(2)}px)`,p.top=`${h}${u.toFixed(2)}px)`),p.fontSize=`${h}${(Ya.#v*l).toFixed(2)}px)`,p.fontFamily=a,r.fontSize=l,i.setAttribute("role","presentation"),i.textContent=e.str,i.dir=e.dir,this.#r&&(i.dataset.fontName=s.fontSubstitutionLoadedName||e.fontName),n!==0&&(r.angle=n*(180/Math.PI));let g=!1;if(e.str.length>1)g=!0;else if(e.str!==" "&&e.transform[0]!==e.transform[3]){const f=Math.abs(e.transform[0]),A=Math.abs(e.transform[3]);f!==A&&Math.max(f,A)/Math.min(f,A)>1.5&&(g=!0)}if(g&&(r.canvasWidth=s.vertical?e.height:e.width),this.#g.set(i,r),this.#o.div=i,this.#o.properties=r,this.#I(this.#o),r.hasText&&this.#t.append(i),r.hasEOL){const f=document.createElement("br");f.setAttribute("role","presentation"),this.#t.append(f)}}#I(e){const{div:i,properties:r,ctx:o}=e,{style:n}=i;let s="";if(Ya.#v>1&&(s=`scale(${1/Ya.#v})`),r.canvasWidth!==0&&r.hasText){const{fontFamily:a}=n,{canvasWidth:l,fontSize:c}=r;Ya.#E(o,c*this.#d,a);const{width:d}=o.measureText(i.textContent);d>0&&(s=`scaleX(${l*this.#d/d}) ${s}`)}r.angle!==0&&(s=`rotate(${r.angle}deg) ${s}`),s.length>0&&(n.transform=s)}static cleanup(){if(!(this.#k.size>0)){this.#A.clear();for(const{canvas:e}of this.#w.values())e.remove();this.#w.clear()}}static#S(e=null){let i=this.#w.get(e||="");if(!i){const r=document.createElement("canvas");r.className="hiddenCanvasElement",r.lang=e,document.body.append(r),i=r.getContext("2d",{alpha:!1,willReadFrequently:!0}),this.#w.set(e,i),this.#x.set(i,{size:0,family:""})}return i}static#E(e,i,r){const o=this.#x.get(e);i===o.size&&r===o.family||(e.font=`${i}px ${r}`,o.size=i,o.family=r)}static#P(){if(this.#v!==null)return;const e=document.createElement("div");e.style.opacity=0,e.style.lineHeight=1,e.style.fontSize="1px",e.style.position="absolute",e.textContent="X",document.body.append(e),this.#v=e.getBoundingClientRect().height,e.remove()}static#R(e,i,r){const o=this.#A.get(e);if(o)return o;const n=this.#S(r);n.canvas.width=n.canvas.height=d7e,this.#E(n,d7e,e);const s=n.measureText(""),a=s.fontBoundingBoxAscent,l=Math.abs(s.fontBoundingBoxDescent);n.canvas.width=n.canvas.height=0;let c=.8;return a?c=a/(a+l):(Us.platform.isFirefox&&Ki("Enable the `dom.textMetrics.fontBoundingBox.enabled` preference in `about:config` to improve TextLayer rendering."),i.ascent?c=i.ascent:i.descent&&(c=1+i.descent)),this.#A.set(e,c),c}}class Py{static textContent(e){const i=[],r={items:i,styles:Object.create(null)};function o(n){if(!n)return;let s=null;const a=n.name;if(a==="#text")s=n.value;else if(Py.shouldBuildText(a))n?.attributes?.textContent?s=n.attributes.textContent:n.value&&(s=n.value);else return;if(s!==null&&i.push({str:s}),!!n.children)for(const l of n.children)o(l)}return o(e),r}static shouldBuildText(e){return!(e==="textarea"||e==="input"||e==="option"||e==="select")}}const AIi=100;function u7e(t={}){typeof t=="string"||t instanceof URL?t={url:t}:(t instanceof ArrayBuffer||ArrayBuffer.isView(t))&&(t={data:t});const e=new CQ,{docId:i}=e,r=t.url?PBi(t.url):null,o=t.data?EBi(t.data):null,n=t.httpHeaders||null,s=t.withCredentials===!0,a=t.password??null,l=t.range instanceof h7e?t.range:null,c=Number.isInteger(t.rangeChunkSize)&&t.rangeChunkSize>0?t.rangeChunkSize:2**16;let d=t.worker instanceof wq?t.worker:null;const u=t.verbosity,h=typeof t.docBaseUrl=="string"&&!oS(t.docBaseUrl)?t.docBaseUrl:null,p=aS(t.cMapUrl),g=t.cMapPacked!==!1,f=t.CMapReaderFactory||(Ua?LBi:V9e),A=aS(t.iccUrl),m=aS(t.standardFontDataUrl),v=t.StandardFontDataFactory||(Ua?FBi:G9e),y=aS(t.wasmUrl),b=t.WasmFactory||(Ua?OBi:K9e),w=t.stopAtErrors!==!0,x=Number.isInteger(t.maxImageSize)&&t.maxImageSize>-1?t.maxImageSize:-1,M=t.isEvalSupported!==!1,P=typeof t.isOffscreenCanvasSupported=="boolean"?t.isOffscreenCanvasSupported:!Ua,E=typeof t.isImageDecoderSupported=="boolean"?t.isImageDecoderSupported:!Ua&&(Us.platform.isFirefox||!globalThis.chrome),S=Number.isInteger(t.canvasMaxAreaInBytes)?t.canvasMaxAreaInBytes:-1,B=typeof t.disableFontFace=="boolean"?t.disableFontFace:Ua,T=t.fontExtraProperties===!0,_=t.enableXfa===!0,U=t.ownerDocument||globalThis.document,H=t.disableRange===!0,N=t.disableStream===!0,z=t.disableAutoFetch===!0,G=t.pdfBug===!0,$=t.CanvasFactory||(Ua?_Bi:TBi),ae=t.FilterFactory||(Ua?DBi:RBi),le=t.enableHWA===!0,me=t.useWasm!==!1,Ee=l?l.length:t.length??NaN,ie=typeof t.useSystemFonts=="boolean"?t.useSystemFonts:!Ua&&!B,se=typeof t.useWorkerFetch=="boolean"?t.useWorkerFetch:!!(f===V9e&&v===G9e&&b===K9e&&p&&m&&y&&lb(p,document.baseURI)&&lb(m,document.baseURI)&&lb(y,document.baseURI)),re=null;oBi(u);const Y={canvasFactory:new $({ownerDocument:U,enableHWA:le}),filterFactory:new ae({docId:i,ownerDocument:U}),cMapReaderFactory:se?null:new f({baseUrl:p,isCompressed:g}),standardFontDataFactory:se?null:new v({baseUrl:m}),wasmFactory:se?null:new b({baseUrl:y})};d||(d=wq.create({verbosity:u,port:O5.workerPort}),e._worker=d);const ce={docId:i,apiVersion:"5.4.54",data:o,password:a,disableAutoFetch:z,rangeChunkSize:c,length:Ee,docBaseUrl:h,enableXfa:_,evaluatorOptions:{maxImageSize:x,disableFontFace:B,ignoreErrors:w,isEvalSupported:M,isOffscreenCanvasSupported:P,isImageDecoderSupported:E,canvasMaxAreaInBytes:S,fontExtraProperties:T,useSystemFonts:ie,useWasm:me,useWorkerFetch:se,cMapUrl:p,iccUrl:A,standardFontDataUrl:m,wasmUrl:y}},he={ownerDocument:U,pdfBug:G,styleElement:re,loadingParams:{disableAutoFetch:z,enableXfa:_}};return d.promise.then(function(){if(e.destroyed)throw new Error("Loading aborted");if(d.destroyed)throw new Error("Worker was destroyed");const Ae=d.messageHandler.sendWithPromise("GetDocRequest",ce,o?[o.buffer]:null);let xe;if(l)xe=new $Bi(l,{disableRange:H,disableStream:N});else if(!o){if(!r)throw new Error("getDocument - no `url` parameter provided.");const Ne=lb(r)?rIi:Ua?pIi:lIi;xe=new Ne({url:r,length:Ee,httpHeaders:n,withCredentials:s,rangeChunkSize:c,disableRange:H,disableStream:N})}return Ae.then(Ne=>{if(e.destroyed)throw new Error("Loading aborted");if(d.destroyed)throw new Error("Worker was destroyed");const ee=new db(i,Ne,d.port),W=new yIi(ee,e,xe,he,Y,le);e._transport=W,ee.send("Ready",null)})}).catch(e._capability.reject),e}class CQ{static#e=0;_capability=Promise.withResolvers();_transport=null;_worker=null;docId=`d${CQ.#e++}`;destroyed=!1;onPassword=null;onProgress=null;get promise(){return this._capability.promise}async destroy(){this.destroyed=!0;try{this._worker?.port&&(this._worker._pendingDestroy=!0),await this._transport?.destroy()}catch(e){throw this._worker?.port&&delete this._worker._pendingDestroy,e}this._transport=null,this._worker?.destroy(),this._worker=null}async getData(){return this._transport.getData()}}class h7e{#e=Promise.withResolvers();#t=[];#i=[];#r=[];#n=[];constructor(e,i,r=!1,o=null){this.length=e,this.initialData=i,this.progressiveDone=r,this.contentDispositionFilename=o}addRangeListener(e){this.#n.push(e)}addProgressListener(e){this.#r.push(e)}addProgressiveReadListener(e){this.#i.push(e)}addProgressiveDoneListener(e){this.#t.push(e)}onDataRange(e,i){for(const r of this.#n)r(e,i)}onDataProgress(e,i){this.#e.promise.then(()=>{for(const r of this.#r)r(e,i)})}onDataProgressiveRead(e){this.#e.promise.then(()=>{for(const i of this.#i)i(e)})}onDataProgressiveDone(){this.#e.promise.then(()=>{for(const e of this.#t)e()})}transportReady(){this.#e.resolve()}requestDataRange(e,i){mo("Abstract method PDFDataRangeTransport.requestDataRange")}abort(){}}class vIi{constructor(e,i){this._pdfInfo=e,this._transport=i}get annotationStorage(){return this._transport.annotationStorage}get canvasFactory(){return this._transport.canvasFactory}get filterFactory(){return this._transport.filterFactory}get numPages(){return this._pdfInfo.numPages}get fingerprints(){return this._pdfInfo.fingerprints}get isPureXfa(){return cr(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()}}class bIi{#e=!1;constructor(e,i,r,o=!1){this._pageIndex=e,this._pageInfo=i,this._transport=r,this._stats=o?new _9e:null,this._pdfBug=o,this.commonObjs=r.commonObjs,this.objs=new c7e,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:n=!1}={}){return new ky({viewBox:this.view,userUnit:this.userUnit,scale:e,rotation:i,offsetX:r,offsetY:o,dontFlip:n})}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 cr(this,"isPureXfa",!!this._transport._htmlForXfa)}async getXfa(){return this._transport._htmlForXfa?.children[this._pageIndex]||null}render({canvasContext:e,canvas:i=e.canvas,viewport:r,intent:o="display",annotationMode:n=i0.ENABLE,transform:s=null,background:a=null,optionalContentConfigPromise:l=null,annotationCanvasMap:c=null,pageColors:d=null,printAnnotationStorage:u=null,isEditing:h=!1}){this._stats?.time("Overall");const p=this._transport.getRenderingIntent(o,n,u,h),{renderingIntent:g,cacheKey:f}=p;this.#e=!1,l||=this._transport.getOptionalContentConfig(g);let A=this._intentStates.get(f);A||(A=Object.create(null),this._intentStates.set(f,A)),A.streamReaderCancelTimeout&&(clearTimeout(A.streamReaderCancelTimeout),A.streamReaderCancelTimeout=null);const m=!!(g&nc.PRINT);A.displayReadyCapability||(A.displayReadyCapability=Promise.withResolvers(),A.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(p));const v=w=>{A.renderTasks.delete(y),m&&(this.#e=!0),this.#t(),w?(y.capability.reject(w),this._abortOperatorList({intentState:A,reason:w instanceof Error?w:new Error(w)})):y.capability.resolve(),this._stats&&(this._stats.timeEnd("Rendering"),this._stats.timeEnd("Overall"),globalThis.Stats?.enabled&&globalThis.Stats.add(this.pageNumber,this._stats))},y=new A6({callback:v,params:{canvas:i,canvasContext:e,viewport:r,transform:s,background:a},objs:this.objs,commonObjs:this.commonObjs,annotationCanvasMap:c,operatorList:A.operatorList,pageIndex:this._pageIndex,canvasFactory:this._transport.canvasFactory,filterFactory:this._transport.filterFactory,useRequestAnimationFrame:!m,pdfBug:this._pdfBug,pageColors:d,enableHWA:this._transport.enableHWA});(A.renderTasks||=new Set).add(y);const b=y.task;return Promise.all([A.displayReadyCapability.promise,l]).then(([w,x])=>{if(this.destroyed){v();return}if(this._stats?.time("Rendering"),!(x.renderingIntent&g))throw new Error("Must use the same `intent`-argument when calling the `PDFPageProxy.render` and `PDFDocumentProxy.getOptionalContentConfig` methods.");y.initializeGraphics({transparency:w,optionalContentConfig:x}),y.operatorListChanged()}).catch(v),b}getOperatorList({intent:e="display",annotationMode:i=i0.ENABLE,printAnnotationStorage:r=null,isEditing:o=!1}={}){function n(){a.operatorList.lastChunk&&(a.opListReadCapability.resolve(a.operatorList),a.renderTasks.delete(l))}const s=this._transport.getRenderingIntent(e,i,r,o,!0);let a=this._intentStates.get(s.cacheKey);a||(a=Object.create(null),this._intentStates.set(s.cacheKey,a));let l;return a.opListReadCapability||(l=Object.create(null),l.operatorListChanged=n,a.opListReadCapability=Promise.withResolvers(),(a.renderTasks||=new Set).add(l),a.operatorList={fnArray:[],argsArray:[],lastChunk:!1,separateAnnots:null},this._stats?.time("Page Request"),this._pumpOperatorList(s)),a.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=>Py.textContent(r));const i=this.streamTextContent(e);return new Promise(function(r,o){function n(){s.read().then(function({value:l,done:c}){if(c){r(a);return}a.lang??=l.lang,Object.assign(a.styles,l.styles),a.items.push(...l.items),n()},o)}const s=i.getReader(),a={items:[],styles:Object.create(null),lang:null};n()})}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(),this.#e=!1,Promise.all(e)}cleanup(e=!1){this.#e=!0;const i=this.#t();return e&&i&&(this._stats&&=new _9e),i}#t(){if(!this.#e||this.destroyed)return!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(),this.#e=!1,!0}_startRenderPage(e,i){const r=this._intentStates.get(i);r&&(this._stats?.timeEnd("Page Request"),r.displayReadyCapability?.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.#t()}_pumpOperatorList({renderingIntent:e,cacheKey:i,annotationStorageSerializable:r,modifiedIds:o}){const{map:n,transfer:s}=r,a=this._transport.messageHandler.sendWithStream("GetOperatorList",{pageIndex:this._pageIndex,intent:e,cacheKey:i,annotationStorage:n,modifiedIds:o},s).getReader(),l=this._intentStates.get(i);l.streamReader=a;const c=()=>{a.read().then(({value:d,done:u})=>{if(u){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 u of l.renderTasks)u.operatorListChanged();this.#t()}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 sq){let o=AIi;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 r0(i.message)).catch(()=>{}),e.streamReader=null,!this._transport.destroyed){for(const[o,n]of this._intentStates)if(n===e){this._intentStates.delete(o);break}this.cleanup()}}}get stats(){return this._stats}}var s2,Du,o0,U5,yq,j5,H5,Id,hS,p7e,f7e,fb,gb,pS;const Jn=class fy{constructor({name:e=null,port:i=null,verbosity:r=nBi()}={}){if(th(this,Id),th(this,s2,Promise.withResolvers()),th(this,Du,null),th(this,o0,null),th(this,U5,null),this.name=e,this.destroyed=!1,this.verbosity=r,i){if(Qo(fy,H5).has(i))throw new Error("Cannot use more than one PDFWorker per port.");Qo(fy,H5).set(i,this),ih(this,Id,p7e).call(this,i)}else ih(this,Id,f7e).call(this)}get promise(){return Qo(this,s2).promise}get port(){return Qo(this,o0)}get messageHandler(){return Qo(this,Du)}destroy(){this.destroyed=!0,Qo(this,U5)?.terminate(),_l(this,U5,null),Qo(fy,H5).delete(Qo(this,o0)),_l(this,o0,null),Qo(this,Du)?.destroy(),_l(this,Du,null)}static create(e){const i=Qo(this,H5).get(e?.port);if(i){if(i._pendingDestroy)throw new Error("PDFWorker.create - the worker is being destroyed.\nPlease remember to await `PDFDocumentLoadingTask.destroy()`-calls.");return i}return new fy(e)}static get workerSrc(){if(O5.workerSrc)return O5.workerSrc;throw new Error('No "GlobalWorkerOptions.workerSrc" specified.')}static get _setupFakeWorkerGlobal(){return cr(this,"_setupFakeWorkerGlobal",(async()=>Qo(this,gb,pS)?Qo(this,gb,pS):(await import(this.workerSrc)).WorkerMessageHandler)())}};s2=new WeakMap,Du=new WeakMap,o0=new WeakMap,U5=new WeakMap,yq=new WeakMap,j5=new WeakMap,H5=new WeakMap,Id=new WeakSet,hS=function(){Qo(this,s2).resolve(),Qo(this,Du).send("configure",{verbosity:this.verbosity})},p7e=function(t){_l(this,o0,t),_l(this,Du,new db("main","worker",t)),Qo(this,Du).on("ready",()=>{}),ih(this,Id,hS).call(this)},f7e=function(){if(Qo(Jn,j5)||Qo(Jn,gb,pS)){ih(this,Id,fb).call(this);return}let{workerSrc:t}=Jn;try{Jn._isSameOrigin(window.location,t)||(t=Jn._createCDNWrapper(new URL(t,window.location).href));const e=new Worker(t,{type:"module"}),i=new db("main","worker",e),r=()=>{o.abort(),i.destroy(),e.terminate(),this.destroyed?Qo(this,s2).reject(new Error("Worker was destroyed")):ih(this,Id,fb).call(this)},o=new AbortController;e.addEventListener("error",()=>{Qo(this,U5)||r()},{signal:o.signal}),i.on("test",s=>{if(o.abort(),this.destroyed||!s){r();return}_l(this,Du,i),_l(this,o0,e),_l(this,U5,e),ih(this,Id,hS).call(this)}),i.on("ready",s=>{if(o.abort(),this.destroyed){r();return}try{n()}catch{ih(this,Id,fb).call(this)}});const n=()=>{const s=new Uint8Array;i.send("test",s,[s.buffer])};n();return}catch{iS("The worker has been disabled.")}ih(this,Id,fb).call(this)},fb=function(){Qo(Jn,j5)||(Ki("Setting up fake worker."),_l(Jn,j5,!0)),Jn._setupFakeWorkerGlobal.then(t=>{if(this.destroyed){Qo(this,s2).reject(new Error("Worker was destroyed"));return}const e=new IBi;_l(this,o0,e);const i=`fake${mCe(Jn,yq)._++}`,r=new db(i+"_worker",i,e);t.setup(r,e),_l(this,Du,new db(i,i+"_worker",e)),ih(this,Id,hS).call(this)}).catch(t=>{Qo(this,s2).reject(new Error(`Setting up fake worker failed: "${t.message}".`))})},gb=new WeakSet,pS=function(){try{return globalThis.pdfjsWorker?.WorkerMessageHandler||null}catch{return null}},th(Jn,gb),th(Jn,yq,0),th(Jn,j5,!1),th(Jn,H5,new WeakMap),Ua&&(_l(Jn,j5,!0),O5.workerSrc||="./pdf.worker.mjs"),Jn._isSameOrigin=(t,e)=>{const i=URL.parse(t);if(!i?.origin||i.origin==="null")return!1;const r=new URL(e,i);return i.origin===r.origin},Jn._createCDNWrapper=t=>{const e=`await import("${t}");`;return URL.createObjectURL(new Blob([e],{type:"text/javascript"}))},Jn.fromPort=t=>{if(ABi("`PDFWorker.fromPort` - please use `PDFWorker.create` instead."),!t?.port)throw new Error("PDFWorker.fromPort - invalid method signature.");return Jn.create(t)};let wq=Jn;class yIi{#e=new Map;#t=new Map;#i=new Map;#r=new Map;#n=null;constructor(e,i,r,o,n,s){this.messageHandler=e,this.loadingTask=i,this.commonObjs=new c7e,this.fontLoader=new kBi({ownerDocument:o.ownerDocument,styleElement:o.styleElement}),this.loadingParams=o.loadingParams,this._params=o,this.canvasFactory=n.canvasFactory,this.filterFactory=n.filterFactory,this.cMapReaderFactory=n.cMapReaderFactory,this.standardFontDataFactory=n.standardFontDataFactory,this.wasmFactory=n.wasmFactory,this.destroyed=!1,this.destroyCapability=null,this._networkStream=r,this._fullReader=null,this._lastProgress=null,this.downloadInfoCapability=Promise.withResolvers(),this.enableHWA=s,this.setupMessageHandler()}#o(e,i=null){const r=this.#e.get(e);if(r)return r;const o=this.messageHandler.sendWithPromise(e,i);return this.#e.set(e,o),o}get annotationStorage(){return cr(this,"annotationStorage",new uq)}getRenderingIntent(e,i=i0.ENABLE,r=null,o=!1,n=!1){let s=nc.DISPLAY,a=dq;switch(e){case"any":s=nc.ANY;break;case"display":break;case"print":s=nc.PRINT;break;default:Ki(`getRenderingIntent - invalid intent: ${e}`)}const l=s&nc.PRINT&&r instanceof N9e?r:this.annotationStorage;switch(i){case i0.DISABLE:s+=nc.ANNOTATIONS_DISABLE;break;case i0.ENABLE:break;case i0.ENABLE_FORMS:s+=nc.ANNOTATIONS_FORMS;break;case i0.ENABLE_STORAGE:s+=nc.ANNOTATIONS_STORAGE,a=l.serializable;break;default:Ki(`getRenderingIntent - invalid annotationMode: ${i}`)}o&&(s+=nc.IS_EDITING),n&&(s+=nc.OPLIST);const{ids:c,hash:d}=l.modifiedIds,u=[s,a.hash,d];return{renderingIntent:s,cacheKey:u.join("_"),annotationStorageSerializable:a,modifiedIds:c}}destroy(){if(this.destroyCapability)return this.destroyCapability.promise;this.destroyed=!0,this.destroyCapability=Promise.withResolvers(),this.#n?.reject(new Error("Worker was destroyed during onPassword callback"));const e=[];for(const r of this.#t.values())e.push(r._destroy());this.#t.clear(),this.#i.clear(),this.#r.clear(),this.hasOwnProperty("annotationStorage")&&this.annotationStorage.resetModified();const i=this.messageHandler.sendWithPromise("Terminate",null);return e.push(i),Promise.all(e).then(()=>{this.commonObjs.clear(),this.fontLoader.clear(),this.#e.clear(),this.filterFactory.destroy(),Ya.cleanup(),this._networkStream?.cancelAllRequests(new r0("Worker was terminated.")),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)=>{_n(this._networkStream,"GetReader - no `IPDFStream` instance available."),this._fullReader=this._networkStream.getFullReader(),this._fullReader.onProgress=n=>{this._lastProgress={loaded:n.loaded,total:n.total}},o.onPull=()=>{this._fullReader.read().then(function({value:n,done:s}){if(s){o.close();return}_n(n instanceof ArrayBuffer,"GetReader - expected an ArrayBuffer."),o.enqueue(new Uint8Array(n),1,[n])}).catch(n=>{o.error(n)})},o.onCancel=n=>{this._fullReader.cancel(n),o.ready.catch(s=>{if(!this.destroyed)throw s})}}),e.on("ReaderHeadersReady",async r=>{await this._fullReader.headersReady;const{isStreamingSupported:o,isRangeSupported:n,contentLength:s}=this._fullReader;return(!o||!n)&&(this._lastProgress&&i.onProgress?.(this._lastProgress),this._fullReader.onProgress=a=>{i.onProgress?.({loaded:a.loaded,total:a.total})}),{isStreamingSupported:o,isRangeSupported:n,contentLength:s}}),e.on("GetRangeReader",(r,o)=>{_n(this._networkStream,"GetRangeReader - no `IPDFStream` instance available.");const n=this._networkStream.getRangeReader(r.begin,r.end);if(!n){o.close();return}o.onPull=()=>{n.read().then(function({value:s,done:a}){if(a){o.close();return}_n(s instanceof ArrayBuffer,"GetRangeReader - expected an ArrayBuffer."),o.enqueue(new Uint8Array(s),1,[s])}).catch(s=>{o.error(s)})},o.onCancel=s=>{n.cancel(s),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 vIi(r,this))}),e.on("DocException",r=>{i._capability.reject(xl(r))}),e.on("PasswordRequest",r=>{this.#n=Promise.withResolvers();try{if(!i.onPassword)throw xl(r);const o=n=>{n instanceof Error?this.#n.reject(n):this.#n.resolve({password:n})};i.onPassword(o,r.code)}catch(o){this.#n.reject(o)}return this.#n.promise}),e.on("DataLoaded",r=>{i.onProgress?.({loaded:r.length,total:r.length}),this.downloadInfoCapability.resolve(r)}),e.on("StartRenderPage",r=>{this.destroyed||this.#t.get(r.pageIndex)._startRenderPage(r.transparency,r.cacheKey)}),e.on("commonobj",([r,o,n])=>{if(this.destroyed||this.commonObjs.has(r))return null;switch(o){case"Font":if("error"in n){const c=n.error;Ki(`Error during font loading: ${c}`),this.commonObjs.resolve(r,c);break}const s=this._params.pdfBug&&globalThis.FontInspector?.enabled?(c,d)=>globalThis.FontInspector.fontAdded(c,d):null,a=new MBi(n,s);this.fontLoader.bind(a).catch(()=>e.sendWithPromise("FontFallback",{id:r})).finally(()=>{!a.fontExtraProperties&&a.data&&(a.data=null),this.commonObjs.resolve(r,a)});break;case"CopyLocalImage":const{imageRef:l}=n;_n(l,"The imageRef must be defined.");for(const c of this.#t.values())for(const[,d]of c.objs)if(d?.ref===l)return d.dataLen?(this.commonObjs.resolve(r,structuredClone(d)),d.dataLen):null;break;case"FontPath":case"Image":case"Pattern":this.commonObjs.resolve(r,n);break;default:throw new Error(`Got unknown common object type ${o}`)}return null}),e.on("obj",([r,o,n,s])=>{if(this.destroyed)return;const a=this.#t.get(o);if(!a.objs.has(r)){if(a._intentStates.size===0){s?.bitmap?.close();return}switch(n){case"Image":case"Pattern":a.objs.resolve(r,s);break;default:throw new Error(`Got unknown object type ${n}`)}}}),e.on("DocProgress",r=>{this.destroyed||i.onProgress?.({loaded:r.loaded,total:r.total})}),e.on("FetchBinaryData",async r=>{if(this.destroyed)throw new Error("Worker was destroyed.");const o=this[r.type];if(!o)throw new Error(`${r.type} not initialized, see the \`useWorkerFetch\` parameter.`);return o.fetch(r)})}getData(){return this.messageHandler.sendWithPromise("GetData",null)}saveDocument(){this.annotationStorage.size<=0&&Ki("saveDocument called while `annotationStorage` is empty, please use the getData-method instead.");const{map:e,transfer:i}=this.annotationStorage.serializable;return this.messageHandler.sendWithPromise("SaveDocument",{isPureXfa:!!this._htmlForXfa,numPages:this._numPages,annotationStorage:e,filename:this._fullReader?.filename??null},i).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=this.#i.get(i);if(r)return r;const o=this.messageHandler.sendWithPromise("GetPage",{pageIndex:i}).then(n=>{if(this.destroyed)throw new Error("Transport destroyed");n.refStr&&this.#r.set(n.refStr,e);const s=new bIi(i,n,this,this._params.pdfBug);return this.#t.set(i,s),s});return this.#i.set(i,o),o}getPageIndex(e){return hq(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.#o("GetFieldObjects")}hasJSActions(){return this.#o("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.#o("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.#o("GetOptionalContentConfig").then(i=>new YBi(i,e))}getPermissions(){return this.messageHandler.sendWithPromise("GetPermissions",null)}getMetadata(){const e="GetMetadata",i=this.#e.get(e);if(i)return i;const r=this.messageHandler.sendWithPromise(e,null).then(o=>({info:o[0],metadata:o[1]?new JBi(o[1]):null,contentDispositionFilename:this._fullReader?.filename??null,contentLength:this._fullReader?.contentLength??null}));return this.#e.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 this.#t.values())if(!i.cleanup())throw new Error(`startCleanup: Page ${i.pageNumber} is currently rendering.`);this.commonObjs.clear(),e||this.fontLoader.clear(),this.#e.clear(),this.filterFactory.destroy(!0),Ya.cleanup()}}cachedPageNumber(e){if(!hq(e))return null;const i=e.gen===0?`${e.num}R`:`${e.num}R${e.gen}`;return this.#r.get(i)??null}}class wIi{#e=null;onContinue=null;onError=null;constructor(e){this.#e=e}get promise(){return this.#e.capability.promise}cancel(e=0){this.#e.cancel(null,e)}get separateAnnots(){const{separateAnnots:e}=this.#e.operatorList;if(!e)return!1;const{annotationCanvasMap:i}=this.#e;return e.form||e.canvas&&i?.size>0}}class A6{#e=null;static#t=new WeakSet;constructor({callback:e,params:i,objs:r,commonObjs:o,annotationCanvasMap:n,operatorList:s,pageIndex:a,canvasFactory:l,filterFactory:c,useRequestAnimationFrame:d=!1,pdfBug:u=!1,pageColors:h=null,enableHWA:p=!1}){this.callback=e,this.params=i,this.objs=r,this.commonObjs=o,this.annotationCanvasMap=n,this.operatorListIdx=null,this.operatorList=s,this._pageIndex=a,this.canvasFactory=l,this.filterFactory=c,this._pdfBug=u,this.pageColors=h,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 wIi(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.canvas,this._canvasContext=i.canvas?null:i.canvasContext,this._enableHWA=p}get completed(){return this.capability.promise.catch(function(){})}initializeGraphics({transparency:e=!1,optionalContentConfig:i}){if(this.cancelled)return;if(this._canvas){if(A6.#t.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.");A6.#t.add(this._canvas)}this._pdfBug&&globalThis.StepperManager?.enabled&&(this.stepper=globalThis.StepperManager.create(this._pageIndex),this.stepper.init(this.operatorList),this.stepper.nextBreakPoint=this.stepper.getNextBreakPoint());const{viewport:r,transform:o,background:n}=this.params,s=this._canvasContext||this._canvas.getContext("2d",{alpha:!1,willReadFrequently:!this._enableHWA});this.gfx=new m6(s,this.commonObjs,this.objs,this.canvasFactory,this.filterFactory,{optionalContentConfig:i},this.annotationCanvasMap,this.pageColors),this.gfx.beginDrawing({transform:o,viewport:r,transparency:e,background:n}),this.operatorListIdx=0,this.graphicsReady=!0,this.graphicsReadyCallback?.()}cancel(e=null,i=0){this.running=!1,this.cancelled=!0,this.gfx?.endDrawing(),this.#e&&(window.cancelAnimationFrame(this.#e),this.#e=null),A6.#t.delete(this._canvas),e||=new sq(`Rendering cancelled, page ${this._pageIndex+1}`,i),this.callback(e),this.task.onError?.(e)}operatorListChanged(){if(!this.graphicsReady){this.graphicsReadyCallback||=this._continueBound;return}this.stepper?.updateOperatorList(this.operatorList),!this.running&&this._continue()}_continue(){this.running=!0,!this.cancelled&&(this.task.onContinue?this.task.onContinue(this._scheduleNextBound):this._scheduleNext())}_scheduleNext(){this._useRequestAnimationFrame?this.#e=window.requestAnimationFrame(()=>{this.#e=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(),A6.#t.delete(this._canvas),this.callback())))}}const xIi="5.4.54",CIi="295fb3ec4";class Xc{#e=null;#t=null;#i;#r=null;#n=!1;#o=!1;#s=null;#a;#l=null;#c=null;static#h=null;static get _keyboardManager(){return cr(this,"_keyboardManager",new cb([[["Escape","mac+Escape"],Xc.prototype._hideDropdownFromKeyboard],[[" ","mac+ "],Xc.prototype._colorSelectFromKeyboard],[["ArrowDown","ArrowRight","mac+ArrowDown","mac+ArrowRight"],Xc.prototype._moveToNext],[["ArrowUp","ArrowLeft","mac+ArrowUp","mac+ArrowLeft"],Xc.prototype._moveToPrevious],[["Home","mac+Home"],Xc.prototype._moveToBeginning],[["End","mac+End"],Xc.prototype._moveToEnd]]))}constructor({editor:e=null,uiManager:i=null}){e?(this.#o=!1,this.#s=e):this.#o=!0,this.#c=e?._uiManager||i,this.#a=this.#c._eventBus,this.#i=e?.color?.toUpperCase()||this.#c?.highlightColors.values().next().value||"#FFFF98",Xc.#h||=Object.freeze({blue:"pdfjs-editor-colorpicker-blue",green:"pdfjs-editor-colorpicker-green",pink:"pdfjs-editor-colorpicker-pink",red:"pdfjs-editor-colorpicker-red",yellow:"pdfjs-editor-colorpicker-yellow"})}renderButton(){const e=this.#e=document.createElement("button");e.className="colorPicker",e.tabIndex="0",e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-button"),e.ariaHasPopup="true",this.#s&&(e.ariaControls=`${this.#s.id}_colorpicker_dropdown`);const i=this.#c._signal;e.addEventListener("click",this.#f.bind(this),{signal:i}),e.addEventListener("keydown",this.#m.bind(this),{signal:i});const r=this.#t=document.createElement("span");return r.className="swatch",r.ariaHidden="true",r.style.backgroundColor=this.#i,e.append(r),e}renderMainDropdown(){const e=this.#r=this.#d();return e.ariaOrientation="horizontal",e.ariaLabelledBy="highlightColorPickerLabel",e}#d(){const e=document.createElement("div"),i=this.#c._signal;e.addEventListener("contextmenu",Uc,{signal:i}),e.className="dropdown",e.role="listbox",e.ariaMultiSelectable="false",e.ariaOrientation="vertical",e.setAttribute("data-l10n-id","pdfjs-editor-colorpicker-dropdown"),this.#s&&(e.id=`${this.#s.id}_colorpicker_dropdown`);for(const[r,o]of this.#c.highlightColors){const n=document.createElement("button");n.tabIndex="0",n.role="option",n.setAttribute("data-color",o),n.title=r,n.setAttribute("data-l10n-id",Xc.#h[r]);const s=document.createElement("span");n.append(s),s.className="swatch",s.style.backgroundColor=o,n.ariaSelected=o===this.#i,n.addEventListener("click",this.#p.bind(this,o),{signal:i}),e.append(n)}return e.addEventListener("keydown",this.#m.bind(this),{signal:i}),e}#p(e,i){i.stopPropagation(),this.#a.dispatch("switchannotationeditorparams",{source:this,type:Mr.HIGHLIGHT_COLOR,value:e}),this.updateColor(e)}_colorSelectFromKeyboard(e){if(e.target===this.#e){this.#f(e);return}const i=e.target.getAttribute("data-color");i&&this.#p(i,e)}_moveToNext(e){if(!this.#g){this.#f(e);return}if(e.target===this.#e){this.#r.firstChild?.focus();return}e.target.nextSibling?.focus()}_moveToPrevious(e){if(e.target===this.#r?.firstChild||e.target===this.#e){this.#g&&this._hideDropdownFromKeyboard();return}this.#g||this.#f(e),e.target.previousSibling?.focus()}_moveToBeginning(e){if(!this.#g){this.#f(e);return}this.#r.firstChild?.focus()}_moveToEnd(e){if(!this.#g){this.#f(e);return}this.#r.lastChild?.focus()}#m(e){Xc._keyboardManager.exec(this,e)}#f(e){if(this.#g){this.hideDropdown();return}if(this.#n=e.detail===0,this.#l||(this.#l=new AbortController,window.addEventListener("pointerdown",this.#u.bind(this),{signal:this.#c.combinedSignal(this.#l)})),this.#e.ariaExpanded="true",this.#r){this.#r.classList.remove("hidden");return}const i=this.#r=this.#d();this.#e.append(i)}#u(e){this.#r?.contains(e.target)||this.hideDropdown()}hideDropdown(){this.#r?.classList.add("hidden"),this.#e.ariaExpanded="false",this.#l?.abort(),this.#l=null}get#g(){return this.#r&&!this.#r.classList.contains("hidden")}_hideDropdownFromKeyboard(){if(!this.#o){if(!this.#g){this.#s?.unselect();return}this.hideDropdown(),this.#e.focus({preventScroll:!0,focusVisible:this.#n})}}updateColor(e){if(this.#t&&(this.#t.style.backgroundColor=e),!this.#r)return;const i=this.#c.highlightColors.values();for(const r of this.#r.children)r.ariaSelected=i.next().value===e.toUpperCase()}destroy(){this.#e?.remove(),this.#e=null,this.#t=null,this.#r?.remove(),this.#r=null}}class Ly{#e=null;#t=null;#i=null;static#r=null;constructor(e){this.#t=e,this.#i=e._uiManager,Ly.#r||=Object.freeze({freetext:"pdfjs-editor-color-picker-free-text-input",ink:"pdfjs-editor-color-picker-ink-input"})}renderButton(){if(this.#e)return this.#e;const{editorType:e,colorType:i,colorValue:r}=this.#t,o=this.#e=document.createElement("input");return o.type="color",o.value=r||"#000000",o.className="basicColorPicker",o.tabIndex=0,o.setAttribute("data-l10n-id",Ly.#r[e]),o.addEventListener("input",()=>{this.#i.updateParams(i,o.value)},{signal:this.#i._signal}),o}update(e){this.#e&&(this.#e.value=e)}destroy(){this.#e?.remove(),this.#e=null}hideDropdown(){}}function g7e(t){return Math.floor(Math.max(0,Math.min(1,t))*255).toString(16).padStart(2,"0")}function mb(t){return Math.max(0,Math.min(255,255*t))}class m7e{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=mb(e),[e,e,e]}static G_HTML([e]){const i=g7e(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(mb)}static RGB_HTML(e){return`#${e.map(g7e).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[mb(1-Math.min(1,e+o)),mb(1-Math.min(1,r+o)),mb(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,n=1-i,s=1-r,a=Math.min(o,n,s);return["CMYK",o,n,s,a]}}class kIi{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){mo("Abstract method `_createSVG` called.")}}class fS extends kIi{_createSVG(e){return document.createElementNS(c1,e)}}class A7e{static setupStorage(e,i,r,o,n){const s=o.getValue(i,{value:null});switch(r.name){case"textarea":if(s.value!==null&&(e.textContent=s.value),n==="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(s.value===r.attributes.xfaOn?e.setAttribute("checked",!0):s.value===r.attributes.xfaOff&&e.removeAttribute("checked"),n==="print")break;e.addEventListener("change",a=>{o.setValue(i,{value:a.target.checked?a.target.getAttribute("xfaOn"):a.target.getAttribute("xfaOff")})})}else{if(s.value!==null&&e.setAttribute("value",s.value),n==="print")break;e.addEventListener("input",a=>{o.setValue(i,{value:a.target.value})})}break;case"select":if(s.value!==null){e.setAttribute("value",s.value);for(const a of r.children)a.attributes.value===s.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:n}){const{attributes:s}=i,a=e instanceof HTMLAnchorElement;s.type==="radio"&&(s.name=`${s.name}-${o}`);for(const[l,c]of Object.entries(s))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&&n.addLinkAttributes(e,s.href,s.newWindow),r&&s.dataId&&this.setupStorage(e,s.dataId,i,r)}static render(e){const i=e.annotationStorage,r=e.linkService,o=e.xfaHtml,n=e.intent||"display",s=document.createElement(o.name);o.attributes&&this.setAttributes({html:s,element:o,intent:n,linkService:r});const a=n!=="richText",l=e.div;if(l.append(s),e.viewport){const u=`matrix(${e.viewport.transform.join(",")})`;l.style.transform=u}a&&l.setAttribute("class","xfaLayer xfaFont");const c=[];if(o.children.length===0){if(o.value){const u=document.createTextNode(o.value);s.append(u),a&&Py.shouldBuildText(o.name)&&c.push(u)}return{textDivs:c}}const d=[[o,-1,s]];for(;d.length>0;){const[u,h,p]=d.at(-1);if(h+1===u.children.length){d.pop();continue}const g=u.children[++d.at(-1)[1]];if(g===null)continue;const{name:f}=g;if(f==="#text"){const m=document.createTextNode(g.value);c.push(m),p.append(m);continue}const A=g?.attributes?.xmlns?document.createElementNS(g.attributes.xmlns,f):document.createElement(f);if(p.append(A),g.attributes&&this.setAttributes({html:A,element:g,storage:i,intent:n,linkService:r}),g.children?.length>0)d.push([g,-1,A]);else if(g.value){const m=document.createTextNode(g.value);a&&Py.shouldBuildText(f)&&c.push(m),A.append(m)}}for(const u of l.querySelectorAll(".xfaNonInteractive input, .xfaNonInteractive textarea"))u.setAttribute("readOnly",!0);return{textDivs:c}}static update(e){const i=`matrix(${e.viewport.transform.join(",")})`;e.div.style.transform=i,e.div.hidden=!1}}const MIi=9,a2=new WeakSet,PIi=new Date().getTimezoneOffset()*60*1e3;class v7e{static create(e){switch(e.data.annotationType){case Dn.LINK:return new xq(e);case Dn.TEXT:return new EIi(e);case Dn.WIDGET:switch(e.data.fieldType){case"Tx":return new SIi(e);case"Btn":return e.data.radioButton?new b7e(e):e.data.checkBox?new IIi(e):new TIi(e);case"Ch":return new RIi(e);case"Sig":return new BIi(e)}return new l2(e);case Dn.POPUP:return new Cq(e);case Dn.FREETEXT:return new y7e(e);case Dn.LINE:return new _Ii(e);case Dn.SQUARE:return new LIi(e);case Dn.CIRCLE:return new FIi(e);case Dn.POLYLINE:return new w7e(e);case Dn.CARET:return new NIi(e);case Dn.INK:return new kq(e);case Dn.POLYGON:return new OIi(e);case Dn.HIGHLIGHT:return new x7e(e);case Dn.UNDERLINE:return new UIi(e);case Dn.SQUIGGLY:return new jIi(e);case Dn.STRIKEOUT:return new HIi(e);case Dn.STAMP:return new C7e(e);case Dn.FILEATTACHMENT:return new VIi(e);default:return new Cn(e)}}}class Cn{#e=null;#t=!1;#i=null;constructor(e,{isRenderable:i=!1,ignoreBorder:r=!1,createQuadrilaterals:o=!1}={}){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({contentsObj:e,richText:i}){return!!(e?.str||i?.str)}get _isEditable(){return this.data.isEditable}get hasPopupData(){return Cn._hasPopupData(this.data)}updateEdited(e){if(!this.container)return;e.rect&&(this.#e||={rect:this.data.rect.slice(0)});const{rect:i,popup:r}=e;i&&this.#r(i);let o=this.#i?.popup||this.popup;!o&&r?.text&&(this._createPopup(r),o=this.#i.popup),o&&(o.updateEdited(e),r?.deleted&&(o.remove(),this.#i=null,this.popup=null))}resetEdited(){this.#e&&(this.#r(this.#e.rect),this.#i?.popup.resetEdited(),this.#e=null)}#r(e){const{container:{style:i},data:{rect:r,rotation:o},parent:{viewport:{rawDims:{pageWidth:n,pageHeight:s,pageX:a,pageY:l}}}}=this;r?.splice(0,4,...e),i.left=`${100*(e[0]-a)/n}%`,i.top=`${100*(s-e[3]+l)/s}%`,o===0?(i.width=`${100*(e[2]-e[0])/n}%`,i.height=`${100*(e[3]-e[1])/s}%`):this.setRotation(o)}_createContainer(e){const{data:i,parent:{page:r,viewport:o}}=this,n=document.createElement("section");n.setAttribute("data-annotation-id",i.id),!(this instanceof l2)&&!(this instanceof xq)&&(n.tabIndex=0);const{style:s}=n;if(s.zIndex=this.parent.zIndex++,i.alternativeText&&(n.title=i.alternativeText),i.noRotate&&n.classList.add("norotate"),!i.rect||this instanceof Cq){const{rotation:f}=i;return!i.hasOwnCanvas&&f!==0&&this.setRotation(f,n),n}const{width:a,height:l}=this;if(!e&&i.borderStyle.width>0){s.borderWidth=`${i.borderStyle.width}px`;const f=i.borderStyle.horizontalCornerRadius,A=i.borderStyle.verticalCornerRadius;if(f>0||A>0){const v=`calc(${f}px * var(--total-scale-factor)) / calc(${A}px * var(--total-scale-factor))`;s.borderRadius=v}else if(this instanceof b7e){const v=`calc(${a}px * var(--total-scale-factor)) / calc(${l}px * var(--total-scale-factor))`;s.borderRadius=v}switch(i.borderStyle.style){case _5.SOLID:s.borderStyle="solid";break;case _5.DASHED:s.borderStyle="dashed";break;case _5.BEVELED:Ki("Unimplemented border style: beveled");break;case _5.INSET:Ki("Unimplemented border style: inset");break;case _5.UNDERLINE:s.borderBottomStyle="solid";break}const m=i.borderColor||null;m?(this.#t=!0,s.borderColor=bi.makeHexColor(m[0]|0,m[1]|0,m[2]|0)):s.borderWidth=0}const c=bi.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:u,pageX:h,pageY:p}=o.rawDims;s.left=`${100*(c[0]-h)/d}%`,s.top=`${100*(c[1]-p)/u}%`;const{rotation:g}=i;return i.hasOwnCanvas||g===0?(s.width=`${100*a/d}%`,s.height=`${100*l/u}%`):this.setRotation(g,n),n}setRotation(e,i=this.container){if(!this.data.rect)return;const{pageWidth:r,pageHeight:o}=this.parent.viewport.rawDims;let{width:n,height:s}=this;e%180!==0&&([n,s]=[s,n]),i.style.width=`${100*n/r}%`,i.style.height=`${100*s/o}%`,i.setAttribute("data-main-rotation",(360-e)%360)}get _commonActions(){const e=(i,r,o)=>{const n=o.detail[i],s=n[0],a=n.slice(1);o.target.style[r]=m7e[`${s}_HTML`](a),this.annotationStorage.setValue(this.data.id,{[r]:m7e[`${s}_rgb`](a)})};return cr(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))(e[o]||r[o])?.(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,n]of Object.entries(i)){const s=r[o];if(s){const a={detail:{[o]:n},target:e};s(a),delete i[o]}}}_createQuadrilaterals(){if(!this.container)return;const{quadPoints:e}=this.data;if(!e)return;const[i,r,o,n]=this.data.rect.map(f=>Math.fround(f));if(e.length===8){const[f,A,m,v]=e.subarray(2,6);if(o===f&&n===A&&i===m&&r===v)return}const{style:s}=this.container;let a;if(this.#t){const{borderColor:f,borderWidth:A}=s;s.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="${f}" stroke-width="${A}">`],this.container.classList.add("hasBorder")}const l=o-i,c=n-r,{svgFactory:d}=this,u=d.createElement("svg");u.classList.add("quadrilateralsContainer"),u.setAttribute("width",0),u.setAttribute("height",0),u.role="none";const h=d.createElement("defs");u.append(h);const p=d.createElement("clipPath"),g=`clippath_${this.data.id}`;p.setAttribute("id",g),p.setAttribute("clipPathUnits","objectBoundingBox"),h.append(p);for(let f=2,A=e.length;f<A;f+=8){const m=e[f],v=e[f+1],y=e[f+2],b=e[f+3],w=d.createElement("rect"),x=(y-i)/l,M=(n-v)/c,P=(m-y)/l,E=(v-b)/c;w.setAttribute("x",x),w.setAttribute("y",M),w.setAttribute("width",P),w.setAttribute("height",E),p.append(w),a?.push(`<rect vector-effect="non-scaling-stroke" x="${x}" y="${M}" width="${P}" height="${E}"/>`)}this.#t&&(a.push("</g></svg>')"),s.backgroundImage=a.join("")),this.container.append(u),this.container.style.clipPath=`url(#${g})`}_createPopup(e=null){const{data:i}=this;let r,o;e?(r={str:e.text},o=e.date):(r=i.contentsObj,o=i.modificationDate);const n=this.#i=new Cq({data:{color:i.color,titleObj:i.titleObj,modificationDate:o,contentsObj:r,richText:i.richText,parentRect:i.rect,borderStyle:0,id:`popup_${i.id}`,rotation:i.rotation,noRotate:!0},linkService:this.linkService,parent:this.parent,elements:[this]});this.parent.div.append(n.render())}get hasPopupElement(){return!!(this.#i||this.popup||this.data.popupRef)}render(){mo("Abstract method `AnnotationElement.render` called")}_getElementsByName(e,i=null){const r=[];if(this._fieldObjects){const o=this._fieldObjects[e];if(o)for(const{page:n,id:s,exportValues:a}of o){if(n===-1||s===i)continue;const l=typeof a=="string"?a:null,c=document.querySelector(`[data-element-id="${s}"]`);if(c&&!a2.has(c)){Ki(`_getElementsByName - element not allowed: ${s}`);continue}r.push({id:s,exportValue:l,domElement:c})}return r}for(const o of document.getElementsByName(e)){const{exportValue:n}=o,s=o.getAttribute("data-element-id");s!==i&&a2.has(o)&&r.push({id:s,exportValue:n,domElement:o})}return r}show(){this.container&&(this.container.hidden=!1),this.popup?.maybeShow()}hide(){this.container&&(this.container.hidden=!0),this.popup?.forceHide()}getElementsToTriggerPopup(){return this.container}addHighlightArea(){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",()=>{this.linkService.eventBus?.dispatch("switchannotationeditormode",{source:this,mode:e,editId:i,mustEnterInEditMode:!0})})}get width(){return this.data.rect[2]-this.data.rect[0]}get height(){return this.data.rect[3]-this.data.rect[1]}}class xq extends Cn{constructor(e,i=null){super(e,{isRenderable:!0,ignoreBorder:!!i?.ignoreBorder,createQuadrilaterals:!0}),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,e.overlaidText),o=!0):e.attachment?(this.#t(r,e.attachment,e.overlaidText,e.attachmentDest),o=!0):e.setOCGState?(this.#i(r,e.setOCGState,e.overlaidText),o=!0):e.dest?(this._bindLink(r,e.dest,e.overlaidText),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}#e(){this.container.setAttribute("data-internal-link","")}_bindLink(e,i,r=""){e.href=this.linkService.getDestinationHash(i),e.onclick=()=>(i&&this.linkService.goToDestination(i),!1),(i||i==="")&&this.#e(),r&&(e.title=r)}_bindNamedAction(e,i,r=""){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeNamedAction(i),!1),r&&(e.title=r),this.#e()}#t(e,i,r="",o=null){e.href=this.linkService.getAnchorUrl(""),i.description?e.title=i.description:r&&(e.title=r),e.onclick=()=>(this.downloadManager?.openOrDownloadData(i.content,i.filename,o),!1),this.#e()}#i(e,i,r=""){e.href=this.linkService.getAnchorUrl(""),e.onclick=()=>(this.linkService.executeSetOCGState(i),!1),r&&(e.title=r),this.#e()}_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 n=r.get(o);n&&(e[n]=()=>(this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:i.id,name:o}}),!1))}i.overlaidText&&(e.title=i.overlaidText),e.onclick||(e.onclick=()=>!1),this.#e()}_bindResetFormAction(e,i){const r=e.onclick;if(r||(e.href=this.linkService.getAnchorUrl("")),this.#e(),!this._fieldObjects){Ki('_bindResetFormAction - "resetForm" action not supported, ensure that the `fieldObjects` parameter is provided.'),r||(e.onclick=()=>!1);return}e.onclick=()=>{r?.();const{fields:o,refs:n,include:s}=i,a=[];if(o.length!==0||n.length!==0){const d=new Set(n);for(const u of o){const h=this._fieldObjects[u]||[];for(const{id:p}of h)d.add(p)}for(const u of Object.values(this._fieldObjects))for(const h of u)d.has(h.id)===s&&a.push(h)}else for(const d of Object.values(this._fieldObjects))a.push(...d);const l=this.annotationStorage,c=[];for(const d of a){const{id:u}=d;switch(c.push(u),d.type){case"text":{const p=d.defaultValue||"";l.setValue(u,{value:p});break}case"checkbox":case"radiobutton":{const p=d.defaultValue===d.exportValues;l.setValue(u,{value:p});break}case"combobox":case"listbox":{const p=d.defaultValue||"";l.setValue(u,{value:p});break}default:continue}const h=document.querySelector(`[data-element-id="${u}"]`);if(h){if(!a2.has(h)){Ki(`_bindResetFormAction - element not allowed: ${u}`);continue}}else continue;h.dispatchEvent(new Event("resetform"))}return this.enableScripting&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:"app",ids:c,name:"ResetForm"}}),!1}}}class EIi extends Cn{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 l2 extends Cn{render(){return this.container}showElementAndHideCanvas(e){this.data.hasOwnCanvas&&(e.previousSibling?.nodeName==="CANVAS"&&(e.previousSibling.hidden=!0),e.hidden=!1)}_getKeyModifier(e){return Us.platform.isMac?e.metaKey:e.ctrlKey}_setEventListener(e,i,r,o,n){r.includes("mouse")?e.addEventListener(r,s=>{this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:o,value:n(s),shift:s.shiftKey,modifier:this._getKeyModifier(s)}})}):e.addEventListener(r,s=>{if(r==="blur"){if(!i.focused||!s.relatedTarget)return;i.focused=!1}else if(r==="focus"){if(i.focused)return;i.focused=!0}n&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:this.data.id,name:o,value:n(s)}})})}_setEventListeners(e,i,r,o){for(const[n,s]of r)(s==="Action"||this.data.actions?.[s])&&((s==="Focus"||s==="Blur")&&(i||={focused:!1}),this._setEventListener(e,i,n,s,o),s==="Focus"&&!this.data.actions?.Blur?this._setEventListener(e,i,"blur","Blur",null):s==="Blur"&&!this.data.actions?.Focus&&this._setEventListener(e,i,"focus","Focus",null))}_setBackgroundColor(e){const i=this.data.backgroundColor||null;e.style.backgroundColor=i===null?"transparent":bi.makeHexColor(i[0],i[1],i[2])}_setTextStyle(e){const i=["left","center","right"],{fontColor:r}=this.data.defaultAppearanceData,o=this.data.defaultAppearanceData.fontSize||MIi,n=e.style;let s;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/(eq*o))||1,u=c/d;s=Math.min(o,l(u/eq))}else{const c=Math.abs(this.data.rect[3]-this.data.rect[1]-a);s=Math.min(o,l(c/eq))}n.fontSize=`calc(${s}px * var(--total-scale-factor))`,n.color=bi.makeHexColor(r[0],r[1],r[2]),this.data.textAlignment!==null&&(n.textAlign=i[this.data.textAlignment])}_setRequired(e,i){i?e.setAttribute("required",!0):e.removeAttribute("required"),e.setAttribute("aria-required",i)}}class SIi extends l2{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 n=this.annotationStorage;for(const s of this._getElementsByName(e.name,e.id))s.domElement&&(s.domElement[i]=r),n.setValue(s.id,{[o]:r})}render(){const e=this.annotationStorage,i=this.data.id;this.container.classList.add("textWidgetAnnotation");let r=null;if(this.renderForms){const o=e.getValue(i,{value:this.data.fieldValue});let n=o.value||"";const s=e.getValue(i,{charLimit:this.data.maxLen}).charLimit;s&&n.length>s&&(n=n.slice(0,s));let a=o.formattedValue||this.data.textContent?.join(`
|
|
5528
5528
|
`)||null;a&&this.data.comb&&(a=a.replaceAll(/\s+/g,""));const l={userValue:n,formattedValue:a,lastCommittedValue:null,commitKey:1,focused:!1};this.data.multiLine?(r=document.createElement("textarea"),r.textContent=a??n,this.data.doNotScroll&&(r.style.overflowY="hidden")):(r=document.createElement("input"),r.type=this.data.password?"password":"text",r.setAttribute("value",a??n),this.data.doNotScroll&&(r.style.overflowX="hidden")),this.data.hasOwnCanvas&&(r.hidden=!0),a2.add(r),r.setAttribute("data-element-id",i),r.disabled=this.data.readOnly,r.name=this.data.fieldName,r.tabIndex=0;const{datetimeFormat:c,datetimeType:d,timeStep:u}=this.data,h=!!d&&this.enableScripting;c&&(r.title=c),this._setRequired(r,this.data.required),s&&(r.maxLength=s),r.addEventListener("input",g=>{e.setValue(i,{value:g.target.value}),this.setPropertyOnSiblings(r,"value",g.target.value,"value"),l.formattedValue=null}),r.addEventListener("resetform",g=>{const f=this.data.defaultFieldValue??"";r.value=l.userValue=f,l.formattedValue=null});let p=g=>{const{formattedValue:f}=l;f!=null&&(g.target.value=f),g.target.scrollLeft=0};if(this.enableScripting&&this.hasJSActions){r.addEventListener("focus",f=>{if(l.focused)return;const{target:A}=f;if(h&&(A.type=d,u&&(A.step=u)),l.userValue){const m=l.userValue;if(h)if(d==="time"){const v=new Date(m),y=[v.getHours(),v.getMinutes(),v.getSeconds()];A.value=y.map(b=>b.toString().padStart(2,"0")).join(":")}else A.value=new Date(m-PIi).toISOString().split(d==="date"?"T":".",1)[0];else A.value=m}l.lastCommittedValue=A.value,l.commitKey=1,this.data.actions?.Focus||(l.focused=!0)}),r.addEventListener("updatefromsandbox",f=>{this.showElementAndHideCanvas(f.target);const A={value(m){l.userValue=m.detail.value??"",h||e.setValue(i,{value:l.userValue.toString()}),m.target.value=l.userValue},formattedValue(m){const{formattedValue:v}=m.detail;l.formattedValue=v,v!=null&&m.target!==document.activeElement&&(m.target.value=v);const y={formattedValue:v};h&&(y.value=v),e.setValue(i,y)},selRange(m){m.target.setSelectionRange(...m.detail.selRange)},charLimit:m=>{const{charLimit:v}=m.detail,{target:y}=m;if(v===0){y.removeAttribute("maxLength");return}y.setAttribute("maxLength",v);let b=l.userValue;!b||b.length<=v||(b=b.slice(0,v),y.value=l.userValue=b,e.setValue(i,{value:b}),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:i,name:"Keystroke",value:b,willCommit:!0,commitKey:1,selStart:y.selectionStart,selEnd:y.selectionEnd}}))}};this._dispatchEventFromSandbox(A,f)}),r.addEventListener("keydown",f=>{l.commitKey=1;let A=-1;if(f.key==="Escape"?A=0:f.key==="Enter"&&!this.data.multiLine?A=2:f.key==="Tab"&&(l.commitKey=3),A===-1)return;const{value:m}=f.target;l.lastCommittedValue!==m&&(l.lastCommittedValue=m,l.userValue=m,this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:i,name:"Keystroke",value:m,willCommit:!0,commitKey:A,selStart:f.target.selectionStart,selEnd:f.target.selectionEnd}}))});const g=p;p=null,r.addEventListener("blur",f=>{if(!l.focused||!f.relatedTarget)return;this.data.actions?.Blur||(l.focused=!1);const{target:A}=f;let{value:m}=A;if(h){if(m&&d==="time"){const v=m.split(":").map(y=>parseInt(y,10));m=new Date(2e3,0,1,v[0],v[1],v[2]||0).valueOf(),A.step=""}else m=new Date(m).valueOf();A.type="text"}l.userValue=m,l.lastCommittedValue!==m&&this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:i,name:"Keystroke",value:m,willCommit:!0,commitKey:l.commitKey,selStart:f.target.selectionStart,selEnd:f.target.selectionEnd}}),g(f)}),this.data.actions?.Keystroke&&r.addEventListener("beforeinput",f=>{l.lastCommittedValue=null;const{data:A,target:m}=f,{value:v,selectionStart:y,selectionEnd:b}=m;let w=y,x=b;switch(f.inputType){case"deleteWordBackward":{const M=v.substring(0,y).match(/\w*[^\w]*$/);M&&(w-=M[0].length);break}case"deleteWordForward":{const M=v.substring(y).match(/^[^\w]*\w*/);M&&(x+=M[0].length);break}case"deleteContentBackward":y===b&&(w-=1);break;case"deleteContentForward":y===b&&(x+=1);break}f.preventDefault(),this.linkService.eventBus?.dispatch("dispatcheventinsandbox",{source:this,detail:{id:i,name:"Keystroke",value:v,change:A||"",willCommit:!1,selStart:w,selEnd:x}})}),this._setEventListeners(r,l,[["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],f=>f.target.value)}if(p&&r.addEventListener("blur",p),this.data.comb){const g=(this.data.rect[2]-this.data.rect[0])/s;r.classList.add("comb"),r.style.letterSpacing=`calc(${g}px * var(--total-scale-factor) - 1ch)`}}else r=document.createElement("div"),r.textContent=this.data.fieldValue,r.style.verticalAlign="middle",r.style.display="table-cell",this.data.hasOwnCanvas&&(r.hidden=!0);return this._setTextStyle(r),this._setBackgroundColor(r),this._setDefaultPropertiesFromJS(r),this.container.append(r),this.container}}class BIi extends l2{constructor(e){super(e,{isRenderable:!!e.data.hasOwnCanvas})}}class IIi extends l2{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 n=document.createElement("input");return a2.add(n),n.setAttribute("data-element-id",r),n.disabled=i.readOnly,this._setRequired(n,this.data.required),n.type="checkbox",n.name=i.fieldName,o&&n.setAttribute("checked",!0),n.setAttribute("exportValue",i.exportValue),n.tabIndex=0,n.addEventListener("change",s=>{const{name:a,checked:l}=s.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})}),n.addEventListener("resetform",s=>{const a=i.defaultFieldValue||"Off";s.target.checked=a===i.exportValue}),this.enableScripting&&this.hasJSActions&&(n.addEventListener("updatefromsandbox",s=>{const a={value(l){l.target.checked=l.detail.value!=="Off",e.setValue(r,{value:l.target.checked})}};this._dispatchEventFromSandbox(a,s)}),this._setEventListeners(n,null,[["change","Validate"],["change","Action"],["focus","Focus"],["blur","Blur"],["mousedown","Mouse Down"],["mouseenter","Mouse Enter"],["mouseleave","Mouse Exit"],["mouseup","Mouse Up"]],s=>s.target.checked)),this._setBackgroundColor(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class b7e extends l2{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 s of this._getElementsByName(i.fieldName,r))e.setValue(s.id,{value:!1});const n=document.createElement("input");if(a2.add(n),n.setAttribute("data-element-id",r),n.disabled=i.readOnly,this._setRequired(n,this.data.required),n.type="radio",n.name=i.fieldName,o&&n.setAttribute("checked",!0),n.tabIndex=0,n.addEventListener("change",s=>{const{name:a,checked:l}=s.target;for(const c of this._getElementsByName(a,r))e.setValue(c.id,{value:!1});e.setValue(r,{value:l})}),n.addEventListener("resetform",s=>{const a=i.defaultFieldValue;s.target.checked=a!=null&&a===i.buttonValue}),this.enableScripting&&this.hasJSActions){const s=i.buttonValue;n.addEventListener("updatefromsandbox",a=>{const l={value:c=>{const d=s===c.detail.value;for(const u of this._getElementsByName(c.target.name)){const h=d&&u.id===r;u.domElement&&(u.domElement.checked=h),e.setValue(u.id,{value:h})}}};this._dispatchEventFromSandbox(l,a)}),this._setEventListeners(n,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(n),this._setDefaultPropertiesFromJS(n),this.container.append(n),this.container}}class TIi extends xq{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 RIi extends l2{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");a2.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=0;let n=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 u=this.data.defaultFieldValue;for(const h of o.options)h.selected=h.value===u});for(const d of this.data.options){const u=document.createElement("option");u.textContent=d.displayValue,u.value=d.exportValue,r.value.includes(d.exportValue)&&(u.setAttribute("selected",!0),n=!1),o.append(u)}let s=null;if(n){const d=document.createElement("option");d.value=" ",d.setAttribute("hidden",!0),d.setAttribute("selected",!0),o.prepend(d),s=()=>{d.remove(),o.removeEventListener("input",s),s=null},o.addEventListener("input",s)}const a=d=>{const u=d?"value":"textContent",{options:h,multiple:p}=o;return p?Array.prototype.filter.call(h,g=>g.selected).map(g=>g[u]):h.selectedIndex===-1?null:h[h.selectedIndex][u]};let l=a(!1);const c=d=>{const u=d.target.options;return Array.prototype.map.call(u,h=>({displayValue:h.textContent,exportValue:h.value}))};return this.enableScripting&&this.hasJSActions?(o.addEventListener("updatefromsandbox",d=>{const u={value(h){s?.();const p=h.detail.value,g=new Set(Array.isArray(p)?p:[p]);for(const f of o.options)f.selected=g.has(f.value);e.setValue(i,{value:a(!0)}),l=a(!1)},multipleSelection(h){o.multiple=!0},remove(h){const p=o.options,g=h.detail.remove;p[g].selected=!1,o.remove(g),p.length>0&&Array.prototype.findIndex.call(p,f=>f.selected)===-1&&(p[0].selected=!0),e.setValue(i,{value:a(!0),items:c(h)}),l=a(!1)},clear(h){for(;o.length!==0;)o.remove(0);e.setValue(i,{value:null,items:[]}),l=a(!1)},insert(h){const{index:p,displayValue:g,exportValue:f}=h.detail.insert,A=o.children[p],m=document.createElement("option");m.textContent=g,m.value=f,A?A.before(m):o.append(m),e.setValue(i,{value:a(!0),items:c(h)}),l=a(!1)},items(h){const{items:p}=h.detail;for(;o.length!==0;)o.remove(0);for(const g of p){const{displayValue:f,exportValue:A}=g,m=document.createElement("option");m.textContent=f,m.value=A,o.append(m)}o.options.length>0&&(o.options[0].selected=!0),e.setValue(i,{value:a(!0),items:c(h)}),l=a(!1)},indices(h){const p=new Set(h.detail.indices);for(const g of h.target.options)g.selected=p.has(g.index);e.setValue(i,{value:a(!0)}),l=a(!1)},editable(h){h.target.disabled=!h.detail.editable}};this._dispatchEventFromSandbox(u,d)}),o.addEventListener("input",d=>{const u=a(!0),h=a(!1);e.setValue(i,{value:u}),d.preventDefault(),this.linkService.eventBus?.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 Cq extends Cn{constructor(e){const{data:i,elements:r}=e;super(e,{isRenderable:Cn._hasPopupData(i)}),this.elements=r,this.popup=null}render(){const{container:e}=this;e.classList.add("popupAnnotation"),e.role="comment";const i=this.popup=new DIi({container:this.container,color:this.data.color,titleObj:this.data.titleObj,modificationDate:this.data.modificationDate||this.data.creationDate,contentsObj:this.data.contentsObj,richText:this.data.richText,rect:this.data.rect,parentRect:this.data.parentRect||null,parent:this.parent,elements:this.elements,open:this.data.open}),r=[];for(const o of this.elements)o.popup=i,o.container.ariaHasPopup="dialog",r.push(o.data.id),o.addHighlightArea();return this.container.setAttribute("aria-controls",r.map(o=>`${nq}${o}`).join(",")),this.container}}class DIi{#e=this.#I.bind(this);#t=this.#R.bind(this);#i=this.#P.bind(this);#r=this.#E.bind(this);#n=null;#o=null;#s=null;#a=null;#l=null;#c=null;#h=null;#d=!1;#p=null;#m=null;#f=null;#u=null;#g=null;#b=null;#A=null;#w=!1;constructor({container:e,color:i,elements:r,titleObj:o,modificationDate:n,contentsObj:s,richText:a,parent:l,rect:c,parentRect:d,open:u}){this.#o=e,this.#b=o,this.#s=s,this.#g=a,this.#c=l,this.#n=i,this.#u=c,this.#h=d,this.#l=r,this.#a=lq.toDateObject(n),this.trigger=r.flatMap(h=>h.getElementsToTriggerPopup()),this.#x(),this.#o.hidden=!0,u&&this.#E()}#x(){if(this.#m)return;this.#m=new AbortController;const{signal:e}=this.#m;for(const i of this.trigger)i.addEventListener("click",this.#r,{signal:e}),i.addEventListener("mouseenter",this.#i,{signal:e}),i.addEventListener("mouseleave",this.#t,{signal:e}),i.classList.add("popupTriggerArea");for(const i of this.#l)i.container?.addEventListener("keydown",this.#e,{signal:e})}render(){if(this.#p)return;const e=this.#p=document.createElement("div");if(e.className="popup",this.#n){const o=e.style.outlineColor=bi.makeHexColor(...this.#n);e.style.backgroundColor=`color-mix(in srgb, ${o} 30%, white)`}const i=document.createElement("span");if(i.className="header",this.#b?.str){const o=document.createElement("span");o.className="title",i.append(o),{dir:o.dir,str:o.textContent}=this.#b}if(e.append(i),this.#a){const o=document.createElement("time");o.className="popupDate",o.setAttribute("data-l10n-id","pdfjs-annotation-date-time-string"),o.setAttribute("data-l10n-args",JSON.stringify({dateObj:this.#a.valueOf()})),o.dateTime=this.#a.toISOString(),i.append(o)}const r=this.#v;if(r)A7e.render({xfaHtml:r,intent:"richText",div:e}),e.lastChild.classList.add("richText","popupContent");else{const o=this._formatContents(this.#s);e.append(o)}this.#o.append(e)}get#v(){const e=this.#g,i=this.#s;return e?.str&&(!i?.str||i.str===e.str)&&this.#g.html||null}get#k(){return this.#v?.attributes?.style?.fontSize||0}get#B(){return this.#v?.attributes?.style?.color||null}#C(e){const i=[],r={str:e,html:{name:"div",attributes:{dir:"auto"},children:[{name:"p",children:i}]}},o={style:{color:this.#B,fontSize:this.#k?`calc(${this.#k}px * var(--total-scale-factor))`:""}};for(const n of e.split(`
|